added X11DisplayOffset sesman option

ulab-original
jsorg71 15 years ago
parent f312c16a8a
commit e83b4c43f5

@ -103,6 +103,11 @@ This option sets the logging level for syslog. It can have the same values of \f
The following parameters can be used in the \fB[Sessions]\fR section:
.br
.TP
\fBX11DisplayOffset\fR=\fI<number>\fR
Specifies the first X display number available for sesman(8). This prevents sesman from interfering with real X11 servers. The default is 10.
.br
.TP
\fBMaxSessions\fR=\fI<number>\fR
Sets the maximum number of simultaneous session on terminal server.

@ -330,6 +330,7 @@ config_read_sessions(int file, struct config_sessions* se, struct list* param_n,
list_clear(param_n);
/* setting defaults */
se->x11_display_offset=10;
se->max_sessions=0;
se->max_idle_time=0;
se->max_disc_time=0;
@ -339,6 +340,10 @@ config_read_sessions(int file, struct config_sessions* se, struct list* param_n,
for (i = 0; i < param_n->count; i++)
{
buf = (char*)list_get_item(param_n, i);
if (0 == g_strcasecmp(buf, SESMAN_CFG_X11DISPLAYOFFSET))
{
se->x11_display_offset = g_atoi((char*)list_get_item(param_v, i));
}
if (0 == g_strcasecmp(buf, SESMAN_CFG_SESS_MAX))
{
se->max_sessions = g_atoi((char*)list_get_item(param_v, i));
@ -360,6 +365,7 @@ config_read_sessions(int file, struct config_sessions* se, struct list* param_n,
/* printing security config */
g_printf("session configuration:\r\n");
g_printf("\tMaxSessions: %i\r\n", se->max_sessions);
g_printf("\tX11DisplayOffset: %i\r\n", se->x11_display_offset);
g_printf("\tKillDisconnected: %i\r\n", se->kill_disconnected);
g_printf("\tIdleTimeLimit: %i\r\n", se->max_idle_time);
g_printf("\tDisconnectedTimeLimit: %i\r\n", se->max_idle_time);

@ -38,6 +38,7 @@
#define SESMAN_CFG_PORT "ListenPort"
#define SESMAN_CFG_ENABLE_USERWM "EnableUserWindowManager"
#define SESMAN_CFG_USERWM "UserWindowManager"
#define SESMAN_CFG_X11DISPLAYOFFSET "X11DisplayOffset"
#define SESMAN_CFG_MAX_SESSION "MaxSessions"
#define SESMAN_CFG_AUTH_FILE_PATH "AuthFilePath"
@ -102,6 +103,11 @@ struct config_security
*/
struct config_sessions
{
/**
* @var x11_display_offset
* @brief X11 TCP port offset. default value: 10
*/
int x11_display_offset;
/**
* @var max_sessions
* @brief maximum number of allowed sessions. 0 for unlimited

@ -12,6 +12,7 @@ TerminalServerUsers=tsusers
TerminalServerAdmins=tsadmins
[Sessions]
X11DisplayOffset=10
MaxSessions=10
KillDisconnected=0
IdleTimeLimit=0

@ -252,9 +252,9 @@ session_get_aval_display_from_chain(void)
{
int display;
display = 10;
display = g_cfg->sess.x11_display_offset;
lock_chain_acquire();
while ((display - 10) <= g_cfg->sess.max_sessions)
while ((display - g_cfg->sess.x11_display_offset) <= g_cfg->sess.max_sessions)
{
if (!session_is_display_in_chain(display))
{

Loading…
Cancel
Save