From 9b0f8ddc30527727d66ca2bd9cd64977993b8cf5 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 2 Sep 2023 01:58:05 +0200 Subject: [PATCH] lib/pwauth.c: Replace getpass(3) by agetpass() Closes: Signed-off-by: Alejandro Colomar --- lib/pwauth.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 */ -- 2.47.2