summaryrefslogtreecommitdiff
path: root/logsrvd
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@sudo.ws>2021-10-18 15:34:48 -0600
committerTodd C. Miller <Todd.Miller@sudo.ws>2021-10-18 15:34:48 -0600
commit026582c94bcafadd5905a07de1c5abf76fedd4a3 (patch)
treea991393898a231feb049daa3e1a69c1a89d56f63 /logsrvd
parentf1dacb6b23db07370ff442e27d267ba504984995 (diff)
downloadsudo-026582c94bcafadd5905a07de1c5abf76fedd4a3.tar.gz
Handle a missing run_time in an ExitMessage.
It is now possible to pass a NULL run_time to eventlog_exit().
Diffstat (limited to 'logsrvd')
-rw-r--r--logsrvd/logsrvd_local.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/logsrvd/logsrvd_local.c b/logsrvd/logsrvd_local.c
index 6b30f9d9f..ea0de8ad1 100644
--- a/logsrvd/logsrvd_local.c
+++ b/logsrvd/logsrvd_local.c
@@ -264,12 +264,16 @@ bool
store_exit_local(ExitMessage *msg, uint8_t *buf, size_t len,
struct connection_closure *closure)
{
+ struct timespec ts, *run_time = NULL;
const char *signame = NULL;
- struct timespec run_time = { msg->run_time->tv_sec, msg->run_time->tv_nsec };
int flags = 0;
- mode_t mode;
debug_decl(store_exit_local, SUDO_DEBUG_UTIL);
+ if (msg->run_time != NULL) {
+ ts.tv_sec = msg->run_time->tv_sec;
+ ts.tv_nsec = msg->run_time->tv_nsec;
+ run_time = &ts;
+ }
if (msg->signal != NULL && msg->signal[0] != '\0') {
signame = msg->signal;
sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO,
@@ -280,7 +284,7 @@ store_exit_local(ExitMessage *msg, uint8_t *buf, size_t len,
"command exited with %d", msg->exit_value);
}
if (logsrvd_conf_log_exit()) {
- if (!eventlog_exit(closure->evlog, flags, &run_time, msg->exit_value,
+ if (!eventlog_exit(closure->evlog, flags, run_time, msg->exit_value,
signame, msg->dumped_core)) {
closure->errstr = _("error logging exit event");
debug_return_bool(false);
@@ -289,7 +293,7 @@ store_exit_local(ExitMessage *msg, uint8_t *buf, size_t len,
if (closure->log_io) {
/* Clear write bits from I/O timing file to indicate completion. */
- mode = logsrvd_conf_iolog_mode();
+ mode_t mode = logsrvd_conf_iolog_mode();
CLR(mode, S_IWUSR|S_IWGRP|S_IWOTH);
if (fchmodat(closure->iolog_dir_fd, "timing", mode, 0) == -1) {
sudo_warn("chmod 0%o %s/%s", (unsigned int)mode, "timing",