[Pcsclite-cvs-commit] r1879 - trunk/PCSC/src

Ludovic Rousseau rousseau at costa.debian.org
Wed Feb 22 09:25:58 UTC 2006


Author: rousseau
Date: 2006-02-22 09:25:57 +0000 (Wed, 22 Feb 2006)
New Revision: 1879

Modified:
   trunk/PCSC/src/winscard_clnt.c
Log:
SCardReleaseContext(): do not check that the thread releasing the
context is the one that established it. This check is not performed on
Windows and creates portability problems

See http://archives.neohapsis.com/archives/dev/muscle/2006-q1/0134.html


Modified: trunk/PCSC/src/winscard_clnt.c
===================================================================
--- trunk/PCSC/src/winscard_clnt.c	2006-02-22 09:03:27 UTC (rev 1878)
+++ trunk/PCSC/src/winscard_clnt.c	2006-02-22 09:25:57 UTC (rev 1879)
@@ -144,7 +144,6 @@
 	DWORD dwClientID;				/** Client Connection ID */
 	SCARDCONTEXT hContext;			/** Application Context ID */
 	DWORD contextBlockStatus;
-	PCSCLITE_THREAD_T TID;			/** Thread owner of this context */
 	PCSCLITE_MUTEX_T mMutex;		/** Mutex for this context */
 	CHANNEL_MAP psChannelMap[PCSCLITE_MAX_APPLICATION_CONTEXT_CHANNELS];
 } psContextMap[PCSCLITE_MAX_APPLICATION_CONTEXTS];
@@ -501,7 +500,6 @@
 	release_struct scReleaseStruct;
 	sharedSegmentMsg msgStruct;
 	DWORD dwContextIndex;
-	PCSCLITE_THREAD_T currentTID;
 
 	PROFILE_START
 
@@ -517,19 +515,6 @@
 
 	SYS_MutexLock(psContextMap[dwContextIndex].mMutex);	
 
-	/*
-	 * Test if the thread that would release the context is the thread owning this context
-	 */
-	currentTID = SYS_ThreadSelf();
-	rv = SYS_ThreadEqual(&psContextMap[dwContextIndex].TID, &currentTID);
-	
-	if (rv == 0)
-	{
-		SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
-		/* Perhaps there is a better error code */
-		return SCARD_F_INTERNAL_ERROR;
-	}
-
 	scReleaseStruct.hContext = hContext;
 	scReleaseStruct.rv = 0;
 
@@ -2945,7 +2930,6 @@
 		if (psContextMap[i].hContext == 0)
 		{
 			psContextMap[i].hContext = hContext;
-			psContextMap[i].TID = SYS_ThreadSelf();
 			psContextMap[i].dwClientID = dwClientID;
 			psContextMap[i].contextBlockStatus = BLOCK_STATUS_RESUME;
 			psContextMap[i].mMutex = (PCSCLITE_MUTEX_T) malloc(sizeof(PCSCLITE_MUTEX));




More information about the Pcsclite-cvs-commit mailing list