[core,connection] relax state machine

contrary to '[MS-RDPBCGR] 1.3.9 Connect-Time and Continuous Network
Characteristics Detection' we have seen autodetection reqeusts mixed in
between licensing messages. This relaxes the state machine and allows
handling.
This commit is contained in:
akallabeth 2023-04-28 08:23:52 +02:00 committed by Martin Fleisz
parent 12a2e55588
commit fdcc36dd8d

View File

@ -1109,10 +1109,6 @@ BOOL rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, wStream* s)
BOOL rdp_client_connect_auto_detect(rdpRdp* rdp, wStream* s)
{
size_t pos;
UINT16 length;
UINT16 channelId;
WINPR_ASSERT(rdp);
WINPR_ASSERT(rdp->mcs);
@ -1121,7 +1117,9 @@ BOOL rdp_client_connect_auto_detect(rdpRdp* rdp, wStream* s)
if (messageChannelId != 0)
{
/* Process any MCS message channel PDUs. */
pos = Stream_GetPosition(s);
const size_t pos = Stream_GetPosition(s);
UINT16 length = 0;
UINT16 channelId = 0;
if (rdp_read_header(rdp, s, &length, &channelId))
{
@ -1172,6 +1170,15 @@ state_run_t rdp_client_connect_license(rdpRdp* rdp, wStream* s)
return STATE_RUN_FAILED;
}
/* there might be autodetect messages mixed in between licensing messages.
* that has been observed with 2k12 R2 and 2k19
*/
const UINT16 messageChannelId = rdp->mcs->messageChannelId;
if (channelId == messageChannelId)
{
return rdp_recv_message_channel_pdu(rdp, s, securityFlags);
}
if ((securityFlags & SEC_LICENSE_PKT) == 0)
{
char buffer[512] = { 0 };