|
|
|
@ -90,9 +90,10 @@ dumpItemsToString(struct list *self, char *outstr, int len)
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
struct session_item *DEFAULT_CC
|
|
|
|
|
session_get_bydata(char *name, int width, int height, int bpp, int type)
|
|
|
|
|
session_get_bydata(char *name, int width, int height, int bpp, int type, char *client_ip)
|
|
|
|
|
{
|
|
|
|
|
struct session_chain *tmp;
|
|
|
|
|
enum SESMAN_CFG_SESS_POLICY policy = g_cfg->sess.policy;
|
|
|
|
|
|
|
|
|
|
/*THREAD-FIX require chain lock */
|
|
|
|
|
lock_chain_acquire();
|
|
|
|
@ -104,6 +105,7 @@ session_get_bydata(char *name, int width, int height, int bpp, int type)
|
|
|
|
|
{
|
|
|
|
|
case SCP_SESSION_TYPE_XVNC: /* 0 */
|
|
|
|
|
type = SESMAN_SESSION_TYPE_XVNC; /* 2 */
|
|
|
|
|
policy |= SESMAN_CFG_SESS_POLICY_D; /* Xvnc cannot resize */
|
|
|
|
|
break;
|
|
|
|
|
case SCP_SESSION_TYPE_XRDP: /* 1 */
|
|
|
|
|
type = SESMAN_SESSION_TYPE_XRDP; /* 1 */
|
|
|
|
@ -116,14 +118,36 @@ session_get_bydata(char *name, int width, int height, int bpp, int type)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
log_message(LOG_LEVEL_INFO,
|
|
|
|
|
"session_get_bydata: search policy %d U %s W %d H %d bpp %d T %d IP %s",
|
|
|
|
|
policy, name, width, height, bpp, type, client_ip);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
while (tmp != 0)
|
|
|
|
|
{
|
|
|
|
|
#if 0
|
|
|
|
|
log_message(LOG_LEVEL_INFO,
|
|
|
|
|
"session_get_bydata: try %p U %s W %d H %d bpp %d T %d IP %s",
|
|
|
|
|
tmp->item,
|
|
|
|
|
tmp->item->name,
|
|
|
|
|
tmp->item->width, tmp->item->height,
|
|
|
|
|
tmp->item->bpp, tmp->item->type,
|
|
|
|
|
tmp->item->client_ip);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (type == SESMAN_SESSION_TYPE_XRDP)
|
|
|
|
|
{
|
|
|
|
|
/* only name and bpp need to match for X11rdp, it can resize */
|
|
|
|
|
if (g_strncmp(name, tmp->item->name, 255) == 0 &&
|
|
|
|
|
tmp->item->bpp == bpp &&
|
|
|
|
|
tmp->item->type == type)
|
|
|
|
|
(!(policy & SESMAN_CFG_SESS_POLICY_D) ||
|
|
|
|
|
(tmp->item->width == width && tmp->item->height == height)) &&
|
|
|
|
|
(!(policy & SESMAN_CFG_SESS_POLICY_I) ||
|
|
|
|
|
(g_strncmp_d(client_ip, tmp->item->client_ip, ':', 255) == 0)) &&
|
|
|
|
|
(!(policy & SESMAN_CFG_SESS_POLICY_C) ||
|
|
|
|
|
(g_strncmp(client_ip, tmp->item->client_ip, 255) == 0)) &&
|
|
|
|
|
tmp->item->bpp == bpp &&
|
|
|
|
|
tmp->item->type == type)
|
|
|
|
|
{
|
|
|
|
|
/*THREAD-FIX release chain lock */
|
|
|
|
|
lock_chain_release();
|
|
|
|
@ -132,10 +156,13 @@ session_get_bydata(char *name, int width, int height, int bpp, int type)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_strncmp(name, tmp->item->name, 255) == 0 &&
|
|
|
|
|
tmp->item->width == width &&
|
|
|
|
|
tmp->item->height == height &&
|
|
|
|
|
tmp->item->bpp == bpp &&
|
|
|
|
|
tmp->item->type == type)
|
|
|
|
|
(tmp->item->width == width && tmp->item->height == height) &&
|
|
|
|
|
(!(policy & SESMAN_CFG_SESS_POLICY_I) ||
|
|
|
|
|
(g_strncmp_d(client_ip, tmp->item->client_ip, ':', 255) == 0)) &&
|
|
|
|
|
(!(policy & SESMAN_CFG_SESS_POLICY_C) ||
|
|
|
|
|
(g_strncmp(client_ip, tmp->item->client_ip, 255) == 0)) &&
|
|
|
|
|
tmp->item->bpp == bpp &&
|
|
|
|
|
tmp->item->type == type)
|
|
|
|
|
{
|
|
|
|
|
/*THREAD-FIX release chain lock */
|
|
|
|
|
lock_chain_release();
|
|
|
|
@ -577,11 +604,11 @@ session_start_fork(int width, int height, int bpp, char *username,
|
|
|
|
|
g_snprintf(text, 255, "%d", g_cfg->sess.kill_disconnected);
|
|
|
|
|
g_setenv("XRDP_SESMAN_KILL_DISCONNECTED", text, 1);
|
|
|
|
|
|
|
|
|
|
if (type == SESMAN_SESSION_TYPE_XORG)
|
|
|
|
|
{
|
|
|
|
|
if (type == SESMAN_SESSION_TYPE_XORG)
|
|
|
|
|
{
|
|
|
|
|
xserver_params = list_create();
|
|
|
|
|
xserver_params->auto_free = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* these are the must have parameters */
|
|
|
|
|
list_add_item(xserver_params, (long) g_strdup("/usr/bin/Xorg"));
|
|
|
|
|
list_add_item(xserver_params, (long) g_strdup(screen));
|
|
|
|
@ -599,18 +626,18 @@ session_start_fork(int width, int height, int bpp, char *username,
|
|
|
|
|
/* some args are passed via env vars */
|
|
|
|
|
g_sprintf(geometry, "%d", width);
|
|
|
|
|
g_setenv("XRDP_START_WIDTH", geometry, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_sprintf(geometry, "%d", height);
|
|
|
|
|
g_setenv("XRDP_START_HEIGHT", geometry, 1);
|
|
|
|
|
|
|
|
|
|
/* fire up Xorg */
|
|
|
|
|
|
|
|
|
|
/* fire up Xorg */
|
|
|
|
|
g_execvp("/usr/bin/Xorg", pp1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (type == SESMAN_SESSION_TYPE_XVNC)
|
|
|
|
|
{
|
|
|
|
|
xserver_params = list_create();
|
|
|
|
|
xserver_params->auto_free = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* these are the must have parameters */
|
|
|
|
|
list_add_item(xserver_params, (long)g_strdup("Xvnc"));
|
|
|
|
|
list_add_item(xserver_params, (long)g_strdup(screen));
|
|
|
|
@ -636,7 +663,7 @@ session_start_fork(int width, int height, int bpp, char *username,
|
|
|
|
|
{
|
|
|
|
|
xserver_params = list_create();
|
|
|
|
|
xserver_params->auto_free = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* these are the must have parameters */
|
|
|
|
|
list_add_item(xserver_params, (long)g_strdup("X11rdp"));
|
|
|
|
|
list_add_item(xserver_params, (long)g_strdup(screen));
|
|
|
|
|