aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/openbsm/libbsm
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/openbsm/libbsm')
-rw-r--r--contrib/openbsm/libbsm/bsm_notify.c29
-rw-r--r--contrib/openbsm/libbsm/bsm_wrappers.c6
2 files changed, 29 insertions, 6 deletions
diff --git a/contrib/openbsm/libbsm/bsm_notify.c b/contrib/openbsm/libbsm/bsm_notify.c
index 92f9b504d7fc..6741025bc33f 100644
--- a/contrib/openbsm/libbsm/bsm_notify.c
+++ b/contrib/openbsm/libbsm/bsm_notify.c
@@ -26,15 +26,12 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_notify.c#8 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_notify.c#9 $
*/
-#ifdef __APPLE__
-
/*
* Based on sample code from Marc Majka.
*/
-#include <notify.h>
#include <string.h> /* strerror() */
#include <sys/errno.h> /* errno */
#include <bsm/libbsm.h>
@@ -42,6 +39,8 @@
#include <syslog.h> /* syslog() */
#include <stdarg.h> /* syslog() */
+#ifdef __APPLE__
+#include <notify.h>
/* If 1, assumes a kernel that sends the right notification. */
#define AUDIT_NOTIFICATION_ENABLED 1
@@ -145,5 +144,25 @@ au_get_state(void)
return (AUC_AUDITING);
}
}
+#endif /* !__APPLE__ */
+
+int
+cannot_audit(int val __unused)
+{
+#ifdef __APPLE__
+ return (!(au_get_state() == AUC_AUDITING));
+#else
+ unsigned long au_cond;
-#endif /* !__APPLE__ */
+ if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) {
+ if (errno != ENOSYS) {
+ syslog(LOG_ERR, "Audit status check failed (%s)",
+ strerror(errno));
+ }
+ return (1);
+ }
+ if (au_cond == AUC_NOAUDIT || au_cond == AUC_DISABLED)
+ return (1);
+ return (0);
+#endif /* !__APPLE__ */
+}
diff --git a/contrib/openbsm/libbsm/bsm_wrappers.c b/contrib/openbsm/libbsm/bsm_wrappers.c
index e7600e7f5ee2..492963e88ab3 100644
--- a/contrib/openbsm/libbsm/bsm_wrappers.c
+++ b/contrib/openbsm/libbsm/bsm_wrappers.c
@@ -26,9 +26,13 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_wrappers.c#14 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_wrappers.c#16 $
*/
+#ifdef __APPLE__
+#define _SYS_AUDIT_H /* Prevent include of sys/audit.h. */
+#endif
+
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/sysctl.h>