#define TAG "gateway"
+static char* string_strnstr(const char* str1, const char* str2, size_t slen)
+{
+ char c, sc;
+ size_t len;
+
+ if ((c = *str2++) != '\0')
+ {
+ len = strlen(str2);
+
+ do
+ {
+ do
+ {
+ if (slen-- < 1 || (sc = *str1++) == '\0')
+ return NULL;
+ }
+ while(sc != c);
+
+ if (len > slen)
+ return NULL;
+ }
+ while(strncmp(str1, str2, len) != 0);
+
+ str1--;
+ }
+
+ return ((char*) str1);
+}
+
+static BOOL strings_equals_nocase(void* obj1, void* obj2)
+{
+ if (!obj1 || !obj2)
+ return FALSE;
+
+ return _stricmp(obj1, obj2) == 0;
+}
+
+static void string_free(void* obj1)
+{
+ if (!obj1)
+ return;
+
+ free(obj1);
+}
+
HttpContext* http_context_new()
{
return (HttpContext*) calloc(1, sizeof(HttpContext));
{
response->ContentLength = atoi(value);
}
+ else if (_stricmp(name, "Content-Type") == 0)
+ {
+ response->ContentType = _strdup(value);
+
+ if (!response->ContentType)
+ return FALSE;
+ }
else if (_stricmp(name, "WWW-Authenticate") == 0)
{
char* separator = NULL;
BOOL http_response_parse_header(HttpResponse* response)
{
+ char c;
int count;
char* line;
char* name;
char* colon_pos;
char* end_of_header;
char end_of_header_char;
- char c;
if (!response)
return FALSE;
HttpResponse* http_response_recv(rdpTls* tls)
{
- int nbytes;
- int length;
+ wStream* s;
+ int size;
+ int count;
int status;
- BYTE* buffer;
- char* content;
- char* header_end;
+ int position;
+ char* line;
+ char* buffer;
+ char* header;
+ char* payload;
+ int bodyLength;
+ int payloadOffset;
HttpResponse* response;
- nbytes = 0;
- length = 10000;
- content = NULL;
+ size = 1024;
+ payload = NULL;
+ payloadOffset = 0;
- buffer = calloc(length, 1);
+ s = Stream_New(NULL, size);
- if (!buffer)
- return NULL;
+ if (!s)
+ goto out_free;
+
+ buffer = (char*) Stream_Buffer(s);
response = http_response_new();
while (TRUE)
{
- while (nbytes < 5)
+ while (!payloadOffset)
{
- status = BIO_read(tls->bio, &buffer[nbytes], length - nbytes);
+ status = BIO_read(tls->bio, Stream_Pointer(s), Stream_Capacity(s) - Stream_GetPosition(s));
if (status <= 0)
{
#ifdef HAVE_VALGRIND_MEMCHECK_H
VALGRIND_MAKE_MEM_DEFINED(p, status);
#endif
- nbytes += status;
- }
- header_end = strstr((char*) buffer, "\r\n\r\n");
+ Stream_Seek(s, status);
- if (!header_end)
- {
- WLog_ERR(TAG, "invalid response");
- winpr_HexDump(TAG, WLOG_ERROR, buffer, status);
- goto out_error;
- }
+ if (Stream_GetRemainingLength(s) < 1024)
+ {
+ Stream_EnsureRemainingCapacity(s, 1024);
+ buffer = (char*) Stream_Buffer(s);
+ payload = &buffer[payloadOffset];
+ }
- header_end += 2;
+ position = Stream_GetPosition(s);
- if (header_end)
- {
- int count;
- char* line;
+ if (position >= 4)
+ {
+ line = string_strnstr(buffer, "\r\n\r\n", position);
+
+ if (line)
+ {
+ payloadOffset = (line - buffer) + 4;
+ payload = &buffer[payloadOffset];
+ }
+ }
+ }
- header_end[0] = '\0';
- header_end[1] = '\0';
- content = header_end + 2;
+ if (payloadOffset)
+ {
count = 0;
- line = (char*) buffer;
+ line = buffer;
+
+ position = Stream_GetPosition(s);
- while ((line = strstr(line, "\r\n")) != NULL)
+ while ((line = string_strnstr(line, "\r\n", payloadOffset - (line - buffer) - 2)))
{
- line++;
+ line += 2;
count++;
}
goto out_error;
}
+ header = (char*) malloc(payloadOffset);
+
+ if (!header)
+ goto out_error;
+
+ CopyMemory(header, buffer, payloadOffset);
+ header[payloadOffset - 1] = '\0';
+ header[payloadOffset - 2] = '\0';
+
count = 0;
- line = strtok((char*) buffer, "\r\n");
+ line = strtok(header, "\r\n");
while (line && response->lines)
{
count++;
}
+ free(header);
+
if (!http_response_parse_header(response))
goto out_error;
- response->BodyLength = nbytes - (content - (char*) buffer);
+ response->BodyLength = Stream_GetPosition(s) - payloadOffset;
if (response->BodyLength > 0)
{
if (!response->BodyContent)
goto out_error;
- CopyMemory(response->BodyContent, content, response->BodyLength);
+ CopyMemory(response->BodyContent, payload, response->BodyLength);
+ }
+
+ bodyLength = 0; /* expected body length */
+
+ if (response->ContentType)
+ {
+ if (_stricmp(response->ContentType, "text/plain") == 0)
+ {
+ bodyLength = response->ContentLength;
+ }
+ }
+
+ if (bodyLength != response->BodyLength)
+ {
+ WLog_WARN(TAG, "http_response_recv: %s unexpected body length: actual: %d, expected: %d",
+ response->ContentType, response->ContentLength, response->BodyLength);
}
break;
}
- if ((length - nbytes) <= 0)
+ if (Stream_GetRemainingLength(s) < 1024)
{
- length *= 2;
- buffer = realloc(buffer, length);
+ Stream_EnsureRemainingCapacity(s, 1024);
+ buffer = (char*) Stream_Buffer(s);
+ payload = &buffer[payloadOffset];
}
}
- free(buffer);
+ Stream_Free(s, TRUE);
return response;
out_error:
http_response_free(response);
out_free:
- free(buffer);
+ Stream_Free(s, TRUE);
return NULL;
}
-static BOOL strings_equals_nocase(void* obj1, void* obj2)
-{
- if (!obj1 || !obj2)
- return FALSE;
-
- return _stricmp(obj1, obj2) == 0;
-}
-
-static void string_free(void* obj1)
-{
- if (!obj1)
- return;
-
- free(obj1);
-}
-
HttpResponse* http_response_new()
{
HttpResponse* response = (HttpResponse*) calloc(1, sizeof(HttpResponse));
free(response->lines);
free(response->ReasonPhrase);
+ free(response->ContentType);
+
ListDictionary_Free(response->Authenticates);
if (response->ContentLength > 0)
if (nego->state == NEGO_STATE_INITIAL)
{
- if (nego->enabled_protocols[PROTOCOL_EXT])
+ if (nego->EnabledProtocols[PROTOCOL_EXT])
{
nego->state = NEGO_STATE_EXT;
}
- else if (nego->enabled_protocols[PROTOCOL_NLA])
+ else if (nego->EnabledProtocols[PROTOCOL_NLA])
{
nego->state = NEGO_STATE_NLA;
}
- else if (nego->enabled_protocols[PROTOCOL_TLS])
+ else if (nego->EnabledProtocols[PROTOCOL_TLS])
{
nego->state = NEGO_STATE_TLS;
}
- else if (nego->enabled_protocols[PROTOCOL_RDP])
+ else if (nego->EnabledProtocols[PROTOCOL_RDP])
{
nego->state = NEGO_STATE_RDP;
}
WLog_DBG(TAG, "Security Layer Negotiation is disabled");
/* attempt only the highest enabled protocol (see nego_attempt_*) */
- nego->enabled_protocols[PROTOCOL_NLA] = FALSE;
- nego->enabled_protocols[PROTOCOL_TLS] = FALSE;
- nego->enabled_protocols[PROTOCOL_RDP] = FALSE;
- nego->enabled_protocols[PROTOCOL_EXT] = FALSE;
+ nego->EnabledProtocols[PROTOCOL_NLA] = FALSE;
+ nego->EnabledProtocols[PROTOCOL_TLS] = FALSE;
+ nego->EnabledProtocols[PROTOCOL_RDP] = FALSE;
+ nego->EnabledProtocols[PROTOCOL_EXT] = FALSE;
if (nego->state == NEGO_STATE_EXT)
{
- nego->enabled_protocols[PROTOCOL_EXT] = TRUE;
- nego->enabled_protocols[PROTOCOL_NLA] = TRUE;
- nego->selected_protocol = PROTOCOL_EXT;
+ nego->EnabledProtocols[PROTOCOL_EXT] = TRUE;
+ nego->EnabledProtocols[PROTOCOL_NLA] = TRUE;
+ nego->SelectedProtocol = PROTOCOL_EXT;
}
else if (nego->state == NEGO_STATE_NLA)
{
- nego->enabled_protocols[PROTOCOL_NLA] = TRUE;
- nego->selected_protocol = PROTOCOL_NLA;
+ nego->EnabledProtocols[PROTOCOL_NLA] = TRUE;
+ nego->SelectedProtocol = PROTOCOL_NLA;
}
else if (nego->state == NEGO_STATE_TLS)
{
- nego->enabled_protocols[PROTOCOL_TLS] = TRUE;
- nego->selected_protocol = PROTOCOL_TLS;
+ nego->EnabledProtocols[PROTOCOL_TLS] = TRUE;
+ nego->SelectedProtocol = PROTOCOL_TLS;
}
else if (nego->state == NEGO_STATE_RDP)
{
- nego->enabled_protocols[PROTOCOL_RDP] = TRUE;
- nego->selected_protocol = PROTOCOL_RDP;
+ nego->EnabledProtocols[PROTOCOL_RDP] = TRUE;
+ nego->SelectedProtocol = PROTOCOL_RDP;
}
}
- if (!nego_send_preconnection_pdu(nego))
+ if (nego->SendPreconnectionPdu)
{
- WLog_ERR(TAG, "Failed to send preconnection pdu");
- nego->state = NEGO_STATE_FINAL;
- return FALSE;
+ if (!nego_send_preconnection_pdu(nego))
+ {
+ WLog_ERR(TAG, "Failed to send preconnection pdu");
+ nego->state = NEGO_STATE_FINAL;
+ return FALSE;
+ }
}
}
}
while (nego->state != NEGO_STATE_FINAL);
- WLog_DBG(TAG, "Negotiated %s security", PROTOCOL_SECURITY_STRINGS[nego->selected_protocol]);
+ WLog_DBG(TAG, "Negotiated %s security", PROTOCOL_SECURITY_STRINGS[nego->SelectedProtocol]);
/* update settings with negotiated protocol security */
- settings->RequestedProtocols = nego->requested_protocols;
- settings->SelectedProtocol = nego->selected_protocol;
+ settings->RequestedProtocols = nego->RequestedProtocols;
+ settings->SelectedProtocol = nego->SelectedProtocol;
settings->NegotiationFlags = nego->flags;
- if (nego->selected_protocol == PROTOCOL_RDP)
+ if (nego->SelectedProtocol == PROTOCOL_RDP)
{
settings->UseRdpSecurityLayer = TRUE;
/* finally connect security layer (if not already done) */
if (!nego_security_connect(nego))
{
- WLog_DBG(TAG, "Failed to connect with %s security", PROTOCOL_SECURITY_STRINGS[nego->selected_protocol]);
+ WLog_DBG(TAG, "Failed to connect with %s security", PROTOCOL_SECURITY_STRINGS[nego->SelectedProtocol]);
return FALSE;
}
/* connect to selected security layer */
BOOL nego_security_connect(rdpNego* nego)
{
- if (!nego->tcp_connected)
+ if (!nego->TcpConnected)
{
- nego->security_connected = FALSE;
+ nego->SecurityConnected = FALSE;
}
- else if (!nego->security_connected)
+ else if (!nego->SecurityConnected)
{
- if (nego->selected_protocol == PROTOCOL_NLA)
+ if (nego->SelectedProtocol == PROTOCOL_NLA)
{
WLog_DBG(TAG, "nego_security_connect with PROTOCOL_NLA");
- nego->security_connected = transport_connect_nla(nego->transport);
+ nego->SecurityConnected = transport_connect_nla(nego->transport);
}
- else if (nego->selected_protocol == PROTOCOL_TLS)
+ else if (nego->SelectedProtocol == PROTOCOL_TLS)
{
WLog_DBG(TAG, "nego_security_connect with PROTOCOL_TLS");
- nego->security_connected = transport_connect_tls(nego->transport);
+ nego->SecurityConnected = transport_connect_tls(nego->transport);
}
- else if (nego->selected_protocol == PROTOCOL_RDP)
+ else if (nego->SelectedProtocol == PROTOCOL_RDP)
{
WLog_DBG(TAG, "nego_security_connect with PROTOCOL_RDP");
- nego->security_connected = transport_connect_rdp(nego->transport);
+ nego->SecurityConnected = transport_connect_rdp(nego->transport);
}
else
{
}
}
- return nego->security_connected;
+ return nego->SecurityConnected;
}
/**
BOOL nego_tcp_connect(rdpNego* nego)
{
- if (!nego->tcp_connected)
+ if (!nego->TcpConnected)
{
if (nego->GatewayEnabled)
{
WLog_INFO(TAG, "Detecting if host can be reached locally. - This might take some time.");
WLog_INFO(TAG, "To disable auto detection use /gateway-usage-method:direct");
transport_set_gateway_enabled(nego->transport, FALSE);
- nego->tcp_connected = transport_connect(nego->transport, nego->hostname, nego->port, 1);
+ nego->TcpConnected = transport_connect(nego->transport, nego->hostname, nego->port, 1);
}
- if (!nego->tcp_connected)
+ if (!nego->TcpConnected)
{
transport_set_gateway_enabled(nego->transport, TRUE);
- nego->tcp_connected = transport_connect(nego->transport, nego->hostname, nego->port, 15);
+ nego->TcpConnected = transport_connect(nego->transport, nego->hostname, nego->port, 15);
}
}
else
{
- nego->tcp_connected = transport_connect(nego->transport, nego->hostname, nego->port, 15);
+ nego->TcpConnected = transport_connect(nego->transport, nego->hostname, nego->port, 15);
}
}
- return nego->tcp_connected;
+ return nego->TcpConnected;
}
/**
{
nego_tcp_connect(nego);
- if (nego->tcp_connected && !nego->NegotiateSecurityLayer)
+ if (nego->TcpConnected && !nego->NegotiateSecurityLayer)
return nego_security_connect(nego);
- return nego->tcp_connected;
+ return nego->TcpConnected;
}
/**
BOOL nego_transport_disconnect(rdpNego* nego)
{
- if (nego->tcp_connected)
+ if (nego->TcpConnected)
transport_disconnect(nego->transport);
- nego->tcp_connected = FALSE;
- nego->security_connected = FALSE;
+ nego->TcpConnected = FALSE;
+ nego->SecurityConnected = FALSE;
return TRUE;
}
UINT16 cchPCB = 0;
WCHAR* wszPCB = NULL;
- if (!nego->send_preconnection_pdu)
- return TRUE;
-
WLog_DBG(TAG, "Sending preconnection PDU");
if (!nego_tcp_connect(nego))
/* it's easier to always send the version 2 PDU, and it's just 2 bytes overhead */
cbSize = PRECONNECTION_PDU_V2_MIN_SIZE;
- if (nego->preconnection_blob)
+ if (nego->PreconnectionBlob)
{
- cchPCB = (UINT16) ConvertToUnicode(CP_UTF8, 0, nego->preconnection_blob, -1, &wszPCB, 0);
+ cchPCB = (UINT16) ConvertToUnicode(CP_UTF8, 0, nego->PreconnectionBlob, -1, &wszPCB, 0);
cchPCB += 1; /* zero-termination */
cbSize += cchPCB * 2;
}
Stream_Write_UINT32(s, cbSize); /* cbSize */
Stream_Write_UINT32(s, 0); /* Flags */
Stream_Write_UINT32(s, PRECONNECTION_PDU_V2); /* Version */
- Stream_Write_UINT32(s, nego->preconnection_id); /* Id */
+ Stream_Write_UINT32(s, nego->PreconnectionId); /* Id */
Stream_Write_UINT16(s, cchPCB); /* cchPCB */
if (wszPCB)
void nego_attempt_ext(rdpNego* nego)
{
- nego->requested_protocols = PROTOCOL_NLA | PROTOCOL_TLS | PROTOCOL_EXT;
+ nego->RequestedProtocols = PROTOCOL_NLA | PROTOCOL_TLS | PROTOCOL_EXT;
WLog_DBG(TAG, "Attempting NLA extended security");
{
nego_transport_disconnect(nego);
- if (nego->enabled_protocols[PROTOCOL_NLA])
+ if (nego->EnabledProtocols[PROTOCOL_NLA])
nego->state = NEGO_STATE_NLA;
- else if (nego->enabled_protocols[PROTOCOL_TLS])
+ else if (nego->EnabledProtocols[PROTOCOL_TLS])
nego->state = NEGO_STATE_TLS;
- else if (nego->enabled_protocols[PROTOCOL_RDP])
+ else if (nego->EnabledProtocols[PROTOCOL_RDP])
nego->state = NEGO_STATE_RDP;
else
nego->state = NEGO_STATE_FAIL;
void nego_attempt_nla(rdpNego* nego)
{
- nego->requested_protocols = PROTOCOL_NLA | PROTOCOL_TLS;
+ nego->RequestedProtocols = PROTOCOL_NLA | PROTOCOL_TLS;
WLog_DBG(TAG, "Attempting NLA security");
{
nego_transport_disconnect(nego);
- if (nego->enabled_protocols[PROTOCOL_TLS])
+ if (nego->EnabledProtocols[PROTOCOL_TLS])
nego->state = NEGO_STATE_TLS;
- else if (nego->enabled_protocols[PROTOCOL_RDP])
+ else if (nego->EnabledProtocols[PROTOCOL_RDP])
nego->state = NEGO_STATE_RDP;
else
nego->state = NEGO_STATE_FAIL;
void nego_attempt_tls(rdpNego* nego)
{
- nego->requested_protocols = PROTOCOL_TLS;
+ nego->RequestedProtocols = PROTOCOL_TLS;
WLog_DBG(TAG, "Attempting TLS security");
{
nego_transport_disconnect(nego);
- if (nego->enabled_protocols[PROTOCOL_RDP])
+ if (nego->EnabledProtocols[PROTOCOL_RDP])
nego->state = NEGO_STATE_RDP;
else
nego->state = NEGO_STATE_FAIL;
void nego_attempt_rdp(rdpNego* nego)
{
- nego->requested_protocols = PROTOCOL_RDP;
+ nego->RequestedProtocols = PROTOCOL_RDP;
WLog_DBG(TAG, "Attempting RDP security");
case TYPE_RDP_NEG_RSP:
nego_process_negotiation_response(nego, s);
- WLog_DBG(TAG, "selected_protocol: %d", nego->selected_protocol);
+ WLog_DBG(TAG, "selected_protocol: %d", nego->SelectedProtocol);
/* enhanced security selected ? */
- if (nego->selected_protocol)
+ if (nego->SelectedProtocol)
{
- if ((nego->selected_protocol == PROTOCOL_NLA) &&
- (!nego->enabled_protocols[PROTOCOL_NLA]))
+ if ((nego->SelectedProtocol == PROTOCOL_NLA) &&
+ (!nego->EnabledProtocols[PROTOCOL_NLA]))
{
nego->state = NEGO_STATE_FAIL;
}
- if ((nego->selected_protocol == PROTOCOL_TLS) &&
- (!nego->enabled_protocols[PROTOCOL_TLS]))
+ if ((nego->SelectedProtocol == PROTOCOL_TLS) &&
+ (!nego->EnabledProtocols[PROTOCOL_TLS]))
{
nego->state = NEGO_STATE_FAIL;
}
}
- else if (!nego->enabled_protocols[PROTOCOL_RDP])
+ else if (!nego->EnabledProtocols[PROTOCOL_RDP])
{
nego->state = NEGO_STATE_FAIL;
}
{
WLog_DBG(TAG, "no rdpNegData");
- if (!nego->enabled_protocols[PROTOCOL_RDP])
+ if (!nego->EnabledProtocols[PROTOCOL_RDP])
nego->state = NEGO_STATE_FAIL;
else
nego->state = NEGO_STATE_FINAL;
if (li != Stream_GetRemainingLength(s) + 6)
{
- WLog_ERR(TAG, "Incorrect TPDU length indicator.");
+ WLog_ERR(TAG, "Incorrect TPDU length indicator.");
return FALSE;
}
if (type != TYPE_RDP_NEG_REQ)
{
- WLog_ERR(TAG, "Incorrect negotiation request type %d", type);
+ WLog_ERR(TAG, "Incorrect negotiation request type %d", type);
return FALSE;
}
if (nego->RoutingToken)
{
Stream_Write(s, nego->RoutingToken, nego->RoutingTokenLength);
+
/* Ensure Routing Token is correctly terminated - may already be present in string */
- if (nego->RoutingTokenLength>2 && (nego->RoutingToken[nego->RoutingTokenLength-2]==0x0D && nego->RoutingToken[nego->RoutingTokenLength-1]==0x0A))
+
+ if ((nego->RoutingTokenLength > 2) &&
+ (nego->RoutingToken[nego->RoutingTokenLength - 2] == 0x0D) &&
+ (nego->RoutingToken[nego->RoutingTokenLength - 1] == 0x0A))
{
WLog_DBG(TAG, "Routing token looks correctly terminated - use verbatim");
length +=nego->RoutingTokenLength;
{
cookie_length = strlen(nego->cookie);
- if (cookie_length > (int) nego->cookie_max_length)
- cookie_length = nego->cookie_max_length;
+ if (cookie_length > (int) nego->CookieMaxLength)
+ cookie_length = nego->CookieMaxLength;
Stream_Write(s, "Cookie: mstshash=", 17);
Stream_Write(s, (BYTE*) nego->cookie, cookie_length);
length += cookie_length + 19;
}
- WLog_DBG(TAG, "RequestedProtocols: %d", nego->requested_protocols);
+ WLog_DBG(TAG, "RequestedProtocols: %d", nego->RequestedProtocols);
- if ((nego->requested_protocols > PROTOCOL_RDP) || (nego->sendNegoData))
+ if ((nego->RequestedProtocols > PROTOCOL_RDP) || (nego->sendNegoData))
{
/* RDP_NEG_DATA must be present for TLS and NLA */
Stream_Write_UINT8(s, TYPE_RDP_NEG_REQ);
Stream_Write_UINT8(s, flags);
Stream_Write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
- Stream_Write_UINT32(s, nego->requested_protocols); /* requestedProtocols */
+ Stream_Write_UINT32(s, nego->RequestedProtocols); /* requestedProtocols */
length += 8;
}
Stream_Read_UINT8(s, flags);
Stream_Read_UINT16(s, length);
- Stream_Read_UINT32(s, nego->requested_protocols);
+ Stream_Read_UINT32(s, nego->RequestedProtocols);
- WLog_DBG(TAG, "RDP_NEG_REQ: RequestedProtocol: 0x%04X", nego->requested_protocols);
+ WLog_DBG(TAG, "RDP_NEG_REQ: RequestedProtocol: 0x%04X", nego->RequestedProtocols);
nego->state = NEGO_STATE_FINAL;
}
Stream_Read_UINT8(s, nego->flags);
Stream_Read_UINT16(s, length);
- Stream_Read_UINT32(s, nego->selected_protocol);
+ Stream_Read_UINT32(s, nego->SelectedProtocol);
nego->state = NEGO_STATE_FINAL;
}
bm = Stream_GetPosition(s);
Stream_Seek(s, length);
- if ((nego->selected_protocol == PROTOCOL_RDP) && !settings->RdpSecurity)
+ if ((nego->SelectedProtocol == PROTOCOL_RDP) && !settings->RdpSecurity)
{
flags = 0;
* TODO: Check for other possibilities,
* like SSL_NOT_ALLOWED_BY_SERVER.
*/
- WLog_ERR(TAG, "client supports only Standard RDP Security");
+ WLog_ERR(TAG, "client supports only Standard RDP Security");
Stream_Write_UINT32(s, SSL_REQUIRED_BY_SERVER);
length += 8;
status = FALSE;
Stream_Write_UINT8(s, TYPE_RDP_NEG_RSP);
Stream_Write_UINT8(s, flags); /* flags */
Stream_Write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
- Stream_Write_UINT32(s, nego->selected_protocol); /* selectedProtocol */
+ Stream_Write_UINT32(s, nego->SelectedProtocol); /* selectedProtocol */
length += 8;
}
if (status)
{
/* update settings with negotiated protocol security */
- settings->RequestedProtocols = nego->requested_protocols;
- settings->SelectedProtocol = nego->selected_protocol;
+ settings->RequestedProtocols = nego->RequestedProtocols;
+ settings->SelectedProtocol = nego->SelectedProtocol;
if (settings->SelectedProtocol == PROTOCOL_RDP)
{
void nego_init(rdpNego* nego)
{
nego->state = NEGO_STATE_INITIAL;
- nego->requested_protocols = PROTOCOL_RDP;
+ nego->RequestedProtocols = PROTOCOL_RDP;
nego->transport->ReceiveCallback = nego_recv;
nego->transport->ReceiveExtra = (void*) nego;
- nego->cookie_max_length = DEFAULT_COOKIE_MAX_LENGTH;
+ nego->CookieMaxLength = DEFAULT_COOKIE_MAX_LENGTH;
nego->sendNegoData = FALSE;
nego->flags = 0;
}
void nego_enable_rdp(rdpNego* nego, BOOL enable_rdp)
{
WLog_DBG(TAG, "Enabling RDP security: %s", enable_rdp ? "TRUE" : "FALSE");
- nego->enabled_protocols[PROTOCOL_RDP] = enable_rdp;
+ nego->EnabledProtocols[PROTOCOL_RDP] = enable_rdp;
}
/**
void nego_enable_tls(rdpNego* nego, BOOL enable_tls)
{
WLog_DBG(TAG, "Enabling TLS security: %s", enable_tls ? "TRUE" : "FALSE");
- nego->enabled_protocols[PROTOCOL_TLS] = enable_tls;
+ nego->EnabledProtocols[PROTOCOL_TLS] = enable_tls;
}
/**
void nego_enable_nla(rdpNego* nego, BOOL enable_nla)
{
WLog_DBG(TAG, "Enabling NLA security: %s", enable_nla ? "TRUE" : "FALSE");
- nego->enabled_protocols[PROTOCOL_NLA] = enable_nla;
+ nego->EnabledProtocols[PROTOCOL_NLA] = enable_nla;
}
/**
void nego_enable_ext(rdpNego* nego, BOOL enable_ext)
{
WLog_DBG(TAG, "Enabling NLA extended security: %s", enable_ext ? "TRUE" : "FALSE");
- nego->enabled_protocols[PROTOCOL_EXT] = enable_ext;
+ nego->EnabledProtocols[PROTOCOL_EXT] = enable_ext;
}
/**
/**
* Set cookie maximum length
* @param nego
- * @param cookie_max_length
+ * @param CookieMaxLength
*/
-void nego_set_cookie_max_length(rdpNego* nego, UINT32 cookie_max_length)
+void nego_set_cookie_max_length(rdpNego* nego, UINT32 CookieMaxLength)
{
- nego->cookie_max_length = cookie_max_length;
+ nego->CookieMaxLength = CookieMaxLength;
}
/**
* @param send_pcpdu
*/
-void nego_set_send_preconnection_pdu(rdpNego* nego, BOOL send_pcpdu)
+void nego_set_send_preconnection_pdu(rdpNego* nego, BOOL SendPreconnectionPdu)
{
- nego->send_preconnection_pdu = send_pcpdu;
+ nego->SendPreconnectionPdu = SendPreconnectionPdu;
}
/**
* @param id
*/
-void nego_set_preconnection_id(rdpNego* nego, UINT32 id)
+void nego_set_preconnection_id(rdpNego* nego, UINT32 PreconnectionId)
{
- nego->preconnection_id = id;
+ nego->PreconnectionId = PreconnectionId;
}
/**
* @param blob
*/
-void nego_set_preconnection_blob(rdpNego* nego, char* blob)
+void nego_set_preconnection_blob(rdpNego* nego, char* PreconnectionBlob)
{
- nego->preconnection_blob = blob;
+ nego->PreconnectionBlob = PreconnectionBlob;
}