Commit | Line | Data |
---|---|---|
45e671e2 HL |
1 | /* |
2 | * WLDAP32 - LDAP support for Wine | |
3 | * | |
4 | * Copyright 2005 Hans Leidekker | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License as published by the Free Software Foundation; either | |
9 | * version 2.1 of the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
360a3f91 | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
45e671e2 HL |
19 | */ |
20 | ||
21 | #include "config.h" | |
22 | ||
23 | #include "wine/port.h" | |
24 | #include "wine/debug.h" | |
25 | ||
26 | #include <stdarg.h> | |
27 | ||
28 | #include "windef.h" | |
29 | #include "winbase.h" | |
30 | #include "winnls.h" | |
31 | ||
32 | #ifdef HAVE_LDAP_H | |
33 | #include <ldap.h> | |
45e671e2 HL |
34 | #endif |
35 | ||
36 | #include "winldap_private.h" | |
37 | #include "wldap32.h" | |
38 | ||
39 | WINE_DEFAULT_DEBUG_CHANNEL(wldap32); | |
40 | ||
9744cdbc HL |
41 | /*********************************************************************** |
42 | * ldap_get_optionA (WLDAP32.@) | |
43 | * | |
44 | * See ldap_get_optionW. | |
45 | */ | |
91e45c62 | 46 | ULONG CDECL ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value ) |
45e671e2 | 47 | { |
46906871 | 48 | ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; |
45e671e2 HL |
49 | #ifdef HAVE_LDAP |
50 | ||
51 | TRACE( "(%p, 0x%08x, %p)\n", ld, option, value ); | |
52 | ||
53 | if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR; | |
54 | ||
55 | switch (option) | |
56 | { | |
7e5770d0 | 57 | case WLDAP32_LDAP_OPT_API_FEATURE_INFO: |
d9ed7161 HL |
58 | { |
59 | LDAPAPIFeatureInfoW featureW; | |
60 | LDAPAPIFeatureInfoA *featureA = value; | |
61 | ||
62 | if (!featureA->ldapaif_name) return WLDAP32_LDAP_PARAM_ERROR; | |
63 | ||
64 | featureW.ldapaif_info_version = featureA->ldapaif_info_version; | |
65 | featureW.ldapaif_name = strAtoW( featureA->ldapaif_name ); | |
66 | featureW.ldapaif_version = 0; | |
67 | ||
68 | if (!featureW.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY; | |
69 | ||
70 | ret = ldap_get_optionW( ld, option, &featureW ); | |
71 | ||
72 | featureA->ldapaif_version = featureW.ldapaif_version; | |
73 | strfreeW( featureW.ldapaif_name ); | |
74 | return ret; | |
75 | } | |
7e5770d0 | 76 | case WLDAP32_LDAP_OPT_API_INFO: |
d9ed7161 HL |
77 | { |
78 | LDAPAPIInfoW infoW; | |
79 | LDAPAPIInfoA *infoA = value; | |
80 | ||
81 | memset( &infoW, 0, sizeof(LDAPAPIInfoW) ); | |
82 | infoW.ldapai_info_version = infoA->ldapai_info_version; | |
83 | ||
84 | ret = ldap_get_optionW( ld, option, &infoW ); | |
85 | ||
86 | infoA->ldapai_api_version = infoW.ldapai_api_version; | |
87 | infoA->ldapai_protocol_version = infoW.ldapai_protocol_version; | |
88 | ||
89 | if (infoW.ldapai_extensions) | |
90 | { | |
91 | infoA->ldapai_extensions = strarrayWtoA( infoW.ldapai_extensions ); | |
92 | if (!infoA->ldapai_extensions) return WLDAP32_LDAP_NO_MEMORY; | |
93 | } | |
94 | if (infoW.ldapai_vendor_name) | |
95 | { | |
96 | infoA->ldapai_vendor_name = strWtoA( infoW.ldapai_vendor_name ); | |
97 | if (!infoA->ldapai_vendor_name) | |
98 | { | |
99 | ldap_value_freeW( infoW.ldapai_extensions ); | |
100 | return WLDAP32_LDAP_NO_MEMORY; | |
101 | } | |
102 | } | |
103 | infoA->ldapai_vendor_version = infoW.ldapai_vendor_version; | |
104 | ||
105 | ldap_value_freeW( infoW.ldapai_extensions ); | |
106 | ldap_memfreeW( infoW.ldapai_vendor_name ); | |
107 | return ret; | |
108 | } | |
109 | ||
7e5770d0 AJ |
110 | case WLDAP32_LDAP_OPT_DEREF: |
111 | case WLDAP32_LDAP_OPT_DESC: | |
112 | case WLDAP32_LDAP_OPT_ERROR_NUMBER: | |
113 | case WLDAP32_LDAP_OPT_PROTOCOL_VERSION: | |
114 | case WLDAP32_LDAP_OPT_REFERRALS: | |
115 | case WLDAP32_LDAP_OPT_SIZELIMIT: | |
116 | case WLDAP32_LDAP_OPT_TIMELIMIT: | |
45e671e2 HL |
117 | return ldap_get_optionW( ld, option, value ); |
118 | ||
7e5770d0 AJ |
119 | case WLDAP32_LDAP_OPT_CACHE_ENABLE: |
120 | case WLDAP32_LDAP_OPT_CACHE_FN_PTRS: | |
121 | case WLDAP32_LDAP_OPT_CACHE_STRATEGY: | |
122 | case WLDAP32_LDAP_OPT_IO_FN_PTRS: | |
123 | case WLDAP32_LDAP_OPT_REBIND_ARG: | |
124 | case WLDAP32_LDAP_OPT_REBIND_FN: | |
125 | case WLDAP32_LDAP_OPT_RESTART: | |
126 | case WLDAP32_LDAP_OPT_THREAD_FN_PTRS: | |
45e671e2 HL |
127 | return LDAP_LOCAL_ERROR; |
128 | ||
7e5770d0 AJ |
129 | case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE: |
130 | case WLDAP32_LDAP_OPT_AUTO_RECONNECT: | |
131 | case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE: | |
132 | case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME: | |
133 | case WLDAP32_LDAP_OPT_ENCRYPT: | |
134 | case WLDAP32_LDAP_OPT_ERROR_STRING: | |
135 | case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND: | |
136 | case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS: | |
137 | case WLDAP32_LDAP_OPT_HOST_NAME: | |
138 | case WLDAP32_LDAP_OPT_HOST_REACHABLE: | |
139 | case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE: | |
140 | case WLDAP32_LDAP_OPT_PING_LIMIT: | |
141 | case WLDAP32_LDAP_OPT_PING_WAIT_TIME: | |
142 | case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS: | |
143 | case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG: | |
144 | case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK: | |
145 | case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT: | |
146 | case WLDAP32_LDAP_OPT_ROOTDSE_CACHE: | |
147 | case WLDAP32_LDAP_OPT_SASL_METHOD: | |
148 | case WLDAP32_LDAP_OPT_SECURITY_CONTEXT: | |
149 | case WLDAP32_LDAP_OPT_SEND_TIMEOUT: | |
150 | case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE: | |
151 | case WLDAP32_LDAP_OPT_SERVER_CONTROLS: | |
152 | case WLDAP32_LDAP_OPT_SERVER_ERROR: | |
153 | case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR: | |
154 | case WLDAP32_LDAP_OPT_SIGN: | |
155 | case WLDAP32_LDAP_OPT_SSL: | |
156 | case WLDAP32_LDAP_OPT_SSL_INFO: | |
157 | case WLDAP32_LDAP_OPT_SSPI_FLAGS: | |
158 | case WLDAP32_LDAP_OPT_TCP_KEEPALIVE: | |
45e671e2 | 159 | FIXME( "Unsupported option: 0x%02x\n", option ); |
46906871 | 160 | return WLDAP32_LDAP_NOT_SUPPORTED; |
45e671e2 HL |
161 | |
162 | default: | |
163 | FIXME( "Unknown option: 0x%02x\n", option ); | |
46906871 | 164 | return WLDAP32_LDAP_LOCAL_ERROR; |
45e671e2 HL |
165 | } |
166 | ||
167 | #endif | |
168 | return ret; | |
169 | } | |
170 | ||
9744cdbc HL |
171 | /*********************************************************************** |
172 | * ldap_get_optionW (WLDAP32.@) | |
173 | * | |
174 | * Retrieve option values for a given LDAP context. | |
175 | * | |
176 | * PARAMS | |
177 | * ld [I] Pointer to an LDAP context. | |
178 | * option [I] Option to get values for. | |
179 | * value [O] Pointer to option values. | |
180 | * | |
181 | * RETURNS | |
182 | * Success: LDAP_SUCCESS | |
183 | * Failure: An LDAP error code. | |
184 | */ | |
91e45c62 | 185 | ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value ) |
45e671e2 | 186 | { |
46906871 | 187 | ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; |
45e671e2 HL |
188 | #ifdef HAVE_LDAP |
189 | ||
190 | TRACE( "(%p, 0x%08x, %p)\n", ld, option, value ); | |
191 | ||
192 | if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR; | |
193 | ||
194 | switch (option) | |
195 | { | |
7e5770d0 | 196 | case WLDAP32_LDAP_OPT_API_FEATURE_INFO: |
d9ed7161 HL |
197 | { |
198 | LDAPAPIFeatureInfo featureU; | |
199 | LDAPAPIFeatureInfoW *featureW = value; | |
200 | ||
201 | if (!featureW->ldapaif_name) return WLDAP32_LDAP_PARAM_ERROR; | |
202 | ||
203 | featureU.ldapaif_info_version = featureW->ldapaif_info_version; | |
204 | featureU.ldapaif_name = strWtoU( featureW->ldapaif_name ); | |
205 | featureU.ldapaif_version = 0; | |
206 | ||
207 | if (!featureU.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY; | |
208 | ||
209 | ret = ldap_get_option( ld, option, &featureU ); | |
210 | ||
211 | featureW->ldapaif_version = featureU.ldapaif_version; | |
212 | strfreeU( featureU.ldapaif_name ); | |
213 | return ret; | |
214 | } | |
7e5770d0 | 215 | case WLDAP32_LDAP_OPT_API_INFO: |
d9ed7161 HL |
216 | { |
217 | LDAPAPIInfo infoU; | |
218 | LDAPAPIInfoW *infoW = value; | |
219 | ||
220 | memset( &infoU, 0, sizeof(LDAPAPIInfo) ); | |
221 | infoU.ldapai_info_version = infoW->ldapai_info_version; | |
222 | ||
223 | ret = ldap_get_option( ld, option, &infoU ); | |
224 | ||
225 | infoW->ldapai_api_version = infoU.ldapai_api_version; | |
226 | infoW->ldapai_protocol_version = infoU.ldapai_protocol_version; | |
227 | ||
228 | if (infoU.ldapai_extensions) | |
229 | { | |
230 | infoW->ldapai_extensions = strarrayUtoW( infoU.ldapai_extensions ); | |
231 | if (!infoW->ldapai_extensions) return WLDAP32_LDAP_NO_MEMORY; | |
232 | } | |
233 | if (infoU.ldapai_vendor_name) | |
234 | { | |
235 | infoW->ldapai_vendor_name = strUtoW( infoU.ldapai_vendor_name ); | |
236 | if (!infoW->ldapai_vendor_name) | |
237 | { | |
6c4011e7 | 238 | ldap_memvfree( (void **)infoU.ldapai_extensions ); |
d9ed7161 HL |
239 | return WLDAP32_LDAP_NO_MEMORY; |
240 | } | |
241 | } | |
242 | infoW->ldapai_vendor_version = infoU.ldapai_vendor_version; | |
243 | ||
6c4011e7 | 244 | ldap_memvfree( (void **)infoU.ldapai_extensions ); |
d9ed7161 HL |
245 | ldap_memfree( infoU.ldapai_vendor_name ); |
246 | return ret; | |
247 | } | |
248 | ||
7e5770d0 AJ |
249 | case WLDAP32_LDAP_OPT_DEREF: |
250 | case WLDAP32_LDAP_OPT_DESC: | |
251 | case WLDAP32_LDAP_OPT_ERROR_NUMBER: | |
252 | case WLDAP32_LDAP_OPT_PROTOCOL_VERSION: | |
253 | case WLDAP32_LDAP_OPT_REFERRALS: | |
254 | case WLDAP32_LDAP_OPT_SIZELIMIT: | |
255 | case WLDAP32_LDAP_OPT_TIMELIMIT: | |
45e671e2 HL |
256 | return ldap_get_option( ld, option, value ); |
257 | ||
7e5770d0 AJ |
258 | case WLDAP32_LDAP_OPT_CACHE_ENABLE: |
259 | case WLDAP32_LDAP_OPT_CACHE_FN_PTRS: | |
260 | case WLDAP32_LDAP_OPT_CACHE_STRATEGY: | |
261 | case WLDAP32_LDAP_OPT_IO_FN_PTRS: | |
262 | case WLDAP32_LDAP_OPT_REBIND_ARG: | |
263 | case WLDAP32_LDAP_OPT_REBIND_FN: | |
264 | case WLDAP32_LDAP_OPT_RESTART: | |
265 | case WLDAP32_LDAP_OPT_THREAD_FN_PTRS: | |
46906871 | 266 | return WLDAP32_LDAP_LOCAL_ERROR; |
45e671e2 | 267 | |
7e5770d0 AJ |
268 | case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE: |
269 | case WLDAP32_LDAP_OPT_AUTO_RECONNECT: | |
270 | case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE: | |
271 | case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME: | |
272 | case WLDAP32_LDAP_OPT_ENCRYPT: | |
273 | case WLDAP32_LDAP_OPT_ERROR_STRING: | |
274 | case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND: | |
275 | case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS: | |
276 | case WLDAP32_LDAP_OPT_HOST_NAME: | |
277 | case WLDAP32_LDAP_OPT_HOST_REACHABLE: | |
278 | case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE: | |
279 | case WLDAP32_LDAP_OPT_PING_LIMIT: | |
280 | case WLDAP32_LDAP_OPT_PING_WAIT_TIME: | |
281 | case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS: | |
282 | case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG: | |
283 | case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK: | |
284 | case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT: | |
285 | case WLDAP32_LDAP_OPT_ROOTDSE_CACHE: | |
286 | case WLDAP32_LDAP_OPT_SASL_METHOD: | |
287 | case WLDAP32_LDAP_OPT_SECURITY_CONTEXT: | |
288 | case WLDAP32_LDAP_OPT_SEND_TIMEOUT: | |
289 | case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE: | |
290 | case WLDAP32_LDAP_OPT_SERVER_CONTROLS: | |
291 | case WLDAP32_LDAP_OPT_SERVER_ERROR: | |
292 | case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR: | |
293 | case WLDAP32_LDAP_OPT_SIGN: | |
294 | case WLDAP32_LDAP_OPT_SSL: | |
295 | case WLDAP32_LDAP_OPT_SSL_INFO: | |
296 | case WLDAP32_LDAP_OPT_SSPI_FLAGS: | |
297 | case WLDAP32_LDAP_OPT_TCP_KEEPALIVE: | |
45e671e2 | 298 | FIXME( "Unsupported option: 0x%02x\n", option ); |
46906871 | 299 | return WLDAP32_LDAP_NOT_SUPPORTED; |
45e671e2 HL |
300 | |
301 | default: | |
302 | FIXME( "Unknown option: 0x%02x\n", option ); | |
46906871 | 303 | return WLDAP32_LDAP_LOCAL_ERROR; |
45e671e2 HL |
304 | } |
305 | ||
306 | #endif | |
307 | return ret; | |
308 | } | |
309 | ||
9744cdbc HL |
310 | /*********************************************************************** |
311 | * ldap_set_optionA (WLDAP32.@) | |
312 | * | |
313 | * See ldap_set_optionW. | |
314 | */ | |
91e45c62 | 315 | ULONG CDECL ldap_set_optionA( WLDAP32_LDAP *ld, int option, void *value ) |
45e671e2 | 316 | { |
46906871 | 317 | ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; |
45e671e2 HL |
318 | #ifdef HAVE_LDAP |
319 | ||
320 | TRACE( "(%p, 0x%08x, %p)\n", ld, option, value ); | |
321 | ||
322 | if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR; | |
323 | ||
324 | switch (option) | |
325 | { | |
7e5770d0 | 326 | case WLDAP32_LDAP_OPT_SERVER_CONTROLS: |
1219fa58 HL |
327 | { |
328 | LDAPControlW **ctrlsW; | |
329 | ||
330 | ctrlsW = controlarrayAtoW( (LDAPControlA **)value ); | |
331 | if (!ctrlsW) return WLDAP32_LDAP_NO_MEMORY; | |
332 | ||
333 | ret = ldap_set_optionW( ld, option, ctrlsW ); | |
334 | controlarrayfreeW( ctrlsW ); | |
335 | return ret; | |
336 | } | |
7e5770d0 AJ |
337 | case WLDAP32_LDAP_OPT_DEREF: |
338 | case WLDAP32_LDAP_OPT_DESC: | |
339 | case WLDAP32_LDAP_OPT_ERROR_NUMBER: | |
340 | case WLDAP32_LDAP_OPT_PROTOCOL_VERSION: | |
341 | case WLDAP32_LDAP_OPT_REFERRALS: | |
342 | case WLDAP32_LDAP_OPT_SIZELIMIT: | |
343 | case WLDAP32_LDAP_OPT_TIMELIMIT: | |
45e671e2 HL |
344 | return ldap_set_optionW( ld, option, value ); |
345 | ||
7e5770d0 AJ |
346 | case WLDAP32_LDAP_OPT_CACHE_ENABLE: |
347 | case WLDAP32_LDAP_OPT_CACHE_FN_PTRS: | |
348 | case WLDAP32_LDAP_OPT_CACHE_STRATEGY: | |
349 | case WLDAP32_LDAP_OPT_IO_FN_PTRS: | |
350 | case WLDAP32_LDAP_OPT_REBIND_ARG: | |
351 | case WLDAP32_LDAP_OPT_REBIND_FN: | |
352 | case WLDAP32_LDAP_OPT_RESTART: | |
353 | case WLDAP32_LDAP_OPT_THREAD_FN_PTRS: | |
46906871 | 354 | return WLDAP32_LDAP_LOCAL_ERROR; |
45e671e2 | 355 | |
7e5770d0 AJ |
356 | case WLDAP32_LDAP_OPT_API_FEATURE_INFO: |
357 | case WLDAP32_LDAP_OPT_API_INFO: | |
46906871 | 358 | return WLDAP32_LDAP_UNWILLING_TO_PERFORM; |
d9ed7161 | 359 | |
7e5770d0 AJ |
360 | case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE: |
361 | case WLDAP32_LDAP_OPT_AUTO_RECONNECT: | |
362 | case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE: | |
363 | case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME: | |
364 | case WLDAP32_LDAP_OPT_ENCRYPT: | |
365 | case WLDAP32_LDAP_OPT_ERROR_STRING: | |
366 | case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND: | |
367 | case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS: | |
368 | case WLDAP32_LDAP_OPT_HOST_NAME: | |
369 | case WLDAP32_LDAP_OPT_HOST_REACHABLE: | |
370 | case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE: | |
371 | case WLDAP32_LDAP_OPT_PING_LIMIT: | |
372 | case WLDAP32_LDAP_OPT_PING_WAIT_TIME: | |
373 | case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS: | |
374 | case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG: | |
375 | case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK: | |
376 | case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT: | |
377 | case WLDAP32_LDAP_OPT_ROOTDSE_CACHE: | |
378 | case WLDAP32_LDAP_OPT_SASL_METHOD: | |
379 | case WLDAP32_LDAP_OPT_SECURITY_CONTEXT: | |
380 | case WLDAP32_LDAP_OPT_SEND_TIMEOUT: | |
381 | case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE: | |
382 | case WLDAP32_LDAP_OPT_SERVER_ERROR: | |
383 | case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR: | |
384 | case WLDAP32_LDAP_OPT_SIGN: | |
385 | case WLDAP32_LDAP_OPT_SSL: | |
386 | case WLDAP32_LDAP_OPT_SSL_INFO: | |
387 | case WLDAP32_LDAP_OPT_SSPI_FLAGS: | |
388 | case WLDAP32_LDAP_OPT_TCP_KEEPALIVE: | |
45e671e2 | 389 | FIXME( "Unsupported option: 0x%02x\n", option ); |
46906871 | 390 | return WLDAP32_LDAP_NOT_SUPPORTED; |
45e671e2 HL |
391 | |
392 | default: | |
393 | FIXME( "Unknown option: 0x%02x\n", option ); | |
46906871 | 394 | return WLDAP32_LDAP_LOCAL_ERROR; |
45e671e2 HL |
395 | } |
396 | ||
397 | #endif | |
398 | return ret; | |
399 | } | |
400 | ||
9744cdbc HL |
401 | /*********************************************************************** |
402 | * ldap_set_optionW (WLDAP32.@) | |
403 | * | |
404 | * Set option values for a given LDAP context. | |
405 | * | |
406 | * PARAMS | |
407 | * ld [I] Pointer to an LDAP context. | |
408 | * option [I] Option to set values for. | |
409 | * value [I] Pointer to option values. | |
410 | * | |
411 | * RETURNS | |
412 | * Success: LDAP_SUCCESS | |
413 | * Failure: An LDAP error code. | |
414 | * | |
415 | * NOTES | |
416 | * Set value to LDAP_OPT_ON or LDAP_OPT_OFF for on/off options. | |
417 | */ | |
91e45c62 | 418 | ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value ) |
45e671e2 | 419 | { |
46906871 | 420 | ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; |
45e671e2 HL |
421 | #ifdef HAVE_LDAP |
422 | ||
423 | TRACE( "(%p, 0x%08x, %p)\n", ld, option, value ); | |
424 | ||
425 | if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR; | |
426 | ||
427 | switch (option) | |
428 | { | |
7e5770d0 | 429 | case WLDAP32_LDAP_OPT_SERVER_CONTROLS: |
1219fa58 HL |
430 | { |
431 | LDAPControl **ctrlsU; | |
432 | ||
433 | ctrlsU = controlarrayWtoU( (LDAPControlW **)value ); | |
434 | if (!ctrlsU) return WLDAP32_LDAP_NO_MEMORY; | |
435 | ||
436 | ret = ldap_set_option( ld, option, ctrlsU ); | |
437 | controlarrayfreeU( ctrlsU ); | |
438 | return ret; | |
439 | } | |
7e5770d0 AJ |
440 | case WLDAP32_LDAP_OPT_DEREF: |
441 | case WLDAP32_LDAP_OPT_DESC: | |
442 | case WLDAP32_LDAP_OPT_ERROR_NUMBER: | |
443 | case WLDAP32_LDAP_OPT_PROTOCOL_VERSION: | |
444 | case WLDAP32_LDAP_OPT_REFERRALS: | |
445 | case WLDAP32_LDAP_OPT_SIZELIMIT: | |
446 | case WLDAP32_LDAP_OPT_TIMELIMIT: | |
45e671e2 HL |
447 | return ldap_set_option( ld, option, value ); |
448 | ||
7e5770d0 AJ |
449 | case WLDAP32_LDAP_OPT_CACHE_ENABLE: |
450 | case WLDAP32_LDAP_OPT_CACHE_FN_PTRS: | |
451 | case WLDAP32_LDAP_OPT_CACHE_STRATEGY: | |
452 | case WLDAP32_LDAP_OPT_IO_FN_PTRS: | |
453 | case WLDAP32_LDAP_OPT_REBIND_ARG: | |
454 | case WLDAP32_LDAP_OPT_REBIND_FN: | |
455 | case WLDAP32_LDAP_OPT_RESTART: | |
456 | case WLDAP32_LDAP_OPT_THREAD_FN_PTRS: | |
46906871 | 457 | return WLDAP32_LDAP_LOCAL_ERROR; |
45e671e2 | 458 | |
7e5770d0 AJ |
459 | case WLDAP32_LDAP_OPT_API_FEATURE_INFO: |
460 | case WLDAP32_LDAP_OPT_API_INFO: | |
46906871 | 461 | return WLDAP32_LDAP_UNWILLING_TO_PERFORM; |
d9ed7161 | 462 | |
7e5770d0 AJ |
463 | case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE: |
464 | case WLDAP32_LDAP_OPT_AUTO_RECONNECT: | |
465 | case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE: | |
466 | case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME: | |
467 | case WLDAP32_LDAP_OPT_ENCRYPT: | |
468 | case WLDAP32_LDAP_OPT_ERROR_STRING: | |
469 | case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND: | |
470 | case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS: | |
471 | case WLDAP32_LDAP_OPT_HOST_NAME: | |
472 | case WLDAP32_LDAP_OPT_HOST_REACHABLE: | |
473 | case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE: | |
474 | case WLDAP32_LDAP_OPT_PING_LIMIT: | |
475 | case WLDAP32_LDAP_OPT_PING_WAIT_TIME: | |
476 | case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS: | |
477 | case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG: | |
478 | case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK: | |
479 | case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT: | |
480 | case WLDAP32_LDAP_OPT_ROOTDSE_CACHE: | |
481 | case WLDAP32_LDAP_OPT_SASL_METHOD: | |
482 | case WLDAP32_LDAP_OPT_SECURITY_CONTEXT: | |
483 | case WLDAP32_LDAP_OPT_SEND_TIMEOUT: | |
484 | case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE: | |
485 | case WLDAP32_LDAP_OPT_SERVER_ERROR: | |
486 | case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR: | |
487 | case WLDAP32_LDAP_OPT_SIGN: | |
488 | case WLDAP32_LDAP_OPT_SSL: | |
489 | case WLDAP32_LDAP_OPT_SSL_INFO: | |
490 | case WLDAP32_LDAP_OPT_SSPI_FLAGS: | |
491 | case WLDAP32_LDAP_OPT_TCP_KEEPALIVE: | |
45e671e2 | 492 | FIXME( "Unsupported option: 0x%02x\n", option ); |
46906871 | 493 | return WLDAP32_LDAP_NOT_SUPPORTED; |
45e671e2 HL |
494 | |
495 | default: | |
496 | FIXME( "Unknown option: 0x%02x\n", option ); | |
46906871 | 497 | return WLDAP32_LDAP_LOCAL_ERROR; |
45e671e2 HL |
498 | } |
499 | ||
500 | #endif | |
501 | return ret; | |
502 | } |