libfreerdp-core: rdpSettings refactoring (part 1)

This commit is contained in:
Marc-André Moreau 2012-11-07 11:02:46 -05:00
parent ebc09d17d8
commit 1a2839a165
17 changed files with 170 additions and 179 deletions

View File

@ -447,7 +447,7 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
}
CommandLineSwitchCase(arg, "nego")
{
settings->security_layer_negotiation = arg->Value ? TRUE : FALSE;
settings->NegotiateSecurityLayer = arg->Value ? TRUE : FALSE;
}
CommandLineSwitchCase(arg, "pcid")
{
@ -463,34 +463,34 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
{
if (strcmp("rdp", arg->Value) == 0) /* Standard RDP */
{
settings->rdp_security = TRUE;
settings->tls_security = FALSE;
settings->nla_security = FALSE;
settings->ext_security = FALSE;
settings->RdpSecurity = TRUE;
settings->TlsSecurity = FALSE;
settings->NlaSecurity = FALSE;
settings->ExtSecurity = FALSE;
settings->encryption = TRUE;
settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
}
else if (strcmp("tls", arg->Value) == 0) /* TLS */
{
settings->rdp_security = FALSE;
settings->tls_security = TRUE;
settings->nla_security = FALSE;
settings->ext_security = FALSE;
settings->RdpSecurity = FALSE;
settings->TlsSecurity = TRUE;
settings->NlaSecurity = FALSE;
settings->ExtSecurity = FALSE;
}
else if (strcmp("nla", arg->Value) == 0) /* NLA */
{
settings->rdp_security = FALSE;
settings->tls_security = FALSE;
settings->nla_security = TRUE;
settings->ext_security = FALSE;
settings->RdpSecurity = FALSE;
settings->TlsSecurity = FALSE;
settings->NlaSecurity = TRUE;
settings->ExtSecurity = FALSE;
}
else if (strcmp("ext", arg->Value) == 0) /* NLA Extended */
{
settings->rdp_security = FALSE;
settings->tls_security = FALSE;
settings->nla_security = FALSE;
settings->ext_security = TRUE;
settings->RdpSecurity = FALSE;
settings->TlsSecurity = FALSE;
settings->NlaSecurity = FALSE;
settings->ExtSecurity = TRUE;
}
else
{
@ -499,19 +499,19 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
}
CommandLineSwitchCase(arg, "sec-rdp")
{
settings->rdp_security = arg->Value ? TRUE : FALSE;
settings->RdpSecurity = arg->Value ? TRUE : FALSE;
}
CommandLineSwitchCase(arg, "sec-tls")
{
settings->tls_security = arg->Value ? TRUE : FALSE;
settings->TlsSecurity = arg->Value ? TRUE : FALSE;
}
CommandLineSwitchCase(arg, "sec-nla")
{
settings->nla_security = arg->Value ? TRUE : FALSE;
settings->NlaSecurity = arg->Value ? TRUE : FALSE;
}
CommandLineSwitchCase(arg, "sec-ext")
{
settings->ext_security = arg->Value ? TRUE : FALSE;
settings->ExtSecurity = arg->Value ? TRUE : FALSE;
}
CommandLineSwitchCase(arg, "cert-name")
{

View File

@ -520,9 +520,9 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~file->AdministrativeSession)
settings->console_session = file->AdministrativeSession;
if (~file->NegotiateSecurityLayer)
settings->security_layer_negotiation = file->NegotiateSecurityLayer;
settings->NegotiateSecurityLayer = file->NegotiateSecurityLayer;
if (~file->EnableCredSSPSupport)
settings->nla_security = file->EnableCredSSPSupport;
settings->NlaSecurity = file->EnableCredSSPSupport;
if (~((size_t) file->AlternateShell))
settings->shell = file->AlternateShell;
if (~((size_t) file->ShellWorkingDirectory))

View File

@ -157,7 +157,7 @@ void test_gcc_write_client_security_data(void)
settings = settings_new(NULL);
settings->encryption = 1; /* turn on encryption */
settings->encryption_method =
settings->EncryptionMethod =
ENCRYPTION_METHOD_40BIT |
ENCRYPTION_METHOD_56BIT |
ENCRYPTION_METHOD_128BIT |

View File

@ -280,13 +280,13 @@ struct rdp_settings
ALIGN64 char* ClientDigProductId; /* 27 */
/* Protocol Security Negotiation */
ALIGN64 UINT32 requested_protocols; /* 28 */
ALIGN64 UINT32 selected_protocol; /* 29 */
ALIGN64 UINT32 encryption_method; /* 30 */
ALIGN64 UINT32 encryption_level; /* 31 */
ALIGN64 BOOL authentication; /* 32 */
ALIGN64 UINT32 negotiationFlags; /* 33 */
ALIGN64 BOOL security_layer_negotiation; /* 34 */
ALIGN64 UINT32 RequestedProtocols; /* 28 */
ALIGN64 UINT32 SelectedProtocol; /* 29 */
ALIGN64 UINT32 EncryptionMethod; /* 30 */
ALIGN64 UINT32 EncryptionLevel; /* 31 */
ALIGN64 BOOL Authentication; /* 32 */
ALIGN64 UINT32 NegotiationFlags; /* 33 */
ALIGN64 BOOL NegotiateSecurityLayer; /* 34 */
UINT64 padding002[48 - 35]; /* 35 */
/* Connection Settings */
@ -347,11 +347,11 @@ struct rdp_settings
/* Security */
ALIGN64 BOOL encryption; /* 144 */
ALIGN64 BOOL tls_security; /* 145 */
ALIGN64 BOOL nla_security; /* 146 */
ALIGN64 BOOL rdp_security; /* 147 */
ALIGN64 BOOL ext_security; /* 148 */
ALIGN64 UINT32 ntlm_version; /* 149 */
ALIGN64 BOOL TlsSecurity; /* 145 */
ALIGN64 BOOL NlaSecurity; /* 146 */
ALIGN64 BOOL RdpSecurity; /* 147 */
ALIGN64 BOOL ExtSecurity; /* 148 */
ALIGN64 void* unused149; /* 149 */
ALIGN64 BOOL salted_checksum; /* 150 */
ALIGN64 BOOL mstsc_cookie_mode; /* 151 */
ALIGN64 UINT32 cookie_max_length; /* 152 */

View File

@ -114,12 +114,12 @@ BOOL rdp_client_connect(rdpRdp* rdp)
nego_set_preconnection_id(rdp->nego, settings->preconnection_id);
nego_set_preconnection_blob(rdp->nego, settings->preconnection_blob);
nego_set_negotiation_enabled(rdp->nego, settings->security_layer_negotiation);
nego_set_negotiation_enabled(rdp->nego, settings->NegotiateSecurityLayer);
nego_enable_rdp(rdp->nego, settings->rdp_security);
nego_enable_tls(rdp->nego, settings->tls_security);
nego_enable_nla(rdp->nego, settings->nla_security);
nego_enable_ext(rdp->nego, settings->ext_security);
nego_enable_rdp(rdp->nego, settings->RdpSecurity);
nego_enable_tls(rdp->nego, settings->TlsSecurity);
nego_enable_nla(rdp->nego, settings->NlaSecurity);
nego_enable_ext(rdp->nego, settings->ExtSecurity);
if (settings->mstsc_cookie_mode)
settings->cookie_max_length = MSTSC_COOKIE_MAX_LENGTH;
@ -292,7 +292,7 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
if (rdp->settings->salted_checksum)
rdp->do_secure_checksum = TRUE;
if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethod == 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);
@ -364,7 +364,7 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, STREAM* s)
if (rdp->settings->salted_checksum)
rdp->do_secure_checksum = TRUE;
if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethod == 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);
@ -584,17 +584,17 @@ BOOL rdp_server_accept_nego(rdpRdp* rdp, STREAM* s)
(rdp->nego->requested_protocols == PROTOCOL_RDP) ? 1: 0);
printf("Server Security: NLA:%d TLS:%d RDP:%d\n",
settings->nla_security, settings->tls_security, settings->rdp_security);
settings->NlaSecurity, settings->TlsSecurity, settings->RdpSecurity);
if ((settings->nla_security) && (rdp->nego->requested_protocols & PROTOCOL_NLA))
if ((settings->NlaSecurity) && (rdp->nego->requested_protocols & PROTOCOL_NLA))
{
rdp->nego->selected_protocol = PROTOCOL_NLA;
}
else if ((settings->tls_security) && (rdp->nego->requested_protocols & PROTOCOL_TLS))
else if ((settings->TlsSecurity) && (rdp->nego->requested_protocols & PROTOCOL_TLS))
{
rdp->nego->selected_protocol = PROTOCOL_TLS;
}
else if ((settings->rdp_security) && (rdp->nego->selected_protocol == PROTOCOL_RDP))
else if ((settings->RdpSecurity) && (rdp->nego->selected_protocol == PROTOCOL_RDP))
{
rdp->nego->selected_protocol = PROTOCOL_RDP;
}

