2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-03 15:55:40 +00:00

Fix the date written used by the exit record in sudo-format log files

The change to always get the current time when building a struct
evlog in sudoers broke the data and time written for exit records.
This only affected file-based logs, not syslog.  GitHub issue #405.
This commit is contained in:
Todd C. Miller
2024-09-06 13:05:47 -06:00
parent f47c88065a
commit 22b320645c
3 changed files with 7 additions and 1 deletions

View File

@@ -655,6 +655,11 @@ log_exit_status(const struct sudoers_context *ctx, int status)
if (!def_log_exit_status)
SET(evl_flags, EVLOG_MAIL_ONLY);
}
/*
* eventlog_exit() expects event_time to be the command start time,
* not the current time as set by sudoers_to_eventlog().
*/
sudo_timespecsub(&evlog.event_time, &run_time, &evlog.event_time);
evlog.run_time = run_time;
evlog.exit_value = exit_value;
evlog.signal_name = signal_name;