Add support for -k flag with a command.

This commit is contained in:
Todd C. Miller
2010-03-15 19:41:15 -04:00
parent 36701e1233
commit 248bae4e56
3 changed files with 4 additions and 3 deletions

View File

@@ -91,7 +91,7 @@ check_user(validated, mode)
int status, rval = TRUE;
/* Always prompt for a password when -k was specified with the command. */
if (ISSET(mode, MODE_INVALIDATE)) {
if (ISSET(mode, MODE_IGNORE_TICKET)) {
SET(validated, FLAG_CHECK_USER);
} else {
if (user_uid == 0 || user_uid == runas_pw->pw_uid || user_is_exempt())
@@ -140,7 +140,7 @@ check_user(validated, mode)
rval = verify_user(auth_pw, prompt);
}
/* Only update timestamp if user was validated. */
if (ISSET(validated, VALIDATE_OK) && !ISSET(mode, MODE_INVALIDATE) && status != TS_ERROR)
if (ISSET(validated, VALIDATE_OK) && !ISSET(mode, MODE_IGNORE_TICKET) && status != TS_ERROR)
update_timestamp(timestampdir, timestampfile);
efree(timestampdir);
efree(timestampfile);

View File

@@ -1232,7 +1232,7 @@ deserialize_info(char * const settings[], char * const user_info[])
continue;
}
if (MATCHES(*cur, "ignore_ticket=")) {
/* XXX */
SET(flags, MODE_IGNORE_TICKET);
continue;
}
if (MATCHES(*cur, "login_class=")) {

View File

@@ -130,6 +130,7 @@ struct sudo_user {
#define MODE_PRESERVE_GROUPS 0x00200000
#define MODE_PRESERVE_ENV 0x00400000
#define MODE_NONINTERACTIVE 0x00800000
#define MODE_IGNORE_TICKET 0x01000000
/*
* Used with set_perms()