[Pcsclite-cvs-commit] r7104 - in trunk/Drivers/ccid: . MacOSX src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Tue Mar 24 09:29:23 UTC 2015


Author: rousseau
Date: 2015-03-24 09:29:22 +0000 (Tue, 24 Mar 2015)
New Revision: 7104

Modified:
   trunk/Drivers/ccid/MacOSX/configure
   trunk/Drivers/ccid/configure.ac
   trunk/Drivers/ccid/src/Info.plist.src
   trunk/Drivers/ccid/src/ccid_ifdhandler.h
   trunk/Drivers/ccid/src/debug.c
   trunk/Drivers/ccid/src/debug.h
   trunk/Drivers/ccid/src/ifdhandler.c
Log:
Yosemite already provides a APDU + ATR logging

The logging is enabled using:
$ sudo defaults write /Library/Preferences/com.apple.security.smartcard
Logging -bool yes

See SmartCardServices(7) or
http://ludovicrousseau.blogspot.fr/2015/02/debug-smart-card-application-on-yosemite.html

This patch reverts the changes from revision 7092.


Modified: trunk/Drivers/ccid/MacOSX/configure
===================================================================
--- trunk/Drivers/ccid/MacOSX/configure	2015-03-23 08:32:50 UTC (rev 7103)
+++ trunk/Drivers/ccid/MacOSX/configure	2015-03-24 09:29:22 UTC (rev 7104)
@@ -72,13 +72,6 @@
 
 CONFIGURE_ARGS="--disable-dependency-tracking"
 
-# Are we on a CryptoTokenKit system? (like Mac OS X 10.10 Yosemite)
-if [ -d /System/Library/CryptoTokenKit ]
-then
-	# so we use syslog(3) to log errors
-	CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-syslog"
-fi
-
 # do not build a static driver
 # (building fails when linking statically with libusb)
 CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-static"

Modified: trunk/Drivers/ccid/configure.ac
===================================================================
--- trunk/Drivers/ccid/configure.ac	2015-03-23 08:32:50 UTC (rev 7103)
+++ trunk/Drivers/ccid/configure.ac	2015-03-24 09:29:22 UTC (rev 7104)
@@ -238,16 +238,6 @@
 AM_CONDITIONAL(WITHOUT_PCSC, test "${pcsclite}" != "yes")
 
 
-# --enable-syslog
-AC_ARG_ENABLE(syslog,
-	AS_HELP_STRING([--enable-syslog],[use syslog instead of printf for debug (Yosemite)]),
-	[ use_syslog="${enableval}" ], [ use_syslog=no ] )
-
-if test x$use_syslog = xyes; then
-  AC_DEFINE(USE_SYSLOG, 1, [Use syslog(3) for debug])
-fi
-
-
 # --disable-class
 AC_ARG_ENABLE(class,
 	AS_HELP_STRING([--disable-class],[remove the CCIDCLASSDRIVER from Info.plist]),

Modified: trunk/Drivers/ccid/src/Info.plist.src
===================================================================
--- trunk/Drivers/ccid/src/Info.plist.src	2015-03-23 08:32:50 UTC (rev 7103)
+++ trunk/Drivers/ccid/src/Info.plist.src	2015-03-24 09:29:22 UTC (rev 7104)
@@ -94,10 +94,6 @@
 		value in order to retreive the remaining retries from the card.
 		Some cards (like the OpenPGP card) do not support this.
 
-	0x80: DRIVER_OPTION_LOG
-		Log the ATR, APDU + response.
-		This is usefull on Yosemite since pcscd disapeared.
-
 	Default value: 0
 	-->
 

Modified: trunk/Drivers/ccid/src/ccid_ifdhandler.h
===================================================================
--- trunk/Drivers/ccid/src/ccid_ifdhandler.h	2015-03-23 08:32:50 UTC (rev 7103)
+++ trunk/Drivers/ccid/src/ccid_ifdhandler.h	2015-03-24 09:29:22 UTC (rev 7104)
@@ -43,7 +43,6 @@
 #define DRIVER_OPTION_USE_BOGUS_FIRMWARE 4
 #define DRIVER_OPTION_RESET_ON_CLOSE 8
 #define DRIVER_OPTION_DISABLE_PIN_RETRIES (1 << 6)
-#define DRIVER_OPTION_LOG (1 << 7)
 
 extern int DriverOptions;
 

Modified: trunk/Drivers/ccid/src/debug.c
===================================================================
--- trunk/Drivers/ccid/src/debug.c	2015-03-23 08:32:50 UTC (rev 7103)
+++ trunk/Drivers/ccid/src/debug.c	2015-03-24 09:29:22 UTC (rev 7104)
@@ -32,10 +32,6 @@
 #include <sys/time.h>
 #include <stdlib.h>
 
-#ifdef USE_SYSLOG
-#include <syslog.h>
-#endif
-
 #include "strlcpycat.h"
 
 #undef LOG_TO_STDERR
@@ -54,21 +50,6 @@
 	struct timeval new_time = { 0, 0 };
 	struct timeval tmp;
 	int delta;
-#ifdef USE_SYSLOG
-	int syslog_level;
-
-	switch(priority)
-	{
-		case PCSC_LOG_CRITICAL:
-			syslog_level = LOG_CRIT;
-			break;
-		case PCSC_LOG_ERROR:
-			syslog_level = LOG_ERR;
-			break;
-		default:
-			syslog_level = LOG_WARNING;
-	}
-#else
 	const char *color_pfx = "", *color_sfx = "";
 	const char *time_pfx = "", *time_sfx = "";
 	static int initialized = 0;
@@ -124,7 +105,6 @@
 				break;
 		}
 	}
