commit rdesktop for openSUSE:Factory
Hello community, here is the log from the commit of package rdesktop for openSUSE:Factory checked in at 2012-02-23 15:34:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rdesktop (Old) and /work/SRC/openSUSE:Factory/.rdesktop.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rdesktop", Maintainer is "LZWang@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/rdesktop/rdesktop.changes 2012-02-14 13:11:11.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rdesktop.new/rdesktop.changes 2012-02-23 15:34:39.000000000 +0100 @@ -1,0 +2,17 @@ +Wed Feb 22 15:27:08 UTC 2012 - chris@computersalat.de + +- update to version rdesktop (1.7.1) + * Fix clipboard issue when not building with unicode support + * Fix compilation against newer PCSC lite versions + * Fix for per-device license mode on Windows 2008 R2 terminal server + * Fix building 64bit version with static openssl linkage + * Rewrite of smartcard handling for 64bit support, fixes several bugs + * Improved license handling using XDG directories +- fix rpmlint + * incorrect-fsf-address + * non-standard-group +- remove obsolete patch + * lib64 patch +- rebase fix_pkgconfig_check patch + +------------------------------------------------------------------- Old: ---- rdesktop-1.6.0-fix-pkgconfig-check.dif rdesktop-1.7.0.tar.bz2 New: ---- rdesktop-1.7.1.tar.bz2 rdesktop-fix_pkgconfig_check.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rdesktop.spec ++++++ --- /var/tmp/diff_new_pack.A2Zs5M/_old 2012-02-23 15:34:40.000000000 +0100 +++ /var/tmp/diff_new_pack.A2Zs5M/_new 2012-02-23 15:34:40.000000000 +0100 @@ -18,17 +18,25 @@ Name: rdesktop -BuildRequires: alsa-devel automake libsamplerate-devel openssl-devel pkg-config xorg-x11-devel -Url: http://www.rdesktop.org/ -License: GPL-3.0+ -Group: Productivity/Networking/Remote Desktop -Version: 1.7.0 -Release: 1 Summary: A Remote Desktop Protocol client +License: GPL-3.0+ +Group: Productivity/Networking/Other +#Group: Productivity/Networking/Remote Desktop +Version: 1.7.1 +Release: 0 +Url: http://www.rdesktop.org/ Source: %{name}-%{version}.tar.bz2 +## FIX-openSUSE: needs rebase (doesn't fit anymore) Patch0: rdesktop-1.7.0-lib64.dif -Patch3: rdesktop-1.6.0-fix-pkgconfig-check.dif +## FIX-openSUSE: remove "Don't depend on pkg-config" +Patch1: rdesktop-fix_pkgconfig_check.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: alsa-devel +BuildRequires: automake +BuildRequires: libsamplerate-devel +BuildRequires: openssl-devel +BuildRequires: pkg-config +BuildRequires: xorg-x11-devel %description rdesktop is an open source client for Windows NT Terminal Server and @@ -36,23 +44,19 @@ Desktop Protocol (RDP) in order to present the user's NT desktop. Unlike Citrix ICA, no server extensions are required. - - -Authors: --------- - Matt Chapman <matthewc@cse.unsw.edu.au> - %prep %setup -%patch0 -%patch3 -p1 +#patch0 +%patch1 +## rpmlint +# incorrect-fsf-address /usr/share/rdesktop/keymaps/convert-map +perl -p -i -e 's|^# Foundation.*|# Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA|' keymaps/convert-map %build %{suse_update_config} autoreconf --force --install --verbose -CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" ./configure --prefix=/usr \ - --libdir=%{_libdir} \ - --mandir=%{_mandir} \ +CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \ +%configure \ --with-openssl=/usr \ --with-ipv6 make ++++++ rdesktop-1.7.0.tar.bz2 -> rdesktop-1.7.1.tar.bz2 ++++++ ++++ 1945 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/channels.c new/rdesktop-1.7.1/channels.c --- old/rdesktop-1.7.0/channels.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/channels.c 2011-09-28 11:36:59.000000000 +0200 @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - Virtual channels - Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003 + Copyright 2003 Erik Forsberg <forsberg@cendio.se> for Cendio AB Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 This program is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/cliprdr.c new/rdesktop-1.7.1/cliprdr.c --- old/rdesktop-1.7.0/cliprdr.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/cliprdr.c 2011-09-28 11:36:59.000000000 +0200 @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - Clipboard functions - Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003 + Copyright 2003 Erik Forsberg <forsberg@cendio.se> for Cendio AB Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 This program is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/configure.ac new/rdesktop-1.7.1/configure.ac --- old/rdesktop-1.7.0/configure.ac 2011-04-13 13:49:09.000000000 +0200 +++ new/rdesktop-1.7.1/configure.ac 2012-01-09 13:29:39.000000000 +0100 @@ -1,7 +1,9 @@ -AC_INIT(rdesktop, 1.7.0) +AC_INIT(rdesktop, 1.7.1) AC_CONFIG_SRCDIR([rdesktop.c]) +AC_CANONICAL_HOST + AC_PROG_CC if test "$GCC" = yes; then CFLAGS="$CFLAGS -Wall" @@ -25,7 +27,7 @@ exit 1 fi -AC_PATH_PROG(PKG_CONFIG, pkg-config) +AC_PATH_TOOL(PKG_CONFIG, pkg-config) AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(inet_aton, resolv) @@ -49,8 +51,6 @@ ]) ]) -rpath="" - # # OpenSSL detection borrowed from stunnel # @@ -98,13 +98,28 @@ CFLAGS="$CFLAGS -I$ssldir/include" AC_ARG_ENABLE(static-openssl, [ --enable-static-openssl link OpenSSL statically], - [ -LIBS="$LIBS $ssldir/lib/libcrypto.a" - ], - [ -LIBS="$LIBS -L$ssldir/lib -lcrypto" -rpath="$rpath:$ssldir/lib" - ]) + [static_openssl=yes], + [static_openssl=no]) +if test x"$static_openssl" = "xyes"; then + # OpenSSL generally relies on libz + AC_SEARCH_LIBS(deflate, z) + LIBS="-L$ssldir/lib -L$ssldir/lib64 -Wl,-Bstatic -lcrypto -Wl,-Bdynamic $LIBS" +else + LIBS="-L$ssldir/lib -L$ssldir/lib64 -lcrypto $LIBS" + + # + # target-specific stuff + # + case "$host" in + *-*-solaris*) + LDFLAGS="$LDFLAGS -R$ssldir/lib" + ;; + *-dec-osf*) + LDFLAGS="$LDFLAGS -Wl,-rpath,$ssldir/lib" + ;; + esac +fi + # xrandr if test -n "$PKG_CONFIG"; then PKG_CHECK_MODULES(XRANDR, xrandr, [HAVE_XRANDR=1], [HAVE_XRANDR=0]) @@ -244,8 +259,8 @@ if test x"$static_libsamplerate" = "xyes"; then _libsamplerate_libdir=`$PKG_CONFIG --errors-to-stdout --variable=libdir samplerate` LIBSAMPLERATE_LIBS="$_libsamplerate_libdir""/libsamplerate.a" + LIBSAMPLERATE_LIBS="$LIBSAMPLERATE_LIBS -lm" fi - LIBSAMPLERATE_LIBS="$LIBSAMPLERATE_LIBS -lm" fi fi @@ -893,26 +908,16 @@ # # target-specific stuff # -# strip leading colon from rpath -rpath=`echo $rpath |sed 's/^://'` -AC_CANONICAL_HOST case "$host" in -*-*-solaris*) - LDFLAGS="$LDFLAGS -R$rpath" - ;; -*-dec-osf*) - LDFLAGS="$LDFLAGS -Wl,-rpath,$rpath" - ;; *-*-hpux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" ;; *-*-irix6.5*) - LIBS="$LIBS -L$ssldir/lib32 -lcrypto" + LIBS="-L$ssldir/lib32 $LIBS" CFLAGS="$CFLAGS -D__SGI_IRIX__" ;; esac - AC_OUTPUT(Makefile) dnl Local Variables: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/doc/ChangeLog new/rdesktop-1.7.1/doc/ChangeLog --- old/rdesktop-1.7.0/doc/ChangeLog 2011-04-18 09:54:21.000000000 +0200 +++ new/rdesktop-1.7.1/doc/ChangeLog 2012-01-09 13:29:39.000000000 +0100 @@ -1,3 +1,13 @@ +rdesktop (1.7.1) + * Fix clipboard issue when not building with unicode support + * Fix compilation against newer PCSC lite versions + * Fix for per-device license mode on Windows 2008 R2 terminal server + * Fix building 64bit version with static openssl linkage + * Rewrite of smartcard handling for 64bit support, fixes several bugs + * Improved license handling using XDG directories + + -- Henrik Andersson <hean01@users.sourceforge.net> 2012-01-09 + rdesktop (1.7.0) * Security: Directory traversal vulnerability with disk redirection (disallow /.. requests) * New maintainer: Peter Åstrand <astrand@cendio.se> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/doc/rdesktop.1 new/rdesktop-1.7.1/doc/rdesktop.1 --- old/rdesktop-1.7.0/doc/rdesktop.1 2010-01-20 10:52:38.000000000 +0100 +++ new/rdesktop-1.7.1/doc/rdesktop.1 2011-10-05 08:54:45.000000000 +0200 @@ -139,7 +139,7 @@ be decimal or hexadecimal (prefixed by 0x). .TP .BR "-a <bpp>" -Sets the colour depth for the connection (8, 15, 16 or 24). +Sets the colour depth for the connection (8, 15, 16, 24 or 32). More than 8 bpp are only supported when connecting to Windows XP (up to 16 bpp) or newer. Note that the colour depth may also be limited by the server configuration. The default value is the depth @@ -161,8 +161,8 @@ Enable caching of bitmaps to disk (persistent bitmap caching). This generally improves performance (especially on low bandwidth connections) and reduces network traffic at the cost of slightly longer startup and some disk space. -(10MB for 8-bit colour, 20MB for 15/16-bit colour and 30MB for 24-bit colour -sessions) +(10MB for 8-bit colour, 20MB for 15/16-bit colour, 30MB for 24-bit colour +and 40MB for 32-bit colour sessions) .TP .BR "-r <device>" Enable redirection of the specified device on the client, such diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/keymaps/convert-map new/rdesktop-1.7.1/keymaps/convert-map --- old/rdesktop-1.7.0/keymaps/convert-map 2009-05-15 13:38:49.000000000 +0200 +++ new/rdesktop-1.7.1/keymaps/convert-map 2011-09-28 15:49:50.000000000 +0200 @@ -1,8 +1,7 @@ #!/usr/bin/env python2 # -*-Python-*- # -# -# Copyright (C) 2001 Peter Åstrand <astrand@cendio.se> +# Copyright 2001 Peter Åstrand <astrand@cendio.se> for Cendio AB # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/licence.c new/rdesktop-1.7.1/licence.c --- old/rdesktop-1.7.0/licence.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/licence.c 2011-11-25 10:55:32.000000000 +0100 @@ -2,6 +2,7 @@ rdesktop: A Remote Desktop Protocol client. RDP licensing negotiation Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright (C) Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de> 2011 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +23,7 @@ extern char *g_username; extern char g_hostname[16]; +extern RD_BOOL g_use_rdp5; static uint8 g_licence_key[16]; static uint8 g_licence_sign_key[16]; @@ -60,14 +62,14 @@ { uint32 sec_flags = SEC_LICENCE_NEG; uint16 length = - 16 + SEC_RANDOM_SIZE + SEC_MODULUS_SIZE + SEC_PADDING_SIZE + + 24 + SEC_RANDOM_SIZE + SEC_MODULUS_SIZE + SEC_PADDING_SIZE + licence_size + LICENCE_HWID_SIZE + LICENCE_SIGNATURE_SIZE; STREAM s; - s = sec_init(sec_flags, length + 4); + s = sec_init(sec_flags, length + 2); out_uint8(s, LICENCE_TAG_PRESENT); - out_uint8(s, 2); /* version */ + out_uint8(s, (g_use_rdp5? 3 : 2)); /* version */ out_uint16_le(s, length); out_uint32_le(s, 1); @@ -75,7 +77,7 @@ out_uint16_le(s, 0x0201); out_uint8p(s, client_random, SEC_RANDOM_SIZE); - out_uint16(s, 0); + out_uint16_le(s, 2); out_uint16_le(s, (SEC_MODULUS_SIZE + SEC_PADDING_SIZE)); out_uint8p(s, rsa_data, SEC_MODULUS_SIZE); out_uint8s(s, SEC_PADDING_SIZE); @@ -101,13 +103,15 @@ uint32 sec_flags = SEC_LICENCE_NEG; uint16 userlen = strlen(user) + 1; uint16 hostlen = strlen(host) + 1; - uint16 length = 128 + userlen + hostlen; + uint16 length = + 24 + SEC_RANDOM_SIZE + SEC_MODULUS_SIZE + SEC_PADDING_SIZE + + userlen + hostlen; STREAM s; s = sec_init(sec_flags, length + 2); out_uint8(s, LICENCE_TAG_REQUEST); - out_uint8(s, 2); /* version */ + out_uint8(s, (g_use_rdp5? 3 : 2)); /* version */ out_uint16_le(s, length); out_uint32_le(s, 1); @@ -115,7 +119,7 @@ out_uint16_le(s, 0xff01); out_uint8p(s, client_random, SEC_RANDOM_SIZE); - out_uint16(s, 0); + out_uint16_le(s, 2); out_uint16_le(s, (SEC_MODULUS_SIZE + SEC_PADDING_SIZE)); out_uint8p(s, rsa_data, SEC_MODULUS_SIZE); out_uint8s(s, SEC_PADDING_SIZE); @@ -163,11 +167,18 @@ ssl_rc4_set_key(&crypt_key, g_licence_key, 16); ssl_rc4_crypt(&crypt_key, hwid, hwid, sizeof(hwid)); +#if WITH_DEBUG + DEBUG(("Sending licensing PDU (message type 0x%02x)\n", LICENCE_TAG_PRESENT)); +#endif licence_present(null_data, null_data, licence_data, licence_size, hwid, signature); + xfree(licence_data); return; } +#if WITH_DEBUG + DEBUG(("Sending licensing PDU (message type 0x%02x)\n", LICENCE_TAG_REQUEST)); +#endif licence_send_request(null_data, null_data, g_username, g_hostname); } @@ -182,7 +193,7 @@ s = sec_init(sec_flags, length + 2); out_uint8(s, LICENCE_TAG_AUTHRESP); - out_uint8(s, 2); /* version */ + out_uint8(s, (g_use_rdp5? 3 : 2)); /* version */ out_uint16_le(s, length); out_uint16_le(s, 1); @@ -249,6 +260,9 @@ ssl_rc4_set_key(&crypt_key, g_licence_key, 16); ssl_rc4_crypt(&crypt_key, hwid, crypt_hwid, LICENCE_HWID_SIZE); +#if WITH_DEBUG + DEBUG(("Sending licensing PDU (message type 0x%02x)\n", LICENCE_TAG_AUTHRESP)); +#endif licence_send_authresp(out_token, crypt_hwid, out_sig); } @@ -300,6 +314,10 @@ in_uint8(s, tag); in_uint8s(s, 3); /* version, length */ +#if WITH_DEBUG + DEBUG(("Received licensing PDU (message type 0x%02x)\n", tag)); +#endif + switch (tag) { case LICENCE_TAG_DEMAND: @@ -311,14 +329,14 @@ break; case LICENCE_TAG_ISSUE: + case LICENCE_TAG_REISSUE: licence_process_issue(s); break; - case LICENCE_TAG_REISSUE: case LICENCE_TAG_RESULT: break; default: - unimpl("licence tag 0x%x\n", tag); + unimpl("licence tag 0x%02x\n", tag); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/proto.h new/rdesktop-1.7.1/proto.h --- old/rdesktop-1.7.0/proto.h 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/proto.h 2011-11-21 11:51:08.000000000 +0100 @@ -176,6 +176,8 @@ int rdpsnd_queue_next_tick(void); void rdpsnd_reset_state(void); /* secure.c */ +void sec_hash_to_string(char * out, int out_size, uint8 * in, int in_size); +void sec_hash_sha1_16(uint8 * out, uint8 * in, uint8 *salt1); void sec_hash_48(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2, uint8 salt); void sec_hash_16(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2); void buf_out_uint32(uint8 * buffer, uint32 value); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/rdesktop.c new/rdesktop-1.7.1/rdesktop.c --- old/rdesktop-1.7.0/rdesktop.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/rdesktop.c 2011-11-25 11:03:03.000000000 +0100 @@ -28,6 +28,7 @@ #include <sys/time.h> /* gettimeofday */ #include <sys/times.h> /* times */ #include <ctype.h> /* toupper */ +#include <limits.h> #include <errno.h> #include <signal.h> #include "rdesktop.h" @@ -49,6 +50,13 @@ #include "ssl.h" +#define RDESKTOP_LICENSE_STORE "/.local/share/rdesktop/licenses" + +uint8 g_static_rdesktop_salt_16[16] = { + 0xb8, 0x82, 0x29, 0x31, 0xc5, 0x39, 0xd9, 0x44, + 0x54, 0x15, 0x5e, 0x14, 0x71, 0x38, 0xd5, 0x4d +}; + char g_title[64] = ""; char *g_username; char g_hostname[16]; @@ -320,7 +328,7 @@ break; case exDiscReasonLicenseErrClientEncryption: - text = "Incorrect client license enryption"; + text = "Incorrect client license encryption"; retval = EXRD_LIC_ENC; break; @@ -988,7 +996,7 @@ STRNCPY(domain, g_redirect_domain, sizeof(domain)); xfree(g_username); g_username = (char *) xmalloc(strlen(g_redirect_username) + 1); - STRNCPY(g_username, g_redirect_username, sizeof(g_username)); + STRNCPY(g_username, g_redirect_username, strlen(g_redirect_username) + 1); STRNCPY(password, g_redirect_password, sizeof(password)); STRNCPY(server, g_redirect_server, sizeof(server)); flags |= RDP_LOGON_AUTO; @@ -1493,11 +1501,72 @@ return ret; } +static int +safe_mkdir(const char *path, int mask) +{ + int res = 0; + struct stat st; + + res = stat(path, &st); + if (res == -1 ) + return mkdir(path, mask); + + if (!S_ISDIR(st.st_mode)) + { + errno = EEXIST; + return -1; + } + + return 0; +} + +static int +mkdir_p(const char *path, int mask) +{ + int res; + char *ptok; + char pt[PATH_MAX]; + char bp[PATH_MAX]; + + if (!path || strlen(path) == 0) + { + errno = EINVAL; + return -1; + } + if (strlen(path) > PATH_MAX) + { + errno = E2BIG; + return -1; + } + + res = 0; + pt[0] = bp[0] = '\0'; + strcpy(bp, path); + + ptok = strtok(bp, "/"); + if (ptok == NULL) + return safe_mkdir(path,mask); + + do + { + if (ptok != bp) + strcat(pt, "/"); + + strcat(pt, ptok); + res = safe_mkdir(pt, mask); + if (res != 0) + return res; + + } while ((ptok = strtok(NULL, "/")) != NULL); + + return 0; +} int load_licence(unsigned char **data) { - char *home, *path; + uint8 ho[20], hi[16]; + char *home, path[PATH_MAX], hash[40]; struct stat st; int fd, length; @@ -1505,48 +1574,68 @@ if (home == NULL) return -1; - path = (char *) xmalloc(strlen(home) + strlen(g_hostname) + sizeof("/.rdesktop/licence.")); - sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname); + snprintf((char*)hi, 16, g_hostname); + sec_hash_sha1_16(ho, hi, g_static_rdesktop_salt_16); + sec_hash_to_string(hash, 40, ho, 22); + + snprintf(path, PATH_MAX, "%s"RDESKTOP_LICENSE_STORE"/%s.cal", + home, hash); + path[sizeof(path)-1] = '\0'; fd = open(path, O_RDONLY); if (fd == -1) - return -1; + { + /* fallback to try reading old license file */ + snprintf(path, PATH_MAX, "%s/.rdesktop/license.%s", + home, g_hostname); + path[sizeof(path)-1] = '\0'; + if ((fd = open(path, O_RDONLY)) == -1) + return -1; + } if (fstat(fd, &st)) + { + close(fd); return -1; + } *data = (uint8 *) xmalloc(st.st_size); length = read(fd, *data, st.st_size); close(fd); - xfree(path); return length; } void save_licence(unsigned char *data, int length) { - char *home, *path, *tmppath; + uint8 ho[20], hi[16]; + char *home, path[PATH_MAX], tmppath[PATH_MAX], hash[40]; int fd; home = getenv("HOME"); if (home == NULL) return; - path = (char *) xmalloc(strlen(home) + strlen(g_hostname) + sizeof("/.rdesktop/licence.")); - - sprintf(path, "%s/.rdesktop", home); - if ((mkdir(path, 0700) == -1) && errno != EEXIST) + snprintf(path, PATH_MAX, "%s"RDESKTOP_LICENSE_STORE, home); + path[sizeof(path)-1] = '\0'; + if ( mkdir_p(path, 0700) == -1) { perror(path); return; } - /* write licence to licence.hostname.new, then atomically rename to licence.hostname */ + snprintf((char*)hi,16,g_hostname); + sec_hash_sha1_16(ho, hi, g_static_rdesktop_salt_16); + sec_hash_to_string(hash, 40, ho, 20); + + /* write licence to {sha1}.cal.new, then atomically + rename to {sha1}.cal */ + snprintf(path, PATH_MAX, "%s"RDESKTOP_LICENSE_STORE"/%s.cal", + home, hash); + path[sizeof(path)-1] = '\0'; - sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname); - tmppath = (char *) xmalloc(strlen(path) + sizeof(".new")); - strcpy(tmppath, path); - strcat(tmppath, ".new"); + snprintf(tmppath, PATH_MAX, "%s.new", path); + path[sizeof(path)-1] = '\0'; fd = open(tmppath, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd == -1) @@ -1567,8 +1656,6 @@ } close(fd); - xfree(tmppath); - xfree(path); } /* Create the bitmap cache directory */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/rdesktop.spec new/rdesktop-1.7.1/rdesktop.spec --- old/rdesktop-1.7.0/rdesktop.spec 2011-04-18 09:44:49.000000000 +0200 +++ new/rdesktop-1.7.1/rdesktop.spec 2012-01-09 13:29:39.000000000 +0100 @@ -1,6 +1,6 @@ Summary: Remote Desktop Protocol client Name: rdesktop -Version: 1.7.0 +Version: 1.7.1 Release: 1 License: GPL; see COPYING Group: Applications/Communications diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/rdp.c new/rdesktop-1.7.1/rdp.c --- old/rdesktop-1.7.0/rdp.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/rdp.c 2011-10-26 12:53:39.000000000 +0200 @@ -1520,7 +1520,7 @@ /* read username string */ g_redirect_username = (char *) xmalloc(len + 1); - rdp_in_unistr(s, g_redirect_username, strlen(g_redirect_username), len); + rdp_in_unistr(s, g_redirect_username, len + 1, len); } if (g_redirect_flags & PDU_REDIRECT_HAS_DOMAIN) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/rdp5.c new/rdesktop-1.7.1/rdp5.c --- old/rdesktop-1.7.0/rdp5.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/rdp5.c 2011-09-28 11:36:59.000000000 +0200 @@ -2,7 +2,7 @@ rdesktop: A Remote Desktop Protocol client. Protocol services - RDP5 short form PDU processing Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 - Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003-2008 + Copyright 2003-2008 Erik Forsberg <forsberg@cendio.se> for Cendio AB This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/scard.c new/rdesktop-1.7.1/scard.c --- old/rdesktop-1.7.0/scard.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/scard.c 2011-12-07 10:49:44.000000000 +0100 @@ -3,6 +3,7 @@ Smart Card support Copyright (C) Alexi Volkov <alexi@myrealbox.com> 2006 Copyright 2010 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright 2011 Henrik Andersson <hean01@cendio.se> for Cendio AB This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +21,7 @@ #include <stdio.h> #include <unistd.h> +#include <assert.h> #include <fcntl.h> #include <strings.h> #include <sys/types.h> @@ -242,69 +244,109 @@ } #ifndef MAKE_PROTO -/* ---------------------------------- */ +typedef struct _scard_handle_list_t +{ + struct _scard_handle_list_t *next; + /* pcsc handles is datatype long which + is arch sizedependent */ + long handle; + /* rdp server handles are always 32bit */ + uint32_t server; +} _scard_handle_list_t; + +static uint32_t g_scard_handle_counter = 0; +static _scard_handle_list_t *g_scard_handle_list = NULL; + +static void _scard_handle_list_add(long handle); +static void _scard_handle_list_remove(long handle); +static uint32_t _scard_handle_list_get_server_handle(long handle); +static long _scard_handle_list_get_pcsc_handle(uint32_t server); + +void +_scard_handle_list_add(long handle) +{ + _scard_handle_list_t *list = g_scard_handle_list; + /* we dont care of order of list so to simplify the add + we add new items to front of list */ + _scard_handle_list_t *item = xmalloc(sizeof(_scard_handle_list_t)); + item->next = list; + item->handle = handle; + + /* lookup first unused handle id */ + int overlap = 0; + if (g_scard_handle_counter == 0) + g_scard_handle_counter++; + + while (_scard_handle_list_get_pcsc_handle(g_scard_handle_counter)) + { + g_scard_handle_counter++; + + if (g_scard_handle_counter == 0 && overlap) + assert(!"broken smartcard client software, handles are not freed and there is no more handles left to allocate."); + + if (g_scard_handle_counter == 0) + overlap = g_scard_handle_counter = 1; + + } + + item->server = g_scard_handle_counter; + g_scard_handle_list = item; +} + +void +_scard_handle_list_remove(long handle) +{ + _scard_handle_list_t *item, *list, *prev_item; + prev_item = NULL; + item = list = g_scard_handle_list; + + while (item) + { + if (item->handle == handle) + { + /* unlink from list */ + if (prev_item) + prev_item->next = item->next; + else + g_scard_handle_list = item->next; + + xfree(item); + break; + } -/* These two functions depend heavily on the actual implementation of the smart - * card handle in PC/SC Lite 1.3.1. Here are the salient bits: - * - * From winscard.c:331, in SCardConnect: - * *phCard = RFCreateReaderHandle(rContext); - * - * RFCreateReaderHandle (readerfactory.c:1161) creates a random short (16-bit - * integer) and makes sure it's unique. Then it adds it to - * rContext->dwIdentity. - * - * From readerfactory.c:173, in RFAddReader: - * (sReadersContexts[dwContext])->dwIdentity = - * (dwContext + 1) << (sizeof(DWORD) / 2) * 8; - * - * dwContext must be less than PCSCLITE_MAX_READERS_CONTEXTS, which is defined - * to be 16 in the 1.3.1 release. - * - * The use of "(sizeof(DWORD) / 2) * 8" is what makes conversion necessary in - * order to use 64-bit card handles when talking to PC/SC Lite, and 32-bit card - * handles when talking with the server, without losing any data: a card handle - * made by a 32-bit PC/SC Lite looks like 0x00014d32, where the 4d32 is the - * random 16 bits, 01 is the reader context index + 1, and it's left-shifted by - * 16 bits (sizeof(DWORD) == 4, divided by 2 is 2, times 8 is 16.) But a 64-bit - * PC/SC Lite makes a card handle that looks like 0x0000000100004d32. The - * reader context index+1 is left-shifted 32 bits because sizeof(DWORD) is 8, - * not 4. This means the handle won't fit in 32 bits. (The multiplication by 8 - * is because sizeofs are in bytes, but saying how many places to left-shift is - * speaking in bits.) - * - * So then. Maximum value of dwContext+1 is 17; we'll say this fits in a byte - * to be loose and have plenty of room. This is then left-shifted by - * sizeof(DWORD) / 2 * 8 - which in this file is sizeof(MYPCSC_DWORD) / 2 * 8. - * - * At any rate, if we take the handle as passed from PC/SC Lite, right-shift by - * sizeof(MYPCSC_DWORD) / 2, left-shift by sizeof(SERVER_DWORD) / 2, and add - * the lower two bytes of the value (the random number), we can fit all the - * information into 32 bits without losing any. Of course, any time we want to - * hand that back to PC/SC Lite, we'll have to expand it again. (And if - * sizeof(MYPCSC_DWORD) == sizeof(SERVER_DWORD), we're essentially doing - * nothing, which will not break anything.) - * - * - * - jared.jennings@eglin.af.mil, 2 Aug 2006 - */ - - -static MYPCSC_SCARDHANDLE -scHandleToMyPCSC(SERVER_SCARDHANDLE server) -{ - return (((MYPCSC_SCARDHANDLE) server >> (sizeof(SERVER_DWORD) * 8 / 2) & 0xffff) - << (sizeof(MYPCSC_DWORD) * 8 / 2)) + (server & 0xffff); + /* store previous item for relinking */ + prev_item = item; + item = item->next; + } } -static SERVER_SCARDHANDLE -scHandleToServer(MYPCSC_SCARDHANDLE mypcsc) +uint32_t +_scard_handle_list_get_server_handle(long handle) { - return ((mypcsc >> (sizeof(MYPCSC_DWORD) * 8 / 2) & 0xffff) - << (sizeof(SERVER_DWORD) * 8 / 2)) + (mypcsc & 0xffff); + _scard_handle_list_t *item; + item = g_scard_handle_list; + while (item) + { + if (item->handle == handle) + return item->server; + item = item->next; + } + return 0; } -/* ---------------------------------- */ +long +_scard_handle_list_get_pcsc_handle(uint32_t server) +{ + _scard_handle_list_t *item; + item = g_scard_handle_list; + while (item) + { + if (item->server == server) + return item->handle; + item = item->next; + } + return 0; +} static void * SC_xmalloc(PMEM_HANDLE * memHandle, unsigned int size) @@ -614,11 +656,22 @@ TS_SCardEstablishContext(STREAM in, STREAM out) { MYPCSC_DWORD rv; - MYPCSC_SCARDCONTEXT hContext; + MYPCSC_SCARDCONTEXT myHContext; + SERVER_SCARDCONTEXT hContext; + /* code segment */ DEBUG_SCARD(("SCARD: SCardEstablishContext()\n")); - rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext); + rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &myHContext); + + hContext = 0; + if (myHContext) + { + _scard_handle_list_add(myHContext); + hContext = _scard_handle_list_get_server_handle(myHContext); + } + + if (rv) { DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", @@ -626,14 +679,18 @@ } else { - DEBUG_SCARD(("SCARD: -> Success (context: 0x%08lx)\n", hContext)); + DEBUG_SCARD(("SCARD: -> Success (context: 0x%08x [0x%lx])\n", hContext, + myHContext)); } + + out_uint32_le(out, 0x00000004); - out_uint32_le(out, (SERVER_DWORD) hContext); /* must not be 0 (Seems to be pointer), don't know what is this (I use hContext as value) */ + out_uint32_le(out, hContext); /* must not be 0 (Seems to be pointer), don't know what is this (I use hContext as value) */ /* i hope it's not a pointer because i just downcasted it - jlj */ out_uint32_le(out, 0x00000004); - out_uint32_le(out, (SERVER_DWORD) hContext); + out_uint32_le(out, hContext); + outForceAlignment(out, 8); return rv; } @@ -641,12 +698,19 @@ TS_SCardReleaseContext(STREAM in, STREAM out) { MYPCSC_DWORD rv; + MYPCSC_SCARDCONTEXT myHContext; SERVER_SCARDCONTEXT hContext; in->p += 0x1C; in_uint32_le(in, hContext); - DEBUG_SCARD(("SCARD: SCardReleaseContext(context: 0x%08x)\n", (unsigned) hContext)); - rv = SCardReleaseContext((MYPCSC_SCARDCONTEXT) hContext); + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + + DEBUG_SCARD(("SCARD: SCardReleaseContext(context: 0x%08x [0x%lx])\n", (unsigned) hContext, + myHContext)); + + rv = SCardReleaseContext(myHContext); + + _scard_handle_list_remove(myHContext); if (rv) { @@ -658,6 +722,7 @@ DEBUG_SCARD(("SCARD: -> Success\n")); } + outForceAlignment(out, 8); return rv; } @@ -666,20 +731,25 @@ { MYPCSC_DWORD rv; SERVER_SCARDCONTEXT hContext; + MYPCSC_SCARDCONTEXT myHContext; char *readers; DWORD readerCount = 1024; PMEM_HANDLE lcHandle = NULL; in->p += 0x1C; in_uint32_le(in, hContext); - DEBUG_SCARD(("SCARD: SCardIsValidContext(context: 0x%08x)\n", (unsigned) hContext)); + + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + + DEBUG_SCARD(("SCARD: SCardIsValidContext(context: 0x%08x [0x%lx])\n", + (unsigned) hContext, myHContext)); /* There is no realization of SCardIsValidContext in PC/SC Lite so we call SCardListReaders */ readers = SC_xmalloc(&lcHandle, 1024); if (!readers) return SC_returnNoMemoryError(&lcHandle, in, out); - rv = SCardListReaders((MYPCSC_SCARDCONTEXT) hContext, NULL, readers, &readerCount); + rv = SCardListReaders(myHContext, NULL, readers, &readerCount); if (rv) { @@ -704,6 +774,7 @@ #define readerArraySize 1024 MYPCSC_DWORD rv; SERVER_SCARDCONTEXT hContext; + MYPCSC_SCARDCONTEXT myHContext; SERVER_DWORD dataLength; MYPCSC_DWORD cchReaders = readerArraySize; unsigned char *plen1, *plen2, *pend; @@ -712,7 +783,9 @@ in->p += 0x2C; in_uint32_le(in, hContext); - DEBUG_SCARD(("SCARD: SCardListReaders(context: 0x%08x)\n", (unsigned) hContext)); + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + DEBUG_SCARD(("SCARD: SCardListReaders(context: 0x%08x [0x%lx])\n", + (unsigned) hContext, myHContext)); plen1 = out->p; out_uint32_le(out, 0x00000000); /* Temp value for data length as 0x0 */ out_uint32_le(out, 0x01760650); @@ -727,7 +800,7 @@ readers[0] = '\0'; readers[1] = '\0'; - rv = SCardListReaders((MYPCSC_SCARDCONTEXT) hContext, NULL, readers, &cchReaders); + rv = SCardListReaders(myHContext, NULL, readers, &cchReaders); cur = readers; if (rv != SCARD_S_SUCCESS) { @@ -780,7 +853,8 @@ TS_SCardConnect(STREAM in, STREAM out, RD_BOOL wide) { MYPCSC_DWORD rv; - SCARDCONTEXT hContext; + SCARDCONTEXT myHContext; + SERVER_SCARDCONTEXT hContext; char *szReader; SERVER_DWORD dwShareMode; SERVER_DWORD dwPreferredProtocol; @@ -796,10 +870,21 @@ inReaderName(&lcHandle, in, &szReader, wide); in->p += 0x04; in_uint32_le(in, hContext); - DEBUG_SCARD(("SCARD: SCardConnect(context: 0x%08x, share: 0x%08x, proto: 0x%08x, reader: \"%s\")\n", (unsigned) hContext, (unsigned) dwShareMode, (unsigned) dwPreferredProtocol, szReader ? szReader : "NULL")); - rv = SCardConnect(hContext, szReader, (MYPCSC_DWORD) dwShareMode, + + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + + DEBUG_SCARD(("SCARD: SCardConnect(context: 0x%08x [0x%lx], share: 0x%08x, proto: 0x%08x, reader: \"%s\")\n", (unsigned) hContext, myHContext, (unsigned) dwShareMode, (unsigned) dwPreferredProtocol, szReader ? szReader : "NULL")); + + rv = SCardConnect(myHContext, szReader, (MYPCSC_DWORD) dwShareMode, (MYPCSC_DWORD) dwPreferredProtocol, &myHCard, &dwActiveProtocol); - hCard = scHandleToServer(myHCard); + + hCard = 0; + if (myHCard) + { + _scard_handle_list_add(myHCard); + hCard = _scard_handle_list_get_server_handle(myHCard); + } + if (rv != SCARD_S_SUCCESS) { DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", @@ -808,8 +893,8 @@ else { char *szVendor = getVendor(szReader); - DEBUG_SCARD(("SCARD: -> Success (hcard: 0x%08x [0x%08lx])\n", - (unsigned) hCard, (unsigned long) myHCard)); + DEBUG_SCARD(("SCARD: -> Success (hcard: 0x%08x [0x%lx])\n", + (unsigned) hCard, myHCard)); if (szVendor && (strlen(szVendor) > 0)) { DEBUG_SCARD(("SCARD: Set Attribute ATTR_VENDOR_NAME\n")); @@ -851,7 +936,7 @@ TS_SCardReconnect(STREAM in, STREAM out) { MYPCSC_DWORD rv; - SCARDCONTEXT hContext; + SERVER_SCARDCONTEXT hContext; SERVER_SCARDHANDLE hCard; MYPCSC_SCARDHANDLE myHCard; SERVER_DWORD dwShareMode; @@ -867,8 +952,10 @@ in_uint32_le(in, hContext); in->p += 0x04; in_uint32_le(in, hCard); - myHCard = scHandleToMyPCSC(hCard); - DEBUG_SCARD(("SCARD: SCardReconnect(context: 0x%08x, hcard: 0x%08x [0x%08lx], share: 0x%08x, proto: 0x%08x, init: 0x%08x)\n", (unsigned) hContext, (unsigned) hCard, (unsigned long) myHCard, (unsigned) dwShareMode, (unsigned) dwPreferredProtocol, (unsigned) dwInitialization)); + + + myHCard = _scard_handle_list_get_pcsc_handle(hCard); + DEBUG_SCARD(("SCARD: SCardReconnect(context: 0x%08x, hcard: 0x%08x [%lx], share: 0x%08x, proto: 0x%08x, init: 0x%08x)\n", (unsigned) hContext, (unsigned) hCard, myHCard, (unsigned) dwShareMode, (unsigned) dwPreferredProtocol, (unsigned) dwInitialization)); rv = SCardReconnect(myHCard, (MYPCSC_DWORD) dwShareMode, (MYPCSC_DWORD) dwPreferredProtocol, (MYPCSC_DWORD) dwInitialization, &dwActiveProtocol); if (rv != SCARD_S_SUCCESS) @@ -881,8 +968,8 @@ DEBUG_SCARD(("SCARD: -> Success (proto: 0x%08x)\n", (unsigned) dwActiveProtocol)); } - outForceAlignment(out, 8); out_uint32_le(out, (SERVER_DWORD) dwActiveProtocol); + outForceAlignment(out, 8); return rv; } @@ -891,6 +978,7 @@ { MYPCSC_DWORD rv; SERVER_SCARDCONTEXT hContext; + MYPCSC_SCARDCONTEXT myHContext; SERVER_SCARDHANDLE hCard; MYPCSC_SCARDHANDLE myHCard; SERVER_DWORD dwDisposition; @@ -902,7 +990,10 @@ in->p += 0x04; in_uint32_le(in, hCard); - DEBUG_SCARD(("SCARD: SCardDisconnect(context: 0x%08x, hcard: 0x%08x, disposition: 0x%08x)\n", (unsigned) hContext, (unsigned) hCard, (unsigned) dwDisposition)); + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + myHCard = _scard_handle_list_get_pcsc_handle(hCard); + + DEBUG_SCARD(("SCARD: SCardDisconnect(context: 0x%08x [0x%lx], hcard: 0x%08x [0x%lx], disposition: 0x%08x)\n", (unsigned) hContext, myHContext, (unsigned) hCard, myHCard, (unsigned) dwDisposition)); pthread_mutex_lock(&hcardAccess); PSCHCardRec hcard = hcardFirst; @@ -923,9 +1014,10 @@ } pthread_mutex_unlock(&hcardAccess); - myHCard = scHandleToMyPCSC(hCard); rv = SCardDisconnect(myHCard, (MYPCSC_DWORD) dwDisposition); + _scard_handle_list_remove(myHCard); + if (rv != SCARD_S_SUCCESS) { DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", @@ -1014,6 +1106,7 @@ { MYPCSC_DWORD rv; SERVER_SCARDCONTEXT hContext; + MYPCSC_SCARDCONTEXT myHContext; SERVER_DWORD dwTimeout; SERVER_DWORD dwCount; SERVER_LPSCARD_READERSTATE_A rsArray, cur; @@ -1028,8 +1121,9 @@ in_uint32_le(in, hContext); in->p += 0x04; - DEBUG_SCARD(("SCARD: SCardGetStatusChange(context: 0x%08x, timeout: 0x%08x, count: %d)\n", - (unsigned) hContext, (unsigned) dwTimeout, (int) dwCount)); + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + + DEBUG_SCARD(("SCARD: SCardGetStatusChange(context: 0x%08x [0x%lx], timeout: 0x%08x, count: %d)\n", (unsigned) hContext, myHContext, (unsigned) dwTimeout, (int) dwCount)); if (dwCount > 0) { @@ -1064,8 +1158,8 @@ cur->dwCurrentState |= SCARD_STATE_IGNORE; DEBUG_SCARD(("SCARD: \"%s\"\n", cur->szReader ? cur->szReader : "NULL")); - DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", - (unsigned) cur->pvUserData, (unsigned) cur->dwCurrentState, + DEBUG_SCARD(("SCARD: user: %p, state: 0x%08x, event: 0x%08x\n", + cur->pvUserData, (unsigned) cur->dwCurrentState, (unsigned) cur->dwEventState)); } } @@ -1075,12 +1169,12 @@ } myRsArray = SC_xmalloc(&lcHandle, dwCount * sizeof(MYPCSC_SCARD_READERSTATE_A)); - if (!rsArray) + if (!myRsArray) return SC_returnNoMemoryError(&lcHandle, in, out); memset(myRsArray, 0, dwCount * sizeof(SERVER_SCARD_READERSTATE_A)); copyReaderState_ServerToMyPCSC(rsArray, myRsArray, (SERVER_DWORD) dwCount); - rv = SCardGetStatusChange((MYPCSC_SCARDCONTEXT) hContext, (MYPCSC_DWORD) dwTimeout, + rv = SCardGetStatusChange(myHContext, (MYPCSC_DWORD) dwTimeout, myRsArray, (MYPCSC_DWORD) dwCount); copyReaderState_MyPCSCToServer(myRsArray, rsArray, (MYPCSC_DWORD) dwCount); @@ -1101,8 +1195,8 @@ for (i = 0, cur = rsArray; i < dwCount; i++, cur++) { DEBUG_SCARD(("SCARD: \"%s\"\n", cur->szReader ? cur->szReader : "NULL")); - DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", - (unsigned) cur->pvUserData, (unsigned) cur->dwCurrentState, + DEBUG_SCARD(("SCARD: user: %p, state: 0x%08x, event: 0x%08x\n", + cur->pvUserData, (unsigned) cur->dwCurrentState, (unsigned) cur->dwEventState)); /* Do endian swaps... */ @@ -1123,11 +1217,16 @@ { MYPCSC_DWORD rv; SERVER_SCARDCONTEXT hContext; + MYPCSC_SCARDCONTEXT myHContext; in->p += 0x1C; in_uint32_le(in, hContext); - DEBUG_SCARD(("SCARD: SCardCancel(context: 0x%08x)\n", (unsigned) hContext)); - rv = SCardCancel((MYPCSC_SCARDCONTEXT) hContext); + + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + + DEBUG_SCARD(("SCARD: SCardCancel(context: 0x%08x [0x%08lx])\n", (unsigned) hContext, + (unsigned long) myHContext)); + rv = SCardCancel(myHContext); if (rv != SCARD_S_SUCCESS) { DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", @@ -1147,6 +1246,8 @@ int i, j, k; MYPCSC_DWORD rv; SERVER_SCARDCONTEXT hContext; + MYPCSC_SCARDCONTEXT myHContext; + /* The SCARD_ATRMASK_L struct doesn't contain any longs or DWORDs - no need to split into SERVER_ and MYPCSC_ */ LPSCARD_ATRMASK_L pAtrMasks, cur; @@ -1165,13 +1266,14 @@ in_uint8a(in, pAtrMasks, atrMaskCount * sizeof(SCARD_ATRMASK_L)); in_uint32_le(in, readerCount); - rsArray = SC_xmalloc(&lcHandle, readerCount * sizeof(SCARD_READERSTATE_A)); + rsArray = SC_xmalloc(&lcHandle, readerCount * sizeof(SCARD_READERSTATE)); if (!rsArray) return SC_returnNoMemoryError(&lcHandle, in, out); - memset(rsArray, 0, readerCount * sizeof(SCARD_READERSTATE_A)); + memset(rsArray, 0, readerCount * sizeof(SCARD_READERSTATE)); - DEBUG_SCARD(("SCARD: SCardLocateCardsByATR(context: 0x%08x, atrs: %d, readers: %d)\n", - (unsigned) hContext, (int) atrMaskCount, (int) readerCount)); + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + + DEBUG_SCARD(("SCARD: SCardLocateCardsByATR(context: 0x%08x [0x%08lx], atrs: %d, readers: %d)\n", (unsigned) hContext, (unsigned long) myHContext, (int) atrMaskCount, (int) readerCount)); for (i = 0, cur = pAtrMasks; i < atrMaskCount; i++, cur++) { @@ -1213,8 +1315,8 @@ inReaderName(&lcHandle, in, (char **) &rsCur->szReader, wide); DEBUG_SCARD(("SCARD: \"%s\"\n", rsCur->szReader ? rsCur->szReader : "NULL")); - DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", - (unsigned) rsCur->pvUserData, (unsigned) rsCur->dwCurrentState, + DEBUG_SCARD(("SCARD: user: %p, state: 0x%08x, event: 0x%08x\n", + rsCur->pvUserData, (unsigned) rsCur->dwCurrentState, (unsigned) rsCur->dwEventState)); } memcpy(ResArray, rsArray, readerCount * sizeof(SERVER_SCARD_READERSTATE_A)); @@ -1224,8 +1326,7 @@ if (!myRsArray) return SC_returnNoMemoryError(&lcHandle, in, out); copyReaderState_ServerToMyPCSC(rsArray, myRsArray, readerCount); - rv = SCardGetStatusChange((MYPCSC_SCARDCONTEXT) hContext, 0x00000001, myRsArray, - readerCount); + rv = SCardGetStatusChange(myHContext, 0x00000001, myRsArray, readerCount); copyReaderState_MyPCSCToServer(myRsArray, rsArray, readerCount); if (rv != SCARD_S_SUCCESS) { @@ -1253,10 +1354,10 @@ if (equal) { rsCur->dwEventState |= 0x00000040; /* SCARD_STATE_ATRMATCH 0x00000040 */ - memcpy(ResArray + j, rsCur, sizeof(SCARD_READERSTATE_A)); + memcpy(ResArray + j, rsCur, sizeof(SCARD_READERSTATE)); DEBUG_SCARD(("SCARD: \"%s\"\n", rsCur->szReader ? rsCur->szReader : "NULL")); - DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", (unsigned) rsCur->pvUserData, (unsigned) rsCur->dwCurrentState, (unsigned) rsCur->dwEventState)); + DEBUG_SCARD(("SCARD: user: %p, state: 0x%08x, event: 0x%08x\n", rsCur->pvUserData, (unsigned) rsCur->dwCurrentState, (unsigned) rsCur->dwEventState)); } } } @@ -1274,7 +1375,7 @@ rsCur->cbAtr = swap32(rsCur->cbAtr); out_uint8p(out, (void *) ((unsigned char **) rsCur + 2), - sizeof(SCARD_READERSTATE_A) - 2 * sizeof(unsigned char *)); + sizeof(SCARD_READERSTATE) - 2 * sizeof(unsigned char *)); } outForceAlignment(out, 8); @@ -1291,9 +1392,9 @@ in->p += 0x30; in_uint32_le(in, hCard); - myHCard = scHandleToMyPCSC(hCard); - DEBUG_SCARD(("SCARD: SCardBeginTransaction(hcard: 0x%08x [0x%08lx])\n", - (unsigned) hCard, (unsigned long) myHCard)); + myHCard = _scard_handle_list_get_pcsc_handle(hCard); + DEBUG_SCARD(("SCARD: SCardBeginTransaction(hcard: 0x%08x [0x%lx])\n", + (unsigned) hCard, myHCard)); rv = SCardBeginTransaction(myHCard); if (rv != SCARD_S_SUCCESS) { @@ -1320,13 +1421,10 @@ in_uint32_le(in, dwDisposition); in->p += 0x0C; in_uint32_le(in, hCard); - myHCard = scHandleToMyPCSC(hCard); - DEBUG_SCARD(("[hCard = 0x%.8x]\n", (unsigned int) hCard)); - DEBUG_SCARD(("[myHCard = 0x%016lx]\n", (unsigned long) myHCard)); - DEBUG_SCARD(("[dwDisposition = 0x%.8x]\n", (unsigned int) dwDisposition)); + myHCard = _scard_handle_list_get_pcsc_handle(hCard); - DEBUG_SCARD(("SCARD: SCardEndTransaction(hcard: 0x%08x [0x%08lx], disposition: 0x%08x)\n", + DEBUG_SCARD(("SCARD: SCardEndTransaction(hcard: 0x%08x [0x%lx], disposition: 0x%08x)\n", (unsigned) hCard, (unsigned long) myHCard, (unsigned) dwDisposition)); rv = SCardEndTransaction(myHCard, (MYPCSC_DWORD) dwDisposition); if (rv != SCARD_S_SUCCESS) @@ -1405,7 +1503,7 @@ in->p += 0x04; in_uint32_le(in, hCard); - myHCard = scHandleToMyPCSC(hCard); + myHCard = _scard_handle_list_get_pcsc_handle(hCard); if (map[2] & INPUT_LINKED) { @@ -1574,8 +1672,7 @@ in->p += 0x0C; in_uint32_le(in, hCard); in->p += 0x04; - myHCard = scHandleToMyPCSC(hCard); - + myHCard = _scard_handle_list_get_pcsc_handle(hCard); DEBUG_SCARD(("SCARD: SCardStatus(hcard: 0x%08x [0x%08lx], reader len: %d bytes, atr len: %d bytes)\n", (unsigned) hCard, (unsigned long) myHCard, (int) dwReaderLen, (int) dwAtrLen)); if (dwReaderLen <= 0 || dwReaderLen == SCARD_AUTOALLOCATE || dwReaderLen > SCARD_MAX_MEM) @@ -1698,7 +1795,7 @@ in->p += 0x0C; in_uint32_le(in, hCard); in->p += 0x04; - myHCard = scHandleToMyPCSC(hCard); + myHCard = _scard_handle_list_get_pcsc_handle(hCard); DEBUG_SCARD(("SCARD: SCardState(hcard: 0x%08x [0x%08lx], atr len: %d bytes)\n", (unsigned) hCard, (unsigned long) myHCard, (int) dwAtrLen)); @@ -1789,6 +1886,7 @@ { MYPCSC_DWORD rv; SERVER_SCARDCONTEXT hContext; + MYPCSC_SCARDCONTEXT myHContext; SERVER_DWORD dwGroups; MYPCSC_DWORD groups; char *szGroups; @@ -1799,8 +1897,10 @@ in->p += 0x04; in_uint32_le(in, hContext); - DEBUG_SCARD(("SCARD: SCardListReaderGroups(context: 0x%08x, groups: %d)\n", - (unsigned) hContext, (int) dwGroups)); + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + + DEBUG_SCARD(("SCARD: SCardListReaderGroups(context: 0x%08x [0x%08lx], groups: %d)\n", + (unsigned) hContext, (unsigned int) myHContext, (int) dwGroups)); if (dwGroups <= 0 || dwGroups == SCARD_AUTOALLOCATE || dwGroups > SCARD_MAX_MEM) dwGroups = SCARD_MAX_MEM; @@ -1810,7 +1910,7 @@ return SC_returnNoMemoryError(&lcHandle, in, out); groups = dwGroups; - rv = SCardListReaderGroups((MYPCSC_SCARDCONTEXT) hContext, szGroups, &groups); + rv = SCardListReaderGroups(myHContext, szGroups, &groups); dwGroups = groups; if (rv) @@ -1862,8 +1962,7 @@ in_uint32_le(in, dwAttrLen); in->p += 0x0C; in_uint32_le(in, hCard); - myHCard = scHandleToMyPCSC(hCard); - + myHCard = _scard_handle_list_get_pcsc_handle(hCard); dwAttrId = dwAttrId & 0x0000FFFF; DEBUG_SCARD(("SCARD: SCardGetAttrib(hcard: 0x%08x [0x%08lx], attrib: 0x%08x (%d bytes))\n", @@ -1878,7 +1977,7 @@ pbAttr = NULL; else if ((dwAttrLen < 0) || (dwAttrLen > SCARD_MAX_MEM)) { - dwAttrLen = SCARD_AUTOALLOCATE; + dwAttrLen = (SERVER_DWORD) SCARD_AUTOALLOCATE; pbAttr = NULL; } else @@ -2004,6 +2103,7 @@ { MYPCSC_DWORD rv; SERVER_SCARDCONTEXT hContext; + MYPCSC_SCARDCONTEXT myHContext; SERVER_SCARDHANDLE hCard; MYPCSC_SCARDHANDLE myHCard; SERVER_DWORD map[3]; @@ -2042,7 +2142,10 @@ } } - DEBUG_SCARD(("SCARD: SCardControl(context: 0x%08x, hcard: 0x%08x, code: 0x%08x, in: %d bytes, out: %d bytes)\n", (unsigned) hContext, (unsigned) hCard, (unsigned) dwControlCode, (int) nInBufferSize, (int) nOutBufferSize)); + myHCard = _scard_handle_list_get_pcsc_handle(hCard); + myHContext = _scard_handle_list_get_pcsc_handle(hContext); + + DEBUG_SCARD(("SCARD: SCardControl(context: 0x%08x [0x%08lx], hcard: 0x%08x [0x%08lx], code: 0x%08x, in: %d bytes, out: %d bytes)\n", (unsigned) hContext, (unsigned long) myHContext, (unsigned) hCard, (unsigned long) myHCard, (unsigned) dwControlCode, (int) nInBufferSize, (int) nOutBufferSize)); /* Is this a proper Windows smart card ioctl? */ if ((dwControlCode & 0xffff0000) == (49 << 16)) @@ -2073,7 +2176,7 @@ return SC_returnNoMemoryError(&lcHandle, in, out); sc_nBytesReturned = nBytesReturned; - myHCard = scHandleToMyPCSC(hCard); + #ifdef WITH_PCSC120 rv = SCardControl(myHCard, pInBuffer, (MYPCSC_DWORD) nInBufferSize, pOutBuffer, &sc_nBytesReturned); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/scard.h new/rdesktop-1.7.1/scard.h --- old/rdesktop-1.7.0/scard.h 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/scard.h 2011-11-22 11:31:30.000000000 +0100 @@ -50,8 +50,7 @@ typedef uint32_t SERVER_SCARDCONTEXT; typedef uint32_t SERVER_SCARDHANDLE; -typedef SCARD_READERSTATE_A MYPCSC_SCARD_READERSTATE_A; -typedef LPSCARD_READERSTATE_A MYPCSC_LPSCARD_READERSTATE_A; +typedef SCARD_READERSTATE MYPCSC_SCARD_READERSTATE_A, *MYPCSC_LPSCARD_READERSTATE_A; typedef struct { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/seamless.h new/rdesktop-1.7.1/seamless.h --- old/rdesktop-1.7.0/seamless.h 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/seamless.h 2011-09-28 11:36:59.000000000 +0200 @@ -1,7 +1,7 @@ /* rdesktop: A Remote Desktop Protocol client. Seamless Windows support - Copyright (C) Peter Astrand <astrand@cendio.se> 2005-2008 + Copyright 2005-2008 Peter Astrand <astrand@cendio.se> for Cendio AB This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/secure.c new/rdesktop-1.7.1/secure.c --- old/rdesktop-1.7.0/secure.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/secure.c 2011-11-21 11:51:08.000000000 +0100 @@ -111,6 +111,29 @@ ssl_md5_final(&md5, out); } +/* + * 16-byte sha1 hash + */ +void sec_hash_sha1_16(uint8 * out, uint8 * in, uint8 *salt1) +{ + SSL_SHA1 sha1; + ssl_sha1_init(&sha1); + ssl_sha1_update(&sha1, in, 16); + ssl_sha1_update(&sha1, salt1, 16); + ssl_sha1_final(&sha1, out); +} + +/* create string from hash */ +void sec_hash_to_string(char * out, int out_size, uint8 * in, int in_size) +{ + int k; + memset(out,0,out_size); + for (k=0;k<in_size;k++,out+=2) + { + sprintf(out,"%.2x",in[k]); + } +} + /* Reduce key entropy from 64 to 40 bits */ static void sec_make_40bit(uint8 * key) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/serial.c new/rdesktop-1.7.1/serial.c --- old/rdesktop-1.7.0/serial.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/serial.c 2011-09-22 14:30:39.000000000 +0200 @@ -699,7 +699,7 @@ static RD_NTSTATUS serial_device_control(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out) { - int flush_mask, purge_mask; + int purge_mask; uint32 result, modemstate; uint8 immediate; SERIAL_DEVICE *pser_inf; @@ -894,13 +894,13 @@ case SERIAL_PURGE: in_uint32(in, purge_mask); DEBUG_SERIAL(("serial_ioctl -> SERIAL_PURGE purge_mask %X\n", purge_mask)); - flush_mask = 0; - if (purge_mask & SERIAL_PURGE_TXCLEAR) - flush_mask |= TCOFLUSH; - if (purge_mask & SERIAL_PURGE_RXCLEAR) - flush_mask |= TCIFLUSH; - if (flush_mask != 0) - tcflush(handle, flush_mask); + if ((purge_mask & SERIAL_PURGE_TXCLEAR) + && (purge_mask & SERIAL_PURGE_RXCLEAR)) + tcflush(handle, TCIOFLUSH); + else if (purge_mask & SERIAL_PURGE_TXCLEAR) + tcflush(handle, TCOFLUSH); + else if (purge_mask & SERIAL_PURGE_RXCLEAR) + tcflush(handle, TCIFLUSH); if (purge_mask & SERIAL_PURGE_TXABORT) rdpdr_abort_io(handle, 4, RD_STATUS_CANCELLED); if (purge_mask & SERIAL_PURGE_RXABORT) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/xclip.c new/rdesktop-1.7.1/xclip.c --- old/rdesktop-1.7.0/xclip.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/xclip.c 2011-12-21 16:19:56.000000000 +0100 @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - Clipboard functions - Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003-2008 + Copyright 2003-2008 Erik Forsberg <forsberg@cendio.se> for Cendio AB Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 Copyright 2006-2011 Pierre Ossman <ossman@cendio.se> for Cendio AB @@ -389,7 +389,7 @@ translated_data = lf2crlf(source, &length); if (translated_data != NULL) { - helper_cliprdr_send_response(translated_data, length); + helper_cliprdr_send_response(translated_data, length+1); xfree(translated_data); /* Not the same thing as XFree! */ } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/rdesktop-1.7.0/xkeymap.c new/rdesktop-1.7.1/xkeymap.c --- old/rdesktop-1.7.0/xkeymap.c 2011-04-18 13:21:57.000000000 +0200 +++ new/rdesktop-1.7.1/xkeymap.c 2011-09-28 11:36:59.000000000 +0200 @@ -3,7 +3,7 @@ User interface services - X keyboard mapping Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 - Copyright (C) 2003-2008 Peter Astrand <astrand@cendio.se> for Cendio AB + Copyright 2003-2008 Peter Astrand <astrand@cendio.se> for Cendio AB This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by ++++++ rdesktop-fix_pkgconfig_check.patch ++++++ Index: configure.ac =================================================================== --- configure.ac.orig +++ configure.ac @@ -42,14 +42,6 @@ AC_CHECK_HEADER(sysexits.h, AC_DEFINE(HA AC_CHECK_TOOL(STRIP, strip, :) -dnl Don't depend on pkg-config -m4_ifdef([PKG_CHECK_MODULES], [], [ - m4_errprint([warning: pkg-config checks are not available]) - m4_defun([PKG_CHECK_MODULES], [ - AC_MSG_WARN([pkg-config not available, cannot check for $2]) - $4 - ]) -]) # # OpenSSL detection borrowed from stunnel -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de