libfreerdp-core: start untangling session redirection
This commit is contained in:
parent
edb218df90
commit
13b6678977
@ -568,22 +568,19 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
|
|||||||
#define FreeRDP_PreconnectionBlob 1155
|
#define FreeRDP_PreconnectionBlob 1155
|
||||||
#define FreeRDP_SendPreconnectionPdu 1156
|
#define FreeRDP_SendPreconnectionPdu 1156
|
||||||
#define FreeRDP_RedirectionFlags 1216
|
#define FreeRDP_RedirectionFlags 1216
|
||||||
#define FreeRDP_LoadBalanceInfo 1217
|
#define FreeRDP_TargetNetAddress 1217
|
||||||
#define FreeRDP_LoadBalanceInfoLength 1218
|
#define FreeRDP_LoadBalanceInfo 1218
|
||||||
#define FreeRDP_RedirectionUsername 1219
|
#define FreeRDP_LoadBalanceInfoLength 1219
|
||||||
#define FreeRDP_RedirectionUsernameLength 1220
|
#define FreeRDP_RedirectionUsername 1220
|
||||||
#define FreeRDP_RedirectionDomain 1221
|
#define FreeRDP_RedirectionDomain 1221
|
||||||
#define FreeRDP_RedirectionDomainLength 1222
|
#define FreeRDP_RedirectionPassword 1222
|
||||||
#define FreeRDP_RedirectionPassword 1223
|
#define FreeRDP_RedirectionPasswordLength 1223
|
||||||
#define FreeRDP_RedirectionPasswordLength 1224
|
#define FreeRDP_RedirectionTargetFQDN 1224
|
||||||
#define FreeRDP_RedirectionTargetFQDN 1225
|
#define FreeRDP_RedirectionTargetNetBiosName 1225
|
||||||
#define FreeRDP_RedirectionTargetFQDNLength 1226
|
#define FreeRDP_RedirectionTsvUrl 1226
|
||||||
#define FreeRDP_RedirectionTargetNetBiosName 1227
|
#define FreeRDP_RedirectionTsvUrlLength 1227
|
||||||
#define FreeRDP_RedirectionTargetNetBiosNameLength 1228
|
#define FreeRDP_TargetNetAddressCount 1228
|
||||||
#define FreeRDP_RedirectionTsvUrl 1229
|
#define FreeRDP_TargetNetAddresses 1229
|
||||||
#define FreeRDP_RedirectionTsvUrlLength 1230
|
|
||||||
#define FreeRDP_TargetNetAddressCount 1231
|
|
||||||
#define FreeRDP_TargetNetAddresses 1232
|
|
||||||
#define FreeRDP_Password51 1280
|
#define FreeRDP_Password51 1280
|
||||||
#define FreeRDP_Password51Length 1281
|
#define FreeRDP_Password51Length 1281
|
||||||
#define FreeRDP_KerberosKdc 1344
|
#define FreeRDP_KerberosKdc 1344
|
||||||
@ -922,23 +919,20 @@ struct rdp_settings
|
|||||||
|
|
||||||
/* Server Redirection */
|
/* Server Redirection */
|
||||||
ALIGN64 UINT32 RedirectionFlags; /* 1216 */
|
ALIGN64 UINT32 RedirectionFlags; /* 1216 */
|
||||||
ALIGN64 BYTE* LoadBalanceInfo; /* 1217 */
|
ALIGN64 char* TargetNetAddress; /* 1217 */
|
||||||
ALIGN64 UINT32 LoadBalanceInfoLength; /* 1218 */
|
ALIGN64 BYTE* LoadBalanceInfo; /* 1218 */
|
||||||
ALIGN64 BYTE* RedirectionUsername; /* 1219 */
|
ALIGN64 UINT32 LoadBalanceInfoLength; /* 1219 */
|
||||||
ALIGN64 UINT32 RedirectionUsernameLength; /* 1220 */
|
ALIGN64 char* RedirectionUsername; /* 1220 */
|
||||||
ALIGN64 BYTE* RedirectionDomain; /* 1221 */
|
ALIGN64 char* RedirectionDomain; /* 1221 */
|
||||||
ALIGN64 UINT32 RedirectionDomainLength; /* 1222 */
|
ALIGN64 BYTE* RedirectionPassword; /* 1222 */
|
||||||
ALIGN64 BYTE* RedirectionPassword; /* 1223 */
|
ALIGN64 UINT32 RedirectionPasswordLength; /* 1223 */
|
||||||
ALIGN64 UINT32 RedirectionPasswordLength; /* 1224 */
|
ALIGN64 char* RedirectionTargetFQDN; /* 1224 */
|
||||||
ALIGN64 BYTE* RedirectionTargetFQDN; /* 1225 */
|
ALIGN64 char* RedirectionTargetNetBiosName; /* 1225 */
|
||||||
ALIGN64 UINT32 RedirectionTargetFQDNLength; /* 1226 */
|
ALIGN64 BYTE* RedirectionTsvUrl; /* 1226 */
|
||||||
ALIGN64 BYTE* RedirectionTargetNetBiosName; /* 1227 */
|
ALIGN64 UINT32 RedirectionTsvUrlLength; /* 1227 */
|
||||||
ALIGN64 UINT32 RedirectionTargetNetBiosNameLength; /* 1228 */
|
ALIGN64 UINT32 TargetNetAddressCount; /* 1228 */
|
||||||
ALIGN64 BYTE* RedirectionTsvUrl; /* 1229 */
|
ALIGN64 char** TargetNetAddresses; /* 1229 */
|
||||||
ALIGN64 UINT32 RedirectionTsvUrlLength; /* 1230 */
|
UINT64 padding1280[1280 - 1230]; /* 1230 */
|
||||||
ALIGN64 UINT32 TargetNetAddressCount; /* 1231 */
|
|
||||||
ALIGN64 TARGET_NET_ADDRESS* TargetNetAddresses; /* 1232 */
|
|
||||||
UINT64 padding1280[1280 - 1233]; /* 1233 */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Security
|
* Security
|
||||||
@ -1331,6 +1325,8 @@ FREERDP_API ADDIN_ARGV* freerdp_dynamic_channel_collection_find(rdpSettings* set
|
|||||||
FREERDP_API ADDIN_ARGV* freerdp_dynamic_channel_clone(ADDIN_ARGV* channel);
|
FREERDP_API ADDIN_ARGV* freerdp_dynamic_channel_clone(ADDIN_ARGV* channel);
|
||||||
FREERDP_API void freerdp_dynamic_channel_collection_free(rdpSettings* settings);
|
FREERDP_API void freerdp_dynamic_channel_collection_free(rdpSettings* settings);
|
||||||
|
|
||||||
|
FREERDP_API void freerdp_target_net_addresses_free(rdpSettings* settings);
|
||||||
|
|
||||||
FREERDP_API void freerdp_performance_flags_make(rdpSettings* settings);
|
FREERDP_API void freerdp_performance_flags_make(rdpSettings* settings);
|
||||||
FREERDP_API void freerdp_performance_flags_split(rdpSettings* settings);
|
FREERDP_API void freerdp_performance_flags_split(rdpSettings* settings);
|
||||||
|
|
||||||
|
@ -402,6 +402,19 @@ void freerdp_dynamic_channel_collection_free(rdpSettings* settings)
|
|||||||
settings->DynamicChannelCount = 0;
|
settings->DynamicChannelCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void freerdp_target_net_addresses_free(rdpSettings* settings)
|
||||||
|
{
|
||||||
|
UINT32 index;
|
||||||
|
|
||||||
|
for (index = 0; index < settings->TargetNetAddressCount; index++)
|
||||||
|
free(settings->TargetNetAddresses[index]);
|
||||||
|
|
||||||
|
free(settings->TargetNetAddresses);
|
||||||
|
|
||||||
|
settings->TargetNetAddressCount = 0;
|
||||||
|
settings->TargetNetAddresses = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void freerdp_performance_flags_make(rdpSettings* settings)
|
void freerdp_performance_flags_make(rdpSettings* settings)
|
||||||
{
|
{
|
||||||
settings->PerformanceFlags = PERF_FLAG_NONE;
|
settings->PerformanceFlags = PERF_FLAG_NONE;
|
||||||
@ -1533,26 +1546,10 @@ UINT32 freerdp_get_param_uint32(rdpSettings* settings, int id)
|
|||||||
return settings->LoadBalanceInfoLength;
|
return settings->LoadBalanceInfoLength;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FreeRDP_RedirectionUsernameLength:
|
|
||||||
return settings->RedirectionUsernameLength;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FreeRDP_RedirectionDomainLength:
|
|
||||||
return settings->RedirectionDomainLength;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FreeRDP_RedirectionPasswordLength:
|
case FreeRDP_RedirectionPasswordLength:
|
||||||
return settings->RedirectionPasswordLength;
|
return settings->RedirectionPasswordLength;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FreeRDP_RedirectionTargetFQDNLength:
|
|
||||||
return settings->RedirectionTargetFQDNLength;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FreeRDP_RedirectionTargetNetBiosNameLength:
|
|
||||||
return settings->RedirectionTargetNetBiosNameLength;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FreeRDP_RedirectionTsvUrlLength:
|
case FreeRDP_RedirectionTsvUrlLength:
|
||||||
return settings->RedirectionTsvUrlLength;
|
return settings->RedirectionTsvUrlLength;
|
||||||
break;
|
break;
|
||||||
@ -1853,26 +1850,10 @@ int freerdp_set_param_uint32(rdpSettings* settings, int id, UINT32 param)
|
|||||||
settings->LoadBalanceInfoLength = param;
|
settings->LoadBalanceInfoLength = param;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FreeRDP_RedirectionUsernameLength:
|
|
||||||
settings->RedirectionUsernameLength = param;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FreeRDP_RedirectionDomainLength:
|
|
||||||
settings->RedirectionDomainLength = param;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FreeRDP_RedirectionPasswordLength:
|
case FreeRDP_RedirectionPasswordLength:
|
||||||
settings->RedirectionPasswordLength = param;
|
settings->RedirectionPasswordLength = param;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FreeRDP_RedirectionTargetFQDNLength:
|
|
||||||
settings->RedirectionTargetFQDNLength = param;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FreeRDP_RedirectionTargetNetBiosNameLength:
|
|
||||||
settings->RedirectionTargetNetBiosNameLength = param;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FreeRDP_RedirectionTsvUrlLength:
|
case FreeRDP_RedirectionTsvUrlLength:
|
||||||
settings->RedirectionTsvUrlLength = param;
|
settings->RedirectionTsvUrlLength = param;
|
||||||
break;
|
break;
|
||||||
|
@ -292,82 +292,43 @@ BOOL rdp_client_redirect(rdpRdp* rdp)
|
|||||||
|
|
||||||
rdp_client_disconnect(rdp);
|
rdp_client_disconnect(rdp);
|
||||||
|
|
||||||
/* FIXME: this is a subset of rdp_free */
|
rdp_reset(rdp);
|
||||||
/* --> this should really go into rdp.c */
|
|
||||||
crypto_rc4_free(rdp->rc4_decrypt_key);
|
|
||||||
rdp->rc4_decrypt_key = NULL;
|
|
||||||
crypto_rc4_free(rdp->rc4_encrypt_key);
|
|
||||||
rdp->rc4_encrypt_key = NULL;
|
|
||||||
crypto_des3_free(rdp->fips_encrypt);
|
|
||||||
rdp->fips_encrypt = NULL;
|
|
||||||
crypto_des3_free(rdp->fips_decrypt);
|
|
||||||
rdp->fips_decrypt = NULL;
|
|
||||||
crypto_hmac_free(rdp->fips_hmac);
|
|
||||||
rdp->fips_hmac = NULL;
|
|
||||||
|
|
||||||
free(settings->ServerRandom);
|
rdp_redirection_apply_settings(rdp);
|
||||||
settings->ServerRandom = NULL;
|
|
||||||
free(settings->ServerCertificate);
|
|
||||||
settings->ServerCertificate = NULL;
|
|
||||||
free(settings->ClientAddress);
|
|
||||||
settings->ClientAddress = NULL;
|
|
||||||
|
|
||||||
mppc_enc_free(rdp->mppc_enc);
|
if (settings->RedirectionFlags & LB_LOAD_BALANCE_INFO)
|
||||||
mppc_dec_free(rdp->mppc_dec);
|
|
||||||
mcs_free(rdp->mcs);
|
|
||||||
nego_free(rdp->nego);
|
|
||||||
license_free(rdp->license);
|
|
||||||
transport_free(rdp->transport);
|
|
||||||
|
|
||||||
rdp->transport = transport_new(settings);
|
|
||||||
rdp->license = license_new(rdp);
|
|
||||||
rdp->nego = nego_new(rdp->transport);
|
|
||||||
rdp->mcs = mcs_new(rdp->transport);
|
|
||||||
rdp->mppc_dec = mppc_dec_new();
|
|
||||||
rdp->mppc_enc = mppc_enc_new(PROTO_RDP_50);
|
|
||||||
|
|
||||||
rdp->transport->layer = TRANSPORT_LAYER_TCP;
|
|
||||||
settings->RedirectedSessionId = redirection->sessionID;
|
|
||||||
|
|
||||||
if (redirection->flags & LB_LOAD_BALANCE_INFO)
|
|
||||||
{
|
{
|
||||||
nego_set_routing_token(rdp->nego, redirection->LoadBalanceInfo, redirection->LoadBalanceInfoLength);
|
nego_set_routing_token(rdp->nego, settings->LoadBalanceInfo, settings->LoadBalanceInfoLength);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (redirection->flags & LB_TARGET_NET_ADDRESS)
|
if (settings->RedirectionFlags & LB_TARGET_NET_ADDRESS)
|
||||||
{
|
{
|
||||||
free(settings->ServerHostname);
|
free(settings->ServerHostname);
|
||||||
settings->ServerHostname = _strdup(redirection->TargetNetAddress);
|
settings->ServerHostname = _strdup(settings->TargetNetAddress);
|
||||||
}
|
}
|
||||||
else if (redirection->flags & LB_TARGET_FQDN)
|
else if (settings->RedirectionFlags & LB_TARGET_FQDN)
|
||||||
{
|
{
|
||||||
free(settings->ServerHostname);
|
free(settings->ServerHostname);
|
||||||
settings->ServerHostname = _strdup(redirection->TargetFQDN);
|
settings->ServerHostname = _strdup(settings->RedirectionTargetFQDN);
|
||||||
}
|
}
|
||||||
else if (redirection->flags & LB_TARGET_NETBIOS_NAME)
|
else if (settings->RedirectionFlags & LB_TARGET_NETBIOS_NAME)
|
||||||
{
|
{
|
||||||
free(settings->ServerHostname);
|
free(settings->ServerHostname);
|
||||||
settings->ServerHostname = _strdup(redirection->TargetNetBiosName);
|
settings->ServerHostname = _strdup(settings->RedirectionTargetNetBiosName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redirection->flags & LB_USERNAME)
|
if (settings->RedirectionFlags & LB_USERNAME)
|
||||||
{
|
{
|
||||||
free(settings->Username);
|
free(settings->Username);
|
||||||
settings->Username = _strdup(redirection->Username);
|
settings->Username = _strdup(settings->RedirectionUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redirection->flags & LB_DOMAIN)
|
if (settings->RedirectionFlags & LB_DOMAIN)
|
||||||
{
|
{
|
||||||
free(settings->Domain);
|
free(settings->Domain);
|
||||||
settings->Domain = _strdup(redirection->Domain);
|
settings->Domain = _strdup(settings->RedirectionDomain);
|
||||||
}
|
|
||||||
|
|
||||||
if (redirection->flags & LB_PASSWORD)
|
|
||||||
{
|
|
||||||
settings->RedirectionPassword = redirection->PasswordCookie;
|
|
||||||
settings->RedirectionPasswordLength = redirection->PasswordCookieLength;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = rdp_client_connect(rdp);
|
status = rdp_client_connect(rdp);
|
||||||
@ -678,7 +639,7 @@ BOOL rdp_client_connect_demand_active(rdpRdp* rdp, wStream* s)
|
|||||||
* so that could result in a bad offset.
|
* so that could result in a bad offset.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (rdp_recv_out_of_sequence_pdu(rdp, s) != TRUE)
|
if (!rdp_recv_out_of_sequence_pdu(rdp, s))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -968,9 +968,10 @@ rdpNego* nego_new(rdpTransport* transport)
|
|||||||
{
|
{
|
||||||
rdpNego* nego = (rdpNego*) malloc(sizeof(rdpNego));
|
rdpNego* nego = (rdpNego*) malloc(sizeof(rdpNego));
|
||||||
|
|
||||||
if (nego != NULL)
|
if (nego)
|
||||||
{
|
{
|
||||||
ZeroMemory(nego, sizeof(rdpNego));
|
ZeroMemory(nego, sizeof(rdpNego));
|
||||||
|
|
||||||
nego->transport = transport;
|
nego->transport = transport;
|
||||||
nego_init(nego);
|
nego_init(nego);
|
||||||
}
|
}
|
||||||
@ -985,6 +986,7 @@ rdpNego* nego_new(rdpTransport* transport)
|
|||||||
|
|
||||||
void nego_free(rdpNego* nego)
|
void nego_free(rdpNego* nego)
|
||||||
{
|
{
|
||||||
|
free(nego->RoutingToken);
|
||||||
free(nego->cookie);
|
free(nego->cookie);
|
||||||
free(nego);
|
free(nego);
|
||||||
}
|
}
|
||||||
@ -1071,8 +1073,10 @@ void nego_enable_ext(rdpNego* nego, BOOL enable_ext)
|
|||||||
|
|
||||||
void nego_set_routing_token(rdpNego* nego, BYTE* RoutingToken, DWORD RoutingTokenLength)
|
void nego_set_routing_token(rdpNego* nego, BYTE* RoutingToken, DWORD RoutingTokenLength)
|
||||||
{
|
{
|
||||||
nego->RoutingToken = RoutingToken;
|
free(nego->RoutingToken);
|
||||||
nego->RoutingTokenLength = RoutingTokenLength;
|
nego->RoutingTokenLength = RoutingTokenLength;
|
||||||
|
nego->RoutingToken = (BYTE*) malloc(nego->RoutingTokenLength);
|
||||||
|
CopyMemory(nego->RoutingToken, RoutingToken, nego->RoutingTokenLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -977,7 +977,7 @@ void rdp_set_blocking_mode(rdpRdp* rdp, BOOL blocking)
|
|||||||
int rdp_check_fds(rdpRdp* rdp)
|
int rdp_check_fds(rdpRdp* rdp)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
status = transport_check_fds(&(rdp->transport));
|
status = transport_check_fds(rdp->transport);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1030,6 +1030,46 @@ rdpRdp* rdp_new(rdpContext* context)
|
|||||||
return rdp;
|
return rdp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rdp_reset(rdpRdp* rdp)
|
||||||
|
{
|
||||||
|
rdpSettings* settings;
|
||||||
|
|
||||||
|
settings = rdp->settings;
|
||||||
|
|
||||||
|
crypto_rc4_free(rdp->rc4_decrypt_key);
|
||||||
|
rdp->rc4_decrypt_key = NULL;
|
||||||
|
crypto_rc4_free(rdp->rc4_encrypt_key);
|
||||||
|
rdp->rc4_encrypt_key = NULL;
|
||||||
|
crypto_des3_free(rdp->fips_encrypt);
|
||||||
|
rdp->fips_encrypt = NULL;
|
||||||
|
crypto_des3_free(rdp->fips_decrypt);
|
||||||
|
rdp->fips_decrypt = NULL;
|
||||||
|
crypto_hmac_free(rdp->fips_hmac);
|
||||||
|
rdp->fips_hmac = NULL;
|
||||||
|
|
||||||
|
mppc_enc_free(rdp->mppc_enc);
|
||||||
|
mppc_dec_free(rdp->mppc_dec);
|
||||||
|
mcs_free(rdp->mcs);
|
||||||
|
nego_free(rdp->nego);
|
||||||
|
license_free(rdp->license);
|
||||||
|
transport_free(rdp->transport);
|
||||||
|
|
||||||
|
free(settings->ServerRandom);
|
||||||
|
settings->ServerRandom = NULL;
|
||||||
|
free(settings->ServerCertificate);
|
||||||
|
settings->ServerCertificate = NULL;
|
||||||
|
free(settings->ClientAddress);
|
||||||
|
settings->ClientAddress = NULL;
|
||||||
|
|
||||||
|
rdp->transport = transport_new(rdp->settings);
|
||||||
|
rdp->license = license_new(rdp);
|
||||||
|
rdp->nego = nego_new(rdp->transport);
|
||||||
|
rdp->mcs = mcs_new(rdp->transport);
|
||||||
|
rdp->mppc_dec = mppc_dec_new();
|
||||||
|
rdp->mppc_enc = mppc_enc_new(PROTO_RDP_50);
|
||||||
|
rdp->transport->layer = TRANSPORT_LAYER_TCP;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free RDP module.
|
* Free RDP module.
|
||||||
* @param rdp RDP module to be freed
|
* @param rdp RDP module to be freed
|
||||||
|
@ -197,6 +197,7 @@ void rdp_set_blocking_mode(rdpRdp* rdp, BOOL blocking);
|
|||||||
int rdp_check_fds(rdpRdp* rdp);
|
int rdp_check_fds(rdpRdp* rdp);
|
||||||
|
|
||||||
rdpRdp* rdp_new(rdpContext* context);
|
rdpRdp* rdp_new(rdpContext* context);
|
||||||
|
void rdp_reset(rdpRdp* rdp);
|
||||||
void rdp_free(rdpRdp* rdp);
|
void rdp_free(rdpRdp* rdp);
|
||||||
|
|
||||||
#ifdef WITH_DEBUG_RDP
|
#ifdef WITH_DEBUG_RDP
|
||||||
|
@ -85,6 +85,89 @@ BOOL rdp_redirection_read_string(wStream* s, char** str)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rdp_redirection_apply_settings(rdpRdp* rdp)
|
||||||
|
{
|
||||||
|
rdpSettings* settings = rdp->settings;
|
||||||
|
rdpRedirection* redirection = rdp->redirection;
|
||||||
|
|
||||||
|
settings->RedirectionFlags = redirection->flags;
|
||||||
|
settings->RedirectedSessionId = redirection->sessionID;
|
||||||
|
|
||||||
|
if (settings->RedirectionFlags & LB_LOAD_BALANCE_INFO)
|
||||||
|
{
|
||||||
|
/* LoadBalanceInfo may not contain a null terminator */
|
||||||
|
free(settings->LoadBalanceInfo);
|
||||||
|
settings->LoadBalanceInfoLength = redirection->LoadBalanceInfoLength;
|
||||||
|
settings->LoadBalanceInfo = (BYTE*) malloc(settings->LoadBalanceInfoLength);
|
||||||
|
CopyMemory(settings->LoadBalanceInfo, redirection->LoadBalanceInfo, settings->LoadBalanceInfoLength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (settings->RedirectionFlags & LB_TARGET_NET_ADDRESS)
|
||||||
|
{
|
||||||
|
free(settings->TargetNetAddress);
|
||||||
|
settings->TargetNetAddress = _strdup(redirection->TargetNetAddress);
|
||||||
|
}
|
||||||
|
else if (settings->RedirectionFlags & LB_TARGET_FQDN)
|
||||||
|
{
|
||||||
|
free(settings->RedirectionTargetFQDN);
|
||||||
|
settings->RedirectionTargetFQDN = _strdup(redirection->TargetFQDN);
|
||||||
|
}
|
||||||
|
else if (settings->RedirectionFlags & LB_TARGET_NETBIOS_NAME)
|
||||||
|
{
|
||||||
|
free(settings->RedirectionTargetNetBiosName);
|
||||||
|
settings->RedirectionTargetNetBiosName = _strdup(redirection->TargetNetBiosName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings->RedirectionFlags & LB_USERNAME)
|
||||||
|
{
|
||||||
|
free(settings->RedirectionUsername);
|
||||||
|
settings->RedirectionUsername = _strdup(redirection->Username);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings->RedirectionFlags & LB_DOMAIN)
|
||||||
|
{
|
||||||
|
free(settings->RedirectionDomain);
|
||||||
|
settings->RedirectionDomain = _strdup(redirection->Domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings->RedirectionFlags & LB_PASSWORD)
|
||||||
|
{
|
||||||
|
/* Password may be a cookie without a null terminator */
|
||||||
|
free(settings->RedirectionPassword);
|
||||||
|
settings->RedirectionPasswordLength = redirection->PasswordLength;
|
||||||
|
settings->RedirectionPassword = (BYTE*) malloc(settings->RedirectionPasswordLength);
|
||||||
|
CopyMemory(settings->RedirectionPassword, redirection->Password, settings->RedirectionPasswordLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings->RedirectionFlags & LB_CLIENT_TSV_URL)
|
||||||
|
{
|
||||||
|
/* TsvUrl may not contain a null terminator */
|
||||||
|
free(settings->RedirectionTsvUrl);
|
||||||
|
settings->RedirectionTsvUrlLength = redirection->TsvUrlLength;
|
||||||
|
settings->RedirectionTsvUrl = (BYTE*) malloc(settings->RedirectionTsvUrlLength);
|
||||||
|
CopyMemory(settings->RedirectionTsvUrl, redirection->TsvUrl, settings->RedirectionTsvUrlLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings->RedirectionFlags & LB_TARGET_NET_ADDRESSES)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
freerdp_target_net_addresses_free(settings);
|
||||||
|
|
||||||
|
settings->TargetNetAddressCount = redirection->TargetNetAddressesCount;
|
||||||
|
settings->TargetNetAddresses = (char**) malloc(sizeof(char*) * settings->TargetNetAddressCount);
|
||||||
|
|
||||||
|
for (i = 0; i < settings->TargetNetAddressCount; i++)
|
||||||
|
{
|
||||||
|
settings->TargetNetAddresses[i] = _strdup(redirection->TargetNetAddresses[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
||||||
{
|
{
|
||||||
UINT16 flags;
|
UINT16 flags;
|
||||||
@ -152,13 +235,13 @@ BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
|||||||
if (Stream_GetRemainingLength(s) < 4)
|
if (Stream_GetRemainingLength(s) < 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Stream_Read_UINT32(s, redirection->PasswordCookieLength);
|
Stream_Read_UINT32(s, redirection->PasswordLength);
|
||||||
redirection->PasswordCookie = (BYTE*) malloc(redirection->PasswordCookieLength);
|
redirection->Password = (BYTE*) malloc(redirection->PasswordLength);
|
||||||
Stream_Read(s, redirection->PasswordCookie, redirection->PasswordCookieLength);
|
Stream_Read(s, redirection->Password, redirection->PasswordLength);
|
||||||
|
|
||||||
#ifdef WITH_DEBUG_REDIR
|
#ifdef WITH_DEBUG_REDIR
|
||||||
DEBUG_REDIR("password_cookie:");
|
DEBUG_REDIR("PasswordCookie:");
|
||||||
winpr_HexDump(redirection->PasswordCookie, redirection->PasswordCookieLength);
|
winpr_HexDump(redirection->Password, redirection->PasswordLength);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,10 +263,21 @@ BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
|||||||
|
|
||||||
if (redirection->flags & LB_CLIENT_TSV_URL)
|
if (redirection->flags & LB_CLIENT_TSV_URL)
|
||||||
{
|
{
|
||||||
if (!rdp_redirection_read_string(s, &(redirection->TsvUrl)))
|
if (Stream_GetRemainingLength(s) < 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
WLog_Print(redirection->log, WLOG_DEBUG, "TsvUrl: %s", redirection->TsvUrl);
|
Stream_Read_UINT32(s, redirection->TsvUrlLength);
|
||||||
|
|
||||||
|
if (Stream_GetRemainingLength(s) < redirection->TsvUrlLength)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
redirection->TsvUrl = (BYTE*) malloc(redirection->TsvUrlLength);
|
||||||
|
Stream_Read(s, redirection->TsvUrl, redirection->TsvUrlLength);
|
||||||
|
|
||||||
|
#ifdef WITH_DEBUG_REDIR
|
||||||
|
DEBUG_REDIR("TsvUrl:");
|
||||||
|
winpr_HexDump(redirection->TsvUrl, redirection->TsvUrlLength);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redirection->flags & LB_TARGET_NET_ADDRESSES)
|
if (redirection->flags & LB_TARGET_NET_ADDRESSES)
|
||||||
@ -281,8 +375,8 @@ void redirection_free(rdpRedirection* redirection)
|
|||||||
if (redirection->LoadBalanceInfo)
|
if (redirection->LoadBalanceInfo)
|
||||||
free(redirection->LoadBalanceInfo);
|
free(redirection->LoadBalanceInfo);
|
||||||
|
|
||||||
if (redirection->PasswordCookie)
|
if (redirection->Password)
|
||||||
free(redirection->PasswordCookie);
|
free(redirection->Password);
|
||||||
|
|
||||||
if (redirection->TargetNetAddresses)
|
if (redirection->TargetNetAddresses)
|
||||||
{
|
{
|
||||||
|
@ -35,11 +35,12 @@ struct rdp_redirection
|
|||||||
wLog* log;
|
wLog* log;
|
||||||
UINT32 flags;
|
UINT32 flags;
|
||||||
UINT32 sessionID;
|
UINT32 sessionID;
|
||||||
char* TsvUrl;
|
BYTE* TsvUrl;
|
||||||
|
DWORD TsvUrlLength;
|
||||||
char* Username;
|
char* Username;
|
||||||
char* Domain;
|
char* Domain;
|
||||||
BYTE* PasswordCookie;
|
BYTE* Password;
|
||||||
DWORD PasswordCookieLength;
|
DWORD PasswordLength;
|
||||||
char* TargetFQDN;
|
char* TargetFQDN;
|
||||||
BYTE* LoadBalanceInfo;
|
BYTE* LoadBalanceInfo;
|
||||||
DWORD LoadBalanceInfoLength;
|
DWORD LoadBalanceInfoLength;
|
||||||
@ -52,6 +53,8 @@ struct rdp_redirection
|
|||||||
BOOL rdp_recv_redirection_packet(rdpRdp* rdp, wStream* s);
|
BOOL rdp_recv_redirection_packet(rdpRdp* rdp, wStream* s);
|
||||||
BOOL rdp_recv_enhanced_security_redirection_packet(rdpRdp* rdp, wStream* s);
|
BOOL rdp_recv_enhanced_security_redirection_packet(rdpRdp* rdp, wStream* s);
|
||||||
|
|
||||||
|
int rdp_redirection_apply_settings(rdpRdp* rdp);
|
||||||
|
|
||||||
rdpRedirection* redirection_new(void);
|
rdpRedirection* redirection_new(void);
|
||||||
void redirection_free(rdpRedirection* redirection);
|
void redirection_free(rdpRedirection* redirection);
|
||||||
|
|
||||||
|
@ -515,11 +515,7 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
|
|||||||
_settings->PreconnectionId = settings->PreconnectionId; /* 1154 */
|
_settings->PreconnectionId = settings->PreconnectionId; /* 1154 */
|
||||||
_settings->RedirectionFlags = settings->RedirectionFlags; /* 1216 */
|
_settings->RedirectionFlags = settings->RedirectionFlags; /* 1216 */
|
||||||
_settings->LoadBalanceInfoLength = settings->LoadBalanceInfoLength; /* 1218 */
|
_settings->LoadBalanceInfoLength = settings->LoadBalanceInfoLength; /* 1218 */
|
||||||
_settings->RedirectionUsernameLength = settings->RedirectionUsernameLength; /* 1220 */
|
|
||||||
_settings->RedirectionDomainLength = settings->RedirectionDomainLength; /* 1222 */
|
|
||||||
_settings->RedirectionPasswordLength = settings->RedirectionPasswordLength; /* 1224 */
|
_settings->RedirectionPasswordLength = settings->RedirectionPasswordLength; /* 1224 */
|
||||||
_settings->RedirectionTargetFQDNLength = settings->RedirectionTargetFQDNLength; /* 1226 */
|
|
||||||
_settings->RedirectionTargetNetBiosNameLength = settings->RedirectionTargetNetBiosNameLength; /* 1228 */
|
|
||||||
_settings->RedirectionTsvUrlLength = settings->RedirectionTsvUrlLength; /* 1230 */
|
_settings->RedirectionTsvUrlLength = settings->RedirectionTsvUrlLength; /* 1230 */
|
||||||
_settings->TargetNetAddressCount = settings->TargetNetAddressCount; /* 1231 */
|
_settings->TargetNetAddressCount = settings->TargetNetAddressCount; /* 1231 */
|
||||||
_settings->Password51Length = settings->Password51Length; /* 1281 */
|
_settings->Password51Length = settings->Password51Length; /* 1281 */
|
||||||
@ -725,6 +721,16 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
|
|||||||
_settings->ClientTimeZone = (TIME_ZONE_INFO*) malloc(sizeof(TIME_ZONE_INFO));
|
_settings->ClientTimeZone = (TIME_ZONE_INFO*) malloc(sizeof(TIME_ZONE_INFO));
|
||||||
CopyMemory(_settings->ClientTimeZone, _settings->ClientTimeZone, sizeof(TIME_ZONE_INFO));
|
CopyMemory(_settings->ClientTimeZone, _settings->ClientTimeZone, sizeof(TIME_ZONE_INFO));
|
||||||
|
|
||||||
|
_settings->TargetNetAddressCount = settings->TargetNetAddressCount;
|
||||||
|
|
||||||
|
if (settings->TargetNetAddressCount > 0)
|
||||||
|
{
|
||||||
|
_settings->TargetNetAddresses = (char**) malloc(sizeof(char*) * settings->TargetNetAddressCount);
|
||||||
|
|
||||||
|
for (index = 0; index < settings->TargetNetAddressCount; index++)
|
||||||
|
_settings->TargetNetAddresses[index] = _strdup(settings->TargetNetAddresses[index]);
|
||||||
|
}
|
||||||
|
|
||||||
_settings->DeviceCount = settings->DeviceCount;
|
_settings->DeviceCount = settings->DeviceCount;
|
||||||
_settings->DeviceArraySize = settings->DeviceArraySize;
|
_settings->DeviceArraySize = settings->DeviceArraySize;
|
||||||
_settings->DeviceArray = (RDPDR_DEVICE**) malloc(sizeof(RDPDR_DEVICE*) * _settings->DeviceArraySize);
|
_settings->DeviceArray = (RDPDR_DEVICE**) malloc(sizeof(RDPDR_DEVICE*) * _settings->DeviceArraySize);
|
||||||
@ -801,6 +807,14 @@ void freerdp_settings_free(rdpSettings* settings)
|
|||||||
free(settings->CurrentPath);
|
free(settings->CurrentPath);
|
||||||
free(settings->HomePath);
|
free(settings->HomePath);
|
||||||
free(settings->LoadBalanceInfo);
|
free(settings->LoadBalanceInfo);
|
||||||
|
free(settings->TargetNetAddress);
|
||||||
|
free(settings->RedirectionTargetFQDN);
|
||||||
|
free(settings->RedirectionTargetNetBiosName);
|
||||||
|
free(settings->RedirectionUsername);
|
||||||
|
free(settings->RedirectionDomain);
|
||||||
|
free(settings->RedirectionPassword);
|
||||||
|
free(settings->RedirectionTsvUrl);
|
||||||
|
freerdp_target_net_addresses_free(settings);
|
||||||
freerdp_device_collection_free(settings);
|
freerdp_device_collection_free(settings);
|
||||||
freerdp_static_channel_collection_free(settings);
|
freerdp_static_channel_collection_free(settings);
|
||||||
freerdp_dynamic_channel_collection_free(settings);
|
freerdp_dynamic_channel_collection_free(settings);
|
||||||
|
@ -796,14 +796,13 @@ void transport_get_read_handles(rdpTransport* transport, HANDLE* events, DWORD*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int transport_check_fds(rdpTransport** ptransport)
|
int transport_check_fds(rdpTransport* transport)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
int status;
|
int status;
|
||||||
UINT16 length;
|
UINT16 length;
|
||||||
int recv_status;
|
int recv_status;
|
||||||
wStream* received;
|
wStream* received;
|
||||||
rdpTransport* transport = *ptransport;
|
|
||||||
|
|
||||||
if (!transport)
|
if (!transport)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -94,7 +94,7 @@ BOOL transport_accept_nla(rdpTransport* transport);
|
|||||||
int transport_read(rdpTransport* transport, wStream* s);
|
int transport_read(rdpTransport* transport, wStream* s);
|
||||||
int transport_write(rdpTransport* transport, wStream* s);
|
int transport_write(rdpTransport* transport, wStream* s);
|
||||||
void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount);
|
void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount);
|
||||||
int transport_check_fds(rdpTransport** ptransport);
|
int transport_check_fds(rdpTransport* transport);
|
||||||
BOOL transport_set_blocking_mode(rdpTransport* transport, BOOL blocking);
|
BOOL transport_set_blocking_mode(rdpTransport* transport, BOOL blocking);
|
||||||
void transport_get_read_handles(rdpTransport* transport, HANDLE* events, DWORD* count);
|
void transport_get_read_handles(rdpTransport* transport, HANDLE* events, DWORD* count);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user