libxrdp: work on multi-mon support

This commit is contained in:
speidy 2013-07-15 10:13:03 +03:00
parent aab0176867
commit a8e5b3fee5
7 changed files with 93 additions and 13 deletions

View File

@ -38,6 +38,7 @@ struct xrdp_client_info
int bitmap_cache_version; /* ored 1 = original version, 2 = v2, 4 = v3 */ int bitmap_cache_version; /* ored 1 = original version, 2 = v2, 4 = v3 */
/* pointer info */ /* pointer info */
int pointer_cache_entries; int pointer_cache_entries;
int pointer_flags; /* 0 color, 1 new, 2 no new */
/* other */ /* other */
int use_bitmap_comp; int use_bitmap_comp;
int use_bitmap_cache; int use_bitmap_cache;
@ -69,6 +70,9 @@ struct xrdp_client_info
int offscreen_cache_size; int offscreen_cache_size;
int offscreen_cache_entries; int offscreen_cache_entries;
int rfx; int rfx;
int nego_sec_layer; /* 0, 1, 2 = RDP security layer, TLS , Negotiate */
int multimon; /* 0 = deny , 1 = allow */
/* CAPSETTYPE_RAIL */ /* CAPSETTYPE_RAIL */
int rail_support_level; int rail_support_level;
/* CAPSETTYPE_WINDOW */ /* CAPSETTYPE_WINDOW */
@ -90,7 +94,6 @@ struct xrdp_client_info
char orders[32]; char orders[32];
int order_flags_ex; int order_flags_ex;
int use_bulk_comp; int use_bulk_comp;
int pointer_flags; /* 0 color, 1 new, 2 no new */
}; };
#endif #endif

View File

@ -25,8 +25,8 @@
/* TCP port for Remote Desktop Protocol */ /* TCP port for Remote Desktop Protocol */
#define TCP_PORT_RDP 3389 #define TCP_PORT_RDP 3389
#define ISO_PDU_CR 0xE0 /* Connection Request */ #define ISO_PDU_CR 0xE0 /* X.224 Connection Request */
#define ISO_PDU_CC 0xD0 /* Connection Confirm */ #define ISO_PDU_CC 0xD0 /* X.224 Connection Confirm */
#define ISO_PDU_DR 0x80 /* Disconnect Request */ #define ISO_PDU_DR 0x80 /* Disconnect Request */
#define ISO_PDU_DT 0xF0 /* Data */ #define ISO_PDU_DT 0xF0 /* Data */
#define ISO_PDU_ER 0x70 /* Error */ #define ISO_PDU_ER 0x70 /* Error */
@ -72,6 +72,7 @@
#define SEC_TAG_CLI_CRYPT 0xc002 #define SEC_TAG_CLI_CRYPT 0xc002
#define SEC_TAG_CLI_CHANNELS 0xc003 #define SEC_TAG_CLI_CHANNELS 0xc003
#define SEC_TAG_CLI_4 0xc004 #define SEC_TAG_CLI_4 0xc004
#define SEC_TAG_CLI_MONITOR 0xc005
#define SEC_TAG_PUBKEY 0x0006 #define SEC_TAG_PUBKEY 0x0006
#define SEC_TAG_KEYSIG 0x0008 #define SEC_TAG_KEYSIG 0x0008

View File

