Prevent chansrv input channels being scanned during a server reset

This commit is contained in:
matt335672 2020-05-29 13:28:04 +01:00
parent a618a67d4a
commit 81e037e964
4 changed files with 20 additions and 4 deletions

View File

@ -47,6 +47,7 @@ libxrdp_init(tbus id, struct trans *trans)
session->rdp = xrdp_rdp_create(session, trans);
session->orders = xrdp_orders_create(session, (struct xrdp_rdp *)session->rdp);
session->client_info = &(((struct xrdp_rdp *)session->rdp)->client_info);
session->check_for_app_input = 1;
return session;
}
@ -1078,7 +1079,12 @@ libxrdp_reset(struct xrdp_session *session,
return 1;
}
/* shut down the rdp client */
/* shut down the rdp client
*
* When resetting the lib, disable application input checks, as
* otherwise we can send a channel message to the other end while
* the channels are inactive ([MS-RDPBCGR] 3.2.5.5.1 */
session->check_for_app_input = 0;
if (xrdp_rdp_send_deactivate((struct xrdp_rdp *)session->rdp) != 0)
{
return 1;
@ -1090,6 +1096,9 @@ libxrdp_reset(struct xrdp_session *session,
return 1;
}
/* Re-enable application input checks */
session->check_for_app_input = 1;
return 0;
}

View File

@ -66,6 +66,7 @@ struct xrdp_session
struct trans *trans;
int (*callback)(intptr_t id, int msg, intptr_t param1, intptr_t param2,
intptr_t param3, intptr_t param4);
int check_for_app_input;
void *rdp;
void *orders;
struct xrdp_client_info *client_info;

View File

@ -146,7 +146,10 @@ xrdp_fastpath_send(struct xrdp_fastpath *self, struct stream *s)
{
return 1;
}
if (self->session->check_for_app_input)
{
xrdp_fastpath_session_callback(self, 0x5556, 0, 0, 0, 0);
}
return 0;
}

View File

@ -996,10 +996,13 @@ xrdp_mcs_call_callback(struct xrdp_mcs *self)
if (session != 0)
{
if (session->callback != 0)
{
if (session->check_for_app_input)
{
/* in xrdp_wm.c */
rv = session->callback(session->id, 0x5556, 0, 0, 0, 0);
}
}
else
{
g_writeln("in xrdp_mcs_send, session->callback is nil");