summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
-rw-r--r--common/os_calls.c160
-rw-r--r--common/os_calls.h2
-rw-r--r--common/xrdp_constants.h7
-rw-r--r--configure.ac66
-rw-r--r--genkeymap/Makefile.am2
-rw-r--r--genkeymap/evdev-map.c156
-rw-r--r--genkeymap/genkeymap.c35
m---------librfxcodec0
-rw-r--r--libxrdp/libxrdp.h1
-rw-r--r--libxrdp/xrdp_mcs.c7
-rw-r--r--libxrdp/xrdp_sec.c74
-rw-r--r--sesman/chansrv/pulse/module-xrdp-source.c38
-rw-r--r--sesman/chansrv/sound.c40
-rw-r--r--sesman/verify_user.c9
-rw-r--r--vnc/vnc.c11
-rw-r--r--vnc/vnc.h1
-rw-r--r--xorg/server/module/rdpCapture.c15
-rw-r--r--xorg/server/readme.txt42
m---------xorgxrdp0
-rw-r--r--xrdp/xrdp.ini7
21 files changed, 578 insertions, 98 deletions
diff --git a/.gitmodules b/.gitmodules
index d40734d4..52a8a98a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "librfxcodec"]
path = librfxcodec
url = git://github.com/neutrinolabs/librfxcodec
+[submodule "xorgxrdp"]
+ path = xorgxrdp
+ url = git://github.com/neutrinolabs/xorgxrdp
diff --git a/common/os_calls.c b/common/os_calls.c
index ef057497..bfea9031 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -126,8 +126,12 @@ g_mk_temp_dir(const char *app_name)
{
if (!g_create_dir("/tmp/.xrdp"))
{
- printf("g_mk_temp_dir: g_create_dir failed\n");
- return 1;
+ /* if failed, still check if it got created by someone else */
+ if (!g_directory_exist("/tmp/.xrdp"))
+ {
+ printf("g_mk_temp_dir: g_create_dir failed\n");
+ return 1;
+ }
}
g_chmod_hex("/tmp/.xrdp", 0x1777);
@@ -3172,6 +3176,158 @@ g_time3(void)
#endif
}
+/******************************************************************************/
+/******************************************************************************/
+struct bmp_magic
+{
+ char magic[2];
+};
+
+struct bmp_hdr
+{
+ unsigned int size; /* file size in bytes */
+ unsigned short reserved1;
+ unsigned short reserved2;
+ unsigned int offset; /* offset to image data, in bytes */
+};
+
+struct dib_hdr
+{
+ unsigned int hdr_size;
+ int width;
+ int height;
+ unsigned short nplanes;
+ unsigned short bpp;
+ unsigned int compress_type;
+ unsigned int image_size;
+ int hres;
+ int vres;
+ unsigned int ncolors;
+ unsigned int nimpcolors;
+ };
+
+/******************************************************************************/
+int APP_CC
+g_save_to_bmp(const char* filename, char* data, int stride_bytes,
+ int width, int height, int depth, int bits_per_pixel)
+{
+ struct bmp_magic bm;
+ struct bmp_hdr bh;
+ struct dib_hdr dh;
+ int bytes;
+ int fd;
+ int index;
+ int i1;
+ int pixel;
+ int extra;
+ int file_stride_bytes;
+ char* line;
+ char* line_ptr;
+
+ if ((depth == 24) && (bits_per_pixel == 32))
+ {
+ }
+ else if ((depth == 32) && (bits_per_pixel == 32))
+ {
+ }
+ else
+ {
+ g_writeln("g_save_to_bpp: unimp");
+ return 1;
+ }
+ bm.magic[0] = 'B';
+ bm.magic[1] = 'M';
+
+ /* scan lines are 32 bit aligned, bottom 2 bits must be zero */
+ file_stride_bytes = width * ((depth + 7) / 8);
+ extra = file_stride_bytes;
+ extra = extra & 3;
+ extra = (4 - extra) & 3;
+ file_stride_bytes += extra;
+
+ bh.size = sizeof(bm) + sizeof(bh) + sizeof(dh) + height * file_stride_bytes;
+ bh.reserved1 = 0;
+ bh.reserved2 = 0;
+ bh.offset = sizeof(bm) + sizeof(bh) + sizeof(dh);
+
+ dh.hdr_size = sizeof(dh);
+ dh.width = width;
+ dh.height = height;
+ dh.nplanes = 1;
+ dh.bpp = depth;
+ dh.compress_type = 0;
+ dh.image_size = height * file_stride_bytes;
+ dh.hres = 0xb13;
+ dh.vres = 0xb13;
+ dh.ncolors = 0;
+ dh.nimpcolors = 0;
+
+ fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
+ if (fd == -1)
+ {
+ g_writeln("g_save_to_bpp: open error");
+ return 1;
+ }
+ bytes = write(fd, &bm, sizeof(bm));
+ if (bytes != sizeof(bm))
+ {
+ g_writeln("g_save_to_bpp: write error");
+ }
+ bytes = write(fd, &bh, sizeof(bh));
+ if (bytes != sizeof(bh))
+ {
+ g_writeln("g_save_to_bpp: write error");
+ }
+ bytes = write(fd, &dh, sizeof(dh));
+ if (bytes != sizeof(dh))
+ {
+ g_writeln("g_save_to_bpp: write error");
+ }
+ data += stride_bytes * height;
+ data -= stride_bytes;
+ if ((depth == 24) && (bits_per_pixel == 32))
+ {
+ line = malloc(file_stride_bytes);
+ memset(line, 0, file_stride_bytes);
+ for (index = 0; index < height; index++)
+ {
+ line_ptr = line;
+ for (i1 = 0; i1 < width; i1++)
+ {
+ pixel = ((int*)data)[i1];
+ *(line_ptr++) = (pixel >> 0) & 0xff;
+ *(line_ptr++) = (pixel >> 8) & 0xff;
+ *(line_ptr++) = (pixel >> 16) & 0xff;
+ }
+ bytes = write(fd, line, file_stride_bytes);
+ if (bytes != file_stride_bytes)
+ {
+ g_writeln("g_save_to_bpp: write error");
+ }
+ data -= stride_bytes;
+ }
+ free(line);
+ }
+ else if (depth == bits_per_pixel)
+ {
+ for (index = 0; index < height; index++)
+ {
+ bytes = write(fd, data, width * (bits_per_pixel / 8));
+ if (bytes != width * (bits_per_pixel / 8))
+ {
+ g_writeln("g_save_to_bpp: write error");
+ }
+ data -= stride_bytes;
+ }
+ }
+ else
+ {
+ g_writeln("g_save_to_bpp: unimp");
+ }
+ close(fd);
+ return 0;
+}
+
/*****************************************************************************/
/* returns boolean */
int APP_CC
diff --git a/common/os_calls.h b/common/os_calls.h
index 1805a6a1..d954a075 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -161,6 +161,8 @@ int APP_CC g_check_user_in_group(const char* username, int gid, int* ok);
int APP_CC g_time1(void);
int APP_CC g_time2(void);
int APP_CC g_time3(void);
+int APP_CC g_save_to_bmp(const char* filename, char* data, int stride_bytes,
+ int width, int height, int depth, int bits_per_pixel);
int APP_CC g_text2bool(const char *s);
void * APP_CC g_shmat(int shmid);
int APP_CC g_shmdt(const void *shmaddr);
diff --git a/common/xrdp_constants.h b/common/xrdp_constants.h
index 2ee034c3..25d9495f 100644
--- a/common/xrdp_constants.h
+++ b/common/xrdp_constants.h
@@ -457,6 +457,7 @@
Extended order support flags. */
#define XR_ORDERFLAGS_EX_CACHE_BITMAP_REV3_SUPPORT 0x0002
#define XR_ORDERFLAGS_EX_ALTSEC_FRAME_MARKER_SUPPORT 0x0004
+#define XR_ORDERFLAGS_EX_OFFSCREEN_COMPOSITE_SUPPORT 0x0100
/* drawable types */
#define WND_TYPE_BITMAP 0
@@ -548,10 +549,14 @@
#define XR_CODEC_GUID_REMOTEFX \
"\x12\x2F\x77\x76\x72\xBD\x63\x44\xAF\xB3\xB7\x3C\x9C\x6F\x78\x86"
-/* CODEC_GUID_JPEG 0x430C9EED1BAF4CE6869ACB8B37B66237*/
+/* CODEC_GUID_JPEG 0x1BAF4CE6 9EED 430C 869ACB8B37B66237 */
#define XR_CODEC_GUID_JPEG \
"\xE6\x4C\xAF\x1B\xED\x9E\x0C\x43\x86\x9A\xCB\x8B\x37\xB6\x62\x37"
+/* CODEC_GUID_PNG 0xOE0C858D 28E0 45DB ADAA0F83E57CC560 */
+#define XR_CODEC_GUID_PNG \
+ "\x8D\x85\x0C\x0E\xE0\x28\xDB\x45\xAD\xAA\x0F\x83\xE5\x7C\xC5\x60"
+
#define RDP_CAPSET_SURFCMDS 0x1c
#define RDP_CAPLEN_SURFCMDS 0x0c
#define RDP_CAPSET_BMPCODECS 0x1d
diff --git a/configure.ac b/configure.ac
index 85145cfc..c5d22ec0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,6 +7,7 @@ AM_INIT_AUTOMAKE([1.6 foreign])
AC_PROG_CC
AC_C_CONST
AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
@@ -15,46 +16,55 @@ if test "x$with_systemdsystemunitdir" != xno; then
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+AC_ARG_ENABLE(pam, AS_HELP_STRING([--disable-pam],
+ [Build PAM support (default: yes)]),
+ [], [enable_pam=yes])
AC_ARG_ENABLE(nopam, AS_HELP_STRING([--enable-nopam],
- [Build no PAM support (default: no)]),
- [nopam=true], [nopam=false])
-AM_CONDITIONAL(SESMAN_NOPAM, [test x$nopam = xtrue])
+ [Build no PAM support (default: no, deprecated)]),
+ [
+ if test "x$enable_nopam" = "xyes"
+ then
+ enable_pam=no
+ AC_MSG_WARN([--enable-nopam option is deprecated. Please use --disable-pam instead.])
+ fi
+ ])
+AM_CONDITIONAL(SESMAN_NOPAM, [test x$enable_pam != xyes])
AC_ARG_ENABLE(kerberos, AS_HELP_STRING([--enable-kerberos],
[Build kerberos support (default: no)]),
- [kerberos=true], [kerberos=false])
-AM_CONDITIONAL(SESMAN_KERBEROS, [test x$kerberos = xtrue])
+ [], [enable_kerberos=no])
+AM_CONDITIONAL(SESMAN_KERBEROS, [test x$enable_kerberos = xyes])
AC_ARG_ENABLE(pamuserpass, AS_HELP_STRING([--enable-pamuserpass],
[Build pam userpass support (default: no)]),
- [pamuserpass=true], [pamuserpass=false])
-AM_CONDITIONAL(SESMAN_PAMUSERPASS, [test x$pamuserpass = xtrue])
+ [], [enable_pamuserpass=no])
+AM_CONDITIONAL(SESMAN_PAMUSERPASS, [test x$enable_pamuserpass = xyes])
AC_ARG_ENABLE(xrdpdebug, AS_HELP_STRING([--enable-xrdpdebug],
[Build debug (default: no)]),
- [xrdpdebug=true], [xrdpdebug=false])
-AM_CONDITIONAL(XRDP_DEBUG, [test x$xrdpdebug = xtrue])
+ [], [enable_xrdpdebug=no])
+AM_CONDITIONAL(XRDP_DEBUG, [test x$enable_xrdpdebug = xyes])
AC_ARG_ENABLE(neutrinordp, AS_HELP_STRING([--enable-neutrinordp],
[Build neutrinordp module (default: no)]),
- [neutrinordp=true], [neutrinordp=false])
-AM_CONDITIONAL(XRDP_NEUTRINORDP, [test x$neutrinordp = xtrue])
+ [], [enable_neutrinordp=no])
+AM_CONDITIONAL(XRDP_NEUTRINORDP, [test x$enable_neutrinordp = xyes])
AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--enable-jpeg],
[Build jpeg module (default: no)]),
- [jpeg=true], [jpeg=false])
-AM_CONDITIONAL(XRDP_JPEG, [test x$jpeg = xtrue])
+ [], [enable_jpeg=no])
+AM_CONDITIONAL(XRDP_JPEG, [test x$enable_jpeg = xyes])
AC_ARG_ENABLE(tjpeg, AS_HELP_STRING([--enable-tjpeg],
[Build turbo jpeg module (default: no)]),
- [tjpeg=true], [tjpeg=false])
-AM_CONDITIONAL(XRDP_TJPEG, [test x$tjpeg = xtrue])
+ [], [enable_tjpeg=no])
+AM_CONDITIONAL(XRDP_TJPEG, [test x$enable_tjpeg = xyes])
AC_ARG_ENABLE(fuse, AS_HELP_STRING([--enable-fuse],
[Build fuse(clipboard file / drive redir) (default: no)]),
- [fuse=true], [fuse=false])
-AM_CONDITIONAL(XRDP_FUSE, [test x$fuse = xtrue])
+ [], [enable_fuse=no])
+AM_CONDITIONAL(XRDP_FUSE, [test x$enable_fuse = xyes])
AC_ARG_ENABLE(xrdpvr, AS_HELP_STRING([--enable-xrdpvr],
[Build xrdpvr module (default: no)]),
- [xrdpvr=true], [xrdpvr=false])
-AM_CONDITIONAL(XRDP_XRDPVR, [test x$xrdpvr = xtrue])
+ [], [enable_xrdpvr=no])
+AM_CONDITIONAL(XRDP_XRDPVR, [test x$enable_xrdpvr = xyes])
AC_ARG_ENABLE(rfxcodec, AS_HELP_STRING([--enable-rfxcodec],
[Build using librfxcodec (default: no)]),
- [rfxcodec=true], [rfxcodec=false])
-AM_CONDITIONAL(XRDP_RFXCODEC, [test x$rfxcodec = xtrue])
+ [], [enable_rfxcodec=no])
+AM_CONDITIONAL(XRDP_RFXCODEC, [test x$enable_rfxcodec = xyes])
AM_CONDITIONAL(GOT_PREFIX, test "x${prefix}" != "xNONE"])
@@ -64,9 +74,9 @@ AC_CHECK_HEADER([openssl/rc4.h], [],
[#include <stdlib.h>])
# checking if pam should be autodetected.
-if test -z "$enable_nopam"
+if test "x$enable_pam" = "xyes"
then
- if test -z "$enable_kerberos"
+ if test "x$enable_kerberos" != "xyes"
then
AC_CHECK_HEADER([security/pam_appl.h], [],
[AC_MSG_ERROR([please install libpam0g-dev or pam-devel])])
@@ -78,7 +88,7 @@ AC_CHECK_MEMBER([struct in6_addr.s6_addr],
[AC_DEFINE(NO_ARPA_INET_H_IP6, 1, [for IPv6])],
[#include <arpa/inet.h>])
-if test "x$enable_nopam" = "xyes"
+if test "x$enable_pam" != "xyes"
then
AC_DEFINE([USE_NOPAM],1,[Disable PAM])
fi
@@ -86,19 +96,19 @@ fi
AS_IF( [test "x$enable_neutrinordp" = "xyes"] , [PKG_CHECK_MODULES(FREERDP, freerdp >= 1.0.0)] )
# checking for libjpeg
-if ! test -z "$enable_jpeg"
+if test "x$enable_jpeg" = "xyes"
then
AC_CHECK_HEADER([jpeglib.h], [],
[AC_MSG_ERROR([please install libjpeg-dev or libjpeg-devel])])
fi
-if ! test -z "$enable_xrdpdebug"
+if test "x$enable_xrdpdebug" = "xyes"
then
CFLAGS="-g -O0"
fi
# checking for fuse
-if ! test -z "$enable_fuse"
+if test "x$enable_fuse" = "xyes"
then
AC_CHECK_HEADER([fuse.h], [],
[AC_MSG_ERROR([please install libfuse-dev or fuse-devel])],
@@ -106,7 +116,7 @@ then
fi
# checking for TurboJPEG
-if ! test -z "$enable_tjpeg"
+if test "x$enable_tjpeg" = "xyes"
then
if test ! -z "$TURBOJPEG_PATH"
then
diff --git a/genkeymap/Makefile.am b/genkeymap/Makefile.am
index e358c61b..aed72512 100644
--- a/genkeymap/Makefile.am
+++ b/genkeymap/Makefile.am
@@ -2,7 +2,7 @@
bin_PROGRAMS = \
xrdp-genkeymap
-xrdp_genkeymap_SOURCES = genkeymap.c
+xrdp_genkeymap_SOURCES = genkeymap.c evdev-map.c
xrdp_genkeymap_LDADD = \
-L/usr/X11R6/lib \
diff --git a/genkeymap/evdev-map.c b/genkeymap/evdev-map.c
new file mode 100644
index 00000000..4610eb69
--- /dev/null
+++ b/genkeymap/evdev-map.c
@@ -0,0 +1,156 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * evdev-map.c
+ * Copyright (C) Michał Górny 2014 <mgorny@gentoo.org>
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * main.cc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with main.cc. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA
+ *
+ * xfree86(base)->evdev keycode mapping
+ */
+
+int xfree86_to_evdev[137-8+1] = {
+ /* MDSW */ 203,
+ /* ESC */ 9,
+ /* AE01 */ 10,
+ /* AE02 */ 11,
+ /* AE03 */ 12,
+ /* AE04 */ 13,
+ /* AE05 */ 14,
+ /* AE06 */ 15,
+ /* AE07 */ 16,
+ /* AE08 */ 17,
+ /* AE09 */ 18,
+ /* AE10 */ 19,
+ /* AE11 */ 20,
+ /* AE12 */ 21,
+ /* BKSP */ 22,
+ /* TAB */ 23,
+ /* AD01 */ 24,
+ /* AD02 */ 25,
+ /* AD03 */ 26,
+ /* AD04 */ 27,
+ /* AD05 */ 28,
+ /* AD06 */ 29,
+ /* AD07 */ 30,
+ /* AD08 */ 31,
+ /* AD09 */ 32,
+ /* AD10 */ 33,
+ /* AD11 */ 34,
+ /* AD12 */ 35,
+ /* RTRN */ 36,
+ /* LCTL */ 37,
+ /* AC01 */ 38,
+ /* AC02 */ 39,
+ /* AC03 */ 40,
+ /* AC04 */ 41,
+ /* AC05 */ 42,
+ /* AC06 */ 43,
+ /* AC07 */ 44,
+ /* AC08 */ 45,
+ /* AC09 */ 46,
+ /* AC10 */ 47,
+ /* AC11 */ 48,
+ /* TLDE */ 49,
+ /* LFSH */ 50,
+ /* BKSL */ 51,
+ /* AB01 */ 52,
+ /* AB02 */ 53,
+ /* AB03 */ 54,
+ /* AB04 */ 55,
+ /* AB05 */ 56,
+ /* AB06 */ 57,
+ /* AB07 */ 58,
+ /* AB08 */ 59,
+ /* AB09 */ 60,
+ /* AB10 */ 61,
+ /* RTSH */ 62,
+ /* KPMU */ 63,
+ /* LALT */ 64,
+ /* SPCE */ 65,
+ /* CAPS */ 66,
+ /* FK01 */ 67,
+ /* FK02 */ 68,
+ /* FK03 */ 69,
+ /* FK04 */ 70,
+ /* FK05 */ 71,
+ /* FK06 */ 72,
+ /* FK07 */ 73,
+ /* FK08 */ 74,
+ /* FK09 */ 75,
+ /* FK10 */ 76,
+ /* NMLK */ 77,
+ /* SCLK */ 78,
+ /* KP7 */ 79,
+ /* KP8 */ 80,
+ /* KP9 */ 81,
+ /* KPSU */ 82,
+ /* KP4 */ 83,
+ /* KP5 */ 84,
+ /* KP6 */ 85,
+ /* KPAD */ 86,
+ /* KP1 */ 87,
+ /* KP2 */ 88,
+ /* KP3 */ 89,
+ /* KP0 */ 90,
+ /* KPDL */ 91,
+ /* SYRQ */ 107,
+ /* II5D */ 0,
+ /* LSGT */ 94,
+ /* FK11 */ 95,
+ /* FK12 */ 96,
+ /* HOME */ 110,
+ /* UP */ 111,
+ /* PGUP */ 112,
+ /* LEFT */ 113,
+ /* II65 */ 0,
+ /* RGHT */ 114,
+ /* END */ 115,
+ /* DOWN */ 116,
+ /* PGDN */ 117,
+ /* INS */ 118,
+ /* DELE */ 119,
+ /* KPEN */ 104,
+ /* RCTL */ 105,
+ /* PAUS */ 127,
+ /* PRSC */ 107,
+ /* KPDV */ 106,
+ /* RALT */ 108,
+ /* BRK */ 419,
+ /* LWIN */ 133,
+ /* RWIN */ 134,
+ /* MENU */ 0,
+ /* FK13 */ 191,
+ /* FK14 */ 192,
+ /* FK15 */ 193,
+ /* FK16 */ 194,
+ /* FK17 */ 195,
+ /* KPDC */ 0,
+ /* LVL3 */ 92,
+ /* ALT */ 204,
+ /* KPEQ */ 125,
+ /* SUPR */ 206,
+ /* HYPR */ 207,
+ /* XFER */ 0,
+ /* I02 */ 0,
+ /* NFER */ 0,
+ /* I04 */ 0,
+ /* AE13 */ 132,
+ /* I06 */ 0,
+ /* I07 */ 0,
+ 0,
+ 0
+};
diff --git a/genkeymap/genkeymap.c b/genkeymap/genkeymap.c
index 16de6e10..088af748 100644
--- a/genkeymap/genkeymap.c
+++ b/genkeymap/genkeymap.c
@@ -37,8 +37,11 @@
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/XKBlib.h>
#include <locale.h>
+extern int xfree86_to_evdev[137-8];
+
int main(int argc, char **argv)
{
const char *programname;
@@ -57,6 +60,9 @@ int main(int argc, char **argv)
FILE *outf;
XKeyPressedEvent e;
wchar_t wtext[256];
+ XkbDescPtr kbdesc;
+ char *symatom;
+ int is_evdev;
setlocale(LC_CTYPE, "");
programname = argv[0];
@@ -78,6 +84,30 @@ int main(int argc, char **argv)
return 1;
}
+ /* check whether evdev is used */
+ kbdesc = XkbAllocKeyboard();
+ if (!kbdesc)
+ {
+ fprintf(stderr, "%s: unable to allocate keyboard desc\n",
+ programname);
+ XCloseDisplay(dpy);
+ return 1;
+ }
+
+ if (XkbGetNames(dpy, XkbKeycodesNameMask, kbdesc) != Success)
+ {
+ fprintf(stderr, "%s: unable to obtain keycode name for keyboard\n",
+ programname);
+ XkbFreeKeyboard(kbdesc, 0, True);
+ XCloseDisplay(dpy);
+ return 1;
+ }
+
+ symatom = XGetAtomName(dpy, kbdesc->names->keycodes);
+ is_evdev = !strncmp(symatom, "evdev", 5);
+ XFree(symatom);
+ XkbFreeKeyboard(kbdesc, 0, True);
+
outf = fopen(outfname, "w");
if (outf == NULL)
@@ -101,7 +131,10 @@ int main(int argc, char **argv)
for (i = 8; i <= 137; i++) /* Keycodes */
{
- e.keycode = i;
+ if (is_evdev)
+ e.keycode = xfree86_to_evdev[i-8];
+ else
+ e.keycode = i;
nbytes = XLookupString(&e, text, 255, &ks, NULL);
text[nbytes] = 0;
char_count = mbstowcs(wtext, text, 255);
diff --git a/librfxcodec b/librfxcodec
-Subproject de6a45cba607b902da704304fa3de8ddd3d1523
+Subproject 61f6e92ecdfd057215da7932b6afefcbfa92844
diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h
index 0bda9f45..5f60183d 100644
--- a/libxrdp/libxrdp.h
+++ b/libxrdp/libxrdp.h
@@ -129,6 +129,7 @@ struct xrdp_sec
void *encrypt_fips_info;
void *decrypt_fips_info;
void *sign_fips_info;
+ int is_security_header_present; /* boolean */
};
/* channel */
diff --git a/libxrdp/xrdp_mcs.c b/libxrdp/xrdp_mcs.c
index 716ad13f..dafbbcd9 100644
--- a/libxrdp/xrdp_mcs.c
+++ b/libxrdp/xrdp_mcs.c
@@ -906,7 +906,8 @@ xrdp_mcs_send_connect_response(struct xrdp_mcs *self)
int APP_CC
xrdp_mcs_incoming(struct xrdp_mcs *self)
{
- int i;
+ int index;
+
DEBUG((" in xrdp_mcs_incoming"));
if (xrdp_mcs_recv_connect_initial(self) != 0)
@@ -945,7 +946,7 @@ xrdp_mcs_incoming(struct xrdp_mcs *self)
return 1;
}
- for (i = 0; i < self->channel_list->count + 2; i++)
+ for (index = 0; index < self->channel_list->count + 2; index++)
{
if (xrdp_mcs_recv_cjrq(self) != 0)
{
@@ -953,7 +954,7 @@ xrdp_mcs_incoming(struct xrdp_mcs *self)
}
if (xrdp_mcs_send_cjcf(self, self->userid,
- self->userid + MCS_USERCHANNEL_BASE + i) != 0)
+ self->userid + MCS_USERCHANNEL_BASE + index) != 0)
{
return 1;
}
diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c
index 63957a45..561acd1f 100644
--- a/libxrdp/xrdp_sec.c
+++ b/libxrdp/xrdp_sec.c
@@ -185,8 +185,6 @@ static const tui8 g_fips_ivec[8] =
0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF
};
-static int is_security_header_present = 1; /* next packet should contain security header? */
-
/*****************************************************************************/
static void APP_CC
hex_str_to_bin(char *in, char *out, int out_len)
@@ -432,42 +430,44 @@ xrdp_sec_create(struct xrdp_rdp *owner, struct trans *trans)
{
struct xrdp_sec *self;
- DEBUG((" in xrdp_sec_create"));
- self = (struct xrdp_sec *) g_malloc(sizeof(struct xrdp_sec), 1);
- self->rdp_layer = owner;
- self->crypt_method = CRYPT_METHOD_NONE; /* set later */
- self->crypt_level = CRYPT_LEVEL_NONE;
- self->mcs_layer = xrdp_mcs_create(self, trans, &(self->client_mcs_data),
- &(self->server_mcs_data));
- self->fastpath_layer = xrdp_fastpath_create(self, trans);
- self->chan_layer = xrdp_channel_create(self, self->mcs_layer);
- DEBUG((" out xrdp_sec_create"));
-
- return self;
+ DEBUG((" in xrdp_sec_create"));
+ self = (struct xrdp_sec *) g_malloc(sizeof(struct xrdp_sec), 1);
+ self->rdp_layer = owner;
+ self->crypt_method = CRYPT_METHOD_NONE; /* set later */
+ self->crypt_level = CRYPT_LEVEL_NONE;
+ self->mcs_layer = xrdp_mcs_create(self, trans, &(self->client_mcs_data),
+ &(self->server_mcs_data));
+ self->fastpath_layer = xrdp_fastpath_create(self, trans);
+ self->chan_layer = xrdp_channel_create(self, self->mcs_layer);
+ self->is_security_header_present = 1;
+ DEBUG((" out xrdp_sec_create"));
+
+ return self;
}
/*****************************************************************************/
void APP_CC
-xrdp_sec_delete(struct xrdp_sec *self) {
-
- if (self == 0) {
- g_writeln("xrdp_sec_delete: indata is null");
- return;
- }
-
- xrdp_channel_delete(self->chan_layer);
- xrdp_mcs_delete(self->mcs_layer);
- xrdp_fastpath_delete(self->fastpath_layer);
- ssl_rc4_info_delete(self->decrypt_rc4_info); /* TODO clear all data */
- ssl_rc4_info_delete(self->encrypt_rc4_info); /* TODO clear all data */
- ssl_des3_info_delete(self->decrypt_fips_info);
- ssl_des3_info_delete(self->encrypt_fips_info);
- ssl_hmac_info_delete(self->sign_fips_info);
- g_free(self->client_mcs_data.data);
- g_free(self->server_mcs_data.data);
- /* Crypto information must always be cleared */
- g_memset(self, 0, sizeof(struct xrdp_sec));
- g_free(self);
+xrdp_sec_delete(struct xrdp_sec *self)
+{
+ if (self == 0)
+ {
+ g_writeln("xrdp_sec_delete: self is null");
+ return;
+ }
+
+ xrdp_channel_delete(self->chan_layer);
+ xrdp_mcs_delete(self->mcs_layer);
+ xrdp_fastpath_delete(self->fastpath_layer);
+ ssl_rc4_info_delete(self->decrypt_rc4_info); /* TODO clear all data */
+ ssl_rc4_info_delete(self->encrypt_rc4_info); /* TODO clear all data */
+ ssl_des3_info_delete(self->decrypt_fips_info);
+ ssl_des3_info_delete(self->encrypt_fips_info);
+ ssl_hmac_info_delete(self->sign_fips_info);
+ g_free(self->client_mcs_data.data);
+ g_free(self->server_mcs_data.data);
+ /* Crypto information must always be cleared */
+ g_memset(self, 0, sizeof(struct xrdp_sec));
+ g_free(self);
}
/*****************************************************************************/
@@ -490,7 +490,6 @@ xrdp_sec_init(struct xrdp_sec *self, struct stream *s)
}
else
{
-// s_push_layer(s, sec_hdr, 4);
}
return 0;
@@ -1209,7 +1208,7 @@ xrdp_sec_recv(struct xrdp_sec *self, struct stream *s, int *chan)
}
- if (!is_security_header_present)
+ if (!(self->is_security_header_present))
{
return 0;
}
@@ -1326,7 +1325,8 @@ xrdp_sec_recv(struct xrdp_sec *self, struct stream *s, int *chan)
if (self->crypt_level == CRYPT_LEVEL_NONE
&& self->crypt_method == CRYPT_METHOD_NONE)
{
- is_security_header_present = 0; /* in tls mode, no more security header from now on */
+ /* in tls mode, no more security header from now on */
+ self->is_security_header_present = 0;
}
DEBUG((" out xrdp_sec_recv"));
diff --git a/sesman/chansrv/pulse/module-xrdp-source.c b/sesman/chansrv/pulse/module-xrdp-source.c
index 1c03b069..3d73fd03 100644
--- a/sesman/chansrv/pulse/module-xrdp-source.c
+++ b/sesman/chansrv/pulse/module-xrdp-source.c
@@ -71,7 +71,7 @@ PA_MODULE_USAGE(
#define DEFAULT_SOURCE_NAME "xrdp-source"
#define DEFAULT_LATENCY_TIME 10
-#define MAX_LATENCY_USEC (PA_USEC_PER_SEC * 2)
+#define MAX_LATENCY_USEC 1000
#define CHANSRV_PORT_STR "/tmp/.xrdp/xrdp_chansrv_audio_in_socket_%d"
struct userdata {
@@ -144,6 +144,32 @@ static void source_update_requested_latency_cb(pa_source *s) {
u->block_usec = pa_source_get_requested_latency_within_thread(s);
}
+static int lsend(int fd, char *data, int bytes) {
+ int sent = 0;
+ int error;
+ while (sent < bytes) {
+ error = send(fd, data + sent, bytes - sent, 0);
+ if (error < 1) {
+ return error;
+ }
+ sent += error;
+ }
+ return sent;
+}
+
+static int lrecv(int fd, char *data, int bytes) {
+ int recved = 0;
+ int error;
+ while (recved < bytes) {
+ error = recv(fd, data + recved, bytes - recved, 0);
+ if (error < 1) {
+ return error;
+ }
+ recved += error;
+ }
+ return recved;
+}
+
static int data_get(struct userdata *u, pa_memchunk *chunk) {
int fd;
@@ -190,7 +216,7 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
buf[9] = 0;
buf[10] = 0;
- send(u->fd, buf, 11, 0);
+ lsend(u->fd, buf, 11);
u->want_src_data = 1;
pa_log_debug("###### started recording");
}
@@ -208,10 +234,10 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
buf[9] = (unsigned char) chunk->length;
buf[10] = (unsigned char) ((chunk->length >> 8) & 0xff);
- send(u->fd, buf, 11, 0);
+ lsend(u->fd, buf, 11);
/* read length of data available */
- recv(u->fd, ubuf, 2, 0);
+ lrecv(u->fd, (char *) ubuf, 2);
bytes = ((ubuf[1] << 8) & 0xff00) | (ubuf[0] & 0xff);
if (bytes == 0) {
@@ -220,7 +246,7 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
}
/* get data */
- bytes = recv(u->fd, data, bytes, 0);
+ bytes = lrecv(u->fd, data, bytes);
pa_memblock_release(chunk->memblock);
@@ -272,7 +298,7 @@ static void thread_func(void *userdata) {
buf[9] = 0;
buf[10] = 0;
- send(u->fd, buf, 11, 0);
+ lsend(u->fd, buf, 11);
u->want_src_data = 0;
pa_log_debug("###### stopped recording");
}
diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c
index 63e4f037..9943a15b 100644
--- a/sesman/chansrv/sound.c
+++ b/sesman/chansrv/sound.c
@@ -43,7 +43,8 @@ static struct trans *g_audio_c_trans_in = 0; /* connection */
static int g_training_sent_time = 0;
static int g_cBlockNo = 0;
static int g_bytes_in_stream = 0;
-static FIFO in_fifo;
+static FIFO g_in_fifo;
+static int g_bytes_in_fifo = 0;
static struct stream *g_stream_inp = NULL;
static struct stream *g_stream_incoming_packet = NULL;
@@ -691,7 +692,7 @@ sound_init(void)
sound_start_source_listener();
/* save data from sound_server_source */
- fifo_init(&in_fifo, 100);
+ fifo_init(&g_in_fifo, 100);
return 0;
}
@@ -725,7 +726,7 @@ sound_deinit(void)
g_audio_c_trans_in = 0;
}
- fifo_deinit(&in_fifo);
+ fifo_deinit(&g_in_fifo);
return 0;
}
@@ -1041,9 +1042,12 @@ sound_input_start_recording(void)
{
struct stream* s;
+ LOG(10, ("sound_input_start_recording:"));
+
/* if there is any data in FIFO, discard it */
- while ((s = (struct stream *) fifo_remove(&in_fifo)) != NULL)
+ while ((s = (struct stream *) fifo_remove(&g_in_fifo)) != NULL)
xstream_free(s);
+ g_bytes_in_fifo = 0;
xstream_new(s, 1024);
@@ -1075,6 +1079,8 @@ sound_input_stop_recording(void)
{
struct stream* s;
+ LOG(10, ("sound_input_stop_recording:"));
+
xstream_new(s, 1024);
/*
@@ -1098,19 +1104,25 @@ sound_input_stop_recording(void)
* Process data: xrdp <- client
*****************************************************************************/
-static unsigned char data = 0;
-
static int APP_CC
sound_process_input_data(struct stream *s, int bytes)
{
struct stream *ls;
+ LOG(0, ("sound_process_input_data: bytes %d g_bytes_in_fifo %d",
+ bytes, g_bytes_in_fifo));
+
+ /* cap data in fifo */
+ if (g_bytes_in_fifo > 8 * 1024)
+ {
+ return 0;
+ }
xstream_new(ls, bytes);
- memcpy(ls->data, s->p, bytes);
+ g_memcpy(ls->data, s->p, bytes);
ls->p += bytes;
s_mark_end(ls);
-
- fifo_insert(&in_fifo, (void *) ls);
+ fifo_insert(&g_in_fifo, (void *) ls);
+ g_bytes_in_fifo += bytes;
return 0;
}
@@ -1143,6 +1155,7 @@ sound_sndsrvr_source_data_in(struct trans *trans)
ts->p = ts->data + 8;
in_uint8(ts, cmd);
in_uint16_le(ts, bytes_req);
+ LOG(10, ("sound_sndsrvr_source_data_in: bytes_req %d", bytes_req));
xstream_new(s, bytes_req + 2);
@@ -1154,7 +1167,14 @@ sound_sndsrvr_source_data_in(struct trans *trans)
while (bytes_read < bytes_req)
{
if (g_stream_inp == NULL)
- g_stream_inp = (struct stream *) fifo_remove(&in_fifo);
+ {
+ g_stream_inp = (struct stream *) fifo_remove(&g_in_fifo);
+ if (g_stream_inp != NULL)
+ {
+ g_bytes_in_fifo -= g_stream_inp->size;
+ LOG(10, (" g_bytes_in_fifo %d", g_bytes_in_fifo));
+ }
+ }
if (g_stream_inp == NULL)
{
diff --git a/sesman/verify_user.c b/sesman/verify_user.c
index 98d3dd32..49c475c6 100644
--- a/sesman/verify_user.c
+++ b/sesman/verify_user.c
@@ -51,6 +51,7 @@ long DEFAULT_CC
auth_userpass(char *user, char *pass, int *errorcode)
{
const char *encr;
+ const char *epass;
struct passwd *spw;
struct spwd *stp;
@@ -84,8 +85,12 @@ auth_userpass(char *user, char *pass, int *errorcode)
/* old system with only passwd */
encr = spw->pw_passwd;
}
-
- return (strcmp(encr, crypt(pass, encr)) == 0);
+ epass = crypt(pass, encr);
+ if (epass == 0)
+ {
+ return 0;
+ }
+ return (strcmp(encr, epass) == 0);
}
/******************************************************************************/
diff --git a/vnc/vnc.c b/vnc/vnc.c
index e50dd70f..bb04726d 100644
--- a/vnc/vnc.c
+++ b/vnc/vnc.c
@@ -979,6 +979,13 @@ lib_mod_connect(struct vnc *v)
v->sck_obj = g_create_wait_obj_from_socket(v->sck, 0);
v->sck_closed = 0;
+ if (v->delay_ms > 0)
+ {
+ g_sprintf(text, "Waiting %d ms for VNC to start...", v->delay_ms);
+ v->server_msg(v, text, 0);
+ g_sleep(v->delay_ms);
+ }
+
g_sprintf(text, "VNC connecting to %s %s", v->ip, con_port);
v->server_msg(v, text, 0);
error = g_tcp_connect(v->sck, v->ip, con_port);
@@ -1331,6 +1338,10 @@ lib_mod_set_param(struct vnc *v, char *name, char *value)
{
v->keylayout = g_atoi(value);
}
+ else if (g_strcasecmp(name, "delay_ms") == 0)
+ {
+ v->delay_ms = g_atoi(value);
+ }
return 0;
}
diff --git a/vnc/vnc.h b/vnc/vnc.h
index 947b521f..6d265beb 100644
--- a/vnc/vnc.h
+++ b/vnc/vnc.h
@@ -115,4 +115,5 @@ struct vnc
char* clip_data;
int clip_data_size;
tbus sck_obj;
+ int delay_ms;
};
diff --git a/xorg/server/module/rdpCapture.c b/xorg/server/module/rdpCapture.c
index 69a5f147..72b95535 100644
--- a/xorg/server/module/rdpCapture.c
+++ b/xorg/server/module/rdpCapture.c
@@ -177,13 +177,14 @@ rdpCopyBox_a8r8g8b8_to_yuvalp(int ax, int ay,
y = (r * 19595 + g * 38470 + b * 7471) >> 16;
u = (r * -11071 + g * -21736 + b * 32807) >> 16;
v = (r * 32756 + g * -27429 + b * -5327) >> 16;
- y = y - 128;
- y = max(y, -128);
- u = max(u, -128);
- v = max(v, -128);
- y = min(y, 127);
- u = min(u, 127);
- v = min(v, 127);
+ u = u + 128;
+ v = v + 128;
+ y = max(y, 0);
+ u = max(u, 0);
+ v = max(v, 0);
+ y = min(y, 255);
+ u = min(u, 255);
+ v = min(v, 255);
*(yptr++) = y;
*(uptr++) = u;
*(vptr++) = v;
diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt
index 28bbc692..13fd064e 100644
--- a/xorg/server/readme.txt
+++ b/xorg/server/readme.txt
@@ -1,5 +1,47 @@
------------------------------------------------------
+11/01/2014
+------------------------------------------------------
+
+There are four modules built for the Xorg driver model and one configuration file
+This works best with newer Xorg installs, xserver 1.10 +, example Debian 7 +, Ubuntu 12.04 +
+
+To see what version you have, run
+xdpyinfo | grep version:
+or
+dpkg -l | grep xserver-xorg-core
+or
+yum list | grep xorg-x11-server-Xorg
+
+It should compile with older version and may run but may be problems.
+Usually, the problems are related to startup / login.
+
+autotools should build and install them
+
+./bootstrap
+./configure
+make
+sudo make install
+
+This should install the following...
+
+libxorgxrdp.so goes in /usr/lib/xorg/modules/
+xrdpdev_drv.so goes in /usr/lib/xorg/modules/drivers/
+xrdpkeyb_drv.so goes in /usr/lib/xorg/modules/input/
+xrdpmouse_drv.so goes in /usr/lib/xorg/modules/input/
+xorg.conf goes in /etc/X11/xrdp/
+
+with all these components in place, you can start Xorg with the xrdp modules with
+Xorg -config xrdp/xorg.conf -logfile /tmp/Xtmp.log -noreset -ac :10
+or
+Xorg -config xrdp/xorg.conf -logfile /dev/null -noreset -ac :10
+
+
+
+
+older notes
+
+------------------------------------------------------
Notes for building xrdpdev_drv.so and libxorgxrdp.so
------------------------------------------------------
diff --git a/xorgxrdp b/xorgxrdp
new file mode 160000
+Subproject 7c4d67356db815a9b4b003fca06394f43aaf7f8
diff --git a/xrdp/xrdp.ini b/xrdp/xrdp.ini
index 59122a00..34adb077 100644
--- a/xrdp/xrdp.ini
+++ b/xrdp/xrdp.ini
@@ -50,6 +50,9 @@ grey=dedede
# when true, userid/password *must* be passed on cmd line
# require_credentials=yes
+# set a default entry for autorun if the client send login and pass directly
+autorun=xrdp1
+
bulk_compression=yes
# You can set the PAM error text in a gateway setup (MAX 256 chars)
@@ -153,6 +156,7 @@ username=ask
password=ask
ip=127.0.0.1
port=-1
+#delay_ms=2000
[xrdp3]
name=console
@@ -161,6 +165,7 @@ ip=127.0.0.1
port=5900
username=na
password=ask
+#delay_ms=2000
[xrdp4]
name=vnc-any
@@ -172,6 +177,7 @@ password=ask
#pamusername=asksame
#pampassword=asksame
#pamsessionmng=127.0.0.1
+#delay_ms=2000
[xrdp5]
name=sesman-any
@@ -180,6 +186,7 @@ ip=ask
port=-1
username=ask
password=ask
+#delay_ms=2000
[xrdp6]
name=rdp-any