s4-smbtorture: be more verbose in LOCAL-NSS-WRAPPER.
[ira/wip.git] / lib / nss_wrapper / nss_wrapper.h
1 /*
2  * Copyright (C) Stefan Metzmacher 2007 <metze@samba.org>
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  *
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.
16  *
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.
20  *
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
31  * SUCH DAMAGE.
32  */
33
34 #ifndef __NSS_WRAPPER_H__
35 #define __NSS_WRAPPER_H__
36
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);
61
62 #ifdef NSS_WRAPPER_REPLACE
63
64 #ifdef getpwnam
65 #undef getpwnam
66 #endif
67 #define getpwnam        nwrap_getpwnam
68
69 #ifdef getpwnam_r
70 #undef getpwnam_r
71 #endif
72 #define getpwnam_r      nwrap_getpwnam_r
73
74 #ifdef getpwuid
75 #undef getpwuid
76 #endif
77 #define getpwuid        nwrap_getpwuid
78
79 #ifdef getpwuid_r
80 #undef getpwuid_r
81 #endif
82 #define getpwuid_r      nwrap_getpwuid_r
83
84 #ifdef setpwent
85 #undef setpwent
86 #endif
87 #define setpwent        nwrap_setpwent
88
89 #ifdef getpwent
90 #undef getpwent
91 #endif
92 #define getpwent        nwrap_getpwent
93
94 #ifdef getpwent_r
95 #undef getpwent_r
96 #endif
97 #define getpwent_r      nwrap_getpwent_r
98
99 #ifdef endpwent
100 #undef endpwent
101 #endif
102 #define endpwent        nwrap_endpwent
103
104 #ifdef getgrlst
105 #undef getgrlst
106 #endif
107 #define getgrlst        __none_nwrap_getgrlst
108
109 #ifdef getgrlst_r
110 #undef getgrlst_r
111 #endif
112 #define getgrlst_r      __none_nwrap_getgrlst_r
113
114 #ifdef initgroups_dyn
115 #undef initgroups_dyn
116 #endif
117 #define initgroups_dyn  __none_nwrap_initgroups_dyn
118
119 #ifdef initgroups
120 #undef initgroups
121 #endif
122 #define initgroups      nwrap_initgroups
123
124 #ifdef getgrouplist
125 #undef getgrouplist
126 #endif
127 #define getgrouplist    nwrap_getgrouplist
128
129 #ifdef getgrnam
130 #undef getgrnam
131 #endif
132 #define getgrnam        nwrap_getgrnam
133
134 #ifdef getgrnam_r
135 #undef getgrnam_r
136 #endif
137 #define getgrnam_r      nwrap_getgrnam_r
138
139 #ifdef getgrgid
140 #undef getgrgid
141 #endif
142 #define getgrgid        nwrap_getgrgid
143
144 #ifdef getgrgid_r
145 #undef getgrgid_r
146 #endif
147 #define getgrgid_r      nwrap_getgrgid_r
148
149 #ifdef setgrent
150 #undef setgrent
151 #endif
152 #define setgrent        nwrap_setgrent
153
154 #ifdef getgrent
155 #undef getgrent
156 #endif
157 #define getgrent        nwrap_getgrent
158
159 #ifdef getgrent_r
160 #undef getgrent_r
161 #endif
162 #define getgrent_r      nwrap_getgrent_r
163
164 #ifdef endgrent
165 #undef endgrent
166 #endif
167 #define endgrent        nwrap_endgrent
168
169 #endif /* NSS_WRAPPER_REPLACE */
170
171 #endif /* __NSS_WRAPPER_H__ */