mirror of https://github.com/FreeRDP/FreeRDP
libfreerdp-core: fix handling of SSL_CERT_NOT_ON_SERVER
This commit is contained in:
parent
d776a2d4ea
commit
073c6fb983
|
@ -308,7 +308,7 @@ BOOL freerdp_client_parse_rdp_file_buffer_ascii(rdpFile* file, BYTE* buffer, siz
|
|||
|
||||
line = strtok_s((char*) buffer, "\r\n", &context);
|
||||
|
||||
while (line != NULL)
|
||||
while (line)
|
||||
{
|
||||
length = strlen(line);
|
||||
|
||||
|
@ -458,8 +458,7 @@ BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name)
|
|||
if (file_size < 1)
|
||||
return FALSE;
|
||||
|
||||
buffer = (BYTE*) malloc(file_size);
|
||||
|
||||
buffer = (BYTE*) malloc(file_size + 2);
|
||||
read_size = fread(buffer, file_size, 1, fp);
|
||||
|
||||
if (!read_size)
|
||||
|
@ -475,6 +474,9 @@ BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
buffer[file_size] = '\0';
|
||||
buffer[file_size + 1] = '\0';
|
||||
|
||||
return freerdp_client_parse_rdp_file_buffer(file, buffer, file_size);
|
||||
}
|
||||
|
||||
|
@ -497,7 +499,7 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
|
|||
if (~file->ServerPort)
|
||||
settings->ServerPort = file->ServerPort;
|
||||
if (~((size_t) file->FullAddress))
|
||||
settings->ServerHostname = file->FullAddress;
|
||||
settings->ServerHostname = _strdup(file->FullAddress);
|
||||
if (~file->DesktopWidth)
|
||||
settings->DesktopWidth = file->DesktopWidth;
|
||||
if (~file->DesktopHeight)
|
||||
|
@ -513,9 +515,9 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
|
|||
if (~file->EnableCredSSPSupport)
|
||||
settings->NlaSecurity = file->EnableCredSSPSupport;
|
||||
if (~((size_t) file->AlternateShell))
|
||||
settings->AlternateShell = file->AlternateShell;
|
||||
settings->AlternateShell = _strdup(file->AlternateShell);
|
||||
if (~((size_t) file->ShellWorkingDirectory))
|
||||
settings->ShellWorkingDirectory = file->ShellWorkingDirectory;
|
||||
settings->ShellWorkingDirectory = _strdup(file->ShellWorkingDirectory);
|
||||
|
||||
if (~((size_t) file->LoadBalanceInfo))
|
||||
{
|
||||
|
@ -546,7 +548,7 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
|
|||
}
|
||||
|
||||
if (~((size_t) file->GatewayHostname))
|
||||
settings->GatewayHostname = file->GatewayHostname;
|
||||
settings->GatewayHostname = _strdup(file->GatewayHostname);
|
||||
if (~file->GatewayUsageMethod)
|
||||
settings->GatewayUsageMethod = TRUE;
|
||||
if (~file->PromptCredentialOnce)
|
||||
|
@ -555,17 +557,17 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
|
|||
if (~file->RemoteApplicationMode)
|
||||
settings->RemoteApplicationMode = file->RemoteApplicationMode;
|
||||
if (~((size_t) file->RemoteApplicationProgram))
|
||||
settings->RemoteApplicationProgram = file->RemoteApplicationProgram;
|
||||
settings->RemoteApplicationProgram = _strdup(file->RemoteApplicationProgram);
|
||||
if (~((size_t) file->RemoteApplicationName))
|
||||
settings->RemoteApplicationName = file->RemoteApplicationName;
|
||||
settings->RemoteApplicationName = _strdup(file->RemoteApplicationName);
|
||||
if (~((size_t) file->RemoteApplicationIcon))
|
||||
settings->RemoteApplicationIcon = file->RemoteApplicationIcon;
|
||||
settings->RemoteApplicationIcon = _strdup(file->RemoteApplicationIcon);
|
||||
if (~((size_t) file->RemoteApplicationFile))
|
||||
settings->RemoteApplicationFile = file->RemoteApplicationFile;
|
||||
settings->RemoteApplicationFile = _strdup(file->RemoteApplicationFile);
|
||||
if (~((size_t) file->RemoteApplicationGuid))
|
||||
settings->RemoteApplicationGuid = file->RemoteApplicationGuid;
|
||||
settings->RemoteApplicationGuid = _strdup(file->RemoteApplicationGuid);
|
||||
if (~((size_t) file->RemoteApplicationCmdLine))
|
||||
settings->RemoteApplicationCmdLine = file->RemoteApplicationCmdLine;
|
||||
settings->RemoteApplicationCmdLine = _strdup(file->RemoteApplicationCmdLine);
|
||||
|
||||
if (~file->SpanMonitors)
|
||||
settings->SpanMonitors = file->SpanMonitors;
|
||||
|
|
|
@ -490,7 +490,7 @@ int nego_recv(rdpTransport* transport, wStream* s, void* extra)
|
|||
if (length == 0)
|
||||
return -1;
|
||||
|
||||
if(!tpdu_read_connection_confirm(s, &li))
|
||||
if (!tpdu_read_connection_confirm(s, &li))
|
||||
return -1;
|
||||
|
||||
if (li > 6)
|
||||
|
@ -563,7 +563,8 @@ BOOL nego_read_request(rdpNego* nego, wStream* s)
|
|||
BYTE type;
|
||||
|
||||
tpkt_read_header(s);
|
||||
if(!tpdu_read_connection_request(s, &li))
|
||||
|
||||
if (!tpdu_read_connection_request(s, &li))
|
||||
return FALSE;
|
||||
|
||||
if (li != stream_get_left(s) + 6)
|
||||
|
@ -671,7 +672,7 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
|
|||
|
||||
DEBUG_NEGO("requested_protocols: %d", nego->requested_protocols);
|
||||
|
||||
if (nego->requested_protocols > PROTOCOL_RDP)
|
||||
if ((nego->requested_protocols > PROTOCOL_RDP) || (nego->sendNegoData))
|
||||
{
|
||||
/* RDP_NEG_DATA must be present for TLS and NLA */
|
||||
stream_write_BYTE(s, TYPE_RDP_NEG_REQ);
|
||||
|
@ -764,18 +765,24 @@ void nego_process_negotiation_failure(rdpNego* nego, wStream* s)
|
|||
case SSL_REQUIRED_BY_SERVER:
|
||||
DEBUG_NEGO("Error: SSL_REQUIRED_BY_SERVER");
|
||||
break;
|
||||
|
||||
case SSL_NOT_ALLOWED_BY_SERVER:
|
||||
DEBUG_NEGO("Error: SSL_NOT_ALLOWED_BY_SERVER");
|
||||
break;
|
||||
|
||||
case SSL_CERT_NOT_ON_SERVER:
|
||||
DEBUG_NEGO("Error: SSL_CERT_NOT_ON_SERVER");
|
||||
nego->sendNegoData = TRUE;
|
||||
break;
|
||||
|
||||
case INCONSISTENT_FLAGS:
|
||||
DEBUG_NEGO("Error: INCONSISTENT_FLAGS");
|
||||
break;
|
||||
|
||||
case HYBRID_REQUIRED_BY_SERVER:
|
||||
DEBUG_NEGO("Error: HYBRID_REQUIRED_BY_SERVER");
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_NEGO("Error: Unknown protocol security error %d", failureCode);
|
||||
break;
|
||||
|
|
|
@ -100,6 +100,7 @@ struct rdp_nego
|
|||
BOOL security_connected;
|
||||
UINT32 cookie_max_length;
|
||||
|
||||
BOOL sendNegoData;
|
||||
UINT32 selected_protocol;
|
||||
UINT32 requested_protocols;
|
||||
BOOL NegotiateSecurityLayer;
|
||||
|
|
|
@ -454,6 +454,7 @@ void freerdp_settings_free(rdpSettings* settings)
|
|||
free(settings->ConfigPath);
|
||||
free(settings->CurrentPath);
|
||||
free(settings->HomePath);
|
||||
free(settings->LoadBalanceInfo);
|
||||
freerdp_device_collection_free(settings);
|
||||
freerdp_static_channel_collection_free(settings);
|
||||
freerdp_dynamic_channel_collection_free(settings);
|
||||
|
|
Loading…
Reference in New Issue