@ -59,6 +59,16 @@ struct mcs_channel_item
int chanid; int chanid;
}; };
/* used in mcs - client monitor data */
struct mcs_monitor_item
{
int x;
int y;
int width;
int height;
int is_primary;
};
/* mcs */ /* mcs */
struct xrdp_mcs struct xrdp_mcs
{ {
@ -69,6 +79,7 @@ struct xrdp_mcs
struct stream* client_mcs_data; struct stream* client_mcs_data;
struct stream* server_mcs_data; struct stream* server_mcs_data;
struct list* channel_list; struct list* channel_list;
struct list* monitor_list;
}; };
/* sec */ /* sec */
@ -99,6 +110,7 @@ struct xrdp_sec
char pub_sig[64]; char pub_sig[64];
char pri_exp[64]; char pri_exp[64];
int channel_code; int channel_code;
int multimon;
}; };
/* channel */ /* channel */
@ -285,7 +297,7 @@ xrdp_mcs_disconnect(struct xrdp_mcs* self);
/* xrdp_sec.c */ /* xrdp_sec.c */
struct xrdp_sec* APP_CC struct xrdp_sec* APP_CC
xrdp_sec_create(struct xrdp_rdp* owner, struct trans* trans, int crypt_level, xrdp_sec_create(struct xrdp_rdp* owner, struct trans* trans, int crypt_level,
int channel_code); int channel_code, int multimon);
void APP_CC void APP_CC
xrdp_sec_delete(struct xrdp_sec* self); xrdp_sec_delete(struct xrdp_sec* self);
int APP_CC int APP_CC

View File

@ -86,7 +86,7 @@ xrdp_iso_recv_msg(struct xrdp_iso *self, struct stream *s, int *code)
} }
else else
{ {
in_uint8s(s, 5); in_uint8s(s, 13);
} }
return 0; return 0;
@ -126,14 +126,20 @@ xrdp_iso_send_msg(struct xrdp_iso *self, struct stream *s, int code)
return 1; return 1;
} }
out_uint8(s, 3); /* TPKT HEADER */
out_uint8(s, 0); out_uint8(s, 3); /* version */
out_uint16_be(s, 11); /* length */ out_uint8(s, 0); /* RESERVED */
out_uint8(s, 6); out_uint16_be(s, 19); /* length */
/* ISO LAYER */
out_uint8(s, 14); /* length */
out_uint8(s, code); out_uint8(s, code);
out_uint16_le(s, 0); out_uint16_le(s, 0);
out_uint16_le(s, 0); out_uint16_le(s, 4660);
out_uint8(s, 0); out_uint8(s, 0);
out_uint8(s, 2); /* TYPE_RDP_NEG_RSP */
out_uint8(s, 1); /* flags */
out_uint16_le(s, 8); /* length */
out_uint32_le(s, 0); /* selectedProtocol: 0 = RDP , 1 = TLS , 2 = CREDSSP */
s_mark_end(s); s_mark_end(s);
if (xrdp_tcp_send(self->tcp_layer, s) != 0) if (xrdp_tcp_send(self->tcp_layer, s) != 0)

View File

@ -364,6 +364,7 @@ xrdp_mcs_recv_edrq(struct xrdp_mcs *self)
int opcode; int opcode;
struct stream *s; struct stream *s;
DEBUG((" in xrdp_mcs_recv_edrq"));
make_stream(s); make_stream(s);
init_stream(s, 8192); init_stream(s, 8192);
@ -396,6 +397,7 @@ xrdp_mcs_recv_edrq(struct xrdp_mcs *self)
} }
free_stream(s); free_stream(s);
DEBUG((" out xrdp_mcs_recv_edrq"));
return 0; return 0;
} }
@ -407,6 +409,7 @@ xrdp_mcs_recv_aurq(struct xrdp_mcs *self)
int opcode; int opcode;
struct stream *s; struct stream *s;
DEBUG((" in xrdp_mcs_recv_aurq"));
make_stream(s); make_stream(s);
init_stream(s, 8192); init_stream(s, 8192);
@ -436,6 +439,7 @@ xrdp_mcs_recv_aurq(struct xrdp_mcs *self)
} }
free_stream(s); free_stream(s);
DEBUG((" out xrdp_mcs_recv_aurq"));
return 0; return 0;
} }

View File

