server: proxy: vc hook: check if proxy client is not null

This commit is contained in:
Kobi Mizrachi 2020-05-19 14:43:30 +03:00
parent 215e41b4ee
commit 715c3f293a

View File

@ -200,11 +200,19 @@ static BOOL pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 chann
{ {
pServerContext* ps = (pServerContext*)peer->context; pServerContext* ps = (pServerContext*)peer->context;
pClientContext* pc = ps->pdata->pc; pClientContext* pc = ps->pdata->pc;
proxyData* pdata = pc->pdata; proxyData* pdata = ps->pdata;
proxyConfig* config = pdata->config; proxyConfig* config = pdata->config;
size_t i; size_t i;
const char* channel_name = WTSChannelGetName(peer, channelId); const char* channel_name = WTSChannelGetName(peer, channelId);
/*
* client side is not initialized yet, call original callback.
* this is probably a drdynvc message between peer and proxy server,
* which doesn't need to be proxied.
*/
if (!pc)
goto original_cb;
for (i = 0; i < config->PassthroughCount; i++) for (i = 0; i < config->PassthroughCount; i++)
{ {
if (strncmp(channel_name, config->Passthrough[i], CHANNEL_NAME_LEN) == 0) if (strncmp(channel_name, config->Passthrough[i], CHANNEL_NAME_LEN) == 0)
@ -227,6 +235,7 @@ static BOOL pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 chann
} }
} }
original_cb:
return server_receive_channel_data_original(peer, channelId, data, size, flags, totalSize); return server_receive_channel_data_original(peer, channelId, data, size, flags, totalSize);
} }