[server,proxy] use rdpPrivateKey and rdpCertificate

This commit is contained in:
akallabeth 2023-02-03 16:19:18 +01:00 committed by Martin Fleisz
parent fe287e199b
commit 87e90903ab
2 changed files with 20 additions and 26 deletions

View File

@ -217,9 +217,7 @@ BOOL pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src)
{
BOOL rc = FALSE;
rdpSettings* before_copy;
const size_t to_revert[] = { FreeRDP_ConfigPath, FreeRDP_PrivateKeyContent,
FreeRDP_PrivateKeyFile, FreeRDP_CertificateFile,
FreeRDP_CertificateName, FreeRDP_CertificateContent };
const size_t to_revert[] = { FreeRDP_ConfigPath, FreeRDP_CertificateName };
if (!dst || !src)
return FALSE;

View File

@ -444,31 +444,38 @@ original_cb:
static BOOL pf_server_initialize_peer_connection(freerdp_peer* peer)
{
pServerContext* ps;
rdpSettings* settings;
proxyData* pdata;
const proxyConfig* config;
proxyServer* server;
WINPR_ASSERT(peer);
ps = (pServerContext*)peer->context;
pServerContext* ps = (pServerContext*)peer->context;
if (!ps)
return FALSE;
settings = peer->context->settings;
rdpSettings* settings = peer->context->settings;
WINPR_ASSERT(settings);
pdata = proxy_data_new();
proxyData* pdata = proxy_data_new();
if (!pdata)
return FALSE;
server = (proxyServer*)peer->ContextExtra;
proxyServer* server = (proxyServer*)peer->ContextExtra;
WINPR_ASSERT(server);
proxy_data_set_server_context(pdata, ps);
pdata->module = server->module;
config = pdata->config = server->config;
const proxyConfig* config = pdata->config = server->config;
rdpPrivateKey* key = freerdp_key_new_from_pem(config->PrivateKeyPEM);
if (!key)
return FALSE;
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_RdpServerRsaKey, key, 1))
return FALSE;
rdpCertificate* cert = freerdp_certificate_new_from_pem(config->CertificatePEM);
if (!cert)
return FALSE;
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_RdpServerCertificate, cert, 1))
return FALSE;
/* currently not supporting GDI orders */
ZeroMemory(settings->OrderSupport, 32);
@ -487,17 +494,6 @@ static BOOL pf_server_initialize_peer_connection(freerdp_peer* peer)
return FALSE;
}
if (!freerdp_settings_set_string(settings, FreeRDP_CertificateFile, config->CertificateFile) ||
!freerdp_settings_set_string(settings, FreeRDP_CertificateContent,
config->CertificateContent) ||
!freerdp_settings_set_string(settings, FreeRDP_PrivateKeyFile, config->PrivateKeyFile) ||
!freerdp_settings_set_string(settings, FreeRDP_PrivateKeyContent,
config->PrivateKeyContent))
{
PROXY_LOG_ERR(TAG, ps, "Memory allocation failed (strdup)");
return FALSE;
}
if (config->RemoteApp)
{
const UINT32 mask =