summaryrefslogtreecommitdiff
path: root/usr/src/man/man2/getauid.2
blob: cba39b5321f2972512e7fbdfd097df4c3dde619a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
.\" 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.
.\" 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.
.\" 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]
.TH GETAUID 2 "Apr 16, 2008"
.SH NAME
getauid, setauid \- get or set user audit identity
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lbsm\fR \fB -lsocket \fR \fB -lnsl \fR  [ \fIlibrary\fR ... ]
#include <sys/param.h>
#include <bsm/libbsm.h>

\fBint\fR \fBgetauid\fR(\fBau_id_t *\fR\fIauid\fR);
.fi

.LP
.nf
\fBint\fR \fBsetauid\fR(\fBau_id_t *\fR\fIauid\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBgetauid()\fR function returns the audit user \fBID\fR for the current
process. This value is initially set at login time and inherited by all child
processes. This value does not change when the real/effective user \fBIDs\fR
change, so it can be used to identify the logged-in user even when running a
setuid program. The audit user \fBID\fR governs audit decisions for a process.
.sp
.LP
The \fBsetauid()\fR function sets the audit user \fBID\fR for the current
process.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, the \fBgetauid()\fR function returns the audit user
\fBID\fR of the current process on success. Otherwise, it returns \fB\(mi1\fR
and sets \fBerrno\fR to indicate the error.
.sp
.LP
Upon successful completion the \fBsetauid()\fR function returns \fB0\fR.
Otherwise, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the
error.
.SH ERRORS
.sp
.LP
The \fBgetauid()\fR and \fBsetauid()\fR functions will fail if:
.sp
.ne 2
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
The \fIauid\fR argument points to an invalid address.
.RE

.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 10n
The {\fBPRIV_SYS_AUDIT\fR} privilege is not asserted in the effective set of
the calling process.
.RE

.sp
.LP
The \fBgetauid()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 9n
The {\fBPRIV_PROC_AUDIT\fR} privilege is not asserted in the effective set of
the calling process.
.RE

.SH USAGE
.sp
.LP
Only a process with appropriate privileges can successfully execute these
calls.
.SH SEE ALSO
.sp
.LP
\fBbsmconv\fR(1M), \fBaudit\fR(2), \fBgetaudit\fR(2), \fBprivileges\fR(5)
.SH NOTES
.sp
.LP
The functionality described on this manual page is available only if the
Solaris Auditing has been enabled.  See \fBbsmconv\fR(1M) for more information.
.sp
.LP
These functions have been superseded by \fBgetaudit\fR(2) and \fBsetaudit()\fR.