Pass auth_pw to the timestamp functions.

This commit is contained in:
Todd C. Miller
2013-03-28 13:22:09 -04:00
parent 2541257696
commit 4d3fc204f7
3 changed files with 12 additions and 12 deletions

View File

@@ -93,12 +93,12 @@ check_user(int validated, int mode)
if (ISSET(mode, MODE_IGNORE_TICKET))
SET(validated, FLAG_CHECK_USER);
if (build_timestamp() == -1) {
if (build_timestamp(auth_pw) == -1) {
rval = -1;
goto done;
}
status = timestamp_status();
status = timestamp_status(auth_pw);
if (status != TS_CURRENT || ISSET(validated, FLAG_CHECK_USER)) {
char *prompt;
@@ -127,7 +127,7 @@ check_user(int validated, int mode)
/* Only update timestamp if user was validated. */
if (rval == true && ISSET(validated, VALIDATE_OK) &&
!ISSET(mode, MODE_IGNORE_TICKET) && status != TS_ERROR)
update_timestamp();
update_timestamp(auth_pw);
done:
sudo_auth_cleanup(auth_pw);
@@ -152,7 +152,7 @@ display_lecture(int status)
if (def_lecture == never ||
(def_lecture == once && already_lectured(status)))
debug_return_int(false);
debug_return_bool(false);
memset(&msg, 0, sizeof(msg));
memset(&repl, 0, sizeof(repl));
@@ -175,7 +175,7 @@ display_lecture(int status)
" #3) With great power comes great responsibility.\n\n");
sudo_conv(1, &msg, &repl);
}
debug_return_int(true);
debug_return_bool(true);
}
/*

View File

@@ -43,8 +43,8 @@ struct sudo_tty_info {
pid_t sid; /* ID of session with controlling tty */
};
bool update_timestamp(void);
int build_timestamp(void);
int timestamp_status(void);
bool update_timestamp(struct passwd *pw);
int build_timestamp(struct passwd *pw);
int timestamp_status(struct passwd *pw);
#endif /* _SUDOERS_CHECK_H */

View File

@@ -73,7 +73,7 @@ static char timestampfile[PATH_MAX];
* Fills in timestampdir as well as timestampfile if using tty tickets.
*/
int
build_timestamp(void)
build_timestamp(struct passwd *pw)
{
char *dirparent;
struct stat sb;
@@ -135,7 +135,7 @@ bad:
* Update the time on the timestamp file/dir or create it if necessary.
*/
bool
update_timestamp(void)
update_timestamp(struct passwd *pw)
{
debug_decl(update_timestamp, SUDO_DEBUG_AUTH)
@@ -374,7 +374,7 @@ done:
}
int
timestamp_status(void)
timestamp_status(struct passwd *pw)
{
return timestamp_status_internal(false);
}
@@ -390,7 +390,7 @@ remove_timestamp(bool remove)
int status;
debug_decl(remove_timestamp, SUDO_DEBUG_AUTH)
if (build_timestamp() == -1)
if (build_timestamp(NULL) == -1)
debug_return;
status = timestamp_status_internal(true);