xref: /illumos-gate/usr/src/lib/libsldap/common/ns_wrapper.c (revision e3ae4b35c024af1196582063ecee3ab79367227d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2000-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #include "ns_sldap.h"
28 #include "ns_internal.h"
29 
30 /* ARGSUSED */
31 static LDAP *
32 __s_api_getLDAPconn(int flags)
33 {
34 	return (NULL);
35 }
36 
37 /*
38  * Abandon functions
39  */
40 /* ARGSUSED */
41 int _ns_ldap_abandon_ext(char *service, int flags,
42 	int msgid, LDAPControl **serverctrls,
43 	LDAPControl ** clientctrls)
44 {
45 	LDAP *ld = __s_api_getLDAPconn(flags);
46 
47 	return (ldap_abandon_ext(ld, msgid, serverctrls, clientctrls));
48 }
49 
50 /* ARGSUSED */
51 int _ns_ldap_abandon(char *service, int flags,
52 	int msgid)
53 {
54 	LDAP *ld = __s_api_getLDAPconn(flags);
55 
56 	return (ldap_abandon(ld, msgid));
57 }
58 
59 /*
60  * Add functions
61  */
62 /* ARGSUSED */
63 int _ns_ldap_add_ext(char *service, int flags,
64 	char *dn, LDAPMod **attrs,
65 	LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp)
66 {
67 	LDAP *ld = __s_api_getLDAPconn(flags);
68 
69 	return (ldap_add_ext(ld, dn, attrs,
70 				serverctrls, clientctrls, msgidp));
71 }
72 
73 /* ARGSUSED */
74 int _ns_ldap_add_ext_s(char *service, int flags,
75 	char *dn, LDAPMod **attrs,
76 	LDAPControl ** serverctrls, LDAPControl **clientctrls)
77 {
78 	LDAP *ld = __s_api_getLDAPconn(flags);
79 
80 	return (ldap_add_ext_s(ld, dn, attrs, serverctrls, clientctrls));
81 }
82 
83 /* ARGSUSED */
84 int _ns_ldap_add(char *service, int flags,
85 	char *dn, LDAPMod **attrs)
86 {
87 	LDAP *ld = __s_api_getLDAPconn(flags);
88 
89 	return (ldap_add(ld, dn, attrs));
90 }
91 
92 /* ARGSUSED */
93 int _ns_ldap_add_s(char *service, int flags,
94 	char *dn, LDAPMod **attrs)
95 {
96 	LDAP *ld = __s_api_getLDAPconn(flags);
97 
98 	return (ldap_add_s(ld, dn, attrs));
99 }
100 
101 /*
102  * Compare functions
103  */
104 /* ARGSUSED */
105 int _ns_ldap_compare_ext(char *service, int flags,
106 	char *dn, char *attr, struct berval *bvalue,
107 	LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp)
108 {
109 	LDAP *ld = __s_api_getLDAPconn(flags);
110 
111 	return (ldap_compare_ext(ld, dn, attr, bvalue,
112 				    serverctrls, clientctrls, msgidp));
113 }
114 
115 /* ARGSUSED */
116 int _ns_ldap_compare_ext_s(char *service, int flags,
117 	char *dn, char *attr, struct berval *bvalue,
118 	LDAPControl ** serverctrls, LDAPControl **clientctrls)
119 {
120 	LDAP *ld = __s_api_getLDAPconn(flags);
121 
122 	return (ldap_compare_ext_s(ld, dn, attr, bvalue,
123 		serverctrls, clientctrls));
124 }
125 
126 /* ARGSUSED */
127 int _ns_ldap_compare(char *service, int flags,
128 	char *dn, char *attr, char *value)
129 {
130 	LDAP *ld = __s_api_getLDAPconn(flags);
131 
132 	return (ldap_compare(ld, dn, attr, value));
133 }
134 
135 /* ARGSUSED */
136 int _ns_ldap_compare_s(char *service, int flags,
137 	char *dn, char *attr, char *value)
138 {
139 	LDAP *ld = __s_api_getLDAPconn(flags);
140 
141 	return (ldap_compare_s(ld, dn, attr, value));
142 }
143 
144 /*
145  * Delete functions
146  */
147 /* ARGSUSED */
148 int _ns_ldap_delete_ext(char *service, int flags,
149 	char *dn, LDAPControl **serverctrls,
150 	LDAPControl **clientctrls, int *msgidp)
151 {
152 	LDAP *ld = __s_api_getLDAPconn(flags);
153 
154 	return (ldap_delete_ext(ld, dn, serverctrls, clientctrls, msgidp));
155 }
156 
157 /* ARGSUSED */
158 int _ns_ldap_delete_ext_s(char *service, int flags,
159 	char *dn, LDAPControl **serverctrls,
160 	LDAPControl **clientctrls)
161 {
162 	LDAP *ld = __s_api_getLDAPconn(flags);
163 
164 	return (ldap_delete_ext_s(ld, dn, serverctrls, clientctrls));
165 }
166 
167 /* ARGSUSED */
168 int _ns_ldap_delete(char *service, int flags,
169 	char *dn)
170 {
171 	LDAP *ld = __s_api_getLDAPconn(flags);
172 
173 	return (ldap_delete(ld, dn));
174 }
175 
176 /* ARGSUSED */
177 int _ns_ldap_delete_s(char *service, int flags,
178 	char *dn)
179 {
180 	LDAP *ld = __s_api_getLDAPconn(flags);
181 
182 	return (ldap_delete_s(ld, dn));
183 }
184 
185 /*
186  * Modify functions
187  */
188 /* ARGSUSED */
189 int _ns_ldap_modify_ext(char *service, int flags,
190 	char *dn, LDAPMod **mods,
191 	LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp)
192 {
193 	LDAP *ld = __s_api_getLDAPconn(flags);
194 
195 	return (ldap_modify_ext(ld, dn, mods, serverctrls,
196 		clientctrls, msgidp));
197 }
198 
199 /* ARGSUSED */
200 int _ns_ldap_modify_ext_s(char *service, int flags,
201 	char *dn, LDAPMod **mods,
202 	LDAPControl **serverctrls, LDAPControl **clientctrls)
203 {
204 	LDAP *ld = __s_api_getLDAPconn(flags);
205 
206 	return (ldap_modify_ext_s(ld, dn, mods, serverctrls, clientctrls));
207 }
208 
209 /* ARGSUSED */
210 int _ns_ldap_modify(char *service, int flags,
211 	char *dn, LDAPMod **mods)
212 /* ARGSUSED */
213 {
214 	LDAP *ld = __s_api_getLDAPconn(flags);
215 
216 	return (ldap_modify(ld, dn, mods));
217 }
218 
219 /* ARGSUSED */
220 int _ns_ldap_modify_s(char *service, int flags,
221 	char *dn, LDAPMod **mods)
222 {
223 	LDAP *ld = __s_api_getLDAPconn(flags);
224 
225 	return (ldap_modify_s(ld, dn, mods));
226 }
227 
228 /*
229  * Modrdn functions
230  */
231 
232 /* ARGSUSED */
233 int _ns_ldap_modrdn(char *service, int flags,
234 	char *dn, char *newrdn, int deleteoldrdn)
235 {
236 	LDAP *ld = __s_api_getLDAPconn(flags);
237 
238 	return (ldap_modrdn(ld, dn, newrdn));
239 }
240 
241 /* ARGSUSED */
242 int _ns_ldap_modrdn_s(char *service, int flags,
243 	char *dn, char *newrdn, int deleteoldrdn)
244 {
245 	LDAP *ld = __s_api_getLDAPconn(flags);
246 
247 	return (ldap_modrdn_s(ld, dn, newrdn));
248 }
249 
250 /* ARGSUSED */
251 int _ns_ldap_modrdn2(char *service, int flags,
252 	char *dn, char *newrdn, int deleteoldrdn)
253 {
254 	LDAP *ld = __s_api_getLDAPconn(flags);
255 
256 	return (ldap_modrdn2(ld, dn, newrdn, deleteoldrdn));
257 }
258 
259 /* ARGSUSED */
260 int _ns_ldap_modrdn2_s(char *service, int flags,
261 	char *dn, char *newrdn, int deleteoldrdn)
262 {
263 	LDAP *ld = __s_api_getLDAPconn(flags);
264 
265 	return (ldap_modrdn2_s(ld, dn, newrdn, deleteoldrdn));
266 }
267 
268 /*
269  * Rename functions
270  */
271 /* ARGSUSED */
272 int _ns_ldap_rename(char *service, int flags,
273 	char *dn, char *newrdn, char *newparent,
274 	int deleteoldrdn, LDAPControl ** serverctrls,
275 	LDAPControl **clientctrls, int *msgidp)
276 {
277 	LDAP *ld = __s_api_getLDAPconn(flags);
278 
279 	return (ldap_rename(ld, dn, newrdn, newparent,
280 				deleteoldrdn, serverctrls,
281 				clientctrls, msgidp));
282 }
283 
284 /* ARGSUSED */
285 int _ns_ldap_rename_s(char *service, int flags,
286 	char *dn, char *newrdn, char *newparent,
287 	int deleteoldrdn, LDAPControl ** serverctrls,
288 	LDAPControl **clientctrls)
289 {
290 	LDAP *ld = __s_api_getLDAPconn(flags);
291 
292 	return (ldap_rename_s(ld, dn, newrdn, newparent,
293 		deleteoldrdn, serverctrls, clientctrls));
294 }
295 
296 /*
297  * Result functions
298  */
299 /* ARGSUSED */
300 int _ns_ldap_result(char *service, int flags,
301 	int msgid, int all,
302 	struct timeval *timeout, LDAPMessage **result)
303 {
304 	LDAP *ld = __s_api_getLDAPconn(flags);
305 
306 	return (ldap_result(ld, msgid, all, timeout, result));
307 }
308 
309 /*
310  * Search functions
311  */
312 /* ARGSUSED */
313 int _ns_ldap_search_ext(char *service, int flags,
314 	char *base, int scope, char *filter,
315 	char **attrs, int attrsonly, LDAPControl **serverctrls,
316 	LDAPControl **clientctrls, struct timeval *timeoutp,
317 	int sizelimit, int *msgidp)
318 {
319 	LDAP *ld = __s_api_getLDAPconn(flags);
320 
321 	return (ldap_search_ext(ld, base, scope, filter,
322 		attrs, attrsonly, serverctrls,
323 		clientctrls, timeoutp, sizelimit, msgidp));
324 }
325 
326 /* ARGSUSED */
327 int _ns_ldap_search_ext_s(char *service, int flags,
328 	char *base, int scope, char *filter,
329 	char **attrs, int attrsonly, LDAPControl **serverctrls,
330 	LDAPControl **clientctrls, struct timeval *timeoutp, int sizelimit,
331 	LDAPMessage **res)
332 {
333 	LDAP *ld = __s_api_getLDAPconn(flags);
334 
335 	return (ldap_search_ext_s(ld, base, scope, filter,
336 		attrs, attrsonly, serverctrls,
337 		clientctrls, timeoutp, sizelimit, res));
338 }
339 
340 /* ARGSUSED */
341 int _ns_ldap_search(char *service, int flags,
342 	char *base, int scope, char *filter,
343 	char **attrs, int attrsonly)
344 {
345 	LDAP *ld = __s_api_getLDAPconn(flags);
346 
347 	return (ldap_search(ld, base, scope, filter, attrs, attrsonly));
348 }
349 
350 /* ARGSUSED */
351 int _ns_ldap_search_s(char *service, int flags,
352 	char *base, int scope, char *filter,
353 	char **attrs, int attrsonly, LDAPMessage **res)
354 {
355 	LDAP *ld = __s_api_getLDAPconn(flags);
356 
357 	return (ldap_search_s(ld, base, scope, filter,
358 		attrs, attrsonly, res));
359 }
360 
361 /* ARGSUSED */
362 int _ns_ldap_search_st(char *service, int flags,
363 	char *base, int scope, char *filter,
364 	char **attrs, int attrsonly,
365 	struct timeval *timeout, LDAPMessage **res)
366 {
367 	LDAP *ld = __s_api_getLDAPconn(flags);
368 
369 	return (ldap_search_st(ld, base, scope, filter,
370 		attrs, attrsonly, timeout, res));
371 }
372