33 |
mcs_send_connect_initial(conn); |
mcs_send_connect_initial(conn); |
34 |
if (!iso_recv(conn) || !mcs_io_connect_response(&conn->in, &mcr)) |
if (!iso_recv(conn) || !mcs_io_connect_response(&conn->in, &mcr)) |
35 |
{ |
{ |
36 |
fprintf(stderr, "MCS error, expected Connect-Response\n"); |
ERROR("MCS error, expected Connect-Response\n"); |
37 |
iso_disconnect(conn); |
iso_disconnect(conn); |
38 |
return NULL; |
return NULL; |
39 |
} |
} |
40 |
|
|
41 |
if (mcr.result != 0) |
if (mcr.result != 0) |
42 |
{ |
{ |
43 |
fprintf(stderr, "MCS-Connect-Initial failed, result %d\n", |
ERROR("MCS-Connect-Initial failed, result %d\n", mcr.result); |
|
mcr.result); |
|
44 |
iso_disconnect(conn); |
iso_disconnect(conn); |
45 |
return NULL; |
return NULL; |
46 |
} |
} |
50 |
mcs_send_aurq(conn); |
mcs_send_aurq(conn); |
51 |
if (!iso_recv(conn) || !mcs_io_aucf(&conn->in, &aucf)) |
if (!iso_recv(conn) || !mcs_io_aucf(&conn->in, &aucf)) |
52 |
{ |
{ |
53 |
fprintf(stderr, "MCS error, expected AUcf\n"); |
ERROR("MCS error, expected AUcf\n"); |
54 |
mcs_disconnect(conn); |
mcs_disconnect(conn); |
55 |
return NULL; |
return NULL; |
56 |
} |
} |
57 |
|
|
58 |
if (aucf.result != 0) |
if (aucf.result != 0) |
59 |
{ |
{ |
60 |
fprintf(stderr, "AUrq failed, result %d\n", mcr.result); |
ERROR("AUrq failed, result %d\n", mcr.result); |
61 |
mcs_disconnect(conn); |
mcs_disconnect(conn); |
62 |
return NULL; |
return NULL; |
63 |
} |
} |
81 |
mcs_send_cjrq(conn, chanid); |
mcs_send_cjrq(conn, chanid); |
82 |
if (!iso_recv(conn) || !mcs_io_cjcf(&conn->in, &cjcf)) |
if (!iso_recv(conn) || !mcs_io_cjcf(&conn->in, &cjcf)) |
83 |
{ |
{ |
84 |
fprintf(stderr, "MCS error, expected CJcf\n"); |
ERROR("MCS error, expected CJcf\n"); |
85 |
return False; |
return False; |
86 |
} |
} |
87 |
|
|
88 |
if (cjcf.result != 0) |
if (cjcf.result != 0) |
89 |
{ |
{ |
90 |
fprintf(stderr, "CJrq failed, result %d\n", cjcf.result); |
ERROR("CJrq failed, result %d\n", cjcf.result); |
91 |
return False; |
return False; |
92 |
} |
} |
93 |
|
|
178 |
if (!iso_recv(conn) || !mcs_io_data(&conn->in, &data, request)) |
if (!iso_recv(conn) || !mcs_io_data(&conn->in, &data, request)) |
179 |
return False; |
return False; |
180 |
|
|
|
#ifdef MCS_DEBUG |
|
|
fprintf(stderr, "MCS packet\n"); |
|
|
dump_data(conn->in.data+conn->in.offset, conn->in.end-conn->in.offset); |
|
|
#endif |
|
|
|
|
181 |
conn->in.rdp_offset = conn->in.offset; |
conn->in.rdp_offset = conn->in.offset; |
182 |
return True; |
return True; |
183 |
} |
} |
210 |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
211 |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
212 |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
213 |
0x00,0x01,0xca,0x00,0x00,0x02,0xc0,0x08,0x00,0x00,0x00,0x00,0x00 }; |
0x00,0x01,0xca,0x00,0x00,0x02,0xc0,0x08,0x00, |
214 |
|
/* encryption disabled */ 0x00,0x00,0x00,0x00 }; |
215 |
|
|
216 |
|
char precanned_connect_userdata_e[] = { |
217 |
|
0x00, |
218 |
|
0x05,0x00,0x14,0x7c,0x00,0x01,0x80,0x9e,0x00,0x08,0x00,0x10,0x00,0x01,0xc0,0x00, |
219 |
|
0x44,0x75,0x63,0x61,0x80,0x90,0x01,0xc0,0x88,0x00,0x01,0x00,0x08,0x00,0x80,0x02, |
220 |
|
0xe0,0x01,0x01,0xca,0x03,0xaa,0x09,0x04,0x00,0x00,0xa3,0x01,0x00,0x00,0x57,0x00, |
221 |
|
0x49,0x00,0x4e,0x00,0x39,0x00,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
222 |
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00, |
223 |
|
0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
224 |
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
225 |
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
226 |
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
227 |
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xca,0x00,0x00,0x02,0xc0, |
228 |
|
0x08,0x00,0x01,0x00,0x00,0x00 |
229 |
|
}; |
230 |
|
|
231 |
|
char domain_data[] = {0x01}; |
232 |
|
|
233 |
/* Initialise a MCS_CONNECT_INITIAL structure */ |
/* Initialise a MCS_CONNECT_INITIAL structure */ |
234 |
void mcs_make_connect_initial(MCS_CONNECT_INITIAL *mci) |
void mcs_make_connect_initial(MCS_CONNECT_INITIAL *mci) |
235 |
{ |
{ |
236 |
mci->calling_domain.length = 0; |
mci->calling_domain.length = 1; |
237 |
mci->calling_domain.data = NULL; |
mci->calling_domain.data = domain_data; |
238 |
|
|
239 |
mci->called_domain.length = 0; |
mci->called_domain.length = 1; |
240 |
mci->called_domain.data = NULL; |
mci->called_domain.data = domain_data; |
241 |
|
|
242 |
mci->upward_flag = 0xff; |
mci->upward_flag = 0xff; |
243 |
|
|
279 |
|
|
280 |
if (!res || (tag != tagval)) |
if (!res || (tag != tagval)) |
281 |
{ |
{ |
282 |
fprintf(stderr, "Invalid ASN.1 tag\n"); |
ERROR("Invalid ASN.1 tag\n"); |
283 |
return False; |
return False; |
284 |
} |
} |
285 |
|
|
386 |
|
|
387 |
if (length != 1) |
if (length != 1) |
388 |
{ |
{ |
389 |
fprintf(stderr, "Wrong length for simple type\n"); |
ERROR("Wrong length for simple type\n"); |
390 |
return False; |
return False; |
391 |
} |
} |
392 |
|
|
453 |
res = prs_io_uint8(s, &pkt_opcode); |
res = prs_io_uint8(s, &pkt_opcode); |
454 |
if (pkt_opcode != opcode) |
if (pkt_opcode != opcode) |
455 |
{ |
{ |
456 |
fprintf(stderr, "Expected EDrq, received %x\n", pkt_opcode); |
ERROR("Expected EDrq, received %x\n", pkt_opcode); |
457 |
return False; |
return False; |
458 |
} |
} |
459 |
|
|
473 |
res = prs_io_uint8(s, &pkt_opcode); |
res = prs_io_uint8(s, &pkt_opcode); |
474 |
if (pkt_opcode != opcode) |
if (pkt_opcode != opcode) |
475 |
{ |
{ |
476 |
fprintf(stderr, "Expected AUrq, received %x\n", pkt_opcode); |
ERROR("Expected AUrq, received %x\n", pkt_opcode); |
477 |
return False; |
return False; |
478 |
} |
} |
479 |
|
|
490 |
res = prs_io_uint8(s, &pkt_opcode); |
res = prs_io_uint8(s, &pkt_opcode); |
491 |
if ((pkt_opcode & 0xfc) != opcode) |
if ((pkt_opcode & 0xfc) != opcode) |
492 |
{ |
{ |
493 |
fprintf(stderr, "Expected AUcf, received %x\n", pkt_opcode); |
ERROR("Expected AUcf, received %x\n", pkt_opcode); |
494 |
return False; |
return False; |
495 |
} |
} |
496 |
|
|
511 |
res = prs_io_uint8(s, &pkt_opcode); |
res = prs_io_uint8(s, &pkt_opcode); |
512 |
if (pkt_opcode != opcode) |
if (pkt_opcode != opcode) |
513 |
{ |
{ |
514 |
fprintf(stderr, "Expected CJrq, received %x\n", pkt_opcode); |
ERROR("Expected CJrq, received %x\n", pkt_opcode); |
515 |
return False; |
return False; |
516 |
} |
} |
517 |
|
|
531 |
res = prs_io_uint8(s, &pkt_opcode); |
res = prs_io_uint8(s, &pkt_opcode); |
532 |
if ((pkt_opcode & 0xfc) != opcode) |
if ((pkt_opcode & 0xfc) != opcode) |
533 |
{ |
{ |
534 |
fprintf(stderr, "Expected CJcf, received %x\n", pkt_opcode); |
ERROR("Expected CJcf, received %x\n", pkt_opcode); |
535 |
return False; |
return False; |
536 |
} |
} |
537 |
|
|
555 |
res = prs_io_uint8(s, &pkt_opcode); |
res = prs_io_uint8(s, &pkt_opcode); |
556 |
if (pkt_opcode != opcode) |
if (pkt_opcode != opcode) |
557 |
{ |
{ |
558 |
fprintf(stderr, "Expected MCS data, received %x\n", pkt_opcode); |
ERROR("Expected MCS data, received %x\n", pkt_opcode); |
559 |
return False; |
return False; |
560 |
} |
} |
561 |
|
|
|
dt->length |= 0x8000; |
|
|
|
|
562 |
res = res ? msb_io_uint16(s, &dt->userid) : False; |
res = res ? msb_io_uint16(s, &dt->userid) : False; |
563 |
res = res ? msb_io_uint16(s, &dt->chanid) : False; |
res = res ? msb_io_uint16(s, &dt->chanid) : False; |
564 |
res = res ? prs_io_uint8 (s, &dt->flags ) : False; |
res = res ? prs_io_uint8 (s, &dt->flags ) : False; |
565 |
|
|
566 |
if (s->marshall) |
if (s->marshall) |
567 |
{ |
{ |
568 |
|
dt->length |= 0x8000; |
569 |
res = res ? msb_io_uint16(s, &dt->length) : False; |
res = res ? msb_io_uint16(s, &dt->length) : False; |
570 |
} |
} |
571 |
else |
else |