]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/, src/, doc/: Remove dead code
authorAlejandro Colomar <alx@kernel.org>
Wed, 29 Jan 2025 15:37:51 +0000 (16:37 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Wed, 5 Feb 2025 15:58:10 +0000 (16:58 +0100)
pw_auth()'s $4 was always being specified as NULL.  Remove the
parameter.  Instead, set a local variable to NULL at function entry, and
remove code that never runs (conditional on $4 != NULL).

Reviewed-by: Sam James <sam@gentoo.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
doc/HOWTO
lib/pwauth.c
lib/pwauth.h
lib/pwdcheck.c
src/login.c
src/su.c

index bb4e052db48029b6ea8ebda5264bf72c57f5a8bb..4bb22a9cb7f036c66c43126e88b4b9797b860179 100644 (file)
--- a/doc/HOWTO
+++ b/doc/HOWTO
       }
   #ifdef HAS_SHADOW
       if ((pw->pw_passwd && pw->pw_passwd[0] == '@'
-           && pw_auth (pw->pw_passwd+1, pw->pw_name, PW_LOGIN, NULL))
+           && pw_auth (pw->pw_passwd+1, pw->pw_name, PW_LOGIN))
           || !valid (passwd, pw)) {
           return (UPAP_AUTHNAK);
       }
index afdc2337a4fdbf48c3e04b84867569c87a660b5f..93ea546a6b555a5927aa78fc3e7dc12b103e024a 100644 (file)
@@ -50,14 +50,14 @@ static const char *PROMPT = gettext_noop ("%s's Password: ");
 
 int pw_auth (const char *cipher,
              const char *user,
-             int reason,
-             /*@null@*/const char *input)
+             int reason)
 {
        int          retval;
        char         prompt[1024];
        char         *clear = NULL;
        const char   *cp;
        const char   *encrypted;
+       const char   *input = NULL;
 
 #ifdef SKEY
        bool         use_skey = false;
@@ -73,14 +73,6 @@ int pw_auth (const char *cipher,
                return 0;
        }
 
-       /*
-        * There are even programs for changing the user name ...
-        */
-
-       if ((PW_CHANGE == reason) && (NULL != input)) {
-               return 0;
-       }
-
        /*
         * WARNING:
         *
@@ -132,7 +124,7 @@ int pw_auth (const char *cipher,
         * get the cleartext password for us.
         */
 
-       if ((PW_FTP != reason) && (PW_REXEC != reason) && (NULL == input)) {
+       if ((PW_FTP != reason) && (PW_REXEC != reason)) {
                cp = getdef_str ("LOGIN_STRING");
                if (NULL == cp) {
                        cp = _(PROMPT);
index b610025dd478b5407a4682c4b993dd2ed35302e5..65def0a404a4e2cacf1101a581ce09da14e839c0 100644 (file)
@@ -17,8 +17,7 @@
 #ifndef USE_PAM
 int pw_auth (const char *cipher,
              const char *user,
-             int flag,
-             /*@null@*/const char *input);
+             int flag);
 #endif                         /* !USE_PAM */
 
 /*
index 93c9f5ced42cd0f63152b5228a83ff569ca19103..29a6dcd80ddefc1a5aeafff96b927b559254b3e3 100644 (file)
@@ -28,7 +28,7 @@ void passwd_check (const char *user, const char *passwd, MAYBE_UNUSED const char
        if (NULL != sp) {
                passwd = sp->sp_pwdp;
        }
-       if (pw_auth (passwd, user, PW_LOGIN, NULL) != 0) {
+       if (pw_auth(passwd, user, PW_LOGIN) != 0) {
                SYSLOG ((LOG_WARN, "incorrect password for `%s'", user));
                (void) sleep (1);
                fprintf (log_get_logfd(), _("Incorrect password for %s.\n"), user);
index eafd498dda6529c4f288a14a3811f91a6698b850..21a2d87873cd42e221da92cac11a5135fb82192f 100644 (file)
@@ -903,7 +903,7 @@ int main (int argc, char **argv)
                        goto auth_ok;
                }
 
-               if (pw_auth (user_passwd, username, reason, NULL) == 0) {
+               if (pw_auth(user_passwd, username, reason) == 0) {
                        goto auth_ok;
                }
 
@@ -964,7 +964,7 @@ int main (int argc, char **argv)
                 * all).  --marekm
                 */
                if (streq(user_passwd, "")) {
-                       pw_auth ("!", username, reason, NULL);
+                       pw_auth("!", username, reason);
                }
 
                /*
index 7b3c9b04ace51495ebea4c2abf1383f7406be973..da8f783c641ae83f913d28960aa145e4e9019c4e 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -590,7 +590,7 @@ static void check_perms_nopam (const struct passwd *pw)
         * The first character of an administrator defined method is an '@'
         * character.
         */
-       if (pw_auth (password, name, PW_SU, NULL) != 0) {
+       if (pw_auth(password, name, PW_SU) != 0) {
                SYSLOG (((pw->pw_uid != 0)? LOG_NOTICE : LOG_WARN,
                         "Authentication failed for %s", name));
                fprintf(stderr, _("%s: Authentication failure\n"), Prog);