]> granicus.if.org Git - sudo/commitdiff
Solaris BSM audit return EINVAL when auditing is not enabled, whereas
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 8 Sep 2010 13:47:00 +0000 (09:47 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 8 Sep 2010 13:47:00 +0000 (09:47 -0400)
OpenBSM returns ENOSYS.

plugins/sudoers/bsm_audit.c

index 2b16f05102198d0c56199125fb359a07f4de8f57..787786fd3ffb3988b49d14468308623af070ca0a 100644 (file)
 
 #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
@@ -72,7 +82,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");
        }
@@ -133,7 +143,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");
        }