Skip to content

Commit

Permalink
Removed RdpKeyFile and RdpKeyContent settings
Browse files Browse the repository at this point in the history
They are a duplicate of PrivateKeyFile and PrivateKeyContent
  • Loading branch information
akallabeth committed Jul 6, 2022
1 parent d0ae1c8 commit b672bda
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 94 deletions.
3 changes: 0 additions & 3 deletions include/freerdp/server/proxy/proxy_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ struct proxy_config

char* PrivateKeyFile;
char* PrivateKeyContent;

char* RdpKeyFile;
char* RdpKeyContent;
};

#ifdef __cplusplus
Expand Down
6 changes: 2 additions & 4 deletions include/freerdp/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,13 +687,11 @@ typedef struct
#define FreeRDP_CertificateName (1409)
#define FreeRDP_CertificateFile (1410)
#define FreeRDP_PrivateKeyFile (1411)
#define FreeRDP_RdpKeyFile (1412)
#define FreeRDP_RdpServerRsaKey (1413)
#define FreeRDP_RdpServerCertificate (1414)
#define FreeRDP_ExternalCertificateManagement (1415)
#define FreeRDP_CertificateContent (1416)
#define FreeRDP_PrivateKeyContent (1417)
#define FreeRDP_RdpKeyContent (1418)
#define FreeRDP_AutoAcceptCertificate (1419)
#define FreeRDP_AutoDenyCertificate (1420)
#define FreeRDP_CertificateAcceptedFingerprints (1421)
Expand Down Expand Up @@ -1198,13 +1196,13 @@ struct rdp_settings
ALIGN64 char* CertificateName; /* 1409 */
ALIGN64 char* CertificateFile; /* 1410 */
ALIGN64 char* PrivateKeyFile; /* 1411 */
ALIGN64 char* RdpKeyFile; /* 1412 */
UINT64 padding1412[1]; /* 1412 */
ALIGN64 rdpRsaKey* RdpServerRsaKey; /* 1413 */
ALIGN64 rdpCertificate* RdpServerCertificate; /* 1414 */
ALIGN64 BOOL ExternalCertificateManagement; /* 1415 */
ALIGN64 char* CertificateContent; /* 1416 */
ALIGN64 char* PrivateKeyContent; /* 1417 */
ALIGN64 char* RdpKeyContent; /* 1418 */
UINT64 padding1418[1]; /* 1418 */
ALIGN64 BOOL AutoAcceptCertificate; /* 1419 */
ALIGN64 BOOL AutoDenyCertificate; /* 1420 */
ALIGN64 char* CertificateAcceptedFingerprints; /* 1421 */
Expand Down
18 changes: 0 additions & 18 deletions libfreerdp/common/settings_getters.c
Original file line number Diff line number Diff line change
Expand Up @@ -2518,12 +2518,6 @@ const char* freerdp_settings_get_string(const rdpSettings* settings, size_t id)
case FreeRDP_RDP2TCPArgs:
return settings->RDP2TCPArgs;

case FreeRDP_RdpKeyContent:
return settings->RdpKeyContent;

case FreeRDP_RdpKeyFile:
return settings->RdpKeyFile;

case FreeRDP_ReaderName:
return settings->ReaderName;

Expand Down Expand Up @@ -2785,12 +2779,6 @@ char* freerdp_settings_get_string_writable(rdpSettings* settings, size_t id)
case FreeRDP_RDP2TCPArgs:
return settings->RDP2TCPArgs;

case FreeRDP_RdpKeyContent:
return settings->RdpKeyContent;

case FreeRDP_RdpKeyFile:
return settings->RdpKeyFile;

case FreeRDP_ReaderName:
return settings->ReaderName;

