+++ /dev/null
---- pcsc-lite-1.8.8/configure.ac~ 2010-12-12 12:03:57.000000000 +0200
-+++ pcsc-lite-1.8.8/configure.ac 2011-01-12 02:44:22.154890564 +0200
-@@ -338,6 +338,7 @@
- AC_SUBST(host_to_ccid_16)
- AC_SUBST(host_to_ccid_32)
- AS_AC_EXPAND(confdir_exp,$confdir)
-+AS_AC_EXPAND(sysconfdir_exp,$sysconfdir)
- AS_AC_EXPAND(sbindir_exp,$sbindir)
- AS_AC_EXPAND(localstatedir_exp,$localstatedir)
-
---- pcsc-lite-1.6.6/src/debuglog.c~ 2010-06-30 15:40:58.000000000 +0300
-+++ pcsc-lite-1.6.6/src/debuglog.c 2011-01-12 01:58:18.693291099 +0200
-@@ -104,6 +104,8 @@
+--- pcsc-lite-1.9.9/src/debuglog.c.orig 2022-09-11 13:51:43.000000000 +0200
++++ pcsc-lite-1.9.9/src/debuglog.c 2022-09-12 01:28:32.960862895 +0200
+@@ -136,6 +136,8 @@ void log_msg(const int priority, const c
{
char DebugBuffer[DEBUG_BUF_SIZE];
va_list argptr;
+ // boolean not to do openlog several times
+ static int syslog_opened = 0;
- if ((LogSuppress != DEBUGLOG_LOG_ENTRIES)
- || (priority < LogLevel) /* log priority lower than threshold? */
-@@ -114,13 +116,18 @@
- vsnprintf(DebugBuffer, DEBUG_BUF_SIZE, fmt, argptr);
+ if ((priority < LogLevel) /* log priority lower than threshold? */
+ || (DEBUGLOG_NO_DEBUG == LogMsgType))
+@@ -145,6 +147,11 @@ void log_msg(const int priority, const c
+ vsnprintf(DebugBuffer, sizeof DebugBuffer, fmt, argptr);
va_end(argptr);
+ if (DEBUGLOG_SYSLOG_DEBUG == LogMsgType && !syslog_opened) {
+ syslog_opened = 1;
+ }
+
- log_line(priority, DebugBuffer);
+ log_line(priority, DebugBuffer, -1);
} /* log_msg */
- static void log_line(const int priority, const char *DebugBuffer)
+@@ -203,7 +210,7 @@ static void log_line(const int priority,
+ unsigned int rv)
{
if (DEBUGLOG_SYSLOG_DEBUG == LogMsgType)
- syslog(LOG_INFO, "%s", DebugBuffer);
+ syslog(LOG_DEBUG, "%s", DebugBuffer);
else
{
- if (LogDoColor)
+ static struct timeval last_time = { 0, 0 };
+++ /dev/null
-# Disable pcscd on-demand startup (#653903)
-https://bugzilla.redhat.com/show_bug.cgi?id=653903
-
---- pcsc-lite-1.7.0/src/winscard_clnt.c.orig 2011-02-22 23:20:25.000000000 +0100
-+++ pcsc-lite-1.7.0/src/winscard_clnt.c 2011-03-18 16:44:57.275416294 +0100
-@@ -444,80 +444,16 @@
- LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
- {
- LONG rv;
-- int daemon_launched = FALSE;
-- int retries = 0;
-
- API_TRACE_IN("%ld, %p, %p", dwScope, pvReserved1, pvReserved2)
- PROFILE_START
-
--again:
- /* Check if the server is running */
- rv = SCardCheckDaemonAvailability();
- if (SCARD_E_INVALID_HANDLE == rv)
- /* we reconnected to a daemon or we got called from a forked child */
- rv = SCardCheckDaemonAvailability();
-
-- if (SCARD_E_NO_SERVICE == rv)
-- {
--launch:
-- if (daemon_launched)
-- {
-- retries++;
-- if (retries < 50) /* 50 x 100ms = 5 seconds */
-- {
-- /* give some more time to the server to start */
-- SYS_USleep(100*1000); /* 100 ms */
-- goto again;
-- }
--
-- /* the server failed to start (in time) */
-- goto end;
-- }
-- else
-- {
-- int pid;
--
-- pid = fork();
--
-- if (pid < 0)
-- {
-- Log2(PCSC_LOG_CRITICAL, "fork failed: %s", strerror(errno));
-- rv = SCARD_F_INTERNAL_ERROR;
-- goto end;
-- }
--
-- if (0 == pid)
-- {
-- int i, max;
-- char *param = getenv("PCSCLITE_PCSCD_ARGS");
--
-- /* close all file handles except stdin, stdout and
-- * stderr so that pcscd does not confiscate ressources
-- * allocated by the application */
-- max = sysconf(_SC_OPEN_MAX);
-- if (-1 == max)
-- max = 1024;
-- for (i=3; i<max; i++)
-- (void)close(i);
--
-- /* son process */
-- execl(PCSCD_BINARY, "pcscd", "--auto-exit", param,
-- (char *)NULL);
-- Log2(PCSC_LOG_CRITICAL, "exec " PCSCD_BINARY " failed: %s",
-- strerror(errno));
-- exit(1);
-- }
--
-- /* father process */
-- daemon_launched = TRUE;
--
-- if (waitpid(pid, NULL, 0) < 0)
-- Log2(PCSC_LOG_CRITICAL, "waitpid failed: %s", strerror(errno));
--
-- goto again;
-- }
-- }
--
- if (rv != SCARD_S_SUCCESS)
- goto end;
-
-@@ -526,15 +462,6 @@
- pvReserved2, phContext);
- (void)SCardUnlockThread();
-
-- /* SCardEstablishContextTH may fail if the previous pcscd crashed
-- * without cleaning /var/run/pcscd/pcscd.comm */
-- if (SCARD_E_NO_SERVICE == rv)
-- {
-- retries++;
-- if (retries <= 1)
-- goto launch;
-- }
--
- end:
- PROFILE_END(rv)
- API_TRACE_OUT("%ld", *phContext)
+++ pcsc-lite-1.5.2/src/winscard.c 2009-04-02 22:54:43.137718835 +0200
@@ -430,6 +430,12 @@
{
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
+ /*
+ * If it is set to ANY let it do any of the protocols
+ dwPreferredProtocols = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
+
if (! (dwPreferredProtocols & rContext->readerState->cardProtocol))
- return SCARD_E_PROTO_MISMATCH;
- }
+ {
+ rv = SCARD_E_PROTO_MISMATCH;
@@ -758,6 +764,12 @@
{
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
+ /*
+ * If it is set to ANY let it do any of the protocols
+ dwPreferredProtocols = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
+
if (! (dwPreferredProtocols & rContext->readerState->cardProtocol))
- return SCARD_E_PROTO_MISMATCH;
- }
+ {
+ rv = SCARD_E_PROTO_MISMATCH;
# TODO
+# - follow upstream with using /run instead of /var/run
# - pcscd & pcscd-lite-libs need to be exactly same version installed otherwise
# client will flood daemon so much that daemon is not usable (max 200
# connections reached, etc)
#
# Conditional build:
-%bcond_without polkit # polkit support
-%bcond_without udev # udev support (plain libusb if disabled)
+%bcond_without apidocs # API documentation
+%bcond_without polkit # polkit support
+%bcond_without static_libs # static libraries
+%bcond_without udev # udev support (plain libusb if disabled)
Summary: PCSC Framework for Linux
Summary(pl.UTF-8): Środowisko PCSC dla Linuksa
Name: pcsc-lite
-Version: 1.8.25
+Version: 2.0.1
Release: 1
License: BSD
Group: Daemons
-# TODO: switch to release tarballs
-#Source0: https://pcsclite.apdu.fr/files/%{name}-%{version}.tar.bz2
-# Source0Download: https://salsa.debian.org/rousseau/PCSC/tags
-Source0: https://salsa.debian.org/rousseau/PCSC/-/archive/pcsc-%{version}/PCSC-pcsc-%{version}.tar.bz2
-# Source0-md5: d104b1c779c15c1da28294095ae0014e
+Source0: https://pcsclite.apdu.fr/files/%{name}-%{version}.tar.bz2
+# Source0-md5: 730d069764c769ba3bac391a96c8a54f
Source1: %{name}-pcscd.init
Source2: %{name}-pcscd.sysconfig
Patch1: %{name}-any.patch
Patch2: debuglog-pid.patch
-Patch3: configure-expand.patch
URL: https://pcsclite.apdu.fr/
BuildRequires: autoconf >= 2.69
+BuildRequires: autoconf-archive
BuildRequires: automake >= 1:1.8
BuildRequires: flex
-%{?with_apidocs:BuildRequires: graphviz}
+%{?with_apidocs:BuildRequires: doxygen}
BuildRequires: libtool >= 2:2.0
%{!?with_udev:BuildRequires: libusb-devel >= 1.0}
+BuildRequires: perl-tools-pod
BuildRequires: pkgconfig
%{?with_polkit:BuildRequires: polkit-devel >= 0.111}
+BuildRequires: rpm-build >= 4.6
BuildRequires: rpmbuild(macros) >= 1.647
%{?with_udev:BuildRequires: udev-devel}
Requires(post,preun): /sbin/chkconfig
Summary: PC/SC Lite API documentation
Summary(pl.UTF-8): Dokumentacja API biblioteki PC/SC Lite
Group: Documentation
+BuildArch: noarch
%description apidocs
API and internal documentation for PC/SC Lite library.
Dokumentacja API biblioteki PC/SC Lite.
%prep
-%setup -q -n PCSC-pcsc-%{version}
+%setup -q
%patch1 -p1
%patch2 -p1
-%patch3 -p1
+
+%{__sed} -i -e '1s, /usr/bin/python$,%{__python3},' src/spy/pcsc-spy
%build
%{__libtoolize}
%{!?with_udev:--disable-libudev} \
--disable-silent-rules \
--enable-ipcdir=/var/run/pcscd \
- %{?with_polkit:--enable-polkit} \
- --enable-static \
+ %{__enable_disable polkit} \
+ %{__enable_disable static_libs static} \
--enable-usbdropdir=%{usbdropdir}
%{__make}
%files
%defattr(644,root,root,755)
-%doc AUTHORS COPYING ChangeLog HELP README SECURITY TODO doc/README.{DAEMON,polkit}
+%doc AUTHORS COPYING ChangeLog HELP README SECURITY TODO doc/README.polkit
%attr(755,root,root) %{_bindir}/pcsc-spy
%attr(755,root,root) %{_sbindir}/pcscd
%dir %{_libdir}/pcsc
%{_pkgconfigdir}/libpcsclite.pc
%{_examplesdir}/%{name}-%{version}
+%if %{with static_libs}
%files static
%defattr(644,root,root,755)
%{_libdir}/libpcsclite.a
%{_libdir}/libpcscspy.a
+%endif
%if %{with apidocs}
%files apidocs