libfreerdp-core: improve similarity of TSG messages with mstsc

This commit is contained in:
Marc-André Moreau 2012-10-28 18:01:18 -04:00
parent 67c24dc81d
commit 744c60b66d
2 changed files with 28 additions and 9 deletions

View File

@ -228,9 +228,9 @@ STREAM* http_request_write(HttpContext* http_context, HttpRequest* http_request)
for (i = 0; i < http_request->count; i++)
{
length += (strlen(http_request->lines[i]) + 1); /* add +1 for each '\n' character */
length += (strlen(http_request->lines[i]) + 2); /* add +2 for each '\r\n' character */
}
length += 1; /* empty line "\n" at end of header */
length += 2; /* empty line "\r\n" at end of header */
length += 1; /* null terminator */
s = stream_new(length);
@ -238,10 +238,10 @@ STREAM* http_request_write(HttpContext* http_context, HttpRequest* http_request)
for (i = 0; i < http_request->count; i++)
{
stream_write(s, http_request->lines[i], strlen(http_request->lines[i]));
stream_write(s, "\n", 1);
stream_write(s, "\r\n", 2);
free(http_request->lines[i]);
}
stream_write(s, "\n", 1);
stream_write(s, "\r\n", 2);
free(http_request->lines);

View File

@ -33,14 +33,17 @@
#include "rpc.h"
BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality, char* user, char* domain, char* password)
/**
* The Security Support Provider Interface:
* http://technet.microsoft.com/en-us/library/bb742535/
*/
BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL http, char* user, char* domain, char* password)
{
SECURITY_STATUS status;
sspi_GlobalInit();
ntlm->confidentiality = confidentiality;
#ifdef WITH_NATIVE_SSPI
{
HMODULE hSSPI;
@ -87,10 +90,26 @@ BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality, char* user, char* dom
ZeroMemory(&ntlm->outputBuffer, sizeof(SecBuffer));
ZeroMemory(&ntlm->ContextSizes, sizeof(SecPkgContext_Sizes));
ntlm->fContextReq = ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT | ISC_REQ_DELEGATE;
ntlm->fContextReq = 0;
if (ntlm->confidentiality)
if (http)
{
/* flags for HTTP authentication */
ntlm->fContextReq |= ISC_REQ_CONFIDENTIALITY;
}
else
{
/**
* flags for RPC authentication:
* RPC_C_AUTHN_LEVEL_PKT_INTEGRITY:
* ISC_REQ_USE_DCE_STYLE | ISC_REQ_DELEGATE | ISC_REQ_MUTUAL_AUTH |
* ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT
*/
ntlm->fContextReq |= ISC_REQ_USE_DCE_STYLE;
ntlm->fContextReq |= ISC_REQ_DELEGATE | ISC_REQ_MUTUAL_AUTH;
ntlm->fContextReq |= ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT;
}
return TRUE;
}