server/proxy: Refactor pdata_set_connection_info
Connection info must be set after the proxy's client connection established, because if the client didn't provide credentials in .rdp file, we don't know its username yet.
This commit is contained in:
parent
98973dd0da
commit
8a115f2020
@ -142,13 +142,20 @@ static BOOL pf_client_post_connect(freerdp* instance)
|
||||
pClientContext* pc;
|
||||
rdpContext* ps;
|
||||
|
||||
if (!gdi_init(instance, PIXEL_FORMAT_XRGB32))
|
||||
return FALSE;
|
||||
|
||||
context = instance->context;
|
||||
settings = instance->settings;
|
||||
update = instance->update;
|
||||
pc = (pClientContext*) context;
|
||||
ps = (rdpContext*) pc->pdata->ps;
|
||||
|
||||
if (!proxy_data_set_connection_info(pc->pdata, ps->settings, settings))
|
||||
{
|
||||
WLog_ERR(TAG, "proxy_data_set_connection_info failed!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gdi_init(instance, PIXEL_FORMAT_XRGB32))
|
||||
return FALSE;
|
||||
|
||||
if (!pf_register_pointer(context->graphics))
|
||||
return FALSE;
|
||||
@ -170,7 +177,6 @@ static BOOL pf_client_post_connect(freerdp* instance)
|
||||
}
|
||||
|
||||
pf_client_register_update_callbacks(update);
|
||||
ps = (rdpContext*) pc->pdata->ps;
|
||||
proxy_server_reactivate(ps, context);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -159,16 +159,16 @@ proxyData* proxy_data_new()
|
||||
return pdata;
|
||||
}
|
||||
|
||||
BOOL proxy_data_set_connection_info(proxyData* pdata, rdpSettings* clientSettings,
|
||||
const char* target)
|
||||
/* sets connection info values using the settings of both server & client */
|
||||
BOOL proxy_data_set_connection_info(proxyData* pdata, rdpSettings* ps, rdpSettings* pc)
|
||||
{
|
||||
if (!(pdata->info->TargetHostname = _strdup(target)))
|
||||
if (!(pdata->info->TargetHostname = _strdup(pc->ServerHostname)))
|
||||
goto out_fail;
|
||||
|
||||
if (!(pdata->info->ClientHostname = _strdup(clientSettings->ClientHostname)))
|
||||
if (!(pdata->info->Username = _strdup(pc->Username)))
|
||||
goto out_fail;
|
||||
|
||||
if (!(pdata->info->Username = _strdup(clientSettings->Username)))
|
||||
if (!(pdata->info->ClientHostname = _strdup(ps->ClientHostname)))
|
||||
goto out_fail;
|
||||
|
||||
return TRUE;
|
||||
|
@ -90,8 +90,7 @@ struct proxy_data
|
||||
BOOL init_p_server_context(freerdp_peer* client);
|
||||
rdpContext* p_client_context_create(rdpSettings* clientSettings);
|
||||
proxyData* proxy_data_new();
|
||||
BOOL proxy_data_set_connection_info(proxyData* pdata, rdpSettings* clientSettings,
|
||||
const char* target);
|
||||
BOOL proxy_data_set_connection_info(proxyData* pdata, rdpSettings* ps, rdpSettings* pc);
|
||||
void proxy_data_free(proxyData* pdata);
|
||||
|
||||
#endif /* FREERDP_SERVER_PROXY_PFCONTEXT_H */
|
||||
|
@ -176,12 +176,6 @@ static BOOL pf_server_post_connect(freerdp_peer* client)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!proxy_data_set_connection_info(pdata, client->settings, pc->settings->ServerHostname))
|
||||
{
|
||||
WLog_ERR(TAG, "proxy_data_set_connection_info failed!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pf_server_rdpgfx_init(ps);
|
||||
pf_server_disp_init(ps);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user