2 .\" The contents of this file are subject to the terms of the
3 .\" Common Development and Distribution License (the "License").
4 .\" You may not use this file except in compliance with the License.
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7 .\" or http://www.opensolaris.org/os/licensing.
8 .\" See the License for the specific language governing permissions
9 .\" and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each
12 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
13 .\" If applicable, add the following below this CDDL HEADER, with the
14 .\" fields enclosed by brackets "[]" replaced with your own identifying
15 .\" information: Portions Copyright [yyyy] [name of copyright owner]
18 .\" Copyright (C) 1999, Sun Microsystems, Inc. All Rights Reserved
19 .\" Copyright (c) 2014 Gary Mills
20 .\" Copyright (c) 2018 Peter Tribble
27 .Nd get entries from administrative database
34 gets a list of entries from the administrative database specified by
36 The information generally comes from one or more of the sources that are
40 .Pa /etc/nsswitch.conf .
43 is the name of the database to be examined.
61 For each of these databases,
63 uses the appropriate library routines described in
67 .Xr gethostbyaddr 3NSL ,
68 .Xr gethostbyname 3NSL ,
69 .Xr getipnodebyaddr 3SOCKET ,
70 .Xr getipnodebyname 3SOCKET ,
71 .Xr getservbyname 3SOCKET ,
72 .Xr getprotobyname 3SOCKET ,
74 .Xr getprojbyname 3PROJECT ,
75 .Xr getnetbyname 3SOCKET ,
76 .Xr getauthattr 3SECDB ,
77 .Xr getexecattr 3SECDB ,
78 .Xr getprofattr 3SECDB ,
80 .Xr getuserattr 3SECDB
85 must be in a format appropriate for searching on the respective database.
86 For example, it can be a username or numeric-uid for
88 hostname or IP address for
90 or service, service/protocol, port, or port/proto for
94 prints out the database entries that match each of the supplied keys, one per
95 line, in the format of the matching administrative file:
111 If no key is given, all entries returned by the corresponding enumeration
112 library routine, for example,
115 .Xr gethostent 3NSL ,
117 Enumeration is not supported on
122 .Ss Key Interpretation for passwd, group, and user_attr Databases
129 each key value is processed as follows:
132 If the key value consists only of numeric characters,
134 assumes that the key value is a numeric user ID and searches the
136 database for a matching user ID.
138 If the user ID is not found in the
140 database or if the key value contains any non-numeric characters,
142 assumes the key value is a user name and searches the
144 database for a matching user name.
153 each key value is processed as follows:
156 If the key value consists only of numeric characters,
158 assumes that the key value is a numeric group ID and searches the
160 database for a matching group ID.
162 If the group ID is not found in the
164 database or if the key value contains any non-numeric characters,
166 assumes the key value is a group name and searches the
168 database for a matching group name.
177 each key value is processed as follows:
180 If the key value consists only of numeric characters,
182 assumes that the key value is a numeric user ID and searches the
184 database for a matching user name, which is then used as the key for
187 If the user ID is not found in the
189 database or if the key value contains any non-numeric characters,
191 assumes the key value is a user name and searches the
193 database for a matching entry.
197 .It Pa /etc/nsswitch.conf
198 name service switch configuration file
202 shadowed password file
205 .It Pa /etc/inet/hosts
206 IPv4 and IPv6 host name database
208 Internet services and aliases
211 .It Pa /etc/protocols
212 protocol name database
214 Ethernet address to hostname database or domain
216 network name database
218 network mask database
219 .It Pa /etc/user_attr
220 extended user attributes database
221 .It Pa /etc/security/auth_attr
222 authorization description database
223 .It Pa /etc/security/exec_attr
224 execution profiles database
225 .It Pa /etc/security/prof_attr
226 profile description database
229 The following exit values are returned:
231 .Bl -tag -width Ds -compact
233 Successful completion.
235 Command syntax was incorrect, an invalid option was used, or an internal error
238 At least one of the specified entry names was not found in the database.
240 There is no support for enumeration on this database.
246 .Xr gethostbyaddr 3NSL ,
247 .Xr gethostbyname 3NSL ,
248 .Xr gethostent 3NSL ,
249 .Xr getprojbyname 3PROJECT ,
250 .Xr getauthattr 3SECDB ,
251 .Xr getexecattr 3SECDB ,
252 .Xr getprofattr 3SECDB ,
253 .Xr getuserattr 3SECDB ,
255 .Xr getipnodebyaddr 3SOCKET ,
256 .Xr getipnodebyname 3SOCKET ,
257 .Xr getnetbyname 3SOCKET ,
258 .Xr getprotobyname 3SOCKET ,
259 .Xr getservbyname 3SOCKET ,
267 .Xr nsswitch.conf 4 ,