policycoreutils/run_init: handle NULL from crypt() in non-PAM build
Stephen Smalley
maintainerPATCH 1/1 policycoreutils/run_init: handle NULL from crypt() in non-PAM build
crypt() returns NULL on error, so check for NULL and treat as if authentication failed in that case.
Signed-off-by Stephen Smalley <[email protected]>
--- policycoreutils/run_init/run_init.c | 2 ++ 1 file changed, 2 insertions(+)
policycoreutils/run_init/run_init.c +2 -0
@@ -213,6 +213,8 @@ static int authenticate_via_shadow_passwd(const struct passwd *p_passwd_line) encrypted_password_s =crypt (unencrypted_password_s, p_shadow_line->sp_pwdp);memset (unencrypted_password_s,0 ,strlen (unencrypted_password_s)); +if (!encrypted_password_s) +return 0 ;/* Return 1 (authenticated) iff the encrypted version of the user's * * input password matches the encrypted password stored in the *
Signature · 1 line
2.55.0
Stephen Smalley
maintainerQuoted 5 lines · Stephen Smalley
crypt()returns NULL on error, so check for NULL and treat as if authentication failed in that case.Signed-off-by Stephen Smalley <[email protected]>
Merged.
Quoted 20 lines
--- policycoreutils/run_init/run_init.c | 2 ++ 1 file changed, 2 insertions(+)policycoreutils/run_init/run_init.c +2
-1@@ -213,6 +213,8 @@ static int authenticate_via_shadow_passwd(const struct passwd *p_passwd_line) encrypted_password_s =crypt (unencrypted_password_s, p_shadow_line->sp_pwdp);memset (unencrypted_password_s,0 ,strlen (unencrypted_password_s)); +if (!encrypted_password_s) +return 0 ;/* Return 1 (authenticated) iff the encrypted version of the user's * * input password matches the encrypted password stored in the * -- 2.55.0