mirror of https://github.com/FreeRDP/FreeRDP
libfreerdp-core: check TPKT/FastPath header when processing a PDU.
This commit is contained in:
parent
9f2a3e847b
commit
e5419bed9f
|
@ -351,7 +351,7 @@ void rdp_read_data_pdu(rdpRdp* rdp, STREAM* s)
|
|||
* @param s stream
|
||||
*/
|
||||
|
||||
void rdp_process_pdu(rdpRdp* rdp, STREAM* s)
|
||||
static void rdp_process_tpkt_pdu(rdpRdp* rdp, STREAM* s)
|
||||
{
|
||||
int length;
|
||||
uint16 pduType;
|
||||
|
@ -362,8 +362,6 @@ void rdp_process_pdu(rdpRdp* rdp, STREAM* s)
|
|||
boolean processed;
|
||||
enum DomainMCSPDU MCSPDU;
|
||||
|
||||
/* TODO: Check Fast Path header */
|
||||
|
||||
MCSPDU = DomainMCSPDU_SendDataIndication;
|
||||
mcs_read_domain_mcspdu_header(s, &MCSPDU, &length);
|
||||
|
||||
|
@ -435,6 +433,21 @@ void rdp_process_pdu(rdpRdp* rdp, STREAM* s)
|
|||
}
|
||||
}
|
||||
|
||||
static void rdp_process_fastpath_pdu(rdpRdp* rdp, STREAM* s)
|
||||
{
|
||||
uint32 length = fastpath_read_header(s, NULL);
|
||||
|
||||
printf("FastPath PDU: length=%d\n", length);
|
||||
}
|
||||
|
||||
static void rdp_process_pdu(rdpRdp* rdp, STREAM* s)
|
||||
{
|
||||
if (tpkt_verify_header(s))
|
||||
rdp_process_tpkt_pdu(rdp, s);
|
||||
else
|
||||
rdp_process_fastpath_pdu(rdp, s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive an RDP packet.\n
|
||||
* @param rdp RDP module
|
||||
|
|
|
@ -24,6 +24,7 @@ typedef struct rdp_rdp rdpRdp;
|
|||
|
||||
#include "mcs.h"
|
||||
#include "tpkt.h"
|
||||
#include "fastpath.h"
|
||||
#include "tpdu.h"
|
||||
#include "nego.h"
|
||||
#include "input.h"
|
||||
|
|
|
@ -53,14 +53,30 @@
|
|||
* length includes the TPKT header (4 bytes), the maximum X.224 TPDU length is 65531.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Verify if a packet has valid TPKT header.\n
|
||||
* @param s
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
boolean tpkt_verify_header(STREAM* s)
|
||||
{
|
||||
uint8 version;
|
||||
|
||||
stream_peek_uint8(s, version);
|
||||
if (version == 3)
|
||||
return True;
|
||||
else
|
||||
return False;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a TPKT header.\n
|
||||
* @param s
|
||||
* @return length
|
||||
*/
|
||||
|
||||
uint16
|
||||
tpkt_read_header(STREAM* s)
|
||||
uint16 tpkt_read_header(STREAM* s)
|
||||
{
|
||||
uint8 version;
|
||||
uint16 length;
|
||||
|
@ -87,8 +103,7 @@ tpkt_read_header(STREAM* s)
|
|||
* @param length
|
||||
*/
|
||||
|
||||
void
|
||||
tpkt_write_header(STREAM* s, int length)
|
||||
void tpkt_write_header(STREAM* s, int length)
|
||||
{
|
||||
stream_write_uint8(s, 3); /* version */
|
||||
stream_write_uint8(s, 0); /* reserved */
|
||||
|
|
|
@ -27,9 +27,8 @@
|
|||
|
||||
#define TPKT_HEADER_LENGTH 4
|
||||
|
||||
uint16
|
||||
tpkt_read_header(STREAM* s);
|
||||
void
|
||||
tpkt_write_header(STREAM* s, int length);
|
||||
boolean tpkt_verify_header(STREAM* s);
|
||||
uint16 tpkt_read_header(STREAM* s);
|
||||
void tpkt_write_header(STREAM* s, int length);
|
||||
|
||||
#endif /* __TPKT_H */
|
||||
|
|
Loading…
Reference in New Issue