[Pcsclite-git-commit] [PCSC] 04/06: SCardEndTransaction(): no card action in a transaction

Ludovic Rousseau rousseau at moszumanska.debian.org
Fri May 20 16:12:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository PCSC.

commit 74656f24db3da1532040a1775ceffa225fbc3d00
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
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(+)

diff --git a/src/winscard.c b/src/winscard.c
index 07514b3..78cac97 100644
--- a/src/winscard.c
+++ b/src/winscard.c
@@ -1137,6 +1137,18 @@ LONG SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition)
 	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)
 	{

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git



More information about the Pcsclite-cvs-commit mailing list