diff --git a/cunit/test_gcc.c b/cunit/test_gcc.c index 9c53a43bd..85cecac11 100644 --- a/cunit/test_gcc.c +++ b/cunit/test_gcc.c @@ -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)); diff --git a/freerdp-ui/test/freerdp.c b/freerdp-ui/test/freerdp.c index 911577eb9..368e701b9 100644 --- a/freerdp-ui/test/freerdp.c +++ b/freerdp-ui/test/freerdp.c @@ -80,5 +80,7 @@ int main(int argc, char* argv[]) mcs = mcs_new(transport); mcs_send_connect_initial(mcs); + mcs_recv(mcs); + return 0; } diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 948c751ec..955f67a7d 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -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; diff --git a/libfreerdp-core/gcc.c b/libfreerdp-core/gcc.c index 9d7f4fb14..038dfa1e9 100644 --- a/libfreerdp-core/gcc.c +++ b/libfreerdp-core/gcc.c @@ -202,7 +202,12 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings *settings) stream_write_uint32(s, 0); /* serialNumber (should be initialized to 0) */ highColorDepth = MIN(settings->color_depth, 24); - supportedColorDepths = RNS_UD_24BPP_SUPPORT | RNS_UD_16BPP_SUPPORT | RNS_UD_15BPP_SUPPORT; + + supportedColorDepths = + RNS_UD_32BPP_SUPPORT | + RNS_UD_24BPP_SUPPORT | + RNS_UD_16BPP_SUPPORT | + RNS_UD_15BPP_SUPPORT; connectionType = 0; earlyCapabilityFlags = RNS_UD_CS_SUPPORT_ERRINFO_PDU; @@ -250,26 +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_56BIT_FLAG | - ENCRYPTION_128BIT_FLAG | - ENCRYPTION_FIPS_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 */ } } diff --git a/libfreerdp-core/gcc.h b/libfreerdp-core/gcc.h index 3a981f138..5f38b877b 100644 --- a/libfreerdp-core/gcc.h +++ b/libfreerdp-core/gcc.h @@ -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 diff --git a/libfreerdp-core/mcs.c b/libfreerdp-core/mcs.c index 347dfb4ac..48e2c7adf 100644 --- a/libfreerdp-core/mcs.c +++ b/libfreerdp-core/mcs.c @@ -121,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 + 97; - - /* 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)); @@ -148,6 +148,26 @@ 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) +{ + int bytes_read; + int size = 2048; + char *recv_buffer; + + recv_buffer = xmalloc(size); + bytes_read = tls_read(mcs->transport->tls, recv_buffer, size); + + return 0; } void mcs_send_connect_initial(rdpMcs* mcs) diff --git a/libfreerdp-core/mcs.h b/libfreerdp-core/mcs.h index 16b19d3cc..8144055d5 100644 --- a/libfreerdp-core/mcs.h +++ b/libfreerdp-core/mcs.h @@ -28,14 +28,14 @@ typedef struct { - uint32 maxChannelIds; - uint32 maxUserIds; - uint32 maxTokenIds; - uint32 numPriorities; - uint32 minThroughput; - uint32 maxHeight; - uint32 maxMCSPDUsize; - uint32 protocolVersion; + uint16 maxChannelIds; + uint16 maxUserIds; + uint16 maxTokenIds; + uint16 numPriorities; + uint16 minThroughput; + uint16 maxHeight; + uint16 maxMCSPDUsize; + uint16 protocolVersion; } DOMAIN_PARAMETERS; struct rdp_mcs @@ -54,6 +54,8 @@ void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, STREAM* user_data); void mcs_send_connect_initial(rdpMcs* mcs); +int mcs_recv(rdpMcs* mcs); + rdpMcs* mcs_new(rdpTransport* transport); void mcs_free(rdpMcs* mcs); diff --git a/libfreerdp-core/settings.c b/libfreerdp-core/settings.c index 6d6ca4eb1..e83f57cfe 100644 --- a/libfreerdp-core/settings.c +++ b/libfreerdp-core/settings.c @@ -37,9 +37,9 @@ rdpSettings* settings_new() settings->tls_security = 1; settings->rdp_security = 1; settings->client_build = 2600; - settings->kbd_type = 4; + settings->kbd_type = 0; settings->kbd_subtype = 0; - settings->kbd_fn_keys = 12; + settings->kbd_fn_keys = 0; settings->kbd_layout = 0x409; settings->encryption = 1; @@ -48,8 +48,11 @@ rdpSettings* settings_new() PERF_DISABLE_MENUANIMATIONS | PERF_DISABLE_WALLPAPER; + settings->encryption_methods = + ENCRYPTION_40BIT_FLAG | + ENCRYPTION_128BIT_FLAG; + settings->uniconv = freerdp_uniconv_new(); - strcpy(settings->client_product_id, "69712-783-0357974-42714"); gethostname(settings->client_hostname, sizeof(settings->client_hostname) - 1); }