From 5e13d5bf162922b36210b859117c6474cc5640a1 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 25 Sep 2024 21:28:11 +0200 Subject: [PATCH] [core,connection] handle message channel in state When in demand active it is possible that we can receive message channel messages. In case we receive one switch parsing to the appropriate handlers. --- libfreerdp/core/connection.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c index 8d04b92f7..a84de180f 100644 --- a/libfreerdp/core/connection.c +++ b/libfreerdp/core/connection.c @@ -1264,6 +1264,21 @@ state_run_t rdp_client_connect_demand_active(rdpRdp* rdp, wStream* s) if (freerdp_shall_disconnect_context(rdp->context)) return STATE_RUN_QUIT_SESSION; + if (rdp->mcs->messageChannelId && (channelId == rdp->mcs->messageChannelId)) + { + UINT16 securityFlags = 0; + if (!rdp_read_security_header(rdp, s, &securityFlags, NULL)) + return STATE_RUN_FAILED; + + if (securityFlags & SEC_ENCRYPT) + { + if (!rdp_decrypt(rdp, s, &length, securityFlags)) + return STATE_RUN_FAILED; + } + rdp->inPackets++; + return rdp_recv_message_channel_pdu(rdp, s, securityFlags); + } + if (!rdp_read_share_control_header(rdp, s, NULL, NULL, &pduType, &pduSource)) return STATE_RUN_FAILED;