Use freerdp_settings_set and _strdup

This commit is contained in:
Armin Novak 2022-02-02 09:41:25 +01:00 committed by akallabeth
parent 3303aa1446
commit cefb4e1237
8 changed files with 64 additions and 79 deletions

View File

@ -101,7 +101,7 @@ char* get_string_from_string_builder(JNIEnv* env, jobject strBuilder)
native_str = (*env)->GetStringUTFChars(env, strObj, NULL); native_str = (*env)->GetStringUTFChars(env, strObj, NULL);
if (!native_str) if (!native_str)
return NULL; return NULL;
result = strdup(native_str); result = _strdup(native_str);
(*env)->ReleaseStringUTFChars(env, strObj, native_str); (*env)->ReleaseStringUTFChars(env, strObj, native_str);
return result; return result;

View File

@ -176,28 +176,21 @@ static BOOL freerdp_client_settings_post_process(rdpSettings* settings)
{ {
if (settings->Username) if (settings->Username)
{ {
free(settings->GatewayUsername); if (!freerdp_settings_set_string(settings, FreeRDP_GatewayUsername,
settings->GatewayUsername = _strdup(settings->Username); settings->Username))
if (!settings->GatewayUsername)
goto out_error; goto out_error;
} }
if (settings->Domain) if (settings->Domain)
{ {
free(settings->GatewayDomain); if (!freerdp_settings_set_string(settings, FreeRDP_GatewayDomain, settings->Domain))
settings->GatewayDomain = _strdup(settings->Domain);
if (!settings->GatewayDomain)
goto out_error; goto out_error;
} }
if (settings->Password) if (settings->Password)
{ {
free(settings->GatewayPassword); if (!freerdp_settings_set_string(settings, FreeRDP_GatewayPassword,
settings->GatewayPassword = _strdup(settings->Password); settings->Password))
if (!settings->GatewayPassword)
goto out_error; goto out_error;
} }
} }

View File

