]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/encrypt.c: Do not exit in error case
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 19 Jan 2025 20:23:54 +0000 (21:23 +0100)
committerAlejandro Colomar <alx@kernel.org>
Tue, 21 Jan 2025 15:24:26 +0000 (16:24 +0100)
commit6cbce81df97a16363c46cbd1e8202c3b4f0a2205
tree2479b064a13dbc484e0a919882a7dce6ae0e6650
parentc8e8557803f3e335eff33009329e0b5b8e464a15
lib/encrypt.c: Do not exit in error case

If crypt fails, pw_encrypt calls exit. This has the consequence that the
plaintext password is not cleared.

A valid password can fail if the underlying library does not support it.
One such example is SHA512, for which the password must not be longer
than 256 characters on musl. A password longer than this with glibc
works, so it is actually possible that a user, running passwd, tries to
enter the old password but the musl-based passwd binary simply exits.
Let passwd clear the password before exiting.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
lib/encrypt.c