Commit 497cbf1
committed
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: <#1474>
Signed-off-by: Alejandro Colomar <alx@kernel.org>1 parent d7ce7e8 commit 497cbf1
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
251 | | - | |
| 252 | + | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| |||
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
295 | | - | |
| 296 | + | |
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
| |||
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
360 | | - | |
| 361 | + | |
361 | 362 | | |
362 | 363 | | |
363 | 364 | | |
| |||
0 commit comments