示例#1
0
文件: rpc.c 项目: felfert/FreeRDP
boolean rpc_ntlm_http_in_connect(rdpRpc* rpc)
{
	STREAM* s;
	int ntlm_token_length;
	uint8* ntlm_token_data;
	HttpResponse* http_response;
	rdpNtlm* ntlm = rpc->ntlm_http_in->ntlm;

	ntlm_client_init(ntlm, true, rpc->settings->username,
			rpc->settings->domain, rpc->settings->password);

	ntlm_authenticate(ntlm);

	s = rpc_ntlm_http_request(rpc, &ntlm->outputBuffer, 0, TSG_CHANNEL_IN);

	/* Send IN Channel Request */

	DEBUG_RPC("\n%s", s->data);
	tls_write_all(rpc->tls_in, s->data, s->size);
	stream_free(s);

	/* Receive IN Channel Response */

	http_response = http_response_recv(rpc->tls_in);

	ntlm_token_data = NULL;
	crypto_base64_decode((uint8*) http_response->AuthParam, strlen(http_response->AuthParam),
			&ntlm_token_data, &ntlm_token_length);

	ntlm->inputBuffer.pvBuffer = ntlm_token_data;
	ntlm->inputBuffer.cbBuffer = ntlm_token_length;

	ntlm_authenticate(ntlm);

	http_response_free(http_response);

	s = rpc_ntlm_http_request(rpc, &ntlm->outputBuffer, 0x40000000, TSG_CHANNEL_IN);

	/* Send IN Channel Request */

	DEBUG_RPC("\n%s", s->data);
	tls_write_all(rpc->tls_in, s->data, s->size);
	stream_free(s);

	ntlm_client_uninit(ntlm);
	ntlm_free(ntlm);

	return true;
}
示例#2
0
int rpc_ncacn_http_send_out_channel_request(rdpRpc* rpc, RpcOutChannel* outChannel, BOOL replacement)
{
	wStream* s;
	int status;
	int contentLength;
	BOOL continueNeeded;
	rdpNtlm* ntlm = outChannel->ntlm;
	HttpContext* http = outChannel->http;

	continueNeeded = ntlm_authenticate(ntlm);

	if (!replacement)
		contentLength = (continueNeeded) ? 0 : 76;
	else
		contentLength = (continueNeeded) ? 0 : 120;

	s = rpc_ntlm_http_request(rpc, http, "RPC_OUT_DATA", contentLength, &ntlm->outputBuffer[0]);

	if (!s)
		return -1;

	status = rpc_out_channel_write(outChannel, Stream_Buffer(s), Stream_Length(s));

	Stream_Free(s, TRUE);

	return (status > 0) ? 1 : -1;
}
示例#3
0
int rpc_http_send_replacement_out_channel_request(rdpRpc* rpc)
{
	wStream* s;
	int content_length;

	content_length = 120;

	s = rpc_ntlm_http_request(rpc, NULL, content_length, TSG_CHANNEL_OUT);

	WLog_DBG(TAG, "\n%s", Stream_Buffer(s));
	rpc_out_write(rpc, Stream_Buffer(s), Stream_Length(s));
	Stream_Free(s, TRUE);

	return 0;
}
示例#4
0
int rpc_http_send_replacement_out_channel_request(rdpRpc* rpc)
{
	int status;
	wStream* s;

	s = rpc_ntlm_http_request(rpc, NULL, 120, TSG_CHANNEL_OUT);

	if (!s)
		return -1;

	WLog_DBG(TAG, "\n%s", Stream_Buffer(s));

	status = rpc_out_write(rpc, Stream_Buffer(s), Stream_Length(s));

	Stream_Free(s, TRUE);

	return (status > 0) ? 1 : -1;
}
示例#5
0
int rpc_ncacn_http_send_in_channel_request(rdpRpc* rpc)
{
	wStream* s;
	int content_length;
	BOOL continue_needed;
	rdpNtlm* ntlm = rpc->NtlmHttpIn->ntlm;

	continue_needed = ntlm_authenticate(ntlm);

	content_length = (continue_needed) ? 0 : 0x40000000;

	s = rpc_ntlm_http_request(rpc, &ntlm->outputBuffer[0], content_length, TSG_CHANNEL_IN);

	WLog_DBG(TAG, "\n%s", Stream_Buffer(s));
	rpc_in_write(rpc, Stream_Buffer(s), Stream_Length(s));
	Stream_Free(s, TRUE);

	return 0;
}
示例#6
0
int rpc_ncacn_http_send_out_channel_request(rdpRpc* rpc)
{
	wStream* s;
	int content_length;
	BOOL continue_needed;
	rdpNtlm* ntlm = rpc->NtlmHttpOut->ntlm;

	continue_needed = ntlm_authenticate(ntlm);

	content_length = (continue_needed) ? 0 : 76;

	s = rpc_ntlm_http_request(rpc, &ntlm->outputBuffer, content_length, TSG_CHANNEL_OUT);

	DEBUG_RPC("\n%s", Stream_Buffer(s));
	rpc_out_write(rpc, Stream_Buffer(s), Stream_Length(s));
	Stream_Free(s, TRUE);

	return 0;
}
示例#7
0
int rpc_ncacn_http_send_in_channel_request(rdpRpc* rpc)
{
	STREAM* s;
	int content_length;
	BOOL continue_needed;
	rdpNtlm* ntlm = rpc->NtlmHttpIn->ntlm;

	continue_needed = ntlm_authenticate(ntlm);

	content_length = (continue_needed) ? 0 : 0x40000000;

	s = rpc_ntlm_http_request(rpc, &ntlm->outputBuffer, content_length, TSG_CHANNEL_IN);

	DEBUG_RPC("\n%s", s->data);
	rpc_in_write(rpc, s->data, s->size);
	stream_free(s);

	return 0;
}
示例#8
0
int rpc_ncacn_http_send_in_channel_request(rdpRpc* rpc)
{
	wStream* s;
	int status;
	int contentLength;
	BOOL continueNeeded;
	rdpNtlm* ntlm = rpc->NtlmHttpIn->ntlm;

	continueNeeded = ntlm_authenticate(ntlm);

	contentLength = (continueNeeded) ? 0 : 0x40000000;

	s = rpc_ntlm_http_request(rpc, &ntlm->outputBuffer[0], contentLength, TSG_CHANNEL_IN);

	if (!s)
		return -1;

	status = rpc_in_write(rpc, Stream_Buffer(s), Stream_Length(s));

	Stream_Free(s, TRUE);

	return (status > 0) ? 1 : -1;
}
示例#9
0
int rpc_ncacn_http_send_in_channel_request(rdpRpc* rpc, RpcInChannel* inChannel)
{
	wStream* s;
	int status;
	int contentLength;
	BOOL continueNeeded;
	rdpNtlm* ntlm = inChannel->ntlm;
	HttpContext* http = inChannel->http;

	continueNeeded = ntlm_authenticate(ntlm);

	contentLength = (continueNeeded) ? 0 : 0x40000000;

	s = rpc_ntlm_http_request(rpc, http, "RPC_IN_DATA", contentLength, &ntlm->outputBuffer[0]);

	if (!s)
		return -1;

	status = rpc_in_channel_write(inChannel, Stream_Buffer(s), Stream_Length(s));

	Stream_Free(s, TRUE);

	return (status > 0) ? 1 : -1;
}
示例#10
0
文件: rpc.c 项目: atong/FreeRDP
BOOL rpc_ntlm_http_in_connect(rdpRpc* rpc)
{
    STREAM* s;
    rdpSettings* settings;
    int ntlm_token_length;
    BYTE* ntlm_token_data;
    HttpResponse* http_response;
    rdpNtlm* ntlm = rpc->ntlm_http_in->ntlm;

    settings = rpc->settings;

    if (settings->tsg_same_credentials)
    {
        ntlm_client_init(ntlm, TRUE, settings->username,
                         settings->domain, settings->password);
        ntlm_client_make_spn(ntlm, _T("HTTP"), settings->tsg_hostname);
    }
    else
    {
        ntlm_client_init(ntlm, TRUE, settings->tsg_username,
                         settings->tsg_domain, settings->tsg_password);
        ntlm_client_make_spn(ntlm, _T("HTTP"), settings->tsg_hostname);
    }

    ntlm_authenticate(ntlm);

    s = rpc_ntlm_http_request(rpc, &ntlm->outputBuffer, 0, TSG_CHANNEL_IN);

    /* Send IN Channel Request */

    DEBUG_RPC("\n%s", s->data);
    tls_write_all(rpc->tls_in, s->data, s->size);
    stream_free(s);

    /* Receive IN Channel Response */

    http_response = http_response_recv(rpc->tls_in);

    ntlm_token_data = NULL;
    crypto_base64_decode((BYTE*) http_response->AuthParam, strlen(http_response->AuthParam),
                         &ntlm_token_data, &ntlm_token_length);

    ntlm->inputBuffer.pvBuffer = ntlm_token_data;
    ntlm->inputBuffer.cbBuffer = ntlm_token_length;

    ntlm_authenticate(ntlm);

    http_response_free(http_response);

    s = rpc_ntlm_http_request(rpc, &ntlm->outputBuffer, 0x40000000, TSG_CHANNEL_IN);

    /* Send IN Channel Request */

    DEBUG_RPC("\n%s", s->data);
    tls_write_all(rpc->tls_in, s->data, s->size);
    stream_free(s);

    ntlm_client_uninit(ntlm);
    ntlm_free(ntlm);

    return TRUE;
}