mirror of https://github.com/FreeRDP/FreeRDP
Removed duplicate fields from rpdRpc
* Removed rdpRpc::context * Removed rdpRpc::settings
This commit is contained in:
parent
17f530a866
commit
37ed889fd7
|
@ -839,16 +839,18 @@ BOOL rpc_connect(rdpRpc* rpc, int timeout)
|
||||||
|
|
||||||
rdpRpc* rpc_new(rdpTransport* transport)
|
rdpRpc* rpc_new(rdpTransport* transport)
|
||||||
{
|
{
|
||||||
rdpRpc* rpc = (rdpRpc*)calloc(1, sizeof(rdpRpc));
|
rdpContext* context = transport_get_context(transport);
|
||||||
|
rdpRpc* rpc;
|
||||||
|
|
||||||
|
WINPR_ASSERT(context);
|
||||||
|
|
||||||
|
rpc = (rdpRpc*)calloc(1, sizeof(rdpRpc));
|
||||||
|
|
||||||
if (!rpc)
|
if (!rpc)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
rpc->State = RPC_CLIENT_STATE_INITIAL;
|
rpc->State = RPC_CLIENT_STATE_INITIAL;
|
||||||
rpc->transport = transport;
|
rpc->transport = transport;
|
||||||
rpc->context = transport_get_context(transport);
|
|
||||||
WINPR_ASSERT(rpc->context);
|
|
||||||
rpc->settings = rpc->context->settings;
|
|
||||||
rpc->SendSeqNum = 0;
|
rpc->SendSeqNum = 0;
|
||||||
rpc->ntlm = ntlm_new();
|
rpc->ntlm = ntlm_new();
|
||||||
|
|
||||||
|
@ -873,7 +875,7 @@ rdpRpc* rpc_new(rdpTransport* transport)
|
||||||
rpc->CurrentKeepAliveInterval = rpc->KeepAliveInterval;
|
rpc->CurrentKeepAliveInterval = rpc->KeepAliveInterval;
|
||||||
rpc->CurrentKeepAliveTime = 0;
|
rpc->CurrentKeepAliveTime = 0;
|
||||||
rpc->CallId = 2;
|
rpc->CallId = 2;
|
||||||
rpc->client = rpc_client_new(rpc->context, rpc->max_recv_frag);
|
rpc->client = rpc_client_new(context, rpc->max_recv_frag);
|
||||||
|
|
||||||
if (!rpc->client)
|
if (!rpc->client)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
|
@ -741,8 +741,6 @@ struct rdp_rpc
|
||||||
|
|
||||||
RpcClient* client;
|
RpcClient* client;
|
||||||
|
|
||||||
rdpContext* context;
|
|
||||||
rdpSettings* settings;
|
|
||||||
rdpTransport* transport;
|
rdpTransport* transport;
|
||||||
|
|
||||||
UINT32 CallId;
|
UINT32 CallId;
|
||||||
|
|
|
@ -114,11 +114,29 @@ int rpc_send_bind_pdu(rdpRpc* rpc)
|
||||||
RpcClientCall* clientCall;
|
RpcClientCall* clientCall;
|
||||||
p_cont_elem_t* p_cont_elem;
|
p_cont_elem_t* p_cont_elem;
|
||||||
rpcconn_bind_hdr_t* bind_pdu = NULL;
|
rpcconn_bind_hdr_t* bind_pdu = NULL;
|
||||||
rdpSettings* settings = rpc->settings;
|
rdpContext* context;
|
||||||
freerdp* instance = (freerdp*)settings->instance;
|
rdpSettings* settings;
|
||||||
RpcVirtualConnection* connection = rpc->VirtualConnection;
|
freerdp* instance;
|
||||||
RpcInChannel* inChannel = connection->DefaultInChannel;
|
RpcVirtualConnection* connection;
|
||||||
|
RpcInChannel* inChannel;
|
||||||
const SecBuffer* sbuffer = NULL;
|
const SecBuffer* sbuffer = NULL;
|
||||||
|
|
||||||
|
WINPR_ASSERT(rpc);
|
||||||
|
context = transport_get_context(rpc->transport);
|
||||||
|
WINPR_ASSERT(context);
|
||||||
|
|
||||||
|
settings = context->settings;
|
||||||
|
WINPR_ASSERT(settings);
|
||||||
|
|
||||||
|
instance = context->instance;
|
||||||
|
WINPR_ASSERT(instance);
|
||||||
|
|
||||||
|
connection = rpc->VirtualConnection;
|
||||||
|
;
|
||||||
|
WINPR_ASSERT(connection);
|
||||||
|
|
||||||
|
inChannel = connection->DefaultInChannel;
|
||||||
|
|
||||||
WLog_DBG(TAG, "Sending Bind PDU");
|
WLog_DBG(TAG, "Sending Bind PDU");
|
||||||
ntlm_free(rpc->ntlm);
|
ntlm_free(rpc->ntlm);
|
||||||
rpc->ntlm = ntlm_new();
|
rpc->ntlm = ntlm_new();
|
||||||
|
|
|
@ -342,13 +342,17 @@ static int rpc_client_recv_fragment(rdpRpc* rpc, wStream* fragment)
|
||||||
{
|
{
|
||||||
/* End of TsProxySetupReceivePipe */
|
/* End of TsProxySetupReceivePipe */
|
||||||
TerminateEventArgs e;
|
TerminateEventArgs e;
|
||||||
|
rdpContext* context = transport_get_context(rpc->transport);
|
||||||
rdpTsg* tsg = transport_get_tsg(rpc->transport);
|
rdpTsg* tsg = transport_get_tsg(rpc->transport);
|
||||||
|
|
||||||
|
WINPR_ASSERT(context);
|
||||||
|
|
||||||
rpc->result = *((UINT32*)&buffer[StubOffset]);
|
rpc->result = *((UINT32*)&buffer[StubOffset]);
|
||||||
freerdp_abort_connect(rpc->context->instance);
|
freerdp_abort_connect(context->instance);
|
||||||
tsg_set_state(tsg, TSG_STATE_TUNNEL_CLOSE_PENDING);
|
tsg_set_state(tsg, TSG_STATE_TUNNEL_CLOSE_PENDING);
|
||||||
EventArgsInit(&e, "freerdp");
|
EventArgsInit(&e, "freerdp");
|
||||||
e.code = 0;
|
e.code = 0;
|
||||||
PubSub_OnTerminate(rpc->context->pubSub, rpc->context, &e);
|
PubSub_OnTerminate(context->pubSub, context, &e);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +560,8 @@ static int rpc_client_default_out_channel_recv(rdpRpc* rpc)
|
||||||
|
|
||||||
if (statusCode == HTTP_STATUS_DENIED)
|
if (statusCode == HTTP_STATUS_DENIED)
|
||||||
{
|
{
|
||||||
freerdp_set_last_error_if_not(rpc->context, FREERDP_ERROR_AUTHENTICATION_FAILED);
|
rdpContext* context = transport_get_context(rpc->transport);
|
||||||
|
freerdp_set_last_error_if_not(context, FREERDP_ERROR_AUTHENTICATION_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
http_response_free(response);
|
http_response_free(response);
|
||||||
|
|
|
@ -724,12 +724,20 @@ static BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu,
|
||||||
UINT32 SwitchValue;
|
UINT32 SwitchValue;
|
||||||
UINT32 MessageSwitchValue = 0;
|
UINT32 MessageSwitchValue = 0;
|
||||||
UINT32 IsMessagePresent;
|
UINT32 IsMessagePresent;
|
||||||
|
rdpContext* context;
|
||||||
PTSG_PACKET_CAPABILITIES tsgCaps = NULL;
|
PTSG_PACKET_CAPABILITIES tsgCaps = NULL;
|
||||||
PTSG_PACKET_VERSIONCAPS versionCaps = NULL;
|
PTSG_PACKET_VERSIONCAPS versionCaps = NULL;
|
||||||
TSG_PACKET_STRING_MESSAGE packetStringMessage;
|
TSG_PACKET_STRING_MESSAGE packetStringMessage;
|
||||||
PTSG_PACKET_CAPS_RESPONSE packetCapsResponse = NULL;
|
PTSG_PACKET_CAPS_RESPONSE packetCapsResponse = NULL;
|
||||||
PTSG_PACKET_QUARENC_RESPONSE packetQuarEncResponse = NULL;
|
PTSG_PACKET_QUARENC_RESPONSE packetQuarEncResponse = NULL;
|
||||||
|
|
||||||
|
WINPR_ASSERT(tsg);
|
||||||
|
WINPR_ASSERT(tsg->rpc);
|
||||||
|
WINPR_ASSERT(tsg->rpc->transport);
|
||||||
|
|
||||||
|
context = transport_get_context(tsg->rpc->transport);
|
||||||
|
WINPR_ASSERT(context);
|
||||||
|
|
||||||
if (!pdu)
|
if (!pdu)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -906,16 +914,15 @@ static BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsg->rpc && tsg->rpc->context && tsg->rpc->context->instance)
|
if (context->instance)
|
||||||
{
|
{
|
||||||
rc = IFCALLRESULT(TRUE, tsg->rpc->context->instance->PresentGatewayMessage,
|
rc = IFCALLRESULT(
|
||||||
tsg->rpc->context->instance,
|
TRUE, context->instance->PresentGatewayMessage, context->instance,
|
||||||
TSG_ASYNC_MESSAGE_CONSENT_MESSAGE
|
TSG_ASYNC_MESSAGE_CONSENT_MESSAGE ? GATEWAY_MESSAGE_CONSENT
|
||||||
? GATEWAY_MESSAGE_CONSENT
|
: TSG_ASYNC_MESSAGE_SERVICE_MESSAGE,
|
||||||
: TSG_ASYNC_MESSAGE_SERVICE_MESSAGE,
|
packetStringMessage.isDisplayMandatory != 0,
|
||||||
packetStringMessage.isDisplayMandatory != 0,
|
packetStringMessage.isConsentMandatory != 0, packetStringMessage.msgBytes,
|
||||||
packetStringMessage.isConsentMandatory != 0,
|
packetStringMessage.msgBuffer);
|
||||||
packetStringMessage.msgBytes, packetStringMessage.msgBuffer);
|
|
||||||
if (!rc)
|
if (!rc)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -1301,11 +1308,18 @@ static BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
|
||||||
UINT32 Pointer;
|
UINT32 Pointer;
|
||||||
UINT32 SwitchValue;
|
UINT32 SwitchValue;
|
||||||
TSG_PACKET packet;
|
TSG_PACKET packet;
|
||||||
|
rdpContext* context;
|
||||||
char* messageText = NULL;
|
char* messageText = NULL;
|
||||||
TSG_PACKET_MSG_RESPONSE packetMsgResponse = { 0 };
|
TSG_PACKET_MSG_RESPONSE packetMsgResponse = { 0 };
|
||||||
TSG_PACKET_STRING_MESSAGE packetStringMessage = { 0 };
|
TSG_PACKET_STRING_MESSAGE packetStringMessage = { 0 };
|
||||||
TSG_PACKET_REAUTH_MESSAGE packetReauthMessage = { 0 };
|
TSG_PACKET_REAUTH_MESSAGE packetReauthMessage = { 0 };
|
||||||
|
|
||||||
|
WINPR_ASSERT(tsg);
|
||||||
|
WINPR_ASSERT(tsg->rpc);
|
||||||
|
|
||||||
|
context = transport_get_context(tsg->rpc->transport);
|
||||||
|
WINPR_ASSERT(context);
|
||||||
|
|
||||||
/* This is an asynchronous response */
|
/* This is an asynchronous response */
|
||||||
|
|
||||||
if (!pdu)
|
if (!pdu)
|
||||||
|
@ -1355,10 +1369,10 @@ static BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
|
||||||
WLog_INFO(TAG, "Consent Message: %s", messageText);
|
WLog_INFO(TAG, "Consent Message: %s", messageText);
|
||||||
free(messageText);
|
free(messageText);
|
||||||
|
|
||||||
if (tsg->rpc && tsg->rpc->context && tsg->rpc->context->instance)
|
if (context->instance)
|
||||||
{
|
{
|
||||||
rc = IFCALLRESULT(TRUE, tsg->rpc->context->instance->PresentGatewayMessage,
|
rc = IFCALLRESULT(TRUE, context->instance->PresentGatewayMessage, context->instance,
|
||||||
tsg->rpc->context->instance, GATEWAY_MESSAGE_CONSENT,
|
GATEWAY_MESSAGE_CONSENT,
|
||||||
packetStringMessage.isDisplayMandatory != 0,
|
packetStringMessage.isDisplayMandatory != 0,
|
||||||
packetStringMessage.isConsentMandatory != 0,
|
packetStringMessage.isConsentMandatory != 0,
|
||||||
packetStringMessage.msgBytes, packetStringMessage.msgBuffer);
|
packetStringMessage.msgBytes, packetStringMessage.msgBuffer);
|
||||||
|
@ -1376,10 +1390,10 @@ static BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
|
||||||
WLog_INFO(TAG, "Service Message: %s", messageText);
|
WLog_INFO(TAG, "Service Message: %s", messageText);
|
||||||
free(messageText);
|
free(messageText);
|
||||||
|
|
||||||
if (tsg->rpc && tsg->rpc->context && tsg->rpc->context->instance)
|
if (context->instance)
|
||||||
{
|
{
|
||||||
rc = IFCALLRESULT(TRUE, tsg->rpc->context->instance->PresentGatewayMessage,
|
rc = IFCALLRESULT(TRUE, context->instance->PresentGatewayMessage, context->instance,
|
||||||
tsg->rpc->context->instance, GATEWAY_MESSAGE_SERVICE,
|
GATEWAY_MESSAGE_SERVICE,
|
||||||
packetStringMessage.isDisplayMandatory != 0,
|
packetStringMessage.isDisplayMandatory != 0,
|
||||||
packetStringMessage.isConsentMandatory != 0,
|
packetStringMessage.isConsentMandatory != 0,
|
||||||
packetStringMessage.msgBytes, packetStringMessage.msgBuffer);
|
packetStringMessage.msgBytes, packetStringMessage.msgBuffer);
|
||||||
|
@ -2033,9 +2047,22 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port, DWORD timeout)
|
||||||
UINT64 looptimeout = timeout * 1000ULL;
|
UINT64 looptimeout = timeout * 1000ULL;
|
||||||
DWORD nCount;
|
DWORD nCount;
|
||||||
HANDLE events[MAXIMUM_WAIT_OBJECTS] = { 0 };
|
HANDLE events[MAXIMUM_WAIT_OBJECTS] = { 0 };
|
||||||
rdpRpc* rpc = tsg->rpc;
|
rdpRpc* rpc;
|
||||||
rdpSettings* settings = rpc->settings;
|
rdpContext* context;
|
||||||
rdpTransport* transport = rpc->transport;
|
rdpSettings* settings;
|
||||||
|
rdpTransport* transport;
|
||||||
|
|
||||||
|
WINPR_ASSERT(tsg);
|
||||||
|
|
||||||
|
rpc = tsg->rpc;
|
||||||
|
WINPR_ASSERT(rpc);
|
||||||
|
|
||||||
|
transport = rpc->transport;
|
||||||
|
context = transport_get_context(transport);
|
||||||
|
WINPR_ASSERT(context);
|
||||||
|
|
||||||
|
settings = context->settings;
|
||||||
|
|
||||||
tsg->Port = port;
|
tsg->Port = port;
|
||||||
tsg->transport = transport;
|
tsg->transport = transport;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue