]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysusers: make ADD_GROUP always create a group
authorMichael Vogt <mvo@ubuntu.com>
Wed, 24 Jan 2018 10:46:10 +0000 (11:46 +0100)
committerMichael Vogt <mvo@ubuntu.com>
Thu, 25 Jan 2018 11:51:06 +0000 (12:51 +0100)
Do not merge group creation with user creation because with the
new uid:gid syntax this can result in confusing (and unwanted)
behavior.

src/sysusers/sysusers.c
test/TEST-21-SYSUSERS/test-4.expected-group [new file with mode: 0644]
test/TEST-21-SYSUSERS/test-4.expected-passwd [new file with mode: 0644]
test/TEST-21-SYSUSERS/test-4.input [new file with mode: 0644]

index 6383da436d1c1ddab21f57ea022dda259c24bfa7..66af3ff4260fc4b3ca8994a68c5916a92b711553 100644 (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");
diff --git a/test/TEST-21-SYSUSERS/test-4.expected-group b/test/TEST-21-SYSUSERS/test-4.expected-group
new file mode 100644 (file)
index 0000000..64913a5
--- /dev/null
@@ -0,0 +1 @@
+xxx:x:310:
diff --git a/test/TEST-21-SYSUSERS/test-4.expected-passwd b/test/TEST-21-SYSUSERS/test-4.expected-passwd
new file mode 100644 (file)
index 0000000..e0370a4
--- /dev/null
@@ -0,0 +1,2 @@
+yyy:x:311:310::/:/sbin/nologin
+xxx:x:312:310::/:/sbin/nologin
diff --git a/test/TEST-21-SYSUSERS/test-4.input b/test/TEST-21-SYSUSERS/test-4.input
new file mode 100644 (file)
index 0000000..620423e
--- /dev/null
@@ -0,0 +1,3 @@
+g xxx 310
+u yyy 311:310
+u xxx 312:310