1 .\" $NetBSD: pwcache.3,v 1.18 2017/10/24 19:04:58 abhinav Exp $
3 .\" Copyright (c) 1989, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
32 .\" All rights reserved.
34 .\" Redistribution and use in source and binary forms, with or without
35 .\" modification, are permitted provided that the following conditions
37 .\" 1. Redistributions of source code must retain the above copyright
38 .\" notice, this list of conditions and the following disclaimer.
39 .\" 2. Redistributions in binary form must reproduce the above copyright
40 .\" notice, this list of conditions and the following disclaimer in the
41 .\" documentation and/or other materials provided with the distribution.
43 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
44 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
45 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
46 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
47 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
49 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
50 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
51 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
53 .\" POSSIBILITY OF SUCH DAMAGE.
56 .\" @(#)pwcache.3 8.1 (Berkeley) 6/9/93
69 .Nd cache password and group entries
75 .Fn user_from_uid "uid_t uid" "int nouser"
77 .Fn uid_from_user "const char *name" "uid_t *uid"
79 .Fn pwcache_userdb "int (*setpassent)(int)" "void (*endpwent)(void)" "struct passwd * (*getpwnam)(const char *)" "struct passwd * (*getpwuid)(uid_t)"
82 .Fn group_from_gid "gid_t gid" "int nogroup"
84 .Fn gid_from_group "const char *name" "gid_t *gid"
86 .Fn pwcache_groupdb "int (*setgroupent)(int)" "void (*endgrent)(void)" "struct group * (*getgrnam)(const char *)" "struct group * (*getgrgid)(gid_t)"
90 function returns the user name associated with the argument
92 The user name is cached so that multiple calls with the same
94 do not require additional calls to
96 If there is no user associated with the
99 to a string representation of the
103 is non-zero, in which case a
109 function returns the group name associated with the argument
111 The group name is cached so that multiple calls with the same
113 do not require additional calls to
115 If there is no group associated with the
117 a pointer is returned
118 to a string representation of the
122 is non-zero, in which case a
128 function returns the uid associated with the argument
130 The uid is cached so that multiple calls with the same
132 do not require additional calls to
134 If there is no uid associated with the
138 function returns \-1; otherwise it stores the uid at the location pointed to by
144 function returns the gid associated with the argument
146 The gid is cached so that multiple calls with the same
148 do not require additional calls to
150 If there is no gid associated with the
154 function returns \-1; otherwise it stores the gid at the location pointed to by
160 function changes the user database access routines which
164 call to search for users.
165 The caches are flushed and the existing
167 method is called before switching to the new routines.
171 must be provided, and
181 function changes the group database access routines which
185 call to search for groups.
186 The caches are flushed and the existing
188 method is called before switching to the new routines.
192 must be provided, and
209 functions first appeared in
216 functions first appeared in
223 functions first appeared in