]> git.ipfire.org Git - thirdparty/shadow.git/commit
src/newusers.c: A user/group name with a leading digit is valid
authorAlejandro Colomar <alx@kernel.org>
Sat, 3 Jan 2026 23:15:15 +0000 (00:15 +0100)
committerSerge Hallyn <serge@hallyn.com>
Wed, 8 Jul 2026 12:35:04 +0000 (07:35 -0500)
commitbdbe9867983d60cf2dea0891070239b593c38bf0
tree97a6ee7f61fc82864bf8339e99509e186485b4b7
parent55e75ec6b2f8878c6c269570a4470730092c1b39
src/newusers.c: A user/group name with a leading digit is valid

Only consider a string to be a UID/GID if it is all digits.

Here's a reproducer of the bug:

$ echo 'foo:p::1a::/tmp/nonexistent:/usr/bin/false' > x
$ sudo newusers ./x
newusers: invalid group ID '1a'
newusers: line 1: can't create group

Where the expected behavior would be the same as for a group name that
doesn't start with a digit:

$ echo 'foo:p::a1a::/tmp/nonexistent:/usr/bin/false' > x
$ sudo newusers ./x
$ tail -n1 /etc/group
a1a:x:1004:
$ tail -n1 /etc/passwd
foo:x:1004:1004::/tmp/nonexistent:/usr/bin/false

Closes: <https://github.com/shadow-maint/shadow/issues/1474>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/newusers.c