[389-commits] esc/src/lib/coolkey CoolKey_Message.cpp, 1.3, 1.4 NSSManager.cpp, 1.6, 1.7 NSSManager.h, 1.5, 1.6 SmartCardMonitoringThread.cpp, 1.5, 1.6 SmartCardMonitoringThread.h, 1.1.1.1, 1.2

Jack Magne jmagne at fedoraproject.org
Tue Nov 17 23:44:39 UTC 2009


Author: jmagne

Update of /cvs/dirsec/esc/src/lib/coolkey
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv2183/lib/coolkey

Modified Files:
	CoolKey_Message.cpp NSSManager.cpp NSSManager.h 
	SmartCardMonitoringThread.cpp SmartCardMonitoringThread.h 
Log Message:
Merge errata changes to the trunk.


Index: CoolKey_Message.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/coolkey/CoolKey_Message.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CoolKey_Message.cpp	24 Feb 2007 02:19:44 -0000	1.3
+++ CoolKey_Message.cpp	17 Nov 2009 23:44:37 -0000	1.4
@@ -560,7 +560,12 @@
 
     string lPassword = getStringValue(pKey);
 
-    aOutputVal += sKey + delim1 + lScreenName + delim + pKey + delim1 + lPassword;
+    string ScreenName_encoded, Password_encoded;
+
+    URLEncode_str(lScreenName, ScreenName_encoded);
+    URLEncode_str(lPassword, Password_encoded);
+
+    aOutputVal += sKey + delim1 + ScreenName_encoded + delim + pKey + delim1 + Password_encoded;
 
     eCKMessage::encode(aOutputVal);
 }


Index: NSSManager.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/coolkey/NSSManager.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NSSManager.cpp	13 Jun 2009 23:44:52 -0000	1.6
+++ NSSManager.cpp	17 Nov 2009 23:44:37 -0000	1.7
@@ -53,9 +53,7 @@
     PR_LOG( coolKeyLogNSS, PR_LOG_DEBUG, ("%s NSSManager::NSSManager:\n",GetTStamp(tBuff,56)));
     mpSCMonitoringThread = NULL;
     NSSManager::lastError = NSS_NO_ERROR;
-#ifdef LINUX
     systemCertDB = NULL;
-#endif
 }
 
 NSSManager::~NSSManager()
@@ -118,21 +116,44 @@
         return E_FAIL;
     }
 
-#ifdef LINUX
-
     // Load our Linux only database
 
+    char modspec_alt[512];
+    // Load our alternate db, if provided. 
 
-    const char *modspec = "configdir='/etc/pki/nssdb' tokenDescripton='SystemDB' flags='readOnly'";
-    PK11SlotInfo *systemCertDB = SECMOD_OpenUserDB(modspec);
+    const char *alt_db = CoolKeyGetConfig("esc.global.alt.nss.db");
 
-    if(!systemCertDB)
+#ifdef LINUX
+
+    if(!alt_db)
     {
-        PR_LOG( coolKeyLogNSS, PR_LOG_ALWAYS, ("%s NSSManager::InitNSS problem loading Linux  System Cert Database!\n",GetTStamp(tBuff,56)));
+        alt_db = "/etc/pki/nssdb";
     }
+    PR_LOG( coolKeyLogNSS, PR_LOG_ALWAYS, ("%s NSSManager alt_db %s \n",GetTStamp(tBuff,56),alt_db));
 
 #endif
 
+    if(alt_db) 
+    {
+       if(strlen(alt_db) < 400 ) 
+       {
+           sprintf(modspec_alt, "configdir='%s' tokenDescription='SystemDB' flags='readOnly'",alt_db); 
+
+           PR_LOG( coolKeyLogNSS, PR_LOG_ALWAYS, ("%s NSSManager modspec_alt %s \n",GetTStamp(tBuff,56),modspec_alt));
+           systemCertDB = SECMOD_OpenUserDB(modspec_alt);
+
+           PR_LOG( coolKeyLogNSS, PR_LOG_ALWAYS, ("%s NSSManager systemCertDB %p \n",GetTStamp(tBuff,56),systemCertDB));
+
+           if(!systemCertDB)
+           {
+               PR_LOG( coolKeyLogNSS, PR_LOG_ALWAYS, ("%s NSSManager::InitNSS problem loading Alternate Cert Database!\n",GetTStamp(tBuff,56)));
+
+           }
+
+       }
+
+    } 
+
     mpSCMonitoringThread = new SmartCardMonitoringThread(userModule);
     if (!mpSCMonitoringThread) {
         SECMOD_UnloadUserModule(userModule);
@@ -157,16 +178,11 @@
   // Logout all tokens.
     PK11_LogoutAll();
 
-#ifdef LINUX
     if(systemCertDB)
     {
-        SECMOD_CloseUserDB(systemCertDB);
-
         PK11_FreeSlot(systemCertDB);
         systemCertDB = NULL;
     }
-
-#endif
 }
 
 bool 


