1.\" 2.\" Copyright (c) 2008-2011 Apple Inc. All rights reserved. 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.\" 28.Dd March 6, 2011 29.Dt GETAUDIT_ADDR 2 30.Os 31.Sh NAME 32.Nm getaudit_addr , 33.Nm getaudit(NOW DEPRECATED) 34.Nd "retrieve audit session state" 35.Sh SYNOPSIS 36.In bsm/audit.h 37.In bsm/audit_session.h 38.Ft int 39.Fn getaudit_addr "auditinfo_addr_t *auditinfo_addr" "u_int length" 40.Sh SYNOPSIS (NOW DEPRECATED) 41.In bsm/audit.h 42.Ft int 43.Fn getaudit "auditinfo_t *auditinfo" 44.Sh DESCRIPTION 45The 46.Fn getaudit_addr 47system call 48retrieves extended state via 49.Fa auditinfo_addr 50and 51.Fa length . 52It 53uses the 54.Fa auditinfo_addr_t 55data structure supports Terminal IDs incuding those with larger addresses such 56as those used in IP version 6. It is defined as follows: 57.nf 58.Bd -literal -offset indent 59struct auditinfo_addr { 60 au_id_t ai_auid; /* Audit user ID. */ 61 au_mask_t ai_mask; /* Audit masks. */ 62 au_tid_addr_t ai_termid; /* Terminal ID. */ 63 au_asid_t ai_asid; /* Audit session ID. */ 64 u_int64_t ai_flags; /* Audit session flags. */ 65}; 66typedef struct auditinfo_addr auditinfo_addr_t; 67.Ed 68.fi 69.Pp 70The 71.Fa ai_auid 72variable contains the audit identifier which is recorded in the audit log for 73each event the process caused. 74.Pp 75The 76.Fa au_mask_t 77data structure defines the bit mask for auditing successful and failed events 78out of the predefined list of event classes. 79It is defined as follows: 80.nf 81.Bd -literal -offset indent 82struct au_mask { 83 unsigned int am_success; /* success bits */ 84 unsigned int am_failure; /* failure bits */ 85}; 86typedef struct au_mask au_mask_t; 87.Ed 88.fi 89.Pp 90The 91.Fa au_tid_addr_t 92data structure which includes a larger address storage field and an additional 93field with the type of address stored: 94.nf 95.Bd -literal -offset indent 96struct au_tid_addr { 97 dev_t at_port; 98 u_int32_t at_type; 99 u_int32_t at_addr[4]; 100}; 101typedef struct au_tid_addr au_tid_addr_t; 102.Ed 103.fi 104.Pp 105The 106.Fa ai_asid 107variable contains the audit session ID which is recorded with every event 108caused by the process. 109.Pp 110The 111.Fa ai_flags 112variable contains flags that are opaque to the kernel and used by various 113consumers of the 114.Fa auditinfo_addr 115data. 116Please see the 117.Ao Pa bsm/audit_session.h Ac 118header file for more information 119and flag definitions for this platform. 120.Pp 121Without appropriate privilege the audit mask fields will be set to all 122ones. 123.Pp 124The 125.Fn getaudit 126system call (NOW DEPRECATED) 127retrieves the active audit session state for the current process via the 128.Vt auditinfo_t 129pointed to by 130.Fa auditinfo . 131.Pp 132The 133.Fa auditinfo_t 134data structure (NOW DEPRECATED) is defined as follows: 135.nf 136.Bd -literal -offset indent 137struct auditinfo { 138 au_id_t ai_auid; /* Audit user ID */ 139 au_mask_t ai_mask; /* Audit masks */ 140 au_tid_t ai_termid; /* Terminal ID */ 141 au_asid_t ai_asid; /* Audit session ID */ 142}; 143typedef struct auditinfo auditinfo_t; 144.Ed 145.fi 146.Pp 147The 148.Fa au_termid_t 149data structure (NOW DEPRECATED) defines the Terminal ID recorded with 150every event caused by the process. 151It is defined as follows: 152.nf 153.Bd -literal -offset indent 154struct au_tid { 155 dev_t port; 156 u_int32_t machine; 157}; 158typedef struct au_tid au_tid_t; 159.Ed 160.fi 161.Sh RETURN VALUES 162.Rv -std getaudit_addr 163.Sh ERRORS 164The 165.Fn getaudit_addr 166function will fail if: 167.Bl -tag -width Er 168.It Bq Er EFAULT 169A failure occurred while data transferred to or from 170the kernel failed. 171.It Bq Er EINVAL 172Illegal argument was passed by a system call. 173.It Bq Er EOVERFLOW 174The 175.Fa length 176argument indicates an overflow condition will occur. 177.It Bq Er ERANGE 178The address is too big. 179.El 180.Sh SEE ALSO 181.Xr audit 2 , 182.Xr auditon 2 , 183.Xr getauid 2 , 184.Xr setaudit 2 , 185.Xr setauid 2 , 186.Xr libbsm 3 187.Sh HISTORY 188The OpenBSM implementation was created by McAfee Research, the security 189division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004. 190It was subsequently adopted by the TrustedBSD Project as the foundation for 191the OpenBSM distribution. 192.Pp 193.Fn getaudit_addr 194replaced 195.Fn getaudit 196in Mac OS X 10.7 to support longer terminal addresses such as those used 197by IP version 6. 198.Fn getaudit 199is now deprecated and 200.Fn getaudit_addr 201should be used instead. 202.Sh AUTHORS 203.An -nosplit 204This software was created by McAfee Research, the security research division 205of McAfee, Inc., under contract to Apple Computer Inc. 206Additional authors include 207.An Wayne Salamon , 208.An Robert Watson , 209and SPARTA Inc. 210.Pp 211The Basic Security Module (BSM) interface to audit records and audit event 212stream format were defined by Sun Microsystems. 213.Pp 214This manual page was written by 215.An Robert Watson Aq [email protected] 216and 217.An Stacey Son Aq [email protected] . 218