]> git.ipfire.org Git - thirdparty/shadow.git/commit
src/usermod.c: -U: Report E_PASSWORDLESS on error due to passwordless account
authorAlejandro Colomar <alx@kernel.org>
Mon, 5 Jan 2026 23:01:07 +0000 (00:01 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Thu, 15 Jan 2026 12:16:17 +0000 (13:16 +0100)
commita49d2acdb4b59b1f854dc29ac304fd2836d7e1eb
tree01ddea3959ca10638e3410fc0298888148b0af8c
parentb43089bcf15978a21b9e858fc61a5fce33a2daa6
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: <https://github.com/shadow-maint/shadow/issues/1479>
Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Acked-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/usermod.c