import less(1)
[unleashed/tickless.git] / share / man / man2 / getauid.2
blob51a6bf47a2fb87f2b16175ffebe301d359bc4678
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH GETAUID 2 "Mar 6, 2017"
7 .SH NAME
8 getauid, setauid \- get or set user audit identity
9 .SH SYNOPSIS
10 .LP
11 .nf
12 cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lbsm\fR [ \fIlibrary\fR ... ]
13 #include <sys/param.h>
14 #include <bsm/libbsm.h>
16 \fBint\fR \fBgetauid\fR(\fBau_id_t *\fR\fIauid\fR);
17 .fi
19 .LP
20 .nf
21 \fBint\fR \fBsetauid\fR(\fBau_id_t *\fR\fIauid\fR);
22 .fi
24 .SH DESCRIPTION
25 .LP
26 The \fBgetauid()\fR function returns the audit user \fBID\fR for the current
27 process. This value is initially set at login time and inherited by all child
28 processes. This value does not change when the real/effective user \fBIDs\fR
29 change, so it can be used to identify the logged-in user even when running a
30 setuid program. The audit user \fBID\fR governs audit decisions for a process.
31 .sp
32 .LP
33 The \fBsetauid()\fR function sets the audit user \fBID\fR for the current
34 process.
35 .SH RETURN VALUES
36 .LP
37 Upon successful completion, the \fBgetauid()\fR function returns the audit user
38 \fBID\fR of the current process on success. Otherwise, it returns \fB\(mi1\fR
39 and sets \fBerrno\fR to indicate the error.
40 .sp
41 .LP
42 Upon successful completion the \fBsetauid()\fR function returns \fB0\fR.
43 Otherwise, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the
44 error.
45 .SH ERRORS
46 .LP
47 The \fBgetauid()\fR and \fBsetauid()\fR functions will fail if:
48 .sp
49 .ne 2
50 .na
51 \fB\fBEFAULT\fR\fR
52 .ad
53 .RS 10n
54 The \fIauid\fR argument points to an invalid address.
55 .RE
57 .sp
58 .ne 2
59 .na
60 \fB\fBEPERM\fR\fR
61 .ad
62 .RS 10n
63 The {\fBPRIV_SYS_AUDIT\fR} privilege is not asserted in the effective set of
64 the calling process.
65 .RE
67 .sp
68 .LP
69 The \fBgetauid()\fR function will fail if:
70 .sp
71 .ne 2
72 .na
73 \fB\fBEPERM\fR\fR
74 .ad
75 .RS 9n
76 The {\fBPRIV_PROC_AUDIT\fR} privilege is not asserted in the effective set of
77 the calling process.
78 .RE
80 .SH USAGE
81 .LP
82 Only a process with appropriate privileges can successfully execute these
83 calls.
84 .SH SEE ALSO
85 .LP
86 \fBaudit\fR(2), \fBgetaudit\fR(2), \fBprivileges\fR(5)
87 .SH NOTES
88 .LP
89 These functions have been superseded by \fBgetaudit\fR(2) and \fBsetaudit()\fR.