Hi,

This attached patch is to allow completely disable logging from the PKCS11 module. I think a production version should have such option.

Rgds.
Martin

diff -u -8 -r cvs\muscleapps\PKCS11/include/cryptoki.h 
muscleapps\PKCS11/include/cryptoki.h
--- cvs\muscleapps\PKCS11/include/cryptoki.h    2004-11-28 22:30:29.000000000 
+0800
+++ muscleapps\PKCS11/include/cryptoki.h        2005-07-19 17:06:07.312500000 
+0800
@@ -55,20 +55,20 @@
 /* #define P11_LOG(x,...)          log_Log(x,##__VA_ARGS__) */
 #else
 #define P11_LOG_START(x)
 #define P11_LOG_END(x)
 #define P11_ERR(x)
 /* #define P11_LOG(x,...) */
 #endif
 
-#define LOG_LOW     0
+#define LOG_LOW     0                  /* more details */
 #define LOG_MED     5
 #define LOG_HIGH    9
-
+#define LOG_NONE       10                      /* disable logging */
 
 /******************************************************************************
 ** Error checking macros
 ******************************************************************************/
 #define PCSC_ERROR_NOLOG(x)    ((x) != SCARD_S_SUCCESS)
 #define CKR_ERROR_NOLOG(x)     ((x) != CKR_OK)
 #define MSC_ERROR_NOLOG(x)     ((x) != MSC_SUCCESS)
 


diff -u -8 -r cvs\muscleapps\PKCS11/src/p11x_prefs.c 
muscleapps\PKCS11/src/p11x_prefs.c
--- cvs\muscleapps\PKCS11/src/p11x_prefs.c      2003-10-04 16:28:02.000000000 
+0800
+++ muscleapps\PKCS11/src/p11x_prefs.c  2005-07-20 09:32:16.453125000 +0800
@@ -71,18 +110,20 @@
             if (!token)
                 P11_ERR("Config option \"DebugLevel\" failed");
             else
             {
                 if (!strcasecmp("LOW", token))
                     st.prefs.log_level = LOG_LOW;
                 else if (!strcasecmp("MED", token))
                     st.prefs.log_level = LOG_MED;
-                else
+                else if (!strcasecmp("HIGH", token))
                     st.prefs.log_level = LOG_HIGH;
+                else
+                    st.prefs.log_level = LOG_NONE;
             }
         }
         else if (!strcasecmp("LogFilename", token))
         {
             token = strtok_r(0, sep, &strtok_ptr);
             if (!token)
                 P11_ERR("Config option \"LogFilename\" failed");
             else

--- cvs\muscleapps\PKCS11/pkcs11rc.example      2002-06-20 04:55:14.000000000 
+0800
+++ muscleapps\PKCS11\pkcs11rc.example  2005-07-20 10:56:04.328125000 +0800
@@ -1,16 +1,16 @@
 #
 # PKCS #11 sample config file (~/.pkcs11rc).  All of these options are
 # optional.  They will default to these values if no rc file is found.
 #
 # Please see the README file for more information about these options.
 #
 
-DebugLevel             = HIGH             # Only logs high priority messages
+DebugLevel             = NONE             # disable logging (LOW/MED/HIGH/NONE)
 LogFilename            = /tmp/PKCS11.log  # Name of log file (no spaces 
allowed)
 MultiApp               = False            # Multiple application support not 
enabled
 Threaded               = False            # Non-threaded operation
 SlotStatusThreadScheme = Partial          # We are in non-threaded mode so 
this is not used
 ObjectSortOrder        = NewestFirst      # Default mode
 CachePIN               = False            # No PIN caching (safer)
 Version                = 2.11             # PKCS #11 version 2.11
 MaxPinTries            = 8                # When personalizing token
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to