sysusers: make ADD_GROUP always create a group

Do not merge group creation with user creation because with the
new uid:gid syntax this can result in confusing (and unwanted)
behavior.
This commit is contained in:
Michael Vogt 2018-01-24 11:46:10 +01:00
parent 1e589ed264
commit e2c2060f7b
4 changed files with 7 additions and 23 deletions

View file

@ -1188,30 +1188,8 @@ static int process_item(Item *i) {
return add_user(i);
case ADD_GROUP: {
Item *j;
j = ordered_hashmap_get(users, i->name);
if (j) {
/* There's already user to be created for this
* name, let's process that in one step */
if (i->gid_set) {
j->gid = i->gid;
j->gid_set = true;
}
if (i->gid_path) {
r = free_and_strdup(&j->gid_path, i->gid_path);
if (r < 0)
return log_oom();
}
return 0;
}
case ADD_GROUP:
return add_group(i);
}
default:
assert_not_reached("Unknown item type");

View file

@ -0,0 +1 @@
xxx:x:310:

View file

@ -0,0 +1,2 @@
yyy:x:311:310::/:/sbin/nologin
xxx:x:312:310::/:/sbin/nologin

View file

@ -0,0 +1,3 @@
g xxx 310
u yyy 311:310
u xxx 312:310