Expand Down Expand Up @@ -3062,12 +3050,6 @@ BOOL freerdp_settings_set_string_(rdpSettings* settings, size_t id, const char*
case FreeRDP_RDP2TCPArgs:
return update_string(&settings->RDP2TCPArgs, cnv.cc, len, cleanup);

case FreeRDP_RdpKeyContent:
return update_string(&settings->RdpKeyContent, cnv.cc, len, cleanup);

case FreeRDP_RdpKeyFile:
return update_string(&settings->RdpKeyFile, cnv.cc, len, cleanup);

case FreeRDP_ReaderName:
return update_string(&settings->ReaderName, cnv.cc, len, cleanup);

Expand Down
2 changes: 0 additions & 2 deletions libfreerdp/common/settings_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ static const struct settings_str_entry settings_map[] = {
{ FreeRDP_ProxyPassword, 7, "FreeRDP_ProxyPassword" },
{ FreeRDP_ProxyUsername, 7, "FreeRDP_ProxyUsername" },
{ FreeRDP_RDP2TCPArgs, 7, "FreeRDP_RDP2TCPArgs" },
{ FreeRDP_RdpKeyContent, 7, "FreeRDP_RdpKeyContent" },
{ FreeRDP_RdpKeyFile, 7, "FreeRDP_RdpKeyFile" },
{ FreeRDP_ReaderName, 7, "FreeRDP_ReaderName" },
{ FreeRDP_RedirectionAcceptedCert, 7, "FreeRDP_RedirectionAcceptedCert" },
{ FreeRDP_RedirectionDomain, 7, "FreeRDP_RedirectionDomain" },
Expand Down
4 changes: 2 additions & 2 deletions libfreerdp/core/nego.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,8 +1313,8 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
settings->UseRdpSecurityLayer = FALSE;
settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;
}
else if (!settings->RdpServerRsaKey && !settings->RdpKeyFile &&
!settings->RdpKeyContent)
else if (!settings->RdpServerRsaKey && !settings->PrivateKeyFile &&
!settings->PrivateKeyContent)
{
WLog_ERR(TAG, "Missing server certificate");
return FALSE;
Expand Down
10 changes: 5 additions & 5 deletions libfreerdp/core/peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,19 @@ static BOOL freerdp_peer_initialize(freerdp_peer* client)
settings->LocalConnection = client->local;
rdp_server_transition_to_state(rdp, CONNECTION_STATE_INITIAL);

if (settings->RdpKeyFile)
if (settings->PrivateKeyFile)
{
settings->RdpServerRsaKey = key_new(settings->RdpKeyFile);
settings->RdpServerRsaKey = key_new(settings->PrivateKeyFile);

if (!settings->RdpServerRsaKey)
{
WLog_ERR(TAG, "invalid RDP key file %s", settings->RdpKeyFile);
WLog_ERR(TAG, "invalid RDP key file %s", settings->PrivateKeyFile);
return FALSE;
}
}
else if (settings->RdpKeyContent)
else if (settings->PrivateKeyContent)
{
settings->RdpServerRsaKey = key_new_from_content(settings->RdpKeyContent, NULL);
settings->RdpServerRsaKey = key_new_from_content(settings->PrivateKeyContent, NULL);

if (!settings->RdpServerRsaKey)
{
Expand Down
2 changes: 0 additions & 2 deletions libfreerdp/core/test/settings_property_lists.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,6 @@ static const size_t string_list_indices[] = {
FreeRDP_ProxyPassword,
FreeRDP_ProxyUsername,
FreeRDP_RDP2TCPArgs,
FreeRDP_RdpKeyContent,
FreeRDP_RdpKeyFile,
FreeRDP_ReaderName,
FreeRDP_RedirectionAcceptedCert,
FreeRDP_RedirectionDomain,
Expand Down
3 changes: 1 addition & 2 deletions server/Sample/sfreerdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,8 +1021,7 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg)
}
}
if (!freerdp_settings_set_string(settings, FreeRDP_CertificateFile, cert) ||
!freerdp_settings_set_string(settings, FreeRDP_PrivateKeyFile, key) ||
!freerdp_settings_set_string(settings, FreeRDP_RdpKeyFile, key))
!freerdp_settings_set_string(settings, FreeRDP_PrivateKeyFile, key))
{
WLog_ERR(TAG, "Memory allocation failed (strdup)");
freerdp_peer_free(client);
Expand Down
48 changes: 0 additions & 48 deletions server/proxy/pf_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,39 +389,6 @@ static BOOL pf_config_load_certificates(wIniFile* ini, proxyConfig* config)
return FALSE;
}

tmp1 = pf_config_get_str(ini, "Certificates", "RdpKeyFile", FALSE);
if (tmp1)
{
if (!winpr_PathFileExists(tmp1))
{
WLog_ERR(TAG, "Certificates/RdpKeyFile file %s does not exist", tmp1);
return FALSE;
}
config->RdpKeyFile = _strdup(tmp1);
}
tmp2 = pf_config_get_str(ini, "Certificates", "RdpKeyContent", FALSE);
if (tmp2)
{
if (strlen(tmp2) < 1)
{
WLog_ERR(TAG, "Certificates/RdpKeyContent has invalid empty value");
return FALSE;
}
config->RdpKeyContent = _strdup(tmp2);
}
if (tmp1 && tmp2)
{
WLog_ERR(TAG, "Certificates/RdpKeyFile and Certificates/RdpKeyContent are mutually "
"exclusive options");
return FALSE;
}
else if (!tmp1 && !tmp2)
{
WLog_ERR(TAG, "Certificates/RdpKeyFile or Certificates/RdpKeyContent are "
"required settings");
return FALSE;
}

return TRUE;
}

