diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/coolkey/Makefile.am | 2 | ||||
-rw-r--r-- | src/coolkey/slot.cpp | 17 | ||||
-rw-r--r-- | src/libckyapplet/cky_card.c | 5 |
3 files changed, 19 insertions, 5 deletions
diff --git a/src/coolkey/Makefile.am b/src/coolkey/Makefile.am index 4d5b6fe..aeb0830 100644 --- a/src/coolkey/Makefile.am +++ b/src/coolkey/Makefile.am @@ -64,7 +64,7 @@ libcoolkeypk11_la_LIBADD = @LIBCKYAPPLET@ $(ZLIB_LIBS) # coreconf .def file to a simplistic but acceptable libtool .sym file # coolkeypk11.sym: coolkeypk11.def - grep -v ';+' $< | grep -v ';-' | sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' > $@ + grep -v ';+' $< | grep -v ';-' | sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' | grep -v '^$$'> $@ clean-generic: rm -f coolkeypk11.sym diff --git a/src/coolkey/slot.cpp b/src/coolkey/slot.cpp index dd1db32..0c69826 100644 --- a/src/coolkey/slot.cpp +++ b/src/coolkey/slot.cpp @@ -237,9 +237,14 @@ SlotList::updateReaderList() CKYStatus status = CKYCardContext_ListReaders(context, &readerNames); if ( status != CKYSUCCESS ) { - throw PKCS11Exception(CKR_GENERAL_ERROR, - "Failed to list readers: 0x%x\n", - CKYCardContext_GetLastError(context)); + /* if the service is stopped, treat it as if we have no readers */ + if ((CKYCardContext_GetLastError(context) != SCARD_E_NO_SERVICE) && + (CKYCardContext_GetLastError(context) != SCARD_E_SERVICE_STOPPED)) { + throw PKCS11Exception(CKR_GENERAL_ERROR, + "Failed to list readers: 0x%x\n", + CKYCardContext_GetLastError(context)); + } + } if (!readerStates) { @@ -1286,7 +1291,9 @@ SlotList::waitForSlotEvent(CK_FLAGS flag, CK_SLOT_ID_PTR slotp, CK_VOID_PTR res) #endif } while ((status == CKYSUCCESS) || (CKYCardContext_GetLastError(context) == SCARD_E_TIMEOUT) || - ( CKYCardContext_GetLastError(context) == SCARD_E_READER_UNAVAILABLE)); + (CKYCardContext_GetLastError(context) == SCARD_E_READER_UNAVAILABLE) || + (CKYCardContext_GetLastError(context) == SCARD_E_NO_SERVICE) || + (CKYCardContext_GetLastError(context) == SCARD_E_SERVICE_STOPPED) ); #else do { OSSleep(100); @@ -3405,10 +3412,12 @@ retry: status = CKYApplet_ComputeCrypt(conn, keyNum, CKY_RSA_NO_PAD, direction, input, NULL, output, getNonce(), &result); } +#ifdef notdef /* CAC pin cachine is incomplete, don't enable it */ /* map the ISO not logged in code to the coolkey one */ if (status == CKYISO_CONDITION_NOT_SATISFIED) { status = (CKYStatus) CKYISO_UNAUTHORIZED; } +#endif if (status != CKYSUCCESS) { if ( status == CKYSCARDERR ) { handleConnectionError(); diff --git a/src/libckyapplet/cky_card.c b/src/libckyapplet/cky_card.c index e613961..325fe6a 100644 --- a/src/libckyapplet/cky_card.c +++ b/src/libckyapplet/cky_card.c @@ -849,6 +849,11 @@ CKYCardContext_WaitForStatusChange(CKYCardContext *ctx, rv = ctx->scard->SCardGetStatusChange(ctx->context, timeout, readers, readerCount); if (rv != SCARD_S_SUCCESS) { + if ((rv == SCARD_E_NO_SERVICE) || (rv == SCARD_E_SERVICE_STOPPED)) { + /* if we were stopped, don't reuse the old context, + * pcsc-lite hangs */ + ckyCardContext_release(ctx); + } ctx->lastError = rv; return CKYSCARDERR; } |