Merge pull request #1147 from metalefty/defaultwm-fullpath
Accept full path for DefaultWindowManager
This commit is contained in:
commit
dbee05d9ed
@ -17,7 +17,8 @@ SUBST_VARS = sed \
|
|||||||
-e 's|@bindir[@]|$(bindir)|g' \
|
-e 's|@bindir[@]|$(bindir)|g' \
|
||||||
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
-e 's|@socketdir[@]|$(socketdir)|g'
|
-e 's|@socketdir[@]|$(socketdir)|g' \
|
||||||
|
-e 's|@xrdpconfdir[@]|$(sysconfdir)/xrdp|g'
|
||||||
|
|
||||||
subst_verbose = $(subst_verbose_@AM_V@)
|
subst_verbose = $(subst_verbose_@AM_V@)
|
||||||
subst_verbose_ = $(subst_verbose_@AM_DEFAULT_V@)
|
subst_verbose_ = $(subst_verbose_@AM_DEFAULT_V@)
|
||||||
|
@ -62,14 +62,23 @@ specified by \fBUserWindowManager\fR if it exists.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBUserWindowManager\fR=\fIfilename\fR
|
\fBUserWindowManager\fR=\fIfilename\fR
|
||||||
Name of the startup script relative to the user's home directory. If
|
Path of the startup script relative to the user's home directory. If
|
||||||
present and enabled by \fBEnableUserWindowManager\fR, that script is
|
present and enabled by \fBEnableUserWindowManager\fR, that script is
|
||||||
executed instead of \fBDefaultWindowManager\fR.
|
executed instead of \fBDefaultWindowManager\fR.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBDefaultWindowManager\fR=\fIfilename\fR
|
\fBDefaultWindowManager\fR=\fIfilename\fR
|
||||||
Full path to the default startup script used by xrdp-sesman to start a
|
Full path or relative path of the default startup script used by xrdp-sesman
|
||||||
session if the user script is disabled or missing.
|
to start a session. If the path is not a full path, it will be resolved as
|
||||||
|
relative path to \fI@xrdpconfdir@\fR. If not specified, defaults to
|
||||||
|
\fI@xrdpconfdir@/startwm.sh\fR.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBReconnectScript\fR=\fIfilename\fR
|
||||||
|
Full path or relative path if the script which executed when users reconnects
|
||||||
|
to the existing session. If the path is not a full path, it will be resolved as
|
||||||
|
relative path to \fI@xrdpconfdir@\fR. If not specified, defaults to
|
||||||
|
\fI@xrdpconfdir@/reconnectwm.sh\fR.
|
||||||
|
|
||||||
.SH "LOGGING"
|
.SH "LOGGING"
|
||||||
Following parameters can be used in the \fB[Logging]\fR section.
|
Following parameters can be used in the \fB[Logging]\fR section.
|
||||||
|
@ -105,6 +105,7 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
|
|||||||
struct list *param_v)
|
struct list *param_v)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int length;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
list_clear(param_v);
|
list_clear(param_v);
|
||||||
@ -115,8 +116,9 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
|
|||||||
cf->listen_port[0] = '\0';
|
cf->listen_port[0] = '\0';
|
||||||
cf->enable_user_wm = 0;
|
cf->enable_user_wm = 0;
|
||||||
cf->user_wm[0] = '\0';
|
cf->user_wm[0] = '\0';
|
||||||
cf->default_wm[0] = '\0';
|
cf->default_wm = 0;
|
||||||
cf->auth_file_path = 0;
|
cf->auth_file_path = 0;
|
||||||
|
cf->reconnect_sh = 0;
|
||||||
|
|
||||||
file_read_section(file, SESMAN_CFG_GLOBALS, param_n, param_v);
|
file_read_section(file, SESMAN_CFG_GLOBALS, param_n, param_v);
|
||||||
|
|
||||||
@ -126,7 +128,7 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
|
|||||||
|
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_DEFWM))
|
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))
|
else if (0 == g_strcasecmp(buf, SESMAN_CFG_USERWM))
|
||||||
{
|
{
|
||||||
@ -148,6 +150,10 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
|
|||||||
{
|
{
|
||||||
cf->auth_file_path = g_strdup((char *)list_get_item(param_v, i));
|
cf->auth_file_path = g_strdup((char *)list_get_item(param_v, i));
|
||||||
}
|
}
|
||||||
|
else if (g_strcasecmp(buf, SESMAN_CFG_RECONNECT_SH) == 0)
|
||||||
|
{
|
||||||
|
cf->reconnect_sh = g_strdup((char *)list_get_item(param_v, i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* checking for missing required parameters */
|
/* checking for missing required parameters */
|
||||||
@ -166,9 +172,46 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
|
|||||||
cf->enable_user_wm = 0;
|
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 to XRDP_CFG_PATH */
|
||||||
|
if (cf->default_wm[0] != '/')
|
||||||
|
{
|
||||||
|
/* sizeof operator returns string length including null terminator */
|
||||||
|
length = sizeof(XRDP_CFG_PATH) + g_strlen(g_cfg->default_wm) + 1; /* '/' */
|
||||||
|
buf = (char *)g_malloc(length, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cf->reconnect_sh == 0)
|
||||||
|
{
|
||||||
|
cf->reconnect_sh = g_strdup("reconnectwm.sh");
|
||||||
|
}
|
||||||
|
else if (g_strlen(cf->reconnect_sh) == 0)
|
||||||
|
{
|
||||||
|
g_free(cf->reconnect_sh);
|
||||||
|
cf->reconnect_sh = g_strdup("reconnectwm.sh");
|
||||||
|
}
|
||||||
|
/* if reconnect_sh doesn't begin with '/', it's a relative path to XRDP_CFG_PATH */
|
||||||
|
if (cf->reconnect_sh[0] != '/')
|
||||||
|
{
|
||||||
|
/* sizeof operator returns string length including null terminator */
|
||||||
|
length = sizeof(XRDP_CFG_PATH) + g_strlen(g_cfg->reconnect_sh) + 1; /* '/' */
|
||||||
|
buf = (char *)g_malloc(length, 0);
|
||||||
|
g_sprintf(buf, "%s/%s", XRDP_CFG_PATH, g_cfg->reconnect_sh);
|
||||||
|
g_free(g_cfg->reconnect_sh);
|
||||||
|
g_cfg->reconnect_sh = g_strdup(buf);
|
||||||
|
g_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -436,6 +479,7 @@ config_dump(struct config_sesman *config)
|
|||||||
g_writeln(" EnableUserWindowManager: %d", config->enable_user_wm);
|
g_writeln(" EnableUserWindowManager: %d", config->enable_user_wm);
|
||||||
g_writeln(" UserWindowManager: %s", config->user_wm);
|
g_writeln(" UserWindowManager: %s", config->user_wm);
|
||||||
g_writeln(" DefaultWindowManager: %s", config->default_wm);
|
g_writeln(" DefaultWindowManager: %s", config->default_wm);
|
||||||
|
g_writeln(" ReconnectScript: %s", config->reconnect_sh);
|
||||||
g_writeln(" AuthFilePath: %s",
|
g_writeln(" AuthFilePath: %s",
|
||||||
((config->auth_file_path) ? (config->auth_file_path) : ("disabled")));
|
((config->auth_file_path) ? (config->auth_file_path) : ("disabled")));
|
||||||
|
|
||||||
@ -530,6 +574,8 @@ config_dump(struct config_sesman *config)
|
|||||||
void
|
void
|
||||||
config_free(struct config_sesman *cs)
|
config_free(struct config_sesman *cs)
|
||||||
{
|
{
|
||||||
|
g_free(cs->default_wm);
|
||||||
|
g_free(cs->reconnect_sh);
|
||||||
g_free(cs->auth_file_path);
|
g_free(cs->auth_file_path);
|
||||||
list_delete(cs->rdp_params);
|
list_delete(cs->rdp_params);
|
||||||
list_delete(cs->vnc_params);
|
list_delete(cs->vnc_params);
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#define SESMAN_CFG_USERWM "UserWindowManager"
|
#define SESMAN_CFG_USERWM "UserWindowManager"
|
||||||
#define SESMAN_CFG_MAX_SESSION "MaxSessions"
|
#define SESMAN_CFG_MAX_SESSION "MaxSessions"
|
||||||
#define SESMAN_CFG_AUTH_FILE_PATH "AuthFilePath"
|
#define SESMAN_CFG_AUTH_FILE_PATH "AuthFilePath"
|
||||||
|
#define SESMAN_CFG_RECONNECT_SH "ReconnectScript"
|
||||||
|
|
||||||
#define SESMAN_CFG_RDP_PARAMS "X11rdp"
|
#define SESMAN_CFG_RDP_PARAMS "X11rdp"
|
||||||
#define SESMAN_CFG_XORG_PARAMS "Xorg"
|
#define SESMAN_CFG_XORG_PARAMS "Xorg"
|
||||||
@ -198,12 +199,17 @@ struct config_sesman
|
|||||||
* @var default_wm
|
* @var default_wm
|
||||||
* @brief Default window manager
|
* @brief Default window manager
|
||||||
*/
|
*/
|
||||||
char default_wm[32];
|
char *default_wm;
|
||||||
/**
|
/**
|
||||||
* @var user_wm
|
* @var user_wm
|
||||||
* @brief Default window manager
|
* @brief Default window manager
|
||||||
*/
|
*/
|
||||||
char user_wm[32];
|
char user_wm[32];
|
||||||
|
/**
|
||||||
|
* @var reconnect_sh
|
||||||
|
* @brief Script executed when reconnected
|
||||||
|
*/
|
||||||
|
char *reconnect_sh;
|
||||||
/**
|
/**
|
||||||
* @var auth_file_path
|
* @var auth_file_path
|
||||||
* @brief Auth file path
|
* @brief Auth file path
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
|
;; See `man 5 sesman.ini` for details
|
||||||
|
|
||||||
[Globals]
|
[Globals]
|
||||||
ListenAddress=127.0.0.1
|
ListenAddress=127.0.0.1
|
||||||
ListenPort=3350
|
ListenPort=3350
|
||||||
EnableUserWindowManager=true
|
EnableUserWindowManager=true
|
||||||
|
; Give in relative path to user's home directory
|
||||||
UserWindowManager=startwm.sh
|
UserWindowManager=startwm.sh
|
||||||
|
; Give in full path or relative path to @sesmansysconfdir@
|
||||||
DefaultWindowManager=startwm.sh
|
DefaultWindowManager=startwm.sh
|
||||||
|
; Give in full path or relative path to @sesmansysconfdir@
|
||||||
|
ReconnectScript=reconnectwm.sh
|
||||||
|
|
||||||
[Security]
|
[Security]
|
||||||
AllowRootLogin=true
|
AllowRootLogin=true
|
||||||
|
@ -575,8 +575,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
|
|||||||
}
|
}
|
||||||
/* if we're here something happened to g_execlp3
|
/* if we're here something happened to g_execlp3
|
||||||
so we try running the default window manager */
|
so we try running the default window manager */
|
||||||
g_sprintf(text, "%s/%s", XRDP_CFG_PATH, g_cfg->default_wm);
|
g_execlp3(g_cfg->default_wm, g_cfg->default_wm, 0);
|
||||||
g_execlp3(text, g_cfg->default_wm, 0);
|
|
||||||
|
|
||||||
log_message(LOG_LEVEL_ALWAYS, "error starting default "
|
log_message(LOG_LEVEL_ALWAYS, "error starting default "
|
||||||
"wm for user %s - pid %d", s->username, g_getpid());
|
"wm for user %s - pid %d", s->username, g_getpid());
|
||||||
@ -585,7 +584,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
|
|||||||
"%s", g_get_errno(), g_get_strerror());
|
"%s", g_get_errno(), g_get_strerror());
|
||||||
log_message(LOG_LEVEL_DEBUG, "execlp3 parameter list:");
|
log_message(LOG_LEVEL_DEBUG, "execlp3 parameter list:");
|
||||||
log_message(LOG_LEVEL_DEBUG, " argv[0] = %s",
|
log_message(LOG_LEVEL_DEBUG, " argv[0] = %s",
|
||||||
text);
|
g_cfg->default_wm);
|
||||||
log_message(LOG_LEVEL_DEBUG, " argv[1] = %s",
|
log_message(LOG_LEVEL_DEBUG, " argv[1] = %s",
|
||||||
g_cfg->default_wm);
|
g_cfg->default_wm);
|
||||||
|
|
||||||
@ -863,7 +862,6 @@ static int
|
|||||||
session_reconnect_fork(int display, char *username, long data)
|
session_reconnect_fork(int display, char *username, long data)
|
||||||
{
|
{
|
||||||
int pid;
|
int pid;
|
||||||
char text[256];
|
|
||||||
|
|
||||||
pid = g_fork();
|
pid = g_fork();
|
||||||
|
|
||||||
@ -878,11 +876,10 @@ session_reconnect_fork(int display, char *username, long data)
|
|||||||
g_cfg->env_names,
|
g_cfg->env_names,
|
||||||
g_cfg->env_values);
|
g_cfg->env_values);
|
||||||
auth_set_env(data);
|
auth_set_env(data);
|
||||||
g_snprintf(text, 255, "%s/%s", XRDP_CFG_PATH, "reconnectwm.sh");
|
|
||||||
|
|
||||||
if (g_file_exist(text))
|
if (g_file_exist(g_cfg->reconnect_sh))
|
||||||
{
|
{
|
||||||
g_execlp3(text, g_cfg->default_wm, 0);
|
g_execlp3(g_cfg->reconnect_sh, g_cfg->reconnect_sh, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_exit(0);
|
g_exit(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user