summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormetalefty <meta@vmeta.jp>2016-12-02 15:25:48 +0900
committerGitHub <noreply@github.com>2016-12-02 15:25:48 +0900
commit943dec86caf5f0775ca22b63c97c1fb7e7d35bfb (patch)
tree18b6a3c73f1fa609a2e69a33735b2cc4cb6d64e0
parent857355bfae31eb718454d96af345d0fd7fb34fcf (diff)
parent1fe048b63d85641687de7e2eb539a74ac850be5d (diff)
downloadxrdp-proprietary-943dec86caf5f0775ca22b63c97c1fb7e7d35bfb.tar.gz
xrdp-proprietary-943dec86caf5f0775ca22b63c97c1fb7e7d35bfb.zip
Merge pull request #512 from speidy/devel
xrdp_encoder: do not initialize for non-UNIX rdp clients
-rw-r--r--common/xrdp_client_info.h3
-rw-r--r--common/xrdp_constants.h37
-rw-r--r--libxrdp/xrdp_caps.c8
-rw-r--r--xrdp/xrdp_encoder.c37
4 files changed, 50 insertions, 35 deletions
diff --git a/common/xrdp_client_info.h b/common/xrdp_client_info.h
index 46589e30..254708f1 100644
--- a/common/xrdp_client_info.h
+++ b/common/xrdp_client_info.h
@@ -145,6 +145,9 @@ struct xrdp_client_info
int disableSSLv3; /* 0 = no, 1 = yes */
char tls_ciphers[64];
+
+ int client_os_major;
+ int client_os_minor;
};
#endif
diff --git a/common/xrdp_constants.h b/common/xrdp_constants.h
index f034a293..7dcb3064 100644
--- a/common/xrdp_constants.h
+++ b/common/xrdp_constants.h
@@ -217,8 +217,25 @@
/* RDP capabilities */
#define RDP_CAPSET_GENERAL 1
#define RDP_CAPLEN_GENERAL 0x18
-#define OS_MAJOR_TYPE_UNIX 4
-#define OS_MINOR_TYPE_XSERVER 7
+#define OSMAJORTYPE_UNSPECIFIED 0x0000
+#define OSMAJORTYPE_WINDOWS 0x0001
+#define OSMAJORTYPE_OS2 0x0002
+#define OSMAJORTYPE_MACINTOSH 0x0003
+#define OSMAJORTYPE_UNIX 0x0004
+#define OSMAJORTYPE_IOS 0x0005
+#define OSMAJORTYPE_OSX 0x0006
+#define OSMAJORTYPE_ANDROID 0x0007
+#define OSMAJORTYPE_CHROME_OS 0x0008
+#define OSMINORTYPE_UNSPECIFIED 0x0000
+#define OSMINORTYPE_WINDOWS_31X 0x0001
+#define OSMINORTYPE_WINDOWS_95 0x0002
+#define OSMINORTYPE_WINDOWS_NT 0x0003
+#define OSMINORTYPE_OS2_V21 0x0004
+#define OSMINORTYPE_POWER_PC 0x0005
+#define OSMINORTYPE_MACINTOSH 0x0006
+#define OSMINORTYPE_NATIVE_XSERVER 0x0007
+#define OSMINORTYPE_PSEUDO_XSERVER 0x0008
+#define OSMINORTYPE_WINDOWS_RT 0x0009
#define RDP_CAPSET_BITMAP 2
#define RDP_CAPLEN_BITMAP 0x1C
@@ -499,22 +516,6 @@
#define CB_ITEMCHANGE 300
-#define OSMAJORTYPE_UNSPECIFIED 0x0000
-#define OSMAJORTYPE_WINDOWS 0x0001
-#define OSMAJORTYPE_OS2 0x0002
-#define OSMAJORTYPE_MACINTOSH 0x0003
-#define OSMAJORTYPE_UNIX 0x0004
-
-#define OSMINORTYPE_UNSPECIFIED 0x0000
-#define OSMINORTYPE_WINDOWS_31X 0x0001
-#define TS_OSMINORTYPE_WINDOWS_95 0x0002
-#define TS_OSMINORTYPE_WINDOWS_NT 0x0003
-#define TS_OSMINORTYPE_OS2_V21 0x0004
-
-#define TS_OSMINORTYPE_POWER_PC 0x0005
-#define TS_OSMINORTYPE_MACINTOSH 0x0006
-#define TS_OSMINORTYPE_NATIVE_XSERVER 0x0007
-#define TS_OSMINORTYPE_PSEUDO_XSERVER 0x0008
#define TS_CAPS_PROTOCOLVERSION 0x0200
#define FASTPATH_OUTPUT_SUPPORTED 0x0001
diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c
index 9dfe6fef..8d5250d5 100644
--- a/libxrdp/xrdp_caps.c
+++ b/libxrdp/xrdp_caps.c
@@ -74,8 +74,12 @@ xrdp_caps_process_general(struct xrdp_rdp *self, struct stream *s,
g_writeln("xrdp_caps_process_general: error");
return 1;
}
- in_uint8s(s, 10);
- in_uint16_le(s, extraFlags);
+
+ in_uint16_le(s, self->client_info.client_os_major); /* osMajorType (2 bytes) */
+ in_uint16_le(s, self->client_info.client_os_minor); /* osMinorType (2 bytes) */
+ in_uint8s(s, 6);
+ in_uint16_le(s, extraFlags); /* extraFlags (2 bytes) */
+
/* use_compact_packets is pretty much 'use rdp5' */
self->client_info.use_compact_packets = (extraFlags != 0);
/* op2 is a boolean to use compact bitmap headers in bitmap cache */
diff --git a/xrdp/xrdp_encoder.c b/xrdp/xrdp_encoder.c
index ff6db7b7..643fe0aa 100644
--- a/xrdp/xrdp_encoder.c
+++ b/xrdp/xrdp_encoder.c
@@ -52,15 +52,22 @@ struct xrdp_encoder *APP_CC
xrdp_encoder_create(struct xrdp_mm *mm)
{
struct xrdp_encoder *self;
+ struct xrdp_client_info *client_info;
char buf[1024];
int pid;
- if (mm->wm->client_info->mcs_connection_type != 6) /* LAN */
+ client_info = mm->wm->client_info;
+
+ if (client_info->client_os_major != OSMAJORTYPE_UNIX)
{
+ /* temp workaround to avoid black screen in non-supported clients */
return 0;
}
-
- if (mm->wm->client_info->bpp < 24)
+ if (client_info->mcs_connection_type != 6) /* LAN */
+ {
+ return 0;
+ }
+ if (client_info->bpp < 24)
{
return 0;
}
@@ -68,24 +75,24 @@ xrdp_encoder_create(struct xrdp_mm *mm)
self = (struct xrdp_encoder *)g_malloc(sizeof(struct xrdp_encoder), 1);
self->mm = mm;
- if (mm->wm->client_info->jpeg_codec_id != 0)
+ if (client_info->jpeg_codec_id != 0)
{
LLOGLN(0, ("xrdp_encoder_create: starting jpeg codec session"));
- self->codec_id = mm->wm->client_info->jpeg_codec_id;
+ self->codec_id = client_info->jpeg_codec_id;
self->in_codec_mode = 1;
- self->codec_quality = mm->wm->client_info->jpeg_prop[0];
- mm->wm->client_info->capture_code = 0;
- mm->wm->client_info->capture_format =
+ self->codec_quality = client_info->jpeg_prop[0];
+ client_info->capture_code = 0;
+ client_info->capture_format =
/* XRDP_a8b8g8r8 */
(32 << 24) | (3 << 16) | (8 << 12) | (8 << 8) | (8 << 4) | 8;
self->process_enc = process_enc_jpg;
}
- else if (mm->wm->client_info->rfx_codec_id != 0)
+ else if (client_info->rfx_codec_id != 0)
{
LLOGLN(0, ("xrdp_encoder_create: starting rfx codec session"));
- self->codec_id = mm->wm->client_info->rfx_codec_id;
+ self->codec_id = client_info->rfx_codec_id;
self->in_codec_mode = 1;
- mm->wm->client_info->capture_code = 2;
+ client_info->capture_code = 2;
self->process_enc = process_enc_rfx;
#ifdef XRDP_RFXCODEC
self->codec_handle =
@@ -94,13 +101,13 @@ xrdp_encoder_create(struct xrdp_mm *mm)
RFX_FORMAT_YUV, 0);
#endif
}
- else if (mm->wm->client_info->h264_codec_id != 0)
+ else if (client_info->h264_codec_id != 0)
{
LLOGLN(0, ("xrdp_encoder_create: starting h264 codec session"));
- self->codec_id = mm->wm->client_info->h264_codec_id;
+ self->codec_id = client_info->h264_codec_id;
self->in_codec_mode = 1;
- mm->wm->client_info->capture_code = 3;
- mm->wm->client_info->capture_format =
+ client_info->capture_code = 3;
+ client_info->capture_format =
/* XRDP_nv12 */
(12 << 24) | (64 << 16) | (0 << 12) | (0 << 8) | (0 << 4) | 0;
self->process_enc = process_enc_h264;