|
|
@ -62,11 +62,11 @@ static int g_sync_cmd;
|
|
|
|
char *APP_CC
|
|
|
|
char *APP_CC
|
|
|
|
dumpItemsToString(struct list *self, char *outstr, int len)
|
|
|
|
dumpItemsToString(struct list *self, char *outstr, int len)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_memset(outstr, 0, len);
|
|
|
|
|
|
|
|
int index;
|
|
|
|
int index;
|
|
|
|
tbus item;
|
|
|
|
tbus item;
|
|
|
|
int totalLen = 0;
|
|
|
|
int totalLen = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_memset(outstr, 0, len);
|
|
|
|
if (self->count == 0)
|
|
|
|
if (self->count == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_writeln("List is empty");
|
|
|
|
g_writeln("List is empty");
|
|
|
@ -385,6 +385,7 @@ session_start_fork(int width, int height, int bpp, char *username,
|
|
|
|
int display = 0;
|
|
|
|
int display = 0;
|
|
|
|
int pid = 0;
|
|
|
|
int pid = 0;
|
|
|
|
int wmpid = 0;
|
|
|
|
int wmpid = 0;
|
|
|
|
|
|
|
|
int pampid = 0;
|
|
|
|
int xpid = 0;
|
|
|
|
int xpid = 0;
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
|
char geometry[32];
|
|
|
|
char geometry[32];
|
|
|
@ -453,99 +454,105 @@ session_start_fork(int width, int height, int bpp, char *username,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_tcp_close(g_sck);
|
|
|
|
g_tcp_close(g_sck);
|
|
|
|
g_tcp_close(g_thread_sck);
|
|
|
|
g_tcp_close(g_thread_sck);
|
|
|
|
auth_start_session(data, display);
|
|
|
|
|
|
|
|
g_sprintf(geometry, "%dx%d", width, height);
|
|
|
|
g_sprintf(geometry, "%dx%d", width, height);
|
|
|
|
g_sprintf(depth, "%d", bpp);
|
|
|
|
g_sprintf(depth, "%d", bpp);
|
|
|
|
g_sprintf(screen, ":%d", display);
|
|
|
|
g_sprintf(screen, ":%d", display);
|
|
|
|
wmpid = g_fork();
|
|
|
|
wmpid = g_fork();
|
|
|
|
|
|
|
|
|
|
|
|
if (wmpid == -1)
|
|
|
|
if (wmpid == -1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (wmpid == 0) /* child (child sesman) xserver */
|
|
|
|
else if (wmpid == 0) /* child (child sesman) xserver */
|
|
|
|
{
|
|
|
|
{
|
|
|
|
wait_for_xserver(display);
|
|
|
|
wait_for_xserver(display);
|
|
|
|
env_set_user(username, 0, display);
|
|
|
|
auth_start_session(data, display);
|
|
|
|
|
|
|
|
pampid = g_fork();
|
|
|
|
if (x_server_running(display))
|
|
|
|
if (pampid == -1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auth_set_env(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (pampid == 0) /* child: X11/client */
|
|
|
|
if (directory != 0)
|
|
|
|
{
|
|
|
|
|
|
|
|
env_set_user(username, 0, display);
|
|
|
|
|
|
|
|
if (x_server_running(display))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (directory[0] != 0)
|
|
|
|
auth_set_env(data);
|
|
|
|
|
|
|
|
if (directory != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_set_current_dir(directory);
|
|
|
|
if (directory[0] != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
g_set_current_dir(directory);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (program != 0)
|
|
|
|
|
|
|
|
|
|
|
|
if (program != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (program[0] != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_execlp3(program, program, 0);
|
|
|
|
if (program[0] != 0)
|
|
|
|
log_message(LOG_LEVEL_ALWAYS,
|
|
|
|
{
|
|
|
|
"error starting program %s for user %s - pid %d",
|
|
|
|
g_execlp3(program, program, 0);
|
|
|
|
program, username, g_getpid());
|
|
|
|
log_message(LOG_LEVEL_ALWAYS,
|
|
|
|
|
|
|
|
"error starting program %s for user %s - pid %d",
|
|
|
|
|
|
|
|
program, username, g_getpid());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* try to execute user window manager if enabled */
|
|
|
|
|
|
|
|
if (g_cfg->enable_user_wm)
|
|
|
|
/* try to execute user window manager if enabled */
|
|
|
|
|
|
|
|
if (g_cfg->enable_user_wm)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
g_sprintf(text, "%s/%s", g_getenv("HOME"), g_cfg->user_wm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (g_file_exist(text))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_execlp3(text, g_cfg->user_wm, 0);
|
|
|
|
g_sprintf(text, "%s/%s", g_getenv("HOME"), g_cfg->user_wm);
|
|
|
|
log_message(LOG_LEVEL_ALWAYS, "error starting user "
|
|
|
|
if (g_file_exist(text))
|
|
|
|
"wm for user %s - pid %d", username, g_getpid());
|
|
|
|
{
|
|
|
|
/* logging parameters */
|
|
|
|
g_execlp3(text, g_cfg->user_wm, 0);
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "errno: %d, "
|
|
|
|
log_message(LOG_LEVEL_ALWAYS, "error starting user "
|
|
|
|
"description: %s", errno, g_get_strerror());
|
|
|
|
"wm for user %s - pid %d", username, g_getpid());
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "execlp3 parameter "
|
|
|
|
/* logging parameters */
|
|
|
|
"list:");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "errno: %d, "
|
|
|
|
log_message(LOG_LEVEL_DEBUG, " argv[0] = %s",
|
|
|
|
"description: %s", errno, g_get_strerror());
|
|
|
|
text);
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "execlp3 parameter "
|
|
|
|
log_message(LOG_LEVEL_DEBUG, " argv[1] = %s",
|
|
|
|
"list:");
|
|
|
|
g_cfg->user_wm);
|
|
|
|
log_message(LOG_LEVEL_DEBUG, " argv[0] = %s",
|
|
|
|
|
|
|
|
text);
|
|
|
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, " argv[1] = %s",
|
|
|
|
|
|
|
|
g_cfg->user_wm);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we're here something happened to g_execlp3
|
|
|
|
|
|
|
|
so we try running the default window manager */
|
|
|
|
|
|
|
|
g_sprintf(text, "%s/%s", XRDP_CFG_PATH, 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", username, g_getpid());
|
|
|
|
|
|
|
|
/* logging parameters */
|
|
|
|
|
|
|
|
log_message(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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 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", username, g_getpid());
|
|
|
|
|
|
|
|
/* logging parameters */
|
|
|
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "errno: %d, description: "
|
|
|
|
|
|
|
|
"%s", errno, g_get_strerror());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "another Xserver might "
|
|
|
|
|
|
|
|
"already be active on display %d - see log", display);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* if we're here something happened to g_execlp3
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "aborting connection...");
|
|
|
|
so we try running the default window manager */
|
|
|
|
g_exit(0);
|
|
|
|
g_sprintf(text, "%s/%s", XRDP_CFG_PATH, 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", username, g_getpid());
|
|
|
|
|
|
|
|
/* logging parameters */
|
|
|
|
|
|
|
|
log_message( 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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 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", username, g_getpid());
|
|
|
|
|
|
|
|
/* logging parameters */
|
|
|
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "errno: %d, description: "
|
|
|
|
|
|
|
|
"%s", errno, g_get_strerror());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_ERROR, "another Xserver might "
|
|
|
|
g_waitpid(pampid);
|
|
|
|
"already be active on display %d - see log", display);
|
|
|
|
auth_stop_session(data);
|
|
|
|
|
|
|
|
g_exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "aborting connection...");
|
|
|
|
|
|
|
|
g_exit(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* parent (child sesman) */
|
|
|
|
else /* parent (child sesman) */
|
|
|
|
{
|
|
|
|
{
|
|
|
|