From b3c04783050c3f5d2c45c68e5d348691b5ccfd39 Mon Sep 17 00:00:00 2001 From: David FORT Date: Wed, 9 Mar 2016 14:10:31 +0100 Subject: [PATCH] Don't require HOME env var to be set for server-side code --- libfreerdp/core/settings.c | 62 +++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index 1002d17..28ed134 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -493,39 +493,45 @@ 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 / 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 / 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; iConfigPath = 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; iConfigPath = 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); -- 2.7.4