commit pcsc-lite for openSUSE:Factory
![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package pcsc-lite for openSUSE:Factory checked in at 2012-06-29 15:21:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pcsc-lite (Old) and /work/SRC/openSUSE:Factory/.pcsc-lite.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "pcsc-lite", Maintainer is "sbrabec@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/pcsc-lite/pcsc-lite.changes 2012-04-02 10:39:30.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.pcsc-lite.new/pcsc-lite.changes 2012-06-29 15:21:29.000000000 +0200 @@ -1,0 +2,15 @@ +Fri Jun 29 06:54:29 UTC 2012 - wr@rosenauer.org + +- Updated to version 1.8.4 + * Add [ and ] in the list of accepted characters for a reader + name + * truncates the reader name if it is too long instead of + rejecting the reader + * The restriction to have to call SCardEstablishContext() in each + thread has been removed. Threads could now share a PC/SC + context. + * Update IFDHandler API Doxygen regarding the "libusb-1.0" naming + scheme + * Some other minor improvements and bug corrections + +------------------------------------------------------------------- Old: ---- pcsc-lite-1.8.3.tar.bz2 New: ---- pcsc-lite-1.8.4.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pcsc-lite.spec ++++++ --- /var/tmp/diff_new_pack.QjW7zq/_old 2012-06-29 15:21:31.000000000 +0200 +++ /var/tmp/diff_new_pack.QjW7zq/_new 2012-06-29 15:21:31.000000000 +0200 @@ -33,7 +33,7 @@ BuildRequires: systemd %{?systemd_requires} %endif -Version: 1.8.3 +Version: 1.8.4 Release: 0 Requires(pre): pwdutils Url: http://pcsclite.alioth.debian.org/ @@ -127,9 +127,6 @@ cp -a %{S:1} %{S:2} %{S:5} %{S:6} . %build -%if %suse_version > 1110 -ACLOCAL="aclocal -I m4" autoreconf -f -i -%endif %configure\ --docdir=%{_docdir}/%{name} \ --enable-usbdropdir=%{ifddir} \ @@ -177,7 +174,6 @@ /bin/systemctl restart pcscd.socket || : %endif %fillup_and_insserv -y -n pcscd pcscd -%restart_on_update pcscd %preun %if %suse_version > 1140 @@ -193,6 +189,7 @@ /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi %endif +%restart_on_update pcscd %insserv_cleanup %post -n libpcsclite1 -p /sbin/ldconfig ++++++ pcsc-lite-1.8.3.tar.bz2 -> pcsc-lite-1.8.4.tar.bz2 ++++++ ++++ 3607 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/pcsc-lite-1.8.3/ChangeLog new/pcsc-lite-1.8.4/ChangeLog --- old/pcsc-lite-1.8.3/ChangeLog 2012-03-30 14:11:48.000000000 +0200 +++ new/pcsc-lite-1.8.4/ChangeLog 2012-06-26 20:58:17.000000000 +0200 @@ -1,3 +1,15 @@ +pcsc-lite-1.8.4: Ludovic Rousseau +26 June 2012 +- Add [ and ] in the list of accepted characters for a reader name +- truncates the reader name if it is too long instead of rejecting the + reader +- The restriction to have to call SCardEstablishContext() in each thread + has been removed. Threads could now share a PC/SC context. +- Fix compiler failure for static driver +- Update IFDHandler API Doxygen regarding the "libusb-1.0" naming scheme +- Some other minor improvements and bug corrections + + pcsc-lite-1.8.3: Ludovic Rousseau 30 March 2012 - ignore directories and hidden (.*) files when parsing a configuration 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/pcsc-lite-1.8.3/ChangeLog.svn new/pcsc-lite-1.8.4/ChangeLog.svn --- old/pcsc-lite-1.8.3/ChangeLog.svn 2012-03-30 14:15:56.000000000 +0200 +++ new/pcsc-lite-1.8.4/ChangeLog.svn 2012-06-26 21:01:25.000000000 +0200 @@ -1,3 +1,199 @@ +2012-06-26 Ludovic Rousseau + + * [r6364] ChangeLog, configure.in: Release 1.8.4 + * [r6363] UnitaryTests/SCardBeginTransaction_deadlock.py: Unitary + test for locking in SCardBeginTransaction, SCardTransmit, + SCardStatus and SCardReconnect + * [r6362] src/winscard_clnt.c: With changes in revisions 6358 to + 6361 it is now possible to use the same SCARDCONTEXT in different + threads (same as on Windows) + + With one context per thread the locking was controlled by the + daemon. With the same context for 2 threads the locking is + controlled (first) on the client side since the 2 threads uses + the same mutex. + * [r6361] src/winscard_clnt.c: Similar patch as in revision 6358 + but for SCardReconnect() + + Thanks to Aleksey Samsonov for the patch + http://archives.neohapsis.com/archives/dev/muscle/2012-q2/0109.html + * [r6360] src/winscard_clnt.c: Similar patch as in revision 6358 + but for SCardBeginTransaction() + + Thanks to Aleksey Samsonov for the patch + http://archives.neohapsis.com/archives/dev/muscle/2012-q2/0109.html + * [r6359] src/winscard_clnt.c: SCardStatus(): Similar patch as in + revision 6358 but for SCardStatus() + + Thanks to Aleksey Samsonov for the patch + http://archives.neohapsis.com/archives/dev/muscle/2012-q2/0109.html + * [r6358] src/winscard_clnt.c: SCardTransmit(): do not hold the + mutex when waiting in a SCARD_E_SHARING_VIOLATION loop + + If SCardTransmit() is waiting because the reader is used by + another thread/process then we release the + currentContextMap->mMutex, sleep, and try to acquire the mutex + again. This will allow another thread using the same hContext to + call SCardEndTransaction() otherwise the mutex is already held by + SCardTransmit() and SCardEndTransaction() can't get it to finish + the transaction => dead lock + + Thanks to Aleksey Samsonov for the patch + http://archives.neohapsis.com/archives/dev/muscle/2012-q2/0109.html + +2012-06-25 Ludovic Rousseau + + * [r6357] src/PCSC/ifdhandler.h: Update Doxygen: document + "libusb-1.0" scheme + + the "libusb" (for libusb-0.1) scheme has been updated to a + "libusb-1.0" scheme (for libusb-1.0). The device name now + contains the interface number. The bus and device are now + integers instead of paths. + + The change has been done in revision 5044 (June 2010) but the API + was not updated at the same time. + * [r6356] src/readerfactory.c: RFReaderInfoNamePort(): Compare only + the significant part of the reader name + + Since revision 6354 the reader name may be truncated. Only the + part in readerState->readerName (managed by RFAddReader()) is + truntacted. The reader name stored the hotplug_*.c + readerTracker[] structures is NOT truncated. So we must use a + truncated compare function to find the reader name. + * [r6355] src/PCSC/pcsclite.h.in: Increase MAX_READERNAME from 100 + to 128 + + It is not a perfect solution but it should limit the truncations + of reader names as introduced in revision 6354. + * [r6354] src/readerfactory.c: RFAddReader(): truncates the reader + name if too long + + The reader name size is limited to a total of MAX_READERNAME + characters (100 by default). But some reader names are very long + like: "SCM Microsystems Inc. SCR3340 - ExpressCard54 Smart Card + Reader" and also provide a serial number and an interface name. + So the name constructed by hotplug_libudev.c can be very long and + longer than the 100 caracters. + + Closes: [#313684] "Reader name too long" error + https://alioth.debian.org/tracker/?func=detail&atid=410085&aid=313684&group_id=30105 + http://archives.neohapsis.com/archives/dev/muscle/2012-q2/0113.html + * [r6353] src/hotplug_libudev.c: HPRescanUsbBus(): Display the full + name of the removed reader + +2012-06-06 Ludovic Rousseau + + * [r6325] src/tokenparser.l: Add [ and ] in the list of accepted + characters for a reader name + + Readers with these characters caused a crash in libccid without + any error message. This is because the reader entry was skiped + and a reader name was then missing in the list. NULL is not a + valid reader name :-) + + Thanks to Philippe Teuwen for the bug report. + +2012-06-05 Ludovic Rousseau + + * [r6323] src/pcscd.h.in: Remove now useless PCSCLITE_SVC_IDENTITY + + PCSCLITE_SVC_IDENTITY is no more used since revision 6322. + * [r6322] src/winscard.c: SCardEstablishContext(): Use a full + 32-bits random value + + Use a full int range (32-bits) value instead of a 16-bits value. + + Note: this value is (still) not used/checked on the server side. + * [r6321] src/readerfactory.c, src/readerfactory.h: remove + dwIdentity field from ReaderContext structure + + Since revision 6320 dwIdentity is no more used. So we can remove + it. + * [r6320] src/readerfactory.c: RFCreateReaderHandle(): generates a + 32-bits random for hCard + + Since the change in revision 6316 dwIdentity is no more used to + identify a hCard -> reader relation. So we can just generate a + hCard as a full 32-bits random. + + The security should be improved with a change from 16-bits random + to a 32-bits random. It will be more difficult for a rogue client + to guess a valid hCard value. + * [r6319] src/sys_unix.c: SYS_RandomInt(): extend range if fEnd == + -1 + + If fEnd parameter is set to -1 then the result of rand() is not + truncated. This is usefull to get 32-bits of random with no + constraint on the values. + * [r6318] src/readerfactory.c, src/readerfactory.h: Remove now + unused function RFFindReaderHandle() + + Since revision 6317 this function is no more used. + * [r6317] src/winscard.c: Calls to RFFindReaderHandle() are now + useless + + RFFindReaderHandle() was used to check the hCard is valid. Since + revision 6316 the algorithm used in RFFindReaderHandle() is + already used in RFReaderInfoById(). + + So calling RFFindReaderHandle() after RFReaderInfoById() (as it + was done) is now useless. + * [r6316] src/readerfactory.c, src/readerfactory.h: Use handlesList + to find a hCard -> reader link + + hCard handles are stored in the handlesList list of readers. The + use of dwIdentity just duplicate the information and is no more + needed. + + The algorithm is the same as in RFFindReaderHandle() + +2012-06-02 Ludovic Rousseau + + * [r6315] src/ifdwrapper.c: Fix compiler failure for static driver + + CFLAGS="-DPCSCLITE_STATIC_DRIVER -DIFDHANDLERv3" ./configure make + [...] ifdwrapper.c: In function ‘IFDOpenIFD’: + ifdwrapper.c:125:15: error: ‘READER_CONTEXT’ has no member named + ‘lpcDevice’ ifdwrapper.c:126:57: error: ‘READER_CONTEXT’ has no + member named ‘lpcDevice’ + +2012-05-28 Ludovic Rousseau + + * [r6312] src/ifdwrapper.c: IFDPowerICC(): check the value returned + by IFDStatusICC() + + The reader may be gone at this step. See + http://archives.neohapsis.com/archives/dev/muscle/2012-q2/0041.html + +2012-05-18 Ludovic Rousseau + + * [r6302] src/PCSC/ifdhandler.h: Remove an extra '.' at the end of + the URL + + Thanks to "helpcrypto" for the bug report + http://archives.neohapsis.com/archives/dev/muscle/2012-q2/0036.html + * [r6299] configure.in: warning: 'libpcsclite.la': linking libtool + libraries using a non-POSIX archiver requires 'AM_PROG_AR' in + 'configure.in' + * [r6298] configure.in: autoupdated using autoupdate (GNU Autoconf) + 2.69 + +2012-04-05 Ludovic Rousseau + + * [r6261] UnitaryTests/FEATURE_GET_TLV_PROPERTIES.py: Unitary test + for FEATURE_GET_TLV_PROPERTIES + +2012-04-04 Ludovic Rousseau + + * [r6256] + UnitaryTests/FEATURE_CCID_ESC_COMMAND_Gemalto_features.py: Catch + control() exception + + If the driver is not configured with + DRIVER_OPTION_CCID_EXCHANGE_AUTHORIZED then the control() will + fail with a SmartcardException() exception. + 2012-03-30 Ludovic Rousseau * [r6253] ChangeLog, configure.in: Release 1.8.3 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/pcsc-lite-1.8.3/ar-lib new/pcsc-lite-1.8.4/ar-lib --- old/pcsc-lite-1.8.3/ar-lib 1970-01-01 01:00:00.000000000 +0100 +++ new/pcsc-lite-1.8.4/ar-lib 2012-06-08 20:49:13.000000000 +0200 @@ -0,0 +1,265 @@ +#! /bin/sh +# Wrapper for Microsoft lib.exe + +me=ar-lib +scriptversion=2012-01-30.22; # UTC + +# Copyright (C) 2010, 2012 Free Software Foundation, Inc. +# Written by Peter Rosin <peda@lysator.liu.se>. +# +# 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + + +# func_error message +func_error () +{ + echo "$me: $1" 1>&2 + exit 1 +} + +file_conv= + +# func_file_conv build_file +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv in + mingw) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_at_file at_file operation archive +# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE +# for each of them. +# When interpreting the content of the @FILE, do NOT use func_file_conv, +# since the user would need to supply preconverted file names to +# binutils ar, at least for MinGW. +func_at_file () +{ + operation=$2 + archive=$3 + at_file_contents=`cat "$1"` + eval set x "$at_file_contents" + shift + + for member + do + $AR -NOLOGO $operation:"$member" "$archive" || exit $? + done +} + +case $1 in + '') + func_error "no command. Try '$0 --help' for more information." + ;; + -h | --h*) + cat <<EOF +Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...] + +Members may be specified in a file named with @FILE. +EOF + exit $? + ;; + -v | --v*) + echo "$me, version $scriptversion" + exit $? + ;; +esac + +if test $# -lt 3; then + func_error "you must specify a program, an action and an archive" +fi + +AR=$1 +shift +while : +do + if test $# -lt 2; then + func_error "you must specify a program, an action and an archive" + fi + case $1 in + -lib | -LIB \ + | -ltcg | -LTCG \ + | -machine* | -MACHINE* \ + | -subsystem* | -SUBSYSTEM* \ + | -verbose | -VERBOSE \ + | -wx* | -WX* ) + AR="$AR $1" + shift + ;; + *) + action=$1 + shift + break + ;; + esac +done +orig_archive=$1 +shift +func_file_conv "$orig_archive" +archive=$file + +# strip leading dash in $action +action=${action#-} + +delete= +extract= +list= +replace= +create= + +while test -n "$action" +do + case $action in + d*) delete=yes ;; + x*) extract=yes ;; + t*) list=yes ;; + r*) replace=yes ;; + c*) create=yes ;; + u*) ;; # TODO: don't ignore the update modifier + v*) ;; # TODO: don't ignore the verbose modifier + *) + func_error "unknown action specified" + ;; + esac + action=${action#?} +done + +case $delete$extract$list$replace in + yes) + ;; + yesyes*) + func_error "more than one action specified" + ;; + *) + func_error "no action specified" + ;; +esac + +if test -n "$delete"; then + if test ! -f "$orig_archive"; then + func_error "archive not found" + fi + for member + do + case $1 in + @*) + func_at_file "${1#@}" -REMOVE "$archive" + ;; + *) + func_file_conv "$1" + $AR -NOLOGO -REMOVE:"$file" "$archive" || exit $? + ;; + esac + done + +elif test -n "$extract"; then + if test ! -f "$orig_archive"; then + func_error "archive not found" + fi + if test $# -gt 0; then + for member + do + case $1 in + @*) + func_at_file "${1#@}" -EXTRACT "$archive" + ;; + *) + func_file_conv "$1" + $AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $? + ;; + esac + done + else + $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member + do + $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? + done + fi + +elif test -n "$replace"; then + if test ! -f "$orig_archive"; then + if test -z "$create"; then + echo "$me: creating $orig_archive" + fi + orig_archive= + else + orig_archive=$archive + fi + + for member + do + case $1 in + @*) + func_file_conv "${1#@}" + set x "$@" "@$file" + ;; + *) + func_file_conv "$1" + set x "$@" "$file" + ;; + esac + shift + shift + done + + if test -n "$orig_archive"; then + $AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $? + else + $AR -NOLOGO -OUT:"$archive" "$@" || exit $? + fi + +elif test -n "$list"; then + if test ! -f "$orig_archive"; then + func_error "archive not found" + fi + $AR -NOLOGO -LIST "$archive" || exit $? +fi 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/pcsc-lite-1.8.3/configure.in new/pcsc-lite-1.8.4/configure.in --- old/pcsc-lite-1.8.3/configure.in 2012-03-30 14:11:48.000000000 +0200 +++ new/pcsc-lite-1.8.4/configure.in 2012-06-26 20:58:17.000000000 +0200 @@ -1,12 +1,12 @@ # -*- mode: m4; -*- # Process this file with autoconf to produce a configure script -AC_PREREQ(2.58) +AC_PREREQ([2.69]) -AC_INIT(pcsc-lite, 1.8.3) +AC_INIT([pcsc-lite],[1.8.4]) AC_CONFIG_SRCDIR(src/pcscdaemon.c) AM_INIT_AUTOMAKE(1.8 dist-bzip2 no-dist-gzip) -AM_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR(m4) @@ -63,6 +63,7 @@ AM_PROG_LEX PKG_PROG_PKG_CONFIG AM_PROG_CC_C_O +AM_PROG_AR # Special check for pthread support ACX_PTHREAD( @@ -87,7 +88,7 @@ # Add libtool support # Static lib is disabled by default. Use --enable-static if needed LT_INIT(disable-static) -AM_PROG_LIBTOOL +LT_INIT # Automatically update the libtool script if it becomes out-of-date #AC_SUBST(LIBTOOL_DEPS) @@ -152,7 +153,7 @@ # --disable-serial AC_ARG_ENABLE(serial, - AC_HELP_STRING([--disable-serial],[do not use serial reader.conf file]), + AS_HELP_STRING([--disable-serial],[do not use serial reader.conf file]), [ use_serial="${enableval}" ], [ use_serial="yes" ] ) AM_CONDITIONAL(ENABLE_SERIAL, test "$use_serial" != "no") if test "$use_serial" != "no"; then @@ -162,7 +163,7 @@ # --disable-usb AC_ARG_ENABLE(usb, - AC_HELP_STRING([--disable-usb],[do not use usb hotplug]), + AS_HELP_STRING([--disable-usb],[do not use usb hotplug]), [ use_usb="${enableval}" ], [ use_usb="yes" ] ) AM_CONDITIONAL(ENABLE_USB, test "$use_usb" != "no") if test "$use_usb" != "no"; then @@ -172,7 +173,7 @@ # --enable-libudev AC_ARG_ENABLE(libudev, - AC_HELP_STRING([--disable-libudev],[do not use libudev]), + AS_HELP_STRING([--disable-libudev],[do not use libudev]), [ use_libudev="${enableval}" ], [ if test "$PCSC_ARCH" != "Linux" ; then use_libudev="no" @@ -221,7 +222,7 @@ # --enable-libusb AC_ARG_ENABLE(libusb, - AC_HELP_STRING([--enable-libusb],[use libusb]), + AS_HELP_STRING([--enable-libusb],[use libusb]), [ use_libusb="${enableval}" ], [ if test "x$use_libudev" = xyes ; then use_libusb="${use_libusb-no}" ; else use_libusb="${use_libusb-yes}" ; fi ] ) @@ -290,7 +291,7 @@ # --enable-embedded AC_ARG_ENABLE(embedded, - AC_HELP_STRING([--enable-embedded], [limit RAM and CPU ressources by disabling features (log)]), + AS_HELP_STRING([--enable-embedded],[limit RAM and CPU ressources by disabling features (log)]), [ use_embedded="${enableval}" ]) if test x$use_embedded = xyes; then @@ -300,7 +301,7 @@ # --enable-usbdropdir=DIR AC_ARG_ENABLE(usbdropdir, - AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB + AS_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB drivers (default /usr/local/lib/pcsc/drivers)]), [usbdropdir="${enableval}"], [usbdropdir=false]) if test x${usbdropdir} = xfalse ; then @@ -317,7 +318,7 @@ # --enable-debugatr AC_ARG_ENABLE(debugatr, - AC_HELP_STRING([--enable-debugatr],[enable ATR debug messages from pcscd]), + AS_HELP_STRING([--enable-debugatr],[enable ATR debug messages from pcscd]), [ case "${enableval}" in yes) debugatr=true ;; no) debugatr=false ;; @@ -331,7 +332,7 @@ # --enable-ipcdir=DIR AC_ARG_ENABLE(ipcdir, - AC_HELP_STRING([--enable-ipcdir=DIR],[directory containing IPC files + AS_HELP_STRING([--enable-ipcdir=DIR],[directory containing IPC files (default /var/run/pcscd)]), [ipcdir="${enableval}"], [ipcdir=false]) @@ -345,8 +346,7 @@ # --enable-confdir=DIR AC_ARG_ENABLE(confdir, -AC_HELP_STRING([--enable-confdir=DIR], - [directory containing reader configurations (default /etc/reader.conf.d)]), +AS_HELP_STRING([--enable-confdir=DIR],[directory containing reader configurations (default /etc/reader.conf.d)]), [confdir="${enableval}"], [confdir="${sysconfdir}/reader.conf.d"]) 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/pcsc-lite-1.8.3/src/PCSC/ifdhandler.h new/pcsc-lite-1.8.4/src/PCSC/ifdhandler.h --- old/pcsc-lite-1.8.3/src/PCSC/ifdhandler.h 2012-01-01 22:02:09.000000000 +0100 +++ new/pcsc-lite-1.8.4/src/PCSC/ifdhandler.h 2012-06-26 20:49:57.000000000 +0200 @@ -8,7 +8,7 @@ * Copyright (C) 2002-2011 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: ifdhandler.h 6156 2012-01-01 21:02:08Z rousseau $ + * $Id: ifdhandler.h 6357 2012-06-25 13:53:30Z rousseau $ */ /** @@ -19,7 +19,7 @@ The routines specified hereafter will allow you to write an IFD handler for the PC/SC Lite resource manager. Please use the complement developer's kit complete with headers and Makefile at: -http://www.musclecard.com/drivers.html. +http://www.musclecard.com/drivers.html This gives a common API for communication to most readers in a homogeneous fashion. This document assumes that the driver developer is @@ -414,16 +414,15 @@ - libusb - For USB drivers using libusb http://libusb.sourceforge.net/ for USB + For USB drivers using libusb-1.0 http://libusb.sourceforge.net/ for USB abstraction the @p DeviceName the string may be generated by: @code - printf("usb:%04x/%04x:libusb:%s:%s", - idVendor, idProduct, - bus->dirname, dev->filename) + printf("usb:%04x/%04x:libusb-1.0:%d:%d:%d", + idVendor, idProduct, bus_number, device_address, interface) @endcode - So it is something like: <tt>usb:08e6/3437:libusb:001:042</tt> under + So it is something like: <tt>usb:08e6/3437:libusb-1.0:7:99:0</tt> under GNU/Linux. - libudev 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/pcsc-lite-1.8.3/src/PCSC/pcsclite.h new/pcsc-lite-1.8.4/src/PCSC/pcsclite.h --- old/pcsc-lite-1.8.3/src/PCSC/pcsclite.h 2012-03-30 14:12:02.000000000 +0200 +++ new/pcsc-lite-1.8.4/src/PCSC/pcsclite.h 2012-06-26 20:58:30.000000000 +0200 @@ -8,7 +8,7 @@ * Copyright (C) 2005 * Martin Paljak <martin@paljak.pri.ee> * - * $Id: pcsclite.h.in 6063 2011-10-22 18:19:11Z rousseau $ + * $Id: pcsclite.h.in 6355 2012-06-25 13:22:27Z rousseau $ */ /** @@ -190,11 +190,11 @@ #define INFINITE 0xFFFFFFFF /**< Infinite timeout */ #endif -#define PCSCLITE_VERSION_NUMBER "1.8.3" /**< Current version */ +#define PCSCLITE_VERSION_NUMBER "1.8.4" /**< Current version */ /** Maximum readers context (a slot is count as a reader) */ #define PCSCLITE_MAX_READERS_CONTEXTS 16 -#define MAX_READERNAME 100 +#define MAX_READERNAME 128 #ifndef SCARD_ATR_LENGTH #define SCARD_ATR_LENGTH MAX_ATR_SIZE /**< Maximum ATR size */ 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/pcsc-lite-1.8.3/src/PCSC/pcsclite.h.in new/pcsc-lite-1.8.4/src/PCSC/pcsclite.h.in --- old/pcsc-lite-1.8.3/src/PCSC/pcsclite.h.in 2011-10-30 14:01:53.000000000 +0100 +++ new/pcsc-lite-1.8.4/src/PCSC/pcsclite.h.in 2012-06-26 20:49:57.000000000 +0200 @@ -8,7 +8,7 @@ * Copyright (C) 2005 * Martin Paljak <martin@paljak.pri.ee> * - * $Id: pcsclite.h.in 6063 2011-10-22 18:19:11Z rousseau $ + * $Id: pcsclite.h.in 6355 2012-06-25 13:22:27Z rousseau $ */ /** @@ -194,7 +194,7 @@ /** Maximum readers context (a slot is count as a reader) */ #define PCSCLITE_MAX_READERS_CONTEXTS 16 -#define MAX_READERNAME 100 +#define MAX_READERNAME 128 #ifndef SCARD_ATR_LENGTH #define SCARD_ATR_LENGTH MAX_ATR_SIZE /**< Maximum ATR size */ 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/pcsc-lite-1.8.3/src/hotplug_libudev.c new/pcsc-lite-1.8.4/src/hotplug_libudev.c --- old/pcsc-lite-1.8.3/src/hotplug_libudev.c 2011-12-15 18:53:18.000000000 +0100 +++ new/pcsc-lite-1.8.4/src/hotplug_libudev.c 2012-06-26 20:49:57.000000000 +0200 @@ -4,7 +4,7 @@ * Copyright (C) 2011 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: hotplug_libudev.c 6130 2011-12-05 14:44:09Z rousseau $ + * $Id: hotplug_libudev.c 6353 2012-06-25 12:40:58Z rousseau $ */ /** @@ -504,9 +504,8 @@ if ((READER_ABSENT == readerTracker[i].status) && (readerTracker[i].fullName != NULL)) { - - Log3(PCSC_LOG_INFO, "Removing USB device[%d]: %s", i, - readerTracker[i].devpath); + Log4(PCSC_LOG_INFO, "Removing USB device[%d]: %s at %s", i, + readerTracker[i].fullName, readerTracker[i].devpath); RFRemoveReader(readerTracker[i].fullName, PCSCLITE_HP_BASE_PORT + i); 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/pcsc-lite-1.8.3/src/ifdwrapper.c new/pcsc-lite-1.8.4/src/ifdwrapper.c --- old/pcsc-lite-1.8.3/src/ifdwrapper.c 2011-07-09 14:10:50.000000000 +0200 +++ new/pcsc-lite-1.8.4/src/ifdwrapper.c 2012-06-08 16:17:11.000000000 +0200 @@ -8,7 +8,7 @@ * Copyright (C) 2002-2011 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: ifdwrapper.c 5860 2011-07-09 11:29:52Z rousseau $ + * $Id: ifdwrapper.c 6315 2012-06-02 13:08:05Z rousseau $ */ /** @@ -122,8 +122,8 @@ #else { /* Use device name only if defined */ - if (rContext->lpcDevice[0] != '\0') - rv = IFDHCreateChannelByName(rContext->slot, rContext->lpcDevice); + if (rContext->device[0] != '\0') + rv = IFDHCreateChannelByName(rContext->slot, rContext->device); else rv = IFDHCreateChannel(rContext->slot, rContext->port); } @@ -266,7 +266,14 @@ /* * Check that the card is inserted first */ - (void)IFDStatusICC(rContext, &dwStatus); + rv = IFDStatusICC(rContext, &dwStatus); + if (rv != IFD_SUCCESS) + { + if (rv == IFD_NO_SUCH_DEVICE) + return SCARD_E_READER_UNAVAILABLE; + + return SCARD_E_NOT_TRANSACTED; + } if (dwStatus & SCARD_ABSENT) return SCARD_W_REMOVED_CARD; 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/pcsc-lite-1.8.3/src/pcscd.h new/pcsc-lite-1.8.4/src/pcscd.h --- old/pcsc-lite-1.8.3/src/pcscd.h 2012-03-30 14:12:02.000000000 +0200 +++ new/pcsc-lite-1.8.4/src/pcscd.h 2012-06-26 20:58:30.000000000 +0200 @@ -4,7 +4,7 @@ * Copyright (C) 2006-2011 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: pcscd.h.in 6071 2011-10-24 11:51:08Z rousseau $ + * $Id: pcscd.h.in 6323 2012-06-05 09:19:06Z rousseau $ */ /** @@ -30,9 +30,7 @@ #define PCSCLITE_CSOCK_NAME PCSCLITE_IPC_DIR "/pcscd.comm" -#define PCSCLITE_SVC_IDENTITY 0x01030000 /**< Service ID */ - -#define PCSCLITE_VERSION_NUMBER "1.8.3" /**< Current version */ +#define PCSCLITE_VERSION_NUMBER "1.8.4" /**< Current version */ #define PCSCLITE_STATUS_POLL_RATE 400000 /**< Status polling rate */ #define PCSCLITE_LOCK_POLL_RATE 100000 /**< Lock polling rate */ 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/pcsc-lite-1.8.3/src/pcscd.h.in new/pcsc-lite-1.8.4/src/pcscd.h.in --- old/pcsc-lite-1.8.3/src/pcscd.h.in 2011-10-30 14:01:53.000000000 +0100 +++ new/pcsc-lite-1.8.4/src/pcscd.h.in 2012-06-08 16:17:11.000000000 +0200 @@ -4,7 +4,7 @@ * Copyright (C) 2006-2011 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: pcscd.h.in 6071 2011-10-24 11:51:08Z rousseau $ + * $Id: pcscd.h.in 6323 2012-06-05 09:19:06Z rousseau $ */ /** @@ -30,8 +30,6 @@ #define PCSCLITE_CSOCK_NAME PCSCLITE_IPC_DIR "/pcscd.comm" -#define PCSCLITE_SVC_IDENTITY 0x01030000 /**< Service ID */ - #define PCSCLITE_VERSION_NUMBER "@VERSION@" /**< Current version */ #define PCSCLITE_STATUS_POLL_RATE 400000 /**< Status polling rate */ #define PCSCLITE_LOCK_POLL_RATE 100000 /**< Lock polling rate */ 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/pcsc-lite-1.8.3/src/readerfactory.c new/pcsc-lite-1.8.4/src/readerfactory.c --- old/pcsc-lite-1.8.3/src/readerfactory.c 2011-12-15 18:53:18.000000000 +0100 +++ new/pcsc-lite-1.8.4/src/readerfactory.c 2012-06-26 20:49:57.000000000 +0200 @@ -10,7 +10,7 @@ * Copyright (C) 2009 * Jean-Luc Giraud <jlgiraud@googlemail.com> * - * $Id: readerfactory.c 6129 2011-12-05 13:57:11Z rousseau $ + * $Id: readerfactory.c 6356 2012-06-25 13:38:46Z rousseau $ */ /** @@ -106,7 +106,7 @@ return EHInitializeEventStructures(); } -LONG RFAddReader(const char *readerName, int port, const char *library, +LONG RFAddReader(const char *readerNameLong, int port, const char *library, const char *device) { DWORD dwContext = 0, dwGetSize; @@ -114,17 +114,22 @@ LONG rv, parentNode; int i, j; int lrv = 0; + char *readerName = NULL; - if ((readerName == NULL) || (library == NULL) || (device == NULL)) + if ((readerNameLong == NULL) || (library == NULL) || (device == NULL)) return SCARD_E_INVALID_VALUE; + /* allocate memory that is automatically freed */ + readerName = alloca(strlen(readerNameLong)); + strcpy(readerName, readerNameLong); + /* Reader name too long? also count " 00 00"*/ if (strlen(readerName) > MAX_READERNAME - sizeof(" 00 00")) { Log3(PCSC_LOG_ERROR, - "Reader name too long: %zd chars instead of max %zd", + "Reader name too long: %zd chars instead of max %zd. Truncating!", strlen(readerName), MAX_READERNAME - sizeof(" 00 00")); - return SCARD_E_INVALID_VALUE; + readerName[MAX_READERNAME - sizeof(" 00 00")] = '\0'; } /* Same name, same port - duplicate reader cannot be used */ @@ -189,8 +194,6 @@ sReadersContexts[dwContext]->pFeeds = NULL; sReadersContexts[dwContext]->pMutex = NULL; sReadersContexts[dwContext]->pthCardEvent = NULL; - sReadersContexts[dwContext]->dwIdentity = - (dwContext + 1) << IDENTITY_SHIFT; lrv = list_init(&sReadersContexts[dwContext]->handlesList); if (lrv < 0) @@ -386,8 +389,6 @@ sReadersContexts[dwContextB]->contexts = 0; sReadersContexts[dwContextB]->hLockId = 0; sReadersContexts[dwContextB]->LockCount = 0; - sReadersContexts[dwContextB]->dwIdentity = - (dwContextB + 1) << IDENTITY_SHIFT; lrv = list_init(&sReadersContexts[dwContextB]->handlesList); if (lrv < 0) @@ -522,7 +523,6 @@ sContext->hLockId = 0; sContext->LockCount = 0; sContext->vHandle = NULL; - sContext->dwIdentity = 0; (void)pthread_mutex_lock(&sContext->handlesList_lock); while (list_size(&(sContext->handlesList)) != 0) @@ -700,8 +700,9 @@ tmplen = strlen(lpcStripReader); lpcStripReader[tmplen - 6] = 0; - if ((strcmp(readerName, lpcStripReader) == 0) && - (port == sReadersContexts[i]->port)) + /* Compare only the significant part of the reader name */ + if ((strncmp(readerName, lpcStripReader, MAX_READERNAME - sizeof(" 00 00")) == 0) + && (port == sReadersContexts[i]->port)) { *sReader = sReadersContexts[i]; return SCARD_S_SUCCESS; @@ -712,20 +713,24 @@ return SCARD_E_INVALID_VALUE; } -LONG RFReaderInfoById(DWORD dwIdentity, READER_CONTEXT * * sReader) +LONG RFReaderInfoById(SCARDHANDLE hCard, READER_CONTEXT * * sReader) { int i; - /* Strip off the lower nibble and get the identity */ - dwIdentity = dwIdentity >> IDENTITY_SHIFT; - dwIdentity = dwIdentity << IDENTITY_SHIFT; - for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++) { - if (dwIdentity == sReadersContexts[i]->dwIdentity) + if (sReadersContexts[i]->vHandle != 0) { - *sReader = sReadersContexts[i]; - return SCARD_S_SUCCESS; + RDR_CLIHANDLES * currentHandle; + (void)pthread_mutex_lock(&sReadersContexts[i]->handlesList_lock); + currentHandle = list_seek(&sReadersContexts[i]->handlesList, + &hCard); + (void)pthread_mutex_unlock(&sReadersContexts[i]->handlesList_lock); + if (currentHandle != NULL) + { + *sReader = sReadersContexts[i]; + return SCARD_S_SUCCESS; + } } } @@ -1011,68 +1016,27 @@ SCARDHANDLE RFCreateReaderHandle(READER_CONTEXT * rContext) { - USHORT randHandle; - - /* Create a random handle with 16 bits check to see if it already is - * used. */ - /* FIXME: THIS IS NOT STRONG ENOUGH: A 128-bit token should be - * generated. The client and server would associate token and hCard - * for authentication. */ - randHandle = SYS_RandomInt(10, 65000); - - int i; -again: - for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++) - { - if (sReadersContexts[i]->vHandle != 0) - { - RDR_CLIHANDLES *currentHandle; - list_t * l = &sReadersContexts[i]->handlesList; + SCARDHANDLE randHandle; + READER_CONTEXT *dummy_reader; + LONG ret; + + do + { + /* Create a random handle with 32 bits check to see if it already is + * used. */ + /* FIXME: THIS IS NOT STRONG ENOUGH: A 128-bit token should be + * generated. The client and server would associate token and hCard + * for authentication. */ + randHandle = SYS_RandomInt(0, -1); - (void)pthread_mutex_lock(&sReadersContexts[i]->handlesList_lock); - list_iterator_start(l); - while (list_iterator_hasnext(l)) - { - currentHandle = list_iterator_next(l); - if (((LONG)rContext->dwIdentity + randHandle) == - (currentHandle->hCard)) - { - /* Get a new handle and loop again */ - randHandle = SYS_RandomInt(10, 65000); - list_iterator_stop(l); - (void)pthread_mutex_unlock(&sReadersContexts[i]->handlesList_lock); - goto again; - } - } - list_iterator_stop(l); - (void)pthread_mutex_unlock(&sReadersContexts[i]->handlesList_lock); - } + /* do we already use this hCard somewhere? */ + ret = RFReaderInfoById(randHandle, &dummy_reader); } + while (SCARD_S_SUCCESS == ret); /* Once the for loop is completed w/o restart a good handle was * found and the loop can be exited. */ - return rContext->dwIdentity + randHandle; -} - -LONG RFFindReaderHandle(SCARDHANDLE hCard) -{ - int i; - - for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++) - { - if (sReadersContexts[i]->vHandle != 0) - { - RDR_CLIHANDLES * currentHandle; - (void)pthread_mutex_lock(&sReadersContexts[i]->handlesList_lock); - currentHandle = list_seek(&sReadersContexts[i]->handlesList, - &hCard); - (void)pthread_mutex_unlock(&sReadersContexts[i]->handlesList_lock); - if (currentHandle != NULL) - return SCARD_S_SUCCESS; - } - } - - return SCARD_E_INVALID_HANDLE; + return randHandle; } LONG RFDestroyReaderHandle(/*@unused@*/ SCARDHANDLE hCard) 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/pcsc-lite-1.8.3/src/readerfactory.h new/pcsc-lite-1.8.4/src/readerfactory.h --- old/pcsc-lite-1.8.3/src/readerfactory.h 2011-08-21 16:32:49.000000000 +0200 +++ new/pcsc-lite-1.8.4/src/readerfactory.h 2012-06-08 16:17:11.000000000 +0200 @@ -6,7 +6,7 @@ * Copyright (C) 2002-2011 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: readerfactory.h 5900 2011-08-21 13:53:33Z rousseau $ + * $Id: readerfactory.h 6321 2012-06-05 09:07:46Z rousseau $ */ /** @@ -103,7 +103,6 @@ int port; /**< Port ID */ int slot; /**< Current Reader Slot */ SCARDHANDLE hLockId; /**< Lock Id */ - DWORD dwIdentity; /**< Shared ID High Nibble */ int LockCount; /**< number of recursive locks */ int32_t contexts; /**< Number of open contexts */ int * pFeeds; /**< Number of shared client to lib */ @@ -124,7 +123,7 @@ LONG RFSetReaderName(READER_CONTEXT *, const char *, const char *, int); LONG RFReaderInfo(const char *, /*@out@*/ struct ReaderContext **); LONG RFReaderInfoNamePort(int, const char *, /*@out@*/ struct ReaderContext **); - LONG RFReaderInfoById(DWORD, /*@out@*/ struct ReaderContext **); + LONG RFReaderInfoById(SCARDHANDLE, /*@out@*/ struct ReaderContext **); LONG RFCheckSharing(SCARDHANDLE, READER_CONTEXT *); LONG RFLockSharing(SCARDHANDLE, READER_CONTEXT *); LONG RFUnlockSharing(SCARDHANDLE, READER_CONTEXT *); @@ -138,7 +137,6 @@ SCARDHANDLE RFCreateReaderHandle(READER_CONTEXT *); LONG RFDestroyReaderHandle(SCARDHANDLE hCard); LONG RFAddReaderHandle(READER_CONTEXT *, SCARDHANDLE); - LONG RFFindReaderHandle(SCARDHANDLE); LONG RFRemoveReaderHandle(READER_CONTEXT *, SCARDHANDLE); LONG RFSetReaderEventState(READER_CONTEXT *, DWORD); LONG RFCheckReaderEventState(READER_CONTEXT *, SCARDHANDLE); 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/pcsc-lite-1.8.3/src/sys_unix.c new/pcsc-lite-1.8.4/src/sys_unix.c --- old/pcsc-lite-1.8.3/src/sys_unix.c 2010-06-30 14:40:58.000000000 +0200 +++ new/pcsc-lite-1.8.4/src/sys_unix.c 2012-06-08 16:17:11.000000000 +0200 @@ -8,7 +8,7 @@ * Copyright (C) 2002-2010 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: sys_unix.c 5047 2010-06-29 14:39:24Z rousseau $ + * $Id: sys_unix.c 6319 2012-06-05 08:59:08Z rousseau $ */ /** @@ -86,7 +86,11 @@ iInitialized = 1; } - iRandNum = ((rand()+0.0)/RAND_MAX * (fEnd - fStart)) + fStart; + if (-1 == fEnd) + /* full int range */ + iRandNum = rand(); + else + iRandNum = ((rand()+0.0)/RAND_MAX * (fEnd - fStart)) + fStart; return iRandNum; } 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/pcsc-lite-1.8.3/src/tokenparser.c new/pcsc-lite-1.8.4/src/tokenparser.c --- old/pcsc-lite-1.8.3/src/tokenparser.c 2012-01-01 21:35:17.000000000 +0100 +++ new/pcsc-lite-1.8.4/src/tokenparser.c 2012-06-08 20:12:08.000000000 +0200 @@ -418,7 +418,7 @@ 4, 9, 4, 4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 1, 1, 1, 4, 4, 1, 11, 11, 11, 11, + 4, 1, 4, 4, 4, 1, 11, 11, 11, 11, 12, 11, 13, 11, 14, 11, 15, 11, 11, 16, 11, 11, 11, 17, 18, 19, 11, 11, 11, 11, @@ -510,7 +510,7 @@ * Copyright (C) 2003-2010 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: tokenparser.l 6132 2011-12-05 15:49:27Z rousseau $ + * $Id: tokenparser.l 6325 2012-06-06 11:54:48Z rousseau $ */ /** * @file 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/pcsc-lite-1.8.3/src/tokenparser.l new/pcsc-lite-1.8.4/src/tokenparser.l --- old/pcsc-lite-1.8.3/src/tokenparser.l 2011-12-15 18:53:18.000000000 +0100 +++ new/pcsc-lite-1.8.4/src/tokenparser.l 2012-06-08 16:17:11.000000000 +0200 @@ -8,7 +8,7 @@ * Copyright (C) 2003-2010 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: tokenparser.l 6132 2011-12-05 15:49:27Z rousseau $ + * $Id: tokenparser.l 6325 2012-06-06 11:54:48Z rousseau $ */ /** @@ -50,7 +50,7 @@ "\n" {} \<key\>([A-Z]|[a-z]|[0-9]|[ \t])+\<\/key\> { eval_key(yytext, ListKeys); } [ \t] {} -\<string\>([A-Z]|[a-z]|[0-9]|[ \t]|[!@#$%^&*()\-+/_\:?.,=~'";])+\<\/string\> { eval_value(yytext, ListValues); } +\<string\>([A-Z]|[a-z]|[0-9]|[ \t]|[!@#$%^&*()\-+/_\:?.,=~'";\[\]])+\<\/string\> { eval_value(yytext, ListValues); } . { tperrorCheck(yytext); } %% 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/pcsc-lite-1.8.3/src/winscard.c new/pcsc-lite-1.8.4/src/winscard.c --- old/pcsc-lite-1.8.3/src/winscard.c 2011-09-24 10:24:36.000000000 +0200 +++ new/pcsc-lite-1.8.4/src/winscard.c 2012-06-08 16:17:11.000000000 +0200 @@ -6,7 +6,7 @@ * Copyright (C) 2002-2011 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: winscard.c 5962 2011-09-24 08:24:34Z rousseau $ + * $Id: winscard.c 6322 2012-06-05 09:17:50Z rousseau $ */ /** @@ -188,7 +188,7 @@ * identified by clients and distinguished from others */ - *phContext = (PCSCLITE_SVC_IDENTITY + SYS_RandomInt(1, 65535)); + *phContext = SYS_RandomInt(0, -1); Log2(PCSC_LOG_DEBUG, "Establishing Context: 0x%lX", *phContext); @@ -528,10 +528,6 @@ if (rv != SCARD_S_SUCCESS) return rv; - rv = RFFindReaderHandle(hCard); - if (rv != SCARD_S_SUCCESS) - return rv; - /* * Make sure no one has a lock on this reader */ @@ -774,10 +770,6 @@ if (rv != SCARD_S_SUCCESS) return rv; - rv = RFFindReaderHandle(hCard); - if (rv != SCARD_S_SUCCESS) - return rv; - if ((dwDisposition != SCARD_LEAVE_CARD) && (dwDisposition != SCARD_UNPOWER_CARD) && (dwDisposition != SCARD_RESET_CARD) @@ -1030,10 +1022,6 @@ if (rv != SCARD_S_SUCCESS) return rv; - rv = RFFindReaderHandle(hCard); - if (rv != SCARD_S_SUCCESS) - return rv; - /* * Make sure some event has not occurred */ @@ -1075,10 +1063,6 @@ if (rv != SCARD_S_SUCCESS) return rv; - rv = RFFindReaderHandle(hCard); - if (rv != SCARD_S_SUCCESS) - return rv; - /* * Make sure some event has not occurred */ @@ -1283,10 +1267,6 @@ if (rv != SCARD_S_SUCCESS) return rv; - rv = RFFindReaderHandle(hCard); - if (rv != SCARD_S_SUCCESS) - return rv; - if (IFD_HVERSION_2_0 == rContext->version) { /* we must wrap a API 3.0 client in an API 2.0 driver */ @@ -1330,10 +1310,6 @@ if (rv != SCARD_S_SUCCESS) return rv; - rv = RFFindReaderHandle(hCard); - if (rv != SCARD_S_SUCCESS) - return rv; - /* * Make sure some event has not occurred */ @@ -1407,10 +1383,6 @@ if (rv != SCARD_S_SUCCESS) return rv; - rv = RFFindReaderHandle(hCard); - if (rv != SCARD_S_SUCCESS) - return rv; - /* * Make sure some event has not occurred */ @@ -1469,10 +1441,6 @@ if (rv != SCARD_S_SUCCESS) return rv; - rv = RFFindReaderHandle(hCard); - if (rv != SCARD_S_SUCCESS) - return rv; - /* * Make sure some event has not occurred */ 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/pcsc-lite-1.8.3/src/winscard_clnt.c new/pcsc-lite-1.8.4/src/winscard_clnt.c --- old/pcsc-lite-1.8.3/src/winscard_clnt.c 2011-11-19 16:10:59.000000000 +0100 +++ new/pcsc-lite-1.8.4/src/winscard_clnt.c 2012-06-26 20:49:57.000000000 +0200 @@ -12,7 +12,7 @@ * Copyright (C) 2009 * Jean-Luc Giraud <jlgiraud@googlemail.com> * - * $Id: winscard_clnt.c 6105 2011-11-14 10:19:44Z rousseau $ + * $Id: winscard_clnt.c 6362 2012-06-26 14:22:15Z rousseau $ */ /** @@ -68,12 +68,6 @@ * shared mode (like with \ref SCARD_SHARE_SHARED) and not in * exclusive mode (like with \ref SCARD_SHARE_EXCLUSIVE) as on * Windows. - * -# SCardEstablishContext() - * @par - * Each thread of an application shall use its own \ref SCARDCONTEXT. - * SCardCancel() is the only exception to the rule. On Windows the - * same \ref SCARDCONTEXT can be shared by different threads of same - * application. * -# SCardConnect() & SCardReconnect() * @par * pdwActiveProtocol is not set to \ref SCARD_PROTOCOL_UNDEFINED if @@ -954,6 +948,9 @@ if (rv == -1) return SCARD_E_INVALID_HANDLE; + /* Retry loop for blocking behaviour */ +retry: + (void)pthread_mutex_lock(currentContextMap->mMutex); /* check the handle is still valid */ @@ -965,9 +962,6 @@ * -> so the mMutex has been unlocked */ return SCARD_E_INVALID_HANDLE; - /* Retry loop for blocking behaviour */ -retry: - scReconnectStruct.hCard = hCard; scReconnectStruct.dwShareMode = dwShareMode; scReconnectStruct.dwPreferredProtocols = dwPreferredProtocols; @@ -994,6 +988,7 @@ if (sharing_shall_block && (SCARD_E_SHARING_VIOLATION == rv)) { + (void)pthread_mutex_unlock(currentContextMap->mMutex); (void)SYS_USleep(PCSCLITE_LOCK_POLL_RATE); goto retry; } @@ -1160,33 +1155,33 @@ if (rv == -1) return SCARD_E_INVALID_HANDLE; - (void)pthread_mutex_lock(currentContextMap->mMutex); - - /* check the handle is still valid */ - rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap, - &pChannelMap); - if (rv == -1) - /* the handle is now invalid - * -> another thread may have called SCardReleaseContext - * -> so the mMutex has been unlocked */ - return SCARD_E_INVALID_HANDLE; - - scBeginStruct.hCard = hCard; - scBeginStruct.rv = SCARD_S_SUCCESS; - /* * Query the server every so often until the sharing violation ends * and then hold the lock for yourself. */ - do + for(;;) { + (void)pthread_mutex_lock(currentContextMap->mMutex); + + /* check the handle is still valid */ + rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap, + &pChannelMap); + if (rv == -1) + /* the handle is now invalid + * -> another thread may have called SCardReleaseContext + * -> so the mMutex has been unlocked */ + return SCARD_E_INVALID_HANDLE; + + scBeginStruct.hCard = hCard; + scBeginStruct.rv = SCARD_S_SUCCESS; + rv = MessageSendWithHeader(SCARD_BEGIN_TRANSACTION, currentContextMap->dwClientID, sizeof(scBeginStruct), (void *) &scBeginStruct); if (rv != SCARD_S_SUCCESS) - goto end; + break; /* * Read a message from the server @@ -1195,13 +1190,18 @@ currentContextMap->dwClientID); if (rv != SCARD_S_SUCCESS) - goto end; + break; rv = scBeginStruct.rv; + + if (SCARD_E_SHARING_VIOLATION != rv) + break; + + (void)pthread_mutex_unlock(currentContextMap->mMutex); + (void)SYS_USleep(PCSCLITE_LOCK_POLL_RATE); } while (SCARD_E_SHARING_VIOLATION == rv); -end: (void)pthread_mutex_unlock(currentContextMap->mMutex); PROFILE_END(rv) @@ -1454,6 +1454,9 @@ if (rv == -1) return SCARD_E_INVALID_HANDLE; + /* Retry loop for blocking behaviour */ +retry: + (void)pthread_mutex_lock(currentContextMap->mMutex); /* check the handle is still valid */ @@ -1484,9 +1487,6 @@ goto end; } - /* Retry loop for blocking behaviour */ -retry: - /* initialise the structure */ memset(&scStatusStruct, 0, sizeof(scStatusStruct)); scStatusStruct.hCard = hCard; @@ -1510,6 +1510,7 @@ if (sharing_shall_block && (SCARD_E_SHARING_VIOLATION == rv)) { + (void)pthread_mutex_unlock(currentContextMap->mMutex); (void)SYS_USleep(PCSCLITE_LOCK_POLL_RATE); goto retry; } @@ -2719,6 +2720,9 @@ return SCARD_E_INVALID_HANDLE; } + /* Retry loop for blocking behaviour */ +retry: + (void)pthread_mutex_lock(currentContextMap->mMutex); /* check the handle is still valid */ @@ -2737,9 +2741,6 @@ goto end; } - /* Retry loop for blocking behaviour */ -retry: - scTransmitStruct.hCard = hCard; scTransmitStruct.cbSendLength = cbSendLength; scTransmitStruct.pcbRecvLength = *pcbRecvLength; @@ -2800,6 +2801,7 @@ if (sharing_shall_block && (SCARD_E_SHARING_VIOLATION == rv)) { + (void)pthread_mutex_unlock(currentContextMap->mMutex); (void)SYS_USleep(PCSCLITE_LOCK_POLL_RATE); goto retry; } -- 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