]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/: Remove unused parameter $3 of password_check() and propagate
authorAlejandro Colomar <alx@kernel.org>
Fri, 21 Feb 2025 06:36:53 +0000 (07:36 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Thu, 6 Nov 2025 11:50:49 +0000 (12:50 +0100)
Propagate the removal of dead code to its callers, which were only
passing the parameter to this function.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/obscure.c
lib/prototypes.h
src/passwd.c

index adefa72ef2c2f2023789595a75445775e0168537..8e8cf09b84b1e95c72e98f261f8f9a1a0feae45e 100644 (file)
@@ -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);
index 537001f5e479d8711fcc9cb8a654ca44bc6ee35b..5fe2cf94d10b73ea71529f82b693cb12e6e9f53f 100644 (file)
@@ -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
index f51cf48d60fe96f3dac310751f73f3ccf53de7ad..9e26296618725967a3d0b57f3ec3fd05b32ca759 100644 (file)
@@ -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;