@ -127,6 +127,14 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
log_message(LOG_LEVEL_DEBUG,"Info - All channels are disabled"); log_message(LOG_LEVEL_DEBUG,"Info - All channels are disabled");
} }
} }
else if (g_strcasecmp(item, "allow_multimon") == 0)
{
client_info->multimon = text2bool(value);
if (client_info->multimon == 0)
{
log_message(LOG_LEVEL_DEBUG,"Info - Multi monitor server support disabled");
}
}
else if (g_strcasecmp(item, "max_bpp") == 0) else if (g_strcasecmp(item, "max_bpp") == 0)
{ {
client_info->max_bpp = g_atoi(value); client_info->max_bpp = g_atoi(value);
@ -211,7 +219,7 @@ xrdp_rdp_create(struct xrdp_session *session, struct trans *trans)
xrdp_rdp_read_config(&self->client_info); xrdp_rdp_read_config(&self->client_info);
/* create sec layer */ /* create sec layer */
self->sec_layer = xrdp_sec_create(self, trans, self->client_info.crypt_level, self->sec_layer = xrdp_sec_create(self, trans, self->client_info.crypt_level,
self->client_info.channel_code); self->client_info.channel_code, self->client_info.multimon);
/* default 8 bit v1 color bitmap cache entries and size */ /* default 8 bit v1 color bitmap cache entries and size */
self->client_info.cache1_entries = 600; self->client_info.cache1_entries = 600;
self->client_info.cache1_size = 256; self->client_info.cache1_size = 256;

View File

@ -138,7 +138,7 @@ hex_str_to_bin(char *in, char *out, int out_len)
/*****************************************************************************/ /*****************************************************************************/
struct xrdp_sec *APP_CC struct xrdp_sec *APP_CC
xrdp_sec_create(struct xrdp_rdp *owner, struct trans *trans, int crypt_level, xrdp_sec_create(struct xrdp_rdp *owner, struct trans *trans, int crypt_level,
int channel_code) int channel_code, int multimon)
{ {
struct xrdp_sec *self; struct xrdp_sec *self;
@ -168,6 +168,7 @@ xrdp_sec_create(struct xrdp_rdp *owner, struct trans *trans, int crypt_level,
} }
self->channel_code = channel_code; self->channel_code = channel_code;
self->multimon = multimon;
if (self->decrypt_rc4_info != NULL) if (self->decrypt_rc4_info != NULL)
{ {
@ -465,7 +466,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
unicode_in(s, len_ip - 2, tmpdata, 255); unicode_in(s, len_ip - 2, tmpdata, 255);
in_uint16_le(s, len_dll); in_uint16_le(s, len_dll);
unicode_in(s, len_dll - 2, tmpdata, 255); unicode_in(s, len_dll - 2, tmpdata, 255);
in_uint32_le(s, tzone); /* len of timetone */ in_uint32_le(s, tzone); /* len of timezone */
in_uint8s(s, 62); /* skip */ in_uint8s(s, 62); /* skip */
in_uint8s(s, 22); /* skip misc. */ in_uint8s(s, 22); /* skip misc. */
in_uint8s(s, 62); /* skip */ in_uint8s(s, 62); /* skip */
@ -850,7 +851,48 @@ 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 */
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;
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 ? */
{
g_writeln("Processing monitor data from client - Multimon is not allowed");
return 0;
}
in_uint32_le(s, flags); /* flags */
DEBUG(("xrdp_sec_process_mcs_data_monitors: monitor flags is %s", flags));
in_uint32_le(s, monitorCount);
DEBUG(("xrdp_sec_process_mcs_data_monitors: monitor count is %s", monitorCount));
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);
in_uint32_le(s, monitor_item->y);
in_uint32_le(s, monitor_item->width);
in_uint32_le(s, monitor_item->height);
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));
}
return 0;
}
/*****************************************************************************/ /*****************************************************************************/
/* process client mcs data, we need some things in here to create the server /* process client mcs data, we need some things in here to create the server
mcs data */ mcs data */
@ -892,6 +934,10 @@ xrdp_sec_process_mcs_data(struct xrdp_sec *self)
break; break;
case SEC_TAG_CLI_4: case SEC_TAG_CLI_4:
break; break;
case SEC_TAG_CLI_MONITOR:
DEBUG((" in CS_MONITOR !!!"));
xrdp_sec_process_mcs_data_monitors(self, s);
break;
default: default:
g_writeln("error unknown xrdp_sec_process_mcs_data tag %d size %d", g_writeln("error unknown xrdp_sec_process_mcs_data tag %d size %d",
tag, size); tag, size);