|
|
|
@ -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,12 +118,34 @@ 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 &&
|
|
|
|
|
(!(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)
|
|
|
|
|
{
|
|
|
|
@ -132,8 +156,11 @@ 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->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)
|
|
|
|
|
{
|
|
|
|
|