diff options
author | David Michael <fedora.dm0@gmail.com> | 2020-01-30 20:04:14 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-02-02 16:53:22 +0100 |
commit | 649916d3561ac41b41bfc5be6297a78847509abe (patch) | |
tree | 0aa48c2357b33511ef8697aac1b1a4c3edbfb894 /test/TEST-21-SYSUSERS | |
parent | Merge pull request #14672 from yuwata/network-routing-policy-uidrange (diff) | |
download | systemd-649916d3561ac41b41bfc5be6297a78847509abe.tar.xz systemd-649916d3561ac41b41bfc5be6297a78847509abe.zip |
sysusers: support creating users with a specific primary group
This extends the "uid:gid" syntax for "u" lines so that a group
name can be given instead of a GID. This requires that the group
is either queued for creation by sysusers, or it is already defined
on the system.
Closes #14340
Diffstat (limited to 'test/TEST-21-SYSUSERS')
-rw-r--r-- | test/TEST-21-SYSUSERS/test-13.expected-group | 5 | ||||
-rw-r--r-- | test/TEST-21-SYSUSERS/test-13.expected-passwd | 5 | ||||
-rw-r--r-- | test/TEST-21-SYSUSERS/test-13.input | 13 | ||||
-rw-r--r-- | test/TEST-21-SYSUSERS/test-14.expected-group | 1 | ||||
-rw-r--r-- | test/TEST-21-SYSUSERS/test-14.expected-passwd | 1 | ||||
-rw-r--r-- | test/TEST-21-SYSUSERS/test-14.initial-group | 1 | ||||
-rw-r--r-- | test/TEST-21-SYSUSERS/test-14.input | 4 | ||||
-rwxr-xr-x | test/TEST-21-SYSUSERS/test.sh | 2 | ||||
-rw-r--r-- | test/TEST-21-SYSUSERS/unhappy-3.expected-err | 1 | ||||
-rw-r--r-- | test/TEST-21-SYSUSERS/unhappy-3.input | 4 |
10 files changed, 37 insertions, 0 deletions
diff --git a/test/TEST-21-SYSUSERS/test-13.expected-group b/test/TEST-21-SYSUSERS/test-13.expected-group new file mode 100644 index 0000000000..c78ea54bd3 --- /dev/null +++ b/test/TEST-21-SYSUSERS/test-13.expected-group @@ -0,0 +1,5 @@ +hoge:x:300: +baz:x:302: +yyy:x:SYSTEM_GID_MAX: +foo:x:301: +ccc:x:305: diff --git a/test/TEST-21-SYSUSERS/test-13.expected-passwd b/test/TEST-21-SYSUSERS/test-13.expected-passwd new file mode 100644 index 0000000000..ffc20a8193 --- /dev/null +++ b/test/TEST-21-SYSUSERS/test-13.expected-passwd @@ -0,0 +1,5 @@ +foo:x:301:301::/:NOLOGIN +aaa:x:303:302::/:NOLOGIN +bbb:x:304:302::/:NOLOGIN +ccc:x:305:305::/:NOLOGIN +zzz:x:306:SYSTEM_GID_MAX::/:NOLOGIN diff --git a/test/TEST-21-SYSUSERS/test-13.input b/test/TEST-21-SYSUSERS/test-13.input new file mode 100644 index 0000000000..bad2f09505 --- /dev/null +++ b/test/TEST-21-SYSUSERS/test-13.input @@ -0,0 +1,13 @@ +# Ensure that the semantic for the uid:groupname syntax is correct +# +#Type Name ID GECOS HOMEDIR +g hoge 300 - - +u foo 301 - - + +g baz 302 - - +u aaa 303:baz - - +u bbb 304:baz - - +u ccc 305 - - + +g yyy - +u zzz 306:yyy diff --git a/test/TEST-21-SYSUSERS/test-14.expected-group b/test/TEST-21-SYSUSERS/test-14.expected-group new file mode 100644 index 0000000000..2e619bc5cd --- /dev/null +++ b/test/TEST-21-SYSUSERS/test-14.expected-group @@ -0,0 +1 @@ +pre:x:987: diff --git a/test/TEST-21-SYSUSERS/test-14.expected-passwd b/test/TEST-21-SYSUSERS/test-14.expected-passwd new file mode 100644 index 0000000000..62ed4f50af --- /dev/null +++ b/test/TEST-21-SYSUSERS/test-14.expected-passwd @@ -0,0 +1 @@ +aaa:x:SYSTEM_UID_MAX:987::/:NOLOGIN diff --git a/test/TEST-21-SYSUSERS/test-14.initial-group b/test/TEST-21-SYSUSERS/test-14.initial-group new file mode 100644 index 0000000000..2e619bc5cd --- /dev/null +++ b/test/TEST-21-SYSUSERS/test-14.initial-group @@ -0,0 +1 @@ +pre:x:987: diff --git a/test/TEST-21-SYSUSERS/test-14.input b/test/TEST-21-SYSUSERS/test-14.input new file mode 100644 index 0000000000..0a11a2e325 --- /dev/null +++ b/test/TEST-21-SYSUSERS/test-14.input @@ -0,0 +1,4 @@ +# Ensure that a preexisting system group can be used as primary +# +#Type Name ID GECOS HOMEDIR +u aaa -:pre diff --git a/test/TEST-21-SYSUSERS/test.sh b/test/TEST-21-SYSUSERS/test.sh index add16ea19f..aed921e39e 100755 --- a/test/TEST-21-SYSUSERS/test.sh +++ b/test/TEST-21-SYSUSERS/test.sh @@ -23,6 +23,7 @@ preprocess() { # get this value from config.h, however the autopkgtest fails with # it SYSTEM_UID_MAX=$(awk 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }' /etc/login.defs) + SYSTEM_GID_MAX=$(awk 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }' /etc/login.defs) # we can't rely on config.h to get the nologin path, as autopkgtest # uses pre-compiled binaries, so extract it from the systemd-sysusers @@ -30,6 +31,7 @@ preprocess() { NOLOGIN=$(strings $(type -p systemd-sysusers) | grep nologin) sed -e "s/SYSTEM_UID_MAX/${SYSTEM_UID_MAX}/g" \ + -e "s/SYSTEM_GID_MAX/${SYSTEM_GID_MAX}/g" \ -e "s#NOLOGIN#${NOLOGIN}#g" "$in" } diff --git a/test/TEST-21-SYSUSERS/unhappy-3.expected-err b/test/TEST-21-SYSUSERS/unhappy-3.expected-err new file mode 100644 index 0000000000..d55b366372 --- /dev/null +++ b/test/TEST-21-SYSUSERS/unhappy-3.expected-err @@ -0,0 +1 @@ +Group g1 not found. diff --git a/test/TEST-21-SYSUSERS/unhappy-3.input b/test/TEST-21-SYSUSERS/unhappy-3.input new file mode 100644 index 0000000000..64e60dd606 --- /dev/null +++ b/test/TEST-21-SYSUSERS/unhappy-3.input @@ -0,0 +1,4 @@ +# Ensure it is not allowed to create groups implicitly in the uid:groupname syntax +# +#Type Name ID GECOS HOMEDIR +u u1 100:g1 - |