Add AlwaysRunReconnect config option
This allows the system administrator to specify whether the reconnectwm.sh script should only be run on reconnects, or should be run for all connections to a session.
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
#define SESMAN_CFG_USERWM "UserWindowManager"
|
||||
#define SESMAN_CFG_AUTH_FILE_PATH "AuthFilePath"
|
||||
#define SESMAN_CFG_RECONNECT_SH "ReconnectScript"
|
||||
#define SESMAN_CFG_ALWAYS_RUN_RECONNECT "AlwaysRunReconnect"
|
||||
|
||||
#define SESMAN_CFG_XORG_PARAMS "Xorg"
|
||||
#define SESMAN_CFG_VNC_PARAMS "Xvnc"
|
||||
@@ -188,6 +189,7 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
|
||||
cf->default_wm = 0;
|
||||
cf->auth_file_path = 0;
|
||||
cf->reconnect_sh = 0;
|
||||
cf->always_run_reconnect = 0;
|
||||
|
||||
file_read_section(file, SESMAN_CFG_GLOBALS, param_n, param_v);
|
||||
|
||||
@@ -222,6 +224,10 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
|
||||
{
|
||||
cf->reconnect_sh = g_strdup(val);
|
||||
}
|
||||
else if (g_strcasecmp(param, SESMAN_CFG_ALWAYS_RUN_RECONNECT) == 0)
|
||||
{
|
||||
cf->always_run_reconnect = g_text2bool(val);
|
||||
}
|
||||
else if (0 == g_strcasecmp(param, SESMAN_CFG_ADDRESS))
|
||||
{
|
||||
/* Config must be updated for Unix Domain Sockets */
|
||||
@@ -676,6 +682,7 @@ config_dump(struct config_sesman *config)
|
||||
g_writeln(" UserWindowManager: %s", config->user_wm);
|
||||
g_writeln(" DefaultWindowManager: %s", config->default_wm);
|
||||
g_writeln(" ReconnectScript: %s", config->reconnect_sh);
|
||||
g_writeln(" AlwaysRunReconnect: %d", config->always_run_reconnect);
|
||||
g_writeln(" AuthFilePath: %s",
|
||||
(config->auth_file_path ? config->auth_file_path : "disabled"));
|
||||
|
||||
|
||||
@@ -219,6 +219,11 @@ struct config_sesman
|
||||
* @brief Script executed when reconnected
|
||||
*/
|
||||
char *reconnect_sh;
|
||||
/**
|
||||
* @var always_run_reconnect
|
||||
* @brief Do we run the reconnect script on a first connection?
|
||||
*/
|
||||
int always_run_reconnect;
|
||||
/**
|
||||
* @var auth_file_path
|
||||
* @brief Auth file path
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "sesexec.h"
|
||||
#include "os_calls.h"
|
||||
#include "session.h"
|
||||
#include "sesman_config.h"
|
||||
#include "trans.h"
|
||||
|
||||
#include "ercp.h"
|
||||
@@ -100,17 +101,24 @@ handle_connect_session_request(struct trans *self)
|
||||
|
||||
if (rv == 0 && scp_status == E_SCP_SCONNECT_OK)
|
||||
{
|
||||
// Don't run the reconnect script on the first connect
|
||||
// Don't run the reconnect script on the first connect,
|
||||
// unless we're configured to do so.
|
||||
if (session_increment_connect_count(g_session_data) == 0)
|
||||
{
|
||||
LOG(LOG_LEVEL_INFO, "User %s has connected to a session",
|
||||
g_login_info->username);
|
||||
if (g_cfg->always_run_reconnect)
|
||||
{
|
||||
session_run_reconnect_script(g_login_info,
|
||||
g_session_data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(LOG_LEVEL_INFO, "User %s has reconnected to a session",
|
||||
g_login_info->username);
|
||||
session_run_reconnect_script(g_login_info, g_session_data);
|
||||
session_run_reconnect_script(g_login_info,
|
||||
g_session_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ UserWindowManager=startwm.sh
|
||||
DefaultWindowManager=startwm.sh
|
||||
; Give in full path or relative path to @sesmansysconfdir@
|
||||
ReconnectScript=reconnectwm.sh
|
||||
; Set this to 'yes' if you wish to reconnect script to be run on
|
||||
; the first connection to a session. Normally the script is
|
||||
; only run on reconnections.
|
||||
#AlwaysRunReconnect=no
|
||||
|
||||
[Security]
|
||||
AllowRootLogin=true
|
||||
|
||||
Reference in New Issue
Block a user