xref: /freebsd/contrib/openbsm/libbsm/au_notify.3 (revision b626f5a73a48f44a31a200291b141e1da408a2ff)
1.\"-
2.\" Copyright (c) 2004-2009 Apple Inc.
3.\" Copyright (c) 2015 Christian Brueffer
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the author nor the names of
15.\"    its contributors may be used to endorse or promote products derived
16.\"    from this software without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.Dd July 29, 2015
31.Dt AU_NOTIFY 3
32.Os
33.Sh NAME
34.Nm au_get_state ,
35.Nm au_notify_initialize ,
36.Nm au_notify_terminate
37.Nd "audit event notification"
38.Sh LIBRARY
39.Lb libbsm
40.Sh SYNOPSIS
41.In bsm/libbsm.h
42.Ft int
43.Fn au_get_state "void"
44.Ft uint32_t
45.Fn au_notify_initialize "void"
46.Ft int
47.Fn au_notify_terminate "void"
48.Sh DESCRIPTION
49The
50.Nm au_notify
51audit notification API tracks audit state in a form permitting efficient
52update, avoiding frequent system calls to check the kernel audit state.
53It is implemented only for Darwin/Mac OS X.
54.Pp
55The
56.Fn au_get_state
57function provides a lightweight way to check whether or not auditing is
58enabled.
59If a client wants to use this function to determine whether an entire
60series of audit calls should be made -- as in the common case of a caller
61building a set of tokens, then writing them -- it should cache the audit
62status in a local variable.
63This function always returns the current state of auditing.
64If audit notification has not already been initialized by calling
65.Fn au_notify_initialize
66it will be automatically initialized on the first call of
67this function.
68.Pp
69The
70.Fn au_notify_initialize
71function initializes audit notification.
72.Pp
73The
74.Fn au_notify_terminate
75function cancels audit notification and frees the resources associated with it.
76Responsible code that no longer needs to use
77.Fn au_get_state
78should call this function.
79.Sh RETURN VALUES
80If no error occurred the
81.Fn au_get_state
82function returns
83.Dv AUC_NOAUDIT
84if auditing is disabled or suspended, and
85.Dv AUC_AUDITING
86if auditing is enabled and active.
87Otherwise, the function can return any of the errno values defined for
88.Xr setaudit 2 ,
89or
90.Dv AU_UNIMPL
91if audit does not appear to be supported by the system.
92.Pp
93The
94.Fn au_notify_initialize
95function returns 0 on success,
96.Dv AU_UNIMPL
97if audit does not appear to be supported by the system,
98or one of the status codes defined in
99.In notify.h
100on Mac OS X to indicate the error.
101.Pp
102The
103.Fn au_notify_terminate
104function returns 0 on success, or \-1 on failure.
105.Sh SEE ALSO
106.Xr libbsm 3 ,
107.Xr notify 3 (Mac OS X)
108.Sh HISTORY
109The OpenBSM implementation was created by McAfee Research, the security
110division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
111It was subsequently adopted by the TrustedBSD Project as the foundation for
112the OpenBSM distribution.
113.Sh AUTHORS
114This software was created by
115.An Apple Computer, Inc .
116.Pp
117The Basic Security Module (BSM) interface to audit records and audit event
118stream format were defined by Sun Microsystems.
119