Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[deadbeef] Remove dead code #1200

Merged
merged 3 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/HOWTO
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@
}
#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);
}
Expand Down
60 changes: 14 additions & 46 deletions lib/pwauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,50 +50,21 @@ 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;
char *clear;
const char *cp;
const char *encrypted;
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;
}

/*
* There are even programs for changing the user name ...
*/

if ((PW_CHANGE == reason) && (NULL != input)) {
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 @@ -128,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) && (NULL == input)) {
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
13 changes: 1 addition & 12 deletions lib/pwauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

/*
Expand All @@ -28,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 */
2 changes: 1 addition & 1 deletion lib/pwdcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/login.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion src/su.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading