38 |
extern int height; |
extern int height; |
39 |
extern int keylayout; |
extern int keylayout; |
40 |
extern BOOL encryption; |
extern BOOL encryption; |
41 |
extern BOOL licence_issued; |
extern BOOL g_licence_issued; |
42 |
extern BOOL use_rdp5; |
extern BOOL use_rdp5; |
43 |
extern int server_bpp; |
extern int server_bpp; |
44 |
|
|
330 |
int hdrlen; |
int hdrlen; |
331 |
STREAM s; |
STREAM s; |
332 |
|
|
333 |
if (!licence_issued) |
if (!g_licence_issued) |
334 |
hdrlen = (flags & SEC_ENCRYPT) ? 12 : 4; |
hdrlen = (flags & SEC_ENCRYPT) ? 12 : 4; |
335 |
else |
else |
336 |
hdrlen = (flags & SEC_ENCRYPT) ? 12 : 0; |
hdrlen = (flags & SEC_ENCRYPT) ? 12 : 0; |
347 |
int datalen; |
int datalen; |
348 |
|
|
349 |
s_pop_layer(s, sec_hdr); |
s_pop_layer(s, sec_hdr); |
350 |
if (!licence_issued || (flags & SEC_ENCRYPT)) |
if (!g_licence_issued || (flags & SEC_ENCRYPT)) |
351 |
out_uint32_le(s, flags); |
out_uint32_le(s, flags); |
352 |
|
|
353 |
if (flags & SEC_ENCRYPT) |
if (flags & SEC_ENCRYPT) |
673 |
} |
} |
674 |
|
|
675 |
DEBUG(("Generating client random\n")); |
DEBUG(("Generating client random\n")); |
|
/* Generate a client random, and hence determine encryption keys */ |
|
|
generate_random(inr); |
|
676 |
// This is what the MS client do: |
// This is what the MS client do: |
677 |
// memset(inr, 0, SEC_RANDOM_SIZE); |
memset(inr, 0, SEC_RANDOM_SIZE); |
678 |
// *ARIGL!* |
/* *ARIGL!* Plaintext attack, anyone? |
679 |
|
I tried doing: |
680 |
|
generate_random(inr); |
681 |
|
..but that generates connection errors now and then (yes, |
682 |
|
"now and then". Something like 0 to 3 attempts needed before a |
683 |
|
successful connection. Nice. Not! |
684 |
|
*/ |
685 |
|
|
686 |
generate_random(client_random); |
generate_random(client_random); |
687 |
if (NULL != server_public_key) |
if (NULL != server_public_key) |
688 |
{ /* Which means we should use |
{ /* Which means we should use |
769 |
|
|
770 |
while ((s = mcs_recv(&channel)) != NULL) |
while ((s = mcs_recv(&channel)) != NULL) |
771 |
{ |
{ |
772 |
if (encryption || !licence_issued) |
if (encryption || !g_licence_issued) |
773 |
{ |
{ |
774 |
in_uint32_le(s, sec_flags); |
in_uint32_le(s, sec_flags); |
775 |
|
|
777 |
{ |
{ |
778 |
if (sec_flags & SEC_ENCRYPT) { |
if (sec_flags & SEC_ENCRYPT) { |
779 |
DEBUG_RDP5(("Encrypted license detected\n")); |
DEBUG_RDP5(("Encrypted license detected\n")); |
780 |
} |
} |
781 |
licence_process(s); |
licence_process(s); |
782 |
continue; |
continue; |
783 |
} |
} |
809 |
|
|
810 |
/* We exchange some RDP data during the MCS-Connect */ |
/* We exchange some RDP data during the MCS-Connect */ |
811 |
mcs_data.size = 512; |
mcs_data.size = 512; |
812 |
mcs_data.p = mcs_data.data = xmalloc(mcs_data.size); |
mcs_data.p = mcs_data.data = (uint8*)xmalloc(mcs_data.size); |
813 |
sec_out_mcs_data(&mcs_data); |
sec_out_mcs_data(&mcs_data); |
814 |
|
|
815 |
if (!mcs_connect(server, &mcs_data, username)) |
if (!mcs_connect(server, &mcs_data, username)) |