-#endif
 
 	gettimeofday(&new_time, NULL);
 	if (0 == last_time.tv_sec)
@@ -148,13 +128,9 @@
 	(void)vsnprintf(debug_buffer, sizeof debug_buffer, fmt, argptr);
 	va_end(argptr);
 
-#ifdef USE_SYSLOG
-	syslog(syslog_level, "%.8d %s", delta, debug_buffer);
-#else
 	(void)fprintf(LOG_STREAM, "%s%.8d%s %s%s%s\n", time_pfx, delta, time_sfx,
 		color_pfx, debug_buffer, color_sfx);
 	fflush(LOG_STREAM);
-#endif
 } /* log_msg */
 
 void log_xxd(const int priority, const char *msg, const unsigned char *buffer,
@@ -176,10 +152,6 @@
 		c += 3;
 	}
 
-#ifdef USE_SYSLOG
-	syslog(LOG_WARNING, "%s", debug_buffer);
-#else
 	(void)fprintf(LOG_STREAM, "%s\n", debug_buffer);
 	fflush(LOG_STREAM);
-#endif
 } /* log_xxd */

Modified: trunk/Drivers/ccid/src/debug.h
===================================================================
--- trunk/Drivers/ccid/src/debug.h	2015-03-23 08:32:50 UTC (rev 7103)
+++ trunk/Drivers/ccid/src/debug.h	2015-03-24 09:29:22 UTC (rev 7104)
@@ -96,7 +96,5 @@
 /* DEBUG_XXD */
 #define DEBUG_XXD(msg, buffer, size) if (LogLevel & DEBUG_LEVEL_COMM) LogXxd(PCSC_LOG_DEBUG, msg, buffer, size)
 
-#define DEBUG_XXD_APPLE(msg, buffer, size) if (DriverOptions & DRIVER_OPTION_LOG) LogXxd(PCSC_LOG_DEBUG, msg, buffer, size)
-
 #endif
 

Modified: trunk/Drivers/ccid/src/ifdhandler.c
===================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c	2015-03-23 08:32:50 UTC (rev 7103)
+++ trunk/Drivers/ccid/src/ifdhandler.c	2015-03-24 09:29:22 UTC (rev 7104)
@@ -1218,9 +1218,6 @@
 			memcpy(Atr, pcbuffer, *AtrLength);
 			memcpy(CcidSlots[reader_index].pcATRBuffer, pcbuffer, *AtrLength);
 
-			/* Log ATR */
-			DEBUG_XXD_APPLE("ATR: ", Atr, *AtrLength);
-
 			/* initialise T=1 context */
 			(void)t1_init(&(get_ccid_slot(reader_index) -> t1), reader_index);
 			break;
@@ -1285,9 +1282,6 @@
 	DEBUG_INFO3("%s (lun: " DWORD_X ")", CcidSlots[reader_index].readerName,
 		Lun);
 
-	/* Log command */
-	DEBUG_XXD_APPLE("APDU: ", TxBuffer, TxLength);
-
 	/* special APDU for the Kobil IDToken (CLASS = 0xFF) */
 	if (KOBIL_IDTOKEN == get_ccid_descriptor(reader_index) -> readerID)
 	{
@@ -1347,9 +1341,6 @@
 	else
 		*RxLength = 0;
 
-	/* Log response */
-	DEBUG_XXD_APPLE("SW: ", RxBuffer, *RxLength);
-
 	return return_value;
 } /* IFDHTransmitToICC */
 




More information about the Pcsclite-cvs-commit mailing list