Hello community,
here is the log from the commit of package pcsc-lite for openSUSE:Factory checked in at 2016-06-02 12:39:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/pcsc-lite (Old)
and /work/SRC/openSUSE:Factory/.pcsc-lite.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pcsc-lite"
Changes:
--------
--- /work/SRC/openSUSE:Factory/pcsc-lite/pcsc-lite.changes 2016-03-26 15:20:49.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.pcsc-lite.new/pcsc-lite.changes 2016-06-02 12:39:05.000000000 +0200
@@ -1,0 +2,9 @@
+Mon May 30 06:34:15 UTC 2016 - wr@rosenauer.org
+
+- Updated to version 1.8.17
+ * Fix SCardEndTransaction() issue with a SCARD_SHARE_EXCLUSIVE connection
+ * Fix an issue when used with systemd (problem in signal handler)
+ * SCardGetAttrib(): set pcbAttrLen when buffer is too small
+ * Some other minor improvements
+
+-------------------------------------------------------------------
Old:
----
pcsc-lite-1.8.16.tar.bz2
pcsc-lite-1.8.16.tar.bz2.asc
New:
----
pcsc-lite-1.8.17.tar.bz2
pcsc-lite-1.8.17.tar.bz2.asc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ pcsc-lite.spec ++++++
--- /var/tmp/diff_new_pack.OVD09S/_old 2016-06-02 12:39:06.000000000 +0200
+++ /var/tmp/diff_new_pack.OVD09S/_new 2016-06-02 12:39:06.000000000 +0200
@@ -21,7 +21,7 @@
%define USER scard
%define GROUP scard
Name: pcsc-lite
-Version: 1.8.16
+Version: 1.8.17
Release: 0
Summary: PCSC Smart Cards Library
License: BSD-3-Clause
++++++ pcsc-lite-1.8.16.tar.bz2 -> pcsc-lite-1.8.17.tar.bz2 ++++++
++++ 2471 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.16/ChangeLog new/pcsc-lite-1.8.17/ChangeLog
--- old/pcsc-lite-1.8.16/ChangeLog 2016-03-20 16:52:25.000000000 +0100
+++ new/pcsc-lite-1.8.17/ChangeLog 2016-05-29 14:14:24.000000000 +0200
@@ -1,3 +1,14 @@
+1.8.17: Ludovic Rousseau
+29 May 2016
+- Fix SCardEndTransaction() issue with a SCARD_SHARE_EXCLUSIVE connection
+- Fix an issue when used with systemd (problem in signal handler)
+- SCardGetAttrib(): set pcbAttrLen when buffer is too small
+- Doxygen: SCardGetAttrib() pbAttr can be NULL
+- Doxygen: SCardGetAttrib() *pcbAttrLen contains the buffer size
+- fix compilation warnings and link errors on SunOS
+- Some other minor improvements
+
+
1.8.16: Ludovic Rousseau
20 March 2016
- SCardCancel() was not correctly handled
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.16/ChangeLog.git new/pcsc-lite-1.8.17/ChangeLog.git
--- old/pcsc-lite-1.8.16/ChangeLog.git 2016-03-20 17:25:18.000000000 +0100
+++ new/pcsc-lite-1.8.17/ChangeLog.git 2016-05-29 14:15:18.000000000 +0200
@@ -1,4 +1,385 @@
-commit 55fa57fc691b732535fc3384a214b1daa133a127 (HEAD -> master, tag: pcsc-1.8.16, origin/master, origin/HEAD, github/master)
+commit f74dc1feea4c7a2345abb3e1861b350d46946c86 (HEAD -> master, tag: pcsc-1.8.17, origin/master, origin/HEAD)
+Author: Ludovic Rousseau
+Date: Sun May 29 14:11:21 2016 +0200
+
+ Release 1.8.17
+
+ ChangeLog | 11 +++++++++++
+ configure.ac | 2 +-
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+commit 0ba8145d814b846f2f2c2c59ad82e34f1253159a
+Author: Ludovic Rousseau
+Date: Fri May 27 18:57:19 2016 +0200
+
+ Doxygen: improve SCardGetStatusChange example
+
+ Show how to wait for a card insertion.
+
+ src/winscard_clnt.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+commit 687128ad9a377a27bd93e542fc096530534dc101
+Author: Richard PALO
+Date: Sat Apr 23 18:13:37 2016 +0200
+
+ Fix SunOS compilation error
+
+ Avoid visibility issues on SunOS on either gcc or studio
+ by using a guard stipulating minimum versions for each compiler
+ needed to support __attribute__((visibility("hidden")) or equivalent
+
+ src/misc.h | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+commit 9be0451909b73a4f52e42c01915683954d7d0a84
+Author: Ludovic Rousseau
+Date: Sat May 7 11:54:14 2016 +0200
+
+ Fix end of function comment
+
+ src/debuglog.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit f3a6ccac63abd4d7d0e4eeced059128919286bab
+Author: Ludovic Rousseau
+Date: Fri May 20 17:07:03 2016 +0200
+
+ Unit Test for 74656f24
+
+ SCardEndTransaction(): no card action in a transaction
+
+ UnitaryTests/SCardBeginTransaction_Reset.py | 85 +++++++++++++++++++++++++++++
+ 1 file changed, 85 insertions(+)
+
+commit 74656f24db3da1532040a1775ceffa225fbc3d00
+Author: Ludovic Rousseau
+Date: Fri May 20 17:02:40 2016 +0200
+
+ SCardEndTransaction(): no card action in a transaction
+
+ If a transaction is ongoing then another SCardEndTransaction() should
+ not reset or unpower the card.
+ In that case SCARD_E_SHARING_VIOLATION is returned and the transaction
+ is not ended.
+
+ src/winscard.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+commit b7a4f8f47c1c57b56dfe6cd1088f68b845016d9b
+Author: Ludovic Rousseau
+Date: Fri May 20 16:19:56 2016 +0200
+
+ RFUnlockSharing: handle SCARD_SHARE_EXCLUSIVE
+
+ When a card is connected using SCARD_SHARE_EXCLUSIVE then
+ RFUnlockSharing() called by SCardEndTransaction() should not be able to
+ remove the exclusive access.
+
+ The bug was detected because the following sequence worked but should
+ not:
+ SCardConnect(..., SCARD_SHARE_EXCLUSIVE, ...);
+ SCardEndTransaction();
+
+ An error was reported only on the second SCardEndTransaction() call.
+
+ Now the first call to SCardEndTransaction() will fail and the card
+ connection will stay exclusive.
+
+ Thanks to Christophe Ferrando for the bug report in "[Pcsclite-muscle]
+ SCARD_E_NOT_TRANSACTED"
+ http://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-2016051...
+
+ src/readerfactory.c | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+commit 88b2085b9c60c7a99aa1306187ad77ce1670a8eb
+Author: Ludovic Rousseau
+Date: Fri May 20 15:39:20 2016 +0200
+
+ SCardGetAttrib.py: display the values in ASCII
+
+ Display the attributes values also in ASCII.
+
+ The output is now something like:
+ PC/SC Readers: ['Gemalto PC Twin Reader (70D7E2EE) 00 00']
+ reader: Gemalto PC Twin Reader (70D7E2EE) 00 00
+ 0x10103 [55, 48, 68, 55, 69, 50, 69, 69, 0] 37 30 44 37 45 32 45 45 00
+ 70D7E2EE
+ 0x90303 [59, 167, 0, 64, 24, 128, 101, 162, 8, 1, 1, 82] 3B A7 00 40 18
+ 80 65 A2 08 01 01 52 ;�@�eR
+
+ UnitaryTests/SCardGetAttrib.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit b1effd21528d27dfa016c2752cf3e4cb973240f4
+Author: Ludovic Rousseau
+Date: Fri Apr 22 15:45:01 2016 +0200
+
+ pcscd.h.in: remove extra spaces
+
+ src/pcscd.h.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 77740786d5450273fad1400322918f5a276b3131
+Author: Ludovic Rousseau
+Date: Mon Apr 25 11:31:44 2016 +0200
+
+ SCardGetAttrib.py: also use SCARD_ATTR_ATR_STRING
+
+ Try to use both attributes SCARD_ATTR_VENDOR_IFD_SERIAL_NO and
+ SCARD_ATTR_ATR_STRING
+
+ Not all devices have a serial number so SCARD_ATTR_VENDOR_IFD_SERIAL_NO
+ may just return an empty buffer.
+
+ SCARD_ATTR_ATR_STRING should always work when a card is inserted (and
+ the CCID driver is used).
+
+ UnitaryTests/SCardGetAttrib.py | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+commit fa52ae4e1f1ae3c35596e9aedaa3ce30fc5ceef9
+Author: Ludovic Rousseau
+Date: Sun Apr 24 19:04:04 2016 +0200
+
+ Fix use of d_type field on SunOS
+
+ SunOS does not provide the d_type field in a directory entry.
+
+ The code now checks that d_type is available using
+ AC_STRUCT_DIRENT_D_TYPE and use it conditionnaly.
+
+ Fix compilation error on SunOS:
+ configfile.l: In function 'DBGetReaderListDir':
+ configfile.l:293:16: error: 'struct dirent' has no member named 'd_type'
+ if (direntry->d_type == DT_UNKNOWN)
+ ^
+ configfile.l:293:28: error: 'DT_UNKNOWN' undeclared (first use in this function)
+ if (direntry->d_type == DT_UNKNOWN)
+ ^
+ configfile.l:293:28: note: each undeclared identifier is reported only once for each function it appears in
+ configfile.l:312:17: error: 'struct dirent' has no member named 'd_type'
+ if (direntry->d_type != DT_REG)
+ ^
+ configfile.l:312:29: error: 'DT_REG' undeclared (first use in this function)
+ if (direntry->d_type != DT_REG)
+ ^
+
+ Thanks to risto3 for the bug report
+ https://github.com/LudovicRousseau/PCSC/issues/6
+
+ configure.ac | 1 +
+ src/configfile.l | 4 ++++
+ 2 files changed, 5 insertions(+)
+
+commit 88acbfa03b98f28567c2438ea7aca6447488c0af
+Author: Ludovic Rousseau
+Date: Sun Apr 24 18:55:45 2016 +0200
+
+ Fix compiler warnings on SunOS
+
+ utils.c: In function 'SendHotplugSignal':
+ utils.c:97:3: warning: format '%d' expects argument of type 'int', but argument 6 has type 'pid_t' [-Wformat=]
+ Log2(PCSC_LOG_INFO, "Send hotplug signal to pcscd (pid=%d)", pid);
+ ^
+ utils.c:100:4: warning: format '%d' expects argument of type 'int', but argument 6 has type 'pid_t' [-Wformat=]
+ Log3(PCSC_LOG_CRITICAL, "Can't signal pcscd (pid=%d): %s",
+ ^
+
+ src/utils.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+commit 2360debebf1c35c8599cd2e0fc484e5f5029ab87
+Author: Ludovic Rousseau
+Date: Sun Apr 24 18:52:45 2016 +0200
+
+ Fix compiler warning on SunOS
+
+ pcscdaemon.c: In function 'main':
+ pcscdaemon.c:402:5: warning: format '%d' expects argument of type 'int', but argument 6 has type 'pid_t' [-Wformat=]
+ Log2(PCSC_LOG_CRITICAL,
+ ^
+
+ src/pcscdaemon.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit abe436e38aa58cb1140eff0d497ba721474c7703
+Author: Ludovic Rousseau
+Date: Sun Apr 24 18:46:53 2016 +0200
+
+ Fix signal handler by using only allowed functions
+
+ The signals are now treated in a special thread created just for that purpose.
+
+ Thanks to Andre Florath for the bug report
+ https://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-201604...
+
+ [Pcsclite-muscle] pcscd jams when using '--auto-exit'
+
+ Andre Florath andre at florath.net
+ Sat Apr 9 06:06:44 UTC 2016
+
+ Hello!
+
+ Since some time I have problems with pcscd. I'm using pcscd in
+ conjunction with online banking and after a short period of working it
+ stops and jams the banking application.
+
+ A 'strace' to the pcscd showed that it is still running somewhere
+ deep in the USB stack.
+
+ The problem is, when manually running the the pcscd, there is no
+ problem at all - only when running from systemd.
+ Therefore I searched for the differences and found one: the
+ '--auto-exit'. Downloaded the source and had a closer look.
+
+ What I understand from the source code is, that when '--auto-exit' is
+ given, a SIGALRM is generated which (should) terminate the process.
+
+ I have noticed that the signal handler 'signal_trap()' uses some
+ function calls that are not allowed in signal handlers; like:
+ * syslog()
+ * gettimeofday()
+ * remove()
+
+ Using this creates undefined behavior.
+ (Please see 'man 7 signal' for a complete list of system calls that
+ are not allowed in signal handlers.)
+
+ I found a workaround for the issue.
+ Changed the service file to:
+
+ ===
+ [Unit]
+ Description=PC/SC Smart Card Daemon
+
+ [Service]
+ ExecStart=/usr/sbin/pcscd --foreground --debug -a
+ ExecReload=/usr/sbin/pcscd --hotplug
+
+ [Install]
+ Also=pcscd.socket
+ ===
+
+ and disabling the pcscd.socket gives me a stable system.
+ (Yes - pcscd is now started at boot time and runs the whole time
+ - which is fine for me.)
+
+ If you need more information, please drop me a note.
+
+ Kind regards
+
+ Andre
+
+ src/pcscdaemon.c | 170 ++++++++++++++++++++++++++++++++++++-------------------
+ 1 file changed, 111 insertions(+), 59 deletions(-)
+
+commit b48ff146f979cd3323845e1c19d1c1629d2ae037
+Author: Ludovic Rousseau
+Date: Sun Apr 24 18:25:03 2016 +0200
+
+ Check alloca(3) is available
+
+ The code uses alloca(3) so we check in ./configure that this function is
+ available.
+
+ configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 890f7edbd931467fd381739257ac1e1f335eb64a
+Author: Ludovic Rousseau
+Date: Sat Apr 23 15:57:46 2016 +0200
+
+ readerfactory: fix compilation warning on SunOS
+
+ The code uses alloca() so we #include "alloca.h"
+
+ readerfactory.c: In function 'RFAddReader':
+ readerfactory.c:211:2: warning: implicit declaration of function 'alloca' [-Wimplicit-function-declaration]
+ readerName = alloca(strlen(readerNameLong)+1);
+ ^
+ readerfactory.c:211:15: warning: incompatible implicit declaration of built-in function 'alloca'
+ readerName = alloca(strlen(readerNameLong)+1);
+ ^
+
+ src/readerfactory.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 2269f10c2d2c5be1308d59469722024650a19b6d
+Author: Ludovic Rousseau
+Date: Wed Apr 13 18:29:53 2016 +0200
+
+ SCardConnect(): fix a Valgrind warning
+
+ ==19635== Memcheck, a memory error detector
+ ==19635== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
+ ==19635== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
+ ==19635== Command: /usr/rtests/bin/Pkcs11UnitTest.X64 pkcs11_common
+ ==19635==
+ Running pkcs11_common
+ pkcs11_common::testGetInfo==19635== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
+ ==19635== at 0x605A1F7: send (send.c:32)
+ ==19635== by 0xBC47CE6: ??? (in /lib/x86_64-linux-gnu/libpcsclite.so.1.0.0)
+ ==19635== by 0xBC47E22: ??? (in /lib/x86_64-linux-gnu/libpcsclite.so.1.0.0)
+ ==19635== by 0xBC43BBE: SCardConnect (in /lib/x86_64-linux-gnu/libpcsclite.so.1.0.0)
+ ...
+
+ The field scConnectStruct.szReader (containing the reader name) was not
+ completely initialized.
+
+ Thanks to Andrey Roussev for the patch
+ https://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-201604...
+
+ src/winscard_clnt.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit d6c7215335fe04abfd91206349c7d674de7bfcaa
+Author: Ludovic Rousseau
+Date: Thu Mar 31 16:43:16 2016 +0200
+
+ Doxygen: SCardGetAttrib() *pcbAttrLen contains the buffer size
+
+ On return *pcbAttrLen contains the actual length of the received
+ attribute.
+
+ If the buffer was not big enough the error SCARD_E_INSUFFICIENT_BUFFER
+ is returned and *pcbAttrLen contains the expected size.
+
+ src/winscard_clnt.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit e64629f80a4639836399493ef5c3c717571ffc96
+Author: Ludovic Rousseau
+Date: Thu Mar 31 16:11:44 2016 +0200
+
+ SCardGetAttrib(): set pcbAttrLen when buffer is too small
+
+ When the user provides a pbAttr[] buffer too small then the error code
+ SCARD_E_INSUFFICIENT_BUFFER is returned and the correct buffer size
+ value is set in pcbAttrLen.
+
+ Before the change the value of pcbAttrLen was not changed so the user
+ had no idea what the correct value should be.
+
+ src/winscard_clnt.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+commit 84a9441d52e72e1fbec6aa2b0dd6db27d3f5ce38
+Author: Ludovic Rousseau
+Date: Thu Mar 31 11:42:39 2016 +0200
+
+ Doxygen: SCardGetAttrib() pbAttr can be NULL
+
+ If pbAttr is NULL then the correct buffer size is indicated in
+ pcbAttrLen.
+
+ Also modify the example to use the double call.
+
+ src/winscard_clnt.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+commit 55fa57fc691b732535fc3384a214b1daa133a127 (tag: pcsc-1.8.16, github/master)
Author: Ludovic Rousseau
Date: Sun Mar 20 16:57:30 2016 +0100
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.16/config.h.in new/pcsc-lite-1.8.17/config.h.in
--- old/pcsc-lite-1.8.16/config.h.in 2016-03-20 16:19:57.000000000 +0100
+++ new/pcsc-lite-1.8.17/config.h.in 2016-05-29 14:14:55.000000000 +0200
@@ -6,12 +6,31 @@
/* display ATR parsing debug messages. */
#undef ATR_DEBUG
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
/* Filter reader names */
#undef FILTER_NAMES
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have and it should be used (not on Ultrix).
+ */
+#undef HAVE_ALLOCA_H
+
/* Define to 1 if you have the `daemon' function. */
#undef HAVE_DAEMON
+/* Define to 1 if you have the header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
+
/* Define to 1 if you have the header file. */
#undef HAVE_DLFCN_H
@@ -54,6 +73,9 @@
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP
+/* Define to 1 if you have the header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
/* Build polkit access control support */
#undef HAVE_POLKIT
@@ -85,12 +107,23 @@
/* Define to 1 if you have the header file. */
#undef HAVE_STRING_H
+/* Define to 1 if `d_type' is a member of `struct dirent'. */
+#undef HAVE_STRUCT_DIRENT_D_TYPE
+
/* Define to 1 if you have the header file. */
#undef HAVE_SYSLOG_H
+/* Define to 1 if you have the header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_DIR_H
+
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_FILIO_H
+/* Define to 1 if you have the header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_NDIR_H
+
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_STAT_H
@@ -156,6 +189,14 @@
your system. */
#undef PTHREAD_CREATE_JOINABLE
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
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.16/configure.ac new/pcsc-lite-1.8.17/configure.ac
--- old/pcsc-lite-1.8.16/configure.ac 2016-03-20 16:52:25.000000000 +0100
+++ new/pcsc-lite-1.8.17/configure.ac 2016-05-29 14:14:24.000000000 +0200
@@ -3,7 +3,7 @@
AC_PREREQ([2.69])
-AC_INIT([pcsc-lite],[1.8.16])
+AC_INIT([pcsc-lite],[1.8.17])
AC_CONFIG_SRCDIR(src/pcscdaemon.c)
AM_INIT_AUTOMAKE(1.8 dist-bzip2 no-dist-gzip)
AC_CONFIG_HEADERS([config.h])
@@ -101,12 +101,14 @@
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
+AC_STRUCT_DIRENT_D_TYPE
# Checks for library functions
AC_FUNC_ERROR_AT_LINE
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(daemon flock getopt_long nanosleep strerror vsnprintf)
+AC_FUNC_ALLOCA
# C Compiler features
AC_C_INLINE
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.16/src/PCSC/pcsclite.h new/pcsc-lite-1.8.17/src/PCSC/pcsclite.h
--- old/pcsc-lite-1.8.16/src/PCSC/pcsclite.h 2016-03-20 16:41:26.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/PCSC/pcsclite.h 2016-05-29 14:15:09.000000000 +0200
@@ -279,7 +279,7 @@
#define INFINITE 0xFFFFFFFF /**< Infinite timeout */
#endif
-#define PCSCLITE_VERSION_NUMBER "1.8.16" /**< Current version */
+#define PCSCLITE_VERSION_NUMBER "1.8.17" /**< Current version */
/** Maximum readers context (a slot is count as a reader) */
#define PCSCLITE_MAX_READERS_CONTEXTS 16
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.16/src/configfile.c new/pcsc-lite-1.8.17/src/configfile.c
--- old/pcsc-lite-1.8.16/src/configfile.c 2015-11-18 16:50:24.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/configfile.c 2016-05-29 14:16:07.000000000 +0200
@@ -7,8 +7,8 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 39
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 0
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -210,7 +210,7 @@
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
- yy_size_t yy_n_chars;
+ int yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
@@ -280,7 +280,7 @@
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
-static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
yy_size_t yyleng;
/* Points to current character in buffer. */
@@ -341,7 +341,7 @@
/* Begin user sect3 */
-#define yywrap() 1
+#define yywrap() (/*CONSTCOND*/1)
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
@@ -355,11 +355,17 @@
int yylineno = 1;
extern char *yytext;
+#ifdef yytext_ptr
+#undef yytext_ptr
+#endif
#define yytext_ptr yytext
static yy_state_type yy_get_previous_state (void );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
static int yy_get_next_buffer (void );
+#if defined(__GNUC__) && __GNUC__ >= 3
+__attribute__((__noreturn__))
+#endif
static void yy_fatal_error (yyconst char msg[] );
/* Done after the current pattern has been matched and before the
@@ -387,7 +393,7 @@
0, 3, 1, 0, 5, 0
} ;
-static yyconst flex_int32_t yy_ec[256] =
+static yyconst YY_CHAR yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -419,12 +425,12 @@
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[11] =
+static yyconst YY_CHAR yy_meta[11] =
{ 0,
1, 1, 2, 1, 1, 1, 1, 1, 1, 1
} ;
-static yyconst flex_int16_t yy_base[20] =
+static yyconst flex_uint16_t yy_base[20] =
{ 0,
0, 0, 15, 31, 31, 31, 8, 0, 10, 10,
18, 31, 0, 20, 0, 31, 26, 13, 28
@@ -436,7 +442,7 @@
17, 16, 18, 19, 10, 0, 16, 16, 16
} ;
-static yyconst flex_int16_t yy_nxt[42] =
+static yyconst flex_uint16_t yy_nxt[42] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 10, 10, 10,
12, 12, 12, 13, 16, 12, 15, 15, 15, 15,
@@ -531,7 +537,7 @@
void tok_error(char *pcToken_error);
#define YY_NO_INPUT 1
-#line 535 "configfile.c"
+#line 541 "configfile.c"
#define INITIAL 0
@@ -564,11 +570,11 @@
FILE *yyget_in (void );
-void yyset_in (FILE * in_str );
+void yyset_in (FILE * _in_str );
FILE *yyget_out (void );
-void yyset_out (FILE * out_str );
+void yyset_out (FILE * _out_str );
yy_size_t yyget_leng (void );
@@ -576,7 +582,7 @@
int yyget_lineno (void );
-void yyset_lineno (int line_number );
+void yyset_lineno (int _line_number );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -590,6 +596,10 @@
#endif
#endif
+#ifndef YY_NO_UNPUT
+
+#endif
+
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
@@ -702,7 +712,7 @@
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
-#define YY_BREAK break;
+#define YY_BREAK /*LINTED*/break;
#endif
#define YY_RULE_SETUP \
@@ -712,9 +722,9 @@
*/
YY_DECL
{
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
if ( !(yy_init) )
{
@@ -746,9 +756,9 @@
#line 69 "configfile.l"
-#line 750 "configfile.c"
+#line 760 "configfile.c"
- while ( 1 ) /* loops until end-of-file is reached */
+ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
yy_cp = (yy_c_buf_p);
@@ -764,7 +774,7 @@
yy_match:
do
{
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@@ -840,7 +850,7 @@
#line 77 "configfile.l"
ECHO;
YY_BREAK
-#line 844 "configfile.c"
+#line 854 "configfile.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -983,9 +993,9 @@
*/
static int yy_get_next_buffer (void)
{
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = (yytext_ptr);
- register int number_to_move, i;
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = (yytext_ptr);
+ yy_size_t number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
@@ -1014,7 +1024,7 @@
/* Try to read more data. */
/* First move last chars to start of buffer. */
- number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+ number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
@@ -1096,9 +1106,9 @@
else
ret_val = EOB_ACT_CONTINUE_SCAN;
- if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
@@ -1117,14 +1127,14 @@
static yy_state_type yy_get_previous_state (void)
{
- register yy_state_type yy_current_state;
- register char *yy_cp;
+ yy_state_type yy_current_state;
+ char *yy_cp;
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@@ -1149,10 +1159,10 @@
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
- register int yy_is_jam;
- register char *yy_cp = (yy_c_buf_p);
+ int yy_is_jam;
+ char *yy_cp = (yy_c_buf_p);
- register YY_CHAR yy_c = 1;
+ YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@@ -1170,6 +1180,10 @@
return yy_is_jam ? 0 : yy_current_state;
}
+#ifndef YY_NO_UNPUT
+
+#endif
+
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (void)
@@ -1319,7 +1333,7 @@
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
- b->yy_buf_size = size;
+ b->yy_buf_size = (yy_size_t)size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
@@ -1474,7 +1488,7 @@
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
- num_to_alloc = 1;
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
@@ -1491,7 +1505,7 @@
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
/* Increase the buffer to prepare for a possible push. */
- int grow_size = 8 /* arbitrary grow size */;
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
num_to_alloc = (yy_buffer_stack_max) + grow_size;
(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
@@ -1599,7 +1613,7 @@
static void yy_fatal_error (yyconst char* msg )
{
- (void) fprintf( stderr, "%s\n", msg );
+ (void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
@@ -1665,29 +1679,29 @@
}
/** Set the current line number.
- * @param line_number
+ * @param _line_number line number
*
*/
-void yyset_lineno (int line_number )
+void yyset_lineno (int _line_number )
{
- yylineno = line_number;
+ yylineno = _line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
- * @param in_str A readable stream.
+ * @param _in_str A readable stream.
*
* @see yy_switch_to_buffer
*/
-void yyset_in (FILE * in_str )
+void yyset_in (FILE * _in_str )
{
- yyin = in_str ;
+ yyin = _in_str ;
}
-void yyset_out (FILE * out_str )
+void yyset_out (FILE * _out_str )
{
- yyout = out_str ;
+ yyout = _out_str ;
}
int yyget_debug (void)
@@ -1695,9 +1709,9 @@
return yy_flex_debug;
}
-void yyset_debug (int bdebug )
+void yyset_debug (int _bdebug )
{
- yy_flex_debug = bdebug ;
+ yy_flex_debug = _bdebug ;
}
static int yy_init_globals (void)
@@ -1757,7 +1771,8 @@
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
- register int i;
+
+ int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
@@ -1766,7 +1781,7 @@
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
- register int n;
+ int n;
for ( n = 0; s[n]; ++n )
;
@@ -1776,11 +1791,12 @@
void *yyalloc (yy_size_t size )
{
- return (void *) malloc( size );
+ return (void *) malloc( size );
}
void *yyrealloc (void * ptr, yy_size_t size )
{
+
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
@@ -1793,12 +1809,12 @@
void yyfree (void * ptr )
{
- free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
-#line 76 "configfile.l"
+#line 77 "configfile.l"
@@ -2016,7 +2032,9 @@
readerconf_dir, direntry->d_name);
/* skip non regular files */
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
if (direntry->d_type == DT_UNKNOWN)
+#endif
{
struct stat st;
@@ -2035,7 +2053,9 @@
}
}
else
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
if (direntry->d_type != DT_REG)
+#endif
{
Log2(PCSC_LOG_DEBUG, "Skipping non regular file: %s",
direntry->d_name);
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.16/src/configfile.l new/pcsc-lite-1.8.17/src/configfile.l
--- old/pcsc-lite-1.8.16/src/configfile.l 2015-11-06 09:39:51.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/configfile.l 2016-05-06 13:16:10.000000000 +0200
@@ -290,7 +290,9 @@
readerconf_dir, direntry->d_name);
/* skip non regular files */
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
if (direntry->d_type == DT_UNKNOWN)
+#endif
{
struct stat st;
@@ -309,7 +311,9 @@
}
}
else
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
if (direntry->d_type != DT_REG)
+#endif
{
Log2(PCSC_LOG_DEBUG, "Skipping non regular file: %s",
direntry->d_name);
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.16/src/debuglog.c new/pcsc-lite-1.8.17/src/debuglog.c
--- old/pcsc-lite-1.8.16/src/debuglog.c 2015-11-06 09:39:51.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/debuglog.c 2016-05-20 19:44:43.000000000 +0200
@@ -192,7 +192,7 @@
}
fflush(stdout);
}
-} /* log_msg */
+} /* log_line */
static void log_xxd_always(const int priority, const char *msg,
const unsigned char *buffer, const int len)
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.16/src/misc.h new/pcsc-lite-1.8.17/src/misc.h
--- old/pcsc-lite-1.8.16/src/misc.h 2015-11-06 09:39:51.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/misc.h 2016-05-29 14:14:24.000000000 +0200
@@ -40,10 +40,12 @@
* see http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/Function-Attributes.html#Functio...
* see http://www.nedprod.com/programs/gccvisibility.html
*/
-#if defined __GNUC__ && (! defined (__sun)) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
+#if defined(__GNUC__) && \
+ (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) || \
+ defined(__SUNPRO_C) && __SUNPRO_C >= 0x590
#define INTERNAL __attribute__ ((visibility("hidden")))
#define PCSC_API __attribute__ ((visibility("default")))
-#elif (! defined __GNUC__ ) && defined (__sun)
+#elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x550
/* http://wikis.sun.com/display/SunStudio/Macros+for+Shared+Library+Symbol+Visi... */
#define INTERNAL __hidden
#define PCSC_API __global
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.16/src/pcscd.h new/pcsc-lite-1.8.17/src/pcscd.h
--- old/pcsc-lite-1.8.16/src/pcscd.h 2016-03-20 16:41:26.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/pcscd.h 2016-05-29 14:15:09.000000000 +0200
@@ -7,7 +7,7 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@@ -15,7 +15,7 @@
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -49,7 +49,7 @@
#define PCSCLITE_CSOCK_NAME PCSCLITE_IPC_DIR "/pcscd.comm"
-#define PCSCLITE_VERSION_NUMBER "1.8.16" /**< Current version */
+#define PCSCLITE_VERSION_NUMBER "1.8.17" /**< 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.16/src/pcscd.h.in new/pcsc-lite-1.8.17/src/pcscd.h.in
--- old/pcsc-lite-1.8.16/src/pcscd.h.in 2016-03-12 20:03:09.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/pcscd.h.in 2016-05-20 19:44:43.000000000 +0200
@@ -7,7 +7,7 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@@ -15,7 +15,7 @@
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
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.16/src/pcscdaemon.c new/pcsc-lite-1.8.17/src/pcscdaemon.c
--- old/pcsc-lite-1.8.16/src/pcscdaemon.c 2016-03-12 20:03:09.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/pcscdaemon.c 2016-05-06 13:16:10.000000000 +0200
@@ -81,6 +81,7 @@
static int ExitValue = EXIT_FAILURE;
int HPForceReaderPolling = 0;
static int pipefd[] = {-1, -1};
+static int signal_handler_fd[] = {-1, -1};
char Add_Serial_In_Name = TRUE;
char Add_Interface_In_Name = TRUE;
@@ -89,7 +90,6 @@
*/
static void at_exit(void);
static void clean_temp_files(void);
-static void signal_reload(int sig);
static void signal_trap(int);
static void print_version (void);
static void print_usage (char const * const);
@@ -152,6 +152,10 @@
/* Nothing to do in case of a syscall interrupted
* It happens when SIGUSR1 (reload) or SIGINT (Ctrl-C) is received
* We just try again */
+
+ /* we wait a bit so that the signal handler thread can do
+ * its job and set AraKiri if needed */
+ SYS_USleep(1000);
break;
default:
@@ -162,6 +166,93 @@
}
}
+/**
+ * thread dedicated to handle signals
+ *
+ * a signal handler can not call any function. See signal(7) for a list
+ * of function that are safe to call from a signal handler.
+ * The functions syslog(), gettimeofday() and remove() are NOT safe.
+ */
+static void *signal_thread(void *arg)
+{
+ (void)arg;
+
+ while (TRUE)
+ {
+ int r;
+ int sig;
+
+ r = read(signal_handler_fd[0], &sig, sizeof sig);
+ if (r < 0)
+ {
+ Log2(PCSC_LOG_ERROR, "read failed: %s", strerror(errno));
+ return NULL;
+ }
+
+ Log2(PCSC_LOG_INFO, "Received signal: %d", sig);
+
+ /* signal for hotplug */
+ if (SIGUSR1 == sig)
+ {
+#ifdef USE_USB
+ if (! AraKiri)
+ HPReCheckSerialReaders();
+#endif
+ /* Reenable the signal handler.
+ * This is needed on Solaris and HPUX. */
+ (void)signal(SIGUSR1, signal_trap);
+
+ continue;
+ }
+
+ /* do not wait if asked to terminate
+ * avoids waiting after the reader(s) in shutdown for example */
+ if (SIGTERM == sig)
+ {
+ Log1(PCSC_LOG_INFO, "Direct suicide");
+ at_exit();
+ }
+
+ if (SIGALRM == sig)
+ {
+ /* normal exit without error */
+ ExitValue = EXIT_SUCCESS;
+ }
+
+ /* the signal handler is called several times for the same Ctrl-C */
+ if (AraKiri == FALSE)
+ {
+ Log1(PCSC_LOG_INFO, "Preparing for suicide");
+ AraKiri = TRUE;
+
+ /* if still in the init/loading phase the AraKiri will not be
+ * seen by the main event loop
+ */
+ if (Init)
+ {
+ Log1(PCSC_LOG_INFO, "Suicide during init");
+ at_exit();
+ }
+ }
+ else
+ {
+ /* if pcscd do not want to die */
+ static int lives = 2;
+
+ lives--;
+ /* no live left. Something is blocking the normal death. */
+ if (0 == lives)
+ {
+ Log1(PCSC_LOG_INFO, "Forced suicide");
+ at_exit();
+ }
+ }
+ }
+
+ return NULL;
+}
+
+
int main(int argc, char **argv)
{
int rv;
@@ -400,7 +491,7 @@
Log1(PCSC_LOG_CRITICAL,
"file " PCSCLITE_CSOCK_NAME " already exists.");
Log2(PCSC_LOG_CRITICAL,
- "Another pcscd (pid: %d) seems to be running.", pid);
+ "Another pcscd (pid: %ld) seems to be running.", (long)pid);
return EXIT_FAILURE;
}
else
@@ -515,6 +606,20 @@
/* exits on SIGALARM to allow pcscd to suicide if not used */
(void)signal(SIGALRM, signal_trap);
+ if (pipe(signal_handler_fd) == -1)
+ {
+ Log2(PCSC_LOG_CRITICAL, "pipe() failed: %s", strerror(errno));
+ return EXIT_FAILURE;
+ }
+
+ pthread_t signal_handler_thread;
+ rv = pthread_create(&signal_handler_thread, NULL, signal_thread, NULL);
+ if (rv)
+ {
+ Log2(PCSC_LOG_CRITICAL, "pthread_create failed: %s", strerror(rv));
+ return EXIT_FAILURE;
+ }
+
/*
* If PCSCLITE_IPC_DIR does not exist then create it
*/
@@ -610,7 +715,7 @@
/*
* Hotplug rescan
*/
- (void)signal(SIGUSR1, signal_reload);
+ (void)signal(SIGUSR1, signal_trap);
/*
* Initialize the comm structure
@@ -730,66 +835,13 @@
strerror(errno));
}
-static void signal_reload(/*@unused@*/ int sig)
-{
- (void)signal(SIGUSR1, signal_reload);
-
- (void)sig;
-
- if (AraKiri)
- return;
-
-#ifdef USE_USB
- HPReCheckSerialReaders();
-#endif
-} /* signal_reload */
-
static void signal_trap(int sig)
{
- Log2(PCSC_LOG_INFO, "Received signal: %d", sig);
-
- /* do not wait if asked to terminate
- * avoids waiting after the reader(s) in shutdown for example */
- if (SIGTERM == sig)
- {
- Log1(PCSC_LOG_INFO, "Direct suicide");
- at_exit();
- }
-
- if (SIGALRM == sig)
- {
- /* normal exit without error */
- ExitValue = EXIT_SUCCESS;
- }
-
- /* the signal handler is called several times for the same Ctrl-C */
- if (AraKiri == FALSE)
- {
- Log1(PCSC_LOG_INFO, "Preparing for suicide");
- AraKiri = TRUE;
-
- /* if still in the init/loading phase the AraKiri will not be
- * seen by the main event loop
- */
- if (Init)
- {
- Log1(PCSC_LOG_INFO, "Suicide during init");
- at_exit();
- }
- }
- else
- {
- /* if pcscd do not want to die */
- static int lives = 2;
+ int r;
- lives--;
- /* no live left. Something is blocking the normal death. */
- if (0 == lives)
- {
- Log1(PCSC_LOG_INFO, "Forced suicide");
- at_exit();
- }
- }
+ r = write(signal_handler_fd[1], &sig, sizeof sig);
+ if (r < 0)
+ Log2(PCSC_LOG_ERROR, "write failed: %s", strerror(errno));
}
static void print_version (void)
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.16/src/readerfactory.c new/pcsc-lite-1.8.17/src/readerfactory.c
--- old/pcsc-lite-1.8.16/src/readerfactory.c 2015-12-25 20:55:51.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/readerfactory.c 2016-05-20 19:44:43.000000000 +0200
@@ -49,6 +49,7 @@
#include
#include
#include
+#include "alloca.h"
#include "misc.h"
#include "pcscd.h"
@@ -1026,15 +1027,25 @@
rv = RFCheckSharing(hCard, rContext);
if (SCARD_S_SUCCESS == rv)
{
- if (rContext->LockCount > 0)
+ if (PCSCLITE_SHARING_EXCLUSIVE_CONTEXT == rContext->contexts)
{
- rContext->LockCount -= 1;
- if (0 == rContext->LockCount)
- rContext->hLockId = 0;
+ if (rContext->LockCount > 1)
+ rContext->LockCount -= 1;
+ else
+ rv = SCARD_E_NOT_TRANSACTED;
}
else
- /* rContext->LockCount == 0 */
- rv = SCARD_E_NOT_TRANSACTED;
+ {
+ if (rContext->LockCount > 0)
+ {
+ rContext->LockCount -= 1;
+ if (0 == rContext->LockCount)
+ rContext->hLockId = 0;
+ }
+ else
+ /* rContext->LockCount == 0 */
+ rv = SCARD_E_NOT_TRANSACTED;
+ }
}
(void)pthread_mutex_unlock(&LockMutex);
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.16/src/utils.c new/pcsc-lite-1.8.17/src/utils.c
--- old/pcsc-lite-1.8.16/src/utils.c 2015-11-06 09:39:51.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/utils.c 2016-05-06 13:16:10.000000000 +0200
@@ -94,11 +94,12 @@
if (pid != -1)
{
- Log2(PCSC_LOG_INFO, "Send hotplug signal to pcscd (pid=%d)", pid);
+ Log2(PCSC_LOG_INFO, "Send hotplug signal to pcscd (pid=%ld)",
+ (long)pid);
if (kill(pid, SIGUSR1) < 0)
{
- Log3(PCSC_LOG_CRITICAL, "Can't signal pcscd (pid=%d): %s",
- pid, strerror(errno));
+ Log3(PCSC_LOG_CRITICAL, "Can't signal pcscd (pid=%ld): %s",
+ (long)pid, strerror(errno));
return EXIT_FAILURE ;
}
(void)SYS_Sleep(1);
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.16/src/winscard.c new/pcsc-lite-1.8.17/src/winscard.c
--- old/pcsc-lite-1.8.16/src/winscard.c 2016-03-12 20:03:09.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/winscard.c 2016-05-20 19:44:43.000000000 +0200
@@ -1137,6 +1137,18 @@
if (rv != SCARD_S_SUCCESS)
goto exit;
+ /*
+ * Error if another transaction is ongoing and a card action is
+ * requested
+ */
+ if ((dwDisposition != SCARD_LEAVE_CARD) && (rContext->hLockId != 0)
+ && (rContext->hLockId != hCard))
+ {
+ Log1(PCSC_LOG_INFO, "No card reset within a transaction");
+ rv = SCARD_E_SHARING_VIOLATION;
+ goto exit;
+ }
+
if (dwDisposition == SCARD_RESET_CARD ||
dwDisposition == SCARD_UNPOWER_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.16/src/winscard_clnt.c new/pcsc-lite-1.8.17/src/winscard_clnt.c
--- old/pcsc-lite-1.8.16/src/winscard_clnt.c 2016-03-12 20:03:09.000000000 +0100
+++ new/pcsc-lite-1.8.17/src/winscard_clnt.c 2016-05-29 14:14:24.000000000 +0200
@@ -794,6 +794,7 @@
if (NULL == currentContextMap)
return SCARD_E_INVALID_HANDLE;
+ memset(scConnectStruct.szReader, 0, sizeof scConnectStruct.szReader);
strncpy(scConnectStruct.szReader, szReader, sizeof scConnectStruct.szReader);
scConnectStruct.szReader[sizeof scConnectStruct.szReader -1] = '\0';
@@ -1623,9 +1624,17 @@
* rgReaderStates[1].szReader = "\\\\?PnP?\\Notification";
* rgReaderStates[1].dwCurrentState = SCARD_STATE_UNAWARE;
* ...
+ * // Get current state
* rv = SCardGetStatusChange(hContext, INFINITE, rgReaderStates, 2);
* printf("reader state: 0x%04X\n", rgReaderStates[0].dwEventState);
* printf("reader state: 0x%04X\n", rgReaderStates[1].dwEventState);
+ *
+ * // Wait for card insertion
+ * if (rgReaderStates[0].dwEventState & SCARD_STATE_EMPTY)
+ * {
+ * rgReaderStates[0].dwCurrentState = rgReaderStates[0].dwEventState;
+ * rv = SCardGetStatusChange(hContext, INFINITE, rgReaderStates, 2);
+ * }
* @endcode
*/
LONG SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout,
@@ -2319,14 +2328,18 @@
* - \ref SCARD_ATTR_VENDOR_IFD_VERSION
* - \ref SCARD_ATTR_VENDOR_NAME
* @param[out] pbAttr Pointer to a buffer that receives the attribute.
- * @param[in,out] pcbAttrLen Length of the \p pbAttr buffer in bytes.
+ * If this value is NULL, SCardGetAttrib() ignores the buffer length
+ * supplied in \p pcbAttrLen, writes the length of the buffer that would
+ * have been returned if this parameter had not been NULL to \p pcbAttrLen,
+ * and returns a success code.
+ * @param[in,out] pcbAttrLen Length of the \p pbAttr buffer in bytes and receives the actual length of the received attribute.
*
* @return Error code.
* @retval SCARD_S_SUCCESS Successful (\ref SCARD_S_SUCCESS)
* @retval SCARD_E_UNSUPPORTED_FEATURE the \p dwAttrId attribute is not supported by the driver (\ref SCARD_E_UNSUPPORTED_FEATURE)
* @retval SCARD_E_NOT_TRANSACTED the driver returned an error (\ref SCARD_E_NOT_TRANSACTED)
* @retval SCARD_E_INSUFFICIENT_BUFFER \p cbAttrLen is too big (\ref SCARD_E_INSUFFICIENT_BUFFER)
- * @retval SCARD_E_INSUFFICIENT_BUFFER Reader buffer not large enough (\ref SCARD_E_INSUFFICIENT_BUFFER)
+ * @retval SCARD_E_INSUFFICIENT_BUFFER \p pbAttr buffer not large enough. In that case the expected buffer size is indicated in \p *pcbAttrLen (\ref SCARD_E_INSUFFICIENT_BUFFER)
* @retval SCARD_E_INVALID_HANDLE Invalid \p hCard handle (\ref SCARD_E_INVALID_HANDLE)
* @retval SCARD_E_INVALID_PARAMETER A parameter is NULL and should not (\ref SCARD_E_INVALID_PARAMETER)
* @retval SCARD_E_NO_MEMORY Memory allocation failed (\ref SCARD_E_NO_MEMORY)
@@ -2340,14 +2353,19 @@
* SCARDCONTEXT hContext;
* SCARDHANDLE hCard;
* DWORD dwActiveProtocol;
- * unsigned char pbAtr[MAX_ATR_SIZE];
- * DWORD dwAtrLen;
+ * unsigned char *pbAttr;
+ * DWORD dwAttrLen;
* ...
* rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
* rv = SCardConnect(hContext, "Reader X", SCARD_SHARE_SHARED,
* SCARD_PROTOCOL_RAW, &hCard, &dwActiveProtocol);
- * dwAtrLen = sizeof(pbAtr);
- * rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, pbAtr, &dwAtrLen);
+ * rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, NULL, &dwAttrLen);
+ * if (SCARD_S_SUCCESS == rv)
+ * {
+ * pbAttr = malloc(dwAttrLen);
+ * rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, pbAttr, &dwAttrLen);
+ * free(pbAttr);
+ * }
* @endcode
*
* @code
@@ -2490,11 +2508,16 @@
scGetSetStruct.hCard = hCard;
scGetSetStruct.dwAttrId = dwAttrId;
- scGetSetStruct.cbAttrLen = *pcbAttrLen;
scGetSetStruct.rv = SCARD_E_NO_SERVICE;
memset(scGetSetStruct.pbAttr, 0, sizeof(scGetSetStruct.pbAttr));
if (SCARD_SET_ATTRIB == command)
+ {
memcpy(scGetSetStruct.pbAttr, pbAttr, *pcbAttrLen);
+ scGetSetStruct.cbAttrLen = *pcbAttrLen;
+ }
+ else
+ /* we can get up to the communication buffer size */
+ scGetSetStruct.cbAttrLen = sizeof scGetSetStruct.pbAttr;
rv = MessageSendWithHeader(command, currentContextMap->dwClientID,
sizeof(scGetSetStruct), &scGetSetStruct);
@@ -2518,7 +2541,12 @@
*/
if (*pcbAttrLen < scGetSetStruct.cbAttrLen)
{
+ /* restrict the value of scGetSetStruct.cbAttrLen to avoid a
+ * buffer overflow in the memcpy() bellow */
+ DWORD correct_value = scGetSetStruct.cbAttrLen;
scGetSetStruct.cbAttrLen = *pcbAttrLen;
+ *pcbAttrLen = correct_value;
+
scGetSetStruct.rv = SCARD_E_INSUFFICIENT_BUFFER;
}
else