/*
- * Copyright (c) 1994-1996, 1998-2010 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 1994-1996, 1998-2012 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
}
/*
- * 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(status, inform_user)
int status;
int inform_user;
char *message;
char *logline;
+ /* 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";
{
int 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))
/*
- * Copyright (c) 1999-2005, 2009
+ * Copyright (c) 1999-2005, 2009-2012
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
void audit_failure __P((char *[], char const * const, ...));
void log_allowed __P((int));
void log_auth_failure __P((int, int));
+void log_denial __P((int, int));
void log_failure __P((int, int));
void log_error __P((int flags, const char *fmt, ...))
__printflike(2, 3);
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;
}