server: proxy: channels: only open allowed channels
authorkubistika <kmizrachi18@gmail.com>
Sat, 3 Aug 2019 13:46:20 +0000 (16:46 +0300)
committerkubistika <kmizrachi18@gmail.com>
Mon, 5 Aug 2019 08:01:31 +0000 (11:01 +0300)
server/proxy/pf_channels.c
server/proxy/pf_server.c

index 922a29b..ff73137 100644 (file)
@@ -55,25 +55,25 @@ void pf_OnChannelConnectedEventHandler(void* data,
        }
        else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
        {
-               pc->gfx = (RdpgfxClientContext*) e->pInterface;
-               pf_rdpgfx_pipeline_init(pc->gfx, ps->gfx, pc->pdata);
-
                if (!ps->gfx->Open(ps->gfx))
                {
                        WLog_ERR(TAG, "failed to open GFX server");
                        return;
                }
+
+               pc->gfx = (RdpgfxClientContext*) e->pInterface;
+               pf_rdpgfx_pipeline_init(pc->gfx, ps->gfx, pc->pdata);
        }
        else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
        {
-               pc->disp = (DispClientContext*) e->pInterface;
-               pf_disp_register_callbacks(pc->disp, ps->disp, pc->pdata);
-
                if (ps->disp->Open(ps->disp) != CHANNEL_RC_OK)
                {
                        WLog_ERR(TAG, "failed to open disp channel");
                        return;
                }
+
+               pc->disp = (DispClientContext*) e->pInterface;
+               pf_disp_register_callbacks(pc->disp, ps->disp, pc->pdata);
        }
 }
 
@@ -108,11 +108,20 @@ void pf_OnChannelDisconnectedEventHandler(void* data,
 
 BOOL pf_server_channels_init(pServerContext* ps)
 {
-       if (!pf_server_rdpgfx_init(ps))
-               return FALSE;
+       rdpContext* context = (rdpContext*) ps;
+       proxyConfig* config = ps->pdata->config;
+
+       if (context->settings->SupportGraphicsPipeline && config->GFX)
+       {
+               if (!pf_server_rdpgfx_init(ps))
+                       return FALSE;
+       }
 
-       if (!pf_server_disp_init(ps))
-               return FALSE;
+       if (config->DisplayControl)
+       {
+               if (!pf_server_disp_init(ps))
+                       return FALSE;
+       }
 
        return TRUE;
 }
index f2c284a..961634a 100644 (file)
@@ -245,9 +245,9 @@ static DWORD WINAPI pf_server_handle_client(LPVOID arg)
                goto out_free_peer;
        }
 
-       client->settings->SupportDisplayControl = TRUE;
+       client->settings->SupportDisplayControl = config->DisplayControl;
+       client->settings->DynamicResolutionUpdate = config->DisplayControl;
        client->settings->SupportMonitorLayoutPdu = TRUE;
-       client->settings->DynamicResolutionUpdate = TRUE;
        client->settings->RdpSecurity = config->RdpSecurity;
        client->settings->TlsSecurity = config->TlsSecurity;
        client->settings->NlaSecurity = config->NlaSecurity;