]>
git.ipfire.org Git - thirdparty/shadow.git/commit
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>