Hans Leidekker : wldap32: Fix handling of zero timeout value in ldap_search_extW.
Alexandre Julliard
julliard at winehq.org
Wed Aug 18 12:09:58 CDT 2010
Module: wine
Branch: master
Commit: 3fbf6bdf113a5fe1768aca146f8062cc96c208d5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3fbf6bdf113a5fe1768aca146f8062cc96c208d5
Author: Hans Leidekker <hans at codeweavers.com>
Date: Wed Aug 18 12:33:35 2010 +0200
wldap32: Fix handling of zero timeout value in ldap_search_extW.
Based on a patch by Adam Romanek.
---
dlls/wldap32/search.c | 12 ++++++++----
dlls/wldap32/tests/parse.c | 20 ++++++++++++++++++++
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/dlls/wldap32/search.c b/dlls/wldap32/search.c
index 16158a4..6b0f4de 100644
--- a/dlls/wldap32/search.c
+++ b/dlls/wldap32/search.c
@@ -243,7 +243,7 @@ ULONG CDECL ldap_search_extW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
#ifdef HAVE_LDAP
char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
- struct timeval tv;
+ struct timeval tv, *tvp = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
@@ -274,11 +274,15 @@ ULONG CDECL ldap_search_extW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
if (!clientctrlsU) goto exit;
}
- tv.tv_sec = timelimit;
- tv.tv_usec = 0;
+ if (timelimit)
+ {
+ tv.tv_sec = timelimit;
+ tv.tv_usec = 0;
+ tvp = &tv;
+ }
ret = map_error( ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
- serverctrlsU, clientctrlsU, &tv, sizelimit, (int *)message ));
+ serverctrlsU, clientctrlsU, tvp, sizelimit, (int *)message ));
exit:
strfreeU( baseU );
diff --git a/dlls/wldap32/tests/parse.c b/dlls/wldap32/tests/parse.c
index 0f22d23..61bc9ca 100644
--- a/dlls/wldap32/tests/parse.c
+++ b/dlls/wldap32/tests/parse.c
@@ -86,6 +86,25 @@ static void test_ldap_parse_sort_control( LDAP *ld )
ldap_controls_free( server_ctrls );
}
+static void test_ldap_search_extW( LDAP *ld )
+{
+ ULONG ret, message, timelimit;
+ WCHAR base[] = {0}, filter[] = {'o','u','=','*',0};
+
+ timelimit = 20;
+ ret = ldap_search_extW( ld, base, LDAP_SCOPE_SUBTREE, filter, NULL, 0, NULL, NULL, timelimit, 0, &message );
+ if (ret == LDAP_SERVER_DOWN)
+ {
+ skip("test server can't be reached\n");
+ return;
+ }
+ ok( !ret, "ldap_search_extW failed 0x%08x\n", ret );
+
+ timelimit = 0;
+ ret = ldap_search_extW( ld, base, LDAP_SCOPE_SUBTREE, filter, NULL, 0, NULL, NULL, timelimit, 0, &message );
+ ok( !ret, "ldap_search_extW failed 0x%08x\n", ret );
+}
+
START_TEST (parse)
{
LDAP *ld;
@@ -94,5 +113,6 @@ START_TEST (parse)
ok( ld != NULL, "ldap_init failed\n" );
test_ldap_parse_sort_control( ld );
+ test_ldap_search_extW( ld );
ldap_unbind( ld );
}
More information about the wine-cvs
mailing list