Author: jmagne
Update of /cvs/dirsec/esc/src/app/xpcom
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12696
Modified Files:
CoolKeyCSP.cpp Makefile Makefile.moz rhCoolKey.cpp
rhICoolKey.idl
Log Message:
Update to latest
Index: CoolKeyCSP.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xpcom/CoolKeyCSP.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- CoolKeyCSP.cpp 12 Jun 2006 23:39:50 -0000 1.1.1.1
+++ CoolKeyCSP.cpp 13 Sep 2006 17:50:07 -0000 1.2
@@ -15,6 +15,8 @@
* All rights reserved.
* END COPYRIGHT BLOCK **/
+#define FORCE_PR_LOG 1
+
#include <string.h>
#include <windows.h>
//#include <wincrypt.h>
@@ -384,7 +386,7 @@
- PR_LOG( coolKeyCSPLog, 5, ("CoolKeyCSPListener::RhNotifyStateChange state %d
\n",aKeyState));
+ PR_LOG( coolKeyCSPLog, PR_LOG_DEBUG, ("CoolKeyCSPListener::RhNotifyStateChange
state %d \n",aKeyState));
AutoCoolKey key(aKeyType, aKeyID);
Index: Makefile
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xpcom/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Makefile 12 Jun 2006 23:39:50 -0000 1.1.1.1
+++ Makefile 13 Sep 2006 17:50:07 -0000 1.2
@@ -26,6 +26,9 @@
MOZ_SRCDIR=$(SOURCE_XP_DIR)/src/mozilla
MOZ_OBJDIR=$(DIST)/xulrunner_build
+ifeq ($(OS_ARCH),Linux)
+endif
+
all export install clean deploy args::
echo "***** Dropping into the Mozilla build environment ***** $(MOZ_OBJDIR)"
@@ -34,7 +37,8 @@
CORE_DIST=$(DIST) \
CORE_INC=$(CORE_INC) \
MOZ_SRCDIR=$(MOZ_SRCDIR) \
- MOZ_OBJDIR=$(MOZ_OBJDIR)
+ MOZ_OBJDIR=$(MOZ_OBJDIR) \
+
libs::
echo "***** Dropping into the Mozilla build environment ***** $(MOZ_OBJDIR)"
@@ -43,12 +47,14 @@
CORE_DIST=$(DIST) \
CORE_INC=$(CORE_INC) \
MOZ_SRCDIR=$(MOZ_SRCDIR) \
- MOZ_OBJDIR=$(MOZ_OBJDIR)
+ MOZ_OBJDIR=$(MOZ_OBJDIR) \
+
$(MAKE) -f Makefile.moz deploy \
OBJDIR=$(OBJDIR) \
CORE_DIST=$(DIST) \
CORE_INC=$(CORE_INC) \
MOZ_SRCDIR=$(MOZ_SRCDIR) \
- MOZ_OBJDIR=$(MOZ_OBJDIR)
+ MOZ_OBJDIR=$(MOZ_OBJDIR) \
+
Index: Makefile.moz
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xpcom/Makefile.moz,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Makefile.moz 12 Jun 2006 23:39:49 -0000 1.1.1.1
+++ Makefile.moz 13 Sep 2006 17:50:07 -0000 1.2
@@ -1,4 +1,4 @@
-# ***** BEGIN COPYRIGHT BLOCK *****
+
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
@@ -28,29 +28,25 @@
MDDEPDIR := $(OBJDIR)/.deps
DESTDIR = $(MOZ_OBJDIR)/install
+NO_DIST_INSTALL = 1
-include $(MOZ_OBJDIR)/config/autoconf.mk
-#include $(CORE_DEPTH)/esc/mozilla/config.mk
-
#XULRUNNER release bundle, taken from ftp site
DEPLOY_OBJDIR = $(CORE_DEPTH)/dist/$(OBJDIR)/esc_build
+XULRUNNER_ZIP_NAME = xulrunner-1.8.0.1.*.tar.gz
+XULRUNNER_BIN_PATH = $(MOZ_OBJDIR)/dist/xulrunner
+XULRUNNER_EXEC = xulrunner
ifeq ($(OS_ARCH), Darwin)
XULRUNNER_BIN_PATH = /Library/Frameworks/XUL.framework
XULRUNNER_EXEC = xulrunner-bin
XULRUNNER_FRAME_DEST = ESC.app/Contents/Frameworks/XUL.framework
XULRUNNER_FRAME_BASE = ESC.app/Contents/Frameworks
-else
-XULRUNNER_BIN_PATH = /opt/xulrunner/1.8.0.1/xulrunner
-DEPLOY_OBJDIR = $(CORE_DEPTH)/dist/$(OBJDIR)/esc_build
-XULRUNNER_EXEC = xulrunner
-XULRUNNER_FRAME_DEST = esc
endif
ifeq ($(OS_ARCH), WINNT)
-XULRUNNER_BIN_PATH = C:/"Program Files"/"Mozilla
XULRunner"/1.8.0.1/xulrunner
OS_LIBS += crypt32.lib
CSPSRCS = CoolKeyCSP.cpp
endif
@@ -75,7 +71,7 @@
# Ensure that the xpcom classes that we build
# do not export themselves
-DEFINES += -DXPCOM_GLUE $(GECKO_INCLUDES) -I$(CORE_INC)/ckymanager
-I$(CORE_INC)/httpchuncked
+DEFINES += -DXPCOM_GLUE $(GECKO_INCLUDES) -I$(CORE_INC)/ckymanager
-I$(CORE_INC)/httpchuncked -I./_xpidlgen
REQUIRES = string \
@@ -99,24 +95,26 @@
XPCOM_EXTRA = $(CORE_DIST)/lib/coolkeypk11.dll
ifeq ($(OS_ARCH),Linux)
-INSTALL_STUFF += $(CORE_DEPTH)/esc/app/gtk/CoolKeyLogo.gif
+INSTALL_STUFF +=
endif
-include $(topsrcdir)/config/config.mk
-
-all:: export libs deploy
+install::
+ifdef DESTDIR
+ $(NSINSTALL) $(DEPLOY_OBJDIR)/esc/* $(DESTDIR)
+endif
+all:: export libs
libs:: $(INSTALL_STUFF) rhCoolKey.h
#$(NSINSTALL) $(INSTALL_STUFF) $(DIST)/bin
- $(NSINSTALL) rhCoolKey.h $(DIST)/include/rhCoolKey
+ $(NSINSTALL) rhCoolKey.h $(CORE_INC)/include/rhCoolKey
clean::
rm -f Makefile.in
rm -rf $(DEPLOY_OBJDIR)
- rm -f $(CORE_DEPTH)/esc/app/xul/esc/test.zip
- rm -rf $(CORE_DEPTH)/esc/app/xul/esc/esc
+ rm -rf $(CORE_DEPTH)/src/app/xul/esc/esc
deploy: $(DEPLOY_OBJDIR)
echo "deploy! on $(OS_ARCH)"
@@ -161,28 +159,35 @@
$(DEPLOY_OBJDIR):
echo "Installing!"
- $(NSINSTALL) ./$(LIB_PREFIX)rhCoolKey$(DLL_SUFFIX)
$(CORE_DEPTH)/esc/app/xul/esc/components
- $(NSINSTALL) ./_xpidlgen/*.xpt $(CORE_DEPTH)/esc/app/xul/esc/components
+ $(NSINSTALL) ./$(LIB_PREFIX)rhCoolKey$(DLL_SUFFIX)
$(CORE_DEPTH)/src/app/xul/esc/components
+ $(NSINSTALL) ./_xpidlgen/*.xpt $(CORE_DEPTH)/src/app/xul/esc/components
echo "Creating $(DEPLOY_OBJDIR)"
mkdir $(DEPLOY_OBJDIR)
- cd $(CORE_DEPTH)/esc/app/xul/esc; zip -r test.zip * -x *\CVS\*; unzip -d esc test.zip
- $(XULRUNNER_BIN_PATH)/$(XULRUNNER_EXEC) --install-app $(CORE_DEPTH)/esc/app/xul/esc/esc
$(DEPLOY_OBJDIR)
+ cd $(CORE_DEPTH)/src/app/xul/esc; zip -r test.zip * -x *\CVS\* \*.fix*; unzip -d esc
test.zip ; rm -f test.zip
+ $(XULRUNNER_BIN_PATH)/$(XULRUNNER_EXEC) --install-app $(CORE_DEPTH)/src/app/xul/esc/esc
$(DEPLOY_OBJDIR)
ifeq ($(OS_ARCH), Darwin)
mkdir $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_BASE)
+ cp -Rf -v $(XULRUNNER_BIN_PATH) $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST)
# mkdir $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_BASE)/XUL.framework
endif
- cp -Rf -v $(XULRUNNER_BIN_PATH) $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST)
+ #cp -Rf -v $(XULRUNNER_BIN_PATH) $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST)
+
+ tar -xzvf $(MOZ_OBJDIR)/dist/$(XULRUNNER_ZIP_NAME) -C
$(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST)/esc
ifeq ($(OS_ARCH),WINNT)
cp -f $(XPCOM_EXTRA) $(DEPLOY_OBJDIR)/ESC/components
endif
+ifdef DESTDIR
+ $(NSINSTALL) $(DEPLOY_OBJDIR) $(DESTDIR)
+endif
-include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),WINNT)
IMPORT_LIBRARY=
endif
+
Index: rhCoolKey.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xpcom/rhCoolKey.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- rhCoolKey.cpp 12 Jun 2006 23:39:50 -0000 1.1.1.1
+++ rhCoolKey.cpp 13 Sep 2006 17:50:07 -0000 1.2
@@ -15,10 +15,11 @@
* All rights reserved.
* END COPYRIGHT BLOCK **/
+#define FORCE_PR_LOG 1
+
#include <stdio.h>
#include "rhCoolKey.h"
#include "CoolKey.h"
-#include "CoolKeyPref.h"
#include "nsMemory.h"
#include "nsXPCOM.h"
@@ -95,7 +96,7 @@
CoolKeyShutdownObserver::~CoolKeyShutdownObserver()
{
- PR_LOG( coolKeyLog, 5, ("CoolKeyShutdownObserver::~CoolKeyShutdownObserver
\n"));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG,
("CoolKeyShutdownObserver::~CoolKeyShutdownObserver \n"));
}
@@ -108,7 +109,7 @@
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
{
- PR_LOG( coolKeyLog, 5, ("CoolKeyShutdownObserver::Observe shutting
down"));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("CoolKeyShutdownObserver::Observe
shutting down"));
if(single)
{
@@ -167,7 +168,7 @@
rhCoolKey::rhCoolKey()
:mJsNotify(nsnull),mProxy(nsnull)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::rhCoolKey: %p \n",this));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::rhCoolKey: %p
\n",this));
if(!single)
{
@@ -187,7 +188,7 @@
if(res == PR_FALSE)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::rhCoolKey: InitInstance failed.
coolKey_instance %p\n",coolKey_instance));
+ PR_LOG( coolKeyLog, PR_LOG_ERROR, ("ESC InitInstance failed,exiting.
CoolKey instance %p\n",coolKey_instance));
exit(1);
}
@@ -199,17 +200,17 @@
{
/* destructor code */
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::~rhCoolKey: %p \n",this));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::~rhCoolKey: %p \n",this));
}
void rhCoolKey::ShutDownInstance()
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::ShutDownInstance. %p \n",this));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ShutDownInstance. %p
\n",this));
if (mProxy)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::ShutDownInstance: About to dereference
Proxy Object. Proxy %p \n",mProxy));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ShutDownInstance: About to
dereference Proxy Object. Proxy %p \n",mProxy));
CoolKeyUnregisterListener(mProxy);
@@ -307,11 +308,11 @@
{
PRBool ret = PR_TRUE;
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::InitInstance %p \n",this));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::InitInstance %p \n",this));
char *path = (char *) GRE_GetXPCOMPath();
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::GREPath %s \n",path));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GREPath %s \n",path));
char xpcom_path[512];
@@ -326,7 +327,7 @@
sprintf(xpcom_path,"%s/%s",path,lib_name);
#endif
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::xpcom_path %s \n",xpcom_path));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::xpcom_path %s
\n",xpcom_path));
XPCOMGlueStartup(xpcom_path);
@@ -346,7 +347,7 @@
}
else
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::InitInstance:Can't create proxy.
\n"));
+ PR_LOG( coolKeyLog, PR_LOG_ERROR, ("Can't create Proxy Object for ESC.
\n"));
}
@@ -402,7 +403,7 @@
observerService->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
} else {
- PR_LOG(coolKeyLog,5,("Could not get an observer service. We will leak on
shutdown."));
+ PR_LOG(coolKeyLog,PR_LOG_ERROR,("Could not get an observer service. We will
leak on shutdown."));
}
return ret;
@@ -414,7 +415,7 @@
rhICoolKey *proxyObject = NULL;
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::CreateProxyObject: \n"));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::CreateProxyObject: \n"));
nsCOMPtr<nsIProxyObjectManager> manager =
do_GetService(NS_XPCOMPROXY_CONTRACTID);
@@ -424,7 +425,7 @@
manager->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(rhICoolKey), this,
PROXY_SYNC | PROXY_ALWAYS, (void**)&proxyObject);
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::CreateProxyObject: original: %p proxy %p
\n",this,proxyObject));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::CreateProxyObject: original: %p
proxy %p \n",this,proxyObject));
return proxyObject;
@@ -433,12 +434,12 @@
CoolKeyNode* rhCoolKey::GetCoolKeyInfo(unsigned long aKeyType, const char * aKeyID)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetCoolKeyInfo: gASCAvailableKeys %p looking
for key %s type %d \n",&gASCAvailableKeys,aKeyID,aKeyType));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetCoolKeyInfo: gASCAvailableKeys
%p looking for key %s type %d \n",&gASCAvailableKeys,aKeyID,aKeyType));
std::list<CoolKeyNode*>::const_iterator it;
for(it=gASCAvailableKeys.begin(); it!=gASCAvailableKeys.end(); ++it) {
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetCoolKeyInfo: current key %s type %d,
looking for key %s type %d
\n",(*it)->mKeyID.get(),(*it)->mKeyType,aKeyID,aKeyType));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetCoolKeyInfo: current key %s
type %d, looking for key %s type %d
\n",(*it)->mKeyID.get(),(*it)->mKeyType,aKeyID,aKeyType));
if ((*it)->mKeyType == aKeyType && !strcmp((*it)->mKeyID.get(),
aKeyID))
return *it;
@@ -451,7 +452,7 @@
PRBool rhCoolKey::ASCCoolKeyIsAvailable(unsigned long aKeyType, char * aKeyID)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::ASCCoolKeyIsAvailable type %d id %s
\n",aKeyType,aKeyID));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ASCCoolKeyIsAvailable type %d id
%s \n",aKeyType,aKeyID));
return GetCoolKeyInfo(aKeyType, aKeyID) ? PR_TRUE : PR_FALSE;
}
@@ -461,7 +462,7 @@
nsEmbedCString *aKeyID)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::ASCGetAvailableCoolKeyAt: index %d type %d
id %s \n",aIndex,aKeyType,aKeyID));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ASCGetAvailableCoolKeyAt: index
%d type %d id %s \n",aIndex,aKeyType,aKeyID));
if (!aKeyType || !aKeyID)
return E_FAIL;
@@ -488,7 +489,7 @@
{
int size = (int) gASCAvailableKeys.size();
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::ASCGetNumAvailableCoolKeys %d
\n",size));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ASCGetNumAvailableCoolKeys %d
\n",size));
return size;
}
@@ -501,21 +502,21 @@
rhIKeyNotify* rhCoolKey::GetNotifyKeyListener(rhIKeyNotify *listener){
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetNotifyKeyListener: %p size %d
\n",listener,gNotifyListeners.size() ));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: %p size %d
\n",listener,gNotifyListeners.size() ));
std::list<nsCOMPtr<rhIKeyNotify> >::const_iterator it;
for(it=gNotifyListeners.begin(); it!=gNotifyListeners.end(); ++it) {
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetNotifyKeyListener: cur %p looking for
%p \n",(*it).get(),listener));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: cur %p
looking for %p \n",(*it).get(),listener));
if((*it) == listener)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetNotifyKeyListener: looking for %p
returning %p \n",listener,(*it).get()));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener:
looking for %p returning %p \n",listener,(*it).get()));
return (*it);
}
}
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetNotifyKeyListener: looking for %p
returning NULL. \n",listener));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: looking for
%p returning NULL. \n",listener));
return nsnull;
}
@@ -587,23 +588,19 @@
if (!node)
{
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::InsertKeyIntoAvailableList:
Can't create CoolKeyNode \n"));
+ PR_LOG( coolKeyLog, PR_LOG_ERROR, ("Can't create new CoolKey Data
Structure. \n"));
return;
-
}
-
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::InsertKeyIntoAvailableList: about
to add node to available key list.\n"));
gASCAvailableKeys.push_back(node);
-
}
void rhCoolKey::RemoveKeyFromAvailableList(unsigned long aKeyType, const char * aKeyID)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RemoveKeyFromAvailableList type %d id %s
\n",aKeyType,aKeyID));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RemoveKeyFromAvailableList type
%d id %s \n",aKeyType,aKeyID));
CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID);
if (!node)
@@ -615,7 +612,7 @@
void rhCoolKey::ClearAvailableList()
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::ClearAvailableList \n"));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ClearAvailableList \n"));
while (gASCAvailableKeys.size() > 0) {
CoolKeyNode *node = gASCAvailableKeys.front();
delete node;
@@ -625,7 +622,7 @@
HRESULT rhCoolKey::ASCSetCoolKeyPin(unsigned long aKeyType, const char * aKeyID, const
char * aPin)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::ASCSetCoolKeyPin type %d id %s pin %s
\n",aKeyType,aKeyID,aPin));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ASCSetCoolKeyPin type %d id %s pin
%s \n",aKeyType,aKeyID,aPin));
CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID);
if (!node)
return E_FAIL;
@@ -639,7 +636,7 @@
NS_IMETHODIMP rhCoolKey::RhNotifyKeyStateChange(PRUint32 aKeyType,const char *aKeyID,
PRUint32 aKeyState, PRUint32 aData,const char* strData)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhNotifyKeyStateChange: id: %s type: %d
state %d data: %d \n",aKeyID,aKeyType, aKeyState,aData));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange: id: %s
type: %d state %d data: %d \n",aKeyID,aKeyType, aKeyState,aData));
CoolKeyNode tempKey(aKeyType, aKeyID,(CoolKeyStatus) aKeyState);
CoolKeyNode *node = NULL;
@@ -657,12 +654,12 @@
if (CoolKeyIsEnrolled(&key))
keyStatus = eAKS_Available; else if (CoolKeyHasApplet(&key))
keyStatus = eAKS_Uninitialized;
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange:
Key Inserted. keyStatus %d \n",keyStatus));
+ PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Key Inserted. ID %s
\n",aKeyID));
InsertKeyIntoAvailableList(tempKey.mKeyType,aKeyID ,(CoolKeyStatus)
keyStatus);
break;
}
case eCKState_KeyRemoved:
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange: Key
Removed. \n"));
+ PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Key Removed. ID %s
\n",aKeyID));
RemoveKeyFromAvailableList(tempKey.mKeyType, aKeyID);
break;
case eCKState_EnrollmentComplete:
@@ -700,8 +697,6 @@
std::list< nsCOMPtr <rhIKeyNotify> >::const_iterator it;
for(it=gNotifyListeners.begin(); it!=gNotifyListeners.end(); ++it) {
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange
about to call RhNotifyKeyStateChange listener: %p",(*it).get()));
-
((rhIKeyNotify *)
(*it))->RhNotifyKeyStateChange(aKeyType,aKeyID,aKeyState,aData,strData);
PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange
after call to RhNotifyKeyStateChange listener: %p",(*it).get()));
@@ -709,100 +704,33 @@
}
- // Do any post processing:
-
- switch (aKeyState)
- {
- case eCKState_KeyInserted:
- if (gAutoEnrollBlankTokens && !CoolKeyIsEnrolled(&key))
- //ASCEnrollCoolKey(aKey->mKeyType, keyID, "housekey"), NULL,
NULL,NULL,NULL);
- break;
- }
-
- return NS_OK;
-
+ return NS_OK;
}
NS_IMETHODIMP rhCoolKey::RhCoolKeyUnSetNotifyCallback(rhIKeyNotify *jsNotify)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback Object: input
%p this %p \n",jsNotify,this));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback
Object: input %p this %p \n",jsNotify,this));
RemoveNotifyKeyListener(jsNotify);
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback Object: removed
listener, size now %d \n",GetNotifyKeyListenerListSize()));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback
Object: removed listener, size now %d \n",GetNotifyKeyListenerListSize()));
if(GetNotifyKeyListenerListSize() == 0)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback Object:
input %p this %p Listener size 0. \n",jsNotify,this));
-
- /* if(mProxy)
- {
-
- CoolKeyUnregisterListener(mProxy);
- NS_RELEASE(mProxy);
- mProxy = nsnull;
-
- }
-*/
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback
Object: input %p this %p Listener size 0. \n",jsNotify,this));
}
-
-/*
- if(!jsNotify || !mJsNotify)
- {
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback: KeyNotify
already unset. \n"));
- return NS_OK;
-
- }
-
- if(jsNotify == mJsNotify)
- {
- mJsNotify = nsnull;
-
- if(mProxy)
- {
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback: About
to dereference Proxy Object. Proxy %p \n",mProxy));
-
- CoolKeyUnregisterListener(mProxy);
-
- NS_RELEASE(mProxy);
-
- mProxy = nsnull;
- }
-
- }
- else
- {
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback: Input
Notify Object not equal to member property. \n"));
- }
-
-*/
-
return NS_OK;
}
NS_IMETHODIMP rhCoolKey::RhCoolKeySetNotifyCallback(rhIKeyNotify *jsNotify)
{
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCoolKeySetNotifyCallback
Object: %p this %p\n",jsNotify,this));
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeySetNotifyCallback Object: %p this
%p\n",jsNotify,this));
-
-
- AddNotifyKeyListener(jsNotify);
-
-
- /* if(!jsNotify || mJsNotify)
- {
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeySetNotifyCallback: returning
error. \n"));
- return NS_ERROR_FAILURE;
-
- }
-
- mJsNotify = jsNotify;
-
-*/
+ AddNotifyKeyListener(jsNotify);
return NS_OK;
@@ -817,14 +745,12 @@
if (!node)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhBlinkCoolKey: GetCoolKeyInfo failed.
\n"));
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhBlinkCoolKey: GetCoolKeyInfo
failed. \n"));
return NS_ERROR_FAILURE;
}
-
if (!aKeyID)
{
- PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhBlinkCoolKey: aKeyID is null. \n"));
return NS_ERROR_FAILURE ;
}
@@ -846,7 +772,7 @@
NS_IMETHODIMP rhCoolKey::EnrollCoolKey(PRUint32 aKeyType, const char *aKeyID, const char
*aEnrollmentType, const char *aScreenName, const char *aPin, const char *aScreenNamePWord,
const char *aTokenCode)
{
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhEnrollCoolKey thread: %p
\n",PR_GetCurrentThread()));
+ PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to Enroll Key ,ID: %s
\n",aKeyID));
CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID);
@@ -870,7 +796,6 @@
return NS_OK;
}
-
return NS_OK;
}
@@ -879,7 +804,7 @@
NS_IMETHODIMP rhCoolKey::ResetCoolKeyPIN(PRUint32 aKeyType, const char *aKeyID, const
char *aScreenName, const char *aPIN, const char *aScreenNamePwd)
{
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhResetCoolKeyPIN thread: %p
\n",PR_GetCurrentThread()));
+ PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to Reset Key PIN, ID: %s
\n",aKeyID));
CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID);
if (!node)
@@ -923,7 +848,7 @@
NS_IMETHODIMP rhCoolKey::RenewCoolKey(PRUint32 aKeyType, const char *aKeyID)
{
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhRenewCoolKey (not implemented)
thread: %p \n",PR_GetCurrentThread()));
+ PR_LOG( coolKeyLog, PR_LOG_ERROR, ("rhCoolKey::RhRenewCoolKey (not implemented)
thread: %p \n",PR_GetCurrentThread()));
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -932,7 +857,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)
{
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhFormatCoolKey thread: %p
\n",PR_GetCurrentThread()));
+ PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to Format Key, ID: %s.
",aKeyID));
CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID);
if (!node)
@@ -975,7 +900,6 @@
NS_IMETHODIMP rhCoolKey::CancelCoolKeyOperation(PRUint32 aKeyType, const char *aKeyID)
{
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCancelCoolKeyOperation thread:
%p \n",PR_GetCurrentThread()));
CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID);
if (!node)
@@ -983,14 +907,14 @@
PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCancelCoolKeyOperation type %d
id %s status %d: \n",aKeyType,aKeyID,node->mStatus));
+
// If the key isn't busy, then there's nothing to do.
if (node->mStatus != eAKS_EnrollmentInProgress &&
node->mStatus != eAKS_UnblockInProgress &&
node->mStatus != eAKS_PINResetInProgress &&
node->mStatus != eAKS_RenewInProgress &&
- node->mStatus != eAKS_FormatInProgress) // &&
- // node->mStatus != eAKS_BlinkInProgress)
+ node->mStatus != eAKS_FormatInProgress)
return NS_OK;
AutoCoolKey key(aKeyType, aKeyID);
@@ -1008,7 +932,6 @@
NS_IMETHODIMP rhCoolKey::GetCoolKeyCertNicknames(PRUint32 aKeyType, const char *aKeyID,
PRUint32 *count, char ***str)
{
-
if(!aKeyID || !count)
{
return NS_ERROR_FAILURE;
@@ -1065,7 +988,6 @@
NS_IMETHODIMP rhCoolKey::GetAvailableCoolKeys(PRUint32 *count, char ***str)
{
-
PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhGetAvailableCoolKeys thread: %p
\n",PR_GetCurrentThread()));
if(!count || !str)
@@ -1077,12 +999,11 @@
long numKeys = ASCGetNumAvailableCoolKeys();
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhGetAvailableCoolKeys num keys
found: %d \n",numKeys));
+ PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to get number of keys. Value:
%d \n",numKeys));
if(numKeys == 0)
{
return NS_OK;
-
}
array = (char **) nsMemory::Alloc((sizeof(char *) * numKeys));
@@ -1103,8 +1024,6 @@
const char *id = keyID.get();
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhGetAvailableCoolKeys iter
%d id %s\n",i,id));
-
array[i] = NULL;
if(id)
@@ -1141,7 +1060,6 @@
*_retval = eAKS_Unavailable;
}
-
PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhGetCoolKeyStatus retval: %d
\n",*_retval));
@@ -1185,15 +1103,38 @@
{
char *info = (char *) certInfo.c_str();
-
char *temp = (char *) nsMemory::Clone(info,sizeof(char) * strlen(info) + 1);
-
*aCertInfo = temp;
-
}
return NS_OK;
}
+
+
+/* string GetCoolKeyIssuerInfo (in unsigned long aKeyType, in string aKeyID); */
NS_IMETHODIMP rhCoolKey::GetCoolKeyIssuerInfo(PRUint32 aKeyType, const char *aKeyID, char
**_retval)
+ {
+
+ *_retval = NULL;
+
+ AutoCoolKey key(aKeyType, aKeyID);
+
+ char issuerInfo[256];
+
+ HRESULT res = CoolKeyGetIssuerInfo(&key, (char *)&issuerInfo,256);
+
+ PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to get the key's Issuer:
Key: %s, Issuer %s. \n",aKeyID, (char *) issuerInfo));
+
+ if(res == S_OK)
+ {
+ char *temp = (char *) nsMemory::Clone(issuerInfo,sizeof(char) * strlen((char
*)issuerInfo) + 1);
+ *_retval = temp;
+
+ }
+ return NS_OK;
+
+ }
+
+
/* void rhGetCoolKeyPolicy (in unsigned long aKeyType, in string aKeyID, out string
policy); */
NS_IMETHODIMP rhCoolKey::GetCoolKeyPolicy(PRUint32 aKeyType, const char *aKeyID, char
**policy)
{
@@ -1207,7 +1148,6 @@
char policyChar[MAX_STR_LEN] ;
policyChar[0] = 0;
-
AutoCoolKey key(aKeyType, aKeyID);
HRESULT hres = CoolKeyGetPolicy(&key, policyChar, MAX_STR_LEN);
@@ -1226,12 +1166,45 @@
return NS_OK;
}
+
+/* string GetCoolKeyIssuedTo (in unsigned long aKeyType, in string aKeyID); */
+NS_IMETHODIMP rhCoolKey::GetCoolKeyIssuedTo(PRUint32 aKeyType, const char *aKeyID, char
**issuedTo)
+{
+ if (!aKeyID) {
+ return NS_ERROR_FAILURE;
+ }
+
+ AutoCoolKey key(aKeyType, ( char *)aKeyID);
+
+ // const char *keyName = CoolKeyGetTokenName(&key);
+
+ char buff[512];
+ int bufLength = 512;
+ buff[0] = 0;
+
+ CoolKeyGetIssuedTo(&key, (char *) buff, bufLength);
+
+
+ if(!buff[0])
+ {
+ return NS_OK;
+ }
+
+ PR_LOG(coolKeyLog,PR_LOG_DEBUG,("rhCoolKey::RhGetCoolKeyGetIssuedTo %s
\n",(char *) buff));
+
+ char *temp = (char *) nsMemory::Clone(buff,sizeof(char) * strlen(buff) + 1);
+
+ *issuedTo = temp;
+
+ return NS_OK;
+
+}
/* boolean SetCoolKeyConfigValue (in string aName, in string aValue); */
NS_IMETHODIMP rhCoolKey::SetCoolKeyConfigValue(const char *aName, const char *aValue,
PRBool *_retval)
{
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::SetCoolKeyConfigValue thread: %p
\n",PR_GetCurrentThread()));
if(!aName || !aValue)
{
-
*_retval = 0;
return NS_ERROR_FAILURE;
}
@@ -1244,6 +1217,7 @@
/* string GetCoolKeyConfigValue (in string aName); */
NS_IMETHODIMP rhCoolKey::GetCoolKeyConfigValue(const char *aName, char **_retval)
{
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetCoolKeyConfigValue thread: %p
\n",PR_GetCurrentThread()));
if(!aName)
{
@@ -1252,7 +1226,6 @@
*_retval = (char *) doGetCoolKeyConfigValue(aName);
-
return NS_OK;
}
@@ -1344,7 +1317,7 @@
{
PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetCoolKeyVersion \n"));
- char *version = "1.2.0";
+ char *version = "1.0.0-10";
char *versionVal = (char *) nsMemory::Clone(version,sizeof(char) * strlen(version) +
1);
@@ -1360,19 +1333,6 @@
// Implement full module and factory dance so we can see what is going on
-//static const nsModuleComponentInfo components[] =
-//{
-// { "CoolKey",
-// COOLKEY_CID,
-// "(a)redhat.com/rhcoolkey",
-// rhCoolKeyConstructor
-// }
-//};
-
-//NS_IMPL_NSGETMODULE(nsSampleModule, components)
-
-
-// factory implementation class for component
class rhCoolKeyFactory: public nsIFactory{
private:
nsrefcnt mRefCnt;
@@ -1501,7 +1461,7 @@
NS_IMETHODIMP_(nsrefcnt)
rhCoolKeyModule::AddRef(void)
{
-PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::AddRef \n"));
+PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::AddRef \n"));
++mRefCnt;
return mRefCnt;
}
@@ -1510,7 +1470,7 @@
NS_IMETHODIMP_(nsrefcnt)
rhCoolKeyModule::Release(void)
{
-PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::Release \n"));
+PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::Release \n"));
--mRefCnt;
if (mRefCnt == 0) {
mRefCnt = 1; /* stabilize */
@@ -1524,7 +1484,7 @@
NS_IMETHODIMP
rhCoolKeyModule::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
-PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::QueryInterface \n"));
+PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::QueryInterface \n"));
if ( !aInstancePtr )
return NS_ERROR_NULL_POINTER;
@@ -1558,7 +1518,7 @@
void** result)
{
-PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::GetClassObject \n"));
+PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::GetClassObject \n"));
if (!kCoolKeyCID.Equals(aClass))
return NS_ERROR_FACTORY_NOT_REGISTERED;
@@ -1589,7 +1549,7 @@
nsIComponentRegistrar* compReg = nsnull;
-PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::RegisterSelf \n"));
+PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::RegisterSelf \n"));
nsresult rv = aCompMgr->QueryInterface(kIComponentRegistrarIID,
(void**)&compReg);
if (NS_FAILED(rv))
return rv;
@@ -1612,7 +1572,7 @@
const char* registryLocation)
{
-PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::UnregisterSelf \n"));
+PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::UnregisterSelf \n"));
nsIComponentRegistrar* compReg = nsnull;
nsresult rv = aCompMgr->QueryInterface(kIComponentRegistrarIID,
(void**)&compReg);
@@ -1642,7 +1602,7 @@
{
nsresult rv = NS_OK;
-PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::NSGetModule \n"));
+PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::NSGetModule \n"));
// Create and initialize the module instance
rhCoolKeyModule *m = new rhCoolKeyModule();
Index: rhICoolKey.idl
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xpcom/rhICoolKey.idl,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- rhICoolKey.idl 12 Jun 2006 23:39:49 -0000 1.1.1.1
+++ rhICoolKey.idl 13 Sep 2006 17:50:07 -0000 1.2
@@ -56,10 +56,14 @@
boolean GetCoolKeyIsEnrolled(in unsigned long aKeyType, in string aKeyID);
+ string GetCoolKeyIssuerInfo(in unsigned long aKeyType, in string aKeyID);
+
string GetCoolKeyPolicy(in unsigned long aKeyType,in string aKeyID);
string GetCoolKeyCertInfo(in unsigned long aKeyType, in string aKeyID, in string
aCertNickname);
+ string GetCoolKeyIssuedTo(in unsigned long aKeyType, in string aKeyID);
+
boolean GetCoolKeyRequiresAuthentication(in unsigned long aKeyType,in string
aKeyID);
boolean GetCoolKeyIsAuthenticated(in unsigned long aKeyType,in string aKeyID);