diff --git a/libfreerdp/core/http.c b/libfreerdp/core/http.c index 1ba028078..6ece2e3ff 100644 --- a/libfreerdp/core/http.c +++ b/libfreerdp/core/http.c @@ -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); diff --git a/libfreerdp/core/rpc.c b/libfreerdp/core/rpc.c index 081eda1bd..5c5ee3ad2 100644 --- a/libfreerdp/core/rpc.c +++ b/libfreerdp/core/rpc.c @@ -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; }