core/server: only enable activated bitmap codecs

This commit is contained in:
Norbert Federa 2014-04-10 19:13:47 +02:00
parent afa4bde06c
commit 5db9d630de

View File

@ -2590,6 +2590,8 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
BYTE bitmapCodecCount; BYTE bitmapCodecCount;
UINT16 codecPropertiesLength; UINT16 codecPropertiesLength;
UINT16 remainingLength; UINT16 remainingLength;
BOOL receivedRemoteFxCodec = FALSE;
BOOL receivedNSCodec = FALSE;
if (length < 5) if (length < 5)
return FALSE; return FALSE;
@ -2597,13 +2599,6 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
Stream_Read_UINT8(s, bitmapCodecCount); /* bitmapCodecCount (1 byte) */ Stream_Read_UINT8(s, bitmapCodecCount); /* bitmapCodecCount (1 byte) */
remainingLength = length - 5; remainingLength = length - 5;
if (settings->ServerMode)
{
settings->RemoteFxCodec = FALSE;
settings->NSCodec = FALSE;
settings->JpegCodec = FALSE;
}
while (bitmapCodecCount > 0) while (bitmapCodecCount > 0)
{ {
if (remainingLength < 19) if (remainingLength < 19)
@ -2616,12 +2611,12 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
if (UuidEqual(&codecGuid, &CODEC_GUID_REMOTEFX, &rpc_status)) if (UuidEqual(&codecGuid, &CODEC_GUID_REMOTEFX, &rpc_status))
{ {
Stream_Read_UINT8(s, settings->RemoteFxCodecId); Stream_Read_UINT8(s, settings->RemoteFxCodecId);
settings->RemoteFxCodec = TRUE; receivedRemoteFxCodec = TRUE;
} }
else if (UuidEqual(&codecGuid, &CODEC_GUID_NSCODEC, &rpc_status)) else if (UuidEqual(&codecGuid, &CODEC_GUID_NSCODEC, &rpc_status))
{ {
Stream_Read_UINT8(s, settings->NSCodecId); Stream_Read_UINT8(s, settings->NSCodecId);
settings->NSCodec = TRUE; receivedNSCodec = TRUE;
} }
else else
{ {
@ -2660,6 +2655,14 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
bitmapCodecCount--; bitmapCodecCount--;
} }
if (settings->ServerMode)
{
/* only enable a codec if we've announced/enabled it before */
settings->RemoteFxCodec = settings->RemoteFxCodec && receivedRemoteFxCodec;
settings->NSCodec = settings->NSCodec && receivedNSCodec;
settings->JpegCodec = FALSE;
}
return TRUE; return TRUE;
} }