--- ./esc/src/lib/coolkey/NSSManager.cpp.fix6 2007-07-17 13:37:43.000000000 -0700 +++ ./esc/src/lib/coolkey/NSSManager.cpp 2007-07-17 13:38:40.000000000 -0700 @@ -46,11 +46,13 @@ static PRLogModuleInfo *coolKeyLogNSS = PR_NewLogModule("coolKeyNSS"); +unsigned int NSSManager::lastError; NSSManager::NSSManager() { char tBuff[56]; 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 @@ -111,6 +113,8 @@ if(!userModule || !userModule->loaded) { PR_LOG( coolKeyLogNSS, PR_LOG_ALWAYS, ("%s NSSManager::InitNSS problem loading PKCS11 module. No keys will be recognized!\n",GetTStamp(tBuff,56))); + + NSSManager::lastError = NSS_ERROR_LOAD_COOLKEY; return E_FAIL; } @@ -132,6 +136,7 @@ mpSCMonitoringThread = new SmartCardMonitoringThread(userModule); if (!mpSCMonitoringThread) { SECMOD_UnloadUserModule(userModule); + NSSManager::lastError = NSS_ERROR_SMART_CARD_THREAD; return E_FAIL; } mpSCMonitoringThread->Start(); --- ./esc/src/lib/coolkey/CoolKey.cpp.fix6 2007-07-17 13:37:29.000000000 -0700 +++ ./esc/src/lib/coolkey/CoolKey.cpp 2007-07-17 13:38:28.000000000 -0700 @@ -1325,7 +1325,10 @@ return E_FAIL; if(g_Log->IsInitialized()) + { + CoolKeyLogNSSStatus(); return S_OK; + } else return E_FAIL; } @@ -1348,6 +1351,35 @@ return S_OK; } +COOLKEY_API HRESULT CoolKeyLogNSSStatus() +{ + + char tBuff[56]; + if (g_NSSManager) + { + unsigned int error = g_NSSManager->GetLastInitError(); + + if(error == NSS_NO_ERROR) + { + CoolKeyLogMsg( PR_LOG_ALWAYS, "%s NSS system intialized successfully!\n",GetTStamp(tBuff,56)); + return S_OK; + } + + if(error == NSS_ERROR_LOAD_COOLKEY) + { + CoolKeyLogMsg( PR_LOG_ERROR, "%s Failed to load CoolKey module! Keys will not be recognized!\n",GetTStamp(tBuff,56)); + } + + if(error == NSS_ERROR_SMART_CARD_THREAD) + { + CoolKeyLogMsg( PR_LOG_ERROR, "%s Problem initializing the Smart Card thread! Keys will not be recognized!\n",GetTStamp(tBuff,56)); + } + } + + return S_OK; + +} + //Utility function to get Time Stamp char *GetTStamp(char *aTime,int aSize) { --- ./esc/src/lib/coolkey/NSSManager.h.fix6 2007-07-17 13:37:51.000000000 -0700 +++ ./esc/src/lib/coolkey/NSSManager.h 2007-07-17 13:38:43.000000000 -0700 @@ -26,6 +26,10 @@ #define PROMISCUOUS_PARAMETER "noAppletOK=yes" #define NSS_PUBLIC_CERTS "slotFlags=PublicCerts" +#define NSS_NO_ERROR 0 +#define NSS_ERROR_LOAD_COOLKEY 1 +#define NSS_ERROR_SMART_CARD_THREAD 2 + #ifndef NSSMANAGER_H #define NSSMANAGER_H @@ -70,11 +74,14 @@ static HRESULT GetKeyIssuer(const CoolKey *aKey, char *aBuf, int aBufLength); + static unsigned int GetLastInitError() { return lastError;} private: static bool IsCACert(CERTCertificate *cert); + static unsigned int lastError; + #ifdef LINUX PK11SlotInfo *systemCertDB; #endif --- ./esc/src/lib/coolkey/CoolKey.h.fix6 2007-07-17 13:37:35.000000000 -0700 +++ ./esc/src/lib/coolkey/CoolKey.h 2007-07-17 13:38:33.000000000 -0700 @@ -180,6 +180,7 @@ COOLKEY_API HRESULT CoolKeyLogMsg(int logLevel, const char *fmt, ...); +COOLKEY_API HRESULT CoolKeyLogNSSStatus(); //Utility time function char *GetTStamp(char *aTime,int aSize); --- ./esc/src/app/xul/esc/application.ini.fix6 2007-07-17 13:36:59.000000000 -0700 +++ ./esc/src/app/xul/esc/application.ini 2007-07-17 13:37:16.000000000 -0700 @@ -25,7 +25,7 @@ Name=ESC ; ; This field specifies your application's version. This field is optional. -Version=1.0.1-4 +Version=1.0.1-5 ; ; This field specifies your application's build ID (timestamp). This field is ; required.