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.
This commit is contained in:
@@ -786,11 +786,6 @@ void
|
|||||||
init_eventlog_config(void)
|
init_eventlog_config(void)
|
||||||
{
|
{
|
||||||
int logtype = 0;
|
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);
|
debug_decl(init_eventlog_config, SUDOERS_DEBUG_LOGGING);
|
||||||
|
|
||||||
if (def_syslog)
|
if (def_syslog)
|
||||||
@@ -805,7 +800,7 @@ init_eventlog_config(void)
|
|||||||
eventlog_set_syslog_alertpri(def_syslog_badpri);
|
eventlog_set_syslog_alertpri(def_syslog_badpri);
|
||||||
eventlog_set_syslog_maxlen(def_syslog_maxlen);
|
eventlog_set_syslog_maxlen(def_syslog_maxlen);
|
||||||
eventlog_set_file_maxlen(def_loglinelen);
|
eventlog_set_file_maxlen(def_loglinelen);
|
||||||
eventlog_set_mailuid(mailuid);
|
eventlog_set_mailuid(ROOT_UID);
|
||||||
eventlog_set_omit_hostname(!def_log_host);
|
eventlog_set_omit_hostname(!def_log_host);
|
||||||
eventlog_set_logpath(def_logfile);
|
eventlog_set_logpath(def_logfile);
|
||||||
eventlog_set_time_fmt(def_log_year ? "%h %e %T %Y" : "%h %e %T");
|
eventlog_set_time_fmt(def_log_year ? "%h %e %T %Y" : "%h %e %T");
|
||||||
|
@@ -518,6 +518,10 @@ sudoers_policy_deserialize_info(void *v)
|
|||||||
/* Some systems support fexecve() which we use for digest matches. */
|
/* Some systems support fexecve() which we use for digest matches. */
|
||||||
cmnd_fd = -1;
|
cmnd_fd = -1;
|
||||||
|
|
||||||
|
#ifdef NO_ROOT_MAILER
|
||||||
|
eventlog_set_mailuid(user_uid);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Dump settings and user info (XXX - plugin args) */
|
/* Dump settings and user info (XXX - plugin args) */
|
||||||
for (cur = info->settings; *cur != NULL; cur++)
|
for (cur = info->settings; *cur != NULL; cur++)
|
||||||
sudo_debug_printf(SUDO_DEBUG_INFO, "settings: %s", *cur);
|
sudo_debug_printf(SUDO_DEBUG_INFO, "settings: %s", *cur);
|
||||||
|
Reference in New Issue
Block a user