|
|
|
@ -124,7 +124,7 @@ session_start_sessvc(int xpid, int wmpid, long data)
|
|
|
|
|
/* new style waiting for clients */
|
|
|
|
|
g_sprintf(wmpid_str, "%d", wmpid);
|
|
|
|
|
g_sprintf(xpid_str, "%d", xpid);
|
|
|
|
|
log_message(LOG_LEVEL_INFO, "starting sessvc - xpid=%s - wmpid=%s",xpid_str, wmpid_str);
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_INFO, "starting sessvc - xpid=%s - wmpid=%s",xpid_str, wmpid_str);
|
|
|
|
|
|
|
|
|
|
sessvc_params = list_create();
|
|
|
|
|
sessvc_params->auto_free = 1;
|
|
|
|
@ -142,16 +142,16 @@ session_start_sessvc(int xpid, int wmpid, long data)
|
|
|
|
|
g_execvp(exe_path, ((char**)sessvc_params->items));
|
|
|
|
|
|
|
|
|
|
/* should not get here */
|
|
|
|
|
log_message(LOG_LEVEL_ALWAYS, "error starting sessvc - pid %d - xpid=%s - wmpid=%s",
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_ALWAYS, "error starting sessvc - pid %d - xpid=%s - wmpid=%s",
|
|
|
|
|
g_getpid(), xpid_str, wmpid_str);
|
|
|
|
|
|
|
|
|
|
/* logging parameters */
|
|
|
|
|
/* no problem calling strerror for thread safety: other threads are blocked */
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno, g_get_strerror());
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"execve parameter list:");
|
|
|
|
|
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:");
|
|
|
|
|
for (i=0; i < (sessvc_params->count); i++)
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, " argv[%d] = %s", i, (char*)list_get_item(sessvc_params, i));
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_DEBUG, " argv[%d] = %s", i, (char*)list_get_item(sessvc_params, i));
|
|
|
|
|
}
|
|
|
|
|
list_delete(sessvc_params);
|
|
|
|
|
|
|
|
|
@ -191,7 +191,7 @@ session_start(int width, int height, int bpp, char* username, char* password,
|
|
|
|
|
{
|
|
|
|
|
/*THREAD-FIX unlock chain*/
|
|
|
|
|
lock_chain_release();
|
|
|
|
|
log_message(LOG_LEVEL_INFO, "max concurrent session limit exceeded. login \
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_INFO, "max concurrent session limit exceeded. login \
|
|
|
|
|
for user %s denied", username);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -202,7 +202,7 @@ for user %s denied", username);
|
|
|
|
|
temp = (struct session_chain*)g_malloc(sizeof(struct session_chain), 0);
|
|
|
|
|
if (temp == 0)
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "cannot create new chain element - user %s",
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "cannot create new chain element - user %s",
|
|
|
|
|
username);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -210,7 +210,7 @@ for user %s denied", username);
|
|
|
|
|
if (temp->item == 0)
|
|
|
|
|
{
|
|
|
|
|
g_free(temp);
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "cannot create new session item - user %s",
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "cannot create new session item - user %s",
|
|
|
|
|
username);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -263,15 +263,15 @@ for user %s denied", username);
|
|
|
|
|
if (g_file_exist(text))
|
|
|
|
|
{
|
|
|
|
|
g_execlp3(text, g_cfg.user_wm, 0);
|
|
|
|
|
log_message(LOG_LEVEL_ALWAYS,"error starting user wm for user %s - pid %d",
|
|
|
|
|
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(LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno,
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno,
|
|
|
|
|
g_get_strerror());
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"execlp3 parameter list:");
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, " argv[0] = %s", text);
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, " argv[1] = %s", g_cfg.user_wm);
|
|
|
|
|
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
|
|
|
|
@ -279,31 +279,31 @@ for user %s denied", username);
|
|
|
|
|
g_sprintf(text, "%s/%s", cur_dir, g_cfg.default_wm);
|
|
|
|
|
g_execlp3(text, g_cfg.default_wm, 0);
|
|
|
|
|
|
|
|
|
|
log_message(LOG_LEVEL_ALWAYS,"error starting default wm for user %s - pid %d",
|
|
|
|
|
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(LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno,
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno,
|
|
|
|
|
g_get_strerror());
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"execlp3 parameter list:");
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, " argv[0] = %s", text);
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, " argv[1] = %s", g_cfg.default_wm);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
/* still a problem starting window manager just start xterm */
|
|
|
|
|
g_execlp3("xterm", "xterm", 0);
|
|
|
|
|
|
|
|
|
|
/* should not get here */
|
|
|
|
|
log_message(LOG_LEVEL_ALWAYS,"error starting xterm for user %s - pid %d",
|
|
|
|
|
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(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(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(LOG_LEVEL_DEBUG,"aborting connection...");
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_DEBUG,"aborting connection...");
|
|
|
|
|
g_exit(0);
|
|
|
|
|
}
|
|
|
|
|
else /* parent (child sesman) */
|
|
|
|
@ -364,23 +364,23 @@ for user %s denied", username);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_ALWAYS, "bad session type - user %s - pid %d",
|
|
|
|
|
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(LOG_LEVEL_ALWAYS, "error starting X server - user %s - pid %d",
|
|
|
|
|
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(LOG_LEVEL_DEBUG, "errno: %d, description: %s", errno, g_get_strerror());
|
|
|
|
|
log_message(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(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);
|
|
|
|
@ -479,7 +479,7 @@ session_kill(int pid)
|
|
|
|
|
{
|
|
|
|
|
if (tmp->item == 0)
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "session descriptor for pid %d is null!",
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "session descriptor for pid %d is null!",
|
|
|
|
|
pid);
|
|
|
|
|
if (prev == 0)
|
|
|
|
|
{
|
|
|
|
@ -499,7 +499,7 @@ session_kill(int pid)
|
|
|
|
|
if (tmp->item->pid == pid)
|
|
|
|
|
{
|
|
|
|
|
/* deleting the session */
|
|
|
|
|
log_message(LOG_LEVEL_INFO, "session %d - user %s - terminated",
|
|
|
|
|
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)
|
|
|
|
@ -544,7 +544,7 @@ session_sigkill_all()
|
|
|
|
|
{
|
|
|
|
|
if (tmp->item == 0)
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "found null session descriptor!");
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "found null session descriptor!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -573,7 +573,7 @@ session_get_bypid(int pid)
|
|
|
|
|
{
|
|
|
|
|
if (tmp->item == 0)
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "session descriptor for pid %d is null!",
|
|
|
|
|
log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "session descriptor for pid %d is null!",
|
|
|
|
|
pid);
|
|
|
|
|
/*THREAD-FIX release chain lock */
|
|
|
|
|
lock_chain_release();
|
|
|
|
|