libfreerdp-core: parse gateway idle timeout + final status code

This commit is contained in:
Marc-André Moreau 2015-01-14 16:49:21 -05:00
parent 94f828a873
commit d8ddfd83c3
2 changed files with 18 additions and 4 deletions

View File

@ -93,6 +93,7 @@ int rpc_client_receive_pool_return(rdpRpc* rpc, RPC_PDU* pdu)
int rpc_client_on_fragment_received_event(rdpRpc* rpc)
{
BYTE* buffer;
UINT32 result;
UINT32 StubOffset;
UINT32 StubLength;
wStream* fragment;
@ -160,12 +161,13 @@ int rpc_client_on_fragment_received_event(rdpRpc* rpc)
if (StubLength == 4)
{
//WLog_ERR(TAG, "Ignoring TsProxySendToServer Response");
//WLog_DBG(TAG, "Got stub length 4 with flags %d and callid %d", header->common.pfc_flags, header->common.call_id);
/* received a disconnect request from the server? */
if ((header->common.call_id == rpc->PipeCallId) && (header->common.pfc_flags & PFC_LAST_FRAG))
{
result = *((UINT32*) &buffer[StubOffset]); /* TODO: use this status code */
TerminateEventArgs e;
rpc->context->rdp->disconnect = TRUE;
rpc->transport->tsg->state = TSG_STATE_TUNNEL_CLOSE_PENDING;

View File

@ -184,7 +184,7 @@ BOOL TsProxyCreateTunnelWriteRequest(rdpTsg* tsg)
* However, reduced capabilities may break connectivity with servers enforcing features, such as
* "Only allow connections from Remote Desktop Services clients that support RD Gateway messaging"
*/
//NapCapabilities = TSG_NAP_CAPABILITY_IDLE_TIMEOUT;
*((UINT32*) &buffer[44]) = NapCapabilities; /* capabilities */
CopyMemory(&buffer[48], TsProxyCreateTunnelUnknownTrailerBytes, 60);
status = rpc_write(rpc, buffer, length, TsProxyCreateTunnelOpnum);
@ -591,6 +591,7 @@ BOOL TsProxyAuthorizeTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
UINT32 Pointer;
UINT32 SizeValue;
UINT32 SwitchValue;
UINT32 idleTimeout;
PTSG_PACKET packet;
rdpRpc* rpc = tsg->rpc;
PTSG_PACKET_RESPONSE packetResponse;
@ -670,11 +671,22 @@ BOOL TsProxyAuthorizeTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
free(packet);
return FALSE;
}
offset += SizeValue; /* ResponseData */
if (SizeValue == 4)
{
idleTimeout = *((UINT32*) &buffer[offset]);
offset += 4;
}
else
{
offset += SizeValue; /* ResponseData */
}
rpc_client_receive_pool_return(rpc, pdu);
free(packetResponse);
free(packet);
return TRUE;
}