View File

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

View File

@ -364,7 +364,7 @@ void gcc_write_client_data_blocks(STREAM* s, rdpSettings* settings)
/* extended client data supported */
if (settings->negotiationFlags)
if (settings->NegotiationFlags)
gcc_write_client_monitor_data(s, settings);
}
@ -568,7 +568,7 @@ BOOL gcc_read_client_core_data(STREAM* s, rdpSettings* settings, UINT16 blockLen
stream_read_UINT32(s, serverSelectedProtocol); /* serverSelectedProtocol */
blockLength -= 4;
if (settings->selected_protocol != serverSelectedProtocol)
if (settings->SelectedProtocol != serverSelectedProtocol)
return FALSE;
} while (0);
@ -721,7 +721,7 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings* settings)
stream_write_BYTE(s, connectionType); /* connectionType */
stream_write_BYTE(s, 0); /* pad1octet */
stream_write_UINT32(s, settings->selected_protocol); /* serverSelectedProtocol */
stream_write_UINT32(s, settings->SelectedProtocol); /* serverSelectedProtocol */
}
BOOL gcc_read_server_core_data(STREAM* s, rdpSettings* settings)
@ -745,7 +745,7 @@ void gcc_write_server_core_data(STREAM* s, rdpSettings* settings)
gcc_write_user_data_header(s, SC_CORE, 12);
stream_write_UINT32(s, settings->RdpVersion == 4 ? RDP_VERSION_4 : RDP_VERSION_5_PLUS);
stream_write_UINT32(s, settings->requested_protocols); /* clientRequestedProtocols */
stream_write_UINT32(s, settings->RequestedProtocols); /* clientRequestedProtocols */
}
/**
@ -762,9 +762,9 @@ BOOL gcc_read_client_security_data(STREAM* s, rdpSettings* settings, UINT16 bloc
if (settings->encryption)
{
stream_read_UINT32(s, settings->encryption_method); /* encryptionMethods */
if (settings->encryption_method == 0)
stream_read_UINT32(s, settings->encryption_method); /* extEncryptionMethods */
stream_read_UINT32(s, settings->EncryptionMethod); /* encryptionMethods */
if (settings->EncryptionMethod == 0)
stream_read_UINT32(s, settings->EncryptionMethod); /* extEncryptionMethods */
}
else
{
@ -786,14 +786,14 @@ void gcc_write_client_security_data(STREAM* s, rdpSettings* settings)
if (settings->encryption)
{
stream_write_UINT32(s, settings->encryption_method); /* encryptionMethods */
stream_write_UINT32(s, settings->EncryptionMethod); /* encryptionMethods */
stream_write_UINT32(s, 0); /* extEncryptionMethods */
}
else
{
/* French locale, disable encryption */
stream_write_UINT32(s, 0); /* encryptionMethods */
stream_write_UINT32(s, settings->encryption_method); /* extEncryptionMethods */
stream_write_UINT32(s, settings->EncryptionMethod); /* extEncryptionMethods */
}
}
@ -802,15 +802,15 @@ BOOL gcc_read_server_security_data(STREAM* s, rdpSettings* settings)
BYTE* data;
UINT32 length;
stream_read_UINT32(s, settings->encryption_method); /* encryptionMethod */
stream_read_UINT32(s, settings->encryption_level); /* encryptionLevel */
stream_read_UINT32(s, settings->EncryptionMethod); /* encryptionMethod */
stream_read_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
if (settings->encryption_method == 0 && settings->encryption_level == 0)
if (settings->EncryptionMethod == 0 && settings->EncryptionLevel == 0)
{
/* serverRandom and serverRandom must not be present */
settings->encryption = FALSE;
settings->encryption_method = ENCRYPTION_METHOD_NONE;
settings->encryption_level = ENCRYPTION_LEVEL_NONE;
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
return TRUE;
}
@ -907,24 +907,24 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings)
if (!settings->encryption)
{
settings->encryption_method = ENCRYPTION_METHOD_NONE;
settings->encryption_level = ENCRYPTION_LEVEL_NONE;
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
}
else if ((settings->encryption_method & ENCRYPTION_METHOD_FIPS) != 0)
else if ((settings->EncryptionMethod & ENCRYPTION_METHOD_FIPS) != 0)
{
settings->encryption_method = ENCRYPTION_METHOD_FIPS;
settings->EncryptionMethod = ENCRYPTION_METHOD_FIPS;
}
else if ((settings->encryption_method & ENCRYPTION_METHOD_128BIT) != 0)
else if ((settings->EncryptionMethod & ENCRYPTION_METHOD_128BIT) != 0)
{
settings->encryption_method = ENCRYPTION_METHOD_128BIT;
settings->EncryptionMethod = ENCRYPTION_METHOD_128BIT;
}
else if ((settings->encryption_method & ENCRYPTION_METHOD_40BIT) != 0)
else if ((settings->EncryptionMethod & ENCRYPTION_METHOD_40BIT) != 0)
{
settings->encryption_method = ENCRYPTION_METHOD_40BIT;
settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT;
}
if (settings->encryption_method != ENCRYPTION_METHOD_NONE)
settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
if (settings->EncryptionMethod != ENCRYPTION_METHOD_NONE)
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
headerLen = 12;
keyLen = 0;
@ -932,8 +932,8 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings)
serverRandomLen = 0;
serverCertLen = 0;
if (settings->encryption_method != ENCRYPTION_METHOD_NONE ||
settings->encryption_level != ENCRYPTION_LEVEL_NONE)
if (settings->EncryptionMethod != ENCRYPTION_METHOD_NONE ||
settings->EncryptionLevel != ENCRYPTION_LEVEL_NONE)
{
serverRandomLen = 32;
@ -966,11 +966,11 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings)
gcc_write_user_data_header(s, SC_SECURITY, headerLen);
stream_write_UINT32(s, settings->encryption_method); /* encryptionMethod */
stream_write_UINT32(s, settings->encryption_level); /* encryptionLevel */
stream_write_UINT32(s, settings->EncryptionMethod); /* encryptionMethod */
stream_write_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
if (settings->encryption_method == ENCRYPTION_METHOD_NONE &&
settings->encryption_level == ENCRYPTION_LEVEL_NONE)
if (settings->EncryptionMethod == ENCRYPTION_METHOD_NONE &&
settings->EncryptionLevel == ENCRYPTION_LEVEL_NONE)
{
return;
}

