}
/*
- * Log and mail the denial message, optionally informing the user.
+ * Log, audit and mail the denial message, optionally informing the user.
*/
-static void
+void
log_denial(int status, bool inform_user)
{
char *logline, *message;
debug_decl(log_denial, SUDO_DEBUG_LOGGING)
+ /* Handle auditing first. */
+ if (ISSET(status, FLAG_NO_USER | FLAG_NO_HOST))
+ audit_failure(NewArgv, _("No user or host"));
+ else
+ audit_failure(NewArgv, _("validation failure"));
+
/* Set error message. */
if (ISSET(status, FLAG_NO_USER))
message = _("user NOT in sudoers");
debug_decl(log_failure, SUDO_DEBUG_LOGGING)
bool inform_user = true;
- /* Handle auditing first. */
- if (ISSET(status, FLAG_NO_USER | FLAG_NO_HOST))
- audit_failure(NewArgv, _("No user or host"));
- else
- audit_failure(NewArgv, _("validation failure"));
-
/* The user doesn't always get to see the log message (path info). */
if (!ISSET(status, FLAG_NO_USER | FLAG_NO_HOST) && def_path_info &&
(flags == NOT_FOUND_DOT || flags == NOT_FOUND))
void audit_failure(char *exec_args[], char const *const fmt, ...);
void log_allowed(int status);
void log_auth_failure(int status, int tries);
+void log_denial(int status, bool inform_user);
void log_failure(int status, int flags);
void log_error(int flags, const char *fmt, ...) __printflike(2, 3);
void log_fatal(int flags, const char *fmt, ...) __printflike(2, 3) __attribute__((__noreturn__));
rval = check_user(validated, sudo_mode);
if (rval != true) {
if (!ISSET(validated, VALIDATE_OK))
- log_failure(validated, cmnd_status);
+ log_denial(validated, false);
goto done;
}