Try to deconfuse static analyzers a bit.
This commit is contained in:
@@ -84,7 +84,7 @@ static sudo_auth auth_switch[] = {
|
|||||||
AUTH_ENTRY(NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
|
AUTH_ENTRY(NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
|
||||||
};
|
};
|
||||||
|
|
||||||
static int standalone;
|
static bool standalone;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize sudoers authentication method(s).
|
* Initialize sudoers authentication method(s).
|
||||||
@@ -214,7 +214,6 @@ verify_user(struct passwd *pw, char *prompt, int validated,
|
|||||||
{
|
{
|
||||||
unsigned int ntries;
|
unsigned int ntries;
|
||||||
int rval, status, success = AUTH_FAILURE;
|
int rval, status, success = AUTH_FAILURE;
|
||||||
char *p;
|
|
||||||
sudo_auth *auth;
|
sudo_auth *auth;
|
||||||
sigset_t mask, omask;
|
sigset_t mask, omask;
|
||||||
sigaction_t sa, saved_sigtstp;
|
sigaction_t sa, saved_sigtstp;
|
||||||
@@ -249,6 +248,7 @@ verify_user(struct passwd *pw, char *prompt, int validated,
|
|||||||
|
|
||||||
for (ntries = 0; ntries < def_passwd_tries; ntries++) {
|
for (ntries = 0; ntries < def_passwd_tries; ntries++) {
|
||||||
int num_methods = 0;
|
int num_methods = 0;
|
||||||
|
char *pass = NULL;
|
||||||
|
|
||||||
/* If user attempted to interrupt password verify, quit now. */
|
/* If user attempted to interrupt password verify, quit now. */
|
||||||
if (user_interrupted())
|
if (user_interrupted())
|
||||||
@@ -278,12 +278,10 @@ verify_user(struct passwd *pw, char *prompt, int validated,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get the password unless the auth function will do it for us */
|
/* Get the password unless the auth function will do it for us */
|
||||||
if (standalone) {
|
if (!standalone) {
|
||||||
p = prompt;
|
pass = auth_getpass(prompt, def_passwd_timeout * 60,
|
||||||
} else {
|
|
||||||
p = auth_getpass(prompt, def_passwd_timeout * 60,
|
|
||||||
SUDO_CONV_PROMPT_ECHO_OFF, callback);
|
SUDO_CONV_PROMPT_ECHO_OFF, callback);
|
||||||
if (p == NULL)
|
if (pass == NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,13 +290,15 @@ verify_user(struct passwd *pw, char *prompt, int validated,
|
|||||||
if (IS_DISABLED(auth))
|
if (IS_DISABLED(auth))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
success = auth->status = (auth->verify)(pw, p, auth, callback);
|
success = auth->status =
|
||||||
|
(auth->verify)(pw, standalone ? prompt : pass, auth, callback);
|
||||||
if (success != AUTH_FAILURE)
|
if (success != AUTH_FAILURE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!standalone) {
|
if (!standalone) {
|
||||||
memset_s(p, SUDO_CONV_REPL_MAX, 0, strlen(p));
|
memset_s(pass, SUDO_CONV_REPL_MAX, 0, strlen(pass));
|
||||||
free(p);
|
free(pass);
|
||||||
|
pass = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success != AUTH_FAILURE)
|
if (success != AUTH_FAILURE)
|
||||||
|
Reference in New Issue
Block a user