X-Git-Url: https://git.sesse.net/?p=rdpsrv;a=blobdiff_plain;f=mcs.c;h=5f4fe2001b0e176ac62743185c203a3b428cea41;hp=ff2dfdb0cfe6ed1a13b79d481b281eda5d77f862;hb=ce66b81460e5353db09d45c02339d4583fbda255;hpb=63fa9a9043d4a58ee7994e669bcc566f09bc9e9b diff --git a/mcs.c b/mcs.c index ff2dfdb..5f4fe20 100644 --- a/mcs.c +++ b/mcs.c @@ -89,6 +89,14 @@ ber_out_integer(STREAM s, int value) out_uint16_be(s, value); } +static void +ber_in_integer(STREAM s, int *value) +{ + int length; + ber_parse_header(s, BER_TAG_INTEGER, &length); + in_uint16_be(s, *value); +} + /* Output a DOMAIN_PARAMS structure (ASN.1 BER) */ static void mcs_out_domain_params(STREAM s, int max_channels, int max_users, int max_tokens, int max_pdusize) @@ -109,10 +117,34 @@ static BOOL mcs_parse_domain_params(STREAM s) { int length; + int max_channels, max_users, max_tokens, max_pdusize; + int num_priorities, min_throughput, max_height; + int ver_protocol; ber_parse_header(s, MCS_TAG_DOMAIN_PARAMS, &length); - in_uint8s(s, length); - + printf("MCS_TAG_DOMAIN_PARAMS, len %u (expected 32)\n", length); + if (length == 32) { + ber_in_integer(s, &max_channels); + ber_in_integer(s, &max_users); + ber_in_integer(s, &max_tokens); + ber_in_integer(s, &num_priorities); + ber_in_integer(s, &min_throughput); + ber_in_integer(s, &max_height); + ber_in_integer(s, &max_pdusize); + ber_in_integer(s, &ver_protocol); + + printf("max_channels=%u\n", max_channels); + printf("max_users=%u\n", max_users); + printf("max_tokens=%u\n", max_tokens); + printf("num_priorities=%u\n", num_priorities); + printf("min_throughput=%u\n", min_throughput); + printf("max_pdusize=%u\n", max_pdusize); + printf("ver_protocol=%u\n", ver_protocol); + } else { + hexdump(s->p, length); + in_uint8s(s, length); + } + return s_check(s); } @@ -155,8 +187,9 @@ void mcs_send_connect_response() { STREAM s; + int i; - s = iso_init(80); // FIXME + s = iso_init(92); ber_out_header(s, MCS_CONNECT_RESPONSE, 80); ber_out_header(s, BER_TAG_RESULT, 1); @@ -167,17 +200,21 @@ mcs_send_connect_response() mcs_out_domain_params(s, 34, 2, 0, 0xffff); // dumdidum? - ber_out_header(s, BER_TAG_OCTET_STRING, 28); + ber_out_header(s, BER_TAG_OCTET_STRING, 40); out_uint8s(s, 21); // ick out_uint8(s, 0); - // server info -- we claim to support RDP4 + // server info -- we claim to support RDP5 out_uint16_le(s, SEC_TAG_SRV_INFO); out_uint16_le(s, 6); // length - out_uint16_le(s, 1); + out_uint16_le(s, 5); - // aiee, no crypto info yet! :-) + // crypto info + out_uint16_le(s, SEC_TAG_SRV_CRYPT); + out_uint16_le(s, 12); // length + out_uint32_le(s, 1); // 40-bit + out_uint32_le(s, 0); // no encryption s_mark_end(s); printf("LEN: %u\n", s->p - s->iso_hdr); @@ -288,7 +325,7 @@ mcs_send_to_channel(STREAM s, uint16 channel) length = s->end - s->p - 8; length |= 0x8000; - out_uint8(s, (MCS_SDRQ << 2)); + out_uint8(s, (MCS_SDIN << 2)); out_uint16_be(s, g_mcs_userid); out_uint16_be(s, channel); out_uint8(s, 0x70); /* flags */