diff options
| -rw-r--r-- | common/arch.h | 2 | ||||
| -rw-r--r-- | common/ssl_calls.c | 6 | ||||
| -rw-r--r-- | configure.ac | 26 | ||||
| -rw-r--r-- | faq-compile.txt | 38 | ||||
| -rw-r--r-- | instfiles/pulse/default.pa | 1 | ||||
| -rw-r--r-- | keygen/keygen.c | 358 | ||||
| -rw-r--r-- | libxrdp/libxrdp.h | 570 | ||||
| -rw-r--r-- | libxrdp/libxrdpinc.h | 204 | ||||
| -rw-r--r-- | libxrdp/xrdp_orders_rail.h | 24 | ||||
| -rw-r--r-- | neutrinordp/xrdp-neutrinordp.c | 2 | ||||
| -rw-r--r-- | sesman/chansrv/Makefile.am | 10 | ||||
| -rw-r--r-- | sesman/chansrv/pcsc/xrdp_pcsc.c | 129 | ||||
| -rw-r--r-- | sesman/chansrv/rail.c | 90 | ||||
| -rw-r--r-- | sesman/chansrv/sound.c | 307 | ||||
| -rw-r--r-- | sesman/chansrv/sound.h | 9 | ||||
| -rwxr-xr-x | xorg/X11R7.6/buildx.sh | 6 |
16 files changed, 825 insertions, 957 deletions
diff --git a/common/arch.h b/common/arch.h index e04504f0..9fbca952 100644 --- a/common/arch.h +++ b/common/arch.h @@ -33,7 +33,7 @@ defined(__ia64__) || defined(__ppc__) || defined(__arm__) #define NEED_ALIGN #elif defined(__x86__) || defined(__x86_64__) || \ - defined(__AMD64__) || defined(_M_IX86) || \ + defined(__AMD64__) || defined(_M_IX86) || defined (_M_AMD64) || \ defined(__i386__) #define NO_NEED_ALIGN #else diff --git a/common/ssl_calls.c b/common/ssl_calls.c index a187edc9..134f5afd 100644 --- a/common/ssl_calls.c +++ b/common/ssl_calls.c @@ -400,7 +400,8 @@ ssl_gen_key_xrdp1(int key_size_in_bits, char *exp, int exp_len, int error; int len; - if ((exp_len != 4) || (mod_len != 64) || (pri_len != 64)) + if ((exp_len != 4) || ((mod_len != 64) && (mod_len != 256)) || + ((pri_len != 64) && (pri_len != 256))) { return 1; } @@ -469,7 +470,8 @@ ssl_gen_key_xrdp1(int key_size_in_bits, char *exp, int exp_len, int error; int len; - if ((exp_len != 4) || (mod_len != 64) || (pri_len != 64)) + if ((exp_len != 4) || ((mod_len != 64) && (mod_len != 256)) || + ((pri_len != 64) && (pri_len != 256))) { return 1; } diff --git a/configure.ac b/configure.ac index d11998f8..c3f95bf9 100644 --- a/configure.ac +++ b/configure.ac @@ -43,22 +43,10 @@ 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]) - -AC_ARG_ENABLE(simplesound, AS_HELP_STRING([--enable-simplesound], - [Build simple pulse audio interface (default: no)]), - [simplesound=true], [simplesound=false]) -AM_CONDITIONAL(XRDP_SIMPLESOUND, [test x$simplesound = xtrue]) - 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]) - -AC_ARG_ENABLE(loadpulsemodules, AS_HELP_STRING([--enable-loadpulsemodules], - [Build code to load pulse audio modules (default: no)]), - [loadpulsemodules=true], [loadpulsemodules=false]) -AM_CONDITIONAL(XRDP_LOAD_PULSE_MODULES, [test x$loadpulsemodules = xtrue]) - AC_ARG_ENABLE(xrdpvr, AS_HELP_STRING([--enable-xrdpvr], [Build xrdpvr module (default: no)]), [xrdpvr=true], [xrdpvr=false]) @@ -113,20 +101,6 @@ then [#define _FILE_OFFSET_BITS 64]) fi -# checking for libpulse -if ! test -z "$enable_loadpulsemodules" -then - AC_CHECK_HEADER([pulse/util.h], [], - [AC_MSG_ERROR([please install libpulse-dev or libpulse-devel])]) -fi - -# checking for libpulse libpulse-simple -if ! test -z "$enable_simplesound" -then - AC_CHECK_HEADER([pulse/simple.h], [], - [AC_MSG_ERROR([please install libpulse-dev or libpulse-devel])]) -fi - # checking for TurboJPEG if ! test -z "$enable_tjpeg" then diff --git a/faq-compile.txt b/faq-compile.txt index 1394c1cf..09f57d84 100644 --- a/faq-compile.txt +++ b/faq-compile.txt @@ -1,24 +1,34 @@ Compile FAQ -Q. I get error: security/pam_appl.h: File or directory doesn't exist +Q. I get one of the following errors: + - "security/pam_appl.h: File or directory doesn't exist" + - "configure: error: please install libpam0g-dev or pam-devel" What is wrong? -A. You need to install pam development package. +A. You need to install the pam development package. For Debian / Ubuntu this package is called libpam0g-dev. - For Red Hat / Suse this package is called pam-devel. + For Red Hat / SUSE this package is called pam-devel. -Q. I get error : -A. You need to install opensll development package. +Q. I get an error: "configure: error: please install libssl-dev or openssl-devel" + +A. You need to install the openssl development package. For Debian / Ubuntu this package is called libssl-dev. - For Red Hat / Suze this package is called openssl-devel. + For Red Hat / Fedora this package is called openssl-devel. + For SUSE / openSUSE this package is called libopenssl-devel. + + +Q. I get one of the following errors: + - "configure: error: please install libx11-dev or libX11-devel" + - "configure: error: please install libx11-dev and libxfixes-dev or libXfixes-devel" + +A. You need to install the X11 and X11 Xfixes development package(s). + For Debian: libx11-dev and libxfixes-dev. + For Red Hat / SUSE: libX11-devel and libXfixes-devel. + -Q. +Q. I get an error: "rail.c:31:35: fatal error: X11/extensions/Xrandr.h: No such file or directory" -A.i -Red Hat - libX11-devel - libXfixes-devel -Debian - libx11-dev - libxfixes-dev +A. You need to install the Xrandr development package. + For Debian / Ubuntu this package is called libxrandr-dev. + For SUSE / openSUSE this package is called libXrandr-devel. diff --git a/instfiles/pulse/default.pa b/instfiles/pulse/default.pa index 00bf55fc..38e9f790 100644 --- a/instfiles/pulse/default.pa +++ b/instfiles/pulse/default.pa @@ -3,4 +3,5 @@ load-module module-augment-properties load-module module-xrdp-sink load-module module-xrdp-source +load-module module-always-sink load-module module-native-protocol-unix diff --git a/keygen/keygen.c b/keygen/keygen.c index dda1e4b8..3cc1a2f3 100644 --- a/keygen/keygen.c +++ b/keygen/keygen.c @@ -36,19 +36,20 @@ /* default to 512 bit key size, can set changed, set */ static int g_key_size_bits = 512; -static int g_key_size_bytes = 64; static tui8 g_exponent[4] = { 0x01, 0x00, 0x01, 0x00 }; +/* 4 bytes public exponent */ static tui8 g_ppk_e[4] = { 0x5B, 0x7B, 0x88, 0xC0 }; -static tui8 g_ppk_n[72] = +/* 64 byte modulus */ +static tui8 g_ppk_n[72] = /* 64 bytes + 8 bytes pad */ { 0x3D, 0x3A, 0x5E, 0xBD, 0x72, 0x43, 0x3E, 0xC9, 0x4D, 0xBB, 0xC1, 0x1E, 0x4A, 0xBA, 0x5F, 0xCB, @@ -61,7 +62,8 @@ static tui8 g_ppk_n[72] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static tui8 g_ppk_d[108] = +/* 64 bytes private exponent */ +static tui8 g_ppk_d[108] = /* 64 bytes + 44 bytes pad */ { 0x87, 0xA7, 0x19, 0x32, 0xDA, 0x11, 0x87, 0x55, 0x58, 0x00, 0x16, 0x16, 0x25, 0x65, 0x68, 0xF8, @@ -79,40 +81,115 @@ static tui8 g_ppk_d[108] = 0x00, 0x00, 0x00, 0x00 }; -static tui8 g_testkey[176] = +/* 512 bit proprietary certificate + dwVersion 0 4 bytes always 0x00000001 + dwSigAlgId 4 4 bytes always 0x00000001 + dwKeyAlgId 8 4 bytes always 0x00000001 + wPublicKeyBlobType 12 2 bytes always 0x0006 + wPublicKeyBlobLen 14 2 bytes 0x005C 92 bytes + magic 16 4 bytes always 0x31415352 + keylen 20 4 bytes 0x0048 72 bytes + bitlen 24 4 bytes 0x0200 512 bits + datalen 28 4 bytes 0x003F 63 bytes + pubExp 32 4 bytes 0x00010001 + modulus 36 72 bytes + wSignatureBlobType 108 2 bytes always 0x0008 + wSignatureBlobLen 110 2 bytes 0x0048 72 bytes + SignatureBlob 112 72 bytes */ + +static tui8 g_testkey512[184] = /* 512 bit test key */ { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* 0 */ 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x5c, 0x00, 0x52, 0x53, 0x41, 0x31, 0x48, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x01, 0x00, 0x79, 0x6f, 0xb4, 0xdf, + 0x01, 0x00, 0x01, 0x00, 0x79, 0x6f, 0xb4, 0xdf, /* 32 */ 0xa6, 0x95, 0xb9, 0xa9, 0x61, 0xe3, 0xc4, 0x5e, 0xff, 0x6b, 0xd8, 0x81, 0x8a, 0x12, 0x4a, 0x93, 0x42, 0x97, 0x18, 0x93, 0xac, 0xd1, 0x3a, 0x38, - 0x3c, 0x68, 0x50, 0x19, 0x31, 0xb6, 0x84, 0x51, + 0x3c, 0x68, 0x50, 0x19, 0x31, 0xb6, 0x84, 0x51, /* 64 */ 0x79, 0xfb, 0x1c, 0xe7, 0xe3, 0x99, 0x20, 0xc7, 0x84, 0xdf, 0xd1, 0xaa, 0xb5, 0x15, 0xef, 0x47, 0x7e, 0xfc, 0x88, 0xeb, 0x29, 0xc3, 0x27, 0x5a, - 0x35, 0xf8, 0xfd, 0xaa, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x48, 0x00, + 0x35, 0xf8, 0xfd, 0xaa, 0x00, 0x00, 0x00, 0x00, /* 96 */ + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x48, 0x00, 0x32, 0x3b, 0xde, 0x6f, 0x18, 0x97, 0x1e, 0xc3, 0x6b, 0x2b, 0x2d, 0xe4, 0xfc, 0x2d, 0xa2, 0x8e, - 0x32, 0x3c, 0xf3, 0x1b, 0x24, 0x90, 0x57, 0x4d, + 0x32, 0x3c, 0xf3, 0x1b, 0x24, 0x90, 0x57, 0x4d, /* 128 */ 0x8e, 0xe4, 0x69, 0xfc, 0x16, 0x8d, 0x41, 0x92, 0x78, 0xc7, 0x9c, 0xb4, 0x26, 0xff, 0xe8, 0x3e, 0xa1, 0x8a, 0xf5, 0x57, 0xc0, 0x7f, 0x3e, 0x21, - 0x17, 0x32, 0x30, 0x6f, 0x79, 0xe1, 0x36, 0xcd, - 0xb6, 0x8e, 0xbe, 0x57, 0x57, 0xd2, 0xa9, 0x36 + 0x17, 0x32, 0x30, 0x6f, 0x79, 0xe1, 0x36, 0xcd, /* 160 */ + 0xb6, 0x8e, 0xbe, 0x57, 0x57, 0xd2, 0xa9, 0x36, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -/* this is the installed signature */ -char inst_pub_sig[] = "0x6a,0x41,0xb1,0x43,0xcf,0x47,0x6f,0xf1,0xe6,0xcc,0xa1,\ -0x72,0x97,0xd9,0xe1,0x85,0x15,0xb3,0xc2,0x39,0xa0,0xa6,0x26,0x1a,0xb6,\ -0x49,0x01,0xfa,0xa6,0xda,0x60,0xd7,0x45,0xf7,0x2c,0xee,0xe4,0x8e,0x64,\ -0x2e,0x37,0x49,0xf0,0x4c,0x94,0x6f,0x08,0xf5,0x63,0x4c,0x56,0x29,0x55,\ -0x5a,0x63,0x41,0x2c,0x20,0x65,0x95,0x99,0xb1,0x15,0x7c"; - +/* 2048 bit proprietary certificate + dwVersion 0 4 bytes always 0x00000001 + dwSigAlgId 4 4 bytes always 0x00000001 + dwKeyAlgId 8 4 bytes always 0x00000001 + wPublicKeyBlobType 12 2 bytes always 0x0006 + wPublicKeyBlobLen 14 2 bytes 0x011C 284 bytes + magic 16 4 bytes always 0x31415352 + keylen 20 4 bytes 0x0108 264 bytes + bitlen 24 4 bytes 0x0800 2048 bits + datalen 28 4 bytes 0x00FF 255 bytes + pubExp 32 4 bytes 0x00010001 + modulus 36 264 bytes + wSignatureBlobType 300 2 bytes always 0x0008 + wSignatureBlobLen 302 2 bytes 0x0048 72 bytes + SignatureBlob 304 72 bytes */ + +static tui8 g_testkey2048[376] = /* 2048 bit test key */ +{ + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* 0 */ + 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x1c, 0x01, + 0x52, 0x53, 0x41, 0x31, 0x08, 0x01, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x13, 0x77, 0x6d, 0xd8, /* 32 */ + 0x7b, 0x6e, 0x6f, 0xb4, 0x27, 0x6d, 0x70, 0x3a, + 0x97, 0x5f, 0xcb, 0x50, 0x9b, 0x13, 0x6b, 0xc7, + 0xba, 0xdf, 0x73, 0x54, 0x17, 0x35, 0xf0, 0x09, + 0x9e, 0x9d, 0x0b, 0x6a, 0x2c, 0x9f, 0xd1, 0x0c, /* 64 */ + 0xc6, 0x47, 0x83, 0xde, 0xca, 0x90, 0x20, 0xac, + 0x70, 0x63, 0x9b, 0xb7, 0x49, 0x07, 0x0b, 0xf5, + 0xf2, 0x38, 0x2a, 0x40, 0xff, 0xf1, 0xba, 0x97, + 0x79, 0x3e, 0xd4, 0xd1, 0xf3, 0x41, 0x0f, 0x91, /* 96 */ + 0xfe, 0x1a, 0x86, 0xf4, 0x1b, 0xef, 0xcc, 0x29, + 0xa3, 0x35, 0x6f, 0x60, 0xfa, 0x98, 0x53, 0x51, + 0x80, 0x57, 0x15, 0x2f, 0xe1, 0x8b, 0xd7, 0x86, + 0x15, 0x2d, 0xb5, 0xec, 0x7a, 0xdd, 0xc5, 0x1d, /* 128 */ + 0x1b, 0x88, 0x53, 0x67, 0x86, 0xe1, 0x6e, 0xcd, + 0x4e, 0x2e, 0xfd, 0xd2, 0x49, 0x04, 0xfb, 0x1d, + 0x95, 0xf0, 0xe9, 0x7f, 0x97, 0xa3, 0x1b, 0xb2, + 0x92, 0x2e, 0x62, 0x2a, 0x96, 0xd4, 0xea, 0x18, /* 160 */ + 0x8e, 0x99, 0x41, 0xea, 0x83, 0xb5, 0xf1, 0x0e, + 0xea, 0x53, 0x70, 0x99, 0xd7, 0x9e, 0x0c, 0x65, + 0x2b, 0xf4, 0xdc, 0x0e, 0xe7, 0x9e, 0xce, 0x04, + 0x25, 0x01, 0x88, 0xc4, 0xc1, 0xd2, 0xa4, 0x18, /* 192 */ + 0xc2, 0x8a, 0x52, 0x0f, 0x01, 0xb2, 0x71, 0x30, + 0x44, 0x3f, 0x5b, 0x11, 0x2e, 0xe7, 0x53, 0xa0, + 0xc8, 0x1f, 0x77, 0xaf, 0xb5, 0xbb, 0xaf, 0x12, + 0xe8, 0x19, 0x0c, 0xf6, 0x1f, 0xa8, 0x3e, 0x11, /* 224 */ + 0x34, 0xe4, 0xac, 0x1c, 0x1c, 0x00, 0xbb, 0xb9, + 0x2f, 0xbb, 0x81, 0x76, 0x4e, 0x46, 0xda, 0x73, + 0x00, 0x82, 0x71, 0xa4, 0x62, 0xc3, 0xd4, 0x3f, + 0xda, 0x34, 0x54, 0x27, 0xe3, 0xd0, 0x3a, 0x73, /* 256 */ + 0x2f, 0x99, 0xc4, 0x91, 0x56, 0x12, 0x98, 0xa8, + 0x3b, 0x8d, 0x61, 0x83, 0x62, 0xb7, 0x20, 0x61, + 0x4d, 0xc9, 0x41, 0xd1, 0x40, 0x02, 0x11, 0x4b, + 0x63, 0x46, 0xc7, 0xc1, 0x00, 0x00, 0x00, 0x00, /* 288 */ + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x48, 0x00, + 0x00, 0x50, 0xb7, 0x75, 0xf3, 0x77, 0x99, 0xb2, + 0xd3, 0xdd, 0xcd, 0x83, 0x6e, 0xdb, 0x0a, 0x29, + 0x88, 0x05, 0xb5, 0x8a, 0x49, 0xd5, 0xa8, 0x5a, /* 320 */ + 0xc3, 0xb7, 0x18, 0xc2, 0x3c, 0x1e, 0xde, 0xd3, + 0x8f, 0xdd, 0x21, 0x27, 0x84, 0xa0, 0xc8, 0x8d, + 0x65, 0xce, 0x5d, 0x3d, 0x46, 0x65, 0x88, 0xfc, + 0x35, 0x0a, 0x04, 0xa0, 0xda, 0xc1, 0xab, 0xbf, /* 352 */ + 0xcd, 0xf1, 0x7e, 0x71, 0x7b, 0xf8, 0x4a, 0x78, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; /*****************************************************************************/ static int APP_CC @@ -120,7 +197,7 @@ out_params(void) { g_writeln(""); g_writeln("xrdp rsa key gen utility examples"); - g_writeln(" xrdp-keygen xrdp ['path and file name' | auto]"); + g_writeln(" xrdp-keygen xrdp ['path and file name' | auto] [512 or 2048]"); g_writeln(" xrdp-keygen test"); g_writeln(""); return 0; @@ -136,37 +213,73 @@ sign_key(char *e_data, int e_len, char *n_data, int n_len, char *md5_final; void *md5; - if ((e_len != 4) || (n_len != 64) || (sign_len != 64)) + if ((e_len != 4) || ((n_len != 64) && (n_len != 256)) || (sign_len != 64)) { return 1; } - - key = (char *)g_malloc(176, 0); - md5_final = (char *)g_malloc(64, 0); - md5 = ssl_md5_info_create(); - /* copy the test key */ - g_memcpy(key, g_testkey, 176); - /* replace e and n */ - g_memcpy(key + 32, e_data, 4); - g_memcpy(key + 36, n_data, 64); - ssl_md5_clear(md5); - /* the first 108 bytes */ - ssl_md5_transform(md5, key, 108); - /* set the whole thing with 0xff */ - g_memset(md5_final, 0xff, 64); - /* digest 16 bytes */ - ssl_md5_complete(md5, md5_final); - /* set non 0xff array items */ - md5_final[16] = 0; - md5_final[62] = 1; - md5_final[63] = 0; - /* encrypt */ - ssl_mod_exp(sign_data, 64, md5_final, 64, (char *)g_ppk_n, 64, - (char *)g_ppk_d, 64); - /* cleanup */ - ssl_md5_info_delete(md5); - g_free(key); - g_free(md5_final); + + if (n_len == 64) + { + key = (char *)g_malloc(184, 0); + md5_final = (char *)g_malloc(64, 0); + md5 = ssl_md5_info_create(); + /* copy the test key */ + g_memcpy(key, g_testkey512, 184); + /* replace e and n */ + g_memcpy(key + 32, e_data, e_len); + g_memcpy(key + 36, n_data, n_len); + ssl_md5_clear(md5); + /* the first 108 bytes */ + ssl_md5_transform(md5, key, 108); + /* set the whole thing with 0xff */ + g_memset(md5_final, 0xff, 64); + /* digest 16 bytes */ + ssl_md5_complete(md5, md5_final); + /* set non 0xff array items */ + md5_final[16] = 0; + md5_final[62] = 1; + md5_final[63] = 0; + /* encrypt */ + ssl_mod_exp(sign_data, sign_len, md5_final, 64, (char *)g_ppk_n, 64, + (char *)g_ppk_d, 64); + /* cleanup */ + ssl_md5_info_delete(md5); + g_free(key); + g_free(md5_final); + } + else if (n_len == 256) + { + key = (char *)g_malloc(376, 0); + md5_final = (char *)g_malloc(64, 0); + md5 = ssl_md5_info_create(); + /* copy the test key */ + g_memcpy(key, g_testkey2048, 376); + /* replace e and n */ + g_memcpy(key + 32, e_data, e_len); + g_memcpy(key + 36, n_data, n_len); + ssl_md5_clear(md5); + /* the first 300 bytes */ + ssl_md5_transform(md5, key, 300); + /* set the whole thing with 0xff */ + g_memset(md5_final, 0xff, 64); + /* digest 16 bytes */ + ssl_md5_complete(md5, md5_final); + /* set non 0xff array items */ + md5_final[16] = 0; + md5_final[62] = 1; + md5_final[63] = 0; + /* encrypt */ + ssl_mod_exp(sign_data, sign_len, md5_final, 64, (char *)g_ppk_n, 64, + (char *)g_ppk_d, 64); + /* cleanup */ + ssl_md5_info_delete(md5); + g_free(key); + g_free(md5_final); + } + else + { + g_writeln("problem"); + } return 0; } @@ -292,12 +405,12 @@ key_gen(const char *path_and_file_name) int error; e_data = (char *)g_exponent; - n_data = (char *)g_malloc(64, 0); - d_data = (char *)g_malloc(64, 0); + n_data = (char *)g_malloc(256, 0); + d_data = (char *)g_malloc(256, 0); sign_data = (char *)g_malloc(64, 0); e_len = 4; - n_len = 64; - d_len = 64; + n_len = g_key_size_bits / 8; + d_len = n_len; sign_len = 64; error = 0; g_writeln(""); @@ -345,84 +458,58 @@ key_gen(const char *path_and_file_name) } /*****************************************************************************/ -/* returns boolean */ static int APP_CC -key_gen_run_it(void) +key_gen_auto(void) { - int fd; - int index; - int rv; - struct list *names; - struct list *values; - char *name; - char *value; - - if (!g_file_exist("/etc/xrdp/rsakeys.ini")) - { - return 1; - } - - if (g_file_get_size("/etc/xrdp/rsakeys.ini") < 10) - { - return 1; - } - - fd = g_file_open("/etc/xrdp/rsakeys.ini"); - - if (fd < 0) - { - return 1; - } - - rv = 0; - names = list_create(); - names->auto_free = 1; - values = list_create(); - values->auto_free = 1; - - if (file_read_section(fd, "keys", names, values) == 0) - { - for (index = 0; index < names->count; index++) - { - name = (char *)list_get_item(names, index); - value = (char *)list_get_item(values, index); - - if (g_strcasecmp(name, "pub_sig") == 0) - { - if (g_strcasecmp(value, inst_pub_sig) == 0) - { - rv = 1; - } - } - } - } - else - { - g_writeln("error reading keys section of rsakeys.ini"); - } - - list_delete(names); - list_delete(values); - g_file_close(fd); - return rv; + return key_gen("/etc/xrdp/rsakeys.ini"); } /*****************************************************************************/ static int APP_CC -key_gen_auto(void) +key_test512(void) { - if (key_gen_run_it()) - { - return key_gen("/etc/xrdp/rsakeys.ini"); - } + char *md5_final; + char *sig; + void *md5; - g_writeln("xrdp-keygen does not need to run"); + md5_final = (char *)g_malloc(64, 0); + sig = (char *)g_malloc(64, 0); + md5 = ssl_md5_info_create(); + g_writeln("original key is:"); + g_hexdump((char *)g_testkey512, 184); + g_writeln("original exponent is:"); + g_hexdump((char *)g_testkey512 + 32, 4); + g_writeln("original modulus is:"); + g_hexdump((char *)g_testkey512 + 36, 64); + g_writeln("original signature is:"); + g_hexdump((char *)g_testkey512 + 112, 64); + ssl_md5_clear(md5); + ssl_md5_transform(md5, (char *)g_testkey512, 108); + g_memset(md5_final, 0xff, 64); + ssl_md5_complete(md5, md5_final); + g_writeln("md5 hash of first 108 bytes of this key is:"); + g_hexdump(md5_final, 16); + md5_final[16] = 0; + md5_final[62] = 1; + md5_final[63] = 0; + ssl_mod_exp(sig, 64, md5_final, 64, (char *)g_ppk_n, 64, (char *)g_ppk_d, 64); + g_writeln("produced signature(this should match original " + "signature above) is:"); + g_hexdump(sig, 64); + g_memset(md5_final, 0, 64); + ssl_mod_exp(md5_final, 64, (char *)g_testkey512 + 112, 64, (char *)g_ppk_n, 64, + (char *)g_ppk_e, 4); + g_writeln("decrypted hash of first 108 bytes of this key is:"); + g_hexdump(md5_final, 64); + ssl_md5_info_delete(md5); + g_free(md5_final); + g_free(sig); return 0; } /*****************************************************************************/ static int APP_CC -key_test(void) +key_test2048(void) { char *md5_final; char *sig; @@ -432,28 +519,28 @@ key_test(void) sig = (char *)g_malloc(64, 0); md5 = ssl_md5_info_create(); g_writeln("original key is:"); - g_hexdump((char *)g_testkey, 176); + g_hexdump((char *)g_testkey2048, 376); g_writeln("original exponent is:"); - g_hexdump((char *)g_testkey + 32, 4); + g_hexdump((char *)g_testkey2048 + 32, 4); g_writeln("original modulus is:"); - g_hexdump((char *)g_testkey + 36, 64); + g_hexdump((char *)g_testkey2048 + 36, 256); g_writeln("original signature is:"); - g_hexdump((char *)g_testkey + 112, 64); + g_hexdump((char *)g_testkey2048 + 304, 64); ssl_md5_clear(md5); - ssl_md5_transform(md5, (char *)g_testkey, 108); + ssl_md5_transform(md5, (char *)g_testkey2048, 300); g_memset(md5_final, 0xff, 64); ssl_md5_complete(md5, md5_final); - g_writeln("md5 hash of first 108 bytes of this key is:"); + g_writeln("md5 hash of first 300 bytes of this key is:"); g_hexdump(md5_final, 16); md5_final[16] = 0; md5_final[62] = 1; md5_final[63] = 0; ssl_mod_exp(sig, 64, md5_final, 64, (char *)g_ppk_n, 64, (char *)g_ppk_d, 64); - g_writeln("produced signature(this should match original \ -signature above) is:"); + g_writeln("produced signature(this should match original " + "signature above) is:"); g_hexdump(sig, 64); g_memset(md5_final, 0, 64); - ssl_mod_exp(md5_final, 64, (char *)g_testkey + 112, 64, (char *)g_ppk_n, 64, + ssl_mod_exp(md5_final, 64, (char *)g_testkey2048 + 304, 64, (char *)g_ppk_n, 64, (char *)g_ppk_e, 4); g_writeln("decrypted hash of first 108 bytes of this key is:"); g_hexdump(md5_final, 64); @@ -473,6 +560,15 @@ main(int argc, char **argv) { if (argc > 2) { + if (argc > 3) + { + g_key_size_bits = g_atoi(argv[3]); + if ((g_key_size_bits != 512) && (g_key_size_bits != 2048)) + { + out_params(); + return 0; + } + } if (g_strcasecmp(argv[2], "auto") == 0) { if (g_getuid() != 0) @@ -495,7 +591,13 @@ main(int argc, char **argv) } else if (g_strcasecmp(argv[1], "test") == 0) { - return key_test(); + g_writeln(""); + g_writeln("testing 512 bit key"); + key_test512(); + g_writeln(""); + g_writeln("testing 2048 bit key"); + key_test2048(); + return 0; } } diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h index b909dd72..2ea8b61d 100644 --- a/libxrdp/libxrdp.h +++ b/libxrdp/libxrdp.h @@ -41,40 +41,40 @@ /* iso */ struct xrdp_iso { - struct xrdp_mcs* mcs_layer; /* owner */ - int requestedProtocol; - int selectedProtocol; - struct trans* trans; + struct xrdp_mcs *mcs_layer; /* owner */ + int requestedProtocol; + int selectedProtocol; + struct trans *trans; }; /* used in mcs */ struct mcs_channel_item { - char name[16]; - int flags; - int chanid; + char name[16]; + int flags; + int chanid; }; /* mcs */ struct xrdp_mcs { - struct xrdp_sec* sec_layer; /* owner */ - struct xrdp_iso* iso_layer; - int userid; - int chanid; - struct stream* client_mcs_data; - struct stream* server_mcs_data; - struct list* channel_list; + struct xrdp_sec *sec_layer; /* owner */ + struct xrdp_iso *iso_layer; + int userid; + int chanid; + struct stream *client_mcs_data; + struct stream *server_mcs_data; + struct list *channel_list; }; /* fastpath */ struct xrdp_fastpath { - struct xrdp_sec* sec_layer; /* owner */ - struct trans* trans; - struct xrdp_session* session; - int numEvents; - int secFlags; + struct xrdp_sec *sec_layer; /* owner */ + struct trans *trans; + struct xrdp_session *session; + int numEvents; + int secFlags; }; /* Encryption Methods */ @@ -95,175 +95,175 @@ struct xrdp_fastpath /* sec */ struct xrdp_sec { - struct xrdp_rdp* rdp_layer; /* owner */ - struct xrdp_mcs* mcs_layer; - struct xrdp_fastpath* fastpath_layer; - struct xrdp_channel* chan_layer; - char server_random[32]; - char client_random[64]; - char client_crypt_random[72]; - struct stream client_mcs_data; - struct stream server_mcs_data; - int decrypt_use_count; - int encrypt_use_count; - char decrypt_key[16]; - char encrypt_key[16]; - char decrypt_update_key[16]; - char encrypt_update_key[16]; - int crypt_method; - int rc4_key_len; /* 8 = 40 bit, 16 = 128 bit */ - int crypt_level; - char sign_key[16]; - void* decrypt_rc4_info; - void* encrypt_rc4_info; - char pub_exp[4]; - char pub_mod[64]; - char pub_sig[64]; - char pri_exp[64]; - int channel_code; - int multimon; - char fips_encrypt_key[24]; - char fips_decrypt_key[24]; - char fips_sign_key[20]; - void* encrypt_fips_info; - void* decrypt_fips_info; - void* sign_fips_info; + struct xrdp_rdp *rdp_layer; /* owner */ + struct xrdp_mcs *mcs_layer; + struct xrdp_fastpath *fastpath_layer; + struct xrdp_channel *chan_layer; + char server_random[32]; + char client_random[64]; + char client_crypt_random[72]; + struct stream client_mcs_data; + struct stream server_mcs_data; + int decrypt_use_count; + int encrypt_use_count; + char decrypt_key[16]; + char encrypt_key[16]; + char decrypt_update_key[16]; + char encrypt_update_key[16]; + int crypt_method; + int rc4_key_len; /* 8 = 40 bit, 16 = 128 bit */ + int crypt_level; + char sign_key[16]; + void *decrypt_rc4_info; + void *encrypt_rc4_info; + char pub_exp[4]; + char pub_mod[64]; + char pub_sig[64]; + char pri_exp[64]; + int channel_code; + int multimon; + char fips_encrypt_key[24]; + char fips_decrypt_key[24]; + char fips_sign_key[20]; + void *encrypt_fips_info; + void *decrypt_fips_info; + void *sign_fips_info; }; /* channel */ struct xrdp_channel { - struct xrdp_sec* sec_layer; - struct xrdp_mcs* mcs_layer; + struct xrdp_sec *sec_layer; + struct xrdp_mcs *mcs_layer; }; /* rdp */ struct xrdp_rdp { - struct xrdp_session* session; - struct xrdp_sec* sec_layer; - int share_id; - int mcs_channel; - struct xrdp_client_info client_info; - struct xrdp_mppc_enc* mppc_enc; - void* rfx_enc; + struct xrdp_session *session; + struct xrdp_sec *sec_layer; + int share_id; + int mcs_channel; + struct xrdp_client_info client_info; + struct xrdp_mppc_enc *mppc_enc; + void *rfx_enc; }; /* state */ struct xrdp_orders_state { - int last_order; /* last order sent */ - - int clip_left; /* RDP_ORDER_BOUNDS, RDP_ORDER_LASTBOUNDS */ - int clip_top; - int clip_right; - int clip_bottom; - - int rect_x; /* RDP_ORDER_RECT */ - int rect_y; - int rect_cx; - int rect_cy; - int rect_color; - - int scr_blt_x; /* RDP_ORDER_SCREENBLT */ - int scr_blt_y; - int scr_blt_cx; - int scr_blt_cy; - int scr_blt_rop; - int scr_blt_srcx; - int scr_blt_srcy; - - int pat_blt_x; /* RDP_ORDER_PATBLT */ - int pat_blt_y; - int pat_blt_cx; - int pat_blt_cy; - int pat_blt_rop; - int pat_blt_bg_color; - int pat_blt_fg_color; - struct xrdp_brush pat_blt_brush; - - int dest_blt_x; /* RDP_ORDER_DESTBLT */ - int dest_blt_y; - int dest_blt_cx; - int dest_blt_cy; - int dest_blt_rop; - - int line_mix_mode; /* RDP_ORDER_LINE */ - int line_startx; - int line_starty; - int line_endx; - int line_endy; - int line_bg_color; - int line_rop; - struct xrdp_pen line_pen; - - int mem_blt_color_table; /* RDP_ORDER_MEMBLT */ - int mem_blt_cache_id; - int mem_blt_x; - int mem_blt_y; - int mem_blt_cx; - int mem_blt_cy; - int mem_blt_rop; - int mem_blt_srcx; - int mem_blt_srcy; - int mem_blt_cache_idx; - - int text_font; /* RDP_ORDER_TEXT2 */ - int text_flags; - int text_unknown; - int text_mixmode; - int text_fg_color; - int text_bg_color; - int text_clip_left; - int text_clip_top; - int text_clip_right; - int text_clip_bottom; - int text_box_left; - int text_box_top; - int text_box_right; - int text_box_bottom; - int text_x; - int text_y; - int text_len; - char* text_data; - - int com_blt_srcidx; /* RDP_ORDER_COMPOSITE */ /* 2 */ - int com_blt_srcformat; /* 2 */ - int com_blt_srcwidth; /* 2 */ - int com_blt_srcrepeat; /* 1 */ - int com_blt_srctransform[10]; /* 40 */ - int com_blt_mskflags; /* 1 */ - int com_blt_mskidx; /* 2 */ - int com_blt_mskformat; /* 2 */ - int com_blt_mskwidth; /* 2 */ - int com_blt_mskrepeat; /* 1 */ - int com_blt_op; /* 1 */ - int com_blt_srcx; /* 2 */ - int com_blt_srcy; /* 2 */ - int com_blt_mskx; /* 2 */ - int com_blt_msky; /* 2 */ - int com_blt_dstx; /* 2 */ - int com_blt_dsty; /* 2 */ - int com_blt_width; /* 2 */ - int com_blt_height; /* 2 */ - int com_blt_dstformat; /* 2 */ + int last_order; /* last order sent */ + + int clip_left; /* RDP_ORDER_BOUNDS, RDP_ORDER_LASTBOUNDS */ + int clip_top; + int clip_right; + int clip_bottom; + + int rect_x; /* RDP_ORDER_RECT */ + int rect_y; + int rect_cx; + int rect_cy; + int rect_color; + + int scr_blt_x; /* RDP_ORDER_SCREENBLT */ + int scr_blt_y; + int scr_blt_cx; + int scr_blt_cy; + int scr_blt_rop; + int scr_blt_srcx; + int scr_blt_srcy; + + int pat_blt_x; /* RDP_ORDER_PATBLT */ + int pat_blt_y; + int pat_blt_cx; + int pat_blt_cy; + int pat_blt_rop; + int pat_blt_bg_color; + int pat_blt_fg_color; + struct xrdp_brush pat_blt_brush; + + int dest_blt_x; /* RDP_ORDER_DESTBLT */ + int dest_blt_y; + int dest_blt_cx; + int dest_blt_cy; + int dest_blt_rop; + + int line_mix_mode; /* RDP_ORDER_LINE */ + int line_startx; + int line_starty; + int line_endx; + int line_endy; + int line_bg_color; + int line_rop; + struct xrdp_pen line_pen; + + int mem_blt_color_table; /* RDP_ORDER_MEMBLT */ + int mem_blt_cache_id; + int mem_blt_x; + int mem_blt_y; + int mem_blt_cx; + int mem_blt_cy; + int mem_blt_rop; + int mem_blt_srcx; + int mem_blt_srcy; + int mem_blt_cache_idx; + + int text_font; /* RDP_ORDER_TEXT2 */ + int text_flags; + int text_unknown; + int text_mixmode; + int text_fg_color; + int text_bg_color; + int text_clip_left; + int text_clip_top; + int text_clip_right; + int text_clip_bottom; + int text_box_left; + int text_box_top; + int text_box_right; + int text_box_bottom; + int text_x; + int text_y; + int text_len; + char *text_data; + + int com_blt_srcidx; /* RDP_ORDER_COMPOSITE */ /* 2 */ + int com_blt_srcformat; /* 2 */ + int com_blt_srcwidth; /* 2 */ + int com_blt_srcrepeat; /* 1 */ + int com_blt_srctransform[10]; /* 40 */ + int com_blt_mskflags; /* 1 */ + int com_blt_mskidx; /* 2 */ + int com_blt_mskformat; /* 2 */ + int com_blt_mskwidth; /* 2 */ + int com_blt_mskrepeat; /* 1 */ + int com_blt_op; /* 1 */ + int com_blt_srcx; /* 2 */ + int com_blt_srcy; /* 2 */ + int com_blt_mskx; /* 2 */ + int com_blt_msky; /* 2 */ + int com_blt_dstx; /* 2 */ + int com_blt_dsty; /* 2 */ + int com_blt_width; /* 2 */ + int com_blt_height; /* 2 */ + int com_blt_dstformat; /* 2 */ }; /* orders */ struct xrdp_orders { - struct stream* out_s; - struct xrdp_rdp* rdp_layer; - struct xrdp_session* session; - struct xrdp_wm* wm; - - char* order_count_ptr; /* pointer to count, set when sending */ - int order_count; - int order_level; /* inc for every call to xrdp_orders_init */ - struct xrdp_orders_state orders_state; - void* jpeg_han; - int rfx_min_pixel; + struct stream *out_s; + struct xrdp_rdp *rdp_layer; + struct xrdp_session *session; + struct xrdp_wm *wm; + + char *order_count_ptr; /* pointer to count, set when sending */ + int order_count; + int order_level; /* inc for every call to xrdp_orders_init */ + struct xrdp_orders_state orders_state; + void *jpeg_han; + int rfx_min_pixel; }; #define PROTO_RDP_40 1 @@ -271,17 +271,17 @@ struct xrdp_orders struct xrdp_mppc_enc { - int protocol_type; /* PROTO_RDP_40, PROTO_RDP_50 etc */ - char *historyBuffer; /* contains uncompressed data */ - char *outputBuffer; /* contains compressed data */ - char *outputBufferPlus; - int historyOffset; /* next free slot in historyBuffer */ - int buf_len; /* length of historyBuffer, protocol dependant */ - int bytes_in_opb; /* compressed bytes available in outputBuffer */ - int flags; /* PACKET_COMPRESSED, PACKET_AT_FRONT, PACKET_FLUSHED etc */ - int flagsHold; - int first_pkt; /* this is the first pkt passing through enc */ - tui16 *hash_table; + int protocol_type; /* PROTO_RDP_40, PROTO_RDP_50 etc */ + char *historyBuffer; /* contains uncompressed data */ + char *outputBuffer; /* contains compressed data */ + char *outputBufferPlus; + int historyOffset; /* next free slot in historyBuffer */ + int buf_len; /* length of historyBuffer, protocol dependant */ + int bytes_in_opb; /* compressed bytes available in outputBuffer */ + int flags; /* PACKET_COMPRESSED, PACKET_AT_FRONT, PACKET_FLUSHED etc */ + int flagsHold; + int first_pkt; /* this is the first pkt passing through enc */ + tui16 *hash_table; }; int APP_CC @@ -292,59 +292,59 @@ void APP_CC mppc_enc_free(struct xrdp_mppc_enc *enc); /* xrdp_tcp.c */ -struct xrdp_tcp* APP_CC -xrdp_tcp_create(struct xrdp_iso* owner, struct trans* trans); +struct xrdp_tcp * APP_CC +xrdp_tcp_create(struct xrdp_iso *owner, struct trans *trans); void APP_CC -xrdp_tcp_delete(struct xrdp_tcp* self); +xrdp_tcp_delete(struct xrdp_tcp *self); int APP_CC -xrdp_tcp_init(struct xrdp_tcp* self, struct stream* s); +xrdp_tcp_init(struct xrdp_tcp *self, struct stream *s); int APP_CC -xrdp_tcp_recv(struct xrdp_tcp* self, struct stream* s, int len); +xrdp_tcp_recv(struct xrdp_tcp *self, struct stream *s, int len); int APP_CC -xrdp_tcp_send(struct xrdp_tcp* self, struct stream* s); +xrdp_tcp_send(struct xrdp_tcp *self, struct stream *s); /* xrdp_iso.c */ -struct xrdp_iso* APP_CC -xrdp_iso_create(struct xrdp_mcs* owner, struct trans* trans); +struct xrdp_iso * APP_CC +xrdp_iso_create(struct xrdp_mcs *owner, struct trans *trans); void APP_CC -xrdp_iso_delete(struct xrdp_iso* self); +xrdp_iso_delete(struct xrdp_iso *self); int APP_CC -xrdp_iso_init(struct xrdp_iso* self, struct stream* s); +xrdp_iso_init(struct xrdp_iso *self, struct stream *s); int APP_CC -xrdp_iso_recv(struct xrdp_iso* self, struct stream* s); +xrdp_iso_recv(struct xrdp_iso *self, struct stream *s); int APP_CC -xrdp_iso_send(struct xrdp_iso* self, struct stream* s); +xrdp_iso_send(struct xrdp_iso *self, struct stream *s); int APP_CC -xrdp_iso_incoming(struct xrdp_iso* self); +xrdp_iso_incoming(struct xrdp_iso *self); int APP_CC xrdp_iso_detect_tpkt(struct xrdp_iso *self, struct stream *s); /* xrdp_mcs.c */ -struct xrdp_mcs* APP_CC -xrdp_mcs_create(struct xrdp_sec* owner, struct trans* trans, - struct stream* client_mcs_data, - struct stream* server_mcs_data); +struct xrdp_mcs * APP_CC +xrdp_mcs_create(struct xrdp_sec *owner, struct trans *trans, + struct stream *client_mcs_data, + struct stream *server_mcs_data); void APP_CC -xrdp_mcs_delete(struct xrdp_mcs* self); +xrdp_mcs_delete(struct xrdp_mcs *self); int APP_CC -xrdp_mcs_init(struct xrdp_mcs* self, struct stream* s); +xrdp_mcs_init(struct xrdp_mcs *self, struct stream *s); int APP_CC -xrdp_mcs_recv(struct xrdp_mcs* self, struct stream* s, int* chan); +xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan); int APP_CC -xrdp_mcs_send(struct xrdp_mcs* self, struct stream* s, int chan); +xrdp_mcs_send(struct xrdp_mcs *self, struct stream *s, int chan); int APP_CC -xrdp_mcs_incoming(struct xrdp_mcs* self); +xrdp_mcs_incoming(struct xrdp_mcs *self); int APP_CC -xrdp_mcs_disconnect(struct xrdp_mcs* self); +xrdp_mcs_disconnect(struct xrdp_mcs *self); /* xrdp_sec.c */ -struct xrdp_sec* APP_CC -xrdp_sec_create(struct xrdp_rdp* owner, struct trans* trans, int crypt_level, +struct xrdp_sec * APP_CC +xrdp_sec_create(struct xrdp_rdp *owner, struct trans *trans, int crypt_level, int channel_code, int multimon); void APP_CC -xrdp_sec_delete(struct xrdp_sec* self); +xrdp_sec_delete(struct xrdp_sec *self); int APP_CC -xrdp_sec_init(struct xrdp_sec* self, struct stream* s); +xrdp_sec_init(struct xrdp_sec *self, struct stream *s); int APP_CC xrdp_sec_get_fastpath_bytes(struct xrdp_sec *self); int APP_CC @@ -354,166 +354,166 @@ xrdp_sec_send_fastpath(struct xrdp_sec *self, struct stream *s); int APP_CC xrdp_sec_recv_fastpath(struct xrdp_sec *self, struct stream *s); int APP_CC -xrdp_sec_recv(struct xrdp_sec* self, struct stream* s, int* chan); +xrdp_sec_recv(struct xrdp_sec *self, struct stream *s, int *chan); int APP_CC -xrdp_sec_send(struct xrdp_sec* self, struct stream* s, int chan); +xrdp_sec_send(struct xrdp_sec *self, struct stream *s, int chan); int APP_CC -xrdp_sec_process_mcs_data(struct xrdp_sec* self); +xrdp_sec_process_mcs_data(struct xrdp_sec *self); int APP_CC -xrdp_sec_out_mcs_data(struct xrdp_sec* self); +xrdp_sec_out_mcs_data(struct xrdp_sec *self); int APP_CC -xrdp_sec_incoming(struct xrdp_sec* self); +xrdp_sec_incoming(struct xrdp_sec *self); int APP_CC -xrdp_sec_disconnect(struct xrdp_sec* self); +xrdp_sec_disconnect(struct xrdp_sec *self); /* xrdp_rdp.c */ -struct xrdp_rdp* APP_CC -xrdp_rdp_create(struct xrdp_session* session, struct trans* trans); +struct xrdp_rdp * APP_CC +xrdp_rdp_create(struct xrdp_session *session, struct trans *trans); void APP_CC -xrdp_rdp_delete(struct xrdp_rdp* self); +xrdp_rdp_delete(struct xrdp_rdp *self); int APP_CC -xrdp_rdp_init(struct xrdp_rdp* self, struct stream* s); +xrdp_rdp_init(struct xrdp_rdp *self, struct stream *s); int APP_CC -xrdp_rdp_init_data(struct xrdp_rdp* self, struct stream* s); +xrdp_rdp_init_data(struct xrdp_rdp *self, struct stream *s); int APP_CC xrdp_rdp_get_fastpath_bytes(struct xrdp_rdp *self); int APP_CC xrdp_rdp_init_fastpath(struct xrdp_rdp *self, struct stream *s); int APP_CC -xrdp_rdp_recv(struct xrdp_rdp* self, struct stream* s, int* code); +xrdp_rdp_recv(struct xrdp_rdp *self, struct stream *s, int *code); int APP_CC -xrdp_rdp_send(struct xrdp_rdp* self, struct stream* s, int pdu_type); +xrdp_rdp_send(struct xrdp_rdp *self, struct stream *s, int pdu_type); int APP_CC -xrdp_rdp_send_data(struct xrdp_rdp* self, struct stream* s, +xrdp_rdp_send_data(struct xrdp_rdp *self, struct stream *s, int data_pdu_type); int APP_CC xrdp_rdp_send_fastpath(struct xrdp_rdp *self, struct stream *s, int data_pdu_type); int APP_CC -xrdp_rdp_send_data_update_sync(struct xrdp_rdp* self); +xrdp_rdp_send_data_update_sync(struct xrdp_rdp *self); int APP_CC -xrdp_rdp_incoming(struct xrdp_rdp* self); +xrdp_rdp_incoming(struct xrdp_rdp *self); int APP_CC -xrdp_rdp_process_data(struct xrdp_rdp* self, struct stream* s); +xrdp_rdp_process_data(struct xrdp_rdp *self, struct stream *s); int APP_CC -xrdp_rdp_disconnect(struct xrdp_rdp* self); +xrdp_rdp_disconnect(struct xrdp_rdp *self); int APP_CC -xrdp_rdp_send_deactive(struct xrdp_rdp* self); +xrdp_rdp_send_deactive(struct xrdp_rdp *self); /* xrdp_orders.c */ -struct xrdp_orders* APP_CC -xrdp_orders_create(struct xrdp_session* session, - struct xrdp_rdp* rdp_layer); +struct xrdp_orders * APP_CC +xrdp_orders_create(struct xrdp_session *session, + struct xrdp_rdp *rdp_layer); void APP_CC -xrdp_orders_delete(struct xrdp_orders* self); +xrdp_orders_delete(struct xrdp_orders *self); int APP_CC -xrdp_orders_reset(struct xrdp_orders* self); +xrdp_orders_reset(struct xrdp_orders *self); int APP_CC -xrdp_orders_init(struct xrdp_orders* self); +xrdp_orders_init(struct xrdp_orders *self); int APP_CC -xrdp_orders_send(struct xrdp_orders* self); +xrdp_orders_send(struct xrdp_orders *self); int APP_CC -xrdp_orders_force_send(struct xrdp_orders* self); +xrdp_orders_force_send(struct xrdp_orders *self); int APP_CC -xrdp_orders_check(struct xrdp_orders* self, int max_size); +xrdp_orders_check(struct xrdp_orders *self, int max_size); int APP_CC -xrdp_orders_rect(struct xrdp_orders* self, int x, int y, int cx, int cy, - int color, struct xrdp_rect* rect); +xrdp_orders_rect(struct xrdp_orders *self, int x, int y, int cx, int cy, + int color, struct xrdp_rect *rect); int APP_CC -xrdp_orders_screen_blt(struct xrdp_orders* self, int x, int y, +xrdp_orders_screen_blt(struct xrdp_orders *self, int x, int y, int cx, int cy, int srcx, int srcy, - int rop, struct xrdp_rect* rect); + int rop, struct xrdp_rect *rect); int APP_CC -xrdp_orders_pat_blt(struct xrdp_orders* self, int x, int y, +xrdp_orders_pat_blt(struct xrdp_orders *self, int x, int y, int cx, int cy, int rop, int bg_color, - int fg_color, struct xrdp_brush* brush, - struct xrdp_rect* rect); + int fg_color, struct xrdp_brush *brush, + struct xrdp_rect *rect); int APP_CC -xrdp_orders_dest_blt(struct xrdp_orders* self, int x, int y, +xrdp_orders_dest_blt(struct xrdp_orders *self, int x, int y, int cx, int cy, int rop, - struct xrdp_rect* rect); + struct xrdp_rect *rect); int APP_CC -xrdp_orders_line(struct xrdp_orders* self, int mix_mode, +xrdp_orders_line(struct xrdp_orders *self, int mix_mode, int startx, int starty, int endx, int endy, int rop, int bg_color, - struct xrdp_pen* pen, - struct xrdp_rect* rect); + struct xrdp_pen *pen, + struct xrdp_rect *rect); int APP_CC -xrdp_orders_mem_blt(struct xrdp_orders* self, int cache_id, +xrdp_orders_mem_blt(struct xrdp_orders *self, int cache_id, int color_table, int x, int y, int cx, int cy, int rop, int srcx, int srcy, - int cache_idx, struct xrdp_rect* rect); + int cache_idx, struct xrdp_rect *rect); int APP_CC -xrdp_orders_composite_blt(struct xrdp_orders* self, int srcidx, +xrdp_orders_composite_blt(struct xrdp_orders *self, int srcidx, int srcformat, int srcwidth, - int srcrepeat, int* srctransform, int mskflags, + int srcrepeat, int *srctransform, int mskflags, int mskidx, int mskformat, int mskwidth, int mskrepeat, int op, int srcx, int srcy, int mskx, int msky, int dstx, int dsty, int width, int height, int dstformat, - struct xrdp_rect* rect); + struct xrdp_rect *rect); int APP_CC -xrdp_orders_text(struct xrdp_orders* self, +xrdp_orders_text(struct xrdp_orders *self, int font, int flags, int mixmode, int fg_color, int bg_color, int clip_left, int clip_top, int clip_right, int clip_bottom, int box_left, int box_top, int box_right, int box_bottom, - int x, int y, char* data, int data_len, - struct xrdp_rect* rect); + int x, int y, char *data, int data_len, + struct xrdp_rect *rect); int APP_CC -xrdp_orders_send_palette(struct xrdp_orders* self, int* palette, +xrdp_orders_send_palette(struct xrdp_orders *self, int *palette, int cache_id); int APP_CC -xrdp_orders_send_raw_bitmap(struct xrdp_orders* self, - int width, int height, int bpp, char* data, +xrdp_orders_send_raw_bitmap(struct xrdp_orders *self, + int width, int height, int bpp, char *data, int cache_id, int cache_idx); int APP_CC -xrdp_orders_send_bitmap(struct xrdp_orders* self, - int width, int height, int bpp, char* data, +xrdp_orders_send_bitmap(struct xrdp_orders *self, + int width, int height, int bpp, char *data, int cache_id, int cache_idx); int APP_CC -xrdp_orders_send_font(struct xrdp_orders* self, - struct xrdp_font_char* font_char, +xrdp_orders_send_font(struct xrdp_orders *self, + struct xrdp_font_char *font_char, int font_index, int char_index); int APP_CC -xrdp_orders_send_raw_bitmap2(struct xrdp_orders* self, - int width, int height, int bpp, char* data, +xrdp_orders_send_raw_bitmap2(struct xrdp_orders *self, + int width, int height, int bpp, char *data, int cache_id, int cache_idx); int APP_CC -xrdp_orders_send_bitmap2(struct xrdp_orders* self, - int width, int height, int bpp, char* data, +xrdp_orders_send_bitmap2(struct xrdp_orders *self, + int width, int height, int bpp, char *data, int cache_id, int cache_idx, int hints); int APP_CC -xrdp_orders_send_bitmap3(struct xrdp_orders* self, - int width, int height, int bpp, char* data, +xrdp_orders_send_bitmap3(struct xrdp_orders *self, + int width, int height, int bpp, char *data, int cache_id, int cache_idx, int hints); int APP_CC -xrdp_orders_send_brush(struct xrdp_orders* self, int width, int height, - int bpp, int type, int size, char* data, int cache_id); +xrdp_orders_send_brush(struct xrdp_orders *self, int width, int height, + int bpp, int type, int size, char *data, int cache_id); int APP_CC -xrdp_orders_send_create_os_surface(struct xrdp_orders* self, int id, +xrdp_orders_send_create_os_surface(struct xrdp_orders *self, int id, int width, int height, - struct list* del_list); + struct list *del_list); int APP_CC -xrdp_orders_send_switch_os_surface(struct xrdp_orders* self, int id); +xrdp_orders_send_switch_os_surface(struct xrdp_orders *self, int id); /* xrdp_bitmap_compress.c */ int APP_CC -xrdp_bitmap_compress(char* in_data, int width, int height, - struct stream* s, int bpp, int byte_limit, - int start_line, struct stream* temp_s, +xrdp_bitmap_compress(char *in_data, int width, int height, + struct stream *s, int bpp, int byte_limit, + int start_line, struct stream *temp_s, int e); int APP_CC -xrdp_bitmap32_compress(char* in_data, int width, int height, - struct stream* s, int bpp, int byte_limit, - int start_line, struct stream* temp_s, +xrdp_bitmap32_compress(char *in_data, int width, int height, + struct stream *s, int bpp, int byte_limit, + int start_line, struct stream *temp_s, int e); int APP_CC -xrdp_jpeg_compress(void *handle, char* in_data, int width, int height, - struct stream* s, int bpp, int byte_limit, - int start_line, struct stream* temp_s, +xrdp_jpeg_compress(void *handle, char *in_data, int width, int height, + struct stream *s, int bpp, int byte_limit, + int start_line, struct stream *temp_s, int e, int quality); int APP_CC @@ -540,16 +540,16 @@ xrdp_jpeg_deinit(void *handle); /* xrdp_channel.c */ struct xrdp_channel* APP_CC -xrdp_channel_create(struct xrdp_sec* owner, struct xrdp_mcs* mcs_layer); +xrdp_channel_create(struct xrdp_sec *owner, struct xrdp_mcs *mcs_layer); void APP_CC -xrdp_channel_delete(struct xrdp_channel* self); +xrdp_channel_delete(struct xrdp_channel *self); int APP_CC -xrdp_channel_init(struct xrdp_channel* self, struct stream* s); +xrdp_channel_init(struct xrdp_channel *self, struct stream *s); int APP_CC -xrdp_channel_send(struct xrdp_channel* self, struct stream* s, int channel_id, +xrdp_channel_send(struct xrdp_channel *self, struct stream *s, int channel_id, int total_data_len, int flags); int APP_CC -xrdp_channel_process(struct xrdp_channel* self, struct stream* s, +xrdp_channel_process(struct xrdp_channel *self, struct stream *s, int chanid); /* xrdp_fastpath.c */ diff --git a/libxrdp/libxrdpinc.h b/libxrdp/libxrdpinc.h index 8617f605..2262f66f 100644 --- a/libxrdp/libxrdpinc.h +++ b/libxrdp/libxrdpinc.h @@ -1,7 +1,7 @@ /** * xrdp: A Remote Desktop Protocol server. * - * Copyright (C) Jay Sorg 2004-2013 + * Copyright (C) Jay Sorg 2004-2014 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,206 +27,206 @@ struct xrdp_brush { - int x_orgin; - int y_orgin; - int style; - char pattern[8]; + int x_orgin; + int y_orgin; + int style; + char pattern[8]; }; struct xrdp_pen { - int style; - int width; - int color; + int style; + int width; + int color; }; /* 2.2.2.2.1.2.5.1 Cache Glyph Data (TS_CACHE_GLYPH_DATA) */ struct xrdp_font_char { - int offset; /* x */ - int baseline; /* y */ - int width; /* cx */ - int height; /* cy */ - int incby; - int bpp; - char* data; + int offset; /* x */ + int baseline; /* y */ + int width; /* cx */ + int height; /* cy */ + int incby; + int bpp; + char *data; }; struct xrdp_rect { - int left; - int top; - int right; - int bottom; + int left; + int top; + int right; + int bottom; }; struct xrdp_session { - long id; - struct trans* trans; - int (*callback)(long id, int msg, long param1, long param2, long param3, - long param4); - void* rdp; - void* orders; - struct xrdp_client_info* client_info; - int up_and_running; - int (*is_term)(void); - int in_process_data; /* inc / dec libxrdp_process_data calls */ + tintptr id; + struct trans *trans; + int (*callback)(tintptr id, int msg, tintptr param1, tintptr param2, + tintptr param3, tintptr param4); + void *rdp; + void *orders; + struct xrdp_client_info *client_info; + int up_and_running; + int (*is_term)(void); + int in_process_data; /* inc / dec libxrdp_process_data calls */ }; -struct xrdp_session* DEFAULT_CC -libxrdp_init(tbus id, struct trans* trans); +struct xrdp_session * DEFAULT_CC +libxrdp_init(tbus id, struct trans *trans); int DEFAULT_CC -libxrdp_exit(struct xrdp_session* session); +libxrdp_exit(struct xrdp_session *session); int DEFAULT_CC -libxrdp_disconnect(struct xrdp_session* session); +libxrdp_disconnect(struct xrdp_session *session); int DEFAULT_CC -libxrdp_process_incomming(struct xrdp_session* session); +libxrdp_process_incomming(struct xrdp_session *session); int EXPORT_CC libxrdp_get_pdu_bytes(const char *aheader); struct stream * APP_CC -libxrdp_force_read(struct trans* trans); +libxrdp_force_read(struct trans *trans); int DEFAULT_CC -libxrdp_process_data(struct xrdp_session* session, struct stream *s); +libxrdp_process_data(struct xrdp_session *session, struct stream *s); int DEFAULT_CC -libxrdp_send_palette(struct xrdp_session* session, int* palette); +libxrdp_send_palette(struct xrdp_session *session, int *palette); int DEFAULT_CC -libxrdp_send_bell(struct xrdp_session* session); +libxrdp_send_bell(struct xrdp_session *session); int DEFAULT_CC -libxrdp_send_bitmap(struct xrdp_session* session, int width, int height, - int bpp, char* data, int x, int y, int cx, int cy); +libxrdp_send_bitmap(struct xrdp_session *session, int width, int height, + int bpp, char *data, int x, int y, int cx, int cy); int DEFAULT_CC -libxrdp_send_pointer(struct xrdp_session* session, int cache_idx, - char* data, char* mask, int x, int y, int bpp); +libxrdp_send_pointer(struct xrdp_session *session, int cache_idx, + char *data, char *mask, int x, int y, int bpp); int DEFAULT_CC -libxrdp_set_pointer(struct xrdp_session* session, int cache_idx); +libxrdp_set_pointer(struct xrdp_session *session, int cache_idx); int DEFAULT_CC -libxrdp_orders_init(struct xrdp_session* session); +libxrdp_orders_init(struct xrdp_session *session); int DEFAULT_CC -libxrdp_orders_send(struct xrdp_session* session); +libxrdp_orders_send(struct xrdp_session *session); int DEFAULT_CC -libxrdp_orders_force_send(struct xrdp_session* session); +libxrdp_orders_force_send(struct xrdp_session *session); int DEFAULT_CC -libxrdp_orders_rect(struct xrdp_session* session, int x, int y, - int cx, int cy, int color, struct xrdp_rect* rect); +libxrdp_orders_rect(struct xrdp_session *session, int x, int y, + int cx, int cy, int color, struct xrdp_rect *rect); int DEFAULT_CC -libxrdp_orders_screen_blt(struct xrdp_session* session, int x, int y, +libxrdp_orders_screen_blt(struct xrdp_session *session, int x, int y, int cx, int cy, int srcx, int srcy, - int rop, struct xrdp_rect* rect); + int rop, struct xrdp_rect *rect); int DEFAULT_CC -libxrdp_orders_pat_blt(struct xrdp_session* session, int x, int y, +libxrdp_orders_pat_blt(struct xrdp_session *session, int x, int y, int cx, int cy, int rop, int bg_color, - int fg_color, struct xrdp_brush* brush, - struct xrdp_rect* rect); + int fg_color, struct xrdp_brush *brush, + struct xrdp_rect *rect); int DEFAULT_CC -libxrdp_orders_dest_blt(struct xrdp_session* session, int x, int y, +libxrdp_orders_dest_blt(struct xrdp_session *session, int x, int y, int cx, int cy, int rop, - struct xrdp_rect* rect); + struct xrdp_rect *rect); int DEFAULT_CC -libxrdp_orders_line(struct xrdp_session* session, int mix_mode, +libxrdp_orders_line(struct xrdp_session *session, int mix_mode, int startx, int starty, int endx, int endy, int rop, int bg_color, - struct xrdp_pen* pen, - struct xrdp_rect* rect); + struct xrdp_pen *pen, + struct xrdp_rect *rect); int DEFAULT_CC -libxrdp_orders_mem_blt(struct xrdp_session* session, int cache_id, +libxrdp_orders_mem_blt(struct xrdp_session *session, int cache_id, int color_table, int x, int y, int cx, int cy, int rop, int srcx, int srcy, - int cache_idx, struct xrdp_rect* rect); + int cache_idx, struct xrdp_rect *rect); int DEFAULT_CC -libxrdp_orders_composite_blt(struct xrdp_session* session, int srcidx, +libxrdp_orders_composite_blt(struct xrdp_session *session, int srcidx, int srcformat, int srcwidth, int srcrepeat, - int* srctransform, int mskflags, + int *srctransform, int mskflags, int mskidx, int mskformat, int mskwidth, int mskrepeat, int op, int srcx, int srcy, int mskx, int msky, int dstx, int dsty, int width, int height, int dstformat, - struct xrdp_rect* rect); + struct xrdp_rect *rect); int DEFAULT_CC -libxrdp_orders_text(struct xrdp_session* session, +libxrdp_orders_text(struct xrdp_session *session, int font, int flags, int mixmode, int fg_color, int bg_color, int clip_left, int clip_top, int clip_right, int clip_bottom, int box_left, int box_top, int box_right, int box_bottom, - int x, int y, char* data, int data_len, - struct xrdp_rect* rect); + int x, int y, char *data, int data_len, + struct xrdp_rect *rect); int DEFAULT_CC -libxrdp_orders_send_palette(struct xrdp_session* session, int* palette, +libxrdp_orders_send_palette(struct xrdp_session *session, int *palette, int cache_id); int DEFAULT_CC -libxrdp_orders_send_raw_bitmap(struct xrdp_session* session, - int width, int height, int bpp, char* data, +libxrdp_orders_send_raw_bitmap(struct xrdp_session *session, + int width, int height, int bpp, char *data, int cache_id, int cache_idx); int DEFAULT_CC -libxrdp_orders_send_bitmap(struct xrdp_session* session, - int width, int height, int bpp, char* data, +libxrdp_orders_send_bitmap(struct xrdp_session *session, + int width, int height, int bpp, char *data, int cache_id, int cache_idx); int DEFAULT_CC -libxrdp_orders_send_font(struct xrdp_session* session, - struct xrdp_font_char* font_char, +libxrdp_orders_send_font(struct xrdp_session *session, + struct xrdp_font_char *font_char, int font_index, int char_index); int DEFAULT_CC -libxrdp_reset(struct xrdp_session* session, +libxrdp_reset(struct xrdp_session *session, int width, int height, int bpp); int DEFAULT_CC -libxrdp_orders_send_raw_bitmap2(struct xrdp_session* session, - int width, int height, int bpp, char* data, +libxrdp_orders_send_raw_bitmap2(struct xrdp_session *session, + int width, int height, int bpp, char *data, int cache_id, int cache_idx); int DEFAULT_CC -libxrdp_orders_send_bitmap2(struct xrdp_session* session, - int width, int height, int bpp, char* data, +libxrdp_orders_send_bitmap2(struct xrdp_session *session, + int width, int height, int bpp, char *data, int cache_id, int cache_idx, int hints); int DEFAULT_CC -libxrdp_orders_send_bitmap3(struct xrdp_session* session, - int width, int height, int bpp, char* data, +libxrdp_orders_send_bitmap3(struct xrdp_session *session, + int width, int height, int bpp, char *data, int cache_id, int cache_idx, int hints); int DEFAULT_CC -libxrdp_query_channel(struct xrdp_session* session, int index, - char* channel_name, int* channel_flags); +libxrdp_query_channel(struct xrdp_session *session, int index, + char *channel_name, int *channel_flags); int DEFAULT_CC -libxrdp_get_channel_id(struct xrdp_session* session, char* name); +libxrdp_get_channel_id(struct xrdp_session *session, char *name); int DEFAULT_CC -libxrdp_send_to_channel(struct xrdp_session* session, int channel_id, - char* data, int data_len, +libxrdp_send_to_channel(struct xrdp_session *session, int channel_id, + char *data, int data_len, int total_data_len, int flags); int DEFAULT_CC -libxrdp_orders_send_brush(struct xrdp_session* session, +libxrdp_orders_send_brush(struct xrdp_session *session, int width, int height, int bpp, int type, - int size, char* data, int cache_id); + int size, char *data, int cache_id); int DEFAULT_CC -libxrdp_orders_send_create_os_surface(struct xrdp_session* session, int id, +libxrdp_orders_send_create_os_surface(struct xrdp_session *session, int id, int width, int height, - struct list* del_list); + struct list *del_list); int DEFAULT_CC -libxrdp_orders_send_switch_os_surface(struct xrdp_session* session, int id); +libxrdp_orders_send_switch_os_surface(struct xrdp_session *session, int id); int DEFAULT_CC -libxrdp_window_new_update(struct xrdp_session* session, int window_id, - struct rail_window_state_order* window_state, +libxrdp_window_new_update(struct xrdp_session *session, int window_id, + struct rail_window_state_order *window_state, int flags); int DEFAULT_CC -libxrdp_window_delete(struct xrdp_session* session, int window_id); +libxrdp_window_delete(struct xrdp_session *session, int window_id); int DEFAULT_CC -libxrdp_window_icon(struct xrdp_session* session, int window_id, +libxrdp_window_icon(struct xrdp_session *session, int window_id, int cache_entry, int cache_id, - struct rail_icon_info* icon_info, int flags); + struct rail_icon_info *icon_info, int flags); int DEFAULT_CC -libxrdp_window_cached_icon(struct xrdp_session* session, int window_id, +libxrdp_window_cached_icon(struct xrdp_session *session, int window_id, int cache_entry, int cache_id, int flags); int DEFAULT_CC -libxrdp_notify_new_update(struct xrdp_session* session, +libxrdp_notify_new_update(struct xrdp_session *session, int window_id, int notify_id, - struct rail_notify_state_order* notify_state, + struct rail_notify_state_order *notify_state, int flags); int DEFAULT_CC -libxrdp_notify_delete(struct xrdp_session* session, +libxrdp_notify_delete(struct xrdp_session *session, int window_id, int notify_id); int DEFAULT_CC -libxrdp_monitored_desktop(struct xrdp_session* session, - struct rail_monitored_desktop_order* mdo, +libxrdp_monitored_desktop(struct xrdp_session *session, + struct rail_monitored_desktop_order *mdo, int flags); int DEFAULT_CC libxrdp_codec_jpeg_compress(struct xrdp_session *session, @@ -237,7 +237,7 @@ libxrdp_codec_jpeg_compress(struct xrdp_session *session, char *out_data, int *io_len); int DEFAULT_CC libxrdp_fastpath_send_surface(struct xrdp_session *session, - char* data_pad, int pad_bytes, + char *data_pad, int pad_bytes, int data_bytes, int destLeft, int dst_Top, int destRight, int destBottom, int bpp, diff --git a/libxrdp/xrdp_orders_rail.h b/libxrdp/xrdp_orders_rail.h index 8f5b402f..475b8f17 100644 --- a/libxrdp/xrdp_orders_rail.h +++ b/libxrdp/xrdp_orders_rail.h @@ -1,7 +1,7 @@ /** * xrdp: A Remote Desktop Protocol server. * - * Copyright (C) Jay Sorg 2012 + * Copyright (C) Jay Sorg 2012-2014 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,31 +20,31 @@ #define _XRDP_ORDERS_RAIL_H int APP_CC -xrdp_orders_send_window_delete(struct xrdp_orders* self, int window_id); +xrdp_orders_send_window_delete(struct xrdp_orders *self, int window_id); int APP_CC -xrdp_orders_send_window_cached_icon(struct xrdp_orders* self, +xrdp_orders_send_window_cached_icon(struct xrdp_orders *self, int window_id, int cache_entry, int cache_id, int flags); int APP_CC -xrdp_orders_send_window_icon(struct xrdp_orders* self, +xrdp_orders_send_window_icon(struct xrdp_orders *self, int window_id, int cache_entry, int cache_id, - struct rail_icon_info* icon_info, + struct rail_icon_info *icon_info, int flags); int APP_CC -xrdp_orders_send_window_new_update(struct xrdp_orders* self, int window_id, - struct rail_window_state_order* window_state, +xrdp_orders_send_window_new_update(struct xrdp_orders *self, int window_id, + struct rail_window_state_order *window_state, int flags); int APP_CC -xrdp_orders_send_notify_delete(struct xrdp_orders* self, int window_id, +xrdp_orders_send_notify_delete(struct xrdp_orders *self, int window_id, int notify_id); int APP_CC -xrdp_orders_send_notify_new_update(struct xrdp_orders* self, +xrdp_orders_send_notify_new_update(struct xrdp_orders *self, int window_id, int notify_id, - struct rail_notify_state_order* notify_state, + struct rail_notify_state_order *notify_state, int flags); int APP_CC -xrdp_orders_send_monitored_desktop(struct xrdp_orders* self, - struct rail_monitored_desktop_order* mdo, +xrdp_orders_send_monitored_desktop(struct xrdp_orders *self, + struct rail_monitored_desktop_order *mdo, int flags); #endif diff --git a/neutrinordp/xrdp-neutrinordp.c b/neutrinordp/xrdp-neutrinordp.c index d559b59d..6c8b17ac 100644 --- a/neutrinordp/xrdp-neutrinordp.c +++ b/neutrinordp/xrdp-neutrinordp.c @@ -275,11 +275,13 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2, case 107: /* wheel up */ flags = PTR_FLAGS_WHEEL | 0x0078; mod->inst->input->MouseEvent(mod->inst->input, flags, 0, 0); + break; case 108: break; case 109: /* wheel down */ flags = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088; mod->inst->input->MouseEvent(mod->inst->input, flags, 0, 0); + break; case 110: break; case 200: diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am index 9aa3ebe7..81218db1 100644 --- a/sesman/chansrv/Makefile.am +++ b/sesman/chansrv/Makefile.am @@ -16,21 +16,11 @@ EXTRA_INCLUDES = EXTRA_LIBS = EXTRA_FLAGS = -if XRDP_SIMPLESOUND -EXTRA_DEFINES += -DXRDP_SIMPLESOUND -EXTRA_LIBS += -lpthread -lpulse -lpulse-simple -endif - if XRDP_FUSE EXTRA_DEFINES += -DXRDP_FUSE EXTRA_LIBS += -lfuse endif -if XRDP_LOAD_PULSE_MODULES -EXTRA_DEFINES += -DXRDP_LOAD_PULSE_MODULES -EXTRA_LIBS += -lpulse -endif - AM_CFLAGS = \ -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \ -DXRDP_SBIN_PATH=\"${sbindir}\" \ diff --git a/sesman/chansrv/pcsc/xrdp_pcsc.c b/sesman/chansrv/pcsc/xrdp_pcsc.c index f4aaba14..3b830d60 100644 --- a/sesman/chansrv/pcsc/xrdp_pcsc.c +++ b/sesman/chansrv/pcsc/xrdp_pcsc.c @@ -15,8 +15,13 @@ typedef unsigned char BYTE; typedef BYTE *LPBYTE; -typedef unsigned int LONG; +#ifdef __APPLE__ +typedef int LONG; typedef unsigned int DWORD; +#else +typedef long LONG; +typedef unsigned long DWORD; +#endif typedef DWORD *LPDWORD; typedef const void *LPCVOID; typedef const char *LPCSTR; @@ -59,6 +64,8 @@ PCSC_API SCARD_IO_REQUEST g_rgSCardRawPci = { SCARD_PROTOCOL_RAW, 8 }; #define LLOG_LEVEL 5 #define LLOGLN(_level, _args) \ do { if (_level < LLOG_LEVEL) { printf _args ; printf("\n"); } } while (0) +#define LHEXDUMP(_level, _args) \ + do { if (_level < LLOG_LEVEL) { lhexdump _args ; } } while (0) #define SCARD_ESTABLISH_CONTEXT 0x01 #define SCARD_RELEASE_CONTEXT 0x02 @@ -103,6 +110,50 @@ static pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER; static char g_error_str[512]; /*****************************************************************************/ +/* produce a hex dump */ +static void +lhexdump(void *p, int len) +{ + unsigned char *line; + int i; + int thisline; + int offset; + + line = (unsigned char *)p; + offset = 0; + + while (offset < len) + { + printf("%04x ", offset); + thisline = len - offset; + + if (thisline > 16) + { + thisline = 16; + } + + for (i = 0; i < thisline; i++) + { + printf("%02x ", line[i]); + } + + for (; i < 16; i++) + { + printf(" "); + } + + for (i = 0; i < thisline; i++) + { + printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.'); + } + + printf("\n"); + offset += thisline; + line += thisline; + } +} + +/*****************************************************************************/ static int get_display_num_from_display(const char *display_text) { @@ -156,7 +207,7 @@ get_display_num_from_display(const char *display_text) host[host_index] = 0; disp[disp_index] = 0; scre[scre_index] = 0; - LLOGLN(0, ("get_display_num_from_display: host [%s] disp [%s] scre [%s]", + LLOGLN(10, ("get_display_num_from_display: host [%s] disp [%s] scre [%s]", host, disp, scre)); rv = atoi(disp); return rv; @@ -219,7 +270,7 @@ connect_to_chansrv(void) bytes = sizeof(saddr.sun_path); snprintf(saddr.sun_path, bytes, "%s/.pcsc%d/pcscd.comm", home_str, dis); saddr.sun_path[bytes - 1] = 0; - LLOGLN(0, ("connect_to_chansrv: connecting to %s", saddr.sun_path)); + LLOGLN(10, ("connect_to_chansrv: connecting to %s", saddr.sun_path)); psaddr = (struct sockaddr *) &saddr; bytes = sizeof(struct sockaddr_un); error = connect(g_sck, psaddr, bytes); @@ -256,6 +307,8 @@ send_message(int code, char *data, int bytes) pthread_mutex_unlock(&g_mutex); return 1; } + LLOGLN(10, ("send_message:")); + LHEXDUMP(10, (data, bytes)); pthread_mutex_unlock(&g_mutex); return 0; } @@ -392,7 +445,7 @@ SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, } context = GET_UINT32(msg, 0); status = GET_UINT32(msg, 4); - LLOGLN(10, ("SCardEstablishContext: got context 0x%8.8x", context)); + LLOGLN(10, ("SCardEstablishContext: got context 0x%8.8x", (int)context)); *phContext = context; return status; } @@ -463,7 +516,7 @@ SCardConnect(SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, LLOGLN(10, ("SCardConnect:")); LLOGLN(10, ("SCardConnect: hContext 0x%8.8x szReader %s dwShareMode %d " "dwPreferredProtocols %d", - hContext, szReader, dwShareMode, dwPreferredProtocols)); + (int)hContext, szReader, (int)dwShareMode, (int)dwPreferredProtocols)); if (g_sck == -1) { LLOGLN(0, ("SCardConnect: error, not connected")); @@ -507,7 +560,7 @@ SCardConnect(SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, status = GET_UINT32(msg, 8); LLOGLN(10, ("SCardConnect: got status 0x%8.8x hCard 0x%8.8x " "dwActiveProtocol %d", - status, *phCard, *pdwActiveProtocol)); + status, (int)*phCard, (int)*pdwActiveProtocol)); return status; } @@ -536,7 +589,7 @@ SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition) int status; LLOGLN(10, ("SCardDisconnect: hCard 0x%8.8x dwDisposition %d", - hCard, dwDisposition)); + (int)hCard, (int)dwDisposition)); if (g_sck == -1) { LLOGLN(0, ("SCardDisconnect: error, not connected")); @@ -575,7 +628,7 @@ SCardBeginTransaction(SCARDHANDLE hCard) int bytes; int status; - LLOGLN(10, ("SCardBeginTransaction: hCard 0x%8.8x", hCard)); + LLOGLN(10, ("SCardBeginTransaction: hCard 0x%8.8x", (int)hCard)); if (hCard == 0) { LLOGLN(0, ("SCardBeginTransaction: error, bad hCard")); @@ -665,7 +718,7 @@ SCardStatus(SCARDHANDLE hCard, LPSTR mszReaderName, LPDWORD pcchReaderLen, LLOGLN(10, ("SCardStatus:")); if (hCard == 0) { - LLOGLN(0, ("SCardStatus: error, bad hCard")); + LLOGLN(10, ("SCardStatus: error, bad hCard")); return SCARD_F_INTERNAL_ERROR; } if (g_sck == -1) @@ -673,9 +726,9 @@ SCardStatus(SCARDHANDLE hCard, LPSTR mszReaderName, LPDWORD pcchReaderLen, LLOGLN(0, ("SCardStatus: error, not connected")); return SCARD_F_INTERNAL_ERROR; } - LLOGLN(10, (" hCard 0x%8.8x", hCard)); - LLOGLN(10, (" cchReaderLen %d", *pcchReaderLen)); - LLOGLN(10, (" cbAtrLen %d", *pcbAtrLen)); + LLOGLN(10, (" hCard 0x%8.8x", (int)hCard)); + LLOGLN(10, (" cchReaderLen %d", (int)*pcchReaderLen)); + LLOGLN(10, (" cbAtrLen %d", (int)*pcbAtrLen)); cchReaderLen = *pcchReaderLen; msg = (char *) malloc(8192); @@ -703,10 +756,10 @@ SCardStatus(SCARDHANDLE hCard, LPSTR mszReaderName, LPDWORD pcchReaderLen, return SCARD_F_INTERNAL_ERROR; } - LLOGLN(10, ("SCardStatus: cchReaderLen in %d", *pcchReaderLen)); + LLOGLN(10, ("SCardStatus: cchReaderLen in %d", (int)*pcchReaderLen)); offset = 0; *pcchReaderLen = GET_UINT32(msg, offset); - LLOGLN(10, ("SCardStatus: cchReaderLen out %d", *pcchReaderLen)); + LLOGLN(10, ("SCardStatus: cchReaderLen out %d", (int)*pcchReaderLen)); offset += 4; if (cchReaderLen > 0) { @@ -721,14 +774,18 @@ SCardStatus(SCARDHANDLE hCard, LPSTR mszReaderName, LPDWORD pcchReaderLen, LLOGLN(10, ("SCardStatus: mszReaderName out %s", mszReaderName)); offset += *pcchReaderLen; *pdwState = GET_UINT32(msg, offset); - LLOGLN(10, ("SCardStatus: dwState %d", *pdwState)); + if (*pdwState == 1) + { + *pdwState = 0x34; + } + LLOGLN(10, ("SCardStatus: dwState %d", (int)*pdwState)); offset += 4; *pdwProtocol = GET_UINT32(msg, offset); - LLOGLN(10, ("SCardStatus: dwProtocol %d", *pdwProtocol)); + LLOGLN(10, ("SCardStatus: dwProtocol %d", (int)*pdwProtocol)); offset += 4; *pcbAtrLen = GET_UINT32(msg, offset); offset += 4; - LLOGLN(10, ("SCardStatus: cbAtrLen %d", *pcbAtrLen)); + LLOGLN(10, ("SCardStatus: cbAtrLen %d", (int)*pcbAtrLen)); memcpy(pbAtr, msg + offset, *pcbAtrLen); offset += *pcbAtrLen; status = GET_UINT32(msg, offset); @@ -757,7 +814,7 @@ SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout, char atr[36]; LLOGLN(10, ("SCardGetStatusChange:")); - LLOGLN(10, (" dwTimeout %d cReaders %d", dwTimeout, cReaders)); + LLOGLN(10, (" dwTimeout %d cReaders %d", (int)dwTimeout, (int)cReaders)); if (g_sck == -1) { LLOGLN(0, ("SCardGetStatusChange: error, not connected")); @@ -829,7 +886,7 @@ SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout, } cReaders = GET_UINT32(msg, 0); offset = 4; - LLOGLN(10, ("SCardGetStatusChange: got back cReaders %d", cReaders)); + LLOGLN(10, ("SCardGetStatusChange: got back cReaders %d", (int)cReaders)); for (index = 0; index < cReaders; index++) { rname = rgReaderStates[index].szReader; @@ -897,10 +954,10 @@ SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, LLOGLN(0, ("SCardControl: error, not connected")); return SCARD_F_INTERNAL_ERROR; } - LLOGLN(10, (" hCard 0x%8.8x", hCard)); - LLOGLN(10, (" dwControlCode 0x%8.8x", dwControlCode)); - LLOGLN(10, (" cbSendLength %d", cbSendLength)); - LLOGLN(10, (" cbRecvLength %d", cbRecvLength)); + LLOGLN(10, (" hCard 0x%8.8x", (int)hCard)); + LLOGLN(10, (" dwControlCode 0x%8.8x", (int)dwControlCode)); + LLOGLN(10, (" cbSendLength %d", (int)cbSendLength)); + LLOGLN(10, (" cbRecvLength %d", (int)cbRecvLength)); /* #define SCARD_CTL_CODE(code) (0x42000000 + (code)) control_code = (control_code & 0x3ffc) >> 2; @@ -910,7 +967,7 @@ SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, dwControlCode = dwControlCode - 0x42000000; dwControlCode = dwControlCode << 2; dwControlCode = dwControlCode | (49 << 16); - LLOGLN(10, (" MS dwControlCode 0x%8.8x", dwControlCode)); + LLOGLN(10, (" MS dwControlCode 0x%8.8d", (int)dwControlCode)); msg = (char *) malloc(8192); offset = 0; @@ -946,7 +1003,7 @@ SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, } offset = 0; *lpBytesReturned = GET_UINT32(msg, offset); - LLOGLN(10, (" cbRecvLength %d", *lpBytesReturned)); + LLOGLN(10, (" cbRecvLength %d", (int)*lpBytesReturned)); offset += 4; memcpy(pbRecvBuffer, msg + offset, *lpBytesReturned); offset += *lpBytesReturned; @@ -976,9 +1033,10 @@ SCardTransmit(SCARDHANDLE hCard, const SCARD_IO_REQUEST *pioSendPci, LLOGLN(0, ("SCardTransmit: error, not connected")); return SCARD_F_INTERNAL_ERROR; } - LLOGLN(10, (" hCard 0x%8.8x", hCard)); - LLOGLN(10, (" cbSendLength %d", cbSendLength)); - LLOGLN(10, (" cbRecvLength %d", *pcbRecvLength)); + + LLOGLN(10, (" hCard 0x%8.8x", (int)hCard)); + LLOGLN(10, (" cbSendLength %d", (int)cbSendLength)); + LLOGLN(10, (" cbRecvLength %d", (int)*pcbRecvLength)); LLOGLN(10, (" pioSendPci->dwProtocol %d", (int)(pioSendPci->dwProtocol))); LLOGLN(10, (" pioSendPci->cbPciLength %d", (int)(pioSendPci->cbPciLength))); LLOGLN(10, (" pioRecvPci %p", pioRecvPci)); @@ -993,9 +1051,11 @@ SCardTransmit(SCARDHANDLE hCard, const SCARD_IO_REQUEST *pioSendPci, offset += 4; SET_UINT32(msg, offset, pioSendPci->dwProtocol); offset += 4; - SET_UINT32(msg, offset, pioSendPci->cbPciLength); +/* SET_UINT32(msg, offset, pioSendPci->cbPciLength); */ + SET_UINT32(msg, offset, 8); offset += 4; - extra_len = pioSendPci->cbPciLength - 8; +/* extra_len = pioSendPci->cbPciLength - 8; */ + extra_len = 0; SET_UINT32(msg, offset, extra_len); offset += 4; memcpy(msg + offset, pioSendPci + 1, extra_len); @@ -1070,8 +1130,9 @@ SCardTransmit(SCARDHANDLE hCard, const SCARD_IO_REQUEST *pioSendPci, } *pcbRecvLength = GET_UINT32(msg, offset); offset += 4; - LLOGLN(10, (" cbRecvLength %d", *pcbRecvLength)); + LLOGLN(10, (" cbRecvLength %d", (int)*pcbRecvLength)); memcpy(pbRecvBuffer, msg + offset, *pcbRecvLength); + LHEXDUMP(10, (pbRecvBuffer, *pcbRecvLength)); offset += *pcbRecvLength; status = GET_UINT32(msg, offset); free(msg); @@ -1113,12 +1174,16 @@ SCardListReaders(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LLOGLN(10, ("SCardListReaders:")); LLOGLN(10, ("SCardListReaders: mszGroups %s", mszGroups)); - LLOGLN(10, ("SCardListReaders: *pcchReaders %d", *pcchReaders)); + LLOGLN(10, ("SCardListReaders: *pcchReaders %d", (int)*pcchReaders)); if (g_sck == -1) { LLOGLN(0, ("SCardListReaders: error, not connected")); return SCARD_F_INTERNAL_ERROR; } + if ((mszGroups == NULL) && (mszReaders == NULL)) + { + *pcchReaders = 0; + } msg = (char *) malloc(8192); offset = 0; SET_UINT32(msg, offset, hContext); diff --git a/sesman/chansrv/rail.c b/sesman/chansrv/rail.c index 4bfeef7e..4888d2e0 100644 --- a/sesman/chansrv/rail.c +++ b/sesman/chansrv/rail.c @@ -71,6 +71,8 @@ static int g_xrr_event_base = 0; /* non zero means we got extension */ static Cursor g_default_cursor = 0; +static char *g_override_window_title = 0; + /* used in valid field of struct rail_window_data */ #define RWD_X (1 << 0) #define RWD_Y (1 << 1) @@ -621,6 +623,18 @@ rail_process_activate(struct stream *s, int size) } /*****************************************************************************/ +static int +rail_select_input(Window window_id) +{ + XSelectInput(g_display, window_id, + PropertyChangeMask | StructureNotifyMask | + SubstructureNotifyMask | FocusChangeMask | + EnterWindowMask | LeaveWindowMask); + XSync(g_display, 0); + return 0; +} + +/*****************************************************************************/ static int APP_CC rail_restore_windows(void) { @@ -637,6 +651,7 @@ rail_restore_windows(void) XGetWindowAttributes(g_display, children[i], &window_attributes); if (!window_attributes.override_redirect) { + rail_select_input(children[i]); if (window_attributes.map_state == IsViewable) { rail_win_set_state(children[i], 0x0); /* WithdrawnState */ @@ -760,31 +775,40 @@ rail_win_set_state(Window win, unsigned long state) } /*****************************************************************************/ +/* *data pointer that needs g_free */ static int APP_CC rail_win_get_text(Window win, char **data) { int ret = 0; int i = 0; unsigned long nitems = 0; + unsigned char *ldata = 0; + char *lldata = 0; + if (g_override_window_title != 0) + { + *data = g_strdup(g_override_window_title); + return g_strlen(*data); + } ret = rail_get_property(g_display, win, g_utf8_string, g_net_wm_name, - (unsigned char **)data, &nitems); + &ldata, &nitems); if (ret != 0) { /* _NET_WM_NAME isn't set, use WM_NAME (XFetchName) instead */ - XFetchName(g_display, win, data); + XFetchName(g_display, win, &lldata); + *data = g_strdup(lldata); + i = g_strlen(*data); + XFree(lldata); + return i; } - if (data) + *data = 0; + if (ldata) { - char *ptr = *data; - for (; ptr != NULL; i++) - { - if (ptr[i] == '\0') - { - break; - } - } + *data = g_strdup((char *)ldata); + i = g_strlen(*data); + XFree(ldata); + return i; } return i; @@ -1207,6 +1231,7 @@ rail_win_send_text(Window win) int crc; struct rail_window_data* rwd; + LOG(10, ("chansrv::rail_win_send_text:")); len = rail_win_get_text(win, &data); rwd = rail_get_window_data_safe(win); if (rwd != 0) @@ -1219,7 +1244,7 @@ rail_win_send_text(Window win) if (rwd->title_crc == crc) { LOG(10, ("chansrv::rail_win_send_text: skipping, title not changed")); - XFree(data); + g_free(data); XFree(rwd); return 0; } @@ -1231,11 +1256,12 @@ rail_win_send_text(Window win) LOG(0, ("chansrv::rail_win_send_text: error rail_get_window_data_safe failed")); return 1; } - if (data && len > 0) { + if (data && len > 0) + { LOG(10, ("chansrv::rail_win_send_text: 0x%8.8x text %s length %d", win, data, len)); make_stream(s); - init_stream(s, 1024); + init_stream(s, len + 1024); flags = WINDOW_ORDER_TYPE_WINDOW | WINDOW_ORDER_FIELD_TITLE; out_uint32_le(s, 8); /* update title info */ out_uint32_le(s, win); /* window id */ @@ -1251,10 +1277,7 @@ rail_win_send_text(Window win) rwd->title_crc = crc; rail_set_window_data(win, rwd); } - if (data != 0) - { - XFree(data); - } + g_free(data); XFree(rwd); return 0; } @@ -1355,7 +1378,8 @@ rail_create_window(Window window_id, Window owner_id) flags = WINDOW_ORDER_TYPE_WINDOW; } - title_size = rail_win_get_text(window_id, &title_bytes); + title_size = 0; + title_bytes = 0; XGetTransientForHint(g_display, window_id, &transient_for); @@ -1363,21 +1387,24 @@ rail_create_window(Window window_id, Window owner_id) { style = RAIL_STYLE_TOOLTIP; ext_style = RAIL_EXT_STYLE_TOOLTIP; + /* for tooltips, we don't grab the window text */ } else if (transient_for > 0) { style = RAIL_STYLE_DIALOG; ext_style = RAIL_EXT_STYLE_DIALOG; owner_id = transient_for; + title_size = rail_win_get_text(window_id, &title_bytes); } else { style = RAIL_STYLE_NORMAL; ext_style = RAIL_EXT_STYLE_NORMAL; + title_size = rail_win_get_text(window_id, &title_bytes); } make_stream(s); - init_stream(s, 1024); + init_stream(s, title_size + 1024 + num_window_rects * 8 + num_visibility_rects * 8); out_uint32_le(s, 2); /* create_window */ out_uint32_le(s, window_id); /* window_id */ @@ -1387,6 +1414,7 @@ rail_create_window(Window window_id, Window owner_id) out_uint32_le(s, ext_style); /* extended_style */ flags |= WINDOW_ORDER_FIELD_STYLE; out_uint32_le(s, 0x05); /* show_state */ + LOG(10, (" title %s", title_bytes)); flags |= WINDOW_ORDER_FIELD_SHOW; if (title_size > 0) { @@ -1449,7 +1477,7 @@ rail_create_window(Window window_id, Window owner_id) s_mark_end(s); send_rail_drawing_orders(s->data, (int)(s->end - s->data)); free_stream(s); - XFree(title_bytes); + g_free(title_bytes); rail_set_window_data(window_id, rwd); XFree(rwd); return 0; @@ -1608,7 +1636,7 @@ rail_configure_request_window(XConfigureRequestEvent* config) flags = WINDOW_ORDER_TYPE_WINDOW; make_stream(s); - init_stream(s, 1024); + init_stream(s, 1024 + num_window_rects * 8 + num_visibility_rects * 8); out_uint32_le(s, 10); /* configure_window */ out_uint32_le(s, window_id); /* window_id */ @@ -1692,7 +1720,7 @@ rail_configure_window(XConfigureEvent *config) flags = WINDOW_ORDER_TYPE_WINDOW; make_stream(s); - init_stream(s, 1024); + init_stream(s, 1024 + num_window_rects * 8 + num_visibility_rects * 8); out_uint32_le(s, 10); /* configure_window */ out_uint32_le(s, window_id); /* window_id */ @@ -1822,10 +1850,7 @@ rail_xevent(void *xevent) case CreateNotify: LOG(10, (" got CreateNotify window 0x%8.8x parent 0x%8.8x", lxevent->xcreatewindow.window, lxevent->xcreatewindow.parent)); - XSelectInput(g_display, lxevent->xcreatewindow.window, - PropertyChangeMask | StructureNotifyMask | - SubstructureNotifyMask | FocusChangeMask | - EnterWindowMask | LeaveWindowMask); + rail_select_input(lxevent->xcreatewindow.window); break; case DestroyNotify: @@ -1865,7 +1890,7 @@ rail_xevent(void *xevent) XGetWindowAttributes(g_display, lxevent->xmap.window, &wnd_attributes); if (wnd_attributes.map_state == IsViewable) { - rail_create_window(lxevent->xmap.window, lxevent->xmap.event); + rail_create_window(lxevent->xmap.window, g_root_window); if (!wnd_attributes.override_redirect) { rail_win_set_state(lxevent->xmap.window, 0x1); /* NormalState */ @@ -1887,7 +1912,16 @@ rail_xevent(void *xevent) LOG(10, (" window 0x%8.8x is unmapped", lxevent->xunmap.window)); if (index >= 0) { + XGetWindowAttributes(g_display, lxevent->xunmap.window, &wnd_attributes); + if (wnd_attributes.override_redirect) + { + // remove popups + rail_destroy_window(lxevent->xunmap.window); + list_remove_item(g_window_list, index); + } else { rail_show_window(lxevent->xunmap.window, 0x0); + } + rv = 0; } } diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c index efb7ff85..d95d1afa 100644 --- a/sesman/chansrv/sound.c +++ b/sesman/chansrv/sound.c @@ -1,7 +1,7 @@ /** * xrdp: A Remote Desktop Protocol server. * - * Copyright (C) Jay Sorg 2009-2013 + * Copyright (C) Jay Sorg 2009-2014 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,6 @@ #include <signal.h> #include <sys/un.h> -#ifdef XRDP_LOAD_PULSE_MODULES -#include <pulse/util.h> -#endif - #include "sound.h" #include "thread_calls.h" #include "defines.h" @@ -56,11 +52,6 @@ int g_buf_index = 0; int g_sent_time[256]; int g_sent_flag[256]; -#if defined(XRDP_SIMPLESOUND) -static void *DEFAULT_CC -read_raw_audio_data(void *arg); -#endif - #define CHANSRV_PORT_OUT_STR "/tmp/.xrdp/xrdp_chansrv_audio_out_socket_%d" #define CHANSRV_PORT_IN_STR "/tmp/.xrdp/xrdp_chansrv_audio_in_socket_%d" @@ -655,11 +646,6 @@ sound_init(void) g_memset(g_sent_flag, 0, sizeof(g_sent_flag)); -#ifdef XRDP_LOAD_PULSE_MODULES - if (load_pulse_modules()) - LOG(0, ("Audio and microphone redirection will not work!")); -#endif - /* init sound output */ sound_send_server_output_formats(); @@ -685,13 +671,6 @@ sound_init(void) /* save data from sound_server_source */ fifo_init(&in_fifo, 100); -#if defined(XRDP_SIMPLESOUND) - - /* start thread to read raw audio data from pulseaudio device */ - tc_thread_create(read_raw_audio_data, 0); - -#endif - return 0; } @@ -726,10 +705,6 @@ sound_deinit(void) fifo_deinit(&in_fifo); -#ifdef XRDP_LOAD_PULSE_MODULES - system("pulseaudio --kill"); -#endif - return 0; } @@ -841,158 +816,6 @@ sound_check_wait_objs(void) return 0; } -/** - * Load xrdp pulseaudio sink and source modules - * - * @return 0 on success, -1 on failure - *****************************************************************************/ - -#ifdef XRDP_LOAD_PULSE_MODULES - -static int APP_CC -load_pulse_modules() -{ - struct sockaddr_un sa; - - pid_t pid; - char* cli; - int fd; - int i; - int rv; - char buf[1024]; - - /* is pulse audio daemon running? */ - if (pa_pid_file_check_running(&pid, "pulseaudio") < 0) - { - LOG(0, ("load_pulse_modules: No PulseAudio daemon running, " - "or not running as session daemon")); - } - - /* get name of unix domain socket used by pulseaudio for CLI */ - if ((cli = (char *) pa_runtime_path("cli")) == NULL) - { - LOG(0, ("load_pulse_modules: Error getting PulesAudio runtime path")); - return -1; - } - - /* open a socket */ - if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) - { - pa_xfree(cli); - LOG(0, ("load_pulse_modules: Socket open error")); - return -1; - } - - /* set it up */ - memset(&sa, 0, sizeof(struct sockaddr_un)); - sa.sun_family = AF_UNIX; - pa_strlcpy(sa.sun_path, cli, sizeof(sa.sun_path)); - pa_xfree(cli); - - for (i = 0; i < 20; i++) - { - if (pa_pid_file_kill(SIGUSR2, NULL, "pulseaudio") < 0) - LOG(0, ("load_pulse_modules: Failed to kill PulseAudio daemon")); - - if ((rv = connect(fd, (struct sockaddr*) &sa, sizeof(sa))) < 0 && - (errno != ECONNREFUSED && errno != ENOENT)) - { - LOG(0, ("load_pulse_modules: connect() failed with error: %s", - strerror(errno))); - return -1; - } - - if (rv >= 0) - break; - - pa_msleep(300); - } - - if (i >= 20) - { - LOG(0, ("load_pulse_modules: Daemon not responding")); - return -1; - } - - LOG(0, ("load_pulse_modules: connected to pulseaudio daemon")); - - /* read back PulseAudio sign on message */ - memset(buf, 0, 1024); - recv(fd, buf, 1024, 0); - - /* send cmd to load source module */ - memset(buf, 0, 1024); - sprintf(buf, "load-module module-xrdp-source\n"); - send(fd, buf, strlen(buf), 0); - - /* read back response */ - memset(buf, 0, 1024); - recv(fd, buf, 1024, 0); - if (strcasestr(buf, "Module load failed") != 0) - { - LOG(0, ("load_pulse_modules: Error loading module-xrdp-source")); - } - else - { - LOG(0, ("load_pulse_modules: Loaded module-xrdp-source")); - - /* success, set it as the default source */ - memset(buf, 0, 1024); - sprintf(buf, "set-default-source xrdp-source\n"); - send(fd, buf, strlen(buf), 0); - - memset(buf, 0, 1024); - recv(fd, buf, 1024, 0); - - if (strcasestr(buf, "does not exist") != 0) - { - LOG(0, ("load_pulse_modules: Error setting default source")); - } - else - { - LOG(0, ("load_pulse_modules: set default source")); - } - } - - /* send cmd to load sink module */ - memset(buf, 0, 1024); - sprintf(buf, "load-module module-xrdp-sink\n"); - send(fd, buf, strlen(buf), 0); - - /* read back response */ - memset(buf, 0, 1024); - recv(fd, buf, 1024, 0); - if (strcasestr(buf, "Module load failed") != 0) - { - LOG(0, ("load_pulse_modules: Error loading module-xrdp-sink")); - } - else - { - LOG(0, ("load_pulse_modules: Loaded module-xrdp-sink")); - - /* success, set it as the default sink */ - memset(buf, 0, 1024); - sprintf(buf, "set-default-sink xrdp-sink\n"); - send(fd, buf, strlen(buf), 0); - - memset(buf, 0, 1024); - recv(fd, buf, 1024, 0); - - if (strcasestr(buf, "does not exist") != 0) - { - LOG(0, ("load_pulse_modules: Error setting default sink")); - } - else - { - LOG(0, ("load_pulse_modules: set default sink")); - } - } - - close(fd); - return 0; -} -#endif - /****************************************************************************** ** ** ** Microphone releated code ** @@ -1326,131 +1149,3 @@ sound_sndsrvr_source_data_in(struct trans *trans) return 0; } - -/*****************************************************************************/ - -#if defined(XRDP_SIMPLESOUND) - -#define AUDIO_BUF_SIZE 2048 - -static int DEFAULT_CC -sttrans_data_in(struct trans *self) -{ - LOG(0, ("sttrans_data_in:\n")); - return 0; -} - -/** - * read raw audio data from pulseaudio device and write it - * to a unix domain socket on which trans server is listening - */ - -static void *DEFAULT_CC -read_raw_audio_data(void *arg) -{ - pa_sample_spec samp_spec; - pa_simple *simple = NULL; - uint32_t bytes_read; - char *cptr; - int i; - int error; - struct trans *strans; - char path[256]; - struct stream *outs; - - strans = trans_create(TRANS_MODE_UNIX, 8192, 8192); - - if (strans == 0) - { - LOG(0, ("read_raw_audio_data: trans_create failed\n")); - return 0; - } - - strans->trans_data_in = sttrans_data_in; - g_snprintf(path, 255, CHANSRV_PORT_OUT_STR, g_display_num); - - if (trans_connect(strans, "", path, 100) != 0) - { - LOG(0, ("read_raw_audio_data: trans_connect failed\n")); - trans_delete(strans); - return 0; - } - - /* setup audio format */ - samp_spec.format = PA_SAMPLE_S16LE; - samp_spec.rate = 44100; - samp_spec.channels = 2; - - /* if we are root, then for first 8 seconds connection to pulseaudo server - fails; if we are non-root, then connection succeeds on first attempt; - for now we have changed code to be non-root, but this may change in the - future - so pretend we are root and try connecting to pulseaudio server - for upto one minute */ - for (i = 0; i < 60; i++) - { - simple = pa_simple_new(NULL, "xrdp", PA_STREAM_RECORD, NULL, - "record", &samp_spec, NULL, NULL, &error); - - if (simple) - { - /* connected to pulseaudio server */ - LOG(0, ("read_raw_audio_data: connected to pulseaudio server\n")); - break; - } - - LOG(0, ("read_raw_audio_data: ERROR creating PulseAudio async interface\n")); - LOG(0, ("read_raw_audio_data: %s\n", pa_strerror(error))); - g_sleep(1000); - } - - if (i == 60) - { - /* failed to connect to audio server */ - trans_delete(strans); - return NULL; - } - - /* insert header just once */ - outs = trans_get_out_s(strans, 8192); - out_uint32_le(outs, 0); - out_uint32_le(outs, AUDIO_BUF_SIZE + 8); - cptr = outs->p; - out_uint8s(outs, AUDIO_BUF_SIZE); - s_mark_end(outs); - - while (1) - { - /* read a block of raw audio data... */ - g_memset(cptr, 0, 4); - bytes_read = pa_simple_read(simple, cptr, AUDIO_BUF_SIZE, &error); - - if (bytes_read < 0) - { - LOG(0, ("read_raw_audio_data: ERROR reading from pulseaudio stream\n")); - LOG(0, ("read_raw_audio_data: %s\n", pa_strerror(error))); - break; - } - - /* bug workaround: - even when there is no audio data, pulseaudio is returning without - errors but the data itself is zero; we use this zero data to - determine that there is no audio data present */ - if (*cptr == 0 && *(cptr + 1) == 0 && *(cptr + 2) == 0 && *(cptr + 3) == 0) - { - g_sleep(10); - continue; - } - - if (trans_force_write_s(strans, outs) != 0) - { - LOG(0, ("read_raw_audio_data: ERROR writing audio data to server\n")); - break; - } - } - - pa_simple_free(simple); - trans_delete(strans); - return NULL; -} - -#endif diff --git a/sesman/chansrv/sound.h b/sesman/chansrv/sound.h index c26d0913..b443f0e3 100644 --- a/sesman/chansrv/sound.h +++ b/sesman/chansrv/sound.h @@ -1,7 +1,7 @@ /** * xrdp: A Remote Desktop Protocol server. * - * Copyright (C) Jay Sorg 2009-2013 + * Copyright (C) Jay Sorg 2009-2014 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,6 @@ #ifndef _SOUND_H_ #define _SOUND_H_ -#if defined(XRDP_SIMPLESOUND) -#include <pulse/simple.h> -#include <pulse/error.h> -#endif - #include "arch.h" #include "parse.h" #include "os_calls.h" @@ -75,5 +70,5 @@ static int APP_CC sound_input_start_recording(); static int APP_CC sound_input_stop_recording(); static int APP_CC sound_process_input_data(struct stream *s, int bytes); static int DEFAULT_CC sound_sndsrvr_source_data_in(struct trans *trans); -static int APP_CC load_pulse_modules(); + #endif diff --git a/xorg/X11R7.6/buildx.sh b/xorg/X11R7.6/buildx.sh index 74145e36..22dfe15f 100755 --- a/xorg/X11R7.6/buildx.sh +++ b/xorg/X11R7.6/buildx.sh @@ -59,10 +59,8 @@ remove_modules() while IFS=: read mod_file mod_dir mod_args do - if [ -d build_dir/$mod_dir ]; then - rm -rf build_dir/$mod_dir - fi - done < ../$data_file + (cd build_dir; [ -d $mod_dir ] && rm -rf $mod_dir) + done < $data_file } extract_it() |
