]> git.saurik.com Git - apple/xnu.git/blame - bsd/man/man2/getaudit.2
xnu-1504.15.3.tar.gz
[apple/xnu.git] / bsd / man / man2 / getaudit.2
CommitLineData
2d21ac55 1.\"
b0d623f7 2.\" Copyright (c) 2008-2009 Apple Inc. All rights reserved.
2d21ac55
A
3.\"
4.\" @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5.\"
6.\" This file contains Original Code and/or Modifications of Original Code
7.\" as defined in and that are subject to the Apple Public Source License
8.\" Version 2.0 (the 'License'). You may not use this file except in
9.\" compliance with the License. The rights granted to you under the License
10.\" may not be used to create, or enable the creation or redistribution of,
11.\" unlawful or unlicensed copies of an Apple operating system, or to
12.\" circumvent, violate, or enable the circumvention or violation of, any
13.\" terms of an Apple operating system software license agreement.
14.\"
15.\" Please obtain a copy of the License at
16.\" http://www.opensource.apple.com/apsl/ and read it before using this file.
17.\"
18.\" The Original Code and all software distributed under the License are
19.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23.\" Please see the License for the specific language governing rights and
24.\" limitations under the License.
25.\"
26.\" @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27.\"
b0d623f7 28.Dd March 6, 2009
2d21ac55 29.Dt GETAUDIT 2
b0d623f7 30.Os
2d21ac55 31.Sh NAME
b0d623f7
A
32.Nm getaudit ,
33.Nm getaudit_addr
34.Nd "retrieve audit session state"
2d21ac55 35.Sh SYNOPSIS
b0d623f7 36.In bsm/audit.h
2d21ac55 37.Ft int
b0d623f7
A
38.Fn getaudit "auditinfo_t *auditinfo"
39.Ft int
40.Fn getaudit_addr "auditinfo_addr_t *auditinfo_addr" "u_int length"
2d21ac55
A
41.Sh DESCRIPTION
42The
43.Fn getaudit
b0d623f7
A
44system call
45retrieves the active audit session state for the current process via the
46.Vt auditinfo_t
47pointed to by
2d21ac55 48.Fa auditinfo .
b0d623f7
A
49The
50.Fn getaudit_addr
51system call
52retrieves extended state via
53.Fa auditinfo_addr
54and
55.Fa length .
56.Pp
57The
58.Fa auditinfo_t
59data structure is defined as follows:
60.nf
61.in +4n
62
63struct auditinfo {
64 au_id_t ai_auid; /* Audit user ID */
65 au_mask_t ai_mask; /* Audit masks */
66 au_tid_t ai_termid; /* Terminal ID */
67 au_asid_t ai_asid; /* Audit session ID */
68};
69typedef struct auditinfo auditinfo_t;
70.in
71.fi
72.Pp
73The
74.Fa ai_auid
75variable contains the audit identifier which is recorded in the audit log for
76each event the process caused.
77.PP
78
79The
80.Fa au_mask_t
81data structure defines the bit mask for auditing successful and failed events
82out of the predefined list of event classes. It is defined as follows:
83.nf
84.in +4n
85
86struct au_mask {
87 unsigned int am_success; /* success bits */
88 unsigned int am_failure; /* failure bits */
89};
90typedef struct au_mask au_mask_t;
91.in
92.fi
93.PP
94
95The
96.Fa au_termid_t
97data structure defines the Terminal ID recorded with every event caused by the
98process. It is defined as follows:
99.nf
100.in +4n
101
102struct au_tid {
103 dev_t port;
104 u_int32_t machine;
105};
106typedef struct au_tid au_tid_t;
107.in
108.fi
109.PP
110
111The
112.Fa ai_asid
113variable contains the audit session ID which is recorded with every event
114caused by the process.
115.Pp
116The
117.Fn getaudit_addr
118system call
119uses the expanded
120.Fa auditinfo_addr_t
121data structure supports Terminal IDs with larger addresses such as those used
122in IP version 6. It is defined as follows:
123.nf
124.in +4n
125
126struct auditinfo_addr {
127 au_id_t ai_auid; /* Audit user ID. */
128 au_mask_t ai_mask; /* Audit masks. */
129 au_tid_addr_t ai_termid; /* Terminal ID. */
130 au_asid_t ai_asid; /* Audit session ID. */
131 u_int64_t ai_flags; /* Audit session flags. */
132};
133typedef struct auditinfo_addr auditinfo_addr_t;
134.in
135.fi
136.Pp
137
138The
139.Fa au_tid_addr_t
140data structure which includes a larger address storage field and an additional
141field with the type of address stored:
142.nf
143.in +4n
144
145struct au_tid_addr {
146 dev_t at_port;
147 u_int32_t at_type;
148 u_int32_t at_addr[4];
149};
150typedef struct au_tid_addr au_tid_addr_t;
151.in
152.fi
153.Pp
154Without appropriate privilege the audit mask fields will be set to all
155ones.
2d21ac55 156.Sh RETURN VALUES
b0d623f7
A
157.Rv -std getaudit getaudit_addr
158.Sh ERRORS
159The
160.Fn getaudit
161function will fail if:
162.Bl -tag -width Er
163.It Bq Er EFAULT
164A failure occurred while data transferred to or from
165the kernel failed.
166.It Bq Er EINVAL
167Illegal argument was passed by a system call.
168.It Bq Er EOVERFLOW
169The
170.Fa length
171argument indicates an overflow condition will occur.
172.It Bq Er ERANGE
173The address is too big and, therefore,
174.Fn getaudit_addr
175should be used instead.
176.El
2d21ac55
A
177.Sh SEE ALSO
178.Xr audit 2 ,
179.Xr auditon 2 ,
2d21ac55 180.Xr getauid 2 ,
b0d623f7 181.Xr setaudit 2 ,
2d21ac55 182.Xr setauid 2 ,
b0d623f7 183.Xr libbsm 3
2d21ac55 184.Sh HISTORY
b0d623f7
A
185The OpenBSM implementation was created by McAfee Research, the security
186division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
187It was subsequently adopted by the TrustedBSD Project as the foundation for
188the OpenBSM distribution.
189.Sh AUTHORS
190.An -nosplit
191This software was created by McAfee Research, the security research division
192of McAfee, Inc., under contract to Apple Computer Inc.
193Additional authors include
194.An Wayne Salamon ,
195.An Robert Watson ,
196and SPARTA Inc.
197.Pp
198The Basic Security Module (BSM) interface to audit records and audit event
199stream format were defined by Sun Microsystems.
200.Pp
201This manual page was written by
202.An Robert Watson Aq rwatson@FreeBSD.org .