libxrdp: work on multimon, added monitor data processing
This commit is contained in:
parent
da62badee5
commit
0d86544819
@ -49,6 +49,8 @@ struct xrdp_iso
|
|||||||
{
|
{
|
||||||
struct xrdp_mcs* mcs_layer; /* owner */
|
struct xrdp_mcs* mcs_layer; /* owner */
|
||||||
struct xrdp_tcp* tcp_layer;
|
struct xrdp_tcp* tcp_layer;
|
||||||
|
int requestedProtocol;
|
||||||
|
int selectedProtocol;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* used in mcs */
|
/* used in mcs */
|
||||||
@ -62,10 +64,10 @@ struct mcs_channel_item
|
|||||||
/* used in mcs - client monitor data */
|
/* used in mcs - client monitor data */
|
||||||
struct mcs_monitor_item
|
struct mcs_monitor_item
|
||||||
{
|
{
|
||||||
int x;
|
int left;
|
||||||
int y;
|
int top;
|
||||||
int width;
|
int right;
|
||||||
int height;
|
int bottom;
|
||||||
int is_primary;
|
int is_primary;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ xrdp_mcs_create(struct xrdp_sec *owner, struct trans *trans,
|
|||||||
self->server_mcs_data = server_mcs_data;
|
self->server_mcs_data = server_mcs_data;
|
||||||
self->iso_layer = xrdp_iso_create(self, trans);
|
self->iso_layer = xrdp_iso_create(self, trans);
|
||||||
self->channel_list = list_create();
|
self->channel_list = list_create();
|
||||||
|
self->monitor_list = list_create();
|
||||||
DEBUG((" out xrdp_mcs_create"));
|
DEBUG((" out xrdp_mcs_create"));
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -47,6 +48,7 @@ void APP_CC
|
|||||||
xrdp_mcs_delete(struct xrdp_mcs *self)
|
xrdp_mcs_delete(struct xrdp_mcs *self)
|
||||||
{
|
{
|
||||||
struct mcs_channel_item *channel_item;
|
struct mcs_channel_item *channel_item;
|
||||||
|
struct mcs_monitor_item *monitor_item;
|
||||||
int index;
|
int index;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
@ -66,6 +68,19 @@ xrdp_mcs_delete(struct xrdp_mcs *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
list_delete(self->channel_list);
|
list_delete(self->channel_list);
|
||||||
|
|
||||||
|
/* here we have to free the monitor items and anything in them */
|
||||||
|
count = self->monitor_list->count;
|
||||||
|
|
||||||
|
for (index = count - 1; index >= 0; index--)
|
||||||
|
{
|
||||||
|
monitor_item = (struct mcs_monitor_item *)
|
||||||
|
list_get_item(self->monitor_list, index);
|
||||||
|
g_free(monitor_item);
|
||||||
|
}
|
||||||
|
|
||||||
|
list_delete(self->monitor_list);
|
||||||
|
|
||||||
xrdp_iso_delete(self->iso_layer);
|
xrdp_iso_delete(self->iso_layer);
|
||||||
/* make sure we get null pointer exception if struct is used again. */
|
/* make sure we get null pointer exception if struct is used again. */
|
||||||
DEBUG(("xrdp_mcs_delete processed"))
|
DEBUG(("xrdp_mcs_delete processed"))
|
||||||
|
@ -852,7 +852,7 @@ xrdp_sec_process_mcs_data_channels(struct xrdp_sec *self, struct stream *s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* reads the client monitors data, in order to send it to X11rdp */
|
/* reads the client monitors data */
|
||||||
static int APP_CC
|
static int APP_CC
|
||||||
xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
|
xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
|
||||||
{
|
{
|
||||||
@ -862,33 +862,36 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
|
|||||||
struct mcs_monitor_item *monitor_item;
|
struct mcs_monitor_item *monitor_item;
|
||||||
|
|
||||||
DEBUG(("processing monitors data, allow_multimon is %d", self->multimon));
|
DEBUG(("processing monitors data, allow_multimon is %d", self->multimon));
|
||||||
|
|
||||||
/* this is an option set in xrdp.ini */
|
/* this is an option set in xrdp.ini */
|
||||||
if (self->multimon != 1) /* is multi-monitors allowed ? */
|
if (self->multimon != 1) /* are multi-monitors allowed ? */
|
||||||
{
|
{
|
||||||
g_writeln("Processing monitor data from client - Multimon is not allowed");
|
DEBUG(("[INFO] xrdp_sec_process_mcs_data_monitors: multimon is not allowed, skipping"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_uint32_le(s, flags); /* flags */
|
in_uint32_le(s, flags); /* flags */
|
||||||
DEBUG(("xrdp_sec_process_mcs_data_monitors: monitor flags is %s", flags));
|
//verify flags - must be 0x0
|
||||||
|
if (flags != 0){
|
||||||
|
DEBUG(("[ERROR] xrdp_sec_process_mcs_data_monitors: flags MUST be zero, detected: %d", flags));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
in_uint32_le(s, monitorCount);
|
in_uint32_le(s, monitorCount);
|
||||||
DEBUG(("xrdp_sec_process_mcs_data_monitors: monitor count is %s", monitorCount));
|
//verify monitorCount - max 16
|
||||||
|
if (monitorCount > 16){
|
||||||
|
DEBUG(("[ERROR] xrdp_sec_process_mcs_data_monitors: max allowed monitors is 16, detected: %d", monitorCount));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
for (index = 0; index < monitorCount; index++)
|
for (index = 0; index < monitorCount; index++)
|
||||||
{
|
{
|
||||||
monitor_item = (struct mcs_monitor_item *)
|
monitor_item = (struct mcs_monitor_item *)
|
||||||
g_malloc(sizeof(struct mcs_monitor_item), 1);
|
g_malloc(sizeof(struct mcs_monitor_item), 1);
|
||||||
in_uint32_le(s, monitor_item->x); //TODO: change to signed 32 bit int.
|
in_uint32_le(s, monitor_item->left);
|
||||||
in_uint32_le(s, monitor_item->y); //TODO: change to signed 32 bit int.
|
in_uint32_le(s, monitor_item->top);
|
||||||
in_uint32_le(s, monitor_item->width); //TODO: change to signed 32 bit int.
|
in_uint32_le(s, monitor_item->right);
|
||||||
in_uint32_le(s, monitor_item->height); //TODO: change to signed 32 bit int.
|
in_uint32_le(s, monitor_item->bottom);
|
||||||
in_uint32_le(s, monitor_item->is_primary);
|
in_uint32_le(s, monitor_item->is_primary);
|
||||||
|
|
||||||
list_add_item(self->mcs_layer->monitor_list, (long)monitor_item);
|
list_add_item(self->mcs_layer->monitor_list, (long)monitor_item);
|
||||||
DEBUG(("got monitor: flags %8.8x is primary? %s", monitor_item->height,
|
DEBUG(("got monitor: x: %d, y: %d, width: %d, height: %d, is primary: %d",
|
||||||
monitor_item->is_primary));
|
monitor_item->x, monitor_item->y, monitor_item->width, monitor_item->height, monitor_item->is_primary));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -935,7 +938,6 @@ xrdp_sec_process_mcs_data(struct xrdp_sec *self)
|
|||||||
case SEC_TAG_CLI_4:
|
case SEC_TAG_CLI_4:
|
||||||
break;
|
break;
|
||||||
case SEC_TAG_CLI_MONITOR:
|
case SEC_TAG_CLI_MONITOR:
|
||||||
DEBUG((" in CS_MONITOR !!!"));
|
|
||||||
xrdp_sec_process_mcs_data_monitors(self, s);
|
xrdp_sec_process_mcs_data_monitors(self, s);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user