--- embedaddon/sudo/plugins/sudoers/audit.c 2012/02/21 16:23:02 1.1.1.1 +++ embedaddon/sudo/plugins/sudoers/audit.c 2013/10/14 07:56:34 1.1.1.4 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 Todd C. Miller + * Copyright (c) 2009-2012 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -26,10 +26,16 @@ # include # endif #endif /* STDC_HEADERS */ +#ifdef HAVE_STDBOOL_H +# include +#else +# include "compat/stdbool.h" +#endif /* HAVE_STDBOOL_H */ #include #include "missing.h" #include "logging.h" +#include "sudo_debug.h" #ifdef HAVE_BSM_AUDIT # include "bsm_audit.h" @@ -38,34 +44,48 @@ # include "linux_audit.h" #endif +#define DEFAULT_TEXT_DOMAIN "sudoers" +#include "gettext.h" + void audit_success(char *exec_args[]) { - if (exec_args == NULL) - return; + debug_decl(audit_success, SUDO_DEBUG_AUDIT) + if (exec_args != NULL) { #ifdef HAVE_BSM_AUDIT - bsm_audit_success(exec_args); + bsm_audit_success(exec_args); #endif #ifdef HAVE_LINUX_AUDIT - linux_audit_command(exec_args, 1); + linux_audit_command(exec_args, 1); #endif + } + + debug_return; } void audit_failure(char *exec_args[], char const *const fmt, ...) { va_list ap; + int oldlocale; + debug_decl(audit_success, SUDO_DEBUG_AUDIT) - if (exec_args == NULL) - return; + /* Audit error messages should be in the sudoers locale. */ + sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale); - va_start(ap, fmt); + if (exec_args != NULL) { + va_start(ap, fmt); #ifdef HAVE_BSM_AUDIT - bsm_audit_failure(exec_args, fmt, ap); + bsm_audit_failure(exec_args, _(fmt), ap); #endif #ifdef HAVE_LINUX_AUDIT - linux_audit_command(exec_args, 0); + linux_audit_command(exec_args, 0); #endif - va_end(ap); + va_end(ap); + } + + sudoers_setlocale(oldlocale, NULL); + + debug_return; }