Index: NSSManager.h
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/coolkey/NSSManager.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NSSManager.h	13 Jun 2009 23:44:52 -0000	1.5
+++ NSSManager.h	17 Nov 2009 23:44:37 -0000	1.6
@@ -15,6 +15,7 @@
  * All rights reserved.
  * END COPYRIGHT BLOCK **/
 
+
 #ifdef DARWIN 
 #define COOLKEY_PKCS11_LIBRARY   "/Library/Application Support/CoolKey/PKCS11/libcoolkeypk11.dylib"
 #else
@@ -84,9 +85,7 @@
 
    static unsigned int lastError;
 
-#ifdef LINUX
   PK11SlotInfo *systemCertDB;
-#endif
   SmartCardMonitoringThread *mpSCMonitoringThread;
 };
 


Index: SmartCardMonitoringThread.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/coolkey/SmartCardMonitoringThread.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SmartCardMonitoringThread.cpp	6 Jun 2009 00:23:13 -0000	1.5
+++ SmartCardMonitoringThread.cpp	17 Nov 2009 23:44:37 -0000	1.6
@@ -33,7 +33,7 @@
 static PRLogModuleInfo *coolKeyLogSC = PR_NewLogModule("coolKeySmart");
 
 SmartCardMonitoringThread::SmartCardMonitoringThread(SECMODModule *aModule)
-  : mModule(aModule), mThread(NULL)
+  : mModule(aModule), mThread(NULL), mGoingAway(0)
 {
     char tBuff[56];
     PR_LOG( coolKeyLogSC, PR_LOG_DEBUG, 
@@ -67,6 +67,7 @@
     PR_LOG( coolKeyLogSC, PR_LOG_DEBUG, 
           ("%s SmartCardMonitoringThread::Stop : \n",GetTStamp(tBuff,56)));
 
+    mGoingAway = 1;
     Interrupt();
 }
 
@@ -104,9 +105,9 @@
     char tBuff[56];
     PK11SlotInfo *slot;
 
-    #ifdef LINUX
-    sleep(3);
-    #endif
+    //Give the rest of the systems time to come up properly
+
+    PR_Sleep(PR_SecondsToInterval(3));
 
     PR_LOG( coolKeyLogSC, PR_LOG_DEBUG, 
          ("%s SmartCardMonitoringThread::Execute.\n",GetTStamp(tBuff,56)));
@@ -116,6 +117,7 @@
    /* PK11SlotList *sl =
 	PK11_FindSlotsByNames(mModule->dllName, NULL, NULL, PR_TRUE);
     PK11SlotListElement *sle;
+
  
     if (sl) {
 
@@ -142,6 +144,11 @@
 
             PR_LOG( coolKeyLogSC, PR_LOG_ERROR, 
               ("%s SmartCard thread event detected, but the slot is NULL.\n",GetTStamp(tBuff,56)));
+            if(!mGoingAway) {
+                PR_Sleep(PR_SecondsToInterval(2));
+                continue;
+            }
+
             break;
         }
 


Index: SmartCardMonitoringThread.h
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/coolkey/SmartCardMonitoringThread.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- SmartCardMonitoringThread.h	12 Jun 2006 23:39:52 -0000	1.1.1.1
+++ SmartCardMonitoringThread.h	17 Nov 2009 23:44:37 -0000	1.2
@@ -45,7 +45,8 @@
   void Remove(CoolKeyInfo *info);
 
   static void LaunchExecute(void *arg);
-  
+
+  int mGoingAway;  
   SECMODModule *mModule;
   PRThread* mThread;
   char* mCurrentActivation;




More information about the Fedora-directory-commits mailing list