Add missing decryption.

This commit is contained in:
Pawel Jakub Dawidek 2012-01-25 16:30:54 +01:00
parent d37cff01ed
commit 86910c8401
3 changed files with 53 additions and 4 deletions

View File

@ -1922,9 +1922,24 @@ boolean rdp_recv_confirm_active(rdpRdp* rdp, STREAM* s)
uint16 lengthSourceDescriptor;
uint16 lengthCombinedCapabilities;
uint16 numberCapabilities;
uint16 securityFlags;
if (!rdp_read_header(rdp, s, &length, &channelId))
return false;
if (rdp->settings->encryption)
{
rdp_read_security_header(s, &securityFlags);
if (securityFlags & SEC_ENCRYPT)
{
if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
{
printf("rdp_decrypt failed\n");
return false;
}
}
}
if (channelId != MCS_GLOBAL_CHANNEL_ID)
return false;

View File

@ -564,15 +564,32 @@ boolean rdp_recv_client_info(rdpRdp* rdp, STREAM* s)
{
uint16 length;
uint16 channelId;
uint16 sec_flags;
uint16 securityFlags;
if (!rdp_read_header(rdp, s, &length, &channelId))
return false;
rdp_read_security_header(s, &sec_flags);
if ((sec_flags & SEC_INFO_PKT) == 0)
rdp_read_security_header(s, &securityFlags);
if ((securityFlags & SEC_INFO_PKT) == 0)
return false;
if (rdp->settings->encryption)
{
if (securityFlags & SEC_REDIRECTION_PKT)
{
printf("Error: SEC_REDIRECTION_PKT unsupported\n");
return false;
}
if (securityFlags & SEC_ENCRYPT)
{
if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
{
printf("rdp_decrypt failed\n");
return false;
}
}
}
return rdp_read_info_packet(s, rdp->settings);
}

View File

@ -112,18 +112,35 @@ static boolean peer_recv_data_pdu(freerdp_peer* client, STREAM* s)
static boolean peer_recv_tpkt_pdu(freerdp_peer* client, STREAM* s)
{
rdpRdp *rdp;
uint16 length;
uint16 pduType;
uint16 pduLength;
uint16 pduSource;
uint16 channelId;
uint16 securityFlags;
if (!rdp_read_header(client->context->rdp, s, &length, &channelId))
rdp = client->context->rdp;
if (!rdp_read_header(rdp, s, &length, &channelId))
{
printf("Incorrect RDP header.\n");
return false;
}
if (rdp->settings->encryption)
{
rdp_read_security_header(s, &securityFlags);
if (securityFlags & SEC_ENCRYPT)
{
if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
{
printf("rdp_decrypt failed\n");
return false;
}
}
}
if (channelId != MCS_GLOBAL_CHANNEL_ID)
{
freerdp_channel_peer_process(client, s, channelId);