59 lines
2.1 KiB
Diff
59 lines
2.1 KiB
Diff
From fc252b5dd06cb0159fd31309bcffef410c724688 Mon Sep 17 00:00:00 2001
|
|
From: "Todd C. Miller" <Todd.Miller@sudo.ws>
|
|
Date: Fri, 29 Jan 2021 05:42:34 -0700
|
|
Subject: [PATCH] Fix NO_ROOT_MAILER, broken by the eventlog refactor in sudo
|
|
1.9.4. init_eventlog_config() is called immediately after initializing the
|
|
Defaults settings, which is before struct sudo_user is setup. This adds a
|
|
call to eventlog_set_mailuid() if NO_ROOT_MAILER is defined after the
|
|
invoking user is determined. Reported by Roman Fiedler.
|
|
|
|
(cherry picked from commit e5ad88488d57dd30a7f08f46b395bccfd3957293)
|
|
---
|
|
plugins/sudoers/logging.c | 7 +------
|
|
plugins/sudoers/policy.c | 4 ++++
|
|
2 files changed, 5 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c
|
|
index 776f881e5..06efbf576 100644
|
|
--- a/plugins/sudoers/logging.c
|
|
+++ b/plugins/sudoers/logging.c
|
|
@@ -786,11 +786,6 @@ void
|
|
init_eventlog_config(void)
|
|
{
|
|
int logtype = 0;
|
|
-#ifdef NO_ROOT_MAILER
|
|
- uid_t mailuid = user_uid;
|
|
-#else
|
|
- uid_t mailuid = ROOT_UID;
|
|
-#endif
|
|
debug_decl(init_eventlog_config, SUDOERS_DEBUG_LOGGING);
|
|
|
|
if (def_syslog)
|
|
@@ -805,7 +800,7 @@ init_eventlog_config(void)
|
|
eventlog_set_syslog_alertpri(def_syslog_badpri);
|
|
eventlog_set_syslog_maxlen(def_syslog_maxlen);
|
|
eventlog_set_file_maxlen(def_loglinelen);
|
|
- eventlog_set_mailuid(mailuid);
|
|
+ eventlog_set_mailuid(ROOT_UID);
|
|
eventlog_set_omit_hostname(!def_log_host);
|
|
eventlog_set_logpath(def_logfile);
|
|
eventlog_set_time_fmt(def_log_year ? "%h %e %T %Y" : "%h %e %T");
|
|
diff --git a/plugins/sudoers/policy.c b/plugins/sudoers/policy.c
|
|
index d675d2fd4..074c3f0e8 100644
|
|
--- a/plugins/sudoers/policy.c
|
|
+++ b/plugins/sudoers/policy.c
|
|
@@ -518,6 +518,10 @@ sudoers_policy_deserialize_info(void *v)
|
|
/* Some systems support fexecve() which we use for digest matches. */
|
|
cmnd_fd = -1;
|
|
|
|
+#ifdef NO_ROOT_MAILER
|
|
+ eventlog_set_mailuid(user_uid);
|
|
+#endif
|
|
+
|
|
/* Dump settings and user info (XXX - plugin args) */
|
|
for (cur = info->settings; *cur != NULL; cur++)
|
|
sudo_debug_printf(SUDO_DEBUG_INFO, "settings: %s", *cur);
|
|
--
|
|
2.53.0
|
|
|