From: Alejandro Colomar Date: Fri, 1 Sep 2023 23:58:05 +0000 (+0200) Subject: lib/pwauth.c: Replace getpass(3) by agetpass() X-Git-Tag: 4.15.0-rc1~179 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b0f8ddc30527727d66ca2bd9cd64977993b8cf5;p=thirdparty%2Fshadow.git lib/pwauth.c: Replace getpass(3) by agetpass() Closes: Signed-off-by: Alejandro Colomar --- diff --git a/lib/pwauth.c b/lib/pwauth.c index 965cb1412..023f25416 100644 --- a/lib/pwauth.c +++ b/lib/pwauth.c @@ -18,14 +18,19 @@ #include #include #include -#include "prototypes.h" + +#include "agetpass.h" #include "defines.h" #include "memzero.h" +#include "prototypes.h" #include "pwauth.h" #include "getdef.h" + #ifdef SKEY #include #endif + + #ifdef __linux__ /* standard password prompt by default */ static const char *PROMPT = gettext_noop ("Password: "); #else @@ -137,7 +142,7 @@ int pw_auth (const char *cipher, #endif snprintf (prompt, sizeof prompt, cp, user); - clear = getpass (prompt); + clear = agetpass(prompt); input = (clear == NULL) ? "" : clear; } @@ -164,7 +169,8 @@ int pw_auth (const char *cipher, * -- AR 8/22/1999 */ if ((0 != retval) && ('\0' == input[0]) && use_skey) { - clear = getpass (prompt); + erase_pass(clear); + clear = agetpass(prompt); input = (clear == NULL) ? "" : clear; } @@ -179,10 +185,8 @@ int pw_auth (const char *cipher, } } #endif + erase_pass(clear); - if (NULL != clear) { - strzero (clear); - } return retval; } #else /* !USE_PAM */