summaryrefslogtreecommitdiff
path: root/usr/src/man/man3secdb/getuserattr.3secdb
blob: 72d0a899d07f0641e36287150130a5f9d8e51e7e (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
'\" 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 GETUSERATTR 3SECDB "Aug 13, 2018"
.SH NAME
getuserattr, getusernam, getuseruid, free_userattr, setuserattr, enduserattr,
fgetuserattr \- get user_attr entry
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR... ] \fIfile\fR... -lsecdb  -lsocket  -lnsl [ \fIlibrary\fR... ]
#include <user_attr.h>

\fBuserattr_t *\fR\fBgetuserattr\fR(\fBvoid\fR);
.fi

.LP
.nf
\fBuserattr_t *\fR\fBgetusernam\fR(\fBconst char *\fR\fI\fR\fIname\fR);
.fi

.LP
.nf
\fBuserattr_t *\fR\fBgetuseruid\fR(\fBuid_t\fR \fIuid\fR);
.fi

.LP
.nf
\fBvoid\fR \fBfree_userattr\fR(\fBuserattr_t *\fR\fIuserattr\fR);
.fi

.LP
.nf
\fBvoid\fR \fBsetuserattr\fR(\fBvoid\fR);
.fi

.LP
.nf
\fBvoid\fR \fBenduserattr\fR(\fBvoid\fR);
.fi

.LP
.nf
\fBuserattr_t *\fR\fBfgetuserattr\fR(\fBFILE *\fR\fIf\fR);
.fi

.SH DESCRIPTION
.LP
The \fBgetuserattr()\fR, \fBgetusernam()\fR, and \fBgetuseruid()\fR functions
each return a \fBuser_attr\fR(4) entry. Entries can come from any of the
sources specified in the \fBnsswitch.conf\fR(4) file. The \fBgetuserattr()\fR
function enumerates \fBuser_attr\fR entries. The \fBgetusernam()\fR function
searches for a \fBuser_attr\fR entry with a given user name \fIname\fR. The
\fBgetuseruid()\fR function searches for a \fBuser_attr\fR entry with a given
user ID \fIuid\fR. Successive calls to these functions return either successive
\fBuser_attr\fR entries or \fINULL\fR.
.sp
.LP
The \fBfgetuserattr()\fR function does not use \fBnsswitch.conf\fR but reads
and parses the next line from the stream \fIf\fR. This stream is assumed to
have the format of the \fBuser_attr\fR files.
.sp
.LP
The \fBfree_userattr()\fR function releases memory allocated by the
\fBgetusernam()\fR, \fBgetuserattr()\fR, and \fBfgetuserattr()\fR functions.
.sp
.LP
The internal representation of a \fBuser_attr\fR entry is a \fBuserattr_t\fR
structure defined in <\fBuser_attr.h\fR> with the following members:
.sp
.in +2
.nf
char  *name;       /* name of the user */
char  *qualifier;  /* reserved for future use */
char  *res1;       /* reserved for future use */
char  *res2;       /* reserved for future use */
kva_t *attr;       /* list of attributes */
.fi
.in -2

.sp
.LP
The \fBsetuserattr()\fR function "rewinds" to the beginning of the enumeration
of \fBuser_attr\fR entries.  Calls to \fBgetusernam()\fR may leave the
enumeration in an indeterminate state, so \fBsetuserattr()\fR should be called
before the first call to \fBgetuserattr()\fR.
.sp
.LP
The \fBenduserattr()\fR function may be called to indicate that \fBuser_attr\fR
processing is complete; the library may then close any open \fBuser_attr\fR
file, deallocate any internal storage, and so forth.
.SH RETURN VALUES
.LP
The \fBgetuserattr()\fR function returns a pointer to a \fBuserattr_t\fR if it
successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating
the end of the enumeration.
.sp
.LP
The \fBgetusernam()\fR function returns a pointer to a \fBuserattr_t\fR if it
successfully locates the requested entry; otherwise it returns \fINULL\fR.
.SH USAGE
.LP
The \fBgetuserattr()\fR and \fBgetusernam()\fR functions both allocate memory
for the pointers they return. This memory should be deallocated with the
\fBfree_userattr()\fR function.
.sp
.LP
Individual attributes can be referenced in the \fBattr\fR structure by calling
the \fBkva_match\fR(3SECDB) function.
.SH WARNINGS
.LP
Because the list of legal keys is likely to expand, code must be written to
ignore unknown key-value pairs without error.
.SH FILES
.ne 2
.na
\fB\fB/etc/user_attr\fR\fR
.ad
.RS 22n
extended user attributes
.RE

.sp
.ne 2
.na
\fB\fB/etc/nsswitch.conf\fR\fR
.ad
.RS 22n
configuration file lookup information for the name service switch
.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
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.LP
\fBgetauthattr\fR(3SECDB), \fBgetexecattr\fR(3SECDB),
\fBgetprofattr\fR(3SECDB), \fBkva_match\fR(3SECDB), \fBuser_attr\fR(4),
\fBattributes\fR(5)