]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/pwauth.*: PW_{ADD,CHANGE,DELETE,FTP,REXEC}: Remove dead code
authorAlejandro Colomar <alx@kernel.org>
Wed, 29 Jan 2025 16:21:33 +0000 (17:21 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Wed, 5 Feb 2025 15:58:10 +0000 (16:58 +0100)
These values aren't being set anywhere.

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

index 93ea546a6b555a5927aa78fc3e7dc12b103e024a..6ff20888dcbb6376007ac89d97750a0712881021 100644 (file)
@@ -54,10 +54,10 @@ int pw_auth (const char *cipher,
 {
        int          retval;
        char         prompt[1024];
-       char         *clear = NULL;
+       char         *clear;
        const char   *cp;
        const char   *encrypted;
-       const char   *input = NULL;
+       const char   *input;
 
 #ifdef SKEY
        bool         use_skey = false;
@@ -65,27 +65,6 @@ int pw_auth (const char *cipher,
        struct skey  skey;
 #endif
 
-       /*
-        * There are programs for adding and deleting authentication data.
-        */
-
-       if ((PW_ADD == reason) || (PW_DELETE == reason)) {
-               return 0;
-       }
-
-       /*
-        * WARNING:
-        *
-        * When we change a password and we are root, we don't prompt.
-        * This is so root can change any password without having to
-        * know it.  This is a policy decision that might have to be
-        * revisited.
-        */
-
-       if ((PW_CHANGE == reason) && (getuid () == 0)) {
-               return 0;
-       }
-
        /*
         * WARNING:
         *
@@ -120,25 +99,22 @@ int pw_auth (const char *cipher,
 #endif
 
        /*
-        * Prompt for the password as required.  FTPD and REXECD both
-        * get the cleartext password for us.
+        * Prompt for the password as required.
         */
 
-       if ((PW_FTP != reason) && (PW_REXEC != reason)) {
-               cp = getdef_str ("LOGIN_STRING");
-               if (NULL == cp) {
-                       cp = _(PROMPT);
-               }
+       cp = getdef_str ("LOGIN_STRING");
+       if (NULL == cp) {
+               cp = _(PROMPT);
+       }
 #ifdef SKEY
-               if (use_skey) {
-                       printf ("[%s]\n", challenge_info);
-               }
+       if (use_skey) {
+               printf ("[%s]\n", challenge_info);
+       }
 #endif
 
-               SNPRINTF(prompt, cp, user);
-               clear = agetpass(prompt);
-               input = (clear == NULL) ? "" : clear;
-       }
+       SNPRINTF(prompt, cp, user);
+       clear = agetpass(prompt);
+       input = (clear == NULL) ? "" : clear;
 
        /*
         * Convert the cleartext password into a ciphertext string.
index 65def0a404a4e2cacf1101a581ce09da14e839c0..405b3ed9472a18afce2c538197c34114e6bc7d5d 100644 (file)
@@ -27,21 +27,11 @@ int pw_auth (const char *cipher,
 #define        PW_SU           1
 #define        PW_LOGIN        2
 
-/*
- * Administrative functions
- */
-
-#define        PW_ADD          101
-#define        PW_CHANGE       102
-#define        PW_DELETE       103
-
 /*
  * Network access
  */
 
 #define        PW_TELNET       201
 #define        PW_RLOGIN       202
-#define        PW_FTP          203
-#define        PW_REXEC        204
 
 #endif /* _PWAUTH_H */