GW RPC-HTTP - Don't drop 4 byte stub from the pipe
authorDaniel Bungert <bungert@hp.com>
Fri, 10 Apr 2015 21:09:54 +0000 (15:09 -0600)
committerDaniel Bungert <bungert@hp.com>
Fri, 10 Apr 2015 21:09:54 +0000 (15:09 -0600)
* Though not frequent, it's possible to get TsProxySetupReceivePipe
  data of stublength 4 that is actual data.  This happens when
  header->common.call_id == rpc->PipeCallId &&
  !(header->common.pfc_flags & PFC_LAST_FRAG).
  This should address GW disconnects that manifest as SSL read errors.

libfreerdp/core/gateway/rpc_client.c

index 1d8e459..17deaf5 100644 (file)
@@ -332,9 +332,9 @@ int rpc_client_recv_fragment(rdpRpc* rpc, wStream* fragment)
 
                if (StubLength == 4)
                {
-                       /* received a disconnect request from the server? */
                        if ((header->common.call_id == rpc->PipeCallId) && (header->common.pfc_flags & PFC_LAST_FRAG))
                        {
+                               /* End of TsProxySetupReceivePipe */
                                TerminateEventArgs e;
 
                                rpc->result = *((UINT32*) &buffer[StubOffset]);
@@ -344,9 +344,14 @@ int rpc_client_recv_fragment(rdpRpc* rpc, wStream* fragment)
                                EventArgsInit(&e, "freerdp");
                                e.code = 0;
                                PubSub_OnTerminate(rpc->context->pubSub, rpc->context, &e);
+                               return 0;
                        }
 
-                       return 0;
+                       if (header->common.call_id != rpc->PipeCallId)
+                       {
+                               /* Ignoring non-TsProxySetupReceivePipe Response */
+                               return 0;
+                       }
                }
 
                if (rpc->StubFragCount == 0)