Minor refactor of process_logon_pdu()

This commit is contained in:
Henrik Andersson 2017-10-31 10:49:51 +01:00
parent 7daf773b6a
commit 5aa5a9dbfc

45
rdp.c
View File

@ -457,6 +457,7 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user,
/* Client Auto-Reconnect */ /* Client Auto-Reconnect */
if (g_has_reconnect_random) if (g_has_reconnect_random)
{ {
logger(Protocol, Debug, "rdp_send_logon_info(), Sending auto-reconnect cookie.");
out_uint16_le(s, 28); /* cbAutoReconnectLen */ out_uint16_le(s, 28); /* cbAutoReconnectLen */
/* ARC_CS_PRIVATE_PACKET */ /* ARC_CS_PRIVATE_PACKET */
out_uint32_le(s, 28); /* cbLen */ out_uint32_le(s, 28); /* cbLen */
@ -1436,23 +1437,18 @@ process_update_pdu(STREAM s)
} }
/* Process a Save Session Info PDU */ /* Process TS_LOGIN_INFO_EXTENDED data structure */
void static void
process_pdu_logon(STREAM s) process_ts_logon_info_extended(STREAM s)
{
uint32 infotype;
in_uint32_le(s, infotype);
if (infotype == INFOTYPE_LOGON_EXTENDED_INF)
{ {
uint32 fieldspresent; uint32 fieldspresent;
uint32 len;
uint32 version;
in_uint8s(s, 2); /* Length */ in_uint8s(s, 2); /* Length */
in_uint32_le(s, fieldspresent); in_uint32_le(s, fieldspresent);
if (fieldspresent & LOGON_EX_AUTORECONNECTCOOKIE) if (fieldspresent & LOGON_EX_AUTORECONNECTCOOKIE)
{ {
uint32 len;
uint32 version;
/* TS_LOGON_INFO_FIELD */ /* TS_LOGON_INFO_FIELD */
in_uint8s(s, 4); /* cbFieldData */ in_uint8s(s, 4); /* cbFieldData */
@ -1461,7 +1457,7 @@ process_pdu_logon(STREAM s)
if (len != 28) if (len != 28)
{ {
logger(Protocol, Error, logger(Protocol, Error,
"process_pdu_logon(), invalid length in Auto-Reconnect packet"); "process_ts_logon_info_extended(), invalid length in Auto-Reconnect packet");
return; return;
} }
@ -1469,7 +1465,7 @@ process_pdu_logon(STREAM s)
if (version != 1) if (version != 1)
{ {
logger(Protocol, Error, logger(Protocol, Error,
"process_pdu_logon(), unsupported version of Auto-Reconnect packet"); "process_ts_logon_info_extended(), unsupported version of Auto-Reconnect packet");
return; return;
} }
@ -1478,10 +1474,33 @@ process_pdu_logon(STREAM s)
g_has_reconnect_random = True; g_has_reconnect_random = True;
g_reconnect_random_ts = time(NULL); g_reconnect_random_ts = time(NULL);
logger(Protocol, Debug, logger(Protocol, Debug,
"process_pdu_logon(), saving Auto-Reconnect cookie, id=%u", "process_ts_logon_info_extended(), saving Auto-Reconnect cookie, id=%u",
g_reconnect_logonid); g_reconnect_logonid);
} }
} }
/* Process TS_SAVE_SESSION_INFO_PDU_DATA data structure */
void
process_pdu_logon(STREAM s)
{
uint32 infotype;
in_uint32_le(s, infotype);
switch(infotype)
{
case INFOTYPE_LOGON_PLAINNOTIFY: /* TS_PLAIN_NOTIFY */
logger(Protocol, Debug, "process_pdu_logon(), Received TS_LOGIN_PLAIN_NOTIFY");
in_uint8s(s, 576); /* pad */
break;
case INFOTYPE_LOGON_EXTENDED_INF: /* TS_LOGON_INFO_EXTENDED */
logger(Protocol, Debug, "process_pdu_logon(), Received TS_LOGIN_INFO_EXTENDED");
process_ts_logon_info_extended(s);
break;
default:
logger(Protocol, Warning, "process_pdu_logon(), Unhandled login infotype %d", infotype);
}
} }