Merge pull request #516 from frankmorgner/lock
Only re-lock for Windows and Apple
This commit is contained in:
commit
ee5915700c
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Building the installer is only tested and supported on 10.9+ with Xcode 6.0.1
|
# Building the installer is only tested and supported on 10.9+ with Xcode 6.0.1
|
||||||
# Built package targets 10.9+
|
# Built package targets 10.10
|
||||||
# Building should also work on older versions with older revisions or slight changes, YMMV
|
# Building should also work on older versions with older revisions or slight changes, YMMV
|
||||||
|
|
||||||
# You need to have the following from homebrew or macports or fink:
|
# You need to have the following from homebrew or macports or fink:
|
||||||
|
@ -15,7 +15,7 @@ SDKS_PATH="$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs"
|
||||||
SDK_PATH="${SDK_PATH:-$SDKS_PATH/$(ls -1 ${SDKS_PATH} | sort -n -k2 -t. -r | head -1)}"
|
SDK_PATH="${SDK_PATH:-$SDKS_PATH/$(ls -1 ${SDKS_PATH} | sort -n -k2 -t. -r | head -1)}"
|
||||||
|
|
||||||
# Set SDK path
|
# Set SDK path
|
||||||
export CFLAGS="-isysroot $SDK_PATH -arch i386 -arch x86_64 -mmacosx-version-min=10.7"
|
export CFLAGS="-isysroot $SDK_PATH -arch i386 -arch x86_64 -mmacosx-version-min=10.10"
|
||||||
|
|
||||||
# OpenSSL is deprecated on OSX since 10.7 and that generates lots of
|
# OpenSSL is deprecated on OSX since 10.7 and that generates lots of
|
||||||
# "false positive" warnings and there is no alternative option.
|
# "false positive" warnings and there is no alternative option.
|
||||||
|
|
|
@ -576,6 +576,7 @@ if test "${enable_pcsc}" = "yes"; then
|
||||||
CFLAGS="${CFLAGS} ${PCSC_CFLAGS}"
|
CFLAGS="${CFLAGS} ${PCSC_CFLAGS}"
|
||||||
# We must cope with mingw32 that does not have winscard.h mingw64 has it.
|
# We must cope with mingw32 that does not have winscard.h mingw64 has it.
|
||||||
AC_CHECK_HEADERS([winscard.h],,[test "${WIN32}" != "yes" && AC_MSG_ERROR([winscard.h is required for pcsc])])
|
AC_CHECK_HEADERS([winscard.h],,[test "${WIN32}" != "yes" && AC_MSG_ERROR([winscard.h is required for pcsc])])
|
||||||
|
AC_CHECK_HEADERS([pcsclite.h])
|
||||||
CFLAGS="${saved_CFLAGS}"
|
CFLAGS="${saved_CFLAGS}"
|
||||||
|
|
||||||
if test "${with_pcsc_provider}" = "detect"; then
|
if test "${with_pcsc_provider}" = "detect"; then
|
||||||
|
|
|
@ -41,6 +41,12 @@
|
||||||
|
|
||||||
#include "pace.h"
|
#include "pace.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_PCSCLITE_H
|
||||||
|
#if !defined (__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
|
||||||
|
#define HAVE_PCSCLITE 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Logging */
|
/* Logging */
|
||||||
#define PCSC_TRACE(reader, desc, rv) do { sc_log(reader->ctx, "%s:" desc ": 0x%08lx\n", reader->name, rv); } while (0)
|
#define PCSC_TRACE(reader, desc, rv) do { sc_log(reader->ctx, "%s:" desc ": 0x%08lx\n", reader->name, rv); } while (0)
|
||||||
#define PCSC_LOG(ctx, desc, rv) do { sc_log(ctx, desc ": 0x%08lx\n", rv); } while (0)
|
#define PCSC_LOG(ctx, desc, rv) do { sc_log(ctx, desc ": 0x%08lx\n", rv); } while (0)
|
||||||
|
@ -431,8 +437,10 @@ static int pcsc_reconnect(sc_reader_t * reader, DWORD action)
|
||||||
if (check_forced_protocol(reader->ctx, &reader->atr, &tmp))
|
if (check_forced_protocol(reader->ctx, &reader->atr, &tmp))
|
||||||
protocol = tmp;
|
protocol = tmp;
|
||||||
|
|
||||||
/* reconnect always unlocks transaction */
|
#ifndef HAVE_PCSCLITE
|
||||||
|
/* reconnect unlocks transaction everywhere but in PCSC-lite */
|
||||||
priv->locked = 0;
|
priv->locked = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
rv = priv->gpriv->SCardReconnect(priv->pcsc_card,
|
rv = priv->gpriv->SCardReconnect(priv->pcsc_card,
|
||||||
priv->gpriv->connect_exclusive ? SCARD_SHARE_EXCLUSIVE : SCARD_SHARE_SHARED,
|
priv->gpriv->connect_exclusive ? SCARD_SHARE_EXCLUSIVE : SCARD_SHARE_SHARED,
|
||||||
|
@ -588,17 +596,21 @@ static int pcsc_release(sc_reader_t *reader)
|
||||||
|
|
||||||
static int pcsc_reset(sc_reader_t *reader, int do_cold_reset)
|
static int pcsc_reset(sc_reader_t *reader, int do_cold_reset)
|
||||||
{
|
{
|
||||||
struct pcsc_private_data *priv = GET_PRIV_DATA(reader);
|
|
||||||
int r;
|
int r;
|
||||||
|
#ifndef HAVE_PCSCLITE
|
||||||
|
struct pcsc_private_data *priv = GET_PRIV_DATA(reader);
|
||||||
int old_locked = priv->locked;
|
int old_locked = priv->locked;
|
||||||
|
#endif
|
||||||
|
|
||||||
r = pcsc_reconnect(reader, do_cold_reset ? SCARD_UNPOWER_CARD : SCARD_RESET_CARD);
|
r = pcsc_reconnect(reader, do_cold_reset ? SCARD_UNPOWER_CARD : SCARD_RESET_CARD);
|
||||||
if(r != SC_SUCCESS)
|
if(r != SC_SUCCESS)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* pcsc_reconnect unlocks card... try to lock it again if it was locked */
|
#ifndef HAVE_PCSCLITE
|
||||||
|
/* reconnect unlocks transaction everywhere but in PCSC-lite */
|
||||||
if(old_locked)
|
if(old_locked)
|
||||||
r = pcsc_lock(reader);
|
r = pcsc_lock(reader);
|
||||||
|
#endif
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -2486,4 +2498,3 @@ struct sc_reader_driver * sc_get_cardmod_driver(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ENABLE_PCSC */
|
#endif /* ENABLE_PCSC */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue