summaryrefslogtreecommitdiffstats
path: root/debian/patches/fix-no-root-mailer.diff
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/fix-no-root-mailer.diff')
-rw-r--r--debian/patches/fix-no-root-mailer.diff48
1 files changed, 48 insertions, 0 deletions
diff --git a/debian/patches/fix-no-root-mailer.diff b/debian/patches/fix-no-root-mailer.diff
new file mode 100644
index 0000000..873464c
--- /dev/null
+++ b/debian/patches/fix-no-root-mailer.diff
@@ -0,0 +1,48 @@
+
+# HG changeset patch
+# User Todd C. Miller <Todd.Miller@sudo.ws>
+# Date 1611924154 25200
+# Node ID e0d4f196ba027604154f79ddd03a0b90f90c9607
+# Parent cd1c7615e861083e9e9b61d0e0070354e227ea5c
+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.
+
+--- 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");
+--- 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);