2 * Copyright (C) Stefan Metzmacher 2007 <metze@samba.org>
6 * Redistribution and use in source and binary forms, with or without
7 * 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.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the author nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #ifndef __NSS_WRAPPER_H__
35 #define __NSS_WRAPPER_H__
37 struct passwd
*nwrap_getpwnam(const char *name
);
38 int nwrap_getpwnam_r(const char *name
, struct passwd
*pwbuf
,
39 char *buf
, size_t buflen
, struct passwd
**pwbufp
);
40 struct passwd
*nwrap_getpwuid(uid_t uid
);
41 int nwrap_getpwuid_r(uid_t uid
, struct passwd
*pwbuf
,
42 char *buf
, size_t buflen
, struct passwd
**pwbufp
);
43 void nwrap_setpwent(void);
44 struct passwd
*nwrap_getpwent(void);
45 int nwrap_getpwent_r(struct passwd
*pwbuf
, char *buf
,
46 size_t buflen
, struct passwd
**pwbufp
);
47 void nwrap_endpwent(void);
48 int nwrap_initgroups(const char *user
, gid_t group
);
49 int nwrap_getgrouplist(const char *user
, gid_t group
, gid_t
*groups
, int *ngroups
);
50 struct group
*nwrap_getgrnam(const char *name
);
51 int nwrap_getgrnam_r(const char *name
, struct group
*gbuf
,
52 char *buf
, size_t buflen
, struct group
**gbufp
);
53 struct group
*nwrap_getgrgid(gid_t gid
);
54 int nwrap_getgrgid_r(gid_t gid
, struct group
*gbuf
,
55 char *buf
, size_t buflen
, struct group
**gbufp
);
56 void nwrap_setgrent(void);
57 struct group
*nwrap_getgrent(void);
58 int nwrap_getgrent_r(struct group
*gbuf
, char *buf
,
59 size_t buflen
, struct group
**gbufp
);
60 void nwrap_endgrent(void);
62 #ifdef NSS_WRAPPER_REPLACE
67 #define getpwnam nwrap_getpwnam
72 #define getpwnam_r nwrap_getpwnam_r
77 #define getpwuid nwrap_getpwuid
82 #define getpwuid_r nwrap_getpwuid_r
87 #define setpwent nwrap_setpwent
92 #define getpwent nwrap_getpwent
97 #define getpwent_r nwrap_getpwent_r
102 #define endpwent nwrap_endpwent
107 #define getgrlst __none_nwrap_getgrlst
112 #define getgrlst_r __none_nwrap_getgrlst_r
114 #ifdef initgroups_dyn
115 #undef initgroups_dyn
117 #define initgroups_dyn __none_nwrap_initgroups_dyn
122 #define initgroups nwrap_initgroups
127 #define getgrouplist nwrap_getgrouplist
132 #define getgrnam nwrap_getgrnam
137 #define getgrnam_r nwrap_getgrnam_r
142 #define getgrgid nwrap_getgrgid
147 #define getgrgid_r nwrap_getgrgid_r
152 #define setgrent nwrap_setgrent
157 #define getgrent nwrap_getgrent
162 #define getgrent_r nwrap_getgrent_r
167 #define endgrent nwrap_endgrent
169 #endif /* NSS_WRAPPER_REPLACE */
171 #endif /* __NSS_WRAPPER_H__ */