X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=plugins%2Fsudoers%2Fbsm_audit.c;h=baf4a8b516c52c907d9f4b60902756b7b246d3f3;hb=e8db7f6eea9b35527ddd4532affabd18a30549b5;hp=bec1cba98242dd6d6e7d05568e803113b5d0adca;hpb=98b9fd63cd28a3636a7cd24641b8f497eaadcd50;p=debian%2Fsudo diff --git a/plugins/sudoers/bsm_audit.c b/plugins/sudoers/bsm_audit.c index bec1cba..baf4a8b 100644 --- a/plugins/sudoers/bsm_audit.c +++ b/plugins/sudoers/bsm_audit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2011 Todd C. Miller + * Copyright (c) 2009-2013 Todd C. Miller * Copyright (c) 2009 Christian S.J. Peron * * Permission to use, copy, modify, and distribute this software for any @@ -57,10 +57,10 @@ audit_sudo_selected(int sf) if (getaudit_addr(&ainfo_addr, sizeof(ainfo_addr)) < 0) { if (errno == ENOSYS) { if (getaudit(&ainfo) < 0) - error(1, _("getaudit: failed")); + fatal("getaudit"); mask = &ainfo.ai_mask; } else - error(1, _("getaudit: failed")); + fatal("getaudit"); } else mask = &ainfo_addr.ai_mask; sorf = (sf == 0) ? AU_PRS_SUCCESS : AU_PRS_FAILURE; @@ -87,7 +87,7 @@ bsm_audit_success(char **exec_args) if (auditon(A_GETCOND, (caddr_t)&au_cond, sizeof(long)) < 0) { if (errno == AUDIT_NOT_CONFIGURED) return; - error(1, _("Could not determine audit condition")); + fatal(_("Could not determine audit condition")); } if (au_cond == AUC_NOAUDIT) debug_return; @@ -98,9 +98,9 @@ bsm_audit_success(char **exec_args) if (!audit_sudo_selected(0)) debug_return; if (getauid(&auid) < 0) - error(1, _("getauid failed")); + fatal("getauid"); if ((aufd = au_open()) == -1) - error(1, _("au_open: failed")); + fatal("au_open"); if (getaudit_addr(&ainfo_addr, sizeof(ainfo_addr)) == 0) { tok = au_to_subject_ex(auid, geteuid(), getegid(), getuid(), getuid(), pid, pid, &ainfo_addr.ai_termid); @@ -109,24 +109,24 @@ bsm_audit_success(char **exec_args) * NB: We should probably watch out for ERANGE here. */ if (getaudit(&ainfo) < 0) - error(1, _("getaudit: failed")); + fatal("getaudit"); tok = au_to_subject(auid, geteuid(), getegid(), getuid(), getuid(), pid, pid, &ainfo.ai_termid); } else - error(1, _("getaudit: failed")); + fatal("getaudit"); if (tok == NULL) - error(1, _("au_to_subject: failed")); + fatal("au_to_subject"); au_write(aufd, tok); tok = au_to_exec_args(exec_args); if (tok == NULL) - error(1, _("au_to_exec_args: failed")); + fatal("au_to_exec_args"); au_write(aufd, tok); tok = au_to_return32(0, 0); if (tok == NULL) - error(1, _("au_to_return32: failed")); + fatal("au_to_return32"); au_write(aufd, tok); if (au_close(aufd, 1, AUE_sudo) == -1) - error(1, _("unable to commit audit record")); + fatal(_("unable to commit audit record")); debug_return; } @@ -150,43 +150,43 @@ bsm_audit_failure(char **exec_args, char const *const fmt, va_list ap) if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) { if (errno == AUDIT_NOT_CONFIGURED) debug_return; - error(1, _("Could not determine audit condition")); + fatal(_("Could not determine audit condition")); } if (au_cond == AUC_NOAUDIT) debug_return; if (!audit_sudo_selected(1)) debug_return; if (getauid(&auid) < 0) - error(1, _("getauid: failed")); + fatal("getauid"); if ((aufd = au_open()) == -1) - error(1, _("au_open: failed")); + fatal("au_open"); if (getaudit_addr(&ainfo_addr, sizeof(ainfo_addr)) == 0) { tok = au_to_subject_ex(auid, geteuid(), getegid(), getuid(), getuid(), pid, pid, &ainfo_addr.ai_termid); } else if (errno == ENOSYS) { if (getaudit(&ainfo) < 0) - error(1, _("getaudit: failed")); + fatal("getaudit"); tok = au_to_subject(auid, geteuid(), getegid(), getuid(), getuid(), pid, pid, &ainfo.ai_termid); } else - error(1, _("getaudit: failed")); + fatal("getaudit"); if (tok == NULL) - error(1, _("au_to_subject: failed")); + fatal("au_to_subject"); au_write(aufd, tok); tok = au_to_exec_args(exec_args); if (tok == NULL) - error(1, _("au_to_exec_args: failed")); + fatal("au_to_exec_args"); au_write(aufd, tok); (void) vsnprintf(text, sizeof(text), fmt, ap); tok = au_to_text(text); if (tok == NULL) - error(1, _("au_to_text: failed")); + fatal("au_to_text"); au_write(aufd, tok); tok = au_to_return32(EPERM, 1); if (tok == NULL) - error(1, _("au_to_return32: failed")); + fatal("au_to_return32"); au_write(aufd, tok); if (au_close(aufd, 1, AUE_sudo) == -1) - error(1, _("unable to commit audit record")); + fatal(_("unable to commit audit record")); debug_return; }