]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/, src/, doc/: Remove pw_auth()'s $3 as dead code
authorAlejandro Colomar <alx@kernel.org>
Thu, 30 Jan 2025 12:19:03 +0000 (13:19 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Wed, 5 Feb 2025 15:58:10 +0000 (16:58 +0100)
We don't read the parameter at all.  Remove it.

As a consequence, all the PW_* constants are also removed (as they are
now unused).

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 4bb22a9cb7f036c66c43126e88b4b9797b860179..62b8d85dc90b74e767b3e00f37efa2cc3682c880 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))
+           && pw_auth(pw->pw_passwd+1, pw->pw_name))
           || !valid (passwd, pw)) {
           return (UPAP_AUTHNAK);
       }
index 6ff20888dcbb6376007ac89d97750a0712881021..e2be3923582c7db39471dd26a1c588aa9f64a1f3 100644 (file)
@@ -48,9 +48,8 @@ static const char *PROMPT = gettext_noop ("%s's Password: ");
  *     compared.
  */
 
-int pw_auth (const char *cipher,
-             const char *user,
-             int reason)
+int
+pw_auth(const char *cipher, const char *user)
 {
        int          retval;
        char         prompt[1024];
index 405b3ed9472a18afce2c538197c34114e6bc7d5d..e4be826a0a921599297fcbcaf9d83a68b8afb84c 100644 (file)
@@ -7,31 +7,11 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-/*
- *     $Id$
- */
-
 #ifndef _PWAUTH_H
 #define _PWAUTH_H
 
 #ifndef USE_PAM
-int pw_auth (const char *cipher,
-             const char *user,
-             int flag);
+int pw_auth(const char *cipher, const char *user);
 #endif                         /* !USE_PAM */
 
-/*
- * Local access
- */
-
-#define        PW_SU           1
-#define        PW_LOGIN        2
-
-/*
- * Network access
- */
-
-#define        PW_TELNET       201
-#define        PW_RLOGIN       202
-
 #endif /* _PWAUTH_H */
index 29a6dcd80ddefc1a5aeafff96b927b559254b3e3..5003d3769d59a0119de57bf0b19ea445710267a0 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) != 0) {
+       if (pw_auth(passwd, user) != 0) {
                SYSLOG ((LOG_WARN, "incorrect password for `%s'", user));
                (void) sleep (1);
                fprintf (log_get_logfd(), _("Incorrect password for %s.\n"), user);
index 21a2d87873cd42e221da92cac11a5135fb82192f..349df16d8e83d0b0fef5ae1ac1a820590f6f2cf0 100644 (file)
@@ -77,7 +77,6 @@ static const char Prog[] = "login";
 
 static const char *hostname = "";
 static /*@null@*/ /*@only@*/char *username = NULL;
-static int reason = PW_LOGIN;
 
 #ifndef USE_PAM
 #ifdef ENABLE_LASTLOG
@@ -289,7 +288,6 @@ static void process_flags (int argc, char *const *argv)
                case 'h':
                        hflg = true;
                        hostname = optarg;
-                       reason = PW_TELNET;
                        break;
                case 'p':
                        pflg = true;
@@ -536,9 +534,6 @@ int main (int argc, char **argv)
        if (fflg) {
                preauth_flag = true;
        }
-       if (hflg) {
-               reason = PW_RLOGIN;
-       }
 
        OPENLOG (Prog);
 
@@ -903,7 +898,7 @@ int main (int argc, char **argv)
                        goto auth_ok;
                }
 
-               if (pw_auth(user_passwd, username, reason) == 0) {
+               if (pw_auth(user_passwd, username) == 0) {
                        goto auth_ok;
                }
 
@@ -964,7 +959,7 @@ int main (int argc, char **argv)
                 * all).  --marekm
                 */
                if (streq(user_passwd, "")) {
-                       pw_auth("!", username, reason);
+                       pw_auth("!", username);
                }
 
                /*
index da8f783c641ae83f913d28960aa145e4e9019c4e..970ff1b3cd7bd5b8defb80bbb3b9dfbd8448f1ff 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) != 0) {
+       if (pw_auth(password, name) != 0) {
                SYSLOG (((pw->pw_uid != 0)? LOG_NOTICE : LOG_WARN,
                         "Authentication failed for %s", name));
                fprintf(stderr, _("%s: Authentication failure\n"), Prog);