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