Expand Down Expand Up @@ -571,13 +538,6 @@ BOOL pf_server_config_dump(const char* file)
"<Contents of some private key file in PEM format>") < 0)
goto fail;

if (IniFile_SetKeyValueString(ini, "Certificates", "RdpKeyFile",
"<absolute path to some private key file> OR") < 0)
goto fail;
if (IniFile_SetKeyValueString(ini, "Certificates", "RdpKeyContent",
"<Contents of some private key file in PEM format>") < 0)
goto fail;

/* store configuration */
if (IniFile_WriteFile(ini, file) < 0)
goto fail;
Expand Down Expand Up @@ -731,8 +691,6 @@ void pf_server_config_print(const proxyConfig* config)
CONFIG_PRINT_STR_CONTENT(config, CertificateContent);
CONFIG_PRINT_STR(config, PrivateKeyFile);
CONFIG_PRINT_STR_CONTENT(config, PrivateKeyContent);
CONFIG_PRINT_STR(config, RdpKeyFile);
CONFIG_PRINT_STR_CONTENT(config, RdpKeyContent);
}

void pf_server_config_free(proxyConfig* config)
Expand All @@ -750,8 +708,6 @@ void pf_server_config_free(proxyConfig* config)
free(config->CertificateContent);
free(config->PrivateKeyFile);
free(config->PrivateKeyContent);
free(config->RdpKeyFile);
free(config->RdpKeyContent);
free(config);
}

Expand Down Expand Up @@ -854,10 +810,6 @@ BOOL pf_config_clone(proxyConfig** dst, const proxyConfig* config)
goto fail;
if (!pf_config_copy_string(&tmp->PrivateKeyContent, config->PrivateKeyContent))
goto fail;
if (!pf_config_copy_string(&tmp->RdpKeyFile, config->RdpKeyFile))
goto fail;
if (!pf_config_copy_string(&tmp->RdpKeyContent, config->RdpKeyContent))
goto fail;

*dst = tmp;
return TRUE;
Expand Down
1 change: 0 additions & 1 deletion server/proxy/pf_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ 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_RdpKeyContent, FreeRDP_RdpKeyFile,
FreeRDP_PrivateKeyFile, FreeRDP_CertificateFile,
FreeRDP_CertificateName, FreeRDP_CertificateContent };

Expand Down
4 changes: 1 addition & 3 deletions server/proxy/pf_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,7 @@ static BOOL pf_server_initialize_peer_connection(freerdp_peer* peer)
config->CertificateContent) ||
!freerdp_settings_set_string(settings, FreeRDP_PrivateKeyFile, config->PrivateKeyFile) ||
!freerdp_settings_set_string(settings, FreeRDP_PrivateKeyContent,
config->PrivateKeyContent) ||
!freerdp_settings_set_string(settings, FreeRDP_RdpKeyFile, config->RdpKeyFile) ||
!freerdp_settings_set_string(settings, FreeRDP_RdpKeyContent, config->RdpKeyContent))
config->PrivateKeyContent))
{
WLog_ERR(TAG, "Memory allocation failed (strdup)");
return FALSE;
Expand Down
4 changes: 0 additions & 4 deletions server/shadow/shadow_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ static BOOL shadow_client_context_new(freerdp_peer* peer, rdpContext* context)
if (!freerdp_settings_set_string(settings, FreeRDP_PrivateKeyFile, server->PrivateKeyFile))
goto fail_privkey_file;

if (!freerdp_settings_set_string(settings, FreeRDP_RdpKeyFile, server->PrivateKeyFile))
goto fail_rdpkey_file;
if (server->ipcSocket && (strncmp(bind_address, server->ipcSocket,
strnlen(bind_address, sizeof(bind_address))) != 0))
{
Expand Down Expand Up @@ -244,8 +242,6 @@ static BOOL shadow_client_context_new(freerdp_peer* peer, rdpContext* context)
fail_open_server:
DeleteCriticalSection(&(client->lock));
fail_client_lock:
freerdp_settings_set_string(settings, FreeRDP_RdpKeyFile, NULL);
fail_rdpkey_file:
freerdp_settings_set_string(settings, FreeRDP_PrivateKeyFile, NULL);
fail_privkey_file:
freerdp_settings_set_string(settings, FreeRDP_CertificateFile, NULL);
Expand Down

0 comments on commit b672bda

Please sign in to comment.