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
100
101
102
103
104
105
106
|
'\" te
.\" Copyright (c) 2005, 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 DOOR_UCRED 3C "Mar 22, 2005"
.SH NAME
door_ucred \- return credential information associated with the client
.SH SYNOPSIS
.LP
.nf
\fBcc\fR \fB-mt\fR [ \fIflag\fR... ] \fIfile\fR... [ \fIlibrary\fR... ]
#include <door.h>
\fBint\fR \fBdoor_ucred\fR(\fBucred_t **\fR\fIinfo\fR);
.fi
.SH DESCRIPTION
.LP
The \fBdoor_ucred()\fR function returns credential information associated with
the client, if any, of the current door invocation.
.sp
.LP
When successful, \fBdoor_ucred()\fR writes a pointer to a user credential to
the location pointed to by \fIinfo\fR if that location was previously
\fINULL\fR. If that location was non-null, \fBdoor_ucred()\fR assumes that
\fIinfo\fR points to a previously allocated \fBucred_t\fR which is then reused.
The location pointed to by \fIinfo\fR can be used multiple times before being
freed. The value returned in \fIinfo\fR must be freed using
\fBucred_free\fR(3C).
.sp
.LP
The resulting user credential includes information about the effective user and
group ID, the real user and group ID, all privilege sets and the calling PID.
.sp
.LP
The credential information associated with the client refers to the information
from the immediate caller, not necessarily from the first thread in a chain of
door calls.
.SH RETURN VALUES
.LP
Upon successful completion, \fBdoor_ucred()\fR returns 0. Otherwise, -1 is
returned and \fBerrno\fR is set to indicate the error, in which case the memory
location pointed to by the \fIinfo\fR argument is unchanged.
.SH ERRORS
.LP
The \fBdoor_ucred()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 10n
The location pointed to by \fIinfo\fR was \fINULL\fR and allocating memory
sufficient to hold a ucred failed.
.RE
.sp
.ne 2
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
The address of the \fIinfo\fR argument is invalid.
.RE
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
There is no associated door client.
.RE
.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
The location pointed to by \fIinfo\fR was \fINULL\fR and allocating memory
sufficient to hold a ucred failed.
.RE
.SH ATTRIBUTES
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability Stable
_
MT-Level Safe
.TE
.SH SEE ALSO
.LP
\fBdoor_call\fR(3C), \fBdoor_create\fR(3C), \fBucred_get\fR(3C),
\fBattributes\fR(5)
|