[core,state] fix state transitions, added logging

This commit is contained in:
akallabeth 2022-11-17 11:02:57 +01:00 committed by akallabeth
parent 9dcf2c7e39
commit 4284d67088
2 changed files with 6 additions and 5 deletions

View File

@ -1436,8 +1436,6 @@ static int nla_decode_ts_request(rdpNla* nla, wStream* s)
const size_t offset = WinPrAsn1DecReadSequence(&dec, &dec2);
if (offset == 0)
return -1;
if (Stream_GetRemainingLength(s) < offset)
return -1;
dec = dec2;
/* version [0] INTEGER */

View File

@ -1697,7 +1697,7 @@ static state_run_t rdp_recv_callback_int(rdpTransport* transport, wStream* s, vo
if (!rdp_client_transition_to_state(rdp, CONNECTION_STATE_MCS_CREATE_REQUEST))
status = STATE_RUN_FAILED;
else
status = STATE_RUN_TRY_AGAIN;
status = STATE_RUN_CONTINUE;
}
}
break;
@ -1979,14 +1979,17 @@ state_run_t rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
{
const rdpRdp* rdp = context->rdp;
const char* old = rdp_get_state_string(rdp);
const size_t orem = Stream_GetPosition(s);
if (rc == STATE_RUN_TRY_AGAIN)
Stream_SetPosition(s, start);
rc = rdp_recv_callback_int(transport, s, extra);
const char* now = rdp_get_state_string(rdp);
const size_t rem = Stream_GetPosition(s);
WLog_VRB(TAG, "(client)[%s -> %s] current return %s [%" PRIuz " bytes not processed]", old,
rdp_get_state_string(rdp), state_run_result_string(rc, buffer, sizeof(buffer)),
Stream_GetRemainingLength(s));
now, state_run_result_string(rc, buffer, sizeof(buffer)), rem - orem);
} while ((rc == STATE_RUN_TRY_AGAIN) || (rc == STATE_RUN_CONTINUE));
return rc;
}