wStream* s;
int status;
int contentLength;
- BOOL continueNeeded;
+ BOOL continueNeeded = FALSE;
rdpNtlm* ntlm;
HttpContext* http;
const SecBuffer* buffer;
ntlm = inChannel->ntlm;
http = inChannel->http;
- continueNeeded = ntlm_authenticate(ntlm);
+
+ if (!ntlm_authenticate(ntlm, &continueNeeded))
+ return FALSE;
+
contentLength = (continueNeeded) ? 0 : 0x40000000;
buffer = ntlm_client_get_output_buffer(ntlm);
s = rpc_ntlm_http_request(http, "RPC_IN_DATA", contentLength, buffer);
BOOL rc = TRUE;
wStream* s;
int contentLength;
- BOOL continueNeeded;
+ BOOL continueNeeded = FALSE;
rdpNtlm* ntlm;
HttpContext* http;
const SecBuffer* buffer;
ntlm = outChannel->ntlm;
http = outChannel->http;
- continueNeeded = ntlm_authenticate(ntlm);
+
+ if (!ntlm_authenticate(ntlm, &continueNeeded))
+ return FALSE;
if (!replacement)
contentLength = (continueNeeded) ? 0 : 76;
* --------------
*/
-BOOL ntlm_authenticate(rdpNtlm* ntlm)
+BOOL ntlm_authenticate(rdpNtlm* ntlm, BOOL* pbContinueNeeded)
{
SECURITY_STATUS status;
ntlm->haveInputBuffer = TRUE;
ntlm->haveContext = TRUE;
- return (status == SEC_I_CONTINUE_NEEDED) ? TRUE : FALSE;
+
+ if (pbContinueNeeded)
+ *pbContinueNeeded = (status == SEC_I_CONTINUE_NEEDED) ? TRUE : FALSE;
+
+ return TRUE;
}
static void ntlm_client_uninit(rdpNtlm* ntlm)
FREERDP_LOCAL rdpNtlm* ntlm_new(void);
FREERDP_LOCAL void ntlm_free(rdpNtlm* ntlm);
-FREERDP_LOCAL BOOL ntlm_authenticate(rdpNtlm* ntlm);
+FREERDP_LOCAL BOOL ntlm_authenticate(rdpNtlm* ntlm, BOOL* pbContinueNeeded);
FREERDP_LOCAL BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality,
LPCTSTR user, LPCTSTR domain,
wStream* s;
const size_t header = sizeof(RdgPacketHeader);
size_t packetLength;
-
- assert (header <= INT_MAX);
-
+ assert(header <= INT_MAX);
s = Stream_New(NULL, 1024);
if (!s)
static BOOL rdg_handle_ntlm_challenge(rdpNtlm* ntlm, HttpResponse* response)
{
+ BOOL continueNeeded = FALSE;
size_t len;
const char* token64 = NULL;
int ntlmTokenLength = 0;
return FALSE;
}
- return ntlm_authenticate(ntlm);
+ if (!ntlm_authenticate(ntlm, &continueNeeded))
+ return FALSE;
+
+ return continueNeeded;
}
static BOOL rdg_skip_seed_payload(rdpTls* tls, SSIZE_T lastResponseLength)
static BOOL rdg_ntlm_init(rdpRdg* rdg, rdpTls* tls)
{
+ BOOL continueNeeded = FALSE;
rdpContext* context = rdg->context;
rdpSettings* settings = context->settings;
rdg->ntlm = ntlm_new();
if (!ntlm_client_make_spn(rdg->ntlm, _T("HTTP"), settings->GatewayHostname))
return FALSE;
- if (!ntlm_authenticate(rdg->ntlm))
+ if (!ntlm_authenticate(rdg->ntlm, &continueNeeded))
return FALSE;
- return TRUE;
+ return continueNeeded;
}
static BOOL rdg_send_http_request(rdpRdg* rdg, rdpTls* tls, const char* method,
if (!bufferedBio)
{
- closesocket((SOCKET)sockfd);
- BIO_free(socketBio);
+ BIO_free_all(socketBio);
return FALSE;
}
{
if (!proxy_connect(settings, bufferedBio, proxyUsername, proxyPassword, settings->GatewayHostname,
(UINT16)settings->GatewayPort))
+ {
+ BIO_free_all(bufferedBio);
return FALSE;
+ }
}
if (!status)
int rpc_send_bind_pdu(rdpRpc* rpc)
{
+ BOOL continueNeeded = FALSE;
int status = -1;
BYTE* buffer = NULL;
UINT32 offset;
if (!ntlm_client_make_spn(rpc->ntlm, NULL, settings->GatewayHostname))
goto fail;
- if (!ntlm_authenticate(rpc->ntlm))
+ if (!ntlm_authenticate(rpc->ntlm, &continueNeeded))
+ goto fail;
+
+ if (!continueNeeded)
goto fail;
bind_pdu = (rpcconn_bind_hdr_t*) calloc(1, sizeof(rpcconn_bind_hdr_t));
int rpc_recv_bind_ack_pdu(rdpRpc* rpc, BYTE* buffer, UINT32 length)
{
+ BOOL continueNeeded = FALSE;
BYTE* auth_data;
rpcconn_hdr_t* header;
header = (rpcconn_hdr_t*) buffer;
if (!ntlm_client_set_input_buffer(rpc->ntlm, TRUE, auth_data, header->common.auth_length))
return -1;
- ntlm_authenticate(rpc->ntlm);
+ if (!ntlm_authenticate(rpc->ntlm, &continueNeeded))
+ return -1;
+
+ if (continueNeeded)
+ return -1;
+
return (int) length;
}