View File

@ -89,7 +89,7 @@ BOOL nego_connect(rdpNego* nego)
nego->state = NEGO_STATE_FAIL;
}
if (!nego->security_layer_negotiation_enabled)
if (!nego->NegotiateSecurityLayer_enabled)
{
DEBUG_NEGO("Security Layer Negotiation is disabled");
/* attempt only the highest enabled protocol (see nego_attempt_*) */
@ -148,15 +148,15 @@ BOOL nego_connect(rdpNego* nego)
DEBUG_NEGO("Negotiated %s security", PROTOCOL_SECURITY_STRINGS[nego->selected_protocol]);
/* update settings with negotiated protocol security */
nego->transport->settings->requested_protocols = nego->requested_protocols;
nego->transport->settings->selected_protocol = nego->selected_protocol;
nego->transport->settings->negotiationFlags = nego->flags;
nego->transport->settings->RequestedProtocols = nego->requested_protocols;
nego->transport->settings->SelectedProtocol = nego->selected_protocol;
nego->transport->settings->NegotiationFlags = nego->flags;
if(nego->selected_protocol == PROTOCOL_RDP)
{
nego->transport->settings->encryption = TRUE;
nego->transport->settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
nego->transport->settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
nego->transport->settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
nego->transport->settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
}
/* finally connect security layer (if not already done) */
@ -226,7 +226,7 @@ BOOL nego_transport_connect(rdpNego* nego)
{
nego_tcp_connect(nego);
if (nego->tcp_connected && !nego->security_layer_negotiation_enabled)
if (nego->tcp_connected && !nego->NegotiateSecurityLayer_enabled)
return nego_security_connect(nego);
return nego->tcp_connected;
@ -661,7 +661,7 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
length += cookie_length + 19;
}
DEBUG_NEGO("requested_protocols: %d", nego->requested_protocols);
DEBUG_NEGO("requested_protocols: %d", nego->RequestedProtocols);
if (nego->requested_protocols > PROTOCOL_RDP)
{
@ -702,7 +702,7 @@ void nego_process_negotiation_request(rdpNego* nego, STREAM* s)
stream_read_UINT16(s, length);
stream_read_UINT32(s, nego->requested_protocols);
DEBUG_NEGO("requested_protocols: %d", nego->requested_protocols);
DEBUG_NEGO("requested_protocols: %d", nego->RequestedProtocols);
nego->state = NEGO_STATE_FINAL;
}
@ -800,7 +800,7 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
stream_write_UINT32(s, nego->selected_protocol); /* selectedProtocol */
length += 8;
}
else if (!settings->rdp_security)
else if (!settings->RdpSecurity)
{
stream_write_BYTE(s, TYPE_RDP_NEG_FAILURE);
stream_write_BYTE(s, 0); /* flags */
@ -827,42 +827,42 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
if (status)
{
/* update settings with negotiated protocol security */
settings->requested_protocols = nego->requested_protocols;
settings->selected_protocol = nego->selected_protocol;
settings->RequestedProtocols = nego->requested_protocols;
settings->SelectedProtocol = nego->selected_protocol;
if (settings->selected_protocol == PROTOCOL_RDP)
if (settings->SelectedProtocol == PROTOCOL_RDP)
{
settings->tls_security = FALSE;
settings->nla_security = FALSE;
settings->rdp_security = TRUE;
settings->TlsSecurity = FALSE;
settings->NlaSecurity = FALSE;
settings->RdpSecurity = TRUE;
if (!settings->local)
{
settings->encryption = TRUE;
settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
}
if (settings->encryption && settings->server_key == NULL && settings->rdp_key_file == NULL)
return FALSE;
}
else if (settings->selected_protocol == PROTOCOL_TLS)
else if (settings->SelectedProtocol == PROTOCOL_TLS)
{
settings->tls_security = TRUE;
settings->nla_security = FALSE;
settings->rdp_security = FALSE;
settings->TlsSecurity = TRUE;
settings->NlaSecurity = FALSE;
settings->RdpSecurity = FALSE;
settings->encryption = FALSE;
settings->encryption_method = ENCRYPTION_METHOD_NONE;
settings->encryption_level = ENCRYPTION_LEVEL_NONE;
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
}
else if (settings->selected_protocol == PROTOCOL_NLA)
else if (settings->SelectedProtocol == PROTOCOL_NLA)
{
settings->tls_security = TRUE;
settings->nla_security = TRUE;
settings->rdp_security = FALSE;
settings->TlsSecurity = TRUE;
settings->NlaSecurity = TRUE;
settings->RdpSecurity = FALSE;
settings->encryption = FALSE;
settings->encryption_method = ENCRYPTION_METHOD_NONE;
settings->encryption_level = ENCRYPTION_LEVEL_NONE;
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
}
}
@ -933,10 +933,10 @@ void nego_set_target(rdpNego* nego, char* hostname, int port)
* @param enable_rdp whether to enable security layer negotiation (TRUE for enabled, FALSE for disabled)
*/
void nego_set_negotiation_enabled(rdpNego* nego, BOOL security_layer_negotiation_enabled)
void nego_set_negotiation_enabled(rdpNego* nego, BOOL NegotiateSecurityLayer_enabled)
{
DEBUG_NEGO("Enabling security layer negotiation: %s", security_layer_negotiation_enabled ? "TRUE" : "FALSE");
nego->security_layer_negotiation_enabled = security_layer_negotiation_enabled;
DEBUG_NEGO("Enabling security layer negotiation: %s", NegotiateSecurityLayer_enabled ? "TRUE" : "FALSE");
nego->NegotiateSecurityLayer_enabled = NegotiateSecurityLayer_enabled;
}
/**

View File

@ -98,7 +98,7 @@ struct rdp_nego
UINT32 selected_protocol;
UINT32 requested_protocols;
BOOL security_layer_negotiation_enabled;
BOOL NegotiateSecurityLayer_enabled;
BYTE enabled_protocols[16];
rdpTransport* transport;
@ -130,7 +130,7 @@ void nego_free(rdpNego* nego);
void nego_init(rdpNego* nego);
void nego_set_target(rdpNego* nego, char* hostname, int port);
void nego_set_negotiation_enabled(rdpNego* nego, BOOL security_layer_negotiation_enabled);
void nego_set_negotiation_enabled(rdpNego* nego, BOOL NegotiateSecurityLayer_enabled);
void nego_enable_rdp(rdpNego* nego, BOOL enable_rdp);
void nego_enable_tls(rdpNego* nego, BOOL enable_tls);
void nego_enable_nla(rdpNego* nego, BOOL enable_nla);

View File

@ -158,12 +158,12 @@ void rdp_write_share_data_header(STREAM* s, UINT16 length, BYTE type, UINT32 sha
stream_write_UINT16(s, 0); /* compressedLength (2 bytes) */
}
static int rdp_security_stream_init(rdpRdp* rdp, STREAM* s)
static int RdpSecurity_stream_init(rdpRdp* rdp, STREAM* s)
{
if (rdp->do_crypt)
{
stream_seek(s, 12);
if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
stream_seek(s, 4);
rdp->sec_flags |= SEC_ENCRYPT;
if (rdp->do_secure_checksum)
@ -188,7 +188,7 @@ STREAM* rdp_send_stream_init(rdpRdp* rdp)
s = transport_send_stream_init(rdp->transport, 2048);
stream_seek(s, RDP_PACKET_HEADER_MAX_LENGTH);
rdp_security_stream_init(rdp, s);
RdpSecurity_stream_init(rdp, s);
return s;
}
@ -198,7 +198,7 @@ STREAM* rdp_pdu_init(rdpRdp* rdp)
STREAM* s;
s = transport_send_stream_init(rdp->transport, 2048);
stream_seek(s, RDP_PACKET_HEADER_MAX_LENGTH);
rdp_security_stream_init(rdp, s);
RdpSecurity_stream_init(rdp, s);
stream_seek(s, RDP_SHARE_CONTROL_HEADER_LENGTH);
return s;
}
@ -208,7 +208,7 @@ STREAM* rdp_data_pdu_init(rdpRdp* rdp)
STREAM* s;
s = transport_send_stream_init(rdp->transport, 2048);
stream_seek(s, RDP_PACKET_HEADER_MAX_LENGTH);
rdp_security_stream_init(rdp, s);
RdpSecurity_stream_init(rdp, s);
stream_seek(s, RDP_SHARE_CONTROL_HEADER_LENGTH);
stream_seek(s, RDP_SHARE_DATA_HEADER_LENGTH);
return s;
@ -276,7 +276,7 @@ void rdp_write_header(rdpRdp* rdp, STREAM* s, UINT16 length, UINT16 channel_id)
MCSPDU = (rdp->settings->server_mode) ? DomainMCSPDU_SendDataIndication : DomainMCSPDU_SendDataRequest;
if ((rdp->sec_flags & SEC_ENCRYPT) && (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS))
if ((rdp->sec_flags & SEC_ENCRYPT) && (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS))
{
int pad;
@ -300,7 +300,7 @@ void rdp_write_header(rdpRdp* rdp, STREAM* s, UINT16 length, UINT16 channel_id)
stream_write_UINT16_be(s, length); /* userData (OCTET_STRING) */
}
static UINT32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length)
static UINT32 RdpSecurity_stream_out(rdpRdp* rdp, STREAM* s, int length)
{
BYTE* data;
UINT32 sec_flags;
@ -314,7 +314,7 @@ static UINT32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length)
if (sec_flags & SEC_ENCRYPT)
{
if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethod == 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->encryption_method == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
sec_bytes += 4;
}
else if (rdp->sec_flags != 0)
@ -401,7 +401,7 @@ BOOL rdp_send(rdpRdp* rdp, STREAM* s, UINT16 channel_id)
stream_seek(s, sec_bytes);
s->p = sec_hold;
length += rdp_security_stream_out(rdp, s, length);
length += RdpSecurity_stream_out(rdp, s, length);
stream_set_pos(s, length);
if (transport_write(rdp->transport, s) < 0)
@ -428,7 +428,7 @@ BOOL rdp_send_pdu(rdpRdp* rdp, STREAM* s, UINT16 type, UINT16 channel_id)
rdp_write_share_control_header(s, length - sec_bytes, type, channel_id);
s->p = sec_hold;
length += rdp_security_stream_out(rdp, s, length);
length += RdpSecurity_stream_out(rdp, s, length);
stream_set_pos(s, length);
if (transport_write(rdp->transport, s) < 0)
@ -456,7 +456,7 @@ BOOL rdp_send_data_pdu(rdpRdp* rdp, STREAM* s, BYTE type, UINT16 channel_id)
rdp_write_share_data_header(s, length - sec_bytes, type, rdp->settings->share_id);
s->p = sec_hold;
length += rdp_security_stream_out(rdp, s, length);
length += RdpSecurity_stream_out(rdp, s, length);
stream_set_pos(s, length);
if (transport_write(rdp->transport, s) < 0)
@ -641,7 +641,7 @@ BOOL rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, UINT16 securityFlags)
{
BYTE cmac[8], wmac[8];
if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS)
if (rdp->settings->EncryptionMethod == ENCRYPTION_METHOD_FIPS)
{
UINT16 len;
BYTE version, pad;

View File

@ -357,7 +357,7 @@ BOOL security_establish_keys(BYTE* client_random, rdpRdp* rdp)
settings = rdp->settings;
server_random = settings->server_random;
if (settings->encryption_method == ENCRYPTION_METHOD_FIPS)
if (settings->EncryptionMethod == 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->encryption_method == 1) /* 40 and 56 bit */
if (settings->EncryptionMethod == 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->encryption_method == 2) /* 128 bit */
else if (settings->EncryptionMethod == 2) /* 128 bit */
{
rdp->rc4_key_len = 16;
}

View File

@ -77,10 +77,10 @@ void settings_client_load_hkey_local_machine(rdpSettings* settings)
REG_QUERY_DWORD_VALUE(hKey, _T("KeyboardFunctionKeys"), dwType, dwValue, dwSize, settings->KeyboardFunctionKey);
REG_QUERY_DWORD_VALUE(hKey, _T("KeyboardLayout"), dwType, dwValue, dwSize, settings->KeyboardLayout);
REG_QUERY_BOOL_VALUE(hKey, _T("ExtSecurity"), dwType, dwValue, dwSize, settings->ext_security);
REG_QUERY_BOOL_VALUE(hKey, _T("NlaSecurity"), dwType, dwValue, dwSize, settings->nla_security);
REG_QUERY_BOOL_VALUE(hKey, _T("TlsSecurity"), dwType, dwValue, dwSize, settings->tls_security);
REG_QUERY_BOOL_VALUE(hKey, _T("RdpSecurity"), dwType, dwValue, dwSize, settings->rdp_security);
REG_QUERY_BOOL_VALUE(hKey, _T("ExtSecurity"), dwType, dwValue, dwSize, settings->ExtSecurity);
REG_QUERY_BOOL_VALUE(hKey, _T("NlaSecurity"), dwType, dwValue, dwSize, settings->NlaSecurity);
REG_QUERY_BOOL_VALUE(hKey, _T("TlsSecurity"), dwType, dwValue, dwSize, settings->TlsSecurity);
REG_QUERY_BOOL_VALUE(hKey, _T("RdpSecurity"), dwType, dwValue, dwSize, settings->RdpSecurity);
REG_QUERY_BOOL_VALUE(hKey, _T("MstscCookieMode"), dwType, dwValue, dwSize, settings->mstsc_cookie_mode);
REG_QUERY_DWORD_VALUE(hKey, _T("CookieMaxLength"), dwType, dwValue, dwSize, settings->cookie_max_length);
@ -174,10 +174,10 @@ void settings_server_load_hkey_local_machine(rdpSettings* settings)
if (status != ERROR_SUCCESS)
return;
REG_QUERY_BOOL_VALUE(hKey, _T("ExtSecurity"), dwType, dwValue, dwSize, settings->ext_security);
REG_QUERY_BOOL_VALUE(hKey, _T("NlaSecurity"), dwType, dwValue, dwSize, settings->nla_security);
REG_QUERY_BOOL_VALUE(hKey, _T("TlsSecurity"), dwType, dwValue, dwSize, settings->tls_security);
REG_QUERY_BOOL_VALUE(hKey, _T("RdpSecurity"), dwType, dwValue, dwSize, settings->rdp_security);
REG_QUERY_BOOL_VALUE(hKey, _T("ExtSecurity"), dwType, dwValue, dwSize, settings->ExtSecurity);
REG_QUERY_BOOL_VALUE(hKey, _T("NlaSecurity"), dwType, dwValue, dwSize, settings->NlaSecurity);
REG_QUERY_BOOL_VALUE(hKey, _T("TlsSecurity"), dwType, dwValue, dwSize, settings->TlsSecurity);
REG_QUERY_BOOL_VALUE(hKey, _T("RdpSecurity"), dwType, dwValue, dwSize, settings->RdpSecurity);
RegCloseKey(hKey);
}
@ -224,11 +224,11 @@ rdpSettings* settings_new(void* instance)
settings->decorations = TRUE;
settings->RdpVersion = 7;
settings->ColorDepth = 16;
settings->ext_security = FALSE;
settings->nla_security = TRUE;
settings->tls_security = TRUE;
settings->rdp_security = TRUE;
settings->security_layer_negotiation = TRUE;
settings->ExtSecurity = FALSE;
settings->NlaSecurity = TRUE;
settings->TlsSecurity = TRUE;
settings->RdpSecurity = TRUE;
settings->NegotiateSecurityLayer = TRUE;
settings->mstsc_cookie_mode = FALSE;
settings->cookie_max_length = DEFAULT_COOKIE_MAX_LENGTH;
settings->ClientBuild = 2600;
@ -248,10 +248,10 @@ rdpSettings* settings_new(void* instance)
settings->auto_reconnection = TRUE;
settings->encryption_method = ENCRYPTION_METHOD_NONE;
settings->encryption_level = ENCRYPTION_LEVEL_NONE;
settings->EncryptionMethod = ENCRYPTION_METHOD_NONE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
settings->authentication = TRUE;
settings->Authentication = TRUE;
settings->authentication_only = FALSE;
settings->from_stdin = FALSE;

