783 lines
31 KiB
Diff
783 lines
31 KiB
Diff
--- ./esc/src/lib/coolkey/CoolKey.cpp.fix5 2007-06-20 11:41:52.000000000 -0700
|
|
+++ ./esc/src/lib/coolkey/CoolKey.cpp 2007-06-20 11:46:20.000000000 -0700
|
|
@@ -16,6 +16,7 @@
|
|
* END COPYRIGHT BLOCK **/
|
|
|
|
#define FORCE_PR_LOG 1
|
|
+#define LINE_BUF_SIZE 512
|
|
|
|
#include "SlotUtils.h"
|
|
|
|
@@ -46,6 +47,161 @@
|
|
HRESULT ClearActiveKeyList(void);
|
|
ActiveKeyNode *GetNodeInActiveKeyList(const CoolKey *aKey);
|
|
|
|
+class CoolKeyLogger {
|
|
+public:
|
|
+
|
|
+ CoolKeyLogger(char *logFileName, int maxNumLines);
|
|
+ ~CoolKeyLogger();
|
|
+
|
|
+ void LogMsg(int logLevel, const char *fmt, ...);
|
|
+ void LogMsg(int logLevel,const char *msg, va_list argp);
|
|
+
|
|
+ void init();
|
|
+
|
|
+ int IsInitialized() { return initialized; }
|
|
+
|
|
+private:
|
|
+
|
|
+ void LockLog();
|
|
+ void UnlockLog();
|
|
+
|
|
+ PRLock *logLock;
|
|
+
|
|
+ int maxLines;
|
|
+
|
|
+ char *pathName;
|
|
+ PRFileDesc *fd;
|
|
+
|
|
+ int initialized;
|
|
+
|
|
+};
|
|
+
|
|
+CoolKeyLogger::CoolKeyLogger(char *logFileName, int maxNumLines)
|
|
+{
|
|
+ fd = NULL;
|
|
+ logLock = NULL;
|
|
+
|
|
+ maxLines = maxNumLines;
|
|
+ if(logFileName)
|
|
+ pathName = strdup(logFileName);
|
|
+ initialized = 0;
|
|
+}
|
|
+
|
|
+CoolKeyLogger::~CoolKeyLogger()
|
|
+{
|
|
+ char tBuff[56];
|
|
+
|
|
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s ~CoolKeyLogger:\n",GetTStamp(tBuff,56)));
|
|
+ LockLog();
|
|
+
|
|
+ PR_Close(fd);
|
|
+
|
|
+ fd = NULL;
|
|
+
|
|
+ UnlockLog();
|
|
+
|
|
+ PR_DestroyLock(logLock);
|
|
+
|
|
+ logLock = NULL;
|
|
+
|
|
+ if(pathName)
|
|
+ free(pathName);
|
|
+
|
|
+ pathName = NULL;
|
|
+}
|
|
+
|
|
+void CoolKeyLogger::LockLog()
|
|
+{
|
|
+ PR_Lock(logLock);
|
|
+}
|
|
+
|
|
+void CoolKeyLogger::UnlockLog()
|
|
+{
|
|
+ PR_Unlock(logLock);
|
|
+}
|
|
+
|
|
+void CoolKeyLogger::init()
|
|
+{
|
|
+ char tBuff[56];
|
|
+
|
|
+ PRFileInfo info;
|
|
+
|
|
+ if( !pathName)
|
|
+ return;
|
|
+
|
|
+ logLock = PR_NewLock();
|
|
+
|
|
+ PRStatus rv = PR_GetFileInfo(pathName,&info);
|
|
+
|
|
+ int fileSize = 0;
|
|
+
|
|
+ if(rv == PR_SUCCESS)
|
|
+ {
|
|
+ fileSize = info.size;
|
|
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s File info size %d! \n",GetTStamp(tBuff,56),fileSize));
|
|
+ }
|
|
+
|
|
+ //Assume average line size of about 40
|
|
+
|
|
+ if((fileSize / 40) > maxLines)
|
|
+ {
|
|
+
|
|
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s Number of lines too big, truncate file %d! \n",GetTStamp(tBuff,56),fileSize / 80));
|
|
+
|
|
+ fd = PR_Open(pathName, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ fd = PR_Open(pathName, PR_WRONLY | PR_CREATE_FILE | PR_APPEND, 0600);
|
|
+ }
|
|
+
|
|
+ if(!fd)
|
|
+ return;
|
|
+
|
|
+ initialized = 1;
|
|
+
|
|
+ return;
|
|
+}
|
|
+
|
|
+void CoolKeyLogger::LogMsg(int logLevel, const char *fmt, ...)
|
|
+{
|
|
+ va_list ap;
|
|
+ char line[LINE_BUF_SIZE];
|
|
+
|
|
+ if(!initialized)
|
|
+ return;
|
|
+
|
|
+ va_start(ap, fmt);
|
|
+
|
|
+ int end = PR_vsnprintf(line, sizeof(line)-1, fmt, ap);
|
|
+
|
|
+ LockLog();
|
|
+
|
|
+ PR_Write(fd,line,end);
|
|
+
|
|
+ UnlockLog();
|
|
+
|
|
+ va_end(ap);
|
|
+}
|
|
+
|
|
+void CoolKeyLogger::LogMsg(int logLevel, const char *msg, va_list argp)
|
|
+{
|
|
+ char line[LINE_BUF_SIZE];
|
|
+
|
|
+ if(!initialized)
|
|
+ return;
|
|
+
|
|
+ int end = PR_vsnprintf(line, sizeof(line)-1, msg, argp);
|
|
+
|
|
+ LockLog();
|
|
+
|
|
+ PR_Write(fd,line,end);
|
|
+
|
|
+ UnlockLog();
|
|
+}
|
|
+
|
|
+static CoolKeyLogger *g_Log = NULL;
|
|
+
|
|
COOLKEY_API HRESULT CoolKeyInit(const char *aAppDir)
|
|
{
|
|
char tBuff[56];
|
|
@@ -92,6 +248,9 @@
|
|
g_NSSManager = 0;
|
|
}
|
|
|
|
+ if(g_Log)
|
|
+ delete g_Log ;
|
|
+
|
|
return S_OK;
|
|
}
|
|
|
|
@@ -903,7 +1062,7 @@
|
|
|
|
assert(cardCtxt);
|
|
if (!cardCtxt) {
|
|
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't create Card Context !.\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't create Card Context !.\n",GetTStamp(tBuff,56));
|
|
result = E_FAIL;
|
|
goto done;
|
|
}
|
|
@@ -911,7 +1070,7 @@
|
|
conn = CKYCardConnection_Create(cardCtxt);
|
|
assert(conn);
|
|
if (!conn) {
|
|
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't create Card Connection!\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't create Card Connection!\n",GetTStamp(tBuff,56));
|
|
result = E_FAIL;
|
|
goto done;
|
|
}
|
|
@@ -919,14 +1078,14 @@
|
|
readerName = GetReaderNameForKeyID(aKey);
|
|
assert(readerName);
|
|
if (!readerName) {
|
|
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't get reader name!\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't get reader name!\n",GetTStamp(tBuff,56));
|
|
result = E_FAIL;
|
|
goto done;
|
|
}
|
|
|
|
status = CKYCardConnection_Connect(conn, readerName);
|
|
if (status != CKYSUCCESS) {
|
|
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't connect to Card!\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't connect to Card!\n",GetTStamp(tBuff,56));
|
|
|
|
result = E_FAIL;
|
|
goto done;
|
|
@@ -938,7 +1097,7 @@
|
|
apduRC = 0;
|
|
status = CKYApplet_SelectCoolKeyManager(conn, &apduRC);
|
|
if (status != CKYSUCCESS) {
|
|
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't select CoolKey manager!\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't select CoolKey manager!\n",GetTStamp(tBuff,56));
|
|
goto done;
|
|
}
|
|
|
|
@@ -946,7 +1105,7 @@
|
|
&apduRC);
|
|
if(status != CKYSUCCESS)
|
|
{
|
|
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Error actually getting IssuerInfo!\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Error actually getting IssuerInfo!\n",GetTStamp(tBuff,56));
|
|
result = E_FAIL;
|
|
goto done;
|
|
}
|
|
@@ -1153,6 +1312,42 @@
|
|
return res;
|
|
}
|
|
|
|
+HRESULT CoolKeyInitializeLog(char *logFileName, int maxNumLines)
|
|
+{
|
|
+ if(g_Log)
|
|
+ return S_OK;
|
|
+
|
|
+ g_Log = new CoolKeyLogger(logFileName,maxNumLines);
|
|
+
|
|
+ if(g_Log)
|
|
+ g_Log->init();
|
|
+ else
|
|
+ return E_FAIL;
|
|
+
|
|
+ if(g_Log->IsInitialized())
|
|
+ return S_OK;
|
|
+ else
|
|
+ return E_FAIL;
|
|
+}
|
|
+
|
|
+HRESULT CoolKeyLogMsg(int logLevel, const char *fmt, ...)
|
|
+{
|
|
+
|
|
+ if(!g_Log)
|
|
+ return S_OK;
|
|
+
|
|
+ va_list ap;
|
|
+
|
|
+
|
|
+ va_start(ap, fmt);
|
|
+
|
|
+ g_Log->LogMsg(logLevel,fmt,ap);
|
|
+
|
|
+ va_end(ap);
|
|
+
|
|
+ return S_OK;
|
|
+}
|
|
+
|
|
//Utility function to get Time Stamp
|
|
char *GetTStamp(char *aTime,int aSize)
|
|
{
|
|
--- ./esc/src/lib/coolkey/CoolKey.h.fix5 2007-06-20 11:42:04.000000000 -0700
|
|
+++ ./esc/src/lib/coolkey/CoolKey.h 2007-06-20 11:46:37.000000000 -0700
|
|
@@ -176,6 +176,11 @@
|
|
|
|
COOLKEY_API int CoolKeyGetAppletVer(const CoolKey *aKey, const bool isMajor);
|
|
|
|
+COOLKEY_API HRESULT CoolKeyInitializeLog(char *logFileName, int maxNumLines);
|
|
+
|
|
+COOLKEY_API HRESULT CoolKeyLogMsg(int logLevel, const char *fmt, ...);
|
|
+
|
|
+
|
|
//Utility time function
|
|
char *GetTStamp(char *aTime,int aSize);
|
|
}
|
|
--- ./esc/src/lib/coolkey/CoolKeyHandler.cpp.fix5 2007-06-20 11:42:18.000000000 -0700
|
|
+++ ./esc/src/lib/coolkey/CoolKeyHandler.cpp 2007-06-20 11:46:26.000000000 -0700
|
|
@@ -453,7 +453,7 @@
|
|
const char *readerName = NULL;
|
|
|
|
if (!aKey || aKey->mKeyType != eCKType_CoolKey || !aKey->mKeyID) {
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Insuficient input parameters. \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Insuficient input parameters. \n",GetTStamp(tBuff,56));
|
|
goto done;
|
|
}
|
|
|
|
@@ -466,14 +466,14 @@
|
|
|
|
|
|
if (!readerName) {
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannot locate card reader name! \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannot locate card reader name! \n",GetTStamp(tBuff,56));
|
|
goto done;
|
|
}
|
|
|
|
mDataLock = PR_NewLock();
|
|
if (!mDataLock)
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannnot initialize internal locking mechanism.\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannnot initialize internal locking mechanism.\n",GetTStamp(tBuff,56));
|
|
return E_FAIL;
|
|
|
|
}
|
|
@@ -481,7 +481,7 @@
|
|
mDataCondVar = PR_NewCondVar(mDataLock);
|
|
if (!mDataCondVar)
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannot initialize internal syncronization mechanism.\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannot initialize internal syncronization mechanism.\n",GetTStamp(tBuff,56));
|
|
return E_FAIL;
|
|
|
|
}
|
|
@@ -493,7 +493,7 @@
|
|
|
|
if(!mCharHostName || !mRAUrl)
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Didn't collect proper config information.\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Didn't collect proper config information.\n",GetTStamp(tBuff,56));
|
|
error_no = config_error_no;
|
|
goto done;
|
|
}
|
|
@@ -502,7 +502,7 @@
|
|
|
|
mCardContext = CKYCardContext_Create(SCARD_SCOPE_USER);
|
|
if (!mCardContext) {
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannot create card context! \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannot create card context! \n",GetTStamp(tBuff,56));
|
|
error_no = CARD_CONTEXT_ERROR;
|
|
goto done;
|
|
}
|
|
@@ -510,7 +510,7 @@
|
|
mPDUWriter = new PDUWriterThread(this);
|
|
if (!mPDUWriter) {
|
|
error_no = PDU_WRITER_ERROR;
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannot create internal PDU writer thread!\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannot create internal PDU writer thread!\n",GetTStamp(tBuff,56));
|
|
goto done;
|
|
}
|
|
|
|
@@ -581,7 +581,7 @@
|
|
|
|
if(!keyID)
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR,("%s Collecting CoolKey preferences. Cannot get keyID , cannot proceed. \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR,"%s Collecting CoolKey preferences. Cannot get keyID , cannot proceed. \n",GetTStamp(tBuff,56));
|
|
|
|
return;
|
|
}
|
|
@@ -621,7 +621,7 @@
|
|
|
|
if(!tps_url)
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Collecting CoolKey preferences. Cannot find value for the TPS URL. \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Collecting CoolKey preferences. Cannot find value for the TPS URL. \n",GetTStamp(tBuff,56));
|
|
|
|
return;
|
|
}
|
|
@@ -651,7 +651,7 @@
|
|
pos = tps_url_str.find(non_ssl_str,0);
|
|
if(pos == string::npos)
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Collecting CoolKey preferences. TPS URL has specified an illegal protocol! \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Collecting CoolKey preferences. TPS URL has specified an illegal protocol! \n",GetTStamp(tBuff,56));
|
|
return;
|
|
}
|
|
|
|
@@ -692,7 +692,7 @@
|
|
|
|
if(!host_name_port_str.length())
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Collecting CoolKey preferences. Bad hostname and port value!.\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg(PR_LOG_ERROR, "%s Collecting CoolKey preferences. Bad hostname and port value!.\n",GetTStamp(tBuff,56));
|
|
return;
|
|
}
|
|
|
|
@@ -1198,7 +1198,7 @@
|
|
PR_LOG( coolKeyLogHN, PR_LOG_DEBUG, ("%s CoolKeyHandler::ProcessTokenPDU:\n",GetTStamp(tBuff,56)));
|
|
if(!req || !context)
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Processing HTTP message. Bad input data. \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Processing HTTP message. Bad input data. \n",GetTStamp(tBuff,56));
|
|
return;
|
|
}
|
|
|
|
@@ -1210,7 +1210,7 @@
|
|
|
|
if(size == 0)
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Processing HTTP message. Can't extract PDU data from message! \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg(PR_LOG_ERROR, "%s Processing HTTP message. Can't extract PDU data from message! \n",GetTStamp(tBuff,56));
|
|
context->HttpDisconnect();
|
|
return;
|
|
}
|
|
@@ -1231,10 +1231,10 @@
|
|
CKYStatus status = CKYCardConnection_ExchangeAPDU(context->GetCardConnection(),
|
|
requestAPDU, &response);
|
|
if (status != CKYSUCCESS) {
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR,
|
|
- ("%s Processing HTTP message. Can't write apdu to card! status %d response[0] %x response[1] %x error %d \n"
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR,
|
|
+ "%s Processing HTTP message. Can't write apdu to card! status %d response[0] %x response[1] %x error %d \n"
|
|
,GetTStamp(tBuff,56) ,status,CKYBuffer_GetChar(&response,0),CKYBuffer_GetChar(&response,1),
|
|
- CKYCardConnection_GetLastError(context->GetCardConnection())));
|
|
+ CKYCardConnection_GetLastError(context->GetCardConnection()));
|
|
|
|
context->HttpDisconnect(ERR_CONN_TOKEN);
|
|
|
|
@@ -1248,7 +1248,7 @@
|
|
|
|
if(pduSizeRet == 0 || !pduDataRet )
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Processing HTTP message. No PDU response from card! \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Processing HTTP message. No PDU response from card! \n",GetTStamp(tBuff,56));
|
|
context->HttpDisconnect(ERR_CONN_TOKEN);
|
|
return;
|
|
}
|
|
@@ -1267,7 +1267,7 @@
|
|
|
|
if(res == 0)
|
|
{
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Processing HTTP message. Write back to TPS failed , disconnecting. \n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Processing HTTP message. Write back to TPS failed , disconnecting. \n",GetTStamp(tBuff,56));
|
|
context->HttpDisconnect();
|
|
}
|
|
else
|
|
@@ -1619,32 +1619,33 @@
|
|
case ENROLL:
|
|
if (result == 0) {
|
|
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Enrollment success.\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg(PR_LOG_ALWAYS,"%s Key Enrollment success.\n",GetTStamp(tBuff,56));
|
|
CoolKeyAuthenticate(context->GetAutoCoolKey(), context->GetPIN());
|
|
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_EnrollmentComplete,
|
|
context->GetScreenName() == NULL ? 1 : 0);
|
|
} else {
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Enrollment failure. Error: %d.\n",GetTStamp(tBuff,56),description));
|
|
+ CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Key Enrollment failure. Error: %d.\n",GetTStamp(tBuff,56),description);
|
|
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_EnrollmentError, description); // XXX: Need INIT_FAILED error code!
|
|
}
|
|
break;
|
|
case RESET_PIN:
|
|
if (result == 0) {
|
|
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Reset Password success.\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg(PR_LOG_ALWAYS,"%s Key Reset Password success.\n",GetTStamp(tBuff,56));
|
|
+
|
|
CoolKeyAuthenticate(context->GetAutoCoolKey(), context->GetPIN());
|
|
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_PINResetComplete, 0);
|
|
} else {
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Reset Password failure. Error: %d.\n",GetTStamp(tBuff,56),description));
|
|
+ CoolKeyLogMsg(PR_LOG_ALWAYS, "%s Key Reset Password failure. Error: %d.\n",GetTStamp(tBuff,56),description);
|
|
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_PINResetError, description); // XXX: Need PIN_RESET_FAILED error code!
|
|
}
|
|
break;
|
|
case FORMAT:
|
|
if (result == 0) {
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Format success.\n",GetTStamp(tBuff,56)));
|
|
+ CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Key Format success.\n",GetTStamp(tBuff,56));
|
|
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_FormatComplete, 0);
|
|
} else {
|
|
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Format failure. Error: %d.\n",GetTStamp(tBuff,56),description));
|
|
+ CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Key Format failure. Error: %d.\n",GetTStamp(tBuff,56),description);
|
|
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_FormatError, description); // XXX: Need FORMAT_FAILED error code!
|
|
}
|
|
break;
|
|
--- ./esc/src/app/xpcom/rhCoolKey.cpp.fix5 2007-06-20 11:39:16.000000000 -0700
|
|
+++ ./esc/src/app/xpcom/rhCoolKey.cpp 2007-06-20 11:43:35.000000000 -0700
|
|
@@ -726,6 +726,14 @@
|
|
|
|
}
|
|
|
|
+/* void CoolKeyInitializeLog (in string aPathName, in unsigned long aMaxLines); */
|
|
+NS_IMETHODIMP rhCoolKey::CoolKeyInitializeLog(const char *aPathName, PRUint32 aMaxLines)
|
|
+{
|
|
+ ::CoolKeyInitializeLog((char *)aPathName, aMaxLines);
|
|
+
|
|
+ return NS_OK;
|
|
+}
|
|
+
|
|
/* void CoolKeyLogMsg (in unsigned long aLogLevel, in string aMessage); */
|
|
NS_IMETHODIMP rhCoolKey::CoolKeyLogMsg(PRUint32 aLogLevel, const char *aMessage)
|
|
{
|
|
@@ -733,7 +741,8 @@
|
|
|
|
if(aMessage && ((PRLogModuleLevel) aLogLevel >= PR_LOG_NONE && aLogLevel <= PR_LOG_MAX))
|
|
{
|
|
- PR_LOG( coolKeyLog, (PRLogModuleLevel) aLogLevel, ("%s %s",GetTStamp(tBuff,56),aMessage));
|
|
+ ::CoolKeyLogMsg((PRLogModuleLevel) aLogLevel, "%s %s \n",GetTStamp(tBuff,56),aMessage);
|
|
+ PR_LOG( coolKeyLog, (PRLogModuleLevel) aLogLevel, ("%s %s",GetTStamp(tBuff,56),aMessage));
|
|
}
|
|
|
|
return NS_OK;
|
|
@@ -776,7 +785,7 @@
|
|
{
|
|
|
|
char tBuff[56];
|
|
- PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("%s Attempting to Enroll Key ,ID: %s \n",GetTStamp(tBuff,56),aKeyID));
|
|
+ ::CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Attempting to Enroll Key ,ID: %s \n",GetTStamp(tBuff,56),aKeyID);
|
|
|
|
CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID);
|
|
|
|
@@ -808,7 +817,7 @@
|
|
NS_IMETHODIMP rhCoolKey::ResetCoolKeyPIN(PRUint32 aKeyType, const char *aKeyID, const char *aScreenName, const char *aPIN, const char *aScreenNamePwd)
|
|
{
|
|
char tBuff[56];
|
|
- PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("%s Attempting to Reset Key PIN, ID: %s \n",GetTStamp(tBuff,56),aKeyID));
|
|
+ ::CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Attempting to Reset Key PIN, ID: %s \n",GetTStamp(tBuff,56),aKeyID);
|
|
CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID);
|
|
|
|
if (!node)
|
|
@@ -859,7 +868,7 @@
|
|
NS_IMETHODIMP rhCoolKey::FormatCoolKey(PRUint32 aKeyType, const char *aKeyID, const char *aEnrollmentType, const char *aScreenName, const char *aPIN, const char *aScreenNamePWord, const char *aTokenCode)
|
|
{
|
|
char tBuff[56];
|
|
- PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("%s Attempting to Format Key, ID: %s. ",GetTStamp(tBuff,56),aKeyID));
|
|
+ ::CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Attempting to Format Key, ID: %s. ",GetTStamp(tBuff,56),aKeyID);
|
|
CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID);
|
|
|
|
if (!node)
|
|
@@ -1203,7 +1212,7 @@
|
|
|
|
HRESULT res = CoolKeyGetIssuerInfo(&key, (char *)&issuerInfo,256);
|
|
|
|
- PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("%s Attempting to get the key's Issuer: Key: %s, Issuer %s. \n",GetTStamp(tBuff,56),aKeyID, (char *) issuerInfo));
|
|
+ ::CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Attempting to get the key's Issuer: Key: %s, Issuer %s. \n",GetTStamp(tBuff,56),aKeyID, (char *) issuerInfo);
|
|
|
|
if(res == S_OK)
|
|
{
|
|
--- ./esc/src/app/xpcom/rhICoolKey.idl.fix5 2007-06-20 11:39:32.000000000 -0700
|
|
+++ ./esc/src/app/xpcom/rhICoolKey.idl 2007-06-20 11:43:51.000000000 -0700
|
|
@@ -32,6 +32,7 @@
|
|
|
|
void rhCoolKeyUnSetNotifyCallback(in rhIKeyNotify jsNotify);
|
|
|
|
+ void CoolKeyInitializeLog(in string aPathName, in unsigned long aMaxLines);
|
|
void CoolKeyLogMsg(in unsigned long aLogLevel, in string aMessage);
|
|
void BlinkCoolKey(in unsigned long aKeyType, in string aKeyID,in unsigned long aRate,in unsigned long aDuration);
|
|
|
|
--- ./esc/src/app/xul/esc/application.ini.fix5 2007-06-20 11:39:57.000000000 -0700
|
|
+++ ./esc/src/app/xul/esc/application.ini 2007-06-20 13:12:31.000000000 -0700
|
|
@@ -25,7 +25,7 @@
|
|
Name=ESC
|
|
;
|
|
; This field specifies your application's version. This field is optional.
|
|
-Version=1.0.1-3
|
|
+Version=1.0.1-4
|
|
;
|
|
; This field specifies your application's build ID (timestamp). This field is
|
|
; required.
|
|
--- ./esc/src/app/xul/esc/chrome/content/esc/settings.xul.fix5 2007-06-20 11:40:31.000000000 -0700
|
|
+++ ./esc/src/app/xul/esc/chrome/content/esc/settings.xul 2007-06-20 11:45:03.000000000 -0700
|
|
@@ -25,8 +25,8 @@
|
|
title="&escTitle;"
|
|
onload="InitializeAdminBindingList()"
|
|
onunload="cleanup()"
|
|
- width ="730"
|
|
- height= "460"
|
|
+ width ="720"
|
|
+ height= "415"
|
|
name="admin"
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
--- ./esc/src/app/xul/esc/chrome/content/esc/ESC.js.fix5 2007-06-20 11:40:21.000000000 -0700
|
|
+++ ./esc/src/app/xul/esc/chrome/content/esc/ESC.js 2007-06-20 11:44:52.000000000 -0700
|
|
@@ -131,6 +131,9 @@
|
|
netkey = netkey.QueryInterface(Components.interfaces.rhICoolKey);
|
|
gNotify = new jsNotify;
|
|
netkey.rhCoolKeySetNotifyCallback(gNotify);
|
|
+
|
|
+ var logFileName = GetESCLogPathName("esc.log");
|
|
+ netkey.CoolKeyInitializeLog(logFileName, 1000);
|
|
} catch(e) {
|
|
MyAlert(getBundleString("errorUniversalXPConnect") + e);
|
|
}
|
|
@@ -167,33 +170,33 @@
|
|
|
|
var Status_Messages = new Array(
|
|
getBundleString("errorNone"),
|
|
- getBundleString("serverError"),
|
|
- getBundleString("errorProblemCommToken"),
|
|
+ getBundleString("errorInternalServer"),
|
|
+ getBundleString("errorInternalServer"),
|
|
getBundleString("errorProblemCommToken"),
|
|
getBundleString("errorProblemResetTokenPin"),
|
|
getBundleString("errorInternalServer"),
|
|
- getBundleString("errorInternalServer"),
|
|
+ getBundleString("errorLifeCyclePDU"),
|
|
getBundleString("errorTokenEnrollment"),
|
|
getBundleString("errorProblemCommToken"),
|
|
getBundleString("errorInternalServer"),
|
|
- getBundleString("errorCommCA"),
|
|
getBundleString("errorInternalServer"),
|
|
- getBundleString("errorResetPin"),
|
|
getBundleString("errorInternalServer"),
|
|
+ getBundleString("errorInternalServer"),
|
|
+ getBundleString("errorTermSecureConn"),
|
|
getBundleString("errorAuthFailure"),
|
|
getBundleString("errorInternalServer"),
|
|
getBundleString("errorTokenDisabled"),
|
|
- getBundleString("errorProblemCommToken"),
|
|
- getBundleString("errorInternalServer"),
|
|
+ getBundleString("errorSecureChannel"),
|
|
+ getBundleString("errorServerMisconfig"),
|
|
getBundleString("errorTokenUpgrade"),
|
|
getBundleString("errorInternalServer"),
|
|
- getBundleString("errorProblemCommToken"),
|
|
- getBundleString("errorInvalidTokenType"),
|
|
+ getBundleString("errorExternalAuth"),
|
|
getBundleString("errorInvalidTokenType"),
|
|
+ getBundleString("errorInvalidTokenTypeParams"),
|
|
getBundleString("errorCannotPublish"),
|
|
getBundleString("errorCommTokenDB"),
|
|
- getBundleString("errorTokenDisabled"),
|
|
- getBundleString("errorPinReset"),
|
|
+ getBundleString("errorTokenSuspended"),
|
|
+ getBundleString("errorPinResetable"),
|
|
getBundleString("errorConnLost"),
|
|
getBundleString("errorEntryTokenDB"),
|
|
getBundleString("errorNoTokenState"),
|
|
@@ -201,10 +204,10 @@
|
|
getBundleString("errorTokenUnusable"),
|
|
getBundleString("errorNoInactiveToken"),
|
|
getBundleString("errorProcessMultiTokens"),
|
|
+ getBundleString("errorTokenTerminated"),
|
|
getBundleString("errorInternalServer"),
|
|
- getBundleString("errorKeyRecoveryProcessed"),
|
|
getBundleString("errorKeyRecoveryFailed"),
|
|
- getBundleString("errorNoOperateLostToken"),
|
|
+ getBundleString("errorInternalServer"),
|
|
getBundleString("errorKeyArchival"),
|
|
getBundleString("errorConnTKS"),
|
|
getBundleString("errorFailUpdateTokenDB"),
|
|
@@ -559,9 +562,9 @@
|
|
|
|
function TestStatusMessages()
|
|
{
|
|
- for(i = 0 ; i < 48; i++)
|
|
+ for(i = 0 ; i < 49; i++)
|
|
{
|
|
- MyAlert(Status_Messages[i]);
|
|
+ MyAlert( i + " " + Status_Messages[i]);
|
|
}
|
|
}
|
|
|
|
@@ -4263,9 +4266,9 @@
|
|
|
|
var value = line.value;
|
|
|
|
- var colonIndex = value.indexOf(":");
|
|
+ //var colonIndex = value.indexOf(":");
|
|
|
|
- value = value.substring(colonIndex + 1);
|
|
+ //value = value.substring(colonIndex + 1);
|
|
|
|
lines.push(value);
|
|
} while(hasmore);
|
|
@@ -4484,3 +4487,29 @@
|
|
adminList.focus();
|
|
}
|
|
}
|
|
+
|
|
+function GetESCLogPathName(aName)
|
|
+{
|
|
+
|
|
+ if(!aName)
|
|
+ return null;
|
|
+
|
|
+ const logFileName = aName;
|
|
+
|
|
+ // Get executable directory
|
|
+
|
|
+ var file = Components.classes["@mozilla.org/file/directory_service;1"]
|
|
+ .getService(Components.interfaces.nsIProperties)
|
|
+ .get("ProfD", Components.interfaces.nsIFile);
|
|
+
|
|
+ file = file.parent;
|
|
+ file.append(logFileName);
|
|
+
|
|
+
|
|
+ //alert("LogPathName " + file.path);
|
|
+
|
|
+
|
|
+ return file.path;
|
|
+
|
|
+
|
|
+}
|
|
--- ./esc/src/app/xul/esc/chrome/locale/en-US/esc.properties.fix5 2007-06-20 11:40:51.000000000 -0700
|
|
+++ ./esc/src/app/xul/esc/chrome/locale/en-US/esc.properties 2007-06-20 11:45:50.000000000 -0700
|
|
@@ -85,40 +85,48 @@
|
|
#ESC Error Messages from TPS
|
|
errorNone=Operation Completed Successfully.
|
|
serverError=Smart Card Server error.
|
|
-errorProblemResetTokenPin=Internal Smart Card Server error.
|
|
-errorTokenEnrollment=Smart card enrollment error.
|
|
+errorProblemResetTokenPin=The Smart Card Server cannot reset your smart card's password.
|
|
+errorTokenEnrollment=The Smart Card Server cannot import the required certificates into your smart card.
|
|
+errorLifeCyclePDU=The Smart Card Server cannot finalize the enrollment of your smart card.
|
|
errorCommCA=Error communicating with the Certification Authority.
|
|
errorInternalServer=Internal Smart Card Server error.
|
|
errorResetPin=Error resetting the smart card's password.
|
|
errorInternalServer=Internal Smart Card Server error.
|
|
-errorAuthFailure=Smart Card Server authentication failure.
|
|
-errorTokenDisabled=Your smart card is listed as disabled.
|
|
-errorProblemCommToken=Problem communicating with the smart card.
|
|
-errorTokenUpgrade=Cannot upgrade smart card software.
|
|
-errorInvalidTokenType=Invalid smart card type.
|
|
-errorCannotPublish=Cannot publish smart card information.
|
|
-errorCommTokenDB=Cannot communicate with smart card database.
|
|
-errorPinReset=Cannot reset the password value for the smart card.
|
|
-errorConnLost=Connection to Smart Card Server.
|
|
-errorEntryTokenDB=Can not create entry for the smart card in the smart card database.
|
|
-errorNoTokenState=Smart card found to be in an inconsistent state.
|
|
-errorInvalidLostTokenReason=Invalid reason for lost smart card submitted.
|
|
-errorTokenUnusable=Smart card found to be unusable due to compromise.
|
|
-errorNoInactiveToken=No such inactive smart card found.
|
|
-errorProcessMultiTokens=Can not process more than one active smart card.
|
|
+errorAuthFailure=The Smart Card Server cannot validate your credentials. Please try again with the correct credentials.
|
|
+errorTokenDisabled=The Smart Card Server does not know about your smart card.
|
|
+errorSecureChannel=The Smart Card Server cannot establish a secure channel with the smart card.
|
|
+errorServerMisconfig=The Smart Card Server has not been configured correctly.
|
|
+errorProblemCommToken=Your smart card can not perform the operation requested by the Smart Card Server.
|
|
+errorExternalAuth=Your smart card cannot correctly identify the Smart Card Server.
|
|
+errorTokenUpgrade=The Smart Card Server cannot upgrade the software on your smart card.
|
|
+errorTermSecureConn=The Smart Card Server can not terminate the secure cummunications channel with the smart card.
|
|
+errorInvalidTokenType=The Smart Card Server does not recognize the requested type of card enrollment.
|
|
+errorInvalidTokenTypeParams=The Smart Card Server cannot process the requested type of enrollment due to a misconfiguration.
|
|
+errorCannotPublish=The Smart Card Server cannot publish your card's certificates to the certificate directory.
|
|
+errorCommTokenDB=The Smart Card Server cannot connect to its internal database.
|
|
+errorTokenSuspended=Your smart card has been suspended.
|
|
+errorPinResetable=You are not allowed to reset the password of this smart card.
|
|
+errorConnLost=The Smart Card Manager has lost the connection to the Smart Card Server.
|
|
+errorEntryTokenDB=The Smart Card Server cannot add your smart card to its internal database.
|
|
+errorNoTokenState=The Smart Card server does not recognize your smart card's current status.
|
|
+errorInvalidLostTokenReason=The Smart Card server cannot process your smart card which has been reported lost.
|
|
+errorTokenUnusable=The Smart Card Server cannot process your smart card which has been reported stolen.
|
|
+errorNoInactiveToken=The Smart Card Server cannot restore your smart card's security keys.
|
|
+errorProcessMultiTokens=The Smart Card Server has detected that you already have one enrolled smart card. The server only allows one enrolled card per user.
|
|
+errorTokenTerminated=The Smart Card Server can not process your smart card which is marked as terminated.
|
|
errorKeyRecoveryProcessed=Smart card key recovery has been processed.
|
|
-errorKeyRecoveryFailed=Smart card key recovery failed.
|
|
+errorKeyRecoveryFailed=The Smart Card Server can not restore the security keys onto your smart card.
|
|
errorNoOperateLostToken=Cannot process this smart card, which has been reported lost.
|
|
-errorKeyArchival=Smart card key archival error.
|
|
-errorConnTKS=Problem connecting to the Smart Card TKS Server.
|
|
-errorFailUpdateTokenDB=Failed to update smart card database.
|
|
-errorCertRevocation=Internal certificate revocation error discovered.
|
|
-errorNotOwnToken=User does not own this smart card.
|
|
-errorESCMisconfigured=Smart Card Manager has been misconfigured.
|
|
-errorESCNoCommCardReader=Smart Card Manager can't communicate with card reader.
|
|
-errorESCNoTokenSession=Smart Card Manager can't initiate session with smart card.
|
|
-errorESCNoTalkTPS=Smart Card Manager can't talk to Smart Card Server.
|
|
-errorESCNoTalkTokenReader=Smart Card Manager can't talk to smart card reader.
|
|
+errorKeyArchival=The Smart Card Server can not restore the security keys onto your smart card due to a server misconfiguration.
|
|
+errorConnTKS=The Smart Card server cannot contact its security key server,which is required for processing.
|
|
+errorFailUpdateTokenDB=The Smart Card Server cannot reset the status of your smart card.
|
|
+errorCertRevocation=The Smart Card Server cannot mark the security keys on your smart card as revoked.
|
|
+errorNotOwnToken=The Smart Card Server cannot process a smart card which you do not own.
|
|
+errorESCMisconfigured=The Smart Card Manager has been misconfigured.
|
|
+errorESCNoCommCardReader=The Smart Card Manager cannot initiate communications with the smart card.
|
|
+errorESCNoTokenSession=The Smart Card Manager cannot establish a communications session with the smart card.
|
|
+errorESCNoTalkTPS=The Smart Card Manager cannot initiate communications with the Smart Card Server.
|
|
+errorESCNoTalkTokenReader=The Smart Card Manager cannot finalize communications with the smart card.
|
|
#ESC text in general Alert messages
|
|
errorCoolKeyIsAuth=coolkey.GetCoolKeyIsAuthenticated() failed!
|
|
errorAuthCoolKey=coolkey.AuthenticateCoolKey failed!
|