wldap32: Accept a NULL value in ldap_set_option. (try 2)

Hans Leidekker hans at codeweavers.com
Tue Mar 29 06:59:22 CDT 2011


This version marks old Windows behavior as broken.

Fixes http://bugs.winehq.org/show_bug.cgi?id=26456
---
 dlls/wldap32/option.c      |    4 ++--
 dlls/wldap32/tests/parse.c |   19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/dlls/wldap32/option.c b/dlls/wldap32/option.c
index 801d77d..95290ce 100644
--- a/dlls/wldap32/option.c
+++ b/dlls/wldap32/option.c
@@ -319,7 +319,7 @@ ULONG CDECL ldap_set_optionA( WLDAP32_LDAP *ld, int option, void *value )
 
     TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
 
-    if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
+    if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
 
     switch (option)
     {
@@ -422,7 +422,7 @@ ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
 
     TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
 
-    if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
+    if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
 
     switch (option)
     {
diff --git a/dlls/wldap32/tests/parse.c b/dlls/wldap32/tests/parse.c
index 98e6b80..4cf8564 100644
--- a/dlls/wldap32/tests/parse.c
+++ b/dlls/wldap32/tests/parse.c
@@ -105,6 +105,24 @@ static void test_ldap_search_extW( LDAP *ld )
     ok( !ret, "ldap_search_extW failed 0x%08x\n", ret );
 }
 
+static void test_ldap_set_optionW( LDAP *ld )
+{
+    ULONG ret, oldvalue;
+
+    ret = ldap_get_optionW( ld, LDAP_OPT_REFERRALS, &oldvalue );
+    if (ret == LDAP_SERVER_DOWN || ret == LDAP_UNAVAILABLE)
+    {
+        skip("test server can't be reached\n");
+        return;
+    }
+
+    ret = ldap_set_optionW( ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF );
+    ok( !ret || broken(ret == LDAP_PARAM_ERROR) /* nt4, win2k */, "ldap_set_optionW failed 0x%08x\n", ret );
+
+    ret = ldap_set_optionW( ld, LDAP_OPT_REFERRALS, (void *)&oldvalue );
+    ok( !ret, "ldap_set_optionW failed 0x%08x\n", ret );
+}
+
 START_TEST (parse)
 {
     LDAP *ld;
@@ -114,5 +132,6 @@ START_TEST (parse)
 
     test_ldap_parse_sort_control( ld );
     test_ldap_search_extW( ld );
+    test_ldap_set_optionW( ld );
     ldap_unbind( ld );
 }
-- 
1.7.1






More information about the wine-patches mailing list