sysusers: look at login.defs when setting the default range to allocate users

Also, even if login.defs are not present, don't start allocating at 1, but at
SYSTEM_UID_MIN.

Fixes #9769.

The test is adjusted. Actually, it was busted before, because sysusers would
never use SYSTEM_GID_MIN, so if SYSTEM_GID_MIN was different than
SYSTEM_UID_MIN, the tests would fail. On all "normal" systems the two are
equal, so we didn't notice. Since sysusers now always uses the minimum of the
two, we only need to substitute one value.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-09-25 17:16:06 +02:00
parent 044df624aa
commit aa25270cb2
18 changed files with 143 additions and 25 deletions

View File

@@ -1,2 +1,2 @@
u1:x:300:u2
u2:x:SYSTEM_UID_MAX:
u2:x:SYSTEM_UGID_MAX:

View File

@@ -1,2 +1,2 @@
u1:x:300:300::/:NOLOGIN
u2:x:SYSTEM_UID_MAX:SYSTEM_UID_MAX::/:NOLOGIN
u2:x:SYSTEM_UGID_MAX:SYSTEM_UGID_MAX::/:NOLOGIN

View File

@@ -1,5 +1,5 @@
hoge:x:300:
baz:x:302:
yyy:x:SYSTEM_GID_MAX:
yyy:x:SYSTEM_UGID_MAX:
foo:x:301:
ccc:x:305:

View File

@@ -2,4 +2,4 @@ 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
zzz:x:306:SYSTEM_UGID_MAX::/:NOLOGIN

View File

@@ -1 +1 @@
aaa:x:SYSTEM_UID_MAX:987::/:NOLOGIN
aaa:x:SYSTEM_UGID_MAX:987::/:NOLOGIN

View File

@@ -1,4 +1,4 @@
u1:x:SYSTEM_UID_MAX:
u1:x:SYSTEM_UGID_MAX:
u2:x:777:
u3:x:778:
u4:x:779:

View File

@@ -1,4 +1,4 @@
u1:x:SYSTEM_UID_MAX:SYSTEM_UID_MAX:some gecos:/random/dir:NOLOGIN
u1:x:SYSTEM_UGID_MAX:SYSTEM_UGID_MAX:some gecos:/random/dir:NOLOGIN
u2:x:777:777:some gecos:/random/dir:/bin/zsh
u3:x:778:778::/random/dir2:/bin/bash
u4:x:779:779::/:/bin/csh

View File

@@ -1,4 +1,4 @@
# Test generation of ID dynamically based on SYSTEM_UID_MAX and
# Test generation of ID dynamically based on SYSTEM_UGID_MAX and
# replacement of all fields up to the login shell.
#
#Type Name ID GECOS homedir shell

View File

@@ -1,2 +1,2 @@
g1:x:111:
u1:x:SYSTEM_UID_MAX:
u1:x:SYSTEM_UGID_MAX:

View File

@@ -1 +1 @@
u1:x:SYSTEM_UID_MAX:SYSTEM_UID_MAX::/:NOLOGIN
u1:x:SYSTEM_UGID_MAX:SYSTEM_UGID_MAX::/:NOLOGIN

View File

@@ -1 +1 @@
username:x:SYSTEM_UID_MAX:300::/:NOLOGIN
username:x:SYSTEM_UGID_MAX:300::/:NOLOGIN

View File

@@ -1,2 +1,2 @@
user1:x:300:300::/:NOLOGIN
user2:x:SYSTEM_UID_MAX:300::/:NOLOGIN
user2:x:SYSTEM_UGID_MAX:300::/:NOLOGIN