@ -521,7 +521,7 @@ static int freerdp_client_command_line_pre_filter(void* context, int index, int
{ {
settings = (rdpSettings*)context; settings = (rdpSettings*)context;
if (!copy_value(argv[index], &settings->ConnectionFile)) if (!freerdp_settings_set_string(settings, FreeRDP_ConnectionFile, argv[index]))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
return 1; return 1;
@ -534,7 +534,7 @@ static int freerdp_client_command_line_pre_filter(void* context, int index, int
{ {
settings = (rdpSettings*)context; settings = (rdpSettings*)context;
if (!copy_value(argv[index], &settings->AssistanceFile)) if (!freerdp_settings_set_string(settings, FreeRDP_AssistanceFile, argv[index]))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
return 1; return 1;
@ -1605,7 +1605,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
else else
{ {
if (!(settings->ServerHostname = _strdup(arg->Value))) if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
} }
@ -1641,7 +1641,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "spn-class") CommandLineSwitchCase(arg, "spn-class")
{ {
if (!copy_value(arg->Value, &settings->AuthenticationServiceClass)) if (!freerdp_settings_set_string(settings, FreeRDP_AuthenticationServiceClass,
arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "redirect-prefer") CommandLineSwitchCase(arg, "redirect-prefer")
@ -1695,7 +1696,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
{ {
settings->SendPreconnectionPdu = TRUE; settings->SendPreconnectionPdu = TRUE;
if (!copy_value(arg->Value, &settings->PreconnectionBlob)) if (!freerdp_settings_set_string(settings, FreeRDP_PreconnectionBlob, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
} }
@ -1855,7 +1856,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "t") CommandLineSwitchCase(arg, "t")
{ {
if (!copy_value(arg->Value, &settings->WindowTitle)) if (!freerdp_settings_set_string(settings, FreeRDP_WindowTitle, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "decorations") CommandLineSwitchCase(arg, "decorations")
@ -1933,12 +1934,12 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
settings->ConsoleSession = TRUE; settings->ConsoleSession = TRUE;
settings->RestrictedAdminModeRequired = TRUE; settings->RestrictedAdminModeRequired = TRUE;
if (!copy_value(arg->Value, &settings->PasswordHash)) if (!freerdp_settings_set_string(settings, FreeRDP_PasswordHash, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "client-hostname") CommandLineSwitchCase(arg, "client-hostname")
{ {
if (!copy_value(arg->Value, &settings->ClientHostname)) if (!freerdp_settings_set_string(settings, FreeRDP_ClientHostname, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "kbd") CommandLineSwitchCase(arg, "kbd")
@ -1965,7 +1966,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "kbd-remap") CommandLineSwitchCase(arg, "kbd-remap")
{ {
if (!copy_value(arg->Value, &settings->KeyboardRemappingList)) if (!freerdp_settings_set_string(settings, FreeRDP_KeyboardRemappingList, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "kbd-lang") CommandLineSwitchCase(arg, "kbd-lang")
@ -2019,12 +2020,12 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "d") CommandLineSwitchCase(arg, "d")
{ {
if (!copy_value(arg->Value, &settings->Domain)) if (!freerdp_settings_set_string(settings, FreeRDP_Domain, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "p") CommandLineSwitchCase(arg, "p")
{ {
if (!copy_value(arg->Value, &settings->Password)) if (!freerdp_settings_set_string(settings, FreeRDP_Password, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "g") CommandLineSwitchCase(arg, "g")
@ -2057,13 +2058,14 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
else else
{ {
if (!(settings->GatewayHostname = _strdup(arg->Value))) if (!freerdp_settings_set_string(settings, FreeRDP_GatewayHostname, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
} }
else else
{ {
if (!(settings->GatewayHostname = _strdup(settings->ServerHostname))) if (!freerdp_settings_set_string(settings, FreeRDP_GatewayHostname,
settings->ServerHostname))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
@ -2194,14 +2196,14 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "gd") CommandLineSwitchCase(arg, "gd")
{ {
if (!copy_value(arg->Value, &settings->GatewayDomain)) if (!freerdp_settings_set_string(settings, FreeRDP_GatewayDomain, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
settings->GatewayUseSameCredentials = FALSE; settings->GatewayUseSameCredentials = FALSE;
} }
CommandLineSwitchCase(arg, "gp") CommandLineSwitchCase(arg, "gp")
{ {
if (!copy_value(arg->Value, &settings->GatewayPassword)) if (!freerdp_settings_set_string(settings, FreeRDP_GatewayPassword, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
settings->GatewayUseSameCredentials = FALSE; settings->GatewayUseSameCredentials = FALSE;
@ -2240,7 +2242,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "gat") CommandLineSwitchCase(arg, "gat")
{ {
if (!copy_value(arg->Value, &settings->GatewayAccessToken)) if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAccessToken, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "gateway-usage-method") CommandLineSwitchCase(arg, "gateway-usage-method")
@ -2268,7 +2270,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "app") CommandLineSwitchCase(arg, "app")
{ {
if (!copy_value(arg->Value, &settings->RemoteApplicationProgram)) if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationProgram,
arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
settings->RemoteApplicationMode = TRUE; settings->RemoteApplicationMode = TRUE;
@ -2279,7 +2282,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "app-workdir") CommandLineSwitchCase(arg, "app-workdir")
{ {
if (!copy_value(arg->Value, &settings->RemoteApplicationWorkingDir)) if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationWorkingDir,
arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "load-balance-info") CommandLineSwitchCase(arg, "load-balance-info")
@ -2291,27 +2295,28 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "app-name") CommandLineSwitchCase(arg, "app-name")
{ {
if (!copy_value(arg->Value, &settings->RemoteApplicationName)) if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationName, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "app-icon") CommandLineSwitchCase(arg, "app-icon")
{ {
if (!copy_value(arg->Value, &settings->RemoteApplicationIcon)) if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationIcon, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "app-cmd") CommandLineSwitchCase(arg, "app-cmd")
{ {
if (!copy_value(arg->Value, &settings->RemoteApplicationCmdLine)) if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationCmdLine,
arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "app-file") CommandLineSwitchCase(arg, "app-file")
{ {
if (!copy_value(arg->Value, &settings->RemoteApplicationFile)) if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationFile, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "app-guid") CommandLineSwitchCase(arg, "app-guid")
{ {
if (!copy_value(arg->Value, &settings->RemoteApplicationGuid)) if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationGuid, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "compression") CommandLineSwitchCase(arg, "compression")
@ -2382,12 +2387,12 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "shell") CommandLineSwitchCase(arg, "shell")
{ {
if (!copy_value(arg->Value, &settings->AlternateShell)) if (!freerdp_settings_set_string(settings, FreeRDP_AlternateShell, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "shell-dir") CommandLineSwitchCase(arg, "shell-dir")
{ {
if (!copy_value(arg->Value, &settings->ShellWorkingDirectory)) if (!freerdp_settings_set_string(settings, FreeRDP_ShellWorkingDirectory, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "audio-mode") CommandLineSwitchCase(arg, "audio-mode")
@ -2692,7 +2697,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
{ {
settings->SendPreconnectionPdu = TRUE; settings->SendPreconnectionPdu = TRUE;
if (!copy_value(arg->Value, &settings->PreconnectionBlob)) if (!freerdp_settings_set_string(settings, FreeRDP_PreconnectionBlob, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "pcid") CommandLineSwitchCase(arg, "pcid")
@ -2818,25 +2823,25 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "tls-ciphers") CommandLineSwitchCase(arg, "tls-ciphers")
{ {
const char* ciphers = NULL;
if (!arg->Value) if (!arg->Value)
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
free(settings->AllowedTlsCiphers);
if (strcmp(arg->Value, "netmon") == 0) if (strcmp(arg->Value, "netmon") == 0)
{ {
if (!(settings->AllowedTlsCiphers = _strdup("ALL:!ECDH"))) ciphers = "ALL:!ECDH";
return COMMAND_LINE_ERROR_MEMORY;
} }
else if (strcmp(arg->Value, "ma") == 0) else if (strcmp(arg->Value, "ma") == 0)
{ {
if (!(settings->AllowedTlsCiphers = _strdup("AES128-SHA"))) ciphers = "AES128-SHA";
return COMMAND_LINE_ERROR_MEMORY;
} }
else else
{ {
if (!(settings->AllowedTlsCiphers = _strdup(arg->Value))) ciphers = arg->Value;
return COMMAND_LINE_ERROR_MEMORY;
} }
if (!freerdp_settings_set_string(settings, FreeRDP_AllowedTlsCiphers, ciphers))
return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "tls-seclevel") CommandLineSwitchCase(arg, "tls-seclevel")
{ {
@ -2875,7 +2880,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
else if (_strnicmp(name, cur, sizeof(name)) == 0) else if (_strnicmp(name, cur, sizeof(name)) == 0)
{ {
const char* val = &cur[sizeof(name)]; const char* val = &cur[sizeof(name)];
if (!copy_value(val, &settings->CertificateName)) if (!freerdp_settings_set_string(settings, FreeRDP_CertificateName, val))
rc = COMMAND_LINE_ERROR_MEMORY; rc = COMMAND_LINE_ERROR_MEMORY;
} }
else if (_strnicmp(fingerprints, cur, sizeof(fingerprints)) == 0) else if (_strnicmp(fingerprints, cur, sizeof(fingerprints)) == 0)
@ -2894,7 +2899,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "cert-name") CommandLineSwitchCase(arg, "cert-name")
{ {
if (!copy_value(arg->Value, &settings->CertificateName)) if (!freerdp_settings_set_string(settings, FreeRDP_CertificateName, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "cert-ignore") CommandLineSwitchCase(arg, "cert-ignore")
@ -3106,12 +3111,12 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "wm-class") CommandLineSwitchCase(arg, "wm-class")
{ {
if (!copy_value(arg->Value, &settings->WmClass)) if (!freerdp_settings_set_string(settings, FreeRDP_WmClass, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "play-rfx") CommandLineSwitchCase(arg, "play-rfx")
{ {
if (!copy_value(arg->Value, &settings->PlayRemoteFxFile)) if (!freerdp_settings_set_string(settings, FreeRDP_PlayRemoteFxFile, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
settings->PlayRemoteFx = TRUE; settings->PlayRemoteFx = TRUE;
@ -3238,14 +3243,12 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
} }
CommandLineSwitchCase(arg, "action-script") CommandLineSwitchCase(arg, "action-script")
{ {
if (!copy_value(arg->Value, &settings->ActionScript)) if (!freerdp_settings_set_string(settings, FreeRDP_ActionScript, arg->Value))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, RDP2TCP_DVC_CHANNEL_NAME) CommandLineSwitchCase(arg, RDP2TCP_DVC_CHANNEL_NAME)
{ {
free(settings->RDP2TCPArgs); if (!freerdp_settings_set_string(settings, FreeRDP_RDP2TCPArgs, arg->Value))
if (!(settings->RDP2TCPArgs = _strdup(arg->Value)))
return COMMAND_LINE_ERROR_MEMORY; return COMMAND_LINE_ERROR_MEMORY;
} }
CommandLineSwitchCase(arg, "fipsmode") CommandLineSwitchCase(arg, "fipsmode")

View File

@ -54,9 +54,9 @@ static BOOL ios_ui_authenticate_raw(freerdp *instance, char **username, char **p
free(*password); free(*password);
free(*domain); free(*domain);
// set values back // set values back
*username = strdup([[params objectForKey:@"username"] UTF8String]); *username = _strdup([[params objectForKey:@"username"] UTF8String]);
*password = strdup([[params objectForKey:@"password"] UTF8String]); *password = _strdup([[params objectForKey:@"password"] UTF8String]);
*domain = strdup([[params objectForKey:@"domain"] UTF8String]); *domain = _strdup([[params objectForKey:@"domain"] UTF8String]);
if (!(*username) || !(*password) || !(*domain)) if (!(*username) || !(*password) || !(*domain))
{ {

View File

@ -493,10 +493,8 @@ static BOOL rdp_client_redirect_try_fqdn(rdpSettings* settings)
if (settings->GatewayEnabled || if (settings->GatewayEnabled ||
rdp_client_redirect_resolvable(settings->RedirectionTargetFQDN)) rdp_client_redirect_resolvable(settings->RedirectionTargetFQDN))
{ {
free(settings->ServerHostname); if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname,
settings->ServerHostname = _strdup(settings->RedirectionTargetFQDN); settings->RedirectionTargetFQDN))
if (!settings->ServerHostname)
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -510,10 +508,8 @@ static BOOL rdp_client_redirect_try_ip(rdpSettings* settings)
{ {
if (settings->RedirectionFlags & LB_TARGET_NET_ADDRESS) if (settings->RedirectionFlags & LB_TARGET_NET_ADDRESS)
{ {
free(settings->ServerHostname); if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname,
settings->ServerHostname = _strdup(settings->TargetNetAddress); settings->TargetNetAddress))
if (!settings->ServerHostname)
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -529,10 +525,8 @@ static BOOL rdp_client_redirect_try_netbios(rdpSettings* settings)
if (settings->GatewayEnabled || if (settings->GatewayEnabled ||
rdp_client_redirect_resolvable(settings->RedirectionTargetNetBiosName)) rdp_client_redirect_resolvable(settings->RedirectionTargetNetBiosName))
{ {
free(settings->ServerHostname); if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname,
settings->ServerHostname = _strdup(settings->RedirectionTargetNetBiosName); settings->RedirectionTargetNetBiosName))
if (!settings->ServerHostname)
return FALSE; return FALSE;
return TRUE; return TRUE;

View File

@ -333,8 +333,8 @@ static void* mf_peer_main_loop(void* arg)
} }
/* Initialize the real server settings here */ /* Initialize the real server settings here */
client->settings->CertificateFile = _strdup("server.crt"); freerdp_settings_set_string(client->settings, FreeRDP_CertificateFile, "server.crt");
client->settings->PrivateKeyFile = _strdup("server.key"); freerdp_settings_set_string(client->settings, FreeRDP_PrivateKeyFile, "server.key");
if (!client->settings->CertificateFile || !client->settings->PrivateKeyFile) if (!client->settings->CertificateFile || !client->settings->PrivateKeyFile)
{ {

View File

@ -211,18 +211,14 @@ static BOOL wf_peer_read_settings(freerdp_peer* client)
if (!wf_settings_read_string_ascii(HKEY_LOCAL_MACHINE, SERVER_KEY, _T("CertificateFile"), if (!wf_settings_read_string_ascii(HKEY_LOCAL_MACHINE, SERVER_KEY, _T("CertificateFile"),
&(client->settings->CertificateFile))) &(client->settings->CertificateFile)))
{ {
client->settings->CertificateFile = _strdup("server.crt"); if (!freerdp_settings_set_string(client->settings, FreeRDP_CertificateFile, "server.crt"))
if (!client->settings->CertificateFile)
return FALSE; return FALSE;
} }
if (!wf_settings_read_string_ascii(HKEY_LOCAL_MACHINE, SERVER_KEY, _T("PrivateKeyFile"), if (!wf_settings_read_string_ascii(HKEY_LOCAL_MACHINE, SERVER_KEY, _T("PrivateKeyFile"),
&(client->settings->PrivateKeyFile))) &(client->settings->PrivateKeyFile)))
{ {
client->settings->PrivateKeyFile = _strdup("server.key"); if (!freerdp_settings_set_string(client->settings, FreeRDP_PrivateKeyFile, "server.key"))
if (!client->settings->PrivateKeyFile)
return FALSE; return FALSE;
} }

View File

@ -159,8 +159,7 @@ static BOOL pf_server_get_target_info(rdpContext* context, rdpSettings* settings
return FALSE; return FALSE;
} }
settings->ServerHostname = _strdup(ev.target_address); if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname, ev.target_address))
if (!settings->ServerHostname)
{ {
PROXY_LOG_ERR(TAG, ps, "strdup failed!"); PROXY_LOG_ERR(TAG, ps, "strdup failed!");
return FALSE; return FALSE;