]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/sysusers/sysusers.c
sysusers: allow force reusing existing user/group IDs (#8037)
authorMichael Vogt <michael.vogt@gmail.com>
Thu, 1 Feb 2018 04:47:50 +0000 (05:47 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 1 Feb 2018 04:47:50 +0000 (13:47 +0900)
commitb9ee05c26617573e3d3c600bf755527e1852859c
tree231edaf435588efbdade2c53fb749148af8bffc6
parentce691f31aafe4492011aa94600453ce69662b910
sysusers: allow force reusing existing user/group IDs (#8037)

On Debian/Ubuntu systems the default passwd/group files use a
slightly strange mapping. E.g. in passwd:
```
man:x:6:12::/var/cache/man:/sbin/nologin
```
and in group:
```
disk:x:6:
man:x:12:
```

This is not supported in systemd-sysusers right now because
sysusers will not re-use an existing uid/gid in its normal
mode of operation. Unfortunately this reuse is needed to
replicate the default Debian/Ubuntu users/groups.

This commit enforces reuse when the "uid:gid" syntax is used
to fix this.

I also added a test that replicates the Debian base-passwd
passwd/group file to ensure things are ok.
16 files changed:
src/sysusers/sysusers.c
test/TEST-21-SYSUSERS/test-1.input
test/TEST-21-SYSUSERS/test-2.expected-group
test/TEST-21-SYSUSERS/test-2.expected-passwd
test/TEST-21-SYSUSERS/test-2.input
test/TEST-21-SYSUSERS/test-3.input
test/TEST-21-SYSUSERS/test-4.input
test/TEST-21-SYSUSERS/test-5.expected-group [new file with mode: 0644]
test/TEST-21-SYSUSERS/test-5.expected-passwd [new file with mode: 0644]
test/TEST-21-SYSUSERS/test-5.input [new file with mode: 0644]
test/TEST-21-SYSUSERS/test-6.expected-group [new file with mode: 0644]
test/TEST-21-SYSUSERS/test-6.expected-passwd [new file with mode: 0644]
test/TEST-21-SYSUSERS/test-6.input [new file with mode: 0644]
test/TEST-21-SYSUSERS/test.sh
test/TEST-21-SYSUSERS/unhappy-1.input
test/TEST-21-SYSUSERS/unhappy-2.input