diff --git a/server/proxy/pf_client.c b/server/proxy/pf_client.c index 348843cb2..8491eb20a 100644 --- a/server/proxy/pf_client.c +++ b/server/proxy/pf_client.c @@ -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; } diff --git a/server/proxy/pf_context.c b/server/proxy/pf_context.c index 05ee2d2a0..4817d17f1 100644 --- a/server/proxy/pf_context.c +++ b/server/proxy/pf_context.c @@ -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; diff --git a/server/proxy/pf_context.h b/server/proxy/pf_context.h index d4c0ea54a..2cd7fe650 100644 --- a/server/proxy/pf_context.h +++ b/server/proxy/pf_context.h @@ -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 */ diff --git a/server/proxy/pf_server.c b/server/proxy/pf_server.c index 8cb9f3b3b..98e2ba1c4 100644 --- a/server/proxy/pf_server.c +++ b/server/proxy/pf_server.c @@ -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);