mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
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:
parent
1e589ed264
commit
e2c2060f7b
@ -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");
|
||||
|
1
test/TEST-21-SYSUSERS/test-4.expected-group
Normal file
1
test/TEST-21-SYSUSERS/test-4.expected-group
Normal file
@ -0,0 +1 @@
|
||||
xxx:x:310:
|
2
test/TEST-21-SYSUSERS/test-4.expected-passwd
Normal file
2
test/TEST-21-SYSUSERS/test-4.expected-passwd
Normal file
@ -0,0 +1,2 @@
|
||||
yyy:x:311:310::/:/sbin/nologin
|
||||
xxx:x:312:310::/:/sbin/nologin
|
3
test/TEST-21-SYSUSERS/test-4.input
Normal file
3
test/TEST-21-SYSUSERS/test-4.input
Normal file
@ -0,0 +1,3 @@
|
||||
g xxx 310
|
||||
u yyy 311:310
|
||||
u xxx 312:310
|
Loading…
Reference in New Issue
Block a user