diff options
Diffstat (limited to 'sesman/config.c')
-rw-r--r-- | sesman/config.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/sesman/config.c b/sesman/config.c index 8e5b096d..0fa8c86b 100644 --- a/sesman/config.c +++ b/sesman/config.c @@ -115,7 +115,7 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n, cf->listen_port[0] = '\0'; cf->enable_user_wm = 0; cf->user_wm[0] = '\0'; - cf->default_wm[0] = '\0'; + cf->default_wm = 0; cf->auth_file_path = 0; file_read_section(file, SESMAN_CFG_GLOBALS, param_n, param_v); @@ -126,7 +126,7 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n, if (0 == g_strcasecmp(buf, SESMAN_CFG_DEFWM)) { - g_strncpy(cf->default_wm, (char *)list_get_item(param_v, i), 31); + cf->default_wm = g_strdup((char *)list_get_item(param_v, i)); } else if (0 == g_strcasecmp(buf, SESMAN_CFG_USERWM)) { @@ -166,9 +166,24 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n, cf->enable_user_wm = 0; } - if ('\0' == cf->default_wm[0]) + if (cf->default_wm == 0) { - g_strncpy(cf->default_wm, "startwm.sh", 11); + cf->default_wm = g_strdup("startwm.sh"); + } + else if (g_strlen(cf->default_wm) == 0) + { + g_free(cf->default_wm); + cf->default_wm = g_strdup("startwm.sh"); + } + + /* if default_wm doesn't begin with '/', it's a relative path from XRDP_CFG_PATH */ + if (cf->default_wm[0] != '/') + { + buf = (char *)g_malloc(1024, 0); + g_sprintf(buf, "%s/%s", XRDP_CFG_PATH, g_cfg->default_wm); + g_free(g_cfg->default_wm); + g_cfg->default_wm = g_strdup(buf); + g_free(buf); } return 0; @@ -530,6 +545,7 @@ config_dump(struct config_sesman *config) void config_free(struct config_sesman *cs) { + g_free(cs->default_wm); g_free(cs->auth_file_path); list_delete(cs->rdp_params); list_delete(cs->vnc_params); |