diff options
author | speidy <speidy@gmail.com> | 2013-10-05 12:03:15 +0300 |
---|---|---|
committer | speidy <speidy@gmail.com> | 2013-10-05 12:03:15 +0300 |
commit | 0d8654481964bf13a4af5474ec37d44ef10320df (patch) | |
tree | 409ab2fd2ba6d1b01dad346c8993d15353ba0873 | |
parent | da62badee518fa31e3a4f9d7d5fb3ea32de40060 (diff) | |
download | xrdp-proprietary-0d8654481964bf13a4af5474ec37d44ef10320df.tar.gz xrdp-proprietary-0d8654481964bf13a4af5474ec37d44ef10320df.zip |
libxrdp: work on multimon, added monitor data processing
-rw-r--r-- | libxrdp/libxrdp.h | 10 | ||||
-rw-r--r-- | libxrdp/xrdp_mcs.c | 15 | ||||
-rw-r--r-- | libxrdp/xrdp_sec.c | 36 |
3 files changed, 40 insertions, 21 deletions
diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h index 66b0cb61..88afae75 100644 --- a/libxrdp/libxrdp.h +++ b/libxrdp/libxrdp.h @@ -49,6 +49,8 @@ struct xrdp_iso { struct xrdp_mcs* mcs_layer; /* owner */ struct xrdp_tcp* tcp_layer; + int requestedProtocol; + int selectedProtocol; }; /* used in mcs */ @@ -62,10 +64,10 @@ struct mcs_channel_item /* used in mcs - client monitor data */ struct mcs_monitor_item { - int x; - int y; - int width; - int height; + int left; + int top; + int right; + int bottom; int is_primary; }; diff --git a/libxrdp/xrdp_mcs.c b/libxrdp/xrdp_mcs.c index 7d89766d..e7c5dee3 100644 --- a/libxrdp/xrdp_mcs.c +++ b/libxrdp/xrdp_mcs.c @@ -38,6 +38,7 @@ xrdp_mcs_create(struct xrdp_sec *owner, struct trans *trans, self->server_mcs_data = server_mcs_data; self->iso_layer = xrdp_iso_create(self, trans); self->channel_list = list_create(); + self->monitor_list = list_create(); DEBUG((" out xrdp_mcs_create")); return self; } @@ -47,6 +48,7 @@ void APP_CC xrdp_mcs_delete(struct xrdp_mcs *self) { struct mcs_channel_item *channel_item; + struct mcs_monitor_item *monitor_item; int index; int count; @@ -66,6 +68,19 @@ xrdp_mcs_delete(struct xrdp_mcs *self) } 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); /* make sure we get null pointer exception if struct is used again. */ DEBUG(("xrdp_mcs_delete processed")) diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c index d7847eb7..cacd7b8e 100644 --- a/libxrdp/xrdp_sec.c +++ b/libxrdp/xrdp_sec.c @@ -852,7 +852,7 @@ xrdp_sec_process_mcs_data_channels(struct xrdp_sec *self, struct stream *s) return 0; } /*****************************************************************************/ -/* reads the client monitors data, in order to send it to X11rdp */ +/* reads the client monitors data */ static int APP_CC 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; DEBUG(("processing monitors data, allow_multimon is %d", self->multimon)); - /* 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; } - 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); - 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++) { monitor_item = (struct mcs_monitor_item *) 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->y); //TODO: change to signed 32 bit int. - in_uint32_le(s, monitor_item->width); //TODO: change to signed 32 bit int. - in_uint32_le(s, monitor_item->height); //TODO: change to signed 32 bit int. + in_uint32_le(s, monitor_item->left); + in_uint32_le(s, monitor_item->top); + in_uint32_le(s, monitor_item->right); + in_uint32_le(s, monitor_item->bottom); in_uint32_le(s, monitor_item->is_primary); - list_add_item(self->mcs_layer->monitor_list, (long)monitor_item); - DEBUG(("got monitor: flags %8.8x is primary? %s", monitor_item->height, - monitor_item->is_primary)); + DEBUG(("got monitor: x: %d, y: %d, width: %d, height: %d, is primary: %d", + monitor_item->x, monitor_item->y, monitor_item->width, monitor_item->height, monitor_item->is_primary)); } return 0; @@ -935,7 +938,6 @@ xrdp_sec_process_mcs_data(struct xrdp_sec *self) case SEC_TAG_CLI_4: break; case SEC_TAG_CLI_MONITOR: - DEBUG((" in CS_MONITOR !!!")); xrdp_sec_process_mcs_data_monitors(self, s); break; default: |