[Pcsclite-cvs-commit] r2116 - in trunk/Drivers/ccid: . examples src

Ludovic Rousseau rousseau at costa.debian.org
Mon Jul 31 15:10:49 UTC 2006


Author: rousseau
Date: 2006-07-31 15:10:48 +0000 (Mon, 31 Jul 2006)
New Revision: 2116

Modified:
   trunk/Drivers/ccid/configure.in
   trunk/Drivers/ccid/examples/scardcontrol.c
   trunk/Drivers/ccid/src/ifdhandler.c
Log:
use ntohl/htonl from arpa/inet.h since the tag value for
IOCTL_FEATURE_VERIFY_PIN_DIRECT and IOCTL_FEATURE_MODIFY_PIN_DIRECT
_shall_ be encoded in big endian as documented in PCSC v2 part 10 ch 2.2
page 2.

The applications using this feature shall be updated (to respect the
PCSC specification)

Thanks to Ulrich Vogl for the bug report


Modified: trunk/Drivers/ccid/configure.in
===================================================================
--- trunk/Drivers/ccid/configure.in	2006-07-31 13:36:16 UTC (rev 2115)
+++ trunk/Drivers/ccid/configure.in	2006-07-31 15:10:48 UTC (rev 2116)
@@ -59,7 +59,7 @@
 
 # Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(errno.h fcntl.h stdlib.h unistd.h termios.h string.h errno.h sys/time.h sys/types.h stdarg.h,,
+AC_CHECK_HEADERS(errno.h fcntl.h stdlib.h unistd.h termios.h string.h errno.h sys/time.h sys/types.h stdarg.h arpa/inet.h,,
 	[AC_MSG_WARN([some header files not found])])
 
 # Checks for typedefs, structures, and compiler characteristics.

Modified: trunk/Drivers/ccid/examples/scardcontrol.c
===================================================================
--- trunk/Drivers/ccid/examples/scardcontrol.c	2006-07-31 13:36:16 UTC (rev 2115)
+++ trunk/Drivers/ccid/examples/scardcontrol.c	2006-07-31 15:10:48 UTC (rev 2116)
@@ -26,6 +26,7 @@
 #include <sys/time.h>
 #include <unistd.h>
 #include <string.h>
+#include <arpa/inet.h>
 #include <winscard.h>
 #include <reader.h>
 
@@ -228,9 +229,9 @@
 	for (i = 0; i < length; i++)
 	{
 		if (pcsc_tlv[i].tag == FEATURE_VERIFY_PIN_DIRECT)
-			verify_ioctl = pcsc_tlv[i].value;
+			verify_ioctl = ntohl(pcsc_tlv[i].value);
 		if (pcsc_tlv[i].tag == FEATURE_MODIFY_PIN_DIRECT)
-			modify_ioctl = pcsc_tlv[i].value;
+			modify_ioctl = ntohl(pcsc_tlv[i].value);
 	}
 
 	if (0 == verify_ioctl)

Modified: trunk/Drivers/ccid/src/ifdhandler.c
===================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c	2006-07-31 13:36:16 UTC (rev 2115)
+++ trunk/Drivers/ccid/src/ifdhandler.c	2006-07-31 15:10:48 UTC (rev 2116)
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <arpa/inet.h>
 #include "misc.h"
 #include <pcsclite.h>
 #include <ifdhandler.h>
@@ -971,7 +972,7 @@
 		{
 			pcsc_tlv -> tag = FEATURE_VERIFY_PIN_DIRECT;
 			pcsc_tlv -> length = 0x04; /* always 0x04 */
-			pcsc_tlv -> value = IOCTL_FEATURE_VERIFY_PIN_DIRECT;
+			pcsc_tlv -> value = htonl(IOCTL_FEATURE_VERIFY_PIN_DIRECT);
 
 			pcsc_tlv++;
 			iBytesReturned += sizeof(PCSC_TLV_STRUCTURE);
@@ -982,7 +983,7 @@
 		{
 			pcsc_tlv -> tag = FEATURE_MODIFY_PIN_DIRECT;
 			pcsc_tlv -> length = 0x04; /* always 0x04 */
-			pcsc_tlv -> value = IOCTL_FEATURE_MODIFY_PIN_DIRECT;
+			pcsc_tlv -> value = htonl(IOCTL_FEATURE_MODIFY_PIN_DIRECT);
 
 			pcsc_tlv++;
 			iBytesReturned += sizeof(PCSC_TLV_STRUCTURE);




More information about the Pcsclite-cvs-commit mailing list