void rpc_ncacn_http_ntlm_uninit(rdpRpc* rpc, TSG_CHANNEL channel) { if (channel == TSG_CHANNEL_IN) { ntlm_client_uninit(rpc->NtlmHttpIn->ntlm); ntlm_free(rpc->NtlmHttpIn->ntlm); rpc->NtlmHttpIn->ntlm = NULL; } else if (channel == TSG_CHANNEL_OUT) { ntlm_client_uninit(rpc->NtlmHttpOut->ntlm); ntlm_free(rpc->NtlmHttpOut->ntlm); rpc->NtlmHttpOut->ntlm = NULL; } }
BOOL rpc_ntlm_http_out_connect(rdpRpc* rpc) { rdpNtlm* ntlm = rpc->NtlmHttpOut->ntlm; BOOL success = FALSE; if (rpc_ncacn_http_ntlm_init(rpc, TSG_CHANNEL_OUT) == 1) { success = TRUE; /* Send OUT Channel Request */ rpc_ncacn_http_send_out_channel_request(rpc); /* Receive OUT Channel Response */ rpc_ncacn_http_recv_out_channel_response(rpc); /* Send OUT Channel Request */ rpc_ncacn_http_send_out_channel_request(rpc); ntlm_client_uninit(ntlm); } ntlm_free(ntlm); rpc->NtlmHttpOut->ntlm = NULL; return success; }
BOOL rpc_ntlm_http_in_connect(rdpRpc* rpc) { BOOL success = FALSE; rdpNtlm* ntlm = rpc->NtlmHttpIn->ntlm; if (rpc_ncacn_http_ntlm_init(rpc, TSG_CHANNEL_IN) == 1) { success = TRUE; /* Send IN Channel Request */ rpc_ncacn_http_send_in_channel_request(rpc); /* Receive IN Channel Response */ rpc_ncacn_http_recv_in_channel_response(rpc); /* Send IN Channel Request */ rpc_ncacn_http_send_in_channel_request(rpc); ntlm_client_uninit(ntlm); } ntlm_free(ntlm); rpc->NtlmHttpIn->ntlm = NULL; return success; }
void ntlm_free(rdpNtlm* ntlm) { if (!ntlm) return; if (ntlm->outputBuffer[0].pvBuffer) { free(ntlm->outputBuffer[0].pvBuffer); ntlm->outputBuffer[0].pvBuffer = NULL; } ntlm_client_uninit(ntlm); free(ntlm); }
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; }
void rpc_free(rdpRpc* rpc) { if (rpc != NULL) { rpc_client_stop(rpc); if (rpc->State >= RPC_CLIENT_STATE_CONTEXT_NEGOTIATED) { ntlm_client_uninit(rpc->ntlm); ntlm_free(rpc->ntlm); } rpc_client_virtual_connection_free(rpc->VirtualConnection); ArrayList_Clear(rpc->VirtualConnectionCookieTable); ArrayList_Free(rpc->VirtualConnectionCookieTable); free(rpc); } }
void rpc_free(rdpRpc* rpc) { if (rpc) { rpc_client_free(rpc); if (rpc->ntlm) { ntlm_client_uninit(rpc->ntlm); ntlm_free(rpc->ntlm); rpc->ntlm = NULL; } if (rpc->VirtualConnection) { rpc_virtual_connection_free(rpc->VirtualConnection); rpc->VirtualConnection = NULL; } free(rpc); } }
BOOL rpc_ntlm_http_out_connect(rdpRpc* rpc) { rdpNtlm* ntlm = rpc->NtlmHttpOut->ntlm; rpc_ncacn_http_ntlm_init(rpc, TSG_CHANNEL_OUT); /* Send OUT Channel Request */ rpc_ncacn_http_send_out_channel_request(rpc); /* Receive OUT Channel Response */ rpc_ncacn_http_recv_out_channel_response(rpc); /* Send OUT Channel Request */ rpc_ncacn_http_send_out_channel_request(rpc); ntlm_client_uninit(ntlm); ntlm_free(ntlm); return TRUE; }
void rpc_ncacn_http_ntlm_uninit(rdpRpc* rpc, RpcChannel* channel) { ntlm_client_uninit(channel->ntlm); ntlm_free(channel->ntlm); channel->ntlm = NULL; }
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; }