xref: /titanic_41/usr/src/lib/libsldap/common/ns_wrapper.c (revision c138f478d2bc94e73ab8f6a084e323bec25e62f5)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include "ns_sldap.h"
30 #include "ns_internal.h"
31 
32 /* ARGSUSED */
33 static LDAP *
34 __s_api_getLDAPconn(int flags)
35 {
36 	return (NULL);
37 }
38 
39 /*
40  * Abandon functions
41  */
42 /* ARGSUSED */
43 int _ns_ldap_abandon_ext(char *service, int flags,
44 	int msgid, LDAPControl **serverctrls,
45 	LDAPControl ** clientctrls)
46 {
47 	LDAP *ld = __s_api_getLDAPconn(flags);
48 
49 	return (ldap_abandon_ext(ld, msgid, serverctrls, clientctrls));
50 }
51 
52 /* ARGSUSED */
53 int _ns_ldap_abandon(char *service, int flags,
54 	int msgid)
55 {
56 	LDAP *ld = __s_api_getLDAPconn(flags);
57 
58 	return (ldap_abandon(ld, msgid));
59 }
60 
61 /*
62  * Add functions
63  */
64 /* ARGSUSED */
65 int _ns_ldap_add_ext(char *service, int flags,
66 	char *dn, LDAPMod **attrs,
67 	LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp)
68 {
69 	LDAP *ld = __s_api_getLDAPconn(flags);
70 
71 	return (ldap_add_ext(ld, dn, attrs,
72 				serverctrls, clientctrls, msgidp));
73 }
74 
75 /* ARGSUSED */
76 int _ns_ldap_add_ext_s(char *service, int flags,
77 	char *dn, LDAPMod **attrs,
78 	LDAPControl ** serverctrls, LDAPControl **clientctrls)
79 {
80 	LDAP *ld = __s_api_getLDAPconn(flags);
81 
82 	return (ldap_add_ext_s(ld, dn, attrs, serverctrls, clientctrls));
83 }
84 
85 /* ARGSUSED */
86 int _ns_ldap_add(char *service, int flags,
87 	char *dn, LDAPMod **attrs)
88 {
89 	LDAP *ld = __s_api_getLDAPconn(flags);
90 
91 	return (ldap_add(ld, dn, attrs));
92 }
93 
94 /* ARGSUSED */
95 int _ns_ldap_add_s(char *service, int flags,
96 	char *dn, LDAPMod **attrs)
97 {
98 	LDAP *ld = __s_api_getLDAPconn(flags);
99 
100 	return (ldap_add_s(ld, dn, attrs));
101 }
102 
103 /*
104  * Compare functions
105  */
106 /* ARGSUSED */
107 int _ns_ldap_compare_ext(char *service, int flags,
108 	char *dn, char *attr, struct berval *bvalue,
109 	LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp)
110 {
111 	LDAP *ld = __s_api_getLDAPconn(flags);
112 
113 	return (ldap_compare_ext(ld, dn, attr, bvalue,
114 				    serverctrls, clientctrls, msgidp));
115 }
116 
117 /* ARGSUSED */
118 int _ns_ldap_compare_ext_s(char *service, int flags,
119 	char *dn, char *attr, struct berval *bvalue,
120 	LDAPControl ** serverctrls, LDAPControl **clientctrls)
121 {
122 	LDAP *ld = __s_api_getLDAPconn(flags);
123 
124 	return (ldap_compare_ext_s(ld, dn, attr, bvalue,
125 		serverctrls, clientctrls));
126 }
127 
128 /* ARGSUSED */
129 int _ns_ldap_compare(char *service, int flags,
130 	char *dn, char *attr, char *value)
131 {
132 	LDAP *ld = __s_api_getLDAPconn(flags);
133 
134 	return (ldap_compare(ld, dn, attr, value));
135 }
136 
137 /* ARGSUSED */
138 int _ns_ldap_compare_s(char *service, int flags,
139 	char *dn, char *attr, char *value)
140 {
141 	LDAP *ld = __s_api_getLDAPconn(flags);
142 
143 	return (ldap_compare_s(ld, dn, attr, value));
144 }
145 
146 /*
147  * Delete functions
148  */
149 /* ARGSUSED */
150 int _ns_ldap_delete_ext(char *service, int flags,
151 	char *dn, LDAPControl **serverctrls,
152 	LDAPControl **clientctrls, int *msgidp)
153 {
154 	LDAP *ld = __s_api_getLDAPconn(flags);
155 
156 	return (ldap_delete_ext(ld, dn, serverctrls, clientctrls, msgidp));
157 }
158 
159 /* ARGSUSED */
160 int _ns_ldap_delete_ext_s(char *service, int flags,
161 	char *dn, LDAPControl **serverctrls,
162 	LDAPControl **clientctrls)
163 {
164 	LDAP *ld = __s_api_getLDAPconn(flags);
165 
166 	return (ldap_delete_ext_s(ld, dn, serverctrls, clientctrls));
167 }
168 
169 /* ARGSUSED */
170 int _ns_ldap_delete(char *service, int flags,
171 	char *dn)
172 {
173 	LDAP *ld = __s_api_getLDAPconn(flags);
174 
175 	return (ldap_delete(ld, dn));
176 }
177 
178 /* ARGSUSED */
179 int _ns_ldap_delete_s(char *service, int flags,
180 	char *dn)
181 {
182 	LDAP *ld = __s_api_getLDAPconn(flags);
183 
184 	return (ldap_delete_s(ld, dn));
185 }
186 
187 /*
188  * Modify functions
189  */
190 /* ARGSUSED */
191 int _ns_ldap_modify_ext(char *service, int flags,
192 	char *dn, LDAPMod **mods,
193 	LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp)
194 {
195 	LDAP *ld = __s_api_getLDAPconn(flags);
196 
197 	return (ldap_modify_ext(ld, dn, mods, serverctrls,
198 		clientctrls, msgidp));
199 }
200 
201 /* ARGSUSED */
202 int _ns_ldap_modify_ext_s(char *service, int flags,
203 	char *dn, LDAPMod **mods,
204 	LDAPControl **serverctrls, LDAPControl **clientctrls)
205 {
206 	LDAP *ld = __s_api_getLDAPconn(flags);
207 
208 	return (ldap_modify_ext_s(ld, dn, mods, serverctrls, clientctrls));
209 }
210 
211 /* ARGSUSED */
212 int _ns_ldap_modify(char *service, int flags,
213 	char *dn, LDAPMod **mods)
214 /* ARGSUSED */
215 {
216 	LDAP *ld = __s_api_getLDAPconn(flags);
217 
218 	return (ldap_modify(ld, dn, mods));
219 }
220 
221 /* ARGSUSED */
222 int _ns_ldap_modify_s(char *service, int flags,
223 	char *dn, LDAPMod **mods)
224 {
225 	LDAP *ld = __s_api_getLDAPconn(flags);
226 
227 	return (ldap_modify_s(ld, dn, mods));
228 }
229 
230 /*
231  * Modrdn functions
232  */
233 
234 /* ARGSUSED */
235 int _ns_ldap_modrdn(char *service, int flags,
236 	char *dn, char *newrdn, int deleteoldrdn)
237 {
238 	LDAP *ld = __s_api_getLDAPconn(flags);
239 
240 	return (ldap_modrdn(ld, dn, newrdn));
241 }
242 
243 /* ARGSUSED */
244 int _ns_ldap_modrdn_s(char *service, int flags,
245 	char *dn, char *newrdn, int deleteoldrdn)
246 {
247 	LDAP *ld = __s_api_getLDAPconn(flags);
248 
249 	return (ldap_modrdn_s(ld, dn, newrdn));
250 }
251 
252 /* ARGSUSED */
253 int _ns_ldap_modrdn2(char *service, int flags,
254 	char *dn, char *newrdn, int deleteoldrdn)
255 {
256 	LDAP *ld = __s_api_getLDAPconn(flags);
257 
258 	return (ldap_modrdn2(ld, dn, newrdn, deleteoldrdn));
259 }
260 
261 /* ARGSUSED */
262 int _ns_ldap_modrdn2_s(char *service, int flags,
263 	char *dn, char *newrdn, int deleteoldrdn)
264 {
265 	LDAP *ld = __s_api_getLDAPconn(flags);
266 
267 	return (ldap_modrdn2_s(ld, dn, newrdn, deleteoldrdn));
268 }
269 
270 /*
271  * Rename functions
272  */
273 /* ARGSUSED */
274 int _ns_ldap_rename(char *service, int flags,
275 	char *dn, char *newrdn, char *newparent,
276 	int deleteoldrdn, LDAPControl ** serverctrls,
277 	LDAPControl **clientctrls, int *msgidp)
278 {
279 	LDAP *ld = __s_api_getLDAPconn(flags);
280 
281 	return (ldap_rename(ld, dn, newrdn, newparent,
282 				deleteoldrdn, serverctrls,
283 				clientctrls, msgidp));
284 }
285 
286 /* ARGSUSED */
287 int _ns_ldap_rename_s(char *service, int flags,
288 	char *dn, char *newrdn, char *newparent,
289 	int deleteoldrdn, LDAPControl ** serverctrls,
290 	LDAPControl **clientctrls)
291 {
292 	LDAP *ld = __s_api_getLDAPconn(flags);
293 
294 	return (ldap_rename_s(ld, dn, newrdn, newparent,
295 		deleteoldrdn, serverctrls, clientctrls));
296 }
297 
298 /*
299  * Result functions
300  */
301 /* ARGSUSED */
302 int _ns_ldap_result(char *service, int flags,
303 	int msgid, int all,
304 	struct timeval *timeout, LDAPMessage **result)
305 {
306 	LDAP *ld = __s_api_getLDAPconn(flags);
307 
308 	return (ldap_result(ld, msgid, all, timeout, result));
309 }
310 
311 /*
312  * Search functions
313  */
314 /* ARGSUSED */
315 int _ns_ldap_search_ext(char *service, int flags,
316 	char *base, int scope, char *filter,
317 	char **attrs, int attrsonly, LDAPControl **serverctrls,
318 	LDAPControl **clientctrls, struct timeval *timeoutp,
319 	int sizelimit, int *msgidp)
320 {
321 	LDAP *ld = __s_api_getLDAPconn(flags);
322 
323 	return (ldap_search_ext(ld, base, scope, filter,
324 		attrs, attrsonly, serverctrls,
325 		clientctrls, timeoutp, sizelimit, msgidp));
326 }
327 
328 /* ARGSUSED */
329 int _ns_ldap_search_ext_s(char *service, int flags,
330 	char *base, int scope, char *filter,
331 	char **attrs, int attrsonly, LDAPControl **serverctrls,
332 	LDAPControl **clientctrls, struct timeval *timeoutp, int sizelimit,
333 	LDAPMessage **res)
334 {
335 	LDAP *ld = __s_api_getLDAPconn(flags);
336 
337 	return (ldap_search_ext_s(ld, base, scope, filter,
338 		attrs, attrsonly, serverctrls,
339 		clientctrls, timeoutp, sizelimit, res));
340 }
341 
342 /* ARGSUSED */
343 int _ns_ldap_search(char *service, int flags,
344 	char *base, int scope, char *filter,
345 	char **attrs, int attrsonly)
346 {
347 	LDAP *ld = __s_api_getLDAPconn(flags);
348 
349 	return (ldap_search(ld, base, scope, filter, attrs, attrsonly));
350 }
351 
352 /* ARGSUSED */
353 int _ns_ldap_search_s(char *service, int flags,
354 	char *base, int scope, char *filter,
355 	char **attrs, int attrsonly, LDAPMessage **res)
356 {
357 	LDAP *ld = __s_api_getLDAPconn(flags);
358 
359 	return (ldap_search_s(ld, base, scope, filter,
360 		attrs, attrsonly, res));
361 }
362 
363 /* ARGSUSED */
364 int _ns_ldap_search_st(char *service, int flags,
365 	char *base, int scope, char *filter,
366 	char **attrs, int attrsonly,
367 	struct timeval *timeout, LDAPMessage **res)
368 {
369 	LDAP *ld = __s_api_getLDAPconn(flags);
370 
371 	return (ldap_search_st(ld, base, scope, filter,
372 		attrs, attrsonly, timeout, res));
373 }
374