userdb: fix enumeration of .membership files

The man page nss-systemd(8) says

> The contents of these files are currently not read, and the files
> should be created empty.

But previously we filtered out such files, as the CONF_FILES_FILTER_MASKED
flag checks if a file is empty (or symlink to null), thus any empty files
were ignored.

To accept empty .membership files, let's use CONF_FILES_FILTER_MASKED_BY_SYMLINK.

Fixes #37945.
This commit is contained in:
Yu Watanabe
2025-06-26 09:42:16 +09:00
parent e93d8c844c
commit d6570eafe3

View File

@@ -1669,7 +1669,7 @@ static void discover_membership_dropins(UserDBIterator *i, UserDBFlags flags) {
&i->dropins,
".membership",
NULL,
CONF_FILES_REGULAR|CONF_FILES_BASENAME|CONF_FILES_FILTER_MASKED,
CONF_FILES_REGULAR|CONF_FILES_BASENAME|CONF_FILES_FILTER_MASKED_BY_SYMLINK,
USERDB_DROPIN_DIR_NULSTR("userdb"));
if (r < 0)
log_debug_errno(r, "Failed to find membership drop-ins, ignoring: %m");