[Pcsclite-cvs-commit] r4479 - /trunk/PCSC/src/winscard_clnt.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Mon Oct 12 13:35:26 UTC 2009


Author: rousseau
Date: Mon Oct 12 13:35:25 2009
New Revision: 4479

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4479
Log:
SCardReconnect(), SCardBeginTransaction(), SCardEndTransaction(),
SCardCancelTransaction(), SCardControl(), SCardGetSetAttrib()
and SCardTransmit(): do not "synchronize reader states with daemon"
since reader availability checks are done on the server side.

Modified:
    trunk/PCSC/src/winscard_clnt.c

Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=4479&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Mon Oct 12 13:35:25 2009
@@ -859,7 +859,6 @@
 {
 	LONG rv;
 	struct reconnect_struct scReconnectStruct;
-	int i;
 	DWORD dwContextIndex, dwChannelIndex;
 
 	PROFILE_START
@@ -887,26 +886,6 @@
 		 * -> another thread may have called SCardReleaseContext
 		 * -> so the mMutex has been unlocked */
 		return SCARD_E_INVALID_HANDLE;
-
-	/* synchronize reader states with daemon */
-	rv = getReaderStates(dwContextIndex);
-	if (rv != SCARD_S_SUCCESS)
-		goto end;
-
-	for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
-	{
-		char *r = psContextMap[dwContextIndex].psChannelMap[dwChannelIndex].readerName;
-
-		/* by default r == NULL */
-		if (r && strcmp(r, readerStates[i].readerName) == 0)
-			break;
-	}
-
-	if (i == PCSCLITE_MAX_READERS_CONTEXTS)
-	{
-		rv = SCARD_E_READER_UNAVAILABLE;
-		goto end;
-	}
 
 	scReconnectStruct.hCard = hCard;
 	scReconnectStruct.dwShareMode = dwShareMode;
@@ -1086,7 +1065,6 @@
 
 	LONG rv;
 	struct begin_struct scBeginStruct;
-	int i;
 	DWORD dwContextIndex, dwChannelIndex;
 
 	PROFILE_START
@@ -1111,26 +1089,6 @@
 		 * -> another thread may have called SCardReleaseContext
 		 * -> so the mMutex has been unlocked */
 		return SCARD_E_INVALID_HANDLE;
-
-	/* synchronize reader states with daemon */
-	rv = getReaderStates(dwContextIndex);
-	if (rv != SCARD_S_SUCCESS)
-		goto end;
-
-	for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
-	{
-		char *r = psContextMap[dwContextIndex].psChannelMap[dwChannelIndex].readerName;
-
-		/* by default r == NULL */
-		if (r && strcmp(r, readerStates[i].readerName) == 0)
-			break;
-	}
-
-	if (i == PCSCLITE_MAX_READERS_CONTEXTS)
-	{
-		rv = SCARD_E_READER_UNAVAILABLE;
-		goto end;
-	}
 
 	scBeginStruct.hCard = hCard;
 	scBeginStruct.rv = SCARD_S_SUCCESS;
@@ -1221,7 +1179,7 @@
 {
 	LONG rv;
 	struct end_struct scEndStruct;
-	int randnum, i;
+	int randnum;
 	DWORD dwContextIndex, dwChannelIndex;
 
 	PROFILE_START
@@ -1252,26 +1210,6 @@
 		 * -> so the mMutex has been unlocked */
 		return SCARD_E_INVALID_HANDLE;
 
-	/* synchronize reader states with daemon */
-	rv = getReaderStates(dwContextIndex);
-	if (rv != SCARD_S_SUCCESS)
-		goto end;
-
-	for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
-	{
-		char *r = psContextMap[dwContextIndex].psChannelMap[dwChannelIndex].readerName;
-
-		/* by default r == NULL */
-		if (r && strcmp(r, readerStates[i].readerName) == 0)
-			break;
-	}
-
-	if (i == PCSCLITE_MAX_READERS_CONTEXTS)
-	{
-		rv = SCARD_E_READER_UNAVAILABLE;
-		goto end;
-	}
-
 	scEndStruct.hCard = hCard;
 	scEndStruct.dwDisposition = dwDisposition;
 	scEndStruct.rv = SCARD_S_SUCCESS;
@@ -1325,7 +1263,6 @@
 {
 	LONG rv;
 	struct cancel_transaction_struct scCancelStruct;
-	int i;
 	DWORD dwContextIndex, dwChannelIndex;
 
 	PROFILE_START
@@ -1350,26 +1287,6 @@
 		 * -> another thread may have called SCardReleaseContext
 		 * -> so the mMutex has been unlocked */
 		return SCARD_E_INVALID_HANDLE;
-
-	/* synchronize reader states with daemon */
-	rv = getReaderStates(dwContextIndex);
-	if (rv != SCARD_S_SUCCESS)
-		goto end;
-
-	for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
-	{
-		char *r = psContextMap[dwContextIndex].psChannelMap[dwChannelIndex].readerName;
-
-		/* by default r == NULL */
-		if (r && strcmp(r, readerStates[i].readerName) == 0)
-			break;
-	}
-
-	if (i == PCSCLITE_MAX_READERS_CONTEXTS)
-	{
-		rv = SCARD_E_READER_UNAVAILABLE;
-		goto end;
-	}
 
 	scCancelStruct.hCard = hCard;
 
@@ -2306,7 +2223,6 @@
 {
 	LONG rv;
 	struct control_struct scControlStruct;
-	int i;
 	DWORD dwContextIndex, dwChannelIndex;
 
 	PROFILE_START
@@ -2338,26 +2254,6 @@
 		 * -> another thread may have called SCardReleaseContext
 		 * -> so the mMutex has been unlocked */
 		return SCARD_E_INVALID_HANDLE;
-
-	/* synchronize reader states with daemon */
-	rv = getReaderStates(dwContextIndex);
-	if (rv != SCARD_S_SUCCESS)
-		goto end;
-
-	for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
-	{
-		char *r = psContextMap[dwContextIndex].psChannelMap[dwChannelIndex].readerName;
-
-		/* by default r == NULL */
-		if (r && strcmp(r, readerStates[i].readerName) == 0)
-			break;
-	}
-
-	if (i == PCSCLITE_MAX_READERS_CONTEXTS)
-	{
-		rv = SCARD_E_READER_UNAVAILABLE;
-		goto end;
-	}
 
 	if ((cbSendLength > MAX_BUFFER_SIZE_EXTENDED)
 		|| (cbRecvLength > MAX_BUFFER_SIZE_EXTENDED))
@@ -2627,7 +2523,6 @@
 {
 	LONG rv;
 	struct getset_struct scGetSetStruct;
-	int i;
 	DWORD dwContextIndex, dwChannelIndex;
 
 	rv = SCardCheckDaemonAvailability();
@@ -2650,26 +2545,6 @@
 		 * -> another thread may have called SCardReleaseContext
 		 * -> so the mMutex has been unlocked */
 		return SCARD_E_INVALID_HANDLE;
-
-	/* synchronize reader states with daemon */
-	rv = getReaderStates(dwContextIndex);
-	if (rv != SCARD_S_SUCCESS)
-		goto end;
-
-	for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
-	{
-		char *r = psContextMap[dwContextIndex].psChannelMap[dwChannelIndex].readerName;
-
-		/* by default r == NULL */
-		if (r && strcmp(r, readerStates[i].readerName) == 0)
-			break;
-	}
-
-	if (i == PCSCLITE_MAX_READERS_CONTEXTS)
-	{
-		rv = SCARD_E_READER_UNAVAILABLE;
-		goto end;
-	}
 
 	if (*pcbAttrLen > MAX_BUFFER_SIZE)
 	{
@@ -2798,7 +2673,6 @@
 	LPDWORD pcbRecvLength)
 {
 	LONG rv;
-	int i;
 	DWORD dwContextIndex, dwChannelIndex;
 	struct transmit_struct scTransmitStruct;
 
@@ -2832,26 +2706,6 @@
 		 * -> another thread may have called SCardReleaseContext
 		 * -> so the mMutex has been unlocked */
 		return SCARD_E_INVALID_HANDLE;
-
-	/* synchronize reader states with daemon */
-	rv = getReaderStates(dwContextIndex);
-	if (rv != SCARD_S_SUCCESS)
-		goto end;
-
-	for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
-	{
-		char *r = psContextMap[dwContextIndex].psChannelMap[dwChannelIndex].readerName;
-
-		/* by default r == NULL */
-		if (r && strcmp(r, readerStates[i].readerName) == 0)
-			break;
-	}
-
-	if (i == PCSCLITE_MAX_READERS_CONTEXTS)
-	{
-		rv = SCARD_E_READER_UNAVAILABLE;
-		goto end;
-	}
 
 	if ((cbSendLength > MAX_BUFFER_SIZE_EXTENDED)
 		|| (*pcbRecvLength > MAX_BUFFER_SIZE_EXTENDED))




More information about the Pcsclite-cvs-commit mailing list