Author: jmagne
Update of /cvs/dirsec/esc/src/app/xpcom
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17947/app/xpcom
Modified Files:
Makefile openkey.h rhCoolKey.cpp
Added Files:
Makefile.sdk
Log Message:
Latest RHEL fixes.
--- NEW FILE Makefile.sdk ---
#
# 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.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# ***** END COPYRIGHT BLOCK *****
CORE_DEPTH = ../../..
DEPLOY_OBJDIR = $(CORE_DEPTH)/dist/$(OBJDIR)/esc_build
include $(CORE_DEPTH)/coreconf/config.mk
include $(CORE_DEPTH)/coreconf/rules.mk
# Change this to point at your Gecko SDK directory.
ifndef GECKO_SDK_PATH
GECKO_SDK_PATH =/usr/lib/xulrunner-sdk-1.9pre/sdk
endif
ifndef GECKO_INCLUDE_PATH
GECKO_INCLUDE_PATH=/usr/include/xulrunner-sdk-1.9pre
endif
ifndef GECKO_BIN_PATH
GECKO_BIN_PATH=/usr/lib/xulrunner-1.9pre
endif
XUL_FRAMEWORK_BIN_PATH=$(GECKO_BIN_PATH)
ifeq ($(OS_ARCH),Darwin)
ifndef GECKO_SDK_PATH
GECKO_SDK_PATH =/Users/jmagne/Desktop/gecko-sdk-mac-universal
endif
GECKO_INCLUDE_PATH=$(GECKO_SDK_PATH)/include
GECKO_BIN_PATH=$(GECKO_SDK_PATH)/bin
ifndef XUL_FRAMEWORK_PATH
XUL_FRAMEWORK_PATH=/Library/Frameworks/XUL.framework
endif
XUL_FRAMEWORK_BIN_PATH=$(XUL_FRAMEWORK_PATH)/Versions/Current
endif
ifeq ($(OS_ARCH),WINNT)
ifndef GECKO_SDK_PATH
GECKO_SDK_PATH =c:/xulrunner-sdk/xulrunner-sdk
endif
GECKO_INCLUDE_PATH=$(GECKO_SDK_PATH)/include
GECKO_SDK_INCLUDE_PATH=$(GECKO_SDK_PATH)/sdk/include
GECKO_BIN_PATH=$(GECKO_SDK_PATH)/bin
XUL_FRAMEWORK_BIN_PATH=$(GECKO_BIN_PATH)
endif
DEPLOY_OBJDIR = $(CORE_DEPTH)/dist/$(OBJDIR)/esc_build
#Xulrunner constants
XULRUNNER_BIN_PATH = $(GECKO_BIN_PATH)
XULRUNNER_EXEC = xulrunner
ifeq ($(OS_ARCH), Darwin)
XULRUNNER_BIN_PATH = $(XUL_FRAMEWORK_BIN_PATH)
XULRUNNER_EXEC = xulrunner-bin
XULRUNNER_FRAME_DEST = ESC.app/Contents/Frameworks/XUL.framework
XULRUNNER_FRAME_BASE = ESC.app/Contents/Frameworks
endif
DEPLOY_OFFSET=/src
DESTDIR=
ifeq ($(OS_ARCH),Linux)
DEPLOY_OFFSET=/src
#DESTDIR=$(MOZ_OBJDIR)/install
endif
ifeq ($(OS_ARCH),WINNT)
CXX = cl
LINK = link
endif
ifeq ($(OS_ARCH),Darwin)
ifdef PPC_BUILD
CXX = c++-3.3
CPPFLAGS += -arch ppc
else
CPPFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386
endif
endif
ifeq ($(OS_ARCH),Darwin)
GECKO_LD_LIBS=-L$(GECKO_SDK_PATH)/lib -W1, $(GECKO_SDK_PATH)/lib/libxpcomglue.a -L$(XUL_FRAMEWORK_BIN_PATH) -lnss3 -lssl3 -lsoftokn3 -lplds4 -lplc4 -lnssutil3
endif
ifeq ($(OS_ARCH),Linux)
CPPFLAGS += -fno-rtti \
-fno-exceptions \
-fshort-wchar -fPIC
GECKO_LD_LIBS=-L$(GECKO_SDK_PATH)/lib $(GECKO_SDK_PATH)/lib/libxpcomglue.a -lnss3 -lcrmf -lssl3 -lsmime3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl
endif
ifeq ($(OS_ARCH),WINNT)
CPPFLAGS = -MD -DXP_WIN=1 -DXP_WIN32=1 -DXPCOM_GLUE -TP -nologo -W3 -Gy -EHsc -DNDEBUG
GECKO_LD_LIBS=/LIBPATH:$(GECKO_SDK_PATH)/lib $(GECKO_SDK_PATH)/lib/xpcomglue.lib
#$(GECKO_SDK_PATH)/lib/xul.lib
endif
# GCC only define which allows us to not have to #include mozilla-config
# in every .cpp file. If your not using GCC remove this line and add
# #include "mozilla-config.h" to each of your .cpp files.
#GECKO_CONFIG_INCLUDE = -include mozilla-config.h
GECKO_DEFINES = -DXPCOM_GLUE -DMOZILLA_CLIENT
NSS_INCLUDE = /usr/include/nss3
NSPR_INCLUDE = /usr/include/nspr4
GECKO_INCLUDES = -I $(GECKO_SDK_PATH)/include -I $(GECKO_INCLUDE_PATH) -I $(NSPR_INCLUDE) -I $(NSS_INCLUDE) -I $(GECKO_INCLUDE_PATH)/xpcom
COOL_INCLUDES = -I $(CORE_INC)/ckymanager -I $(CORE_INC)/httpchuncked
COOL_LDFLAGS = -L$(CORE_DIST)/lib -lckymanager -lhttpchunked $(CKY_LIB_LDD) -lckyapplet
OBJECT = rhCoolKey.o
ifeq ($(OS_ARCH), WINNT)
GECKO_INCLUDES += -I $(GECKO_SDK_PATH)/sdk/include
OBJECT = rhCoolKey.obj
OBJECTCSP = CoolKeyCSP.obj
COOL_LDFLAGS = -IMPLIB:fake-import /LIBPATH:$(CORE_DIST)/lib ckymanager.lib httpchunked.lib $(GECKO_LD_LIBS) nss3.lib ssl3.lib smime3.lib softokn3.lib /LIBPATH:$(CKY_LIB_LDD) libckyapplet.lib crypt32.lib kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib /NODEFAULTLIB:libc.lib
endif
ifeq ($(OS_ARCH),Darwin)
COOL_LDFLAGS += -lsystemStubs -framework Carbon -bundle -lm
endif
GECKO_LDFLAGS= -lnspr4 \
-lplds4 -lplc4 -ldl -lpthread -Wl -z \
$(GECKO_LD_LIBS)
ifeq ($(OS_ARCH),WINNT)
GECKO_LDFLAGS= nspr4.lib plds4.lib plc4.lib $(GECKO_LD_LIBS)
endif
FILES = rhCoolKey.cpp
FILESCSP = CoolKeyCSP.cpp
ifeq ($(OS_ARCH),Linux)
TARGET = librhCoolKey.so
endif
ifeq ($(OS_ARCH),Darwin)
TARGET = librhCoolKey.dylib
endif
ifeq ($(OS_ARCH),WINNT)
TARGET = rhCoolKey.dll
endif
install::
ifdef DESTDIR
cp -rf $(DEPLOY_OBJDIR)/esc/* $(DESTDIR)
cp -f $(CORE_DIST)/bin/escd $(DESTDIR)
endif
all:: export libs
libs::
$(GECKO_BIN_PATH)/xpidl -v -I $(GECKO_SDK_PATH)/idl -I $(NSPR_INCLUDE) -m header rhIKeyNotify.idl
$(GECKO_BIN_PATH)/xpidl -v -I $(GECKO_SDK_PATH)/idl -I $(NSPR_INCLUDE) -m typelib rhIKeyNotify.idl
$(GECKO_BIN_PATH)/xpidl -v -I $(GECKO_SDK_PATH)/idl -I $(NSPR_INCLUDE) -m header rhICoolKey.idl
$(GECKO_BIN_PATH)/xpidl -v -I $(GECKO_SDK_PATH)/idl -I $(NSPR_INCLUDE) -m typelib rhICoolKey.idl
ifeq ($(OS_ARCH),Darwin)
$(CXX) $(CPPFLAGS) -c -o $(OBJECT) $(GECKO_CONFIG_INCLUDE) $(GECKO_DEFINES) $(GECKO_INCLUDES) $(COOL_INCLUDES) $(CXXFLAGS) $(FILES)
$(CXX) $(CPPFLAGS) -o $(TARGET) $(OBJECT) $(GECKO_DEFINES) $(GECKO_INCLUDES) $(GECKO_LDFLAGS) $(COOL_LDFLAGS)
chmod +x $(TARGET)
endif
ifeq ($(OS_ARCH),Linux)
$(CXX) $(CPPFLAGS) -c -o $(OBJECT) $(GECKO_CONFIG_INCLUDE) $(GECKO_DEFINES) $(GECKO_INCLUDES) $(COOL_INCLUDES) $(CXXFLAGS) $(FILES)
$(CXX) $(CPPFLAGS) -shared -o $(TARGET) $(OBJECT) $(GECKO_DEFINES) $(GECKO_INCLUDES) $(GECKO_LDFLAGS) $(COOL_LDFLAGS)
chmod +x $(TARGET)
strip $(TARGET)
endif
ifeq ($(OS_ARCH),WINNT)
$(CXX) $(CPPFLAGS) -Fo$(OBJECT) -c $(GECKO_CONFIG_INCLUDE) $(GECKO_DEFINES) $(GECKO_INCLUDES) $(COOL_INCLUDES) $(CXXFLAGS) $(FILES)
$(CXX) $(CPPFLAGS) -Fo$(OBJECTCSP) -c $(GECKO_CONFIG_INCLUDE) $(GECKO_DEFINES) $(GECKO_INCLUDES) $(COOL_INCLUDES) $(CXXFLAGS) $(FILESCSP)
$(LINK) -NOLOGO -DLL -OUT:$(TARGET) $(OBJECT) $(OBJECTCSP) $(GECKO_LDFLAGS) $(GECKO_DEFINES) $(COOL_LDFLAGS)
endif
export::
touch Makefile.in
echo "Export"
clean::
echo "Cleaning up."
rm -f $(TARGET)
rm -f *.xpt
rm -f *.so
rm -f *.o
rm -f *.dylib
rm -f *.obj
rm -rf $(DEPLOY_OBJDIR)
rm -rf $(CORE_DEPTH)$(DEPLOY_OFFSET)/app/xul/esc/esc
ifeq ($(OS_ARCH),Darwin)
rm -rf ppc
rm -rf i386
endif
deploy: $(DEPLOY_OBJDIR)
echo "Deploy."
$(DEPLOY_OBJDIR):
echo "Installing!"
$(NSINSTALL) ./$(LIB_PREFIX)rhCoolKey.$(DLL_SUFFIX) $(CORE_DEPTH)$(DEPLOY_OFFSET)/app/xul/esc/components
$(NSINSTALL) ./*.xpt $(CORE_DEPTH)$(DEPLOY_OFFSET)/app/xul/esc/components
echo "Creating $(DEPLOY_OBJDIR)"
mkdir $(DEPLOY_OBJDIR)
cd $(CORE_DEPTH)/$(DEPLOY_OFFSET)/app/xul/esc; zip -r test.zip * -x *\CVS\* \*.fix*; unzip -d esc test.zip ; rm -f test.zip
$(XUL_FRAMEWORK_BIN_PATH)/$(XULRUNNER_EXEC) --install-app $(CORE_DEPTH)$(DEPLOY_OFFSET)/app/xul/esc/esc $(DEPLOY_OBJDIR)
ifeq ($(OS_ARCH), Darwin)
mkdir $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_BASE)
cp -Rf -v $(XUL_FRAMEWORK_PATH) $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST)
endif
ifeq ($(OS_ARCH),Linux)
endif
ifeq ($(OS_ARCH),WINNT)
mkdir -p $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST)/esc/xulrunner
cp -rf $(XUL_FRAMEWORK_BIN_PATH)/* $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST)/esc/xulrunner
endif
ifdef DESTDIR
$(NSINSTALL) $(DEPLOY_OBJDIR) $(DESTDIR)
endif
Index: Makefile
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xpcom/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile 10 Jan 2007 02:20:13 -0000 1.3
+++ Makefile 4 Feb 2009 01:43:46 -0000 1.4
@@ -19,12 +19,20 @@
CORE_DEPTH = ../../..
+MAKEFILE=Makefile.moz
+
+
+ifdef USE_XUL_SDK
+MAKEFILE=Makefile.sdk
+endif
+
include $(CORE_DEPTH)/coreconf/config.mk
include $(CORE_DEPTH)/coreconf/rules.mk
CORE_INC=$(SOURCE_XP_DIR)/public
-MOZ_SRCDIR=$(SOURCE_XP_DIR)/src/mozilla
-MOZ_OBJDIR=$(DIST)/xulrunner_build
+MOZ_SRCDIR=/home/jmagne/xulrunner/mozilla
+#MOZ_OBJDIR=$(DIST)/xulrunner_build
+MOZ_OBJDIR=$(MOZ_SRC_DIR)
DARWIN_LIB_NAME=librhCoolKey.dylib
@@ -44,7 +52,7 @@
all export install clean deploy args::
echo "***** Dropping into the Mozilla build environment ***** $(MOZ_OBJDIR)"
- $(MAKE) -f Makefile.moz $@ \
+ $(MAKE) -f $(MAKEFILE) $@ \
OBJDIR=$(OBJDIR) \
CORE_DIST=$(DIST) \
CORE_INC=$(CORE_INC) \
@@ -53,7 +61,7 @@
ifeq ($(OS_ARCH),Darwin)
echo "Darwin all"
- $(MAKE) -f Makefile.moz $@ \
+ $(MAKE) -f $(MAKEFILE) $@ \
OBJDIR=$(OBJDIR) \
CORE_DIST=$(DIST) \
CORE_INC=$(CORE_INC) \
@@ -64,7 +72,7 @@
libs::
echo "***** Dropping into the Mozilla build environment ***** $(MOZ_OBJDIR)"
- $(MAKE) -f Makefile.moz libs \
+ $(MAKE) -f $(MAKEFILE) libs \
OBJDIR=$(OBJDIR) \
CORE_DIST=$(DIST) \
CORE_INC=$(CORE_INC) \
@@ -78,12 +86,13 @@
mv -n $(DARWIN_LIB_NAME) i386
rm Makefile.in
rm *.o
- $(MAKE) -f Makefile.moz libs \
+ $(MAKE) -f $(MAKEFILE) libs \
OBJDIR=$(OBJDIR) \
CORE_DIST=$(DIST) \
CORE_INC=$(CORE_INC) \
MOZ_SRCDIR=$(MOZ_SRCDIR) \
- MOZ_OBJDIR=$(MOZ_OBJDIR_PPC)
+ MOZ_OBJDIR=$(MOZ_OBJDIR_PPC) \
+ PPC_BUILD=1
mv $(DARWIN_LIB_NAME) $(UNIVERSAL_OFFSET_PPC)
endif
@@ -92,7 +101,7 @@
echo "Darwin Creating UNI binary."
lipo -create $(UNIVERSAL_OFFSET_PPC)/$(DARWIN_LIB_NAME) $(UNIVERSAL_OFFSET_386)/$(DARWIN_LIB_NAME) -output $(DARWIN_LIB_NAME)
endif
- $(MAKE) -f Makefile.moz deploy \
+ $(MAKE) -f $(MAKEFILE) deploy \
OBJDIR=$(OBJDIR) \
CORE_DIST=$(DIST) \
CORE_INC=$(CORE_INC) \
Index: openkey.h
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xpcom/openkey.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- openkey.h 25 Oct 2006 03:58:16 -0000 1.2
+++ openkey.h 4 Feb 2009 01:43:46 -0000 1.3
@@ -21,8 +21,11 @@
#define OPENKEY_CARD_NAME "CoolKey Card Type"
#define OPENKEY_CARD_NAME_MS "CoolKey Card Type\0" /* a multi-string */
-#define OPENKEY_PROV "Identity Alliance CSP"
-#define OPENKEY_PROV_W L"Identity Alliance CSP"
+//#define OPENKEY_PROV "Identity Alliance CSP"
+//#define OPENKEY_PROV_W L"Identity Alliance CSP"
+
+#define OPENKEY_PROV "CoolKey PKCS #11 CSP"
+#define OPENKEY_PROV_W L"CoolKey PKCS #11 CSP"
#define OPENKEY_NAME_W L"CoolKey"
Index: rhCoolKey.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xpcom/rhCoolKey.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- rhCoolKey.cpp 18 Jan 2008 17:52:52 -0000 1.9
+++ rhCoolKey.cpp 4 Feb 2009 01:43:46 -0000 1.10
@@ -39,6 +39,7 @@
#include "nsIObserverService.h"
#include "nsXPCOMGlue.h"
#include "prlink.h"
+#include "prthread.h"
#include "nscore.h"
#include "content/nsCopySupport.h"
#include <vector>
@@ -74,7 +75,9 @@
static const nsIID kISupportsIID = NS_ISUPPORTS_IID;
static const nsIID kIComponentRegistrarIID = NS_ICOMPONENTREGISTRAR_IID;
-static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
+//static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
+
+#define NS_XPCOMPROXY_CONTRACTID "@mozilla.org/xpcomproxy;1"
static const nsCID kCoolKeyCID = COOLKEY_CID;
@@ -313,20 +316,22 @@
PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s rhCoolKey::InitInstance %p \n",GetTStamp(tBuff,56),this));
- char *path = (char *) GRE_GetXPCOMPath();
+ char xpcom_path[4096];
+ xpcom_path[0] = 0;
- PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s rhCoolKey::GREPath %s \n",GetTStamp(tBuff,56),path));
+ static const GREVersionRange greVersion =
+ {
+ "1.9", PR_TRUE,
+ "2", PR_TRUE
+ };
- char xpcom_path[512];
+ nsresult rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcom_path, 4096);
+ if (NS_FAILED(rv)) {
+ return PR_FALSE;
+ }
- char *lib_name = XPCOM_LIB_NAME ;
+ char *lib_name =(char *) XPCOM_LIB_NAME ;
-#ifdef XP_WIN32
-
- sprintf(xpcom_path,"%s",path);
-#else
- sprintf(xpcom_path,"%s/%s",path,lib_name);
-#endif
PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s rhCoolKey::xpcom_path %s \n",GetTStamp(tBuff,56),xpcom_path));
@@ -419,7 +424,7 @@
PR_ASSERT(manager);
- manager->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(rhICoolKey), this, PROXY_SYNC | PROXY_ALWAYS, (void**)&proxyObject);
+ manager->GetProxyForObject(NULL, NS_GET_IID(rhICoolKey), this, NS_PROXY_SYNC | NS_PROXY_ALWAYS, (void**)&proxyObject);
PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s rhCoolKey::CreateProxyObject: original: %p proxy %p \n",GetTStamp(tBuff,56),this,proxyObject));
@@ -1444,7 +1449,7 @@
char tBuff[56];
PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s rhCoolKey::GetCoolKeyVersion \n",GetTStamp(tBuff,56)));
- char *version = GETSTRING(ESC_VERSION);
+ char *version = (char *) GETSTRING(ESC_VERSION);
char *versionVal = (char *) nsMemory::Clone(version,sizeof(char) * strlen(version) + 1);