Delref auth_pw at the end of check_user() instead of getting a ref
twice.
This commit is contained in:
@@ -117,11 +117,9 @@ check_user(int validated, int mode)
|
|||||||
/* Init authentication system regardless of whether we need a password. */
|
/* Init authentication system regardless of whether we need a password. */
|
||||||
auth_pw = get_authpw();
|
auth_pw = get_authpw();
|
||||||
if (sudo_auth_init(auth_pw) == -1) {
|
if (sudo_auth_init(auth_pw) == -1) {
|
||||||
pw_delref(auth_pw);
|
|
||||||
rval = -1;
|
rval = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
pw_delref(auth_pw);
|
|
||||||
|
|
||||||
/* Always prompt for a password when -k was specified with the command. */
|
/* Always prompt for a password when -k was specified with the command. */
|
||||||
if (ISSET(mode, MODE_IGNORE_TICKET)) {
|
if (ISSET(mode, MODE_IGNORE_TICKET)) {
|
||||||
@@ -146,8 +144,6 @@ check_user(int validated, int mode)
|
|||||||
TS_MAKE_DIRS);
|
TS_MAKE_DIRS);
|
||||||
|
|
||||||
if (status != TS_CURRENT || ISSET(validated, FLAG_CHECK_USER)) {
|
if (status != TS_CURRENT || ISSET(validated, FLAG_CHECK_USER)) {
|
||||||
struct passwd *auth_pw;
|
|
||||||
|
|
||||||
/* Bail out if we are non-interactive and a password is required */
|
/* Bail out if we are non-interactive and a password is required */
|
||||||
if (ISSET(mode, MODE_NONINTERACTIVE)) {
|
if (ISSET(mode, MODE_NONINTERACTIVE)) {
|
||||||
warningx(_("sorry, a password is required to run %s"), getprogname());
|
warningx(_("sorry, a password is required to run %s"), getprogname());
|
||||||
@@ -162,9 +158,7 @@ check_user(int validated, int mode)
|
|||||||
prompt = expand_prompt(user_prompt ? user_prompt : def_passprompt,
|
prompt = expand_prompt(user_prompt ? user_prompt : def_passprompt,
|
||||||
user_name, user_shost);
|
user_name, user_shost);
|
||||||
|
|
||||||
auth_pw = get_authpw();
|
|
||||||
rval = verify_user(auth_pw, prompt);
|
rval = verify_user(auth_pw, prompt);
|
||||||
pw_delref(auth_pw);
|
|
||||||
}
|
}
|
||||||
/* Only update timestamp if user was validated. */
|
/* Only update timestamp if user was validated. */
|
||||||
if (rval == TRUE && ISSET(validated, VALIDATE_OK) &&
|
if (rval == TRUE && ISSET(validated, VALIDATE_OK) &&
|
||||||
@@ -175,6 +169,7 @@ check_user(int validated, int mode)
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
sudo_auth_cleanup(auth_pw);
|
sudo_auth_cleanup(auth_pw);
|
||||||
|
pw_delref(auth_pw);
|
||||||
|
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user