diff options
author | cvs2hg <devnull@localhost> | 2003-05-21 22:08:38 +0000 |
---|---|---|
committer | cvs2hg <devnull@localhost> | 2003-05-21 22:08:38 +0000 |
commit | 9732a3655f62930efd25aab0cfeb87f9134c08fd (patch) | |
tree | 48d37d8fdfdfd40e4218448531c7c7aa3b81803c | |
parent | 1be67d750e4f93391552f608ec9bc37f848375a4 (diff) | |
download | nss-hg-9732a3655f62930efd25aab0cfeb87f9134c08fd.tar.gz |
fixup commit for branch 'MOZILLA_1_4_BRANCH'
60 files changed, 653 insertions, 1183 deletions
diff --git a/dbm/src/Makefile.in b/dbm/src/Makefile.in index 259443c37..280c944d1 100644 --- a/dbm/src/Makefile.in +++ b/dbm/src/Makefile.in @@ -68,9 +68,6 @@ FORCE_USE_PIC = 1 include $(topsrcdir)/config/rules.mk DEFINES += -DMEMMOVE -D__DBINTERFACE_PRIVATE $(SECURITY_FLAG) -ifeq ($(OS_ARCH), Linux) -DEFINES += -D_BSD_SOURCE -endif ifeq ($(OS_ARCH),AIX) OS_LIBS += -lc_r diff --git a/dbm/src/hash.c b/dbm/src/hash.c index a4e73e499..98f7440fc 100644 --- a/dbm/src/hash.c +++ b/dbm/src/hash.c @@ -185,7 +185,7 @@ __hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dfl if (file) { -#if defined(_WIN32) || defined(_WINDOWS) || defined (macintosh) || defined(XP_OS2_VACPP) +#if defined(_WIN32) || defined(_WINDOWS) || defined (macintosh) || defined(XP_OS2) if ((hashp->fp = DBFILE_OPEN(file, flags | O_BINARY, mode)) == -1) RETURN_ERROR(errno, error0); #else diff --git a/dbm/tests/Makefile.in b/dbm/tests/Makefile.in index 96cbdf8b5..25ecd2a33 100644 --- a/dbm/tests/Makefile.in +++ b/dbm/tests/Makefile.in @@ -41,6 +41,3 @@ LIBS = $(EXTRA_DSO_LIBS) include $(topsrcdir)/config/rules.mk -ifeq ($(OS_ARCH), Linux) -DEFINES += -D_BSD_SOURCE -endif diff --git a/security/dbm/src/manifest.mn b/security/coreconf/HP-UXB.11.22.mk index 80f2abfd0..7199ce816 100644 --- a/security/dbm/src/manifest.mn +++ b/security/coreconf/HP-UXB.11.22.mk @@ -1,4 +1,3 @@ -#! gmake # # The contents of this file are subject to the Mozilla Public # License Version 1.1 (the "License"); you may not use this file @@ -14,7 +13,7 @@ # # The Initial Developer of the Original Code is Netscape # Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All +# Copyright (C) 2002 Netscape Communications Corporation. All # Rights Reserved. # # Contributor(s): @@ -31,31 +30,26 @@ # may use your version of this file under either the MPL or the # GPL. # +# On HP-UX 10.30 and 11.x, the default implementation strategy is +# pthreads. Classic nspr and pthreads-user are also available. +# -CORE_DEPTH = ../.. - -VPATH = $(CORE_DEPTH)/../dbm/src - -MODULE = dbm +ifeq ($(OS_RELEASE),B.11.22) +OS_CFLAGS += -DHPUX10 +DEFAULT_IMPL_STRATEGY = _PTH +endif # -# memmove.c, snprintf.c, and strerror.c are not in CSRCS because -# the Standard C Library has memmove and strerror and DBM is not -# using snprintf. +# To use the true pthread (kernel thread) library on 10.30 and +# 11.x, we should define _POSIX_C_SOURCE to be 199506L. +# The _REENTRANT macro is deprecated. # -CSRCS = db.c \ - h_bigkey.c \ - h_func.c \ - h_log2.c \ - h_page.c \ - hash.c \ - hash_buf.c \ - hsearch.c \ - mktemp.c \ - ndbm.c \ - nsres.c \ - dirent.c \ - $(NULL) +ifdef USE_PTHREADS + OS_CFLAGS += -D_POSIX_C_SOURCE=199506L +endif -LIBRARY_NAME = dbm +# +# Config stuff for HP-UXB.11.x. +# +include $(CORE_DEPTH)/coreconf/HP-UXB.11.mk diff --git a/security/coreconf/Linux.mk b/security/coreconf/Linux.mk index b571be9cd..fcd4c1fc4 100644 --- a/security/coreconf/Linux.mk +++ b/security/coreconf/Linux.mk @@ -90,6 +90,10 @@ ifeq ($(OS_TEST),s390x) OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE CPU_ARCH = s390x else +ifeq ($(OS_TEST),mips) + OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE + CPU_ARCH = mips +else OS_REL_CFLAGS = -DLINUX1_2 -Di386 -D_XOPEN_SOURCE CPU_ARCH = x86 endif @@ -102,6 +106,7 @@ endif endif endif endif +endif LIBC_TAG = _glibc diff --git a/security/coreconf/OS2.mk b/security/coreconf/OS2.mk index 6420b8bac..562a81de5 100644 --- a/security/coreconf/OS2.mk +++ b/security/coreconf/OS2.mk @@ -111,7 +111,7 @@ NSPR_INCLUDE_DIR = ifdef BUILD_OPT -OPTIMIZER = -O6 +OPTIMIZER = -O2 -s DEFINES += -UDEBUG -U_DEBUG -DNDEBUG DLLFLAGS = -DLL -OUT:$@ -MAP:$(@:.dll=.map) EXEFLAGS = -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE diff --git a/security/coreconf/WIN32.mk b/security/coreconf/WIN32.mk index 6dd67d51b..9487e12f5 100644 --- a/security/coreconf/WIN32.mk +++ b/security/coreconf/WIN32.mk @@ -38,13 +38,26 @@ DEFAULT_COMPILER = cl -CC = cl -CCC = cl -LINK = link -AR = lib -AR += -NOLOGO -OUT:"$@" -RANLIB = echo -BSDECHO = echo +ifdef NS_USE_GCC + CC = gcc + CCC = g++ + LINK = ld + AR = ar + AR += cr $@ + RANLIB = ranlib + BSDECHO = echo + RC = windres.exe -O coff + LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS) +else + CC = cl + CCC = cl + LINK = link + AR = lib + AR += -NOLOGO -OUT:"$@" + RANLIB = echo + BSDECHO = echo + RC = rc.exe +endif ifdef BUILD_TREE NSINSTALL_DIR = $(BUILD_TREE)/nss @@ -62,13 +75,38 @@ MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk INSTALL = $(NSINSTALL) MAKE_OBJDIR = mkdir MAKE_OBJDIR += $(OBJDIR) -RC = rc.exe GARBAGE += $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb XP_DEFINE += -DXP_PC +ifdef NS_USE_GCC +LIB_SUFFIX = a +else LIB_SUFFIX = lib +endif DLL_SUFFIX = dll -ifdef BUILD_OPT +ifdef NS_USE_GCC + OS_CFLAGS += -mno-cygwin -mms-bitfields + _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY) + DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB)) + ifdef BUILD_OPT + OPTIMIZER += -O2 + DEFINES += -UDEBUG -U_DEBUG -DNDEBUG + # + # Add symbolic information for a profiler + # + ifdef MOZ_PROFILE + OPTIMIZER += -g + endif + else + OPTIMIZER += -g + NULLSTRING := + SPACE := $(NULLSTRING) # end of the line + USERNAME := $(subst $(SPACE),_,$(USERNAME)) + USERNAME := $(subst -,_,$(USERNAME)) + DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME) + endif +else # !NS_USE_GCC + ifdef BUILD_OPT OS_CFLAGS += -MD OPTIMIZER += -O2 DEFINES += -UDEBUG -U_DEBUG -DNDEBUG @@ -80,7 +118,7 @@ ifdef BUILD_OPT OPTIMIZER += -Z7 DLLFLAGS += -DEBUG -DEBUGTYPE:CV endif -else + else # # Define USE_DEBUG_RTL if you want to use the debug runtime library # (RTL) in the debug build @@ -99,12 +137,15 @@ else DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME) DLLFLAGS += -DEBUG -DEBUGTYPE:CV -OUT:"$@" LDFLAGS += -DEBUG -DEBUGTYPE:CV -PDB:NONE -endif + endif +endif # NS_USE_GCC DEFINES += -DWIN32 ifdef MAPFILE +ifndef NS_USE_GCC DLLFLAGS += -DEF:$(MAPFILE) endif +endif # Change PROCESS to put the mapfile in the correct format for this platform PROCESS_MAP_FILE = cp $(LIBRARY_NAME).def $@ @@ -116,8 +157,13 @@ PROCESS_MAP_FILE = cp $(LIBRARY_NAME).def $@ DEFINES += -D_WINDOWS # override default, which is ASFLAGS = CFLAGS -AS = ml.exe -ASFLAGS = -Cp -Sn -Zi -coff $(INCLUDES) +ifdef NS_USE_GCC + AS = $(CC) + ASFLAGS = $(INCLUDES) +else + AS = ml.exe + ASFLAGS = -Cp -Sn -Zi -coff $(INCLUDES) +endif # # override the definitions of RELEASE_TREE found in tree.mk @@ -135,11 +181,24 @@ ifndef RELEASE_TREE endif # -# override the definitions of LIB_PREFIX and DLL_PREFIX in prefix.mk +# override the definitions of IMPORT_LIB_PREFIX, LIB_PREFIX, and +# DLL_PREFIX in prefix.mk # +ifndef IMPORT_LIB_PREFIX + ifdef NS_USE_GCC + IMPORT_LIB_PREFIX = lib + else + IMPORT_LIB_PREFIX = $(NULL) + endif +endif + ifndef LIB_PREFIX - LIB_PREFIX = $(NULL) + ifdef NS_USE_GCC + LIB_PREFIX = lib + else + LIB_PREFIX = $(NULL) + endif endif ifndef DLL_PREFIX @@ -154,14 +213,22 @@ endif # Object suffixes # ifndef OBJ_SUFFIX - OBJ_SUFFIX = .obj + ifdef NS_USE_GCC + OBJ_SUFFIX = .o + else + OBJ_SUFFIX = .obj + endif endif # # Assembler source suffixes # ifndef ASM_SUFFIX - ASM_SUFFIX = .asm + ifdef NS_USE_GCC + ASM_SUFFIX = .s + else + ASM_SUFFIX = .asm + endif endif # diff --git a/security/coreconf/WIN954.0.mk b/security/coreconf/WIN954.0.mk index 24a44c1ff..e710f6e2e 100644 --- a/security/coreconf/WIN954.0.mk +++ b/security/coreconf/WIN954.0.mk @@ -40,7 +40,9 @@ include $(CORE_DEPTH)/coreconf/WIN32.mk ifeq ($(CPU_ARCH), x386) +ifndef NS_USE_GCC OS_CFLAGS += -W3 -nologo +endif DEFINES += -D_X86_ else ifeq ($(CPU_ARCH), MIPS) @@ -55,5 +57,7 @@ else endif endif +ifndef NS_USE_GCC OS_DLLFLAGS += -nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE +endif DEFINES += -DWIN95 diff --git a/security/coreconf/rules.mk b/security/coreconf/rules.mk index ac55f9279..ff380d472 100644 --- a/security/coreconf/rules.mk +++ b/security/coreconf/rules.mk @@ -52,7 +52,7 @@ endif platform:: @echo $(OBJDIR_NAME) -ifeq (,$(filter-out WIN%,$(OS_TARGET))) +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) USE_NT_C_SYNTAX=1 endif @@ -285,7 +285,7 @@ endif $(PROGRAM): $(OBJS) $(EXTRA_LIBS) @$(MAKE_OBJDIR) -ifeq (,$(filter-out WIN%,$(OS_TARGET))) +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)) else ifdef XP_OS2_VACPP @@ -337,7 +337,11 @@ ifeq ($(OS_TARGET)$(OS_RELEASE), AIX4.1) -bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) else ifeq (,$(filter-out WIN%,$(OS_TARGET))) +ifdef NS_USE_GCC + $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES) +else $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)) +endif else ifdef XP_OS2_VACPP $(MKSHLIB) $(DLLFLAGS) $(LDFLAGS) $(OBJS) $(SUB_SHLOBJS) $(LD_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) @@ -357,7 +361,11 @@ ifeq (,$(filter-out WIN%,$(OS_TARGET))) $(RES): $(RESNAME) @$(MAKE_OBJDIR) # The resource compiler does not understand the -U option. +ifdef NS_USE_GCC + $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $< +else $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $< +endif @echo $(RES) finished endif @@ -368,7 +376,7 @@ $(MAPFILE): $(LIBRARY_NAME).def $(OBJDIR)/$(PROG_PREFIX)%$(PROG_SUFFIX): $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX) @$(MAKE_OBJDIR) -ifeq (,$(filter-out WIN%,$(OS_TARGET))) +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) $(MKPROG) $(OBJDIR)/$(PROG_PREFIX)$*$(OBJ_SUFFIX) -Fe$@ -link \ $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) else @@ -380,23 +388,54 @@ WCCFLAGS1 := $(subst /,\\,$(CFLAGS)) WCCFLAGS2 := $(subst -I,-i=,$(WCCFLAGS1)) WCCFLAGS3 := $(subst -D,-d,$(WCCFLAGS2)) +# Translate source filenames to absolute paths. This is required for +# debuggers under Windows & OS/2 to find source files automatically + +ifeq (,$(filter-out OS2%,$(OS_TARGET))) +NEED_ABSOLUTE_PATH := 1 +PWD := $(shell pwd) +endif + +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) +NEED_ABSOLUTE_PATH := 1 +ifeq (,$(findstring ;,$(PATH))) +PWD := $(subst \,/,$(shell cygpath -w `pwd`)) +else +PWD := $(shell pwd) +endif +endif + +ifdef NEED_ABSOLUTE_PATH +abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1))) +else +abspath = $(1) +endif + $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c @$(MAKE_OBJDIR) ifdef USE_NT_C_SYNTAX - $(CC) -Fo$@ -c $(CFLAGS) $< + $(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<) +else +ifdef NEED_ABSOLUTE_PATH + $(CC) -o $@ -c $(CFLAGS) $(call abspath,$<) else $(CC) -o $@ -c $(CFLAGS) $< endif +endif $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c ifdef USE_NT_C_SYNTAX - $(CC) -Fo$@ -c $(CFLAGS) $< + $(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<) +else +ifdef NEED_ABSOLUTE_PATH + $(CC) -o $@ -c $(CFLAGS) $(call abspath,$<) else $(CC) -o $@ -c $(CFLAGS) $< endif +endif ifndef XP_OS2_VACPP -ifneq (,$(filter-out WIN%,$(OS_TARGET))) +ifneq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.s @$(MAKE_OBJDIR) $(AS) -o $@ $(ASFLAGS) -c $< @@ -418,10 +457,14 @@ $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.S $(OBJDIR)/$(PROG_PREFIX)%: %.cpp @$(MAKE_OBJDIR) ifdef USE_NT_C_SYNTAX - $(CCC) -Fo$@ -c $(CFLAGS) $< + $(CCC) -Fo$@ -c $(CFLAGS) $(call abspath,$<) +else +ifdef NEED_ABSOLUTE_PATH + $(CCC) -o $@ -c $(CFLAGS) $(call abspath,$<) else $(CCC) -o $@ -c $(CFLAGS) $< endif +endif # # Please keep the next two rules in sync. @@ -438,10 +481,14 @@ ifdef STRICT_CPLUSPLUS_SUFFIX rm -f $(OBJDIR)/t_$*.cc else ifdef USE_NT_C_SYNTAX - $(CCC) -Fo$@ -c $(CFLAGS) $< + $(CCC) -Fo$@ -c $(CFLAGS) $(call abspath,$<) +else +ifdef NEED_ABSOLUTE_PATH + $(CCC) -o $@ -c $(CFLAGS) $(call abspath,$<) else $(CCC) -o $@ -c $(CFLAGS) $< endif +endif endif #STRICT_CPLUSPLUS_SUFFIX %.i: %.cpp diff --git a/security/dbm/Makefile b/security/dbm/Makefile deleted file mode 100644 index 34cd6d899..000000000 --- a/security/dbm/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape security libraries. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the -# terms of the GNU General Public License Version 2 or later (the -# "GPL"), in which case the provisions of the GPL are applicable -# instead of those above. If you wish to allow use of your -# version of this file only under the terms of the GPL and not to -# allow others to use your version of this file under the MPL, -# indicate your decision by deleting the provisions above and -# replace them with the notice and other provisions required by -# the GPL. If you do not delete the provisions above, a recipient -# may use your version of this file under either the MPL or the -# GPL. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - -coreconf_hack: - cd ../coreconf; gmake - gmake import - -RelEng_bld: coreconf_hack - gmake diff --git a/security/dbm/config/config.mk b/security/dbm/config/config.mk deleted file mode 100644 index 753364931..000000000 --- a/security/dbm/config/config.mk +++ /dev/null @@ -1,67 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape security libraries. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the -# terms of the GNU General Public License Version 2 or later (the -# "GPL"), in which case the provisions of the GPL are applicable -# instead of those above. If you wish to allow use of your -# version of this file only under the terms of the GPL and not to -# allow others to use your version of this file under the MPL, -# indicate your decision by deleting the provisions above and -# replace them with the notice and other provisions required by -# the GPL. If you do not delete the provisions above, a recipient -# may use your version of this file under either the MPL or the -# GPL. -# - -# -# These macros are defined by mozilla's configure script. -# We define them manually here. -# - -DEFINES += -DSTDC_HEADERS -DHAVE_STRERROR - -# -# Most platforms have snprintf, so it's simpler to list the exceptions. -# -HAVE_SNPRINTF = 1 -# -# OSF1 V4.0D doesn't have snprintf but V5.0A does. -# -ifeq ($(OS_TARGET)$(OS_RELEASE),OSF1V4.0D) -HAVE_SNPRINTF = -endif -ifdef HAVE_SNPRINTF -DEFINES += -DHAVE_SNPRINTF -endif - -ifeq (,$(filter-out IRIX Linux,$(OS_TARGET))) -DEFINES += -DHAVE_SYS_CDEFS_H -endif - -ifeq (,$(filter-out DGUX NCR ReliantUNIX SCO_SV SCOOS UNIXWARE,$(OS_TARGET))) -DEFINES += -DHAVE_SYS_BYTEORDER_H -endif - -# -# None of the platforms that we are interested in need to -# define HAVE_MEMORY_H. -# diff --git a/security/dbm/include/Makefile b/security/dbm/include/Makefile deleted file mode 100644 index ba4dd8ddf..000000000 --- a/security/dbm/include/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape security libraries. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the -# terms of the GNU General Public License Version 2 or later (the -# "GPL"), in which case the provisions of the GPL are applicable -# instead of those above. If you wish to allow use of your -# version of this file only under the terms of the GPL and not to -# allow others to use your version of this file under the MPL, -# indicate your decision by deleting the provisions above and -# replace them with the notice and other provisions required by -# the GPL. If you do not delete the provisions above, a recipient -# may use your version of this file under either the MPL or the -# GPL. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/security/dbm/include/manifest.mn b/security/dbm/include/manifest.mn deleted file mode 100644 index 886fedd98..000000000 --- a/security/dbm/include/manifest.mn +++ /dev/null @@ -1,57 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape security libraries. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the -# terms of the GNU General Public License Version 2 or later (the -# "GPL"), in which case the provisions of the GPL are applicable -# instead of those above. If you wish to allow use of your -# version of this file only under the terms of the GPL and not to -# allow others to use your version of this file under the MPL, -# indicate your decision by deleting the provisions above and -# replace them with the notice and other provisions required by -# the GPL. If you do not delete the provisions above, a recipient -# may use your version of this file under either the MPL or the -# GPL. -# - -CORE_DEPTH = ../.. - -VPATH = $(CORE_DEPTH)/../dbm/include - -MODULE = dbm - -EXPORTS = nsres.h \ - cdefs.h \ - mcom_db.h \ - ncompat.h \ - winfile.h \ - $(NULL) - -PRIVATE_EXPORTS = hsearch.h \ - page.h \ - extern.h \ - ndbm.h \ - queue.h \ - hash.h \ - mpool.h \ - search.h \ - $(NULL) - diff --git a/security/dbm/manifest.mn b/security/dbm/manifest.mn deleted file mode 100644 index 11f4f4237..000000000 --- a/security/dbm/manifest.mn +++ /dev/null @@ -1,45 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape security libraries. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the -# terms of the GNU General Public License Version 2 or later (the -# "GPL"), in which case the provisions of the GPL are applicable -# instead of those above. If you wish to allow use of your -# version of this file only under the terms of the GPL and not to -# allow others to use your version of this file under the MPL, -# indicate your decision by deleting the provisions above and -# replace them with the notice and other provisions required by -# the GPL. If you do not delete the provisions above, a recipient -# may use your version of this file under either the MPL or the -# GPL. -# - -CORE_DEPTH = .. - -MODULE = dbm - -IMPORTS = nspr20/v4.1.2 - -RELEASE = dbm - -DIRS = include \ - src \ - $(NULL) diff --git a/security/dbm/src/Makefile b/security/dbm/src/Makefile deleted file mode 100644 index 8fce98394..000000000 --- a/security/dbm/src/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape security libraries. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the -# terms of the GNU General Public License Version 2 or later (the -# "GPL"), in which case the provisions of the GPL are applicable -# instead of those above. If you wish to allow use of your -# version of this file only under the terms of the GPL and not to -# allow others to use your version of this file under the MPL, -# indicate your decision by deleting the provisions above and -# replace them with the notice and other provisions required by -# the GPL. If you do not delete the provisions above, a recipient -# may use your version of this file under either the MPL or the -# GPL. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/dbm/config/config.mk - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/security/dbm/src/config.mk b/security/dbm/src/config.mk deleted file mode 100644 index 370fd75d6..000000000 --- a/security/dbm/src/config.mk +++ /dev/null @@ -1,63 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape security libraries. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the -# terms of the GNU General Public License Version 2 or later (the -# "GPL"), in which case the provisions of the GPL are applicable -# instead of those above. If you wish to allow use of your -# version of this file only under the terms of the GPL and not to -# allow others to use your version of this file under the MPL, -# indicate your decision by deleting the provisions above and -# replace them with the notice and other provisions required by -# the GPL. If you do not delete the provisions above, a recipient -# may use your version of this file under either the MPL or the -# GPL. -# - -DEFINES += -DMEMMOVE -D__DBINTERFACE_PRIVATE $(SECURITY_FLAG) - -INCLUDES += -I$(CORE_DEPTH)/../dbm/include - -# -# Currently, override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -TARGETS = $(LIBRARY) -SHARED_LIBRARY = -IMPORT_LIBRARY = -PURE_LIBRARY = -PROGRAM = - -ifdef SHARED_LIBRARY - ifeq (,$(filter-out WINNT WIN95 WINCE,$(OS_TARGET))) # list omits WIN16 - DLLBASE=/BASE:0x30000000 - RES=$(OBJDIR)/dbm.res - RESNAME=../include/dbm.rc - endif - ifeq ($(DLL_SUFFIX),dll) - DEFINES += -D_DLL - endif -endif - -ifeq ($(OS_TARGET),AIX) - OS_LIBS += -lc_r -endif diff --git a/security/dbm/src/dirent.c b/security/dbm/src/dirent.c deleted file mode 100644 index 001a48c5c..000000000 --- a/security/dbm/src/dirent.c +++ /dev/null @@ -1,348 +0,0 @@ -#ifdef OS2 - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -#include <dirent.h> -#include <errno.h> - -/*#ifndef __EMX__ -#include <libx.h> -#endif */ - -#define INCL_DOSFILEMGR -#define INCL_DOSERRORS -#include <os2.h> - -#if OS2 >= 2 -# define FFBUF FILEFINDBUF3 -# define Word ULONG - /* - * LS20 recommends a request count of 100, but according to the - * APAR text it does not lead to missing files, just to funny - * numbers of returned entries. - * - * LS30 HPFS386 requires a count greater than 2, or some files - * are missing (those starting with a character less that '.'). - * - * Novell looses entries which overflow the buffer. In previous - * versions of dirent2, this could have lead to missing files - * when the average length of 100 directory entries was 40 bytes - * or more (quite unlikely for files on a Novell server). - * - * Conclusion: Make sure that the entries all fit into the buffer - * and that the buffer is large enough for more than 2 entries - * (each entry is at most 300 bytes long). And ignore the LS20 - * effect. - */ -# define Count 25 -# define BufSz (25 * (sizeof(FILEFINDBUF3)+1)) -#else -# define FFBUF FILEFINDBUF -# define Word USHORT -# define BufSz 1024 -# define Count 3 -#endif - -#if defined(__IBMC__) || defined(__IBMCPP__) - #define error(rc) _doserrno = rc, errno = EOS2ERR -#elif defined(MICROSOFT) - #define error(rc) _doserrno = rc, errno = 255 -#else - #define error(rc) errno = 255 -#endif - -struct _dirdescr { - HDIR handle; /* DosFindFirst handle */ - char fstype; /* filesystem type */ - Word count; /* valid entries in <ffbuf> */ - long number; /* absolute number of next entry */ - int index; /* relative number of next entry */ - FFBUF * next; /* pointer to next entry */ - char name[MAXPATHLEN+3]; /* directory name */ - unsigned attrmask; /* attribute mask for seekdir */ - struct dirent entry; /* buffer for directory entry */ - BYTE ffbuf[BufSz]; -}; - -/* - * Return first char of filesystem type, or 0 if unknown. - */ -static char -getFSType(const char *path) -{ - static char cache[1+26]; - char drive[3], info[512]; - Word unit, infolen; - char r; - - if (isalpha(path[0]) && path[1] == ':') { - unit = toupper(path[0]) - '@'; - path += 2; - } else { - ULONG driveMap; -#if OS2 >= 2 - if (DosQueryCurrentDisk(&unit, &driveMap)) -#else - if (DosQCurDisk(&unit, &driveMap)) -#endif - return 0; - } - - if ((path[0] == '\\' || path[0] == '/') - && (path[1] == '\\' || path[1] == '/')) - return 0; - - if (cache [unit]) - return cache [unit]; - - drive[0] = '@' + unit; - drive[1] = ':'; - drive[2] = '\0'; - infolen = sizeof info; -#if OS2 >= 2 - if (DosQueryFSAttach(drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen)) - return 0; - if (infolen >= sizeof(FSQBUFFER2)) { - FSQBUFFER2 *p = (FSQBUFFER2 *)info; - r = p->szFSDName[p->cbName]; - } else -#else - if (DosQFSAttach((PSZ)drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen, 0)) - return 0; - if (infolen >= 9) { - char *p = info + sizeof(USHORT); - p += sizeof(USHORT) + *(USHORT *)p + 1 + sizeof(USHORT); - r = *p; - } else -#endif - r = 0; - return cache [unit] = r; -} - -char * -abs_path(const char *name, char *buffer, int len) -{ - char buf[4]; - if (isalpha(name[0]) && name[1] == ':' && name[2] == '\0') { - buf[0] = name[0]; - buf[1] = name[1]; - buf[2] = '.'; - buf[3] = '\0'; - name = buf; - } -#if OS2 >= 2 - if (DosQueryPathInfo((PSZ)name, FIL_QUERYFULLNAME, buffer, len)) -#else - if (DosQPathInfo((PSZ)name, FIL_QUERYFULLNAME, (PBYTE)buffer, len, 0L)) -#endif - return NULL; - return buffer; -} - -DIR * -openxdir(const char *path, unsigned att_mask) -{ - DIR *dir; - char name[MAXPATHLEN+3]; - Word rc; - - dir = malloc(sizeof(DIR)); - if (dir == NULL) { - errno = ENOMEM; - return NULL; - } - - strncpy(name, path, MAXPATHLEN); - name[MAXPATHLEN] = '\0'; - switch (name[strlen(name)-1]) { - default: - strcat(name, "\\"); - case '\\': - case '/': - case ':': - ; - } - strcat(name, "."); - if (!abs_path(name, dir->name, MAXPATHLEN+1)) - strcpy(dir->name, name); - if (dir->name[strlen(dir->name)-1] == '\\') - strcat(dir->name, "*"); - else - strcat(dir->name, "\\*"); - - dir->fstype = getFSType(dir->name); - dir->attrmask = att_mask | A_DIR; - - dir->handle = HDIR_CREATE; - dir->count = 100; -#if OS2 >= 2 - rc = DosFindFirst(dir->name, &dir->handle, dir->attrmask, - dir->ffbuf, sizeof dir->ffbuf, &dir->count, FIL_STANDARD); -#else - rc = DosFindFirst((PSZ)dir->name, &dir->handle, dir->attrmask, - (PFILEFINDBUF)dir->ffbuf, sizeof dir->ffbuf, &dir->count, 0); -#endif - switch (rc) { - default: - free(dir); - error(rc); - return NULL; - case NO_ERROR: - case ERROR_NO_MORE_FILES: - ; - } - - dir->number = 0; - dir->index = 0; - dir->next = (FFBUF *)dir->ffbuf; - - return (DIR *)dir; -} - -DIR * -opendir(const char *pathname) -{ - return openxdir(pathname, 0); -} - -struct dirent * -readdir(DIR *dir) -{ - static int dummy_ino = 2; - - if (dir->index == dir->count) { - Word rc; - dir->count = 100; -#if OS2 >= 2 - rc = DosFindNext(dir->handle, dir->ffbuf, - sizeof dir->ffbuf, &dir->count); -#else - rc = DosFindNext(dir->handle, (PFILEFINDBUF)dir->ffbuf, - sizeof dir->ffbuf, &dir->count); -#endif - if (rc) { - error(rc); - return NULL; - } - - dir->index = 0; - dir->next = (FFBUF *)dir->ffbuf; - } - - if (dir->index == dir->count) - return NULL; - - memcpy(dir->entry.d_name, dir->next->achName, dir->next->cchName); - dir->entry.d_name[dir->next->cchName] = '\0'; - dir->entry.d_ino = dummy_ino++; - dir->entry.d_reclen = dir->next->cchName; - dir->entry.d_namlen = dir->next->cchName; - dir->entry.d_size = dir->next->cbFile; - dir->entry.d_attribute = dir->next->attrFile; - dir->entry.d_time = *(USHORT *)&dir->next->ftimeLastWrite; - dir->entry.d_date = *(USHORT *)&dir->next->fdateLastWrite; - - switch (dir->fstype) { - case 'F': /* FAT */ - case 'C': /* CDFS */ - if (dir->next->attrFile & FILE_DIRECTORY) - strupr(dir->entry.d_name); - else - strlwr(dir->entry.d_name); - } - -#if OS2 >= 2 - dir->next = (FFBUF *)((BYTE *)dir->next + dir->next->oNextEntryOffset); -#else - dir->next = (FFBUF *)((BYTE *)dir->next->achName + dir->next->cchName + 1); -#endif - ++dir->number; - ++dir->index; - - return &dir->entry; -} - -long -telldir(DIR *dir) -{ - return dir->number; -} - -void -seekdir(DIR *dir, long off) -{ - if (dir->number > off) { - char name[MAXPATHLEN+2]; - Word rc; - - DosFindClose(dir->handle); - - strcpy(name, dir->name); - strcat(name, "*"); - - dir->handle = HDIR_CREATE; - dir->count = 32767; -#if OS2 >= 2 - rc = DosFindFirst(name, &dir->handle, dir->attrmask, - dir->ffbuf, sizeof dir->ffbuf, &dir->count, FIL_STANDARD); -#else - rc = DosFindFirst((PSZ)name, &dir->handle, dir->attrmask, - (PFILEFINDBUF)dir->ffbuf, sizeof dir->ffbuf, &dir->count, 0); -#endif - switch (rc) { - default: - error(rc); - return; - case NO_ERROR: - case ERROR_NO_MORE_FILES: - ; - } - - dir->number = 0; - dir->index = 0; - dir->next = (FFBUF *)dir->ffbuf; - } - - while (dir->number < off && readdir(dir)) - ; -} - -void -closedir(DIR *dir) -{ - DosFindClose(dir->handle); - free(dir); -} - -/*****************************************************************************/ - -#ifdef TEST - -main(int argc, char **argv) -{ - int i; - DIR *dir; - struct dirent *ep; - - for (i = 1; i < argc; ++i) { - dir = opendir(argv[i]); - if (!dir) - continue; - while (ep = readdir(dir)) - if (strchr("\\/:", argv[i] [strlen(argv[i]) - 1])) - printf("%s%s\n", argv[i], ep->d_name); - else - printf("%s/%s\n", argv[i], ep->d_name); - closedir(dir); - } - - return 0; -} - -#endif - -#endif /* OS2 */ - diff --git a/security/dbm/src/dirent.h b/security/dbm/src/dirent.h deleted file mode 100644 index 07a6c0ac8..000000000 --- a/security/dbm/src/dirent.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef __DIRENT_H__ -#define __DIRENT_H__ -/* - * @(#)msd_dir.h 1.4 87/11/06 Public Domain. - * - * A public domain implementation of BSD directory routines for - * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield), - * August 1897 - * - * Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks - * and returns 2 more pieces of information - file size & attribute. - * Plus a little reshuffling of some #define's positions December 1987 - * - * Some modifications by Martin Junius 02-14-89 - * - * AK900712 - * AK910410 abs_path - make absolute path - * - */ - -#ifdef __EMX__ -#include <sys/param.h> -#else -#if defined(__IBMC__) || defined(__IBMCPP__) || defined(XP_W32_MSVC) -#include <stdio.h> -#ifdef MAXPATHLEN - #undef MAXPATHLEN -#endif -#define MAXPATHLEN (FILENAME_MAX*4) -#define MAXNAMLEN FILENAME_MAX - -#else -#include <param.h> -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* attribute stuff */ -#ifndef A_RONLY -# define A_RONLY 0x01 -# define A_HIDDEN 0x02 -# define A_SYSTEM 0x04 -# define A_LABEL 0x08 -# define A_DIR 0x10 -# define A_ARCHIVE 0x20 -#endif - -struct dirent { -#if defined(OS2) || defined(WIN32) /* use the layout of EMX to avoid trouble */ - int d_ino; /* Dummy */ - int d_reclen; /* Dummy, same as d_namlen */ - int d_namlen; /* length of name */ - char d_name[MAXNAMLEN + 1]; - unsigned long d_size; - unsigned short d_attribute; /* attributes (see above) */ - unsigned short d_time; /* modification time */ - unsigned short d_date; /* modification date */ -#else - char d_name[MAXNAMLEN + 1]; /* garentee null termination */ - char d_attribute; /* .. extension .. */ - unsigned long d_size; /* .. extension .. */ -#endif -}; - -typedef struct _dirdescr DIR; -/* the structs do not have to be defined here */ - -extern DIR *opendir(const char *); -extern DIR *openxdir(const char *, unsigned); -extern struct dirent *readdir(DIR *); -extern void seekdir(DIR *, long); -extern long telldir(DIR *); -extern void closedir(DIR *); -#define rewinddir(dirp) seekdir(dirp, 0L) - -extern char * abs_path(const char *name, char *buffer, int len); - -#ifndef S_IFMT -#define S_IFMT ( S_IFDIR | S_IFREG ) -#endif - -#ifndef S_ISDIR -#define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR) -#endif - -#ifndef S_ISREG -#define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG) -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/security/dbm/tests/Makefile b/security/dbm/tests/Makefile deleted file mode 100644 index fe132e19c..000000000 --- a/security/dbm/tests/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape security libraries. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the -# terms of the GNU General Public License Version 2 or later (the -# "GPL"), in which case the provisions of the GPL are applicable -# instead of those above. If you wish to allow use of your -# version of this file only under the terms of the GPL and not to -# allow others to use your version of this file under the MPL, -# indicate your decision by deleting the provisions above and -# replace them with the notice and other provisions required by -# the GPL. If you do not delete the provisions above, a recipient -# may use your version of this file under either the MPL or the -# GPL. -# -DEPTH = ../.. -CORE_DEPTH = ../.. - -VPATH = $(CORE_DEPTH)/../dbm/tests - -MODULE = dbm - -CSRCS = lots.c - -PROGRAM = lots - -include $(DEPTH)/coreconf/config.mk - -include $(DEPTH)/dbm/config/config.mk - -ifeq (,$(filter-out WIN%,$(OS_TARGET))) -LIBDBM = ../src/$(PLATFORM)/dbm$(STATIC_LIB_SUFFIX) -else -LIBDBM = ../src/$(PLATFORM)/libdbm$(STATIC_LIB_SUFFIX) -endif - -INCLUDES += -I$(CORE_DEPTH)/../dbm/include - -LDFLAGS = $(LDOPTS) $(LIBDBM) - -include $(DEPTH)/coreconf/rules.mk - -lots.pure: lots - purify $(CC) -o lots.pure $(CFLAGS) $(OBJS) $(MYLIBS) - -crash: crash.o $(MYLIBS) - $(CC) -o crash $(CFLAGS) $^ - -crash.pure: crash.o $(MYLIBS) - purify $(CC) -o crash.pure $(CFLAGS) $^ - diff --git a/security/nss/cmd/dbtest/Makefile b/security/nss/cmd/dbtest/Makefile index 0d4b54c29..0ff13ae43 100644 --- a/security/nss/cmd/dbtest/Makefile +++ b/security/nss/cmd/dbtest/Makefile @@ -60,7 +60,9 @@ endif ifeq (,$(filter-out WINNT WIN95 WIN16,$(OS_TARGET))) # omits WINCE ifndef BUILD_OPT +ifndef NS_USE_GCC LDFLAGS += /subsystem:console /profile /debug /machine:I386 /incremental:no +endif OS_CFLAGS += -D_CONSOLE endif endif diff --git a/security/nss/cmd/platlibs.mk b/security/nss/cmd/platlibs.mk index 4a9953461..a160c3176 100644 --- a/security/nss/cmd/platlibs.mk +++ b/security/nss/cmd/platlibs.mk @@ -39,7 +39,7 @@ ifeq ($(OS_ARCH), WINNT) DEFINES += -DNSS_USE_STATIC_LIBS # $(PROGRAM) has explicit dependencies on $(EXTRA_LIBS) -CRYPTOLIB=$(DIST)/lib/freebl.lib +CRYPTOLIB=$(DIST)/lib/$(LIB_PREFIX)freebl.$(LIB_SUFFIX) ifdef MOZILLA_SECURITY_BUILD CRYPTOLIB=$(DIST)/lib/crypto.lib endif @@ -49,28 +49,28 @@ ifdef MOZILLA_BSAFE_BUILD endif EXTRA_LIBS += \ - $(DIST)/lib/smime.lib \ - $(DIST)/lib/ssl.lib \ - $(DIST)/lib/nss.lib \ - $(DIST)/lib/ssl.lib \ - $(DIST)/lib/sectool.lib \ - $(DIST)/lib/pkcs12.lib \ - $(DIST)/lib/pkcs7.lib \ - $(DIST)/lib/certhi.lib \ - $(DIST)/lib/cryptohi.lib \ - $(DIST)/lib/pk11wrap.lib \ - $(DIST)/lib/certdb.lib \ - $(DIST)/lib/softokn.lib \ + $(DIST)/lib/$(LIB_PREFIX)smime.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)ssl.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)nss.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)ssl.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)sectool.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)pkcs12.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)pkcs7.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)certhi.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)cryptohi.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)pk11wrap.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)certdb.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)softokn.$(LIB_SUFFIX) \ $(CRYPTOLIB) \ - $(DIST)/lib/swfci.lib \ - $(DIST)/lib/secutil.lib \ - $(DIST)/lib/nsspki.lib \ - $(DIST)/lib/nssdev.lib \ - $(DIST)/lib/nssb.lib \ - $(DIST)/lib/dbm.lib \ - $(DIST)/lib/$(NSPR31_LIB_PREFIX)plc4.lib \ - $(DIST)/lib/$(NSPR31_LIB_PREFIX)plds4.lib \ - $(DIST)/lib/$(NSPR31_LIB_PREFIX)nspr4.lib \ + $(DIST)/lib/$(LIB_PREFIX)swfci.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)secutil.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)nsspki.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)nssdev.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)nssb.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)dbm.$(LIB_SUFFIX) \ + $(DIST)/lib/$(NSPR31_LIB_PREFIX)plc4.$(LIB_SUFFIX) \ + $(DIST)/lib/$(NSPR31_LIB_PREFIX)plds4.$(LIB_SUFFIX) \ + $(DIST)/lib/$(NSPR31_LIB_PREFIX)nspr4.$(LIB_SUFFIX) \ $(NULL) # $(PROGRAM) has NO explicit dependencies on $(OS_LIBS) @@ -79,8 +79,8 @@ EXTRA_LIBS += \ winmm.lib \ $(NULL) -JAR_LIBS = $(DIST)/lib/jar.lib \ - $(DIST)/lib/zlib.lib \ +JAR_LIBS = $(DIST)/lib/$(LIB_PREFIX)jar.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)zlib.$(LIB_SUFFIX) \ $(NULL) else @@ -150,13 +150,13 @@ ifeq ($(OS_ARCH), WINNT) # $(PROGRAM) has explicit dependencies on $(EXTRA_LIBS) EXTRA_LIBS += \ - $(DIST)/lib/sectool.lib \ - $(DIST)/lib/smime3.lib \ - $(DIST)/lib/ssl3.lib \ - $(DIST)/lib/nss3.lib \ - $(DIST)/lib/$(NSPR31_LIB_PREFIX)plc4.lib \ - $(DIST)/lib/$(NSPR31_LIB_PREFIX)plds4.lib \ - $(DIST)/lib/$(NSPR31_LIB_PREFIX)nspr4.lib \ + $(DIST)/lib/$(LIB_PREFIX)sectool.$(LIB_SUFFIX) \ + $(DIST)/lib/$(IMPORT_LIB_PREFIX)smime3$(IMPORT_LIB_SUFFIX) \ + $(DIST)/lib/$(IMPORT_LIB_PREFIX)ssl3$(IMPORT_LIB_SUFFIX) \ + $(DIST)/lib/$(IMPORT_LIB_PREFIX)nss3$(IMPORT_LIB_SUFFIX) \ + $(DIST)/lib/$(NSPR31_LIB_PREFIX)plc4.$(LIB_SUFFIX) \ + $(DIST)/lib/$(NSPR31_LIB_PREFIX)plds4.$(LIB_SUFFIX) \ + $(DIST)/lib/$(NSPR31_LIB_PREFIX)nspr4.$(LIB_SUFFIX) \ $(NULL) # $(PROGRAM) has NO explicit dependencies on $(OS_LIBS) @@ -165,8 +165,8 @@ EXTRA_LIBS += \ winmm.lib \ $(NULL) -JAR_LIBS = $(DIST)/lib/jar.lib \ - $(DIST)/lib/zlib.lib \ +JAR_LIBS = $(DIST)/lib/$(LIB_PREFIX)jar.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)zlib.$(LIB_SUFFIX) \ $(NULL) else @@ -179,24 +179,13 @@ ifeq ($(OS_ARCH), AIX) EXTRA_SHARED_LIBS += -brtl endif -# On Linux we must use the -rpath-link option to tell the linker -# where to find libsoftokn3.so, an implicit dependency of libnss3.so. -ifeq ($(OS_ARCH), Linux) +# If GNU ld is used, we must use the -rpath-link option to tell +# the linker where to find libsoftokn3.so, an implicit dependency +# of libnss3.so. +ifeq (,$(filter-out BSD_OS FreeBSD Linux NetBSD, $(OS_ARCH))) EXTRA_SHARED_LIBS += -Wl,-rpath-link,$(DIST)/lib endif -ifeq ($(OS_ARCH), BSD_OS) -EXTRA_SHARED_LIBS += -Wl,-rpath-link,$(DIST)/lib -endif - -ifeq ($(OS_ARCH), FreeBSD) -EXTRA_SHARED_LIBS += -Wl,-rpath-link,$(DIST)/lib -endif - -ifeq ($(OS_ARCH), Darwin) -EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib -endif - ifeq ($(OS_ARCH), SunOS) ifdef NS_USE_GCC ifdef GCC_USE_GNU_LD @@ -205,6 +194,10 @@ endif endif endif +ifeq ($(OS_ARCH), Darwin) +EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib +endif + # $(PROGRAM) has NO explicit dependencies on $(EXTRA_SHARED_LIBS) # $(EXTRA_SHARED_LIBS) come before $(OS_LIBS), except on AIX. diff --git a/security/nss/cmd/rsaperf/Makefile b/security/nss/cmd/rsaperf/Makefile index 1a555a2fe..35dc5f5da 100644 --- a/security/nss/cmd/rsaperf/Makefile +++ b/security/nss/cmd/rsaperf/Makefile @@ -55,7 +55,9 @@ include ../platlibs.mk ifeq (,$(filter-out WINNT WIN95 WIN16,$(OS_TARGET))) #omits WINCE ifndef BUILD_OPT +ifndef NS_USE_GCC LDFLAGS += /subsystem:console /profile /debug /machine:I386 /incremental:no +endif OS_CFLAGS += -D_CONSOLE endif endif diff --git a/security/nss/cmd/shlibsign/Makefile b/security/nss/cmd/shlibsign/Makefile index 9228540a1..11b458de9 100644 --- a/security/nss/cmd/shlibsign/Makefile +++ b/security/nss/cmd/shlibsign/Makefile @@ -75,7 +75,7 @@ ifdef LOADABLE_FREEBL CHECKFILES += freebl_pure32_3.chk freebl_hybrid_3.chk endif -CHECKLOC=$(addprefix $(DIST)/lib/$(LIB_PREFIX), $(CHECKFILES)) +CHECKLOC=$(addprefix $(DIST)/lib/$(DLL_PREFIX), $(CHECKFILES)) MD_LIB_RELEASE_FILES = $(CHECKLOC) ALL_TRASH += $(CHECKLOC) @@ -101,7 +101,7 @@ include ../platrules.mk %.chk: %.$(DLL_SUFFIX) ifeq ($(OS_TARGET), OS2) - -exec sign.cmd $(DIST) $(OBJDIR) $(OS_TARGET) $< + @cmd.exe /c sign.cmd $(DIST) $(OBJDIR) $(OS_TARGET) $< else @sh ./sign.sh $(DIST) $(OBJDIR) $(OS_TARGET) $< endif diff --git a/security/nss/cmd/shlibsign/sign.cmd b/security/nss/cmd/shlibsign/sign.cmd index 028334654..612609de9 100644 --- a/security/nss/cmd/shlibsign/sign.cmd +++ b/security/nss/cmd/shlibsign/sign.cmd @@ -5,6 +5,7 @@ objdir=forwardtoback(objdir); 'echo 'dist 'echo 'objdir 'set BEGINLIBPATH='dist'\lib;%BEGINLIBPATH%' +'set LIBPATHSTRICT=T' objdir'\shlibsign -v -i 'therest exit diff --git a/security/nss/cmd/tstclnt/Makefile b/security/nss/cmd/tstclnt/Makefile index 8a0332d89..b31a4fdc8 100644 --- a/security/nss/cmd/tstclnt/Makefile +++ b/security/nss/cmd/tstclnt/Makefile @@ -56,7 +56,9 @@ include ../platlibs.mk ifeq (,$(filter-out WINNT WIN95 WIN16,$(OS_TARGET))) # omits WINCE ifndef BUILD_OPT +ifndef NS_USE_GCC LDFLAGS += /subsystem:console /profile /debug /machine:I386 /incremental:no +endif OS_CFLAGS += -D_CONSOLE endif endif diff --git a/security/nss/cmd/vfyserv/Makefile b/security/nss/cmd/vfyserv/Makefile index 8a0332d89..b31a4fdc8 100644 --- a/security/nss/cmd/vfyserv/Makefile +++ b/security/nss/cmd/vfyserv/Makefile @@ -56,7 +56,9 @@ include ../platlibs.mk ifeq (,$(filter-out WINNT WIN95 WIN16,$(OS_TARGET))) # omits WINCE ifndef BUILD_OPT +ifndef NS_USE_GCC LDFLAGS += /subsystem:console /profile /debug /machine:I386 /incremental:no +endif OS_CFLAGS += -D_CONSOLE endif endif diff --git a/security/nss/lib/certdb/cert.h b/security/nss/lib/certdb/cert.h index bf1881e83..1131b1633 100644 --- a/security/nss/lib/certdb/cert.h +++ b/security/nss/lib/certdb/cert.h @@ -1481,7 +1481,7 @@ CERT_SPKDigestValueForCert(PRArenaPool *arena, CERTCertificate *cert, /* * fill in nsCertType field of the cert based on the cert extension */ -extern SECStatus CERT_GetCertType(CERTCertificate *cert); +extern SECStatus cert_GetCertType(CERTCertificate *cert); SECStatus CERT_CheckCRL(CERTCertificate* cert, CERTCertificate* issuer, diff --git a/security/nss/lib/certdb/certdb.c b/security/nss/lib/certdb/certdb.c index e6b5dc4b1..76c13e2de 100644 --- a/security/nss/lib/certdb/certdb.c +++ b/security/nss/lib/certdb/certdb.c @@ -523,7 +523,7 @@ findOIDinOIDSeqByTagNum(CERTOidSequence *seq, SECOidTag tagnum) * fill in nsCertType field of the cert based on the cert extension */ SECStatus -CERT_GetCertType(CERTCertificate *cert) +cert_GetCertType(CERTCertificate *cert) { SECStatus rv; SECItem tmpitem; @@ -531,6 +531,12 @@ CERT_GetCertType(CERTCertificate *cert) CERTOidSequence *extKeyUsage = NULL; PRBool basicConstraintPresent = PR_FALSE; CERTBasicConstraints basicConstraint; + unsigned int nsCertType = 0; + + if (cert->nsCertType) { + /* once set, no need to recalculate */ + return SECSuccess; + } tmpitem.data = NULL; CERT_FindNSCertTypeExtension(cert, &tmpitem); @@ -545,9 +551,9 @@ CERT_GetCertType(CERTCertificate *cert) } if (tmpitem.data != NULL || extKeyUsage != NULL) { if (tmpitem.data == NULL) { - cert->nsCertType = 0; + nsCertType = 0; } else { - cert->nsCertType = tmpitem.data[0]; + nsCertType = tmpitem.data[0]; } /* free tmpitem data pointer to avoid memory leak */ @@ -558,16 +564,16 @@ CERT_GetCertType(CERTCertificate *cert) * for this release, we will allow SSL certs with an email address * to be used for email */ - if ( ( cert->nsCertType & NS_CERT_TYPE_SSL_CLIENT ) && + if ( ( nsCertType & NS_CERT_TYPE_SSL_CLIENT ) && cert->emailAddr ) { - cert->nsCertType |= NS_CERT_TYPE_EMAIL; + nsCertType |= NS_CERT_TYPE_EMAIL; } /* * for this release, we will allow SSL intermediate CAs to be * email intermediate CAs too. */ - if ( cert->nsCertType & NS_CERT_TYPE_SSL_CA ) { - cert->nsCertType |= NS_CERT_TYPE_EMAIL_CA; + if ( nsCertType & NS_CERT_TYPE_SSL_CA ) { + nsCertType |= NS_CERT_TYPE_EMAIL_CA; } /* * allow a cert with the extended key usage of EMail Protect @@ -579,9 +585,9 @@ CERT_GetCertType(CERTCertificate *cert) SECSuccess) { if (basicConstraintPresent == PR_TRUE && (basicConstraint.isCA)) { - cert->nsCertType |= NS_CERT_TYPE_EMAIL_CA; + nsCertType |= NS_CERT_TYPE_EMAIL_CA; } else { - cert->nsCertType |= NS_CERT_TYPE_EMAIL; + nsCertType |= NS_CERT_TYPE_EMAIL; } } if (findOIDinOIDSeqByTagNum(extKeyUsage, @@ -589,9 +595,9 @@ CERT_GetCertType(CERTCertificate *cert) SECSuccess){ if (basicConstraintPresent == PR_TRUE && (basicConstraint.isCA)) { - cert->nsCertType |= NS_CERT_TYPE_SSL_CA; + nsCertType |= NS_CERT_TYPE_SSL_CA; } else { - cert->nsCertType |= NS_CERT_TYPE_SSL_SERVER; + nsCertType |= NS_CERT_TYPE_SSL_SERVER; } } if (findOIDinOIDSeqByTagNum(extKeyUsage, @@ -599,9 +605,9 @@ CERT_GetCertType(CERTCertificate *cert) SECSuccess){ if (basicConstraintPresent == PR_TRUE && (basicConstraint.isCA)) { - cert->nsCertType |= NS_CERT_TYPE_SSL_CA; + nsCertType |= NS_CERT_TYPE_SSL_CA; } else { - cert->nsCertType |= NS_CERT_TYPE_SSL_CLIENT; + nsCertType |= NS_CERT_TYPE_SSL_CLIENT; } } if (findOIDinOIDSeqByTagNum(extKeyUsage, @@ -609,43 +615,43 @@ CERT_GetCertType(CERTCertificate *cert) SECSuccess) { if (basicConstraintPresent == PR_TRUE && (basicConstraint.isCA)) { - cert->nsCertType |= NS_CERT_TYPE_OBJECT_SIGNING_CA; + nsCertType |= NS_CERT_TYPE_OBJECT_SIGNING_CA; } else { - cert->nsCertType |= NS_CERT_TYPE_OBJECT_SIGNING; + nsCertType |= NS_CERT_TYPE_OBJECT_SIGNING; } } if (findOIDinOIDSeqByTagNum(extKeyUsage, SEC_OID_EXT_KEY_USAGE_TIME_STAMP) == SECSuccess) { - cert->nsCertType |= EXT_KEY_USAGE_TIME_STAMP; + nsCertType |= EXT_KEY_USAGE_TIME_STAMP; } if (findOIDinOIDSeqByTagNum(extKeyUsage, SEC_OID_OCSP_RESPONDER) == SECSuccess) { - cert->nsCertType |= EXT_KEY_USAGE_STATUS_RESPONDER; + nsCertType |= EXT_KEY_USAGE_STATUS_RESPONDER; } } else { /* if no extension, then allow any ssl or email (no ca or object * signing) */ - cert->nsCertType = NS_CERT_TYPE_SSL_CLIENT | NS_CERT_TYPE_SSL_SERVER | + nsCertType = NS_CERT_TYPE_SSL_CLIENT | NS_CERT_TYPE_SSL_SERVER | NS_CERT_TYPE_EMAIL; /* if the basic constraint extension says the cert is a CA, then allow SSL CA and EMAIL CA and Status Responder */ if ((basicConstraintPresent == PR_TRUE) && (basicConstraint.isCA)) { - cert->nsCertType |= NS_CERT_TYPE_SSL_CA; - cert->nsCertType |= NS_CERT_TYPE_EMAIL_CA; - cert->nsCertType |= EXT_KEY_USAGE_STATUS_RESPONDER; + nsCertType |= NS_CERT_TYPE_SSL_CA; + nsCertType |= NS_CERT_TYPE_EMAIL_CA; + nsCertType |= EXT_KEY_USAGE_STATUS_RESPONDER; } else if (CERT_IsCACert(cert, NULL) == PR_TRUE) { - cert->nsCertType |= EXT_KEY_USAGE_STATUS_RESPONDER; + nsCertType |= EXT_KEY_USAGE_STATUS_RESPONDER; } /* if the cert is a fortezza CA cert, then allow SSL CA and EMAIL CA */ if (fortezzaIsCA(cert)) { - cert->nsCertType |= NS_CERT_TYPE_SSL_CA; - cert->nsCertType |= NS_CERT_TYPE_EMAIL_CA; + nsCertType |= NS_CERT_TYPE_SSL_CA; + nsCertType |= NS_CERT_TYPE_EMAIL_CA; } } @@ -653,6 +659,7 @@ CERT_GetCertType(CERTCertificate *cert) PORT_Free(encodedExtKeyUsage.data); CERT_DestroyOidSequence(extKeyUsage); } + PR_AtomicSet(&cert->nsCertType, nsCertType); return(SECSuccess); } @@ -877,7 +884,7 @@ CERT_DecodeDERCertificate(SECItem *derSignedCert, PRBool copyDER, } /* initialize the certType */ - rv = CERT_GetCertType(cert); + rv = cert_GetCertType(cert); if ( rv != SECSuccess ) { goto loser; } diff --git a/security/nss/lib/certhigh/certvfy.c b/security/nss/lib/certhigh/certvfy.c index 2aaad95e8..87ef671ef 100644 --- a/security/nss/lib/certhigh/certvfy.c +++ b/security/nss/lib/certhigh/certvfy.c @@ -1265,7 +1265,7 @@ CERT_VerifyCertificate(CERTCertDBHandle *handle, CERTCertificate *cert, } /* check key usage and netscape cert type */ - CERT_GetCertType(cert); + cert_GetCertType(cert); certType = cert->nsCertType; for (i=1;i<=certificateUsageHighest && !(SECFailure == valid && !returnedUsages) ;) { @@ -1487,7 +1487,7 @@ CERT_VerifyCert(CERTCertDBHandle *handle, CERTCertificate *cert, } /* check key usage and netscape cert type */ - CERT_GetCertType(cert); + cert_GetCertType(cert); certType = cert->nsCertType; switch ( certUsage ) { case certUsageSSLClient: diff --git a/security/nss/lib/ckfw/builtins/Makefile b/security/nss/lib/ckfw/builtins/Makefile index 7c392f2c9..164e0c369 100644 --- a/security/nss/lib/ckfw/builtins/Makefile +++ b/security/nss/lib/ckfw/builtins/Makefile @@ -44,10 +44,22 @@ EXTRA_LIBS = \ # can't do this in manifest.mn because OS_TARGET isn't defined there. ifeq (,$(filter-out WIN%,$(OS_TARGET))) +# Link with the real NSPR DLLs for MinGW because the NSPR stubs in +# nsprstub.c can't resolve the references to the _imp__PR_XXX symbols. +# This is merely an expedient hack and not the right solution. +ifdef NS_USE_GCC +EXTRA_LIBS += \ + -L$(DIST)/lib \ + -lplc4 \ + -lplds4 \ + -lnspr4 \ + $(NULL) +else EXTRA_LIBS += \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)plc4_s.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)plds4_s.lib \ $(NULL) +endif else diff --git a/security/nss/lib/ckfw/builtins/config.mk b/security/nss/lib/ckfw/builtins/config.mk index f9fdb5702..f4d64b0f0 100644 --- a/security/nss/lib/ckfw/builtins/config.mk +++ b/security/nss/lib/ckfw/builtins/config.mk @@ -43,7 +43,7 @@ IMPORT_LIBRARY = PROGRAM = ifeq (,$(filter-out OS2 WIN%,$(OS_TARGET))) - SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).dll + SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) endif ifdef BUILD_IDG diff --git a/security/nss/lib/ckfw/builtins/manifest.mn b/security/nss/lib/ckfw/builtins/manifest.mn index 23360f081..86a794fbd 100644 --- a/security/nss/lib/ckfw/builtins/manifest.mn +++ b/security/nss/lib/ckfw/builtins/manifest.mn @@ -35,6 +35,7 @@ MANIFEST_CVS_ID = "@(#) $RCSfile$ $Revision$ $Date$ $Name$" CORE_DEPTH = ../../../.. MODULE = nss +MAPFILE = $(OBJDIR)/nssckbi.def EXPORTS = \ nssckbi.h \ diff --git a/security/nss/lib/ckfw/builtins/nssckbi.def b/security/nss/lib/ckfw/builtins/nssckbi.def new file mode 100644 index 000000000..c0fd99c04 --- /dev/null +++ b/security/nss/lib/ckfw/builtins/nssckbi.def @@ -0,0 +1,53 @@ +;+# +;+# The contents of this file are subject to the Mozilla Public +;+# License Version 1.1 (the "License"); you may not use this file +;+# except in compliance with the License. You may obtain a copy of +;+# the License at http://www.mozilla.org/MPL/ +;+# +;+# Software distributed under the License is distributed on an "AS +;+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +;+# implied. See the License for the specific language governing +;+# rights and limitations under the License. +;+# +;+# The Original Code is the Netscape security libraries. +;+# +;+# The Initial Developer of the Original Code is Netscape +;+# Communications Corporation. Portions created by Netscape are +;+# Copyright (C) 2003 Netscape Communications Corporation. All +;+# Rights Reserved. +;+# +;+# Contributor(s): +;+# +;+# Alternatively, the contents of this file may be used under the +;+# terms of the GNU General Public License Version 2 or later (the +;+# "GPL"), in which case the provisions of the GPL are applicable +;+# instead of those above. If you wish to allow use of your +;+# version of this file only under the terms of the GPL and not to +;+# allow others to use your version of this file under the MPL, +;+# indicate your decision by deleting the provisions above and +;+# replace them with the notice and other provisions required by +;+# the GPL. If you do not delete the provisions above, a recipient +;+# may use your version of this file under either the MPL or the +;+# GPL. +;+# +;+# OK, this file is meant to support SUN, LINUX, AIX and WINDOWS +;+# 1. For all unix platforms, the string ";-" means "remove this line" +;+# 2. For all unix platforms, the string " DATA " will be removed from any +;+# line on which it occurs. +;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX. +;+# On AIX, lines containing ";+" will be removed. +;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed. +;+# 5. For all unix platforms, after the above processing has taken place, +;+# all characters after the first ";" on the line will be removed. +;+# And for AIX, the first ";" will also be removed. +;+# This file is passed directly to windows. Since ';' is a comment, all UNIX +;+# directives are hidden behind ";", ";+", and ";-" +;+ +;+NSS_3.1 { # NSS 3.1 release +;+ global: +LIBRARY nssckbi ;- +EXPORTS ;- +C_GetFunctionList; +;+ local: +;+*; +;+}; diff --git a/security/nss/lib/ckfw/ckapi.perl b/security/nss/lib/ckfw/ckapi.perl index 09dfc9199..da757f5a4 100644 --- a/security/nss/lib/ckfw/ckapi.perl +++ b/security/nss/lib/ckfw/ckapi.perl @@ -489,11 +489,7 @@ __ADJOIN(MODULE_NAME,C_GetFunctionList) } /* This one is always present */ -#ifdef WIN32 -CK_RV _declspec(dllexport) -#else CK_RV CK_ENTRY -#endif C_GetFunctionList ( CK_FUNCTION_LIST_PTR_PTR ppFunctionList diff --git a/security/nss/lib/ckfw/nsprstub.c b/security/nss/lib/ckfw/nsprstub.c index c9e3964d9..0801023d4 100644 --- a/security/nss/lib/ckfw/nsprstub.c +++ b/security/nss/lib/ckfw/nsprstub.c @@ -283,6 +283,12 @@ nssPointerTracker_verify(nssPointerTracker *tracker, const void *pointer) } #endif +/* + * Do not use NSPR stubs for MinGW because they can't resolve references + * to the _imp__PR_XXX symbols. This is merely an expedient hack and not + * the right solution. + */ +#if !(defined(WIN32) && defined(__GNUC__)) PR_IMPLEMENT(PRThread *) PR_GetCurrentThread(void) { @@ -337,6 +343,7 @@ PR_IMPLEMENT(PRInt32) PR_AtomicSet(PRInt32 *val) { return ++(*val); } /* now make the RNG happy */ /* This is not atomic! */ PR_IMPLEMENT(PRInt32) PR_AtomicIncrement(PRInt32 *val) { return ++(*val); } +#endif /* ! (WIN32 && GCC) */ CK_C_INITIALIZE_ARGS_PTR nssstub_initArgs = NULL; NSSArena *nssstub_arena = NULL; @@ -349,6 +356,12 @@ nssSetLockArgs(CK_C_INITIALIZE_ARGS_PTR pInitArgs) } } +/* + * Do not use NSPR stubs for MinGW because they can't resolve references + * to the _imp__PR_XXX symbols. This is merely an expedient hack and not + * the right solution. + */ +#if !(defined(WIN32) && defined(__GNUC__)) #include "prlock.h" PR_IMPLEMENT(PRLock *) PR_NewLock(void) { @@ -437,6 +450,7 @@ PRIntn PR_CeilingLog2(PRUint32 i) { PR_CEILING_LOG2(log2,i); return log2; } +#endif /* ! (WIN32 && GCC) */ /********************** end of arena functions ***********************/ diff --git a/security/nss/lib/ckfw/nssck.api b/security/nss/lib/ckfw/nssck.api index 4cbe5e8cc..2e8fbd70c 100644 --- a/security/nss/lib/ckfw/nssck.api +++ b/security/nss/lib/ckfw/nssck.api @@ -1874,11 +1874,7 @@ __ADJOIN(MODULE_NAME,C_GetFunctionList) } /* This one is always present */ -#if defined(WIN32) || defined(XP_OS2_VACPP) -CK_RV _declspec(dllexport) -#else CK_RV CK_ENTRY -#endif C_GetFunctionList ( CK_FUNCTION_LIST_PTR_PTR ppFunctionList diff --git a/security/nss/lib/dev/dev.h b/security/nss/lib/dev/dev.h index 43ad7ac98..4495be2f5 100644 --- a/security/nss/lib/dev/dev.h +++ b/security/nss/lib/dev/dev.h @@ -323,6 +323,18 @@ nssSlot_Logout nssSession *sessionOpt ); +NSS_EXTERN void +nssSlot_EnterMonitor +( + NSSSlot *slot +); + +NSS_EXTERN void +nssSlot_ExitMonitor +( + NSSSlot *slot +); + #define NSSSLOT_ASK_PASSWORD_FIRST_TIME -1 #define NSSSLOT_ASK_PASSWORD_EVERY_TIME 0 NSS_EXTERN void diff --git a/security/nss/lib/dev/devslot.c b/security/nss/lib/dev/devslot.c index 81cd512d5..ca26a74ef 100644 --- a/security/nss/lib/dev/devslot.c +++ b/security/nss/lib/dev/devslot.c @@ -76,6 +76,7 @@ struct NSSSlotStr CK_FLAGS ckFlags; /* from CK_SLOT_INFO.flags */ struct nssSlotAuthInfoStr authInfo; PRIntervalTime lastTokenPing; + PZLock *lock; #ifdef NSS_3_4_CODE PK11SlotInfo *pk11slot; #endif @@ -151,6 +152,9 @@ nssSlot_Create if (!rvSlot->base.lock) { goto loser; } + if (!nssModule_IsThreadSafe(parent)) { + rvSlot->lock = nssModule_GetLock(parent); + } rvSlot->module = parent; /* refs go from module to slots */ rvSlot->slotID = slotID; rvSlot->ckFlags = slotInfo.flags; @@ -190,6 +194,22 @@ nssSlot_Destroy return PR_SUCCESS; } +void +nssSlot_EnterMonitor(NSSSlot *slot) +{ + if (slot->lock) { + PZ_Lock(slot->lock); + } +} + +void +nssSlot_ExitMonitor(NSSSlot *slot) +{ + if (slot->lock) { + PZ_Unlock(slot->lock); + } +} + NSS_IMPLEMENT void NSSSlot_Destroy ( @@ -274,7 +294,9 @@ nssSlot_IsTokenPresent if (!epv) { return PR_FALSE; } + nssSlot_EnterMonitor(slot); ckrv = CKAPI(epv)->C_GetSlotInfo(slot->slotID, &slotInfo); + nssSlot_ExitMonitor(slot); if (ckrv != CKR_OK) { slot->token->base.name[0] = 0; /* XXX */ return PR_FALSE; @@ -772,9 +794,9 @@ nssSlot_CreateSession if (!rvSession) { return (nssSession *)NULL; } - if (!nssModule_IsThreadSafe(slot->module)) { - /* If the parent module is not threadsafe, create lock to manage - * session within threads. + if (nssModule_IsThreadSafe(slot->module)) { + /* If the parent module is threadsafe, + * create lock to protect just this session. */ rvSession->lock = PZ_NewLock(nssILockOther); if (!rvSession->lock) { @@ -785,7 +807,12 @@ nssSlot_CreateSession } return (nssSession *)NULL; } + rvSession->ownLock = PR_TRUE; + } else { + rvSession->lock = slot->lock; + rvSession->ownLock = PR_FALSE; } + rvSession->handle = handle; rvSession->slot = slot; rvSession->isRW = readWrite; @@ -802,7 +829,7 @@ nssSession_Destroy if (s) { void *epv = s->slot->epv; ckrv = CKAPI(epv)->C_CloseSession(s->handle); - if (s->lock) { + if (s->ownLock && s->lock) { PZ_DestroyLock(s->lock); } nss_ZFreeIf(s); diff --git a/security/nss/lib/dev/devt.h b/security/nss/lib/dev/devt.h index 10a7978c3..002f31144 100644 --- a/security/nss/lib/dev/devt.h +++ b/security/nss/lib/dev/devt.h @@ -124,6 +124,7 @@ struct NSSSlotStr CK_FLAGS ckFlags; /* from CK_SLOT_INFO.flags */ struct nssSlotAuthInfoStr authInfo; PRIntervalTime lastTokenPing; + PZLock *lock; #ifdef NSS_3_4_CODE void *epv; PK11SlotInfo *pk11slot; @@ -136,6 +137,7 @@ struct nssSessionStr CK_SESSION_HANDLE handle; NSSSlot *slot; PRBool isRW; + PRBool ownLock; }; typedef enum { diff --git a/security/nss/lib/fortcrypt/Makefile b/security/nss/lib/fortcrypt/Makefile index 40609cb98..b3913b3a0 100644 --- a/security/nss/lib/fortcrypt/Makefile +++ b/security/nss/lib/fortcrypt/Makefile @@ -109,11 +109,19 @@ endif ifeq (,$(filter-out WIN%,$(OS_TARGET))) $(STUBDLL): $(OBJDIR)/maci.o +ifdef NS_USE_GCC + $(LINK_DLL) -Wl,--out-implib,$(STUBLIB) $(OBJDIR)/maci.o $(OS_LIBS) +else $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJDIR)/maci.o $(OS_LIBS)) +endif $(OBJDIR)/maci.o: maci.c +ifdef NS_USE_GCC + $(CC) -o $@ -c $(CFLAGS) $< +else $(CC) -Fo$@ -c $(CFLAGS) $< endif +endif # # The following rules packages the shared library into a JAR, diff --git a/security/nss/lib/fortcrypt/maci.h b/security/nss/lib/fortcrypt/maci.h index eb38ff81c..cab61ace8 100644 --- a/security/nss/lib/fortcrypt/maci.h +++ b/security/nss/lib/fortcrypt/maci.h @@ -78,7 +78,7 @@ extern "C" #ifndef RETURN_TYPE #if defined( _WIN32 ) || defined( __WIN32__ ) -#define RETURN_TYPE extern _declspec( dllimport ) int _cdecl +#define RETURN_TYPE extern __declspec( dllimport ) int _cdecl #elif defined( _WINDOWS ) || defined( _Windows ) #define RETURN_TYPE extern int _far _pascal #else diff --git a/security/nss/lib/fortcrypt/swfort/pkcs11/Makefile b/security/nss/lib/fortcrypt/swfort/pkcs11/Makefile index c148b325c..44e50063b 100644 --- a/security/nss/lib/fortcrypt/swfort/pkcs11/Makefile +++ b/security/nss/lib/fortcrypt/swfort/pkcs11/Makefile @@ -50,6 +50,23 @@ CRYPTO_LIB += $(DIST)/lib/bsafe$(BSAFEVER).lib CRYPTO_LIB += $(DIST)/lib/freebl.lib endif +# Link with the real NSPR DLLs for MinGW because the NSPR stubs in +# stub.c can't resolve the references to the _imp__PR_XXX symbols. +# This is merely an expedient hack and not the right solution. +ifdef NS_USE_GCC +EXTRA_LIBS = \ + $(DIST)/lib/$(LIB_PREFIX)swfci.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)softokn.$(LIB_SUFFIX) \ + $(CRYPTO_LIB) \ + $(DIST)/lib/$(LIB_PREFIX)secutil.$(LIB_SUFFIX) \ + -L$(DIST)/lib \ + -lplc4 \ + -lplds4 \ + -lnspr4 \ + -lws2_32 \ + -lwinmm \ + $(NULL) +else # ! NS_USE_GCC EXTRA_LIBS = \ $(DIST)/lib/swfci.lib \ $(DIST)/lib/softokn.lib \ @@ -60,6 +77,7 @@ EXTRA_LIBS = \ wsock32.lib \ winmm.lib \ $(NULL) +endif # NS_USE_GCC else diff --git a/security/nss/lib/fortcrypt/swfort/pkcs11/stub.c b/security/nss/lib/fortcrypt/swfort/pkcs11/stub.c index 0f673e77b..12ce3cd27 100644 --- a/security/nss/lib/fortcrypt/swfort/pkcs11/stub.c +++ b/security/nss/lib/fortcrypt/swfort/pkcs11/stub.c @@ -234,6 +234,12 @@ PORT_ArenaStrdup(PLArenaPool *arena,const char *str) { return newstr; } +/* + * Do not use NSPR stubs for MinGW because they can't resolve references + * to the _imp__PR_XXX symbols. This is merely an expedient hack and not + * the right solution. + */ +#if !(defined(WIN32) && defined(__GNUC__)) PR_IMPLEMENT(void) PR_Assert(const char *expr, const char *file, int line) { return; @@ -256,6 +262,7 @@ PR_SetError(PRErrorCode errorCode, PRInt32 oserr) { return; } PR_IMPLEMENT(void) PR_SetErrorText(PRIntn textLength, const char *text) { return; } +#endif /* ! (WIN32 && GCC) */ /* Old template; want to expunge it eventually. */ @@ -272,6 +279,12 @@ const SEC_ASN1Template SECOID_AlgorithmIDTemplate[] = { { 0, } }; +/* + * Do not use NSPR stubs for MinGW because they can't resolve references + * to the _imp__PR_XXX symbols. This is merely an expedient hack and not + * the right solution. + */ +#if !(defined(WIN32) && defined(__GNUC__)) /* now make the RNG happy */ /* This is not atomic! */ PR_IMPLEMENT(PRInt32) PR_AtomicIncrement(PRInt32 *val) { return ++(*val); } /* This is not atomic! */ @@ -358,6 +371,7 @@ PRIntn PR_CeilingLog2(PRUint32 i) { PR_CEILING_LOG2(log2,i); return log2; } +#endif /* ! (WIN32 && GCC) */ /********************** end of arena functions ***********************/ diff --git a/security/nss/lib/freebl/Makefile b/security/nss/lib/freebl/Makefile index ba73f4e8c..aa0b5c6a4 100644 --- a/security/nss/lib/freebl/Makefile +++ b/security/nss/lib/freebl/Makefile @@ -78,12 +78,25 @@ ifeq ($(OS_TARGET),OSF1) endif ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET))) #omits WIN16 and WINCE +ifdef NS_USE_GCC +# Ideally, we want to use assembler +# ASFILES = mpi_x86.s +# DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE \ +# -DMP_ASSEMBLY_DIV_2DX1D +# but we haven't figured out how to make it work, so we are not +# using assembler right now. + ASFILES = + DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT +else ASFILES = mpi_x86.asm DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE -DMP_ASSEMBLY_DIV_2DX1D +endif ifdef BUILD_OPT +ifndef NS_USE_GCC OPTIMIZER += -Ox # maximum optimization for freebl endif endif +endif ifeq ($(OS_TARGET),WINCE) DEFINES += -DMP_ARGCHK=0 # no assert in WinCE diff --git a/security/nss/lib/freebl/shvfy.c b/security/nss/lib/freebl/shvfy.c index 084ba0161..67d87dc8a 100644 --- a/security/nss/lib/freebl/shvfy.c +++ b/security/nss/lib/freebl/shvfy.c @@ -42,6 +42,7 @@ #include "blapi.h" #include "seccomon.h" #include "stdio.h" +#include "prmem.h" /* #define DEBUG_SHVERIFY 1 */ diff --git a/security/nss/lib/nss/config.mk b/security/nss/lib/nss/config.mk index 693b6d31a..4ca5480f3 100644 --- a/security/nss/lib/nss/config.mk +++ b/security/nss/lib/nss/config.mk @@ -40,18 +40,28 @@ ifeq (,$(filter-out WIN%,$(OS_TARGET))) # don't want the 32 in the shared library name -SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).dll -IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).lib +SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) +IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX) RES = $(OBJDIR)/$(LIBRARY_NAME).res RESNAME = $(LIBRARY_NAME).rc +ifdef NS_USE_GCC +EXTRA_SHARED_LIBS += \ + -L$(DIST)/lib \ + -lsoftokn3 \ + -lplc4 \ + -lplds4 \ + -lnspr4\ + $(NULL) +else # ! NS_USE_GCC EXTRA_SHARED_LIBS += \ $(DIST)/lib/softokn3.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)plc4.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)plds4.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)nspr4.lib \ $(NULL) +endif # NS_USE_GCC else @@ -99,8 +109,10 @@ MKSHLIB += -R '$$ORIGIN' endif ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET))) +ifndef NS_USE_GCC # Export 'mktemp' to be backward compatible with NSS 3.2.x and 3.3.x # but do not put it in the import library. See bug 142575. DEFINES += -DWIN32_NSS3_DLL_COMPAT DLLFLAGS += -EXPORT:mktemp=nss_mktemp,PRIVATE endif +endif diff --git a/security/nss/lib/nss/nss.h b/security/nss/lib/nss/nss.h index 29b6bf4bc..e6baca71c 100644 --- a/security/nss/lib/nss/nss.h +++ b/security/nss/lib/nss/nss.h @@ -49,11 +49,11 @@ SEC_BEGIN_PROTOS * The format of the version string should be * "<major version>.<minor version>[.<patch level>] [<Beta>]" */ -#define NSS_VERSION "3.8" +#define NSS_VERSION "3.8.1 Beta" #define NSS_VMAJOR 3 #define NSS_VMINOR 8 -#define NSS_VPATCH 0 -#define NSS_BETA PR_FALSE +#define NSS_VPATCH 1 +#define NSS_BETA PR_TRUE /* diff --git a/security/nss/lib/pk11wrap/dev3hack.c b/security/nss/lib/pk11wrap/dev3hack.c index 3f704436d..2c7ee38f2 100644 --- a/security/nss/lib/pk11wrap/dev3hack.c +++ b/security/nss/lib/pk11wrap/dev3hack.c @@ -67,6 +67,7 @@ nssSession_ImportNSS3Session(NSSArena *arenaOpt, rvSession = nss_ZNEW(arenaOpt, nssSession); rvSession->handle = session; rvSession->lock = lock; + rvSession->ownLock = PR_FALSE; rvSession->isRW = rw; return rvSession; } @@ -92,6 +93,23 @@ nssSlot_CreateSession } rvSession->isRW = PR_TRUE; rvSession->slot = slot; + /* + * The session doesn't need its own lock. Here's why. + * 1. If we are reusing the default RW session of the slot, + * the slot lock is already locked to protect the session. + * 2. If the module is not thread safe, the slot (or rather + * module) lock is already locked. + * 3. If the module is thread safe and we are using a new + * session, no higher-level lock has been locked and we + * would need a lock for the new session. However, the + * NSS_3_4_CODE usage of the session is that it is always + * used and destroyed within the same function and never + * shared with another thread. + * So the session is either already protected by another + * lock or only used by one thread. + */ + rvSession->lock = NULL; + rvSession->ownLock = PR_FALSE; return rvSession; } else { return NULL; @@ -136,6 +154,7 @@ nssSlot_CreateFromPK11SlotInfo(NSSTrustDomain *td, PK11SlotInfo *nss3slot) rvSlot->slotID = nss3slot->slotID; /* Grab the slot name from the PKCS#11 fixed-length buffer */ rvSlot->base.name = nssUTF8_Duplicate(nss3slot->slot_name,td->arena); + rvSlot->lock = (nss3slot->isThreadSafe) ? NULL : nss3slot->sessionLock; return rvSlot; } diff --git a/security/nss/lib/pk11wrap/pk11func.h b/security/nss/lib/pk11wrap/pk11func.h index 4747fe6ea..115a42bb3 100644 --- a/security/nss/lib/pk11wrap/pk11func.h +++ b/security/nss/lib/pk11wrap/pk11func.h @@ -83,7 +83,7 @@ CK_SESSION_HANDLE PK11_GetRWSession(PK11SlotInfo *slot); void PK11_RestoreROSession(PK11SlotInfo *slot,CK_SESSION_HANDLE rwsession); PRBool PK11_RWSessionHasLock(PK11SlotInfo *slot, CK_SESSION_HANDLE session_handle); -PK11SlotInfo *PK11_NewSlotInfo(void); +PK11SlotInfo *PK11_NewSlotInfo(SECMODModule *mod); SECStatus PK11_Logout(PK11SlotInfo *slot); void PK11_LogoutAll(void); void PK11_EnterSlotMonitor(PK11SlotInfo *); diff --git a/security/nss/lib/pk11wrap/pk11load.c b/security/nss/lib/pk11wrap/pk11load.c index f9ff7d506..4da327680 100644 --- a/security/nss/lib/pk11wrap/pk11load.c +++ b/security/nss/lib/pk11wrap/pk11load.c @@ -271,7 +271,7 @@ SECMOD_LoadPKCS11Module(SECMODModule *mod) { /* Initialize each slot */ for (i=0; i < (int)slotCount; i++) { - mod->slots[i] = PK11_NewSlotInfo(); + mod->slots[i] = PK11_NewSlotInfo(mod); PK11_InitSlot(mod,slotIDs[i],mod->slots[i]); /* look down the slot info table */ PK11_LoadSlotList(mod->slots[i],mod->slotInfo,mod->slotInfoCount); diff --git a/security/nss/lib/pk11wrap/pk11slot.c b/security/nss/lib/pk11wrap/pk11slot.c index 74816b485..055aa178e 100644 --- a/security/nss/lib/pk11wrap/pk11slot.c +++ b/security/nss/lib/pk11wrap/pk11slot.c @@ -398,7 +398,7 @@ PK11_FindSlotElement(PK11SlotList *list,PK11SlotInfo *slot) * Create a new slot structure */ PK11SlotInfo * -PK11_NewSlotInfo(void) +PK11_NewSlotInfo(SECMODModule *mod) { PK11SlotInfo *slot; @@ -411,7 +411,8 @@ PK11_NewSlotInfo(void) PORT_Free(slot); return slot; } - slot->sessionLock = PZ_NewLock(nssILockSession); + slot->sessionLock = mod->isThreadSafe ? + PZ_NewLock(nssILockSession) : (PZLock *)mod->refLock; if (slot->sessionLock == NULL) { PZ_DestroyLock(slot->refLock); PORT_Free(slot); @@ -419,7 +420,9 @@ PK11_NewSlotInfo(void) } slot->freeListLock = PZ_NewLock(nssILockFreelist); if (slot->freeListLock == NULL) { - PZ_DestroyLock(slot->sessionLock); + if (mod->isThreadSafe) { + PZ_DestroyLock(slot->sessionLock); + } PZ_DestroyLock(slot->refLock); PORT_Free(slot); return slot; @@ -498,26 +501,26 @@ PK11_DestroySlot(PK11SlotInfo *slot) if (slot->mechanismList) { PORT_Free(slot->mechanismList); } - - /* finally Tell our parent module that we've gone away so it can unload */ - if (slot->module) { - SECMOD_SlotDestroyModule(slot->module,PR_TRUE); - } #ifdef PKCS11_USE_THREADS if (slot->refLock) { PZ_DestroyLock(slot->refLock); slot->refLock = NULL; } - if (slot->sessionLock) { + if (slot->isThreadSafe && slot->sessionLock) { PZ_DestroyLock(slot->sessionLock); - slot->sessionLock = NULL; } + slot->sessionLock = NULL; if (slot->freeListLock) { PZ_DestroyLock(slot->freeListLock); slot->freeListLock = NULL; } #endif + /* finally Tell our parent module that we've gone away so it can unload */ + if (slot->module) { + SECMOD_SlotDestroyModule(slot->module,PR_TRUE); + } + /* ok, well not quit finally... now we free the memory */ PORT_Free(slot); } @@ -4756,7 +4759,7 @@ PK11_WaitForTokenEvent(PK11SlotInfo *slot, PK11TokenEvent event, if (waitForRemoval && series != PK11_GetSlotSeries(slot)) { return PK11TokenChanged; } - if (timeout != PR_INTERVAL_NO_WAIT) { + if (timeout == PR_INTERVAL_NO_WAIT) { return waitForRemoval ? PK11TokenPresent : PK11TokenRemoved; } if (timeout != PR_INTERVAL_NO_TIMEOUT ) { diff --git a/security/nss/lib/smime/cmsdecode.c b/security/nss/lib/smime/cmsdecode.c index 906fbaa25..8ba2b33dd 100644 --- a/security/nss/lib/smime/cmsdecode.c +++ b/security/nss/lib/smime/cmsdecode.c @@ -59,6 +59,13 @@ struct NSSCMSDecoderContextStr { void * cb_arg; }; +struct NSSCMSDecoderDataStr { + SECItem data; /* must be first */ + unsigned int totalBufferSize; +}; + +typedef struct NSSCMSDecoderDataStr NSSCMSDecoderData; + static void nss_cms_decoder_update_filter (void *arg, const char *data, unsigned long len, int depth, SEC_ASN1EncodingPart data_kind); static SECStatus nss_cms_before_data(NSSCMSDecoderContext *p7dcx); @@ -66,9 +73,26 @@ static SECStatus nss_cms_after_data(NSSCMSDecoderContext *p7dcx); static SECStatus nss_cms_after_end(NSSCMSDecoderContext *p7dcx); static void nss_cms_decoder_work_data(NSSCMSDecoderContext *p7dcx, const unsigned char *data, unsigned long len, PRBool final); +static NSSCMSDecoderData *nss_cms_create_decoder_data(PRArenaPool *poolp); extern const SEC_ASN1Template NSSCMSMessageTemplate[]; +static NSSCMSDecoderData * +nss_cms_create_decoder_data(PRArenaPool *poolp) +{ + NSSCMSDecoderData *decoderData = NULL; + + decoderData = (NSSCMSDecoderData *) + PORT_ArenaAlloc(poolp,sizeof(NSSCMSDecoderData)); + if (!decoderData) { + return NULL; + } + decoderData->data.data = NULL; + decoderData->data.len = 0; + decoderData->totalBufferSize = 0; + return decoderData; +} + /* * nss_cms_decoder_notify - * this is the driver of the decoding process. It gets called by the ASN.1 @@ -250,8 +274,8 @@ nss_cms_before_data(NSSCMSDecoderContext *p7dcx) childtype = NSS_CMSContentInfo_GetContentTypeTag(cinfo); if (childtype == SEC_OID_PKCS7_DATA) { - cinfo->content.data = SECITEM_AllocItem(poolp, NULL, 0); - if (cinfo->content.data == NULL) + cinfo->content.pointer = (void *) nss_cms_create_decoder_data(poolp); + if (cinfo->content.pointer == NULL) /* set memory error */ return SECFailure; @@ -414,7 +438,6 @@ nss_cms_decoder_work_data(NSSCMSDecoderContext *p7dcx, unsigned char *dest; unsigned int offset; SECStatus rv; - SECItem *storage; /* * We should really have data to process, or we should be trying @@ -510,27 +533,30 @@ nss_cms_decoder_work_data(NSSCMSDecoderContext *p7dcx, if (NSS_CMSContentInfo_GetContentTypeTag(cinfo) == SEC_OID_PKCS7_DATA) { /* store it in "inner" data item as well */ /* find the DATA item in the encapsulated cinfo and store it there */ - storage = cinfo->content.data; - - offset = storage->len; - if (storage->len == 0) { - dest = (unsigned char *)PORT_ArenaAlloc(p7dcx->cmsg->poolp, len); - } else { - dest = (unsigned char *)PORT_ArenaGrow(p7dcx->cmsg->poolp, - storage->data, - storage->len, - storage->len + len); - } - if (dest == NULL) { - p7dcx->error = SEC_ERROR_NO_MEMORY; - goto loser; - } + NSSCMSDecoderData *decoderData = + (NSSCMSDecoderData *)cinfo->content.pointer; + SECItem *dataItem = &decoderData->data; + + offset = dataItem->len; + if (dataItem->len+len > decoderData->totalBufferSize) { + int needLen = (dataItem->len+len) * 2; + dest = (unsigned char *) + PORT_ArenaAlloc(p7dcx->cmsg->poolp, needLen); + if (dest == NULL) { + p7dcx->error = SEC_ERROR_NO_MEMORY; + goto loser; + } - storage->data = dest; - storage->len += len; + if (dataItem->len) { + PORT_Memcpy(dest, dataItem->data, dataItem->len); + } + decoderData->totalBufferSize = needLen; + dataItem->data = dest; + } /* copy it in */ - PORT_Memcpy(storage->data + offset, data, len); + PORT_Memcpy(dataItem->data + offset, data, len); + dataItem->len += len; } done: diff --git a/security/nss/lib/smime/config.mk b/security/nss/lib/smime/config.mk index 95a180b71..cd5c893a5 100644 --- a/security/nss/lib/smime/config.mk +++ b/security/nss/lib/smime/config.mk @@ -36,18 +36,28 @@ RELEASE_LIBS = $(TARGETS) ifeq (,$(filter-out WIN%,$(OS_TARGET))) # don't want the 32 in the shared library name -SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).dll -IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).lib +SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) +IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX) RES = $(OBJDIR)/smime.res RESNAME = smime.rc +ifdef NS_USE_GCC +EXTRA_SHARED_LIBS += \ + -L$(DIST)/lib \ + -lnss3 \ + -lplc4 \ + -lplds4 \ + -lnspr4 \ + $(NULL) +else # ! NS_USE_GCC EXTRA_SHARED_LIBS += \ $(DIST)/lib/nss3.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)plc4.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)plds4.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)nspr4.lib \ $(NULL) +endif # NS_USE_GCC else diff --git a/security/nss/lib/softoken/config.mk b/security/nss/lib/softoken/config.mk index d2e7a8231..a9f7c4b4b 100644 --- a/security/nss/lib/softoken/config.mk +++ b/security/nss/lib/softoken/config.mk @@ -49,12 +49,20 @@ EXTRA_LIBS += \ ifeq (,$(filter-out WIN%,$(OS_TARGET))) # don't want the 32 in the shared library name -SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).dll -IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).lib +SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) +IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX) RES = $(OBJDIR)/$(LIBRARY_NAME).res RESNAME = $(LIBRARY_NAME).rc +ifdef NS_USE_GCC +EXTRA_SHARED_LIBS += \ + -L$(DIST)/lib \ + -lplc4 \ + -lplds4 \ + -lnspr4 \ + $(NULL) +else # ! NS_USE_GCC ifdef MOZILLA_BSAFE_BUILD EXTRA_LIBS+=$(DIST)/lib/bsafe$(BSAFEVER).lib endif @@ -64,6 +72,7 @@ EXTRA_SHARED_LIBS += \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)plds4.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)nspr4.lib \ $(NULL) +endif # NS_USE_GCC else diff --git a/security/nss/lib/softoken/pkcs11p.h b/security/nss/lib/softoken/pkcs11p.h index 0a30e8ee4..1361991c5 100644 --- a/security/nss/lib/softoken/pkcs11p.h +++ b/security/nss/lib/softoken/pkcs11p.h @@ -43,7 +43,9 @@ */ #if defined(_WIN32) +#ifdef _MSC_VER #pragma warning(disable:4103) +#endif #pragma pack(push, cryptoki, 1) #endif diff --git a/security/nss/lib/softoken/pkcs11u.h b/security/nss/lib/softoken/pkcs11u.h index 0addf0f6f..777eda4d4 100644 --- a/security/nss/lib/softoken/pkcs11u.h +++ b/security/nss/lib/softoken/pkcs11u.h @@ -41,7 +41,9 @@ */ #if defined (_WIN32) +#ifdef _MSC_VER #pragma warning(disable:4103) +#endif #pragma pack(pop, cryptoki) #endif diff --git a/security/nss/lib/ssl/config.mk b/security/nss/lib/ssl/config.mk index e6f9123f6..3917eaba1 100644 --- a/security/nss/lib/ssl/config.mk +++ b/security/nss/lib/ssl/config.mk @@ -34,18 +34,29 @@ ifeq (,$(filter-out WIN%,$(OS_TARGET))) # don't want the 32 in the shared library name -SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).dll -IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).lib +SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) +IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX) RES = $(OBJDIR)/ssl.res RESNAME = ssl.rc +ifdef NS_USE_GCC +EXTRA_SHARED_LIBS += \ + -L$(DIST)/lib \ + -lnss3 \ + -lplc4 \ + -lplds4 \ + -lnspr4 \ + $(NULL) +else # ! NS_USE_GCC EXTRA_SHARED_LIBS += \ $(DIST)/lib/nss3.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)plc4.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)plds4.lib \ $(DIST)/lib/$(NSPR31_LIB_PREFIX)nspr4.lib \ $(NULL) +endif # NS_USE_GCC + else diff --git a/security/nss/lib/ssl/ssl3con.c b/security/nss/lib/ssl/ssl3con.c index 51ddd58f3..8d3106a9c 100644 --- a/security/nss/lib/ssl/ssl3con.c +++ b/security/nss/lib/ssl/ssl3con.c @@ -5127,6 +5127,21 @@ ssl3_HandleCertificateRequest(sslSocket *ss, SSL3Opaque *b, PRUint32 length) break; /* not an error */ case SECSuccess: + /* check what the callback function returned */ + if ((!ssl3->clientCertificate) || (!ssl3->clientPrivateKey)) { + /* we are missing either the key or cert */ + if (ssl3->clientCertificate) { + /* got a cert, but no key - free it */ + CERT_DestroyCertificate(ssl3->clientCertificate); + ssl3->clientCertificate = NULL; + } + if (ssl3->clientPrivateKey) { + /* got a key, but no cert - free it */ + SECKEY_DestroyPrivateKey(ssl3->clientPrivateKey); + ssl3->clientPrivateKey = NULL; + } + goto send_no_certificate; + } /* Setting ssl3->clientCertChain non-NULL will cause * ssl3_HandleServerHelloDone to call SendCertificate. */ diff --git a/security/nss/lib/ssl/sslcon.c b/security/nss/lib/ssl/sslcon.c index cce73d225..e373fa28b 100644 --- a/security/nss/lib/ssl/sslcon.c +++ b/security/nss/lib/ssl/sslcon.c @@ -2344,6 +2344,22 @@ ssl2_HandleRequestCertificate(sslSocket *ss) goto no_cert_error; } + /* check what the callback function returned */ + if ((!cert) || (!key)) { + /* we are missing either the key or cert */ + if (cert) { + /* got a cert, but no key - free it */ + CERT_DestroyCertificate(cert); + cert = NULL; + } + if (key) { + /* got a key, but no cert - free it */ + SECKEY_DestroyPrivateKey(key); + key = NULL; + } + goto no_cert_error; + } + rv = ssl2_SignResponse(ss, key, &response); if ( rv != SECSuccess ) { ret = -1; diff --git a/security/nss/lib/util/secasn1d.c b/security/nss/lib/util/secasn1d.c index 890ddddba..4f3a8be1b 100644 --- a/security/nss/lib/util/secasn1d.c +++ b/security/nss/lib/util/secasn1d.c @@ -600,6 +600,32 @@ sec_asn1d_init_state_based_on_template (sec_asn1d_state *state) return state; } +static PRBool +sec_asn1d_parent_is_indefinite(sec_asn1d_state *state) +{ + for (state = state->parent; state; state = state->parent) { + sec_asn1d_parse_place place = state->place; + if (place != afterImplicit && + place != afterPointer && + place != afterInline && + place != afterSaveEncoding && + place != duringSaveEncoding && + place != duringChoice) { + + /* we've walked up the stack to a state that represents + ** the enclosing construct. Is it one of the types that + ** permits an unexpected EOC? + */ + int eoc_permitted = + (place == duringGroup || + place == duringConstructedString || + state->child->optional); + return (state->indefinite && eoc_permitted) ? PR_TRUE : PR_FALSE; + + } + } + return PR_FALSE; +} static unsigned long sec_asn1d_parse_identifier (sec_asn1d_state *state, @@ -628,15 +654,7 @@ sec_asn1d_parse_identifier (sec_asn1d_state *state, */ state->pending = 1; } else { - if (byte == 0 && state->parent != NULL && - (state->parent->indefinite || - ( - (state->parent->place == afterImplicit || - state->parent->place == afterPointer) - && state->parent->parent != NULL && state->parent->parent->indefinite - ) - ) - ) { + if (byte == 0 && sec_asn1d_parent_is_indefinite(state)) { /* * Our parent has indefinite-length encoding, and the * entire tag found is 0, so it seems that we have hit the @@ -2187,6 +2205,26 @@ sec_asn1d_during_choice unsigned char child_found_tag_modifiers = 0; unsigned long child_found_tag_number = 0; + state->consumed += child->consumed; + + if (child->endofcontents) { + /* This choice is probably the first item in a GROUP + ** (e.g. SET_OF) that was indefinite-length encoded. + ** We're actually at the end of that GROUP. + ** We should look up the stack to be sure that we find + ** a state with indefinite length encoding before we + ** find a state (like a SEQUENCE) that is definite. + */ + child->place = notInUse; + state->place = afterChoice; + state->endofcontents = PR_TRUE; /* propagate this up */ + if (sec_asn1d_parent_is_indefinite(state)) + return state; + PORT_SetError(SEC_ERROR_BAD_DER); + state->top->status = decodeError; + return NULL; + } + child->theTemplate++; if( 0 == child->theTemplate->kind ) { @@ -2196,8 +2234,6 @@ sec_asn1d_during_choice return (sec_asn1d_state *)NULL; } - state->consumed += child->consumed; - /* cargo'd from next_in_sequence innards */ if( state->pending ) { PORT_Assert(!state->indefinite); |