mirror of https://github.com/neutrinolabs/xrdp
sesman: accept full path for DefaultWindowManager
Solves: #1143 Also, this idea is inspired by Fedora's patch [1]. Some distro wants to put all scripts in libexec directory due to SELinux. This enables distros to put such scripts anywhere. [1] https://src.fedoraproject.org/cgit/rpms/xrdp.git/tree/xrdp-0.9.6-scripts-libexec.patch?id=02f845c1b8cea781313cf3e9efcd6d7d50341824
This commit is contained in:
parent
036c292120
commit
e82f212f34
|
@ -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);
|
||||
|
|
|
@ -198,7 +198,7 @@ struct config_sesman
|
|||
* @var default_wm
|
||||
* @brief Default window manager
|
||||
*/
|
||||
char default_wm[32];
|
||||
char *default_wm;
|
||||
/**
|
||||
* @var user_wm
|
||||
* @brief Default window manager
|
||||
|
|
|
@ -575,8 +575,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
|
|||
}
|
||||
/* if we're here something happened to g_execlp3
|
||||
so we try running the default window manager */
|
||||
g_sprintf(text, "%s/%s", XRDP_CFG_PATH, g_cfg->default_wm);
|
||||
g_execlp3(text, g_cfg->default_wm, 0);
|
||||
g_execlp3(g_cfg->default_wm, g_cfg->default_wm, 0);
|
||||
|
||||
log_message(LOG_LEVEL_ALWAYS, "error starting default "
|
||||
"wm for user %s - pid %d", s->username, g_getpid());
|
||||
|
|
Loading…
Reference in New Issue