# HG changeset patch # User Todd C. Miller # 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);