Replace AUTH_INTR return with AUTH_FAILURE.
The two were treated identically by the caller.
This commit is contained in:
@@ -63,10 +63,6 @@ The member functions can return the following values:
|
||||
When verify_user() gets AUTH_FATAL from an auth
|
||||
function it does an exit(1).
|
||||
|
||||
AUTH_INTR An attempt to read the password read was interrupted.
|
||||
Usually this means the user entered ^C at the
|
||||
password prompt.
|
||||
|
||||
AUTH_NONINTERACTIVE Function failed because user interaction was
|
||||
required but sudo was run in non-interactive
|
||||
mode.
|
||||
|
@@ -257,7 +257,7 @@ sudo_aix_verify(const struct sudoers_context *ctx, struct passwd *pw,
|
||||
if (sudo_aix_valid_message(message))
|
||||
sudo_printf(SUDO_CONV_ERROR_MSG|SUDO_CONV_PREFER_TTY,
|
||||
"%s", message);
|
||||
ret = pass ? AUTH_FAILURE : AUTH_INTR;
|
||||
ret = AUTH_FAILURE;
|
||||
}
|
||||
free(message);
|
||||
message = NULL;
|
||||
|
@@ -160,7 +160,7 @@ bsdauth_verify(const struct sudoers_context *ctx, struct passwd *pw,
|
||||
}
|
||||
}
|
||||
|
||||
if (pass) {
|
||||
if (pass != NULL) {
|
||||
authok = auth_userresponse(as, pass, 1);
|
||||
freezero(pass, strlen(pass));
|
||||
}
|
||||
@@ -171,11 +171,10 @@ bsdauth_verify(const struct sudoers_context *ctx, struct passwd *pw,
|
||||
if (authok)
|
||||
debug_return_int(AUTH_SUCCESS);
|
||||
|
||||
if (!pass)
|
||||
debug_return_int(AUTH_INTR);
|
||||
|
||||
if ((s = auth_getvalue(as, (char *)"errormsg")) != NULL)
|
||||
log_warningx(ctx, 0, "%s", s);
|
||||
if (pass != NULL) {
|
||||
if ((s = auth_getvalue(as, (char *)"errormsg")) != NULL)
|
||||
log_warningx(ctx, 0, "%s", s);
|
||||
}
|
||||
debug_return_int(AUTH_FAILURE);
|
||||
}
|
||||
|
||||
|
@@ -121,8 +121,8 @@ restart:
|
||||
sudo_warnx("%s", resp);
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
if (!pass) { /* ^C or error */
|
||||
debug_return_int(AUTH_INTR);
|
||||
if (pass == NULL) { /* ^C or error */
|
||||
debug_return_int(AUTH_FAILURE);
|
||||
}
|
||||
|
||||
/* Send the user's response to the server */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: ISC
|
||||
*
|
||||
* Copyright (c) 1999-2005, 2007-2020 Todd C. Miller <Todd.Miller@sudo.ws>
|
||||
* Copyright (c) 1999-2005, 2007-2023 Todd C. Miller <Todd.Miller@sudo.ws>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -332,7 +332,7 @@ sudo_pam_verify(const struct sudoers_context *ctx, struct passwd *pw,
|
||||
|
||||
if (getpass_error) {
|
||||
/* error or ^C from tgetpass() or running non-interactive */
|
||||
debug_return_int(noninteractive ? AUTH_NONINTERACTIVE : AUTH_INTR);
|
||||
debug_return_int(noninteractive ? AUTH_NONINTERACTIVE : AUTH_FAILURE);
|
||||
}
|
||||
switch (*pam_status) {
|
||||
case PAM_SUCCESS:
|
||||
|
@@ -89,10 +89,10 @@ sudo_sia_verify(const struct sudoers_context *ctx, struct passwd *pw,
|
||||
if (IS_NONINTERACTIVE(auth))
|
||||
debug_return_int(AUTH_NONINTERACTIVE);
|
||||
|
||||
/* Get password, return AUTH_INTR if we got ^C */
|
||||
/* Get password, return AUTH_FAILURE if we got ^C */
|
||||
pass = auth_getpass(prompt, SUDO_CONV_PROMPT_ECHO_OFF, callback);
|
||||
if (pass == NULL)
|
||||
debug_return_int(AUTH_INTR);
|
||||
debug_return_int(AUTH_FAILURE);
|
||||
|
||||
/* Check password and zero out plaintext copy. */
|
||||
rc = sia_ses_authent(NULL, pass, siah);
|
||||
|
@@ -355,7 +355,6 @@ done:
|
||||
case AUTH_SUCCESS:
|
||||
ret = true;
|
||||
break;
|
||||
case AUTH_INTR:
|
||||
case AUTH_FAILURE:
|
||||
if (ntries != 0)
|
||||
SET(validated, FLAG_BAD_PASSWORD);
|
||||
|
@@ -22,9 +22,8 @@
|
||||
/* Auth function return values. */
|
||||
#define AUTH_SUCCESS 0
|
||||
#define AUTH_FAILURE 1
|
||||
#define AUTH_INTR 2
|
||||
#define AUTH_FATAL 3
|
||||
#define AUTH_NONINTERACTIVE 4
|
||||
#define AUTH_FATAL 2
|
||||
#define AUTH_NONINTERACTIVE 3
|
||||
|
||||
typedef struct sudo_auth {
|
||||
unsigned int flags; /* various flags, see below */
|
||||
|
Reference in New Issue
Block a user