wldap32: Map LDAP_OPT_AUTO_RECONNECT to LDAP_OPT_RESTART and add tests.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55450
This commit is contained in:
parent
f339506f4f
commit
65e2c3844b
2 changed files with 65 additions and 4 deletions
|
@ -92,6 +92,7 @@ ULONG CDECL ldap_get_optionA( LDAP *ld, int option, void *value )
|
|||
return WLDAP32_LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
|
||||
case WLDAP32_LDAP_OPT_DEREF:
|
||||
case WLDAP32_LDAP_OPT_DESC:
|
||||
case WLDAP32_LDAP_OPT_ERROR_NUMBER:
|
||||
|
@ -115,7 +116,6 @@ ULONG CDECL ldap_get_optionA( LDAP *ld, int option, void *value )
|
|||
return WLDAP32_LDAP_LOCAL_ERROR;
|
||||
|
||||
case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE:
|
||||
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
|
||||
case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE:
|
||||
case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME:
|
||||
case WLDAP32_LDAP_OPT_ENCRYPT:
|
||||
|
@ -218,6 +218,13 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
|
|||
|
||||
return WLDAP32_LDAP_SUCCESS;
|
||||
}
|
||||
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
|
||||
{
|
||||
BOOL *on = value;
|
||||
ret = map_error( ldap_get_option( CTX(ld), LDAP_OPT_RESTART, value ) );
|
||||
if (!ret) *on = !!*on;
|
||||
return ret;
|
||||
}
|
||||
|
||||
case WLDAP32_LDAP_OPT_DEREF:
|
||||
case WLDAP32_LDAP_OPT_DESC:
|
||||
|
@ -242,7 +249,6 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
|
|||
return WLDAP32_LDAP_LOCAL_ERROR;
|
||||
|
||||
case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE:
|
||||
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
|
||||
case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE:
|
||||
case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME:
|
||||
case WLDAP32_LDAP_OPT_ENCRYPT:
|
||||
|
@ -300,6 +306,7 @@ ULONG CDECL ldap_set_optionA( LDAP *ld, int option, void *value )
|
|||
controlarrayfreeW( ctrlsW );
|
||||
return ret;
|
||||
}
|
||||
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
|
||||
case WLDAP32_LDAP_OPT_DEREF:
|
||||
case WLDAP32_LDAP_OPT_DESC:
|
||||
case WLDAP32_LDAP_OPT_ERROR_NUMBER:
|
||||
|
@ -327,7 +334,6 @@ ULONG CDECL ldap_set_optionA( LDAP *ld, int option, void *value )
|
|||
return WLDAP32_LDAP_UNWILLING_TO_PERFORM;
|
||||
|
||||
case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE:
|
||||
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
|
||||
case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE:
|
||||
case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME:
|
||||
case WLDAP32_LDAP_OPT_ENCRYPT:
|
||||
|
@ -473,6 +479,22 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value )
|
|||
|
||||
return map_error( ldap_set_option( CTX(ld), option, value ) );
|
||||
}
|
||||
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
|
||||
{
|
||||
if (value == WLDAP32_LDAP_OPT_ON)
|
||||
value = LDAP_OPT_ON;
|
||||
else if (value == WLDAP32_LDAP_OPT_OFF)
|
||||
value = LDAP_OPT_OFF;
|
||||
else if (*(ULONG *)value == 1)
|
||||
value = LDAP_OPT_ON;
|
||||
else if (*(ULONG *)value == 0)
|
||||
value = LDAP_OPT_OFF;
|
||||
else
|
||||
return WLDAP32_LDAP_PARAM_ERROR;
|
||||
|
||||
return map_error( ldap_set_option( CTX(ld), LDAP_OPT_RESTART, value ) );
|
||||
}
|
||||
|
||||
case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT:
|
||||
return map_error( ldap_set_option( CTX(ld), LDAP_OPT_REFHOPLIMIT, value ) );
|
||||
|
||||
|
@ -533,7 +555,6 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value )
|
|||
return WLDAP32_LDAP_UNWILLING_TO_PERFORM;
|
||||
|
||||
case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE:
|
||||
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
|
||||
case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE:
|
||||
case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME:
|
||||
case WLDAP32_LDAP_OPT_ENCRYPT:
|
||||
|
|
|
@ -593,6 +593,45 @@ static void test_opt_server_certificate(void)
|
|||
ldap_unbind( ld );
|
||||
}
|
||||
|
||||
static void test_opt_auto_reconnect(void)
|
||||
{
|
||||
LDAP *ld;
|
||||
ULONG ret, value;
|
||||
|
||||
ld = ldap_initA( (char *)"db.debian.org", 389 );
|
||||
ok( ld != NULL, "ldap_init failed\n" );
|
||||
|
||||
ret = ldap_set_optionA( ld, LDAP_OPT_AUTO_RECONNECT, LDAP_OPT_ON );
|
||||
ok( !ret, "ldap_set_optionA should succeed, got %#lx\n", ret );
|
||||
ret = ldap_get_optionA( ld, LDAP_OPT_AUTO_RECONNECT, &value );
|
||||
ok( !ret, "ldap_get_optionA should succeed, got %#lx\n", ret );
|
||||
ok( value == 1, "got %lu\n", ret );
|
||||
|
||||
ret = ldap_set_optionA( ld, LDAP_OPT_AUTO_RECONNECT, LDAP_OPT_OFF );
|
||||
ok( !ret, "ldap_set_optionA should succeed, got %#lx\n", ret );
|
||||
ret = ldap_get_optionA( ld, LDAP_OPT_AUTO_RECONNECT, &value );
|
||||
ok( !ret, "ldap_get_optionA should succeed, got %#lx\n", ret );
|
||||
ok( value == 0, "got %lu\n", ret );
|
||||
|
||||
value = 1;
|
||||
ret = ldap_set_optionA( ld, LDAP_OPT_AUTO_RECONNECT, &value );
|
||||
ok( !ret, "ldap_set_optionA should succeed, got %#lx\n", ret );
|
||||
ret = ldap_get_optionA( ld, LDAP_OPT_AUTO_RECONNECT, &value );
|
||||
ok( !ret, "ldap_get_optionA should succeed, got %#lx\n", ret );
|
||||
ok( value == 1, "got %lu\n", ret );
|
||||
|
||||
value = 0;
|
||||
ret = ldap_set_optionA( ld, LDAP_OPT_AUTO_RECONNECT, &value );
|
||||
ok( !ret, "ldap_set_optionA should succeed, got %#lx\n", ret );
|
||||
ret = ldap_get_optionA( ld, LDAP_OPT_AUTO_RECONNECT, &value );
|
||||
ok( !ret, "ldap_get_optionA should succeed, got %#lx\n", ret );
|
||||
ok( value == 0, "got %lu\n", ret );
|
||||
|
||||
value = 2;
|
||||
ret = ldap_set_optionA( ld, LDAP_OPT_AUTO_RECONNECT, &value );
|
||||
ok( ret == LDAP_PARAM_ERROR, "ldap_set_optionA should fail, got %#lx\n", ret );
|
||||
}
|
||||
|
||||
START_TEST (parse)
|
||||
{
|
||||
LDAP *ld;
|
||||
|
@ -602,6 +641,7 @@ START_TEST (parse)
|
|||
test_ldap_bind_sA();
|
||||
test_opt_ssl();
|
||||
test_opt_server_certificate();
|
||||
test_opt_auto_reconnect();
|
||||
|
||||
ld = ldap_initA( (char *)"db.debian.org", 389 );
|
||||
ok( ld != NULL, "ldap_init failed\n" );
|
||||
|
|
Loading…
Add table
Reference in a new issue