mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 08:54:38 +09:00
Refactored rdg channel structs.
This commit is contained in:
@@ -374,7 +374,7 @@ static BOOL http_encode_print(wStream* s, const char* fmt, ...)
|
||||
if (!Stream_EnsureRemainingCapacity(s, length))
|
||||
return FALSE;
|
||||
|
||||
str = Stream_Pointer(s);
|
||||
str = (char*)Stream_Pointer(s);
|
||||
va_start(ap, fmt);
|
||||
used = vsnprintf(str, length, fmt, ap);
|
||||
va_end(ap);
|
||||
@@ -724,7 +724,7 @@ HttpResponse* http_response_recv(rdpTls* tls)
|
||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
||||
VALGRIND_MAKE_MEM_DEFINED(Stream_Pointer(response->data), status);
|
||||
#endif
|
||||
Stream_Seek(response->data, status);
|
||||
Stream_Seek(response->data, (size_t)status);
|
||||
|
||||
if (Stream_GetRemainingLength(response->data) < 1024)
|
||||
{
|
||||
@@ -831,7 +831,7 @@ HttpResponse* http_response_recv(rdpTls* tls)
|
||||
continue;
|
||||
}
|
||||
|
||||
Stream_Seek(response->data, status);
|
||||
Stream_Seek(response->data, (size_t)status);
|
||||
response->BodyLength += status;
|
||||
|
||||
if (response->BodyLength > RESPONSE_SIZE_LIMIT)
|
||||
@@ -909,7 +909,7 @@ SSIZE_T http_request_get_content_length(HttpRequest* request)
|
||||
if (!request)
|
||||
return -1;
|
||||
|
||||
return request->ContentLength;
|
||||
return (SSIZE_T)request->ContentLength;
|
||||
}
|
||||
|
||||
BOOL http_request_set_content_length(HttpRequest* request, size_t length)
|
||||
@@ -934,7 +934,7 @@ SSIZE_T http_response_get_body_length(HttpResponse* response)
|
||||
if (!response)
|
||||
return -1;
|
||||
|
||||
return response->BodyLength;
|
||||
return (SSIZE_T)response->BodyLength;
|
||||
}
|
||||
|
||||
const char* http_response_get_auth_token(HttpResponse* respone, const char* method)
|
||||
|
||||
@@ -68,7 +68,7 @@ fail:
|
||||
return s;
|
||||
}
|
||||
|
||||
BOOL rpc_ncacn_http_send_in_channel_request(RpcInChannel* inChannel)
|
||||
BOOL rpc_ncacn_http_send_in_channel_request(RpcChannel* inChannel)
|
||||
{
|
||||
wStream* s;
|
||||
int status;
|
||||
@@ -89,15 +89,15 @@ BOOL rpc_ncacn_http_send_in_channel_request(RpcInChannel* inChannel)
|
||||
if (!s)
|
||||
return -1;
|
||||
|
||||
status = rpc_in_channel_write(inChannel, Stream_Buffer(s), Stream_Length(s));
|
||||
status = rpc_channel_write(inChannel, Stream_Buffer(s), Stream_Length(s));
|
||||
Stream_Free(s, TRUE);
|
||||
return (status > 0) ? 1 : -1;
|
||||
}
|
||||
|
||||
BOOL rpc_ncacn_http_recv_in_channel_response(RpcInChannel* inChannel,
|
||||
BOOL rpc_ncacn_http_recv_in_channel_response(RpcChannel* inChannel,
|
||||
HttpResponse* response)
|
||||
{
|
||||
char* token64 = NULL;
|
||||
const char* token64 = NULL;
|
||||
int ntlmTokenLength = 0;
|
||||
BYTE* ntlmTokenData = NULL;
|
||||
rdpNtlm* ntlm;
|
||||
@@ -205,12 +205,11 @@ void rpc_ncacn_http_ntlm_uninit(RpcChannel* channel)
|
||||
channel->ntlm = NULL;
|
||||
}
|
||||
|
||||
BOOL rpc_ncacn_http_send_out_channel_request(RpcOutChannel* outChannel,
|
||||
BOOL rpc_ncacn_http_send_out_channel_request(RpcChannel* outChannel,
|
||||
BOOL replacement)
|
||||
{
|
||||
BOOL rc = TRUE;
|
||||
wStream* s;
|
||||
int status;
|
||||
int contentLength;
|
||||
BOOL continueNeeded;
|
||||
rdpNtlm* ntlm;
|
||||
@@ -233,17 +232,17 @@ BOOL rpc_ncacn_http_send_out_channel_request(RpcOutChannel* outChannel,
|
||||
if (!s)
|
||||
return -1;
|
||||
|
||||
if (rpc_out_channel_write(outChannel, Stream_Buffer(s), Stream_Length(s)) < 0)
|
||||
if (rpc_channel_write(outChannel, Stream_Buffer(s), Stream_Length(s)) < 0)
|
||||
rc = FALSE;
|
||||
|
||||
Stream_Free(s, TRUE);
|
||||
return rc;
|
||||
}
|
||||
|
||||
BOOL rpc_ncacn_http_recv_out_channel_response(RpcOutChannel* outChannel,
|
||||
BOOL rpc_ncacn_http_recv_out_channel_response(RpcChannel* outChannel,
|
||||
HttpResponse* response)
|
||||
{
|
||||
char* token64 = NULL;
|
||||
const char* token64 = NULL;
|
||||
int ntlmTokenLength = 0;
|
||||
BYTE* ntlmTokenData = NULL;
|
||||
rdpNtlm* ntlm;
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
FREERDP_LOCAL BOOL rpc_ncacn_http_ntlm_init(rdpContext* context, RpcChannel* channel);
|
||||
FREERDP_LOCAL void rpc_ncacn_http_ntlm_uninit(RpcChannel* channel);
|
||||
|
||||
FREERDP_LOCAL BOOL rpc_ncacn_http_send_in_channel_request(RpcInChannel* inChannel);
|
||||
FREERDP_LOCAL BOOL rpc_ncacn_http_recv_in_channel_response(RpcInChannel* inChannel,
|
||||
FREERDP_LOCAL BOOL rpc_ncacn_http_send_in_channel_request(RpcChannel* inChannel);
|
||||
FREERDP_LOCAL BOOL rpc_ncacn_http_recv_in_channel_response(RpcChannel* inChannel,
|
||||
HttpResponse* response);
|
||||
|
||||
FREERDP_LOCAL BOOL rpc_ncacn_http_send_out_channel_request(RpcOutChannel* outChannel,
|
||||
FREERDP_LOCAL BOOL rpc_ncacn_http_send_out_channel_request(RpcChannel* outChannel,
|
||||
BOOL replacement);
|
||||
FREERDP_LOCAL BOOL rpc_ncacn_http_recv_out_channel_response(RpcOutChannel* outChannel,
|
||||
FREERDP_LOCAL BOOL rpc_ncacn_http_recv_out_channel_response(RpcChannel* outChannel,
|
||||
HttpResponse* response);
|
||||
|
||||
#endif /* FREERDP_LIB_CORE_GATEWAY_NCACN_HTTP_H */
|
||||
|
||||
@@ -362,7 +362,7 @@ out:
|
||||
|
||||
static BOOL rdg_handle_ntlm_challenge(rdpNtlm* ntlm, HttpResponse* response)
|
||||
{
|
||||
char* token64 = NULL;
|
||||
const char* token64 = NULL;
|
||||
int ntlmTokenLength = 0;
|
||||
BYTE* ntlmTokenData = NULL;
|
||||
long StatusCode;
|
||||
|
||||
@@ -327,42 +327,43 @@ BOOL rpc_get_stub_data_info(rdpRpc* rpc, BYTE* buffer, UINT32* offset, UINT32* l
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int rpc_out_channel_read(RpcOutChannel* outChannel, BYTE* data, int length)
|
||||
SSIZE_T rpc_channel_read(RpcChannel* channel, wStream* s, size_t length)
|
||||
{
|
||||
int status;
|
||||
status = BIO_read(outChannel->tls->bio, data, length);
|
||||
|
||||
if (!channel)
|
||||
return -1;
|
||||
|
||||
status = BIO_read(channel->tls->bio, Stream_Pointer(s), length);
|
||||
|
||||
if (status > 0)
|
||||
{
|
||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
||||
VALGRIND_MAKE_MEM_DEFINED(data, status);
|
||||
#endif
|
||||
Stream_Seek(s, (size_t)status);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (BIO_should_retry(outChannel->tls->bio))
|
||||
if (BIO_should_retry(channel->tls->bio))
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rpc_in_channel_write(RpcInChannel* inChannel, const BYTE* data, int length)
|
||||
SSIZE_T rpc_channel_write(RpcChannel* channel, const BYTE* data, size_t length)
|
||||
{
|
||||
int status;
|
||||
status = tls_write_all(inChannel->tls, data, length);
|
||||
|
||||
if (!channel)
|
||||
return -1;
|
||||
|
||||
status = tls_write_all(channel->tls, data, length);
|
||||
return status;
|
||||
}
|
||||
|
||||
int rpc_out_channel_write(RpcOutChannel* outChannel, const BYTE* data, int length)
|
||||
BOOL rpc_in_channel_transition_to_state(RpcInChannel* inChannel, CLIENT_IN_CHANNEL_STATE state)
|
||||
{
|
||||
int status;
|
||||
status = tls_write_all(outChannel->tls, data, length);
|
||||
return status;
|
||||
}
|
||||
|
||||
int rpc_in_channel_transition_to_state(RpcInChannel* inChannel, CLIENT_IN_CHANNEL_STATE state)
|
||||
{
|
||||
int status = 1;
|
||||
const char* str = "CLIENT_IN_CHANNEL_STATE_UNKNOWN";
|
||||
|
||||
switch (state)
|
||||
@@ -396,67 +397,63 @@ int rpc_in_channel_transition_to_state(RpcInChannel* inChannel, CLIENT_IN_CHANNE
|
||||
break;
|
||||
}
|
||||
|
||||
if (!inChannel)
|
||||
return FALSE;
|
||||
|
||||
inChannel->State = state;
|
||||
WLog_DBG(TAG, "%s", str);
|
||||
return status;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int rpc_in_channel_rpch_init(rdpRpc* rpc, RpcInChannel* inChannel)
|
||||
static int rpc_channel_rpch_init(rdpRpc* rpc, RpcChannel* channel, const char* inout)
|
||||
{
|
||||
HttpContext* http;
|
||||
inChannel->ntlm = ntlm_new();
|
||||
|
||||
if (!inChannel->ntlm)
|
||||
if (!rpc || !channel || !inout)
|
||||
return -1;
|
||||
|
||||
inChannel->http = http_context_new();
|
||||
channel->ntlm = ntlm_new();
|
||||
rts_generate_cookie((BYTE*) &channel->Cookie);
|
||||
channel->rpc = rpc;
|
||||
|
||||
if (!inChannel->http)
|
||||
if (!channel->ntlm)
|
||||
return -1;
|
||||
|
||||
channel->http = http_context_new();
|
||||
|
||||
if (!channel->http)
|
||||
return -1;
|
||||
|
||||
http = channel->http;
|
||||
|
||||
if (!http_context_set_method(http, inout) ||
|
||||
!http_context_set_uri(http, "/rpc/rpcproxy.dll?localhost:3388") ||
|
||||
!http_context_set_accept(http, "application/rpc") ||
|
||||
!http_context_set_cache_control(http, "no-cache") ||
|
||||
!http_context_set_connection(http, "Keep-Alive") || !http_context_set_user_agent(http, "MSRPC") ||
|
||||
!http_context_set_host(http, rpc->settings->GatewayHostname) ||
|
||||
!http_context_set_pragma(http,
|
||||
"ResourceTypeUuid=44e265dd-7daf-42cd-8560-3cdb6e7a2729, "
|
||||
"SessionId=fbd9c34f-397d-471d-a109-1b08cc554624"))
|
||||
return -1;
|
||||
|
||||
http = inChannel->http;
|
||||
http_context_set_method(http, "RPC_IN_DATA");
|
||||
http_context_set_uri(http, "/rpc/rpcproxy.dll?localhost:3388");
|
||||
http_context_set_accept(http, "application/rpc");
|
||||
http_context_set_cache_control(http, "no-cache");
|
||||
http_context_set_connection(http, "Keep-Alive");
|
||||
http_context_set_user_agent(http, "MSRPC");
|
||||
http_context_set_host(http, rpc->settings->GatewayHostname);
|
||||
http_context_set_pragma(http, "ResourceTypeUuid=44e265dd-7daf-42cd-8560-3cdb6e7a2729");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int rpc_in_channel_init(rdpRpc* rpc, RpcInChannel* inChannel)
|
||||
{
|
||||
rts_generate_cookie((BYTE*) &inChannel->Cookie);
|
||||
inChannel->rpc = rpc;
|
||||
inChannel->State = CLIENT_IN_CHANNEL_STATE_INITIAL;
|
||||
inChannel->BytesSent = 0;
|
||||
inChannel->SenderAvailableWindow = rpc->ReceiveWindow;
|
||||
inChannel->PingOriginator.ConnectionTimeout = 30;
|
||||
inChannel->PingOriginator.KeepAliveInterval = 0;
|
||||
|
||||
if (rpc_in_channel_rpch_init(rpc, inChannel) < 0)
|
||||
if (rpc_channel_rpch_init(rpc, &inChannel->common, "RPC_IN_DATA") < 0)
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void rpc_in_channel_rpch_uninit(RpcInChannel* inChannel)
|
||||
{
|
||||
if (inChannel->ntlm)
|
||||
{
|
||||
ntlm_free(inChannel->ntlm);
|
||||
inChannel->ntlm = NULL;
|
||||
}
|
||||
|
||||
if (inChannel->http)
|
||||
{
|
||||
http_context_free(inChannel->http);
|
||||
inChannel->http = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static RpcInChannel* rpc_in_channel_new(rdpRpc* rpc)
|
||||
{
|
||||
RpcInChannel* inChannel = NULL;
|
||||
@@ -470,25 +467,19 @@ static RpcInChannel* rpc_in_channel_new(rdpRpc* rpc)
|
||||
return inChannel;
|
||||
}
|
||||
|
||||
static void rpc_in_channel_free(RpcInChannel* inChannel)
|
||||
void rpc_channel_free(RpcChannel* channel)
|
||||
{
|
||||
if (!inChannel)
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
rpc_in_channel_rpch_uninit(inChannel);
|
||||
|
||||
if (inChannel->tls)
|
||||
{
|
||||
tls_free(inChannel->tls);
|
||||
inChannel->tls = NULL;
|
||||
}
|
||||
|
||||
free(inChannel);
|
||||
ntlm_free(channel->ntlm);
|
||||
http_context_free(channel->http);
|
||||
tls_free(channel->tls);
|
||||
free(channel);
|
||||
}
|
||||
|
||||
int rpc_out_channel_transition_to_state(RpcOutChannel* outChannel, CLIENT_OUT_CHANNEL_STATE state)
|
||||
BOOL rpc_out_channel_transition_to_state(RpcOutChannel* outChannel, CLIENT_OUT_CHANNEL_STATE state)
|
||||
{
|
||||
int status = 1;
|
||||
const char* str = "CLIENT_OUT_CHANNEL_STATE_UNKNOWN";
|
||||
|
||||
switch (state)
|
||||
@@ -534,42 +525,16 @@ int rpc_out_channel_transition_to_state(RpcOutChannel* outChannel, CLIENT_OUT_CH
|
||||
break;
|
||||
}
|
||||
|
||||
if (!outChannel)
|
||||
return FALSE;
|
||||
|
||||
outChannel->State = state;
|
||||
WLog_DBG(TAG, "%s", str);
|
||||
return status;
|
||||
}
|
||||
|
||||
static int rpc_out_channel_rpch_init(rdpRpc* rpc, RpcOutChannel* outChannel)
|
||||
{
|
||||
HttpContext* http;
|
||||
outChannel->ntlm = ntlm_new();
|
||||
|
||||
if (!outChannel->ntlm)
|
||||
return -1;
|
||||
|
||||
outChannel->http = http_context_new();
|
||||
|
||||
if (!outChannel->http)
|
||||
return -1;
|
||||
|
||||
http = outChannel->http;
|
||||
http_context_set_method(http, "RPC_OUT_DATA");
|
||||
http_context_set_uri(http, "/rpc/rpcproxy.dll?localhost:3388");
|
||||
http_context_set_accept(http, "application/rpc");
|
||||
http_context_set_cache_control(http, "no-cache");
|
||||
http_context_set_connection(http, "Keep-Alive");
|
||||
http_context_set_user_agent(http, "MSRPC");
|
||||
http_context_set_host(http, rpc->settings->GatewayHostname);
|
||||
http_context_set_pragma(http,
|
||||
"ResourceTypeUuid=44e265dd-7daf-42cd-8560-3cdb6e7a2729, "
|
||||
"SessionId=fbd9c34f-397d-471d-a109-1b08cc554624");
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int rpc_out_channel_init(rdpRpc* rpc, RpcOutChannel* outChannel)
|
||||
{
|
||||
rts_generate_cookie((BYTE*) &outChannel->Cookie);
|
||||
outChannel->rpc = rpc;
|
||||
outChannel->State = CLIENT_OUT_CHANNEL_STATE_INITIAL;
|
||||
outChannel->BytesReceived = 0;
|
||||
outChannel->ReceiverAvailableWindow = rpc->ReceiveWindow;
|
||||
@@ -577,27 +542,12 @@ static int rpc_out_channel_init(rdpRpc* rpc, RpcOutChannel* outChannel)
|
||||
outChannel->ReceiveWindowSize = rpc->ReceiveWindow;
|
||||
outChannel->AvailableWindowAdvertised = rpc->ReceiveWindow;
|
||||
|
||||
if (rpc_out_channel_rpch_init(rpc, outChannel) < 0)
|
||||
if (rpc_channel_rpch_init(rpc, &outChannel->common, "RPC_OUT_DATA") < 0)
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void rpc_out_channel_rpch_uninit(RpcOutChannel* outChannel)
|
||||
{
|
||||
if (outChannel->ntlm)
|
||||
{
|
||||
ntlm_free(outChannel->ntlm);
|
||||
outChannel->ntlm = NULL;
|
||||
}
|
||||
|
||||
if (outChannel->http)
|
||||
{
|
||||
http_context_free(outChannel->http);
|
||||
outChannel->http = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
RpcOutChannel* rpc_out_channel_new(rdpRpc* rpc)
|
||||
{
|
||||
RpcOutChannel* outChannel = NULL;
|
||||
@@ -611,26 +561,9 @@ RpcOutChannel* rpc_out_channel_new(rdpRpc* rpc)
|
||||
return outChannel;
|
||||
}
|
||||
|
||||
void rpc_out_channel_free(RpcOutChannel* outChannel)
|
||||
{
|
||||
if (!outChannel)
|
||||
return;
|
||||
|
||||
rpc_out_channel_rpch_uninit(outChannel);
|
||||
|
||||
if (outChannel->tls)
|
||||
{
|
||||
tls_free(outChannel->tls);
|
||||
outChannel->tls = NULL;
|
||||
}
|
||||
|
||||
free(outChannel);
|
||||
}
|
||||
|
||||
int rpc_virtual_connection_transition_to_state(rdpRpc* rpc,
|
||||
BOOL rpc_virtual_connection_transition_to_state(rdpRpc* rpc,
|
||||
RpcVirtualConnection* connection, VIRTUAL_CONNECTION_STATE state)
|
||||
{
|
||||
int status = 1;
|
||||
const char* str = "VIRTUAL_CONNECTION_STATE_UNKNOWN";
|
||||
|
||||
switch (state)
|
||||
@@ -660,9 +593,12 @@ int rpc_virtual_connection_transition_to_state(rdpRpc* rpc,
|
||||
break;
|
||||
}
|
||||
|
||||
if (!connection)
|
||||
return FALSE;
|
||||
|
||||
connection->State = state;
|
||||
WLog_DBG(TAG, "%s", str);
|
||||
return status;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static RpcVirtualConnection* rpc_virtual_connection_new(rdpRpc* rpc)
|
||||
@@ -699,10 +635,10 @@ static void rpc_virtual_connection_free(RpcVirtualConnection* connection)
|
||||
if (!connection)
|
||||
return;
|
||||
|
||||
rpc_in_channel_free(connection->DefaultInChannel);
|
||||
rpc_in_channel_free(connection->NonDefaultInChannel);
|
||||
rpc_out_channel_free(connection->DefaultOutChannel);
|
||||
rpc_out_channel_free(connection->NonDefaultOutChannel);
|
||||
rpc_channel_free(&connection->DefaultInChannel->common);
|
||||
rpc_channel_free(&connection->NonDefaultInChannel->common);
|
||||
rpc_channel_free(&connection->DefaultOutChannel->common);
|
||||
rpc_channel_free(&connection->NonDefaultOutChannel->common);
|
||||
free(connection);
|
||||
}
|
||||
|
||||
@@ -782,47 +718,49 @@ static int rpc_channel_tls_connect(RpcChannel* channel, int timeout)
|
||||
|
||||
static int rpc_in_channel_connect(RpcInChannel* inChannel, int timeout)
|
||||
{
|
||||
rdpRpc* rpc = inChannel->rpc;
|
||||
rdpRpc* rpc = inChannel->common.rpc;
|
||||
|
||||
/* Connect IN Channel */
|
||||
|
||||
if (rpc_channel_tls_connect((RpcChannel*) inChannel, timeout) < 0)
|
||||
if (rpc_channel_tls_connect(&inChannel->common, timeout) < 0)
|
||||
return -1;
|
||||
|
||||
rpc_in_channel_transition_to_state(inChannel, CLIENT_IN_CHANNEL_STATE_CONNECTED);
|
||||
|
||||
if (!rpc_ncacn_http_ntlm_init(rpc->context, (RpcChannel*) inChannel))
|
||||
if (!rpc_ncacn_http_ntlm_init(rpc->context, &inChannel->common))
|
||||
return -1;
|
||||
|
||||
/* Send IN Channel Request */
|
||||
|
||||
if (!rpc_ncacn_http_send_in_channel_request(inChannel))
|
||||
if (!rpc_ncacn_http_send_in_channel_request(&inChannel->common))
|
||||
{
|
||||
WLog_ERR(TAG, "rpc_ncacn_http_send_in_channel_request failure");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rpc_in_channel_transition_to_state(inChannel, CLIENT_IN_CHANNEL_STATE_SECURITY);
|
||||
if (!rpc_in_channel_transition_to_state(inChannel, CLIENT_IN_CHANNEL_STATE_SECURITY))
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int rpc_out_channel_connect(RpcOutChannel* outChannel, int timeout)
|
||||
{
|
||||
rdpRpc* rpc = outChannel->rpc;
|
||||
rdpRpc* rpc = outChannel->common.rpc;
|
||||
|
||||
/* Connect OUT Channel */
|
||||
|
||||
if (rpc_channel_tls_connect((RpcChannel*) outChannel, timeout) < 0)
|
||||
if (rpc_channel_tls_connect(&outChannel->common, timeout) < 0)
|
||||
return -1;
|
||||
|
||||
rpc_out_channel_transition_to_state(outChannel, CLIENT_OUT_CHANNEL_STATE_CONNECTED);
|
||||
|
||||
if (!rpc_ncacn_http_ntlm_init(rpc->context, (RpcChannel*) outChannel))
|
||||
if (!rpc_ncacn_http_ntlm_init(rpc->context, &outChannel->common))
|
||||
return FALSE;
|
||||
|
||||
/* Send OUT Channel Request */
|
||||
|
||||
if (!rpc_ncacn_http_send_out_channel_request(outChannel, FALSE))
|
||||
if (!rpc_ncacn_http_send_out_channel_request(&outChannel->common, FALSE))
|
||||
{
|
||||
WLog_ERR(TAG, "rpc_ncacn_http_send_out_channel_request failure");
|
||||
return FALSE;
|
||||
@@ -834,7 +772,7 @@ static int rpc_out_channel_connect(RpcOutChannel* outChannel, int timeout)
|
||||
|
||||
int rpc_out_channel_replacement_connect(RpcOutChannel* outChannel, int timeout)
|
||||
{
|
||||
rdpRpc* rpc = outChannel->rpc;
|
||||
rdpRpc* rpc = outChannel->common.rpc;
|
||||
|
||||
/* Connect OUT Channel */
|
||||
|
||||
@@ -848,7 +786,7 @@ int rpc_out_channel_replacement_connect(RpcOutChannel* outChannel, int timeout)
|
||||
|
||||
/* Send OUT Channel Request */
|
||||
|
||||
if (!rpc_ncacn_http_send_out_channel_request(outChannel, TRUE))
|
||||
if (!rpc_ncacn_http_send_out_channel_request(&outChannel->common, TRUE))
|
||||
{
|
||||
WLog_ERR(TAG, "rpc_ncacn_http_send_out_channel_request failure");
|
||||
return FALSE;
|
||||
|
||||
@@ -585,17 +585,14 @@ struct rpc_client_call
|
||||
};
|
||||
typedef struct rpc_client_call RpcClientCall;
|
||||
|
||||
#define RPC_CHANNEL_COMMON() \
|
||||
rdpRpc* rpc; \
|
||||
BIO* bio; \
|
||||
rdpTls* tls; \
|
||||
rdpNtlm* ntlm; \
|
||||
HttpContext* http; \
|
||||
BYTE Cookie[16]
|
||||
|
||||
struct rpc_channel
|
||||
{
|
||||
RPC_CHANNEL_COMMON();
|
||||
rdpRpc* rpc;
|
||||
BIO* bio;
|
||||
rdpTls* tls;
|
||||
rdpNtlm* ntlm;
|
||||
HttpContext* http;
|
||||
BYTE Cookie[16];
|
||||
};
|
||||
typedef struct rpc_channel RpcChannel;
|
||||
|
||||
@@ -627,7 +624,7 @@ struct rpc_in_channel
|
||||
{
|
||||
/* Sending Channel */
|
||||
|
||||
RPC_CHANNEL_COMMON();
|
||||
RpcChannel common;
|
||||
|
||||
CLIENT_IN_CHANNEL_STATE State;
|
||||
|
||||
@@ -664,7 +661,7 @@ struct rpc_out_channel
|
||||
{
|
||||
/* Receiving Channel */
|
||||
|
||||
RPC_CHANNEL_COMMON();
|
||||
RpcChannel common;
|
||||
|
||||
CLIENT_OUT_CHANNEL_STATE State;
|
||||
|
||||
@@ -774,25 +771,24 @@ FREERDP_LOCAL UINT32 rpc_offset_pad(UINT32* offset, UINT32 pad);
|
||||
FREERDP_LOCAL BOOL rpc_get_stub_data_info(rdpRpc* rpc, BYTE* header,
|
||||
UINT32* offset, UINT32* length);
|
||||
|
||||
FREERDP_LOCAL int rpc_in_channel_write(RpcInChannel* inChannel,
|
||||
const BYTE* data, int length);
|
||||
FREERDP_LOCAL SSIZE_T rpc_channel_write(RpcChannel* channel,
|
||||
const BYTE* data, size_t length);
|
||||
|
||||
FREERDP_LOCAL int rpc_out_channel_read(RpcOutChannel* outChannel, BYTE* data,
|
||||
int length);
|
||||
FREERDP_LOCAL int rpc_out_channel_write(RpcOutChannel* outChannel,
|
||||
const BYTE* data, int length);
|
||||
FREERDP_LOCAL SSIZE_T rpc_channel_read(RpcChannel* channel, wStream* s,
|
||||
size_t length);
|
||||
|
||||
FREERDP_LOCAL void rpc_channel_free(RpcChannel* channel);
|
||||
|
||||
FREERDP_LOCAL RpcOutChannel* rpc_out_channel_new(rdpRpc* rpc);
|
||||
FREERDP_LOCAL int rpc_out_channel_replacement_connect(RpcOutChannel* outChannel,
|
||||
int timeout);
|
||||
FREERDP_LOCAL void rpc_out_channel_free(RpcOutChannel* outChannel);
|
||||
|
||||
FREERDP_LOCAL int rpc_in_channel_transition_to_state(RpcInChannel* inChannel,
|
||||
FREERDP_LOCAL BOOL rpc_in_channel_transition_to_state(RpcInChannel* inChannel,
|
||||
CLIENT_IN_CHANNEL_STATE state);
|
||||
FREERDP_LOCAL int rpc_out_channel_transition_to_state(RpcOutChannel* outChannel,
|
||||
FREERDP_LOCAL BOOL rpc_out_channel_transition_to_state(RpcOutChannel* outChannel,
|
||||
CLIENT_OUT_CHANNEL_STATE state);
|
||||
|
||||
FREERDP_LOCAL int rpc_virtual_connection_transition_to_state(rdpRpc* rpc,
|
||||
FREERDP_LOCAL BOOL rpc_virtual_connection_transition_to_state(rdpRpc* rpc,
|
||||
RpcVirtualConnection* connection, VIRTUAL_CONNECTION_STATE state);
|
||||
|
||||
FREERDP_LOCAL BOOL rpc_connect(rdpRpc* rpc, int timeout);
|
||||
|
||||
@@ -459,14 +459,14 @@ static int rpc_client_default_out_channel_recv(rdpRpc* rpc)
|
||||
RpcVirtualConnection* connection = rpc->VirtualConnection;
|
||||
inChannel = connection->DefaultInChannel;
|
||||
outChannel = connection->DefaultOutChannel;
|
||||
BIO_get_event(outChannel->tls->bio, &outChannelEvent);
|
||||
BIO_get_event(outChannel->common.tls->bio, &outChannelEvent);
|
||||
|
||||
if (outChannel->State < CLIENT_OUT_CHANNEL_STATE_OPENED)
|
||||
{
|
||||
if (WaitForSingleObject(outChannelEvent, 0) != WAIT_OBJECT_0)
|
||||
return 1;
|
||||
|
||||
response = http_response_recv(outChannel->tls);
|
||||
response = http_response_recv(outChannel->common.tls);
|
||||
|
||||
if (!response)
|
||||
return -1;
|
||||
@@ -474,7 +474,7 @@ static int rpc_client_default_out_channel_recv(rdpRpc* rpc)
|
||||
if (outChannel->State == CLIENT_OUT_CHANNEL_STATE_SECURITY)
|
||||
{
|
||||
/* Receive OUT Channel Response */
|
||||
if (!rpc_ncacn_http_recv_out_channel_response(outChannel, response))
|
||||
if (!rpc_ncacn_http_recv_out_channel_response(&outChannel->common, response))
|
||||
{
|
||||
http_response_free(response);
|
||||
WLog_ERR(TAG, "rpc_ncacn_http_recv_out_channel_response failure");
|
||||
@@ -483,14 +483,14 @@ static int rpc_client_default_out_channel_recv(rdpRpc* rpc)
|
||||
|
||||
/* Send OUT Channel Request */
|
||||
|
||||
if (!rpc_ncacn_http_send_out_channel_request(outChannel, FALSE))
|
||||
if (!rpc_ncacn_http_send_out_channel_request(&outChannel->common, FALSE))
|
||||
{
|
||||
http_response_free(response);
|
||||
WLog_ERR(TAG, "rpc_ncacn_http_send_out_channel_request failure");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rpc_ncacn_http_ntlm_uninit((RpcChannel*)outChannel);
|
||||
rpc_ncacn_http_ntlm_uninit(&outChannel->common);
|
||||
rpc_out_channel_transition_to_state(outChannel,
|
||||
CLIENT_OUT_CHANNEL_STATE_NEGOTIATED);
|
||||
|
||||
@@ -523,7 +523,7 @@ static int rpc_client_default_out_channel_recv(rdpRpc* rpc)
|
||||
if (WaitForSingleObject(outChannelEvent, 0) != WAIT_OBJECT_0)
|
||||
return 1;
|
||||
|
||||
response = http_response_recv(outChannel->tls);
|
||||
response = http_response_recv(outChannel->common.tls);
|
||||
|
||||
if (!response)
|
||||
return -1;
|
||||
@@ -560,21 +560,16 @@ static int rpc_client_default_out_channel_recv(rdpRpc* rpc)
|
||||
{
|
||||
while (Stream_GetPosition(fragment) < RPC_COMMON_FIELDS_LENGTH)
|
||||
{
|
||||
status = rpc_out_channel_read(outChannel, Stream_Pointer(fragment),
|
||||
RPC_COMMON_FIELDS_LENGTH - Stream_GetPosition(fragment));
|
||||
status = rpc_channel_read(&outChannel->common, fragment,
|
||||
RPC_COMMON_FIELDS_LENGTH - Stream_GetPosition(fragment));
|
||||
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
if (!status)
|
||||
if (Stream_GetPosition(fragment) < RPC_COMMON_FIELDS_LENGTH)
|
||||
return 0;
|
||||
|
||||
Stream_Seek(fragment, status);
|
||||
}
|
||||
|
||||
if (Stream_GetPosition(fragment) < RPC_COMMON_FIELDS_LENGTH)
|
||||
return status;
|
||||
|
||||
header = (rpcconn_common_hdr_t*)Stream_Buffer(fragment);
|
||||
|
||||
if (header->frag_length > rpc->max_recv_frag)
|
||||
@@ -587,8 +582,8 @@ static int rpc_client_default_out_channel_recv(rdpRpc* rpc)
|
||||
|
||||
while (Stream_GetPosition(fragment) < header->frag_length)
|
||||
{
|
||||
status = rpc_out_channel_read(outChannel, Stream_Pointer(fragment),
|
||||
header->frag_length - Stream_GetPosition(fragment));
|
||||
status = rpc_channel_read(&outChannel->common, fragment,
|
||||
header->frag_length - Stream_GetPosition(fragment));
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
@@ -596,16 +591,10 @@ static int rpc_client_default_out_channel_recv(rdpRpc* rpc)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!status)
|
||||
if (Stream_GetPosition(fragment) < header->frag_length)
|
||||
return 0;
|
||||
|
||||
Stream_Seek(fragment, status);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
if (Stream_GetPosition(fragment) >= header->frag_length)
|
||||
{
|
||||
/* complete fragment received */
|
||||
Stream_SealLength(fragment);
|
||||
@@ -618,7 +607,7 @@ static int rpc_client_default_out_channel_recv(rdpRpc* rpc)
|
||||
/* channel recycling may update channel pointers */
|
||||
if (outChannel->State == CLIENT_OUT_CHANNEL_STATE_RECYCLED && connection->NonDefaultOutChannel)
|
||||
{
|
||||
rpc_out_channel_free(connection->DefaultOutChannel);
|
||||
rpc_channel_free(&connection->DefaultOutChannel->common);
|
||||
connection->DefaultOutChannel = connection->NonDefaultOutChannel;
|
||||
connection->NonDefaultOutChannel = NULL;
|
||||
rpc_out_channel_transition_to_state(connection->DefaultOutChannel, CLIENT_OUT_CHANNEL_STATE_OPENED);
|
||||
@@ -642,22 +631,22 @@ static int rpc_client_nondefault_out_channel_recv(rdpRpc* rpc)
|
||||
RpcOutChannel* nextOutChannel;
|
||||
HANDLE nextOutChannelEvent = NULL;
|
||||
nextOutChannel = rpc->VirtualConnection->NonDefaultOutChannel;
|
||||
BIO_get_event(nextOutChannel->tls->bio, &nextOutChannelEvent);
|
||||
BIO_get_event(nextOutChannel->common.tls->bio, &nextOutChannelEvent);
|
||||
|
||||
if (WaitForSingleObject(nextOutChannelEvent, 0) != WAIT_OBJECT_0)
|
||||
return 1;
|
||||
|
||||
response = http_response_recv(nextOutChannel->tls);
|
||||
response = http_response_recv(nextOutChannel->common.tls);
|
||||
|
||||
if (response)
|
||||
{
|
||||
if (nextOutChannel->State == CLIENT_OUT_CHANNEL_STATE_SECURITY)
|
||||
{
|
||||
if (rpc_ncacn_http_recv_out_channel_response(nextOutChannel, response))
|
||||
if (rpc_ncacn_http_recv_out_channel_response(&nextOutChannel->common, response))
|
||||
{
|
||||
if (rpc_ncacn_http_send_out_channel_request(nextOutChannel, TRUE))
|
||||
if (rpc_ncacn_http_send_out_channel_request(&nextOutChannel->common, TRUE))
|
||||
{
|
||||
rpc_ncacn_http_ntlm_uninit((RpcChannel*) nextOutChannel);
|
||||
rpc_ncacn_http_ntlm_uninit(&nextOutChannel->common);
|
||||
status = rts_send_OUT_R1_A3_pdu(rpc);
|
||||
|
||||
if (status >= 0)
|
||||
@@ -720,21 +709,21 @@ int rpc_client_in_channel_recv(rdpRpc* rpc)
|
||||
RpcVirtualConnection* connection = rpc->VirtualConnection;
|
||||
inChannel = connection->DefaultInChannel;
|
||||
outChannel = connection->DefaultOutChannel;
|
||||
BIO_get_event(inChannel->tls->bio, &InChannelEvent);
|
||||
BIO_get_event(inChannel->common.tls->bio, &InChannelEvent);
|
||||
|
||||
if (WaitForSingleObject(InChannelEvent, 0) != WAIT_OBJECT_0)
|
||||
return 1;
|
||||
|
||||
if (inChannel->State < CLIENT_IN_CHANNEL_STATE_OPENED)
|
||||
{
|
||||
response = http_response_recv(inChannel->tls);
|
||||
response = http_response_recv(inChannel->common.tls);
|
||||
|
||||
if (!response)
|
||||
return -1;
|
||||
|
||||
if (inChannel->State == CLIENT_IN_CHANNEL_STATE_SECURITY)
|
||||
{
|
||||
if (!rpc_ncacn_http_recv_in_channel_response(inChannel, response))
|
||||
if (!rpc_ncacn_http_recv_in_channel_response(&inChannel->common, response))
|
||||
{
|
||||
WLog_ERR(TAG, "rpc_ncacn_http_recv_in_channel_response failure");
|
||||
http_response_free(response);
|
||||
@@ -743,14 +732,14 @@ int rpc_client_in_channel_recv(rdpRpc* rpc)
|
||||
|
||||
/* Send IN Channel Request */
|
||||
|
||||
if (!rpc_ncacn_http_send_in_channel_request(inChannel))
|
||||
if (!rpc_ncacn_http_send_in_channel_request(&inChannel->common))
|
||||
{
|
||||
WLog_ERR(TAG, "rpc_ncacn_http_send_in_channel_request failure");
|
||||
http_response_free(response);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rpc_ncacn_http_ntlm_uninit((RpcChannel*) inChannel);
|
||||
rpc_ncacn_http_ntlm_uninit(&inChannel->common);
|
||||
rpc_in_channel_transition_to_state(inChannel,
|
||||
CLIENT_IN_CHANNEL_STATE_NEGOTIATED);
|
||||
|
||||
@@ -779,7 +768,7 @@ int rpc_client_in_channel_recv(rdpRpc* rpc)
|
||||
}
|
||||
else
|
||||
{
|
||||
response = http_response_recv(inChannel->tls);
|
||||
response = http_response_recv(inChannel->common.tls);
|
||||
|
||||
if (!response)
|
||||
return -1;
|
||||
@@ -840,8 +829,8 @@ int rpc_in_channel_send_pdu(RpcInChannel* inChannel, BYTE* buffer, UINT32 length
|
||||
int status;
|
||||
RpcClientCall* clientCall;
|
||||
rpcconn_common_hdr_t* header;
|
||||
rdpRpc* rpc = inChannel->rpc;
|
||||
status = rpc_in_channel_write(inChannel, buffer, length);
|
||||
rdpRpc* rpc = inChannel->common.rpc;
|
||||
status = rpc_channel_write(&inChannel->common, buffer, length);
|
||||
|
||||
if (status <= 0)
|
||||
return -1;
|
||||
|
||||
@@ -416,7 +416,7 @@ int rts_send_CONN_A1_pdu(rdpRpc* rpc)
|
||||
header.NumberOfCommands = 4;
|
||||
WLog_DBG(TAG, "Sending CONN/A1 RTS PDU");
|
||||
VirtualConnectionCookie = (BYTE*) & (connection->Cookie);
|
||||
OUTChannelCookie = (BYTE*) & (outChannel->Cookie);
|
||||
OUTChannelCookie = (BYTE*) & (outChannel->common.Cookie);
|
||||
ReceiveWindowSize = outChannel->ReceiveWindow;
|
||||
buffer = (BYTE*) malloc(header.frag_length);
|
||||
|
||||
@@ -430,7 +430,7 @@ int rts_send_CONN_A1_pdu(rdpRpc* rpc)
|
||||
rts_cookie_command_write(&buffer[48], OUTChannelCookie); /* OUTChannelCookie (20 bytes) */
|
||||
rts_receive_window_size_command_write(&buffer[68],
|
||||
ReceiveWindowSize); /* ReceiveWindowSize (8 bytes) */
|
||||
status = rpc_out_channel_write(outChannel, buffer, header.frag_length);
|
||||
status = rpc_channel_write(&outChannel->common, buffer, header.frag_length);
|
||||
free(buffer);
|
||||
return (status > 0) ? 1 : -1;
|
||||
}
|
||||
@@ -463,7 +463,7 @@ int rts_send_CONN_B1_pdu(rdpRpc* rpc)
|
||||
header.NumberOfCommands = 6;
|
||||
WLog_DBG(TAG, "Sending CONN/B1 RTS PDU");
|
||||
VirtualConnectionCookie = (BYTE*) & (connection->Cookie);
|
||||
INChannelCookie = (BYTE*) & (inChannel->Cookie);
|
||||
INChannelCookie = (BYTE*) & (inChannel->common.Cookie);
|
||||
AssociationGroupId = (BYTE*) & (connection->AssociationGroupId);
|
||||
buffer = (BYTE*) malloc(header.frag_length);
|
||||
|
||||
@@ -482,7 +482,7 @@ int rts_send_CONN_B1_pdu(rdpRpc* rpc)
|
||||
rts_association_group_id_command_write(&buffer[84],
|
||||
AssociationGroupId); /* AssociationGroupId (20 bytes) */
|
||||
length = header.frag_length;
|
||||
status = rpc_in_channel_write(inChannel, buffer, length);
|
||||
status = rpc_channel_write(&inChannel->common, buffer, length);
|
||||
free(buffer);
|
||||
return (status > 0) ? 1 : -1;
|
||||
}
|
||||
@@ -531,7 +531,7 @@ static int rts_send_keep_alive_pdu(rdpRpc* rpc)
|
||||
rts_client_keepalive_command_write(&buffer[20],
|
||||
rpc->CurrentKeepAliveInterval); /* ClientKeepAlive (8 bytes) */
|
||||
length = header.frag_length;
|
||||
status = rpc_in_channel_write(inChannel, buffer, length);
|
||||
status = rpc_channel_write(&inChannel->common, buffer, length);
|
||||
free(buffer);
|
||||
return (status > 0) ? 1 : -1;
|
||||
}
|
||||
@@ -555,7 +555,7 @@ int rts_send_flow_control_ack_pdu(rdpRpc* rpc)
|
||||
WLog_DBG(TAG, "Sending FlowControlAck RTS PDU");
|
||||
BytesReceived = outChannel->BytesReceived;
|
||||
AvailableWindow = outChannel->AvailableWindowAdvertised;
|
||||
ChannelCookie = (BYTE*) & (outChannel->Cookie);
|
||||
ChannelCookie = (BYTE*) & (outChannel->common.Cookie);
|
||||
outChannel->ReceiverAvailableWindow = outChannel->AvailableWindowAdvertised;
|
||||
buffer = (BYTE*) malloc(header.frag_length);
|
||||
|
||||
@@ -567,7 +567,7 @@ int rts_send_flow_control_ack_pdu(rdpRpc* rpc)
|
||||
/* FlowControlAck Command (28 bytes) */
|
||||
rts_flow_control_ack_command_write(&buffer[28], BytesReceived, AvailableWindow, ChannelCookie);
|
||||
length = header.frag_length;
|
||||
status = rpc_in_channel_write(inChannel, buffer, length);
|
||||
status = rpc_channel_write(&inChannel->common, buffer, length);
|
||||
free(buffer);
|
||||
return (status > 0) ? 1 : -1;
|
||||
}
|
||||
@@ -642,7 +642,7 @@ static int rts_send_ping_pdu(rdpRpc* rpc)
|
||||
|
||||
CopyMemory(buffer, ((BYTE*) &header), 20); /* RTS Header (20 bytes) */
|
||||
length = header.frag_length;
|
||||
status = rpc_in_channel_write(inChannel, buffer, length);
|
||||
status = rpc_channel_write(&inChannel->common, buffer, length);
|
||||
free(buffer);
|
||||
return (status > 0) ? 1 : -1;
|
||||
}
|
||||
@@ -735,7 +735,7 @@ static int rts_send_OUT_R2_A7_pdu(rdpRpc* rpc)
|
||||
header.Flags = RTS_FLAG_OUT_CHANNEL;
|
||||
header.NumberOfCommands = 3;
|
||||
WLog_DBG(TAG, "Sending OUT_R2/A7 RTS PDU");
|
||||
SuccessorChannelCookie = (BYTE*) & (nextOutChannel->Cookie);
|
||||
SuccessorChannelCookie = (BYTE*) & (nextOutChannel->common.Cookie);
|
||||
buffer = (BYTE*) malloc(header.frag_length);
|
||||
|
||||
if (!buffer)
|
||||
@@ -746,7 +746,7 @@ static int rts_send_OUT_R2_A7_pdu(rdpRpc* rpc)
|
||||
rts_cookie_command_write(&buffer[28],
|
||||
SuccessorChannelCookie); /* SuccessorChannelCookie (20 bytes) */
|
||||
rts_version_command_write(&buffer[48]); /* Version (8 bytes) */
|
||||
status = rpc_in_channel_write(inChannel, buffer, header.frag_length);
|
||||
status = rpc_channel_write(&inChannel->common, buffer, header.frag_length);
|
||||
free(buffer);
|
||||
return (status > 0) ? 1 : -1;
|
||||
}
|
||||
@@ -769,7 +769,7 @@ static int rts_send_OUT_R2_C1_pdu(rdpRpc* rpc)
|
||||
|
||||
CopyMemory(buffer, ((BYTE*) &header), 20); /* RTS Header (20 bytes) */
|
||||
rts_empty_command_write(&buffer[20]); /* Empty command (4 bytes) */
|
||||
status = rpc_out_channel_write(nextOutChannel, buffer, header.frag_length);
|
||||
status = rpc_channel_write(&nextOutChannel->common, buffer, header.frag_length);
|
||||
free(buffer);
|
||||
return (status > 0) ? 1 : -1;
|
||||
}
|
||||
@@ -792,8 +792,8 @@ int rts_send_OUT_R1_A3_pdu(rdpRpc* rpc)
|
||||
header.NumberOfCommands = 5;
|
||||
WLog_DBG(TAG, "Sending OUT_R1/A3 RTS PDU");
|
||||
VirtualConnectionCookie = (BYTE*) & (connection->Cookie);
|
||||
PredecessorChannelCookie = (BYTE*) & (outChannel->Cookie);
|
||||
SuccessorChannelCookie = (BYTE*) & (nextOutChannel->Cookie);
|
||||
PredecessorChannelCookie = (BYTE*) & (outChannel->common.Cookie);
|
||||
SuccessorChannelCookie = (BYTE*) & (nextOutChannel->common.Cookie);
|
||||
ReceiveWindowSize = outChannel->ReceiveWindow;
|
||||
buffer = (BYTE*) malloc(header.frag_length);
|
||||
|
||||
@@ -810,7 +810,7 @@ int rts_send_OUT_R1_A3_pdu(rdpRpc* rpc)
|
||||
SuccessorChannelCookie); /* SuccessorChannelCookie (20 bytes) */
|
||||
rts_receive_window_size_command_write(&buffer[88],
|
||||
ReceiveWindowSize); /* ReceiveWindowSize (8 bytes) */
|
||||
status = rpc_out_channel_write(nextOutChannel, buffer, header.frag_length);
|
||||
status = rpc_channel_write(&nextOutChannel->common, buffer, header.frag_length);
|
||||
free(buffer);
|
||||
return (status > 0) ? 1 : -1;
|
||||
}
|
||||
|
||||
@@ -1595,44 +1595,44 @@ DWORD tsg_get_event_handles(rdpTsg* tsg, HANDLE* events, DWORD count)
|
||||
else
|
||||
return 0;
|
||||
|
||||
if (connection->DefaultInChannel && connection->DefaultInChannel->tls)
|
||||
if (connection->DefaultInChannel && connection->DefaultInChannel->common.tls)
|
||||
{
|
||||
if (events && (nCount < count))
|
||||
{
|
||||
BIO_get_event(connection->DefaultInChannel->tls->bio, &events[nCount]);
|
||||
BIO_get_event(connection->DefaultInChannel->common.tls->bio, &events[nCount]);
|
||||
nCount++;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (connection->NonDefaultInChannel && connection->NonDefaultInChannel->tls)
|
||||
if (connection->NonDefaultInChannel && connection->NonDefaultInChannel->common.tls)
|
||||
{
|
||||
if (events && (nCount < count))
|
||||
{
|
||||
BIO_get_event(connection->NonDefaultInChannel->tls->bio, &events[nCount]);
|
||||
BIO_get_event(connection->NonDefaultInChannel->common.tls->bio, &events[nCount]);
|
||||
nCount++;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (connection->DefaultOutChannel && connection->DefaultOutChannel->tls)
|
||||
if (connection->DefaultOutChannel && connection->DefaultOutChannel->common.tls)
|
||||
{
|
||||
if (events && (nCount < count))
|
||||
{
|
||||
BIO_get_event(connection->DefaultOutChannel->tls->bio, &events[nCount]);
|
||||
BIO_get_event(connection->DefaultOutChannel->common.tls->bio, &events[nCount]);
|
||||
nCount++;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (connection->NonDefaultOutChannel && connection->NonDefaultOutChannel->tls)
|
||||
if (connection->NonDefaultOutChannel && connection->NonDefaultOutChannel->common.tls)
|
||||
{
|
||||
if (events && (nCount < count))
|
||||
{
|
||||
BIO_get_event(connection->NonDefaultOutChannel->tls->bio, &events[nCount]);
|
||||
BIO_get_event(connection->NonDefaultOutChannel->common.tls->bio, &events[nCount]);
|
||||
nCount++;
|
||||
}
|
||||
else
|
||||
@@ -1928,8 +1928,8 @@ static long transport_bio_tsg_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
|
||||
if (cmd == BIO_CTRL_FLUSH)
|
||||
{
|
||||
(void)BIO_flush(inChannel->tls->bio);
|
||||
(void)BIO_flush(outChannel->tls->bio);
|
||||
(void)BIO_flush(inChannel->common.tls->bio);
|
||||
(void)BIO_flush(outChannel->common.tls->bio);
|
||||
status = 1;
|
||||
}
|
||||
else if (cmd == BIO_C_GET_EVENT)
|
||||
@@ -1946,18 +1946,18 @@ static long transport_bio_tsg_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
}
|
||||
else if (cmd == BIO_C_READ_BLOCKED)
|
||||
{
|
||||
BIO* bio = outChannel->bio;
|
||||
BIO* bio = outChannel->common.bio;
|
||||
status = BIO_read_blocked(bio);
|
||||
}
|
||||
else if (cmd == BIO_C_WRITE_BLOCKED)
|
||||
{
|
||||
BIO* bio = inChannel->bio;
|
||||
BIO* bio = inChannel->common.bio;
|
||||
status = BIO_write_blocked(bio);
|
||||
}
|
||||
else if (cmd == BIO_C_WAIT_READ)
|
||||
{
|
||||
int timeout = (int) arg1;
|
||||
BIO* bio = outChannel->bio;
|
||||
BIO* bio = outChannel->common.bio;
|
||||
|
||||
if (BIO_read_blocked(bio))
|
||||
return BIO_wait_read(bio, timeout);
|
||||
@@ -1969,7 +1969,7 @@ static long transport_bio_tsg_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
else if (cmd == BIO_C_WAIT_WRITE)
|
||||
{
|
||||
int timeout = (int) arg1;
|
||||
BIO* bio = inChannel->bio;
|
||||
BIO* bio = inChannel->common.bio;
|
||||
|
||||
if (BIO_write_blocked(bio))
|
||||
status = BIO_wait_write(bio, timeout);
|
||||
|
||||
Reference in New Issue
Block a user