wldap32: Fix handling of zero timeout value in ldap_search_extW.
Based on a patch by Adam Romanek.
This commit is contained in:
parent
378bb21f8e
commit
3fbf6bdf11
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue