Minor improvement to diagnostics logging.

This commit is contained in:
Jack Magne 2007-07-17 23:38:36 +00:00
parent 86550e2a91
commit 3216cd7d7b
2 changed files with 141 additions and 1 deletions

131
esc-1.0.1-log-fixes-1.patch Normal file
View File

@ -0,0 +1,131 @@
--- ./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.

View File

@ -1,6 +1,6 @@
Name: esc
Version: 1.0.1
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Enterprise Security Client Smart Card Client
License: GPL
URL: http://directory.fedora.redhat.com/wiki/CoolKey
@ -13,6 +13,7 @@ Patch2: firefox-1.1-nss-system-nspr.patch
Patch3: esc-1.0.1-admin-row-update.patch
Patch4: esc-1.0.1-ui-fixes-1.patch
Patch5: esc-1.0.1-log-fixes.patch
Patch6: esc-1.0.1-log-fixes-1.patch
BuildRequires: doxygen fontconfig-devel freetype-devel >= 2.1
BuildRequires: glib2-devel libIDL-devel atk-devel gtk2-devel libjpeg-devel
@ -68,6 +69,7 @@ cryptographic smartcards.
%patch3 -p1 -b .fix3
%patch4 -p1 -b .fix4
%patch5 -p1 -b .fix5
%patch6 -p1 -b .fix6
#Unpack xulrunner where esc expects it to be.
@ -165,6 +167,11 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/%{appdir}/esc.desktop
%doc %{docdir}/LICENSE
%preun
killall --exact -q escd
exit 0
%post
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
@ -178,6 +185,8 @@ if [ -x %{_bindir}/gtk-update-icon-cache ]; then
fi
%changelog
* Tue Jul 17 2007 Jack Magne <jmagne@redhat.com>- 1.0.1-5
- Further fixes to the diagnostics logging.
* Wed Jun 20 2007 Jack Magne <jmagne@redhat.com>- 1.0.1-4
- Fixes to the diagnostics log files and esc error messages.
* Thu Apr 26 2007 Jack Magne <jmagne@redhat.com>- 1.0.1-3