|
|
| version 1.1.1.1, 2012/02/21 16:23:02 | version 1.1.1.3.2.1, 2013/07/22 00:54:41 |
|---|---|
| Line 1 | Line 1 |
| /* | /* |
| * Copyright (c) 2009-2010 Todd C. Miller <Todd.Miller@courtesan.com> | * Copyright (c) 2009-2012 Todd C. Miller <Todd.Miller@courtesan.com> |
| * | * |
| * Permission to use, copy, modify, and distribute this software for any | * Permission to use, copy, modify, and distribute this software for any |
| * purpose with or without fee is hereby granted, provided that the above | * purpose with or without fee is hereby granted, provided that the above |
| Line 26 | Line 26 |
| # include <stdlib.h> | # include <stdlib.h> |
| # endif | # endif |
| #endif /* STDC_HEADERS */ | #endif /* STDC_HEADERS */ |
| #ifdef HAVE_STDBOOL_H | |
| # include <stdbool.h> | |
| #else | |
| # include "compat/stdbool.h" | |
| #endif /* HAVE_STDBOOL_H */ | |
| #include <stdarg.h> | #include <stdarg.h> |
| #include "missing.h" | #include "missing.h" |
| #include "logging.h" | #include "logging.h" |
| #include "sudo_debug.h" | |
| #ifdef HAVE_BSM_AUDIT | #ifdef HAVE_BSM_AUDIT |
| # include "bsm_audit.h" | # include "bsm_audit.h" |
| # include "gettext.h" | |
| #endif | #endif |
| #ifdef HAVE_LINUX_AUDIT | #ifdef HAVE_LINUX_AUDIT |
| # include "linux_audit.h" | # include "linux_audit.h" |
| Line 41 | Line 48 |
| void | void |
| audit_success(char *exec_args[]) | audit_success(char *exec_args[]) |
| { | { |
| if (exec_args == NULL) | debug_decl(audit_success, SUDO_DEBUG_AUDIT) |
| return; | |
| if (exec_args != NULL) { | |
| #ifdef HAVE_BSM_AUDIT | #ifdef HAVE_BSM_AUDIT |
| bsm_audit_success(exec_args); | bsm_audit_success(exec_args); |
| #endif | #endif |
| #ifdef HAVE_LINUX_AUDIT | #ifdef HAVE_LINUX_AUDIT |
| linux_audit_command(exec_args, 1); | linux_audit_command(exec_args, 1); |
| #endif | #endif |
| } | |
| debug_return; | |
| } | } |
| void | void |
| audit_failure(char *exec_args[], char const *const fmt, ...) | audit_failure(char *exec_args[], char const *const fmt, ...) |
| { | { |
| va_list ap; | va_list ap; |
| int oldlocale; | |
| debug_decl(audit_success, SUDO_DEBUG_AUDIT) | |
| if (exec_args == NULL) | /* Audit error messages should be in the sudoers locale. */ |
| return; | sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale); |
| va_start(ap, fmt); | if (exec_args != NULL) { |
| va_start(ap, fmt); | |
| #ifdef HAVE_BSM_AUDIT | #ifdef HAVE_BSM_AUDIT |
| bsm_audit_failure(exec_args, fmt, ap); | bsm_audit_failure(exec_args, _(fmt), ap); |
| #endif | #endif |
| #ifdef HAVE_LINUX_AUDIT | #ifdef HAVE_LINUX_AUDIT |
| linux_audit_command(exec_args, 0); | linux_audit_command(exec_args, 0); |
| #endif | #endif |
| va_end(ap); | va_end(ap); |
| } | |
| sudoers_setlocale(oldlocale, NULL); | |
| debug_return; | |
| } | } |