libxrdp: work on fastpath input, fix length issue in fastpath_recv
This commit is contained in:
parent
f525c0f8e7
commit
f8d26973d0
@ -82,7 +82,6 @@ struct xrdp_fastpath
|
||||
struct xrdp_tcp* tcp_layer;
|
||||
int numEvents;
|
||||
int secFlags;
|
||||
int firstPacket;
|
||||
};
|
||||
|
||||
/* sec */
|
||||
|
@ -56,8 +56,9 @@ int APP_CC
|
||||
xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
|
||||
{
|
||||
int fp_hdr;
|
||||
int len;
|
||||
int len = 0;
|
||||
int byte;
|
||||
int hdr_len = 2;
|
||||
DEBUG((" in xrdp_fastpath_recv"));
|
||||
|
||||
/* read the first fastpath byte
|
||||
@ -67,7 +68,7 @@ xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
|
||||
self->numEvents = (fp_hdr & 0x3C) >> 2;
|
||||
self->secFlags = (fp_hdr & 0xC0) >> 6;
|
||||
|
||||
// receive fastpath packet length
|
||||
// receive fastpath first packet length
|
||||
if (xrdp_tcp_recv(self->tcp_layer, s, 1) != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -79,6 +80,12 @@ xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
|
||||
{
|
||||
byte &= ~(0x80);
|
||||
len = (byte << 8);
|
||||
// receive fastpath second packet length
|
||||
if (xrdp_tcp_recv(self->tcp_layer, s, 1) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
hdr_len++;
|
||||
in_uint8(s, byte); /* length 2 */
|
||||
len += byte;
|
||||
}
|
||||
@ -87,8 +94,10 @@ xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
|
||||
len = byte;
|
||||
}
|
||||
|
||||
g_writeln("len= %d , numEvents= %d, secFlags= %d, bytesleft: %d", len, self->numEvents, self->secFlags, (s->p - s->data));
|
||||
|
||||
// receive the left bytes
|
||||
if (xrdp_tcp_recv(self->tcp_layer, s, len - (s->p - s->data)) != 0)
|
||||
if (xrdp_tcp_recv(self->tcp_layer, s, len - hdr_len) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -277,7 +277,6 @@ xrdp_rdp_recv(struct xrdp_rdp *self, struct stream *s, int *code)
|
||||
|
||||
if (error == 2) /* we have fastpath packet! */
|
||||
{
|
||||
s->next_packet = 0;
|
||||
*code = 2;
|
||||
return 0;
|
||||
}
|
||||
@ -1710,6 +1709,8 @@ xrdp_rdp_process_fastpath_data_input(struct xrdp_rdp *self, struct stream *s)
|
||||
int eventFlags;
|
||||
int code;
|
||||
int flags;
|
||||
int param2;
|
||||
int time;
|
||||
|
||||
// process fastpath input events
|
||||
for (i = 0 ; i < self->sec_layer->fastpath_layer->numEvents ; i++) {
|
||||
@ -1740,7 +1741,7 @@ xrdp_rdp_process_fastpath_data_input(struct xrdp_rdp *self, struct stream *s)
|
||||
RDP_INPUT_MOUSE - 0x8001
|
||||
RDP_INPUT_MOUSEX - 0x8002 */
|
||||
/* call to xrdp_wm.c : callback */
|
||||
self->session->callback(self->session->id, RDP_INPUT_SCANCODE, flags, 0,
|
||||
self->session->callback(self->session->id, RDP_INPUT_SCANCODE, flags, param2,
|
||||
code, time);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user