View File

@ -129,7 +129,7 @@ BOOL transport_connect_nla(rdpTransport* transport)
/* Network Level Authentication */
if (transport->settings->authentication != TRUE)
if (transport->settings->Authentication != TRUE)
return TRUE;
settings = transport->settings;
@ -247,7 +247,7 @@ BOOL transport_accept_nla(rdpTransport* transport)
/* Network Level Authentication */
if (transport->settings->authentication != TRUE)
if (transport->settings->Authentication != TRUE)
return TRUE;
settings = transport->settings;

View File

@ -356,15 +356,6 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
{
settings->compression = TRUE;
}
else if (strcmp("--ntlm", argv[index]) == 0)
{
index++;
settings->ntlm_version = atoi(argv[index]);
if (settings->ntlm_version != 2)
settings->ntlm_version = 1;
}
else if (strcmp("--no-glyph-cache", argv[index]) == 0)
{
settings->glyphSupportLevel = GLYPH_SUPPORT_NONE;
@ -379,7 +370,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
}
else if (strcmp("--no-auth", argv[index]) == 0)
{
settings->authentication = FALSE;
settings->Authentication = FALSE;
}
else if (strcmp("--authonly", argv[index]) == 0)
{
@ -639,15 +630,15 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
}
else if (strcmp("--no-rdp", argv[index]) == 0)
{
settings->rdp_security = FALSE;
settings->RdpSecurity = FALSE;
}
else if (strcmp("--no-tls", argv[index]) == 0)
{
settings->tls_security = FALSE;
settings->TlsSecurity = FALSE;
}
else if (strcmp("--no-nla", argv[index]) == 0)
{
settings->nla_security = FALSE;
settings->NlaSecurity = FALSE;
}
else if (strcmp("--sec", argv[index]) == 0)
{
@ -659,24 +650,24 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
}
if (strncmp("rdp", argv[index], 1) == 0) /* Standard RDP */
{
settings->rdp_security = TRUE;
settings->tls_security = FALSE;
settings->nla_security = FALSE;
settings->RdpSecurity = TRUE;
settings->TlsSecurity = FALSE;
settings->NlaSecurity = FALSE;
settings->encryption = TRUE;
settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
settings->EncryptionMethod = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
}
else if (strncmp("tls", argv[index], 1) == 0) /* TLS */
{
settings->rdp_security = FALSE;
settings->tls_security = TRUE;
settings->nla_security = FALSE;
settings->RdpSecurity = FALSE;
settings->TlsSecurity = TRUE;
settings->NlaSecurity = FALSE;
}
else if (strncmp("nla", argv[index], 1) == 0) /* NLA */
{
settings->rdp_security = FALSE;
settings->tls_security = FALSE;
settings->nla_security = TRUE;
settings->RdpSecurity = FALSE;
settings->TlsSecurity = FALSE;
settings->NlaSecurity = TRUE;
}
else
{
@ -686,7 +677,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
}
else if (strcmp("--no-nego", argv[index]) == 0)
{
settings->security_layer_negotiation = FALSE;
settings->NegotiateSecurityLayer = FALSE;
}
else if (strcmp("--tsg", argv[index]) == 0)
{

View File

@ -201,7 +201,7 @@ static void* mf_peer_main_loop(void* arg)
/* Initialize the real server settings here */
client->settings->cert_file = _strdup("server.crt");
client->settings->privatekey_file = _strdup("server.key");
client->settings->nla_security = FALSE;
client->settings->NlaSecurity = FALSE;
client->settings->rfx_codec = TRUE;
client->settings->suppress_output = TRUE;
client->settings->refresh_rect = TRUE;

View File

@ -654,7 +654,7 @@ static void* test_peer_mainloop(void* arg)
/* Initialize the real server settings here */
client->settings->cert_file = _strdup("server.crt");
client->settings->privatekey_file = _strdup("server.key");
client->settings->nla_security = FALSE;
client->settings->NlaSecurity = FALSE;
client->settings->rfx_codec = TRUE;
client->settings->suppress_output = TRUE;
client->settings->refresh_rect = TRUE;

View File

@ -638,9 +638,9 @@ void* xf_peer_main_loop(void* arg)
settings->cert_file = freerdp_construct_path(server_file_path, "server.crt");
settings->privatekey_file = freerdp_construct_path(server_file_path, "server.key");
settings->nla_security = TRUE;
settings->tls_security = FALSE;
settings->rdp_security = FALSE;
settings->NlaSecurity = TRUE;
settings->TlsSecurity = FALSE;
settings->RdpSecurity = FALSE;
settings->rfx_codec = TRUE;