summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitmodules6
-rw-r--r--Makefile.am29
-rw-r--r--common/os_calls.c2
-rw-r--r--common/xrdp_constants.h44
-rw-r--r--configure.ac2
-rw-r--r--docs/man/sesman.ini.510
-rw-r--r--docs/man/xrdp.ini.515
-rw-r--r--genkeymap/Makefile.am4
-rw-r--r--instfiles/Makefile.am2
-rw-r--r--instfiles/km-00000412.ini1057
m---------libpainter0
m---------librfxcodec0
-rw-r--r--libxrdp/Makefile.am3
-rw-r--r--libxrdp/libxrdp.c6
-rw-r--r--libxrdp/xrdp_bitmap32_compress.c122
-rw-r--r--libxrdp/xrdp_bitmap_compress.c8
-rw-r--r--libxrdp/xrdp_caps.c79
-rw-r--r--libxrdp/xrdp_fastpath.c30
-rw-r--r--libxrdp/xrdp_jpeg_compress.c11
-rw-r--r--libxrdp/xrdp_orders.c115
-rw-r--r--neutrinordp/Makefile.am1
-rw-r--r--sesman/Makefile.am5
-rw-r--r--sesman/chansrv/Makefile.am6
-rw-r--r--sesman/env.c18
-rw-r--r--sesman/session.c24
-rw-r--r--sesman/xauth.c62
-rw-r--r--sesman/xauth.h41
-rw-r--r--vnc/vnc.c2
-rw-r--r--xrdp/Makefile.am7
-rw-r--r--xrdp/xrdp.ini6
-rw-r--r--xrdp/xrdp_bitmap.c31
-rw-r--r--xrdp/xrdp_encoder.c30
-rw-r--r--xrdp/xrdp_keyboard.ini3
-rw-r--r--xrdp/xrdp_mm.c19
-rw-r--r--xrdp/xrdp_wm.c80
-rw-r--r--xrdpapi/Makefile.am5
-rw-r--r--xrdpvr/Makefile.am3
37 files changed, 1678 insertions, 210 deletions
diff --git a/.gitmodules b/.gitmodules
index 32417c16..281ee599 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,8 @@
[submodule "librfxcodec"]
path = librfxcodec
- url = git://github.com/neutrinolabs/librfxcodec
+ url = https://github.com/neutrinolabs/librfxcodec.git
+[submodule "libpainter"]
+ path = libpainter
+ url = https://github.com/neutrinolabs/libpainter.git
+ branch = devel
diff --git a/Makefile.am b/Makefile.am
index c50ea295..52ea2e61 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,25 @@
ACLOCAL_AMFLAGS = -I m4
AM_DISTCHECK_CONFIGURE_FLAGS = --without-systemdsystemunitdir
-EXTRA_DIST = bootstrap COPYING coding_style.md design.txt faq-compile.txt \
- faq-general.txt file-loc.txt install.txt m4 readme.txt
+EXTRA_DIST = \
+ COPYING \
+ astyle_config.as \
+ bootstrap \
+ coding_style.md \
+ description-pak \
+ design.txt \
+ faq-compile.txt \
+ faq-general.txt \
+ file-loc.txt \
+ fontdump \
+ install.txt \
+ m4 \
+ postinstall-pak \
+ readme.txt \
+ tcutils \
+ tests \
+ vrplayer \
+ xorg
if XRDP_NEUTRINORDP
NEUTRINORDPDIR = neutrinordp
@@ -16,7 +33,14 @@ else
XRDPVRDIR =
endif
+if XRDP_RFXCODEC
+RFXCODECDIR = librfxcodec
+else
+RFXCODECDIR =
+endif
+
SUBDIRS = \
+ libpainter \
common \
vnc \
rdp \
@@ -24,6 +48,7 @@ SUBDIRS = \
mc \
$(NEUTRINORDPDIR) \
libxrdp \
+ $(RFXCODECDIR) \
xrdp \
sesman \
keygen \
diff --git a/common/os_calls.c b/common/os_calls.c
index 9ebaa880..5db59caa 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -681,7 +681,7 @@ g_sck_close(int sck)
char addr[48];
struct sockaddr_in6 *sock_addr_in6 = &sock_info.sock_addr_in6;
- g_snprintf(sockname, sizeof(sockname), "AF_INET6 %s:%d",
+ g_snprintf(sockname, sizeof(sockname), "AF_INET6 %s port %d",
inet_ntop(sock_addr_in6->sin6_family,
&sock_addr_in6->sin6_addr, addr, sizeof(addr)),
ntohs(sock_addr_in6->sin6_port));
diff --git a/common/xrdp_constants.h b/common/xrdp_constants.h
index f4b97c3b..6a055678 100644
--- a/common/xrdp_constants.h
+++ b/common/xrdp_constants.h
@@ -160,6 +160,7 @@
#define RDP_INPUT_CODEPOINT 1
#define RDP_INPUT_VIRTKEY 2
#define RDP_INPUT_SCANCODE 4
+#define RDP_INPUT_UNICODE 5
#define RDP_INPUT_MOUSE 0x8001
#define RDP_INPUT_MOUSEX 0x8002
@@ -283,6 +284,24 @@
#define RDP_CAPSET_VIRCHAN 20
#define RDP_CAPLEN_VIRCHAN 0x08
+#define RDP_CAPSET_MULTIFRAGMENT 0x001A
+#define RDP_CAPLEN_MULTIFRAGMENT 0x08
+
+#define RDP_CAPSET_FRAME_ACKNOWLEDGE 0x001E
+#define RDP_CAPLEN_FRAME_ACKNOWLEDGE 0x08
+
+#define RDP_CAPSET_SURFCMDS 0x1C
+#define RDP_CAPLEN_SURFCMDS 0x0C
+
+#define RDP_CAPSET_BMPCODECS 0x1D
+#define RDP_CAPLEN_BMPCODECS 0x1C
+
+#define RDP_CAPSET_COMPDESK 0x19
+#define RDP_CAPLEN_COMPDESK 0x06
+
+#define RDP_CAPSET_LPOINTER 0x1B
+#define RDP_CAPLEN_LPOINTER 0x06
+
#define RDP_SOURCE "MSTSC"
/* Logon flags */
@@ -572,9 +591,9 @@
#define COMPDESK_NOT_SUPPORTED 0x0000
#define COMPDESK_SUPPORTED 0x0001
-#define SURCMDS_SETSURFACEBITS 0x00000002
-#define SURCMDS_FRAMEMARKER 0x00000010
-#define SURCMDS_STREAMSUFRACEBITS 0x00000040
+#define SURFCMDS_SETSURFACEBITS 0x00000002
+#define SURFCMDS_FRAMEMARKER 0x00000010
+#define SURFCMDS_STREAMSUFRACEBITS 0x00000040
/* CODEC_GUID_NSCODEC CA8D1BB9-000F-154F-589FAE2D1A87E2D6 */
#define XR_CODEC_GUID_NSCODEC \
@@ -584,6 +603,10 @@
#define XR_CODEC_GUID_REMOTEFX \
"\x12\x2F\x77\x76\x72\xBD\x63\x44\xAF\xB3\xB7\x3C\x9C\x6F\x78\x86"
+/* CODEC_GUID_IMAGE_REMOTEFX 2744CCD4-9D8A-4E74-803C-0ECBEEA19C54 */
+#define XR_CODEC_GUID_IMAGE_REMOTEFX \
+ "\xD4\xCC\x44\x27\x8A\x9D\x74\x4E\x80\x3C\x0E\xCB\xEE\xA1\x9C\x54"
+
/* CODEC_GUID_JPEG 1BAF4CE6-9EED-430C-869ACB8B37B66237 */
#define XR_CODEC_GUID_JPEG \
"\xE6\x4C\xAF\x1B\xED\x9E\x0C\x43\x86\x9A\xCB\x8B\x37\xB6\x62\x37"
@@ -596,15 +619,6 @@
#define XR_CODEC_GUID_H264 \
"\x48\x32\x36\x34\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"
-#define RDP_CAPSET_SURFCMDS 0x1c
-#define RDP_CAPLEN_SURFCMDS 0x0c
-#define RDP_CAPSET_BMPCODECS 0x1d
-#define RDP_CAPLEN_BMPCODECS 0x1c
-#define RDP_CAPSET_COMPDESK 0x19
-#define RDP_CAPLEN_COMPDESK 0x06
-#define RDP_CAPSET_LPOINTER 0x27
-#define RDP_CAPLEN_LPOINTER 0x06
-
/* fastpath input */
#define FASTPATH_INPUT_SECURE_CHECKSUM 0x1
#define FASTPATH_INPUT_ENCRYPTED 0x2
@@ -656,4 +670,10 @@
#define XRDP_MAX_BITMAP_CACHE_IDX 2000
#define XRDP_BITMAP_CACHE_ENTRIES 2048
+#define XR_MIN_KEY_CODE 8
+#define XR_MAX_KEY_CODE 256
+
+#define XR_RDP_SCAN_LSHIFT 42
+#define XR_RDP_SCAN_ALT 56
+
#endif
diff --git a/configure.ac b/configure.ac
index 302534bb..4168c1b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,6 +10,8 @@ AC_C_CONST
AC_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG
+AC_CONFIG_SUBDIRS([libpainter librfxcodec])
+
# Use silent rules by default if supported by Automake
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
diff --git a/docs/man/sesman.ini.5 b/docs/man/sesman.ini.5
index af9b35ab..9003f82e 100644
--- a/docs/man/sesman.ini.5
+++ b/docs/man/sesman.ini.5
@@ -196,12 +196,10 @@ Following parameters can be used in the \fB[X11rdp]\fR, \fB[Xvnc]\fR and
\fB[Xorg]\fR sections.
.TP
-\fBparam0\fR=\fIfilename\fR
-Path to the X11 server executable
-
-.TP
-\fBparam\fR\fIN\fR=\fIstring\fR
-Nth command line argument
+\fBparam\fR=\fIstring\fR
+Multiple \fIparam\fR lines are supported. This first line specifies the
+path to the X11 server executable. Following lines specify command line
+arguments passed to the X11 server.
.SH "CHANSRV"
Following parameters can be used in the \fB[Chansrv]\fR section.
diff --git a/docs/man/xrdp.ini.5 b/docs/man/xrdp.ini.5
index 6a4da78c..55299d0c 100644
--- a/docs/man/xrdp.ini.5
+++ b/docs/man/xrdp.ini.5
@@ -29,9 +29,13 @@ Specify xrdp listening address. If not specified, defaults to 0.0.0.0 (all inter
.TP
\fBautorun\fP=\fIsession_name\fP
-Automatically run the connection specified by \fIsession_name\fP, which must match a section as described below.
-By default a drop-down list with all available connections is shown.
-A connection can also be chosen by the connecting client by setting the \fBLOGIN DOMAIN\fP to a valid \fIsession name\fP.
+Section name for automatic login. If set and the client supplies valid
+username and password, the user will be logged in automatically using the
+connection specified by \fIsession_name\fP.
+
+If \fIsession_name\fP is empty, the \fBLOGIN DOMAIN\fR from the client
+with be used to select the section. If no domain name is supplied, the
+first suitable section will be used for automatic login.
.TP
\fBbitmap_cache\fR=\fI[true|false]\fR
@@ -294,8 +298,9 @@ depth of the client. Only Xvnc and X11rdp use that setting. Xorg runs at
\fI24\fR bpp.
.TP
-\fBcode\fR=\fI<number>\fR|\fI\-1\fR
-Specifies the session type, the default, \fI\0\fR, is Xvnc, \fI\10\fR, is X11rdp, and \fI\20\fR, uses Xorg driver mode.
+\fBcode\fR=\fI<number>\fR|\fI0\fR
+Specifies the session type. The default, \fI0\fR, is Xvnc, \fI10\fR is
+X11rdp, and \fI20\fR is Xorg with xorgxrdp modules.
.SH "EXAMPLES"
This is an example \fBxrdp.ini\fR:
diff --git a/genkeymap/Makefile.am b/genkeymap/Makefile.am
index 25767395..8c295170 100644
--- a/genkeymap/Makefile.am
+++ b/genkeymap/Makefile.am
@@ -1,3 +1,7 @@
+EXTRA_DIST = \
+ dump-keymaps.sh \
+ readme.txt
+
AM_CFLAGS = $(X_CFLAGS)
bin_PROGRAMS = \
diff --git a/instfiles/Makefile.am b/instfiles/Makefile.am
index 29472c5f..92cc9cf2 100644
--- a/instfiles/Makefile.am
+++ b/instfiles/Makefile.am
@@ -1,4 +1,5 @@
EXTRA_DIST = \
+ keymap-names.txt \
xrdp.sh \
xrdp-sesman.service \
xrdp.service
@@ -16,6 +17,7 @@ dist_startscript_DATA = \
km-0000040c.ini \
km-00000410.ini \
km-00000411.ini \
+ km-00000412.ini \
km-00000414.ini \
km-00000415.ini \
km-00000416.ini \
diff --git a/instfiles/km-00000412.ini b/instfiles/km-00000412.ini
new file mode 100644
index 00000000..e8cb305e
--- /dev/null
+++ b/instfiles/km-00000412.ini
@@ -0,0 +1,1057 @@
+[noshift]
+Key8=65406:0
+Key9=65307:27
+Key10=49:49
+Key11=50:50
+Key12=51:51
+Key13=52:52
+Key14=53:53
+Key15=54:54
+Key16=55:55
+Key17=56:56
+Key18=57:57
+Key19=48:48
+Key20=45:45
+Key21=61:61
+Key22=65288:8
+Key23=65289:9
+Key24=113:113
+Key25=119:119
+Key26=101:101
+Key27=114:114
+Key28=116:116
+Key29=121:121
+Key30=117:117
+Key31=105:105
+Key32=111:111
+Key33=112:112
+Key34=91:91
+Key35=93:93
+Key36=65293:13
+Key37=65507:0
+Key38=97:97
+Key39=115:115
+Key40=100:100
+Key41=102:102
+Key42=103:103
+Key43=104:104
+Key44=106:106
+Key45=107:107
+Key46=108:108
+Key47=59:59
+Key48=39:39
+Key49=96:96
+Key50=65505:0
+Key51=92:92
+Key52=122:122
+Key53=120:120
+Key54=99:99
+Key55=118:118
+Key56=98:98
+Key57=110:110
+Key58=109:109
+Key59=44:44
+Key60=46:46
+Key61=47:47
+Key62=65506:0
+Key63=65450:42
+Key64=65513:0
+Key65=32:32
+Key66=65509:0
+Key67=65470:0
+Key68=65471:0
+Key69=65472:0
+Key70=65473:0
+Key71=65474:0
+Key72=65475:0
+Key73=65476:0
+Key74=65477:0
+Key75=65478:0
+Key76=65479:0
+Key77=65407:0
+Key78=65300:0
+Key79=65429:0
+Key80=65431:0
+Key81=65434:0
+Key82=65453:45
+Key83=65430:0
+Key84=65437:0
+Key85=65432:0
+Key86=65451:43
+Key87=65436:0
+Key88=65433:0
+Key89=65435:0
+Key90=65438:0
+Key91=65439:0
+Key92=0:0
+Key93=0:0
+Key94=60:60
+Key95=65480:0
+Key96=65481:0
+Key97=65360:0
+Key98=65362:0
+Key99=65365:0
+Key100=65361:0
+Key101=0:0
+Key102=65363:0
+Key103=65367:0
+Key104=65364:0
+Key105=65366:0
+Key106=65379:0
+Key107=65535:127
+Key108=65421:13
+Key109=65508:0
+Key110=65299:0
+Key111=65377:0
+Key112=65455:47
+Key113=65514:0
+Key114=0:0
+Key115=65515:0
+Key116=65516:0
+Key117=65383:0
+Key118=0:0
+Key119=0:0
+Key120=0:0
+Key121=0:0
+Key122=0:0
+Key123=0:0
+Key124=65027:0
+Key125=0:0
+Key126=65469:61
+Key127=0:0
+Key128=0:0
+Key129=0:0
+Key130=0:0
+Key131=0:0
+Key132=0:0
+Key133=0:0
+Key134=65454:46
+Key135=0:0
+Key136=0:0
+Key137=0:0
+
+[shift]
+Key8=65406:0
+Key9=65307:27
+Key10=33:33
+Key11=64:64
+Key12=35:35
+Key13=36:36
+Key14=37:37
+Key15=94:94
+Key16=38:38
+Key17=42:42
+Key18=40:40
+Key19=41:41
+Key20=95:95
+Key21=43:43
+Key22=65288:8
+Key23=65056:0
+Key24=81:81
+Key25=87:87
+Key26=69:69
+Key27=82:82
+Key28=84:84
+Key29=89:89
+Key30=85:85
+Key31=73:73
+Key32=79:79
+Key33=80:80
+Key34=123:123
+Key35=125:125
+Key36=65293:13
+Key37=65507:0
+Key38=65:65
+Key39=83:83
+Key40=68:68
+Key41=70:70
+Key42=71:71
+Key43=72:72
+Key44=74:74
+Key45=75:75
+Key46=76:76
+Key47=58:58
+Key48=34:34
+Key49=126:126
+Key50=65505:0
+Key51=124:124
+Key52=90:90
+Key53=88:88
+Key54=67:67
+Key55=86:86
+Key56=66:66
+Key57=78:78
+Key58=77:77
+Key59=60:60
+Key60=62:62
+Key61=63:63
+Key62=65506:0
+Key63=65450:42
+Key64=65511:0
+Key65=32:32
+Key66=65509:0
+Key67=65470:0
+Key68=65471:0
+Key69=65472:0
+Key70=65473:0
+Key71=65474:0
+Key72=65475:0
+Key73=65476:0
+Key74=65477:0
+Key75=65478:0
+Key76=65479:0
+Key77=65407:0
+Key78=65300:0
+Key79=65463:55
+Key80=65464:56
+Key81=65465:57
+Key82=65453:45
+Key83=65460:52
+Key84=65461:53
+Key85=65462:54
+Key86=65451:43
+Key87=65457:49
+Key88=65458:50
+Key89=65459:51
+Key90=65456:48
+Key91=65454:46
+Key92=0:0
+Key93=0:0
+Key94=62:62
+Key95=65480:0
+Key96=65481:0
+Key97=65360:0
+Key98=65362:0
+Key99=65365:0
+Key100=65361:0
+Key101=0:0
+Key102=65363:0
+Key103=65367:0
+Key104=65364:0
+Key105=65366:0
+Key106=65379:0
+Key107=65535:127
+Key108=65421:13
+Key109=65508:0
+Key110=65299:0
+Key111=65377:0
+Key112=65455:47
+Key113=65512:0
+Key114=0:0
+Key115=65515:0
+Key116=65516:0
+Key117=65383:0
+Key118=0:0
+Key119=0:0
+Key120=0:0
+Key121=0:0
+Key122=0:0
+Key123=0:0
+Key124=65027:0
+Key125=65513:0
+Key126=65469:61
+Key127=65515:0
+Key128=65517:0
+Key129=0:0
+Key130=0:0
+Key131=0:0
+Key132=0:0
+Key133=0:0
+Key134=65454:46
+Key135=0:0
+Key136=0:0
+Key137=0:0
+
+[altgr]
+Key8=65406:0
+Key9=65307:27
+Key10=49:49
+Key11=50:50
+Key12=51:51
+Key13=52:52
+Key14=53:53
+Key15=54:54
+Key16=55:55
+Key17=56:56
+Key18=57:57
+Key19=48:48
+Key20=45:45
+Key21=61:61
+Key22=65288:8
+Key23=65289:9
+Key24=113:113
+Key25=119:119
+Key26=101:101
+Key27=114:114
+Key28=116:116
+Key29=121:121
+Key30=117:117
+Key31=105:105
+Key32=111:111
+Key33=112:112
+Key34=91:91
+Key35=93:93
+Key36=65293:13
+Key37=65507:0
+Key38=97:97
+Key39=115:115
+Key40=100:100
+Key41=102:102
+Key42=103:103
+Key43=104:104
+Key44=106:106
+Key45=107:107
+Key46=108:108
+Key47=59:59
+Key48=39:39
+Key49=96:96
+Key50=65505:0
+Key51=92:92
+Key52=122:122
+Key53=120:120
+Key54=99:99
+Key55=118:118
+Key56=98:98
+Key57=110:110
+Key58=109:109
+Key59=44:44
+Key60=46:46
+Key61=47:47
+Key62=65506:0
+Key63=65450:42
+Key64=65513:0
+Key65=32:32
+Key66=65509:0
+Key67=65470:0
+Key68=65471:0
+Key69=65472:0
+Key70=65473:0
+Key71=65474:0
+Key72=65475:0
+Key73=65476:0
+Key74=65477:0
+Key75=65478:0
+Key76=65479:0
+Key77=65407:0
+Key78=65300:0
+Key79=65429:0
+Key80=65431:0
+Key81=65434:0
+Key82=65453:45
+Key83=65430:0
+Key84=65437:0
+Key85=65432:0
+Key86=65451:43
+Key87=65436:0
+Key88=65433:0
+Key89=65435:0
+Key90=65438:0
+Key91=65439:0
+Key92=0:0
+Key93=0:0
+Key94=124:124
+Key95=65480:0
+Key96=65481:0
+Key97=65360:0
+Key98=65362:0
+Key99=65365:0
+Key100=65361:0
+Key101=0:0
+Key102=65363:0
+Key103=65367:0
+Key104=65364:0
+Key105=65366:0
+Key106=65379:0
+Key107=65535:127
+Key108=65421:13
+Key109=65508:0
+Key110=65299:0
+Key111=65377:0
+Key112=65455:47
+Key113=65514:0
+Key114=0:0
+Key115=65515:0
+Key116=65516:0
+Key117=65383:0
+Key118=0:0
+Key119=0:0
+Key120=0:0
+Key121=0:0
+Key122=0:0
+Key123=0:0
+Key124=65027:0
+Key125=0:0
+Key126=65469:61
+Key127=0:0
+Key128=0:0
+Key129=0:0
+Key130=0:0
+Key131=0:0
+Key132=0:0
+Key133=0:0
+Key134=65454:46
+Key135=0:0
+Key136=0:0
+Key137=0:0
+
+[shiftaltgr]
+Key8=65406:0
+Key9=65307:27
+Key10=33:33
+Key11=64:64
+Key12=35:35
+Key13=36:36
+Key14=37:37
+Key15=94:94
+Key16=38:38
+Key17=42:42
+Key18=40:40
+Key19=41:41
+Key20=95:95
+Key21=43:43
+Key22=65288:8
+Key23=65056:0
+Key24=81:81
+Key25=87:87
+Key26=69:69
+Key27=82:82
+Key28=84:84
+Key29=89:89
+Key30=85:85
+Key31=73:73
+Key32=79:79
+Key33=80:80
+Key34=123:123
+Key35=125:125
+Key36=65293:13
+Key37=65507:0
+Key38=65:65
+Key39=83:83
+Key40=68:68
+Key41=70:70
+Key42=71:71
+Key43=72:72
+Key44=74:74
+Key45=75:75
+Key46=76:76
+Key47=58:58
+Key48=34:34
+Key49=126:126
+Key50=65505:0
+Key51=124:124
+Key52=90:90
+Key53=88:88
+Key54=67:67
+Key55=86:86
+Key56=66:66
+Key57=78:78
+Key58=77:77
+Key59=60:60
+Key60=62:62
+Key61=63:63
+Key62=65506:0
+Key63=65450:42
+Key64=65511:0
+Key65=32:32
+Key66=65509:0
+Key67=65470:0
+Key68=65471:0
+Key69=65472:0
+Key70=65473:0
+Key71=65474:0
+Key72=65475:0
+Key73=65476:0
+Key74=65477:0
+Key75=65478:0
+Key76=65479:0
+Key77=65407:0
+Key78=65300:0
+Key79=65463:55
+Key80=65464:56
+Key81=65465:57
+Key82=65453:45
+Key83=65460:52
+Key84=65461:53
+Key85=65462:54
+Key86=65451:43
+Key87=65457:49
+Key88=65458:50
+Key89=65459:51
+Key90=65456:48
+Key91=65454:46
+Key92=0:0
+Key93=0:0
+Key94=166:166
+Key95=65480:0
+Key96=65481:0
+Key97=65360:0
+Key98=65362:0
+Key99=65365:0
+Key100=65361:0
+Key101=0:0
+Key102=65363:0
+Key103=65367:0
+Key104=65364:0
+Key105=65366:0
+Key106=65379:0
+Key107=65535:127
+Key108=65421:13
+Key109=65508:0
+Key110=65299:0
+Key111=65377:0
+Key112=65455:47
+Key113=65512:0
+Key114=0:0
+Key115=65515:0
+Key116=65516:0
+Key117=65383:0
+Key118=0:0
+Key119=0:0
+Key120=0:0
+Key121=0:0
+Key122=0:0
+Key123=0:0
+Key124=65027:0
+Key125=65513:0
+Key126=65469:61
+Key127=65515:0
+Key128=65517:0
+Key129=0:0
+Key130=0:0
+Key131=0:0
+Key132=0:0
+Key133=0:0
+Key134=65454:46
+Key135=0:0
+Key136=0:0
+Key137=0:0
+
+[capslock]
+Key8=65406:0
+Key9=65307:27
+Key10=49:49
+Key11=50:50
+Key12=51:51
+Key13=52:52
+Key14=53:53
+Key15=54:54
+Key16=55:55
+Key17=56:56
+Key18=57:57
+Key19=48:48
+Key20=45:45
+Key21=61:61
+Key22=65288:8
+Key23=65289:9
+Key24=81:81
+Key25=87:87
+Key26=69:69
+Key27=82:82
+Key28=84:84
+Key29=89:89
+Key30=85:85
+Key31=73:73
+Key32=79:79
+Key33=80:80
+Key34=91:91
+Key35=93:93
+Key36=65293:13
+Key37=65507:0
+Key38=65:65
+Key39=83:83
+Key40=68:68
+Key41=70:70
+Key42=71:71
+Key43=72:72
+Key44=74:74
+Key45=75:75
+Key46=76:76
+Key47=59:59
+Key48=39:39
+Key49=96:96
+Key50=65505:0
+Key51=92:92
+Key52=90:90
+Key53=88:88
+Key54=67:67
+Key55=86:86
+Key56=66:66
+Key57=78:78
+Key58=77:77
+Key59=44:44
+Key60=46:46
+Key61=47:47
+Key62=65506:0
+Key63=65450:42
+Key64=65513:0
+Key65=32:32
+Key66=65509:0
+Key67=65470:0
+Key68=65471:0
+Key69=65472:0
+Key70=65473:0
+Key71=65474:0
+Key72=65475:0
+Key73=65476:0
+Key74=65477:0
+Key75=65478:0
+Key76=65479:0
+Key77=65407:0
+Key78=65300:0
+Key79=65429:0
+Key80=65431:0
+Key81=65434:0
+Key82=65453:45
+Key83=65430:0
+Key84=65437:0
+Key85=65432:0
+Key86=65451:43
+Key87=65436:0
+Key88=65433:0
+Key89=65435:0
+Key90=65438:0
+Key91=65439:0
+Key92=0:0
+Key93=0:0
+Key94=60:60
+Key95=65480:0
+Key96=65481:0
+Key97=65360:0
+Key98=65362:0
+Key99=65365:0
+Key100=65361:0
+Key101=0:0
+Key102=65363:0
+Key103=65367:0
+Key104=65364:0
+Key105=65366:0
+Key106=65379:0
+Key107=65535:127
+Key108=65421:13
+Key109=65508:0
+Key110=65299:0
+Key111=65377:0
+Key112=65455:47
+Key113=65514:0
+Key114=0:0
+Key115=65515:0
+Key116=65516:0
+Key117=65383:0
+Key118=0:0
+Key119=0:0
+Key120=0:0
+Key121=0:0
+Key122=0:0
+Key123=0:0
+Key124=65027:0
+Key125=0:0
+Key126=65469:61
+Key127=0:0
+Key128=0:0
+Key129=0:0
+Key130=0:0
+Key131=0:0
+Key132=0:0
+Key133=0:0
+Key134=65454:46
+Key135=0:0
+Key136=0:0
+Key137=0:0
+
+[capslockaltgr]
+Key8=65406:0
+Key9=65307:27
+Key10=49:49
+Key11=50:50
+Key12=51:51
+Key13=52:52
+Key14=53:53
+Key15=54:54
+Key16=55:55
+Key17=56:56
+Key18=57:57
+Key19=48:48
+Key20=45:45
+Key21=61:61
+Key22=65288:8
+Key23=65289:9
+Key24=81:81
+Key25=87:87
+Key26=69:69
+Key27=82:82
+Key28=84:84
+Key29=89:89
+Key30=85:85
+Key31=73:73
+Key32=79:79
+Key33=80:80
+Key34=91:91
+Key35=93:93
+Key36=65293:13
+Key37=65507:0
+Key38=65:65
+Key39=83:83
+Key40=68:68
+Key41=70:70
+Key42=71:71
+Key43=72:72
+Key44=74:74
+Key45=75:75
+Key46=76:76
+Key47=59:59
+Key48=39:39
+Key49=96:96
+Key50=65505:0
+Key51=92:92
+Key52=90:90
+Key53=88:88
+Key54=67:67
+Key55=86:86
+Key56=66:66
+Key57=78:78
+Key58=77:77
+Key59=44:44
+Key60=46:46
+Key61=47:47
+Key62=65506:0
+Key63=65450:42
+Key64=65513:0
+Key65=32:32
+Key66=65509:0
+Key67=65470:0
+Key68=65471:0
+Key69=65472:0
+Key70=65473:0
+Key71=65474:0
+Key72=65475:0
+Key73=65476:0
+Key74=65477:0
+Key75=65478:0
+Key76=65479:0
+Key77=65407:0
+Key78=65300:0
+Key79=65429:0
+Key80=65431:0
+Key81=65434:0
+Key82=65453:45
+Key83=65430:0
+Key84=65437:0
+Key85=65432:0
+Key86=65451:43
+Key87=65436:0
+Key88=65433:0
+Key89=65435:0
+Key90=65438:0
+Key91=65439:0
+Key92=0:0
+Key93=0:0
+Key94=124:124
+Key95=65480:0
+Key96=65481:0
+Key97=65360:0
+Key98=65362:0
+Key99=65365:0
+Key100=65361:0
+Key101=0:0
+Key102=65363:0
+Key103=65367:0
+Key104=65364:0
+Key105=65366:0
+Key106=65379:0
+Key107=65535:127
+Key108=65421:13
+Key109=65508:0
+Key110=65299:0
+Key111=65377:0
+Key112=65455:47
+Key113=65514:0
+Key114=0:0
+Key115=65515:0
+Key116=65516:0
+Key117=65383:0
+Key118=0:0
+Key119=0:0
+Key120=0:0
+Key121=0:0
+Key122=0:0
+Key123=0:0
+Key124=65027:0
+Key125=0:0
+Key126=65469:61
+Key127=0:0
+Key128=0:0
+Key129=0:0
+Key130=0:0
+Key131=0:0
+Key132=0:0
+Key133=0:0
+Key134=65454:46
+Key135=0:0
+Key136=0:0
+Key137=0:0
+
+[shiftcapslock]
+Key8=65406:0
+Key9=65307:27
+Key10=33:33
+Key11=64:64
+Key12=35:35
+Key13=36:36
+Key14=37:37
+Key15=94:94
+Key16=38:38
+Key17=42:42
+Key18=40:40
+Key19=41:41
+Key20=95:95
+Key21=43:43
+Key22=65288:8
+Key23=65056:0
+Key24=113:113
+Key25=119:119
+Key26=101:101
+Key27=114:114
+Key28=116:116
+Key29=121:121
+Key30=117:117
+Key31=105:105
+Key32=111:111
+Key33=112:112
+Key34=123:123
+Key35=125:125
+Key36=65293:13
+Key37=65507:0
+Key38=97:97
+Key39=115:115
+Key40=100:100
+Key41=102:102
+Key42=103:103
+Key43=104:104
+Key44=106:106
+Key45=107:107
+Key46=108:108
+Key47=58:58
+Key48=34:34
+Key49=126:126
+Key50=65505:0
+Key51=124:124
+Key52=122:122
+Key53=120:120
+Key54=99:99
+Key55=118:118
+Key56=98:98
+Key57=110:110
+Key58=109:109
+Key59=60:60
+Key60=62:62
+Key61=63:63
+Key62=65506:0
+Key63=65450:42
+Key64=65511:0
+Key65=32:32
+Key66=65509:0
+Key67=65470:0
+Key68=65471:0
+Key69=65472:0
+Key70=65473:0
+Key71=65474:0
+Key72=65475:0
+Key73=65476:0
+Key74=65477:0
+Key75=65478:0
+Key76=65479:0
+Key77=65407:0
+Key78=65300:0
+Key79=65463:55
+Key80=65464:56
+Key81=65465:57
+Key82=65453:45
+Key83=65460:52
+Key84=65461:53
+Key85=65462:54
+Key86=65451:43
+Key87=65457:49
+Key88=65458:50
+Key89=65459:51
+Key90=65456:48
+Key91=65454:46
+Key92=0:0
+Key93=0:0
+Key94=62:62
+Key95=65480:0
+Key96=65481:0
+Key97=65360:0
+Key98=65362:0
+Key99=65365:0
+Key100=65361:0
+Key101=0:0
+Key102=65363:0
+Key103=65367:0
+Key104=65364:0
+Key105=65366:0
+Key106=65379:0
+Key107=65535:127
+Key108=65421:13
+Key109=65508:0
+Key110=65299:0
+Key111=65377:0
+Key112=65455:47
+Key113=65512:0
+Key114=0:0
+Key115=65515:0
+Key116=65516:0
+Key117=65383:0
+Key118=0:0
+Key119=0:0
+Key120=0:0
+Key121=0:0
+Key122=0:0
+Key123=0:0
+Key124=65027:0
+Key125=65513:0
+Key126=65469:61
+Key127=65515:0
+Key128=65517:0
+Key129=0:0
+Key130=0:0
+Key131=0:0
+Key132=0:0
+Key133=0:0
+Key134=65454:46
+Key135=0:0
+Key136=0:0
+Key137=0:0
+
+[shiftcapslockaltgr]
+Key8=65406:0
+Key9=65307:27
+Key10=33:33
+Key11=64:64
+Key12=35:35
+Key13=36:36
+Key14=37:37
+Key15=94:94
+Key16=38:38
+Key17=42:42
+Key18=40:40
+Key19=41:41
+Key20=95:95
+Key21=43:43
+Key22=65288:8
+Key23=65056:0
+Key24=113:113
+Key25=119:119
+Key26=101:101
+Key27=114:114
+Key28=116:116
+Key29=121:121
+Key30=117:117
+Key31=105:105
+Key32=111:111
+Key33=112:112
+Key34=123:123
+Key35=125:125
+Key36=65293:13
+Key37=65507:0
+Key38=97:97
+Key39=115:115
+Key40=100:100
+Key41=102:102
+Key42=103:103
+Key43=104:104
+Key44=106:106
+Key45=107:107
+Key46=108:108
+Key47=58:58
+Key48=34:34
+Key49=126:126
+Key50=65505:0
+Key51=124:124
+Key52=122:122
+Key53=120:120
+Key54=99:99
+Key55=118:118
+Key56=98:98
+Key57=110:110
+Key58=109:109
+Key59=60:60
+Key60=62:62
+Key61=63:63
+Key62=65506:0
+Key63=65450:42
+Key64=65511:0
+Key65=32:32
+Key66=65509:0
+Key67=65470:0
+Key68=65471:0
+Key69=65472:0
+Key70=65473:0
+Key71=65474:0
+Key72=65475:0
+Key73=65476:0
+Key74=65477:0
+Key75=65478:0
+Key76=65479:0
+Key77=65407:0
+Key78=65300:0
+Key79=65463:55
+Key80=65464:56
+Key81=65465:57
+Key82=65453:45
+Key83=65460:52
+Key84=65461:53
+Key85=65462:54
+Key86=65451:43
+Key87=65457:49
+Key88=65458:50
+Key89=65459:51
+Key90=65456:48
+Key91=65454:46
+Key92=0:0
+Key93=0:0
+Key94=166:166
+Key95=65480:0
+Key96=65481:0
+Key97=65360:0
+Key98=65362:0
+Key99=65365:0
+Key100=65361:0
+Key101=0:0
+Key102=65363:0
+Key103=65367:0
+Key104=65364:0
+Key105=65366:0
+Key106=65379:0
+Key107=65535:127
+Key108=65421:13
+Key109=65508:0
+Key110=65299:0
+Key111=65377:0
+Key112=65455:47
+Key113=65512:0
+Key114=0:0
+Key115=65515:0
+Key116=65516:0
+Key117=65383:0
+Key118=0:0
+Key119=0:0
+Key120=0:0
+Key121=0:0
+Key122=0:0
+Key123=0:0
+Key124=65027:0
+Key125=65513:0
+Key126=65469:61
+Key127=65515:0
+Key128=65517:0
+Key129=0:0
+Key130=0:0
+Key131=0:0
+Key132=0:0
+Key133=0:0
+Key134=65454:46
+Key135=0:0
+Key136=0:0
+Key137=0:0
+Key209=65329:0
+Key210=65332:0
diff --git a/libpainter b/libpainter
new file mode 160000
+Subproject 15e9448f7cd770095d514ff1f6cf470d68245be
diff --git a/librfxcodec b/librfxcodec
-Subproject fb80d7d38c914af756eecb87762ea1cbb4df448
+Subproject 29fdb8f029bc887d30e0f5c097d2dee820225f3
diff --git a/libxrdp/Makefile.am b/libxrdp/Makefile.am
index b7d1dc26..bd044d77 100644
--- a/libxrdp/Makefile.am
+++ b/libxrdp/Makefile.am
@@ -1,3 +1,6 @@
+EXTRA_DIST = \
+ xrdp_surface.c
+
AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c
index c3763bf5..2d59621a 100644
--- a/libxrdp/libxrdp.c
+++ b/libxrdp/libxrdp.c
@@ -1332,13 +1332,13 @@ libxrdp_fastpath_send_surface(struct xrdp_session *session,
s->rdp_hdr = s->sec_hdr + sec_bytes;
s->end = data_pad + pad_bytes + data_bytes;
s->p = s->data + (rdp_bytes + sec_bytes);
- /* TS_SURFCMD_SET_SURF_BITS */
- out_uint16_le(s, 0x0001); /* CMDTYPE_SET_SURFACE_BITS */
+ /* TS_SURFCMD_STREAM_SURF_BITS */
+ out_uint16_le(s, CMDTYPE_STREAM_SURFACE_BITS);
out_uint16_le(s, destLeft);
out_uint16_le(s, destTop);
out_uint16_le(s, destRight);
out_uint16_le(s, destBottom);
- /* TS_ BITMAP_DATA_EX */
+ /* TS_BITMAP_DATA_EX */
out_uint8(s, bpp);
out_uint8(s, 0);
out_uint8(s, 0);
diff --git a/libxrdp/xrdp_bitmap32_compress.c b/libxrdp/xrdp_bitmap32_compress.c
index 083c4409..daec9f28 100644
--- a/libxrdp/xrdp_bitmap32_compress.c
+++ b/libxrdp/xrdp_bitmap32_compress.c
@@ -107,7 +107,7 @@ fsplit3(char *in_data, int start_line, int width, int e,
}
start_line--;
cy++;
- if (out_index > 64 * 64)
+ if (out_index + width + e > 64 * 64)
{
break;
}
@@ -195,7 +195,7 @@ fsplit4(char *in_data, int start_line, int width, int e,
}
start_line--;
cy++;
- if (out_index > 64 * 64)
+ if (out_index + width + e > 64 * 64)
{
break;
}
@@ -422,6 +422,7 @@ xrdp_bitmap32_compress(char *in_data, int width, int height,
char *sr_data;
char *sg_data;
char *sb_data;
+ char *hold_p;
int a_bytes;
int r_bytes;
int g_bytes;
@@ -449,6 +450,7 @@ xrdp_bitmap32_compress(char *in_data, int width, int height,
r_data = a_data + max_bytes;
g_data = r_data + max_bytes;
b_data = g_data + max_bytes;
+ hold_p = s->p;
if (header & FLAGS_NOALPHA)
{
@@ -459,35 +461,44 @@ xrdp_bitmap32_compress(char *in_data, int width, int height,
fdelta(sr_data, r_data, cx, cy);
fdelta(sg_data, g_data, cx, cy);
fdelta(sb_data, b_data, cx, cy);
- out_uint8(s, header);
- r_bytes = fpack(r_data, cx, cy, s);
- g_bytes = fpack(g_data, cx, cy, s);
- b_bytes = fpack(b_data, cx, cy, s);
- total_bytes = r_bytes + g_bytes + b_bytes;
- if (1 + total_bytes > byte_limit)
+ while (cy > 0)
{
- /* failed */
- LLOGLN(0, ("xrdp_bitmap32_compress: too big, rgb "
- "bytes %d %d %d total_bytes %d cx %d cy %d "
- "byte_limit %d", r_bytes, g_bytes, b_bytes,
- total_bytes, cx, cy, byte_limit));
- return 0;
- }
- max_bytes = cx * cy * 3;
- if (total_bytes > max_bytes)
- {
- /* raw is better */
- LLOGLN(10, ("xrdp_bitmap32_compress: too big, rgb "
- "bytes %d %d %d total_bytes %d cx %d cy %d "
- "max_bytes %d", r_bytes, g_bytes, b_bytes,
- total_bytes, cx, cy, max_bytes));
- init_stream(s, 0);
- foutraw3(s, cx * cy, FLAGS_NOALPHA, sr_data, sg_data, sb_data);
+ s->p = hold_p;
+ out_uint8(s, header);
+ r_bytes = fpack(r_data, cx, cy, s);
+ g_bytes = fpack(g_data, cx, cy, s);
+ b_bytes = fpack(b_data, cx, cy, s);
+ max_bytes = cx * cy * 3;
+ total_bytes = r_bytes + g_bytes + b_bytes;
+ if (total_bytes > max_bytes)
+ {
+ if (2 + max_bytes <= byte_limit)
+ {
+ s->p = hold_p;
+ foutraw3(s, cx * cy, FLAGS_NOALPHA, sr_data, sg_data, sb_data);
+ break;
+ }
+ }
+ if (1 + total_bytes <= byte_limit)
+ {
+ break;
+ }
+ cy--;
}
}
else
{
- foutraw3(s, cx * cy, FLAGS_NOALPHA, sr_data, sg_data, sb_data);
+ while (cy > 0)
+ {
+ max_bytes = cx * cy * 3;
+ if (2 + max_bytes <= byte_limit)
+ {
+ s->p = hold_p;
+ foutraw3(s, cx * cy, FLAGS_NOALPHA, sr_data, sg_data, sb_data);
+ break;
+ }
+ cy--;
+ }
}
}
else
@@ -500,36 +511,45 @@ xrdp_bitmap32_compress(char *in_data, int width, int height,
fdelta(sr_data, r_data, cx, cy);
fdelta(sg_data, g_data, cx, cy);
fdelta(sb_data, b_data, cx, cy);
- out_uint8(s, header);
- a_bytes = fpack(a_data, cx, cy, s);
- r_bytes = fpack(r_data, cx, cy, s);
- g_bytes = fpack(g_data, cx, cy, s);
- b_bytes = fpack(b_data, cx, cy, s);
- max_bytes = cx * cy * 4;
- total_bytes = a_bytes + r_bytes + g_bytes + b_bytes;
- if (1 + total_bytes > byte_limit)
+ while (cy > 0)
{
- /* failed */
- LLOGLN(0, ("xrdp_bitmap32_compress: too big, argb "
- "bytes %d %d %d %d total_bytes %d cx %d cy %d "
- "byte_limit %d", a_bytes, r_bytes, g_bytes, b_bytes,
- total_bytes, cx, cy, byte_limit));
- return 0;
- }
- if (total_bytes > max_bytes)
- {
- /* raw is better */
- LLOGLN(10, ("xrdp_bitmap32_compress: too big, argb "
- "bytes %d %d %d %d total_bytes %d cx %d cy %d "
- "max_bytes %d", a_bytes, r_bytes, g_bytes, b_bytes,
- total_bytes, cx, cy, max_bytes));
- init_stream(s, 0);
- foutraw4(s, cx * cy, 0, sa_data, sr_data, sg_data, sb_data);
+ s->p = hold_p;
+ out_uint8(s, header);
+ a_bytes = fpack(a_data, cx, cy, s);
+ r_bytes = fpack(r_data, cx, cy, s);
+ g_bytes = fpack(g_data, cx, cy, s);
+ b_bytes = fpack(b_data, cx, cy, s);
+ max_bytes = cx * cy * 4;
+ total_bytes = a_bytes + r_bytes + g_bytes + b_bytes;
+ if (total_bytes > max_bytes)
+ {
+ if (2 + max_bytes <= byte_limit)
+ {
+ s->p = hold_p;
+ foutraw4(s, cx * cy, 0, sa_data, sr_data, sg_data, sb_data);
+ break;
+ }
+ }
+ if (1 + total_bytes <= byte_limit)
+ {
+ break;
+ }
+ cy--;
}
}
else
{
- foutraw4(s, cx * cy, 0, sa_data, sr_data, sg_data, sb_data);
+ while (cy > 0)
+ {
+ max_bytes = cx * cy * 4;
+ if (2 + max_bytes <= byte_limit)
+ {
+ s->p = hold_p;
+ foutraw4(s, cx * cy, 0, sa_data, sr_data, sg_data, sb_data);
+ break;
+ }
+ cy--;
+ }
}
}
return cy;
diff --git a/libxrdp/xrdp_bitmap_compress.c b/libxrdp/xrdp_bitmap_compress.c
index 03c56f10..56898776 100644
--- a/libxrdp/xrdp_bitmap_compress.c
+++ b/libxrdp/xrdp_bitmap_compress.c
@@ -22,6 +22,8 @@
#include "libxrdp.h"
+#define BC_MAX_BYTES (16 * 1024)
+
/*****************************************************************************/
#define IN_PIXEL8(in_ptr, in_x, in_y, in_w, in_last_pixel, in_pixel); \
do { \
@@ -695,7 +697,7 @@ xrdp_bitmap_compress(char *in_data, int width, int height,
out_count = end;
line = in_data + width * start_line;
- while (start_line >= 0 && out_count < 32768)
+ while (start_line >= 0 && out_count <= BC_MAX_BYTES)
{
i = (s->p - s->data) + count;
@@ -987,7 +989,7 @@ xrdp_bitmap_compress(char *in_data, int width, int height,
out_count = end * 2;
line = in_data + width * start_line * 2;
- while (start_line >= 0 && out_count < 32768)
+ while (start_line >= 0 && out_count <= BC_MAX_BYTES)
{
i = (s->p - s->data) + count * 2;
@@ -1279,7 +1281,7 @@ xrdp_bitmap_compress(char *in_data, int width, int height,
out_count = end * 3;
line = in_data + width * start_line * 4;
- while (start_line >= 0 && out_count < 32768)
+ while (start_line >= 0 && out_count <= BC_MAX_BYTES)
{
i = (s->p - s->data) + count * 3;
diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c
index de76c550..f4e18395 100644
--- a/libxrdp/xrdp_caps.c
+++ b/libxrdp/xrdp_caps.c
@@ -466,7 +466,7 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len)
if (g_memcmp(codec_guid, XR_CODEC_GUID_NSCODEC, 16) == 0)
{
- g_writeln("xrdp_caps_process_codecs: nscodec codec id %d prop len %d",
+ g_writeln("xrdp_caps_process_codecs: nscodec, codec id %d, properties len %d",
codec_id, codec_properties_length);
self->client_info.ns_codec_id = codec_id;
i1 = MIN(64, codec_properties_length);
@@ -475,7 +475,7 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len)
}
else if (g_memcmp(codec_guid, XR_CODEC_GUID_REMOTEFX, 16) == 0)
{
- g_writeln("xrdp_caps_process_codecs: rfx codec id %d prop len %d",
+ g_writeln("xrdp_caps_process_codecs: RemoteFX, codec id %d, properties len %d",
codec_id, codec_properties_length);
self->client_info.rfx_codec_id = codec_id;
i1 = MIN(64, codec_properties_length);
@@ -484,7 +484,7 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len)
}
else if (g_memcmp(codec_guid, XR_CODEC_GUID_JPEG, 16) == 0)
{
- g_writeln("xrdp_caps_process_codecs: jpeg codec id %d prop len %d",
+ g_writeln("xrdp_caps_process_codecs: jpeg, codec id %d, properties len %d",
codec_id, codec_properties_length);
self->client_info.jpeg_codec_id = codec_id;
i1 = MIN(64, codec_properties_length);
@@ -501,7 +501,7 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len)
}
else if (g_memcmp(codec_guid, XR_CODEC_GUID_H264, 16) == 0)
{
- g_writeln("xrdp_caps_process_codecs: h264 codec id %d prop len %d",
+ g_writeln("xrdp_caps_process_codecs: h264, codec id %d, properties len %d",
codec_id, codec_properties_length);
self->client_info.h264_codec_id = codec_id;
i1 = MIN(64, codec_properties_length);
@@ -543,6 +543,18 @@ xrdp_caps_process_frame_ack(struct xrdp_rdp *self, struct stream *s, int len)
}
/*****************************************************************************/
+static int APP_CC
+xrdp_caps_process_surface_cmds(struct xrdp_rdp *self, struct stream *s, int len)
+{
+ int cmdFlags;
+ g_writeln("xrdp_caps_process_surface_cmds:");
+ in_uint32_le(s, cmdFlags);
+ in_uint8s(s, 4); /* reserved */
+ g_writeln(" cmdFlags 0x%08x", cmdFlags);
+ return 0;
+}
+
+/*****************************************************************************/
int APP_CC
xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s)
{
@@ -668,6 +680,9 @@ xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s)
case 0x001E: /* CAPSSETTYPE_FRAME_ACKNOWLEDGE */
xrdp_caps_process_frame_ack(self, s, len);
break;
+ case RDP_CAPSET_SURFCMDS: /* CAPSETTYPE_SURFACE_COMMANDS */
+ xrdp_caps_process_surface_cmds(self, s, len);
+ break;
default:
g_writeln("unknown in xrdp_caps_process_confirm_active %d", type);
break;
@@ -847,22 +862,30 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
codec_caps_count++;
out_uint8a(s, XR_CODEC_GUID_NSCODEC, 16);
out_uint8(s, 1); /* codec id, must be 1 */
- out_uint16_le(s, 3);
+ out_uint16_le(s, 3); /* codecPropertiesLength */
out_uint8(s, 0x01); /* fAllowDynamicFidelity */
out_uint8(s, 0x01); /* fAllowSubsampling */
out_uint8(s, 0x03); /* colorLossLevel */
+#if defined(XRDP_RFXCODEC) || defined(XRDP_NEUTRINORDP)
/* remotefx */
codec_caps_count++;
out_uint8a(s, XR_CODEC_GUID_REMOTEFX, 16);
out_uint8(s, 0); /* codec id, client sets */
- out_uint16_le(s, 256);
- out_uint8s(s, 256);
+ out_uint16_le(s, 4); /* codecPropertiesLength */
+ out_uint32_le(s, 0); /* reserved */
+ /* image remotefx */
+ codec_caps_count++;
+ out_uint8a(s, XR_CODEC_GUID_IMAGE_REMOTEFX, 16);
+ out_uint8(s, 0); /* codec id, client sets */
+ out_uint16_le(s, 4); /* codecPropertiesLength */
+ out_uint32_le(s, 0); /* reserved */
+#endif
/* jpeg */
codec_caps_count++;
out_uint8a(s, XR_CODEC_GUID_JPEG, 16);
out_uint8(s, 0); /* codec id, client sets */
- out_uint16_le(s, 1); /* ext length */
- out_uint8(s, 75);
+ out_uint16_le(s, 1); /* codecPropertiesLength */
+ out_uint8(s, 75); /* jpeg compression ratio */
/* calculate and set size and count */
codec_caps_size = (int)(s->p - codec_caps_size_ptr);
codec_caps_size += 2; /* 2 bytes for RDP_CAPSET_BMPCODECS above */
@@ -890,16 +913,10 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
out_uint16_le(s, RDP_CAPSET_INPUT); /* 13(0xd) */
out_uint16_le(s, RDP_CAPLEN_INPUT); /* 88(0x58) */
- /* INPUT_FLAG_SCANCODES 0x0001
- INPUT_FLAG_MOUSEX 0x0004
- INPUT_FLAG_FASTPATH_INPUT 0x0008
- INPUT_FLAG_FASTPATH_INPUT2 0x0020 */
- flags = 0x0001 | 0x0004;
+ flags = INPUT_FLAG_SCANCODES | INPUT_FLAG_MOUSEX | INPUT_FLAG_UNICODE;
if (self->client_info.use_fast_path & 2)
{
- /* 0x0008 INPUT_FLAG_FASTPATH_INPUT */
- /* 0x0020 INPUT_FLAG_FASTPATH_INPUT2 */
- flags |= 0x0008 | 0x0020;
+ flags |= INPUT_FLAG_FASTPATH_INPUT | INPUT_FLAG_FASTPATH_INPUT2;
}
out_uint16_le(s, flags);
out_uint8s(s, 82);
@@ -925,19 +942,29 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
out_uint16_le(s, 5);
out_uint8(s, 0); /* client sets */
- if (self->client_info.use_fast_path & 1) /* fastpath output on */
+ if (self->client_info.use_fast_path & FASTPATH_OUTPUT_SUPPORTED) /* fastpath output on */
{
+ /* multifragment update */
caps_count++;
- out_uint16_le(s, 0x001A); /* 26 CAPSETTYPE_MULTIFRAGMENTUPDATE */
- out_uint16_le(s, 8);
+ out_uint16_le(s, RDP_CAPSET_MULTIFRAGMENT); /* 26 CAPSETTYPE_MULTIFRAGMENTUPDATE */
+ out_uint16_le(s, RDP_CAPLEN_MULTIFRAGMENT);
out_uint32_le(s, 3 * 1024 * 1024); /* 3MB */
- }
- /* frame acks */
- caps_count++;
- out_uint16_le(s, 0x001E); /* CAPSETTYPE_FRAME_ACKNOWLEDGE */
- out_uint16_le(s, 8);
- out_uint32_le(s, 2); /* 2 frames in flight */
+ /* frame acks */
+ caps_count++;
+ out_uint16_le(s, RDP_CAPSET_FRAME_ACKNOWLEDGE); /* CAPSETTYPE_FRAME_ACKNOWLEDGE */
+ out_uint16_le(s, RDP_CAPLEN_FRAME_ACKNOWLEDGE);
+ out_uint32_le(s, 2); /* 2 frames in flight */
+
+ /* surface commands */
+ caps_count++;
+ out_uint16_le(s, RDP_CAPSET_SURFCMDS); /* CAPSETTYPE_SURFACE_COMMANDS */
+ out_uint16_le(s, RDP_CAPLEN_SURFCMDS); /* lengthCapability */
+ out_uint32_le(s, (SURFCMDS_SETSURFACEBITS |
+ SURFCMDS_FRAMEMARKER |
+ SURFCMDS_STREAMSUFRACEBITS)); /* cmdFlags */
+ out_uint32_le(s, 0); /* reserved */
+ }
out_uint8s(s, 4); /* pad */
diff --git a/libxrdp/xrdp_fastpath.c b/libxrdp/xrdp_fastpath.c
index 008c8289..33e9c9d0 100644
--- a/libxrdp/xrdp_fastpath.c
+++ b/libxrdp/xrdp_fastpath.c
@@ -265,12 +265,30 @@ static int APP_CC
xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self,
int eventFlags, struct stream *s)
{
- if (!s_check_rem(s, 2))
- {
- return 1;
- }
- in_uint8s(s, 2);
- return 0;
+ int flags;
+ int code;
+
+ flags = 0;
+ if (!s_check_rem(s, 2))
+ {
+ return 1;
+ }
+ in_uint16_le(s, code); /* unicode (2 byte) */
+ if (eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE)
+ {
+ flags |= KBD_FLAG_UP;
+ }
+ else
+ {
+ flags |= KBD_FLAG_DOWN;
+ }
+ if (eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED)
+ {
+ flags |= KBD_FLAG_EXT;
+ }
+ xrdp_fastpath_session_callback(self, RDP_INPUT_UNICODE,
+ code, 0, flags, 0);
+ return 0;
}
/*****************************************************************************/
diff --git a/libxrdp/xrdp_jpeg_compress.c b/libxrdp/xrdp_jpeg_compress.c
index 385203a6..755c20bd 100644
--- a/libxrdp/xrdp_jpeg_compress.c
+++ b/libxrdp/xrdp_jpeg_compress.c
@@ -365,11 +365,14 @@ jpeg_compress(char *in_data, int width, int height,
*(dst8++) = red;
}
- for (i = 0; i < e; i++)
+ if (width > 0)
{
- *(dst8++) = blue;
- *(dst8++) = green;
- *(dst8++) = red;
+ for (i = 0; i < e; i++)
+ {
+ *(dst8++) = blue;
+ *(dst8++) = green;
+ *(dst8++) = red;
+ }
}
}
}
diff --git a/libxrdp/xrdp_orders.c b/libxrdp/xrdp_orders.c
index 18a5ad38..b0c28ed8 100644
--- a/libxrdp/xrdp_orders.c
+++ b/libxrdp/xrdp_orders.c
@@ -2235,6 +2235,11 @@ xrdp_orders_send_raw_bitmap(struct xrdp_orders *self,
Bpp = (bpp + 7) / 8;
bufsize = (width + e) * height * Bpp;
+ while (bufsize + 16 > MAX_ORDERS_SIZE)
+ {
+ height--;
+ bufsize = (width + e) * height * Bpp;
+ }
if (xrdp_orders_check(self, bufsize + 16) != 0)
{
return 1;
@@ -2254,33 +2259,58 @@ xrdp_orders_send_raw_bitmap(struct xrdp_orders *self,
out_uint16_le(self->out_s, bufsize);
out_uint16_le(self->out_s, cache_idx);
- for (i = height - 1; i >= 0; i--)
+ if (Bpp == 4)
{
- for (j = 0; j < width; j++)
+ for (i = height - 1; i >= 0; i--)
{
- if (Bpp == 3)
+ for (j = 0; j < width; j++)
{
pixel = GETPIXEL32(data, j, i, width);
out_uint8(self->out_s, pixel);
out_uint8(self->out_s, pixel >> 8);
out_uint8(self->out_s, pixel >> 16);
+ out_uint8(self->out_s, pixel >> 24);
}
- else if (Bpp == 2)
+ out_uint8s(self->out_s, Bpp * e);
+ }
+ }
+ else if (Bpp == 3)
+ {
+ for (i = height - 1; i >= 0; i--)
+ {
+ for (j = 0; j < width; j++)
{
- pixel = GETPIXEL16(data, j, i, width);
+ pixel = GETPIXEL32(data, j, i, width);
out_uint8(self->out_s, pixel);
out_uint8(self->out_s, pixel >> 8);
+ out_uint8(self->out_s, pixel >> 16);
}
- else if (Bpp == 1)
+ out_uint8s(self->out_s, Bpp * e);
+ }
+ }
+ else if (Bpp == 2)
+ {
+ for (i = height - 1; i >= 0; i--)
+ {
+ for (j = 0; j < width; j++)
{
- pixel = GETPIXEL8(data, j, i, width);
+ pixel = GETPIXEL16(data, j, i, width);
out_uint8(self->out_s, pixel);
+ out_uint8(self->out_s, pixel >> 8);
}
+ out_uint8s(self->out_s, Bpp * e);
}
-
- for (j = 0; j < e; j++)
+ }
+ else if (Bpp == 1)
+ {
+ for (i = height - 1; i >= 0; i--)
{
- out_uint8s(self->out_s, Bpp);
+ for (j = 0; j < width; j++)
+ {
+ pixel = GETPIXEL8(data, j, i, width);
+ out_uint8(self->out_s, pixel);
+ }
+ out_uint8s(self->out_s, Bpp * e);
}
}
@@ -2334,20 +2364,19 @@ xrdp_orders_send_bitmap(struct xrdp_orders *self,
if (bpp > 24)
{
lines_sending = xrdp_bitmap32_compress(data, width, height, s,
- bpp, 16384,
+ bpp, MAX_ORDERS_SIZE,
i - 1, temp_s, e, 0x10);
}
else
{
- lines_sending = xrdp_bitmap_compress(data, width, height, s, bpp, 16384,
+ lines_sending = xrdp_bitmap_compress(data, width, height, s,
+ bpp, MAX_ORDERS_SIZE,
i - 1, temp_s, e);
}
if (lines_sending != height)
{
- g_writeln("error in xrdp_orders_send_bitmap, lines_sending(%d) != \
-height(%d)", lines_sending, height);
- return 1;
+ height = lines_sending;
}
bufsize = (int)(s->p - p);
@@ -2458,6 +2487,7 @@ xrdp_orders_send_raw_bitmap2(struct xrdp_orders *self,
int pixel = 0;
int e = 0;
+ g_writeln("xrdp_orders_send_raw_bitmap2:");
if (width > 64)
{
g_writeln("error, width > 64");
@@ -2479,6 +2509,11 @@ xrdp_orders_send_raw_bitmap2(struct xrdp_orders *self,
Bpp = (bpp + 7) / 8;
bufsize = (width + e) * height * Bpp;
+ while (bufsize + 14 > MAX_ORDERS_SIZE)
+ {
+ height--;
+ bufsize = (width + e) * height * Bpp;
+ }
if (xrdp_orders_check(self, bufsize + 14) != 0)
{
return 1;
@@ -2499,7 +2534,7 @@ xrdp_orders_send_raw_bitmap2(struct xrdp_orders *self,
i = cache_idx & 0xff;
out_uint8(self->out_s, i);
- if (1 && Bpp == 3)
+ if (Bpp == 4)
{
for (i = height - 1; i >= 0; i--)
{
@@ -2509,44 +2544,49 @@ xrdp_orders_send_raw_bitmap2(struct xrdp_orders *self,
out_uint8(self->out_s, pixel);
out_uint8(self->out_s, pixel >> 8);
out_uint8(self->out_s, pixel >> 16);
+ out_uint8(self->out_s, pixel >> 24);
}
- for (j = 0; j < e; j++)
- {
- out_uint8s(self->out_s, Bpp);
- }
+ out_uint8s(self->out_s, Bpp * e);
}
}
- else
- {
- for (i = height - 1; i >= 0; i--)
+ else if (Bpp == 3)
{
- for (j = 0; j < width; j++)
+ for (i = height - 1; i >= 0; i--)
{
- if (Bpp == 3)
+ for (j = 0; j < width; j++)
{
pixel = GETPIXEL32(data, j, i, width);
out_uint8(self->out_s, pixel);
out_uint8(self->out_s, pixel >> 8);
out_uint8(self->out_s, pixel >> 16);
}
- else if (Bpp == 2)
+ out_uint8s(self->out_s, Bpp * e);
+ }
+ }
+ else if (Bpp == 2)
+ {
+ for (i = height - 1; i >= 0; i--)
+ {
+ for (j = 0; j < width; j++)
{
pixel = GETPIXEL16(data, j, i, width);
out_uint8(self->out_s, pixel);
out_uint8(self->out_s, pixel >> 8);
}
- else if (Bpp == 1)
+ out_uint8s(self->out_s, Bpp * e);
+ }
+ }
+ else if (Bpp == 1)
+ {
+ for (i = height - 1; i >= 0; i--)
+ {
+ for (j = 0; j < width; j++)
{
pixel = GETPIXEL8(data, j, i, width);
out_uint8(self->out_s, pixel);
}
+ out_uint8s(self->out_s, Bpp * e);
}
-
- for (j = 0; j < e; j++)
- {
- out_uint8s(self->out_s, Bpp);
- }
- }
}
return 0;
@@ -2599,20 +2639,19 @@ xrdp_orders_send_bitmap2(struct xrdp_orders *self,
if (bpp > 24)
{
lines_sending = xrdp_bitmap32_compress(data, width, height, s,
- bpp, 16384,
+ bpp, MAX_ORDERS_SIZE,
i - 1, temp_s, e, 0x10);
}
else
{
- lines_sending = xrdp_bitmap_compress(data, width, height, s, bpp, 16384,
+ lines_sending = xrdp_bitmap_compress(data, width, height, s,
+ bpp, MAX_ORDERS_SIZE,
i - 1, temp_s, e);
}
if (lines_sending != height)
{
- g_writeln("error in xrdp_orders_send_bitmap2, lines_sending(%d) != \
-height(%d)", lines_sending, height);
- return 1;
+ height = lines_sending;
}
bufsize = (int)(s->p - p);
diff --git a/neutrinordp/Makefile.am b/neutrinordp/Makefile.am
index d3adc756..fb5bf030 100644
--- a/neutrinordp/Makefile.am
+++ b/neutrinordp/Makefile.am
@@ -17,6 +17,7 @@ module_LTLIBRARIES = \
libxrdpneutrinordp_la_SOURCES = \
xrdp-color.c \
+ xrdp-color.h \
xrdp-neutrinordp.c \
xrdp-neutrinordp.h
diff --git a/sesman/Makefile.am b/sesman/Makefile.am
index 68dba28e..89b99f54 100644
--- a/sesman/Makefile.am
+++ b/sesman/Makefile.am
@@ -1,3 +1,6 @@
+EXTRA_DIST = \
+ Doxyfile
+
AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
@@ -54,6 +57,8 @@ xrdp_sesman_SOURCES = \
session.h \
sig.c \
sig.h \
+ xauth.c \
+ xauth.h \
$(AUTH_C)
xrdp_sesman_LDADD = \
diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am
index 221437e9..7a2672a8 100644
--- a/sesman/chansrv/Makefile.am
+++ b/sesman/chansrv/Makefile.am
@@ -1,3 +1,9 @@
+EXTRA_DIST = \
+ clipboard-notes.txt \
+ pcsc \
+ pulse \
+ wave-format-server.txt
+
AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
diff --git a/sesman/env.c b/sesman/env.c
index 1a4fa679..d8eb3106 100644
--- a/sesman/env.c
+++ b/sesman/env.c
@@ -150,7 +150,7 @@ env_set_user(const char *username, char **passwd_file, int display,
if (0 == g_cfg->auth_file_path)
{
/* if no auth_file_path is set, then we go for
- $HOME/.vnc/sesman_username_passwd */
+ $HOME/.vnc/sesman_username_passwd:DISPLAY */
if (!g_directory_exist(".vnc"))
{
if (g_mkdir(".vnc") < 0)
@@ -161,12 +161,24 @@ env_set_user(const char *username, char **passwd_file, int display,
}
}
- len = g_snprintf(NULL, 0, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
+ len = g_snprintf(NULL, 0, "%s/.vnc/sesman_%s_passwd:%d",
+ pw_dir, username, display);
*passwd_file = (char *) g_malloc(len + 1, 1);
if (*passwd_file != NULL)
{
- g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
+ /* Try legacy name first, remove if found */
+ g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd",
+ pw_dir, username);
+ if (g_file_exist(*passwd_file))
+ {
+ log_message(LOG_LEVEL_WARNING, "Removing insecure "
+ "password file %s", *passwd_file);
+ g_file_delete(*passwd_file);
+ }
+
+ g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd:%d",
+ pw_dir, username, display);
}
}
else
diff --git a/sesman/session.c b/sesman/session.c
index 783665cf..4e51867f 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -39,6 +39,7 @@
#include "sesman.h"
#include "libscp_types.h"
+#include "xauth.h"
#ifndef PR_SET_NO_NEW_PRIVS
#define PR_SET_NO_NEW_PRIVS 38
@@ -441,6 +442,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_SESSION *s)
struct list *xserver_params = (struct list *)NULL;
struct tm stime;
time_t ltime;
+ char authfile[256]; /* The filename for storing xauth informations */
/* initialize (zero out) local variables: */
g_memset(&ltime, 0, sizeof(time_t));
@@ -676,6 +678,22 @@ session_start_fork(tbus data, tui8 type, struct SCP_SESSION *s)
g_snprintf(text, 255, "%d", g_cfg->sess.kill_disconnected);
g_setenv("XRDP_SESMAN_KILL_DISCONNECTED", text, 1);
+ /* prepare the Xauthority stuff */
+ if (g_getenv("XAUTHORITY") != NULL)
+ {
+ g_snprintf(authfile, 255, "%s", g_getenv("XAUTHORITY"));
+ }
+ else
+ {
+ g_snprintf(authfile, 255, "%s", ".Xauthority");
+ }
+
+ /* Add the entry in XAUTHORITY file or exit if error */
+ if (add_xauth_cookie(display, authfile) != 0)
+ {
+ g_exit(1);
+ }
+
if (type == SESMAN_SESSION_TYPE_XORG)
{
#ifdef HAVE_SYS_PRCTL_H
@@ -702,6 +720,8 @@ session_start_fork(tbus data, tui8 type, struct SCP_SESSION *s)
/* these are the must have parameters */
list_add_item(xserver_params, (tintptr) g_strdup(xserver));
list_add_item(xserver_params, (tintptr) g_strdup(screen));
+ list_add_item(xserver_params, (tintptr) g_strdup("-auth"));
+ list_add_item(xserver_params, (tintptr) g_strdup(authfile));
/* additional parameters from sesman.ini file */
list_append_list_strdup(g_cfg->xorg_params, xserver_params, 1);
@@ -737,6 +757,8 @@ session_start_fork(tbus data, tui8 type, struct SCP_SESSION *s)
/* these are the must have parameters */
list_add_item(xserver_params, (tintptr)g_strdup(xserver));
list_add_item(xserver_params, (tintptr)g_strdup(screen));
+ list_add_item(xserver_params, (tintptr)g_strdup("-auth"));
+ list_add_item(xserver_params, (tintptr)g_strdup(authfile));
list_add_item(xserver_params, (tintptr)g_strdup("-geometry"));
list_add_item(xserver_params, (tintptr)g_strdup(geometry));
list_add_item(xserver_params, (tintptr)g_strdup("-depth"));
@@ -768,6 +790,8 @@ session_start_fork(tbus data, tui8 type, struct SCP_SESSION *s)
/* these are the must have parameters */
list_add_item(xserver_params, (tintptr)g_strdup(xserver));
list_add_item(xserver_params, (tintptr)g_strdup(screen));
+ list_add_item(xserver_params, (tintptr)g_strdup("-auth"));
+ list_add_item(xserver_params, (tintptr)g_strdup(authfile));
list_add_item(xserver_params, (tintptr)g_strdup("-geometry"));
list_add_item(xserver_params, (tintptr)g_strdup(geometry));
list_add_item(xserver_params, (tintptr)g_strdup("-depth"));
diff --git a/sesman/xauth.c b/sesman/xauth.c
new file mode 100644
index 00000000..003fb866
--- /dev/null
+++ b/sesman/xauth.c
@@ -0,0 +1,62 @@
+/**
+ * xrdp: A Remote Desktop Protocol server.
+ *
+ * Copyright (C) Emmanuel Blindauer 2016
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ *
+ * @file xauth.c
+ * @brief XAUTHORITY handling code
+ *
+ */
+
+#include <stdio.h>
+#include "log.h"
+#include "os_calls.h"
+
+
+/******************************************************************************/
+int DEFAULT_CC
+add_xauth_cookie(int display, const char *file)
+{
+ FILE *dp;
+ char cookie_str[33];
+ char cookie_bin[16];
+ char xauth_str[256];
+ int ret;
+
+ g_random(cookie_bin, 16);
+ g_bytes_to_hexstr(cookie_bin, 16, cookie_str, 33);
+
+ g_sprintf(xauth_str, "xauth -q -f %s add :%d . %s",
+ file, display, cookie_str);
+
+ dp = popen(xauth_str, "r");
+ if (dp == NULL)
+ {
+ log_message(LOG_LEVEL_ERROR, "Unable to launch xauth");
+ return 1;
+ }
+
+ ret = pclose(dp);
+ if (ret < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "An error occurred while running xauth");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/sesman/xauth.h b/sesman/xauth.h
new file mode 100644
index 00000000..3254d635
--- /dev/null
+++ b/sesman/xauth.h
@@ -0,0 +1,41 @@
+/**
+ * xrdp: A Remote Desktop Protocol server.
+ *
+ * Copyright (C) Emmanuel Blindauer 2016
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ *
+ * @file xauth.c
+ * @brief XAUTHORITY handling code
+ *
+ */
+
+#ifndef XAUTH_H
+#define XAUTH_H
+
+/**
+ *
+ * @brief create the XAUTHORITY file for the user according to the display and the cookie
+ * xauth uses XAUTHORITY if defined, ~/.Xauthority otherwise
+ * @param display The session display
+ * @param file If not NULL, write the authorization in the file instead of default location
+ * @return 0 if adding the cookie is ok
+ */
+
+int DEFAULT_CC
+add_xauth_cookie(int display, const char *file);
+
+#endif
diff --git a/vnc/vnc.c b/vnc/vnc.c
index 8fe3a8bc..3a91ea9d 100644
--- a/vnc/vnc.c
+++ b/vnc/vnc.c
@@ -1288,7 +1288,7 @@ lib_mod_connect(struct vnc *v)
out_uint8(pixel_format, 0); /* blue shift */
out_uint8s(pixel_format, 3); /* pad */
}
- else if (v->mod_bpp == 24)
+ else if (v->mod_bpp == 24 || v->mod_bpp == 32)
{
out_uint8(pixel_format, 32); /* bits per pixel */
out_uint8(pixel_format, 24); /* depth */
diff --git a/xrdp/Makefile.am b/xrdp/Makefile.am
index 818a77a1..8e22d182 100644
--- a/xrdp/Makefile.am
+++ b/xrdp/Makefile.am
@@ -1,3 +1,8 @@
+EXTRA_DIST = \
+ czech.txt \
+ rdp-scan-codes.txt \
+ xrdpwin.c
+
AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
@@ -19,7 +24,7 @@ endif
if XRDP_RFXCODEC
AM_CPPFLAGS += -DXRDP_RFXCODEC
AM_CPPFLAGS += -I$(top_srcdir)/librfxcodec/include
-XRDP_EXTRA_LIBS += $(top_srcdir)/librfxcodec/src/.libs/librfxencode.a
+XRDP_EXTRA_LIBS += $(top_builddir)/librfxcodec/src/.libs/librfxencode.a
endif
if XRDP_PIXMAN
diff --git a/xrdp/xrdp.ini b/xrdp/xrdp.ini
index 1da90cca..242641ff 100644
--- a/xrdp/xrdp.ini
+++ b/xrdp/xrdp.ini
@@ -31,8 +31,10 @@ key_file=
#tls_ciphers=HIGH
; Section name to use for automatic login if the client sends username
-; and password
-autorun=X11rdp
+; and password. If empty, the domain name sent by the client is used.
+; If empty and no domain name is given, the first suitable section in
+; this file will be used.
+autorun=
allow_channels=true
allow_multimon=true
diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c
index 1c759c3e..deb56a2c 100644
--- a/xrdp/xrdp_bitmap.c
+++ b/xrdp/xrdp_bitmap.c
@@ -157,9 +157,9 @@ xrdp_bitmap_create_with_data(int width, int height,
struct xrdp_wm *wm)
{
struct xrdp_bitmap *self = (struct xrdp_bitmap *)NULL;
+ int Bpp;
#if defined(NEED_ALIGN)
tintptr data_as_int;
- int Bpp;
#endif
self = (struct xrdp_bitmap *)g_malloc(sizeof(struct xrdp_bitmap), 1);
@@ -168,6 +168,22 @@ xrdp_bitmap_create_with_data(int width, int height,
self->height = height;
self->bpp = bpp;
self->wm = wm;
+
+ Bpp = 4;
+ switch (bpp)
+ {
+ case 8:
+ Bpp = 1;
+ break;
+ case 15:
+ Bpp = 2;
+ break;
+ case 16:
+ Bpp = 2;
+ break;
+ }
+ self->line_size = width * Bpp;
+
#if defined(NEED_ALIGN)
data_as_int = (tintptr) data;
if (((bpp >= 24) && (data_as_int & 3)) ||
@@ -175,19 +191,6 @@ xrdp_bitmap_create_with_data(int width, int height,
{
/* got to copy data here, it's not aligned
other calls in this file assume alignment */
- Bpp = 4;
- switch (bpp)
- {
- case 8:
- Bpp = 1;
- break;
- case 15:
- Bpp = 2;
- break;
- case 16:
- Bpp = 2;
- break;
- }
self->data = (char *)g_malloc(width * height * Bpp, 0);
g_memcpy(self->data, data, width * height * Bpp);
return self;
diff --git a/xrdp/xrdp_encoder.c b/xrdp/xrdp_encoder.c
index 643fe0aa..0af0b85e 100644
--- a/xrdp/xrdp_encoder.c
+++ b/xrdp/xrdp_encoder.c
@@ -42,8 +42,10 @@
/*****************************************************************************/
static int
process_enc_jpg(struct xrdp_encoder *self, XRDP_ENC_DATA *enc);
+#ifdef XRDP_RFXCODEC
static int
process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc);
+#endif
static int
process_enc_h264(struct xrdp_encoder *self, XRDP_ENC_DATA *enc);
@@ -58,11 +60,6 @@ xrdp_encoder_create(struct xrdp_mm *mm)
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 (client_info->mcs_connection_type != 6) /* LAN */
{
return 0;
@@ -87,6 +84,7 @@ xrdp_encoder_create(struct xrdp_mm *mm)
(32 << 24) | (3 << 16) | (8 << 12) | (8 << 8) | (8 << 4) | 8;
self->process_enc = process_enc_jpg;
}
+#ifdef XRDP_RFXCODEC
else if (client_info->rfx_codec_id != 0)
{
LLOGLN(0, ("xrdp_encoder_create: starting rfx codec session"));
@@ -94,13 +92,11 @@ xrdp_encoder_create(struct xrdp_mm *mm)
self->in_codec_mode = 1;
client_info->capture_code = 2;
self->process_enc = process_enc_rfx;
-#ifdef XRDP_RFXCODEC
- self->codec_handle =
- rfxcodec_encode_create(mm->wm->screen->width,
- mm->wm->screen->height,
- RFX_FORMAT_YUV, 0);
-#endif
+ self->codec_handle = rfxcodec_encode_create(mm->wm->screen->width,
+ mm->wm->screen->height,
+ RFX_FORMAT_YUV, 0);
}
+#endif
else if (client_info->h264_codec_id != 0)
{
LLOGLN(0, ("xrdp_encoder_create: starting h264 codec session"));
@@ -296,7 +292,6 @@ process_enc_jpg(struct xrdp_encoder *self, XRDP_ENC_DATA *enc)
}
#ifdef XRDP_RFXCODEC
-
/*****************************************************************************/
/* called from encoder thread */
static int
@@ -399,17 +394,6 @@ process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc)
return 0;
}
-
-#else
-
-/*****************************************************************************/
-/* called from encoder thread */
-static int
-process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc)
-{
- return 0;
-}
-
#endif
/*****************************************************************************/
diff --git a/xrdp/xrdp_keyboard.ini b/xrdp/xrdp_keyboard.ini
index 914ca974..3ce7644a 100644
--- a/xrdp/xrdp_keyboard.ini
+++ b/xrdp/xrdp_keyboard.ini
@@ -62,6 +62,7 @@ rdp_layout_de=0x00000407
rdp_layout_fr=0x0000040C
rdp_layout_it=0x00000410
rdp_layout_jp=0x00000411
+rdp_layout_kr=0x00000412
rdp_layout_ru=0x00000419
rdp_layout_se=0x0000041D
rdp_layout_ch=0x00000807
@@ -76,6 +77,7 @@ rdp_layout_de=de
rdp_layout_fr=fr
rdp_layout_it=it
rdp_layout_jp=jp
+rdp_layout_kr=kr
rdp_layout_ru=ru
rdp_layout_se=se
rdp_layout_ch=ch
@@ -103,6 +105,7 @@ rdp_layout_us=us
rdp_layout_de=de
rdp_layout_fr=fr
rdp_layout_jp=jp
+rdp_layout_kr=kr
rdp_layout_it=it
rdp_layout_ru=ru
rdp_layout_se=se
diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c
index 715a18fc..bb6bc5d8 100644
--- a/xrdp/xrdp_mm.c
+++ b/xrdp/xrdp_mm.c
@@ -229,14 +229,19 @@ xrdp_mm_send_login(struct xrdp_mm *self)
out_uint16_be(s, self->wm->screen->width);
out_uint16_be(s, self->wm->screen->height);
- if (xserverbpp > 0)
+ /* select and send X server bpp */
+ if (xserverbpp == 0)
{
- out_uint16_be(s, xserverbpp);
- }
- else
- {
- out_uint16_be(s, self->wm->screen->bpp);
+ if (self->code == 20)
+ {
+ xserverbpp = 24; /* xorgxrdp is always at 24 bpp */
+ }
+ else
+ {
+ xserverbpp = self->wm->screen->bpp; /* use client's bpp */
+ }
}
+ out_uint16_be(s, xserverbpp);
/* send domain */
if(self->wm->client_info->domain[0]!='_')
@@ -2291,7 +2296,7 @@ xrdp_mm_frame_ack(struct xrdp_mm *self, int frame_id)
{
int ex;
- LLOGLN(0, ("xrdp_mm_frame_ack:"));
+ LLOGLN(10, ("xrdp_mm_frame_ack:"));
self->encoder->frame_id_client = frame_id;
if (self->wm->client_info->use_frame_acks == 0)
{
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index a8ae5033..065bca5c 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -1496,6 +1496,83 @@ xrdp_wm_key_sync(struct xrdp_wm *self, int device_flags, int key_flags)
/*****************************************************************************/
int APP_CC
+xrdp_wm_key_unicode(struct xrdp_wm *self, int device_flags, int unicode)
+{
+ int index;
+
+ for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
+ {
+ if (unicode == self->keymap.keys_noshift[index].chr)
+ {
+ xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
+ return 0;
+ }
+ }
+
+ for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
+ {
+ if (unicode == self->keymap.keys_shift[index].chr)
+ {
+ if (device_flags & KBD_FLAG_UP)
+ {
+ xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
+ xrdp_wm_key(self, KBD_FLAG_UP, XR_RDP_SCAN_LSHIFT);
+ }
+ else
+ {
+ xrdp_wm_key(self, KBD_FLAG_DOWN, XR_RDP_SCAN_LSHIFT);
+ xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
+ }
+ return 0;
+ }
+ }
+
+ for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
+ {
+ if (unicode == self->keymap.keys_altgr[index].chr)
+ {
+ if (device_flags & KBD_FLAG_UP)
+ {
+ xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
+ xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT,
+ XR_RDP_SCAN_ALT);
+ }
+ else
+ {
+ xrdp_wm_key(self, KBD_FLAG_DOWN | KBD_FLAG_EXT,
+ XR_RDP_SCAN_ALT);
+ xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
+ }
+ return 0;
+ }
+ }
+
+ for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
+ {
+ if (unicode == self->keymap.keys_shiftaltgr[index].chr)
+ {
+ if (device_flags & KBD_FLAG_UP)
+ {
+ xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
+ xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT, XR_RDP_SCAN_ALT);
+ xrdp_wm_key(self, KBD_FLAG_UP, XR_RDP_SCAN_LSHIFT);
+ }
+ else
+ {
+ xrdp_wm_key(self, KBD_FLAG_DOWN, XR_RDP_SCAN_LSHIFT);
+ xrdp_wm_key(self, KBD_FLAG_DOWN | KBD_FLAG_EXT,
+ XR_RDP_SCAN_ALT);
+ xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
+ }
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
+/*****************************************************************************/
+int APP_CC
xrdp_wm_pu(struct xrdp_wm *self, struct xrdp_bitmap *control)
{
int x;
@@ -1690,6 +1767,9 @@ callback(long id, int msg, long param1, long param2, long param3, long param4)
case 4: /* RDP_INPUT_SCANCODE */
rv = xrdp_wm_key(wm, param3, param1);
break;
+ case 5: /* RDP_INPUT_UNICODE */
+ rv = xrdp_wm_key_unicode(wm, param3, param1);
+ break;
case 0x8001: /* RDP_INPUT_MOUSE */
rv = xrdp_wm_process_input_mouse(wm, param3, param1, param2);
break;
diff --git a/xrdpapi/Makefile.am b/xrdpapi/Makefile.am
index 920f3d1a..fefa03fc 100644
--- a/xrdpapi/Makefile.am
+++ b/xrdpapi/Makefile.am
@@ -1,3 +1,8 @@
+EXTRA_DIST = \
+ simple.c \
+ vrplayer.c \
+ vrplayer.mk
+
module_LTLIBRARIES = \
libxrdpapi.la
diff --git a/xrdpvr/Makefile.am b/xrdpvr/Makefile.am
index f9b8d421..8c907402 100644
--- a/xrdpvr/Makefile.am
+++ b/xrdpvr/Makefile.am
@@ -3,4 +3,5 @@ module_LTLIBRARIES = \
libxrdpvr_la_SOURCES = \
xrdpvr.c \
- xrdpvr.h
+ xrdpvr.h \
+ xrdpvr_internal.h