Skip to content

Commit

Permalink
lib/pwauth.*: PW_{ADD,CHANGE,DELETE,FTP,REXEC}: Remove dead code
Browse files Browse the repository at this point in the history
These values aren't being set anywhere.

Reviewed-by: Sam James <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar authored and ikerexxe committed Feb 5, 2025
1 parent d4ca9fd commit 6e8d7bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 47 deletions.
50 changes: 13 additions & 37 deletions lib/pwauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,17 @@ 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;
char challenge_info[40];
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:
*
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 0 additions & 10 deletions lib/pwauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 6e8d7bf

Please sign in to comment.