Commit 42d0fa8b authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

wldap32: Allow LDAP_OPT_REFERRALS to be set from a pointer.

parent e2ead2fb
...@@ -431,12 +431,31 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value ) ...@@ -431,12 +431,31 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value )
} }
case WLDAP32_LDAP_OPT_REFERRALS: case WLDAP32_LDAP_OPT_REFERRALS:
{ {
if (value == WLDAP32_LDAP_OPT_OFF) value = LDAP_OPT_OFF; if (value == WLDAP32_LDAP_OPT_ON)
else if (value != WLDAP32_LDAP_OPT_ON) value = LDAP_OPT_ON;
else if (value == WLDAP32_LDAP_OPT_OFF)
value = LDAP_OPT_OFF;
else if (value == (void *)LDAP_CHASE_SUBORDINATE_REFERRALS ||
value == (void *)LDAP_CHASE_EXTERNAL_REFERRALS ||
value == (void *)(LDAP_CHASE_SUBORDINATE_REFERRALS|LDAP_CHASE_EXTERNAL_REFERRALS))
{ {
FIXME( "upgrading referral value %p to LDAP_OPT_ON (OpenLDAP lacks sufficient granularity)\n", value ); FIXME( "upgrading referral value %p to LDAP_OPT_ON (OpenLDAP lacks sufficient granularity)\n", value );
value = LDAP_OPT_ON; value = LDAP_OPT_ON;
} }
else if (*(ULONG *)value == 1)
value = LDAP_OPT_ON;
else if (*(ULONG *)value == 0)
value = LDAP_OPT_OFF;
else if (*(ULONG *)value == LDAP_CHASE_SUBORDINATE_REFERRALS ||
*(ULONG *)value == LDAP_CHASE_EXTERNAL_REFERRALS ||
*(ULONG *)value == (LDAP_CHASE_SUBORDINATE_REFERRALS|LDAP_CHASE_EXTERNAL_REFERRALS))
{
FIXME( "upgrading referral value 0x%lx to LDAP_OPT_ON (OpenLDAP lacks sufficient granularity)\n", *(ULONG *)value );
value = LDAP_OPT_ON;
}
else
return WLDAP32_LDAP_PARAM_ERROR;
return map_error( ldap_set_option( CTX(ld), option, value ) ); return map_error( ldap_set_option( CTX(ld), option, value ) );
} }
case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT: case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT:
......
...@@ -116,20 +116,29 @@ static void test_ldap_search_extW( LDAP *ld ) ...@@ -116,20 +116,29 @@ static void test_ldap_search_extW( LDAP *ld )
static void test_opt_referrals( LDAP *ld ) static void test_opt_referrals( LDAP *ld )
{ {
ULONG ret, oldvalue; ULONG ret, value;
ret = ldap_get_optionW( ld, LDAP_OPT_REFERRALS, &oldvalue ); value = 0xdeadbeef;
if (ret == LDAP_SERVER_DOWN || ret == LDAP_UNAVAILABLE) ret = ldap_get_optionW( ld, LDAP_OPT_REFERRALS, &value );
{ ok( !ret, "ldap_get_optionW failed %#lx\n", ret );
skip("test server can't be reached\n"); todo_wine ok( value == 1, "got %lu\n", value );
return;
}
ret = ldap_set_optionW( ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF ); value = 0;
ret = ldap_set_optionW( ld, LDAP_OPT_REFERRALS, (void *)&value );
ok( !ret, "ldap_set_optionW failed %#lx\n", ret ); ok( !ret, "ldap_set_optionW failed %#lx\n", ret );
ret = ldap_set_optionW( ld, LDAP_OPT_REFERRALS, (void *)&oldvalue ); value = 0xdeadbeef;
ret = ldap_get_optionW( ld, LDAP_OPT_REFERRALS, &value );
ok( !ret, "ldap_get_optionW failed %#lx\n", ret );
ok( !value, "got %lu\n", value );
ret = ldap_set_optionW( ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON );
ok( !ret, "ldap_set_optionW failed %#lx\n", ret ); ok( !ret, "ldap_set_optionW failed %#lx\n", ret );
value = 0xdeadbeef;
ret = ldap_get_optionW( ld, LDAP_OPT_REFERRALS, &value );
ok( !ret, "ldap_get_optionW failed %#lx\n", ret );
todo_wine ok( value == 1, "got %lu\n", value );
} }
static void test_opt_protocol_version( LDAP *ld ) static void test_opt_protocol_version( LDAP *ld )
......
...@@ -168,6 +168,9 @@ typedef enum { ...@@ -168,6 +168,9 @@ typedef enum {
#define WLDAP32_LDAP_VERSION3 3 #define WLDAP32_LDAP_VERSION3 3
#define WLDAP32_LDAP_VERSION WLDAP32_LDAP_VERSION2 #define WLDAP32_LDAP_VERSION WLDAP32_LDAP_VERSION2
#define LDAP_CHASE_SUBORDINATE_REFERRALS 0x20
#define LDAP_CHASE_EXTERNAL_REFERRALS 0x40
#define WLDAP32_LDAP_AUTH_SIMPLE 0x80 #define WLDAP32_LDAP_AUTH_SIMPLE 0x80
#define WLDAP32_LDAP_AUTH_SASL 0x83 #define WLDAP32_LDAP_AUTH_SASL 0x83
#define WLDAP32_LDAP_AUTH_OTHERKIND 0x86 #define WLDAP32_LDAP_AUTH_OTHERKIND 0x86
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment