@@ -135,8 +135,8 @@ index 8fa34aea..da94cf95 100644
135135- LOG(LOG_LEVEL_DEBUG, "keyboard_cfg_file %s", keyboard_cfg_file);
136136+ LOG(LOG_LEVEL_DEBUG, "keyboard_cfg_file %s", client_info->xrdp_keyboard_ini_file);
137137
138- - fd = g_file_open (keyboard_cfg_file);
139- + fd = g_file_open (client_info->xrdp_keyboard_ini_file);
138+ - fd = g_file_open_ro (keyboard_cfg_file);
139+ + fd = g_file_open_ro (client_info->xrdp_keyboard_ini_file);
140140
141141 if (fd >= 0)
142142 {
@@ -179,19 +179,19 @@ index 8fa34aea..da94cf95 100644
179179 list_delete(items);
180180 list_delete(values);
181181 return 1;
182- diff --git a/sesman/config .c b/sesman/config .c
182+ diff --git a/sesman/libsesman/sesman_config .c b/sesman/libsesman/sesman_config .c
183183index 61e9e403..0466f61a 100644
184- --- a/sesman/config.c
185- +++ b/sesman/config.c
186- @@ -34,6 +34,7 @@
187- #include "sesman.h"
184+ --- a/sesman/libsesman/sesman_config.c
185+ +++ b/sesman/libsesman/sesman_config.c
186+ @@ -37,6 +37,7 @@
188187 #include "log.h"
188+ #include "os_calls.h"
189189 #include "string_calls.h"
190190+ #include <string.h>
191- #include "chansrv/chansrv_common.h"
192-
193- /***************************************************************************//**
194- @@ -47,11 +48,10 @@
191+ // #include "chansrv/chansrv_common.h"
192+ #include "scp.h"
193+
194+ @@ -171,7 +172,7 @@ config_output_policy_string(unsigned int value,
195195 *
196196 */
197197 static int
@@ -200,61 +200,57 @@ index 61e9e403..0466f61a 100644
200200 struct list *param_v)
201201 {
202202 int i;
203- - int length;
204- char *buf;
205-
206- list_clear(param_v);
207- @@ -127,13 +127,12 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
208- g_free(cf->default_wm);
203+ @@ -249,14 +250,12 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
209204 cf->default_wm = g_strdup("startwm.sh");
210205 }
211- - /* if default_wm doesn't begin with '/', it's a relative path to XRDP_CFG_PATH */
212- + /* if default_wm doesn't begin with '/', it's a relative path to base_dir */
206+ /* if default_wm doesn't begin with '/', it's a relative path to
207+ - * XRDP_CFG_PATH */
208+ + * base_dir */
213209 if (cf->default_wm[0] != '/')
214210 {
215211 /* sizeof operator returns string length including null terminator */
216- - length = sizeof(XRDP_CFG_PATH) + g_strlen(cf->default_wm) + 1; /* '/' */
217- - buf = (char *)g_malloc(length, 0);
212+ - int length = (sizeof(XRDP_CFG_PATH) +
213+ - g_strlen(cf->default_wm) + 1); /* '/' */
214+ - char *buf = (char *)g_malloc(length, 0);
218215- g_sprintf(buf, "%s/%s", XRDP_CFG_PATH, cf->default_wm);
219- + buf = (char *)g_malloc(g_strlen(base_dir) + 1 + g_strlen(cf->default_wm) + 1, 0);
216+ + char * buf = (char *)g_malloc(g_strlen(base_dir) + 1 + g_strlen(cf->default_wm) + 1, 0);
220217+ g_sprintf(buf, "%s/%s", base_dir, cf->default_wm);
221218 g_free(cf->default_wm);
222- cf->default_wm = g_strdup(buf);
223- g_free(buf);
224- @@ -151,10 +150,8 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
225- /* if reconnect_sh doesn't begin with '/', it's a relative path to XRDP_CFG_PATH */
219+ cf->default_wm = buf;
220+ }
221+ @@ -271,10 +270,8 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
226222 if (cf->reconnect_sh[0] != '/')
227223 {
228- - /* sizeof operator returns string length including null terminator */
229- - length = sizeof(XRDP_CFG_PATH) + g_strlen(cf->reconnect_sh) + 1; /* '/' */
230- - buf = (char *)g_malloc(length, 0);
224+ /* sizeof operator returns string length including null terminator */
225+ - int length = (sizeof(XRDP_CFG_PATH) +
226+ - g_strlen(cf->reconnect_sh) + 1); /* '/' */
227+ - char *buf = (char *)g_malloc(length, 0);
231228- g_sprintf(buf, "%s/%s", XRDP_CFG_PATH, cf->reconnect_sh);
232- + buf = (char *)g_malloc(g_strlen(base_dir) + 1 + g_strlen(cf->reconnect_sh) + 1, 0);
233- + g_sprintf(buf, "%s/%s", base_dir, cf->reconnect_sh);
229+ + char * buf = (char *)g_malloc(g_strlen(base_dir) + 1 + g_strlen(cf->reconnect_sh) + 1, 0);
230+ + g_sprintf(buf, "%s/%s", base_dir, cf->reconnect_sh);
234231 g_free(cf->reconnect_sh);
235- cf->reconnect_sh = g_strdup( buf) ;
236- g_free(buf);
237- @@ -511 ,6 +508 ,7 @@ struct config_sesman *
232+ cf->reconnect_sh = buf;
233+ }
234+ @@ -580 ,6 +577 ,7 @@ struct config_sesman *
238235 config_read(const char *sesman_ini)
239236 {
240237 struct config_sesman *cfg;
241238+ char cfg_dir[256];
242239 int all_ok = 0;
243-
240+
244241 if ((cfg = g_new0(struct config_sesman, 1)) != NULL)
245- @@ -532,8 +530 ,10 @@ config_read(const char *sesman_ini)
246- param_v->auto_free = 1;
247-
242+ @@ -602,7 +600 ,10 @@ config_read(const char *sesman_ini)
243+ all_ok = 1;
244+
248245 /* read global config */
249246- config_read_globals(fd, cfg, param_n, param_v);
250- -
251247+ g_strcpy(cfg_dir, sesman_ini);
252248+ *(strrchr(cfg_dir, '/')) = 0; // cfg_file validated to contain '/'
253- +
249+ +
254250+ config_read_globals(cfg_dir, fd, cfg, param_n, param_v);
255- /* read Xvnc/X11rdp/Xorg parameter list */
251+
252+ /* read Xvnc/Xorg parameter list */
256253 config_read_vnc_params(fd, cfg, param_n, param_v);
257- config_read_rdp_params(fd, cfg, param_n, param_v);
258254diff --git a/xrdp/lang.c b/xrdp/lang.c
259255index e4c18077..06f92997 100644
260256--- a/xrdp/lang.c
0 commit comments