From: Alejandro Colomar Date: Fri, 21 Feb 2025 06:36:53 +0000 (+0100) Subject: lib/: Remove unused parameter $3 of password_check() and propagate X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8f784fed8e674c1bf2657cf01c7f676706e105ab;p=thirdparty%2Fshadow.git lib/: Remove unused parameter $3 of password_check() and propagate Propagate the removal of dead code to its callers, which were only passing the parameter to this function. Signed-off-by: Alejandro Colomar --- diff --git a/lib/obscure.c b/lib/obscure.c index adefa72ef..8e8cf09b8 100644 --- a/lib/obscure.c +++ b/lib/obscure.c @@ -81,8 +81,7 @@ static bool similar (/*@notnull@*/const char *old, /*@notnull@*/const char *new) static /*@observer@*//*@null@*/const char *password_check ( /*@notnull@*/const char *old, - /*@notnull@*/const char *new, - /*@notnull@*/MAYBE_UNUSED const struct passwd *pwdp) + /*@notnull@*/const char *new) { const char *msg = NULL; char *oldmono, *newmono, *wrapped; @@ -113,8 +112,7 @@ static /*@observer@*//*@null@*/const char *password_check ( static /*@observer@*//*@null@*/const char *obscure_msg ( /*@notnull@*/const char *old, - /*@notnull@*/const char *new, - /*@notnull@*/const struct passwd *pwdp) + /*@notnull@*/const char *new) { size_t maxlen, oldlen, newlen; char *new1, *old1; @@ -135,7 +133,7 @@ static /*@observer@*//*@null@*/const char *obscure_msg ( return NULL; } - msg = password_check (old, new, pwdp); + msg = password_check(old, new); if (NULL != msg) { return msg; } @@ -183,7 +181,7 @@ static /*@observer@*//*@null@*/const char *obscure_msg ( if (oldlen > maxlen) stpcpy(&old1[maxlen], ""); - msg = password_check (old1, new1, pwdp); + msg = password_check(old1, new1); freezero (new1, newlen); freezero (old1, oldlen); @@ -199,9 +197,10 @@ static /*@observer@*//*@null@*/const char *obscure_msg ( * check passwords. */ -bool obscure (const char *old, const char *new, const struct passwd *pwdp) +bool +obscure(const char *old, const char *new) { - const char *msg = obscure_msg (old, new, pwdp); + const char *msg = obscure_msg(old, new); if (NULL != msg) { printf (_("Bad password: %s. "), msg); diff --git a/lib/prototypes.h b/lib/prototypes.h index 537001f5e..5fe2cf94d 100644 --- a/lib/prototypes.h +++ b/lib/prototypes.h @@ -305,7 +305,7 @@ extern int do_pam_passwd_non_interactive (const char *pam_service, #endif /* USE_PAM */ /* obscure.c */ -extern bool obscure (const char *, const char *, const struct passwd *); +extern bool obscure (const char *, const char *); /* pam_pass.c */ #ifdef USE_PAM diff --git a/src/passwd.c b/src/passwd.c index f51cf48d6..9e2629661 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -320,7 +320,7 @@ static int new_password (const struct passwd *pw) return -1; } - if (!amroot && !obscure(orig, pass, pw)) { + if (!amroot && !obscure(orig, pass)) { (void) puts (_("Try again.")); continue; } @@ -331,7 +331,7 @@ static int new_password (const struct passwd *pw) * --marekm */ if (amroot && !warned && getdef_bool ("PASS_ALWAYS_WARN") - && !obscure(orig, pass, pw)) { + && !obscure(orig, pass)) { (void) puts (_("\nWarning: weak password (enter it again to use it anyway).")); warned = true; continue;