mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-12-02 22:36:16 +08:00
Try redirection FQDN first, but check if it is resolvable.
This commit is contained in:
parent
92c2d83a40
commit
f6b6eba0ab
@ -412,29 +412,48 @@ BOOL rdp_client_redirect(rdpRdp* rdp)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (settings->RedirectionFlags & LB_TARGET_NET_ADDRESS)
|
||||
{
|
||||
free(settings->ServerHostname);
|
||||
settings->ServerHostname = _strdup(settings->TargetNetAddress);
|
||||
BOOL useFQDN = FALSE;
|
||||
|
||||
if (!settings->ServerHostname)
|
||||
return FALSE;
|
||||
if (settings->RedirectionFlags & LB_TARGET_FQDN)
|
||||
{
|
||||
int status;
|
||||
struct addrinfo hints = { 0 };
|
||||
struct addrinfo* result = NULL;
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
status = getaddrinfo(settings->RedirectionTargetFQDN, NULL, &hints, &result);
|
||||
|
||||
if (status == 0)
|
||||
{
|
||||
freeaddrinfo(result);
|
||||
free(settings->ServerHostname);
|
||||
settings->ServerHostname = _strdup(settings->RedirectionTargetFQDN);
|
||||
|
||||
if (!settings->ServerHostname)
|
||||
return FALSE;
|
||||
|
||||
useFQDN = TRUE;
|
||||
}
|
||||
}
|
||||
else if (settings->RedirectionFlags & LB_TARGET_FQDN)
|
||||
{
|
||||
free(settings->ServerHostname);
|
||||
settings->ServerHostname = _strdup(settings->RedirectionTargetFQDN);
|
||||
|
||||
if (!settings->ServerHostname)
|
||||
return FALSE;
|
||||
}
|
||||
else if (settings->RedirectionFlags & LB_TARGET_NETBIOS_NAME)
|
||||
if (!useFQDN)
|
||||
{
|
||||
free(settings->ServerHostname);
|
||||
settings->ServerHostname = _strdup(settings->RedirectionTargetNetBiosName);
|
||||
if (settings->RedirectionFlags & LB_TARGET_NET_ADDRESS)
|
||||
{
|
||||
free(settings->ServerHostname);
|
||||
settings->ServerHostname = _strdup(settings->TargetNetAddress);
|
||||
|
||||
if (!settings->ServerHostname)
|
||||
return FALSE;
|
||||
if (!settings->ServerHostname)
|
||||
return FALSE;
|
||||
}
|
||||
else if (settings->RedirectionFlags & LB_TARGET_NETBIOS_NAME)
|
||||
{
|
||||
free(settings->ServerHostname);
|
||||
settings->ServerHostname = _strdup(settings->RedirectionTargetNetBiosName);
|
||||
|
||||
if (!settings->ServerHostname)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user