ReactOS 0.4.15-dev-7670-g69b08be
option.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap_private.h"
#include "wldap32.h"
#include "wine/debug.h"
Include dependency graph for option.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wldap32)
 
ULONG CDECL ldap_get_optionA (WLDAP32_LDAP *ld, int option, void *value)
 
ULONG CDECL ldap_get_optionW (WLDAP32_LDAP *ld, int option, void *value)
 
ULONG CDECL ldap_set_optionA (WLDAP32_LDAP *ld, int option, void *value)
 
ULONG CDECL ldap_set_optionW (WLDAP32_LDAP *ld, int option, void *value)
 

Function Documentation

◆ ldap_get_optionA()

ULONG CDECL ldap_get_optionA ( WLDAP32_LDAP ld,
int  option,
void value 
)

Definition at line 44 of file option.c.

45{
47#ifdef HAVE_LDAP
48
49 TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
50
51 if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
52
53 switch (option)
54 {
56 {
57 LDAPAPIFeatureInfoW featureW;
58 LDAPAPIFeatureInfoA *featureA = value;
59
60 if (!featureA->ldapaif_name) return WLDAP32_LDAP_PARAM_ERROR;
61
62 featureW.ldapaif_info_version = featureA->ldapaif_info_version;
63 featureW.ldapaif_name = strAtoW( featureA->ldapaif_name );
64 featureW.ldapaif_version = 0;
65
66 if (!featureW.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY;
67
68 ret = ldap_get_optionW( ld, option, &featureW );
69
70 featureA->ldapaif_version = featureW.ldapaif_version;
71 strfreeW( featureW.ldapaif_name );
72 return ret;
73 }
75 {
78
79 memset( &infoW, 0, sizeof(LDAPAPIInfoW) );
80 infoW.ldapai_info_version = infoA->ldapai_info_version;
81
83
84 infoA->ldapai_api_version = infoW.ldapai_api_version;
85 infoA->ldapai_protocol_version = infoW.ldapai_protocol_version;
86
87 if (infoW.ldapai_extensions)
88 {
89 infoA->ldapai_extensions = strarrayWtoA( infoW.ldapai_extensions );
90 if (!infoA->ldapai_extensions) return WLDAP32_LDAP_NO_MEMORY;
91 }
92 if (infoW.ldapai_vendor_name)
93 {
94 infoA->ldapai_vendor_name = strWtoA( infoW.ldapai_vendor_name );
95 if (!infoA->ldapai_vendor_name)
96 {
97 ldap_value_freeW( infoW.ldapai_extensions );
99 }
100 }
101 infoA->ldapai_vendor_version = infoW.ldapai_vendor_version;
102
103 ldap_value_freeW( infoW.ldapai_extensions );
104 ldap_memfreeW( infoW.ldapai_vendor_name );
105 return ret;
106 }
107
115 return ldap_get_optionW( ld, option, value );
116
125 return LDAP_LOCAL_ERROR;
126
157 FIXME( "Unsupported option: 0x%02x\n", option );
159
160 default:
161 FIXME( "Unknown option: 0x%02x\n", option );
163 }
164
165#endif
166 return ret;
167}
#define FIXME(fmt,...)
Definition: debug.h:111
void CDECL ldap_memfreeW(PWCHAR block)
Definition: misc.c:421
static LPWSTR strAtoW(const char *str)
static const SecPkgInfoW infoW
Definition: kerberos.c:293
static const SecPkgInfoA infoA
Definition: kerberos.c:302
ULONG CDECL ldap_get_optionW(WLDAP32_LDAP *ld, int option, void *value)
Definition: option.c:183
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
Definition: getopt.h:109
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:94
ULONG CDECL ldap_value_freeW(PWCHAR *vals)
Definition: value.c:364
int ret
#define LDAP_LOCAL_ERROR
Definition: winldap.h:102
#define WLDAP32_LDAP_OPT_IO_FN_PTRS
#define WLDAP32_LDAP_OPT_HOST_REACHABLE
#define WLDAP32_LDAP_OPT_PROTOCOL_VERSION
#define WLDAP32_LDAP_OPT_REBIND_FN
#define WLDAP32_LDAP_OPT_CACHE_FN_PTRS
#define WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE
#define WLDAP32_LDAP_OPT_RESTART
#define WLDAP32_LDAP_OPT_THREAD_FN_PTRS
#define WLDAP32_LDAP_OPT_DEREF
@ WLDAP32_LDAP_LOCAL_ERROR
@ WLDAP32_LDAP_PARAM_ERROR
@ WLDAP32_LDAP_NOT_SUPPORTED
@ WLDAP32_LDAP_NO_MEMORY
#define WLDAP32_LDAP_OPT_SASL_METHOD
#define WLDAP32_LDAP_OPT_SSPI_FLAGS
#define WLDAP32_LDAP_OPT_SIZELIMIT
#define WLDAP32_LDAP_OPT_SERVER_CERTIFICATE
#define WLDAP32_LDAP_OPT_SECURITY_CONTEXT
#define WLDAP32_LDAP_OPT_HOST_NAME
#define WLDAP32_LDAP_OPT_ERROR_STRING
#define WLDAP32_LDAP_OPT_SERVER_EXT_ERROR
#define WLDAP32_LDAP_OPT_CACHE_STRATEGY
#define WLDAP32_LDAP_OPT_SEND_TIMEOUT
#define WLDAP32_LDAP_OPT_REFERRALS
#define WLDAP32_LDAP_OPT_PING_LIMIT
#define WLDAP32_LDAP_OPT_TIMELIMIT
#define WLDAP32_LDAP_OPT_API_FEATURE_INFO
#define WLDAP32_LDAP_OPT_SSL_INFO
#define WLDAP32_LDAP_OPT_TCP_KEEPALIVE
#define WLDAP32_LDAP_OPT_AREC_EXCLUSIVE
#define WLDAP32_LDAP_OPT_DNSDOMAIN_NAME
#define WLDAP32_LDAP_OPT_ERROR_NUMBER
#define WLDAP32_LDAP_OPT_PING_KEEP_ALIVE
#define WLDAP32_LDAP_OPT_AUTO_RECONNECT
#define WLDAP32_LDAP_OPT_DESC
#define WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG
#define WLDAP32_LDAP_OPT_SERVER_ERROR
#define WLDAP32_LDAP_OPT_SERVER_CONTROLS
#define WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS
#define WLDAP32_LDAP_OPT_GETDSNAME_FLAGS
#define WLDAP32_LDAP_OPT_PING_WAIT_TIME
#define WLDAP32_LDAP_OPT_SIGN
#define WLDAP32_LDAP_OPT_REFERRAL_CALLBACK
#define WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT
#define WLDAP32_LDAP_OPT_ROOTDSE_CACHE
#define WLDAP32_LDAP_OPT_REBIND_ARG
#define WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND
#define WLDAP32_LDAP_OPT_API_INFO
#define WLDAP32_LDAP_OPT_CACHE_ENABLE
#define WLDAP32_LDAP_OPT_ENCRYPT
#define WLDAP32_LDAP_OPT_SSL
static LPSTR strWtoA(LPCWSTR str)
Definition: wldap32.h:62
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
static LPSTR * strarrayWtoA(LPWSTR *strarray)
Definition: wldap32.h:154

◆ ldap_get_optionW()

ULONG CDECL ldap_get_optionW ( WLDAP32_LDAP ld,
int  option,
void value 
)

Definition at line 183 of file option.c.

184{
186#ifdef HAVE_LDAP
187
188 TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
189
190 if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
191
192 switch (option)
193 {
195 {
196 LDAPAPIFeatureInfo featureU;
197 LDAPAPIFeatureInfoW *featureW = value;
198
199 if (!featureW->ldapaif_name) return WLDAP32_LDAP_PARAM_ERROR;
200
201 featureU.ldapaif_info_version = featureW->ldapaif_info_version;
202 featureU.ldapaif_name = strWtoU( featureW->ldapaif_name );
203 featureU.ldapaif_version = 0;
204
205 if (!featureU.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY;
206
207 ret = map_error( ldap_get_option( ld, option, &featureU ));
208
209 featureW->ldapaif_version = featureU.ldapaif_version;
210 strfreeU( featureU.ldapaif_name );
211 return ret;
212 }
214 {
215 LDAPAPIInfo infoU;
217
218 memset( &infoU, 0, sizeof(LDAPAPIInfo) );
219 infoU.ldapai_info_version = infoW->ldapai_info_version;
220
221 ret = map_error( ldap_get_option( ld, option, &infoU ));
222
223 infoW->ldapai_api_version = infoU.ldapai_api_version;
224 infoW->ldapai_protocol_version = infoU.ldapai_protocol_version;
225
226 if (infoU.ldapai_extensions)
227 {
228 infoW->ldapai_extensions = strarrayUtoW( infoU.ldapai_extensions );
229 if (!infoW->ldapai_extensions) return WLDAP32_LDAP_NO_MEMORY;
230 }
231 if (infoU.ldapai_vendor_name)
232 {
233 infoW->ldapai_vendor_name = strUtoW( infoU.ldapai_vendor_name );
234 if (!infoW->ldapai_vendor_name)
235 {
236 ldap_memvfree( (void **)infoU.ldapai_extensions );
238 }
239 }
240 infoW->ldapai_vendor_version = infoU.ldapai_vendor_version;
241
242 ldap_memvfree( (void **)infoU.ldapai_extensions );
243 ldap_memfree( infoU.ldapai_vendor_name );
244 return ret;
245 }
246
254 return map_error( ldap_get_option( ld, option, value ));
255
265
296 FIXME( "Unsupported option: 0x%02x\n", option );
298
299 default:
300 FIXME( "Unknown option: 0x%02x\n", option );
302 }
303
304#endif
305 return ret;
306}
static UINT map_error(DWORD error)
Definition: service.c:35
#define ldap_memfree
Definition: winldap.h:688
#define LDAPAPIInfo
Definition: winldap.h:626
#define LDAPAPIFeatureInfo
Definition: winldap.h:628
#define ldap_get_option
Definition: winldap.h:640
static void strfreeU(char *str)
Definition: wldap32.h:108
static char * strWtoU(LPCWSTR str)
Definition: wldap32.h:74
static LPWSTR * strarrayUtoW(char **strarray)
Definition: wldap32.h:194
static LPWSTR strUtoW(char *str)
Definition: wldap32.h:86

Referenced by ldap_get_optionA(), test_ldap_get_optionW(), and test_ldap_set_optionW().

◆ ldap_set_optionA()

ULONG CDECL ldap_set_optionA ( WLDAP32_LDAP ld,
int  option,
void value 
)

Definition at line 313 of file option.c.

314{
316#ifdef HAVE_LDAP
317
318 TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
319
320 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
321
322 switch (option)
323 {
325 {
326 LDAPControlW **ctrlsW;
327
328 ctrlsW = controlarrayAtoW( value );
329 if (!ctrlsW) return WLDAP32_LDAP_NO_MEMORY;
330
331 ret = ldap_set_optionW( ld, option, ctrlsW );
332 controlarrayfreeW( ctrlsW );
333 return ret;
334 }
342 return ldap_set_optionW( ld, option, value );
343
353
357
387 FIXME( "Unsupported option: 0x%02x\n", option );
389
390 default:
391 FIXME( "Unknown option: 0x%02x\n", option );
393 }
394
395#endif
396 return ret;
397}
ULONG CDECL ldap_set_optionW(WLDAP32_LDAP *ld, int option, void *value)
Definition: option.c:416
@ WLDAP32_LDAP_UNWILLING_TO_PERFORM

◆ ldap_set_optionW()

ULONG CDECL ldap_set_optionW ( WLDAP32_LDAP ld,
int  option,
void value 
)

Definition at line 416 of file option.c.

417{
419#ifdef HAVE_LDAP
420
421 TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
422
423 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
424
425 switch (option)
426 {
428 {
429 LDAPControl **ctrlsU;
430
431 ctrlsU = controlarrayWtoU( value );
432 if (!ctrlsU) return WLDAP32_LDAP_NO_MEMORY;
433
434 ret = map_error( ldap_set_option( ld, option, ctrlsU ));
435 controlarrayfreeU( ctrlsU );
436 return ret;
437 }
445 return map_error( ldap_set_option( ld, option, value ));
446
456
460
490 FIXME( "Unsupported option: 0x%02x\n", option );
492
493 default:
494 FIXME( "Unknown option: 0x%02x\n", option );
496 }
497
498#endif
499 return ret;
500}
#define LDAPControl
Definition: winldap.h:620
#define ldap_set_option
Definition: winldap.h:641

Referenced by ldap_set_optionA(), and test_ldap_set_optionW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wldap32  )