[SmartcardServices-Changes] [107] trunk/Tokend/PKCS11/GemaltoToken.cpp

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 2 02:05:59 PST 2010


Revision: 107
          http://trac.macosforge.org/projects/smartcardservices/changeset/107
Author:   ludovic.rousseau at gmail.com
Date:     2010-02-02 02:05:56 -0800 (Tue, 02 Feb 2010)
Log Message:
-----------
GemaltoToken::probe(): only use libraries that ends in ".dylib"
It is then easy to disable a PKCS#11 lib by changing its file name extension

Modified Paths:
--------------
    trunk/Tokend/PKCS11/GemaltoToken.cpp

Modified: trunk/Tokend/PKCS11/GemaltoToken.cpp
===================================================================
--- trunk/Tokend/PKCS11/GemaltoToken.cpp	2010-02-02 07:21:29 UTC (rev 106)
+++ trunk/Tokend/PKCS11/GemaltoToken.cpp	2010-02-02 10:05:56 UTC (rev 107)
@@ -310,6 +310,14 @@
 				if ((strcmp(dir_entry->d_name, ".") == 0) || (strcmp(dir_entry->d_name, "..") == 0))
 					continue;
 				
+				/* only use files ending with ".dylib" */
+#define VALID_FILE_EXTENSION ".dylib"
+				char *ext = dir_entry->d_name + strlen(dir_entry->d_name) - sizeof(VALID_FILE_EXTENSION)+1;
+				if (/* file name is at least as long as the extention */
+					ext > dir_entry->d_name
+					&& strcasecmp(ext, VALID_FILE_EXTENSION) != 0)
+					continue;
+
 				lib_name.append(dir_entry->d_name);
 				dlPath = lib_name.c_str();
 				log( "GemaltoToken::probe - Using %s PKCS#11 library\n", dlPath );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/smartcardservices-changes/attachments/20100202/f1792901/attachment.html>


More information about the SmartcardServices-Changes mailing list