libfreerdp-core: fix MCS unit tests
This commit is contained in:
parent
c837c6b374
commit
e608809f9c
@ -154,6 +154,12 @@ void test_gcc_write_client_security_data(void)
|
||||
s = stream_new(12);
|
||||
settings = settings_new();
|
||||
|
||||
settings->encryption_methods =
|
||||
ENCRYPTION_40BIT_FLAG |
|
||||
ENCRYPTION_56BIT_FLAG |
|
||||
ENCRYPTION_128BIT_FLAG |
|
||||
ENCRYPTION_FIPS_FLAG;
|
||||
|
||||
gcc_write_client_security_data(s, settings);
|
||||
|
||||
ASSERT_STREAM(s, (uint8*) gcc_client_security_data_expected, sizeof(gcc_client_security_data_expected));
|
||||
|
@ -23,15 +23,22 @@
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#define PERF_FLAG_NONE 0x00000000
|
||||
#define PERF_DISABLE_WALLPAPER 0x00000001
|
||||
#define PERF_DISABLE_FULLWINDOWDRAG 0x00000002
|
||||
#define PERF_DISABLE_MENUANIMATIONS 0x00000004
|
||||
#define PERF_DISABLE_THEMING 0x00000008
|
||||
#define PERF_DISABLE_CURSOR_SHADOW 0x00000020
|
||||
#define PERF_DISABLE_CURSORSETTINGS 0x00000040
|
||||
#define PERF_ENABLE_FONT_SMOOTHING 0x00000080
|
||||
#define PERF_ENABLE_DESKTOP_COMPOSITION 0x00000100
|
||||
/* Performance Flags */
|
||||
#define PERF_FLAG_NONE 0x00000000
|
||||
#define PERF_DISABLE_WALLPAPER 0x00000001
|
||||
#define PERF_DISABLE_FULLWINDOWDRAG 0x00000002
|
||||
#define PERF_DISABLE_MENUANIMATIONS 0x00000004
|
||||
#define PERF_DISABLE_THEMING 0x00000008
|
||||
#define PERF_DISABLE_CURSOR_SHADOW 0x00000020
|
||||
#define PERF_DISABLE_CURSORSETTINGS 0x00000040
|
||||
#define PERF_ENABLE_FONT_SMOOTHING 0x00000080
|
||||
#define PERF_ENABLE_DESKTOP_COMPOSITION 0x00000100
|
||||
|
||||
/* Encryption Methods */
|
||||
#define ENCRYPTION_40BIT_FLAG 0x00000001
|
||||
#define ENCRYPTION_128BIT_FLAG 0x00000002
|
||||
#define ENCRYPTION_56BIT_FLAG 0x00000008
|
||||
#define ENCRYPTION_FIPS_FLAG 0x00000010
|
||||
|
||||
struct rdp_chan
|
||||
{
|
||||
@ -68,6 +75,7 @@ struct rdp_settings
|
||||
uint32 kbd_fn_keys;
|
||||
uint32 client_build;
|
||||
uint32 selected_protocol;
|
||||
uint32 encryption_methods;
|
||||
|
||||
int console_session;
|
||||
uint32 redirected_session_id;
|
||||
|
@ -119,6 +119,20 @@ void ber_write_boolean(STREAM* s, boolean value)
|
||||
void ber_write_integer(STREAM* s, uint32 value)
|
||||
{
|
||||
ber_write_universal_tag(s, BER_TAG_INTEGER);
|
||||
ber_write_length(s, 2);
|
||||
stream_write_uint16_be(s, value);
|
||||
|
||||
if (value <= 0xFF)
|
||||
{
|
||||
ber_write_length(s, 1);
|
||||
stream_write_uint8(s, value);
|
||||
}
|
||||
else if (value <= 0xFFFF)
|
||||
{
|
||||
ber_write_length(s, 2);
|
||||
stream_write_uint16_be(s, value);
|
||||
}
|
||||
else if (value <= 0xFFFFFFFF)
|
||||
{
|
||||
ber_write_length(s, 4);
|
||||
stream_write_uint32_be(s, value);
|
||||
}
|
||||
}
|
||||
|
@ -255,22 +255,18 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings *settings)
|
||||
|
||||
void gcc_write_client_security_data(STREAM* s, rdpSettings *settings)
|
||||
{
|
||||
uint16 encryptionMethods;
|
||||
|
||||
gcc_write_user_data_header(s, CS_SECURITY, 12);
|
||||
|
||||
encryptionMethods = ENCRYPTION_40BIT_FLAG | ENCRYPTION_128BIT_FLAG;
|
||||
|
||||
if (settings->encryption > 0)
|
||||
{
|
||||
stream_write_uint32(s, encryptionMethods); /* encryptionMethods */
|
||||
stream_write_uint32(s, settings->encryption_methods); /* encryptionMethods */
|
||||
stream_write_uint32(s, 0); /* extEncryptionMethods */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* French locale, disable encryption */
|
||||
stream_write_uint32(s, 0); /* encryptionMethods */
|
||||
stream_write_uint32(s, encryptionMethods); /* extEncryptionMethods */
|
||||
stream_write_uint32(s, settings->encryption_methods); /* extEncryptionMethods */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,12 +85,6 @@
|
||||
#define CONNECTION_TYPE_WAN 0x05
|
||||
#define CONNECTION_TYPE_LAN 0x06
|
||||
|
||||
/* Encryption Methods */
|
||||
#define ENCRYPTION_40BIT_FLAG 0x00000001
|
||||
#define ENCRYPTION_128BIT_FLAG 0x00000002
|
||||
#define ENCRYPTION_56BIT_FLAG 0x00000008
|
||||
#define ENCRYPTION_FIPS_FLAG 0x00000010
|
||||
|
||||
/* Cluster Information Flags */
|
||||
#define REDIRECTION_SUPPORTED 0x00000001
|
||||
#define REDIRECTED_SESSIONID_FIELD_VALID 0x00000002
|
||||
|
@ -88,7 +88,12 @@ static void mcs_init_domain_parameters(DOMAIN_PARAMETERS* domainParameters,
|
||||
|
||||
static void mcs_write_domain_parameters(STREAM* s, DOMAIN_PARAMETERS* domainParameters)
|
||||
{
|
||||
ber_write_sequence_of_tag(s, 32);
|
||||
int length;
|
||||
uint8 *bm, *em;
|
||||
|
||||
stream_get_mark(s, bm);
|
||||
stream_seek(s, 2);
|
||||
|
||||
ber_write_integer(s, domainParameters->maxChannelIds);
|
||||
ber_write_integer(s, domainParameters->maxUserIds);
|
||||
ber_write_integer(s, domainParameters->maxTokenIds);
|
||||
@ -97,6 +102,13 @@ static void mcs_write_domain_parameters(STREAM* s, DOMAIN_PARAMETERS* domainPara
|
||||
ber_write_integer(s, domainParameters->maxHeight);
|
||||
ber_write_integer(s, domainParameters->maxMCSPDUsize);
|
||||
ber_write_integer(s, domainParameters->protocolVersion);
|
||||
|
||||
stream_get_mark(s, em);
|
||||
length = (em - bm) - 2;
|
||||
stream_set_mark(s, bm);
|
||||
|
||||
ber_write_sequence_of_tag(s, length);
|
||||
stream_set_mark(s, em);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,12 +121,12 @@ static void mcs_write_domain_parameters(STREAM* s, DOMAIN_PARAMETERS* domainPara
|
||||
void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, STREAM* user_data)
|
||||
{
|
||||
int length;
|
||||
uint8 *bm, *em;
|
||||
|
||||
int gcc_CCrq_length = stream_get_length(user_data);
|
||||
|
||||
length = gcc_CCrq_length + (3* 34) + 13;
|
||||
|
||||
/* Connect-Initial (APPLICATION 101, IMPLICIT SEQUENCE) */
|
||||
ber_write_application_tag(s, MCS_TYPE_CONNECT_INITIAL, length);
|
||||
stream_get_mark(s, bm);
|
||||
stream_seek(s, 5);
|
||||
|
||||
/* callingDomainSelector (OCTET_STRING) */
|
||||
ber_write_octet_string(s, callingDomainSelector, sizeof(callingDomainSelector));
|
||||
@ -136,6 +148,14 @@ void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, STREAM* user_data)
|
||||
|
||||
/* userData (OCTET_STRING) */
|
||||
ber_write_octet_string(s, user_data->data, gcc_CCrq_length);
|
||||
|
||||
stream_get_mark(s, em);
|
||||
length = (em - bm) - 5;
|
||||
stream_set_mark(s, bm);
|
||||
|
||||
/* Connect-Initial (APPLICATION 101, IMPLICIT SEQUENCE) */
|
||||
ber_write_application_tag(s, MCS_TYPE_CONNECT_INITIAL, length);
|
||||
stream_set_mark(s, em);
|
||||
}
|
||||
|
||||
int mcs_recv(rdpMcs* mcs)
|
||||
|
@ -48,6 +48,10 @@ rdpSettings* settings_new()
|
||||
PERF_DISABLE_MENUANIMATIONS |
|
||||
PERF_DISABLE_WALLPAPER;
|
||||
|
||||
settings->encryption_methods =
|
||||
ENCRYPTION_40BIT_FLAG |
|
||||
ENCRYPTION_128BIT_FLAG;
|
||||
|
||||
settings->uniconv = freerdp_uniconv_new();
|
||||
gethostname(settings->client_hostname, sizeof(settings->client_hostname) - 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user