Commit a49d2ac
src/usermod.c: -U: Report E_PASSWORDLESS on error due to passwordless account
Reproducer:
$ useradd foo
$ grep foo /etc/passwd /etc/shadow
/etc/passwd:foo:x:1001:1001::/home/foo:/usr/bin/bash
/etc/shadow:foo:!:20458:0:99999:7:::
$ usermod -U testuser
usermod: unlocking the user's password would result in a passwordless account.
You should set a password with usermod -p to unlock this user's password.
$ echo $?
0
$ grep foo /etc/passwd /etc/shadow
/etc/passwd:foo:x:1001:1001::/home/foo:/usr/bin/bash
/etc/shadow:foo:!:20458:0:99999:7:::
The program failed (didn't change anything, and reported the problem to
stderr) but reported success (0). After this patch, the error is
reported as E_PASSWORDLESS (20).
Closes: <#1479>
Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Acked-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>1 parent b43089b commit a49d2ac
1 file changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
437 | 439 | | |
438 | 440 | | |
439 | 441 | | |
440 | | - | |
| 442 | + | |
| 443 | + | |
441 | 444 | | |
442 | 445 | | |
443 | 446 | | |
| |||
452 | 455 | | |
453 | 456 | | |
454 | 457 | | |
455 | | - | |
| 458 | + | |
456 | 459 | | |
457 | 460 | | |
458 | 461 | | |
| |||
507 | 510 | | |
508 | 511 | | |
509 | 512 | | |
510 | | - | |
| 513 | + | |
511 | 514 | | |
512 | 515 | | |
513 | 516 | | |
| |||
622 | 625 | | |
623 | 626 | | |
624 | 627 | | |
625 | | - | |
| 628 | + | |
626 | 629 | | |
627 | 630 | | |
628 | 631 | | |
| |||
0 commit comments