Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/wldap32/add.c | 8 ++++----
dlls/wldap32/bind.c | 24 +++++++++++++++---------
dlls/wldap32/compare.c | 8 ++++----
dlls/wldap32/control.c | 4 ++--
dlls/wldap32/delete.c | 8 ++++----
dlls/wldap32/dn.c | 2 +-
dlls/wldap32/error.c | 2 +-
dlls/wldap32/extended.c | 4 ++--
dlls/wldap32/init.c | 25 ++++++++++++++++---------
dlls/wldap32/misc.c | 20 ++++++++++----------
dlls/wldap32/modify.c | 8 ++++----
dlls/wldap32/modrdn.c | 8 ++++----
dlls/wldap32/option.c | 10 +++++-----
dlls/wldap32/parse.c | 16 ++++++++--------
dlls/wldap32/rename.c | 4 ++--
dlls/wldap32/search.c | 10 +++++-----
dlls/wldap32/value.c | 4 ++--
dlls/wldap32/winldap_private.h | 5 ++++-
18 files changed, 93 insertions(+), 77 deletions(-)
diff --git a/dlls/wldap32/add.c b/dlls/wldap32/add.c
index 270311e561..0d0c8bfa11 100644
--- a/dlls/wldap32/add.c
+++ b/dlls/wldap32/add.c
@@ -120,7 +120,7 @@ ULONG CDECL ldap_addW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[] )
if (!attrsU) goto exit;
}
- ret = ldap_add_ext( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, NULL, NULL, &msg );
+ ret = ldap_add_ext( ld->ld, dn ? dnU : "", attrs ? attrsU : nullattrs, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
@@ -242,7 +242,7 @@ ULONG CDECL ldap_add_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[],
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_add_ext( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, serverctrlsU,
+ ret = map_error( ldap_add_ext( ld->ld, dn ? dnU : "", attrs ? attrsU : nullattrs, serverctrlsU,
clientctrlsU, message ? (int *)message : &dummy ));
exit:
@@ -359,7 +359,7 @@ ULONG CDECL ldap_add_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[],
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_add_ext_s( ld, dn ? dnU : "", attrs ? attrsU : nullattrs,
+ ret = map_error( ldap_add_ext_s( ld->ld, dn ? dnU : "", attrs ? attrsU : nullattrs,
serverctrlsU, clientctrlsU ));
exit:
@@ -446,7 +446,7 @@ ULONG CDECL ldap_add_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[] )
if (!attrsU) goto exit;
}
- ret = map_error( ldap_add_ext_s( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, NULL, NULL ));
+ ret = map_error( ldap_add_ext_s( ld->ld, dn ? dnU : "", attrs ? attrsU : nullattrs, NULL, NULL ));
exit:
strfreeU( dnU );
diff --git a/dlls/wldap32/bind.c b/dlls/wldap32/bind.c
index 46b866fd31..aedda13634 100644
--- a/dlls/wldap32/bind.c
+++ b/dlls/wldap32/bind.c
@@ -123,7 +123,7 @@ ULONG CDECL ldap_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
pwd.bv_val = credU;
}
- ret = ldap_sasl_bind( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, &msg );
+ ret = ldap_sasl_bind( ld->ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
@@ -265,7 +265,7 @@ ULONG CDECL ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method
pwd.bv_val = credU;
}
- ret = map_error( ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL ));
+ ret = map_error( ldap_sasl_bind_s( ld->ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL ));
}
else if (method == WLDAP32_LDAP_AUTH_NEGOTIATE)
{
@@ -292,7 +292,7 @@ ULONG CDECL ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method
idU.Password = (unsigned char *)strnWtoU( id->Password, id->PasswordLength, &idU.PasswordLength );
}
- ret = map_error( ldap_sasl_interactive_bind_s( ld,
+ ret = map_error( ldap_sasl_interactive_bind_s( ld->ld,
NULL /* server will ignore DN anyway */,
NULL /* query supportedSASLMechanisms */,
NULL, NULL, LDAP_SASL_QUIET, sasl_interact, &idU ));
@@ -429,7 +429,7 @@ ULONG CDECL ldap_sasl_bindW( WLDAP32_LDAP *ld, const PWCHAR dn,
credU.bv_len = cred->bv_len;
credU.bv_val = cred->bv_val;
- ret = map_error( ldap_sasl_bind( ld, dnU, mechanismU, &credU,
+ ret = map_error( ldap_sasl_bind( ld->ld, dnU, mechanismU, &credU,
serverctrlsU, clientctrlsU, message ));
exit:
@@ -549,7 +549,7 @@ ULONG CDECL ldap_sasl_bind_sW( WLDAP32_LDAP *ld, const PWCHAR dn,
credU.bv_len = cred->bv_len;
credU.bv_val = cred->bv_val;
- ret = map_error( ldap_sasl_bind_s( ld, dnU, mechanismU, &credU,
+ ret = map_error( ldap_sasl_bind_s( ld->ld, dnU, mechanismU, &credU,
serverctrlsU, clientctrlsU, (struct berval **)serverdata ));
exit:
@@ -641,7 +641,7 @@ ULONG CDECL ldap_simple_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
pwd.bv_val = passwdU;
}
- ret = ldap_sasl_bind( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, &msg );
+ ret = ldap_sasl_bind( ld->ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
@@ -734,7 +734,7 @@ ULONG CDECL ldap_simple_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
pwd.bv_val = passwdU;
}
- ret = map_error( ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL ));
+ ret = map_error( ldap_sasl_bind_s( ld->ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL ));
exit:
strfreeU( dnU );
@@ -764,7 +764,10 @@ ULONG CDECL WLDAP32_ldap_unbind( WLDAP32_LDAP *ld )
TRACE( "(%p)\n", ld );
if (ld)
- ret = map_error( ldap_unbind_ext( ld, NULL, NULL ));
+ {
+ ret = map_error( ldap_unbind_ext( ld->ld, NULL, NULL ));
+ heap_free( ld );
+ }
else
ret = WLDAP32_LDAP_PARAM_ERROR;
@@ -792,7 +795,10 @@ ULONG CDECL WLDAP32_ldap_unbind_s( WLDAP32_LDAP *ld )
TRACE( "(%p)\n", ld );
if (ld)
- ret = map_error( ldap_unbind_ext_s( ld, NULL, NULL ));
+ {
+ ret = map_error( ldap_unbind_ext_s( ld->ld, NULL, NULL ));
+ heap_free( ld );
+ }
else
ret = WLDAP32_LDAP_PARAM_ERROR;
diff --git a/dlls/wldap32/compare.c b/dlls/wldap32/compare.c
index a7eab26d96..c725aa3a71 100644
--- a/dlls/wldap32/compare.c
+++ b/dlls/wldap32/compare.c
@@ -126,7 +126,7 @@ ULONG CDECL ldap_compareW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR valu
val.bv_val = valueU;
}
- ret = ldap_compare_ext( ld, dn ? dnU : "", attrU, &val, NULL, NULL, &msg );
+ ret = ldap_compare_ext( ld->ld, dn ? dnU : "", attrU, &val, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
@@ -268,7 +268,7 @@ ULONG CDECL ldap_compare_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_compare_ext( ld, dn ? dnU : "", attrU, data ? (struct berval *)data : &val,
+ ret = map_error( ldap_compare_ext( ld->ld, dn ? dnU : "", attrU, data ? (struct berval *)data : &val,
serverctrlsU, clientctrlsU, (int *)message ));
exit:
@@ -404,7 +404,7 @@ ULONG CDECL ldap_compare_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHA
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "",
+ ret = map_error( ldap_compare_ext_s( ld->ld, dn ? dnU : "", attr ? attrU : "",
data ? (struct berval *)data : &val,
serverctrlsU, clientctrlsU ));
@@ -506,7 +506,7 @@ ULONG CDECL ldap_compare_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR va
val.bv_val = valueU;
}
- ret = map_error( ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "", &val, NULL, NULL ));
+ ret = map_error( ldap_compare_ext_s( ld->ld, dn ? dnU : "", attr ? attrU : "", &val, NULL, NULL ));
exit:
strfreeU( dnU );
diff --git a/dlls/wldap32/control.c b/dlls/wldap32/control.c
index ffbf41ef68..f0e0b05c0d 100644
--- a/dlls/wldap32/control.c
+++ b/dlls/wldap32/control.c
@@ -189,7 +189,7 @@ ULONG CDECL ldap_create_sort_controlW( WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkey,
sortkeyU = sortkeyarrayWtoU( sortkey );
if (!sortkeyU) return WLDAP32_LDAP_NO_MEMORY;
- ret = map_error( ldap_create_sort_control( ld, sortkeyU, critical, &controlU ));
+ ret = map_error( ldap_create_sort_control( ld->ld, sortkeyU, critical, &controlU ));
*control = controlUtoW( controlU );
if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
@@ -263,7 +263,7 @@ INT CDECL ldap_create_vlv_controlW( WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info,
if (!ld || !control) return ~0u;
- ret = map_error( ldap_create_vlv_control( ld, (LDAPVLVInfo *)info, &controlU ));
+ ret = map_error( ldap_create_vlv_control( ld->ld, (LDAPVLVInfo *)info, &controlU ));
if (ret == WLDAP32_LDAP_SUCCESS)
{
diff --git a/dlls/wldap32/delete.c b/dlls/wldap32/delete.c
index 7d62edc8ac..95d636e487 100644
--- a/dlls/wldap32/delete.c
+++ b/dlls/wldap32/delete.c
@@ -99,7 +99,7 @@ ULONG CDECL ldap_deleteW( WLDAP32_LDAP *ld, PWCHAR dn )
if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
}
- ret = ldap_delete_ext( ld, dn ? dnU : "", NULL, NULL, &msg );
+ ret = ldap_delete_ext( ld->ld, dn ? dnU : "", NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
@@ -206,7 +206,7 @@ ULONG CDECL ldap_delete_extW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *server
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_delete_ext( ld, dn ? dnU : "", serverctrlsU, clientctrlsU,
+ ret = map_error( ldap_delete_ext( ld->ld, dn ? dnU : "", serverctrlsU, clientctrlsU,
message ? (int *)message : &dummy ));
exit:
@@ -305,7 +305,7 @@ ULONG CDECL ldap_delete_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serv
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_delete_ext_s( ld, dn ? dnU : "", serverctrlsU, clientctrlsU ));
+ ret = map_error( ldap_delete_ext_s( ld->ld, dn ? dnU : "", serverctrlsU, clientctrlsU ));
exit:
strfreeU( dnU );
@@ -371,7 +371,7 @@ ULONG CDECL ldap_delete_sW( WLDAP32_LDAP *ld, PWCHAR dn )
if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
}
- ret = map_error( ldap_delete_ext_s( ld, dn ? dnU : "", NULL, NULL ));
+ ret = map_error( ldap_delete_ext_s( ld->ld, dn ? dnU : "", NULL, NULL ));
strfreeU( dnU );
#endif
diff --git a/dlls/wldap32/dn.c b/dlls/wldap32/dn.c
index 1303eb5057..6d1a971101 100644
--- a/dlls/wldap32/dn.c
+++ b/dlls/wldap32/dn.c
@@ -214,7 +214,7 @@ PWCHAR CDECL ldap_get_dnW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry )
if (!ld || !entry) return NULL;
- retU = ldap_get_dn( ld, entry );
+ retU = ldap_get_dn( ld->ld, entry );
ret = strUtoW( retU );
ldap_memfree( retU );
diff --git a/dlls/wldap32/error.c b/dlls/wldap32/error.c
index fbbd124d23..11ecaf8763 100644
--- a/dlls/wldap32/error.c
+++ b/dlls/wldap32/error.c
@@ -159,7 +159,7 @@ ULONG CDECL WLDAP32_ldap_result2error( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *re
if (!ld || !res) return ~0u;
- ret = ldap_parse_result( ld, res, &error, NULL, NULL, NULL, NULL, free );
+ ret = ldap_parse_result( ld->ld, res, &error, NULL, NULL, NULL, NULL, free );
if (ret == LDAP_SUCCESS)
ret = error;
diff --git a/dlls/wldap32/extended.c b/dlls/wldap32/extended.c
index b05c3c5f1a..4600109182 100644
--- a/dlls/wldap32/extended.c
+++ b/dlls/wldap32/extended.c
@@ -158,7 +158,7 @@ ULONG CDECL ldap_extended_operationW( WLDAP32_LDAP *ld, PWCHAR oid, struct WLDAP
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_extended_operation( ld, oid ? oidU : "", (struct berval *)data,
+ ret = map_error( ldap_extended_operation( ld->ld, oid ? oidU : "", (struct berval *)data,
serverctrlsU, clientctrlsU, (int *)message ));
exit:
@@ -275,7 +275,7 @@ ULONG CDECL ldap_extended_operation_sW( WLDAP32_LDAP *ld, PWCHAR oid, struct WLD
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_extended_operation_s( ld, oid ? oidU : "", (struct berval *)data, serverctrlsU,
+ ret = map_error( ldap_extended_operation_s( ld->ld, oid ? oidU : "", (struct berval *)data, serverctrlsU,
clientctrlsU, &retoidU, (struct berval **)retdata ));
if (retoid && retoidU) {
diff --git a/dlls/wldap32/init.c b/dlls/wldap32/init.c
index d3508e33ef..afaef3b52f 100644
--- a/dlls/wldap32/init.c
+++ b/dlls/wldap32/init.c
@@ -205,12 +205,19 @@ static char *urlify_hostnames( const char *scheme, char *hostnames, ULONG port )
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
#ifdef HAVE_LDAP
-static LDAP *create_context( const char *url )
+static WLDAP32_LDAP *create_context( const char *url )
{
- LDAP *ld;
+ WLDAP32_LDAP *ld;
int version = LDAP_VERSION3;
- if (ldap_initialize( &ld, url ) != LDAP_SUCCESS) return NULL;
- ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
+
+ ld = heap_alloc_zero( sizeof( *ld ));
+ if (!ld) return NULL;
+ if (ldap_initialize( &ld->ld, url ) != LDAP_SUCCESS)
+ {
+ heap_free( ld );
+ return NULL;
+ }
+ ldap_set_option( ld->ld, LDAP_OPT_PROTOCOL_VERSION, &version );
return ld;
}
#endif
@@ -268,7 +275,7 @@ exit:
WLDAP32_LDAP * CDECL cldap_openW( PWCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
- LDAP *ld = NULL;
+ WLDAP32_LDAP *ld = NULL;
char *hostnameU = NULL, *url = NULL;
TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
@@ -377,7 +384,7 @@ exit:
WLDAP32_LDAP * CDECL ldap_initW( const PWCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
- LDAP *ld = NULL;
+ WLDAP32_LDAP *ld = NULL;
char *hostnameU = NULL, *url = NULL;
TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
@@ -459,7 +466,7 @@ exit:
WLDAP32_LDAP * CDECL ldap_openW( PWCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
- LDAP *ld = NULL;
+ WLDAP32_LDAP *ld = NULL;
char *hostnameU = NULL, *url = NULL;
TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
@@ -562,7 +569,7 @@ WLDAP32_LDAP * CDECL ldap_sslinitW( PWCHAR hostname, ULONG portnumber, int secur
url = urlify_hostnames( "ldap://", hostnameU, portnumber );
if (!url) goto exit;
- ldap_initialize( &ld, url );
+ ldap_initialize( &ld->ld, url );
exit:
strfreeU( hostnameU );
@@ -652,7 +659,7 @@ ULONG CDECL ldap_start_tls_sW( WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMess
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_start_tls_s( ld, serverctrlsU, clientctrlsU ));
+ ret = map_error( ldap_start_tls_s( ld->ld, serverctrlsU, clientctrlsU ));
exit:
controlarrayfreeU( serverctrlsU );
diff --git a/dlls/wldap32/misc.c b/dlls/wldap32/misc.c
index 9c421f9470..3964296095 100644
--- a/dlls/wldap32/misc.c
+++ b/dlls/wldap32/misc.c
@@ -58,7 +58,7 @@ ULONG CDECL WLDAP32_ldap_abandon( WLDAP32_LDAP *ld, ULONG msgid )
TRACE( "(%p, 0x%08x)\n", ld, msgid );
if (!ld) return ~0u;
- ret = map_error( ldap_abandon_ext( ld, msgid, NULL, NULL ));
+ ret = map_error( ldap_abandon_ext( ld->ld, msgid, NULL, NULL ));
#endif
return ret;
@@ -161,7 +161,7 @@ ULONG CDECL WLDAP32_ldap_count_entries( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *r
TRACE( "(%p, %p)\n", ld, res );
if (!ld) return ~0u;
- ret = ldap_count_entries( ld, res );
+ ret = ldap_count_entries( ld->ld, res );
#endif
return ret;
@@ -188,7 +188,7 @@ ULONG CDECL WLDAP32_ldap_count_references( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage
TRACE( "(%p, %p)\n", ld, res );
if (!ld) return 0;
- ret = ldap_count_references( ld, res );
+ ret = ldap_count_references( ld->ld, res );
#endif
return ret;
@@ -333,7 +333,7 @@ PWCHAR CDECL ldap_first_attributeW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry
TRACE( "(%p, %p, %p)\n", ld, entry, ptr );
if (!ld || !entry) return NULL;
- retU = ldap_first_attribute( ld, entry, ptr );
+ retU = ldap_first_attribute( ld->ld, entry, ptr );
ret = strUtoW( retU );
ldap_memfree( retU );
@@ -365,7 +365,7 @@ WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_first_entry( WLDAP32_LDAP *ld, WLDAP32_
TRACE( "(%p, %p)\n", ld, res );
if (!ld || !res) return NULL;
- return ldap_first_entry( ld, res );
+ return ldap_first_entry( ld->ld, res );
#else
return NULL;
@@ -392,7 +392,7 @@ WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_first_reference( WLDAP32_LDAP *ld, WLDA
TRACE( "(%p, %p)\n", ld, res );
if (!ld) return NULL;
- return ldap_first_reference( ld, res );
+ return ldap_first_reference( ld->ld, res );
#else
return NULL;
@@ -496,7 +496,7 @@ PWCHAR CDECL ldap_next_attributeW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry,
TRACE( "(%p, %p, %p)\n", ld, entry, ptr );
if (!ld || !entry || !ptr) return NULL;
- retU = ldap_next_attribute( ld, entry, ptr );
+ retU = ldap_next_attribute( ld->ld, entry, ptr );
ret = strUtoW( retU );
ldap_memfree( retU );
@@ -528,7 +528,7 @@ WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_entry( WLDAP32_LDAP *ld, WLDAP32_L
TRACE( "(%p, %p)\n", ld, entry );
if (!ld || !entry) return NULL;
- return ldap_next_entry( ld, entry );
+ return ldap_next_entry( ld->ld, entry );
#else
return NULL;
@@ -558,7 +558,7 @@ WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_reference( WLDAP32_LDAP *ld, WLDAP
TRACE( "(%p, %p)\n", ld, entry );
if (!ld || !entry) return NULL;
- return ldap_next_reference( ld, entry );
+ return ldap_next_reference( ld->ld, entry );
#else
return NULL;
@@ -610,7 +610,7 @@ ULONG CDECL WLDAP32_ldap_result( WLDAP32_LDAP *ld, ULONG msgid, ULONG all,
TRACE( "(%p, 0x%08x, 0x%08x, %p, %p)\n", ld, msgid, all, timeout, res );
if (!ld || !res || msgid == ~0u) return ~0u;
- ret = ldap_result( ld, msgid, all, (struct timeval *)timeout, res );
+ ret = ldap_result( ld->ld, msgid, all, (struct timeval *)timeout, res );
#endif
return ret;
diff --git a/dlls/wldap32/modify.c b/dlls/wldap32/modify.c
index defc32af9c..7269df9da9 100644
--- a/dlls/wldap32/modify.c
+++ b/dlls/wldap32/modify.c
@@ -120,7 +120,7 @@ ULONG CDECL ldap_modifyW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
if (!modsU) goto exit;
}
- ret = ldap_modify_ext( ld, dn ? dnU : "", mods ? modsU : nullmods,
+ ret = ldap_modify_ext( ld->ld, dn ? dnU : "", mods ? modsU : nullmods,
NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
@@ -243,7 +243,7 @@ ULONG CDECL ldap_modify_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_modify_ext( ld, dn ? dnU : "", mods ? modsU : nullmods, serverctrlsU,
+ ret = map_error( ldap_modify_ext( ld->ld, dn ? dnU : "", mods ? modsU : nullmods, serverctrlsU,
clientctrlsU, message ? (int *)message : &dummy ));
exit:
@@ -360,7 +360,7 @@ ULONG CDECL ldap_modify_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_modify_ext_s( ld, dn ? dnU : "", mods ? modsU : nullmods,
+ ret = map_error( ldap_modify_ext_s( ld->ld, dn ? dnU : "", mods ? modsU : nullmods,
serverctrlsU, clientctrlsU ));
exit:
@@ -447,7 +447,7 @@ ULONG CDECL ldap_modify_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
if (!modsU) goto exit;
}
- ret = map_error( ldap_modify_ext_s( ld, dn ? dnU : "", mods ? modsU : nullmods, NULL, NULL ));
+ ret = map_error( ldap_modify_ext_s( ld->ld, dn ? dnU : "", mods ? modsU : nullmods, NULL, NULL ));
exit:
strfreeU( dnU );
diff --git a/dlls/wldap32/modrdn.c b/dlls/wldap32/modrdn.c
index 97ab0a9258..c9e232140c 100644
--- a/dlls/wldap32/modrdn.c
+++ b/dlls/wldap32/modrdn.c
@@ -113,7 +113,7 @@ ULONG CDECL ldap_modrdnW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
- ret = ldap_rename( ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL, &msg );
+ ret = ldap_rename( ld->ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
@@ -204,7 +204,7 @@ ULONG CDECL ldap_modrdn2W( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
- ret = ldap_rename( ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL, &msg );
+ ret = ldap_rename( ld->ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
@@ -289,7 +289,7 @@ ULONG CDECL ldap_modrdn2_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT dele
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
- ret = map_error( ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL ));
+ ret = map_error( ldap_rename_s( ld->ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL ));
exit:
strfreeU( dnU );
@@ -368,7 +368,7 @@ ULONG CDECL ldap_modrdn_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
- ret = map_error( ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL ));
+ ret = map_error( ldap_rename_s( ld->ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL ));
exit:
strfreeU( dnU );
diff --git a/dlls/wldap32/option.c b/dlls/wldap32/option.c
index 4b7ec36c38..8a8a86b579 100644
--- a/dlls/wldap32/option.c
+++ b/dlls/wldap32/option.c
@@ -206,7 +206,7 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
if (!featureU.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY;
- ret = map_error( ldap_get_option( ld, option, &featureU ));
+ ret = map_error( ldap_get_option( ld->ld, option, &featureU ));
featureW->ldapaif_version = featureU.ldapaif_version;
strfreeU( featureU.ldapaif_name );
@@ -220,7 +220,7 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
memset( &infoU, 0, sizeof(LDAPAPIInfo) );
infoU.ldapai_info_version = infoW->ldapai_info_version;
- ret = map_error( ldap_get_option( ld, option, &infoU ));
+ ret = map_error( ldap_get_option( ld->ld, option, &infoU ));
infoW->ldapai_api_version = infoU.ldapai_api_version;
infoW->ldapai_protocol_version = infoU.ldapai_protocol_version;
@@ -253,7 +253,7 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
case WLDAP32_LDAP_OPT_REFERRALS:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
- return map_error( ldap_get_option( ld, option, value ));
+ return map_error( ldap_get_option( ld->ld, option, value ));
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
@@ -433,7 +433,7 @@ ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
ctrlsU = controlarrayWtoU( value );
if (!ctrlsU) return WLDAP32_LDAP_NO_MEMORY;
- ret = map_error( ldap_set_option( ld, option, ctrlsU ));
+ ret = map_error( ldap_set_option( ld->ld, option, ctrlsU ));
controlarrayfreeU( ctrlsU );
return ret;
}
@@ -444,7 +444,7 @@ ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
case WLDAP32_LDAP_OPT_REFERRALS:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
- return map_error( ldap_set_option( ld, option, value ));
+ return map_error( ldap_set_option( ld->ld, option, value ));
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
diff --git a/dlls/wldap32/parse.c b/dlls/wldap32/parse.c
index 88464a3b13..6bde8542be 100644
--- a/dlls/wldap32/parse.c
+++ b/dlls/wldap32/parse.c
@@ -99,7 +99,7 @@ ULONG CDECL ldap_parse_extended_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (!result) return WLDAP32_LDAP_NO_RESULTS_RETURNED;
- ret = map_error( ldap_parse_extended_result( ld, result, &oidU, (struct berval **)data, free ) );
+ ret = map_error( ldap_parse_extended_result( ld->ld, result, &oidU, (struct berval **)data, free ) );
if (oid) {
*oid = strUtoW( oidU );
@@ -163,8 +163,8 @@ ULONG CDECL ldap_parse_referenceW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *messag
TRACE( "(%p, %p, %p)\n", ld, message, referrals );
if (!ld) return ~0u;
-
- ret = map_error( ldap_parse_reference( ld, message, &referralsU, NULL, 0 ));
+
+ ret = map_error( ldap_parse_reference( ld->ld, message, &referralsU, NULL, 0 ));
*referrals = strarrayUtoW( referralsU );
ldap_memfree( referralsU );
@@ -249,7 +249,7 @@ ULONG CDECL ldap_parse_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
- ret = map_error( ldap_parse_result( ld, result, (int *)retcode, &matchedU, &errorU,
+ ret = map_error( ldap_parse_result( ld->ld, result, (int *)retcode, &matchedU, &errorU,
&referralsU, &serverctrlsU, free ));
if (matched) *matched = strUtoW( matchedU );
@@ -339,7 +339,7 @@ ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
#ifdef HAVE_LDAP_PARSE_SORT_CONTROL
- if (!(ret = ldap_parse_sort_control( ld, controlU, &res, &attrU )))
+ if (!(ret = ldap_parse_sort_control( ld->ld, controlU, &res, &attrU )))
{
*result = res;
*attr = strUtoW( attrU );
@@ -355,7 +355,7 @@ ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
controlarrayfreeU( controlU );
return WLDAP32_LDAP_CONTROL_NOT_FOUND;
}
- if (!(ret = ldap_parse_sortresponse_control( ld, sortcontrol, &res, &attrU )))
+ if (!(ret = ldap_parse_sortresponse_control( ld->ld, sortcontrol, &res, &attrU )))
{
*result = res;
*attr = strUtoW( attrU );
@@ -443,7 +443,7 @@ INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
#ifdef HAVE_LDAP_PARSE_VLV_CONTROL
- if (!(ret = ldap_parse_vlv_control( ld, controlU, &pos, &count,
+ if (!(ret = ldap_parse_vlv_control( ld->ld, controlU, &pos, &count,
(struct berval **)context, errcode )))
{
*targetpos = pos;
@@ -460,7 +460,7 @@ INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
controlarrayfreeU( controlU );
return WLDAP32_LDAP_CONTROL_NOT_FOUND;
}
- if (!(ret = ldap_parse_vlvresponse_control( ld, vlvcontrol, &pos, &count,
+ if (!(ret = ldap_parse_vlvresponse_control( ld->ld, vlvcontrol, &pos, &count,
(struct berval **)context, errcode )))
{
*targetpos = pos;
diff --git a/dlls/wldap32/rename.c b/dlls/wldap32/rename.c
index f8cac439a9..b978daa8ab 100644
--- a/dlls/wldap32/rename.c
+++ b/dlls/wldap32/rename.c
@@ -157,7 +157,7 @@ ULONG CDECL ldap_rename_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_rename( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
+ ret = map_error( ldap_rename( ld->ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
delete, serverctrlsU, clientctrlsU, (int *)message ));
exit:
@@ -283,7 +283,7 @@ ULONG CDECL ldap_rename_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_rename_s( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
+ ret = map_error( ldap_rename_s( ld->ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
delete, serverctrlsU, clientctrlsU ));
exit:
diff --git a/dlls/wldap32/search.c b/dlls/wldap32/search.c
index f3d3eb48d4..88ecb541c9 100644
--- a/dlls/wldap32/search.c
+++ b/dlls/wldap32/search.c
@@ -132,7 +132,7 @@ ULONG CDECL ldap_searchW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR fil
if (!attrsU) goto exit;
}
- ret = ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
+ ret = ldap_search_ext( ld->ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, NULL, 0, &msg );
if (ret == LDAP_SUCCESS)
@@ -281,7 +281,7 @@ ULONG CDECL ldap_search_extW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
tvp = &tv;
}
- ret = map_error( ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
+ ret = map_error( ldap_search_ext( ld->ld, baseU, scope, filterU, attrsU, attrsonly,
serverctrlsU, clientctrlsU, tvp, sizelimit, (int *)message ));
exit:
@@ -416,7 +416,7 @@ ULONG CDECL ldap_search_ext_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
if (!clientctrlsU) goto exit;
}
- ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
+ ret = map_error( ldap_search_ext_s( ld->ld, baseU, scope, filterU, attrsU, attrsonly,
serverctrlsU, clientctrlsU, (struct timeval *)timeout,
sizelimit, res ));
@@ -523,7 +523,7 @@ ULONG CDECL ldap_search_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR f
if (!attrsU) goto exit;
}
- ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
+ ret = map_error( ldap_search_ext_s( ld->ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, NULL, 0, res ));
exit:
@@ -633,7 +633,7 @@ ULONG CDECL ldap_search_stW( WLDAP32_LDAP *ld, const PWCHAR base, ULONG scope,
if (!attrsU) goto exit;
}
- ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
+ ret = map_error( ldap_search_ext_s( ld->ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, (struct timeval *)timeout, 0, res ));
exit:
diff --git a/dlls/wldap32/value.c b/dlls/wldap32/value.c
index 4e1701c926..ff13289b30 100644
--- a/dlls/wldap32/value.c
+++ b/dlls/wldap32/value.c
@@ -228,7 +228,7 @@ PWCHAR * CDECL ldap_get_valuesW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, P
attrU = strWtoU( attr );
if (!attrU) return NULL;
- bv = ldap_get_values_len( ld, entry, attrU );
+ bv = ldap_get_values_len( ld->ld, entry, attrU );
if (bv)
{
retU = bv2str_array( bv );
@@ -305,7 +305,7 @@ struct WLDAP32_berval ** CDECL ldap_get_values_lenW( WLDAP32_LDAP *ld,
attrU = strWtoU( attr );
if (!attrU) return NULL;
- ret = ldap_get_values_len( ld, message, attrU );
+ ret = ldap_get_values_len( ld->ld, message, attrU );
strfreeU( attrU );
return (struct WLDAP32_berval **)ret;
diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h
index df257dafec..0332deafa2 100644
--- a/dlls/wldap32/winldap_private.h
+++ b/dlls/wldap32/winldap_private.h
@@ -103,8 +103,11 @@ typedef struct berelement
#define WLDAP32_LDAP_AUTH_NEGOTIATE 0x486
-typedef struct ldap
+typedef struct wldap32
{
+#ifdef HAVE_LDAP
+ LDAP *ld;
+#endif
struct
{
UINT_PTR sb_sd;
--
2.25.1