From 008a0e8dc13b296bf86987c39cbbd5c5b141d981 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 5 Dec 2020 08:31:46 -0700 Subject: [PATCH] Store iolog_path in struct sudo_user for use in the event log. --- plugins/sudoers/logging.c | 2 +- plugins/sudoers/sudoers.c | 6 +++--- plugins/sudoers/sudoers.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c index 9964fe179..33597d607 100644 --- a/plugins/sudoers/logging.c +++ b/plugins/sudoers/logging.c @@ -655,8 +655,8 @@ sudoers_to_eventlog(struct eventlog *evlog, char * const argv[], debug_decl(sudoers_to_eventlog, SUDOERS_DEBUG_LOGGING); memset(evlog, 0, sizeof(*evlog)); - /* TODO: iolog_path */ evlog->iolog_file = sudo_user.iolog_file; + evlog->iolog_path = sudo_user.iolog_path; evlog->command = safe_cmnd ? safe_cmnd : (argv ? argv[0] : NULL); evlog->cwd = user_cwd; if (def_runchroot != NULL && strcmp(def_runchroot, "*") != 0) { diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index 02fac6f2a..28d545595 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -265,9 +265,9 @@ format_iolog_path(void) goto done; } - /* Stash pointer to the I/O log file for use when logging. */ - sudo_user.iolog_file = - iolog_path + sizeof("iolog_path=") - 1 + strlen(dir) + 1; + /* Stash pointer to the I/O log for the event log. */ + sudo_user.iolog_path = iolog_path + sizeof("iolog_path=") - 1; + sudo_user.iolog_file = sudo_user.iolog_path + 1 + strlen(dir); done: debug_return_str(iolog_path); diff --git a/plugins/sudoers/sudoers.h b/plugins/sudoers/sudoers.h index 4bc97fc11..598816425 100644 --- a/plugins/sudoers/sudoers.h +++ b/plugins/sudoers/sudoers.h @@ -114,6 +114,7 @@ struct sudo_user { char *limitprivs; #endif char *iolog_file; + char *iolog_path; GETGROUPS_T *gids; int execfd; int ngids;