mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-22 03:14:11 +00:00
wldap32: Add support for ldap_set_option(LDAP_OPT_HOST_NAME).
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
This commit is contained in:
parent
6dedfec9c3
commit
2e5a8595ed
|
@ -105,6 +105,24 @@ ULONG CDECL ldap_get_optionA( LDAP *ld, int option, void *value )
|
|||
case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT:
|
||||
return ldap_get_optionW( ld, LDAP_OPT_REFHOPLIMIT, value );
|
||||
|
||||
case WLDAP32_LDAP_OPT_HOST_NAME:
|
||||
{
|
||||
WCHAR *hostW;
|
||||
char *host;
|
||||
|
||||
ret = ldap_get_optionW( ld, option, &hostW );
|
||||
if (!ret)
|
||||
{
|
||||
host = strWtoA( hostW );
|
||||
if (!host)
|
||||
ret = WLDAP32_LDAP_NO_MEMORY;
|
||||
else
|
||||
*(char **)value = host;
|
||||
free( hostW );
|
||||
}
|
||||
return map_error( ret );
|
||||
}
|
||||
|
||||
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
|
||||
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
|
||||
case WLDAP32_LDAP_OPT_CACHE_STRATEGY:
|
||||
|
@ -122,7 +140,6 @@ ULONG CDECL ldap_get_optionA( LDAP *ld, int option, void *value )
|
|||
case WLDAP32_LDAP_OPT_ERROR_STRING:
|
||||
case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND:
|
||||
case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS:
|
||||
case WLDAP32_LDAP_OPT_HOST_NAME:
|
||||
case WLDAP32_LDAP_OPT_HOST_REACHABLE:
|
||||
case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE:
|
||||
case WLDAP32_LDAP_OPT_PING_LIMIT:
|
||||
|
@ -238,6 +255,24 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
|
|||
case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT:
|
||||
return map_error( ldap_get_option( CTX(ld), LDAP_OPT_REFHOPLIMIT, value ) );
|
||||
|
||||
case WLDAP32_LDAP_OPT_HOST_NAME:
|
||||
{
|
||||
WCHAR *hostW;
|
||||
char *host;
|
||||
|
||||
ret = ldap_get_option( CTX(ld), LDAP_OPT_HOST_NAME, &host );
|
||||
if (!ret)
|
||||
{
|
||||
hostW = strUtoW( host );
|
||||
if (!hostW)
|
||||
ret = WLDAP32_LDAP_NO_MEMORY;
|
||||
else
|
||||
*(WCHAR **)value = hostW;
|
||||
free( host );
|
||||
}
|
||||
return map_error( ret );
|
||||
}
|
||||
|
||||
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
|
||||
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
|
||||
case WLDAP32_LDAP_OPT_CACHE_STRATEGY:
|
||||
|
@ -255,7 +290,6 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
|
|||
case WLDAP32_LDAP_OPT_ERROR_STRING:
|
||||
case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND:
|
||||
case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS:
|
||||
case WLDAP32_LDAP_OPT_HOST_NAME:
|
||||
case WLDAP32_LDAP_OPT_HOST_REACHABLE:
|
||||
case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE:
|
||||
case WLDAP32_LDAP_OPT_PING_LIMIT:
|
||||
|
@ -322,6 +356,19 @@ ULONG CDECL ldap_set_optionA( LDAP *ld, int option, void *value )
|
|||
case WLDAP32_LDAP_OPT_TIMELIMIT:
|
||||
return ldap_set_optionW( ld, option, value );
|
||||
|
||||
case WLDAP32_LDAP_OPT_HOST_NAME:
|
||||
{
|
||||
char **host = value;
|
||||
WCHAR *hostW;
|
||||
|
||||
hostW = strAtoW( *host );
|
||||
if (!hostW) return WLDAP32_LDAP_NO_MEMORY;
|
||||
|
||||
ret = ldap_set_optionW( ld, option, &hostW );
|
||||
free( hostW );
|
||||
return map_error( ret );
|
||||
}
|
||||
|
||||
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
|
||||
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
|
||||
case WLDAP32_LDAP_OPT_CACHE_STRATEGY:
|
||||
|
@ -342,7 +389,6 @@ ULONG CDECL ldap_set_optionA( LDAP *ld, int option, void *value )
|
|||
case WLDAP32_LDAP_OPT_ERROR_STRING:
|
||||
case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND:
|
||||
case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS:
|
||||
case WLDAP32_LDAP_OPT_HOST_NAME:
|
||||
case WLDAP32_LDAP_OPT_HOST_REACHABLE:
|
||||
case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE:
|
||||
case WLDAP32_LDAP_OPT_PING_LIMIT:
|
||||
|
@ -540,6 +586,19 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value )
|
|||
return ret;
|
||||
}
|
||||
|
||||
case WLDAP32_LDAP_OPT_HOST_NAME:
|
||||
{
|
||||
WCHAR **hostW = value;
|
||||
char *host;
|
||||
|
||||
host = strWtoU( *hostW );
|
||||
if (!host) return WLDAP32_LDAP_NO_MEMORY;
|
||||
|
||||
ret = ldap_set_option( CTX(ld), LDAP_OPT_HOST_NAME, host );
|
||||
free( host );
|
||||
return map_error( ret );
|
||||
}
|
||||
|
||||
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
|
||||
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
|
||||
case WLDAP32_LDAP_OPT_CACHE_STRATEGY:
|
||||
|
@ -566,7 +625,6 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value )
|
|||
case WLDAP32_LDAP_OPT_ERROR_STRING:
|
||||
case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND:
|
||||
case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS:
|
||||
case WLDAP32_LDAP_OPT_HOST_NAME:
|
||||
case WLDAP32_LDAP_OPT_HOST_REACHABLE:
|
||||
case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE:
|
||||
case WLDAP32_LDAP_OPT_PING_LIMIT:
|
||||
|
|
|
@ -632,10 +632,38 @@ static void test_opt_auto_reconnect(void)
|
|||
ok( ret == LDAP_PARAM_ERROR, "ldap_set_optionA should fail, got %#lx\n", ret );
|
||||
}
|
||||
|
||||
static void test_ldap_host_name(void)
|
||||
{
|
||||
LDAP *ld;
|
||||
char *value;
|
||||
ULONG ret;
|
||||
|
||||
ld = ldap_initA( NULL, 389 );
|
||||
ok(ld != NULL, "ldap_init failed\n");
|
||||
|
||||
value = (char *)"deadbeef";
|
||||
ret = ldap_get_optionA( ld, LDAP_OPT_HOST_NAME, &value );
|
||||
ok( !ret, "ldap_get_option error %#lx\n", ret );
|
||||
todo_wine
|
||||
ok( !value, "got %s\n", value );
|
||||
|
||||
value = (char *)"deadbeef";
|
||||
ret = ldap_set_optionA( ld, LDAP_OPT_HOST_NAME, &value );
|
||||
ok( !ret, "ldap_set_option error %#lx\n", ret );
|
||||
|
||||
value = (char *)"";
|
||||
ret = ldap_get_optionA( ld, LDAP_OPT_HOST_NAME, &value );
|
||||
ok( !ret, "ldap_get_option error %#lx\n", ret );
|
||||
ok( !strcmp(value, "deadbeef") || !strcmp(value, "deadbeef:389"), "got %s\n", value );
|
||||
|
||||
ldap_unbind( ld );
|
||||
}
|
||||
|
||||
START_TEST (parse)
|
||||
{
|
||||
LDAP *ld;
|
||||
|
||||
test_ldap_host_name();
|
||||
test_ldap_paged_search();
|
||||
test_ldap_server_control();
|
||||
test_ldap_bind_sA();
|
||||
|
|
Loading…
Reference in a new issue