summaryrefslogtreecommitdiffstats
path: root/src/sysusers
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysusers')
-rw-r--r--src/sysusers/sysusers.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 5fe3b0c..7758267 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -1448,9 +1448,15 @@ static int process_item(Context *c, Item *i) {
case ADD_USER: {
Item *j = NULL;
- if (!i->gid_set)
+ if (!i->gid_set) {
j = ordered_hashmap_get(c->groups, i->group_name ?: i->name);
+ /* If that's not a match, also check if the group name
+ * matches a user name in the queue. */
+ if (!j && i->group_name)
+ j = ordered_hashmap_get(c->users, i->group_name);
+ }
+
if (j && j->todo_group) {
/* When a group with the target name is already in queue,
* use the information about the group and do not create