logline = new_logline(message, 0);
+ /* Become root if we are not already. */
+ set_perms(PERM_ROOT|PERM_NOEXIT);
+
if (should_mail(status))
send_mail("%s", logline); /* send mail based on status */
if (def_logfile)
do_logfile(logline);
+ restore_perms();
+
efree(logline);
/* Restore locale. */
logline = new_logline(NULL, 0);
+ /* Become root if we are not already. */
+ set_perms(PERM_ROOT|PERM_NOEXIT);
+
if (should_mail(status))
send_mail("%s", logline); /* send mail based on status */
if (def_logfile)
do_logfile(logline);
+ restore_perms();
+
efree(logline);
sudoers_setlocale(oldlocale, NULL);
va_list ap2;
debug_decl(vlog_error, SUDO_DEBUG_LOGGING)
- /* Become root if we are not already to avoid user interference */
- set_perms(PERM_ROOT|PERM_NOEXIT);
-
/* Need extra copy of ap for warning() below. */
if (!ISSET(flags, NO_STDERR))
va_copy(ap2, ap);
efree(message);
}
+ /* Become root if we are not already. */
+ set_perms(PERM_ROOT|PERM_NOEXIT);
+
/*
* Send a copy of the error via mail.
*/
do_logfile(logline);
}
+ restore_perms();
+
efree(logline);
sudoers_setlocale(oldlocale, NULL);
- restore_perms();
-
/*
* Tell the user (in their locale).
*/