]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
user-record: make a NULL UserDBMatch be equivalent to no filtering 36141/head
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Jan 2025 15:24:17 +0000 (16:24 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 23 Jan 2025 20:32:12 +0000 (21:32 +0100)
src/shared/group-record.c
src/shared/user-record.c

index 3aa26657185ff24cec98542b9c299f641feb7810..6d696bdaaa33ca0e28d0c09d4f0a6c021476092a 100644 (file)
@@ -346,7 +346,9 @@ bool group_record_matches_group_name(const GroupRecord *g, const char *group_nam
 
 int group_record_match(GroupRecord *h, const UserDBMatch *match) {
         assert(h);
-        assert(match);
+
+        if (!match)
+                return true;
 
         if (h->gid < match->gid_min || h->gid > match->gid_max)
                 return false;
index 9feac30933ff9b341d15fd61bd2cdd9fa57b01bc..ebdbb28065ec7b789c018d2cda35ac9251cde33c 100644 (file)
@@ -2694,7 +2694,9 @@ bool user_name_fuzzy_match(const char *names[], size_t n_names, char **matches)
 
 int user_record_match(UserRecord *u, const UserDBMatch *match) {
         assert(u);
-        assert(match);
+
+        if (!match)
+                return true;
 
         if (u->uid < match->uid_min || u->uid > match->uid_max)
                 return false;