1 .\" $NetBSD: pwcache.3,v 1.17 2008/05/02 18:11:04 martin Exp $
4 .\" Copyright (c) 1989, 1991, 1993
5 .\" The Regents of the University of California. All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
33 .\" All rights reserved.
35 .\" Redistribution and use in source and binary forms, with or without
36 .\" modification, are permitted provided that the following conditions
38 .\" 1. Redistributions of source code must retain the above copyright
39 .\" notice, this list of conditions and the following disclaimer.
40 .\" 2. Redistributions in binary form must reproduce the above copyright
41 .\" notice, this list of conditions and the following disclaimer in the
42 .\" documentation and/or other materials provided with the distribution.
44 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
45 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
46 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
47 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
48 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
49 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
50 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
51 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
52 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
54 .\" POSSIBILITY OF SUCH DAMAGE.
57 .\" @(#)pwcache.3 8.1 (Berkeley) 6/9/93
70 .Nd cache password and group entries
76 .Fn user_from_uid "uid_t uid" "int nouser"
78 .Fn uid_from_user "const char *name" "uid_t *uid"
80 .Fn pwcache_userdb "int (*setpassent)(int)" "void (*endpwent)(void)" "struct passwd * (*getpwnam)(const char *)" "struct passwd * (*getpwuid)(uid_t)"
83 .Fn group_from_gid "gid_t gid" "int nogroup"
85 .Fn gid_from_group "const char *name" "gid_t *gid"
87 .Fn pwcache_groupdb "int (*setgroupent)(int)" "void (*endgrent)(void)" "struct group * (*getgrnam)(const char *)" "struct group * (*getgrgid)(gid_t)"
91 function returns the user name associated with the argument
93 The user name is cached so that multiple calls with the same
95 do not require additional calls to
97 If there is no user associated with the
100 to a string representation of the
104 is non-zero, in which case a
110 function returns the group name associated with the argument
112 The group name is cached so that multiple calls with the same
114 do not require additional calls to
116 If there is no group associated with the
118 a pointer is returned
119 to a string representation of the
123 is non-zero, in which case a
129 function returns the uid associated with the argument
131 The uid is cached so that multiple calls with the same
133 do not require additional calls to
135 If there is no uid associated with the
139 function returns \-1; otherwise it stores the uid at the location pointed to by
145 function returns the gid associated with the argument
147 The gid is cached so that multiple calls with the same
149 do not require additional calls to
151 If there is no gid associated with the
155 function returns \-1; otherwise it stores the gid at the location pointed to by
161 function changes the user database access routines which
165 call to search for users.
166 The caches are flushed and the existing
168 method is called before switching to the new routines.
172 must be provided, and
182 function changes the group database access routines which
186 call to search for groups.
187 The caches are flushed and the existing
189 method is called before switching to the new routines.
193 must be provided, and
201 If insufficient memory is available,
205 may return NULL pointers.
219 functions first appeared in
226 functions first appeared in
233 functions first appeared in