libfreerdp-core: rdpSettings refactoring (part 4)

This commit is contained in:
Marc-André Moreau 2012-11-07 23:29:24 -05:00
parent 8544716104
commit 410b7ab867
26 changed files with 359 additions and 325 deletions

View File

@ -674,13 +674,13 @@ static rdpChannel* freerdp_channels_find_channel_by_id(rdpChannels* channels, rd
int lcount;
rdpChannel* lrdp_channel;
lcount = settings->num_channels;
lcount = settings->ChannelCount;
for (lindex = 0; lindex < lcount; lindex++)
{
lrdp_channel = settings->channels + lindex;
lrdp_channel = settings->ChannelDefArray + lindex;
if (lrdp_channel->channel_id == channel_id)
if (lrdp_channel->ChannelId == channel_id)
{
if (pindex != 0)
*pindex = lindex;
@ -700,13 +700,13 @@ static rdpChannel* freerdp_channels_find_channel_by_name(rdpChannels* channels,
int lcount;
rdpChannel* lrdp_channel;
lcount = settings->num_channels;
lcount = settings->ChannelCount;
for (lindex = 0; lindex < lcount; lindex++)
{
lrdp_channel = settings->channels + lindex;
lrdp_channel = settings->ChannelDefArray + lindex;
if (strcmp(channel_name, lrdp_channel->name) == 0)
if (strcmp(channel_name, lrdp_channel->Name) == 0)
{
if (pindex != 0)
*pindex = lindex;
@ -804,12 +804,12 @@ static UINT32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF
strncpy(lchannel_data->name, lchannel_def->name, CHANNEL_NAME_LEN);
lchannel_data->options = lchannel_def->options;
if (channels->settings->num_channels < 16)
if (channels->settings->ChannelCount < 16)
{
lrdp_channel = channels->settings->channels + channels->settings->num_channels;
strncpy(lrdp_channel->name, lchannel_def->name, 7);
lrdp_channel = channels->settings->ChannelDefArray + channels->settings->ChannelCount;
strncpy(lrdp_channel->Name, lchannel_def->name, 7);
lrdp_channel->options = lchannel_def->options;
channels->settings->num_channels++;
channels->settings->ChannelCount++;
}
else
{
@ -1166,7 +1166,7 @@ int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, c
{
void* entry;
DEBUG_CHANNELS("%s", name);
DEBUG_CHANNELS("%s", Name);
entry = (PVIRTUALCHANNELENTRY) freerdp_load_plugin(name, CHANNEL_EXPORT_FUNC_NAME);
@ -1284,7 +1284,7 @@ int freerdp_channels_data(freerdp* instance, int channel_id, void* data, int dat
return 1;
}
lchannel_data = freerdp_channels_find_channel_data_by_name(channels, lrdp_channel->name, &index);
lchannel_data = freerdp_channels_find_channel_data_by_name(channels, lrdp_channel->Name, &index);
if (lchannel_data == 0)
{
@ -1335,7 +1335,7 @@ FREERDP_API int freerdp_channels_send_event(rdpChannels* channels, RDP_EVENT* ev
if (lchannel_data == NULL)
{
DEBUG_CHANNELS("could not find channel name %s", name);
DEBUG_CHANNELS("could not find channel name %s", Name);
freerdp_event_free(event);
return 1;
}
@ -1372,7 +1372,7 @@ static void freerdp_channels_process_sync(rdpChannels* channels, freerdp* instan
lchannel_data->name, &item->Index);
if (lrdp_channel != NULL)
instance->SendChannelData(instance, lrdp_channel->channel_id, item->Data, item->DataLength);
instance->SendChannelData(instance, lrdp_channel->ChannelId, item->Data, item->DataLength);
if (lchannel_data->open_event_proc != 0)
{

View File

@ -174,12 +174,12 @@ static void wts_read_drdynvc_create_response(rdpPeerChannel* channel, STREAM* s,
if ((INT32) CreationStatus < 0)
{
DEBUG_DVC("ChannelId %d creation failed (%d)", channel->channel_id, (INT32)CreationStatus);
DEBUG_DVC("ChannelId %d creation failed (%d)", channel->ChannelId, (INT32)CreationStatus);
channel->dvc_open_state = DVC_OPEN_STATE_FAILED;
}
else
{
DEBUG_DVC("ChannelId %d creation succeeded", channel->channel_id);
DEBUG_DVC("ChannelId %d creation succeeded", channel->ChannelId);
channel->dvc_open_state = DVC_OPEN_STATE_SUCCEEDED;
}
wait_obj_set(channel->receive_event);
@ -231,7 +231,7 @@ static void wts_read_drdynvc_data(rdpPeerChannel* channel, STREAM* s, UINT32 len
static void wts_read_drdynvc_close_response(rdpPeerChannel* channel)
{
DEBUG_DVC("ChannelId %d close response", channel->channel_id);
DEBUG_DVC("ChannelId %d close response", channel->ChannelId);
channel->dvc_open_state = DVC_OPEN_STATE_CLOSED;
}
@ -388,14 +388,14 @@ static int WTSReceiveChannelData(freerdp_peer* client, int channelId, BYTE* data
BOOL result = FALSE;
rdpPeerChannel* channel;
for (i = 0; i < client->settings->num_channels; i++)
for (i = 0; i < client->settings->ChannelCount; i++)
{
if (client->settings->channels[i].channel_id == channelId)
if (client->settings->ChannelDefArray[i].ChannelId == channelId)
break;
}
if (i < client->settings->num_channels)
if (i < client->settings->ChannelCount)
{
channel = (rdpPeerChannel*) client->settings->channels[i].handle;
channel = (rdpPeerChannel*) client->settings->ChannelDefArray[i].handle;
if (channel != NULL)
{
@ -554,7 +554,7 @@ void* WTSVirtualChannelOpenEx(
WTSVirtualChannelWrite(vcm->drdynvc_channel, stream_get_head(s), stream_get_length(s), NULL);
stream_free(s);
DEBUG_DVC("ChannelId %d.%s (total %d)", channel->channel_id, pVirtualName, list_size(vcm->dvc_channel_list));
DEBUG_DVC("ChannelId %d.%s (total %d)", channel->ChannelId, pVirtualName, list_size(vcm->dvc_channel_list));
}
else
{
@ -563,26 +563,26 @@ void* WTSVirtualChannelOpenEx(
if (len > 8)
return NULL;
for (i = 0; i < client->settings->num_channels; i++)
for (i = 0; i < client->settings->ChannelCount; i++)
{
if (client->settings->channels[i].joined &&
strncmp(client->settings->channels[i].name, pVirtualName, len) == 0)
if (client->settings->ChannelDefArray[i].joined &&
strncmp(client->settings->ChannelDefArray[i].Name, pVirtualName, len) == 0)
{
break;
}
}
if (i >= client->settings->num_channels)
if (i >= client->settings->ChannelCount)
return NULL;
channel = (rdpPeerChannel*) client->settings->channels[i].handle;
channel = (rdpPeerChannel*) client->settings->ChannelDefArray[i].handle;
if (channel == NULL)
{
channel = xnew(rdpPeerChannel);
channel->vcm = vcm;
channel->client = client;
channel->channel_id = client->settings->channels[i].channel_id;
channel->channel_id = client->settings->ChannelDefArray[i].ChannelId;
channel->index = i;
channel->channel_type = RDP_PEER_CHANNEL_TYPE_SVC;
channel->receive_data = stream_new(client->settings->VirtualChannelChunkSize);
@ -590,7 +590,7 @@ void* WTSVirtualChannelOpenEx(
channel->receive_queue = list_new();
channel->mutex = CreateMutex(NULL, FALSE, NULL);
client->settings->channels[i].handle = channel;
client->settings->ChannelDefArray[i].handle = channel;
}
}
@ -791,8 +791,8 @@ BOOL WTSVirtualChannelClose(
if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC)
{
if (channel->index < channel->client->settings->num_channels)
channel->client->settings->channels[channel->index].handle = NULL;
if (channel->index < channel->client->settings->ChannelCount)
channel->client->settings->ChannelDefArray[channel->index].handle = NULL;
}
else
{

View File

@ -105,15 +105,15 @@ BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings)
}
#endif
settings->num_monitors = vscreen->nmonitors;
settings->MonitorCount = vscreen->nmonitors;
for (i = 0; i < vscreen->nmonitors; i++)
{
settings->monitors[i].x = vscreen->monitors[i].area.left;
settings->monitors[i].y = vscreen->monitors[i].area.top;
settings->monitors[i].width = vscreen->monitors[i].area.right - vscreen->monitors[i].area.left + 1;
settings->monitors[i].height = vscreen->monitors[i].area.bottom - vscreen->monitors[i].area.top + 1;
settings->monitors[i].is_primary = vscreen->monitors[i].primary;
settings->MonitorDefArray[i].x = vscreen->monitors[i].area.left;
settings->MonitorDefArray[i].y = vscreen->monitors[i].area.top;
settings->MonitorDefArray[i].width = vscreen->monitors[i].area.right - vscreen->monitors[i].area.left + 1;
settings->MonitorDefArray[i].height = vscreen->monitors[i].area.bottom - vscreen->monitors[i].area.top + 1;
settings->MonitorDefArray[i].is_primary = vscreen->monitors[i].primary;
vscreen->area.left = MIN(vscreen->monitors[i].area.left, vscreen->area.left);
vscreen->area.right = MAX(vscreen->monitors[i].area.right, vscreen->area.right);
@ -122,7 +122,7 @@ BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings)
}
/* if no monitor information is present then make sure variables are set accordingly */
if (settings->num_monitors == 0)
if (settings->MonitorCount == 0)
{
vscreen->area.left = 0;
vscreen->area.right = settings->DesktopWidth -1;
@ -131,7 +131,7 @@ BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings)
}
if (settings->num_monitors)
if (settings->MonitorCount)
{
settings->DesktopWidth = vscreen->area.right - vscreen->area.left + 1;
settings->DesktopHeight = vscreen->area.bottom - vscreen->area.top + 1;

View File

@ -467,8 +467,8 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
settings->TlsSecurity = FALSE;
settings->NlaSecurity = FALSE;
settings->ExtSecurity = FALSE;
settings->Encryption = TRUE;
settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->DisableEncryption = TRUE;
settings->EncryptionMethods = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
}
else if (strcmp("tls", arg->Value) == 0) /* TLS */

View File

@ -156,8 +156,8 @@ void test_gcc_write_client_security_data(void)
s = stream_new(12);
settings = settings_new(NULL);
settings->Encryption = 1; /* turn on encryption */
settings->EncryptionMethod =
settings->DisableEncryption = 1; /* turn on encryption */
settings->EncryptionMethods =
ENCRYPTION_METHOD_40BIT |
ENCRYPTION_METHOD_56BIT |
ENCRYPTION_METHOD_128BIT |
@ -197,17 +197,17 @@ void test_gcc_write_client_network_data(void)
s = stream_new(44);
settings = settings_new(NULL);
settings->num_channels = 3;
memset(settings->channels, 0, sizeof(rdpChannel) * settings->num_channels);
settings->ChannelCount = 3;
memset(settings->ChannelDefArray, 0, sizeof(rdpChannel) * settings->ChannelCount);
strcpy(settings->channels[0].name, "rdpdr");
settings->channels[0].options = 0x80800000;
strcpy(settings->ChannelDefArray[0].Name, "rdpdr");
settings->ChannelDefArray[0].options = 0x80800000;
strcpy(settings->channels[1].name, "cliprdr");
settings->channels[1].options = 0xc0A00000;
strcpy(settings->ChannelDefArray[1].Name, "cliprdr");
settings->ChannelDefArray[1].options = 0xc0A00000;
strcpy(settings->channels[2].name, "rdpsnd");
settings->channels[2].options = 0xc0000000;
strcpy(settings->ChannelDefArray[2].Name, "rdpsnd");
settings->ChannelDefArray[2].options = 0xc0000000;
gcc_write_client_network_data(s, settings);

View File

@ -46,23 +46,6 @@ enum RDP_SVC_CHANNEL_FLAG
CHANNEL_FLAG_FAIL = 0x100
};
/**
* Static Virtual Channel Options
*/
enum RDP_SVC_CHANNEL_OPTION
{
CHANNEL_OPTION_SHOW_PROTOCOL = 0x00200000,
CHANNEL_OPTION_COMPRESS = 0x00400000,
CHANNEL_OPTION_COMPRESS_RDP = 0x00800000,
CHANNEL_OPTION_PRI_LOW = 0x02000000,
CHANNEL_OPTION_PRI_MED = 0x04000000,
CHANNEL_OPTION_PRI_HIGH = 0x08000000,
CHANNEL_OPTION_ENCRYPT_CS = 0x10000000,
CHANNEL_OPTION_ENCRYPT_SC = 0x20000000,
CHANNEL_OPTION_ENCRYPT_RDP = 0x40000000,
CHANNEL_OPTION_INITIALIZED = 0x80000000
};
/**
* Static Virtual Channel Events
*/

View File

@ -18,8 +18,8 @@
* limitations under the License.
*/
#ifndef __RDP_SETTINGS_H
#define __RDP_SETTINGS_H
#ifndef FREERDP_SETTINGS_H
#define FREERDP_SETTINGS_H
#include <freerdp/types.h>
@ -41,6 +41,71 @@
#define CONNECTION_TYPE_BROADBAND_HIGH 0x04
#define CONNECTION_TYPE_WAN 0x05
#define CONNECTION_TYPE_LAN 0x06
#define CONNECTION_TYPE_AUTODETECT 0x07
/* Client to Server (CS) data blocks */
#define CS_CORE 0xC001
#define CS_SECURITY 0xC002
#define CS_NET 0xC003
#define CS_CLUSTER 0xC004
#define CS_MONITOR 0xC005
#define CS_MCS_MSGCHANNEL 0xC006
#define CS_MULTITRANSPORT 0xC008
/* Server to Client (SC) data blocks */
#define SC_CORE 0x0C01
#define SC_SECURITY 0x0C02
#define SC_NET 0x0C03
#define SC_MULTITRANSPORT 0x0C06
/* RDP version */
#define RDP_VERSION_4 0x00080001
#define RDP_VERSION_5_PLUS 0x00080004
/* Color depth */
#define RNS_UD_COLOR_4BPP 0xCA00
#define RNS_UD_COLOR_8BPP 0xCA01
#define RNS_UD_COLOR_16BPP_555 0xCA02
#define RNS_UD_COLOR_16BPP_565 0xCA03
#define RNS_UD_COLOR_24BPP 0xCA04
/* Secure Access Sequence */
#define RNS_UD_SAS_DEL 0xAA03
/* Supported Color Depths */
#define RNS_UD_24BPP_SUPPORT 0x0001
#define RNS_UD_16BPP_SUPPORT 0x0002
#define RNS_UD_15BPP_SUPPORT 0x0004
#define RNS_UD_32BPP_SUPPORT 0x0008
/* Early Capability Flags (Client to Server) */
#define RNS_UD_CS_SUPPORT_ERRINFO_PDU 0x0001
#define RNS_UD_CS_WANT_32BPP_SESSION 0x0002
#define RNS_UD_CS_SUPPORT_STATUSINFO_PDU 0x0004
#define RNS_UD_CS_STRONG_ASYMMETRIC_KEYS 0x0008
#define RNS_UD_CS_VALID_CONNECTION_TYPE 0x0020
#define RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU 0x0040
#define RNS_UD_CS_SUPPORT_NETWORK_AUTODETECT 0x0080
#define RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL 0x0100
#define RNS_UD_CS_SUPPORT_DYNAMIC_TIME_ZONE 0x0200
/* Early Capability Flags (Server to Client) */
#define RNS_UD_SC_EDGE_ACTIONS_SUPPORTED 0x00000001
#define RNS_UD_SC_DYNAMIC_DST_SUPPORTED 0x00000002
/* Cluster Information Flags */
#define REDIRECTION_SUPPORTED 0x00000001
#define REDIRECTED_SESSIONID_FIELD_VALID 0x00000002
#define REDIRECTED_SMARTCARD 0x00000040
#define REDIRECTION_VERSION1 0x00
#define REDIRECTION_VERSION2 0x01
#define REDIRECTION_VERSION3 0x02
#define REDIRECTION_VERSION4 0x03
#define REDIRECTION_VERSION5 0x04
#define REDIRECTION_VERSION6 0x05
#define MONITOR_PRIMARY 0x00000001
/* Encryption Methods */
#define ENCRYPTION_METHOD_NONE 0x00000000
@ -56,6 +121,24 @@
#define ENCRYPTION_LEVEL_HIGH 0x00000003
#define ENCRYPTION_LEVEL_FIPS 0x00000004
/* Multitransport Types */
#define TRANSPORT_TYPE_UDP_FECR 0x00000001
#define TRANSPORT_TYPE_UDP_FECL 0x00000004
#define TRANSPORT_TYPE_UDP_PREFERRED 0x00000100
/* Static Virtual Channel Options */
#define CHANNEL_OPTION_INITIALIZED 0x80000000
#define CHANNEL_OPTION_ENCRYPT_RDP 0x40000000
#define CHANNEL_OPTION_ENCRYPT_SC 0x20000000
#define CHANNEL_OPTION_ENCRYPT_CS 0x10000000
#define CHANNEL_OPTION_PRI_HIGH 0x08000000
#define CHANNEL_OPTION_PRI_MED 0x04000000
#define CHANNEL_OPTION_PRI_LOW 0x02000000
#define CHANNEL_OPTION_COMPRESS_RDP 0x00800000
#define CHANNEL_OPTION_COMPRESS 0x00400000
#define CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000
#define CHANNEL_REMOTE_CONTROL_PERSISTENT 0x00100000
/* Auto Reconnect Version */
#define AUTO_RECONNECT_VERSION_1 0x00000001
@ -188,7 +271,7 @@ struct rdp_certificate
};
typedef struct rdp_certificate rdpCertificate;
struct rdp_key
struct rdp_rsa_key
{
BYTE* Modulus;
DWORD ModulusLength;
@ -196,24 +279,17 @@ struct rdp_key
DWORD PrivateExponentLength;
BYTE exponent[4];
};
typedef struct rdp_key rdpKey;
typedef struct rdp_rsa_key rdpRsaKey;
/* Channels */
struct _RDPDR_DRIVE
{
char* name;
char* path;
};
typedef struct _RDPDR_DRIVE RDPDR_DRIVE;
struct rdp_channel
{
char name[8]; /* ui sets */
int options; /* ui sets */
int channel_id; /* core sets */
BOOL joined; /* client has joined the channel */
void* handle; /* just for ui */
char Name[8];
UINT32 options;
int ChannelId;
BOOL joined;
void* handle;
};
typedef struct rdp_channel rdpChannel;
@ -254,12 +330,13 @@ typedef struct _GLYPH_CACHE_DEFINITION GLYPH_CACHE_DEFINITION;
struct rdp_monitor
{
int x;
int y;
int width;
int height;
int is_primary;
INT32 x;
INT32 y;
INT32 width;
INT32 height;
UINT32 is_primary;
};
typedef struct rdp_monitor rdpMonitor;
/* Settings */
@ -278,26 +355,67 @@ struct rdp_settings
ALIGN64 void* instance; /* 0 */
UINT64 padding001[16 - 1]; /* 1 */
/**
* Section: Core
*/
/* Core Parameters */
ALIGN64 BOOL ServerMode; /* 16 */
ALIGN64 UINT32 ShareId; /* 17 */
ALIGN64 UINT32 PduSource; /* 18 */
ALIGN64 UINT32 RdpVersion; /* 19 */
ALIGN64 UINT32 DesktopWidth; /* 20 */
ALIGN64 UINT32 DesktopHeight; /* 21 */
ALIGN64 UINT32 ColorDepth; /* 22 */
ALIGN64 UINT32 ClientBuild; /* 28 */
ALIGN64 char* ClientName; /* 29 */
ALIGN64 char* ClientDigProductId; /* 30 */
UINT64 padding0064[64 - 31]; /* 31 */
ALIGN64 UINT32 ServerPort; /* 19 */
ALIGN64 char* ServerHostname; /* 20 */
UINT64 padding0064[64 - 21]; /* 21 */
UINT64 padding0128[128 - 64]; /* 64 */
/* Server Info */
ALIGN64 UINT32 ServerPort; /* 65 */
ALIGN64 char* ServerHostname; /* 66 */
/**
* GCC User Data Blocks
*/
/* Client/Server Core Data */
ALIGN64 UINT32 RdpVersion; /* 128 */
ALIGN64 UINT32 DesktopWidth; /* 129 */
ALIGN64 UINT32 DesktopHeight; /* 130 */
ALIGN64 UINT32 ColorDepth; /* 131 */
ALIGN64 UINT32 ConnectionType; /* 132 */
ALIGN64 UINT32 ClientBuild; /* 133 */
ALIGN64 char* ClientName; /* 134 */
ALIGN64 char* ClientDigProductId; /* 135 */
ALIGN64 UINT32 EarlyCapabilitiesFlag; /* 136 */
ALIGN64 BOOL NetworkAutoDetect; /* 137 */
ALIGN64 BOOL SupportAsymetricKeys; /* 138 */
ALIGN64 BOOL SupportErrorInfoPdu; /* 139 */
ALIGN64 BOOL SupportStatusInfoPdu; /* 140 */
ALIGN64 BOOL SupportMonitorLayoutPdu; /* 141 */
ALIGN64 BOOL SupportGraphicsPipeline; /* 142 */
ALIGN64 BOOL SupportDynamicTimeZone; /* 143 */
UINT64 padding0192[192 - 143]; /* 143 */
/* Client/Server Security Data */
ALIGN64 BOOL DisableEncryption; /* 192 */
ALIGN64 UINT32 EncryptionMethods; /* 193 */
ALIGN64 UINT32 ExtEncryptionMethods; /* 194 */
ALIGN64 UINT32 EncryptionLevel; /* 195 */
ALIGN64 BYTE* ServerRandom; /* 196 */
ALIGN64 DWORD ServerRandomLength; /* 197 */
ALIGN64 BYTE* ServerCertificate; /* 198 */
ALIGN64 DWORD ServerCertificateLength; /* 199 */
UINT64 padding0256[256 - 200]; /* 200 */
/* Client Network Data */
ALIGN64 UINT32 ChannelCount;
ALIGN64 UINT32 ChannelDefArraySize;
ALIGN64 rdpChannel ChannelDefArray[16];
/* Client Cluster Data */
ALIGN64 UINT32 ClusterInfoFlags; /* 162 */
ALIGN64 UINT32 RedirectedSessionId; /* 162 */
/* Client Monitor Data */
ALIGN64 int MonitorCount;
ALIGN64 UINT32 MonitorDefArraySize;
ALIGN64 rdpMonitor MonitorDefArray[16];
/* Client Message Channel Data */
/* Client Multitransport Channel Data */
ALIGN64 UINT32 MultitransportFlags;
/* Client Info */
ALIGN64 char* Username; /* 67 */
@ -305,7 +423,7 @@ struct rdp_settings
ALIGN64 char* Domain; /* 69 */
ALIGN64 char* AlternateShell; /* 54 */
ALIGN64 char* ShellWorkingDirectory; /* 55 */
UINT64 padding0128[128 - 70]; /* 70 */
UINT64 padding1128[128 - 70]; /* 70 */
/* Client Info Flags */
ALIGN64 BOOL AutoLogonEnabled; /* 58 */
@ -347,9 +465,17 @@ struct rdp_settings
ALIGN64 DWORD Password51Length; /* 775 */
UINT64 padding0832[832 - 776]; /* 776 */
/* Server Certificate */
ALIGN64 BOOL IgnoreCertificate; /* 256 */
ALIGN64 char* CertificateName; /* 257 */
ALIGN64 char* CertificateFile; /* 258 */
ALIGN64 char* PrivateKeyFile; /* 259 */
ALIGN64 char* RdpKeyFile; /* 260 */
ALIGN64 rdpRsaKey* RdpServerRsaKey; /* 261 */
ALIGN64 rdpCertificate* RdpServerCertificate; /* 262 */
/* Performance Flags */
ALIGN64 UINT32 PerformanceFlags; /* 128 */
ALIGN64 UINT32 ConnectionType; /* 129 */
ALIGN64 BOOL AllowFontSmoothing; /* 130 */
ALIGN64 BOOL DisableWallpaper; /* 131 */
ALIGN64 BOOL DisableFullWindowDrag; /* 132 */
@ -358,16 +484,15 @@ struct rdp_settings
ALIGN64 BOOL DisableCursorShadow; /* 135 */
ALIGN64 BOOL DisableCursorBlinking; /* 136 */
ALIGN64 BOOL AllowDesktopComposition; /* 137 */
UINT64 padding0192[192 - 138]; /* 138 */
UINT64 padding1192[192 - 138]; /* 138 */
/* Protocol Security */
ALIGN64 BOOL TlsSecurity; /* 192 */
ALIGN64 BOOL NlaSecurity; /* 193 */
ALIGN64 BOOL RdpSecurity; /* 194 */
ALIGN64 BOOL ExtSecurity; /* 195 */
ALIGN64 BOOL Encryption; /* 196 */
ALIGN64 BOOL Authentication; /* 197 */
UINT64 padding0256[256 - 198]; /* 198 */
UINT64 padding1256[256 - 198]; /* 198 */
/* Connection Cookie */
ALIGN64 BOOL MstscCookieMode; /* 256 */
@ -380,8 +505,6 @@ struct rdp_settings
/* Protocol Security Negotiation */
ALIGN64 UINT32 RequestedProtocols; /* 320 */
ALIGN64 UINT32 SelectedProtocol; /* 321 */
ALIGN64 UINT32 EncryptionMethod; /* 322 */
ALIGN64 UINT32 EncryptionLevel; /* 323 */
ALIGN64 UINT32 NegotiationFlags; /* 324 */
ALIGN64 BOOL NegotiateSecurityLayer; /* 325 */
UINT64 padding0384[384 - 326]; /* 326 */
@ -540,7 +663,6 @@ struct rdp_settings
/* Session */
ALIGN64 BOOL ConsoleSession; /* 161 */
ALIGN64 UINT32 RedirectedSessionId; /* 162 */
UINT64 padding007[176 - 165]; /* 165 */
/* Kerberos Authentication */
@ -550,18 +672,6 @@ struct rdp_settings
/* Certificate */
ALIGN64 char* ClientHostname; /* 250 */
ALIGN64 char* ClientProductId; /* 251 */
ALIGN64 BYTE* ServerRandom; /* 252 */
ALIGN64 DWORD ServerRandomLength; /* 253 */
ALIGN64 BYTE* ServerCertificate; /* 254 */
ALIGN64 DWORD ServerCertificateLength; /* 255 */
ALIGN64 BOOL IgnoreCertificate; /* 256 */
ALIGN64 char* CertificateName; /* 260 */
ALIGN64 char* CertificateFile; /* 248 */
ALIGN64 char* PrivateKeyFile; /* 249 */
ALIGN64 rdpCertificate* ServerCert; /* 257 */
ALIGN64 char* RdpKeyFile; /* 258 */
ALIGN64 rdpKey* ServerKey; /* 259 */
ALIGN64 BOOL LocalConnection; /* 69 */
ALIGN64 BOOL AuthenticationOnly; /* 70 */
@ -640,14 +750,6 @@ struct rdp_settings
ALIGN64 char* PlayRemoteFxFile; /* 299 */
UINT64 padding014[312 - 300]; /* 300 */
/* Channels */
ALIGN64 int num_channels;
ALIGN64 rdpChannel channels[16];
/* Monitors */
ALIGN64 int num_monitors;
ALIGN64 struct rdp_monitor monitors[16];
/* Extensions */
ALIGN64 int num_extensions;
ALIGN64 struct rdp_ext_set extensions[16];
@ -657,4 +759,4 @@ typedef struct rdp_settings rdpSettings;
rdpSettings* settings_new(void* instance);
void settings_free(rdpSettings* settings);
#endif /* __RDP_SETTINGS_H */
#endif /* FREERDP_SETTINGS_H */

View File

@ -1861,7 +1861,7 @@ BOOL rdp_recv_demand_active(rdpRdp* rdp, STREAM* s)
if (rdp->disconnect)
return TRUE;
if (rdp->settings->Encryption)
if (rdp->settings->DisableEncryption)
{
rdp_read_security_header(s, &securityFlags);
if (securityFlags & SEC_ENCRYPT)
@ -1996,7 +1996,7 @@ BOOL rdp_recv_confirm_active(rdpRdp* rdp, STREAM* s)
if (!rdp_read_header(rdp, s, &length, &channelId))
return FALSE;
if (rdp->settings->Encryption)
if (rdp->settings->DisableEncryption)
{
rdp_read_security_header(s, &securityFlags);
if (securityFlags & SEC_ENCRYPT)

View File

@ -493,13 +493,13 @@ BOOL certificate_read_server_certificate(rdpCertificate* certificate, BYTE* serv
return TRUE;
}
rdpKey* key_new(const char* keyfile)
rdpRsaKey* key_new(const char* keyfile)
{
FILE* fp;
RSA* rsa;
rdpKey* key;
rdpRsaKey* key;
key = (rdpKey*) xzalloc(sizeof(rdpKey));
key = (rdpRsaKey*) xzalloc(sizeof(rdpRsaKey));
if (key == NULL)
return NULL;
@ -571,7 +571,7 @@ rdpKey* key_new(const char* keyfile)
return key;
}
void key_free(rdpKey* key)
void key_free(rdpRsaKey* key)
{
if (key != NULL)
{

View File

@ -54,8 +54,8 @@ BOOL certificate_read_server_certificate(rdpCertificate* certificate, BYTE* serv
rdpCertificate* certificate_new();
void certificate_free(rdpCertificate* certificate);
rdpKey* key_new(const char *keyfile);
void key_free(rdpKey* key);
rdpRsaKey* key_new(const char *keyfile);
void key_free(rdpRsaKey* key);
#ifdef WITH_DEBUG_CERTIFICATE
#define DEBUG_CERTIFICATE(fmt, ...) DEBUG_CLASS(CERTIFICATE, fmt, ## __VA_ARGS__)

View File

@ -42,11 +42,11 @@ BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channel_id, BYTE* data, int size)
int chunk_size;
rdpChannel* channel = NULL;
for (i = 0; i < rdp->settings->num_channels; i++)
for (i = 0; i < rdp->settings->ChannelCount; i++)
{
if (rdp->settings->channels[i].channel_id == channel_id)
if (rdp->settings->ChannelDefArray[i].ChannelId == channel_id)
{
channel = &rdp->settings->channels[i];
channel = &rdp->settings->ChannelDefArray[i];
break;
}
}

View File

@ -255,7 +255,7 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
UINT32 length;
STREAM* s;
if (rdp->settings->Encryption == FALSE)
if (rdp->settings->DisableEncryption == FALSE)
{
/* no RDP encryption */
return TRUE;
@ -264,19 +264,22 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
/* encrypt client random */
memset(crypt_client_random, 0, sizeof(crypt_client_random));
crypto_nonce(client_random, sizeof(client_random));
key_len = rdp->settings->ServerCert->cert_info.ModulusLength;
mod = rdp->settings->ServerCert->cert_info.Modulus;
exp = rdp->settings->ServerCert->cert_info.exponent;
key_len = rdp->settings->RdpServerCertificate->cert_info.ModulusLength;
mod = rdp->settings->RdpServerCertificate->cert_info.Modulus;
exp = rdp->settings->RdpServerCertificate->cert_info.exponent;
crypto_rsa_public_encrypt(client_random, sizeof(client_random), key_len, mod, exp, crypt_client_random);
/* send crypt client random to server */
length = RDP_PACKET_HEADER_MAX_LENGTH + RDP_SECURITY_HEADER_LENGTH + 4 + key_len + 8;
s = transport_send_stream_init(rdp->mcs->transport, length);
rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID);
rdp_write_security_header(s, SEC_EXCHANGE_PKT);
length = key_len + 8;
stream_write_UINT32(s, length);
stream_write(s, crypt_client_random, length);
if (transport_write(rdp->mcs->transport, s) < 0)
{
return FALSE;
@ -292,7 +295,7 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
if (rdp->settings->SaltedChecksum)
rdp->do_secure_checksum = TRUE;
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
{
BYTE fips_ivec[8] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
rdp->fips_encrypt = crypto_des3_encrypt_init(rdp->fips_encrypt_key, fips_ivec);
@ -317,7 +320,7 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, STREAM* s)
BYTE* mod;
BYTE* priv_exp;
if (rdp->settings->Encryption == FALSE)
if (rdp->settings->DisableEncryption == FALSE)
{
/* No RDP Security. */
return TRUE;
@ -338,7 +341,7 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, STREAM* s)
}
stream_read_UINT32(s, rand_len);
key_len = rdp->settings->ServerKey->ModulusLength;
key_len = rdp->settings->RdpServerRsaKey->ModulusLength;
if (rand_len != key_len + 8)
{
@ -350,8 +353,8 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, STREAM* s)
stream_read(s, crypt_client_random, rand_len);
/* 8 zero bytes of padding */
stream_seek(s, 8);
mod = rdp->settings->ServerKey->Modulus;
priv_exp = rdp->settings->ServerKey->PrivateExponent;
mod = rdp->settings->RdpServerRsaKey->Modulus;
priv_exp = rdp->settings->RdpServerRsaKey->PrivateExponent;
crypto_rsa_private_decrypt(crypt_client_random, rand_len - 8, key_len, mod, priv_exp, client_random);
/* now calculate encrypt / decrypt and update keys */
@ -364,7 +367,7 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, STREAM* s)
if (rdp->settings->SaltedChecksum)
rdp->do_secure_checksum = TRUE;
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
{
BYTE fips_ivec[8] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
rdp->fips_encrypt = crypto_des3_encrypt_init(rdp->fips_encrypt_key, fips_ivec);
@ -436,9 +439,9 @@ BOOL rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s)
return FALSE;
rdp->mcs->global_channel_joined = TRUE;
if (rdp->settings->num_channels > 0)
if (rdp->settings->ChannelCount > 0)
{
if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->channels[0].channel_id))
if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->ChannelDefArray[0].ChannelId))
return FALSE;
all_joined = FALSE;
@ -446,20 +449,20 @@ BOOL rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s)
}
else
{
for (i = 0; i < rdp->settings->num_channels; i++)
for (i = 0; i < rdp->settings->ChannelCount; i++)
{
if (rdp->settings->channels[i].joined)
if (rdp->settings->ChannelDefArray[i].joined)
continue;
if (rdp->settings->channels[i].channel_id != channel_id)
if (rdp->settings->ChannelDefArray[i].ChannelId != channel_id)
return FALSE;
rdp->settings->channels[i].joined = TRUE;
rdp->settings->ChannelDefArray[i].joined = TRUE;
break;
}
if (i + 1 < rdp->settings->num_channels)
if (i + 1 < rdp->settings->ChannelCount)
{
if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->channels[i + 1].channel_id))
if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->ChannelDefArray[i + 1].ChannelId))
return FALSE;
all_joined = FALSE;
@ -639,9 +642,9 @@ BOOL rdp_server_accept_mcs_connect_initial(rdpRdp* rdp, STREAM* s)
printf("Accepted client: %s\n", rdp->settings->ClientHostname);
printf("Accepted channels:");
for (i = 0; i < rdp->settings->num_channels; i++)
for (i = 0; i < rdp->settings->ChannelCount; i++)
{
printf(" %s", rdp->settings->channels[i].name);
printf(" %s", rdp->settings->ChannelDefArray[i].Name);
}
printf("\n");
@ -693,12 +696,12 @@ BOOL rdp_server_accept_mcs_channel_join_request(rdpRdp* rdp, STREAM* s)
else if (channel_id == MCS_GLOBAL_CHANNEL_ID)
rdp->mcs->global_channel_joined = TRUE;
for (i = 0; i < rdp->settings->num_channels; i++)
for (i = 0; i < rdp->settings->ChannelCount; i++)
{
if (rdp->settings->channels[i].channel_id == channel_id)
rdp->settings->channels[i].joined = TRUE;
if (rdp->settings->ChannelDefArray[i].ChannelId == channel_id)
rdp->settings->ChannelDefArray[i].joined = TRUE;
if (!rdp->settings->channels[i].joined)
if (!rdp->settings->ChannelDefArray[i].joined)
all_joined = FALSE;
}

View File

@ -537,7 +537,7 @@ static UINT32 fastpath_get_sec_bytes(rdpRdp* rdp)
if (rdp->do_crypt)
{
sec_bytes = 8;
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
sec_bytes += 4;
}
else

View File

@ -760,11 +760,11 @@ BOOL gcc_read_client_security_data(STREAM* s, rdpSettings* settings, UINT16 bloc
if (blockLength < 8)
return FALSE;
if (settings->Encryption)
if (settings->DisableEncryption)
{
stream_read_UINT32(s, settings->EncryptionMethod); /* encryptionMethods */
if (settings->EncryptionMethod == 0)
stream_read_UINT32(s, settings->EncryptionMethod); /* extEncryptionMethods */
stream_read_UINT32(s, settings->EncryptionMethods); /* encryptionMethods */
if (settings->EncryptionMethods == 0)
stream_read_UINT32(s, settings->EncryptionMethods); /* extEncryptionMethods */
}
else
{
@ -784,16 +784,16 @@ void gcc_write_client_security_data(STREAM* s, rdpSettings* settings)
{
gcc_write_user_data_header(s, CS_SECURITY, 12);
if (settings->Encryption)
if (settings->DisableEncryption)
{
stream_write_UINT32(s, settings->EncryptionMethod); /* encryptionMethods */
stream_write_UINT32(s, settings->EncryptionMethods); /* encryptionMethods */
stream_write_UINT32(s, 0); /* extEncryptionMethods */
}
else
{
/* French locale, disable encryption */
stream_write_UINT32(s, 0); /* encryptionMethods */
stream_write_UINT32(s, settings->EncryptionMethod); /* extEncryptionMethods */
stream_write_UINT32(s, settings->EncryptionMethods); /* extEncryptionMethods */
}
}
@ -802,14 +802,14 @@ BOOL gcc_read_server_security_data(STREAM* s, rdpSettings* settings)
BYTE* data;
UINT32 length;
stream_read_UINT32(s, settings->EncryptionMethod); /* encryptionMethod */
stream_read_UINT32(s, settings->EncryptionMethods); /* encryptionMethod */
stream_read_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
if (settings->EncryptionMethod == 0 && settings->EncryptionLevel == 0)
if (settings->EncryptionMethods == 0 && settings->EncryptionLevel == 0)
{
/* serverRandom and serverRandom must not be present */
settings->Encryption = FALSE;
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->DisableEncryption = FALSE;
settings->EncryptionMethods = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
return TRUE;
}
@ -834,12 +834,12 @@ BOOL gcc_read_server_security_data(STREAM* s, rdpSettings* settings)
settings->ServerCertificate = (BYTE*) malloc(settings->ServerCertificateLength);
stream_read(s, settings->ServerCertificate, settings->ServerCertificateLength);
certificate_free(settings->ServerCert);
settings->ServerCert = certificate_new();
certificate_free(settings->RdpServerCertificate);
settings->RdpServerCertificate = certificate_new();
data = settings->ServerCertificate;
length = settings->ServerCertificateLength;
if (!certificate_read_server_certificate(settings->ServerCert, data, length))
if (!certificate_read_server_certificate(settings->RdpServerCertificate, data, length))
return FALSE;
}
else
@ -905,25 +905,25 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings)
BYTE signature[sizeof(initial_signature)];
UINT32 headerLen, serverRandomLen, serverCertLen, wPublicKeyBlobLen;
if (!settings->Encryption)
if (!settings->DisableEncryption)
{
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->EncryptionMethods = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
}
else if ((settings->EncryptionMethod & ENCRYPTION_METHOD_FIPS) != 0)
else if ((settings->EncryptionMethods & ENCRYPTION_METHOD_FIPS) != 0)
{
settings->EncryptionMethod = ENCRYPTION_METHOD_FIPS;
settings->EncryptionMethods = ENCRYPTION_METHOD_FIPS;
}
else if ((settings->EncryptionMethod & ENCRYPTION_METHOD_128BIT) != 0)
else if ((settings->EncryptionMethods & ENCRYPTION_METHOD_128BIT) != 0)
{
settings->EncryptionMethod = ENCRYPTION_METHOD_128BIT;
settings->EncryptionMethods = ENCRYPTION_METHOD_128BIT;
}
else if ((settings->EncryptionMethod & ENCRYPTION_METHOD_40BIT) != 0)
else if ((settings->EncryptionMethods & ENCRYPTION_METHOD_40BIT) != 0)
{
settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT;
settings->EncryptionMethods = ENCRYPTION_METHOD_40BIT;
}
if (settings->EncryptionMethod != ENCRYPTION_METHOD_NONE)
if (settings->EncryptionMethods != ENCRYPTION_METHOD_NONE)
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
headerLen = 12;
@ -932,13 +932,13 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings)
serverRandomLen = 0;
serverCertLen = 0;
if (settings->EncryptionMethod != ENCRYPTION_METHOD_NONE ||
if (settings->EncryptionMethods != ENCRYPTION_METHOD_NONE ||
settings->EncryptionLevel != ENCRYPTION_LEVEL_NONE)
{
serverRandomLen = 32;
keyLen = settings->ServerKey->ModulusLength;
expLen = sizeof(settings->ServerKey->exponent);
keyLen = settings->RdpServerRsaKey->ModulusLength;
expLen = sizeof(settings->RdpServerRsaKey->exponent);
wPublicKeyBlobLen = 4; /* magic (RSA1) */
wPublicKeyBlobLen += 4; /* keylen */
wPublicKeyBlobLen += 4; /* bitlen */
@ -966,10 +966,10 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings)
gcc_write_user_data_header(s, SC_SECURITY, headerLen);
stream_write_UINT32(s, settings->EncryptionMethod); /* encryptionMethod */
stream_write_UINT32(s, settings->EncryptionMethods); /* encryptionMethod */
stream_write_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
if (settings->EncryptionMethod == ENCRYPTION_METHOD_NONE &&
if (settings->EncryptionMethods == ENCRYPTION_METHOD_NONE &&
settings->EncryptionLevel == ENCRYPTION_LEVEL_NONE)
{
return;
@ -996,8 +996,8 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings)
stream_write_UINT32(s, keyLen * 8); /* bitlen */
stream_write_UINT32(s, keyLen - 1); /* datalen */
stream_write(s, settings->ServerKey->exponent, expLen);
stream_write(s, settings->ServerKey->Modulus, keyLen);
stream_write(s, settings->RdpServerRsaKey->exponent, expLen);
stream_write(s, settings->RdpServerRsaKey->Modulus, keyLen);
stream_write_zero(s, 8);
sigDataLen = stream_get_tail(s) - sigData;
@ -1032,19 +1032,19 @@ BOOL gcc_read_client_network_data(STREAM* s, rdpSettings* settings, UINT16 block
if (blockLength < 4)
return FALSE;
stream_read_UINT32(s, settings->num_channels); /* channelCount */
if (blockLength < 4 + settings->num_channels * 12)
stream_read_UINT32(s, settings->ChannelCount); /* channelCount */
if (blockLength < 4 + settings->ChannelCount * 12)
return FALSE;
if (settings->num_channels > 16)
if (settings->ChannelCount > 16)
return FALSE;
/* channelDefArray */
for (i = 0; i < settings->num_channels; i++)
for (i = 0; i < settings->ChannelCount; i++)
{
/* CHANNEL_DEF */
stream_read(s, settings->channels[i].name, 8); /* name (8 bytes) */
stream_read_UINT32(s, settings->channels[i].options); /* options (4 bytes) */
settings->channels[i].channel_id = MCS_GLOBAL_CHANNEL_ID + 1 + i;
stream_read(s, settings->ChannelDefArray[i].Name, 8); /* name (8 bytes) */
stream_read_UINT32(s, settings->ChannelDefArray[i].options); /* options (4 bytes) */
settings->ChannelDefArray[i].ChannelId = MCS_GLOBAL_CHANNEL_ID + 1 + i;
}
return TRUE;
@ -1062,19 +1062,19 @@ void gcc_write_client_network_data(STREAM* s, rdpSettings* settings)
int i;
UINT16 length;
if (settings->num_channels > 0)
if (settings->ChannelCount > 0)
{
length = settings->num_channels * 12 + 8;
length = settings->ChannelCount * 12 + 8;
gcc_write_user_data_header(s, CS_NET, length);
stream_write_UINT32(s, settings->num_channels); /* channelCount */
stream_write_UINT32(s, settings->ChannelCount); /* channelCount */
/* channelDefArray */
for (i = 0; i < settings->num_channels; i++)
for (i = 0; i < settings->ChannelCount; i++)
{
/* CHANNEL_DEF */
stream_write(s, settings->channels[i].name, 8); /* name (8 bytes) */
stream_write_UINT32(s, settings->channels[i].options); /* options (4 bytes) */
stream_write(s, settings->ChannelDefArray[i].Name, 8); /* name (8 bytes) */
stream_write_UINT32(s, settings->ChannelDefArray[i].options); /* options (4 bytes) */
}
}
}
@ -1089,16 +1089,16 @@ BOOL gcc_read_server_network_data(STREAM* s, rdpSettings* settings)
stream_read_UINT16(s, MCSChannelId); /* MCSChannelId */
stream_read_UINT16(s, channelCount); /* channelCount */
if (channelCount != settings->num_channels)
if (channelCount != settings->ChannelCount)
{
printf("requested %d channels, got %d instead\n",
settings->num_channels, channelCount);
settings->ChannelCount, channelCount);
}
for (i = 0; i < channelCount; i++)
{
stream_read_UINT16(s, channelId); /* channelId */
settings->channels[i].channel_id = channelId;
settings->ChannelDefArray[i].ChannelId = channelId;
}
if (channelCount % 2 == 1)
@ -1111,17 +1111,17 @@ void gcc_write_server_network_data(STREAM* s, rdpSettings* settings)
{
int i;
gcc_write_user_data_header(s, SC_NET, 8 + settings->num_channels * 2 + (settings->num_channels % 2 == 1 ? 2 : 0));
gcc_write_user_data_header(s, SC_NET, 8 + settings->ChannelCount * 2 + (settings->ChannelCount % 2 == 1 ? 2 : 0));
stream_write_UINT16(s, MCS_GLOBAL_CHANNEL_ID); /* MCSChannelId */
stream_write_UINT16(s, settings->num_channels); /* channelCount */
stream_write_UINT16(s, settings->ChannelCount); /* channelCount */
for (i = 0; i < settings->num_channels; i++)
for (i = 0; i < settings->ChannelCount; i++)
{
stream_write_UINT16(s, settings->channels[i].channel_id);
stream_write_UINT16(s, settings->ChannelDefArray[i].ChannelId);
}
if (settings->num_channels % 2 == 1)
if (settings->ChannelCount % 2 == 1)
stream_write_UINT16(s, 0);
}
@ -1195,21 +1195,21 @@ void gcc_write_client_monitor_data(STREAM* s, rdpSettings* settings)
UINT16 length;
UINT32 left, top, right, bottom, flags;
if (settings->num_monitors > 1)
if (settings->MonitorCount > 1)
{
length = (20 * settings->num_monitors) + 12;
length = (20 * settings->MonitorCount) + 12;
gcc_write_user_data_header(s, CS_MONITOR, length);
stream_write_UINT32(s, 0); /* flags */
stream_write_UINT32(s, settings->num_monitors); /* monitorCount */
stream_write_UINT32(s, settings->MonitorCount); /* monitorCount */
for (i = 0; i < settings->num_monitors; i++)
for (i = 0; i < settings->MonitorCount; i++)
{
left = settings->monitors[i].x;
top = settings->monitors[i].y;
right = settings->monitors[i].x + settings->monitors[i].width - 1;
bottom = settings->monitors[i].y + settings->monitors[i].height - 1;
flags = settings->monitors[i].is_primary ? MONITOR_PRIMARY : 0;
left = settings->MonitorDefArray[i].x;
top = settings->MonitorDefArray[i].y;
right = settings->MonitorDefArray[i].x + settings->MonitorDefArray[i].width - 1;
bottom = settings->MonitorDefArray[i].y + settings->MonitorDefArray[i].height - 1;
flags = settings->MonitorDefArray[i].is_primary ? MONITOR_PRIMARY : 0;
stream_write_UINT32(s, left); /* left */
stream_write_UINT32(s, top); /* top */

View File

@ -17,8 +17,8 @@
* limitations under the License.
*/
#ifndef __GCC_H
#define __GCC_H
#ifndef FREERDP_CORE_GCC_H
#define FREERDP_CORE_GCC_H
#include "mcs.h"
#include <freerdp/crypto/per.h>
@ -27,60 +27,6 @@
#include <freerdp/settings.h>
#include <freerdp/utils/stream.h>
/* Client to Server (CS) data blocks */
#define CS_CORE 0xC001
#define CS_SECURITY 0xC002
#define CS_NET 0xC003
#define CS_CLUSTER 0xC004
#define CS_MONITOR 0xC005
/* Server to Client (SC) data blocks */
#define SC_CORE 0x0C01
#define SC_SECURITY 0x0C02
#define SC_NET 0x0C03
/* RDP version */
#define RDP_VERSION_4 0x00080001
#define RDP_VERSION_5_PLUS 0x00080004
/* Color depth */
#define RNS_UD_COLOR_4BPP 0xCA00
#define RNS_UD_COLOR_8BPP 0xCA01
#define RNS_UD_COLOR_16BPP_555 0xCA02
#define RNS_UD_COLOR_16BPP_565 0xCA03
#define RNS_UD_COLOR_24BPP 0xCA04
/* Secure Access Sequence */
#define RNS_UD_SAS_DEL 0xAA03
/* Supported Color Depths */
#define RNS_UD_24BPP_SUPPORT 0x0001
#define RNS_UD_16BPP_SUPPORT 0x0002
#define RNS_UD_15BPP_SUPPORT 0x0004
#define RNS_UD_32BPP_SUPPORT 0x0008
/* Early Capability Flags */
#define RNS_UD_CS_SUPPORT_ERRINFO_PDU 0x0001
#define RNS_UD_CS_WANT_32BPP_SESSION 0x0002
#define RNS_UD_CS_SUPPORT_STATUSINFO_PDU 0x0004
#define RNS_UD_CS_STRONG_ASYMMETRIC_KEYS 0x0008
#define RNS_UD_CS_VALID_CONNECTION_TYPE 0x0020
#define RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU 0x0040
/* Cluster Information Flags */
#define REDIRECTION_SUPPORTED 0x00000001
#define REDIRECTED_SESSIONID_FIELD_VALID 0x00000002
#define REDIRECTED_SMARTCARD 0x00000040
#define REDIRECTION_VERSION1 0x00
#define REDIRECTION_VERSION2 0x01
#define REDIRECTION_VERSION3 0x02
#define REDIRECTION_VERSION4 0x03
#define REDIRECTION_VERSION5 0x04
/* Monitor Flags */
#define MONITOR_PRIMARY 0x00000001
BOOL gcc_read_conference_create_request(STREAM* s, rdpSettings* settings);
void gcc_write_conference_create_request(STREAM* s, STREAM* user_data);
BOOL gcc_read_conference_create_response(STREAM* s, rdpSettings* settings);
@ -108,4 +54,4 @@ void gcc_write_client_cluster_data(STREAM* s, rdpSettings *settings);
BOOL gcc_read_client_monitor_data(STREAM* s, rdpSettings *settings, UINT16 blockLength);
void gcc_write_client_monitor_data(STREAM* s, rdpSettings *settings);
#endif /* __GCC_H */
#endif /* FREERDP_CORE_GCC_H */

View File

@ -431,7 +431,7 @@ BOOL rdp_recv_client_info(rdpRdp* rdp, STREAM* s)
if ((securityFlags & SEC_INFO_PKT) == 0)
return FALSE;
if (rdp->settings->Encryption)
if (rdp->settings->DisableEncryption)
{
if (securityFlags & SEC_REDIRECTION_PKT)
{

View File

@ -675,7 +675,7 @@ BOOL mcs_send_attach_user_confirm(rdpMcs* mcs)
mcs_write_domain_mcspdu_header(s, DomainMCSPDU_AttachUserConfirm, length, 2);
per_write_enumerated(s, 0, MCS_Result_enum_length); /* result */
mcs->user_id = MCS_GLOBAL_CHANNEL_ID + 1 + mcs->transport->settings->num_channels;
mcs->user_id = MCS_GLOBAL_CHANNEL_ID + 1 + mcs->transport->settings->ChannelCount;
per_write_integer16(s, mcs->user_id, MCS_BASE_CHANNEL_ID); /* initiator (UserId) */
transport_write(mcs->transport, s);

View File

@ -154,8 +154,8 @@ BOOL nego_connect(rdpNego* nego)
if(nego->selected_protocol == PROTOCOL_RDP)
{
nego->transport->settings->Encryption = TRUE;
nego->transport->settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
nego->transport->settings->DisableEncryption = TRUE;
nego->transport->settings->EncryptionMethods = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
nego->transport->settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
}
@ -838,12 +838,12 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
if (!settings->LocalConnection)
{
settings->Encryption = TRUE;
settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->DisableEncryption = TRUE;
settings->EncryptionMethods = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
}
if (settings->Encryption && settings->ServerKey == NULL && settings->RdpKeyFile == NULL)
if (settings->DisableEncryption && settings->RdpServerRsaKey == NULL && settings->RdpKeyFile == NULL)
return FALSE;
}
else if (settings->SelectedProtocol == PROTOCOL_TLS)
@ -851,8 +851,8 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
settings->TlsSecurity = TRUE;
settings->NlaSecurity = FALSE;
settings->RdpSecurity = FALSE;
settings->Encryption = FALSE;
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->DisableEncryption = FALSE;
settings->EncryptionMethods = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
}
else if (settings->SelectedProtocol == PROTOCOL_NLA)
@ -860,8 +860,8 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
settings->TlsSecurity = TRUE;
settings->NlaSecurity = TRUE;
settings->RdpSecurity = FALSE;
settings->Encryption = FALSE;
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->DisableEncryption = FALSE;
settings->EncryptionMethods = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
}
}

View File

@ -35,7 +35,7 @@ static BOOL freerdp_peer_initialize(freerdp_peer* client)
if (client->context->rdp->settings->RdpKeyFile != NULL)
{
client->context->rdp->settings->ServerKey =
client->context->rdp->settings->RdpServerRsaKey =
key_new(client->context->rdp->settings->RdpKeyFile);
}
@ -171,7 +171,7 @@ static BOOL peer_recv_tpkt_pdu(freerdp_peer* client, STREAM* s)
return FALSE;
}
if (rdp->settings->Encryption)
if (rdp->settings->DisableEncryption)
{
rdp_read_security_header(s, &securityFlags);
@ -289,7 +289,7 @@ static BOOL peer_recv_callback(rdpTransport* transport, STREAM* s, void* extra)
break;
case CONNECTION_STATE_MCS_CHANNEL_JOIN:
if (rdp->settings->Encryption)
if (rdp->settings->DisableEncryption)
{
if (!rdp_server_accept_client_keys(rdp, s))
return FALSE;

View File

@ -163,7 +163,7 @@ static int RdpSecurity_stream_init(rdpRdp* rdp, STREAM* s)
if (rdp->do_crypt)
{
stream_seek(s, 12);
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
stream_seek(s, 4);
rdp->sec_flags |= SEC_ENCRYPT;
if (rdp->do_secure_checksum)
@ -276,7 +276,7 @@ void rdp_write_header(rdpRdp* rdp, STREAM* s, UINT16 length, UINT16 channel_id)
MCSPDU = (rdp->settings->ServerMode) ? DomainMCSPDU_SendDataIndication : DomainMCSPDU_SendDataRequest;
if ((rdp->sec_flags & SEC_ENCRYPT) && (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS))
if ((rdp->sec_flags & SEC_ENCRYPT) && (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS))
{
int pad;
@ -314,7 +314,7 @@ static UINT32 RdpSecurity_stream_out(rdpRdp* rdp, STREAM* s, int length)
if (sec_flags & SEC_ENCRYPT)
{
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
{
data = s->p + 12;
@ -363,7 +363,7 @@ static UINT32 rdp_get_sec_bytes(rdpRdp* rdp)
{
sec_bytes = 12;
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
sec_bytes += 4;
}
else if (rdp->sec_flags != 0)
@ -641,7 +641,7 @@ BOOL rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, UINT16 securityFlags)
{
BYTE cmac[8], wmac[8];
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
{
UINT16 len;
BYTE version, pad;
@ -717,7 +717,7 @@ static BOOL rdp_recv_tpkt_pdu(rdpRdp* rdp, STREAM* s)
return FALSE;
}
if (rdp->settings->Encryption)
if (rdp->settings->DisableEncryption)
{
rdp_read_security_header(s, &securityFlags);
if (securityFlags & (SEC_ENCRYPT|SEC_REDIRECTION_PKT))

View File

@ -357,7 +357,7 @@ BOOL security_establish_keys(BYTE* client_random, rdpRdp* rdp)
settings = rdp->settings;
server_random = settings->ServerRandom;
if (settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
if (settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
{
CryptoSha1 sha1;
BYTE client_encrypt_key_t[CRYPTO_SHA1_DIGEST_LENGTH + 1];
@ -413,14 +413,14 @@ BOOL security_establish_keys(BYTE* client_random, rdpRdp* rdp)
server_random, rdp->encrypt_key);
}
if (settings->EncryptionMethod == 1) /* 40 and 56 bit */
if (settings->EncryptionMethods == 1) /* 40 and 56 bit */
{
memcpy(rdp->sign_key, salt40, 3); /* TODO 56 bit */
memcpy(rdp->decrypt_key, salt40, 3); /* TODO 56 bit */
memcpy(rdp->encrypt_key, salt40, 3); /* TODO 56 bit */
rdp->rc4_key_len = 8;
}
else if (settings->EncryptionMethod == 2) /* 128 bit */
else if (settings->EncryptionMethods == 2) /* 128 bit */
{
rdp->rc4_key_len = 16;
}

View File

@ -236,7 +236,7 @@ rdpSettings* settings_new(void* instance)
settings->KeyboardSubType = 0;
settings->KeyboardFunctionKey = 12;
settings->KeyboardLayout = 0;
settings->Encryption = FALSE;
settings->DisableEncryption = FALSE;
settings->SaltedChecksum = TRUE;
settings->ServerPort = 3389;
settings->DesktopResize = TRUE;
@ -248,7 +248,7 @@ rdpSettings* settings_new(void* instance)
settings->AutoReconnectionEnabled = TRUE;
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->EncryptionMethods = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
settings->Authentication = TRUE;
@ -413,14 +413,14 @@ void settings_free(rdpSettings* settings)
free(settings->ServerRandom);
free(settings->ServerCertificate);
free(settings->RdpKeyFile);
certificate_free(settings->ServerCert);
certificate_free(settings->RdpServerCertificate);
free(settings->ClientAutoReconnectCookie);
free(settings->ServerAutoReconnectCookie);
free(settings->ClientTimeZone);
free(settings->BitmapCacheV2CellInfo);
free(settings->GlyphCache);
free(settings->FragCache);
key_free(settings->ServerKey);
key_free(settings->RdpServerRsaKey);
free(settings->ConfigPath);
free(settings->CurrentPath);
free(settings);

View File

@ -653,8 +653,8 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
settings->RdpSecurity = TRUE;
settings->TlsSecurity = FALSE;
settings->NlaSecurity = FALSE;
settings->Encryption = TRUE;
settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->DisableEncryption = TRUE;
settings->EncryptionMethods = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
}
else if (strncmp("tls", argv[index], 1) == 0) /* TLS */

View File

@ -106,11 +106,11 @@ BOOL mf_peer_post_connect(freerdp_peer* client)
/* Iterate all channel names requested by the client and activate those supported by the server */
for (i = 0; i < client->settings->num_channels; i++)
for (i = 0; i < client->settings->ChannelCount; i++)
{
if (client->settings->channels[i].joined)
if (client->settings->ChannelDefArray[i].joined)
{
if (strncmp(client->settings->channels[i].name, "rdpsnd", 6) == 0)
if (strncmp(client->settings->ChannelDefArray[i].Name, "rdpsnd", 6) == 0)
{
mf_peer_rdpsnd_init(context); /* Audio Output */
}

View File

@ -485,11 +485,11 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
/* Iterate all channel names requested by the client and activate those supported by the server */
for (i = 0; i < client->settings->num_channels; i++)
for (i = 0; i < client->settings->ChannelCount; i++)
{
if (client->settings->channels[i].joined)
if (client->settings->ChannelDefArray[i].joined)
{
if (strncmp(client->settings->channels[i].name, "rdpdbg", 6) == 0)
if (strncmp(client->settings->ChannelDefArray[i].Name, "rdpdbg", 6) == 0)
{
context->debug_channel = WTSVirtualChannelOpenEx(context->vcm, "rdpdbg", 0);
@ -501,7 +501,7 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
tf_debug_channel_thread_func, context);
}
}
else if (strncmp(client->settings->channels[i].name, "rdpsnd", 6) == 0)
else if (strncmp(client->settings->ChannelDefArray[i].Name, "rdpsnd", 6) == 0)
{
sf_peer_rdpsnd_init(context); /* Audio Output */
}

View File

@ -100,11 +100,11 @@ BOOL wf_peer_post_connect(freerdp_peer* client)
client->update->DesktopResize(client->update->context);
}
for (i = 0; i < client->settings->num_channels; i++)
for (i = 0; i < client->settings->ChannelCount; i++)
{
if (client->settings->channels[i].joined)
if (client->settings->ChannelDefArray[i].joined)
{
if (strncmp(client->settings->channels[i].name, "rdpsnd", 6) == 0)
if (strncmp(client->settings->ChannelDefArray[i].Name, "rdpsnd", 6) == 0)
{
wf_peer_rdpsnd_init(context); /* Audio Output */
}