Initial import of the Sun C SDK back into mozilla

This commit is contained in:
richm%stanfordalumni.org 2006-05-19 20:17:49 +00:00
parent f484db0fbd
commit b581ec67bf
365 changed files with 59303 additions and 5019 deletions

543
directory/c-sdk/build.mk Normal file
View File

@ -0,0 +1,543 @@
#
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
COMPVERSIONDIR = $(DEPTH)/directory/c-sdk
DEFAULT_VENDOR_NAME="Sun Microsystems Inc."
DEFAULT_VENDOR_VERSION=600
LDAPVERS = 60
LDAPVERS_SUFFIX = 6.0
ifndef VENDOR_NAME
VENDOR_NAME = $(DEFAULT_VENDOR_NAME)
endif
ifndef VENDOR_VERSION
VENDOR_VERSION = $(DEFAULT_VENDOR_VERSION)
endif
__BUILD_MARKER = "\"$(VENDOR_VERSION) $(OS_ARCH)$(OS_RELEASE) \
$(USER) $(BUILD_NOTE)\""
DEFINES += -D__BUILD_MARKER=$(__BUILD_MARKER)
ifeq ($(OS_ARCH), WINNT)
COMPONENT_PULL_METHOD=FTP
endif
ifdef HAVE_CCONF
# component tags for internal build only
include $(COMPVERSIONDIR)/component_versions.mk
endif
ifeq ($(DEBUG), full)
DBG_OR_OPT = DBG
else
DBG_OR_OPT = OPT
endif
# Ldap library
ifeq ($(OS_ARCH), WINNT)
LDAP_LIBNAME = nsldap32v$(LDAPVERS)
else
LDAP_LIBNAME = ldap$(LDAPVERS)
endif
DIR_VERSION = $(LDAPVERS_SUFFIX)
DIRSDK_VERSION = $(LDAPVERS_SUFFIX)
# PrLdap library
ifeq ($(OS_ARCH), WINNT)
PRLDAP_LIBNAME = nsldappr32v$(PRLDAPVERS)
else
PRLDAP_LIBNAME = prldap$(PRLDAPVERS)
endif
# lber library
ifeq ($(OS_ARCH), WINNT)
LBER_LIBNAME = nslber32v$(LBERVERS)
else
LBER_LIBNAME = lber$(LBERVERS)
endif
# ldif library
ifeq ($(OS_ARCH), WINNT)
LDIF_LIBNAME = nsldif32v$(LDIFVERS)
else
LDIF_LIBNAME = ldif$(LDIFVERS)
endif
# iutil library
ifeq ($(OS_ARCH), WINNT)
IUTIL_LIBNAME = nsiutil32v$(IUTILVERS)
else
IUTIL_LIBNAME = iutil$(IUTILVERS)
endif
# util library
ifeq ($(OS_ARCH), WINNT)
UTIL_LIBNAME = nsutil32v$(UTILVERS)
else
UTIL_LIBNAME = util$(UTILVERS)
endif
# ssl library
ifeq ($(OS_ARCH), WINNT)
SSLDAP_LIBNAME = nsldapssl32v$(SSLDAPVERS)
else
SSLDAP_LIBNAME = ssldap$(SSLDAPVERS)
endif
# nss library
NSS_LIBNAME = nss$(NSSVERS)
SSL_LIBNAME = ssl$(NSSVERS)
STKN_LIBNAME = softokn$(NSSVERS)
HYBRID_LIBNAME = freebl_hybrid_$(NSSVERS)
PURE32_LIBNAME = freebl_pure32_$(NSSVERS)
FREEBL_LIBNAME = freebl*
COPYFREEBL = 1
ifneq ($(USE_64), 1)
ifeq ($(OS_ARCH), SunOS)
ifneq ($(OS_TEST),i86pc)
COPYFREEBL = 1
endif
endif
ifeq ($(OS_ARCH), HP-UX)
COPYFREEBL = 1
endif
endif
# svrcore library
SVRCOREVERS =
SVRCOREVERS_SUFFIX =
SVRCORE_LIBNAME = svrcore$(SVRCOREVERS)
#
# NSPR library
#
ifeq ($(OS_TARGET), WIN95)
PLC_BASENAME=plc$(NSPR_LIBVERSION)
PLDS_BASENAME=plds$(NSPR_LIBVERSION)
NSPR_BASENAME=nspr$(NSPR_LIBVERSION)
else
PLC_BASENAME=libplc$(NSPR_LIBVERSION)
PLDS_BASENAME=libplds$(NSPR_LIBVERSION)
NSPR_BASENAME=libnspr$(NSPR_LIBVERSION)
endif
PLCBASE=plc$(NSPR_LIBVERSION)
PLDSBASE=plds$(NSPR_LIBVERSION)
NSPRBASE=nspr$(NSPR_LIBVERSION)
DYNAMICNSPR = -l$(PLCBASE) -l$(PLDSBASE) -l$(NSPRBASE)
PLC_LIBNAME=plc$(NSPR_LIBVERSION)
PLDS_LIBNAME=plds$(NSPR_LIBVERSION)
NSPR_LIBNAME=nspr$(NSPR_LIBVERSION)
#
# SASL library
#
LIBSASL_INCLUDES_LOC = /share/builds/integration/sasl$(SASLVERS)/$(SASL_RELEASE_TAG)/$(OBJDIR_NAME)/include
LIBSASL_LIB_LOC = /share/builds/integration/sasl$(SASLVERS)/$(SASL_RELEASE_TAG)/$(OBJDIR_NAME)/lib
ifeq ($(HAVE_SASL_LOCAL), 1)
LIBSASL_INCLUDES = /usr/include/sasl
LIBSASL_LIBDIR =
else
LIBSASL_INCLUDES =../../../../../dist/public/libsasl
LIBSASL_LIBDIR =../../../../../dist/$(OBJDIR_NAME)/libsasl
endif
SASL_LIBNAME=sasl
SASL_BASENAME=sasl32
################################
# LIB ICU (for I18N) #
################################
# default setting
ICU_COMP_NAME = icu
ICUOBJDIR=$(OBJDIR_NAME)
#ifeq ($(OS_ARCH), SunOS)
# ifeq ($(OS_TEST),i86pc)
# ICUOBJDIR = SunOS5.8_x86_$(DBG_OR_OPT).OBJ
# endif
#endif
# because we don't have a real Win 95 ICU component...
ifeq ($(OS_TARGET), WIN95)
ICUOBJDIR = WINNT4.0_$(DBG_OR_OPT).OBJ
endif
ifeq ($(OS_ARCH), Linux)
ifeq ($(USE_64), 1)
ICUOBJDIR = $(OS_ARCH)$(OS_RELEASE)_64$(OBJDIR_TAG).OBJ
else
ICUOBJDIR = $(OS_ARCH)$(OS_RELEASE)$(OBJDIR_TAG).OBJ
endif
endif
ifeq ($(OS_ARCH), AIX)
ICU_VERS_NUM = 2.1
ICU_LIBVERSION = 2.1.6
LIBICU_RELDATE = 20040126_21.1
ICU_RELDATE = 20040126_21.1
else
ICU_VERS_NUM = 3.2
ICU_LIBVERSION = 3.2
LIBICU_RELDATE = 20051214
ICU_RELDATE = 20051214
endif
ICU_VERSION = $(ICU_RELDATE)
ICU_COMP_DIR = lib$(ICU_COMP_NAME)$(ICU_VERS_NUM)
ICU_INT=
ifeq ($(ICU_INT), 1)
LIBICU_INCLUDES_LOC = /share/builds/components/icu/$(ICU_LIBVERSION)/$(ICU_RELDATE)/$(ICUOBJDIR)/include
LIBICU_LIB_LOC = /share/builds/components/icu/$(ICU_LIBVERSION)/$(ICU_RELDATE)/$(ICUOBJDIR)/lib
else
LIBICU_INCLUDES_LOC = /share/builds/integration/icu/$(ICU_LIBVERSION)/$(ICU_RELDATE)/$(ICUOBJDIR)/include
LIBICU_LIB_LOC = /share/builds/integration/icu/$(ICU_LIBVERSION)/$(ICU_RELDATE)/$(ICUOBJDIR)/lib
endif
ifneq ($(HAVE_LIBICU_LOCAL), 1)
LIBICU_DIR = ../../../../../dist/libicu$(ICU_LIBVERSION)
LIBICU_INCLUDES =../../../../../dist/public/libicu
LIBICU_LIBDIR =../../../../../dist/$(OBJDIR_NAME)/libicu
else
LIBICU_DIR =
LIBICU_INCLUDES = /usr/include
LIBICU_LIBDIR =
endif
ICU_LIBPATH = $(LIBICU_LIBDIR)
ICU_INCLUDE = $(LIBICU_INCLUDEDIR)
ifeq ($(OS_ARCH), WINNT)
ICU_RELEASE = $(COMPONENTS_DIR)/icu/$(ICU_VERSION)/$(ICUOBJDIR)
ICU_LIBNAMES = icuin icuuc icudt
ICU_LIBS = $(addsuffix .lib, $(ICU_LIBNAMES))
ICUDLL_NAMES = $(addsuffix .dll, $(ICU_LIBNAMES))
LIBICU = $(addprefix $(ICU_LIBPATH)/, $(ICU_LIBS))
ICUOBJNAME = $(ICU_LIBNAMES)
else # WINNT
ICU_LIBNAMES = icudata icui18n icuuc
ICU_SOLIB_NAMES = $(addsuffix $(DLL_PRESUF), $(ICU_LIBNAMES))
ICU_LIBS = $(addsuffix .a, $(ICU_SOLIB_NAMES))
ICU_SOLIBS = $(addsuffix .$(DLL_SUFFIX), $(ICU_SOLIB_NAMES))
ICUOBJNAME = $(ICU_SOLIBS)
LIBICU = $(addprefix $(ICU_LIBPATH)/, $(ICU_SOLIBS))
ICULINK = -L$(ICU_LIBPATH) $(addprefix -l, $(addsuffix $(DLL_PRESUF), $(ICU_LIBNAMES)))
ICULINK_STATIC = $(addprefix $(ICU_LIBPATH)/, $(ICU_LIBS))
ifeq ($(OS_ARCH),SOLARIS)
ICULINK += -lw
endif # Solaris
ifeq ($(OS_ARCH),HPUX)
#linking with libC is *BAD* on HPUX11
ICULINK = -L$(ICU_LIBPATH) $(addprefix -l, $(addsuffix $(DLL_PRESUF), $(ICU_LIBNAMES)))
ICULINK_STATIC = $(addprefix $(ICU_LIBPATH)/, $(ICU_LIBS))
endif # HPUX
ifeq ($(OS_ARCH),Linux)
ICULINK += -lresolv
ICULINK_STATIC += -lresolv
endif # Linux
endif #WINNT
RM = rm -f
SED = sed
# uncomment to enable support for LDAP referrals
LDAP_REFERRALS = -DLDAP_REFERRALS
DEFNETSSL = -DNET_SSL
NOLIBLCACHE = -DNO_LIBLCACHE
NSDOMESTIC = -DNS_DOMESTIC
#for including SASL options
ifdef HAVE_SASL
HAVESASLOPTIONS = -DLDAP_SASLIO_HOOKS -DHAVE_SASL_OPTIONS -DHAVE_SASL_OPTIONS_2
else
HAVESASLOPTIONS =
endif
ifdef BUILD_OPT
LDAP_DEBUG =
else
LDAP_DEBUG = -DLDAP_DEBUG
endif
ifdef HAVE_LIBICU
HAVELIBICU = -DHAVE_LIBICU
else
HAVELIBICU =
endif
ifdef BUILD_CLU
BUILDCLU = 1
else
BUILDCLU =
endif
#
# DEFS are included in CFLAGS
#
DEFS = $(PLATFORMCFLAGS) $(LDAP_DEBUG) $(HAVELIBICU) \
$(CLDAP) $(DEFNETSSL) $(NOLIBLCACHE) \
$(LDAP_REFERRALS) $(LDAP_DNS) $(STR_TRANSLATION) \
$(LIBLDAP_CHARSETS) $(LIBLDAP_DEF_CHARSET) \
$(NSDOMESTIC) $(LDAPSSLIO) $(HAVESASLOPTIONS)
ifeq ($(OS_ARCH), WINNT)
DIRVER_PROG=$(COMMON_OBJDIR)/dirver.exe
else
DIRVER_PROG=$(COMMON_OBJDIR)/dirver
endif
ifeq ($(OS_ARCH), WINNT)
EXE_SUFFIX=.exe
RSC=rc
OFFLAG=/Fo
else
OFFLAG=-o
endif
ifeq ($(OS_ARCH), Linux)
DEFS += -DLINUX2_0 -DLINUX1_2 -DLINUX2_1
endif
ifeq ($(OS_ARCH), WINNT)
DLLEXPORTS_PREFIX=/DEF:
USE_DLL_EXPORTS_FILE = 1
endif
ifeq ($(OS_ARCH), SunOS)
DLLEXPORTS_PREFIX=-Blocal -M
USE_DLL_EXPORTS_FILE = 1
endif
ifeq ($(OS_ARCH), IRIX)
DLLEXPORTS_PREFIX=-exports_file
USE_DLL_EXPORTS_FILE = 1
endif
ifeq ($(OS_ARCH), HP-UX)
DEFS += -Dhpux -D_REENTRANT
endif
ifeq ($(OS_ARCH),AIX)
DLLEXPORTS_PREFIX=-bE:
DL=-ldl
USE_DLL_EXPORTS_FILE = 1
endif
ifeq ($(OS_ARCH),OSF1)
DEFS += -DOSF1V4
DL=
endif
ifeq ($(OS_ARCH),ReliantUNIX)
DL=-ldl
endif
ifeq ($(OS_ARCH),UnixWare)
DL=
endif
RPATHFLAG = ..:../lib:../../lib:../../../lib:../../../../lib:../lib-private
ifeq ($(OS_ARCH), SunOS)
# flag to pass to cc when linking to set runtime shared library search path
# this is used like this, for example: $(RPATHFLAG_PREFIX)../..
RPATHFLAG_PREFIX=-Wl,-R,
# flag to pass to ld when linking to set runtime shared library search path
# this is used like this, for example: $(LDRPATHFLAG_PREFIX)../..
LDRPATHFLAG_PREFIX=-R
# OS network libraries
PLATFORMLIBS+=-lresolv -lsocket -lnsl -lgen -ldl -lposix4
endif
ifeq ($(OS_ARCH), OSF1)
# flag to pass to cc when linking to set runtime shared library search path
# this is used like this, for example: $(RPATHFLAG_PREFIX)../..
RPATHFLAG_PREFIX=-Wl,-rpath,
# flag to pass to ld when linking to set runtime shared library search path
# this is used like this, for example: $(LDRPATHFLAG_PREFIX)../..
LDRPATHFLAG_PREFIX=-rpath
# allow for unresolved symbols
DLL_LDFLAGS += -expect_unresolved "*"
endif # OSF1
ifeq ($(OS_ARCH), AIX)
# Flags to set runtime shared library search path. For example:
# $(CC) $(RPATHFLAG_PREFIX)../..$(RPATHFLAG_EXTRAS)
RPATHFLAG_PREFIX=-blibpath:
RPATHFLAG_EXTRAS=:/usr/lib:/lib
# flag to pass to ld when linking to set runtime shared library search path
# this is used like this, for example: $(LDRPATHFLAG_PREFIX)../..
LDRPATHFLAG_PREFIX=-blibpath:/usr/lib:/lib:
DLL_LDFLAGS= -bM:SRE -bnoentry \
-L.:/usr/lib/threads:/usr/lpp/xlC/lib:/usr/lib:/lib
DLL_EXTRA_LIBS= -bI:/usr/lib/lowsys.exp -lC_r -lC -lpthreads -lc_r -lm \
/usr/lib/libc.a
EXE_EXTRA_LIBS= -bI:/usr/lib/syscalls.exp -lsvld -lpthreads
endif # AIX
ifeq ($(OS_ARCH), HP-UX)
# flag to pass to cc when linking to set runtime shared library search path
# this is used like this, for example: $(RPATHFLAG_PREFIX)../..
RPATHFLAG_PREFIX=-Wl,+s,+b,
# flag to pass to ld when linking to set runtime shared library search path
# this is used like this, for example: $(LDRPATHFLAG_PREFIX)../..
LDRPATHFLAG_PREFIX=+s +b
# we need to link in the rt library to get sem_*()
PLATFORMLIBS += -lrt
PLATFORMCFLAGS=
endif # HP-UX
ifeq ($(OS_ARCH), Linux)
# flag to pass to cc when linking to set runtime shared library search path
# this is used like this, for example: $(RPATHFLAG_PREFIX)../..
RPATHFLAG_PREFIX=-Wl,-rpath,
# flag to pass to ld when linking to set runtime shared library search path
# this is used like this, for example: $(LDRPATHFLAG_PREFIX)../..
# note, there is a trailing space
LDRPATHFLAG_PREFIX=-rpath
endif # Linux
#
# XXX: does anyone know of a better way to solve the "LINK_LIB2" problem? -mcs
#
# Link to produce a console/windows exe on Windows
#
ifeq ($(OS_ARCH), WINNT)
DEBUG_LINK_OPT=/DEBUG:FULL
ifeq ($(BUILD_OPT), 1)
DEBUG_LINK_OPT=
endif
SUBSYSTEM=CONSOLE
LINK_EXE = link $(DEBUG_LINK_OPT) -OUT:"$@" /MAP $(ALDFLAGS) $(LDFLAGS) $(ML_DEBUG) \
$(LCFLAGS) /NOLOGO /PDB:NONE /DEBUGTYPE:BOTH /INCREMENTAL:NO \
/NODEFAULTLIB:MSVCRTD /SUBSYSTEM:$(SUBSYSTEM) $(DEPLIBS) \
$(EXTRA_LIBS) $(PLATFORMLIBS) $(OBJS)
LINK_LIB = lib -OUT:"$@" $(OBJS)
LINK_DLL = link $(DEBUG_LINK_OPT) /nologo /MAP /DLL /PDB:NONE /DEBUGTYPE:BOTH \
$(ML_DEBUG) /SUBSYSTEM:$(SUBSYSTEM) $(LLFLAGS) $(DLL_LDFLAGS) \
$(EXTRA_LIBS) /out:"$@" $(OBJS)
else # WINNT
#
# UNIX link commands
#
LINK_LIB = $(RM) $@; $(AR) $(OBJS); $(RANLIB) $@
LINK_LIB2 = $(RM) $@; $(AR) $@ $(OBJS2); $(RANLIB) $@
ifdef SONAMEFLAG_PREFIX
LINK_DLL = $(LD) $(DSO_LDOPTS) $(RPATHFLAG_PREFIX)$(RPATHFLAG) $(ALDFLAGS) $(DLL_LDFLAGS) \
$(DLL_EXPORT_FLAGS) -o $@ $(SONAMEFLAG_PREFIX)$(notdir $@) $(OBJS)
else # SONAMEFLAG_PREFIX
LINK_DLL = $(LD) $(RPATHFLAG_PREFIX)$(RPATHFLAG) $(ALDFLAGS) $(DLL_LDFLAGS) $(DLL_EXPORT_FLAGS) \
-o $@ $(OBJS)
endif # SONAMEFLAG_PREFIX
ifeq ($(OS_ARCH), OSF1)
# The linker on OSF/1 gets confused if it finds an so_locations file
# that doesn't meet its expectations, so we arrange to remove it before
# linking.
SO_FILES_TO_REMOVE=so_locations
endif
ifeq ($(OS_ARCH), HP-UX)
# On HPUX, we need a couple of changes:
# 1) Use the C++ compiler for linking, which will pass the +eh flag on down to the
# linker so the correct exception-handling-aware libC gets used (libnshttpd.sl
# needs this).
# 2) Add a "-Wl,-E" option so the linker gets a "-E" flag. This makes symbols
# in an executable visible to shared libraries loaded at runtime.
LINK_EXE = $(CCC) -AA -Wl,-E $(ALDFLAGS) $(LDFLAGS) $(RPATHFLAG_PREFIX)$(RPATHFLAG) -o $@ $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
ifeq ($(USE_64), 1)
LINK_EXE = $(CCC) -AA -DHPUX_ACC -D__STDC_EXT__ -D_POSIX_C_SOURCE=199506L +DA2.0W +DS2.0 -Wl,-E $(ALDFLAGS) $(LDFLAGS) $(RPATHFLAG_PREFIX)$(RPATHFLAG) -o $@ $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
endif
else # HP-UX
# everything except HPUX
ifeq ($(OS_ARCH), ReliantUNIX)
# Use the C++ compiler for linking if at least ONE object is C++
export LD_RUN_PATH=$(RPATHFLAG)
LINK_EXE = $(CXX) $(ALDFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
else # ReliantUNIX
ifdef USE_LD_RUN_PATH
#does RPATH differently. instead we export RPATHFLAG as LD_RUN_PATH
#see ns/netsite/ldap/clients/tools/Makefile for an example
export LD_RUN_PATH=$(RPATHFLAG)
LINK_EXE = $(CC) $(ALDFLAGS) $(LDFLAGS) \
-o $@ $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
LINK_EXE_NOLIBSOBJS = $(CC) $(ALDFLAGS) $(LDFLAGS) -o $@
else # USE_LD_RUN_PATH
LINK_EXE = $(CC) $(ALDFLAGS) $(LDFLAGS) \
$(RPATHFLAG_PREFIX)$(RPATHFLAG)$(RPATHFLAG_EXTRAS) \
-o $@ $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
LINK_EXE_NOLIBSOBJS = $(CC) $(ALDFLAGS) $(LDFLAGS) \
$(RPATHFLAG_PREFIX)$(RPATHFLAG)$(RPATHFLAG_EXTRAS) -o $@
endif # USE_LD_RUN_PATH
endif # ReliantUNIX
endif # HP-UX
endif # WINNT
ifeq ($(OS_ARCH), OSF1)
LINK_EXE = $(CCC) $(ALDFLAGS) $(LDFLAGS) $(RPATHFLAG_PREFIX)$(RPATHFLAG) \
-o $@ $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
endif
ifeq ($(OS_ARCH), SunOS)
ifeq ($(USE_64), 1)
LINK_EXE = $(CCC) $(ALDFLAGS) $(LDFLAGS) -R:$(RPATHFLAG)\
-o $@ $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
endif
endif
PERL = perl
#
# shared library symbol export definitions
#
ifeq ($(OS_ARCH), WINNT)
GENEXPORTS=cmd /c $(PERL) $(LDAP_SRC)/build/genexports.pl
else
GENEXPORTS=$(PERL) $(LDAP_SRC)/build/genexports.pl
endif

View File

@ -0,0 +1,97 @@
#
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
# NSPR - Netscape Portable Runtime
NSPR_LIBVERSION = 4
NSPR_RELEASE_TAG = v4.1.4
# NSS - Network Security Services
NSSVERS = 3
NSS_RELEASE_TAG = SECURITY_JES5_20060428
# SVRCORE - Client/server utility library
# SVRCORE_RELEASE_TAG = SVRCORE_3_3_3_RTM
# LDAP library
LDAPVERS = 60
LDAPVERS_SUFFIX = 6.0
# PRLDAP library
PRLDAPVERS = 60
PRLDAPVERS_SUFFIX = 6.0
# LBER library
LBERVERS = 60
LBERVERS_SUFFIX = 6.0
# ldif library
LDIFVERS = 60
LDIFVERS_SUFFIX = 6.0
# iutil library
IUTILVERS = 60
IUTILVERS_SUFFIX = 6.0
# util library
UTILVERS = 60
UTILVERS_SUFFIX = 6.0
# ssl library
SSLDAPVERS = 60
SSLDAPVERS_SUFFIX = 6.0
# sasl library
SASLVERS = 20
SASL_RELEASE_TAG = 2.19_20051117
# libICU - replaces National Language Support (NLS).
# ICU_LIBVERSION = 2.1.6
# LIBICU_RELDATE = 20040126_21.1
# Some components already had existing Solaris 5.8 symbolic
# link to a Solaris 5.6 version. Hence, the new respun components
# were put in in a forte6 directory in each of the component
# respectively. For Solaris 5.8 only we have to pick up the components
# from the forte6 directory. As we move forward with new components,
# we can take the mess below out
# Michael.....
#ifeq ($(OS_ARCH), SunOS)
# ifneq ($(USE_64), 1)
# OS_VERS := $(shell uname -r)
# ifeq ($(OS_VERS),5.8)
# ifneq ($(OS_TEST),i86pc)
# NSPR_RELEASE_TAG=v4.1.2/forte6
# NSS_RELEASE_TAG =NSS_3_3_2_RTM/forte6
# SVRCORE_RELEASE_TAG=SVRCORE_3_3_1_RTM/forte6
# endif
# endif
# endif
#endif
#ifeq ($(OS_ARCH), Linux)
# ifeq ($(OS_RELEASE), 2.4)
# NSPR_RELEASE_TAG=v4.1.2/redhat7.2
# NSS_RELEASE_TAG =NSS_3_3_2_RTM/redhat7.2
# SVRCORE_RELEASE_TAG=SVRCORE_3_3_1_RTM/redhat7.2
# endif
#endif

View File

@ -0,0 +1,175 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for AIX.
#
include $(MOD_DEPTH)/config/UNIX.mk
#
# XXX
# Temporary define for the Client; to be removed when binary release is used
#
ifdef MOZILLA_CLIENT
ifneq ($(USE_PTHREADS),1)
CLASSIC_NSPR = 1
endif
endif
#
# There are three implementation strategies available on AIX:
# pthreads, classic, and pthreads-user.
#
# On AIX 3.2, classic nspr is the default (and only) implementation
# strategy. On AIX 4.1 and later, the default is pthreads.
#
ifeq ($(OS_RELEASE),3.2)
CLASSIC_NSPR = 1
endif
ifeq ($(CLASSIC_NSPR),1)
PTHREADS_USER =
USE_PTHREADS =
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
else
ifeq ($(PTHREADS_USER),1)
USE_PTHREADS =
IMPL_STRATEGY = _PTH_USER
else
USE_PTHREADS = 1
ifeq ($(HAVE_CCONF), 1)
IMPL_STRATEGY =
else
IMPL_STRATEGY = _PTH
endif
endif
endif
# IPv6 support part of the standard AIX 4.3 release.
ifneq (,$(filter-out 3.2 4.1 4.2,$(OS_RELEASE)))
USE_IPV6 = 1
endif
ifeq ($(CLASSIC_NSPR),1)
CC = xlC
CCC = xlC
else
CC = xlC_r
CCC = xlC_r
endif
OS_CFLAGS = -qro -qroconst
ifeq ($(USE_64),1)
OBJECT_MODE = 64
export OBJECT_MODE
COMPILER_TAG = _64
else
ifeq ($(HAVE_CCONF), 1)
COMPILER_TAG =
else
COMPILER_TAG = _32
endif
endif
CPU_ARCH = rs6000
RANLIB = ranlib
OS_CFLAGS += -DAIX -DSYSV
ifeq ($(CC),xlC_r)
OS_CFLAGS += -qarch=com
endif
ifneq ($(OS_RELEASE),3.2)
OS_CFLAGS += -DAIX_HAVE_ATOMIC_OP_H -DAIX_TIMERS
endif
ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
ifndef USE_PTHREADS
OS_CFLAGS += -DAIX_RENAME_SELECT
endif
endif
ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
OS_CFLAGS += -D_PR_NO_LARGE_FILES
else
OS_CFLAGS += -D_PR_HAVE_OFF64_T -D_LARGEFILE64_SOURCE
endif
ifeq ($(OS_RELEASE),4.1)
OS_CFLAGS += -DAIX4_1
else
DSO_LDOPTS = -brtl -bM:SRE -bnoentry -bexpall
MKSHLIB = $(LD) $(DSO_LDOPTS)
ifeq ($(OS_RELEASE),4.3)
OS_CFLAGS += -DAIX4_3
endif
endif
# Have the socklen_t data type
ifeq ($(OS_RELEASE),4.3)
OS_CFLAGS += -DHAVE_SOCKLEN_T
endif
ifeq (,$(filter-out 4.2 4.3,$(OS_RELEASE)))
# On these OS revisions, localtime_r() is declared if _THREAD_SAFE
# is defined.
ifneq ($(CLASSIC_NSPR),1)
OS_CFLAGS += -DHAVE_POINTER_LOCALTIME_R
endif
endif
ifeq (,$(filter-out 4.3,$(OS_RELEASE)))
# On these OS revisions, gethostbyXXX() returns result in thread
# specific storage.
ifeq ($(USE_PTHREADS),1)
OS_CFLAGS += -D_PR_HAVE_THREADSAFE_GETHOST
endif
endif
#
# Special link info for constructing AIX programs. On AIX we have to
# statically link programs that use NSPR into a single .o, rewriting the
# calls to select to call "aix". Once that is done we then can
# link that .o with a .o built in nspr which implements the system call.
#
ifneq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
AIX_LINK_OPTS = -brtl -bnso -berok
else
AIX_LINK_OPTS = -bnso -berok
#AIX_LINK_OPTS = -bnso -berok -brename:.select,.wrap_select -brename:.poll,.wrap_poll -bI:/usr/lib/syscalls.exp
endif
AIX_WRAP = $(DIST)/lib/aixwrap.o
AIX_TMP = $(OBJDIR)/_aix_tmp.o

View File

@ -0,0 +1,91 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for BSD/OS Unix.
#
include $(MOD_DEPTH)/config/UNIX.mk
ifeq (,$(filter-out 1.1 4.%,$(OS_RELEASE)))
CC = gcc -Wall -Wno-format
CCC = g++
else
CC = shlicc2
CCC = shlicc2
endif
RANLIB = ranlib
ifeq ($(USE_PTHREADS),1)
IMPL_STRATEGY = _PTH
DEFINES += -D_PR_NEED_PTHREAD_INIT
else
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
endif
OS_CFLAGS = $(DSO_CFLAGS) -DBSDI -DHAVE_STRERROR -DNEED_BSDREGEX
ifeq (86,$(findstring 86,$(OS_TEST)))
CPU_ARCH = x86
endif
ifeq (sparc,$(findstring sparc,$(OS_TEST)))
CPU_ARCH = sparc
endif
ifeq ($(OS_RELEASE),2.1)
OS_CFLAGS += -D_PR_TIMESPEC_HAS_TS_SEC
endif
ifeq (,$(filter-out 1.1 2.1,$(OS_RELEASE)))
OS_CFLAGS += -D_PR_BSDI_JMPBUF_IS_ARRAY
else
OS_CFLAGS += -D_PR_SELECT_CONST_TIMEVAL -D_PR_BSDI_JMPBUF_IS_STRUCT
endif
NOSUCHFILE = /no-such-file
ifeq ($(OS_RELEASE),1.1)
OS_CFLAGS += -D_PR_STAT_HAS_ONLY_ST_ATIME -D_PR_NEED_H_ERRNO
else
OS_CFLAGS += -DHAVE_DLL -DUSE_DLFCN -D_PR_STAT_HAS_ST_ATIMESPEC
OS_LIBS = -ldl
ifeq (,$(filter-out 4.%,$(OS_RELEASE)))
MKSHLIB = $(CC) $(DSO_LDOPTS)
DSO_CFLAGS = -fPIC
DSO_LDOPTS = -shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so)
else
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -r
endif
endif

View File

@ -0,0 +1,138 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
######################################################################
# Config stuff for BeOS (all architectures)
######################################################################
######################################################################
# Version-independent
######################################################################
DEFINES +=
XP_DEFINE = -DXP_BEOS
OBJ_SUFFIX = o
LIB_SUFFIX = a
DLL_SUFFIX = so
AR = ar cr $@
ifdef BUILD_OPT
DEFINES = -UDEBUG -DNDEBUG
OBJDIR_TAG = _OPT
else
DEFINES = -DDEBUG -UNDEBUG
OBJDIR_TAG = _DBG
endif
ifeq (PC,$(findstring PC,$(OS_TEST)))
CPU_ARCH = x86
CC = gcc
CCC = g++
LD = gcc
RANLIB = ranlib
DSO_LDOPTS = -nostart
PORT_FLAGS = -DHAVE_STRERROR
ifdef BUILD_OPT
OPTIMIZER = -O2
LDFLAGS += -s
else
OPTIMIZER = -gdwarf-2 -O0
endif
else
CPU_ARCH = ppc
CC = mwcc
CCC = mwcc
LD = mwld
RANLIB = ranlib
DSO_LDOPTS = -xms -export pragma \
-init _init_routine_ \
-term _term_routine_ \
-lroot -lnet \
/boot/develop/lib/ppc/glue-noinit.a \
/boot/develop/lib/ppc/init_term_dyn.o \
/boot/develop/lib/ppc/start_dyn.o
PORT_FLAGS = -DHAVE_STRERROR -D_POSIX_SOURCE
ifdef BUILD_OPT
OPTIMIZER = -O2
else
OPTIMIZER = -g -O0
endif
endif
CPU_ARCH_TAG = _$(CPU_ARCH)
OS_INCLUDES = -I- -I.
#G++INCLUDES = -I/usr/include/g++
PLATFORM_FLAGS = -DBeOS -DBEOS $(OS_INCLUDES)
OS_CFLAGS = $(DSO_CFLAGS) $(PLATFORM_FLAGS) $(PORT_FLAGS)
USE_BTHREADS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
OBJDIR_NAME = $(OS_CONFIG)_$(CPU_ARCH)$(OBJDIR_TAG).OBJ
####################################################################
#
# One can define the makefile variable NSDISTMODE to control
# how files are published to the 'dist' directory. If not
# defined, the default is "install using relative symbolic
# links". The two possible values are "copy", which copies files
# but preserves source mtime, and "absolute_symlink", which
# installs using absolute symbolic links. The "absolute_symlink"
# option requires NFSPWD.
#
####################################################################
NSINSTALL = $(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall
ifeq ($(NSDISTMODE),copy)
# copy files, but preserve source mtime
INSTALL = $(NSINSTALL) -t
else
ifeq ($(NSDISTMODE),absolute_symlink)
# install using absolute symbolic links
INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
else
# install using relative symbolic links
INSTALL = $(NSINSTALL) -R
endif
endif
define MAKE_OBJDIR
if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
endef

View File

@ -0,0 +1,63 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for Data General DG/UX
#
# Initial DG/UX port by Marc Fraioli <fraioli@dg-rtp.dg.com>
#
include $(MOD_DEPTH)/config/UNIX.mk
CC = gcc
CCC = g++
RANLIB = true
DEFINES += -D_PR_LOCAL_THREADS_ONLY
OS_CFLAGS = -DSVR4 -DSYSV -DDGUX -D_DGUX_SOURCE -D_POSIX4A_DRAFT6_SOURCE
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G
CPU_ARCH = x86
ARCH = dgux
NOSUCHFILE = /no-such-file
ifdef BUILD_OPT
OPTIMIZER = -O2
else
# -g would produce a huge executable.
OPTIMIZER =
endif

View File

@ -0,0 +1,82 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for FreeBSD
#
include $(MOD_DEPTH)/config/UNIX.mk
CC = gcc
CCC = g++
RANLIB = ranlib
ifeq ($(OS_TEST),alpha)
CPU_ARCH = alpha
else
OS_REL_CFLAGS = -Di386
CPU_ARCH = x86
endif
CPU_ARCH_TAG = _$(CPU_ARCH)
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -pipe $(THREAD_FLAG) -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
#
# The default implementation strategy for FreeBSD is pthreads.
#
ifeq ($(CLASSIC_NSPR),1)
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
else
USE_PTHREADS = 1
IMPL_STRATEGY = _PTH
DEFINES += -D_THREAD_SAFE
THREAD_FLAG += -pthread
endif
ARCH = freebsd
MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
ifeq ($(MOZ_OBJFORMAT),elf)
DLL_SUFFIX = so
else
DLL_SUFFIX = so.1.0
endif
DSO_CFLAGS = -fPIC
DSO_LDOPTS = -Bshareable
MKSHLIB = $(LD) $(DSO_LDOPTS)
G++INCLUDES = -I/usr/include/g++

View File

@ -0,0 +1,240 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for HP-UX
#
include $(MOD_DEPTH)/config/UNIX.mk
DLL_SUFFIX = sl
ifeq ($(NS_USE_GCC), 1)
CC = gcc
CCC = g++
OS_CFLAGS =
COMPILER_TAG = _gcc
else
CC = cc -Ae
CCC = CC -ext
OS_CFLAGS = +ESlit
endif
RANLIB = echo
CPU_ARCH = hppa
OS_CFLAGS += $(DSO_CFLAGS) -DHPUX -D$(CPU_ARCH) -D_HPUX_SOURCE
ifeq ($(OS_RELEASE),B.11.11)
OS_CFLAGS += -D_USE_BIG_FDS
endif
#
# The header netdb.h on HP-UX 9 does not declare h_errno.
# On 10.10 and 10.20, netdb.h declares h_errno only if
# _XOPEN_SOURCE_EXTENDED is defined. So we need to declare
# h_errno ourselves.
#
ifeq ($(basename $(OS_RELEASE)),A.09)
OS_CFLAGS += -D_PR_NEED_H_ERRNO
endif
ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE)))
OS_CFLAGS += -D_PR_NEED_H_ERRNO
endif
# Do we have localtime_r()? Does it return 'int' or 'struct tm *'?
ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE)))
OS_CFLAGS += -DHAVE_INT_LOCALTIME_R
endif
ifeq (,$(filter-out B.10.30 B.11.00 B.11.11,$(OS_RELEASE)))
OS_CFLAGS += -DHAVE_POINTER_LOCALTIME_R
endif
#
# XXX
# Temporary define for the Client; to be removed when binary release is used
#
ifdef MOZILLA_CLIENT
CLASSIC_NSPR = 1
endif
#
# On HP-UX 9, the default (and only) implementation strategy is
# classic nspr.
#
# On HP-UX 10.10 and 10.20, the default implementation strategy is
# pthreads (actually DCE threads). Classic nspr is also available.
#
# On HP-UX 10.30 and 11.00, the default implementation strategy is
# pthreads. Classic nspr and pthreads-user are also available.
#
ifeq ($(basename $(OS_RELEASE)),A.09)
OS_CFLAGS += -DHPUX9
DEFAULT_IMPL_STRATEGY = _EMU
endif
ifeq ($(OS_RELEASE),B.10.01)
OS_CFLAGS += -DHPUX10
DEFAULT_IMPL_STRATEGY = _EMU
endif
ifeq ($(OS_RELEASE),B.10.10)
OS_CFLAGS += -DHPUX10 -DHPUX10_10
DEFAULT_IMPL_STRATEGY = _PTH
endif
ifeq ($(OS_RELEASE),B.10.20)
OS_CFLAGS += -DHPUX10 -DHPUX10_20
ifneq ($(NS_USE_GCC), 1)
OS_CFLAGS += +DAportable
endif
DEFAULT_IMPL_STRATEGY = _PTH
endif
#
# On 10.30 and 11.00, we use the new ANSI C++ compiler aCC.
#
ifeq ($(OS_RELEASE),B.10.30)
ifneq ($(NS_USE_GCC), 1)
CCC = /opt/aCC/bin/aCC -ext
OS_CFLAGS += +DAportable +DS1.1
endif
OS_CFLAGS += -DHPUX10 -DHPUX10_30
DEFAULT_IMPL_STRATEGY = _PTH
endif
# 11.00 is similar to 10.30.
ifeq ($(OS_RELEASE),B.11.00)
ifneq ($(NS_USE_GCC), 1)
CCC = /opt/aCC/bin/aCC -ext
ifeq ($(USE_64),1)
OS_CFLAGS += +DA2.0W +DS2.0 +DD64
COMPILER_TAG = _64
else
OS_CFLAGS += +DAportable +DS2.0
ifeq ($(HAVE_CCONF), 1)
COMPILER_TAG =
else
COMPILER_TAG = _32
endif
endif
endif
OS_CFLAGS += -DHPUX10 -DHPUX11 -D_LARGEFILE64_SOURCE -D_PR_HAVE_OFF64_T
ifeq ($(HAVE_CCONF), 1)
DEFAULT_IMPL_STRATEGY =
else
DEFAULT_IMPL_STRATEGY = _PTH
endif
endif
# 11.00 is similar to 10.30.
ifeq ($(OS_RELEASE),B.11.11)
ifneq ($(NS_USE_GCC), 1)
CCC = /opt/aCC/bin/aCC -ext
ifeq ($(USE_64),1)
OS_CFLAGS += +DA2.0W +DS2.0 +DD64
COMPILER_TAG = _64
else
OS_CFLAGS += +DAportable +DS2.0
ifeq ($(HAVE_CCONF), 1)
COMPILER_TAG =
else
COMPILER_TAG = _32
endif
endif
endif
OS_CFLAGS += -DHPUX10 -DHPUX11 -D_LARGEFILE64_SOURCE -D_PR_HAVE_OFF64_T
ifeq ($(HAVE_CCONF), 1)
DEFAULT_IMPL_STRATEGY =
else
DEFAULT_IMPL_STRATEGY = _PTH
endif
endif
ifeq ($(DEFAULT_IMPL_STRATEGY),_EMU)
CLASSIC_NSPR = 1
endif
ifeq ($(DEFAULT_IMPL_STRATEGY),_PTH)
USE_PTHREADS = 1
IMPL_STRATEGY = _PTH
ifeq ($(CLASSIC_NSPR),1)
USE_PTHREADS =
IMPL_STRATEGY = _EMU
endif
ifeq ($(PTHREADS_USER),1)
USE_PTHREADS =
IMPL_STRATEGY = _PTH_USER
endif
endif
ifeq ($(CLASSIC_NSPR),1)
DEFINES += -D_PR_LOCAL_THREADS_ONLY
endif
ifeq (,$(filter-out A.09 B.10,$(basename $(OS_RELEASE))))
DEFINES += -D_PR_NO_LARGE_FILES
endif
#
# To use the true pthread (kernel thread) library on 10.30 and
# 11.00, we should define _POSIX_C_SOURCE to be 199506L.
# The _REENTRANT macro is deprecated.
#
ifdef USE_PTHREADS
ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE)))
OS_CFLAGS += -D_REENTRANT -D_PR_DCETHREADS
else
OS_CFLAGS += -D_POSIX_C_SOURCE=199506L -D_PR_HAVE_THREADSAFE_GETHOST
endif
endif
ifdef PTHREADS_USER
OS_CFLAGS += -D_POSIX_C_SOURCE=199506L
endif
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -b +h $(notdir $@)
# -fPIC or +Z generates position independent code for use in shared
# libraries.
ifeq ($(NS_USE_GCC), 1)
DSO_CFLAGS = -fPIC
else
DSO_CFLAGS = +Z
endif

View File

@ -0,0 +1,158 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for IRIX
#
include $(MOD_DEPTH)/config/UNIX.mk
#
# XXX
# Temporary define for the Client; to be removed when binary release is used
#
ifdef MOZILLA_CLIENT
ifneq ($(USE_PTHREADS),1)
CLASSIC_NSPR = 1
endif
endif
#
# On IRIX 5.x, classic nspr (user-level threads on top of sprocs)
# is the default (and only) implementation strategy.
#
# On IRIX 6.x and later, the default implementation strategy is
# pthreads. Classic nspr is also available.
#
ifeq ($(basename $(OS_RELEASE)),5)
CLASSIC_NSPR = 1
endif
ifeq ($(CLASSIC_NSPR),1)
IMPL_STRATEGY = _MxN
else
USE_PTHREADS = 1
USE_N32 = 1
IMPL_STRATEGY = _PTH
endif
ifeq ($(NS_USE_GCC), 1)
CC = gcc
COMPILER_TAG = _gcc
AS = $(CC) -x assembler-with-cpp -D_ASM -mips2
ODD_CFLAGS = -Wall -Wno-format
ifdef BUILD_OPT
OPTIMIZER = -O6
endif
else
CC = cc
CCC = CC
ODD_CFLAGS = -fullwarn -xansi
ifdef BUILD_OPT
ifneq ($(USE_N32),1)
OPTIMIZER = -O -Olimit 4000
else
OPTIMIZER = -O -OPT:Olimit=4000
endif
endif
#
# The default behavior is still -o32 generation, hence the explicit tests
# for -n32 and -64 and implicitly assuming -o32. If that changes, ...
#
ifeq ($(basename $(OS_RELEASE)),6)
ODD_CFLAGS += -multigot
SHLIB_LD_OPTS = -no_unresolved
ifeq ($(USE_N32),1)
ODD_CFLAGS += -n32 -woff 1209
COMPILER_TAG = _n32
LDOPTS += -n32
SHLIB_LD_OPTS += -n32
ifeq ($(OS_RELEASE), 6_2)
LDOPTS += -Wl,-woff,85
SHLIB_LD_OPTS += -woff 85
endif
else
ifeq ($(USE_64),1)
ODD_CFLAGS += -64
COMPILER_TAG = _64
else
ODD_CFLAGS += -32
COMPILER_TAG = _o32
endif
endif
else
ODD_CFLAGS += -xgot
endif
endif
ODD_CFLAGS += -DSVR4 -DIRIX
CPU_ARCH = mips
RANLIB = /bin/true
# For purify
# XXX: should always define _SGI_MP_SOURCE
NOMD_OS_CFLAGS = $(ODD_CFLAGS) -D_SGI_MP_SOURCE
ifeq ($(OS_RELEASE),5.3)
OS_CFLAGS += -DIRIX5_3
endif
ifneq ($(basename $(OS_RELEASE)),5)
OS_CFLAGS += -D_PR_HAVE_SGI_PRDA_PROCMASK
endif
ifeq (,$(filter-out 6.5,$(OS_RELEASE)))
ifneq ($(NS_USE_GCC), 1)
OS_CFLAGS += -mips3
endif
OS_CFLAGS += -D_PR_HAVE_GETPROTO_R -D_PR_HAVE_GETPROTO_R_POINTER
ifeq ($(USE_PTHREADS),1)
OS_CFLAGS += -D_PR_HAVE_GETHOST_R -D_PR_HAVE_GETHOST_R_POINTER
endif
endif
ifndef NO_MDUPDATE
OS_CFLAGS += $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES)
else
OS_CFLAGS += $(NOMD_OS_CFLAGS)
endif
# -rdata_shared is an ld option that puts string constants and
# const data into the text segment, where they will be shared
# across processes and be read-only.
MKSHLIB = $(LD) $(SHLIB_LD_OPTS) -rdata_shared -shared -soname $(notdir $@)
DSO_LDOPTS = -elf -shared -all

View File

@ -0,0 +1,149 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
######################################################################
# Config stuff for Linux (all architectures)
######################################################################
######################################################################
# Version-independent
######################################################################
include $(MOD_DEPTH)/config/UNIX.mk
#
# XXX
# Temporary define for the Client; to be removed when binary release is used
#
ifdef MOZILLA_CLIENT
ifneq ($(USE_PTHREADS),1)
CLASSIC_NSPR = 1
endif
endif
#
# The default implementation strategy for Linux is pthreads.
#
ifeq ($(CLASSIC_NSPR),1)
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
else
USE_PTHREADS = 1
ifeq ($(HAVE_CCONF), 1)
IMPL_STRATEGY = _glibc_PTH
else
IMPL_STRATEGY = _PTH
endif
DEFINES += -D_REENTRANT
endif
ifeq (86,$(findstring 86,$(OS_TEST)))
ifeq ($(USE_64),1)
CPU_ARCH = x86_64
ARCH_FLAG = -m64
LDFLAGS += -m64
DSO_LDFLAGS += -melf_x86_64
EXTRA_LIBS += -L/usr/lib64
else
CPU_ARCH = x86
ARCH_FLAG = -m32
LDFLAGS += -m32
DSO_LDFLAGS += -melf_i386
EXTRA_LIBS += -L/usr/lib
endif
else
ifeq (,$(filter-out arm% sa110,$(OS_TEST)))
CPU_ARCH := arm
else
CPU_ARCH := $(OS_TEST)
endif
endif
CPU_ARCH_TAG = _$(CPU_ARCH)
CC = gcc
CCC = g++
RANLIB = ranlib
OS_INCLUDES =
G++INCLUDES = -I/usr/include/g++
PLATFORM_FLAGS = $(ARCH_FLAG) -ansi -Wall -pipe -DLINUX -Dlinux -D_LARGEFILE64_SOURCE
PORT_FLAGS = -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -DHAVE_STRERROR
OS_CFLAGS = $(DSO_CFLAGS) $(PLATFORM_FLAGS) $(PORT_FLAGS)
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(CPU_ARCH),alpha)
PLATFORM_FLAGS += -D_ALPHA_ -D__alpha -mieee
endif
ifeq ($(CPU_ARCH),x86-64)
PLATFORM_FLAGS += -Dx86-64
endif
ifeq ($(CPU_ARCH),x86)
PLATFORM_FLAGS += -Di386
endif
ifeq ($(CPU_ARCH),m68k)
#
# gcc on Linux/m68k either has a bug or triggers a code-sequence
# bug in the 68060 which causes gcc to crash. The simplest way to
# avoid this is to enable a minimum level of optimization.
#
ifndef BUILD_OPT
OPTIMIZER += -O
endif
PLATFORM_FLAGS += -m68020-40
endif
#
# Linux 2.x has shared libraries.
#
MKSHLIB = $(LD) $(DSO_LDOPTS) -soname $(notdir $@)
ifdef BUILD_OPT
OPTIMIZER = -O2
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
######################################################################
# Other
######################################################################
DSO_CFLAGS = -fPIC
DSO_LDOPTS = -shared $(DSO_LDFLAGS)

View File

@ -0,0 +1,129 @@
#! 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
MOD_DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(MOD_DEPTH)/config/autoconf.mk
# Indicate that this directory builds build tools.
INTERNAL_TOOLS = 1
# autoconf.mk must be deleted last (from the top-level directory)
# because it is included by every makefile.
DIST_GARBAGE = nsprincl.mk nsprincl.sh
include $(topsrcdir)/config/config.mk
CSRCS = nsinstall.c now.c
PLSRCS = nfspwd.pl
ifeq ($(OS_ARCH), WINNT)
PROG_SUFFIX = .exe
else
PROG_SUFFIX =
endif
# Temporary workaround to disable the generation of
# library build time because now.c uses the 'long long'
# data type that's not available on some platforms.
ifeq (,$(filter-out NEC NEXTSTEP QNX SCOOS UNIXWARE,$(OS_ARCH)))
DEFINES += -DOMIT_LIB_BUILD_TIME
endif
ifeq ($(OS_ARCH), IRIX)
ifeq ($(basename $(OS_RELEASE)),6)
ifeq ($(USE_N32),1)
XLDOPTS += -n32 -Wl,-woff,85
ifeq ($(OS_RELEASE), 6_2)
XLDOPTS += -Wl,-woff,85
endif
else
ifeq ($(USE_64),1)
XLDOPTS += -64
else
XLDOPTS += -32
endif
endif
endif
endif
ifeq ($(OS_ARCH), HP-UX)
ifeq ($(USE_64),1)
XLDOPTS += +DA2.0W
endif
endif
ifdef XP_OS2_EMX
XCFLAGS = $(OS_EXE_CFLAGS)
XLDOPTS = -Zlinker /PM:VIO
endif
ifeq ($(MOZ_OS2_TOOLS),VACPP)
OS_CFLAGS = $(OS_EXE_CFLAGS)
endif
include $(topsrcdir)/config/rules.mk
PROGS = $(OBJDIR)/now$(PROG_SUFFIX)
ifeq ($(OS_ARCH),WINNT)
TARGETS = $(PROGS)
else
PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX)
TARGETS = $(PROGS) $(PLSRCS:.pl=)
endif
OUTOPTION = -o # end of the line
ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
OUTOPTION = /Fe
endif
# Redefine MAKE_OBJDIR for just this directory
define MAKE_OBJDIR
if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi
endef
export:: $(TARGETS)
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
ifeq ($(MOZ_OS2_TOOLS),VACPP)
$(LINK) $(EXEFLAGS) $<
else
$(CC) $(XCFLAGS) $< $(XLDOPTS) $(OUTOPTION)$@
endif

View File

@ -0,0 +1,97 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for NCR SVR4 MP-RAS
#
include $(MOD_DEPTH)/config/UNIX.mk
###
NS_USE_NATIVE = 1
# NS_USE_GCC = 1
export PATH:=$(PATH):/opt/ncc/bin
###
RANLIB = true
GCC_FLAGS_EXTRA = -pipe
DEFINES += -DSVR4 -DSYSV -DHAVE_STRERROR -DNCR -D_PR_LOCAL_THREADS_ONLY
ifeq (,$(filter-out 2.03,$(OS_RELEASE)))
DEFINES += -D_PR_STAT_HAS_ST_ATIM
else
DEFINES += -D_PR_STAT_HAS_ST_ATIM_UNION
endif
ifdef NS_USE_NATIVE
CC = cc
CCC = ncc
OS_CFLAGS = -Hnocopyr
#OS_LIBS = -L/opt/ncc/lib
else
#OS_LIBS =
endif
CCC = g++
#OS_LIBS += -lsocket -lnsl -ldl -lc
MKSHLIB = $(LD) $(DSO_LDOPTS)
#DSO_LDOPTS = -G -z defs
DSO_LDOPTS = -G
CPU_ARCH = x86
ARCH = ncr
NOSUCHFILE = /no-such-file
# now take care of default GCC (rus@5/5/97)
ifdef NS_USE_GCC
# if gcc-settings are redefined already - don't touch it
#
ifeq (,$(findstring gcc, $(CC)))
CC = gcc
CCC = g++
CXX = g++
COMPILER_TAG = _gcc
# always use -fPIC - some makefiles are still broken and don't distinguish
# situation when they build shared and static libraries
CFLAGS += -fPIC -Wall $(GCC_FLAGS_EXTRA)
#OS_LIBS += -L/usr/local/lib -lstdc++ -lg++ -lgcc
endif
endif
###

View File

@ -0,0 +1,61 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for NEC Mips SYSV
#
include $(MOD_DEPTH)/config/UNIX.mk
CPU_ARCH = mips
ifdef NS_USE_GCC
CC = gcc
CCC = g++
else
CC = $(NSDEPTH)/build/hcc cc -Xa -KGnum=0 -KOlimit=4000
CCC = g++
endif
MKSHLIB = $(LD) $(DSO_LDOPTS)
RANLIB = /bin/true
DEFINES += -D_PR_LOCAL_THREADS_ONLY
OS_CFLAGS = $(ODD_CFLAGS) -DSVR4 -D__SVR4 -DNEC -Dnec_ews -DHAVE_STRERROR
OS_LIBS = -lsocket -lnsl -ldl $(LDOPTIONS)
LDOPTIONS = -lc -L/usr/ucblib -lucb
NOSUCHFILE = /no-such-file
DSO_LDOPTS = -G

View File

@ -0,0 +1,74 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
######################################################################
# Config stuff for Sony NEWS-OS
######################################################################
######################################################################
# Version-independent
######################################################################
include $(MOD_DEPTH)/config/UNIX.mk
ARCH := sony
CPU_ARCH := mips
CC = cc
CCC = CC
RANLIB = /bin/true
OS_INCLUDES = -I/usr/include
G++INCLUDES =
#OS_LIBS = -lsocket -lnsl -lgen -lresolv
PLATFORM_FLAGS = -Xa -fullwarn -DSONY
PORT_FLAGS = -DSYSV -DSVR4 -D__svr4 -D__svr4__ -D_PR_LOCAL_THREADS_ONLY -DHAVE_SVID_GETTOD
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS)
######################################################################
# Version-specific stuff
######################################################################
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
######################################################################
# Other
######################################################################
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G

View File

@ -0,0 +1,68 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for NEXTSTEP
#
include $(MOD_DEPTH)/config/UNIX.mk
CC = cc
CCC = cc++
RANLIB = ranlib
OS_REL_CFLAGS = -D$(shell uname -p)
CPU_ARCH := $(shell uname -p)
# "Commons" are tentative definitions in a global scope, like this:
# int x;
# The meaning of a common is ambiguous. It may be a true definition:
# int x = 0;
# or it may be a declaration of a symbol defined in another file:
# extern int x;
# Use the -fno-common option to force all commons to become true
# definitions so that the linker can catch multiply-defined symbols.
# Also, common symbols are not allowed with Rhapsody dynamic libraries.
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -fno-common -pipe -DNEXTSTEP -DHAVE_STRERROR -DHAVE_BSD_FLOCK -D_POSIX_SOURCE -traditional-cpp -posix
DEFINES += -D_PR_LOCAL_THREADS_ONLY
ARCH = $(CPU_ARCH)
# May override this with -bundle to create a loadable module.
#DSO_LDOPTS = -dynamiclib
#MKSHLIB = $(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS)
DLL_SUFFIX = dylib

View File

@ -0,0 +1,90 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1999-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.
#
######################################################################
# Config stuff for Neutrino
######################################################################
include $(MOD_DEPTH)/config/UNIX.mk
#
# XXX
# Temporary define for the Client; to be removed when binary release is used
#
ifdef MOZILLA_CLIENT
ifneq ($(USE_PTHREADS),1)
CLASSIC_NSPR = 1
endif
endif
#
# The default implementation strategy for Linux is pthreads.
#
ifeq ($(CLASSIC_NSPR),1)
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
else
USE_PTHREADS = 1
IMPL_STRATEGY = _PTH
DEFINES += -D_REENTRANT
endif
AR = qcc -Vgcc_ntox86 -M -a $@
CC = qcc -Vgcc_ntox86
LD = $(CC)
CCC = $(CC)
# Old Flags -DNO_REGEX -DSTRINGS_ALIGNED
OS_CFLAGS = -Wc,-Wall -Wc,-Wno-parentheses -DNTO \
-D_QNX_SOURCE -DHAVE_POINTER_LOCALTIME_R -shared
COMPILER_TAG = _qcc
MKSHLIB = qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M
RANLIB = ranlib
G++INCLUDES =
OS_LIBS =
EXTRA_LIBS = -lsocket
ifdef BUILD_OPT
OPTIMIZER = -O1
else
OPTIMIZER = -O1 -gstabs
endif
NOSUCHFILE = /no-such-file
GARBAGE += *.map

View File

@ -0,0 +1,82 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for NetBSD
#
include $(MOD_DEPTH)/config/UNIX.mk
CC = gcc
CCC = g++
RANLIB = ranlib
ifndef OBJECT_FMT
OBJECT_FMT := $(shell if echo __ELF__ | $${CC:-cc} -E - | grep -q __ELF__ ; then echo a.out ; else echo ELF ; fi)
endif
OS_REL_CFLAGS =
ifeq (86,$(findstring 86,$(OS_TEST)))
CPU_ARCH = x86
else
CPU_ARCH = $(OS_TEST)
endif
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -pipe -DNETBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
ifeq ($(USE_PTHREADS),1)
OS_LIBS = -lc_r
# XXX probably should define _THREAD_SAFE too.
else
OS_LIBS = -lc
DEFINES += -D_PR_LOCAL_THREADS_ONLY
endif
ARCH = netbsd
ifeq ($(OBJECT_FMT),ELF)
DLL_SUFFIX = so
else
DLL_SUFFIX = so.1.0
endif
DSO_CFLAGS = -fPIC -DPIC
DSO_LDOPTS = -x -shared
ifdef LIBRUNPATH
DSO_LDOPTS += -R$(LIBRUNPATH)
endif
MKSHLIB = $(LD) $(DSO_LDOPTS)
G++INCLUDES = -I/usr/include/g++

View File

@ -0,0 +1,170 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Configuration common to all (supported) versions of OS/2
#
# OS_CFLAGS is the command line options for the compiler when
# building the .DLL object files.
# OS_EXE_CFLAGS is the command line options for the compiler
# when building the .EXE object files; this is for the test
# programs.
# the macro OS_CFLAGS is set to OS_EXE_CFLAGS inside of the
# makefile for the pr/tests directory. ... Hack.
# Specify toolset. Default to EMX.
ifeq ($(MOZ_OS2_TOOLS),VACPP)
XP_OS2_VACPP = 1
else
ifeq ($(MOZ_OS2_TOOLS),PGCC)
XP_OS2_EMX = 1
else
MOZ_OS2_TOOLS = EMX
XP_OS2_EMX = 1
endif
endif
ifeq ($(XP_OS2_EMX),1)
MOZ_EMXTAG = $(subst .,,$(MOZ_OS2_EMX_OBJECTFORMAT))
endif
#
# On OS/2 we proudly support gbash...
#
SHELL = GBASH.EXE
CC = icc -q -DXP_OS2 -N10
CCC = icc -q -DXP_OS2 -DOS2=4 -N10
LINK = -ilink
AR = -ilib /noignorecase /nologo /Out:$(subst /,\\,$@)
RANLIB = @echo RANLIB
BSDECHO = @echo BSDECHO
NSINSTALL = nsinstall
INSTALL = $(NSINSTALL)
MAKE_OBJDIR = if test ! -d $(OBJDIR); then mkdir $(OBJDIR); fi
IMPLIB = implib -nologo -noignorecase
FILTER = cppfilt -b -p -q
RC = rc.exe
GARBAGE =
XP_DEFINE = -DXP_PC
LIB_SUFFIX = lib
DLL_SUFFIX = dll
OBJ_SUFFIX = obj
OS_CFLAGS = -W3 -Wcnd- -gm -gd+ -sd- -su4 -ge- -Mp
OS_EXE_CFLAGS = -W3 -Wcnd- -gm -gd+ -sd- -su4 -Mp
AR_EXTRA_ARGS =
ifdef BUILD_OPT
OPTIMIZER = -O+ -Oi
DEFINES = -UDEBUG -U_DEBUG -DNDEBUG
DLLFLAGS = -DLL -OUT:$@ -MAP:$(@:.dll=.map)
EXEFLAGS = -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE
OBJDIR_TAG = _OPT
else
OPTIMIZER = -Ti+ -DE
DEFINES = -DDEBUG -D_DEBUG -DDEBUGPRINTS
DLLFLAGS = -DEBUG -DLL -OUT:$@ -MAP:$(@:.dll=.map)
EXEFLAGS = -DEBUG -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE
OBJDIR_TAG = _DBG
LDFLAGS = -DEBUG
endif
DEFINES += -DOS2=4
DEFINES += -D_X86_
DEFINES += -D_PR_GLOBAL_THREADS_ONLY -DBSD_SELECT
# Name of the binary code directories
ifdef MOZ_LITE
OBJDIR_NAME = $(subst OS2,NAV,$(OS_CONFIG))_$(MOZ_OS2_TOOLS)$(MOZ_EMXTAG)$(OBJDIR_TAG).OBJ
else
OBJDIR_NAME = $(OS_CONFIG)_$(MOZ_OS2_TOOLS)$(MOZ_EMXTAG)$(OBJDIR_TAG).OBJ
endif
OS_DLLFLAGS = -nologo -DLL -FREE -NOE
ifdef XP_OS2_VACPP
OS_LIBS = so32dll.lib tcp32dll.lib
DEFINES += -DXP_OS2_VACPP -DTCPV40HDRS
else
CC = gcc
CCC = gcc
LINK = gcc
RC = rc.exe
FILTER = emxexp
IMPLIB = emximp -o
# Determine which object format to use. Two choices:
# a.out and omf. We default to omf.
ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT), A.OUT)
AR = ar -q $@
LIB_SUFFIX = a
else
OMF_FLAG = -Zomf
AR = emxomfar r $@
LIB_SUFFIX = lib
endif
OS_LIBS = -lsocket -lemxio
DEFINES += -DXP_OS2 -DXP_OS2_EMX -DOS2EMX_PLAIN_CHAR
OS_CFLAGS = $(OMF_FLAG) -Wall -Wno-unused -Zmtd
OS_EXE_CFLAGS = $(OMF_FLAG) -Wall -Wno-unused -Zmtd
OS_DLLFLAGS = $(OMF_FLAG) -Zmt -Zdll -Zcrtdll -o $@
ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF)
EXEFLAGS += -Zlinker /DE
endif
ifdef BUILD_OPT
OPTIMIZER = -O3
DLLFLAGS =
EXEFLAGS = -Zmtd -o $@
else
OPTIMIZER = -g #-s
DLLFLAGS = -g #-s
EXEFLAGS = -g $(OMF_FLAG) -Zmtd -L$(DIST)/lib -o $@ # -s
ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF)
EXEFLAGS += -Zlinker /DE
endif
endif
AR_EXTRA_ARGS =
endif

View File

@ -0,0 +1,131 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for DEC OSF/1
#
#
# The Bourne shell (sh) on OSF1 doesn't handle "set -e" correctly,
# which we use to stop LOOP_OVER_DIRS submakes as soon as any
# submake fails. So we use the Korn shell instead.
#
SHELL = /usr/bin/ksh
include $(MOD_DEPTH)/config/UNIX.mk
#
# XXX
# Temporary define for the Client; to be removed when binary release is used
#
ifdef MOZILLA_CLIENT
ifneq ($(USE_PTHREADS),1)
CLASSIC_NSPR = 1
endif
endif
#
# Prior to OSF1 V4.0, classic nspr is the default (and only) implementation
# strategy.
#
# On OSF1 V4.0, pthreads is the default implementation strategy.
# Classic nspr is also available.
#
ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
CLASSIC_NSPR = 1
endif
ifeq ($(CLASSIC_NSPR), 1)
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
else
USE_PTHREADS = 1
ifeq ($(HAVE_CCONF), 1)
IMPL_STRATEGY =
else
IMPL_STRATEGY = _PTH
endif
endif
ifeq ($(HAVE_CCONF), 1)
CC = cc $(NON_LD_FLAGS)
else
CC = cc $(NON_LD_FLAGS) -std1
endif
ifneq ($(OS_RELEASE),V2.0)
CC += -readonly_strings
endif
# The C++ compiler cxx has -readonly_strings on by default.
CCC = cxx
RANLIB = /bin/true
CPU_ARCH = alpha
ifdef BUILD_OPT
OPTIMIZER += -Olimit 4000
endif
NON_LD_FLAGS = -ieee_with_inexact
OS_CFLAGS = -DOSF1 -D_REENTRANT
ifeq ($(HAVE_CCONF), 1)
OS_CFLAGS += -DIS_64 -DOSF1V4D -DOSF1
endif
ifneq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
OS_CFLAGS += -DOSF1_HAVE_MACHINE_BUILTINS_H
endif
ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
OS_CFLAGS += -DHAVE_INT_LOCALTIME_R
else
OS_CFLAGS += -DHAVE_POINTER_LOCALTIME_R
endif
ifeq (,$(filter-out V4.0%,$(OS_RELEASE)))
OS_CFLAGS += -DOSF1V4_MAP_PRIVATE_BUG
endif
ifeq ($(USE_PTHREADS),1)
OS_CFLAGS += -pthread
ifneq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
OS_CFLAGS += -D_PR_HAVE_THREADSAFE_GETHOST
endif
endif
# The command to build a shared library on OSF1.
MKSHLIB = ld -shared -all -expect_unresolved "*" -soname $(notdir $@)
DSO_LDOPTS = -shared

View File

@ -0,0 +1,78 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for OpenBSD
#
include $(MOD_DEPTH)/config/UNIX.mk
CC = gcc
CCC = g++
RANLIB = ranlib
OS_REL_CFLAGS =
ifeq (86,$(findstring 86,$(OS_TEST)))
CPU_ARCH = x86
else
CPU_ARCH = $(OS_TEST)
endif
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -pipe $(THREAD_FLAG) -DOPENBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
ifeq ($(USE_PTHREADS),1)
THREAD_FLAG += -pthread
# XXX probably should define _THREAD_SAFE too.
else
DEFINES += -D_PR_LOCAL_THREADS_ONLY
endif
ARCH = openbsd
DLL_SUFFIX = so.1.0
DSO_CFLAGS = -fPIC
DSO_LDOPTS = -Bshareable
ifeq ($(OS_TEST),alpha)
DSO_LDOPTS = -shared
endif
ifeq ($(OS_TEST),mips)
DSO_LDOPTS = -shared
endif
ifeq ($(OS_TEST),pmax)
DSO_LDOPTS = -shared
endif
MKSHLIB = $(LD) $(DSO_LDOPTS)
G++INCLUDES = -I/usr/include/g++

View File

@ -0,0 +1,67 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for Compaq OpenVMS
#
include $(MOD_DEPTH)/config/UNIX.mk
ifdef INTERNAL_TOOLS
CC = c89
CCC = cxx
OPTIMIZER = -O
else
CC = ccc
CCC = ccc
endif
RANLIB = /bin/true
CPU_ARCH_TAG = _$(CPU_ARCH)
OS_CFLAGS = -DVMS -DVMS_AS_IS -Wc,names=\(short,as\) \
-DGENERIC_PTHREAD_REDEFINES
OS_CXXFLAGS = -DVMS -DVMS_AS_IS -Wc,names=\(short,as\) \
-DGENERIC_PTHREAD_REDEFINES
#
# XCFLAGS are the only CFLAGS that are used during a link operation. Defining
# OPTIMIZER in XCFLAGS means that each compilation line gets OPTIMIZER
# included twice, but at least we get OPTIMIZER included in the link
# operations; and OpenVMS needs it!
#
XCFLAGS += $(OPTIMIZER)
# The command to build a shared library in POSIX on OpenVMS.
MKSHLIB = vmsld $(OPTIMIZER)

View File

@ -0,0 +1,57 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
######################################################################
# Config stuff for QNX.
######################################################################
include $(MOD_DEPTH)/config/UNIX.mk
CPU_ARCH = x86
ifndef NS_USE_GCC
CC = cc
CCC = cc
endif
RANLIB = true
G++INCLUDES =
OS_LIBS =
XLDOPTS = -lunix
OS_CFLAGS = -DQNX -Di386 -D_PR_LOCAL_THREADS_ONLY -D_PR_NEED_H_ERRNO
#IMPL_STRATEGY = _EMU
NOSUCHFILE = /no-such-file
GARBAGE = $(wildcard *.err)

View File

@ -0,0 +1,9 @@
This part of of the tree taken from NSPR 4.1. The
NSPR config tree was tagged with:
cvs tag ldapcsdk_branch50-config
The version of NSPR this was taken from:
NSPRPUB_RELEASE_4_1 (revision: 3.23)

View File

@ -0,0 +1,83 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for Rhapsody
#
include $(MOD_DEPTH)/config/UNIX.mk
#
# The default implementation strategy for Rhapsody is pthreads.
#
ifeq ($(CLASSIC_NSPR),1)
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
else
USE_PTHREADS = 1
IMPL_STRATEGY = _PTH
endif
CC = cc
CCC = c++
RANLIB = ranlib
ifeq (86,$(findstring 86,$(OS_TEST)))
OS_REL_CFLAGS = -mno-486 -Di386
CPU_ARCH = i386
else
OS_REL_CFLAGS = -Dppc
CPU_ARCH = ppc
endif
# "Commons" are tentative definitions in a global scope, like this:
# int x;
# The meaning of a common is ambiguous. It may be a true definition:
# int x = 0;
# or it may be a declaration of a symbol defined in another file:
# extern int x;
# Use the -fno-common option to force all commons to become true
# definitions so that the linker can catch multiply-defined symbols.
# Also, common symbols are not allowed with Rhapsody dynamic libraries.
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wmost -fno-common -pipe -DRHAPSODY -DHAVE_STRERROR -DHAVE_BSD_FLOCK
ARCH = rhapsody
# May override this with -bundle to create a loadable module.
DSO_LDOPTS = -dynamiclib -compatibility_version 1 -current_version 1 -all_load
MKSHLIB = $(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS)
DLL_SUFFIX = dylib
G++INCLUDES = -I/usr/include/g++

View File

@ -0,0 +1,63 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for SCO OpenServer for x86.
# SCO OpenServer 5, based on SVR3.2, is intended for small to
# medium customers.
#
include $(MOD_DEPTH)/config/UNIX.mk
CC = cc -b elf -KPIC
CCC = $(NSDEPTH)/build/hcpp CC +.cpp +w
RANLIB = /bin/true
DEFINES += -D_PR_LOCAL_THREADS_ONLY
#
# -DSCO - Changes to Netscape source (consistent with AIX, LINUX, etc..)
# -Dsco - Needed for /usr/include/X11/*
#
OS_CFLAGS = -DSYSV -D_SVID3 -DHAVE_STRERROR -D_PR_NEED_H_ERRNO -DSCO -Dsco
#OS_LIBS = -lpmapi -lsocket -lc
MKSHLIB = $(LD) $(DSO_LDOPTS)
CPU_ARCH = x86
ARCH = sco
NOSUCHFILE = /no-such-file
BSDECHO = /bin/echo
DSO_LDOPTS = -b elf -G

View File

@ -0,0 +1,108 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for SNI SINIX (aka ReliantUNIX)
#
include $(MOD_DEPTH)/config/UNIX.mk
ifeq (86,$(findstring 86,$(OS_TEST)))
CPU_ARCH = x86
else
CPU_ARCH = mips
endif
CPU_ARCH_TAG = _$(CPU_ARCH)
# use gcc -tf-
NS_USE_GCC = 1
ifeq ($(NS_USE_GCC),1)
## gcc-2.7.2 homebrewn
CC = gcc
COMPILER_TAG = _gcc
CCC = g++
AS = $(CC) -x assembler-with-cpp
ifeq ($(CPU_ARCH),mips)
LD = gld
endif
ODD_CFLAGS = -Wall -Wno-format
ifeq ($(CPU_ARCH),mips)
# The -pipe flag only seems to work on the mips version of SINIX.
ODD_CFLAGS += -pipe
endif
ifdef BUILD_OPT
OPTIMIZER = -O
#OPTIMIZER = -O6
endif
MKSHLIB = $(LD) -G -z defs -h $(@:$(OBJDIR)/%.so=%.so)
#DSO_LDOPTS = -G -Xlinker -Blargedynsym
else
## native compiler (CDS++ 1.0)
CC = /usr/bin/cc
CCC = /usr/bin/CC
AS = /usr/bin/cc
#ODD_CFLAGS = -fullwarn -xansi
ODD_CFLAGS =
ifdef BUILD_OPT
#OPTIMIZER = -Olimit 4000
OPTIMIZER = -O -F Olimit,4000
endif
MKSHLIB = $(LD) -G -z defs -h $(@:$(OBJDIR)/%.so=%.so)
#DSO_LDOPTS = -G -W l,-Blargedynsym
endif
ifeq ($(CPU_ARCH),x86)
DEFINES += -Di386
endif
ODD_CFLAGS += -DSVR4 -DSNI -DRELIANTUNIX -Dsinix -DHAVE_SVID_GETTOD
# On SINIX 5.43, need to define IP_MULTICAST in order to get the
# IP multicast macro and struct definitions in netinet/in.h.
# (SINIX 5.42 does not have IP multicast at all.)
ifeq ($(OS_RELEASE),5.43)
ODD_CFLAGS += -DIP_MULTICAST
endif
RANLIB = /bin/true
# For purify
NOMD_OS_CFLAGS = $(ODD_CFLAGS)
# we do not have -MDupdate ...
OS_CFLAGS = $(NOMD_OS_CFLAGS)
OS_LIBS = -lsocket -lnsl -lresolv -ldl -lc
NOSUCHFILE = /no-such-file
DEFINES += -D_PR_LOCAL_THREADS_ONLY

View File

@ -0,0 +1,42 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for SunOS.
# 4 and 5 are vastly different, so we use 2 different files.
#
ifeq ($(basename $(OS_RELEASE)),4.1)
include $(MOD_DEPTH)/config/SunOS4.mk
else
include $(MOD_DEPTH)/config/SunOS5.mk
endif

View File

@ -0,0 +1,68 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for SunOS4.1
#
include $(MOD_DEPTH)/config/UNIX.mk
# SunOS 4 _requires_ that shared libs have a version number.
# XXX FIXME: Version number should use NSPR_VERSION_NUMBER?
DLL_SUFFIX = so.1.0
CC = gcc
CCC = g++
COMPILER_TAG = _gcc
RANLIB = ranlib
CPU_ARCH = sparc
DEFINES += -D_PR_LOCAL_THREADS_ONLY
# Purify doesn't like -MDupdate
NOMD_OS_CFLAGS = -Wall -Wno-format -DSUNOS4
ifdef NO_MDUPDATE
OS_CFLAGS = $(DSO_CFLAGS) $(NOMD_OS_CFLAGS)
else
OS_CFLAGS = $(DSO_CFLAGS) $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES)
endif
MKSHLIB = $(LD) $(DSO_LDOPTS)
NOSUCHFILE = /no-such-file
DSO_LDOPTS =
# -fPIC generates position-independent code for use in a shared library.
DSO_CFLAGS = -fPIC

View File

@ -0,0 +1,48 @@
#
# 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) 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.
#
# Config stuff for Solaris 8 on x86
#
SOL_CFLAGS = -D_SVID_GETTOD
include $(CORE_DEPTH)/coreconf/SunOS5.mk
CPU_ARCH = x86
ARCHFLAG =
OS_DEFINES += -Di386
ifeq ($(OS_RELEASE),5.8_i86pc)
OS_DEFINES += -DSOLARIS2_8
endif
OS_LIBS += -lnsl -lsocket -lposix4 -ldl -lc

View File

@ -0,0 +1,44 @@
#
# 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.
#
# Config stuff for SunOS5.9
#
SOL_CFLAGS += -D_SVID_GETTOD
include $(CORE_DEPTH)/coreconf/SunOS5.mk
ifeq ($(OS_RELEASE),5.9)
OS_DEFINES += -DSOLARIS2_9
endif
OS_LIBS += -lnsl -lsocket -lposix4 -ldl -lc

View File

@ -0,0 +1,48 @@
#
# 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) 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.
#
# Config stuff for Solaris 9 on x86
#
SOL_CFLAGS = -D_SVID_GETTOD
include $(CORE_DEPTH)/coreconf/SunOS5.mk
CPU_ARCH = x86
ARCHFLAG =
OS_DEFINES += -Di386
ifeq ($(OS_RELEASE),5.9_i86pc)
OS_DEFINES += -DSOLARIS2_9
endif
OS_LIBS += -lnsl -lsocket -lposix4 -ldl -lc

View File

@ -0,0 +1,223 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for SunOS 5.x on sparc and x86
#
include $(MOD_DEPTH)/config/UNIX.mk
#
# XXX
# Temporary define for the Client; to be removed when binary release is used
#
ifdef MOZILLA_CLIENT
ifneq ($(USE_PTHREADS),1)
LOCAL_THREADS_ONLY = 1
endif
ifndef NS_USE_NATIVE
NS_USE_GCC = 1
endif
endif
#
# The default implementation strategy on Solaris is pthreads.
# Global threads only and local threads only are also available.
#
ifeq ($(GLOBAL_THREADS_ONLY),1)
IMPL_STRATEGY = _NATIVE
DEFINES += -D_PR_GLOBAL_THREADS_ONLY
else
ifeq ($(LOCAL_THREADS_ONLY),1)
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
else
USE_PTHREADS = 1
ifeq ($(HAVE_CCONF), 1)
IMPL_STRATEGY =
else
IMPL_STRATEGY = _PTH
endif
endif
endif
ifeq ($(NS_USE_GCC), 1)
CC = gcc -Wall
CCC = g++ -Wall
ASFLAGS += -Wa,-P
COMPILER_TAG = _gcc
ifdef NO_MDUPDATE
OS_CFLAGS = $(NOMD_OS_CFLAGS)
else
OS_CFLAGS = $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES)
endif
else
CC = cc -xstrconst
# 'conststrings' enabled by default in CC standard mode
CCC = CC
ASFLAGS += -Wa,-P
OS_CFLAGS = $(NOMD_OS_CFLAGS)
#
# If we are building for a release, we want to put all symbol
# tables in the debug executable or share library instead of
# the .o files, so that our clients can run dbx on the debug
# library without having the .o files around.
#
ifdef BUILD_NUMBER
ifndef BUILD_OPT
OS_CFLAGS += -xs
endif
endif
endif
ifeq ($(USE_64),1)
ifneq ($(NS_USE_GCC), 1)
ifeq ($(CPU_ARCH),sparc)
CC += -xarch=v9
CCC += -xarch=v9
COMPILER_TAG = _64
endif
ifeq ($(CPU_ARCH),i386)
CC += -xarch=amd64
CCC += -xarch=amd64
CPU_ARCH = x86_64
COMPILER_TAG = _i86pc_64
OS_DEFINES += -Dx86_64
endif
endif
else
ifeq ($(OS_TEST),i86pc)
COMPILER_TAG = _i86pc
else
ifeq ($(HAVE_CCONF), 1)
COMPILER_TAG =
else
COMPILER_TAG = _32
endif
endif
endif
RANLIB = echo
OS_DEFINES = -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS
ifeq ($(OS_TEST),i86pc)
# The default debug format, DWARF (-g), is not supported by gcc
# on i386-ANY-sysv4/solaris, but the stabs format is. It is
# assumed that the Solaris assembler /usr/ccs/bin/as is used.
# If your gcc uses GNU as, you do not need the -Wa,-s option.
ifndef BUILD_OPT
ifeq ($(NS_USE_GCC), 1)
OPTIMIZER = -Wa,-s -gstabs
endif
endif
else
ifeq ($(HAVE_CCONF), 1)
CPU_ARCH =
else
CPU_ARCH = sparc
endif
endif
ifeq ($(HAVE_CCONF), 1)
CPU_ARCH_TAG =
else
CPU_ARCH_TAG = _$(CPU_ARCH)
endif
ifeq (5.5,$(findstring 5.5,$(OS_RELEASE)))
OS_DEFINES += -DSOLARIS2_5
else
ifeq (,$(filter-out 5.3 5.4,$(OS_RELEASE)))
OS_DEFINES += -D_PR_NO_LARGE_FILES
else
OS_DEFINES += -D_PR_HAVE_OFF64_T
# The lfcompile64(5) man page on Solaris 2.6 says:
# For applications that do not wish to conform to the POSIX or
# X/Open specifications, the 64-bit transitional interfaces
# are available by default. No compile-time flags need to be
# set.
# But gcc 2.7.2.x fails to define _LARGEFILE64_SOURCE by default.
# The native compiler, gcc 2.8.x, and egcs don't have this problem.
#ifeq ($(NS_USE_GCC), 1)
OS_DEFINES += -D_LARGEFILE64_SOURCE
#endif
endif
endif
ifneq ($(LOCAL_THREADS_ONLY),1)
OS_DEFINES += -D_REENTRANT -DHAVE_POINTER_LOCALTIME_R
endif
# Purify doesn't like -MDupdate
NOMD_OS_CFLAGS = $(DSO_CFLAGS) $(OS_DEFINES) $(SOL_CFLAGS)
MKSHLIB = $(LD) $(DSO_LDOPTS)
# ld options:
# -G: produce a shared object
# -z defs: no unresolved symbols allowed
DSO_LDOPTS = -G -h $(notdir $@)
# -KPIC generates position independent code for use in shared libraries.
# (Similarly for -fPIC in case of gcc.)
ifeq ($(NS_USE_GCC), 1)
DSO_CFLAGS = -fPIC
else
DSO_CFLAGS = -KPIC
endif
NOSUCHFILE = /no-such-file
#
# Library of atomic functions for UltraSparc systems
#
# The nspr makefiles build ULTRASPARC_LIBRARY (which contains assembly language
# implementation of the nspr atomic functions for UltraSparc systems) in addition
# to libnspr.so. (The actual name of the library is
# lib$(ULTRASPARC_LIBRARY)$(MOD_VERSION).so
#
# The actual name of the filter-library, recorded in libnspr.so, is set to the
# value of $(ULTRASPARC_FILTER_LIBRARY).
# For an application to use the assembly-language implementation, a link should be
# made so that opening ULTRASPARC_FILTER_LIBRARY results in opening
# ULTRASPARC_LIBRARY. This indirection requires the user to explicitly set up
# library for use on UltraSparc systems, thereby helping to avoid using it by
# accident on non-UltraSparc systems.
# The directory containing the ultrasparc libraries should be in LD_LIBRARY_PATH.
#
ifeq ($(OS_TEST),sun4u)
ULTRASPARC_LIBRARY = ultrasparc
ULTRASPARC_FILTER_LIBRARY = libatomic.so
DSO_LDOPTS += -f $(ULTRASPARC_FILTER_LIBRARY)
endif

View File

@ -0,0 +1,91 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
PR_UNIXOS = 1
XP_DEFINE = -DXP_UNIX
OBJ_SUFFIX = o
LIB_SUFFIX = a
DLL_SUFFIX = so
AR = ar cr $@
ifdef BUILD_OPT
OPTIMIZER = -O
DEFINES = -UDEBUG -DNDEBUG
OBJDIR_TAG = _OPT
else
OPTIMIZER = -g
DEFINES = -DDEBUG -UNDEBUG
OBJDIR_TAG = _DBG
endif
# Name of the binary code directories
ifdef MOZILLA_CLIENT
OBJDIR_NAME = $(OS_CONFIG)$(CPU_ARCH_TAG)$(OBJDIR_TAG).OBJ
else
OBJDIR_NAME = $(OS_CONFIG)$(CPU_ARCH_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
endif
MKDEPEND_DIR = $(DEPTH)/config/mkdepend
MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend
MKDEPENDENCIES = $(OBJDIR)/depend.mk
####################################################################
#
# One can define the makefile variable NSDISTMODE to control
# how files are published to the 'dist' directory. If not
# defined, the default is "install using relative symbolic
# links". The two possible values are "copy", which copies files
# but preserves source mtime, and "absolute_symlink", which
# installs using absolute symbolic links. The "absolute_symlink"
# option requires NFSPWD.
#
####################################################################
NSINSTALL = $(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall
ifeq ($(NSDISTMODE),copy)
# copy files, but preserve source mtime
INSTALL = $(NSINSTALL) -t
else
ifeq ($(NSDISTMODE),absolute_symlink)
# install using absolute symbolic links
INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
else
# install using relative symbolic links
INSTALL = $(NSINSTALL) -R
endif
endif
define MAKE_OBJDIR
if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); else true; fi
endef

View File

@ -0,0 +1,71 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for SCO UnixWare
# UnixWare is intended for high-end enterprise customers.
# UnixWare 2.1 and 2.1.1 are based on SVR4. (2.1.2 is a maintenance
# release.)
# UnixWare 7 (codename Gemini) is based on what SCO calls SVR5.
# The somewhat odd version number 7 was chosen to suggest that
# UnixWare 2 + OpenServer 5 = UnixWare 7
#
include $(MOD_DEPTH)/config/UNIX.mk
ifeq (,$(filter-out 2.1,$(OS_RELEASE)))
CC = $(NSDEPTH)/build/hcc cc
CCC = $(NSDEPTH)/build/hcpp CC
else
CC = cc
CCC = CC
endif
RANLIB = true
DEFINES += -D_PR_LOCAL_THREADS_ONLY
OS_CFLAGS = -DSVR4 -DSYSV -DUNIXWARE
ifeq (,$(filter-out 2.1,$(OS_RELEASE)))
OS_CFLAGS += -D_PR_NO_LARGE_FILES
else
OS_CFLAGS += -D_LARGEFILE64_SOURCE -D_PR_HAVE_OFF64_T -D_PR_HAVE_SOCKADDR_LEN
endif
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G
CPU_ARCH = x86
ARCH = sco
NOSUCHFILE = /no-such-file

View File

@ -0,0 +1,175 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Configuration common to all versions of Windows NT
# and Windows 95.
#
#
# Client build: make sure we use the shmsdos.exe under $(MOZ_TOOLS).
# $(MOZ_TOOLS_FLIPPED) is $(MOZ_TOOLS) with all the backslashes
# flipped, so that gmake won't interpret them as escape characters.
#
ifdef PR_CLIENT_BUILD_WINDOWS
SHELL = $(MOZ_TOOLS_FLIPPED)/bin/shmsdos.exe
endif
CC = cl
CCC = cl
LINK = link
AR = lib -NOLOGO -OUT:"$@"
RANLIB = echo
BSDECHO = echo
NSINSTALL = nsinstall
INSTALL = $(NSINSTALL)
define MAKE_OBJDIR
if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
endef
RC = rc.exe
GARBAGE = $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb
XP_DEFINE = -DXP_PC
OBJ_SUFFIX = obj
LIB_SUFFIX = lib
DLL_SUFFIX = dll
OS_CFLAGS = -W3 -nologo -GF -Gy
ifdef BUILD_OPT
OS_CFLAGS += -MD
OPTIMIZER = -O2
DEFINES = -UDEBUG -U_DEBUG -DNDEBUG
DLLFLAGS = -OUT:"$@"
OBJDIR_TAG = _OPT
# Add symbolic information for use by a profiler
ifdef MOZ_PROFILE
OPTIMIZER += -Zi
DLLFLAGS += -DEBUG -DEBUGTYPE:CV
LDFLAGS += -DEBUG -DEBUGTYPE:CV
endif
else
#
# Define USE_DEBUG_RTL if you want to use the debug runtime library
# (RTL) in the debug build
#
ifdef USE_DEBUG_RTL
OS_CFLAGS += -MDd
else
OS_CFLAGS += -MD
endif
OPTIMIZER = -Od -Zi
#OPTIMIZER = -Zi -Fd$(OBJDIR)/ -Od
DEFINES = -DDEBUG -D_DEBUG -UNDEBUG
DLLFLAGS = -DEBUG -DEBUGTYPE:CV -OUT:"$@"
ifdef GLOWCODE
DLLFLAGS = -DEBUG -DEBUGTYPE:both -INCLUDE:_GlowCode -OUT:"$@"
endif
OBJDIR_TAG = _DBG
LDFLAGS = -DEBUG -DEBUGTYPE:CV
#
# When PROFILE=1 is defined, set the compile and link options
# to build targets for use by the ms-win32 profiler
#
ifdef PROFILE
LDFLAGS += -PROFILE -MAP
DLLFLAGS += -PROFILE -MAP
endif
endif
DEFINES += -DWIN32 -D_WINDOWS
#
# On Win95, we use the TlsXXX() interface by default because that
# allows us to load the NSPR DLL dynamically at run time.
# If you want to use static thread-local storage (TLS) for better
# performance, build the NSPR library with USE_STATIC_TLS=1.
#
ifeq ($(USE_STATIC_TLS),1)
DEFINES += -D_PR_USE_STATIC_TLS
endif
#
# NSPR uses both fibers and static thread-local storage
# (i.e., __declspec(thread) variables) on NT. We need the -GT
# flag to turn off certain compiler optimizations so that fibers
# can use static TLS safely.
#
# Also, we optimize for Pentium (-G5) on NT.
#
ifeq ($(OS_TARGET),WINNT)
OS_CFLAGS += -GT
ifeq ($(CPU_ARCH),x86)
OS_CFLAGS += -G5
endif
DEFINES += -DWINNT
else
DEFINES += -DWIN95 -D_PR_GLOBAL_THREADS_ONLY
endif
ifeq ($(CPU_ARCH),x86)
DEFINES += -D_X86_
else
ifeq ($(CPU_ARCH),MIPS)
DEFINES += -D_MIPS_
else
ifeq ($(CPU_ARCH),ALPHA)
DEFINES += -D_ALPHA_=1
else
CPU_ARCH = processor_is_undefined
endif
endif
endif
# Name of the binary code directories
ifeq ($(CPU_ARCH),x86)
CPU_ARCH_TAG =
else
CPU_ARCH_TAG = $(CPU_ARCH)
endif
ifdef USE_DEBUG_RTL
OBJDIR_SUFFIX = OBJD
else
OBJDIR_SUFFIX = OBJ
endif
OBJDIR_NAME = $(OS_CONFIG)$(CPU_ARCH_TAG)$(OBJDIR_TAG).$(OBJDIR_SUFFIX)
OS_DLLFLAGS = -nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE

View File

@ -0,0 +1,38 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for WIN95
#
include $(MOD_DEPTH)/config/WIN32.mk

View File

@ -0,0 +1,38 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Config stuff for WINNT
#
include $(MOD_DEPTH)/config/WIN32.mk

View File

@ -0,0 +1,307 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#######################################################################
# Master "Core Components" macros for getting the OS architecture #
#######################################################################
#
# Important internal static macros
#
OS_ARCH := $(subst /,_,$(shell uname -s))
OS_RELEASE := $(shell uname -r)
OS_TEST := $(shell uname -m)
#
# No -p option in HPUX uname and since we
# do not build for Itanic skip it for now
#
ifneq ($(OS_ARCH),HP-UX)
CPU_ARCH := $(shell uname -p)
endif
#
# Tweak the default OS_ARCH and OS_RELEASE macros as needed.
#
ifeq ($(HAVE_CCONF), 1)
ifeq ($(OS_ARCH), Linux)
ifeq (2.6,$(findstring 2.6,$(OS_RELEASE)))
OS_RELEASE :=2.6
endif
ifeq (2.4,$(findstring 2.4,$(OS_RELEASE)))
OS_RELEASE :=2.4
endif
ifeq (2.2,$(findstring 2.2,$(OS_RELEASE)))
OS_RELEASE :=2.2
endif
ifeq (2.1,$(findstring 2.1,$(OS_RELEASE)))
OS_RELEASE :=2.1
endif
ifeq (2.0,$(findstring 2.0,$(OS_RELEASE)))
OS_RELEASE :=2.0
endif
endif
endif
ifeq ($(OS_ARCH),AIX)
OS_RELEASE := $(shell uname -v).$(shell uname -r)
endif
ifeq ($(OS_ARCH),BSD_386)
OS_ARCH := BSD_OS
endif
ifeq ($(OS_ARCH),dgux)
OS_ARCH := DGUX
endif
ifeq ($(OS_ARCH),IRIX64)
OS_ARCH := IRIX
endif
ifeq ($(OS_ARCH),UNIX_SV)
ifneq ($(findstring NCR,$(shell grep NCR /etc/bcheckrc | head -1 )),)
OS_ARCH := NCR
else
OS_ARCH := UNIXWARE
OS_RELEASE := $(shell uname -v)
endif
endif
ifeq ($(OS_ARCH),Mac OS)
OS_ARCH := Rhapsody
endif
ifeq ($(OS_ARCH),Darwin)
OS_ARCH := Rhapsody
endif
ifeq ($(OS_ARCH),ncr)
OS_ARCH := NCR
endif
# This is the only way to correctly determine the actual OS version on NCR boxes.
ifeq ($(OS_ARCH),NCR)
OS_RELEASE := $(shell awk '{print $$3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$$/\2.\3/')
endif
ifeq ($(OS_ARCH),UNIX_System_V)
OS_ARCH := NEC
endif
ifneq (,$(findstring POSIX_for_OpenVMS,$(OS_ARCH)))
OS_ARCH := OpenVMS
CPU_ARCH := $(shell uname -Wh)
OS_RELEASE := $(shell uname -v)
endif
ifeq ($(OS_ARCH),QNX)
ifeq ($(OS_RELEASE),6.00)
OS_ARCH := NTO
OS_RELEASE := _$(OS_TEST)$(OS_RELEASE)
else
OS_RELEASE := $(shell uname -v | sed 's/^\([0-9]\)\([0-9]*\)$$/\1.\2/')
endif
endif
ifeq ($(OS_ARCH),SCO_SV)
OS_ARCH := SCOOS
OS_RELEASE := 5.0
endif
ifeq ($(OS_ARCH),SINIX-N)
OS_ARCH := SINIX
endif
ifeq ($(OS_ARCH),SINIX-Y)
OS_ARCH := SINIX
endif
ifeq ($(OS_ARCH),SINIX-Z)
OS_ARCH := SINIX
endif
# SINIX changes name to ReliantUNIX with 5.43
ifeq ($(OS_ARCH),ReliantUNIX-N)
OS_ARCH := SINIX
endif
ifeq ($(OS_ARCH),UnixWare)
OS_ARCH := UNIXWARE
OS_RELEASE := $(shell uname -v)
endif
#
# Handle FreeBSD 2.2-STABLE and Linux 2.0.30-osfmach3
#
ifeq (,$(filter-out Linux FreeBSD,$(OS_ARCH)))
OS_RELEASE := $(shell echo "$(OS_RELEASE)" | sed 's/-.*//')
endif
#
# Distinguish between OSF1 V4.0B and V4.0D
#
ifeq ($(OS_ARCH)$(OS_RELEASE),OSF1V4.0)
OS_VERSION := $(shell uname -v)
ifeq ($(OS_VERSION),564)
OS_RELEASE := V4.0B
endif
ifeq ($(OS_VERSION),878)
OS_RELEASE := V4.0D
endif
endif
#
# Handle uname variants for OS/2.
#
ifeq ($(OS_ARCH),OS_2)
OS_ARCH := OS2
OS_RELEASE := 4.0
endif
#######################################################################
# Master "Core Components" macros for getting the OS target #
#######################################################################
#
# Note: OS_TARGET should be specified on the command line for gmake.
# When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
# The difference between the Win95 target and the WinNT target is that
# the WinNT target uses Windows NT specific features not available
# in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
# at lesser performance (the Win95 target uses threads; the WinNT target
# uses fibers).
#
# When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
# is built. See: win16_3.11.mk for lots more about the Win16 target.
#
# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
# cross-compilation.
#
#
# The following hack allows one to build on a WIN95 machine (as if
# s/he were cross-compiling on a WINNT host for a WIN95 target).
# It also accomodates for MKS's uname.exe. If you never intend
# to do development on a WIN95 machine, you don't need this hack.
#
ifeq ($(OS_ARCH),WIN95)
OS_ARCH := WINNT
OS_TARGET := WIN95
endif
ifeq ($(OS_ARCH),Windows_95)
OS_ARCH := Windows_NT
OS_TARGET := WIN95
endif
ifeq ($(OS_ARCH),CYGWIN_95-4.0)
OS_ARCH := CYGWIN_NT-4.0
OS_TARGET := WIN95
endif
ifeq ($(OS_ARCH),OS2)
OS_ARCH := OS2
OS_TARGET := OS2
endif
#
# On WIN32, we also define the variable CPU_ARCH.
#
ifeq ($(OS_ARCH), WINNT)
ifneq ($(subst /,_,$(shell uname -s)),OS_2)
CPU_ARCH := $(shell uname -p)
else
CPU_ARCH := $(shell uname -m)
endif
ifeq ($(CPU_ARCH),I386)
CPU_ARCH = x86
endif
else
#
# If uname -s returns "Windows_NT", we assume that we are using
# the uname.exe in MKS toolkit.
#
# The -r option of MKS uname only returns the major version number.
# So we need to use its -v option to get the minor version number.
# Moreover, it doesn't have the -p option, so we need to use uname -m.
#
ifeq ($(OS_ARCH), Windows_NT)
OS_ARCH = WINNT
OS_MINOR_RELEASE := $(shell uname -v)
ifeq ($(OS_MINOR_RELEASE),00)
OS_MINOR_RELEASE = 0
endif
OS_RELEASE := $(OS_RELEASE).$(OS_MINOR_RELEASE)
CPU_ARCH := $(shell uname -m)
#
# MKS's uname -m returns "586" on a Pentium machine.
#
ifneq (,$(findstring 86,$(CPU_ARCH)))
CPU_ARCH = x86
endif
else
#
# If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
# the uname.exe in the Cygwin tools.
#
ifeq (CYGWIN_NT,$(findstring CYGWIN_NT,$(OS_ARCH)))
OS_RELEASE := $(patsubst CYGWIN_NT-%,%,$(OS_ARCH))
OS_ARCH = WINNT
CPU_ARCH := $(shell uname -m)
#
# Cygwin's uname -m returns "i686" on a Pentium Pro machine.
#
ifneq (,$(findstring 86,$(CPU_ARCH)))
CPU_ARCH = x86
endif
else
#
# Prior to the Beta 20 release, Cygwin was called GNU-Win32.
# If uname -s returns "CYGWIN32/NT", we assume that we are using
# the uname.exe in the GNU-Win32 tools.
#
ifeq ($(OS_ARCH), CYGWIN32_NT)
OS_ARCH = WINNT
CPU_ARCH := $(shell uname -m)
#
# GNU-Win32's uname -m returns "i686" on a Pentium Pro machine.
#
ifneq (,$(findstring 86,$(CPU_ARCH)))
CPU_ARCH = x86
endif
endif
endif
endif
endif
ifndef OS_TARGET
OS_TARGET := $(OS_ARCH)
endif
ifeq ($(OS_TARGET), WIN95)
OS_RELEASE := 4.0
endif
ifeq ($(OS_TARGET), WIN16)
OS_RELEASE :=
# OS_RELEASE := _3.11
endif
OS_CONFIG := $(OS_TARGET)$(OS_RELEASE)

View File

@ -0,0 +1,87 @@
#
# 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 mozilla.org LDAP SDK autoconf glue.
#
# The Initial Developer of the Original Code is Netscape
# Commmunications Corp. Portions created by Netscape are
# Copyright (C) 2000, Netscape Communications Corp. All
# Rights Reserved.
#
# Contributor(s): Dan Mosedale <dmose@mozilla.org>
#
USE_AUTOCONF = 1
MOZILLA_CLIENT = @MOZILLA_CLIENT@
DIST = @prefix@
OBJDIR_NAME = .
OBJDIR = .
OBJ_SUFFIX = @OBJ_SUFFIX@
LIB_SUFFIX = @LIB_SUFFIX@
DLL_SUFFIX = @DLL_SUFFIX@
MOD_VERSION = @NSPR_VERSION@
MOD_NAME = @NSPR_MODNAME@
USE_CPLUS = @USE_CPLUS@
USE_IPV6 = @USE_IPV6@
USE_N32 = @USE_N32@
USE_64 = @USE_64@
USE_PTHREADS = @USE_PTHREADS@
USE_BTHREADS = @USE_BTHREADS@
PTHREADS_USER = @USE_USER_PTHREADS@
CLASSIC_NSPR = @USE_NSPR_THREADS@
AS = @AS@
ASFLAGS = @ASFLAGS@
CC = @CC@
CCC = @CXX@
AR = @AR@
AR_FLAGS = @AR_FLAGS@
LD = @LD@
RANLIB = @RANLIB@
PERL = @PERL@
DLLTOOL = @DLLTOOL@
WINDRES = @WINDRES@
RC = $(WINDRES)
OS_CFLAGS = @CFLAGS@ $(DSO_CFLAGS)
OS_CXXFLAGS = @CXXFLAGS@ $(DSO_CFLAGS)
OS_LIBS = @OS_LIBS@
OS_LDFLAGS = @LDFLAGS@
MKSHLIB = @MKSHLIB@
DSO_CFLAGS = @DSO_CFLAGS@
DSO_LDOPTS = @DSO_LDOPTS@
RESOLVE_LINK_SYMBOLS = @RESOLVE_LINK_SYMBOLS@
HOST_CC = @HOST_CC@
HOST_CFLAGS = @HOST_CFLAGS@
DEFINES = @DEFINES@ @DEFS@
MDCPUCFG_H = @MDCPUCFG_H@
MOZ_TARGET = @MOZ_TARGET@
PR_MD_CSRCS = @PR_MD_CSRCS@
PR_MD_ASFILES = @PR_MD_ASFILES@
PR_MD_ARCH_DIR = @PR_MD_ARCH_DIR@
OS_TARGET = @OS_TARGET@
OS_ARCH = @OS_ARCH@
OS_RELEASE = @OS_RELEASE@
OS_TEST = @OS_TEST@
NOSUCHFILE = @NOSUCHFILE@
AIX_LINK_OPTS = @AIX_LINK_OPTS@
MOZ_OBJFORMAT = @MOZ_OBJFORMAT@
ULTRASPARC_LIBRARY = @ULTRASPARC_LIBRARY@
ULTRASPARC_FILTER_LIBRARY = @ULTRASPARC_FILTER_LIBRARY@

View File

@ -0,0 +1,237 @@
#! 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
# Configuration information for building in the NSPR source module
# Define an include-at-most-once-flag
NSPR_CONFIG_MK = 1
#
# The variable definitions in this file are inputs to NSPR's
# build system. This file, if present, is included at the
# beginning of config.mk.
#
# For example:
#
# BUILD_OPT=1
# USE_PTHREADS=1
# NS_USE_GCC=
#
ifndef topsrcdir
topsrcdir=$(MOD_DEPTH)
endif
ifndef srcdir
srcdir=.
endif
ifdef USE_AUTOCONF
NFSPWD = $(MOD_DEPTH)/config/nfspwd
CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\
$(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
CCCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\
$(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
# For purify
NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
$(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
$(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
NSINSTALL = $(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall
ifeq ($(NSDISTMODE),copy)
# copy files, but preserve source mtime
INSTALL = $(NSINSTALL) -t
else
ifeq ($(NSDISTMODE),absolute_symlink)
# install using absolute symbolic links
INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
else
# install using relative symbolic links
INSTALL = $(NSINSTALL) -R
endif
endif
ifdef BUILD_DEBUG_GC
DEFINES += -DDEBUG_GC
endif
GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*)
ifdef USE_AUTOCONF
DIST_GARBAGE += Makefile
endif
DEFINES += -DFORCE_PR_LOG
ifeq ($(_PR_NO_CLOCK_TIMER),1)
DEFINES += -D_PR_NO_CLOCK_TIMER
endif
ifeq ($(USE_PTHREADS), 1)
DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
endif
ifeq ($(PTHREADS_USER), 1)
DEFINES += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM
endif
ifeq ($(USE_IPV6),1)
DEFINES += -D_PR_INET6
endif
else # ! USE_AUTOCONF
ifndef NSPR_MY_CONFIG_MK
NSPR_MY_CONFIG_MK = $(MOD_DEPTH)/config/my_config.mk
endif
#
# The variable definitions in this file are used to
# override variable values set by NSPR's build system.
# This file, if present, is included at the end of config.mk.
#
# For example:
#
# DIST=/usr/local/nspr
#
ifndef NSPR_MY_OVERRIDES_MK
NSPR_MY_OVERRIDES_MK = $(MOD_DEPTH)/config/my_overrides.mk
endif
-include $(NSPR_MY_CONFIG_MK)
include $(MOD_DEPTH)/config/module.df
include $(MOD_DEPTH)/config/arch.mk
ifndef NSDEPTH
NSDEPTH = $(MOD_DEPTH)/..
endif
#
# Default command macros; can be overridden in <arch>.mk.
#
# XXX FIXME: I removed CCF and LINKEXE.
AS = $(CC)
ASFLAGS = $(CFLAGS)
PURIFY = purify $(PURIFYOPTIONS)
LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
NFSPWD = $(MOD_DEPTH)/config/nfspwd
CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\
$(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
CCCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\
$(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
# For purify
NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
$(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
include $(MOD_DEPTH)/config/$(OS_TARGET).mk
# Figure out where the binary code lives.
BUILD = $(OBJDIR_NAME)
OBJDIR = $(OBJDIR_NAME)
DIST = $(NSDEPTH)/dist/$(OBJDIR_NAME)
ifeq ($(MOZ_BITS),16)
MOZ_INCL = $(NSDEPTH)/dist/public/win16
MOZ_DIST = $(NSDEPTH)/dist/WIN16D_D.OBJ
endif
VPATH = $(OBJDIR)
DEPENDENCIES = $(OBJDIR)/.md
ifdef BUILD_DEBUG_GC
DEFINES += -DDEBUG_GC
endif
GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*)
####################################################################
#
# The NSPR-specific configuration
#
####################################################################
OS_CFLAGS += -DFORCE_PR_LOG
ifeq ($(_PR_NO_CLOCK_TIMER),1)
OS_CFLAGS += -D_PR_NO_CLOCK_TIMER
endif
ifeq ($(USE_PTHREADS), 1)
OS_CFLAGS += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
endif
ifeq ($(PTHREADS_USER), 1)
OS_CFLAGS += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM
endif
ifeq ($(USE_IPV6),1)
OS_CFLAGS += -D_PR_INET6
endif
ifdef GC_LEAK_DETECTOR
OS_CFLAGS += -DGC_LEAK_DETECTOR
endif
####################################################################
#
# Configuration for the release process
#
####################################################################
ifeq ($(USE_INT), 1)
MDIST = /share/builds/integration
else
MDIST = /share/builds/components
endif
ifeq ($(OS_ARCH),WINNT)
MDIST = //helium/dist
MDIST_DOS = $(subst /,\\,$(MDIST))
endif
# RELEASE_DIR is ns/dist/<module name>
RELEASE_DIR = $(NSDEPTH)/dist/release/$(MOD_NAME)
RELEASE_INCLUDE_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/include
RELEASE_BIN_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/bin
RELEASE_LIB_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/lib
-include $(NSPR_MY_OVERRIDES_MK)
endif # USE_AUTOCONF

View File

@ -0,0 +1,155 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-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.
*/
/* libc_r.h -- macros, defines, etc. to make using reentrant libc calls */
/* a bit easier. This was initially done for AIX pthreads, */
/* but should be usable for anyone... */
/* Most of these use locally defined space instead of static library space. */
/* Because of this, we use the _INIT_R to declare/allocate space (stack), */
/* and the plain routines to actually do it..._WARNING_: avoid allocating */
/* memory wherever possible. Memory allocation is fairly expensive, at */
/* least on AIX...use arrays instead (which allocate from the stack.) */
/* I know the names are a bit strange, but I wanted to be fairly certain */
/* that we didn't have any namespace corruption...in general, the inits are */
/* R_<name>_INIT_R(), and the actual calls are R_<name>_R(). */
#ifndef _LIBC_R_H
#define _LIBC_R_H
/************/
/* strtok */
/************/
#define R_STRTOK_INIT_R() \
char *r_strtok_r=NULL
#define R_STRTOK_R(return,source,delim) \
return=strtok_r(source,delim,&r_strtok_r)
#define R_STRTOK_NORET_R(source,delim) \
strtok_r(source,delim,&r_strtok_r)
/**************/
/* strerror */
/**************/
#define R_MAX_STRERROR_LEN_R 8192 /* Straight from limits.h */
#define R_STRERROR_INIT_R() \
char r_strerror_r[R_MAX_STRERROR_LEN_R]
#define R_STRERROR_R(val) \
strerror_r(val,r_strerror_r,R_MAX_STRERROR_LEN_R)
/*****************/
/* time things */
/*****************/
#define R_ASCTIME_INIT_R() \
char r_asctime_r[26]
#define R_ASCTIME_R(val) \
asctime_r(val,r_asctime_r)
#define R_CTIME_INIT_R() \
char r_ctime_r[26]
#define R_CTIME_R(val) \
ctime_r(val,r_ctime_r)
#define R_GMTIME_INIT_R() \
struct tm r_gmtime_r
#define R_GMTIME_R(time) \
gmtime_r(time,&r_gmtime_r)
#define R_LOCALTIME_INIT_R() \
struct tm r_localtime_r
#define R_LOCALTIME_R(val) \
localtime_r(val,&r_localtime_r)
/***********/
/* crypt */
/***********/
#include <crypt.h>
#define R_CRYPT_INIT_R() \
CRYPTD r_cryptd_r; \
bzero(&r_cryptd_r,sizeof(CRYPTD))
#define R_CRYPT_R(pass,salt) \
crypt_r(pass,salt,&r_cryptd_r)
/**************/
/* pw stuff */
/**************/
#define R_MAX_PW_LEN_R 1024
/* The following must be after the last declaration, but */
/* before the first bit of code... */
#define R_GETPWNAM_INIT_R(pw_ptr) \
struct passwd r_getpwnam_pw_r; \
char r_getpwnam_line_r[R_MAX_PW_LEN_R]; \
pw_ptr = &r_getpwnam_pw_r
#define R_GETPWNAM_R(name) \
getpwnam_r(name,&r_getpwnam_pw_r,r_getpwnam_line_r,R_MAX_PW_LEN_R)
/*******************/
/* gethost stuff */
/*******************/
#define R_GETHOSTBYADDR_INIT_R() \
struct hostent r_gethostbyaddr_r; \
struct hostent_data r_gethostbyaddr_data_r
#define R_GETHOSTBYADDR_R(addr,len,type,xptr_ent) \
bzero(&r_gethostbyaddr_r,sizeof(struct hostent)); \
bzero(&r_gethostbyaddr_data_r,sizeof(struct hostent_data)); \
xptr_ent = &r_gethostbyaddr_r; \
if (gethostbyaddr_r(addr,len,type, \
&r_gethostbyaddr_r,&r_gethostbyaddr_data_r) == -1) { \
xptr_ent = NULL; \
}
#define R_GETHOSTBYNAME_INIT_R() \
struct hostent r_gethostbyname_r; \
struct hostent_data r_gethostbyname_data_r
#define R_GETHOSTBYNAME_R(name,xptr_ent) \
bzero(&r_gethostbyname_r,sizeof(struct hostent)); \
bzero(&r_gethostbyname_data_r,sizeof(struct hostent_data)); \
xptr_ent = &r_gethostbyname_r; \
if (gethostbyname_r(name, \
&r_gethostbyname_r,&r_gethostbyname_data_r) == -1) { \
xptr_ent = NULL; \
}
#endif /* _LIBC_R_H */

View File

@ -0,0 +1,40 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# Module description file
#
# A module is also called a component or a subsystem.
MOD_NAME = nspr20
MOD_VERSION = 4

46
directory/c-sdk/config/nfspwd Executable file
View File

@ -0,0 +1,46 @@
#! perl
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
require "fastcwd.pl";
$_ = &fastcwd;
if (m@^/[uh]/@o || s@^/tmp_mnt/@/@o) {
print("$_\n");
} elsif ((($user, $rest) = m@^/usr/people/(\w+)/(.*)@o)
&& readlink("/u/$user") eq "/usr/people/$user") {
print("/u/$user/$rest\n");
} else {
chop($host = `hostname`);
print("/h/$host$_\n");
}

View File

@ -0,0 +1,46 @@
#! perl
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
require "fastcwd.pl";
$_ = &fastcwd;
if (m@^/[uh]/@o || s@^/tmp_mnt/@/@o) {
print("$_\n");
} elsif ((($user, $rest) = m@^/usr/people/(\w+)/(.*)@o)
&& readlink("/u/$user") eq "/usr/people/$user") {
print("/u/$user/$rest\n");
} else {
chop($host = `hostname`);
print("/h/$host$_\n");
}

View File

@ -0,0 +1,129 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-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.
*/
#include <stdio.h>
#include <stdlib.h>
#if defined(VMS)
#include <sys/timeb.h>
#elif defined(XP_UNIX) || defined(XP_OS2_EMX) || defined(XP_BEOS)
#include <sys/time.h>
#elif defined(WIN32) || defined(XP_OS2_VACPP)
#include <sys/timeb.h>
#else
#error "Architecture not supported"
#endif
int main(int argc, char **argv)
{
#if defined(OMIT_LIB_BUILD_TIME)
/*
* Some platforms don't have any 64-bit integer type
* such as 'long long'. Because we can't use NSPR's
* PR_snprintf in this program, it is difficult to
* print a static initializer for PRInt64 (a struct).
* So we print nothing. The makefiles that build the
* shared libraries will detect the empty output string
* of this program and omit the library build time
* in PRVersionDescription.
*/
#elif defined(VMS)
long long now;
struct timeb b;
ftime(&b);
now = b.time;
now *= 1000000;
now += (1000 * b.millitm);
fprintf(stdout, "%Ld", now);
#elif defined(XP_UNIX) || defined(XP_OS2_EMX) || defined(XP_BEOS)
long long now;
struct timeval tv;
#ifdef HAVE_SVID_GETTOD
gettimeofday(&tv);
#else
gettimeofday(&tv, NULL);
#endif
now = ((1000000LL) * tv.tv_sec) + (long long)tv.tv_usec;
#if defined(OSF1)
fprintf(stdout, "%ld", now);
#elif defined(BEOS) && defined(__POWERPC__)
fprintf(stdout, "%Ld", now); /* Metroworks on BeOS PPC */
#else
fprintf(stdout, "%lld", now);
#endif
#elif defined(WIN32)
__int64 now;
struct timeb b;
ftime(&b);
now = b.time;
now *= 1000000;
now += (1000 * b.millitm);
fprintf(stdout, "%I64d", now);
#elif defined(XP_OS2_VACPP)
/* no long long or i64 so we use a string */
#include <string.h>
char buf[24];
char tbuf[7];
time_t now;
long mtime;
int i;
struct timeb b;
ftime(&b);
now = b.time;
_ltoa(now, buf, 10);
mtime = b.millitm * 1000;
if (mtime == 0){
++now;
strcat(buf, "000000");
} else {
_ltoa(mtime, tbuf, 10);
for (i = strlen(tbuf); i < 6; ++i)
strcat(buf, "0");
strcat(buf, tbuf);
}
fprintf(stdout, "%s", buf);
#else
#error "Architecture not supported"
#endif
return 0;
} /* main */
/* now.c */

View File

@ -0,0 +1,592 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-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.
*/
/*
** Netscape portable install command.
**
** Brendan Eich, 7/20/95
*/
#include <stdio.h> /* OSF/1 requires this before grp.h, so put it first */
#include <assert.h>
#include <fcntl.h>
#include <grp.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <utime.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <stdarg.h>
#ifdef USE_REENTRANT_LIBC
#include "libc_r.h"
#endif /* USE_REENTRANT_LIBC */
#include "pathsub.h"
#define HAVE_LCHOWN
#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) \
|| defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) \
|| defined(RHAPSODY) || defined(NEXTSTEP) || defined(QNX) \
|| defined(BEOS) || defined(VMS)
#undef HAVE_LCHOWN
#endif
#define HAVE_FCHMOD
#if defined(BEOS)
#undef HAVE_FCHMOD
#endif
/*
* Does getcwd() take NULL as the first argument and malloc
* the result buffer?
*/
#if !defined(RHAPSODY) && !defined(NEXTSTEP) && !defined(VMS)
#define GETCWD_CAN_MALLOC
#endif
#ifdef NEXTSTEP
#include <bsd/libc.h>
/*
** balazs.pataki@sztaki.hu: The getcwd is broken in NEXTSTEP (returns 0),
** when called on a mounted fs. Did anyone notice this? Here's an ugly
** workaround ...
*/
#define getcwd(b,s) my_getcwd(b,s)
static char *
my_getcwd (char *buf, size_t size)
{
FILE *pwd = popen("pwd", "r");
char *result = fgets(buf, size, pwd);
if (result) {
buf[strlen(buf)-1] = '\0';
}
pclose (pwd);
return buf;
}
#endif /* NEXTSTEP */
#ifdef LINUX
#include <getopt.h>
#endif
#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined(NCR) || defined(NEC) || defined(NEXTSTEP)
#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
#endif
#endif
#if defined(SNI)
extern int fchmod(int fildes, mode_t mode);
#endif
#ifdef QNX
#define d_ino d_stat.st_ino
#endif
static void
usage(void)
{
fprintf(stderr,
"usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
" %*s [-DdltR] file [file ...] directory\n",
program, (int)strlen(program), "");
exit(2);
}
static int
mkdirs(char *path, mode_t mode)
{
char *cp;
struct stat sb;
int res;
while (*path == '/' && path[1] == '/')
path++;
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
*cp = '\0';
if (cp && cp != path) {
*cp = '\0';
if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
mkdirs(path, mode) < 0) {
return -1;
}
*cp = '/';
}
res = mkdir(path, mode);
if ((res != 0) && (errno == EEXIST))
return 0;
else
return res;
}
static uid_t
touid(char *owner)
{
struct passwd *pw;
uid_t uid;
char *cp;
pw = getpwnam(owner);
if (pw)
return pw->pw_uid;
uid = strtol(owner, &cp, 0);
if (uid == 0 && cp == owner)
fail("cannot find uid for %s", owner);
return uid;
}
static gid_t
togid(char *group)
{
struct group *gr;
gid_t gid;
char *cp;
gr = getgrnam(group);
if (gr)
return gr->gr_gid;
gid = strtol(group, &cp, 0);
if (gid == 0 && cp == group)
fail("cannot find gid for %s", group);
return gid;
}
int
main(int argc, char **argv)
{
int onlydir, dodir, dolink, dorelsymlink, dotimes, opt, len, lplen, tdlen, bnlen, exists, fromfd, tofd, cc, wc;
mode_t mode = 0755;
char *linkprefix, *owner, *group, *cp, *cwd, *todir, *toname, *name, *base, *linkname, *bp, buf[BUFSIZ];
uid_t uid;
gid_t gid;
struct stat sb, tosb;
struct utimbuf utb;
program = argv[0];
cwd = linkname = linkprefix = owner = group = 0;
onlydir = dodir = dolink = dorelsymlink = dotimes = lplen = 0;
while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) {
switch (opt) {
case 'C':
cwd = optarg;
break;
case 'D':
onlydir = 1;
break;
case 'd':
dodir = 1;
break;
case 'l':
dolink = 1;
break;
case 'L':
linkprefix = optarg;
lplen = strlen(linkprefix);
dolink = 1;
break;
case 'R':
dolink = dorelsymlink = 1;
break;
case 'm':
mode = strtoul(optarg, &cp, 8);
if (mode == 0 && cp == optarg)
usage();
break;
case 'o':
owner = optarg;
break;
case 'g':
group = optarg;
break;
case 't':
dotimes = 1;
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
if (argc < 2 - onlydir)
usage();
todir = argv[argc-1];
if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
mkdirs(todir, 0777) < 0) {
fail("cannot make directory %s", todir);
}
if (onlydir)
return 0;
if (!cwd) {
#ifdef GETCWD_CAN_MALLOC
cwd = getcwd(0, PATH_MAX);
#else
cwd = malloc(PATH_MAX + 1);
cwd = getcwd(cwd, PATH_MAX);
#endif
}
xchdir(todir);
#ifdef GETCWD_CAN_MALLOC
todir = getcwd(0, PATH_MAX);
#else
todir = malloc(PATH_MAX + 1);
todir = getcwd(todir, PATH_MAX);
#endif
tdlen = strlen(todir);
xchdir(cwd);
tdlen = strlen(todir);
uid = owner ? touid(owner) : -1;
gid = group ? togid(group) : -1;
while (--argc > 0) {
name = *argv++;
len = strlen(name);
base = xbasename(name);
bnlen = strlen(base);
toname = (char*)xmalloc(tdlen + 1 + bnlen + 1);
sprintf(toname, "%s/%s", todir, base);
exists = (lstat(toname, &tosb) == 0);
if (dodir) {
/* -d means create a directory, always */
if (exists && !S_ISDIR(tosb.st_mode)) {
(void) unlink(toname);
exists = 0;
}
if (!exists && mkdir(toname, mode) < 0)
fail("cannot make directory %s", toname);
if ((owner || group) && chown(toname, uid, gid) < 0)
fail("cannot change owner of %s", toname);
} else if (dolink) {
if (*name == '/') {
/* source is absolute pathname, link to it directly */
linkname = 0;
} else {
if (linkprefix) {
/* -L implies -l and prefixes names with a $cwd arg. */
len += lplen + 1;
linkname = (char*)xmalloc(len + 1);
sprintf(linkname, "%s/%s", linkprefix, name);
} else if (dorelsymlink) {
/* Symlink the relative path from todir to source name. */
linkname = (char*)xmalloc(PATH_MAX);
if (*todir == '/') {
/* todir is absolute: skip over common prefix. */
lplen = relatepaths(todir, cwd, linkname);
strcpy(linkname + lplen, name);
} else {
/* todir is named by a relative path: reverse it. */
reversepath(todir, name, len, linkname);
xchdir(cwd);
}
len = strlen(linkname);
}
name = linkname;
}
/* Check for a pre-existing symlink with identical content. */
if (exists &&
(!S_ISLNK(tosb.st_mode) ||
readlink(toname, buf, sizeof buf) != len ||
strncmp(buf, name, len) != 0)) {
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
exists = 0;
}
if (!exists && symlink(name, toname) < 0)
fail("cannot make symbolic link %s", toname);
#ifdef HAVE_LCHOWN
if ((owner || group) && lchown(toname, uid, gid) < 0)
fail("cannot change owner of %s", toname);
#endif
if (linkname) {
free(linkname);
linkname = 0;
}
} else {
/* Copy from name to toname, which might be the same file. */
fromfd = open(name, O_RDONLY);
if (fromfd < 0 || fstat(fromfd, &sb) < 0)
fail("cannot access %s", name);
if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0))
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
if (tofd < 0)
fail("cannot create %s", toname);
bp = buf;
while ((cc = read(fromfd, bp, sizeof buf)) > 0) {
while ((wc = write(tofd, bp, cc)) > 0) {
if ((cc -= wc) == 0)
break;
bp += wc;
}
if (wc < 0)
fail("cannot write to %s", toname);
}
if (cc < 0)
fail("cannot read from %s", name);
if (ftruncate(tofd, sb.st_size) < 0)
fail("cannot truncate %s", toname);
if (dotimes) {
utb.actime = sb.st_atime;
utb.modtime = sb.st_mtime;
if (utime(toname, &utb) < 0)
fail("cannot set times of %s", toname);
}
#ifdef HAVE_FCHMOD
if (fchmod(tofd, mode) < 0)
#else
if (chmod(toname, mode) < 0)
#endif
fail("cannot change mode of %s", toname);
if ((owner || group) && fchown(tofd, uid, gid) < 0)
fail("cannot change owner of %s", toname);
/* Must check for delayed (NFS) write errors on close. */
if (close(tofd) < 0)
fail("cannot write to %s", toname);
close(fromfd);
}
free(toname);
}
free(cwd);
free(todir);
return 0;
}
/*
** Pathname subroutines.
**
** Brendan Eich, 8/29/95
*/
char *program;
void
fail(char *format, ...)
{
int error;
va_list ap;
#ifdef USE_REENTRANT_LIBC
R_STRERROR_INIT_R();
#endif
error = errno;
fprintf(stderr, "%s: ", program);
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
if (error)
#ifdef USE_REENTRANT_LIBC
R_STRERROR_R(errno);
fprintf(stderr, ": %s", r_strerror_r);
#else
fprintf(stderr, ": %s", strerror(errno));
#endif
putc('\n', stderr);
exit(1);
}
char *
getcomponent(char *path, char *name)
{
if (*path == '\0')
return 0;
if (*path == '/') {
*name++ = '/';
} else {
do {
*name++ = *path++;
} while (*path != '/' && *path != '\0');
}
*name = '\0';
while (*path == '/')
path++;
return path;
}
#ifdef UNIXWARE_READDIR_BUFFER_TOO_SMALL
/* Sigh. The static buffer in Unixware's readdir is too small. */
struct dirent * readdir(DIR *d)
{
static struct dirent *buf = NULL;
#define MAX_PATH_LEN 1024
if(buf == NULL)
buf = (struct dirent *) malloc(sizeof(struct dirent) + MAX_PATH_LEN)
;
return(readdir_r(d, buf));
}
#endif
char *
ino2name(ino_t ino, char *dir)
{
DIR *dp;
struct dirent *ep;
char *name;
dp = opendir("..");
if (!dp)
fail("cannot read parent directory");
for (;;) {
if (!(ep = readdir(dp)))
fail("cannot find current directory");
if (ep->d_ino == ino)
break;
}
name = xstrdup(ep->d_name);
closedir(dp);
return name;
}
void *
xmalloc(size_t size)
{
void *p = malloc(size);
if (!p)
fail("cannot allocate %u bytes", size);
return p;
}
char *
xstrdup(char *s)
{
return strcpy((char*)xmalloc(strlen(s) + 1), s);
}
char *
xbasename(char *path)
{
char *cp;
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
*cp = '\0';
if (!cp) return path;
return cp + 1;
}
void
xchdir(char *dir)
{
if (chdir(dir) < 0)
fail("cannot change directory to %s", dir);
}
int
relatepaths(char *from, char *to, char *outpath)
{
char *cp, *cp2;
int len;
char buf[NAME_MAX];
assert(*from == '/' && *to == '/');
for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++)
if (*cp == '\0')
break;
while (cp[-1] != '/')
cp--, cp2--;
if (cp - 1 == to) {
/* closest common ancestor is /, so use full pathname */
len = strlen(strcpy(outpath, to));
if (outpath[len] != '/') {
outpath[len++] = '/';
outpath[len] = '\0';
}
} else {
len = 0;
while ((cp2 = getcomponent(cp2, buf)) != 0) {
strcpy(outpath + len, "../");
len += 3;
}
while ((cp = getcomponent(cp, buf)) != 0) {
sprintf(outpath + len, "%s/", buf);
len += strlen(outpath + len);
}
}
return len;
}
void
reversepath(char *inpath, char *name, int len, char *outpath)
{
char *cp, *cp2;
char buf[NAME_MAX];
struct stat sb;
cp = strcpy(outpath + PATH_MAX - (len + 1), name);
cp2 = inpath;
while ((cp2 = getcomponent(cp2, buf)) != 0) {
if (strcmp(buf, ".") == 0)
continue;
if (strcmp(buf, "..") == 0) {
if (stat(".", &sb) < 0)
fail("cannot stat current directory");
name = ino2name(sb.st_ino, "..");
len = strlen(name);
cp -= len + 1;
strcpy(cp, name);
cp[len] = '/';
free(name);
xchdir("..");
} else {
cp -= 3;
strncpy(cp, "../", 3);
xchdir(buf);
}
}
strcpy(outpath, cp);
}

View File

@ -0,0 +1,38 @@
#
# 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 mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
# Include in Makefiles to define NSPR variables
NSPR_VERSION = @NSPR_VERSION@
NSPR_LIB = -lnspr@NSPR_VERSION@
NSPR_EXTRA_LIBS = @EXTRA_LIBS@

View File

@ -0,0 +1,38 @@
#
# 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 mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
# Include in shell scripts to define NSPR variables
NSPR_VERSION=@NSPR_VERSION@
NSPR_LIB=-lnspr$NSPR_VERSION
NSPR_EXTRA_LIBS="@EXTRA_LIBS@"

View File

@ -0,0 +1,75 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-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.
*/
#ifndef pathsub_h___
#define pathsub_h___
/*
** Pathname subroutines.
**
** Brendan Eich, 8/29/95
*/
#include <limits.h>
#include <sys/types.h>
#if SUNOS4
#include "../pr/include/md/sunos4.h"
#endif
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
/*
* Just prevent stupidity
*/
#undef NAME_MAX
#define NAME_MAX 256
extern char *program;
extern void fail(char *format, ...);
extern char *getcomponent(char *path, char *name);
extern char *ino2name(ino_t ino, char *dir);
extern void *xmalloc(size_t size);
extern char *xstrdup(char *s);
extern char *xbasename(char *path);
extern void xchdir(char *dir);
/* Relate absolute pathnames from and to returning the result in outpath. */
extern int relatepaths(char *from, char *to, char *outpath);
/* XXX changes current working directory -- caveat emptor */
extern void reversepath(char *inpath, char *name, int len, char *outpath);
#endif /* pathsub_h___ */

View File

@ -0,0 +1,42 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 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.
*/
/*
* A dummy header file that is a dependency for all the object files.
* Used to force a full recompilation of NSPR in Mozilla's Tinderbox
* depend builds. See comments in rules.mk.
*/
#error "Do not include this header file."

View File

@ -0,0 +1,18 @@
REM
REM The contents of this file are subject to the Netscape Public License
REM Version 1.1 (the "NPL"); you may not use this file except in
REM compliance with the NPL. You may obtain a copy of the NPL at
REM http://www.mozilla.org/NPL/
REM
REM Software distributed under the NPL is distributed on an "AS IS" basis,
REM WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
REM for the specific language governing rights and limitations under the
REM NPL.
REM
REM The Initial Developer of this code under the NPL is Netscape
REM Communications Corporation. Portions created by Netscape are
REM Copyright (C) 1998 Netscape Communications Corporation. All Rights
REM Reserved.
REM
mkdir %1

View File

@ -0,0 +1,480 @@
#! 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
################################################################################
# We have a 4 pass build process:
#
# Pass 1. export - Create generated headers and stubs. Publish public headers to
# dist/<arch>/include.
#
# Pass 2. libs - Create libraries. Publish libraries to dist/<arch>/lib.
#
# Pass 3. all - Create programs.
#
# Pass 4. install - Publish programs to dist/<arch>/bin.
#
# Parameters to this makefile (set these before including):
#
# a)
# TARGETS -- the target to create
# (defaults to $LIBRARY $PROGRAM)
# b)
# DIRS -- subdirectories for make to recurse on
# (the 'all' rule builds $TARGETS $DIRS)
# c)
# CSRCS -- .c files to compile
# (used to define $OBJS)
# d)
# PROGRAM -- the target program name to create from $OBJS
# ($OBJDIR automatically prepended to it)
# e)
# LIBRARY -- the target library name to create from $OBJS
# ($OBJDIR automatically prepended to it)
#
################################################################################
ifndef topsrcdir
topsrcdir=$(MOD_DEPTH)
endif
ifndef srcdir
srcdir=.
endif
ifndef NSPR_CONFIG_MK
include $(topsrcdir)/config/config.mk
endif
ifdef USE_AUTOCONF
ifdef CROSS_COMPILE
ifdef INTERNAL_TOOLS
CC=$(HOST_CC)
CCC=$(HOST_CXX)
CFLAGS=$(HOST_CFLAGS)
CXXFLAGS=$(HOST_CXXFLAGS)
endif
endif
endif
#
# This makefile contains rules for building the following kinds of
# libraries:
# - LIBRARY: a static (archival) library
# - SHARED_LIBRARY: a shared (dynamic link) library
# - IMPORT_LIBRARY: an import library, used only on Windows and OS/2
#
# The names of these libraries can be generated by simply specifying
# LIBRARY_NAME and LIBRARY_VERSION.
#
ifdef LIBRARY_NAME
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
#
# Win95, Win16, and OS/2 require library names conforming to the 8.3 rule.
# other platforms do not.
#
ifeq (,$(filter-out WIN95 WIN16 OS2,$(OS_TARGET)))
LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
else
LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
endif
else
LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_shr.a
else
ifdef MKSHLIB
SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
endif
endif
endif
endif
ifndef TARGETS
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
else
TARGETS = $(LIBRARY) $(SHARED_LIBRARY)
endif
endif
#
# OBJS is the list of object files. It can be constructed by
# specifying CSRCS (list of C source files) and ASFILES (list
# of assembly language source files).
#
ifndef OBJS
OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \
$(addprefix $(OBJDIR)/,$(ASFILES:.s=.$(OBJ_SUFFIX)))
endif
ifeq ($(OS_TARGET), WIN16)
comma := ,
empty :=
space := $(empty) $(empty)
W16OBJS = $(subst $(space),$(comma)$(space),$(strip $(OBJS)))
W16TEMP =$(OS_LIBS) $(EXTRA_LIBS)
ifeq ($(strip $(W16TEMP)),)
W16LIBS =
else
W16LIBS = library $(subst $(space),$(comma)$(space),$(strip $(W16TEMP)))
endif
W16DEF = $(notdir $(basename $(SHARED_LIBRARY))).DEF
endif
ifeq ($(OS_ARCH), WINNT)
ifneq ($(OS_TARGET), WIN16)
OBJS += $(RES)
endif
endif
ALL_TRASH = $(TARGETS) $(OBJS) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \
$(NOSUCHFILE) \
so_locations
ifdef DIRS
LOOP_OVER_DIRS = \
@for d in $(DIRS); do \
if test -d $$d; then \
set -e; \
echo "cd $$d; $(MAKE) $@"; \
$(MAKE) -C $$d $@; \
set +e; \
else \
echo "Skipping non-directory $$d..."; \
fi; \
done
endif
################################################################################
all:: export libs install
export::
+$(LOOP_OVER_DIRS)
libs::
+$(LOOP_OVER_DIRS)
install::
+$(LOOP_OVER_DIRS)
clean::
rm -rf $(OBJS) so_locations $(NOSUCHFILE) $(GARBAGE)
+$(LOOP_OVER_DIRS)
clobber::
rm -rf $(OBJS) $(TARGETS) $(filter-out . ..,$(OBJDIR)) $(GARBAGE) so_locations $(NOSUCHFILE)
+$(LOOP_OVER_DIRS)
realclean clobber_all::
rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH)
+$(LOOP_OVER_DIRS)
distclean::
rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) $(DIST_GARBAGE)
+$(LOOP_OVER_DIRS)
release:: export
ifdef RELEASE_BINS
@echo "Copying executable programs and scripts to release directory"
@if test -z "$(BUILD_NUMBER)"; then \
echo "BUILD_NUMBER must be defined"; \
false; \
else \
true; \
fi
@if test ! -d $(RELEASE_BIN_DIR); then \
rm -rf $(RELEASE_BIN_DIR); \
$(NSINSTALL) -D $(RELEASE_BIN_DIR);\
else \
true; \
fi
cp $(RELEASE_BINS) $(RELEASE_BIN_DIR)
endif
ifdef RELEASE_LIBS
@echo "Copying libraries to release directory"
@if test -z "$(BUILD_NUMBER)"; then \
echo "BUILD_NUMBER must be defined"; \
false; \
else \
true; \
fi
@if test ! -d $(RELEASE_LIB_DIR); then \
rm -rf $(RELEASE_LIB_DIR); \
$(NSINSTALL) -D $(RELEASE_LIB_DIR);\
else \
true; \
fi
cp $(RELEASE_LIBS) $(RELEASE_LIB_DIR)
endif
ifdef RELEASE_HEADERS
@echo "Copying header files to release directory"
@if test -z "$(BUILD_NUMBER)"; then \
echo "BUILD_NUMBER must be defined"; \
false; \
else \
true; \
fi
@if test ! -d $(RELEASE_HEADERS_DEST); then \
rm -rf $(RELEASE_HEADERS_DEST); \
$(NSINSTALL) -D $(RELEASE_HEADERS_DEST);\
else \
true; \
fi
cp $(RELEASE_HEADERS) $(RELEASE_HEADERS_DEST)
endif
+$(LOOP_OVER_DIRS)
alltags:
rm -f TAGS tags
find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a
$(NFSPWD):
cd $(@D); $(MAKE) $(@F)
$(PROGRAM): $(OBJS)
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH),WINNT)
$(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
else
ifeq ($(MOZ_OS2_TOOLS),VACPP)
$(CC) $(OBJS) -Fe$@ $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
else
$(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS)
endif
endif
$(LIBRARY): $(OBJS)
@$(MAKE_OBJDIR)
rm -f $@
ifeq ($(MOZ_OS2_TOOLS),VACPP)
$(AR) $(subst /,\\,$(OBJS)) $(AR_EXTRA_ARGS)
else
ifdef USE_AUTOCONF
$(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
else
$(AR) $(OBJS) $(AR_EXTRA_ARGS)
endif # USE_AUTOCONF
endif
$(RANLIB) $@
ifeq ($(OS_TARGET), WIN16)
$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
wlib $(OS_LIB_FLAGS) $@ +$(SHARED_LIBRARY)
endif
ifeq ($(OS_TARGET), OS2)
$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
$(IMPLIB) $@ $(SHARED_LIBRARY).def
endif
$(SHARED_LIBRARY): $(OBJS)
@$(MAKE_OBJDIR)
rm -f $@
ifdef USE_AUTOCONF
$(MKSHLIB) $(OBJS) $(EXTRA_LIBS) $(OS_LIBS)
else
ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms
nm -B -C -g $(OBJS) \
| awk '/ [T,D] / {print $$3}' \
| sed -e 's/^\.//' \
| sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms
$(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \
-bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS)
else # AIX 4.1
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET), WIN16)
echo system windows dll initinstance >w16link
echo option map >>w16link
echo option oneautodata >>w16link
echo option heapsize=32K >>w16link
echo option $(OS_DLL_OPTION) >>w16link
echo debug $(DEBUGTYPE) all >>w16link
echo name $@ >>w16link
echo file >>w16link
echo $(W16OBJS) >>w16link
echo $(W16IMPORTS) >>w16link
echo $(W16LIBS) >>w16link
echo $(W16_EXPORTS) >>w16link
echo libfile libentry >>w16link
$(LINK) @w16link.
rm w16link
else # WIN16
$(LINK_DLL) -MAP $(DLLBASE) $(OS_LIBS) $(EXTRA_LIBS) $(OBJS)
endif # WINNT
else
ifeq ($(OS_ARCH),OS2)
# append ( >> ) doesn't seem to be working under OS/2 gmake. Run through OS/2 shell instead.
@cmd /C "echo LIBRARY $(notdir $(basename $(SHARED_LIBRARY))) INITINSTANCE TERMINSTANCE >$@.def"
@cmd /C "echo PROTMODE >>$@.def"
@cmd /C "echo CODE LOADONCALL MOVEABLE DISCARDABLE >>$@.def"
@cmd /C "echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >>$@.def"
@cmd /C "echo EXPORTS >>$@.def"
@cmd /C "$(FILTER) $(LIBRARY) | grep -v _DLL_InitTerm >>$@.def"
$(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $@.def
else # OS2
ifeq ($(OS_TARGET), OpenVMS)
@if test ! -f $(OBJDIR)/VMSuni.opt; then \
echo "Creating universal symbol option file $(OBJDIR)/VMSuni.opt";\
create_opt_uni $(OBJS); \
mv VMSuni.opt $(OBJDIR); \
fi
$(MKSHLIB) -o $@ $(OBJS) $(EXTRA_LIBS) $(OS_LIBS) $(OBJDIR)/VMSuni.opt
@echo "`translate $@`" > $(@:.$(DLL_SUFFIX)=.vms)
else # OpenVMS
$(MKSHLIB) -o $@ $(OBJS) $(EXTRA_LIBS) $(OS_LIBS)
endif # OpenVMS
endif # OS2
endif # WINNT
endif # AIX 4.1
endif # USE_AUTOCONF
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
$(RES): $(RESNAME)
@$(MAKE_OBJDIR)
ifeq ($(OS_TARGET),OS2)
$(RC) -DOS2 -r $(RESNAME) $(RES)
else
# The resource compiler does not understand the -U option.
$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$(RES) $(RESNAME)
endif
@echo $(RES) finished
endif
$(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH), WINNT)
$(CCC) -Fo$@ -c $(CCCFLAGS) $<
else
ifeq ($(MOZ_OS2_TOOLS),VACPP)
$(CCC) -Fo$@ -c $(CCCFLAGS) $<
else
$(CCC) -o $@ -c $(CCCFLAGS) $<
endif
endif
WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
$(OBJDIR)/%.$(OBJ_SUFFIX): %.c
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET), WIN16)
# $(MOD_DEPTH)/config/w16opt $(WCCFLAGS3)
echo $(WCCFLAGS3) >w16wccf
$(CC) -zq -fo$(OBJDIR)\\$*.$(OBJ_SUFFIX) @w16wccf $*.c
rm w16wccf
else
$(CC) -Fo$@ -c $(CFLAGS) $<
endif
else
ifeq ($(MOZ_OS2_TOOLS),VACPP)
$(CC) -Fo$@ -c $(CFLAGS) $<
else
$(CC) -o $@ -c $(CFLAGS) $<
endif
endif
$(OBJDIR)/%.$(OBJ_SUFFIX): %.s
@$(MAKE_OBJDIR)
$(AS) -o $@ $(ASFLAGS) -c $<
%.i: %.c
$(CC) -C -E $(CFLAGS) $< > $*.i
%: %.pl
rm -f $@; cp $< $@; chmod +x $@
#
# HACK ALERT
#
# The only purpose of this rule is to pass Mozilla's Tinderbox depend
# builds (http://tinderbox.mozilla.org/showbuilds.cgi). Mozilla's
# Tinderbox builds NSPR continuously as part of the Mozilla client.
# Because NSPR's make depend is not implemented, whenever we change
# an NSPR header file, the depend build does not recompile the NSPR
# files that depend on the header.
#
# This rule makes all the objects depend on a dummy header file.
# Touch this dummy header file to force the depend build to recompile
# everything.
#
# This rule should be removed when make depend is implemented.
#
DUMMY_DEPEND_H = $(topsrcdir)/config/prdepend.h
$(filter $(OBJDIR)/%.$(OBJ_SUFFIX),$(OBJS)): $(OBJDIR)/%.$(OBJ_SUFFIX): $(DUMMY_DEPEND_H)
# END OF HACK
################################################################################
# Special gmake rules.
################################################################################
#
# Re-define the list of default suffixes, so gmake won't have to churn through
# hundreds of built-in suffix rules for stuff we don't need.
#
.SUFFIXES:
.SUFFIXES: .a .$(OBJ_SUFFIX) .c .cpp .s .h .i .pl
#
# Fake targets. Always run these rules, even if a file/directory with that
# name already exists.
#
.PHONY: all alltags clean export install libs realclean release
#
# List the target pattern of an implicit rule as a dependency of the
# special target .PRECIOUS to preserve intermediate files made by
# implicit rules whose target patterns match that file's name.
# (See GNU Make documentation, Edition 0.51, May 1996, Sec. 10.4,
# p. 107.)
#
.PRECIOUS: $(OBJDIR)/%.$(OBJ_SUFFIX)

View File

@ -0,0 +1,115 @@
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# win16_3.11.mk -- Make configuration for Win16
#
# This file configures gmake to build the Win16 variant of
# NSPR 2.0. This file has the function of two files commonly
# used on other platforms, for example: winnt.mk and
# winnt4.0.mk. ... The packaging is easier and there is only
# one variant of the Win16 target.
#
# Win16 is built using the Watcom C/C++ version 11.0
# compiler. You gotta set up the compiler first. Follow the
# directions in the manual (Ha! ... really, its not a
# problem). The Watcom compiler depends on a few environment
# variables; these environment variables define where the
# compiler components are installed; they must be set before
# running the make.
#
# Notes:
# OS_CFLAGS is the command line options for the compiler when
# building the .DLL object files.
# OS_EXE_CFLAGS is the command line options for the compiler
# when building the .EXE object files; this is for the test
# programs.
# the macro OS_CFLAGS is set to OS_EXE_CFLAGS inside of the
# makefile for the pr/tests directory. ... Hack.
#
# USE_WATCOM_DEBUG_DATA environment variable causes the
# watcom compiler flag to be set to -hw (otherwise
# it is set to -hc (codeview debug data)) for debug builds.
#
# -- configuration -----------------------------------------
CC = wcc
CCC = wcl
LINK = wlink
AR = wlib -q $@
RC = wrc.exe /r /dWIN16=1 /bt=windows
RANLIB = echo
BSDECHO = echo
NSINSTALL = nsinstall
INSTALL = $(NSINSTALL)
MAKE_OBJDIR = mkdir $(OBJDIR)
XP_DEFINE = -DXP_PC
OBJ_SUFFIX = obj
LIB_SUFFIX = lib
DLL_SUFFIX = dll
ifdef BUILD_OPT
OBJDIR_TAG = _O
OPTIMIZER = -oneatx -oh -oi -ei -3 -fpi87 -fp3 -s
else
ifdef USE_WATCOM_DEBUG_DATA
OPTIMIZER = -d2 -hw -s -DDEBUG
DEBUGTYPE = watcom
else
OPTIMIZER = -d2 -hc -s -DDEBUG
DEBUGTYPE = codeview
endif
OBJDIR_TAG = _D
endif
# XXX FIXME: I doubt we use this. It is redundant with
# SHARED_LIBRARY.
ifdef DLL
DLL := $(addprefix $(OBJDIR)/, $(DLL))
endif
CPU_ARCH = x86
OS_CFLAGS = -ml -3 -bd -zc -zu -bt=windows -d_X86_ -dWIN16 -d_WINDLL
OS_EXE_CFLAGS = -ml -3 -bt=windows -d_X86_ -dWIN16
OS_LIB_FLAGS = -c -iro -n
# Name of the binary code directories
OBJDIR_NAME = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
OS_DLL_OPTION = CASEEXACT
OS_DLLFLAGS =
OS_LIBS =
W16_EXPORTS = #

View File

@ -1,8 +1,37 @@
NS_DEPTH = ../..
#
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
NSPR_TREE = ..
MOD_DEPTH = ..
include $(NSPR_TREE)/config/rules.mk
include ../build.mk
SRCDIRS = build include libraries
include $(NS_DEPTH)/config/rules.mk
ifeq ($(BUILDCLU), 1)
SRCDIRS += clients/tools
endif
all export:: FORCE
@for i in $(SRCDIRS); do \
@ -21,6 +50,7 @@ clean clobber:: FORCE
echo "cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) clean"; \
( cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) clean ); \
done
cd clients/tools; $(MAKE) -f Makefile.client $(MFLAGS) clean
realclean clobber_all:: FORCE
@for i in $(SRCDIRS); do \

View File

@ -0,0 +1,68 @@
#
# 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 mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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 = ../../..
srcdir = @srcdir@
ldaptopsrcdir = @top_srcdir@
SRCDIRS = build include libraries
include build/autoconf.mk
include $(NSPR_TREE)/config/rules.mk
all export:: FORCE
@for i in $(SRCDIRS); do \
echo " cd $$i; $(MAKE) $(MFLAGS) export"; \
( cd $$i; $(MAKE) $(MFLAGS) export ); \
done
libs install:: FORCE
@for i in $(SRCDIRS); do \
echo "cd $$i; $(MAKE) $(MFLAGS) install"; \
( cd $$i; $(MAKE) $(MFLAGS) install ); \
done
clean clobber:: FORCE
@for i in $(SRCDIRS); do \
echo "cd $$i; $(MAKE) $(MFLAGS) clean"; \
( cd $$i; $(MAKE) $(MFLAGS) clean ); \
done
realclean clobber_all:: FORCE
@for i in $(SRCDIRS); do \
echo "cd $$i; $(MAKE) $(MFLAGS) realclean"; \
( cd $$i; $(MAKE) $(MFLAGS) realclean ); \
done
FORCE:

View File

@ -0,0 +1,31 @@
The autoconf files here are the barest shim to allow the LDAP C SDK to
build with autoconf, including in a --objdir. These are really just a
wrapper around the existing (NSPR-based) build-system; they propagate
very little information from the autconf command line or environment.
The Makefile.in files are all just slightly edited forks of the
Makefile.client files. These files are:
Makefile.in
configure
configure.in
build/Makefile.in
build/autoconf.mk.in
build/my_overrides.mk
include/Makefile.in
libraries/Makefile.in
libraries/liblber/Makefile.in
libraries/libldap/Makefile.in
Note that as in the main browser tree, I've checked in the (generated)
configure script so that autoconf isn't a prerequisite to build.
At some point after the most current LDAP SDK code lands in Mozilla,
then perhaps it will be worth spending some time creating a more
correctly autoconfified build process that isn't just a shim and
doesn't depend on NSPR.
Comments to <news://news.mozilla.org/netscape.public.mozilla.directory>,
please.
Dan Mosedale
<dmose@mozilla.org>

View File

@ -1,13 +1,44 @@
NS_DEPTH = ../../..
#
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../../..
MOD_DEPTH = ../..
NSPR_TREE = ../..
CSRCS = dirver.c
include $(NS_DEPTH)/config/rules.mk
include $(NSPR_TREE)/config/rules.mk
include ../../build.mk
TARGETS = $(OBJDIR)/dirver$(BIN_SUFFIX)
TARGETS = $(OBJDIR)/dirver$(EXE_SUFFIX)
GARBAGE += $(TARGETS)
ifeq ($(OS_ARCH), WINNT)
$(OBJS) = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.o))
$(TARGETS): $(OBJS)
@$(MAKE_OBJDIR)
$(LINK_EXE)
endif
ifeq ($(OS_ARCH), OS2)
$(OBJS) = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.o))
@ -17,7 +48,10 @@ $(TARGETS): $(OBJS)
endif
export:: $(TARGETS)
$(INSTALL) -m 555 $(TARGETS) $(DIST)/bin
$(INSTALL) -m 555 $(TARGETS) ../$(DIST)/bin
install:: export
clean::
rm -rf $(OBJDIR_NAME)

View File

@ -0,0 +1,62 @@
#
# 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 mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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 = ../../../..
srcdir = @srcdir@
ldaptopsrcdir = @top_srcdir@
CSRCS = dirver.c
include autoconf.mk
include $(NSPR_TREE)/config/rules.mk
TARGETS = $(OBJDIR)/dirver$(BIN_SUFFIX)
GARBAGE += $(TARGETS)
ifeq ($(OS_ARCH), OS2)
$(OBJS) = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.o))
$(TARGETS): $(OBJS)
@$(MAKE_OBJDIR)
$(LINK_EXE) -OUT:$@ $(OBJS)
endif
export:: $(TARGETS)
$(INSTALL) -m 555 $(TARGETS) $(DIST)/bin
install:: export
clean::
rm -rf $(OBJDIR_NAME)

View File

@ -0,0 +1,57 @@
#
# 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 mozilla.org LDAP SDK autoconf glue.
#
# The Initial Developer of the Original Code is Netscape
# Commmunications Corp. Portions created by Netscape are
# Copyright (C) 2000, Netscape Communications Corp. All
# Rights Reserved.
#
# Contributor(s): Dan Mosedale <dmose@mozilla.org>
#
# this is used to override DIST and VPATH
#
NSPR_MY_OVERRIDES_MK = $(ldaptopsrcdir)/build/my_overrides.mk
# common to all the ldap sdk makefiles
#
NSPR_TREE = $(ldaptopsrcdir)/../../../nsprpub
topsrcdir = $(ldaptopsrcdir)/../../../nsprpub
# various stuff from the ldap sdk documentation
#
MOZILLA_CLIENT = 1
NO_MDUPDATE = 1
MOZ_LDAP_SDK = 1
MOZ_LI =
MOZ_LITE =
MOZ_MEDIUM =
NO_SECURITY =
# we have to cope if nspr was built using autoconf (which we only know is
# is true if our configure was passed --enable-nspr-autoconf -- which
# the top-level configure does automagically, as appropriate).
#
NSPR_USE_AUTOCONF = @NSPR_USE_AUTOCONF@
ifeq ($(NSPR_USE_AUTOCONF), 1)
MOD_DEPTH = $(DEPTH)
include $(DEPTH)/nsprpub/config/autoconf.mk
VPATH = $(srcdir)
DIST = $(DEPTH)/dist
else
MOD_DEPTH = $(NSPR_TREE)
endif

View File

@ -0,0 +1,91 @@
#!/bin/sh
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
# compver.sh - a script to check if the correct component version is
# available. If it is not available, it uses the nsftp.sh script to
# download the component version. The component release is assumed
# to be under /share/builds/components on a UNIX box.
#
COMP_ROOT=$1
COMP_VERSION=$2
COMP_VERSION_FILE=${COMP_ROOT}/Version
COMPOBJDIR=$3
MCOM_ROOT=$4
MODULE=$5 # Module which needs this component
COMP_RELEASE=$6 # Component release dir
COMP_NAME=$7 # component name (e.g. ldapsdk, rouge)
COMP_SUBDIRS=$8 # subdirs to ftp over
TEST_FILE=$9 # to test if ftp was successful
if test -r ${COMP_VERSION_FILE}; then \
CUR_VERSION=`cat ${COMP_VERSION_FILE}`; \
if test "${CUR_VERSION}" = "${COMP_VERSION}"; then \
if test -d ${COMP_ROOT}/${COMPOBJDIR}; then \
exit 0; \
fi; \
fi; \
fi
echo "************************ WARNING *************************"
echo "The MODULE ${MODULE} needs ${COMP_NAME} client libraries."
echo "The ${COMP_NAME} client libraries are missing. "
echo ""
echo "Attempting to download..."
rm -rf ${COMP_ROOT}/${COMPOBJDIR} ${COMP_VERSION_FILE}
mkdir -p ${COMP_ROOT}/${COMPOBJDIR}
sh ../../build/nsftp.sh ${COMP_NAME}/${COMP_VERSION}/${COMPOBJDIR} ${COMP_ROOT}/${COMPOBJDIR}
for d in ${COMP_SUBDIRS}; do \
mkdir -p ${COMP_ROOT}/${COMPOBJDIR}/${d}; \
sh ../../build/nsftp.sh ${COMP_NAME}/${COMP_VERSION}/${COMPOBJDIR}/${d} ${COMP_ROOT}/${COMPOBJDIR}/${d}
done
if test -f ${TEST_FILE}; then \
echo "${COMP_VERSION}" > ${COMP_VERSION_FILE}; \
echo "************************ SUCCESS! ************************"; \
else \
echo ""; \
echo "Attempt to ftp over ${COMP_NAME} failed!!!"; \
echo "Please ftp over (${COMP_SUBDIRS}) subdirectories under:"; \
echo " ${COMP_RELEASE}"; \
echo "and put them under:"; \
echo " ${COMP_ROOT}/${COMPOBJDIR}"; \
echo "Also, execute the following command: "; \
echo " echo \"${COMP_VERSION}\" > ${COMP_VERSION_FILE}"; \
echo "Note: Above directories are w.r.t. the MODULE ${MODULE}"; \
echo "**********************************************************"; \
exit 1; \
fi

View File

@ -1,6 +1,26 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*--------------------------------------------------------------------------
/ Copyright (C) 1996, 1997 Netscape Communications Corporation
/ --------------------------------------------------------------------------
/
/ Name: Netscape File Version Generator
/ Platforms: WIN32
@ -26,6 +46,9 @@
#ifdef _WIN32
#include <windows.h>
#endif
#ifdef macintosh
#include <console.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -48,20 +71,20 @@ static void _GetVersions(char *szVer, unsigned *nMajor, unsigned *nMinor,
unsigned *nPatch)
{
char szVersion[128];
unsigned nReturn = 0;
/* unsigned nReturn = 0; Unused? */
char *szToken;
*nMajor = 0;
*nMinor = 0;
*nPatch = 0;
strcpy(szVersion, szVer);
if(szToken = strtok(szVersion, ".\n"))
if((szToken = strtok(szVersion, ".\n")) != NULL)
{
*nMajor = atoi(szToken);
if(szToken = strtok(NULL, ".\n"))
if((szToken = strtok(NULL, ".\n")) != NULL)
{
*nMinor = atoi(szToken);
if(szToken = strtok(NULL, ".\n"))
if((szToken = strtok(NULL, ".\n")) != NULL)
{
*nPatch = atoi(szToken);
}
@ -75,14 +98,18 @@ unsigned _CalcBuildDate(unsigned nYear, unsigned nMonth, unsigned nDay)
{
unsigned nBuildDate = 0;
if(nYear < 100) /* they really mean 19xx */
if(nYear < 1900) /* they really mean 1900 + nYear */
nYear += 1900;
nYear -= 1980;
nBuildDate = nYear;
/*
nBuildDate <<= 5;
nBuildDate += nMonth;
*/
nBuildDate <<= 4;
nBuildDate += nMonth;
/* nBuildDate <<= 4; */
nBuildDate <<= 5;
nBuildDate += nDay;
nBuildDate &= 0xFFFF;
return(nBuildDate);
@ -101,12 +128,21 @@ unsigned _GenBuildDate(char *szBuildDate)
if((szBuildDate) && (strchr(szBuildDate, '\\') || strchr(szBuildDate, '/')) && (szToken = strtok(szBuildDate, "\\/")))
{
nMonth = atoi(szToken);
if(szToken = strtok(NULL, "\\/"))
nMonth--; /* use months in the range [0..11], as in struct tm */
if((szToken = strtok(NULL, "\\/")) != NULL)
{
nDay = atoi(szToken);
if(szToken = strtok(NULL, "\\/"))
if((szToken = strtok(NULL, "\\/")) != NULL)
{
nYear = atoi(szToken);
if(nYear < 70) { /* handle 2 digit years like (20)00 */
nYear += 100;
}
else if (nYear < 100) {
}
else if (nYear > 1900){
nYear -= 1900;
}
}
}
}
@ -132,7 +168,6 @@ unsigned _GenBuildDate(char *szBuildDate)
static void ShowHelp(char *szFilename)
{
char szTemp[128];
fprintf(stdout, "%s: Generates ascii format #define for FILEVERSION\n", szFilename);
fprintf(stdout, " resource identifier used by Windows executable binaries.\n");
fprintf(stdout, "\n");
@ -146,12 +181,17 @@ static void ShowHelp(char *szFilename)
int
main(int nArgc, char **lpArgv)
{
int nReturn = 0;
unsigned nVersion = 0;
unsigned nBuildDate = 0;
#ifdef macintosh
nArgc = ccommand( &lpArgv );
#endif
if(nArgc < 2)
{
ShowHelp(lpArgv[0]);
@ -174,11 +214,15 @@ main(int nArgc, char **lpArgv)
nVersion = _CalcVersion(nMajor, nMinor, nPatch);
nBuildDate = _GenBuildDate(szDate);
if(nArgc >= 4)
f = fopen(szOutput, "w");
if(nArgc >= 4) {
if (( f = fopen(szOutput, "w")) == NULL ) {
perror( szOutput );
exit( 1 );
}
}
fprintf(f, "#define VI_PRODUCTVERSION %u.%u\n", nMajor, nMinor);
fprintf(f, "#define PRODUCTTEXT \"%u.%u\"\n", nMajor, nMinor);
fprintf(f, "#define PRODUCTTEXT \"%s\"\n", szVersion );
fprintf(f, "#define VI_FILEVERSION %u, 0, 0,%u\n",
nVersion, nBuildDate);
fprintf(f, "#define VI_FileVersion \"%s Build %u\\0\"\n",

View File

@ -0,0 +1,388 @@
#
# 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 mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
#
# genexports.pl: create up-to-date export and .def files
#
# created 31 August 1997 by Mark Smith <mcs@netscape.com>
$type = $ARGV[0];
$tmplfile = $ARGV[1];
$expfile = $ARGV[2];
$buildtype = $ARGV[3];
if ( $type ne "Win16" && $type ne "Win16Rev" && $type ne "Win32" &&
$type ne "WinBC" && $type ne "AIX" && $type ne "IRIX" &&
$type ne "MacOS" && $type ne "SOLARIS" && $type ne "SunOS" )
{
usage();
}
if ( $tmplfile eq "" || $expfile eq "" )
{
usage();
}
if ( $tmplfile ne "Standard" )
{
open( TMPL, $tmplfile );
while(<TMPL>)
{
$line = $_;
&process_line( $type, $expfile, $line, $ARGV[3+1], $ARGV[3+2],
$ARGV[3+3] );
}
}
else
{
if ( substr( $type, 0, 3 ) eq "Win" )
{
&windows_std( $type, $expfile, $ARGV[3+1], $ARGV[3+2], $ARGV[3+3] );
}
elsif ( $type eq "SOLARIS" || $type eq "SunOS" )
{
&solaris_std( $type, $expfile, $ARGV[3+1], $ARGV[3+2], $ARGV[3+3] );
}
else
{
# Simple standard template just includes exports; this works for all others.
&simple_std( $type, $expfile, $ARGV[3+1], $ARGV[3+2], $ARGV[3+3] );
}
}
# process_line( type, expfile, line, arg1, arg2, arg3 )
sub
process_line
{
local( $type, $expfile, $line, $arg1, $arg2, $arg3 ) = @_;
if ( $line eq "\$EXPORTS\n" )
{
&print_exports( $type, $expfile );
}
else
{
$line =~ s/\$1/$arg1/;
$line =~ s/\$2/$arg2/;
$line =~ s/\$3/$arg3/;
print $line;
}
}
# usage()
sub
usage
{
print STDERR "usage: genexports.pl TYPE TMPLFILE|Standard EXPFILE BUILDTYPE [ARG1 [[ARG2] [ARG3]]] > OUTFILE\n";
print STDERR " where TYPE is Win16, Win16Rev, Win32, WinBC, AIX, IRIX, MacOS, or SOLARIS.\n";
print STDERR " and where BUILDTYPE is matched against last field in export file.\n";
exit 1;
}
# print_exports( type, exports-file )
sub
print_exports
{
local( $type, $expfile ) = @_;
$SunOSType = "<SunOS>";
$SunOSType_len = length($SunOSType);
$SolarisType = "<SOLARIS>";
$SolarisType_len = length($SolarisType);
$curType = "<" . $type . ">";
$curType_len = length($curType);
$SASLType = "<SASL>";
$SASLType_len = length($SASLType);
$OS_Version = `uname -r`;
open( EXP, $expfile );
&print_comment( $type, "\n" );
&print_comment( $type, "exports list (generated by genexports.pl)\n" );
&print_comment( $type, "\n" );
while( <EXP> )
{
$line = $_;
if ( substr( $line, 0, 1 ) eq "#" )
{
# --------------------------------------------------------------------
# special processing for output embedded in the comments
# Any line in the ex file starts with "#" and follows immediately
# with "<".$type.">" will have the this prefix striped off and
# the rest of that line sent to output.
# for example:
# #<SunOS>abcdefg
# where # is the first character of the comment line
# abcdefg will be sent to the output if the $type is SunOS
# #<SunOS>abcdefg will be sent unchanged to the output if
# the $type is not SunOS
#
# Allowing embedded output in the comment makes it possible to
# generate platform specific output.
#
# If the type is SunOS or SOLARIS, the two are treated as
# interchangable in the comment line by this script. Thus,
# if the type is "SunOS" or "SOLARIS", either "#<SunOS>" or
# "#<SOLARIS>" as leading prefix is considered matched.
# --------------------------------------------------------------------
# determine if the current comment line is for embedded output
$embeddedOutput = false;
if ( $type eq "SunOS" || $type eq "SOLARIS" )
{ # for SunOS and SOLAIRS, the two are treated as interchangable
if ( (substr( $line, 1, $SunOSType_len ) eq $SunOSType) )
{
$embeddedOutput = true;
$line = substr( $line, $SunOSType_len + 1 );
}
elsif ( (substr( $line, 1, $SolarisType_len ) eq $SolarisType) )
{
$embeddedOutput = true;
$line = substr( $line, $SolarisType_len + 1 );
}
}
else
{ # any other type
if ((substr( $line, 1, $curType_len ) eq $curType) )
{
$embeddedOutput = true;
$line = substr( $line, $curType_len + 1 );
}
}
if (substr( $line, 1, $SASLType_len ) eq $SASLType)
{
if ( ($type eq "SunOS" || $type eq "SOLARIS") && (substr($OS_Version, 0, 3) eq "5.6") )
{
print STDERR "Ignoring SASL symbol:\t",$line;
}
else
{
# remove SASL symbols in Solaris 5.6
$line = substr( $line, $SASLType_len + 1 );
&print_export( $type, $line );
next;
}
}
# generate the output
if ( $embeddedOutput eq true )
{
process_line( $type, $expfile, $line );
}
else
{
$line = substr( $line, 1 );
$_ = $line;
if ( /^[0-9]+[\t ]/ )
{
&print_comment( $type, "" );
&print_export( $type, $line );
}
else
{
&print_comment( $type, $line );
}
}
}
elsif ( length( $line ) eq 1 && substr( $line, 0, 1 ) eq "\n" )
{
print "\n";
}
else
{
&print_export( $type, $line );
}
}
&print_comment( $type, "\n" );
&print_comment( $type, "end of generated exports list.\n" );
}
# print_comment( type, s )
sub
print_comment
{
local( $type, $s ) = @_;
if ( $type eq "AIX" )
{
$prefix = "* ";
}
elsif ( substr( $type, 0, 3 ) ne "Win" )
{
$prefix = "# ";
}
else
{
$prefix = "; ";
}
print $prefix,$s
}
# print_export( type, expline )
sub
print_export
{
local( $type, $expline ) = @_;
# strip trailing newline
$expline =~ s/\n$//;
# split into pieces
# lines look like: ORDINAL SYMBOL [SYMTYPE] [BUILDTYPE]
# where SYMTYPE is "P" (for Pascal), "C", or "G" (for globals).
# P is the default.
($ordinal,$symbol,$symtype,$bldtype) = split( /[ \t]+/, $expline, 4 );
$upcase_symbol = $symbol;
$upcase_symbol =~ tr/a-z/A-Z/;
if ( $symtype eq "" )
{
$symtype = "P";
}
if ( $bldtype ne "" && $bldtype ne $buildtype )
{
return;
}
# finally, print out an appropriate export line
if ( $type eq "Win32" )
{
if ( $symtype ne "G" )
{
print "\t$symbol\t\t\@$ordinal\n";
}
}
elsif ( $type eq "Win16" )
{
if ( $symtype eq "C" )
{
print "\t_$symbol\t\t\@$ordinal\n";
}
elsif ( $symtype eq "P" )
{
print "\t_$symbol=$upcase_symbol\t\t\@$ordinal\n";
}
}
elsif ( $type eq "Win16Rev" )
{
if ( $symtype ne "G" )
{
print "\t$upcase_symbol=_$symbol\t\t\@$ordinal\n";
}
}
elsif ( $type eq "WinBC" )
{
if ( $symtype ne "G" )
{
print "\t_$symbol=$symbol\t\t\@$ordinal\n";
}
}
elsif ( $type eq "MacOS" )
{
if ( $symtype ne "G" )
{
print "$symbol\n";
}
}
elsif ( $type eq "AIX" || $type eq "IRIX" )
{
print "$symbol\n";
}
elsif ( $type eq "SOLARIS" || $type eq "SunOS")
{
print "\t$symbol;\n";
}
else
{
print STDERR "print_export: unknown type <$type>\n";
exit 1;
}
}
# windows_std( type, expfile, arg1, arg2, arg3 )
sub
windows_std
{
local( $type, $expfile, $arg1, $arg2, $arg3 ) = @_;
process_line( $type, $expfile, "LIBRARY\tNSLIB\$1\n" );
if ( substr( $type, 0, 5 ) eq "Win16" )
{
process_line( $type, $expfile, "CODE\tPRELOAD MOVEABLE DISCARDABLE\n" );
process_line( $type, $expfile, "DATA\tPRELOAD MOVEABLE SINGLE\n" );
}
process_line( $type, $expfile, "VERSION\t\$2\n" );
process_line( $type, $expfile, "HEAPSIZE\t4096\n" );
process_line( $type, $expfile, "EXPORTS\n" );
process_line( $type, $expfile, "\$EXPORTS\n" );
}
# solaris_std( type, expfile, arg1, arg2, arg3 )
sub
solaris_std
{
local( $type, $expfile, $arg1, $arg2, $arg3 ) = @_;
# process_line( $type, $expfile, "{\n" );
# process_line( $type, $expfile, "global:\n" );
process_line( $type, $expfile, "\$EXPORTS\n" );
process_line( $type, $expfile, "\n" );
# process_line( $type, $expfile, "local:\n" );
# process_line( $type, $expfile, "\t*;\n" );
# process_line( $type, $expfile, "};\n" );
}
# simple_std( type, expfile, arg1, arg2, arg3 )
sub
simple_std
{
local( $type, $expfile, $arg1, $arg2, $arg3 ) = @_;
process_line( $type, $expfile, "\$EXPORTS\n" );
}

View File

@ -0,0 +1,23 @@
#
# 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 mozilla.org LDAP SDK autoconf glue.
#
# The Initial Developer of the Original Code is Netscape
# Commmunications Corp. Portions created by Netscape are
# Copyright (C) 2000, Netscape Communications Corp. All
# Rights Reserved.
#
# Contributor(s): Dan Mosedale <dmose@mozilla.org>
#
DIST = $(DEPTH)/dist
VPATH = $(srcdir)

View File

@ -0,0 +1,72 @@
#!/bin/sh
#
# 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 Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
# FTP script for downloading /share/builds/components stuff.
#
# syntax:
# nsftp <srcdir-relative to /share/builds/components> <destdir>
#
# Example
#
# nsftp ldapsdk/19961108 c:\3.0\ns\components\ldapsdk
#
#JSERVER=ftp-rel
#SERVER=gaida
SERVER=$COMPONENT_FTP_SERVER
USER=ftpman
PASSWD=ftpman
TMPFILE=tmp.foo
SRC=$1
DEST=$2
if [ -z "$3" ]; then
FILENAME=*
else
FILENAME=$3
fi
echo ${USER} contents of ${SRC} to ${DEST}
cd ${DEST}
ftp -n ${SERVER} << -=EOF=-
user ${USER} ${PASSWD}
binary
hash
prompt
cd ${SRC}
mget ${FILENAME}
quit
-=EOF=-

View File

@ -0,0 +1,69 @@
#
# 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 mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-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.
#
# replace.pl: perform simple string substitution on a file
# the first line in the input (template) file is also discarded.
#
# usage: perl replace.pl KEYWORD=VALUE... < TMPLFILE > OUTFILE
#
# created 17 October 2001 by Mark Smith <mcs@netscape.com>
@keywords = ();
@values = ();
$count = 0;
foreach $str (@ARGV) {
($key,$val) = split( "=", $str, 2 );
push (@keywords, $key);
push (@values, $val);
++$count;
}
$first_line = 1;
while(<STDIN>) {
$line = $_;
$count = 0;
foreach $str (@keywords) {
$line =~ s/{{$str}}/$values[$count]/g;
++$count;
}
if ( ! $first_line ) {
print $line;
} else {
$first_line = 0;
}
}
exit 0;

View File

@ -0,0 +1,522 @@
#
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
NS_DEPTH = ../../../..
DEPTH = ../../../../..
LDAP_SRC = ../..
NSCP_DISTDIR = ../../../../../dist
NSPR_TREE = ../../..
MOD_DEPTH = ../../..
include $(NSPR_TREE)/config/rules.mk
include ../../../build.mk
INSTALLDIR = $(NSCP_DISTDIR)/$(OBJDIR_NAME)/bin
HEADERDIR = $(DEPTH)/dist/$(OBJDIR_NAME)
INCLUDES += -I$(HEADERDIR)/include \
-I../../../../../dist/include/obsolete \
-I../../../../../dist/include \
-I../../../../../dist/public/security \
-I../../../../../dist/public/nss \
-I$(NSCP_DISTDIR)/public/ldap \
-I../../../ldap/include
ifdef HAVE_SASL
INCLUDES += -I$(LIBSASL_INCLUDES)
endif
#for including SASL options
ifdef HAVE_SASL
HAVESASLOPTIONS = -DHAVE_SASL_OPTIONS
# we don't need the -2 version of sasl any more.
#HAVESASLOPTIONS += -DHAVE_SASL_OPTIONS_2
else
HAVESASLOPTIONS =
endif
ifeq ($(HAVE_CCONF), 1)
COMPS_FROM_OBJDIR=1
endif
#
# keep this defined for ldapssl_pkcs_init->NSS_Initialize
# so that custom NSS secdb filenames/prefixes can be used
#
CFLAGS+=-DLDAP_TOOL_PKCS11
ifdef HAVE_LIBICU
INCLUDES += -I$(LIBICU_INCLUDES)
endif
ifeq ($(OS_ARCH), WINNT)
DEFS += -DXP_WIN -DXP_WIN32
endif
DEFINES += $(DEFS)
CXXSRCS = convutf8.cpp
OBJDEST = $(OBJDIR_NAME)
BINDIR = $(OBJDIR_NAME)/bin
LIBDIR = $(OBJDIR_NAME)/lib
ifneq ($(OS_ARCH), WINNT)
ifeq ($(USE_64), 1)
RPATHFLAG = '$$'ORIGIN/../lib:/opt/sun/private/lib/64
else
RPATHFLAG = '$$'ORIGIN/../lib:/opt/sun/private/lib
endif
ifeq ($(OS_ARCH), SunOS)
ifeq ($(USE_64), 1)
RPATHFLAG = '$$'ORIGIN/../lib:/usr/lib/mps/sasl2/64:/usr/lib/mps/secv1/64:/usr/lib/mps/64
else
RPATHFLAG = '$$'ORIGIN/../lib:/usr/lib/mps/sasl2:/usr/lib/mps/secv1:/usr/lib/mps
endif
endif
ifeq ($(OS_ARCH), Linux)
ifeq ($(USE_64), 1)
RPATHFLAG = '$$'ORIGIN/../lib:/opt/sun/private/lib64
else
RPATHFLAG = '$$'ORIGIN/../lib:/opt/sun/private/lib
endif
endif
ifeq ($(OS_ARCH), HP-UX)
ifeq ($(USE_64), 1)
RPATHFLAG = '$$'ORIGIN/../lib:/opt/sun/private/lib/64
else
RPATHFLAG = '$$'ORIGIN/../lib:/opt/sun/private/lib
endif
endif
ifeq ($(OS_ARCH), AIX)
ifeq ($(USE_64), 1)
RPATHFLAG = ../lib:/opt/sun/private/lib/64
else
RPATHFLAG = ../lib:/opt/sun/private/lib
endif
endif
endif
ifeq ($(OS_ARCH), WINNT)
LDAPDELETE_OBJ = $(addprefix $(OBJDEST)/, ldapdelete.obj)
LDAPMODIFY_OBJ = $(addprefix $(OBJDEST)/, ldapmodify.obj)
LDAPSEARCH_OBJ = $(addprefix $(OBJDEST)/, ldapsearch.obj)
LDAPCOMPARE_OBJ = $(addprefix $(OBJDEST)/, ldapcompare.obj)
LDAPCMP_OBJ = $(addprefix $(OBJDEST)/, ldapcmp.obj)
LDAPPASSWD_OBJ = $(addprefix $(OBJDEST)/, ldappasswd.obj)
LDAPTOOLCOMMON_OBJ = $(addprefix $(OBJDEST)/, common.obj) \
$(addprefix $(OBJDEST)/, convutf8.obj) \
$(addprefix $(OBJDEST)/, fileurl.obj)
ifdef HAVE_SASL
LDAPTOOLCOMMON_OBJ += $(addprefix $(OBJDEST)/, ldaptool-sasl.obj)
endif
else
LDAPDELETE_OBJ = $(addprefix $(OBJDEST)/, ldapdelete.o)
LDAPMODIFY_OBJ = $(addprefix $(OBJDEST)/, ldapmodify.o)
LDAPSEARCH_OBJ = $(addprefix $(OBJDEST)/, ldapsearch.o)
LDAPCOMPARE_OBJ = $(addprefix $(OBJDEST)/, ldapcompare.o)
LDAPCMP_OBJ = $(addprefix $(OBJDEST)/, ldapcmp.o)
LDAPPASSWD_OBJ = $(addprefix $(OBJDEST)/, ldappasswd.o)
ifeq ($(OS_ARCH), HP-UX)
LDAPTOOLCOMMON_OBJ = $(addprefix $(OBJDEST)/, common.o) \
$(addprefix $(OBJDEST)/, fileurl.o)
else
LDAPTOOLCOMMON_OBJ = $(addprefix $(OBJDEST)/, common.o) \
$(addprefix $(OBJDEST)/, convutf8.o) \
$(addprefix $(OBJDEST)/, fileurl.o)
endif
ifdef HAVE_SASL
LDAPTOOLCOMMON_OBJ += $(addprefix $(OBJDEST)/, ldaptool-sasl.o)
endif
endif
ifeq ($(OS_ARCH), HP-UX)
LDAPTOOLCPPCOMMON_OBJ = $(addprefix $(OBJDEST)/, convutf8.o)
endif
CLIENT_OBJS = $(LDAPDELETE_OBJ) $(LDAPMODIFY_OBJ) \
$(LDAPSEARCH_OBJ) $(LDAPCOMPARE_OBJ) $(LDAPCMP_OBJ) $(LDAPPASSWD_OBJ) $(LDAPTOOLCOMMON_OBJ)
ifeq ($(OS_ARCH), WINNT)
LDAPCOMPARE_RES = $(addprefix $(OBJDEST)/, ldapcompare.res)
LDAPCOMPARE_OBJS_RES = $(LDAPCOMPARE_RES)
LDAPDELETE_RES = $(addprefix $(OBJDEST)/, ldapdelete.res)
LDAPDELETE_OBJS_RES = $(LDAPDELETE_RES)
LDAPMODIFY_RES = $(addprefix $(OBJDEST)/, ldapmodify.res)
LDAPMODIFY_OBJS_RES = $(LDAPMODIFY_RES)
LDAPSEARCH_RES = $(addprefix $(OBJDEST)/, ldapsearch.res)
LDAPSEARCH_OBJS_RES = $(LDAPSEARCH_RES)
LDAPCMP_RES = $(addprefix $(OBJDEST)/, ldapcmp.res)
LDAPCMP_OBJS_RES = $(LDAPCMP_RES)
LDAPPASSWD_RES = $(addprefix $(OBJDEST)/, ldappasswd.res)
LDAPPASSWD_OBJS_RES = $(LDAPPASSWD_RES)
endif
LDAPDELETE = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapdelete))
LDAPMODIFY = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapmodify))
LDAPSEARCH = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapsearch))
LDAPCOMPARE = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapcompare))
LDAPCMP = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapcmp))
LDAPPASSWD = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldappasswd))
BINS= $(LDAPDELETE) $(LDAPMODIFY) $(LDAPSEARCH) $(LDAPCOMPARE) $(LDAPCMP) $(LDAPPASSWD)
ifeq ($(OS_ARCH), WINNT)
LDTOOLS_LIBS += $(LIBNSPR)
else
LDTOOLS_LIBS += $(DYNAMICNSPR)
endif
ifeq ($(OS_ARCH), SunOS)
EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LDAP_LIBNAME) \
-l$(LDIF_LIBNAME) -l$(SSLDAP_LIBNAME) -l$(PRLDAP_LIBNAME) \
-L$(NSCP_DISTDIR)/lib $(SVRCORE_LINK) \
-l$(SSL_LIBNAME) -l$(NSS_LIBNAME) \
-lposix4 -lsocket -lnsl \
-ldl -lresolv -lgen
EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib $(DYNAMICNSPR)
endif
ifeq ($(OS_ARCH), WINNT)
EXTRA_LIBS =wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
rpcrt4.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(LBER_LIBNAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(LDAP_LIBNAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(LDIF_LIBNAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(PLC_BASENAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(PLDS_BASENAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(NSPR_BASENAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(UTIL_LIBNAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(SSLDAP_LIBNAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(PRLDAP_LIBNAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(NSS_LIBNAME).lib
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(SSL_LIBNAME).lib
endif
ifeq ($(OS_ARCH), OSF1)
EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LDAP_LIBNAME) \
-l$(LDIF_LIBNAME) -l$(SSLDAP_LIBNAME) -l$(PRLDAP_LIBNAME) \
-L$(NSCP_DISTDIR)/lib $(SVRCORE_LINK) \
-l$(SSL_LIBNAME) -l$(NSS_LIBNAME) \
-lcxx -lpthread -lrt -lmach -lexc
EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib $(DYNAMICNSPR)
endif
ifeq ($(OS_ARCH), Linux)
EXTRA_LIBS += -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LDAP_LIBNAME) \
-l$(LDIF_LIBNAME) -l$(SSLDAP_LIBNAME) -l$(PRLDAP_LIBNAME) \
-L$(NSCP_DISTDIR)/lib $(SVRCORE_LINK) \
-l$(SSL_LIBNAME) -l$(NSS_LIBNAME) \
-l$(STKN_LIBNAME) -l$(LBER_LIBNAME) \
-ldl -lresolv -lc -lstdc++
EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib $(DYNAMICNSPR)
endif
ifeq ($(OS_ARCH), HP-UX)
EXTRA_LIBS = -ldld -lm -lrt \
-L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LDAP_LIBNAME) \
-l$(LDIF_LIBNAME) -l$(SSLDAP_LIBNAME) -l$(PRLDAP_LIBNAME) \
-L$(NSCP_DISTDIR)/lib $(SVRCORE_LINK) \
-l$(SSL_LIBNAME) -l$(NSS_LIBNAME) -l$(LBER_LIBNAME)
EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib $(DYNAMICNSPR)
endif
ifeq ($(OS_ARCH), AIX)
EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LDAP_LIBNAME) \
-l$(LDIF_LIBNAME) -l$(SSLDAP_LIBNAME) -l$(PRLDAP_LIBNAME) \
-L$(NSCP_DISTDIR)/lib $(SVRCORE_LINK) \
-l$(SSL_LIBNAME) -l$(NSS_LIBNAME) \
-ldl -brtl -lpthreads -lc_r -lm
EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib $(DYNAMICNSPR)
endif
ifdef HAVE_SASL
ifeq ($(OS_ARCH), WINNT)
EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/sasl32.lib
else
EXTRA_LIBS += -lsasl
endif
endif
ifdef HAVE_LIBICU
ifeq ($(OS_ARCH), SunOS)
OS_VERS := $(shell uname -r)
ifeq ($(OS_VERS),5.6)
EXTRA_LIBS += -lC
else
EXTRA_LIBS += -lCrun
endif
endif
endif
ifeq ($(OS_ARCH), WINNT)
EXTRA_LIBS += $(LIBICU)
else
EXTRA_LIBS += $(ICULINK)
endif
LDTOOLS_LIBS += $(EXTRA_LIBS)
LIBLOCATION = $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib
###########################################################################
all:: $(BINS) $(OBJDEST) linklibicu libdir $(BINS)
libdir: linklibicu
ifeq ($(OS_ARCH), WINNT)
@echo "Install libldap provided libraries - NT only"
$(NSINSTALL) $(LIBLOCATION)/$(LDAP_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(LIBLOCATION)/$(PRLDAP_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(LIBLOCATION)/$(SSLDAP_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
else
@echo "Install libldap provided libraries - Unix'es"
$(NSINSTALL) $(LIBLOCATION)/lib$(LDAP_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(LIBLOCATION)/lib$(PRLDAP_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(LIBLOCATION)/lib$(SSLDAP_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
endif
ifeq ($(COMPS_FROM_OBJDIR), 1)
ifeq ($(OS_ARCH), WINNT)
@echo "Install libraries from specified location - NT only"
ifeq ($(HAVE_SASL), 1)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(SASL_BASENAME).$(DLL_SUFFIX) $(LIBDIR)
endif
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(PLC_BASENAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(PLDS_BASENAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(NSPR_BASENAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(SSL_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(NSS_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
else
@echo "Install libraries from specified location - Unix'es"
ifeq ($(HAVE_SASL), 1)
ifneq ($(HAVE_SASL_LOCAL), 1)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/lib$(SASL_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
endif
endif
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/lib$(PLC_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/lib$(PLDS_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/lib$(NSPR_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/lib$(SSL_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/lib$(NSS_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
endif
else
ifeq ($(OS_ARCH), WINNT)
@echo "Install libraries needed by libldap - NT only"
ifeq ($(HAVE_SASL), 1)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/$(SASL_BASENAME).$(DLL_SUFFIX) $(LIBDIR)
endif
$(NSINSTALL) $(NSCP_DISTDIR)/lib/$(PLC_BASENAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/$(PLDS_BASENAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/$(NSPR_BASENAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/$(SSL_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/$(NSS_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
else
@echo "Install libraries needed by libldap - UNIX'es only"
ifeq ($(OS_ARCH), WINNT)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/lib$(SASL_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
endif
$(NSINSTALL) $(NSCP_DISTDIR)/lib/lib$(PLC_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/lib$(PLDS_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/lib$(NSPR_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/lib$(SSL_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
$(NSINSTALL) $(NSCP_DISTDIR)/lib/lib$(NSS_LIBNAME).$(DLL_SUFFIX) $(LIBDIR)
endif
endif
ifeq ($(COPYFREEBL), 1)
ifeq ($(OS_ARCH), WINNT)
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(FREEBL_LIBNAME) $(LIBDIR)
else
$(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/lib$(FREEBL_LIBNAME) $(LIBDIR)
endif
endif
linklibsasl: FORCE
ifeq ($(HAVE_SASL), 1)
ifneq ($(HAVE_SASL_LOCAL), 1)
ifneq ($(COMPONENT_PULL_METHOD), FTP)
@echo ""
@echo "IMPORTING .... libsasl"
@echo ""
$(RM) -f $(LIBSASL_INCLUDES)
$(RM) -f $(LIBSASL_LIBDIR)
ln -s $(LIBSASL_INCLUDES_LOC) $(LIBSASL_INCLUDES)
ln -s $(LIBSASL_LIB_LOC) $(LIBSASL_LIBDIR)
else
@echo ""
@echo "IMPORTING .... libsasl"
@echo ""
$(NSINSTALL) -D ../../../../../dist/$(OBJDIR_NAME)/libsasl
$(NSINSTALL) -D ../../../../../dist/public
$(NSINSTALL) -D ../../../../../dist/public/libsasl
sh ../../build/nsftp.sh /share/builds/integration/sasl$(SASLVERS)/$(SASL_RELEASE_TAG)/$(OBJDIR_NAME)/lib ../../../../../dist/$(OBJDIR_NAME)/libsasl
sh ../../build/nsftp.sh /share/builds/integration/sasl$(SASLVERS)/$(SASL_RELEASE_TAG)/$(OBJDIR_NAME)/include ../../../../../dist/public/libsasl
endif
ifeq ($(OS_ARCH),WINNT)
$(NSINSTALL) $(LIBSASL_LIBDIR)/$(SASL_BASENAME).* ../../../../../dist/$(OBJDIR_NAME)/lib
else
$(NSINSTALL) $(LIBSASL_LIBDIR)/lib$(SASL_LIBNAME).$(DLL_SUFFIX) ../../../../../dist/$(OBJDIR_NAME)/lib
endif
else
@echo ""
@echo "WARNING: HAVE_SASL_LOCAL is set for libsasl; default to local version provided by OS"
@echo ""
endif
endif
linklibicu: FORCE
ifneq ($(COMPONENT_PULL_METHOD), FTP)
ifeq ($(HAVE_LIBICU), 1)
ifneq ($(HAVE_LIBICU_LOCAL), 1)
@echo ""
@echo "IMPORTING .... libicu"
@echo ""
$(RM) -f $(LIBICU_INCLUDES)
$(RM) -f $(LIBICU_LIBDIR)
ln -s $(LIBICU_INCLUDES_LOC) $(LIBICU_INCLUDES)
ln -s $(LIBICU_LIB_LOC) $(LIBICU_LIBDIR)
endif
endif
else
ifeq ($(HAVE_LIBICU), 1)
ifneq ($(HAVE_LIBICU_LOCAL), 1)
@echo ""
@echo "IMPORTING .... libicu"
@echo ""
# The following shell script recalculates $(ICU_INCLUDE), $(ICU_LIBPATH)
ifeq ($(USE_INT), 1)
sh ../../build/compver.sh $(LIBICU_DIR) $(LIBICU_RELDATE) \
$(OBJDIR_NAME) ../../../../dist ldapsdk \
/share/builds/components/icu/$(ICU_LIBVERSION)/$(LIBICU_RELDATE)/$(OBJDIR_NAME) \
libicu$(ICU_LIBVERSION) \
"include lib"
else
$(NSINSTALL) -D ../../../../../dist/$(OBJDIR_NAME)/libicu
$(NSINSTALL) -D ../../../../../dist/public
$(NSINSTALL) -D ../../../../../dist/public/libicu
$(NSINSTALL) -D ../../../../../dist/public/libicu/unicode
$(NSINSTALL) -D ../../../../../dist/public/libicu/layout
sh ../../build/nsftp.sh /share/builds/integration/icu/$(ICU_LIBVERSION)/$(LIBICU_RELDATE)/$(ICUOBJDIR)/lib ../../../../../dist/$(OBJDIR_NAME)/libicu
ifeq ($(OS_ARCH), WINNT)
sh ../../build/nsftp.sh /share/builds/integration/icu/$(ICU_LIBVERSION)/$(LIBICU_RELDATE)/$(ICUOBJDIR)/bin ../../../../../dist/$(OBJDIR_NAME)/libicu
endif
sh ../../build/nsftp.sh /share/builds/integration/icu/$(ICU_LIBVERSION)/$(LIBICU_RELDATE)/$(ICUOBJDIR)/include ../../../../../dist/public/libicu
sh ../../build/nsftp.sh /share/builds/integration/icu/$(ICU_LIBVERSION)/$(LIBICU_RELDATE)/$(ICUOBJDIR)/include/unicode ../../../../../dist/public/libicu/unicode
sh ../../build/nsftp.sh /share/builds/integration/icu/$(ICU_LIBVERSION)/$(LIBICU_RELDATE)/$(ICUOBJDIR)/include/layout ../../../../../dist/public/libicu/layout
endif
else
@echo ""
@echo "WARNING: HAVE_LIBICU_LOCAL is set for libicu; default to local version provided by OS"
@echo ""
endif
endif
endif
ifeq ($(OS_ARCH), SunOS)
ifneq ($(HAVE_LIBICU_LOCAL), 1)
$(NSINSTALL) -D $(LIBDIR)
cp ../../../../../dist/$(OBJDIR_NAME)/libicu/libicu* $(LIBDIR)
endif
endif
$(LDAPTOOLCOMMON_OBJ):
ifeq ($(OS_ARCH), HP-UX)
$(LDAPTOOLCPPCOMMON_OBJ): convutf8.cpp
ifneq ($(USE_64), 1)
/opt/aCC/bin/aCC -ext -DHPUX_ACC -D__STDC_EXT__ -D_POSIX_C_SOURCE=199506L -c -DHPUX11 -DHPUX11_00 +DAportable +DS1.1 -D_LARGEFILE64_SOURCE -D_PR_HAVE_OFF64_T -DNO_NODELOCK -DNO_LIBLCACHE -DXP_UNIX -DHPUX -DMCC_HTTPD -DNS_DOMESTIC -DNET_SSL -DCLIENT_AUTH -DNSPR20 -D_PR_NTHREAD -D_PR_USECPU -D_REENTRANT -DNS_DS -DSPAPI20 -DBUILD_NUM=\"01.081.1519\" -DCPU_hppa -DOS_hpux -D_NO_THREADS_ -Dhpux -Dhpux -D_HPUX_SOURCE -D_REENTRANT -Aa -DLDAP_REFERRALS -DLDAP_LDBM -DLDAP_LDIF -DLDBM_USE_DBBTREE -DSLAPD_PASSWD_SHA1 -D__DBINTERFACE_PRIVATE -DNO_LIBLCACHE -DNS_DIRECTORY -DNET_SSL -DUSE_NSPR_MT -O $(INCLUDES) convutf8.cpp -o $(OBJDIR_NAME)/convutf8.o
else
/opt/aCC/bin/aCC -DHPUX_ACC -D__STDC_EXT__ -D_POSIX_C_SOURCE=199506L +DA2.0W +DS2.0 -c -DHPUX11 -DHPUX11_00 -DIS_64 +e +DA2.0W +DS2.0 -D_LARGEFILE64_SOURCE -D_PR_HAVE_OFF64_T -DNO_NODELOCK -DNO_LIBLCACHE -DXP_UNIX -DHPUX -DMCC_DEBUG -g -DMCC_HTTPD -DNS_DOMESTIC -DNET_SSL -DCLIENT_AUTH -DNSPR20 -D_PR_NTHREAD -D_PR_USECPU -D_REENTRANT -DNS_DS -DSPAPI20 -DBUILD_NUM=\"01.081.1617\" -DCPU_hppa -DOS_hpux -D_NO_THREADS_ -Dhpux -Dhpux -D_HPUX_SOURCE -D_REENTRANT -Aa -DLDAP_DEBUG -DLDAP_REFERRALS -DLDAP_LDBM -DLDAP_LDIF -DLDBM_USE_DBBTREE -DSLAPD_PASSWD_SHA1 -D__DBINTERFACE_PRIVATE -DNO_LIBLCACHE -DNS_DIRECTORY -DNET_SSL -DUSE_NSPR_MT $(INCLUDES) -g convutf8.cpp -o $(OBJDIR_NAME)/convutf8.o
endif
else
$(LDAPTOOLCPPCOMMON_OBJ):
endif
$(LDAPCOMPARE_RES) $(LDAPDELETE_RES) $(LDAPMODIFY_RES) $(LDAPSEARCH_RES) $(LDAPCMP_RES) $(LDAPPASSWD_RES): ldaptools.rc
$(RSC) -fo $@ -d LDAP_TOOLNAME=$(LDAP_TOOLNAME) \
-d YY=`date +%y` -d MMDD=`date +%m%d` -d HH=`date +%H` \
-d MMSS=`date +%M%S` -d DEBUG=$(DEBUG) \
-i ../../../../../dist/public/ldap $<
$(LDAPCOMPARE): LDAP_TOOLNAME = ldapcompare
$(LDAPCOMPARE): $(LDAPCOMPARE_OBJ) $(LDAPTOOLCOMMON_OBJ) \
$(LDAPTOOLCPPCOMMON_OBJ) $(LDAPCOMPARE_RES) $(LDTOOLS_LIBS_DEP)
$(LINK_EXE) $(LDAPCOMPARE_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) \
$(LDTOOLS_LIBS) $(LDAPCOMPARE_OBJS_RES)
$(LDAPDELETE): LDAP_TOOLNAME = ldapdelete
$(LDAPDELETE): $(LDAPDELETE_OBJ) $(LDAPTOOLCOMMON_OBJ) \
$(LDAPTOOLCPPCOMMON_OBJ) $(LDAPDELETE_RES) $(LDTOOLS_LIBS_DEP)
$(LINK_EXE) $(LDAPDELETE_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) \
$(LDTOOLS_LIBS) $(LDAPDELETE_OBJS_RES)
$(LDAPMODIFY): LDAP_TOOLNAME = ldapmodify
$(LDAPMODIFY): $(LDAPMODIFY_OBJ) $(LDAPTOOLCOMMON_OBJ) \
$(LDAPTOOLCPPCOMMON_OBJ) $(LDAPMODIFY_RES) $(LDTOOLS_LIBS_DEP)
$(LINK_EXE) $(LDAPMODIFY_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) \
$(LDTOOLS_LIBS) $(LDAPMODIFY_OBJS_RES)
$(LDAPSEARCH): LDAP_TOOLNAME = ldapsearch
$(LDAPSEARCH): $(LDAPSEARCH_OBJ) $(LDAPTOOLCOMMON_OBJ) \
$(LDAPTOOLCPPCOMMON_OBJ) $(LDAPSEARCH_RES) $(LDTOOLS_LIBS_DEP)
$(LINK_EXE) $(LDAPSEARCH_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) \
$(LDTOOLS_LIBS) $(LDAPSEARCH_OBJS_RES)
$(LDAPCMP): LDAP_TOOLNAME = ldapcmp
$(LDAPCMP): $(LDAPCMP_OBJ) $(LDAPTOOLCOMMON_OBJ) \
$(LDAPTOOLCPPCOMMON_OBJ) $(LDAPCMP_RES) $(LDTOOLS_LIBS_DEP)
$(LINK_EXE) $(LDAPCMP_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) \
$(LDTOOLS_LIBS) $(LDAPCMP_OBJS_RES)
$(LDAPPASSWD): LDAP_TOOLNAME = ldappasswd
$(LDAPPASSWD): $(LDAPPASSWD_OBJ) $(LDAPTOOLCOMMON_OBJ) \
$(LDAPTOOLCPPCOMMON_OBJ) $(LDAPPASSWD_RES) $(LDTOOLS_LIBS_DEP)
$(LINK_EXE) $(LDAPPASSWD_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) \
$(LDTOOLS_LIBS) $(LDAPPASSWD_OBJS_RES)
$(OBJDEST):
$(NSINSTALL) -D $(OBJDEST)
$(NSINSTALL) -D $(BINDIR)
$(NSINSTALL) -D $(LIBDIR)
clean::
$(RM) -rf $(OBJDEST)
install:: $(OBJDEST) libdir $(BINS)
$(NSINSTALL) $(LDAPDELETE) $(INSTALLDIR)
$(NSINSTALL) $(LDAPSEARCH) $(INSTALLDIR)
$(NSINSTALL) $(LDAPMODIFY) $(INSTALLDIR)
$(NSINSTALL) $(LDAPCOMPARE) $(INSTALLDIR)
$(NSINSTALL) $(LDAPCMP) $(INSTALLDIR)
$(NSINSTALL) $(LDAPPASSWD) $(INSTALLDIR)
#
# Simple, local dependencies
#
LDAPTOOL_COMMON_DEPS = ldaptool.h Makefile
$(LDAPTOOLCOMMON_OBJ): $(LDAPTOOL_COMMON_DEPS)
$(LDAPDELETE_OBJ): $(LDAPTOOL_COMMON_DEPS)
$(LDAPMODIFY_OBJ): $(LDAPTOOL_COMMON_DEPS) fileurl.h
$(LDAPSEARCH_OBJ): $(LDAPTOOL_COMMON_DEPS) fileurl.h
$(LDAPCOMPARE_OBJ): $(LDAPTOOL_COMMON_DEPS)
$(LDAPCMP_OBJ): $(LDAPTOOL_COMMON_DEPS)
$(LDAPPASSWD_OBJ): $(LDAPTOOL_COMMON_DEPS)
FORCE:

View File

@ -0,0 +1,59 @@
Summary of options used by the LDAP tools
Updated 5-May-2000 by Mark Smith <mcs@netscape.com>
Only single letter options in the sets [0-9], [A-Z], and [a-z] are
listed.
The "raw" lists are taken from the calls to getopt() and
ldaptool_process_args().
The "sorted" lists are just that -- sorted versions of the raw list.
The "all" lists include options from common.c as well as the tool-specific
options.
The "avail" lists included options that are available for use.
common.c (supported by all of the tools):
raw: nvEMRHZ0d:D:f:h:I:j:K:N:O:P:p:Q:W:w:V:X:m:i:k:y:Y:J:
sorted: 0 DEHIJKMNOPQRVWXYZ dfhikmnpvwy
avail: 2 [4-9] g (not used by any of the tools)
ldapcmp.c:
raw: Bb:l:s:z:
sorted: B blsz
all: 0 BDHIKMNOPQRVWXYZ bdfhiklmnpsvwyz
avail: [12] [4-9] ACFGLSTU acegjoqrtu
ldapcompare.c:
raw: cq
sorted: cq
all: 0 DEHIKMNOPQRVWXYZ cdfhikmnpqvwy
avail: [12] [4-9] ABCFLSTU abegjlorstuxz
ldapdelete.c (deprecated)
raw: c
sorted: c
all: 0 DHIKMNOPQRVWXYZ cdfhikmnpvwy
avail: [12] [4-9] ABCFGLSTU abegjloqrstuxz
ldapmodify.c
raw: aAbcFe:B:q
sorted: ABF abceq
all: 0 ABDFHIKMNOPQRVWXYZ abcdefhikmnpqvwy
avail: [12] [4-9] CGLSTU gjlorstuxz
ldapmodrdn.c (deprecated)
raw: cr
sorted: cr
all: 0 DHIKMNOPQRVWXYZ cdfhikmnprvwy
avail: [12] [4-9] ABCFGLSTU abegjloqstuxz
ldapsearch.c
raw: ABLTU1eotuxa:b:F:G:l:S:s:z:C:
sorted: 1 ABCFGLSTU abeostuxz
all: 01 ABCDFGHIKLMNOPQRSTUVWXYZ abdefhikmnopstuvwxyz
avail: 2 [4-9] cgjlqr

View File

@ -0,0 +1,147 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/******************************************************
*
* argpin.c - Returns pin for token specified in a
* command line paramenter.
*
******************************************************/
#include <stdio.h>
#include <string.h>
#include "argpin.h"
struct SVRCOREArgPinObj
{
SVRCOREPinObj base;
char *tokenName;
char *password;
SVRCOREPinObj *alt;
};
static const struct SVRCOREPinMethods vtable;
/* XXXceb these are two hacks to fix a problem with the debug builds
* of svrcore. With the optimizer turned off, there is a situation
* in user.c, where these two functions need to be available for the
* linker (they are imported, and no lib exports them, since they are
* declared static on XP_UNIX platforms) The short term hack solution
* is to define them here. Yeah, it is ugly but, it will need to be
* here, until a new version of svrcore is done.
*/
void echoOff(int fd)
{
}
void echoOn(int fd)
{
}
/* ------------------------------------------------------------ */
SVRCOREError
SVRCORE_CreateArgPinObj(SVRCOREArgPinObj **out, const char * tokenName, const char *password, SVRCOREPinObj *pinObj)
{
SVRCOREError err = 0;
SVRCOREArgPinObj *obj = 0;
do {
obj = (SVRCOREArgPinObj*)malloc(sizeof (SVRCOREArgPinObj));
if (!obj) { err = 1; break; }
obj->base.methods = &vtable;
obj->tokenName=NULL;
obj->password=NULL;
obj->alt=pinObj;
if ( tokenName == NULL) {
PK11SlotInfo *slot = PK11_GetInternalKeySlot();
obj->tokenName = strdup(PK11_GetTokenName(slot));
PK11_FreeSlot(slot);
}
else
{
obj->tokenName = strdup(tokenName);
}
if (obj->tokenName == NULL) { err = 1; break; }
obj->password = strdup(password);
if (obj->password == NULL) { err = 1; break; }
} while(0);
if (err)
{
SVRCORE_DestroyArgPinObj(obj);
obj = 0;
}
*out = obj;
return err;
}
void
SVRCORE_DestroyArgPinObj(SVRCOREArgPinObj *obj)
{
if (obj->tokenName) free(obj->tokenName);
if (obj->password)
{
memset(obj->password, 0, strlen(obj->password));
free(obj->password);
}
if (obj) free(obj);
}
static void destroyObject(SVRCOREPinObj *obj)
{
SVRCORE_DestroyArgPinObj((SVRCOREArgPinObj*)obj);
}
static char *getPin(SVRCOREPinObj *obj, const char *tokenName, PRBool retry)
{
SVRCOREArgPinObj *p = (SVRCOREArgPinObj*)obj;
if (tokenName == NULL) return NULL;
/* On first attempt, return the password if the token name
* matches.
*/
if (!retry && strcmp(p->tokenName, tokenName) == 0)
{
return strdup(p->password);
}
if (p->alt != NULL) return SVRCORE_GetPin(p->alt, tokenName, retry);
return (NULL);
}
/*
* VTable
*/
static const SVRCOREPinMethods vtable =
{ 0, 0, destroyObject, getPin };

View File

@ -0,0 +1,36 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef __ARGPIN_H__
#define __ARGPIN_H__
#include <svrcore.h>
typedef struct SVRCOREArgPinObj SVRCOREArgPinObj;
SVRCOREError
SVRCORE_CreateArgPinObj(SVRCOREArgPinObj **out, const char * tokenName, const char *password, SVRCOREPinObj *pinObj);
void
SVRCORE_DestroyArgPinObj(SVRCOREArgPinObj *obj);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,615 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <ctype.h>
#ifndef HAVE_LIBICU
#ifdef __cplusplus
extern "C" {
#endif
extern char *ldaptool_charset;
char *ldaptool_convdir = NULL;
static int charsetset = 0;
char *ldaptool_local2UTF8( const char *src );
char *
ldaptool_local2UTF8( const char *src )
{
char *utf8;
charsetset = 0;
if (src == NULL)
{
return NULL;
}
utf8 = strdup(src);
return ( utf8 );
}
#else /* HAVE_LIBICU */
#include "unicode/utypes.h"
#include "unicode/ucnv.h"
#define NSPR20
#ifdef XP_WIN32
#define VC_EXTRALEAN
#include <afxwin.h>
#include <winnls.h>
#endif
extern char *ldaptool_charset;
static int charsetset = 0;
static int icu_err_once = 0;
extern "C" {
char *ldaptool_convdir = NULL;
char *ldaptool_local2UTF8( const char * );
}
#ifndef XP_WIN32
char * GetNormalizedLocaleName(void);
char *
GetNormalizedLocaleName(void)
{
#ifdef _HPUX_SOURCE
int len;
char *locale;
locale = setlocale(LC_CTYPE, "");
if (locale && *locale) {
len = strlen(locale);
} else {
locale = (char *)"C";
len = 1;
}
if ((!strncmp(locale, "/\x03:", 3)) &&
(!strcmp(&locale[len - 2], ";/"))) {
locale += 3;
len -= 5;
}
locale = strdup(locale);
if (locale) {
locale[len] = 0;
}
return locale;
#else
char *locale;
locale = setlocale(LC_CTYPE, "");
if (locale && *locale) {
return strdup(locale);
}
return strdup("C");
#endif
}
#if defined(IRIX)
const char *CHARCONVTABLE[] =
{
"! This table maps the host's locale names to IANA charsets",
"!",
"C: ISO_8859-1:1987",
"cs: ISO_8859-2:1987",
"da: ISO_8859-1:1987",
"de: ISO_8859-1:1987",
"de_AT: ISO_8859-1:1987",
"de_CH: ISO_8859-1:1987",
"en: ISO_8859-1:1987",
"en_AU: ISO_8859-1:1987",
"en_CA: ISO_8859-1:1987",
"en_TH: ISO_8859-1:1987",
"en_US: ISO_8859-1:1987",
"es: ISO_8859-1:1987",
"fi: ISO_8859-1:1987",
"fr: ISO_8859-1:1987",
"fr_BE: ISO_8859-1:1987",
"fr_CA: ISO_8859-1:1987",
"fr_CH: ISO_8859-1:1987",
"is: ISO_8859-1:1987",
"it: ISO_8859-1:1987",
"it_CH: ISO_8859-1:1987",
"ja_JP.EUC: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ko_KR.euc: EUC-KR",
"nl: ISO_8859-1:1987",
"nl_BE: ISO_8859-1:1987",
"no: ISO_8859-1:1987",
"pl: ISO_8859-2:1987",
"pt: ISO_8859-1:1987",
"sh: ISO_8859-2:1987",
"sk: ISO_8859-2:1987",
"sv: ISO_8859-1:1987",
"zh_CN.ugb: GB2312",
"zh_TW.ucns: cns11643_1",
NULL
};
#elif defined(SOLARIS)
const char *CHARCONVTABLE[] =
{
"! This table maps the host's locale names to IANA charsets",
"!",
"C: ISO_8859-1:1987",
"ja: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ja_JP.EUC: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ja_JP.PCK: Shift_JIS",
"en: ISO_8859-1:1987",
"en_AU: ISO_8859-1:1987",
"en_CA: ISO_8859-1:1987",
"en_UK: ISO_8859-1:1987",
"en_US: ISO_8859-1:1987",
"es: ISO_8859-1:1987",
"es_AR: ISO_8859-1:1987",
"es_BO: ISO_8859-1:1987",
"es_CL: ISO_8859-1:1987",
"es_CO: ISO_8859-1:1987",
"es_CR: ISO_8859-1:1987",
"es_EC: ISO_8859-1:1987",
"es_GT: ISO_8859-1:1987",
"es_MX: ISO_8859-1:1987",
"es_NI: ISO_8859-1:1987",
"es_PA: ISO_8859-1:1987",
"es_PE: ISO_8859-1:1987",
"es_PY: ISO_8859-1:1987",
"es_SV: ISO_8859-1:1987",
"es_UY: ISO_8859-1:1987",
"es_VE: ISO_8859-1:1987",
"fr: ISO_8859-1:1987",
"fr_BE: ISO_8859-1:1987",
"fr_CA: ISO_8859-1:1987",
"fr_CH: ISO_8859-1:1987",
"de: ISO_8859-1:1987",
"de_AT: ISO_8859-1:1987",
"de_CH: ISO_8859-1:1987",
"nl: ISO_8859-1:1987",
"nl_BE: ISO_8859-1:1987",
"it: ISO_8859-1:1987",
"sv: ISO_8859-1:1987",
"no: ISO_8859-1:1987",
"da: ISO_8859-1:1987",
"iso_8859_1: ISO_8859-1:1987",
"japanese: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ko: EUC-KR",
"zh: GB2312",
"zh_TW: cns11643_1",
NULL
};
#elif defined(OSF1)
const char *CHARCONVTABLE[] =
{
"! This table maps the host's locale names to IANA charsets",
"!",
"C: ISO_8859-1:1987",
"cs_CZ.ISO8859-2: ISO_8859-2:1987",
"cs_CZ: ISO_8859-2:1987",
"da_DK.ISO8859-1: ISO_8859-1:1987",
"de_CH.ISO8859-1: ISO_8859-1:1987",
"de_DE.ISO8859-1: ISO_8859-1:1987",
"en_GB.ISO8859-1: ISO_8859-1:1987",
"en_US.ISO8859-1: ISO_8859-1:1987",
"es_ES.ISO8859-1: ISO_8859-1:1987",
"fi_FI.ISO8859-1: ISO_8859-1:1987",
"fr_BE.ISO8859-1: ISO_8859-1:1987",
"fr_CA.ISO8859-1: ISO_8859-1:1987",
"fr_CH.ISO8859-1: ISO_8859-1:1987",
"fr_FR.ISO8859-1: ISO_8859-1:1987",
"hu_HU.ISO8859-2: ISO_8859-2:1987",
"hu_HU: ISO_8859-2:1987",
"is_IS.ISO8859-1: ISO_8859-1:1987",
"it_IT.ISO8859-1: ISO_8859-1:1987",
"ja_JP.SJIS: Shift_JIS",
"ja_JP.eucJP: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ja_JP: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ko_KR.eucKR: EUC-KR",
"ko_KR: EUC-KR",
"nl_BE.ISO8859-1: ISO_8859-1:1987",
"nl_NL.ISO8859-1: ISO_8859-1:1987",
"no_NO.ISO8859-1: ISO_8859-1:1987",
"pl_PL.ISO8859-2: ISO_8859-2:1987",
"pl_PL: ISO_8859-2:1987",
"pt_PT.ISO8859-1: ISO_8859-1:1987",
"sk_SK.ISO8859-2: ISO_8859-2:1987",
"sk_SK: ISO_8859-2:1987",
"sv_SE.ISO8859-1: ISO_8859-1:1987",
"zh_CN: GB2312",
"zh_HK.big5: Big5",
"zh_HK.eucTW: cns11643_1",
"zh_TW.big5: Big5",
"zh_TW.big5@chuyin: Big5",
"zh_TW.big5@radical: Big5",
"zh_TW.big5@stroke: Big5",
"zh_TW.eucTW: cns11643_1",
"zh_TW.eucTW@chuyin: cns11643_1",
"zh_TW.eucTW@radical: cns11643_1",
"zh_TW.eucTW@stroke: cns11643_1",
"zh_TW: cns11643_1",
NULL
};
#elif defined(HPUX)
const char *CHARCONVTABLE[] =
{
"! This table maps the host's locale names to IANA charsets",
"!",
"C: ISO_8859-1:1987",
"ja_JP: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ja_JP.SJIS: Shift_JIS",
"ja_JP.eucJP: Extended_UNIX_Code_Packed_Format_for_Japanese",
"es_ES: ISO_8859-1:1987",
"es_ES.iso88591: ISO_8859-1:1987",
"sv_SE: ISO_8859-1:1987",
"sv_SE.iso88591: ISO_8859-1:1987",
"da_DK: ISO_8859-1:1987",
"da_DK.iso88591: ISO_8859-1:1987",
"nl_NL: ISO_8859-1:1987",
"nl_NL.iso88591: ISO_8859-1:1987",
"en: ISO_8859-1:1987",
"en_GB: ISO_8859-1:1987",
"en_GB.iso88591: ISO_8859-1:1987",
"en_US: ISO_8859-1:1987",
"en_US.iso88591: ISO_8859-1:1987",
"fi_FI: ISO_8859-1:1987",
"fi_FI.iso88591: ISO_8859-1:1987",
"fr_CA: ISO_8859-1:1987",
"fr_CA.iso88591: ISO_8859-1:1987",
"fr_FR: ISO_8859-1:1987",
"fr_FR.iso88591: ISO_8859-1:1987",
"de_DE: ISO_8859-1:1987",
"de_DE.iso88591: ISO_8859-1:1987",
"is_IS: ISO_8859-1:1987",
"is_IS.iso88591: ISO_8859-1:1987",
"it_IT: ISO_8859-1:1987",
"it_IT.iso88591: ISO_8859-1:1987",
"no_NO: ISO_8859-1:1987",
"no_NO.iso88591: ISO_8859-1:1987",
"pt_PT: ISO_8859-1:1987",
"pt_PT.iso88591: ISO_8859-1:1987",
"hu_HU: ISO_8859-2:1987",
"hu_HU.iso88592: ISO_8859-2:1987",
"cs_CZ: ISO_8859-2:1987",
"cs_CZ.iso88592: ISO_8859-2:1987",
"pl_PL: ISO_8859-2:1987",
"pl_PL.iso88592: ISO_8859-2:1987",
"ro_RO: ISO_8859-2:1987",
"ro_RO.iso88592: ISO_8859-2:1987",
"hr_HR: ISO_8859-2:1987",
"hr_HR.iso88592: ISO_8859-2:1987",
"sk_SK: ISO_8859-2:1987",
"sk_SK.iso88592: ISO_8859-2:1987",
"sl_SI: ISO_8859-2:1987",
"sl_SI.iso88592: ISO_8859-2:1987",
"american.iso88591: ISO_8859-1:1987",
"bulgarian: ISO_8859-2:1987",
"c-french.iso88591: ISO_8859-1:1987",
"chinese-s: GB2312",
"chinese-t.big5: Big5",
"czech: ISO_8859-2:1987",
"danish.iso88591: ISO_8859-1:1987",
"dutch.iso88591: ISO_8859-1:1987",
"english.iso88591: ISO_8859-1:1987",
"finnish.iso88591: ISO_8859-1:1987",
"french.iso88591: ISO_8859-1:1987",
"german.iso88591: ISO_8859-1:1987",
"hungarian: ISO_8859-2:1987",
"icelandic.iso88591: ISO_8859-1:1987",
"italian.iso88591: ISO_8859-1:1987",
"japanese.euc: Extended_UNIX_Code_Packed_Format_for_Japanese",
"japanese: Shift_JIS",
"katakana: Shift_JIS",
"korean: EUC-KR",
"norwegian.iso88591: ISO_8859-1:1987",
"polish: ISO_8859-2:1987",
"portuguese.iso88591: ISO_8859-1:1987",
"rumanian: ISO_8859-2:1987",
"serbocroatian: ISO_8859-2:1987",
"slovene: ISO_8859-2:1987",
"spanish.iso88591: ISO_8859-1:1987",
"swedish.iso88591: ISO_8859-1:1987",
NULL
};
#elif defined(AIX)
const char *CHARCONVTABLE[] =
{
"! This table maps the host's locale names to IANA charsets",
"!",
"C: ISO_8859-1:1987",
"En_JP.IBM-932: Shift_JIS",
"En_JP: Shift_JIS",
"Ja_JP.IBM-932: Shift_JIS",
"Ja_JP: Shift_JIS",
"da_DK.ISO8859-1: ISO_8859-1:1987",
"da_DK: ISO_8859-1:1987",
"de_CH.ISO8859-1: ISO_8859-1:1987",
"de_CH: ISO_8859-1:1987",
"de_DE.ISO8859-1: ISO_8859-1:1987",
"de_DE: ISO_8859-1:1987",
"en_GB.ISO8859-1: ISO_8859-1:1987",
"en_GB: ISO_8859-1:1987",
"en_JP.IBM-eucJP: Extended_UNIX_Code_Packed_Format_for_Japanese",
"en_JP: Extended_UNIX_Code_Packed_Format_for_Japanese",
"en_KR.IBM-eucKR: EUC-KR",
"en_KR: EUC-KR",
"en_TW.IBM-eucTW: cns11643_1",
"en_TW: cns11643_1",
"en_US.ISO8859-1: ISO_8859-1:1987",
"en_US: ISO_8859-1:1987",
"es_ES.ISO8859-1: ISO_8859-1:1987",
"es_ES: ISO_8859-1:1987",
"fi_FI.ISO8859-1: ISO_8859-1:1987",
"fi_FI: ISO_8859-1:1987",
"fr_BE.ISO8859-1: ISO_8859-1:1987",
"fr_BE: ISO_8859-1:1987",
"fr_CA.ISO8859-1: ISO_8859-1:1987",
"fr_CA: ISO_8859-1:1987",
"fr_CH.ISO8859-1: ISO_8859-1:1987",
"fr_CH: ISO_8859-1:1987",
"fr_FR.ISO8859-1: ISO_8859-1:1987",
"fr_FR: ISO_8859-1:1987",
"is_IS.ISO8859-1: ISO_8859-1:1987",
"is_IS: ISO_8859-1:1987",
"it_IT.ISO8859-1: ISO_8859-1:1987",
"it_IT: ISO_8859-1:1987",
"ja_JP.IBM-eucJP: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ja_JP: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ko_KR.IBM-eucKR: EUC-KR",
"ko_KR: EUC-KR",
"nl_BE.ISO8859-1: ISO_8859-1:1987",
"nl_BE: ISO_8859-1:1987",
"nl_NL.ISO8859-1: ISO_8859-1:1987",
"nl_NL: ISO_8859-1:1987",
"no_NO.ISO8859-1: ISO_8859-1:1987",
"no_NO: ISO_8859-1:1987",
"pt_PT.ISO8859-1: ISO_8859-1:1987",
"pt_PT: ISO_8859-1:1987",
"sv_SE.ISO8859-1: ISO_8859-1:1987",
"sv_SE: ISO_8859-1:1987",
"zh_TW.IBM-eucTW: cns11643_1",
"zh_TW: cns11643_1",
NULL
};
#else // sunos by default
const char *CHARCONVTABLE[] =
{
"! This table maps the host's locale names to IANA charsets",
"!",
"C: ISO_8859-1:1987",
"de: ISO_8859-1:1987",
"en_US: ISO_8859-1:1987",
"es: ISO_8859-1:1987",
"fr: ISO_8859-1:1987",
"iso_8859_1: ISO_8859-1:1987",
"it: ISO_8859-1:1987",
"ja: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ja_JP.EUC: Extended_UNIX_Code_Packed_Format_for_Japanese",
"japanese: Extended_UNIX_Code_Packed_Format_for_Japanese",
"ko: EUC-KR",
"sv: ISO_8859-1:1987",
"zh: GB2312",
"zh_TW: cns11643_1",
NULL
};
#endif
#define BSZ 256
char *
GetCharsetFromLocale(char *locale)
{
char *tmpcharset = NULL;
char buf[BSZ];
char *p;
const char *line;
int i=0;
line = CHARCONVTABLE[i];
while (line != NULL)
{
if (*line == 0)
{
break;
}
strcpy(buf, line);
line = CHARCONVTABLE[++i];
if (strlen(buf) == 0 || buf[0] == '!')
{
continue;
}
p = strchr(buf, ':');
if (p == NULL)
{
tmpcharset = NULL;
break;
}
*p = 0;
if (strcmp(buf, locale) == 0) {
while (*++p == ' ' || *p == '\t')
;
if (isalpha(*p)) {
tmpcharset = strdup(p);
} else
tmpcharset = NULL;
break;
}
}
return tmpcharset;
}
#endif /* Not defined XP_WIN32 */
#ifdef XP_WIN32
char *_convertor(const char *instr, int bFromUTF8)
{
char *outstr = NULL;
int inlen, wclen, outlen;
LPWSTR wcstr;
if (instr == NULL)
return NULL;
if ((inlen = strlen(instr)) <= 0)
return NULL;
/* output never becomes longer than input,
* thus we don't have to ask for the length
*/
wcstr = (LPWSTR) malloc( sizeof( WCHAR ) * (inlen+1) );
if (!wcstr)
return NULL;
wclen = MultiByteToWideChar(bFromUTF8 ? CP_UTF8 : CP_ACP, 0, instr,
inlen, wcstr, inlen);
outlen = WideCharToMultiByte(bFromUTF8 ? CP_ACP : CP_UTF8, 0, wcstr,
wclen, NULL, 0, NULL, NULL);
if (outlen > 0) {
outstr = (char *) malloc(outlen + 2);
outlen = WideCharToMultiByte(bFromUTF8 ? CP_ACP : CP_UTF8, 0, wcstr,
wclen, outstr, outlen, NULL, NULL);
if (outlen > 0)
*(outstr+outlen) = _T('\0');
else
return NULL;
}
free( wcstr );
return outstr;
}
#endif
char *
ldaptool_local2UTF8( const char *src )
{
char *utf8;
#ifndef XP_WIN32
char *locale, *newcharset;
size_t outLen, resultLen;
UErrorCode err = U_ZERO_ERROR;
UConverter *cnv;
if (src == NULL)
{
return NULL;
}
else if (*src == 0 || (ldaptool_charset == NULL)
|| (!strcmp( ldaptool_charset, "" )))
{
/* no charset specified, lets try to get charset from locale */
newcharset = (char *)ucnv_getDefaultName();
if (newcharset != NULL) {
/* the default codepage lives in ICU */
ldaptool_charset = strdup(newcharset);
if (ldaptool_charset == NULL) {
utf8 = strdup(src);
return utf8;
}
}
charsetset = 1;
}
if( !strcmp( ldaptool_charset, "0" ) && (!charsetset) ) {
/* zero option specified to override any conversions */
utf8 = strdup(src);
return utf8;
}
else
if( strcmp( ldaptool_charset, "" ) && (!charsetset) ) {
/* -i option specified with charset name */
charsetset = 1;
}
/* do the preflight - get the size needed for the target buffer */
outLen = (size_t) ucnv_convert( "utf-8", ldaptool_charset, NULL, 0, src,
strlen( src ) * sizeof(char), &err);
if ( ( U_FAILURE(err) ) && ( !icu_err_once ) ) {
if ( err == U_FILE_ACCESS_ERROR ) {
fprintf( stderr,
"\nWARNING: no converter found for charset: %s\n\n",
ldaptool_charset );
} else if ( err != U_BUFFER_OVERFLOW_ERROR) {
fprintf( stderr,
"\nWARNING: charset conversion failed in preflight: %s\n\n",
u_errorName(err) );
}
icu_err_once = 1;
}
if ((err != U_BUFFER_OVERFLOW_ERROR) || (outLen == 0)) {
/* default to just a copy of the string - this covers
the case of an illegal charset also */
return strdup(src);
}
utf8 = (char *) malloc( outLen + 1);
if( utf8 == NULL ) {
/* if we're already out of memory, does strdup just return NULL? */
return strdup(src);
}
/* do the actual conversion this time */
err = U_ZERO_ERROR;
resultLen = ucnv_convert( "utf-8", ldaptool_charset, utf8, (outLen + 1), src,
strlen(src) * sizeof(char), &err );
if (!U_SUCCESS(err)) {
if ( !icu_err_once ) {
fprintf( stderr, "\nWARNING: charset conversion failed: %s\n\n",
u_errorName(err) );
icu_err_once = 1;
}
free(utf8);
return strdup(src);
}
#else
utf8 = _convertor(src, FALSE);
if( utf8 == NULL )
utf8 = strdup(src);
#endif
return utf8;
}
#endif /* HAVE_LIBICU */
#ifndef HAVE_LIBICU
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,181 @@
# LDIF examples, taken from the specification which was found at:
# http://www.ietf.org/internet-drafts/draft-good-ldap-ldif-03.txt
# Example 1: An simple LDAP file with two entries
version: 1
dn: cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Barbara Jensen
cn: Barbara J Jensen
cn: Babs Jensen
sn: Jensen
uid: bjensen
telephonenumber: +1 408 555 1212
description: A big sailing fan.
dn: cn=Bjorn Jensen, ou=Accounting, dc=airius, dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Bjorn Jensen
sn: Jensen
telephonenumber: +1 408 555 1212
# Example 2: A file containing an entry with a folded attribute value
version: 1
dn:cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com
objectclass:top
objectclass:person
objectclass:organizationalPerson
cn:Barbara Jensen
cn:Barbara J Jensen
cn:Babs Jensen
sn:Jensen
uid:bjensen
telephonenumber:+1 408 555 1212
description:Babs is a big sailing fan, and travels extensively in search of
perfect sailing conditions.
title:Product Manager, Rod and Reel Division
# Example 3: A file containing a base-64-encoded value
version: 1
dn: cn=Gern Jensen, ou=Product Testing, dc=airius, dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Gern Jensen
cn: Gern O Jensen
sn: Jensen
uid: gernj
telephonenumber: +1 408 555 1212
description:: V2hhdCBhIGNhcmVmdWwgcmVhZGVyIHlvdSBhcmUhICBUaGlzIHZhbHVlIGlzIGJ
hc2UtNjQtZW5jb2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdGVyIGluIGl0ICh
hIENSKS4NICBCeSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQgb3V0IG1vcmUu
# Example 4: A file containing an entries with UTF-8-encoded attribute
# values, including language tags. Comments indicate the contents
# of UTF-8-encoded attributes and distinguished names.
version: 1
dn:: b3U95Za25qWt6YOoLG89QWlyaXVz
# dn:: ou=<JapaneseOU>,o=Airius
objectclass: top
objectclass: organizationalUnit
ou:: 5Za25qWt6YOo
# ou:: <JapaneseOU>
ou;lang-ja:: 5Za25qWt6YOo
# ou;lang-ja:: <JapaneseOU>
ou;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2
# ou;lang-ja:: <JapaneseOU_in_phonetic_representation>
ou;lang-en: Sales
description: Japanese office
dn:: dWlkPXJvZ2FzYXdhcmEsb3U95Za25qWt6YOoLG89QWlyaXVz
# dn:: uid=<uid>,ou=<JapaneseOU>,o=Airius
userpassword: {SHA}O3HSv1MusyL4kTjP+HKI5uxuNoM=
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
uid: rogasawara
mail: rogasawara@airius.co.jp
givenname;lang-ja:: 44Ot44OJ44OL44O8
# givenname;lang-ja:: <JapaneseGivenname>
sn;lang-ja:: 5bCP56yg5Y6f
# sn;lang-ja:: <JapaneseSn>
cn;lang-ja:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
# cn;lang-ja:: <JapaneseCn>
title;lang-ja:: 5Za25qWt6YOoIOmDqOmVtw==
# title;lang-ja:: <JapaneseTitle>
preferredlanguage: ja
givenname:: 44Ot44OJ44OL44O8
# givenname:: <JapaneseGivenname>
sn:: 5bCP56yg5Y6f
# sn:: <JapaneseSn>
cn:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
# cn:: <JapaneseCn>
title:: 5Za25qWt6YOoIOmDqOmVtw==
# title:: <JapaneseTitle>
givenname;lang-ja;phonetic:: 44KN44Gp44Gr44O8
# givenname;lang-ja;phonetic:: <JapaneseGivenname_in_phonetic_representation_kana>
sn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJ
# sn;lang-ja;phonetic:: <JapaneseSn_in_phonetic_representation_kana>
cn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJIOOCjeOBqeOBq+ODvA==
# cn;lang-ja;phonetic:: <JapaneseCn_in_phonetic_representation_kana>
title;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2IOOBtuOBoeOCh+OBhg==
# title;lang-ja;phonetic:: <JapaneseTitle_in_phonetic_representation_kana>
givenname;lang-en: Rodney
sn;lang-en: Ogasawara
cn;lang-en: Rodney Ogasawara
title;lang-en: Sales, Director
# Example 5: A file containing a reference to an external file
version: 1
dn: cn=Horatio Jensen, ou=Product Testing, dc=airius, dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Horatio Jensen
cn: Horatio N Jensen
sn: Jensen
uid: hjensen
telephonenumber: +1 408 555 1212
# XXXmcs: In the spec, the following line reads:
# jpegphoto:< file:///usr/local/directory/photos/hjensen.jpg
# I changed the file URL to point to a more generic directory.
jpegphoto:< file:///tmp/hjensen.jpg
# Example 6: A file containing a series of change records and comments
version: 1
# Add a new entry
dn: cn=Fiona Jensen, ou=Marketing, dc=airius, dc=com
changetype: add
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Fiona Jensen
sn: Jensen
uid: fiona
telephonenumber: +1 408 555 1212
# XXXmcs: In the spec, the following line reads:
# jpegphoto:< file:///usr/local/directory/photos/fiona.jpg
# I changed the file URL to point to a more generic directory.
jpegphoto:< file:///tmp/fiona.jpg
# Delete an existing entry
dn: cn=Robert Jensen, ou=Marketing, dc=airius, dc=com
changetype: delete
# Modify an entry's relative distinguished name
dn: cn=Paul Jensen, ou=Product Development, dc=airius, dc=com
changetype: modrdn
newrdn: cn=Paula Jensen
deleteoldrdn: 1
# Rename an entry and move all of its children to a new location in
# the directory tree (only implemented by LDAPv3 servers).
dn: ou=PD Accountants, ou=Product Development, dc=airius, dc=com
changetype: modrdn
newrdn: ou=Product Development Accountants
deleteoldrdn: 0
newsuperior: ou=Accounting, dc=airius, dc=com
# Modify an entry: add an additional value to the postaladdress attribute,
# completely delete the description attribute, replace the telephonenumber
# attribute with two values, and delete a specific value from the
# facsimiletelephonenumber attribute
dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com
changetype: modify
add: postaladdress
postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
-
delete: description
-
replace: telephonenumber
telephonenumber: +1 408 555 1234
telephonenumber: +1 408 555 5678
-
delete: facsimiletelephonenumber
facsimiletelephonenumber: +1 408 555 9876
-

View File

@ -0,0 +1,501 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* LDAP tools fileurl.c -- functions for handling file URLs.
* Used by ldapmodify.
*/
#include "ldaptool.h"
#include "fileurl.h"
#include <ctype.h> /* for isalpha() */
static int str_starts_with( const char *s, char *prefix );
static void hex_unescape( char *s );
static int unhex( char c );
static void strcpy_escaped_and_convert( char *s1, char *s2 );
static int berval_from_file( const char *path, struct berval *bvp,
int reporterrs );
/*
* Convert a file URL to a local path.
*
* If successful, LDAPTOOL_FILEURL_SUCCESS is returned and *localpathp is
* set point to an allocated string. If not, an different LDAPTOOL_FILEURL_
* error code is returned.
*
* See RFCs 1738 and 2396 for a specification for file URLs... but
* Netscape Navigator seems to be a bit more lenient in what it will
* accept, especially on Windows).
*
* This function parses file URLs of these three forms:
*
* file:///path
* file:/path
* file://localhost/path
* file://host/path (rejected with a ...NONLOCAL error)
*
* On Windows, we convert leading drive letters of the form C| to C:
* and if a drive letter is present we strip off the slash that precedes
* path. Otherwise, the leading slash is returned.
*
*/
int
ldaptool_fileurl2path( const char *fileurl, char **localpathp )
{
const char *path;
char *pathcopy;
/*
* Make sure this is a file URL we can handle.
*/
if ( !str_starts_with( fileurl, "file:" )) {
return( LDAPTOOL_FILEURL_NOTAFILEURL );
}
path = fileurl + 5; /* skip past "file:" scheme prefix */
if ( *path != '/' ) {
return( LDAPTOOL_FILEURL_MISSINGPATH );
}
++path; /* skip past '/' at end of "file:/" */
if ( *path == '/' ) {
++path; /* remainder is now host/path or /path */
if ( *path != '/' ) {
/*
* Make sure it is for the local host.
*/
if ( str_starts_with( path, "localhost/" )) {
path += 9;
} else {
return( LDAPTOOL_FILEURL_NONLOCAL );
}
}
} else { /* URL is of the form file:/path */
--path;
}
/*
* The remainder is now of the form /path. On Windows, skip past the
* leading slash if a drive letter is present.
*/
#ifdef _WINDOWS
if ( isalpha( path[1] ) && ( path[2] == '|' || path[2] == ':' )) {
++path;
}
#endif /* _WINDOWS */
/*
* Duplicate the path so we can safely alter it.
* Unescape any %HH sequences.
*/
if (( pathcopy = strdup( path )) == NULL ) {
return( LDAPTOOL_FILEURL_NOMEMORY );
}
hex_unescape( pathcopy );
#ifdef _WINDOWS
/*
* Convert forward slashes to backslashes for Windows. Also,
* if we see a drive letter / vertical bar combination (e.g., c|)
* at the beginning of the path, replace the '|' with a ':'.
*/
{
char *p;
for ( p = pathcopy; *p != '\0'; ++p ) {
if ( *p == '/' ) {
*p = '\\';
}
}
}
if ( isalpha( pathcopy[0] ) && pathcopy[1] == '|' ) {
pathcopy[1] = ':';
}
#endif /* _WINDOWS */
*localpathp = pathcopy;
return( LDAPTOOL_FILEURL_SUCCESS );
}
/*
* Convert a local path to a file URL.
*
* If successful, LDAPTOOL_FILEURL_SUCCESS is returned and *urlp is
* set point to an allocated string. If not, an different LDAPTOOL_FILEURL_
* error code is returned. At present, the only possible error is
* LDAPTOOL_FILEURL_NOMEMORY.
*
* This function produces file URLs of the form file:path.
*
* On Windows, we convert leading drive letters to C|.
*
*/
int
ldaptool_path2fileurl( char *path, char **urlp )
{
char *p, *url, *prefix ="file:";
if ( NULL == path ) {
path = "/";
}
/*
* Allocate space for the URL, taking into account that path may
* expand during the hex escaping process.
*/
if (( url = malloc( strlen( prefix ) + 3 * strlen( path ) + 1 )) == NULL ) {
return( LDAPTOOL_FILEURL_NOMEMORY );
}
strcpy( url, prefix );
p = url + strlen( prefix );
#ifdef _WINDOWS
/*
* On Windows, convert leading drive letters (e.g., C:) to the correct URL
* syntax (e.g., C|).
*/
if ( isalpha( path[0] ) && path[1] == ':' ) {
*p++ = path[0];
*p++ = '|';
path += 2;
*p = '\0';
}
#endif /* _WINDOWS */
/*
* Append the path, encoding any URL-special characters using the %HH
* convention.
* On Windows, convert backwards slashes in the path to forward ones.
*/
strcpy_escaped_and_convert( p, path );
*urlp = url;
return( LDAPTOOL_FILEURL_SUCCESS );
}
/*
* Populate *bvp from "value" of length "vlen."
*
* If recognize_url_syntax is non-zero, :<fileurl is recognized.
* If always_try_file is recognized and no file URL was found, an
* attempt is made to stat and read the value as if it were the name
* of a file.
*
* If reporterrs is non-zero, specific error messages are printed to
* stderr.
*
* If successful, LDAPTOOL_FILEURL_SUCCESS is returned and bvp->bv_len
* and bvp->bv_val are set (the latter is set to malloc'd memory).
* Upon failure, a different LDAPTOOL_FILEURL_ error code is returned.
*/
int
ldaptool_berval_from_ldif_value( const char *value, int vlen,
struct berval *bvp, int recognize_url_syntax, int always_try_file,
int reporterrs )
{
int rc = LDAPTOOL_FILEURL_SUCCESS; /* optimistic */
const char *url = NULL;
struct stat fstats;
/* recognize "attr :< url" syntax if LDIF version is >= 1 */
#ifdef notdef
if ( ldaptool_verbose ) {
fprintf( stderr, "%s: ldaptool_berval_from_ldif_value: value: %s\n",
ldaptool_progname, value);
}
#endif
if ( recognize_url_syntax && *value == '<' ) {
for ( url = value + 1; isspace( *url ); ++url ) {
; /* NULL */
}
if (strlen(url) > 7 && strncasecmp(url, "file://", 7) != 0) {
/*
* We only support file:// URLs for now.
*/
url = NULL;
}
}
if ( NULL != url ) {
char *path;
rc = ldaptool_fileurl2path( url, &path );
switch( rc ) {
case LDAPTOOL_FILEURL_NOTAFILEURL:
if ( reporterrs ) fprintf( stderr, "%s: unsupported URL \"%s\";"
" use a file:// URL instead.\n", ldaptool_progname, url );
break;
case LDAPTOOL_FILEURL_MISSINGPATH:
if ( reporterrs ) fprintf( stderr,
"%s: unable to process URL \"%s\" --"
" missing path.\n", ldaptool_progname, url );
break;
case LDAPTOOL_FILEURL_NONLOCAL:
if ( reporterrs ) fprintf( stderr,
"%s: unable to process URL \"%s\" -- only"
" local file:// URLs are supported.\n",
ldaptool_progname, url );
break;
case LDAPTOOL_FILEURL_NOMEMORY:
if ( reporterrs ) perror( "ldaptool_fileurl2path" );
break;
case LDAPTOOL_FILEURL_SUCCESS:
if ( stat( path, &fstats ) != 0 ) {
if ( reporterrs ) perror( path );
} else if ( fstats.st_mode & S_IFDIR ) {
if ( reporterrs ) fprintf( stderr,
"%s: %s is a directory, not a file\n",
ldaptool_progname, path );
rc = LDAPTOOL_FILEURL_FILEIOERROR;
} else {
rc = berval_from_file( path, bvp, reporterrs );
}
free( path );
break;
default:
if ( reporterrs ) fprintf( stderr,
"%s: unable to process URL \"%s\""
" -- unknown error\n", ldaptool_progname, url );
}
} else if ( always_try_file && (stat( value, &fstats ) == 0) &&
!(fstats.st_mode & S_IFDIR)) { /* get value from file */
rc = berval_from_file( value, bvp, reporterrs );
} else {
bvp->bv_len = vlen;
if (( bvp->bv_val = (char *)malloc( vlen + 1 )) == NULL ) {
if ( reporterrs ) perror( "malloc" );
rc = LDAPTOOL_FILEURL_NOMEMORY;
} else {
SAFEMEMCPY( bvp->bv_val, value, vlen );
bvp->bv_val[ vlen ] = '\0';
}
}
return( rc );
}
/*
* Map an LDAPTOOL_FILEURL_ error code to an LDAP error code (crude).
*/
int
ldaptool_fileurlerr2ldaperr( int lderr )
{
int rc;
switch( lderr ) {
case LDAPTOOL_FILEURL_SUCCESS:
rc = LDAP_SUCCESS;
break;
case LDAPTOOL_FILEURL_NOMEMORY:
rc = LDAP_NO_MEMORY;
break;
default:
rc = LDAP_PARAM_ERROR;
}
return( rc );
}
/*
* Populate *bvp with the contents of the file named by "path".
*
* If reporterrs is non-zero, specific error messages are printed to
* stderr.
*
* If successful, LDAPTOOL_FILEURL_SUCCESS is returned and bvp->bv_len
* and bvp->bv_val are set (the latter is set to malloc'd memory).
* Upon failure, a different LDAPTOOL_FILEURL_ error code is returned.
*/
static int
berval_from_file( const char *path, struct berval *bvp, int reporterrs )
{
FILE *fp;
long rlen;
int eof;
#if defined( XP_WIN32 )
char mode[20] = "r+b";
#else
char mode[20] = "r";
#endif
if (( fp = ldaptool_open_file( path, mode )) == NULL ) {
if ( reporterrs ) perror( path );
return( LDAPTOOL_FILEURL_FILEIOERROR );
}
if ( fseek( fp, 0L, SEEK_END ) != 0 ) {
if ( reporterrs ) perror( path );
fclose( fp );
return( LDAPTOOL_FILEURL_FILEIOERROR );
}
bvp->bv_len = ftell( fp );
if (( bvp->bv_val = (char *)malloc( bvp->bv_len + 1 )) == NULL ) {
if ( reporterrs ) perror( "malloc" );
fclose( fp );
return( LDAPTOOL_FILEURL_NOMEMORY );
}
if ( fseek( fp, 0L, SEEK_SET ) != 0 ) {
if ( reporterrs ) perror( path );
fclose( fp );
return( LDAPTOOL_FILEURL_FILEIOERROR );
}
rlen = fread( bvp->bv_val, 1, bvp->bv_len, fp );
eof = feof( fp );
fclose( fp );
if ( rlen != (long)bvp->bv_len ) {
if ( reporterrs ) perror( path );
free( bvp->bv_val );
return( LDAPTOOL_FILEURL_FILEIOERROR );
}
bvp->bv_val[ bvp->bv_len ] = '\0';
return( LDAPTOOL_FILEURL_SUCCESS );
}
/*
* Return a non-zero value if the string s begins with prefix and zero if not.
*/
static int
str_starts_with( const char *s, char *prefix )
{
size_t prefix_len;
if ( s == NULL || prefix == NULL ) {
return( 0 );
}
prefix_len = strlen( prefix );
if ( strlen( s ) < prefix_len ) {
return( 0 );
}
return( strncmp( s, prefix, prefix_len ) == 0 );
}
/*
* Remove URL hex escapes from s... done in place. The basic concept for
* this routine is borrowed from the WWW library HTUnEscape() routine.
*
* A similar function called nsldapi_hex_unescape can be found in
* ../../libraries/libldap/unescape.c
*/
static void
hex_unescape( char *s )
{
char *p;
for ( p = s; *s != '\0'; ++s ) {
if ( *s == '%' ) {
if ( *++s != '\0' ) {
*p = unhex( *s ) << 4;
}
if ( *++s != '\0' ) {
*p++ += unhex( *s );
}
} else {
*p++ = *s;
}
}
*p = '\0';
}
/*
* Return the integer equivalent of one hex digit (in c).
*
* A similar function can be found in ../../libraries/libldap/unescape.c
*/
static int
unhex( char c )
{
return( c >= '0' && c <= '9' ? c - '0'
: c >= 'A' && c <= 'F' ? c - 'A' + 10
: c - 'a' + 10 );
}
#define HREF_CHAR_ACCEPTABLE( c ) (( c >= '-' && c <= '9' ) || \
( c >= '@' && c <= 'Z' ) || \
( c == '_' ) || \
( c >= 'a' && c <= 'z' ))
/*
* Like strcat(), except if any URL-special characters are found in s2
* they are escaped using the %HH convention and backslash characters are
* converted to forward slashes on Windows.
*
* Maximum space needed in s1 is 3 * strlen( s2 ) + 1.
*
* A similar function that does not convert the slashes called
* strcat_escaped() can be found in ../../libraries/libldap/tmplout.c
*/
static void
strcpy_escaped_and_convert( char *s1, char *s2 )
{
char *p, *q;
char *hexdig = "0123456789ABCDEF";
p = s1 + strlen( s1 );
for ( q = s2; *q != '\0'; ++q ) {
#ifdef _WINDOWS
if ( *q == '\\' ) {
*p++ = '/';
} else
#endif /* _WINDOWS */
if ( HREF_CHAR_ACCEPTABLE( *q )) {
*p++ = *q;
} else {
*p++ = '%';
*p++ = hexdig[ 0x0F & ((*(unsigned char*)q) >> 4) ];
*p++ = hexdig[ 0x0F & *q ];
}
}
*p = '\0';
}

View File

@ -0,0 +1,84 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* LDAP tools fileurl.h -- defines for file URL functions.
* Used by ldapmodify.
*/
/*
* ldaptool_fileurl2path() convert a file URL to a local path.
*
* If successful, LDAPTOOL_FILEURL_SUCCESS is returned and *localpathp is
* set point to an allocated string. If not, a different LDAPTOOL_FILEURL_
* error code is returned.
*/
int ldaptool_fileurl2path( const char *fileurl, char **localpathp );
/*
* Convert a local path to a file URL.
*
* If successful, LDAPTOOL_FILEURL_SUCCESS is returned and *urlp is
* set point to an allocated string. If not, a different LDAPTOOL_FILEURL_
* error code is returned. At present, the only possible error is
* LDAPTOOL_FILEURL_NOMEMORY.
*
*/
int ldaptool_path2fileurl( char *path, char **urlp );
/*
* Populate *bvp from "value" of length "vlen."
*
* If recognize_url_syntax is non-zero, :<fileurl is recognized.
* If always_try_file is recognized and no file URL was found, an
* attempt is made to stat and read the value as if it were the name
* of a file.
*
* If reporterrs is non-zero, specific error messages are printed to
* stderr.
*
* If successful, LDAPTOOL_FILEURL_SUCCESS is returned and bvp->bv_len
* and bvp->bv_val are set (the latter is set to malloc'd memory).
* Upon failure, a different LDAPTOOL_FILEURL_ error code is returned.
*/
int ldaptool_berval_from_ldif_value( const char *value, int vlen,
struct berval *bvp, int recognize_url_syntax, int always_try_file,
int reporterrs );
/*
* Map an LDAPTOOL_FILEURL_ error code to an LDAP error code (crude).
*/
int ldaptool_fileurlerr2ldaperr( int lderr );
/*
* Possible return codes for the functions declared in this file:
*/
#define LDAPTOOL_FILEURL_SUCCESS 0
#define LDAPTOOL_FILEURL_NOTAFILEURL 1
#define LDAPTOOL_FILEURL_MISSINGPATH 2
#define LDAPTOOL_FILEURL_NONLOCAL 3
#define LDAPTOOL_FILEURL_NOMEMORY 4
#define LDAPTOOL_FILEURL_FILEIOERROR 5

View File

@ -0,0 +1,607 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* tool to compare the contents of two LDAP directory subtrees */
#include <__version.h>
#include "ldaptool.h"
typedef struct attr {
char *name;
char **vals;
struct attr *next;
} ATTR; /* used for comparing two entries */
static void options_callback( int option, char *optarg );
static int docompare( LDAP *ld1, LDAP *ld2, char *base );
static int cmp2(LDAP *ld1, LDAP *ld2, LDAPMessage *e1, int findonly );
static void notfound(char *base, int dbaseno);
ATTR* get_attrs( LDAP *ld, LDAPMessage *e );
char* cmp_attrs( ATTR *a1, ATTR *a2 );
static void attr_free(ATTR *at);
#if 0 /* these functions are not used */
static void print_entry( LDAP *ld, LDAPMessage *entry, int attrsonly );
static void print_dn( LDAP *ld, LDAPMessage *entry );
static int write_ldif_value( char *type, char *value, unsigned long vallen );
#endif /* 0 */
static void
usage( void )
{
fprintf( stderr,
"usage: %s -b basedn [options]\nwhere:\n",
ldaptool_progname );
fprintf( stderr, " basedn\tbase dn for search\n" );
fprintf( stderr, "\t\t(if the environment variable LDAP_BASEDN is set,\n" );
fprintf( stderr, "\t\tthen the -b flag is not required)\n" );
fprintf( stderr, "options:\n" );
fprintf( stderr, " -s scope\tone of base, one, or sub (default is sub)\n" );
fprintf( stderr, " -l timelim\ttime limit (in seconds) for search (default is no limit)\n" );
fprintf( stderr, " -z sizelim\tsize limit (in entries) for search (default is no limit)\n" );
ldaptool_common_usage( 1 );
exit( LDAP_PARAM_ERROR );
}
static char *base = NULL;
static int allow_binary, vals2tmp, ldif, scope, deref, differ=0;
static int attrsonly, timelimit, sizelimit;
#if 0 /* these statics are referenced only by unused functions */
static char *sep = LDAPTOOL_DEFSEP;
static char **sortattr = NULL;
static int *skipsortattr = NULL;
static int includeufn;
#endif /* 0 */
int
main( int argc, char **argv )
{
int rc, optind;
LDAP *ld1, *ld2;
#ifdef notdef
#ifdef HPUX11
#ifndef __LP64__
_main( argc, argv);
#endif /* __LP64_ */
#endif /* HPUX11 */
#endif
deref = LDAP_DEREF_NEVER;
allow_binary = vals2tmp = attrsonly = 0;
ldif = 1;
sizelimit = timelimit = 0;
scope = LDAP_SCOPE_SUBTREE;
optind = ldaptool_process_args( argc, argv, "Bb:l:s:z:", 0,
options_callback );
if ( optind == -1 ) {
usage();
}
if ( base == NULL ) {
if (( base = getenv( "LDAP_BASEDN" )) == NULL ) {
usage();
}
}
ld1 = ldaptool_ldap_init( 0 );
ldap_set_option( ld1, LDAP_OPT_DEREF, &deref );
ldap_set_option( ld1, LDAP_OPT_TIMELIMIT, &timelimit );
ldap_set_option( ld1, LDAP_OPT_SIZELIMIT, &sizelimit );
ldaptool_bind( ld1 );
ld2 = ldaptool_ldap_init( 1 );
ldap_set_option( ld2, LDAP_OPT_DEREF, &deref );
ldap_set_option( ld2, LDAP_OPT_TIMELIMIT, &timelimit );
ldap_set_option( ld2, LDAP_OPT_SIZELIMIT, &sizelimit );
ldaptool_bind( ld2 );
if ( ldaptool_verbose ) {
printf( "Connections to servers established. Beginning comparison.\n" );
}
rc = docompare( ld1, ld2, base );
ldaptool_cleanup( ld1 );
ldaptool_cleanup( ld2 );
if ( ldaptool_verbose && !rc ) {
if ( !differ ) {
printf( "compare completed: no differences found\n" );
} else {
printf( "compare completed: ****differences were found****\n" );
}
}
return( rc );
}
static void
options_callback( int option, char *optarg )
{
switch( option ) {
case 'B': /* allow binary values to be printed */
++allow_binary;
break;
case 's': /* search scope */
if ( strncasecmp( optarg, "base", 4 ) == 0 ) {
scope = LDAP_SCOPE_BASE;
} else if ( strncasecmp( optarg, "one", 3 ) == 0 ) {
scope = LDAP_SCOPE_ONELEVEL;
} else if ( strncasecmp( optarg, "sub", 3 ) == 0 ) {
scope = LDAP_SCOPE_SUBTREE;
} else {
fprintf( stderr, "scope should be base, one, or sub\n" );
usage();
}
break;
case 'b': /* searchbase */
base = strdup( optarg );
break;
case 'l': /* time limit */
timelimit = atoi( optarg );
break;
case 'z': /* size limit */
sizelimit = atoi( optarg );
break;
default:
usage();
break;
}
}
/*
* Returns an LDAP error code.
*/
static int
docompare( LDAP *ld1, LDAP *ld2, char *base )
{
int rc, msgid;
LDAPMessage *res, *e;
LDAPControl *ctrls[2], **serverctrls;
if ( ldaptool_verbose ) {
printf( "Base: %s\n\n", base );
}
if ( ldaptool_not ) {
return( LDAP_SUCCESS );
}
if (( ctrls[0] = ldaptool_create_manage_dsait_control()) != NULL ) {
ctrls[1] = NULL;
serverctrls = ctrls;
} else {
serverctrls = NULL;
}
if ( ldap_search_ext( ld1, base, scope, "objectClass=*", NULL,
0, serverctrls, NULL, NULL, -1, &msgid ) != LDAP_SUCCESS ) {
return( ldaptool_print_lderror( ld1, "ldap_search",
LDAPTOOL_CHECK4SSL_IF_APPROP ));
}
/* XXXmcs: this code should be modified to display referrals and references */
while ( (rc = ldap_result( ld1, LDAP_RES_ANY, 0, NULL, &res )) ==
LDAP_RES_SEARCH_ENTRY ) {
e = ldap_first_entry( ld1, res );
rc = cmp2( ld1, ld2, e , 0);
ldap_msgfree( res );
}
if ( rc == -1 ) {
return( ldaptool_print_lderror( ld1, "ldap_result",
LDAPTOOL_CHECK4SSL_IF_APPROP ));
}
if (( rc = ldap_result2error( ld1, res, 0 )) != LDAP_SUCCESS ) {
ldaptool_print_lderror( ld1, "ldap_search",
LDAPTOOL_CHECK4SSL_IF_APPROP );
}
ldap_msgfree( res );
if ( ldap_search_ext( ld2, base, scope, "objectClass=*", NULL,
0, serverctrls, NULL, NULL, -1, &msgid ) == -1 ) {
return( ldaptool_print_lderror( ld2, "ldap_search",
LDAPTOOL_CHECK4SSL_IF_APPROP ));
}
/* XXXmcs: this code should be modified to display referrals and references */
while ( (rc = ldap_result( ld2, LDAP_RES_ANY, 0, NULL, &res )) ==
LDAP_RES_SEARCH_ENTRY ) {
e = ldap_first_entry( ld2, res );
rc = cmp2( ld2, ld1, e , 1);
ldap_msgfree( res );
}
if ( rc == -1 ) {
return( ldaptool_print_lderror( ld2, "ldap_result",
LDAPTOOL_CHECK4SSL_IF_APPROP ));
}
if (( rc = ldap_result2error( ld1, res, 0 )) != LDAP_SUCCESS ) {
ldaptool_print_lderror( ld1, "ldap_search",
LDAPTOOL_CHECK4SSL_IF_APPROP );
}
ldap_msgfree( res );
return( rc );
}
/*
* Returns an LDAP error code.
*/
static int
cmp2( LDAP *ld1, LDAP *ld2, LDAPMessage *e1, int findonly)
{
LDAPMessage *e2, *res;
char *dn, *attrcmp;
int found=0, rc;
ATTR *a1, *a2;
dn = ldap_get_dn( ld1, e1 );
if ( ldaptool_verbose ) {
if ( findonly ) {
printf( "Checking that %s exists on both servers\n", dn );
} else {
printf("Comparing entry %s on both servers\n", dn );
}
}
if ( ldap_search( ld2, dn, LDAP_SCOPE_BASE, "objectClass=*", NULL, 0 ) == -1 ) {
return( ldaptool_print_lderror( ld2, "ldap_search",
LDAPTOOL_CHECK4SSL_IF_APPROP ));
}
/* XXXmcs: this code should be modified to display referrals and references */
while ( (rc = ldap_result( ld2, LDAP_RES_ANY, 0, NULL, &res )) ==
LDAP_RES_SEARCH_ENTRY ) {
e2 = ldap_first_entry( ld1, res );
found = 1;
if ( !findonly ) {
a1 = get_attrs( ld1, e1 );
a2 = get_attrs( ld2, e2 );
attrcmp = cmp_attrs( a1, a2 );
if ( strcmp( attrcmp, "") != 0 ) {
printf("\n%s%s\n", dn, attrcmp);
}
}
ldap_msgfree( res );
}
if ( !found ) {
notfound( dn, findonly );
differ = 1;
}
if ( rc == -1 ) {
return( ldaptool_print_lderror( ld2, "ldap_result",
LDAPTOOL_CHECK4SSL_IF_APPROP ));
}
ldap_msgfree( res );
ldap_memfree( dn );
return(rc);
}
ATTR*
get_attrs( LDAP *ld, LDAPMessage *e )
{
char *a;
ATTR *head, *tail, *tmp;
BerElement *ber;
head=tail=tmp=NULL;
for ( a = ldap_first_attribute( ld, e, &ber ); a != NULL;
a = ldap_next_attribute( ld, e, ber ) ) {
tmp = (ATTR*)malloc(sizeof(ATTR));
if(head == NULL)
head = tail = tmp;
else {
tail->next = tmp;
tail = tmp;
}
tmp->name = a;
tmp->vals = ldap_get_values( ld, e, a );
tmp->next = NULL;
}
if ( ber != NULL ) {
ber_free( ber, 0 );
}
/* used for debugging
tmp=head;
while(tmp!= NULL) {
printf("\n%s :", tmp->name);
for(i=0; tmp->vals[i] != NULL; i++)
printf("\n\t%d %s", i, tmp->vals[i]);
tmp = tmp->next;
}
*/
return(head);
}
char*
cmp_attrs( ATTR *a1, ATTR *a2 )
{
static char result[5000];
char res[1000], partial[1000], *name = "";
ATTR *head1, *head2, *tmp, *prev, *start;
int i, j, found;
head1 = a1;
head2 = a2;
tmp = a2;
prev = NULL;
strcpy(result, "");
while(head1 != NULL) {
name = head1->name;
if(head2 == NULL) {
while(head1 != NULL) {
sprintf(partial, "\ndifferent: %s(*)", head1->name);
strcat(result, partial);
for(i=0; head1->vals[i] != NULL; i++) {
sprintf(partial,"\n\t1: %s", head1->vals[i]);
strcat(result, partial);
}
tmp = head1;
head1 = head1->next;
attr_free(tmp);
}
differ = 1;
break;
}
name = head1->name;
start = tmp;
while(tmp != NULL) {
if(!strcmp(name, tmp->name)) { /* attr found */
strcpy(res, "");
for(i=0; (head1->vals[i]) != NULL; i++) {
found = 0;
for(j=0; (tmp->vals[j]) != NULL; j++)
if(!strcmp(head1->vals[i], tmp->vals[j])) {
found = 1;
tmp->vals[j][0] = 7;
break;
}
if(!found) {
sprintf(partial, "\n\t1: %s", head1->vals[i]);
strcat(res, partial);
}
}
for(j=0; tmp->vals[j] != NULL; j++)
if(tmp->vals[j][0] != 7){
sprintf(partial, "\n\t2: %s", tmp->vals[j]);
strcat(res, partial);
}
if(strcmp(res, "")) {
sprintf(partial, "\ndifferent: %s%s", name, res);
differ = 1;
strcat(result, partial);
}
if(prev == NULL) { /* tmp = head2 */
head2 = head2->next;
attr_free(tmp);
tmp = head2;
}
else {
prev->next = tmp->next;
attr_free(tmp);
tmp = prev->next;
if(tmp == NULL) {
tmp = head2;
prev = NULL;
}
}
break;
}
else { /* attr not found */
if(prev == NULL)
prev = head2;
else
prev = tmp;
tmp = tmp->next;
if(tmp == NULL) { /* end of list */
tmp = head2;
prev = NULL;
}
if(tmp == start) { /* attr !exist in 2 */
sprintf(partial, "\ndifferent: %s(*)", name);
differ = 1;
strcat(result, partial);
for(i=0; head1->vals[i] != NULL; i++) {
sprintf(partial, "\n\t1: %s", head1->vals[i]);
strcat(result, partial);
}
break;
}
}
}
start = head1;
head1 = head1->next;
attr_free(start);
}
while(head2 != NULL) {
sprintf(partial, "\ndifferent: %s(*)", head2->name);
differ = 1;
strcat(result, partial);
for(i=0; head2->vals[i] != NULL; i++) {
sprintf(partial, "\n\t2: %s", head2->vals[i]);
strcat(result, partial);
}
tmp = head2;
head2 = head2->next;
attr_free(tmp);
}
return(result);
}
static void
attr_free(ATTR *at)
{
ldap_memfree(at->name);
ldap_value_free(at->vals);
free(at);
}
static void
notfound(char *base, int dbaseno)
{
printf("%donly: %s\n", dbaseno+1, base);
}
#if 0 /* these function is not used */
/* used for debugging */
static void
print_dn( LDAP *ld, LDAPMessage *entry )
{
char *dn, *ufn;
dn = ldap_get_dn( ld, entry );
if ( ldif ) {
write_ldif_value( "dn", dn, strlen( dn ));
} else {
printf( "%s\n", dn );
}
if ( includeufn ) {
ufn = ldap_dn2ufn( dn );
if ( ldif ) {
write_ldif_value( "ufn", ufn, strlen( ufn ));
} else {
printf( "%s\n", ufn );
}
free( ufn );
}
ldap_memfree( dn );
}
static void
print_entry( ld, entry, attrsonly )
LDAP *ld;
LDAPMessage *entry;
int attrsonly;
{
char *a, *dn, *ufn, tmpfname[ 256 ];
int i, notascii;
BerElement *ber;
struct berval **bvals;
FILE *tmpfp;
#if defined( XP_WIN32 )
char mode[20] = "w+b";
#else
char mode[20] = "w";
#endif
dn = ldap_get_dn( ld, entry );
if ( ldif ) {
write_ldif_value( "dn", dn, strlen( dn ));
} else {
printf( "%s\n", dn );
}
if ( includeufn ) {
ufn = ldap_dn2ufn( dn );
if ( ldif ) {
write_ldif_value( "ufn", ufn, strlen( ufn ));
} else {
printf( "%s\n", ufn );
}
free( ufn );
}
ldap_memfree( dn );
for ( a = ldap_first_attribute( ld, entry, &ber ); a != NULL;
a = ldap_next_attribute( ld, entry, ber ) ) {
if ( ldap_charray_inlist(sortattr, a) && /* in the list*/
skipsortattr[ldap_charray_position(sortattr, a)] ) {/* and skip it*/
continue; /* so skip it! */
}
if ( attrsonly ) {
if ( ldif ) {
write_ldif_value( a, "", 0 );
} else {
printf( "%s\n", a );
}
} else if (( bvals = ldap_get_values_len( ld, entry, a )) != NULL ) {
for ( i = 0; bvals[i] != NULL; i++ ) {
if ( vals2tmp ) {
sprintf( tmpfname, "%s/ldapcmp-%s-XXXXXX",
ldaptool_get_tmp_dir(), a );
tmpfp = NULL;
if ( LDAPTOOL_MKTEMP( tmpfname ) == NULL ) {
perror( tmpfname );
} else if (( tmpfp = fopen( tmpfname, mode)) == NULL ) {
perror( tmpfname );
} else if ( fwrite( bvals[ i ]->bv_val,
bvals[ i ]->bv_len, 1, tmpfp ) == 0 ) {
perror( tmpfname );
} else if ( ldif ) {
write_ldif_value( a, tmpfname, strlen( tmpfname ));
} else {
printf( "%s%s%s\n", a, sep, tmpfname );
}
if ( tmpfp != NULL ) {
fclose( tmpfp );
}
} else {
notascii = 0;
if ( !ldif && !allow_binary ) {
notascii = !ldaptool_berval_is_ascii( bvals[ i ] );
}
if ( ldif ) {
write_ldif_value( a, bvals[ i ]->bv_val,
bvals[ i ]->bv_len );
} else {
printf( "%s%s%s\n", a, sep,
notascii ? "NOT ASCII" : bvals[ i ]->bv_val );
}
}
}
ber_bvecfree( bvals );
}
}
if ( ber != NULL ) {
ber_free( ber, 0 );
}
}
static int
write_ldif_value( char *type, char *value, unsigned long vallen )
{
char *ldif;
if (( ldif = ldif_type_and_value( type, value, (int)vallen )) == NULL ) {
return( -1 );
}
fputs( ldif, stdout );
free( ldif );
return( 0 );
}
#endif /* 0 */

View File

@ -0,0 +1,221 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* ldapdelete.c - simple program to delete an entry using LDAP */
#include <__version.h>
#include "ldaptool.h"
#include "fileurl.h"
static int contoper = 0;
static LDAP *ld;
static int ldapcompare_quiet = 0;
static int docompare( LDAP *ld, const char *dn, const char *attrtype,
const struct berval *bvalue, LDAPControl **serverctrls );
static void options_callback( int option, char *optarg );
static int typeval2berval( char *typeval, char **typep, struct berval *bvp );
static void
usage( int rc )
{
fprintf( stderr, "usage: %s [options] attributetype:value [dn...]\n",
ldaptool_progname );
fprintf( stderr, " %s [options] attributetype::base64value [dn...]\n",
ldaptool_progname );
fprintf( stderr, " %s [options] attributetype:<fileurl [dn...]\n",
ldaptool_progname );
fprintf( stderr, "options:\n" );
ldaptool_common_usage( 0 );
fprintf( stderr, " -c\t\tcontinuous mode (do not stop on errors)\n" );
fprintf( stderr, " -f file\tread DNs to compare against from file\n" );
fprintf( stderr, " -q\t\tbe quiet when comparing entries\n" );
exit( rc );
}
int
main( int argc, char **argv )
{
char buf[ 4096 ], *typeval = NULL, *type = NULL;
struct berval bv;
int rc, optind;
LDAPControl *ldctrl;
#ifdef notdef
#ifdef HPUX11
#ifndef __LP64__
_main( argc, argv);
#endif /* __LP64_ */
#endif /* HPUX11 */
#endif
optind = ldaptool_process_args( argc, argv, "cq", 0, options_callback );
if ( optind == -1 ) {
usage ( LDAP_PARAM_ERROR );
}
if ( ldaptool_fp == NULL && optind >= argc ) {
ldaptool_fp = stdin;
}
ld = ldaptool_ldap_init( 0 );
ldaptool_bind( ld );
if (( ldctrl = ldaptool_create_manage_dsait_control()) != NULL ) {
ldaptool_add_control_to_array( ldctrl, ldaptool_request_ctrls);
}
if ((ldctrl = ldaptool_create_proxyauth_control(ld)) !=NULL) {
ldaptool_add_control_to_array( ldctrl, ldaptool_request_ctrls);
}
if ( optind >= argc ) {
usage( LDAP_PARAM_ERROR );
}
typeval = ldaptool_local2UTF8( argv[optind] );
if (( rc = typeval2berval( typeval, &type, &bv )) != LDAP_SUCCESS ) {
fprintf( stderr, "%s: unable to parse \"%s\"\n",
ldaptool_progname, argv[optind] );
usage( rc );
free( typeval );
}
++optind;
rc = 0;
if ( ldaptool_fp == NULL ) {
for ( ; optind < argc &&
( contoper || !LDAPTOOL_RESULT_IS_AN_ERROR( rc ) );
++optind ) {
char *conv;
conv = ldaptool_local2UTF8( argv[ optind ] );
rc = docompare( ld, conv, type, &bv, ldaptool_request_ctrls );
if ( conv != NULL ) {
free( conv );
}
}
} else {
while (( contoper || !LDAPTOOL_RESULT_IS_AN_ERROR( rc )) &&
fgets(buf, sizeof(buf), ldaptool_fp) != NULL) {
buf[ strlen( buf ) - 1 ] = '\0'; /* remove trailing newline */
if ( *buf != '\0' ) {
rc = docompare( ld, buf, type, &bv, ldaptool_request_ctrls );
}
}
}
ldaptool_reset_control_array( ldaptool_request_ctrls );
ldaptool_cleanup( ld );
if ( typeval != NULL ) free( typeval );
if ( bv.bv_val != NULL ) free( bv.bv_val );
return( rc );
}
static void
options_callback( int option, char *optarg )
{
switch( option ) {
case 'c': /* continuous operation mode */
++contoper;
break;
case 'q': /* continuous operation mode */
++ldapcompare_quiet;
break;
default:
usage( LDAP_PARAM_ERROR );
}
}
static int
docompare( LDAP *ld, const char *dn, const char *attrtype,
const struct berval *bvalue, LDAPControl **serverctrls )
{
int rc;
if ( !ldapcompare_quiet ) {
char *valuestr, tmpbuf[256];
if ( ldaptool_berval_is_ascii( bvalue )) {
valuestr = bvalue->bv_val;
} else {
#ifdef HAVE_SNPRINTF
snprintf( tmpbuf, sizeof(tmpbuf), "NOT ASCII (%ld bytes)",
bvalue->bv_len );
#else
sprintf( tmpbuf, "NOT ASCII (%ld bytes)",
bvalue->bv_len );
#endif
valuestr = tmpbuf;
}
printf( "%scomparing type: \"%s\" value: \"%s\" in entry \"%s\"\n",
ldaptool_not ? "!" : "", attrtype, valuestr, dn );
}
if ( ldaptool_not ) {
rc = LDAP_COMPARE_TRUE;
} else {
rc = ldaptool_compare_ext_s( ld, dn, attrtype, bvalue,
serverctrls, NULL, "ldap_compare" );
if ( !ldapcompare_quiet ) {
if ( rc == LDAP_COMPARE_TRUE ) {
puts( "compare TRUE" );
} else if ( rc == LDAP_COMPARE_FALSE ) {
puts( "compare FALSE" );
}
}
}
return( rc );
}
/*
* Parse an ldapcompare type:value or type::value argument.
*
* The *typep is set to point into the typeval string.
* bvp->bv_val is created from malloc'd memory.
*
* This function returns an LDAP error code (LDAP_SUCCESS if all goes well).
*/
static int
typeval2berval( char *typeval, char **typep, struct berval *bvp )
{
char *value;
int vlen, rc;
if ( ldif_parse_line( typeval, typep, &value, &vlen ) != 0 ) {
return( LDAP_PARAM_ERROR );
}
rc = ldaptool_berval_from_ldif_value( value, vlen, bvp,
1 /* recognize file URLs */, 0 /* always try file */,
1 /* report errors */ );
return( ldaptool_fileurlerr2ldaperr( rc ));
}

View File

@ -0,0 +1,221 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* ldapdelete.c - simple program to delete an entry using LDAP */
#include <__version.h>
#include "ldaptool.h"
static int contoper;
#ifdef later
static int delbypasscmd, yestodelete;
#endif
static LDAP *ld;
LDAPMessage *result, *e;
char *my_filter = "(objectclass=*)";
static int dodelete( LDAP *ld, char *dn, LDAPControl **serverctrls );
static void options_callback( int option, char *optarg );
static void
usage( void )
{
fprintf( stderr, "usage: %s [options] [dn...]\n", ldaptool_progname );
fprintf( stderr, "options:\n" );
ldaptool_common_usage( 0 );
#ifdef later
fprintf( stderr, " -a\t\tBy-pass confirmation question when deleting a branch\n" );
#endif
fprintf( stderr, " -c\t\tcontinuous mode (do not stop on errors)\n" );
fprintf( stderr, " -f file\tread DNs to delete from file (default: standard input)\n" );
exit( LDAP_PARAM_ERROR );
}
int
main( int argc, char **argv )
{
char buf[ 4096 ];
int rc, deref, optind;
LDAPControl *ldctrl;
#ifdef notdef
#ifdef HPUX11
#ifndef __LP64__
_main( argc, argv);
#endif /* __LP64_ */
#endif /* HPUX11 */
#endif
contoper = 0;
#ifdef later
delbypasscmd = 0;
#endif
optind = ldaptool_process_args( argc, argv, "c", 0, options_callback );
if ( optind == -1 ) {
usage();
}
if ( ldaptool_fp == NULL && optind >= argc ) {
ldaptool_fp = stdin;
}
ld = ldaptool_ldap_init( 0 );
deref = LDAP_DEREF_NEVER; /* prudent, but probably unnecessary */
ldap_set_option( ld, LDAP_OPT_DEREF, &deref );
ldaptool_bind( ld );
if (( ldctrl = ldaptool_create_manage_dsait_control()) != NULL ) {
ldaptool_add_control_to_array( ldctrl, ldaptool_request_ctrls);
}
if ((ldctrl = ldaptool_create_proxyauth_control(ld)) !=NULL) {
ldaptool_add_control_to_array( ldctrl, ldaptool_request_ctrls);
}
if ( ldaptool_fp == NULL ) {
for ( ; optind < argc; ++optind ) {
char *conv;
conv = ldaptool_local2UTF8( argv[ optind ] );
rc = dodelete( ld, conv, ldaptool_request_ctrls );
if( conv != NULL ) {
free( conv );
}
}
} else {
rc = 0;
while ((rc == 0 || contoper) &&
fgets(buf, sizeof(buf), ldaptool_fp) != NULL) {
buf[ strlen( buf ) - 1 ] = '\0'; /* remove trailing newline */
if ( *buf != '\0' ) {
rc = dodelete( ld, buf, ldaptool_request_ctrls );
}
}
}
ldaptool_reset_control_array( ldaptool_request_ctrls );
ldaptool_cleanup( ld );
return( rc );
}
static void
options_callback( int option, char *optarg )
{
switch( option ) {
case 'c': /* continuous operation mode */
++contoper;
break;
default:
usage();
}
}
static int
dodelete( LDAP *ld, char *dn, LDAPControl **serverctrls )
{
int rc;
if ( ldaptool_verbose ) {
printf( "%sdeleting entry %s\n", ldaptool_not ? "!" : "", dn );
}
if ( ldaptool_not ) {
rc = LDAP_SUCCESS;
} else if (( rc = ldaptool_delete_ext_s( ld, dn, serverctrls, NULL,
"ldap_delete" )) == LDAP_SUCCESS && ldaptool_verbose ) {
printf( "entry removed\n" );
}
return( rc );
}
#ifdef later
/* This code broke iDS.....it will have to be revisited */
static int
dodelete( LDAP *ld, char *dn, LDAPControl **serverctrls )
{
int rc;
Head HeadNode;
Element *datalist;
char ch;
if ( ldaptool_verbose ) {
printf( "%sdeleting entry %s\n", ldaptool_not ? "!" : "", dn );
}
if ( ldaptool_not ) {
rc = LDAP_SUCCESS;
}
else { /* else 1 */
L_Init(&HeadNode);
if ( (rc = ldap_search_s( ld, dn, LDAP_SCOPE_SUBTREE, my_filter, NULL, 0, &result )) != LDAP_SUCCESS ) {
ldaptool_print_lderror( ld, "ldap_search", LDAPTOOL_CHECK4SSL_IF_APPROP );
}
else { /* else 2 */
for ( e = ldap_first_entry( ld, result ); e != NULL; e = ldap_next_entry( ld, e ) ) {
if ( ( dn = ldap_get_dn( ld, e ) ) != NULL ) {
datalist = (Element *)malloc(sizeof(Element));
datalist->data = dn;
L_Insert(datalist, &HeadNode);
}
}
if ( ((Head *)&HeadNode)->count > 1 ) {
yestodelete = 0;
if ( delbypasscmd == 0 ) {
printf( "Are you sure you want to delete the entire branch rooted at %s? [no]\n", (char *)((Element *)(((Head *)&HeadNode)->first))->data);
ch = getchar();
if ( (ch == 'Y') || (ch == 'y')) {
yestodelete = 1;
}
} else {
yestodelete = 1;
}
} else {
yestodelete = 1;
}
if ( yestodelete == 1 ) {
for ( datalist = ((Head *)&HeadNode)->last; datalist; datalist = datalist->left ) {
if (datalist) {
if ((rc = ldaptool_delete_ext_s( ld, (char *)datalist->data, serverctrls, NULL, "ldap_delete" )) == LDAP_SUCCESS && ldaptool_verbose ) {
printf( "%s entry removed\n", (char *)datalist->data );
}
L_Remove(datalist, (Head *)&HeadNode);
ldap_memfree(datalist->data);
free ( datalist );
}
}
} /* end if (yestodelete) */
} /* else 2 */
} /* else 1 */
return (rc);
} /* function end bracket */
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,170 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* ldapmodrdn.c - generic program to modify an entry's RDN using LDAP */
#include "ldaptool.h"
static int domodrdn( LDAP *ld, char *dn, char *rdn, int remove,
LDAPControl **serverctrls);
static void options_callback( int option, char *optarg );
static int contoper, remove_oldrdn;
static LDAP *ld;
static void
usage( void )
{
fprintf( stderr, "usage: %s [options] [dn rdn]\n", ldaptool_progname );
fprintf( stderr, "options:\n" );
ldaptool_common_usage( 0 );
fprintf( stderr, " -c\t\tcontinuous mode (do not stop on errors)\n" );
fprintf( stderr, " -r\t\tremove old RDN\n" );
fprintf( stderr, " -f file\tread changes from file\n" );
exit( LDAP_PARAM_ERROR );
}
int main( int argc, char **argv )
{
char *entrydn, *rdn, buf[ 4096 ];
int rc, havedn, deref, optind;
LDAPControl *ctrls[2], **serverctrls;
contoper = remove_oldrdn = 0;
optind = ldaptool_process_args( argc, argv, "cr", 0, options_callback );
if ( optind == -1 ) {
usage();
}
if ( ldaptool_fp == NULL ) {
ldaptool_fp = stdin;
}
havedn = 0;
if (argc - optind == 2) {
if (( rdn = strdup( argv[argc - 1] )) == NULL ) {
perror( "strdup" );
exit( LDAP_NO_MEMORY );
}
if (( entrydn = strdup( argv[argc - 2] )) == NULL ) {
perror( "strdup" );
exit( LDAP_NO_MEMORY );
}
++havedn;
} else if ( argc - optind != 0 ) {
fprintf( stderr, "%s: invalid number of arguments, only two allowed\n",
ldaptool_progname );
usage();
}
ld = ldaptool_ldap_init( 0 );
if ( !ldaptool_not ) {
deref = LDAP_DEREF_NEVER; /* this seems prudent */
ldap_set_option( ld, LDAP_OPT_DEREF, &deref );
}
ldaptool_bind( ld );
if (( ctrls[0] = ldaptool_create_manage_dsait_control()) != NULL ) {
ctrls[1] = NULL;
serverctrls = ctrls;
} else {
serverctrls = NULL;
}
rc = 0;
if (havedn) {
rc = domodrdn(ld, entrydn, rdn, remove_oldrdn, serverctrls);
} else while ((rc == 0 || contoper) &&
fgets(buf, sizeof(buf), ldaptool_fp) != NULL) {
if ( *buf != '\0' && *buf != '\n' ) { /* skip blank lines */
buf[ strlen( buf ) - 1 ] = '\0'; /* remove nl */
if ( havedn ) { /* have DN, get RDN */
if (( rdn = strdup( buf )) == NULL ) {
perror( "strdup" );
exit( LDAP_NO_MEMORY );
}
rc = domodrdn(ld, entrydn, rdn, remove_oldrdn, serverctrls);
havedn = 0;
} else if ( !havedn ) { /* don't have DN yet */
if (( entrydn = strdup( buf )) == NULL ) {
perror( "strdup" );
exit( LDAP_NO_MEMORY );
}
++havedn;
}
}
}
ldaptool_cleanup( ld );
exit( rc );
}
static void
options_callback( int option, char *optarg )
{
switch( option ) {
case 'c': /* continuous operation mode */
++contoper;
break;
case 'r': /* remove old RDN */
++remove_oldrdn;
break;
default:
usage();
}
}
static int
domodrdn( LDAP *ld, char *dn, char *rdn, int remove_oldrdn,
LDAPControl **serverctrls )
{
int i;
if ( ldaptool_verbose ) {
printf( "modrdn %s:\n\t%s\n", dn, rdn );
if (remove_oldrdn)
printf("removing old RDN\n");
else
printf("keeping old RDN\n");
}
if ( !ldaptool_not ) {
if (( i = ldaptool_rename_s( ld, dn, rdn, NULL, remove_oldrdn,
serverctrls, NULL, "ldap_rename" )) == LDAP_SUCCESS
&& ldaptool_verbose ) {
printf( "modrdn complete\n" );
}
} else {
i = LDAP_SUCCESS;
}
return( i );
}

View File

@ -0,0 +1,256 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 Sun LDAP C SDK.
*
* The Initial Developer of the Original Code is Sun Microsystems, Inc.
*
* Portions created by Sun Microsystems, Inc are Copyright (C) 2005
* Sun Microsystems, Inc. All Rights Reserved.
*
* Contributor(s): abobrov
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* ldappasswd.c - generic program to change LDAP users password
* by using password modify extended operation.
*/
#include <__version.h>
#include "ldaptool.h"
#include "fileurl.h"
static int prompt_old_password = 0;
static int prompt_new_password = 0;
static int is_file_old = 0;
static int is_file_new = 0;
static FILE *old_password_fp = NULL;
static FILE *new_password_fp = NULL;
static char *old_password_string = "Old Password: ";
static char *new_password_string = "New Password: ";
static char *re_new_password_string = "Re-enter new Password: ";
static struct berval genpasswd = { 0, NULL };
static struct berval oldpasswd = { 0, NULL };
static struct berval newpasswd = { 0, NULL };
static struct berval userid = { 0, NULL };
static void usage( void );
static void options_callback( int option, char *optarg );
static void
usage( void )
{
fprintf( stderr, "usage: %s [options] [user]\n", ldaptool_progname );
fprintf( stderr, "where:\n" );
fprintf( stderr, " user\tauthentication id\n" );
fprintf( stderr, " \te.g, uid=bjensen,dc=example,dc=com\n" );
fprintf( stderr, "options:\n" );
ldaptool_common_usage( 0 );
fprintf( stderr, " -a passwd\told password\n" );
fprintf( stderr, " -A\t\tprompt for old password\n" );
fprintf( stderr, " -t file\tread old password from 'file'\n" );
fprintf( stderr, " -s passwd\tnew password\n" );
fprintf( stderr, " -S\t\tprompt for new password\n" );
fprintf( stderr, " -T file\tread new password from 'file'\n" );
exit( LDAP_PARAM_ERROR );
}
int
main( int argc, char **argv )
{
int optind;
int rc = LDAP_SUCCESS; /* being superoptimistic for -n */
LDAP *ld;
#ifdef notdef
#ifdef HPUX11
#ifndef __LP64__
_main( argc, argv);
#endif /* __LP64_ */
#endif /* HPUX11 */
#endif
optind = ldaptool_process_args( argc, argv, "ASa:t:s:T:", 0, options_callback );
if ( (optind == -1) || (argc <= 1) ) {
usage();
}
if ( (argc - optind) >= 1 ) {
if ( argv[ optind ] ) {
if ( (userid.bv_val = ldaptool_local2UTF8(argv[ optind ]) ) == NULL ) {
fprintf( stderr, "%s: not enough memory\n", ldaptool_progname );
exit( LDAP_NO_MEMORY );
}
userid.bv_len = strlen( userid.bv_val );
++optind;
}
}
ld = ldaptool_ldap_init( 0 );
ldaptool_bind( ld );
if ( ldaptool_nobind && (userid.bv_val == NULL) && (userid.bv_len == 0) ) {
usage();
}
if ( !ldaptool_not ) {
rc = ldap_passwd_s( ld, userid.bv_val ? &userid : NULL,
oldpasswd.bv_val ? &oldpasswd : NULL,
newpasswd.bv_val ? &newpasswd : NULL,
&genpasswd, NULL, NULL );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, "ldap_passwd_s: %s\n",
ldap_err2string( rc ) );
} else {
fprintf( stderr, "%s: password successfully changed\n",
ldaptool_progname );
}
if ( (genpasswd.bv_val != NULL) && (genpasswd.bv_len != 0) ) {
fprintf( stderr, "New password: %s\n", genpasswd.bv_val );
}
}
ldaptool_cleanup( ld );
return( rc );
}
static void
options_callback( int option, char *optarg )
{
char *old_passwd = NULL;
char *new_passwd = NULL;
char *re_newpasswd = NULL;
switch( option ) {
case 'a': /* old password */
old_passwd = strdup( optarg );
if (NULL == old_passwd)
{
perror("malloc");
exit( LDAP_NO_MEMORY );
}
break;
case 'A': /* prompt old password */
prompt_old_password = 1;
break;
case 't': /* old password from file */
if ((old_password_fp = fopen( optarg, "r" )) == NULL ) {
fprintf(stderr, "%s: Unable to open '%s' file\n",
ldaptool_progname, optarg);
exit( LDAP_PARAM_ERROR );
}
is_file_old = 1;
break;
case 's': /* new password */
new_passwd = strdup( optarg );
if (NULL == new_passwd)
{
perror("malloc");
exit( LDAP_NO_MEMORY );
}
break;
case 'S': /* prompt new password */
prompt_new_password = 1;
break;
case 'T': /* new password from file */
if ((new_password_fp = fopen( optarg, "r" )) == NULL ) {
fprintf(stderr, "%s: Unable to open '%s' file\n",
ldaptool_progname, optarg);
exit( LDAP_PARAM_ERROR );
}
is_file_new = 1;
break;
default:
usage();
break;
}
if ( (oldpasswd.bv_val == NULL) && (oldpasswd.bv_len == 0)
&& (prompt_old_password) ) {
old_passwd = ldaptool_prompt_password( old_password_string );
} else if ( (oldpasswd.bv_val == NULL) && (oldpasswd.bv_len == 0)
&& (is_file_old) ) {
old_passwd = ldaptool_read_password( old_password_fp );
}
if ( old_passwd ) {
if ( !ldaptool_noconv_passwd ) {
oldpasswd.bv_val = ldaptool_local2UTF8( old_passwd );
} else {
oldpasswd.bv_val = strdup( old_passwd );
}
if (NULL == oldpasswd.bv_val)
{
perror("malloc");
exit( LDAP_NO_MEMORY );
}
oldpasswd.bv_len = strlen( oldpasswd.bv_val );
}
if ( (newpasswd.bv_val == NULL) && (newpasswd.bv_len == 0)
&& (prompt_new_password) ) {
try_again:
new_passwd = ldaptool_prompt_password( new_password_string );
re_newpasswd = ldaptool_prompt_password( re_new_password_string );
if ( (NULL == new_passwd) || (NULL == re_newpasswd) )
{
perror("malloc");
exit( LDAP_NO_MEMORY );
}
if ( (strncmp( new_passwd, re_newpasswd,
strlen( new_passwd ) ) ) ) {
fprintf( stderr,
"%s: They don't match.\n\nPlease try again\n",
ldaptool_progname );
free( re_newpasswd );
free( new_passwd );
re_newpasswd = NULL;
new_passwd = NULL;
goto try_again;
}
} else if ( (newpasswd.bv_val == NULL) && (newpasswd.bv_len == 0)
&& (is_file_new) ) {
new_passwd = ldaptool_read_password( new_password_fp );
}
if ( new_passwd ) {
if ( !ldaptool_noconv_passwd ) {
newpasswd.bv_val = ldaptool_local2UTF8( new_passwd );
} else {
newpasswd.bv_val = strdup( new_passwd );
}
if (NULL == newpasswd.bv_val) {
perror("malloc");
exit( LDAP_NO_MEMORY );
}
newpasswd.bv_len = strlen( newpasswd.bv_val );
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,219 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 Sun LDAP C SDK.
*
* The Initial Developer of the Original Code is Sun Microsystems, Inc.
*
* Portions created by Sun Microsystems, Inc are Copyright (C) 2005
* Sun Microsystems, Inc. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* File for ldaptool routines for SASL
*/
#include <ldap.h>
#include "ldaptool.h"
#include "ldaptool-sasl.h"
#include <sasl.h>
#include <stdio.h>
#ifdef HAVE_SASL_OPTIONS
#define SASL_PROMPT "SASL"
typedef struct {
char *mech;
char *authid;
char *username;
char *passwd;
char *realm;
} ldaptoolSASLdefaults;
static int get_default(ldaptoolSASLdefaults *defaults, sasl_interact_t *interact);
static int get_new_value(sasl_interact_t *interact, unsigned flags);
void *
ldaptool_set_sasl_defaults ( LDAP *ld, char *mech, char *authid, char *username,
char *passwd, char *realm )
{
ldaptoolSASLdefaults *defaults;
if ((defaults = calloc(sizeof(defaults[0]), 1)) == NULL)
return NULL;
if (mech)
defaults->mech = mech;
else
ldap_get_option(ld, LDAP_OPT_X_SASL_MECH, &defaults->mech);
if (authid)
defaults->authid = authid;
else
ldap_get_option(ld, LDAP_OPT_X_SASL_AUTHCID, &defaults->authid);
if (username)
defaults->username = username;
else
ldap_get_option(ld, LDAP_OPT_X_SASL_AUTHZID, &defaults->username);
defaults->passwd = passwd;
if (realm)
defaults->realm = realm;
else
ldap_get_option(ld, LDAP_OPT_X_SASL_REALM, &defaults->realm);
return defaults;
}
int
ldaptool_sasl_interact( LDAP *ld, unsigned flags, void *defaults, void *prompts ) {
sasl_interact_t *interact;
ldaptoolSASLdefaults *sasldefaults = defaults;
int rc;
if (prompts == NULL || flags != LDAP_SASL_INTERACTIVE)
return (LDAP_PARAM_ERROR);
for (interact = prompts; interact->id != SASL_CB_LIST_END; interact++) {
/* Obtain the default value */
if ((rc = get_default(sasldefaults, interact)) != LDAP_SUCCESS)
return (rc);
/* If no default, get the new value from stdin */
if (interact->result == NULL) {
if ((rc = get_new_value(interact, flags)) != LDAP_SUCCESS)
return (rc);
}
}
return (LDAP_SUCCESS);
}
static int
get_default(ldaptoolSASLdefaults *defaults, sasl_interact_t *interact) {
const char *defvalue = interact->defresult;
if (defaults != NULL) {
switch( interact->id ) {
case SASL_CB_AUTHNAME:
defvalue = defaults->authid;
break;
case SASL_CB_USER:
defvalue = defaults->username;
break;
case SASL_CB_PASS:
defvalue = defaults->passwd;
break;
case SASL_CB_GETREALM:
defvalue = defaults->realm;
break;
}
}
if (defvalue != NULL) {
interact->result = (char *)malloc(strlen(defvalue)+1);
strcpy((char *)interact->result,defvalue);
/* Clear passwd */
if (interact->id == SASL_CB_PASS && defaults != NULL) {
/* At this point defaults->passwd is not NULL */
memset( defaults->passwd, '\0', strlen(defaults->passwd));
defaults->passwd = NULL;
}
if ((char *)interact->result == NULL)
return (LDAP_NO_MEMORY);
interact->len = strlen((char *)(interact->result));
}
return (LDAP_SUCCESS);
}
static int
get_new_value(sasl_interact_t *interact, unsigned flags) {
char *newvalue, str[1024];
int len;
if (interact->id == SASL_CB_ECHOPROMPT || interact->id == SASL_CB_NOECHOPROMPT) {
if (interact->challenge)
fprintf(stderr, "Challenge:%s\n", interact->challenge);
}
#ifdef HAVE_SNPRINTF
snprintf(str, sizeof(str), "%s:", interact->prompt?interact->prompt:SASL_PROMPT);
#else
sprintf(str, "%s:", interact->prompt?interact->prompt:SASL_PROMPT);
#endif
/* Get the new value */
if (interact->id == SASL_CB_PASS || interact->id == SASL_CB_NOECHOPROMPT) {
#if defined(_WIN32)
char pbuf[257];
fputs(str,stdout);
fflush(stdout);
if (fgets(pbuf,256,stdin) == NULL) {
newvalue = NULL;
} else {
char *tmp;
tmp = strchr(pbuf,'\n');
if (tmp) *tmp = '\0';
tmp = strchr(pbuf,'\r');
if (tmp) *tmp = '\0';
newvalue = strdup(pbuf);
}
if ( newvalue == NULL) {
#else
#if defined(SOLARIS)
if ((newvalue = (char *)getpassphrase(str)) == NULL) {
#else
if ((newvalue = (char *)getpass(str)) == NULL) {
#endif
#endif
return (LDAP_UNAVAILABLE);
}
len = strlen(newvalue);
} else {
fputs(str, stderr);
if ((newvalue = fgets(str, sizeof(str), stdin)) == NULL)
return (LDAP_UNAVAILABLE);
len = strlen(str);
if (len > 0 && str[len - 1] == '\n')
str[len - 1] = 0;
}
interact->result = (char *) strdup(newvalue);
memset(newvalue, '\0', len);
if (interact->result == NULL)
return (LDAP_NO_MEMORY);
interact->len = len;
return (LDAP_SUCCESS);
}
#endif /* HAVE_SASL_OPTIONS */

View File

@ -0,0 +1,46 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 Sun LDAP C SDK.
*
* The Initial Developer of the Original Code is Sun Microsystems, Inc.
*
* Portions created by Sun Microsystems, Inc are Copyright (C) 2005
* Sun Microsystems, Inc. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _LDAPTOOL_SASL_H
#define _LDAPTOOL_SASL_H
/*
* Include file for ldaptool routines for SASL
*/
void *ldaptool_set_sasl_defaults ( LDAP *ld, char *mech, char *authid, char *username, char *passwd, char *realm );
int ldaptool_sasl_interact ( LDAP *ld, unsigned flags, void *defaults, void *p );
#endif /* _LDAPTOOL_SASL_H */

View File

@ -0,0 +1,214 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef _LDAPTOOL_H
#define _LDAPTOOL_H
/* XXX:mhein The following is a workaround for the redefinition of */
/* const problem on OSF. Fix to be provided by NSS */
/* This is a pretty benign workaround for us which */
/* should not cause problems in the future even if */
/* we forget to take it out :-) */
#ifdef OSF1V4D
#ifndef __STDC__
# define __STDC__
#endif /* __STDC__ */
#endif /* OSF1V4D */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#ifdef AIX
#include <strings.h>
#endif
#ifdef SCOOS
#include <sys/types.h>
#endif
#ifdef _WINDOWS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
extern int getopt (int argc, char *const *argv, const char *optstring);
#include <io.h> /* for _mktemp() */
#define LDAPTOOL_MKTEMP( p ) _mktemp( p )
#else
#include <sys/file.h>
#include <sys/stat.h>
#include <unistd.h>
#define LDAPTOOL_MKTEMP( p ) mktemp( p )
#endif
#ifdef LINUX
#include <getopt.h> /* not always included from unistd.h */
#endif
#include <ctype.h>
#ifndef SCOOS
#include <sys/types.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>
#if defined(NET_SSL)
#include <ssl.h>
#endif
#include <portable.h>
#include <ldap.h>
#ifndef NO_LIBLCACHE
#include <lcache.h>
#endif
#include <ldaplog.h>
#include <ldif.h>
#if defined(NET_SSL)
#include <ldap_ssl.h>
#endif
#include <ldappr.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* shared macros, structures, etc.
*/
#define LDAPTOOL_RESULT_IS_AN_ERROR( rc ) \
( (rc) != LDAP_SUCCESS && (rc) != LDAP_COMPARE_TRUE \
&& (rc) != LDAP_COMPARE_FALSE )
#define LDAPTOOL_DEFSEP "=" /* used by ldapcmp and ldapsearch */
#define LDAPTOOL_DEFHOST "localhost"
#define LDAPTOOL_DEFSSLSTRENGTH LDAPSSL_AUTH_CERT
#define LDAPTOOL_DEFCERTDBPATH "."
#define LDAPTOOL_DEFKEYDBPATH "."
#define LDAPTOOL_DEFREFHOPLIMIT 5
#define LDAPTOOL_SAFEREALLOC( ptr, size ) ( ptr == NULL ? malloc( size ) : \
realloc( ptr, size ))
/* this defines the max number of control requests for the tools */
#define CONTROL_REQUESTS 50
/*
* globals (defined in common.c)
*/
extern char *ldaptool_host;
extern char *ldaptool_host2;
extern int ldaptool_port;
extern int ldaptool_port2;
extern int ldaptool_verbose;
extern int ldaptool_not;
extern int ldaptool_nobind;
extern int ldaptool_noconv_passwd;
extern char *ldaptool_progname;
extern FILE *ldaptool_fp;
extern char *ldaptool_charset;
extern char *ldaptool_convdir;
extern LDAPControl *ldaptool_request_ctrls[];
/*
* function prototypes
*/
void ldaptool_common_usage( int two_hosts );
int ldaptool_process_args( int argc, char **argv, char *extra_opts,
int two_hosts, void (*extra_opt_callback)( int option, char *optarg ));
LDAP *ldaptool_ldap_init( int second_host );
void ldaptool_bind( LDAP *ld );
void ldaptool_cleanup( LDAP *ld );
int ldaptool_print_lderror( LDAP *ld, char *msg, int check4ssl );
#define LDAPTOOL_CHECK4SSL_NEVER 0
#define LDAPTOOL_CHECK4SSL_ALWAYS 1
#define LDAPTOOL_CHECK4SSL_IF_APPROP 2 /* if appropriate */
LDAPControl *ldaptool_create_manage_dsait_control( void );
void ldaptool_print_referrals( char **refs );
int ldaptool_print_extended_response( LDAP *ld, LDAPMessage *res, char *msg );
LDAPControl *ldaptool_create_proxyauth_control( LDAP *ld );
LDAPControl *ldaptool_create_geteffectiveRights_control ( LDAP *ld,
const char *authzid,
const char **attrlist );
void ldaptool_add_control_to_array( LDAPControl *ctrl, LDAPControl **array);
void ldaptool_reset_control_array( LDAPControl **array );
char *ldaptool_get_tmp_dir( void );
char *ldaptool_local2UTF8( const char * );
char *ldaptool_prompt_password( char *mod_password_string );
char *ldaptool_read_password( FILE *mod_password_fp );
int ldaptool_berval_is_ascii( const struct berval *bvp );
int ldaptool_sasl_bind_s( LDAP *ld, const char *dn, const char *mechanism,
const struct berval *cred, LDAPControl **serverctrls,
LDAPControl **clientctrls, struct berval **servercredp, char *msg );
int ldaptool_simple_bind_s( LDAP *ld, const char *dn, const char *passwd,
LDAPControl **serverctrls, LDAPControl **clientctrls, char *msg );
int ldaptool_add_ext_s( LDAP *ld, const char *dn, LDAPMod **attrs,
LDAPControl **serverctrls, LDAPControl **clientctrls, char *msg );
int ldaptool_modify_ext_s( LDAP *ld, const char *dn, LDAPMod **mods,
LDAPControl **serverctrls, LDAPControl **clientctrls, char *msg );
int ldaptool_delete_ext_s( LDAP *ld, const char *dn, LDAPControl **serverctrls,
LDAPControl **clientctrls, char *msg );
int ldaptool_rename_s( LDAP *ld, const char *dn, const char *newrdn,
const char *newparent, int deleteoldrdn, LDAPControl **serverctrls,
LDAPControl **clientctrls, char *msg );
int ldaptool_compare_ext_s( LDAP *ld, const char *dn, const char *attrtype,
const struct berval *bvalue, LDAPControl **serverctrls,
LDAPControl **clientctrls, char *msg );
int ldaptool_boolean_str2value ( const char *s, int strict );
int ldaptool_parse_ctrl_arg ( char *ctrl_arg, char sep, char **ctrl_oid,
int *ctrl_criticality, char **ctrl_value, int *vlen);
FILE * ldaptool_open_file(const char *filename, const char *mode);
/* Definition for list in ldapdelete.c */
typedef struct Element { /* double-linked list data type */
struct Element *right;
struct Element *left;
char *data;
} Element;
typedef struct { /* generic double-linked list head */
Element *first;
Element *last;
long count;
} Head;
void L_Init(Head *list);
void L_Insert(Element *Node, Head *HeadNode);
void L_Remove(Element *Node, Head *HeadNode);
#ifdef __cplusplus
}
#endif
#endif /* LDAPTOOL_H */

View File

@ -0,0 +1,259 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 Sun LDAP C SDK.
*
* The Initial Developer of the Original Code is Sun Microsystems, Inc.
*
* Portions created by Sun Microsystems, Inc are Copyright (C) 2005
* Sun Microsystems, Inc. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "ldaptool.h"
#include "list.h"
/* Initialize the pointer to the Head of the list
* The QHead is not allocated internally
*/
void q_init(QHead *list)
{
if(list)
{
list->first = NULL;
list->last = NULL;
list->nnodes = 0;
}
}
/* Append the node given to the end of the queue */
/* The node is NOT internally malloced */
void q_append(QElement *node, QHead *headNode)
{
if (!node || !headNode)
return;
node->next = NULL;
if (headNode->first == NULL)
{
node->prev= NULL;
headNode->last = headNode->first = node;
}
else
{
node->prev = headNode->last;
headNode->last = node->prev->next = node;
}
headNode->nnodes++;
}
/* Pre-pend the node given to the start of the queue */
/* The node is NOT internally malloced */
void q_prepend(QElement *node, QHead *headNode)
{
if(!node || !headNode )
return;
node->prev = NULL;
if((node->next = headNode->first) == NULL)
{
headNode->first = headNode->last = node;
}
else
{
headNode->first = node->next->prev = node;
}
headNode->nnodes++;
}
/* Find the node in the list - helper function */
void *q_find(QElement *node, QHead *headNode)
{
QElement *walker=NULL;
if(!node || !headNode)
return NULL;
for(walker = headNode->first; walker; walker = walker->next)
{
if(node == walker)
{
return walker;
}
}
return NULL;
}
/* Insert the element 1 (elem1) BEFORE element 2 (elem2) in the list */
/* It is assumed though there is no proof of this in any application code
* that the elem2 is already in the list and that ele1 is being inserted,
* positioning it before elem2
* If the elem1 already exits in the list, it is removed from its old position
* and then repositioned as follows:
* elem1 gets inserted before elem2
* elem1 gets prepended before elem2
*/
void q_before(QElement *elem1, QElement *elem2, QHead *headNode)
{
/* insert element 1 before element 2 now ----prepend it */
QElement *walker=NULL;
QElement *insertnode=NULL;
QElement *newnode = elem1;
if(!elem1 || !elem2 || !headNode )
return;
if((walker = (QElement *)q_find(elem2, headNode)) != NULL)
{
if((insertnode = (QElement *)q_find(elem1, headNode)) != NULL)
{
/* the node already exists in the list
remove the node and the proceed to add it
to the right spot in the list */
q_remove(insertnode, headNode);
}
if(headNode->first == walker)
{
/* elem 2 is the first node in the list
update the HeadNode pointers to point to the new node */
q_prepend(newnode, headNode );
return;
}
newnode->next = walker;
newnode->prev = walker->prev;
walker->prev->next = newnode;
walker->prev = newnode;
headNode->nnodes++;
}
}
/* Insert the element 1(elem1) after element 2 (elem2) in the list */
/* The semantics of these routines is determined from their use in
* the Universal Connector application
* It is assumed that element 2 is already in the list and that
* element 1 gets inserted after element 2
* If elem1 already exists in the list then the elem1 is removed and
* repostioned as follows:
* element 1 after element 2
* elem1 appened to elem2
*/
void q_after(QElement *elem1, QElement *elem2, QHead *headNode)
{
/* insert element 1 after element 2 now ----append after it */
QElement *walker = NULL;
QElement *insertnode = NULL;
QElement *newnode = elem1;
if(!elem1 || !elem2 || !headNode )
return;
if((walker = (QElement *)q_find(elem2, headNode)) != NULL)
{
if((insertnode = (QElement *)q_find(elem1, headNode)) != NULL)
{
/* the node already exists in the list
remove the node and the proceed to add it
to the right spot in the list */
q_remove(insertnode, headNode);
}
if(headNode->last == walker)
{
/* elem 2 is the last node in the list
update the headNode pointers */
q_append(newnode, headNode);
return;
}
newnode->next = walker->next;
walker->next->prev = newnode;
walker->next = newnode;
newnode->prev = walker;
headNode->nnodes++;
}
}
/* Remove the node from the list */
void q_remove(QElement *node, QHead *headNode)
{
QElement *walker = NULL;
QElement *prevnode = NULL;
if(!node || !headNode)
return;
for(walker = headNode->first; walker; walker = walker->next)
{
if(walker == node)
{
if(headNode->first == walker)
{
headNode->first = walker->next;
}
if(headNode->last == walker)
{
headNode->last = prevnode;
}
walker = walker->next;
if(prevnode != NULL)
{
prevnode->next = walker;
}
if(walker != NULL)
{
walker->prev = prevnode;
}
headNode->nnodes--;
return;
}
else /* walker != node */
{
prevnode = walker;
}
}
}
/* Move the node from list with HeadNode1 to list with HeadNode2 */
void q_move(QElement *node, QHead *headNode1, QHead *headNode2)
{
QElement *walker=NULL;
if((walker = (QElement *)q_find(node, headNode1)) != NULL)
{
q_remove(walker, headNode1);
q_append(walker, headNode2);
}
}

View File

@ -0,0 +1,70 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 Sun LDAP C SDK.
*
* The Initial Developer of the Original Code is Sun Microsystems, Inc.
*
* Portions created by Sun Microsystems, Inc are Copyright (C) 2005
* Sun Microsystems, Inc. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*************************************************************************
double linked list declaration
**************************************************************************/
typedef struct QElement { /* double-linked list data type */
struct QElement *next; /* pointer to next entry (NULL if none) */
struct QElement *prev; /* pointer to previous entry (NULL if none) */
char *buffer;
} QElement;
typedef struct { /* generic double-linked list head */
QElement *first; /* pointer to first entry (NULL if empty list) */
QElement *last; /* pointer to last entry (NULL if empty list) */
long nnodes;
} QHead;
void q_init(QHead *list);
void q_append(QElement *node, QHead *headNode);
void q_prepend(QElement *node, QHead *headNode);
void *q_find(QElement *node, QHead *headNode);
void q_after(QElement *elem1, QElement *elem2, QHead *headNode);
void q_before(QElement *ele1, QElement *ele2, QHead *headNode);
void q_remove(QElement *node, QHead *headNode);
void q_move(QElement *node, QHead *headNode1, QHead *headNode2);
/* The Qhead Node is passed in an allocated entity */
#define QInit(qh) q_init((QHead *)(qh))
#define QInsert(q, qh) q_append((QElement *)(q), (QHead *)(qh))
#define QAppend(q, qh) q_append((QElement *)(q), (QHead *)(qh))
#define QPrepend(q, qh) q_prepend((QElement *)(q), (QHead *)(qh))
#define QAfter(q1, q2, qh) q_after((QElement *)(q1), (QElement *)(q2), (QHead *)(qh))
#define QBefore(q1, q2, qh) q_before((QElement *)(q1), (QElement *)(q2), (QHead *)(qh))
#define QRemove(q, qh) q_remove((QElement *)(q), (QHead *)(qh))
#define QMove(q, from, to) q_move((QElement *)(q), (QHead *)(from), (QHead *)(to))

View File

@ -0,0 +1,115 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/******************************************************
*
* ntuserpin.c - Prompts for the key
* database passphrase.
*
******************************************************/
#if defined( _WIN32 ) && defined ( NET_SSL )
#include <conio.h>
#include "ntuserpin.h"
#undef Debug
#undef OFF
#undef LITTLE_ENDIAN
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
static int i=0;
static int cbRemotePassword = 0;
static const char nt_retryWarning[] =
"Warning: You entered an incorrect PIN.\nIncorrect PIN may result in disabling the token";
static const char prompt[] = "Enter PIN for";
#define SZ_LOCAL_PWD 1024
static char loclpwd[SZ_LOCAL_PWD] = "";
struct SVRCORENTUserPinObj
{
SVRCOREPinObj base;
};
static const struct SVRCOREPinMethods vtable;
/* ------------------------------------------------------------ */
SVRCOREError
SVRCORE_CreateNTUserPinObj(SVRCORENTUserPinObj **out)
{
SVRCOREError err = 0;
SVRCORENTUserPinObj *obj = 0;
do {
obj = (SVRCORENTUserPinObj*)malloc(sizeof (SVRCORENTUserPinObj));
if (!obj) { err = 1; break; }
obj->base.methods = &vtable;
} while(0);
if (err)
{
SVRCORE_DestroyNTUserPinObj(obj);
obj = 0;
}
*out = obj;
return err;
}
void
SVRCORE_DestroyNTUserPinObj(SVRCORENTUserPinObj *obj)
{
if (obj) free(obj);
}
static void destroyObject(SVRCOREPinObj *obj)
{
SVRCORE_DestroyNTUserPinObj((SVRCORENTUserPinObj*)obj);
}
static char *getPin(SVRCOREPinObj *obj, const char *tokenName, PRBool retry)
{
char *pwd;
int ch;
if (retry)
printf("%s\n",nt_retryWarning);
printf("%s %s:", prompt, tokenName);
pwd = &loclpwd[0];
do
{
ch = _getch();
*pwd++ = (char )ch;
} while( ch != '\r' && (pwd < &loclpwd[SZ_LOCAL_PWD - 1]));
*(pwd-1)='\0';
printf("\n");
/* test for zero length password. if zero length, return null */
if ('\0' == loclpwd[0])
return NULL;
return &loclpwd[0];
}
/*
* VTable
*/
static const SVRCOREPinMethods vtable =
{ 0, 0, destroyObject, getPin };
#endif /* defined( _WIN32 ) && defined ( NET_SSL ) */

View File

@ -0,0 +1,43 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/******************************************************
*
* ntuserpin.h - Prompts for the key
* database passphrase.
*
******************************************************/
#ifndef _NTUSERPIN_H_
#define _NTUSERPIN_H_
#include "svrcore.h"
typedef struct SVRCORENTUserPinObj SVRCORENTUserPinObj;
SVRCOREError
SVRCORE_CreateNTUserPinObj(SVRCORENTUserPinObj **out);
void
SVRCORE_SetNTUserPinInteractive(SVRCORENTUserPinObj *obj, PRBool interactive);
void
SVRCORE_DestroyNTUserPinObj(SVRCORENTUserPinObj *obj);
#endif

File diff suppressed because it is too large Load Diff

798
directory/c-sdk/ldap/configure vendored Executable file
View File

@ -0,0 +1,798 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# Defaults:
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
--enable-nspr-autoconf Enable building with an autoconf'ed NSPR tree"
# Initialize some variables set by options.
# The variables have the same names as the options, with
# dashes changed to underlines.
build=NONE
cache_file=./config.cache
exec_prefix=NONE
host=NONE
no_create=
nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
case "$ac_option" in
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) ac_optarg= ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case "$ac_option" in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir="$ac_optarg" ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build="$ac_optarg" ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file="$ac_optarg" ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
datadir="$ac_optarg" ;;
-disable-* | --disable-*)
ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
fi
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
eval "enable_${ac_feature}=no" ;;
-enable-* | --enable-*)
ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
fi
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
case "$ac_option" in
*=*) ;;
*) ac_optarg=yes ;;
esac
eval "enable_${ac_feature}='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix="$ac_optarg" ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he)
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat << EOF
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
--cache-file=FILE cache test results in FILE
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[same as prefix]
--bindir=DIR user executables in DIR [EPREFIX/bin]
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
--libexecdir=DIR program executables in DIR [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data in DIR
[PREFIX/share]
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data in DIR
[PREFIX/com]
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
--includedir=DIR C header files in DIR [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
--infodir=DIR info documentation in DIR [PREFIX/info]
--mandir=DIR man documentation in DIR [PREFIX/man]
--srcdir=DIR find the sources in DIR [configure dir or ..]
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM
run sed PROGRAM on installed program names
EOF
cat << EOF
Host type:
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [guessed]
--target=TARGET configure for TARGET [TARGET=HOST]
Features and packages:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--x-includes=DIR X include files are in DIR
--x-libraries=DIR X library files are in DIR
EOF
if test -n "$ac_help"; then
echo "--enable and --with options recognized:$ac_help"
fi
exit 0 ;;
-host | --host | --hos | --ho)
ac_prev=host ;;
-host=* | --host=* | --hos=* | --ho=*)
host="$ac_optarg" ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir="$ac_optarg" ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir="$ac_optarg" ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir="$ac_optarg" ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir="$ac_optarg" ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
| --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir="$ac_optarg" ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir="$ac_optarg" ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir="$ac_optarg" ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix="$ac_optarg" ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix="$ac_optarg" ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix="$ac_optarg" ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name="$ac_optarg" ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir="$ac_optarg" ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir="$ac_optarg" ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir="$ac_optarg" ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir="$ac_optarg" ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target="$ac_optarg" ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
echo "configure generated by autoconf version 2.13"
exit 0 ;;
-with-* | --with-*)
ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
fi
ac_package=`echo $ac_package| sed 's/-/_/g'`
case "$ac_option" in
*=*) ;;
*) ac_optarg=yes ;;
esac
eval "with_${ac_package}='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`echo $ac_option|sed -e 's/-*without-//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
fi
ac_package=`echo $ac_package| sed 's/-/_/g'`
eval "with_${ac_package}=no" ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes="$ac_optarg" ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries="$ac_optarg" ;;
-*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
;;
*)
if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
echo "configure: warning: $ac_option: invalid host type" 1>&2
fi
if test "x$nonopt" != xNONE; then
{ echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
fi
nonopt="$ac_option"
;;
esac
done
if test -n "$ac_prev"; then
{ echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
fi
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
# File descriptor usage:
# 0 standard input
# 1 file creation
# 2 errors and warnings
# 3 some systems may open it to /dev/tty
# 4 used on the Kubota Titan
# 6 checking for... messages and results
# 5 compiler messages saved in config.log
if test "$silent" = yes; then
exec 6>/dev/null
else
exec 6>&1
fi
exec 5>./config.log
echo "\
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
" 1>&5
# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing shell metacharacters.
ac_configure_args=
for ac_arg
do
case "$ac_arg" in
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c) ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
ac_configure_args="$ac_configure_args '$ac_arg'" ;;
*) ac_configure_args="$ac_configure_args $ac_arg" ;;
esac
done
# NLS nuisances.
# Only set these to C if already set. These must not be set unconditionally
# because not all systems understand e.g. LANG=C (notably SCO).
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
# Non-C LC_CTYPE values break the ctype check.
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo > confdefs.h
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
ac_unique_file=build/dirver.c
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
ac_prog=$0
ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
else
{ echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
fi
fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
echo "loading site script $ac_site_file"
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
echo "loading cache $cache_file"
. $cache_file
else
echo "creating cache $cache_file"
> $cache_file
fi
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
ac_exeext=
ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi
# Check whether --enable-nspr-autoconf or --disable-nspr-autoconf was given.
if test "${enable_nspr_autoconf+set}" = set; then
enableval="$enable_nspr_autoconf"
NSPR_USE_AUTOCONF=1
else
NSPR_USE_AUTOCONF=0
fi
MAKEFILES="
Makefile
build/Makefile
build/autoconf.mk
include/Makefile
libraries/Makefile
libraries/libldap/Makefile
libraries/liblber/Makefile
"
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
EOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
sed -n \
-e "s/'/'\\\\''/g" \
-e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
;;
esac >> confcache
if cmp -s $cache_file confcache; then
:
else
if test -w $cache_file; then
echo "updating cache $cache_file"
cat confcache > $cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# Any assignment to VPATH causes Sun make to only execute
# the first set of double-colon rules, so remove it if not needed.
# If there is a colon in the path, we need to keep it.
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
fi
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
cat > conftest.defs <<\EOF
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
s%\[%\\&%g
s%\]%\\&%g
s%\$%$$%g
EOF
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
rm -f conftest.defs
# Without the "./", some shells look in PATH for config.status.
: ${CONFIG_STATUS=./config.status}
echo creating $CONFIG_STATUS
rm -f $CONFIG_STATUS
cat > $CONFIG_STATUS <<EOF
#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
# $0 $ac_configure_args
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.
ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
for ac_option
do
case "\$ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
*) echo "\$ac_cs_usage"; exit 1 ;;
esac
done
ac_given_srcdir=$srcdir
trap 'rm -fr `echo "$MAKEFILES" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
# Protect against being on the right side of a sed subst in config.status.
sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
s%@exec_prefix@%$exec_prefix%g
s%@prefix@%$prefix%g
s%@program_transform_name@%$program_transform_name%g
s%@bindir@%$bindir%g
s%@sbindir@%$sbindir%g
s%@libexecdir@%$libexecdir%g
s%@datadir@%$datadir%g
s%@sysconfdir@%$sysconfdir%g
s%@sharedstatedir@%$sharedstatedir%g
s%@localstatedir@%$localstatedir%g
s%@libdir@%$libdir%g
s%@includedir@%$includedir%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
s%@NSPR_USE_AUTOCONF@%$NSPR_USE_AUTOCONF%g
CEOF
EOF
cat >> $CONFIG_STATUS <<\EOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=""
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
else
sed "${ac_end}q" conftest.subs > conftest.s$ac_file
fi
if test ! -s conftest.s$ac_file; then
ac_more_lines=false
rm -f conftest.s$ac_file
else
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f conftest.s$ac_file"
else
ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
fi
ac_file=`expr $ac_file + 1`
ac_beg=$ac_end
ac_end=`expr $ac_end + $ac_max_sed_cmds`
fi
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"$MAKEFILES"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
# Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dir_suffix.
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
else
ac_dir_suffix= ac_dots=
fi
case "$ac_given_srcdir" in
.) srcdir=.
if test -z "$ac_dots"; then top_srcdir=.
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
*) # Relative path.
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
echo creating "$ac_file"
rm -f "$ac_file"
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
case "$ac_file" in
*Makefile*) ac_comsub="1i\\
# $configure_input" ;;
*) ac_comsub= ;;
esac
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
sed -e "$ac_comsub
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*
EOF
cat >> $CONFIG_STATUS <<EOF
EOF
cat >> $CONFIG_STATUS <<\EOF
exit 0
EOF
chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1

View File

@ -0,0 +1,50 @@
dnl
dnl The contents of this file are subject to the Mozilla Public
dnl License Version 1.1 (the "License"); you may not use this file
dnl except in compliance with the License. You may obtain a copy of
dnl the License at http://www.mozilla.org/MPL/
dnl
dnl Software distributed under the License is distributed on an "AS
dnl IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
dnl implied. See the License for the specific language governing
dnl rights and limitations under the License.
dnl
dnl The Original Code is mozilla.org LDAP SDK autoconf glue.
dnl
dnl The Initial Developer of the Original Code is Netscape
dnl Communications Corp. Portions created by Netscape are
dnl Copyright (C) 2000, Netscape Communications Corp. All
dnl Rights Reserved.
dnl
dnl Contributor(s): Dan Mosedale <dmose@mozilla.org>
dnl
dnl Process this file with autoconf to produce a configure script.
AC_INIT(build/dirver.c)
dnl Checks for programs.
dnl Checks for libraries.
dnl Checks for header files.
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
dnl If the nsprpub whose configuration system we're using has been built with
dnl --enable-nspr-autoconf, we need to cope with that here.
dnl
AC_ARG_ENABLE(nspr-autoconf,
[ --enable-nspr-autoconf Enable building with an autoconf'ed NSPR tree],
NSPR_USE_AUTOCONF=1, NSPR_USE_AUTOCONF=0)
AC_SUBST(NSPR_USE_AUTOCONF)
dnl Generate output files
dnl
MAKEFILES="
Makefile
build/Makefile
build/autoconf.mk
include/Makefile
libraries/Makefile
libraries/libldap/Makefile
libraries/liblber/Makefile
"
AC_OUTPUT([$MAKEFILES])

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,170 @@
LDAP SDK for C Examples
-----------------------
This directory contains some sample LDAP code to help you understand
how to use the LDAP SDK for C. These examples are designed to work against
the sample data contained in the Sun[tm] Java[tm] System Directory Server
distribution. If you want to run these samples, you will need to have
a working LDAP server running, and the sample "example.com" data
loaded.
-----------------
Building examples
-----------------
There is a simple Makefile provided which is sufficient to build on
UNIX[R] platforms. If you are not building on a Solaris[tm] system,
comment out the Solaris section and uncomment the appropriate section
for your platform. If you are building on Windows it is best to build
using Cygwin like environment by invoking gmake -f win32.mak <target>.
Targets are same for all platforms. While "all" and "clean" are
standard ones, you can use each example name without ".c" extention as a
target to build a partucular example. See the Makefile/s for all details.
--------------------
Synchronous examples
--------------------
These samples use the synchronous LDAP calls. These calls are more
straightforward to use, and it's suggested you look at these examples
first. These calls will block the calling process until all results
have been returned, so they are probably not appropriate for use in a
client with a graphical user interface which relies an an event loop.
However, they're fine for command-line clients and CGI programs.
search.c
--------
Shows how to use ldap_search_s() to search for all entries which have
an attribute value which exactly matches what you're searching for. In
this example, all entries with the surname (last name) "Jensen" are
retrieved and displayed.
csearch.c
---------
Like search.c, but enables an in-memory cache.
ssnoauth.c
----------
Like search.c, but the search is done over SSL.
ssearch.c
---------
Like ssnoauth.c, but with certificate based authentication thrown in.
srvrsort.c
----------
Shows how to use server side sorting in conjunction with the
ldap_search_ext_s() function.
rdentry.c
---------
Shows how to use ldap_search_s() to retrieve a particular entry from the
directory. In this example, the entry:
uid=bjensen,ou=People,dc=example,dc=com
is retrieved and displayed.
getattrs.c
----------
Just like read.c, but retrieves specific attributes from an entry.
compare.c
---------
Show how to use ldap_compare_s(), which allows you to test if a particular
value is contained in an attribute of an entry.
modattrs.c
----------
Shows how to use ldap_modify_s() to replace and add to values in an attribute.
modrdn.c
--------
Shows how to use ldap_modrdn2_s() to change the relative distinguished name
(rdn) of an entry.
getfilt.c
---------
Shows how to use the ldap_getfilter family of routines, which help generate
LDAP filters based on an arbitrary search string provided by a user.
crtfilt.c
---------
Shows how to use the ldap_create_filter() function to generate LDAP filters.
authzid.c
---------
Shows how to get the authorization ID for an operation.
effright.c
----------
Shows how to get effective rights for a user.
pwdextop.c
----------
Shows how to change a password using the LDAP Password Modification
extended operation.
pwdpolicy.c
-----------
Shows how to get password policy information using the password
policy control.
realattr.c
----------
Shows how to return only real attributes from a search.
starttls.c
----------
Shows how to use the Start TLS extended operation.
userstatus.c
------------
Shows how to get account status using the account status control.
virtattr.c
----------
Shows how to return only virtual attributes from a search.
whoami.c
--------
Shows how to perform the Who am I? extended operation.
---------------------
Asynchronous examples
---------------------
These examples use the asynchronous LDAP calls. The general idea is that
you begin an operation, and then periodically poll to see if any results
have been returned.
asearch.c
---------
Initiates a search for entries, and polls for results, printing them as
they arrive.
nsprio.c
--------
Like asearch.c but using the prldap routines to incorporate NSPR.
add.c
------
Add an entry to the directory.
del.c
------
Delete an entry from the directory.
psearch.c
---------
Shows how to use the Persistent Search LDAPv3 protocol extension to
monitor a directory server for changes.
ppolicy.c
---------
Attempt to bind to the directory, and report back any password expiration
information received. This demonstrates how clients can process password
policy information that is optionally returned by Directory Server 3.0
and later.
------------------------------------------------------------------------
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
Use of this product is subject to license terms.

View File

@ -0,0 +1,180 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
* Use of this product is subject to license terms.
*/
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Add a new entry to the directory.
*
* Instead of calling the synchronous ldap_add_s() routine, we call
* the asynchronous routine ldap_add() and poll for results using
* ldap_result().
*
* Since it is an error to attempt to add an entry which already exists,
* you cannot run this example program twice in a row. You can use the
* adel.c example program to delete the entry which this example adds.
*
*/
#include "examples.h"
static void do_other_work();
unsigned long global_counter = 0;
static void free_mods( LDAPMod **mods );
#define NMODS 5
int
main( int argc, char **argv )
{
LDAP *ld;
LDAPMessage *result;
char *dn;
int i;
int rc;
int msgid;
int finished;
struct timeval zerotime;
LDAPMod **mods;
char *objectclass_values[] = { "top", "person", "organizationalPerson",
"inetOrgPerson", NULL };
char *cn_values[] = { "William B Jensen", "William Jensen", "Bill Jensen",
NULL };
char *sn_values[] = { "Jensen", NULL };
char *givenname_values[] = { "William", "Bill", NULL };
char *telephonenumber_values[] = { "+1 415 555 1212", NULL };
zerotime.tv_sec = zerotime.tv_usec = 0L;
/* Specify the DN we're adding */
dn = "cn=William B Jensen, " PEOPLE_BASE; /* see examples.h */
/* get a handle to an LDAP connection */
if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) {
perror( "ldap_init" );
return( 1 );
}
/* authenticate to the directory as the Directory Manager */
if ( ldap_simple_bind_s( ld, MGR_DN, MGR_PW ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_simple_bind_s" );
return( 1 );
}
/* Construct the array of values to add */
mods = ( LDAPMod ** ) malloc(( NMODS + 1 ) * sizeof( LDAPMod * ));
if ( mods == NULL ) {
fprintf( stderr, "Cannot allocate memory for mods array\n" );
}
for ( i = 0; i < NMODS; i++ ) {
if (( mods[ i ] = ( LDAPMod * ) malloc( sizeof( LDAPMod ))) == NULL ) {
fprintf( stderr, "Cannot allocate memory for mods element\n" );
exit( 1 );
}
}
mods[ 0 ]->mod_op = 0;
mods[ 0 ]->mod_type = "objectclass";
mods[ 0 ]->mod_values = objectclass_values;
mods[ 1 ]->mod_op = 0;
mods[ 1 ]->mod_type = "cn";
mods[ 1 ]->mod_values = cn_values;
mods[ 2 ]->mod_op = 0;
mods[ 2 ]->mod_type = "sn";
mods[ 2 ]->mod_values = sn_values;
mods[ 3 ]->mod_op = 0;
mods[ 3 ]->mod_type = "givenname";
mods[ 3 ]->mod_values = givenname_values;
mods[ 4 ]->mod_op = 0;
mods[ 4 ]->mod_type = "telephonenumber";
mods[ 4 ]->mod_values = telephonenumber_values;
mods[ 5 ] = NULL;
/* Initiate the add operation */
if (( msgid = ldap_add( ld, dn, mods )) < 0 ) {
ldap_perror( ld, "ldap_add" );
free_mods( mods );
return( 1 );
}
/* Poll for the result */
finished = 0;
while ( !finished ) {
rc = ldap_result( ld, msgid, LDAP_MSG_ONE, &zerotime, &result );
switch ( rc ) {
case -1:
/* some error occurred */
ldap_perror( ld, "ldap_result" );
free_mods( mods );
return( 1 );
case 0:
/* Timeout was exceeded. No entries are ready for retrieval */
break;
default:
/* Should be finished here */
finished = 1;
if (( rc = ldap_result2error( ld, result, 0 )) == LDAP_SUCCESS ) {
printf( "Entry added successfully. I counted to %ld "
"while waiting.\n", global_counter );
} else {
printf( "Error while adding entry: %s\n",
ldap_err2string( rc ));
}
ldap_msgfree( result );
}
do_other_work();
}
ldap_unbind( ld );
free_mods( mods );
return 0;
}
/*
* Free a mods array.
*/
static void
free_mods( LDAPMod **mods )
{
int i;
for ( i = 0; i < NMODS; i++ ) {
free( mods[ i ] );
}
free( mods );
}
/*
* Perform other work while polling for results. This doesn't do anything
* useful, but it could.
*/
static void
do_other_work()
{
global_counter++;
}

View File

@ -0,0 +1,156 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
* Use of this product is subject to license terms.
*/
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Search the directory for all people whose surname (last name) is
* "Jensen". Since the "sn" attribute is a caseignorestring (cis), case
* is not significant when searching.
*
* Instead of calling the synchronous ldap_search_s() routine, we call
* the asynchronous routine ldap_search() and poll for results using
* ldap_result().
*
*/
#include "examples.h"
static void do_other_work();
unsigned long global_counter = 0;
int
main( int argc, char **argv )
{
LDAP *ld;
LDAPMessage *result, *e;
BerElement *ber;
char *a, *dn;
char **vals;
int i;
int rc;
int finished;
int msgid;
int num_entries = 0;
struct timeval zerotime;
zerotime.tv_sec = zerotime.tv_usec = 0L;
/* get a handle to an LDAP connection */
if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) {
perror( "ldap_init" );
return( 1 );
}
/* authenticate to the directory as nobody */
if ( ldap_simple_bind_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_simple_bind_s" );
return( 1 );
}
/* search for all entries with surname of Jensen */
if (( msgid = ldap_search( ld, MY_SEARCHBASE, LDAP_SCOPE_SUBTREE,
MY_FILTER, NULL, 0 )) < 0 ) {
ldap_perror( ld, "ldap_search" );
return( 1 );
}
/* Loop, polling for results until finished */
finished = 0;
while ( !finished ) {
/*
* Poll for results. We call ldap_result with the "all" argument
* set to LDAP_MSG_ONE. This causes ldap_result() to return exactly one
* entry if at least one entry is available. This allows us to
* display the entries as they are received.
*/
result = NULL;
rc = ldap_result( ld, msgid, LDAP_MSG_ONE, &zerotime, &result );
switch ( rc ) {
case -1:
/* some error occurred */
ldap_perror( ld, "ldap_result" );
return( 1 );
case 0:
/* Timeout was exceeded. No entries are ready for retrieval. */
if ( result != NULL ) {
ldap_msgfree( result );
}
break;
default:
/*
* Either an entry is ready for retrieval, or all entries have
* been retrieved.
*/
if (( e = ldap_first_entry( ld, result )) == NULL ) {
/* All done */
finished = 1;
if ( result != NULL ) {
ldap_msgfree( result );
}
continue;
}
/* for each entry print out name + all attrs and values */
num_entries++;
if (( dn = ldap_get_dn( ld, e )) != NULL ) {
printf( "dn: %s\n", dn );
ldap_memfree( dn );
}
for ( a = ldap_first_attribute( ld, e, &ber );
a != NULL; a = ldap_next_attribute( ld, e, ber ) ) {
if (( vals = ldap_get_values( ld, e, a )) != NULL ) {
for ( i = 0; vals[ i ] != NULL; i++ ) {
printf( "%s: %s\n", a, vals[ i ] );
}
ldap_value_free( vals );
}
ldap_memfree( a );
}
if ( ber != NULL ) {
ber_free( ber, 0 );
}
printf( "\n" );
ldap_msgfree( result );
}
/* Do other work here while you are waiting... */
do_other_work();
}
/* All done. Print a summary. */
printf( "%d entries retrieved. I counted to %ld "
"while I was waiting.\n", num_entries,
global_counter );
ldap_unbind( ld );
return( 0 );
}
/*
* Perform other work while polling for results. This doesn't do anything
* useful, but it could.
*/
static void
do_other_work()
{
global_counter++;
}

View File

@ -0,0 +1,149 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 Sun LDAP C SDK.
*
* The Initial Developer of the Original Code is Sun Microsystems, Inc.
*
* Portions created by Sun Microsystems, Inc are Copyright (C) 2005
* Sun Microsystems, Inc. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* Get the authorization ID for an operation.
*/
#include "examples.h"
int
main( int argc, char **argv )
{
int version;
LDAP *ld;
int rc;
LDAPControl *authzidctrl = NULL;
LDAPControl *requestctrls[ 2 ];
int msgid;
LDAPMessage *result;
int parse_rc;
char *matched = NULL;
char *errmsg = NULL;
char **referrals;
LDAPControl **resultctrls = NULL;
char *authzid;
/* Use LDAPv3. */
version = LDAP_VERSION3;
if ( ldap_set_option( NULL, LDAP_OPT_PROTOCOL_VERSION, &version )
!= 0 ) {
fprintf( stderr,
"ldap_set_option protocol version to %d failed\n",
version );
return ( 1 );
}
/* Get a handle to an LDAP connection. */
if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) {
perror( "ldap_init" );
return( 1 );
}
/* Create a authorization ID control. */
rc = ldap_create_authzid_control( ld, 1, &authzidctrl );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, "ldap_create_authzid_control: %s\n",
ldap_err2string( rc ) );
ldap_unbind( ld );
return( 1 );
}
requestctrls[ 0 ] = authzidctrl;
requestctrls[ 1 ] = NULL;
/* Use the authorization ID control for the bind. */
rc = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, &authzidctrl );
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_set_option" );
return ( 1 );
}
/* Authenticate to the directory, checking for result controls. */
msgid = ldap_simple_bind( ld, ENTRYDN, ENTRYPW );
if ( msgid < 0 ) {
fprintf( stderr, "ldap_simple_bind: %s\n", ldap_err2string( rc ) );
if ( errmsg != NULL && errmsg != '\0' ) {
fprintf( stderr, "%s\n", errmsg );
}
ldap_unbind( ld );
return ( 1 );
}
rc = ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result );
if ( rc < 0 ) {
rc = ldap_get_lderrno( ld, NULL, NULL );
fprintf( stderr, "ldap_result: %s\n", ldap_err2string( rc ) );
ldap_unbind( ld );
return ( 1 );
}
parse_rc = ldap_parse_result( ld, result, &rc, &matched, &errmsg,
&referrals, &resultctrls, 0 );
if ( parse_rc != LDAP_SUCCESS ) {
fprintf( stderr, "ldap_parse_result: %s\n", ldap_err2string( rc ) );
ldap_unbind( ld );
return ( 1 );
}
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, "ldap_simple_bind: %s\n", ldap_err2string( rc ) );
if ( errmsg != NULL && errmsg != '\0' ) {
fprintf( stderr, "%s\n", errmsg );
}
}
if ( resultctrls == NULL ) {
fprintf( stderr, "No result control from server.\n" );
ldap_unbind( ld );
return ( 1 );
}
/* Show the authorization ID. */
parse_rc = ldap_parse_authzid_control( ld, resultctrls, &authzid );
if ( parse_rc != LDAP_SUCCESS ) {
fprintf( stderr, "ldap_parse_authzid_control: %s\n",
ldap_err2string( rc ) );
ldap_unbind( ld );
return ( 1 );
}
printf( "DN: %s\n", ENTRYDN );
printf( "Authz ID: %s\n", authzid );
ldap_msgfree( result );
ldap_control_free( authzidctrl );
ldap_controls_free( resultctrls );
ldap_unbind( ld );
return( 0 );
}

View File

@ -0,0 +1,89 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
* Use of this product is subject to license terms.
*/
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Use ldap_compare() to compare values agains values contained in entry
* ENTRYDN (defined in examples.h)
* We test to see if (1) the value "person" is one of the values in the
* objectclass attribute (it is), and if (2) the value "xyzzy" is in the
* objectlass attribute (it isn't, or at least, it shouldn't be).
*
*/
#include "examples.h"
int
main( int main, char **argv )
{
LDAP *ld;
int rc;
/* get a handle to an LDAP connection */
if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) {
perror( "ldap_init" );
return( 1 );
}
/* authenticate to the directory as nobody */
if ( ldap_simple_bind_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_simple_bind_s" );
return( 1 );
}
/* compare the value "person" against the objectclass attribute */
rc = ldap_compare_s( ld, ENTRYDN, "objectclass", "person" );
switch ( rc ) {
case LDAP_COMPARE_TRUE:
printf( "The value \"person\" is contained in the objectclass "
"attribute.\n" );
break;
case LDAP_COMPARE_FALSE:
printf( "The value \"person\" is not contained in the objectclass "
"attribute.\n" );
break;
default:
ldap_perror( ld, "ldap_compare_s" );
}
/* compare the value "xyzzy" against the objectclass attribute */
rc = ldap_compare_s( ld, ENTRYDN, "objectclass", "xyzzy" );
switch ( rc ) {
case LDAP_COMPARE_TRUE:
printf( "The value \"xyzzy\" is contained in the objectclass "
"attribute.\n" );
break;
case LDAP_COMPARE_FALSE:
printf( "The value \"xyzzy\" is not contained in the objectclass "
"attribute.\n" );
break;
default:
ldap_perror( ld, "ldap_compare_s" );
}
ldap_unbind( ld );
return( 0 );
}

View File

@ -0,0 +1,175 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
* Use of this product is subject to license terms.
*/
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Demonstrate use of the create filter function.
*/
#include "examples.h"
#define FILT_BUFSIZ 4096
struct filt_words {
char **f_words;
char *f_internal;
};
static int get_string_input( const char *prompt, const char *defaultval,
char *resultbuf );
static struct filt_words *val2words( const char *value, const char *delims );
static void freewords( struct filt_words *words );
int
main( int argc, char **argv )
{
int rc;
char patbuf[ FILT_BUFSIZ ];
char attrbuf[ FILT_BUFSIZ ], valuebuf[ FILT_BUFSIZ ];
char filtbuf[ FILT_BUFSIZ ];
struct filt_words *fwords;
patbuf[0] = attrbuf[0] = valuebuf[0] = '\0';
while ( 1 ) {
if ( get_string_input( "Enter a filter pattern: [%s] ", patbuf,
patbuf ) != 0 ) {
break;
}
if ( get_string_input( "Enter an attribute type: [%s] ", attrbuf,
attrbuf ) != 0 ) {
break;
}
if ( get_string_input( "Enter a value: [%s] ", valuebuf,
valuebuf ) != 0 ) {
break;
}
fwords = val2words( valuebuf, " " );
rc = ldap_create_filter( filtbuf, sizeof( filtbuf ), patbuf,
NULL, NULL, attrbuf, valuebuf, fwords->f_words );
freewords( fwords );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, "ldap_create_filter: failed (%d - %s)\n", rc,
ldap_err2string( rc ));
} else {
printf( "Resulting filter: %s\n", filtbuf );
}
putchar( '\n' );
}
return( 0 );
}
/*
* Prompt the user for a string. The entered string is placed in resultbuf.
* If a zero-length string is entered, i.e., if they just hit return, the
* contents of defaultval are copied to resultbuf.
* Returns 0 if all goes well and -1 if error or end of file.
*/
static int
get_string_input( const char *prompt, const char *defaultval, char *resultbuf )
{
char inbuf[ FILT_BUFSIZ ];
inbuf[0] = '\0';
printf( prompt, defaultval );
if ( fgets( inbuf, sizeof( inbuf ), stdin ) == NULL ) {
return( -1 );
}
inbuf[ strlen( inbuf ) - 1 ] = '\0'; /* strip trailing newline */
if ( inbuf[ 0 ] == '\0' ) { /* use default value */
if ( defaultval != resultbuf ) {
strcpy( resultbuf, defaultval );
}
} else { /* use newly entered value */
strcpy( resultbuf, inbuf );
}
return( 0 );
}
static struct filt_words *
val2words( const char *value, const char *delims )
{
struct filt_words *fw;
char *word;
int i;
if (( fw = calloc( 1, sizeof( struct filt_words ))) == NULL ||
( fw->f_internal = strdup( value )) == NULL ) {
perror( "calloc OR strdup" );
exit( 1 );
}
word = strtok( fw->f_internal, delims );
i = 0;
while ( word != NULL ) {
if ( fw->f_words == NULL ) {
fw->f_words = (char **)malloc( (i + 2 ) * sizeof( char * ));
} else {
fw->f_words = (char **)realloc( fw->f_words,
(i + 2 ) * sizeof( char * ));
}
if ( fw->f_words == NULL ) {
perror( "malloc OR realloc" );
exit( 1 );
}
fw->f_words[ i ] = word;
fw->f_words[ ++i ] = NULL;
word = strtok( NULL, delims );
}
if ( i > 0 ) {
fw->f_words[ i ] = NULL;
}
return( fw );
}
static void
freewords( struct filt_words *words )
{
if ( words != NULL ) {
if ( words->f_words != NULL ) {
free( words->f_words );
}
if ( words->f_internal != NULL ) {
free( words->f_internal );
}
free( words );
}
}

View File

@ -0,0 +1,141 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
* Use of this product is subject to license terms.
*/
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Enable the in-memory cache and then search the directory 10 times
* for all people whose surname (last name) is "Jensen". Since the
* "sn" attribute is a caseignorestring (cis), case is not significant
* when searching.
*
*/
#include "examples.h"
LDAP *ld;
LDAPMessage *result, *e;
BerElement *ber;
char *a, *dn;
char **vals;
int i, j;
LDAPMemCache *cacheHandle;
int memCache;
int mySearch();
int
main( int argc, char **argv )
{
/* get a handle to an LDAP connection */
if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) {
perror( "ldap_init" );
return( 1 );
}
memCache=ldap_memcache_init( 1800, 1024L * 1024, NULL, NULL, &cacheHandle );
switch ( memCache )
{
case LDAP_SUCCESS :
printf("LDAP_SUCCESS\n");
printf("LDAP_SUCCESS = %d\n", LDAP_SUCCESS);
printf("memCache = %d\n", memCache);
break;
case LDAP_PARAM_ERROR:
printf("LDAP_PARAM_ERROR\n");
break;
case LDAP_NO_MEMORY:
printf("LDAP_NO_MEMORY\n");
break;
case LDAP_SIZELIMIT_EXCEEDED:
printf("LDAP_SIZELIMITE_EXCEEDED\n");
break;
default :
printf("Unknown Error = %d\n", memCache);
break;
};
/* authenticate to the directory as nobody */
if ( ldap_simple_bind_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_simple_bind_s" );
ldap_unbind( ld );
return( 1 );
}
ldap_memcache_set( ld, cacheHandle );
for ( j = 0; j < 10; ++j ) {
#ifdef _WINDOWS
Sleep( 1000 );
#else
sleep( 1 );
#endif
mySearch();
}
ldap_memcache_destroy( cacheHandle );
ldap_unbind( ld );
return 0;
}
int mySearch()
{
/* search for all entries with surname of Jensen */
if ( ldap_search_s( ld, MY_SEARCHBASE, LDAP_SCOPE_SUBTREE,
MY_FILTER, NULL, 0, &result ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_search_s" );
if ( result == NULL ) {
ldap_unbind( ld );
return( 1 );
}
}
/* for each entry print out name + all attrs and values */
for ( e = ldap_first_entry( ld, result ); e != NULL;
e = ldap_next_entry( ld, e ) ) {
if ( (dn = ldap_get_dn( ld, e )) != NULL ) {
printf( "dn: %s\n", dn );
ldap_memfree( dn );
}
for ( a = ldap_first_attribute( ld, e, &ber );
a != NULL; a = ldap_next_attribute( ld, e, ber ) ) {
if ((vals = ldap_get_values( ld, e, a)) != NULL ) {
for ( i = 0; vals[i] != NULL; i++ ) {
printf( "%s: %s\n", a, vals[i] );
}
ldap_value_free( vals );
}
ldap_memfree( a );
}
if ( ber != NULL ) {
ber_free( ber, 0 );
}
printf( "\n" );
}
ldap_msgfree( result );
return( 0 );
}

View File

@ -0,0 +1,117 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
* Use of this product is subject to license terms.
*/
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Delete an entry from the directory.
*
* Instead of calling the synchronous ldap_delete_s() routine, we call
* the asynchronous routine ldap_delete() and poll for results using
* ldap_result().
*
* Since it is an error to attempt to delete an entry which does not
* exist, you cannot run this example until you have added the entry
* with the aadd.c example program.
*
*/
#include "examples.h"
static void do_other_work();
unsigned long global_counter = 0;
int
main( int argc, char **argv )
{
LDAP *ld;
LDAPMessage *result;
char *dn;
int rc;
int msgid;
int finished;
struct timeval zerotime;
zerotime.tv_sec = zerotime.tv_usec = 0L;
/* Specify the DN we're deleting */
dn = "cn=William B Jensen, " PEOPLE_BASE; /* see examples.h */
/* get a handle to an LDAP connection */
if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) {
perror( "ldap_init" );
return( 1 );
}
/* authenticate to the directory as the Directory Manager */
if ( ldap_simple_bind_s( ld, MGR_DN, MGR_PW ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_simple_bind_s" );
return( 1 );
}
/* Initiate the delete operation */
if (( msgid = ldap_delete( ld, dn )) < 0 ) {
ldap_perror( ld, "ldap_delete" );
return( 1 );
}
/* Poll for the result */
finished = 0;
while ( !finished ) {
rc = ldap_result( ld, msgid, LDAP_MSG_ONE, &zerotime, &result );
switch ( rc ) {
case -1:
/* some error occurred */
ldap_perror( ld, "ldap_result" );
return( 1 );
case 0:
/* Timeout was exceeded. No entries are ready for retrieval */
break;
default:
/* Should be finished here */
finished = 1;
if (( rc = ldap_result2error( ld, result, 0 )) == LDAP_SUCCESS ) {
printf( "Entry deleted successfully. I counted to %ld "
"while waiting.\n", global_counter );
} else {
printf( "Error while deleting entry: %s\n",
ldap_err2string( rc ));
}
ldap_msgfree( result );
}
do_other_work();
}
ldap_unbind( ld );
return 0;
}
/*
* Perform other work while polling for results. This doesn't do anything
* useful, but it could.
*/
static void
do_other_work()
{
global_counter++;
}

Some files were not shown because too many files have changed in this diff Show More