summaryrefslogtreecommitdiffstats
path: root/sesman/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'sesman/session.c')
-rw-r--r--sesman/session.c98
1 files changed, 55 insertions, 43 deletions
diff --git a/sesman/session.c b/sesman/session.c
index 1e67ae1a..bfd60a09 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -205,24 +205,24 @@ session_start_fork(int width, int height, int bpp, char* username,
/* check to limit concurrent sessions */
if (g_session_count >= g_cfg->sess.max_sessions)
{
- log_message(&(g_cfg->log), LOG_LEVEL_INFO, "max concurrent session limit exceeded. login \
-for user %s denied", username);
+ log_message(&(g_cfg->log), LOG_LEVEL_INFO, "max concurrent session limit "
+ "exceeded. login for user %s denied", username);
return 0;
}
temp = (struct session_chain*)g_malloc(sizeof(struct session_chain), 0);
if (temp == 0)
{
- log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "cannot create new chain element - user %s",
- username);
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "cannot create new chain "
+ "element - user %s", username);
return 0;
}
temp->item = (struct session_item*)g_malloc(sizeof(struct session_item), 0);
if (temp->item == 0)
{
g_free(temp);
- log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "cannot create new session item - user %s",
- username);
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "cannot create new session "
+ "item - user %s", username);
return 0;
}
@@ -283,15 +283,17 @@ for user %s denied", username);
if (g_file_exist(text))
{
g_execlp3(text, g_cfg->user_wm, 0);
- log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS,"error starting user wm for user %s - pid %d",
- username, g_getpid());
+ log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS,"error starting user "
+ "wm for user %s - pid %d", username, g_getpid());
/* logging parameters */
- /* no problem calling strerror for thread safety: other threads are blocked */
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno,
- g_get_strerror());
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG,"execlp3 parameter list:");
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[0] = %s", text);
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[1] = %s", g_cfg->user_wm);
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "errno: %d, "
+ "description: %s", errno, g_get_strerror());
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG,"execlp3 parameter "
+ "list:");
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[0] = %s",
+ text);
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[1] = %s",
+ g_cfg->user_wm);
}
}
/* if we're here something happened to g_execlp3
@@ -299,29 +301,31 @@ for user %s denied", username);
g_sprintf(text, "%s/%s", XRDP_CFG_PATH, g_cfg->default_wm);
g_execlp3(text, g_cfg->default_wm, 0);
- log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS,"error starting default wm for user %s - pid %d",
- username, g_getpid());
+ log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS,"error starting default "
+ "wm for user %s - pid %d", username, g_getpid());
/* logging parameters */
- /* no problem calling strerror for thread safety: other threads are blocked */
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno,
- g_get_strerror());
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "errno: %d, description: "
+ "%s", errno, g_get_strerror());
log_message(&(g_cfg->log), LOG_LEVEL_DEBUG,"execlp3 parameter list:");
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[0] = %s", text);
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[1] = %s", g_cfg->default_wm);
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[0] = %s",
+ text);
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[1] = %s",
+ g_cfg->default_wm);
/* still a problem starting window manager just start xterm */
g_execlp3("xterm", "xterm", 0);
/* should not get here */
- log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS,"error starting xterm for user %s - pid %d",
- username, g_getpid());
+ log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS,"error starting xterm "
+ "for user %s - pid %d", username, g_getpid());
/* logging parameters */
- /* no problem calling strerror for thread safety: other threads are blocked */
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno, g_get_strerror());
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "errno: %d, description: "
+ "%s", errno, g_get_strerror());
}
else
{
- log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "another Xserver is already active on display %d", display);
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "another Xserver is "
+ "already active on display %d", display);
}
log_message(&(g_cfg->log), LOG_LEVEL_DEBUG,"aborting connection...");
g_exit(0);
@@ -384,29 +388,35 @@ for user %s denied", username);
}
else
{
- log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS, "bad session type - user %s - pid %d",
- username, g_getpid());
+ log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS, "bad session type - "
+ "user %s - pid %d", username, g_getpid());
g_exit(1);
}
/* should not get here */
- log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS, "error starting X server - user %s - pid %d",
- username, g_getpid());
+ log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS, "error starting X server "
+ "- user %s - pid %d", username, g_getpid());
/* logging parameters */
- /* no problem calling strerror for thread safety: other threads are blocked */
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno, g_get_strerror());
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "execve parameter list: %d", (xserver_params)->count);
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "errno: %d, description: "
+ "%s", errno, g_get_strerror());
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, "execve parameter list: "
+ "%d", (xserver_params)->count);
for (i=0; i<(xserver_params->count); i++)
{
- log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[%d] = %s", i, (char*)list_get_item(xserver_params, i));
+ log_message(&(g_cfg->log), LOG_LEVEL_DEBUG, " argv[%d] = %s",
+ i, (char*)list_get_item(xserver_params, i));
}
list_delete(xserver_params);
g_exit(1);
}
else /* parent (child sesman)*/
{
+ g_snprintf(text, 255, "%d", display);
+ g_setenv("XRDP_SESSVC_DISPLAY", text, 1);
+ g_snprintf(text, 255, ":%d.0", display);
+ g_setenv("DISPLAY", text, 1);
/* new style waiting for clients */
session_start_sessvc(xpid, wmpid, data);
}
@@ -505,8 +515,8 @@ session_kill(int pid)
{
if (tmp->item == 0)
{
- log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "session descriptor for pid %d is null!",
- pid);
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "session descriptor for "
+ "pid %d is null!", pid);
if (prev == 0)
{
/* prev does no exist, so it's the first element - so we set
@@ -525,8 +535,8 @@ session_kill(int pid)
if (tmp->item->pid == pid)
{
/* deleting the session */
- log_message(&(g_cfg->log), LOG_LEVEL_INFO, "session %d - user %s - terminated",
- tmp->item->pid, tmp->item->name);
+ log_message(&(g_cfg->log), LOG_LEVEL_INFO, "session %d - user %s - "
+ "terminated", tmp->item->pid, tmp->item->name);
g_free(tmp->item);
if (prev == 0)
{
@@ -570,7 +580,8 @@ session_sigkill_all()
{
if (tmp->item == 0)
{
- log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "found null session descriptor!");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "found null session "
+ "descriptor!");
}
else
{
@@ -607,8 +618,8 @@ session_get_bypid(int pid)
{
if (tmp->item == 0)
{
- log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "session descriptor for pid %d is null!",
- pid);
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "session descriptor for "
+ "pid %d is null!", pid);
/*THREAD-FIX release chain lock */
lock_chain_release();
return 0;
@@ -652,7 +663,9 @@ session_get_byuser(char* user, int* cnt, unsigned char flags)
LOG_DBG(&(g_cfg->log), "user: %s", user);
if ((NULL == user) || (!g_strncasecmp(user, tmp->item->name, 256)))
{
- LOG_DBG(&(g_cfg->log), "session_get_byuser: status=%d, flags=%d, result=%d", (tmp->item->status), flags, ((tmp->item->status) & flags));
+ LOG_DBG(&(g_cfg->log), "session_get_byuser: status=%d, flags=%d, "
+ "result=%d", (tmp->item->status), flags,
+ ((tmp->item->status) & flags));
if ((tmp->item->status) & flags)
{
count++;
@@ -733,4 +746,3 @@ session_get_byuser(char* user, int* cnt, unsigned char flags)
(*cnt)=count;
return sess;
}
-