[Pcsclite-cvs-commit] r6236 - /trunk/PCSC/src/spy/pcsc-spy

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Feb 28 14:42:18 UTC 2012


Author: rousseau
Date: Tue Feb 28 14:42:18 2012
New Revision: 6236

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6236
Log:
_SCardControl(): parse the received buffer only on success

The received buffer (answer) is valid only if the command execution
succeeded.

Modified:
    trunk/PCSC/src/spy/pcsc-spy

Modified: trunk/PCSC/src/spy/pcsc-spy
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/spy/pcsc-spy?rev=6236&op=diff
==============================================================================
--- trunk/PCSC/src/spy/pcsc-spy (original)
+++ trunk/PCSC/src/spy/pcsc-spy Tue Feb 28 14:42:18 2012
@@ -170,6 +170,8 @@
         else:
             print self.indent + data + time
 
+        return rv_text
+
     def log_in(self, line):
         """ generic log for IN line """
         if self.color:
@@ -506,6 +508,12 @@
         bSendBuffer = self.log_buffer("bSendBuffer", "in")
         bRecvLength = self.log_out2("bRecvLength")
         bRecvBuffer = self.log_buffer("bRecvBuffer", "out")
+
+        rv_text = self._log_rv()
+
+        # do not parse the received buffer in case of error
+        if rv_text != "SCARD_S_SUCCESS":
+            return
 
         def hex2int(data, lengh):
             return [int(x, 16) for x in data.split(" ")]
@@ -602,8 +610,6 @@
             result = hexdump(bSendBuffer[19:])
             for line in result:
                 print "  ", line
-
-        self._log_rv()
 
     def _SCardGetAttrib(self):
         """ SCardGetAttrib """




More information about the Pcsclite-cvs-commit mailing list