From fcb1b825c578e4ddc737f276819c798166bbb56c Mon Sep 17 00:00:00 2001 From: daixj Date: Fri, 23 Nov 2018 16:08:55 +0800 Subject: [PATCH] neutrinordp: don't enable remote_app if the INFO_RAIL flag is not set --- common/xrdp_client_info.h | 1 + common/xrdp_constants.h | 1 + libxrdp/xrdp_caps.c | 29 ++++++++++++++++------------- libxrdp/xrdp_sec.c | 6 ++++++ neutrinordp/xrdp-neutrinordp.c | 2 +- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/common/xrdp_client_info.h b/common/xrdp_client_info.h index b57b1949..ca349f0a 100644 --- a/common/xrdp_client_info.h +++ b/common/xrdp_client_info.h @@ -155,6 +155,7 @@ struct xrdp_client_info int no_orders_supported; int use_cache_glyph_v2; + int rail_enable; }; #endif diff --git a/common/xrdp_constants.h b/common/xrdp_constants.h index fec882a4..98bd8371 100644 --- a/common/xrdp_constants.h +++ b/common/xrdp_constants.h @@ -370,6 +370,7 @@ #define RDP_COMPRESSION 0x0080 #define RDP_LOGON_BLOB 0x0100 #define RDP_LOGON_LEAVE_AUDIO 0x2000 +#define RDP_LOGON_RAIL 0x8000 /* Compression Flags (MS-RDPBCGR 3.1.8.2.1) */ /* TODO: to be renamed, not used anywhere */ diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c index ff9b4484..e47c4a63 100644 --- a/libxrdp/xrdp_caps.c +++ b/libxrdp/xrdp_caps.c @@ -964,20 +964,23 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) out_uint16_le(s, flags); out_uint8s(s, 82); - /* Remote Programs Capability Set */ - caps_count++; - out_uint16_le(s, 0x0017); /* CAPSETTYPE_RAIL */ - out_uint16_le(s, 8); - out_uint32_le(s, 3); /* TS_RAIL_LEVEL_SUPPORTED - TS_RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED */ + if (self->client_info.rail_enable) /* MS-RDPERP 3.3.5.1.4 */ + { + /* Remote Programs Capability Set */ + caps_count++; + out_uint16_le(s, 0x0017); /* CAPSETTYPE_RAIL */ + out_uint16_le(s, 8); + out_uint32_le(s, 3); /* TS_RAIL_LEVEL_SUPPORTED + TS_RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED */ - /* Window List Capability Set */ - caps_count++; - out_uint16_le(s, 0x0018); /* CAPSETTYPE_WINDOW */ - out_uint16_le(s, 11); - out_uint32_le(s, 2); /* TS_WINDOW_LEVEL_SUPPORTED_EX */ - out_uint8(s, 3); /* NumIconCaches */ - out_uint16_le(s, 12); /* NumIconCacheEntries */ + /* Window List Capability Set */ + caps_count++; + out_uint16_le(s, 0x0018); /* CAPSETTYPE_WINDOW */ + out_uint16_le(s, 11); + out_uint32_le(s, 2); /* TS_WINDOW_LEVEL_SUPPORTED_EX */ + out_uint8(s, 3); /* NumIconCaches */ + out_uint16_le(s, 12); /* NumIconCacheEntries */ + } /* 6 - bitmap cache v3 codecid */ caps_count++; diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c index 2fbad018..31197ab6 100644 --- a/libxrdp/xrdp_sec.c +++ b/libxrdp/xrdp_sec.c @@ -701,6 +701,12 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s) DEBUG(("flag RDP_LOGON_LEAVE_AUDIO found")); } + if (flags & RDP_LOGON_RAIL) + { + self->rdp_layer->client_info.rail_enable = 1; + DEBUG(("flag RDP_LOGON_RAIL found")); + } + if ((flags & RDP_LOGON_AUTO) && (!self->rdp_layer->client_info.is_mce)) /* todo, for now not allowing autologon and mce both */ { diff --git a/neutrinordp/xrdp-neutrinordp.c b/neutrinordp/xrdp-neutrinordp.c index d7f90e18..89e8f2ea 100644 --- a/neutrinordp/xrdp-neutrinordp.c +++ b/neutrinordp/xrdp-neutrinordp.c @@ -1527,7 +1527,7 @@ lfreerdp_pre_connect(freerdp *instance) instance->settings->password = g_strdup(mod->password); instance->settings->domain = g_strdup(mod->domain); - if (mod->client_info.rail_support_level > 0) + if (mod->client_info.rail_enable && (mod->client_info.rail_support_level > 0)) { LLOGLN(0, ("Railsupport !!!!!!!!!!!!!!!!!!")); instance->settings->remote_app = 1;