2 * WLDAP32 - LDAP support for Wine
4 * Copyright 2005 Hans Leidekker
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.
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.
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
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/debug.h"
27 #include "winldap_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(wldap32
);
31 /***********************************************************************
32 * ldap_get_optionA (WLDAP32.@)
34 ULONG CDECL
ldap_get_optionA( LDAP
*ld
, int option
, void *value
)
38 TRACE( "(%p, 0x%08x, %p)\n", ld
, option
, value
);
40 if (!ld
|| !value
) return WLDAP32_LDAP_PARAM_ERROR
;
44 case WLDAP32_LDAP_OPT_API_FEATURE_INFO
:
46 LDAPAPIFeatureInfoW featureW
;
47 LDAPAPIFeatureInfoA
*featureA
= value
;
49 if (!featureA
->ldapaif_name
) return WLDAP32_LDAP_PARAM_ERROR
;
51 featureW
.ldapaif_info_version
= featureA
->ldapaif_info_version
;
52 if (!(featureW
.ldapaif_name
= strAtoW( featureA
->ldapaif_name
))) return WLDAP32_LDAP_NO_MEMORY
;
53 featureW
.ldapaif_version
= 0;
55 ret
= ldap_get_optionW( ld
, option
, &featureW
);
57 if (ret
== WLDAP32_LDAP_SUCCESS
) featureA
->ldapaif_version
= featureW
.ldapaif_version
;
58 free( featureW
.ldapaif_name
);
61 case WLDAP32_LDAP_OPT_API_INFO
:
64 LDAPAPIInfoA
*infoA
= value
;
66 memset( &infoW
, 0, sizeof(infoW
) );
67 infoW
.ldapai_info_version
= infoA
->ldapai_info_version
;
69 ret
= ldap_get_optionW( ld
, option
, &infoW
);
70 if (ret
== WLDAP32_LDAP_SUCCESS
)
72 infoA
->ldapai_api_version
= infoW
.ldapai_api_version
;
73 infoA
->ldapai_protocol_version
= infoW
.ldapai_protocol_version
;
75 if (infoW
.ldapai_extensions
&& !(infoA
->ldapai_extensions
= strarrayWtoA( infoW
.ldapai_extensions
)))
76 return WLDAP32_LDAP_NO_MEMORY
;
77 if (infoW
.ldapai_vendor_name
&& !(infoA
->ldapai_vendor_name
= strWtoA( infoW
.ldapai_vendor_name
)))
79 ldap_value_freeW( infoW
.ldapai_extensions
);
80 return WLDAP32_LDAP_NO_MEMORY
;
82 infoA
->ldapai_vendor_version
= infoW
.ldapai_vendor_version
;
84 ldap_value_freeW( infoW
.ldapai_extensions
);
85 ldap_memfreeW( infoW
.ldapai_vendor_name
);
90 case WLDAP32_LDAP_OPT_DEREF
:
91 case WLDAP32_LDAP_OPT_DESC
:
92 case WLDAP32_LDAP_OPT_ERROR_NUMBER
:
93 case WLDAP32_LDAP_OPT_PROTOCOL_VERSION
:
94 case WLDAP32_LDAP_OPT_REFERRALS
:
95 case WLDAP32_LDAP_OPT_SIZELIMIT
:
96 case WLDAP32_LDAP_OPT_TIMELIMIT
:
97 return ldap_get_optionW( ld
, option
, value
);
99 case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT
:
100 return ldap_get_optionW( ld
, LDAP_OPT_REFHOPLIMIT
, value
);
102 case WLDAP32_LDAP_OPT_CACHE_ENABLE
:
103 case WLDAP32_LDAP_OPT_CACHE_FN_PTRS
:
104 case WLDAP32_LDAP_OPT_CACHE_STRATEGY
:
105 case WLDAP32_LDAP_OPT_IO_FN_PTRS
:
106 case WLDAP32_LDAP_OPT_REBIND_ARG
:
107 case WLDAP32_LDAP_OPT_REBIND_FN
:
108 case WLDAP32_LDAP_OPT_RESTART
:
109 case WLDAP32_LDAP_OPT_THREAD_FN_PTRS
:
110 return WLDAP32_LDAP_LOCAL_ERROR
;
112 case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE
:
113 case WLDAP32_LDAP_OPT_AUTO_RECONNECT
:
114 case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE
:
115 case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME
:
116 case WLDAP32_LDAP_OPT_ENCRYPT
:
117 case WLDAP32_LDAP_OPT_ERROR_STRING
:
118 case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND
:
119 case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS
:
120 case WLDAP32_LDAP_OPT_HOST_NAME
:
121 case WLDAP32_LDAP_OPT_HOST_REACHABLE
:
122 case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE
:
123 case WLDAP32_LDAP_OPT_PING_LIMIT
:
124 case WLDAP32_LDAP_OPT_PING_WAIT_TIME
:
125 case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS
:
126 case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG
:
127 case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK
:
128 case WLDAP32_LDAP_OPT_ROOTDSE_CACHE
:
129 case WLDAP32_LDAP_OPT_SASL_METHOD
:
130 case WLDAP32_LDAP_OPT_SECURITY_CONTEXT
:
131 case WLDAP32_LDAP_OPT_SEND_TIMEOUT
:
132 case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE
:
133 case WLDAP32_LDAP_OPT_SERVER_CONTROLS
:
134 case WLDAP32_LDAP_OPT_SERVER_ERROR
:
135 case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR
:
136 case WLDAP32_LDAP_OPT_SIGN
:
137 case WLDAP32_LDAP_OPT_SSL
:
138 case WLDAP32_LDAP_OPT_SSL_INFO
:
139 case WLDAP32_LDAP_OPT_SSPI_FLAGS
:
140 case WLDAP32_LDAP_OPT_TCP_KEEPALIVE
:
141 FIXME( "Unsupported option: 0x%02x\n", option
);
142 return WLDAP32_LDAP_NOT_SUPPORTED
;
145 FIXME( "Unknown option: 0x%02x\n", option
);
146 return WLDAP32_LDAP_LOCAL_ERROR
;
150 /***********************************************************************
151 * ldap_get_optionW (WLDAP32.@)
153 ULONG CDECL
ldap_get_optionW( LDAP
*ld
, int option
, void *value
)
157 TRACE( "(%p, 0x%08x, %p)\n", ld
, option
, value
);
159 if (!ld
|| !value
) return WLDAP32_LDAP_PARAM_ERROR
;
163 case WLDAP32_LDAP_OPT_API_FEATURE_INFO
:
165 LDAPAPIFeatureInfo featureU
;
166 LDAPAPIFeatureInfoW
*featureW
= value
;
168 if (!featureW
->ldapaif_name
) return WLDAP32_LDAP_PARAM_ERROR
;
170 featureU
.ldapaif_info_version
= featureW
->ldapaif_info_version
;
171 if ((featureU
.ldapaif_name
= strWtoU( featureW
->ldapaif_name
)))
173 featureU
.ldapaif_version
= 0;
174 ret
= map_error( ldap_get_option( CTX(ld
), option
, &featureU
) );
176 else return WLDAP32_LDAP_NO_MEMORY
;
178 if (ret
== WLDAP32_LDAP_SUCCESS
) featureW
->ldapaif_version
= featureU
.ldapaif_version
;
179 free( featureU
.ldapaif_name
);
182 case WLDAP32_LDAP_OPT_API_INFO
:
185 LDAPAPIInfoW
*infoW
= value
;
187 memset( &infoU
, 0, sizeof(infoU
) );
188 infoU
.ldapai_info_version
= infoW
->ldapai_info_version
;
190 ret
= map_error( ldap_get_option( CTX(ld
), option
, &infoU
) );
191 if (ret
== WLDAP32_LDAP_SUCCESS
)
193 infoW
->ldapai_api_version
= infoU
.ldapai_api_version
;
194 infoW
->ldapai_protocol_version
= infoU
.ldapai_protocol_version
;
196 if (infoU
.ldapai_extensions
&& !(infoW
->ldapai_extensions
= strarrayUtoW( infoU
.ldapai_extensions
)))
197 return WLDAP32_LDAP_NO_MEMORY
;
198 if (infoU
.ldapai_vendor_name
&& !(infoW
->ldapai_vendor_name
= strUtoW( infoU
.ldapai_vendor_name
)))
200 ldap_memvfree( (void **)infoU
.ldapai_extensions
);
201 return WLDAP32_LDAP_NO_MEMORY
;
203 infoW
->ldapai_vendor_version
= infoU
.ldapai_vendor_version
;
205 ldap_memvfree( (void **)infoU
.ldapai_extensions
);
206 ldap_memfree( infoU
.ldapai_vendor_name
);
211 case WLDAP32_LDAP_OPT_DEREF
:
212 case WLDAP32_LDAP_OPT_DESC
:
213 case WLDAP32_LDAP_OPT_ERROR_NUMBER
:
214 case WLDAP32_LDAP_OPT_PROTOCOL_VERSION
:
215 case WLDAP32_LDAP_OPT_REFERRALS
:
216 case WLDAP32_LDAP_OPT_SIZELIMIT
:
217 case WLDAP32_LDAP_OPT_TIMELIMIT
:
218 return map_error( ldap_get_option( CTX(ld
), option
, value
) );
220 case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT
:
221 return map_error( ldap_get_option( CTX(ld
), LDAP_OPT_REFHOPLIMIT
, value
) );
223 case WLDAP32_LDAP_OPT_CACHE_ENABLE
:
224 case WLDAP32_LDAP_OPT_CACHE_FN_PTRS
:
225 case WLDAP32_LDAP_OPT_CACHE_STRATEGY
:
226 case WLDAP32_LDAP_OPT_IO_FN_PTRS
:
227 case WLDAP32_LDAP_OPT_REBIND_ARG
:
228 case WLDAP32_LDAP_OPT_REBIND_FN
:
229 case WLDAP32_LDAP_OPT_RESTART
:
230 case WLDAP32_LDAP_OPT_THREAD_FN_PTRS
:
231 return WLDAP32_LDAP_LOCAL_ERROR
;
233 case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE
:
234 case WLDAP32_LDAP_OPT_AUTO_RECONNECT
:
235 case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE
:
236 case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME
:
237 case WLDAP32_LDAP_OPT_ENCRYPT
:
238 case WLDAP32_LDAP_OPT_ERROR_STRING
:
239 case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND
:
240 case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS
:
241 case WLDAP32_LDAP_OPT_HOST_NAME
:
242 case WLDAP32_LDAP_OPT_HOST_REACHABLE
:
243 case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE
:
244 case WLDAP32_LDAP_OPT_PING_LIMIT
:
245 case WLDAP32_LDAP_OPT_PING_WAIT_TIME
:
246 case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS
:
247 case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG
:
248 case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK
:
249 case WLDAP32_LDAP_OPT_ROOTDSE_CACHE
:
250 case WLDAP32_LDAP_OPT_SASL_METHOD
:
251 case WLDAP32_LDAP_OPT_SECURITY_CONTEXT
:
252 case WLDAP32_LDAP_OPT_SEND_TIMEOUT
:
253 case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE
:
254 case WLDAP32_LDAP_OPT_SERVER_CONTROLS
:
255 case WLDAP32_LDAP_OPT_SERVER_ERROR
:
256 case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR
:
257 case WLDAP32_LDAP_OPT_SIGN
:
258 case WLDAP32_LDAP_OPT_SSL
:
259 case WLDAP32_LDAP_OPT_SSL_INFO
:
260 case WLDAP32_LDAP_OPT_SSPI_FLAGS
:
261 case WLDAP32_LDAP_OPT_TCP_KEEPALIVE
:
262 FIXME( "Unsupported option: 0x%02x\n", option
);
263 return WLDAP32_LDAP_NOT_SUPPORTED
;
266 FIXME( "Unknown option: 0x%02x\n", option
);
267 return WLDAP32_LDAP_LOCAL_ERROR
;
271 /***********************************************************************
272 * ldap_set_optionA (WLDAP32.@)
274 ULONG CDECL
ldap_set_optionA( LDAP
*ld
, int option
, void *value
)
278 TRACE( "(%p, 0x%08x, %p)\n", ld
, option
, value
);
280 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
284 case WLDAP32_LDAP_OPT_SERVER_CONTROLS
:
286 LDAPControlW
**ctrlsW
;
287 if (!(ctrlsW
= controlarrayAtoW( value
))) return WLDAP32_LDAP_NO_MEMORY
;
288 ret
= ldap_set_optionW( ld
, option
, ctrlsW
);
289 controlarrayfreeW( ctrlsW
);
292 case WLDAP32_LDAP_OPT_DEREF
:
293 case WLDAP32_LDAP_OPT_DESC
:
294 case WLDAP32_LDAP_OPT_ERROR_NUMBER
:
295 case WLDAP32_LDAP_OPT_PROTOCOL_VERSION
:
296 case WLDAP32_LDAP_OPT_REFERRALS
:
297 case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT
:
298 case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE
:
299 case WLDAP32_LDAP_OPT_SIZELIMIT
:
300 case WLDAP32_LDAP_OPT_SSL
:
301 case WLDAP32_LDAP_OPT_TIMELIMIT
:
302 return ldap_set_optionW( ld
, option
, value
);
304 case WLDAP32_LDAP_OPT_CACHE_ENABLE
:
305 case WLDAP32_LDAP_OPT_CACHE_FN_PTRS
:
306 case WLDAP32_LDAP_OPT_CACHE_STRATEGY
:
307 case WLDAP32_LDAP_OPT_IO_FN_PTRS
:
308 case WLDAP32_LDAP_OPT_REBIND_ARG
:
309 case WLDAP32_LDAP_OPT_REBIND_FN
:
310 case WLDAP32_LDAP_OPT_RESTART
:
311 case WLDAP32_LDAP_OPT_THREAD_FN_PTRS
:
312 return WLDAP32_LDAP_LOCAL_ERROR
;
314 case WLDAP32_LDAP_OPT_API_FEATURE_INFO
:
315 case WLDAP32_LDAP_OPT_API_INFO
:
316 return WLDAP32_LDAP_UNWILLING_TO_PERFORM
;
318 case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE
:
319 case WLDAP32_LDAP_OPT_AUTO_RECONNECT
:
320 case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE
:
321 case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME
:
322 case WLDAP32_LDAP_OPT_ENCRYPT
:
323 case WLDAP32_LDAP_OPT_ERROR_STRING
:
324 case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND
:
325 case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS
:
326 case WLDAP32_LDAP_OPT_HOST_NAME
:
327 case WLDAP32_LDAP_OPT_HOST_REACHABLE
:
328 case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE
:
329 case WLDAP32_LDAP_OPT_PING_LIMIT
:
330 case WLDAP32_LDAP_OPT_PING_WAIT_TIME
:
331 case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS
:
332 case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG
:
333 case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK
:
334 case WLDAP32_LDAP_OPT_ROOTDSE_CACHE
:
335 case WLDAP32_LDAP_OPT_SASL_METHOD
:
336 case WLDAP32_LDAP_OPT_SECURITY_CONTEXT
:
337 case WLDAP32_LDAP_OPT_SEND_TIMEOUT
:
338 case WLDAP32_LDAP_OPT_SERVER_ERROR
:
339 case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR
:
340 case WLDAP32_LDAP_OPT_SIGN
:
341 case WLDAP32_LDAP_OPT_SSL_INFO
:
342 case WLDAP32_LDAP_OPT_SSPI_FLAGS
:
343 case WLDAP32_LDAP_OPT_TCP_KEEPALIVE
:
344 FIXME( "Unsupported option: 0x%02x\n", option
);
345 return WLDAP32_LDAP_NOT_SUPPORTED
;
348 FIXME( "Unknown option: 0x%02x\n", option
);
349 return WLDAP32_LDAP_LOCAL_ERROR
;
353 static BOOL
query_supported_server_ctrls( LDAP
*ld
)
355 char *attrs
[] = { (char *)"supportedControl", NULL
};
356 LDAPMessage
*res
, *entry
;
357 struct berval
**ctrls
= SERVER_CTRLS(ld
);
360 if (ctrls
) return TRUE
;
362 ret
= map_error( ldap_search_ext_s( CTX(ld
), (char *)"", WLDAP32_LDAP_SCOPE_BASE
, (char *)"(objectClass=*)",
363 attrs
, FALSE
, NULL
, NULL
, NULL
, 0, &res
) );
364 if (ret
== WLDAP32_LDAP_SUCCESS
)
366 if ((entry
= ldap_first_entry( CTX(ld
), res
)))
369 ctrls
= ldap_get_values_len( CTX(ld
), entry
, attrs
[0] );
370 count
= ldap_count_values_len( ctrls
);
371 for (i
= 0; i
< count
; i
++) TRACE( "%lu: %s\n", i
, debugstr_an( ctrls
[i
]->bv_val
, ctrls
[i
]->bv_len
) );
372 *(struct berval
***)&SERVER_CTRLS(ld
) = ctrls
;
378 return ctrls
!= NULL
;
381 static BOOL
is_supported_server_ctrls( LDAP
*ld
, LDAPControl
**ctrls
)
383 ULONG user_count
, server_count
, i
, n
, supported
= 0;
385 if (!query_supported_server_ctrls( ld
))
386 return TRUE
; /* can't verify, let the server handle it on next query */
388 user_count
= controlarraylenU( ctrls
);
389 server_count
= ldap_count_values_len( SERVER_CTRLS(ld
) );
391 for (n
= 0; n
< user_count
; n
++)
393 TRACE("looking for %s\n", debugstr_a(ctrls
[n
]->ldctl_oid
));
395 for (i
= 0; i
< server_count
; i
++)
397 struct berval
**server_ctrls
= SERVER_CTRLS(ld
);
398 if (!strncmp( ctrls
[n
]->ldctl_oid
, server_ctrls
[i
]->bv_val
, server_ctrls
[i
]->bv_len
))
406 return supported
== user_count
;
409 /***********************************************************************
410 * ldap_set_optionW (WLDAP32.@)
412 ULONG CDECL
ldap_set_optionW( LDAP
*ld
, int option
, void *value
)
416 TRACE( "(%p, 0x%08x, %p)\n", ld
, option
, value
);
418 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
422 case WLDAP32_LDAP_OPT_SERVER_CONTROLS
:
424 LDAPControl
**ctrlsU
;
426 if (!(ctrlsU
= controlarrayWtoU( value
))) return WLDAP32_LDAP_NO_MEMORY
;
428 if (!is_supported_server_ctrls( ld
, ctrlsU
))
429 ret
= WLDAP32_LDAP_PARAM_ERROR
;
431 ret
= map_error( ldap_set_option( CTX(ld
), option
, ctrlsU
) );
433 controlarrayfreeU( ctrlsU
);
436 case WLDAP32_LDAP_OPT_REFERRALS
:
438 if (value
== WLDAP32_LDAP_OPT_ON
)
440 else if (value
== WLDAP32_LDAP_OPT_OFF
)
441 value
= LDAP_OPT_OFF
;
442 else if (value
== (void *)LDAP_CHASE_SUBORDINATE_REFERRALS
||
443 value
== (void *)LDAP_CHASE_EXTERNAL_REFERRALS
||
444 value
== (void *)(LDAP_CHASE_SUBORDINATE_REFERRALS
|LDAP_CHASE_EXTERNAL_REFERRALS
))
446 FIXME( "upgrading referral value %p to LDAP_OPT_ON (OpenLDAP lacks sufficient granularity)\n", value
);
449 else if (*(ULONG
*)value
== 1)
451 else if (*(ULONG
*)value
== 0)
452 value
= LDAP_OPT_OFF
;
453 else if (*(ULONG
*)value
== LDAP_CHASE_SUBORDINATE_REFERRALS
||
454 *(ULONG
*)value
== LDAP_CHASE_EXTERNAL_REFERRALS
||
455 *(ULONG
*)value
== (LDAP_CHASE_SUBORDINATE_REFERRALS
|LDAP_CHASE_EXTERNAL_REFERRALS
))
457 FIXME( "upgrading referral value 0x%lx to LDAP_OPT_ON (OpenLDAP lacks sufficient granularity)\n", *(ULONG
*)value
);
461 return WLDAP32_LDAP_PARAM_ERROR
;
463 return map_error( ldap_set_option( CTX(ld
), option
, value
) );
465 case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT
:
466 return map_error( ldap_set_option( CTX(ld
), LDAP_OPT_REFHOPLIMIT
, value
) );
468 case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE
:
469 CERT_CALLBACK(ld
) = value
;
470 return WLDAP32_LDAP_SUCCESS
;
472 case WLDAP32_LDAP_OPT_DEREF
:
473 case WLDAP32_LDAP_OPT_DESC
:
474 case WLDAP32_LDAP_OPT_ERROR_NUMBER
:
475 case WLDAP32_LDAP_OPT_PROTOCOL_VERSION
:
476 case WLDAP32_LDAP_OPT_SIZELIMIT
:
477 case WLDAP32_LDAP_OPT_TIMELIMIT
:
478 return map_error( ldap_set_option( CTX(ld
), option
, value
) );
480 case WLDAP32_LDAP_OPT_SSL
:
485 if (value
== WLDAP32_LDAP_OPT_ON
)
487 else if (value
== WLDAP32_LDAP_OPT_OFF
)
489 else if (*(ULONG
*)value
== 1)
491 else if (*(ULONG
*)value
== 0)
494 return WLDAP32_LDAP_PARAM_ERROR
;
496 ret
= ldap_get_option( CTX(ld
), LDAP_OPT_URI
, &uri
);
497 if (ret
!= LDAP_SUCCESS
) return map_error( ret
);
500 new_uri
= strreplace( uri
, "ldap://", "ldaps://" );
502 new_uri
= strreplace( uri
, "ldaps://", "ldap://" );
504 ret
= map_error( ldap_set_option( CTX(ld
), LDAP_OPT_URI
, new_uri
) );
510 case WLDAP32_LDAP_OPT_CACHE_ENABLE
:
511 case WLDAP32_LDAP_OPT_CACHE_FN_PTRS
:
512 case WLDAP32_LDAP_OPT_CACHE_STRATEGY
:
513 case WLDAP32_LDAP_OPT_IO_FN_PTRS
:
514 case WLDAP32_LDAP_OPT_REBIND_ARG
:
515 case WLDAP32_LDAP_OPT_REBIND_FN
:
516 case WLDAP32_LDAP_OPT_RESTART
:
517 case WLDAP32_LDAP_OPT_THREAD_FN_PTRS
:
518 return WLDAP32_LDAP_LOCAL_ERROR
;
520 case WLDAP32_LDAP_OPT_API_FEATURE_INFO
:
521 case WLDAP32_LDAP_OPT_API_INFO
:
522 return WLDAP32_LDAP_UNWILLING_TO_PERFORM
;
524 case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE
:
525 case WLDAP32_LDAP_OPT_AUTO_RECONNECT
:
526 case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE
:
527 case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME
:
528 case WLDAP32_LDAP_OPT_ENCRYPT
:
529 case WLDAP32_LDAP_OPT_ERROR_STRING
:
530 case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND
:
531 case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS
:
532 case WLDAP32_LDAP_OPT_HOST_NAME
:
533 case WLDAP32_LDAP_OPT_HOST_REACHABLE
:
534 case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE
:
535 case WLDAP32_LDAP_OPT_PING_LIMIT
:
536 case WLDAP32_LDAP_OPT_PING_WAIT_TIME
:
537 case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS
:
538 case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG
:
539 case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK
:
540 case WLDAP32_LDAP_OPT_ROOTDSE_CACHE
:
541 case WLDAP32_LDAP_OPT_SASL_METHOD
:
542 case WLDAP32_LDAP_OPT_SECURITY_CONTEXT
:
543 case WLDAP32_LDAP_OPT_SEND_TIMEOUT
:
544 case WLDAP32_LDAP_OPT_SERVER_ERROR
:
545 case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR
:
546 case WLDAP32_LDAP_OPT_SIGN
:
547 case WLDAP32_LDAP_OPT_SSL_INFO
:
548 case WLDAP32_LDAP_OPT_SSPI_FLAGS
:
549 case WLDAP32_LDAP_OPT_TCP_KEEPALIVE
:
550 FIXME( "Unsupported option: 0x%02x\n", option
);
551 return WLDAP32_LDAP_NOT_SUPPORTED
;
554 FIXME( "Unknown option: 0x%02x\n", option
);
555 return WLDAP32_LDAP_LOCAL_ERROR
;