diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c index 8c4e6a2e..161f88f8 100644 --- a/libxrdp/xrdp_sec.c +++ b/libxrdp/xrdp_sec.c @@ -956,42 +956,49 @@ xrdp_sec_process_mcs_data_channels(struct xrdp_sec *self, struct stream *s) static int APP_CC xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s) { - int index; - int monitorCount; - int flags; - struct mcs_monitor_item *monitor_item; + int index; + int monitorCount; + int flags; + 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) /* are multi-monitors allowed ? */ { - DEBUG(("[INFO] xrdp_sec_process_mcs_data_monitors: multimon is not allowed, skipping")); + DEBUG(("[INFO] xrdp_sec_process_mcs_data_monitors: multimon is not " + "allowed, skipping")); return 0; } in_uint32_le(s, flags); /* 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; + 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); //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; + 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 *) + monitor_item = (struct mcs_monitor_item *) g_malloc(sizeof(struct mcs_monitor_item), 1); - in_uint32_le(s, monitor_item->left); + 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: left: %d, top: %d, right: %d, bottom: %d, is primary: %d", - monitor_item->left, monitor_item->top, monitor_item->right, monitor_item->bottom, monitor_item->is_primary)); + DEBUG(("got monitor: left: %d, top: %d, right: %d, bottom: %d, is " + "primary: %d", monitor_item->left, monitor_item->top, + monitor_item->right, monitor_item->bottom, + monitor_item->is_primary)); } return 0; @@ -1045,7 +1052,7 @@ xrdp_sec_process_mcs_data(struct xrdp_sec *self) case SEC_TAG_CLI_4: break; case SEC_TAG_CLI_MONITOR: - xrdp_sec_process_mcs_data_monitors(self, s); + xrdp_sec_process_mcs_data_monitors(self, s); break; default: g_writeln("error unknown xrdp_sec_process_mcs_data tag %d size %d", @@ -1093,27 +1100,31 @@ xrdp_sec_out_mcs_data(struct xrdp_sec *self) out_uint8(s, 0x63); /* c */ out_uint8(s, 0x44); /* D */ out_uint8(s, 0x6e); /* n */ - if (self->mcs_layer->iso_layer->selectedProtocol != -1) { // Check for RDPNEGDATA availability - out_uint16_be(s, 0x80fc + (num_channels_even * 2) + 4); + if (self->mcs_layer->iso_layer->selectedProtocol != -1) + { // Check for RDPNEGDATA availability + out_uint16_be(s, 0x80fc + (num_channels_even * 2) + 4); } else { - out_uint16_be(s, 0x80fc + (num_channels_even * 2)); + out_uint16_be(s, 0x80fc + (num_channels_even * 2)); } out_uint16_le(s, SEC_TAG_SRV_INFO); - if (self->mcs_layer->iso_layer->selectedProtocol != -1) { - out_uint16_le(s, 12); /* len */ + if (self->mcs_layer->iso_layer->selectedProtocol != -1) + { + out_uint16_le(s, 12); /* len */ } else { - out_uint16_le(s, 8); /* len */ + out_uint16_le(s, 8); /* len */ } out_uint8(s, 4); /* 4 = rdp5 1 = rdp4 */ out_uint8(s, 0); out_uint8(s, 8); out_uint8(s, 0); - if (self->mcs_layer->iso_layer->selectedProtocol != -1) { - out_uint32_le(s, self->mcs_layer->iso_layer->selectedProtocol); /* clientReqeustedProtocol */ + if (self->mcs_layer->iso_layer->selectedProtocol != -1) + { + /* clientReqeustedProtocol */ + out_uint32_le(s, self->mcs_layer->iso_layer->selectedProtocol); } out_uint16_le(s, SEC_TAG_SRV_CHANNELS); out_uint16_le(s, 8 + (num_channels_even * 2)); /* len */ @@ -1244,7 +1255,8 @@ xrdp_sec_incoming(struct xrdp_sec *self) if (file_by_name_read_section(key_file, "keys", items, values) != 0) { /* this is a show stopper */ - log_message(LOG_LEVEL_ALWAYS,"XRDP cannot read file: %s (check permissions)", key_file); + log_message(LOG_LEVEL_ALWAYS, "XRDP cannot read file: %s " + "(check permissions)", key_file); list_delete(items); list_delete(values); return 1;