mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Merge pull request #3210 from hardening/env_fix
Don't require HOME env var to be set for server-side code
This commit is contained in:
@@ -493,40 +493,46 @@ rdpSettings* freerdp_settings_new(DWORD flags)
|
||||
if(!settings->DynamicChannelArray)
|
||||
goto out_fail;
|
||||
|
||||
settings->HomePath = GetKnownPath(KNOWN_PATH_HOME);
|
||||
if (!settings->HomePath)
|
||||
goto out_fail;
|
||||
|
||||
/* For default FreeRDP continue using same config directory
|
||||
* as in old releases.
|
||||
* Custom builds use <Vendor>/<Product> as config folder. */
|
||||
if (_stricmp(FREERDP_VENDOR_STRING, FREERDP_PRODUCT_STRING))
|
||||
if (!settings->ServerMode)
|
||||
{
|
||||
base = GetKnownSubPath(KNOWN_PATH_XDG_CONFIG_HOME,
|
||||
FREERDP_VENDOR_STRING);
|
||||
if (base)
|
||||
/* these values are used only by the client part */
|
||||
|
||||
settings->HomePath = GetKnownPath(KNOWN_PATH_HOME);
|
||||
if (!settings->HomePath)
|
||||
goto out_fail;
|
||||
|
||||
/* For default FreeRDP continue using same config directory
|
||||
* as in old releases.
|
||||
* Custom builds use <Vendor>/<Product> as config folder. */
|
||||
if (_stricmp(FREERDP_VENDOR_STRING, FREERDP_PRODUCT_STRING))
|
||||
{
|
||||
settings->ConfigPath = GetCombinedPath(
|
||||
base,
|
||||
FREERDP_PRODUCT_STRING);
|
||||
base = GetKnownSubPath(KNOWN_PATH_XDG_CONFIG_HOME,
|
||||
FREERDP_VENDOR_STRING);
|
||||
if (base)
|
||||
{
|
||||
settings->ConfigPath = GetCombinedPath(
|
||||
base,
|
||||
FREERDP_PRODUCT_STRING);
|
||||
}
|
||||
free (base);
|
||||
} else {
|
||||
int i;
|
||||
char product[sizeof(FREERDP_PRODUCT_STRING)];
|
||||
|
||||
memset(product, 0, sizeof(product));
|
||||
for (i=0; i<sizeof(product); i++)
|
||||
product[i] = tolower(FREERDP_PRODUCT_STRING[i]);
|
||||
|
||||
settings->ConfigPath = GetKnownSubPath(
|
||||
KNOWN_PATH_XDG_CONFIG_HOME,
|
||||
product);
|
||||
}
|
||||
free (base);
|
||||
} else {
|
||||
int i;
|
||||
char product[sizeof(FREERDP_PRODUCT_STRING)];
|
||||
|
||||
memset(product, 0, sizeof(product));
|
||||
for (i=0; i<sizeof(product); i++)
|
||||
product[i] = tolower(FREERDP_PRODUCT_STRING[i]);
|
||||
|
||||
settings->ConfigPath = GetKnownSubPath(
|
||||
KNOWN_PATH_XDG_CONFIG_HOME,
|
||||
product);
|
||||
if (!settings->ConfigPath)
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
if (!settings->ConfigPath)
|
||||
goto out_fail;
|
||||
|
||||
settings_load_hkey_local_machine(settings);
|
||||
|
||||
settings->SettingsModified = (BYTE*) calloc(1, sizeof(rdpSettings) / 8 );
|
||||
|
||||
Reference in New Issue
Block a user