From 69e7ae639cda0b1a11312670ff25a1a43f397966 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 8 Sep 2010 09:46:49 -0400 Subject: [PATCH] Solaris BSM audit return EINVAL when auditing is not enabled, whereas OpenBSM returns ENOSYS. --HG-- branch : 1.7 --- bsm_audit.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bsm_audit.c b/bsm_audit.c index b388b86f7..a673d281e 100644 --- a/bsm_audit.c +++ b/bsm_audit.c @@ -31,6 +31,16 @@ #include "bsm_audit.h" +/* + * Solaris auditon() returns EINVAL if BSM audit not configured. + * OpenBSM returns ENOSYS for unimplemented options. + */ +#ifdef __sun__ +# define AUDIT_NOT_CONFIGURED EINVAL +#else +# define AUDIT_NOT_CONFIGURED ENOSYS +#endif + void log_error(int flags, const char *fmt, ...) __attribute__((__noreturn__)); static int @@ -71,7 +81,7 @@ bsm_audit_success(char **exec_args) * If we are not auditing, don't cut an audit record; just return. */ if (auditon(A_GETCOND, (caddr_t)&au_cond, sizeof(long)) < 0) { - if (errno == ENOSYS) + if (errno == AUDIT_NOT_CONFIGURED) return; log_error(0, "Could not determine audit condition"); } @@ -132,7 +142,7 @@ bsm_audit_failure(char **exec_args, char const *const fmt, va_list ap) * If we are not auditing, don't cut an audit record; just return. */ if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) { - if (errno == ENOSYS) + if (errno == AUDIT_NOT_CONFIGURED) return; log_error(0, "Could not determine audit condition"); } -- 2.40.0