diff --git a/mozilla/directory/Makefile b/mozilla/directory/Makefile deleted file mode 100644 index 1d76a01c75d..00000000000 --- a/mozilla/directory/Makefile +++ /dev/null @@ -1,196 +0,0 @@ -# -# 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_DEPTH = . -NSPR_TREE = ../nsprpub -NSS_TREE = ../security -MOD_DEPTH = ../nsprpub -CORECONFDIR = ../coreconf -ALTCORECONFDIR = ../../coreconf -NSPR_VERSION = 4.1.2 -NSS_VERSION = 3.3.1 -DEPTH = .. -CONFIGDIR = c-sdk/config -MOD_DEPTH = c-sdk - -include $(CONFIGDIR)/config.mk -include c-sdk/build.mk - -all: FORCE - @echo - @echo The following are build targets that you can choose from: - @echo - @echo " gmake buildLdapClientSDK" - @echo " gmake clean" - @echo - @echo Allowed options: - @echo - @echo " BUILD_OPT=1 for optimized build" - @echo " USE_PTHREADS=1 for using pthreads" - @echo " USE_64=1 for building 64 bit versions" - @echo " BUILD_CLU=1 build command line utilities" - @echo " COMPS_FROM_OBJDIR=1 use components from ../dist/$(OBJDIR_NAME)" - @echo " VENDOR_NAME=string SDK vendor name (default $(DEFAULT_VENDOR_NAME))" - @echo " VENDOR_VERSION=# vendor specific version number * 100 (default $(DEFAULT_VENDOR_VERSION))" - @echo - @echo Internal options - @echo - @echo " gmake buildAndPkgLdapSDK" - @echo " gmake PullSDKComponents" - @echo " gmake pkgLdapSDK" - @echo - @echo " HAVE_LIBNLS=1 for building/linking with LIBNLS" - @echo " HAVE_CCONF=1 for building with components" - @echo " HAVE_SVRCORE=1 for building with svrcore" - @echo " DONT_REPULL=1 for not repulling components" - @echo " PKG_PRIVATE_HDRS=0 do not ship private headers" - @echo " PKG_PRIVATE_LIBS=0 do not ship private libraries" - @echo " PKG_DEP_LIBS=0 do not ship dependent libraries" - - @echo - @echo " For internal builds, coreconf must be installed" - @echo " in $(CORECONFDIR)" - -buildLdapClientSDK export: PullSDKComponents - @echo - @echo ==== Starting LDAP Client SDK ========== - @echo -ifneq ($(HAVE_CCONF), 1) - @if [ -d $(NSPR_TREE)/ ]; then \ - echo "NSPR $(NSPR_VERSION) directory found"; \ - else \ - echo "No NSPR $(NSPR_VERSION) directory found"; \ - fi - @if [ -d $(NSS_TREE)/ ]; then \ - echo "NSS $(NSS_VERSION) directory found"; \ - else \ - echo "No NSS $(NSS_VERSION) directory found"; \ - fi -else - @if [ -d $(CORECONFDIR)/ ]; then \ - echo "coreconf $(CORECONFDIR) directory found"; \ - else \ - echo "No $(CORECONFDIR) found checking for alternate location"; \ - if [ -d $(ALTCORECONFDIR)/ ]; then \ - echo "found $(ALTCORECONFDIR)....copying to $(CORECONFDIR)/"; \ - cp -r $(ALTCORECONFDIR) $(CORECONFDIR); \ - else \ - echo "No coreconf directory found"; \ - exit 1; \ - fi \ - fi - @if [ -d $(CORECONFDIR)/ ]; then \ - cd $(CORECONFDIR); \ - gmake; \ - else \ - echo "No $(CORECONFDIR) directory found"; \ - fi -endif - @if [ -d $(CONFIGDIR)/ ]; then \ - cd $(CONFIGDIR); \ - gmake; \ - else \ - echo "No $(CONFIGDIR) directory found"; \ - fi - @if [ -d $(LDAP_DEPTH)/c-sdk/ldap ]; then \ - cd $(LDAP_DEPTH)/c-sdk/ldap; \ - $(MAKE) -f Makefile.client $(MFLAGS) export; \ - $(MAKE) -f Makefile.client $(MFLAGS) install; \ - else \ - echo "No LDAP directory -- skipping"; \ - exit 0; \ - fi - -pkgLdapSDK: FORCE - @echo - @echo ==== Starting LDAP Client SDK packaging === - @echo - @if [ -d $(DIST_TREE)/ ]; then \ - cd $(LDAP_DEPTH)/c-sdk/; \ - $(MAKE) -f package.mk $(MFLAGS) all; \ - else \ - echo "No dist directory found -- can't package"; \ - exit 0; \ - fi - -buildAndPkgLdapSDK: buildLdapClientSDK pkgLdapSDK - -PullSDKComponents: FORCE - @echo - @echo ==== Starting to pull components ========== - @echo -ifneq ($(DONT_REPULL), 1) -ifeq ($(HAVE_CCONF), 1) - @if [ -d $(CORECONFDIR)/ ]; then \ - echo "coreconf $(CORECONFDIR) directory found"; \ - else \ - echo "No $(CORECONFDIR) found checking for alternate location"; \ - if [ -d $(ALTCORECONFDIR)/ ]; then \ - echo "found $(ALTCORECONFDIR)....copying to $(CORECONFDIR)/"; \ - cp -r $(ALTCORECONFDIR) $(CORECONFDIR); \ - else \ - echo "No coreconf directory found"; \ - exit 1; \ - fi \ - fi - @if [ -d $(CORECONFDIR)/ ]; then \ - cd $(CORECONFDIR); \ - gmake; \ - else \ - echo "No $(CORECONFDIR) directory found"; \ - fi -ifeq ($(OS_ARCH), WINNT) -# cd $(CORECONFDIR)/dbm; \ -# $(MAKE) VERSION=$(DBM_RELEASE_TAG) $(MFLAGS) USE_FTP=YES import - cd $(CORECONFDIR)/nspr20; \ - $(MAKE) VERSION=$(NSPR_RELEASE_TAG) $(MFLAGS) USE_FTP=YES import - cd $(CORECONFDIR)/security; \ - $(MAKE) VERSION=$(NSS_RELEASE_TAG) $(MFLAGS) USE_FTP=YES import - cd $(CORECONFDIR)/svrcore; \ - $(MAKE) VERSION=$(SVRCORE_RELEASE_TAG) $(MFLAGS) USE_FTP=YES import -else -# cd $(CORECONFDIR)/dbm; \ -# $(MAKE) VERSION=$(DBM_RELEASE_TAG) $(MFLAGS) import - cd $(CORECONFDIR)/nspr20; \ - $(MAKE) VERSION=$(NSPR_RELEASE_TAG) $(MFLAGS) import - cd $(CORECONFDIR)/security; \ - $(MAKE) VERSION=$(NSS_RELEASE_TAG) $(MFLAGS) import - cd $(CORECONFDIR)/svrcore; \ - $(MAKE) VERSION=$(SVRCORE_RELEASE_TAG) $(MFLAGS) import -endif -endif -endif - -clean clobber: FORCE - @if [ -d $(LDAP_DEPTH)/c-sdk/ldap ]; then \ - cd $(LDAP_DEPTH)/c-sdk/ldap; \ - $(MAKE) -f Makefile.client $(MFLAGS) clean; \ - else \ - echo "No LDAP directory -- skipping"; \ - exit 0; \ - fi - @if [ -d $(CONFIGDIR) ]; then \ - cd $(CONFIGDIR); \ - gmake cleanconfig; \ - fi - -FORCE: diff --git a/mozilla/directory/c-sdk/build.mk b/mozilla/directory/c-sdk/build.mk deleted file mode 100644 index 85cbe73784b..00000000000 --- a/mozilla/directory/c-sdk/build.mk +++ /dev/null @@ -1,489 +0,0 @@ -# -# 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): -# - -DEFAULT_VENDOR_NAME=mozilla.org -DEFAULT_VENDOR_VERSION=500 - -ifndef VENDOR_NAME -VENDOR_NAME = $(DEFAULT_VENDOR_NAME) -endif - -ifndef VENDOR_VERSION -VENDOR_VERSION = $(DEFAULT_VENDOR_VERSION) -endif - - -ifdef HAVE_CCONF -# component tags for internal build only -NSPR_RELEASE_TAG=v4.1.2 -NSS_RELEASE_TAG =NSS_3_3_1_RTM -SVRCORE_RELEASE_TAG=SVRCORE_3_3_RTM -# NSPR, NSS, and SVRCORE 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_1_RTM/forte6 -SVRCORE_RELEASE_TAG=SVRCORE_3_3_RTM/forte6 -endif -endif -endif -endif -endif - -# Ldap library -LDAPVERS = 50 -LDAPVERS_SUFFIX = 5.0 -ifeq ($(OS_ARCH), WINNT) -LDAP_LIBNAME = nsldap32v$(LDAPVERS) -else -LDAP_LIBNAME = ldap$(LDAPVERS) -endif -DIR_VERSION = $(LDAPVERS_SUFFIX) -DIRSDK_VERSION = $(LDAPVERS_SUFFIX) - -# PrLdap library -PRLDAPVERS = 50 -PRLDAPVERS_SUFFIX= 5.0 -ifeq ($(OS_ARCH), WINNT) -PRLDAP_LIBNAME = nsldappr32v$(PRLDAPVERS) -else -PRLDAP_LIBNAME = prldap$(PRLDAPVERS) -endif - -# lber library -LBERVERS = 50 -LBERVERS_SUFFIX = 5.0 -ifeq ($(OS_ARCH), WINNT) -LBER_LIBNAME = nslber32v$(LBERVERS) -else -LBER_LIBNAME = lber$(LBERVERS) -endif - -# ldif library -LDIFVERS = 50 -LDIFVERS_SUFFIX = 5.0 -ifeq ($(OS_ARCH), WINNT) -LDIF_LIBNAME = nsldif32v$(LDIFVERS) -else -LDIF_LIBNAME = ldif$(LDIFVERS) -endif - -# iutil library -IUTILVERS = 50 -IUTILVERS_SUFFIX = 5.0 -ifeq ($(OS_ARCH), WINNT) -IUTIL_LIBNAME = nsiutil32v$(IUTILVERS) -else -IUTIL_LIBNAME = iutil$(IUTILVERS) -endif - -# util library -UTILVERS = 50 -UTILVERS_SUFFIX = 5.0 -ifeq ($(OS_ARCH), WINNT) -UTIL_LIBNAME = nsutil32v$(UTILVERS) -else -UTIL_LIBNAME = util$(UTILVERS) -endif - -# ssl library -SSLDAPVERS = 50 -SSLDAPVERS_SUFFIX = 5.0 -ifeq ($(OS_ARCH), WINNT) -SSLDAP_LIBNAME = nsldapssl32v$(SSLDAPVERS) -else -SSLDAP_LIBNAME = ssldap$(SSLDAPVERS) -endif - -# nss library -NSSVERS = 3 -NSS_LIBNAME = nss$(NSSVERS) -SSL_LIBNAME = ssl$(NSSVERS) -HYBRID_LIBNAME = freebl_hybrid_$(NSSVERS) -PURE32_LIBNAME = freebl_pure32_$(NSSVERS) - -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 -# - -NSPR_LIBVERSION=4 -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) - -# -# NLS library -# -NLS_LIBVERSION =31 -LIBNLS_RELDATE=v3.2 -ifeq ($(OS_ARCH), WINNT) -NSCNV_LIBNAME =nscnv32$(NLS_LIBVERSION).$(LIB_SUFFIX) -NSJPN_LIBNAME =nsjpn32$(NLS_LIBVERSION).$(LIB_SUFFIX) -NSCCK_LIBNAME =nscck32$(NLS_LIBVERSION).$(LIB_SUFFIX) -NSSB_LIBNAME =nssb32$(NLS_LIBVERSION).$(LIB_SUFFIX) -else -NSCNV_LIBNAME =libnscnv$(NLS_LIBVERSION).$(LIB_SUFFIX) -NSJPN_LIBNAME =libnsjpn$(NLS_LIBVERSION).$(LIB_SUFFIX) -NSCCK_LIBNAME =libnscck$(NLS_LIBVERSION).$(LIB_SUFFIX) -NSSB_LIBNAME =libnssb$(NLS_LIBVERSION).$(LIB_SUFFIX) -endif - -ifdef RELEASE_TREE -LIBNLS_INCLUDES_LOC = $(RELEASE_TREE)/libnls$(NLS_LIBVERSION)/v3.2/$(OBJDIR_NAME)/include -LIBNLS_LIB_LOC = $(RELEASE_TREE)/libnls$(NLS_LIBVERSION)/v3.2/$(OBJDIR_NAME)/lib -else -LIBNLS_INCLUDES_LOC = /share/builds/components/libnls$(NLS_LIBVERSION)/v3.2/$(OBJDIR_NAME)/include -LIBNLS_LIB_LOC = /share/builds/components/libnls$(NLS_LIBVERSION)/v3.2/$(OBJDIR_NAME)/lib - -ifeq ($(OS_ARCH), SunOS) -ifneq ($(USE_64), 1) -OS_VERS := $(shell uname -r) -ifeq ($(OS_VERS),5.8) -ifneq ($(OS_TEST),i86pc) -LIBNLS_INCLUDES_LOC = /share/builds/components/libnls$(NLS_LIBVERSION)/v3.2/forte6/$(OBJDIR_NAME)/include -LIBNLS_LIB_LOC = /share/builds/components/libnls$(NLS_LIBVERSION)/v3.2/forte6/$(OBJDIR_NAME)/lib -endif -endif -endif -endif - -endif -LIBNLS_DIR = ../../../../../dist/libnls$(NLS_LIBVERSION) -ifeq ($(OS_ARCH), WINNT) -LIBNLS_INCLUDES =../../../../../dist/libnls$(NLS_LIBVERSION)/$(OBJDIR_NAME)/include -LIBNLS_LIBDIR =../../../../../dist/libnls$(NLS_LIBVERSION)/$(OBJDIR_NAME)/lib -else -LIBNLS_INCLUDES =../../../../../dist/public/libnls -LIBNLS_LIBDIR =../../../../../dist/$(OBJDIR_NAME)/libnls -endif - -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 - - -ifdef BUILD_OPT -LDAP_DEBUG = -else -LDAP_DEBUG = -DLDAP_DEBUG -endif - -ifdef HAVE_LIBNLS -HAVELIBNLS = -DHAVE_LIBNLS -else -HAVELIBNLS = -endif - -ifdef BUILD_CLU -BUILDCLU = 1 -else -BUILDCLU = -endif - -# -# DEFS are included in CFLAGS -# -DEFS = $(PLATFORMCFLAGS) $(LDAP_DEBUG) $(HAVELIBNLS) \ - $(CLDAP) $(DEFNETSSL) $(NOLIBLCACHE) \ - $(LDAP_REFERRALS) $(LDAP_DNS) $(STR_TRANSLATION) \ - $(LIBLDAP_CHARSETS) $(LIBLDAP_DEF_CHARSET) \ - $(NSDOMESTIC) $(LDAPSSLIO) - - -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 - -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) $(ALDFLAGS) $(DLL_LDFLAGS) $(DLL_EXPORT_FLAGS) \ - -o $@ $(SONAMEFLAG_PREFIX)$(notdir $@) $(OBJS) -else # SONAMEFLAG_PREFIX -LINK_DLL = $(LD) $(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) -Wl,-E $(ALDFLAGS) $(LDFLAGS) $(RPATHFLAG_PREFIX)$(RPATHFLAG) -o $@ $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS) - -ifeq ($(USE_64), 1) -LINK_EXE = $(CCC) -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 - diff --git a/mozilla/directory/c-sdk/config/AIX.mk b/mozilla/directory/c-sdk/config/AIX.mk deleted file mode 100644 index 4d8c4ca89d6..00000000000 --- a/mozilla/directory/c-sdk/config/AIX.mk +++ /dev/null @@ -1,175 +0,0 @@ -# -# 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 -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 diff --git a/mozilla/directory/c-sdk/config/BSD_OS.mk b/mozilla/directory/c-sdk/config/BSD_OS.mk deleted file mode 100644 index 17b6ee549eb..00000000000 --- a/mozilla/directory/c-sdk/config/BSD_OS.mk +++ /dev/null @@ -1,91 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/BeOS.mk b/mozilla/directory/c-sdk/config/BeOS.mk deleted file mode 100644 index 25cb693641c..00000000000 --- a/mozilla/directory/c-sdk/config/BeOS.mk +++ /dev/null @@ -1,138 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/DGUX.mk b/mozilla/directory/c-sdk/config/DGUX.mk deleted file mode 100644 index 3928aa4fcf8..00000000000 --- a/mozilla/directory/c-sdk/config/DGUX.mk +++ /dev/null @@ -1,63 +0,0 @@ -# -# 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 -# - -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 diff --git a/mozilla/directory/c-sdk/config/FreeBSD.mk b/mozilla/directory/c-sdk/config/FreeBSD.mk deleted file mode 100644 index 41ee17c5f93..00000000000 --- a/mozilla/directory/c-sdk/config/FreeBSD.mk +++ /dev/null @@ -1,82 +0,0 @@ -# -# 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++ diff --git a/mozilla/directory/c-sdk/config/HP-UX.mk b/mozilla/directory/c-sdk/config/HP-UX.mk deleted file mode 100644 index 8c96bdecccf..00000000000 --- a/mozilla/directory/c-sdk/config/HP-UX.mk +++ /dev/null @@ -1,211 +0,0 @@ -# -# 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 - -# -# 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,$(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 - -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 diff --git a/mozilla/directory/c-sdk/config/IRIX.mk b/mozilla/directory/c-sdk/config/IRIX.mk deleted file mode 100644 index 827641fff0a..00000000000 --- a/mozilla/directory/c-sdk/config/IRIX.mk +++ /dev/null @@ -1,158 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/Linux.mk b/mozilla/directory/c-sdk/config/Linux.mk deleted file mode 100644 index 401cd5f2cb7..00000000000 --- a/mozilla/directory/c-sdk/config/Linux.mk +++ /dev/null @@ -1,133 +0,0 @@ -# -# 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))) -CPU_ARCH := x86 -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 = -ansi -Wall -pipe -DLINUX -Dlinux -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) -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 diff --git a/mozilla/directory/c-sdk/config/Makefile b/mozilla/directory/c-sdk/config/Makefile deleted file mode 100644 index 37188a158d7..00000000000 --- a/mozilla/directory/c-sdk/config/Makefile +++ /dev/null @@ -1,137 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape 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 = .. - -# Indicate that this directory builds build tools. -INTERNAL_TOOLS = 1 - -include $(MOD_DEPTH)/config/config.mk - -CSRCS = now.c - -# This version hasn't been ported for us; the one in mozilla/config has -ifneq ($(OS_ARCH),OS2) -CSRCS += nsinstall.c - -PLSRCS = nfspwd.pl -endif - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -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 - -ifeq ($(MOZ_OS2_TOOLS),EMX) -XCFLAGS = $(OS_EXE_CFLAGS) -ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF) -XLDOPTS = -Zlinker /PM:VIO -endif -endif - -ifeq ($(MOZ_OS2_TOOLS),PGCC) -XCFLAGS = $(OS_EXE_CFLAGS) -XLDOPTS = -Zlinker /PM:VIO -endif - -ifeq ($(MOZ_OS2_TOOLS),VACPP) -OS_CFLAGS = $(OS_EXE_CFLAGS) -endif - -include $(MOD_DEPTH)/config/rules.mk - -PROGS = $(OBJDIR)/now$(PROG_SUFFIX) - -ifeq (,$(filter-out OS2 WINNT,$(OS_ARCH))) -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 - -cleanconfig: FORCE - $(RM) -r $(OBJDIR) - -FORCE: diff --git a/mozilla/directory/c-sdk/config/Makefile.in b/mozilla/directory/c-sdk/config/Makefile.in deleted file mode 100644 index 71291787222..00000000000 --- a/mozilla/directory/c-sdk/config/Makefile.in +++ /dev/null @@ -1,129 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape 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 diff --git a/mozilla/directory/c-sdk/config/NCR.mk b/mozilla/directory/c-sdk/config/NCR.mk deleted file mode 100644 index 18e175f911b..00000000000 --- a/mozilla/directory/c-sdk/config/NCR.mk +++ /dev/null @@ -1,97 +0,0 @@ -# -# 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 -### - diff --git a/mozilla/directory/c-sdk/config/NEC.mk b/mozilla/directory/c-sdk/config/NEC.mk deleted file mode 100644 index d9f65a659cb..00000000000 --- a/mozilla/directory/c-sdk/config/NEC.mk +++ /dev/null @@ -1,61 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/NEWS-OS.mk b/mozilla/directory/c-sdk/config/NEWS-OS.mk deleted file mode 100644 index cf3b6a82bae..00000000000 --- a/mozilla/directory/c-sdk/config/NEWS-OS.mk +++ /dev/null @@ -1,74 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/NEXTSTEP.mk b/mozilla/directory/c-sdk/config/NEXTSTEP.mk deleted file mode 100644 index 01b07825156..00000000000 --- a/mozilla/directory/c-sdk/config/NEXTSTEP.mk +++ /dev/null @@ -1,68 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/NTO.mk b/mozilla/directory/c-sdk/config/NTO.mk deleted file mode 100644 index 7ccaad469c4..00000000000 --- a/mozilla/directory/c-sdk/config/NTO.mk +++ /dev/null @@ -1,90 +0,0 @@ -# -# 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 - diff --git a/mozilla/directory/c-sdk/config/NetBSD.mk b/mozilla/directory/c-sdk/config/NetBSD.mk deleted file mode 100644 index 0179110c74e..00000000000 --- a/mozilla/directory/c-sdk/config/NetBSD.mk +++ /dev/null @@ -1,82 +0,0 @@ -# -# 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++ diff --git a/mozilla/directory/c-sdk/config/OS2.mk b/mozilla/directory/c-sdk/config/OS2.mk deleted file mode 100644 index cfd4584e176..00000000000 --- a/mozilla/directory/c-sdk/config/OS2.mk +++ /dev/null @@ -1,170 +0,0 @@ -# -# 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 - - diff --git a/mozilla/directory/c-sdk/config/OSF1.mk b/mozilla/directory/c-sdk/config/OSF1.mk deleted file mode 100644 index 6aec2870438..00000000000 --- a/mozilla/directory/c-sdk/config/OSF1.mk +++ /dev/null @@ -1,131 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/OpenBSD.mk b/mozilla/directory/c-sdk/config/OpenBSD.mk deleted file mode 100644 index e303b908fb4..00000000000 --- a/mozilla/directory/c-sdk/config/OpenBSD.mk +++ /dev/null @@ -1,78 +0,0 @@ -# -# 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++ diff --git a/mozilla/directory/c-sdk/config/OpenVMS.mk b/mozilla/directory/c-sdk/config/OpenVMS.mk deleted file mode 100644 index dd5be58a5a7..00000000000 --- a/mozilla/directory/c-sdk/config/OpenVMS.mk +++ /dev/null @@ -1,67 +0,0 @@ -# -# 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) diff --git a/mozilla/directory/c-sdk/config/QNX.mk b/mozilla/directory/c-sdk/config/QNX.mk deleted file mode 100644 index a5e9e6bd7a2..00000000000 --- a/mozilla/directory/c-sdk/config/QNX.mk +++ /dev/null @@ -1,57 +0,0 @@ -# -# 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) diff --git a/mozilla/directory/c-sdk/config/README b/mozilla/directory/c-sdk/config/README deleted file mode 100644 index 16b78e0a60c..00000000000 --- a/mozilla/directory/c-sdk/config/README +++ /dev/null @@ -1,9 +0,0 @@ -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) diff --git a/mozilla/directory/c-sdk/config/Rhapsody.mk b/mozilla/directory/c-sdk/config/Rhapsody.mk deleted file mode 100644 index db27247fa29..00000000000 --- a/mozilla/directory/c-sdk/config/Rhapsody.mk +++ /dev/null @@ -1,83 +0,0 @@ -# -# 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++ diff --git a/mozilla/directory/c-sdk/config/SCOOS.mk b/mozilla/directory/c-sdk/config/SCOOS.mk deleted file mode 100644 index 6e19d07a1aa..00000000000 --- a/mozilla/directory/c-sdk/config/SCOOS.mk +++ /dev/null @@ -1,63 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/SINIX.mk b/mozilla/directory/c-sdk/config/SINIX.mk deleted file mode 100644 index e4ce6e41882..00000000000 --- a/mozilla/directory/c-sdk/config/SINIX.mk +++ /dev/null @@ -1,108 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/SunOS.mk b/mozilla/directory/c-sdk/config/SunOS.mk deleted file mode 100644 index 1a945d2ef98..00000000000 --- a/mozilla/directory/c-sdk/config/SunOS.mk +++ /dev/null @@ -1,42 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/SunOS4.mk b/mozilla/directory/c-sdk/config/SunOS4.mk deleted file mode 100644 index 41d9dbc5892..00000000000 --- a/mozilla/directory/c-sdk/config/SunOS4.mk +++ /dev/null @@ -1,68 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/SunOS5.8_i86pc.mk b/mozilla/directory/c-sdk/config/SunOS5.8_i86pc.mk deleted file mode 100644 index 58b66b503e3..00000000000 --- a/mozilla/directory/c-sdk/config/SunOS5.8_i86pc.mk +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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 += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/directory/c-sdk/config/SunOS5.9.mk b/mozilla/directory/c-sdk/config/SunOS5.9.mk deleted file mode 100755 index 63a1a003bb2..00000000000 --- a/mozilla/directory/c-sdk/config/SunOS5.9.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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 += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/directory/c-sdk/config/SunOS5.9_i86pc.mk b/mozilla/directory/c-sdk/config/SunOS5.9_i86pc.mk deleted file mode 100755 index 8ad8d0ba5b7..00000000000 --- a/mozilla/directory/c-sdk/config/SunOS5.9_i86pc.mk +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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 += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/mozilla/directory/c-sdk/config/SunOS5.mk b/mozilla/directory/c-sdk/config/SunOS5.mk deleted file mode 100644 index 71c8dab896e..00000000000 --- a/mozilla/directory/c-sdk/config/SunOS5.mk +++ /dev/null @@ -1,214 +0,0 @@ -# -# 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 -CCC = CC -Qoption cg -xstrconst -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) -ifndef INTERNAL_TOOLS -ifneq ($(NS_USE_GCC), 1) -CC += -xarch=v9 -CCC += -xarch=v9 -endif -endif -COMPILER_TAG = _64 -else -ifeq ($(HAVE_CCONF), 1) -COMPILER_TAG = -else -COMPILER_TAG = _32 -endif -endif - -RANLIB = echo - -OS_DEFINES = -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS - -ifeq ($(OS_TEST),i86pc) -CPU_ARCH = x86 -COMPILER_TAG = _i86pc -OS_DEFINES += -Di386 -# 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 diff --git a/mozilla/directory/c-sdk/config/UNIX.mk b/mozilla/directory/c-sdk/config/UNIX.mk deleted file mode 100644 index 34a0a0eec37..00000000000 --- a/mozilla/directory/c-sdk/config/UNIX.mk +++ /dev/null @@ -1,91 +0,0 @@ -# -# 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 -DDEBUG_$(shell whoami) -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 diff --git a/mozilla/directory/c-sdk/config/UNIXWARE.mk b/mozilla/directory/c-sdk/config/UNIXWARE.mk deleted file mode 100644 index 0419b1b8337..00000000000 --- a/mozilla/directory/c-sdk/config/UNIXWARE.mk +++ /dev/null @@ -1,71 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/WIN32.mk b/mozilla/directory/c-sdk/config/WIN32.mk deleted file mode 100644 index 99b464e13b0..00000000000 --- a/mozilla/directory/c-sdk/config/WIN32.mk +++ /dev/null @@ -1,175 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/WIN95.mk b/mozilla/directory/c-sdk/config/WIN95.mk deleted file mode 100644 index c30d48d6a5e..00000000000 --- a/mozilla/directory/c-sdk/config/WIN95.mk +++ /dev/null @@ -1,38 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/WINNT.mk b/mozilla/directory/c-sdk/config/WINNT.mk deleted file mode 100644 index 781c2b5da92..00000000000 --- a/mozilla/directory/c-sdk/config/WINNT.mk +++ /dev/null @@ -1,38 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/arch.mk b/mozilla/directory/c-sdk/config/arch.mk deleted file mode 100644 index 4e3146911cb..00000000000 --- a/mozilla/directory/c-sdk/config/arch.mk +++ /dev/null @@ -1,295 +0,0 @@ -# -# 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) - -# -# Tweak the default OS_ARCH and OS_RELEASE macros as needed. -# -ifeq ($(HAVE_CCONF), 1) -ifeq ($(OS_ARCH), Linux) -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) diff --git a/mozilla/directory/c-sdk/config/autoconf.mk.in b/mozilla/directory/c-sdk/config/autoconf.mk.in deleted file mode 100644 index 83b7a86fbce..00000000000 --- a/mozilla/directory/c-sdk/config/autoconf.mk.in +++ /dev/null @@ -1,67 +0,0 @@ - -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@ diff --git a/mozilla/directory/c-sdk/config/config.mk b/mozilla/directory/c-sdk/config/config.mk deleted file mode 100644 index 3d241e730ea..00000000000 --- a/mozilla/directory/c-sdk/config/config.mk +++ /dev/null @@ -1,233 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape 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 .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 -# -#################################################################### - -MDIST = /share/builds/components -ifeq ($(OS_ARCH),WINNT) -MDIST = //helium/dist -MDIST_DOS = $(subst /,\\,$(MDIST)) -endif - -# RELEASE_DIR is ns/dist/ - -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 diff --git a/mozilla/directory/c-sdk/config/libc_r.h b/mozilla/directory/c-sdk/config/libc_r.h deleted file mode 100644 index c8128cfa361..00000000000 --- a/mozilla/directory/c-sdk/config/libc_r.h +++ /dev/null @@ -1,155 +0,0 @@ -/* -*- 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__INIT_R(), and the actual calls are R__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 -#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 */ diff --git a/mozilla/directory/c-sdk/config/module.df b/mozilla/directory/c-sdk/config/module.df deleted file mode 100644 index e8b784859f4..00000000000 --- a/mozilla/directory/c-sdk/config/module.df +++ /dev/null @@ -1,40 +0,0 @@ -# -# 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 diff --git a/mozilla/directory/c-sdk/config/nfspwd b/mozilla/directory/c-sdk/config/nfspwd deleted file mode 100755 index e47261e8c76..00000000000 --- a/mozilla/directory/c-sdk/config/nfspwd +++ /dev/null @@ -1,46 +0,0 @@ -#! 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"); -} diff --git a/mozilla/directory/c-sdk/config/nfspwd.pl b/mozilla/directory/c-sdk/config/nfspwd.pl deleted file mode 100644 index e47261e8c76..00000000000 --- a/mozilla/directory/c-sdk/config/nfspwd.pl +++ /dev/null @@ -1,46 +0,0 @@ -#! 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"); -} diff --git a/mozilla/directory/c-sdk/config/now.c b/mozilla/directory/c-sdk/config/now.c deleted file mode 100644 index 784b5ceabde..00000000000 --- a/mozilla/directory/c-sdk/config/now.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- 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 -#include - -#if defined(VMS) -#include -#elif defined(XP_UNIX) || defined(XP_OS2_EMX) || defined(XP_BEOS) -#include -#elif defined(WIN32) || defined(XP_OS2_VACPP) -#include -#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 - 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 */ diff --git a/mozilla/directory/c-sdk/config/nsinstall.c b/mozilla/directory/c-sdk/config/nsinstall.c deleted file mode 100644 index 646072a59fe..00000000000 --- a/mozilla/directory/c-sdk/config/nsinstall.c +++ /dev/null @@ -1,592 +0,0 @@ -/* -*- 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 /* OSF/1 requires this before grp.h, so put it first */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 - -/* -** 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 -#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); -} diff --git a/mozilla/directory/c-sdk/config/nsprincl.mk.in b/mozilla/directory/c-sdk/config/nsprincl.mk.in deleted file mode 100644 index d56cc0248b2..00000000000 --- a/mozilla/directory/c-sdk/config/nsprincl.mk.in +++ /dev/null @@ -1,5 +0,0 @@ -# Include in Makefiles to define NSPR variables - -NSPR_VERSION = @NSPR_VERSION@ -NSPR_LIB = -lnspr@NSPR_VERSION@ -NSPR_EXTRA_LIBS = @EXTRA_LIBS@ diff --git a/mozilla/directory/c-sdk/config/nsprincl.sh.in b/mozilla/directory/c-sdk/config/nsprincl.sh.in deleted file mode 100644 index be4e1450ca4..00000000000 --- a/mozilla/directory/c-sdk/config/nsprincl.sh.in +++ /dev/null @@ -1,5 +0,0 @@ -# Include in shell scripts to define NSPR variables - -NSPR_VERSION=@NSPR_VERSION@ -NSPR_LIB=-lnspr$NSPR_VERSION -NSPR_EXTRA_LIBS="@EXTRA_LIBS@" diff --git a/mozilla/directory/c-sdk/config/pathsub.h b/mozilla/directory/c-sdk/config/pathsub.h deleted file mode 100644 index 48cdb1054ed..00000000000 --- a/mozilla/directory/c-sdk/config/pathsub.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- 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 -#include - -#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___ */ diff --git a/mozilla/directory/c-sdk/config/prdepend.h b/mozilla/directory/c-sdk/config/prdepend.h deleted file mode 100644 index 28c1b139d11..00000000000 --- a/mozilla/directory/c-sdk/config/prdepend.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- 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." - diff --git a/mozilla/directory/c-sdk/config/prmkdir.bat b/mozilla/directory/c-sdk/config/prmkdir.bat deleted file mode 100755 index b0e00ca6110..00000000000 --- a/mozilla/directory/c-sdk/config/prmkdir.bat +++ /dev/null @@ -1,18 +0,0 @@ -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 diff --git a/mozilla/directory/c-sdk/config/rules.mk b/mozilla/directory/c-sdk/config/rules.mk deleted file mode 100644 index 58283290a22..00000000000 --- a/mozilla/directory/c-sdk/config/rules.mk +++ /dev/null @@ -1,480 +0,0 @@ -#! gmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Netscape 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//include. -# -# Pass 2. libs - Create libraries. Publish libraries to dist//lib. -# -# Pass 3. all - Create programs. -# -# Pass 4. install - Publish programs to dist//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) diff --git a/mozilla/directory/c-sdk/config/win16.mk b/mozilla/directory/c-sdk/config/win16.mk deleted file mode 100644 index a7a27f62abc..00000000000 --- a/mozilla/directory/c-sdk/config/win16.mk +++ /dev/null @@ -1,115 +0,0 @@ -# -# 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 = # diff --git a/mozilla/directory/c-sdk/ldap/Makefile.client b/mozilla/directory/c-sdk/ldap/Makefile.client deleted file mode 100644 index a1d63026853..00000000000 --- a/mozilla/directory/c-sdk/ldap/Makefile.client +++ /dev/null @@ -1,62 +0,0 @@ -# -# 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 - -ifeq ($(BUILDCLU), 1) -SRCDIRS += clients/tools -endif - -all export:: FORCE - @for i in $(SRCDIRS); do \ - echo " cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) export"; \ - ( cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) export ); \ - done - -libs install:: FORCE - @for i in $(SRCDIRS); do \ - echo "cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) install"; \ - ( cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) install ); \ - done - -clean clobber:: FORCE - @for i in $(SRCDIRS); do \ - 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 \ - echo "cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) realclean"; \ - ( cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) realclean ); \ - done - -FORCE: - diff --git a/mozilla/directory/c-sdk/ldap/Makefile.in b/mozilla/directory/c-sdk/ldap/Makefile.in deleted file mode 100644 index e95cb8baff6..00000000000 --- a/mozilla/directory/c-sdk/ldap/Makefile.in +++ /dev/null @@ -1,35 +0,0 @@ -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: - diff --git a/mozilla/directory/c-sdk/ldap/README.configure b/mozilla/directory/c-sdk/ldap/README.configure deleted file mode 100644 index 03896acfcd8..00000000000 --- a/mozilla/directory/c-sdk/ldap/README.configure +++ /dev/null @@ -1,31 +0,0 @@ -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 , -please. - -Dan Mosedale - diff --git a/mozilla/directory/c-sdk/ldap/build/Makefile.client b/mozilla/directory/c-sdk/ldap/build/Makefile.client deleted file mode 100644 index 549ed0e7297..00000000000 --- a/mozilla/directory/c-sdk/ldap/build/Makefile.client +++ /dev/null @@ -1,57 +0,0 @@ -# -# 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 $(NSPR_TREE)/config/rules.mk -include ../../build.mk - -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)) - -$(TARGETS): $(OBJS) - @$(MAKE_OBJDIR) - $(LINK_EXE) -OUT:$@ $(OBJS) -endif - -export:: $(TARGETS) - $(INSTALL) -m 555 $(TARGETS) ../$(DIST)/bin - -install:: export - -clean:: - rm -rf $(OBJDIR_NAME) - diff --git a/mozilla/directory/c-sdk/ldap/build/Makefile.in b/mozilla/directory/c-sdk/ldap/build/Makefile.in deleted file mode 100644 index f4ff5d04d34..00000000000 --- a/mozilla/directory/c-sdk/ldap/build/Makefile.in +++ /dev/null @@ -1,29 +0,0 @@ -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) - diff --git a/mozilla/directory/c-sdk/ldap/build/autoconf.mk.in b/mozilla/directory/c-sdk/ldap/build/autoconf.mk.in deleted file mode 100644 index 49c3f41c232..00000000000 --- a/mozilla/directory/c-sdk/ldap/build/autoconf.mk.in +++ /dev/null @@ -1,57 +0,0 @@ -# -# 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 -# - -# 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 diff --git a/mozilla/directory/c-sdk/ldap/build/compver.sh b/mozilla/directory/c-sdk/ldap/build/compver.sh deleted file mode 100755 index a615430fb82..00000000000 --- a/mozilla/directory/c-sdk/ldap/build/compver.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin\sh -# -# 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 diff --git a/mozilla/directory/c-sdk/ldap/build/dirver.c b/mozilla/directory/c-sdk/ldap/build/dirver.c deleted file mode 100644 index 6432aed999c..00000000000 --- a/mozilla/directory/c-sdk/ldap/build/dirver.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * 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): - */ - -/*-------------------------------------------------------------------------- -/ -/ Name: Netscape File Version Generator -/ Platforms: WIN32 -/ ...................................................................... -/ This program generates an ascii format of the 64-bit FILEVERSION -/ resource identifier used by Windows executable binaries. -/ -/ Usage Syntax: -/ fversion [mm/dd/yyyy] [outfile] -/ If date is not specified, the current GMT date is used. yyyy must be -/ greater than 1980 -/ -/ Usage Example: -/ fversion 3.0.0 -/ fversion 6.5.4 1/30/2001 -/ fversion 6.5.4 1/30/2001 fileversion.h -/ -/ see http://ntsbuild/sd/30ver.htm for specification -/ ...................................................................... -/ Revision History: -/ 01-30-97 Initial Version, Andy Hakim (ahakim@netscape.com) -/ --------------------------------------------------------------------------*/ -#ifdef _WIN32 -#include -#endif -#ifdef macintosh -#include -#endif -#include -#include -#include -#include - -unsigned _CalcVersion(unsigned nMajor, unsigned nMinor, unsigned nPatch) -{ - unsigned nVersion; - nVersion = nMajor; - nVersion <<= 5; - nVersion += nMinor; - nVersion <<= 7; - nVersion += nPatch; - nVersion &= 0xFFFF; - return(nVersion); -} - - -static void _GetVersions(char *szVer, unsigned *nMajor, unsigned *nMinor, - unsigned *nPatch) -{ - char szVersion[128]; - unsigned nReturn = 0; - char *szToken; - *nMajor = 0; - *nMinor = 0; - *nPatch = 0; - - strcpy(szVersion, szVer); - if(szToken = strtok(szVersion, ".\n")) - { - *nMajor = atoi(szToken); - if(szToken = strtok(NULL, ".\n")) - { - *nMinor = atoi(szToken); - if(szToken = strtok(NULL, ".\n")) - { - *nPatch = atoi(szToken); - } - } - } -} - - - -unsigned _CalcBuildDate(unsigned nYear, unsigned nMonth, unsigned nDay) -{ - unsigned nBuildDate = 0; - - if(nYear < 1900) /* they really mean 1900 + nYear */ - nYear += 1900; - - nYear -= 1980; - nBuildDate = nYear; - /* - nBuildDate <<= 5; - */ - nBuildDate <<= 4; - nBuildDate += nMonth; - /* nBuildDate <<= 4; */ - nBuildDate <<= 5; - nBuildDate += nDay; - nBuildDate &= 0xFFFF; - return(nBuildDate); -} - - - -unsigned _GenBuildDate(char *szBuildDate) -{ - unsigned nReturn = 0; - char *szToken; - unsigned nYear = 0; - unsigned nMonth = 0; - unsigned nDay = 0; - - if((szBuildDate) && (strchr(szBuildDate, '\\') || strchr(szBuildDate, '/')) && (szToken = strtok(szBuildDate, "\\/"))) - { - nMonth = atoi(szToken); - nMonth--; /* use months in the range [0..11], as in struct tm */ - if(szToken = strtok(NULL, "\\/")) - { - nDay = atoi(szToken); - if(szToken = strtok(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; - } - } - } - } - else - { - struct tm *newtime; - time_t ltime; - - time( <ime ); - - /* Obtain coordinated universal time: */ - newtime = gmtime( <ime ); - nYear = newtime->tm_year; - nMonth = newtime->tm_mon; - nDay = newtime->tm_mday; - } - - nReturn = _CalcBuildDate(nYear, nMonth, nDay); - return(nReturn); -} - - - -static void ShowHelp(char *szFilename) -{ - fprintf(stdout, "%s: Generates ascii format #define for FILEVERSION\n", szFilename); - fprintf(stdout, " resource identifier used by Windows executable binaries.\n"); - fprintf(stdout, "\n"); - fprintf(stdout, "Usage: %s [mm/dd/yy] [outfile]\n", szFilename); - fprintf(stdout, "\n"); - fprintf(stdout, "Examples:\n"); - fprintf(stdout, "%s 3.0.0\n", szFilename); - fprintf(stdout, "%s 6.5.2 1/30/2001\n", szFilename); - fprintf(stdout, "%s 6.5.2 1/30/2001 fileversion.h\n", szFilename); -} - - - -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]); - nReturn = 1; - } - else - { - char *szVersion = NULL; - char *szDate = NULL; - char *szOutput = NULL; - FILE *f = stdout; - unsigned nMajor = 0; - unsigned nMinor = 0; - unsigned nPatch = 0; - - szVersion = (char *)lpArgv[1]; - szDate = (char *)lpArgv[2]; - szOutput = (char *)lpArgv[3]; - _GetVersions( szVersion, &nMajor, &nMinor, &nPatch ); - nVersion = _CalcVersion(nMajor, nMinor, nPatch); - nBuildDate = _GenBuildDate(szDate); - - 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 \"%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", - szVersion, nBuildDate); - - if(nArgc >= 4) - fclose(f); - nReturn = (nVersion && !nBuildDate); - } - return(nReturn); -} - diff --git a/mozilla/directory/c-sdk/ldap/build/genexports.pl b/mozilla/directory/c-sdk/ldap/build/genexports.pl deleted file mode 100755 index 4130f24737b..00000000000 --- a/mozilla/directory/c-sdk/ldap/build/genexports.pl +++ /dev/null @@ -1,211 +0,0 @@ - -# -# genexports.pl: create up-to-date export and .def files -# -# created 31 August 1997 by Mark Smith - -$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() { - $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 ) = @_; - - open( EXP, $expfile ); - &print_comment( $type, "\n" ); - &print_comment( $type, "exports list (generated by genexports.pl)\n" ); - &print_comment( $type, "\n" ); - while( ) { - $line = $_; - if ( substr( $line, 0, 1 ) eq "#" ) { - $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" ); -} - diff --git a/mozilla/directory/c-sdk/ldap/build/my_overrides.mk b/mozilla/directory/c-sdk/ldap/build/my_overrides.mk deleted file mode 100644 index d637889ccc3..00000000000 --- a/mozilla/directory/c-sdk/ldap/build/my_overrides.mk +++ /dev/null @@ -1,23 +0,0 @@ -# -# 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 -# - -DIST = $(DEPTH)/dist -VPATH = $(srcdir) diff --git a/mozilla/directory/c-sdk/ldap/build/nsftp.sh b/mozilla/directory/c-sdk/ldap/build/nsftp.sh deleted file mode 100644 index 12ede7850dc..00000000000 --- a/mozilla/directory/c-sdk/ldap/build/nsftp.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# FTP script for downloading /share/builds/components stuff. -# -# syntax: -# nsftp -# -# Example -# -# nsftp ldapsdk/19961108 c:\3.0\ns\components\ldapsdk -# - -SERVER=ftp-rel -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=- - diff --git a/mozilla/directory/c-sdk/ldap/build/replace.pl b/mozilla/directory/c-sdk/ldap/build/replace.pl deleted file mode 100755 index d3f03da0bd8..00000000000 --- a/mozilla/directory/c-sdk/ldap/build/replace.pl +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 - -@keywords = (); -@values = (); - -$count = 0; -foreach $str (@ARGV) { - ($key,$val) = split( "=", $str, 2 ); - push (@keywords, $key); - push (@values, $val); - ++$count; -} - -$first_line = 1; - -while() { - $line = $_; - $count = 0; - foreach $str (@keywords) { - $line =~ s/{{$str}}/$values[$count]/g; - ++$count; - } - - if ( ! $first_line ) { - print $line; - } else { - $first_line = 0; - } -} - -exit 0; diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/Makefile b/mozilla/directory/c-sdk/ldap/clients/tools/Makefile deleted file mode 100644 index 0023a580725..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/Makefile +++ /dev/null @@ -1,467 +0,0 @@ -# -# GNU Makefile for LDAP client tools. -# - -LDAP_SRC = ../.. -MCOM_ROOT = ../../../.. - -NOSTDCLEAN=true # don't let nsconfig.mk define target clean -NOSTDSTRIP=true # don't let nsconfig.mk define target strip -NSPR20=true # probably should be defined somewhere else (not sure where) - -OBJDEST = $(OBJDIR)/clients/tools/obj -BINDIR = $(OBJDIR)/clients/bin - -include $(MCOM_ROOT)/c-sdk/nsdefs.mk -include $(MCOM_ROOT)/c-sdk/nsconfig.mk - -include $(LDAP_SRC)/nsldap.mk -ifndef LDAP_USE_OLD_DB -include $(MCOM_ROOT)/c-sdk/ns_usedb.mk -endif - -# NLS Library - -NLS_COMP_NAME = libnls -NLS_VERS_NUM = 31 -NLS_COMP_DIR = $(NLS_COMP_NAME)$(NLS_VERS_NUM) -NLS_ROOT = $(MCOM_ROOT)/../components/$(NLS_COMP_DIR) - -NLS_LIBPATH = $(NLS_ROOT)/$(NLSOBJDIR)/lib -NLS_INCLUDE = $(NLS_ROOT)/$(NLSOBJDIR)/include -NLS_LOCALE = $(NLS_ROOT)/$(NLSOBJDIR)/locale$(NLS_VERS_NUM) -NLS_CONV = $(NLS_ROOT)/$(NLSOBJDIR)/conv$(NLS_VERS_NUM) -NLS_VERSION_FILE = $(NLS_ROOT)/Version - - -NLS_RELDATE=v3.2 - -NLS_VERSION = $(NLS_RELDATE) - -ifeq ($(ARCH), WINNT) - ifeq ($(OS_TARGET), WIN95) - ifeq ($(DEBUG), full) - NLSOBJDIR = WIN954.0_DBG.OBJ - else - ifeq ($(DEBUG), fulld) - NLSOBJDIR = WIN954.0_DBG.OBJD - else - NLSOBJDIR = WIN954.0_OPT.OBJ - endif - endif - else - ifeq ($(DEBUG), full) - NLSOBJDIR = WINNT4.0_DBG.OBJ - else - ifeq ($(DEBUG), fulld) - NLSOBJDIR = WINNT4.0_DBG.OBJD - else - NLSOBJDIR = WINNT4.0_OPT.OBJ - endif - endif - endif - NLS_RELEASE = $(COMPONENTS_DIR)/libnls$(NLS_VERS_NUM)/$(NLS_VERSION)/$(NLSOBJDIR) -# NLS_LIBNAMES = brk32$(NLS_VERS_NUM) cnv32$(NLS_VERS_NUM) col32$(NLS_VERS_NUM) fmt32$(NLS_VERS_NUM) res32$(NLS_VERS_NUM) uni32$(NLS_VERS_NUM) - NLS_LIBNAMES = cnv32$(NLS_VERS_NUM) - NLS_CONV_LIBNAMES = jpn32$(NLS_VERS_NUM) cck32$(NLS_VERS_NUM) sb32$(NLS_VERS_NUM) - NLS_LIBS = $(addsuffix .lib, $(addprefix ns, $(NLS_LIBNAMES))) - NLS_CONV_LIBS = $(addsuffix .lib, $(addprefix ns, $(NLS_CONV_LIBNAMES))) - NLSDLL_NAMES = $(addsuffix .dll, $(addprefix ns, $(NLS_LIBNAMES))) - NLS_CONVDLL_NAMES = $(addsuffix .dll, $(addprefix ns, $(NLS_CONV_LIBNAMES))) - LIBNLS = $(addprefix $(NLS_LIBPATH)/, $(NLS_LIBS)) - LIBNLS_CONV = $(addprefix $(NLS_LIBPATH)/, $(NLS_CONV_LIBS)) - NLSOBJNAME = $(NLS_LIBNAMES) -else -ifeq ($(ARCH), HPUX) - ifeq ($(NSOS_RELEASE), B.11.00) - NLSOBJDIR = $(NSOBJDIR_NAME) - NLS_RELEASE = $(COMPONENTS_DIR)/libnls$(NLS_VERS_NUM)/$(NLS_VERSION)/$(NLSOBJDIR) - else - NLSOBJDIR = $(NSOBJDIR_NAME) - NLS_RELEASE = $(COMPONENTS_DIR)/libnls$(NLS_VERS_NUM)/$(NLS_VERSION)/$(NLSOBJDIR) - endif -else -# Here is a hack to replace _PTH with n32, this must be done before -# the _PTH substitustion - - ifeq ($(ARCH),IRIX) - ifeq ($(USE_N32),1) - NLSOBJDIR = $(NSOBJDIR_NAME2_NOTAG) - else - NLSOBJDIR = $(NSOBJDIR_NAME_NOTAG) - endif - else - NLSOBJDIR = $(NSOBJDIR_NAME_NOTAG) - - ifeq ($(ARCH), OSF1) - NLSOBJDIR = $(NSOBJDIR_NAME) - endif - endif - -# NLS Does not has PTH version, so here is the hack which treat non PTH -# version as PTH version - ifeq ($(USE_PTHREADS), 1) - NLS_RELEASE = $(COMPONENTS_DIR)/libnls$(NLS_VERS_NUM)/$(NLS_VERSION)/$(NLSOBJDIR) - else - NLS_RELEASE = $(COMPONENTS_DIR)/libnls$(NLS_VERS_NUM)/$(NLS_VERSION)/$(NLSOBJDIR) - endif -endif # HPUX - NLS_LIBNAMES = cnv$(NLS_VERS_NUM) - NLS_CONV_LIBNAMES = jpn$(NLS_VERS_NUM) cck$(NLS_VERS_NUM) sb$(NLS_VERS_NUM) - NLS_SOLIB_NAMES = $(addsuffix $(DLL_PRESUF), $(addprefix libns, $(NLS_LIBNAMES))) - NLS_CONV_SOLIB_NAMES = $(addsuffix $(DLL_PRESUF), $(addprefix libns, $(NLS_CONV_LIBNAMES))) - NLS_LIBS = $(addsuffix .a, $(NLS_SOLIB_NAMES)) - NLS_CONV_LIBS = $(addsuffix .a, $(NLS_CONV_SOLIB_NAMES)) - NLS_SOLIBS = $(addsuffix .$(DLL_SUFFIX), $(NLS_SOLIB_NAMES)) - NLS_CONV_SOLIBS = $(addsuffix .$(DLL_SUFFIX), $(NLS_CONV_SOLIB_NAMES)) - NLSOBJNAME = $(NLS_SOLIBS) - LIBNLS = $(addprefix $(NLS_LIBPATH)/, $(NLS_SOLIBS)) - - ifeq ($(ARCH), OSF1) - NLSLINK = -L$(NLS_LIBPATH) $(addprefix -l, $(addsuffix $(DLL_PRESUF), $(addprefix ns, $(NLS_LIBNAMES)))) -lcxx - NLSLINK_STATIC = $(addprefix $(NLS_LIBPATH)/, $(NLS_LIBS)) -lcxx - NLSLINK_CONV_STATIC = $(addprefix $(NLS_LIBPATH)/, $(NLS_CONV_LIBS)) - else - ifeq ($(ARCH),HPUX) - #linking with libC is *BAD* on HPUX11 - NLSLINK = -L$(NLS_LIBPATH) $(addprefix -l, $(addsuffix $(DLL_PRESUF), $(addprefix ns, $(NLS_LIBNAMES)))) - NLSLINK_STATIC = $(addprefix $(NLS_LIBPATH)/, $(NLS_LIBS)) - NLSLINK_CONV_STATIC = $(addprefix $(NLS_LIBPATH)/, $(NLS_CONV_LIBS)) - else - ifeq ($(ARCH),Linux) - NLSLINK = -L$(NLS_LIBPATH) $(addprefix -l, $(addsuffix $(DLL_PRESUF), $(addprefix ns, $(NLS_LIBNAMES)))) -lresolv -lpthread - NLSLINK_STATIC = $(addprefix $(NLS_LIBPATH)/, $(NLS_LIBS)) -lresolv -lpthread - else - ifeq ($(ARCH),IRIX) - NLSLINK = -L$(NLS_LIBPATH) $(addprefix -l, $(addsuffix $(DLL_PRESUF), $(addprefix ns, $(NLS_LIBNAMES)))) -lpthread - NLSLINK_STATIC = $(addprefix $(NLS_LIBPATH)/, $(NLS_LIBS)) -lpthread - else - NLSLINK = -L$(NLS_LIBPATH) $(addprefix -l, $(addsuffix $(DLL_PRESUF), $(addprefix ns, $(NLS_LIBNAMES)))) -lC - NLSLINK_STATIC = $(addprefix $(NLS_LIBPATH)/, $(NLS_LIBS)) -lC - endif # Irix - endif # Linux - NLSLINK_CONV_STATIC = $(addprefix $(NLS_LIBPATH)/, $(NLS_CONV_LIBS)) - endif # HPUX -endif # OSF1 -endif - -ifeq ($(ARCH), SOLARIS) -NLSLINK += -lw -endif - -$(LIBNLS): $(NLS_VERSION_FILE) nls_version_check - -$(NLS_VERSION_FILE): - mkdir -p $(NLS_ROOT); \ - cd $(NLS_ROOT); echo "garbage" > Version - -ifneq ($(ARCH), WINNT) -ifndef FORCE_FTP -nls_version_check: - @if [ `cat $(NLS_VERSION_FILE)` != "$(NLS_VERSION)" -o ! -d $(NLS_ROOT)/$(NLSOBJDIR) ]; then \ - if [ -d $(NLS_RELEASE) ]; then \ - if [ "$(RELEASE_TREE)" != "" ]; then \ - (cd $(NLS_ROOT); \ - \rm -rf $(NLSOBJDIR) $(NLS_VERSION_FILE); \ - ln -s $(RELEASE_TREE)/libnls31/$(NLSOBJDIR) $(NLSOBJDIR)); \ - echo "$(NLS_VERSION)" > $(NLS_VERSION_FILE); \ - else \ - (cd $(NLS_ROOT); \ - \rm -rf $(NLSOBJDIR) $(NLS_VERSION_FILE); \ - ln -s $(NLS_RELEASE) $(NLSOBJDIR)); \ - echo "$(NLS_VERSION)" > $(NLS_VERSION_FILE); \ - fi; \ - else \ - echo "************************** ERROR *************************"; \ - echo "LIBNLS client libraries are missing. Make sure your machine"; \ - echo "has access to $(NLS_RELEASE)"; \ - echo "**********************************************************"; \ - exit 1; \ - fi; \ - fi; \ - -else - -nls_version_check: -# The following shell script recalculates $(NLS_INCLUDE), $(NLS_LIBPATH) and -# $(NLS_VERSION_FILE) - sh $(MCOM_ROOT)/c-sdk/compver.sh $(NLS_ROOT) $(NLS_VERSION) \ - $(NLSOBJDIR) $(MCOM_ROOT) $(MODULE) $(NLS_RELEASE) libnls$(NLS_VERS_NUM) \ - "' include lib conv$(NLS_VERS_NUM) locale$(NLS_VERS_NUM) '" $(NLS_ROOT)/$(NLSOBJDIR)/locale$(NLS_VERS_NUM)/index.txt -endif -else - -nls_version_check: -# The following shell script recalculates $(NLS_INCLUDE), $(NLS_LIBPATH) and -# $(NLS_VERSION_FILE) - sh $(MCOM_ROOT)/c-sdk/compver.sh $(NLS_ROOT) $(NLS_VERSION) \ - $(NLSOBJDIR) $(MCOM_ROOT) ldapsdk $(NLS_RELEASE) \ - libnls$(NLS_VERS_NUM) \ - "' include lib conv$(NLS_VERS_NUM) locale$(NLS_VERS_NUM) '" \ - $(NLS_ROOT)/$(NLSOBJDIR)/locale$(NLS_VERS_NUM)/index.txt -endif - -ifeq ($(ARCH), HPUX) - ifeq ($(NSOS_RELEASE), B.11.00) - EXTRA_LIBS += -lrt - CXX=aCC -DHPUX_ACC -D__STDC_EXT__ -D_POSIX_C_SOURCE=199506L - LINK_EXE_NOLIBSOBJS_NOCXX = $(CXX) -Wl,-E $(ALDFLAGS) $(LDFLAGS) \ - $(RPATHFLAG_PREFIX)$(RPATHFLAG) -o $@ - LINK_EXE_NOCXX = $(CXX) -Wl,-E $(ALDFLAGS) $(LDFLAGS) \ - $(RPATHFLAG_PREFIX)$(RPATHFLAG) -o $@ $(OBJS) $(EXTRA_LIBS) - endif - ifeq ($(NSOS_RELEASE), B.11.00_64) - EXTRA_LIBS += -lrt - CXX=aCC -DHPUX_ACC -D__STDC_EXT__ -D_POSIX_C_SOURCE=199506L +DA2.0W +DS2.0 - LINK_EXE_NOLIBSOBJS_NOCXX = $(CXX) -Wl,-E $(ALDFLAGS) $(LDFLAGS) \ - $(RPATHFLAG_PREFIX)$(RPATHFLAG) -o $@ - LINK_EXE_NOCXX = $(CXX) -Wl,-E $(ALDFLAGS) $(LDFLAGS) \ - $(RPATHFLAG_PREFIX)$(RPATHFLAG) -o $@ $(OBJS) $(EXTRA_LIBS) - endif - ifeq ($(NSOS_RELEASE), B.10.10) - CC= CC +a1 -# CXX=CC -D__STDC_EXT__ -# $(subst "+e", "",$(CFLAGS)) - endif -endif - -ifeq ($(ARCH),Linux) -CXX = egcs -LINK_EXE = $(CXX) $(ALDFLAGS) $(LDFLAGS) \ - $(RPATHFLAG_PREFIX)$(RPATHFLAG)$(RPATHFLAG_EXTRAS) \ - -o $@ $(OBJS) $(EXTRA_LIBS) -LINK_EXE_NOLIBSOBJS = $(CXX) $(ALDFLAGS) $(LDFLAGS) \ - $(RPATHFLAG_PREFIX)$(RPATHFLAG)$(RPATHFLAG_EXTRAS) -o $@ - -else -ifeq ($(ARCH), OSF1) -ifdef USE_LD_RUN_PATH -#does RPATH differently. instead we export RPATHFLAG as LD_RUN_PATH -#see ns/c-sdk/ldap/clients/tools/Makefile for an example -export LD_RUN_PATH=$(RPATHFLAG) -LINK_EXE = $(CXX) $(ALDFLAGS) $(LDFLAGS) \ - -o $@ $(OBJS) $(EXTRA_LIBS) -LINK_EXE_NOLIBSOBJS = $(CXX) $(ALDFLAGS) $(LDFLAGS) -o $@ -else # USE_LD_RUN_PATH -LINK_EXE = $(CXX) $(ALDFLAGS) $(LDFLAGS) \ - $(RPATHFLAG_PREFIX)$(RPATHFLAG)$(RPATHFLAG_EXTRAS) \ - -o $@ $(OBJS) $(EXTRA_LIBS) -LINK_EXE_NOLIBSOBJS = $(CXX) $(ALDFLAGS) $(LDFLAGS) \ - $(RPATHFLAG_PREFIX)$(RPATHFLAG)$(RPATHFLAG_EXTRAS) -o $@ -endif # USE_LD_RUN_PATH -endif -endif -MCOM_INCLUDE += -I$(NLS_INCLUDE) - -INCLUDES += $(SSLINCLUDE) $(NO_LIBLCACHE) -DEFS += $(SSL) - -ALDFLAGS += $(SSLLIBFLAG) - -ifeq ($(ARCH), WINNT) -SUBSYSTEM=console -endif - -ifneq ($(ARCH), WINNT) -# Run-time search path for shared libraries: in admin server 3.x installations, -# the ldap tools get installed under NSHOME/userdb/ldap/tools and the LDAP SDK -# libraries (libldap and liblcache) get installed under NSHOME/lib, so the -# correct library search path is ../../../lib. We also want to search -# NSHOME/bin/slapd, where more recent versions of the SDK so's may be. -RPATHFLAG=..:../lib:../../lib:../../../lib:../../../../lib -ifdef USE_LD_RUN_PATH -LD_RUN_PATH=$(RPATHFLAG) -export LD_RUN_PATH -endif -endif - -# svrcore is used by ntpinobj, and pinarg handling -LIBSVRCORE_DEP= $(NSCP_DISTDIR)/lib/svrcore.$(LIB_SUFFIX) -ifeq ($(ARCH), WINNT) -LIBSVRCORE= $(NSCP_DISTDIR)/lib/svrcore.$(LIB_SUFFIX) -else -LIBSVRCORE = -lsvrcore -endif - -ifeq ($(INCLUDE_SSL),1) -# libsec and friends are already in libldap, so don't link with them here - LDTOOLS_LIBS_DEP = $(LDAP_SDK_LIBLDAP_DLL_DEP) $(EXTRA_LIBS_DEP) - LDTOOLS_LIBS = $(LDAP_SDK_LIBLDAP_DLL) - ifneq ($(LDAP_NO_LIBLCACHE),1) - LDTOOLS_LIBS_DEP += $(LDAP_LIBLDIF_DEP) - LDTOOLS_LIBS += $(LDAP_LIBLDIF) $(LDAP_SDK_LIBLCACHE_DLL) - else - LDTOOLS_LIBS_DEP += $(LDAP_LIBLDIF_DEP) - LDTOOLS_LIBS += $(LDAP_LIBLDIF) - endif - - LDTOOLS_LIBS += $(EXTRA_LIBS) $(EXTRA_MALLOC_LIBS) $(LDAP_SDK_LIBLDAP_DLL) $(LIBSVRCORE) - -# XXXceb The linker on NT is auto optimizing. We still need to have libsec around for svrcore -# Do Not Mess with the link order. This was not straightforward, and "optimizing" the text -# will break the builds. - ifeq ($(ARCH), WINNT) - LDTOOLS_LIBS += $(LIBSEC) - endif - ifeq ($(ARCH), SOLARIS) - LDTOOLS_LIBS += $(LIBSEC) $(LIBDB) - endif - ifeq ($(ARCH), HPUX) - LDTOOLS_LIBS += $(LIBSEC) - endif - ifeq ($(ARCH), IRIX) - LDTOOLS_LIBS += $(LIBSEC) $(LIBDB) - endif - ifeq ($(ARCH), AIX) - LDTOOLS_LIBS += $(LIBSEC) $(LIBDB) - endif - ifeq ($(ARCH), WINNT) - LDTOOLS_LIBS += $(LIBNSPR) - else - LDTOOLS_LIBS += $(DYNAMICNSPR) - endif -else -# SSL is not included in the LDAP shared library... -# need to link with libsec and friends explicitly - LDTOOLS_LIBS_DEP = $(LDAP_SDK_LIBS_DEP) $(LDAP_LIBLDIF_DEP) \ - $(EXTRA_LIBS_DEP) - LDTOOLS_LIBS_DEP += $(LDAP_LIBLDIF_DEP) -ifeq ($(ARCH), OSF1) - LDTOOLS_LIBS = $(LDAP_SDK_LIBSSLDAP_LIB) $(LDAP_SDK_LIBLDAP_DLL) $(LDAP_SDK_LIBPRLDAP_DLL) -else - LDTOOLS_LIBS = $(LDAP_SDK_LIBSSLDAP_LIB) $(LDAP_SDK_LIBPRLDAP_DLL) $(LDAP_SDK_LIBLDAP_DLL) -endif - ifneq ($(LDAP_NO_LIBLCACHE),1) - LDTOOLS_LIBS += $(LDAP_SDK_LIBLCACHE_DLL) - endif - LDTOOLS_LIBS += $(LIBSVRCORE) $(LIBSEC) $(LIBDB) $(EXTRA_LIBS)\ - $(EXTRA_MALLOC_LIBS) $(LDAP_LIBLDIF) - - ifneq ($(LDAP_NO_LIBLCACHE),1) - ifndef LDAP_USE_OLD_DB - LDTOOLS_LIBS_DEP+=$(DB_LIB_DEP) - LDTOOLS_LIBS+=$(DB_LIB) - endif - endif - - ifeq ($(LDAP_NO_LIBLCACHE),1) - CFLAGS+=-DNO_LIBLCACHE - endif - -ifeq ($(ARCH), WINNT) -LDTOOLS_LIBS += $(LIBNSPR) -else -LDTOOLS_LIBS += $(DYNAMICNSPR) -endif - -# INCLUDE_SSL -endif - -LDTOOLS_LIBS_DEP += $(LIBNLS) -ifeq ($(ARCH), WINNT) -LDTOOLS_LIBS += $(LIBNLS) $(LIBNLS_CONV) -else -LDTOOLS_LIBS += $(NLSLINK_STATIC) $(NLSLINK_CONV_STATIC) -endif - - - - -#LDTOOLS_LIBS += $(LIBSVRCORE) - -ifeq ($(ARCH), AIX) -LDTOOLS_LIBS += $(EXE_EXTRA_LIBS) -endif - -ifeq ($(ARCH), WINNT) -ALDFLAGS += -FORCE:MULTIPLE /NODEFAULTLIB:MSVCRTD -endif - -#ifeq ($(ARCH), HPUX) -#CC=CC +a1 -#LINK_EXE = $(LINK_EXE_NOCXX) -#endif - -ifeq ($(ARCH),IRIX) -ifeq ($(USE_N32),1) -CXX=CC -LDFLAGS += -n32 -mips3 -CC=cc -LINK_EXE = $(CXX) $(ALDFLAGS) $(LDFLAGS) \ - -o $@ $(OBJS) $(EXTRA_LIBS) -endif -endif - -ifeq ($(ARCH), SOLARIS) -ifeq ($(USE_64), 1) -LINK_EXE += -xarch=v9 -L/usr/lib/sparcv9 -lCrun -endif -endif - -LINK_EXE += -$(LIBPATH)../$(MCOM_ROOT)/dist/$(NC_BUILD_FLAVOR)/lib - -LDAPDELETE_OBJ = $(addprefix $(OBJDEST)/, ldapdelete.o) -LDAPMODIFY_OBJ = $(addprefix $(OBJDEST)/, ldapmodify.o fileurl.o) -LDAPMODRDN_OBJ = $(addprefix $(OBJDEST)/, ldapmodrdn.o) -LDAPSEARCH_OBJ = $(addprefix $(OBJDEST)/, ldapsearch.o fileurl.o) -LDAPCMP_OBJ = $(addprefix $(OBJDEST)/, ldapcmp.o) -LDAPTOOLCOMMON_OBJ = $(addprefix $(OBJDEST)/, common.o convutf8.o argpin.o ntuserpin.o) - -CLIENT_OBJS = $(LDAPDELETE_OBJ) $(LDAPMODIFY_OBJ) $(LDAPMODRDN_OBJ) \ - $(LDAPSEARCH_OBJ) $(LDAPCMP_OBJ) $(LDAPTOOLCOMMON_OBJ) - -LDAPDELETE = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapdelete)) -LDAPMODIFY = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapmodify)) -LDAPMODRDN = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapmodrdn)) -LDAPSEARCH = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapsearch)) -LDAPADD = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapadd)) -LDAPCMP = $(addsuffix $(EXE_SUFFIX), $(addprefix $(BINDIR)/, ldapcmp)) - -BINS= $(LDAPDELETE) $(LDAPMODIFY) $(LDAPSEARCH) $(LDAPCMP) - -all: $(OBJDEST) $(BINDIR) $(BINS) -cmp: $(LDAPCMP) - -$(LDAPTOOLCOMMON_OBJ): $(LIBNLS) - -$(LDAPDELETE): $(LDAPDELETE_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPDELETE_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS) - -$(LDAPMODIFY): $(LDAPMODIFY_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPMODIFY_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS) - -$(LDAPMODRDN): $(LDAPMODRDN_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPMODRDN_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS) - -$(LDAPSEARCH): $(LDAPSEARCH_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPSEARCH_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS) - -$(LDAPADD): $(LDAPMODIFY) $(LDTOOLS_LIBS_DEP) - $(RM) $(LDAPADD) - $(HARDLN) $(LDAPMODIFY) $(LDAPADD) - -$(LDAPCMP): $(LDAPCMP_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPCMP_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDTOOLS_LIBS) - -clientSDK: all - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - -$(BINDIR): - $(MKDIR) $(BINDIR) - -clean: - $(RM) $(CLIENT_OBJS) - $(RM) $(BINS) - -# -# 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 -$(LDAPMODRDN_OBJ): $(LDAPTOOL_COMMON_DEPS) -$(LDAPSEARCH_OBJ): $(LDAPTOOL_COMMON_DEPS) fileurl.h -$(LDAPCMP_OBJ): $(LDAPTOOL_COMMON_DEPS) diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/Makefile.client b/mozilla/directory/c-sdk/ldap/clients/tools/Makefile.client deleted file mode 100644 index c1fb9dbccfe..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/Makefile.client +++ /dev/null @@ -1,363 +0,0 @@ -# -# 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 = ../../../.. -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 \ - -ifeq ($(HAVE_CCONF), 1) -COMPS_FROM_OBJDIR=1 -endif - -# -# The "arg pin" feature depends on the server core library. -# -ifeq ($(HAVE_SVRCORE), 1) -LDAP_TOOL_ARGPIN=1 -endif - -ifeq ($(LDAP_TOOL_ARGPIN),1) -INCLUDES += -I../../../../../dist/public/svrcore -CFLAGS+=-DLDAP_TOOL_ARGPIN -DLDAP_TOOL_PKCS11 -SVRCORE_LINK=-l$(SVRCORE_LIBNAME) -endif - -ifdef HAVE_LIBNLS -INCLUDES += -I$(LIBNLS_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 - -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) -LDAPTOOLCOMMON_OBJ = $(addprefix $(OBJDEST)/, common.obj) \ - $(addprefix $(OBJDEST)/, convutf8.obj) \ - $(addprefix $(OBJDEST)/, fileurl.obj) -ifeq ($(LDAP_TOOL_ARGPIN),1) -LDAPTOOLCOMMON_OBJ += $(addprefix $(OBJDEST)/, argpin.obj) \ - $(addprefix $(OBJDEST)/, ntuserpin.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) -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 -ifeq ($(LDAP_TOOL_ARGPIN),1) -LDAPTOOLCOMMON_OBJ += $(addprefix $(OBJDEST)/, argpin.o) \ - $(addprefix $(OBJDEST)/, ntuserpin.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) $(LDAPTOOLCOMMON_OBJ) - -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)) - -BINS= $(LDAPDELETE) $(LDAPMODIFY) $(LDAPSEARCH) $(LDAPCOMPARE) $(LDAPCMP) - -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) \ - -lthread -lposix4 -lsocket -lnls \ - -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 -ifeq ($(LDAP_TOOL_ARGPIN),1) -EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(SVRCORE_LIBNAME).lib -endif -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$(LBER_LIBNAME) \ - -ldl -lresolv -lpthread -EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib $(DYNAMICNSPR) -endif - -ifeq ($(OS_ARCH), HP-UX) -EXTRA_LIBS = -ldld -lm -lpthread -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_LIBNLS -ifeq ($(OS_ARCH), WINNT) -EXTRA_LIBS += $(LIBNLS_LIBDIR)/$(NSCNV_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSJPN_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSCCK_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSSB_LIBNAME) -else -ifeq ($(OS_ARCH), SunOS) -OS_VERS := $(shell uname -r) -ifeq ($(OS_VERS),5.6) -EXTRA_LIBS += $(LIBNLS_LIBDIR)/$(NSCNV_LIBNAME) -lC \ - $(LIBNLS_LIBDIR)/$(NSJPN_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSCCK_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSSB_LIBNAME) -else -EXTRA_LIBS += $(LIBNLS_LIBDIR)/$(NSCNV_LIBNAME) -lCrun \ - $(LIBNLS_LIBDIR)/$(NSJPN_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSCCK_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSSB_LIBNAME) -endif -else -endif -EXTRA_LIBS += $(LIBNLS_LIBDIR)/$(NSCNV_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSJPN_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSCCK_LIBNAME) \ - $(LIBNLS_LIBDIR)/$(NSSB_LIBNAME) -endif -endif - -LDTOOLS_LIBS += $(EXTRA_LIBS) -LIBLOCATION = $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib - -########################################################################### - -all:: $(BINS) $(OBJDEST) linklibnls libdir $(BINS) - -libdir: linklibnls -ifeq ($(OS_ARCH), WINNT) - $(NSINSTALL) $(LIBLOCATION)/$(LDAP_LIBNAME).$(DLL_SUFFIX) $(LIBDIR) - $(NSINSTALL) $(LIBLOCATION)/$(PRLDAP_LIBNAME).$(DLL_SUFFIX) $(LIBDIR) - $(NSINSTALL) $(LIBLOCATION)/$(SSLDAP_LIBNAME).$(DLL_SUFFIX) $(LIBDIR) -else - $(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) - $(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 - $(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 -ifeq ($(COPYFREEBL), 1) - $(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/lib$(HYBRID_LIBNAME).$(DLL_SUFFIX) $(LIBDIR) - $(NSINSTALL) $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/lib$(PURE32_LIBNAME).$(DLL_SUFFIX) $(LIBDIR) -endif -else -ifeq ($(OS_ARCH), WINNT) - $(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 - $(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 -ifeq ($(COPYFREEBL), 1) - $(NSINSTALL) $(NSCP_DISTDIR)/lib/lib$(HYBRID_LIBNAME).$(DLL_SUFFIX) $(LIBDIR) - $(NSINSTALL) $(NSCP_DISTDIR)/lib/lib$(PURE32_LIBNAME).$(DLL_SUFFIX) $(LIBDIR) -endif -endif - -linklibnls: FORCE -ifneq ($(OS_ARCH), WINNT) -ifeq ($(HAVE_LIBNLS), 1) - $(RM) -f $(LIBNLS_INCLUDES) - $(RM) -f $(LIBNLS_LIBDIR) - ln -s $(LIBNLS_INCLUDES_LOC) $(LIBNLS_INCLUDES) - ln -s $(LIBNLS_LIB_LOC) $(LIBNLS_LIBDIR) -endif -else -ifeq ($(HAVE_LIBNLS), 1) - @echo "Pulling libnls......" -# The following shell script recalculates $(NLS_INCLUDE), $(NLS_LIBPATH) and -# $(NLS_VERSION_FILE) - sh ../../build/compver.sh $(LIBNLS_DIR) $(LIBNLS_RELDATE) \ - $(OBJDIR_NAME) ../../../../dist ldapsdk \ - /share/builds/components/libnls$(NLS_LIBVERSION)/v3.2/$(OBJDIR_NAME) \ - libnls$(NLS_LIBVERSION) \ - "include lib conv$(NLS_LIBVERSION) locale$(NLS_LIBVERSION)" \ - ../../../../../dist/libnls31/$(OBJDIR_NAME)/locale$(NLS_LIBVERSION)/index.txt -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): $(LDAPCOMPARE_OBJ) $(LDAPTOOLCOMMON_OBJ) \ - $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPCOMPARE_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS) - -$(LDAPDELETE): $(LDAPDELETE_OBJ) $(LDAPTOOLCOMMON_OBJ) \ - $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPDELETE_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS) - -$(LDAPMODIFY): $(LDAPMODIFY_OBJ) $(LDAPTOOLCOMMON_OBJ) \ - $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPMODIFY_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS) - -$(LDAPSEARCH): $(LDAPSEARCH_OBJ) $(LDAPTOOLCOMMON_OBJ) \ - $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPSEARCH_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS) - -$(LDAPCMP): $(LDAPCMP_OBJ) $(LDAPTOOLCOMMON_OBJ) \ - $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS_DEP) - $(LINK_EXE) $(LDAPCMP_OBJ) $(LDAPTOOLCOMMON_OBJ) $(LDAPTOOLCPPCOMMON_OBJ) $(LDTOOLS_LIBS) - -$(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) - - -# -# 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) - -FORCE: diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/Options.txt b/mozilla/directory/c-sdk/ldap/clients/tools/Options.txt deleted file mode 100644 index e361177bcd6..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/Options.txt +++ /dev/null @@ -1,59 +0,0 @@ -Summary of options used by the LDAP tools - -Updated 5-May-2000 by Mark Smith - - -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: - sorted: 0 DEHIKMNOPQRVWXYZ dfhikmnpvwy - avail: [2-9] J g (not used by any of the tools) - -ldapcmp.c: - raw: Bb:l:s:z: - sorted: B blsz - all: 0 BDHIKMNOPQRVWXYZ bdfhiklmnpsvwyz - avail: [1-9] ACFGJLSTU acegjoqrtu - -ldapcompare.c: - raw: cq - sorted: cq - all: 0 DEHIKMNOPQRVWXYZ cdfhikmnpqvwy - avail: [1-9] ABCFJLSTU abegjlorstuxz - -ldapdelete.c (deprecated) - raw: c - sorted: c - all: 0 DHIKMNOPQRVWXYZ cdfhikmnpvwy - avail: [1-9] ABCFGJLSTU abegjloqrstuxz - -ldapmodify.c - raw: aAbcFe:B:q - sorted: ABF abceq - all: 0 ABDFHIKMNOPQRVWXYZ abcdefhikmnpqvwy - avail: [1-9] CGJLSTU gjlorstuxz - -ldapmodrdn.c (deprecated) - raw: cr - sorted: cr - all: 0 DHIKMNOPQRVWXYZ cdfhikmnprvwy - avail: [1-9] ABCFGJLSTU abegjloqstuxz - -ldapsearch.c - raw: ABLTU1eotuxa:b:F:G:l:S:s:z:C: - sorted: 1 ABCFGLSTU abeostuxz - all: 01 ABCDFGHIKLMNOPQRSTUVWXYZ abdefhikmnopstuvwxyz - avail: [2-9] J cgjlqr diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/argpin.c b/mozilla/directory/c-sdk/ldap/clients/tools/argpin.c deleted file mode 100644 index 1c5481dc8f6..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/argpin.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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 -#include - -#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 }; - diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/argpin.h b/mozilla/directory/c-sdk/ldap/clients/tools/argpin.h deleted file mode 100644 index d9959739eb7..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/argpin.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 - -typedef struct SVRCOREArgPinObj SVRCOREArgPinObj; - -SVRCOREError -SVRCORE_CreateArgPinObj(SVRCOREArgPinObj **out, const char * tokenName, const char *password, SVRCOREPinObj *pinObj); - -void -SVRCORE_DestroyArgPinObj(SVRCOREArgPinObj *obj); - -#endif diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/common.c b/mozilla/directory/c-sdk/ldap/clients/tools/common.c deleted file mode 100644 index f946b230482..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/common.c +++ /dev/null @@ -1,2185 +0,0 @@ -/* - * 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): - */ - -/* - * code that is shared by two or more of the LDAP command line tools - */ - -#include "ldaptool.h" -#include "fileurl.h" - -#ifdef LDAP_TOOL_ARGPIN -#include "argpin.h" -#include "ntuserpin.h" -#endif /* LDAP_TOOL_ARGPIN */ - -#include /* for PR_Cleanup() */ -#include -#include /* for time() and ctime() */ - -static LDAP_REBINDPROC_CALLBACK get_rebind_credentials; -static void print_library_info( const LDAPAPIInfo *aip, FILE *fp ); -static int wait4result( LDAP *ld, int msgid, struct berval **servercredp, - char *msg ); -static int parse_result( LDAP *ld, LDAPMessage *res, - struct berval **servercredp, char *msg, int freeit ); - -#ifdef LDAPTOOL_DEBUG_MEMORY -static void *ldaptool_debug_malloc( size_t size ); -static void *ldaptool_debug_calloc( size_t nelem, size_t elsize ); -static void *ldaptool_debug_realloc( void *ptr, size_t size ); -static void ldaptool_debug_free( void *ptr ); -#endif /* LDAPTOOL_DEBUG_MEMORY */ - -#if defined(NET_SSL) -static char *certpath2keypath( char *certdbpath ); -static int ldaptool_setcallbacks( struct ldapssl_pkcs_fns *pfns); -static char * buildTokenCertName( const char *tokenName, const char *certName); -#ifdef FORTEZZA -static int ldaptool_fortezza_init( int exit_on_error ); -static int ldaptool_fortezza_alert( void *arg, PRBool onOpen, - char *string, int value1, void *value2 ); -static void * ldaptool_fortezza_getpin( char **passwordp ); -static char * ldaptool_fortezza_err2string( int err ); -#endif /* FORTEZZA */ -#endif - -/* - * display usage for common options with one exception: -f is not included - * since the description tends to be tool-specific. - * - * As of 1-Jul-1998, of the characters in the set [A-Za-z] the following are - * not currently used by any of the tools: EJgjqr - */ -void -ldaptool_common_usage( int two_hosts ) -{ - fprintf( stderr, " -n\t\tshow what would be done but don't actually do it\n" ); - fprintf( stderr, " -v\t\trun in verbose mode (diagnostics to standard output)\n" ); - if ( two_hosts ) { - fprintf( stderr, " -h host\tLDAP server1 name or IP address (default: %s)\n", LDAPTOOL_DEFHOST ); - fprintf( stderr, " -p port\tLDAP server1 TCP port number (default: %d)\n", LDAP_PORT ); - fprintf( stderr, " -h host\tLDAP server2 name or IP address (default: %s)\n", LDAPTOOL_DEFHOST ); - fprintf( stderr, " -p port\tLDAP server2 TCP port number (default: %d)\n", LDAP_PORT ); - } else { - fprintf( stderr, " -h host\tLDAP server name or IP address (default: %s)\n", LDAPTOOL_DEFHOST ); - fprintf( stderr, " -p port\tLDAP server TCP port number (default: %d)\n", LDAP_PORT ); - } - fprintf( stderr, - " -V n\tLDAP protocol version number (%d or %d; default: %d)\n", - LDAP_VERSION2, LDAP_VERSION3, LDAP_VERSION3 ); -#if defined(NET_SSL) - fprintf( stderr, " -Z\t\tmake an SSL-encrypted connection\n" ); - fprintf( stderr, " -P pathname\tpath to SSL certificate database (default: current directory)\n" ); - fprintf( stderr, " -N\t\tname of certificate to use for SSL client authentication\n" ); - fprintf( stderr, " -K pathname\tpath to key database to use for SSL client authentication\n" ); - fprintf( stderr, " \t\t(default: path to certificate database provided with -P option)\n" ); -#ifdef LDAP_TOOL_PKCS11 - fprintf( stderr, " -m pathname\tpath to security module database\n"); -#endif /* LDAP_TOOL_PKCS11 */ - fprintf( stderr, " -W\t\tSSL key password\n" ); - -#ifdef LDAP_TOOL_PKCS11 - fprintf( stderr, " -Q [token][:certificate name]\tPKCS 11\n" ); - fprintf( stderr, " -X pathname\tFORTEZZA compromised key list (CKL)\n" ); - fprintf( stderr, " -I pin\tcard password file\n" ); -#endif /* LDAP_TOOL_PKCS11 */ - -#endif /* NET_SSL */ - fprintf( stderr, " -D binddn\tbind dn\n" ); - fprintf( stderr, " -w passwd\tbind passwd (for simple authentication)\n" ); - fprintf( stderr, " -w - \tprompt for bind passwd (for simple authentication)\n" ); - fprintf( stderr, " -j file\tread bind passwd from 'file' (for simple authentication)\n" ); - fprintf( stderr, " -E\t\task server to expose (report) bind identity\n" ); -#ifdef LDAP_DEBUG - fprintf( stderr, " -d level\tset LDAP debugging level to `level'\n" ); -#endif - fprintf( stderr, " -R\t\tdo not automatically follow referrals\n" ); - fprintf( stderr, " -O limit\tmaximum number of referral hops to traverse (default: %d)\n", LDAPTOOL_DEFREFHOPLIMIT ); - fprintf( stderr, " -M\t\tmanage references (treat them as regular entries)\n" ); - fprintf( stderr, " -0\t\tignore LDAP library version mismatches\n" ); - -#ifndef NO_LIBLCACHE - fprintf( stderr, " -C cfgfile\tuse local database described by cfgfile\n" ); -#endif - fprintf( stderr, " -i charset\tcharacter set for command line input (default taken from locale)\n" ); - fprintf( stderr, " -k dir\tconversion routine directory (default: current directory)\n" ); -#if 0 -/* - * Suppress usage for -y (old proxied authorization control) even though - * we still support it. We want to encourage people to use -Y instead (the - * new proxied authorization control). - */ - fprintf( stderr, " -y proxydn\tDN used for proxy authorization\n" ); -#endif - fprintf( stderr, " -Y proxyid\tproxied authorization id,\n" ); - fprintf( stderr, " \te.g, dn:uid=bjensen,dc=example,dc=com\n" ); - fprintf( stderr, " -H\t\tdisplay usage information\n" ); - fprintf( stderr, " -J controloid[:criticality[:value|::b64value|:ldctl_value), - 1 /* recognize file URLs */, - 0 /* always try file */, - 1 /* report errors */ ); - if ((rc = ldaptool_fileurlerr2ldaperr( rc )) != LDAP_SUCCESS) { - fprintf( stderr, "Unable to parse %s\n", ctrl_value); - return (-1); - } - } - ldctrl->ldctl_oid = ctrl_oid; - ldctrl->ldctl_iscritical = ctrl_criticality; - ldaptool_add_control_to_array(ldctrl, ldaptool_request_ctrls); - break; - default: - (*extra_opt_callback)( i, optarg ); - } - } - - /* If '-Z' is specified, check if '-P' is specified too. */ - if ( isN || isW ) { - if ( !isZ ) { - printf( "%s: with -N, -W options, please specify -Z\n\n", ldaptool_progname ); - return (-1); - } - } - - if ( isj && isw ) { - fprintf(stderr, "%s: -j and -w options cannot be specified simultaneously\n\n", ldaptool_progname ); - return (-1); - } - - if ( (isj || isw) && !isD ) { - fprintf(stderr, "%s: with -j, -w options, please specify -D\n\n", ldaptool_progname ); - return (-1); - } - - if (prompt_password != 0) { - char *password_string = "Enter bind password: "; - char pbuf[257]; - -#if defined(_WIN32) - fputs(password_string,stdout); - fflush(stdout); - if (fgets(pbuf,256,stdin) == NULL) { - passwd = NULL; - } else { - char *tmp; - - tmp = strchr(pbuf,'\n'); - if (tmp) *tmp = '\0'; - tmp = strchr(pbuf,'\r'); - if (tmp) *tmp = '\0'; - passwd = pbuf; - } -#else -#if defined(SOLARIS) - /* 256 characters on Solaris */ - passwd = getpassphrase(password_string); -#else - /* limited to 16 chars on Tru64, 32 on AIX */ - passwd = getpass(password_string); -#endif -#endif - - } else if (password_fp != NULL) { - char *linep = NULL; - int increment = 0; - int c, index; - - /* allocate initial block of memory */ - if ((linep = (char *)malloc(BUFSIZ)) == NULL) { - fprintf( stderr, "%s: not enough memory to read password from file\n", ldaptool_progname ); - exit( LDAP_NO_MEMORY ); - } - increment++; - index = 0; - while ((c = fgetc( password_fp )) != '\n' && c != EOF) { - - /* check if we will overflow the buffer */ - if ((c != EOF) && (index == ((increment * BUFSIZ) -1))) { - - /* if we did, add another BUFSIZ worth of bytes */ - if ((linep = (char *) - realloc(linep, (increment + 1) * BUFSIZ)) == NULL) { - fprintf( stderr, "%s: not enough memory to read password from file\n", ldaptool_progname ); - exit( LDAP_NO_MEMORY ); - } - increment++; - } - linep[index++] = c; - } - linep[index] = '\0'; - passwd = linep; - } - - /* - * If verbose (-v) flag was passed in, display program name and start time. - * If the verbose flag was passed at least twice (-vv), also display - * information about the API library we are running with. - */ - if ( ldaptool_verbose ) { - time_t curtime; - - curtime = time( NULL ); - printf( "%s: started %s\n", ldaptool_progname, ctime( &curtime )); - if ( ldaptool_verbose > 1 ) { - print_library_info( &ldai, stdout ); - } - } - -#ifdef LDAP_TOOL_PKCS11 - if ((NULL != pkcs_token) && (NULL != ssl_certname)) { - char *result; - - if ( (result = buildTokenCertName( pkcs_token, ssl_certname)) != NULL){ - free( ssl_certname ); - ssl_certname = result; - } - } -#endif /* LDAP_TOOL_PKCS11 */ - - free( optstring ); - - /* - * Clean up and return index of first non-option argument. - */ - if ( ldai.ldapai_extensions != NULL ) { - ldap_value_free( ldai.ldapai_extensions ); - } - if ( ldai.ldapai_vendor_name != NULL ) { - ldap_memfree( ldai.ldapai_vendor_name ); - } - - return( optind ); -} - - -/* - * Write detailed information about the API library we are running with to fp. - */ -static void -print_library_info( const LDAPAPIInfo *aip, FILE *fp ) -{ - int i; - LDAPAPIFeatureInfo fi; - - fprintf( fp, "LDAP Library Information -\n" - " Highest supported protocol version: %d\n" - " LDAP API revision: %d\n" - " API vendor name: %s\n" - " Vendor-specific version: %.2f\n", - aip->ldapai_protocol_version, aip->ldapai_api_version, - aip->ldapai_vendor_name, - (float)aip->ldapai_vendor_version / 100.0 ); - - if ( aip->ldapai_extensions != NULL ) { - fputs( " LDAP API Extensions:\n", fp ); - - for ( i = 0; aip->ldapai_extensions[i] != NULL; i++ ) { - fprintf( fp, " %s", aip->ldapai_extensions[i] ); - fi.ldapaif_info_version = LDAP_FEATURE_INFO_VERSION; - fi.ldapaif_name = aip->ldapai_extensions[i]; - fi.ldapaif_version = 0; - - if ( ldap_get_option( NULL, LDAP_OPT_API_FEATURE_INFO, &fi ) - != 0 ) { - fprintf( fp, " %s: ldap_get_option( NULL," - " LDAP_OPT_API_FEATURE_INFO, ... ) for %s failed" - " (Feature Info version: %d)\n", ldaptool_progname, - fi.ldapaif_name, fi.ldapaif_info_version ); - } else { - fprintf( fp, " (revision %d)\n", fi.ldapaif_version); - } - } - } - fputc( '\n', fp ); -} - - - -#ifdef LDAP_TOOL_ARGPIN -static int PinArgRegistration( void ) -{ - - /* pkcs_init was successful register the pin args */ - - SVRCOREArgPinObj *ArgPinObj; - char *tokenName; -#ifndef _WIN32 - SVRCOREStdPinObj *StdPinObj; -#else - SVRCOREFilePinObj *FilePinObj; - SVRCOREAltPinObj *AltPinObj; - SVRCORENTUserPinObj *NTUserPinObj; - int err; -#endif - char *pin; - char *filename; - /* Create and register the pin object for PKCS 11 */ - local_pkcs_fns.pkcs_getdonglefilename(NULL, &filename); - local_pkcs_fns.pkcs_getpin(NULL, "", &pin); -#ifndef _WIN32 - if ( SVRCORE_CreateStdPinObj(&StdPinObj, filename, PR_TRUE) != - SVRCORE_Success) { - printf("Security Initialization: Unable to create PinObj " - "(%d)", PR_GetError()); - return -1; - } - if (pin != NULL) - { - local_pkcs_fns.pkcs_gettokenname(NULL, &tokenName); - SVRCORE_CreateArgPinObj(&ArgPinObj, tokenName, pin, (SVRCOREPinObj *)StdPinObj); - SVRCORE_RegisterPinObj((SVRCOREPinObj *)ArgPinObj); - } - else - { - SVRCORE_RegisterPinObj((SVRCOREPinObj *)StdPinObj); - } -#else - if (NULL != pin) - { - local_pkcs_fns.pkcs_gettokenname(NULL, &tokenName); - if ((err = SVRCORE_CreateNTUserPinObj(&NTUserPinObj)) != SVRCORE_Success){ - printf("Security Initialization: Unable to create NTUserPinObj " - "(%d)", PR_GetError()); - exit( LDAP_LOCAL_ERROR ); - } - if ((err = SVRCORE_CreateArgPinObj(&ArgPinObj, tokenName, pin, - (SVRCOREPinObj *)NTUserPinObj)) != SVRCORE_Success) - { - printf("Security Initialization: Unable to create ArgPinObj " - "(%d)", PR_GetError()); - return -1; - - } - SVRCORE_RegisterPinObj((SVRCOREPinObj *)ArgPinObj); - - } - else - { - if ((err = SVRCORE_CreateNTUserPinObj(&NTUserPinObj)) != SVRCORE_Success){ - printf("Security Initialization: Unable to create NTUserPinObj " - "(%d)", PR_GetError()); - return -1; - } - if (filename && *filename) - { - if ((err = SVRCORE_CreateFilePinObj(&FilePinObj, filename)) != - SVRCORE_Success) { - printf("Security Initialization: Unable to create FilePinObj " - "(%d)", PR_GetError()); - return -1; - - } - if ((err = SVRCORE_CreateAltPinObj(&AltPinObj, (SVRCOREPinObj *)FilePinObj, - (SVRCOREPinObj *)NTUserPinObj)) != SVRCORE_Success) { - printf("Security Initialization: Unable to create AltPinObj " - "(%d)", PR_GetError()); - return -1; - } - SVRCORE_RegisterPinObj((SVRCOREPinObj *)AltPinObj); - } - else - { - SVRCORE_RegisterPinObj((SVRCOREPinObj *)NTUserPinObj); - } - } -#endif - return LDAP_SUCCESS; - -} -#endif /* LDAP_TOOL_ARGPIN */ - - -/* - * initialize and return an LDAP session handle. - * if errors occur, we exit here. - */ -LDAP * -ldaptool_ldap_init( int second_host ) -{ - LDAP *ld = NULL; - char *host; - int port, rc, user_port; - - if ( ldaptool_not ) { - return( NULL ); - } - - if ( second_host ) { - host = ldaptool_host2; - port = ldaptool_port2; - user_port = user_specified_port2; - } else { - host = ldaptool_host; - port = ldaptool_port; - user_port = user_specified_port; - } - - - if ( ldaptool_verbose ) { - printf( "ldap_init( %s, %d )\n", host, port ); - } - -#if defined(NET_SSL) - /* - * Initialize security libraries and databases and LDAP session. If - * ssl_certname is not NULL, then we will attempt to use client auth. - * if the server supports it. - */ -#ifdef LDAP_TOOL_PKCS11 - ldaptool_setcallbacks( &local_pkcs_fns ); - - if ( !second_host && secure - &&(rc = ldapssl_pkcs_init( &local_pkcs_fns)) < 0) { - /* secure connection requested -- fail if no SSL */ - rc = PORT_GetError(); - fprintf( stderr, "SSL initialization failed: error %d (%s)\n", - rc, ldapssl_err2string( rc )); - exit( LDAP_LOCAL_ERROR ); - } - -#ifdef LDAP_TOOL_ARGPIN - if (secure) { - if (PinArgRegistration( )) { - exit( LDAP_LOCAL_ERROR); - } - } -#endif /* LDAP_TOOL_ARGPIN */ - -#else /* LDAP_TOOL_PKCS11 */ - if ( !second_host && secure - &&(rc = ldapssl_client_init( ssl_certdbpath, NULL )) < 0) { - /* secure connection requested -- fail if no SSL */ - rc = PORT_GetError(); - fprintf( stderr, "SSL initialization failed: error %d (%s)\n", - rc, ldapssl_err2string( rc )); - exit( LDAP_LOCAL_ERROR ); - } -#endif /* LDAP_TOOL_PKCS11 */ - - if (secure) { - if ( !user_port ) { - port = LDAPS_PORT; - } - - if (( ld = ldapssl_init( host, port, - secure )) != NULL && ssl_certname != NULL ) - if (ldapssl_enable_clientauth( ld, ssl_keydbpath, ssl_passwd, - ssl_certname ) != 0 ) { - exit ( ldaptool_print_lderror( ld, "ldapssl_enable_clientauth", - LDAPTOOL_CHECK4SSL_ALWAYS )); - } - } else { - /* In order to support IPv6, we use NSPR I/O */ - ld = prldap_init( host, port, 0 /* not shared across threads */ ); - } - -#else - /* In order to support IPv6, we use NSPR I/O */ - ld = prldap_init( host, port, 0 /* not shared across threads */ ); -#endif - - if ( ld == NULL ) { - perror( "ldap_init" ); - exit( LDAP_LOCAL_ERROR ); - } - -#ifndef NO_LIBLCACHE - if ( cache_config_file != NULL ) { - int opt; - - if ( lcache_init( ld, cache_config_file ) != 0 ) { - exit( ldaptool_print_lderror( ld, cache_config_file, - LDAPTOOL_CHECK4SSL_NEVER )); - } - opt = 1; - (void) ldap_set_option( ld, LDAP_OPT_CACHE_ENABLE, &opt ); - opt = LDAP_CACHE_LOCALDB; - (void) ldap_set_option( ld, LDAP_OPT_CACHE_STRATEGY, &opt ); - if ( ldversion == -1 ) { /* not set with -V */ - ldversion = LDAP_VERSION2; /* local db only supports v2 */ - } - } -#endif - - - ldap_set_option( ld, LDAP_OPT_REFERRALS, chase_referrals ? LDAP_OPT_ON: - LDAP_OPT_OFF ); - if ( chase_referrals ) { - ldap_set_rebind_proc( ld, get_rebind_credentials, NULL ); - ldap_set_option( ld, LDAP_OPT_REFERRAL_HOP_LIMIT, &refhoplim ); - } - - if ( ldversion == -1 ) { /* not set with -V and not using local db */ - ldversion = LDAP_VERSION3; - } - ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &ldversion ); - - return( ld ); -} - - -/* - * perform a bind to the LDAP server if needed. - * if an error occurs, we exit here. - */ -void -ldaptool_bind( LDAP *ld ) -{ - int rc; - char *conv; - LDAPControl auth_resp_ctrl, *ctrl_array[ 2 ], **bindctrls; - - if ( ldaptool_not ) { - return; - } - - if ( send_auth_response_ctrl ) { - auth_resp_ctrl.ldctl_oid = LDAP_CONTROL_AUTH_REQUEST; - auth_resp_ctrl.ldctl_value.bv_val = NULL; - auth_resp_ctrl.ldctl_value.bv_len = 0; - auth_resp_ctrl.ldctl_iscritical = 0; - - ctrl_array[0] = &auth_resp_ctrl; - ctrl_array[1] = NULL; - bindctrls = ctrl_array; - } else { - bindctrls = NULL; - } - - /* - * if using LDAPv3 and not using client auth., omit NULL bind for - * efficiency. - */ - if ( ldversion > LDAP_VERSION2 && binddn == NULL && passwd == NULL - && ssl_certname == NULL ) { - return; - } - - /* - * do the bind, backing off one LDAP version if necessary - */ - conv = ldaptool_local2UTF8( binddn ); - - /* - * if using LDAPv3 and client auth., try a SASL EXTERNAL bind - */ - if ( ldversion > LDAP_VERSION2 && binddn == NULL && passwd == NULL - && ssl_certname != NULL ) { - rc = ldaptool_sasl_bind_s( ld, NULL, LDAP_SASL_EXTERNAL, NULL, - bindctrls, NULL, NULL, "ldap_sasl_bind" ); - } else { - rc = ldaptool_simple_bind_s( ld, conv, passwd, bindctrls, NULL, - "ldap_simple_bind" ); - } - - if ( rc == LDAP_SUCCESS ) { - if ( conv != NULL ) { - free( conv ); - } - return; /* success */ - } - - if ( rc == LDAP_PROTOCOL_ERROR && ldversion > LDAP_VERSION2 ) { - /* - * try again, backing off one LDAP version - * this is okay even for client auth. because the way to achieve - * client auth. with LDAPv2 is to perform a NULL simple bind. - */ - --ldversion; - fprintf( stderr, "%s: the server doesn't understand LDAPv%d;" - " trying LDAPv%d instead...\n", ldaptool_progname, - ldversion + 1, ldversion ); - ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &ldversion ); - if (( rc = ldaptool_simple_bind_s( ld, conv, passwd, - bindctrls, NULL, "ldap_simple_bind" )) == LDAP_SUCCESS ) { - if( conv != NULL ) - free( conv ); - return; /* a qualified success */ - } - } - - if ( conv != NULL ) { - free( conv ); - } - - /* - * bind(s) failed -- fatal error - */ - ldap_unbind( ld ); - exit( rc ); -} - - -/* - * close open files, unbind, etc. - */ -void -ldaptool_cleanup( LDAP *ld ) -{ - if ( ld != NULL ) { - ldap_unbind( ld ); - } - - if ( ldaptool_fp != NULL && ldaptool_fp != stdin ) { - fclose( ldaptool_fp ); - ldaptool_fp = NULL; - } -} - - -/* - * Retrieve and print an LDAP error message. Returns the LDAP error code. - */ -int -ldaptool_print_lderror( LDAP *ld, char *msg, int check4ssl ) -{ - int lderr = ldap_get_lderrno( ld, NULL, NULL ); - - ldap_perror( ld, msg ); - if ( secure && check4ssl != LDAPTOOL_CHECK4SSL_NEVER ) { - if ( check4ssl == LDAPTOOL_CHECK4SSL_ALWAYS - || ( lderr == LDAP_SERVER_DOWN )) { - int sslerr = PORT_GetError(); - - fprintf( stderr, "\tSSL error %d (%s)\n", sslerr, - ldapssl_err2string( sslerr )); - } - } - - return( lderr ); -} - - -/* - * print referrals to stderr - */ -void -ldaptool_print_referrals( char **refs ) -{ - int i; - - if ( refs != NULL ) { - for ( i = 0; refs[ i ] != NULL; ++i ) { - fprintf( stderr, "Referral: %s\n", refs[ i ] ); - } - } -} - - -/* - * print contents of an extended response to stderr - * this is mainly to support unsolicited notifications - * Returns an LDAP error code (from the extended result). - */ -int -ldaptool_print_extended_response( LDAP *ld, LDAPMessage *res, char *msg ) -{ - char *oid; - struct berval *data; - - if ( ldap_parse_extended_result( ld, res, &oid, &data, 0 ) - != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - } else { - if ( oid != NULL ) { - if ( strcmp ( oid, LDAP_NOTICE_OF_DISCONNECTION ) == 0 ) { - fprintf( stderr, "%s: Notice of Disconnection\n", msg ); - } else { - fprintf( stderr, "%s: OID %s\n", msg, oid ); - } - ldap_memfree( oid ); - } else { - fprintf( stderr, "%s: missing OID\n", msg ); - } - - if ( data != NULL ) { - fprintf( stderr, "%s: Data (length %ld):\n", msg, data->bv_len ); -#if 0 -/* XXXmcs: maybe we should display the actual data? */ - lber_bprint( data->bv_val, data->bv_len ); -#endif - ber_bvfree( data ); - } - } - - return parse_result( ld, res, NULL, msg, 1 ); -} - - -/* - * Like ldap_sasl_bind_s() but calls wait4result() to display - * any referrals returned and report errors in a consistent way. - */ -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 rc, msgid; - - if ( servercredp != NULL ) { - *servercredp = NULL; - } - - if (( rc = ldap_sasl_bind( ld, dn, mechanism, cred, serverctrls, - clientctrls, &msgid )) != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - } else { - rc = wait4result( ld, msgid, servercredp, msg ); - } - - return( rc ); -} - - -/* - * Like ldap_simple_bind_s() but calls wait4result() to display - * any referrals returned and report errors in a consistent way. - */ -int -ldaptool_simple_bind_s( LDAP *ld, const char *dn, const char *passwd, - LDAPControl **serverctrls, LDAPControl **clientctrls, char *msg ) -{ - struct berval bv; - - bv.bv_val = (char *)passwd; /* XXXmcs: had to cast away const */ - bv.bv_len = ( passwd == NULL ? 0 : strlen( passwd )); - return( ldaptool_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, &bv, serverctrls, - clientctrls, NULL, msg )); -} - - -/* - * Like ldap_add_ext_s() but calls wait4result() to display - * any referrals returned and report errors in a consistent way. - */ -int -ldaptool_add_ext_s( LDAP *ld, const char *dn, LDAPMod **attrs, - LDAPControl **serverctrls, LDAPControl **clientctrls, char *msg ) -{ - int rc, msgid; - - if (( rc = ldap_add_ext( ld, dn, attrs, serverctrls, clientctrls, &msgid )) - != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - } else { - /* - * 25-April-2000 Note: the next line used to read: - * rc = wait4result( ld, msgid, NULL, msg ); - * 'msgid' it was changed to 'LDAP_RES_ANY' in order to receive - * unsolicited notifications. - */ - rc = wait4result( ld, LDAP_RES_ANY, NULL, msg ); - } - - return( rc ); -} - - -/* - * Like ldap_modify_ext_s() but calls wait4result() to display - * any referrals returned and report errors in a consistent way. - */ -int -ldaptool_modify_ext_s( LDAP *ld, const char *dn, LDAPMod **mods, - LDAPControl **serverctrls, LDAPControl **clientctrls, char *msg ) -{ - int rc, msgid; - - if (( rc = ldap_modify_ext( ld, dn, mods, serverctrls, clientctrls, - &msgid )) != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - } else { - rc = wait4result( ld, msgid, NULL, msg ); - } - - return( rc ); -} - - -/* - * Like ldap_delete_ext_s() but calls wait4result() to display - * any referrals returned and report errors in a consistent way. - */ -int -ldaptool_delete_ext_s( LDAP *ld, const char *dn, LDAPControl **serverctrls, - LDAPControl **clientctrls, char *msg ) -{ - int rc, msgid; - - if (( rc = ldap_delete_ext( ld, dn, serverctrls, clientctrls, &msgid )) - != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - } else { - rc = wait4result( ld, msgid, NULL, msg ); - } - - return( rc ); -} - - -/* - * Like ldap_compare_ext_s() but calls wait4result() to display - * any referrals returned and report errors in a consistent way. - */ -int ldaptool_compare_ext_s( LDAP *ld, const char *dn, const char *attrtype, - const struct berval *bvalue, LDAPControl **serverctrls, - LDAPControl **clientctrls, char *msg ) -{ - int rc, msgid; - - if (( rc = ldap_compare_ext( ld, dn, attrtype, bvalue, serverctrls, - clientctrls, &msgid )) != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - } else { - rc = wait4result( ld, msgid, NULL, msg ); - } - - return( rc ); -} - - -/* - * Like ldap_rename_s() but calls wait4result() to display - * any referrals returned and report errors in a consistent way. - */ -int -ldaptool_rename_s( LDAP *ld, const char *dn, const char *newrdn, - const char *newparent, int deleteoldrdn, LDAPControl **serverctrls, - LDAPControl **clientctrls, char *msg ) -{ - int rc, msgid; - - if (( rc = ldap_rename( ld, dn, newrdn, newparent, deleteoldrdn, - serverctrls, clientctrls, &msgid )) != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - } else { - rc = wait4result( ld, msgid, NULL, msg ); - } - - return( rc ); -} - - -/* - * Wait for a result, check for and display errors and referrals. - * Also recognize and display "Unsolicited notification" messages. - * Returns an LDAP error code. - */ -static int -wait4result( LDAP *ld, int msgid, struct berval **servercredp, char *msg ) -{ - LDAPMessage *res; - int rc, received_only_unsolicited = 1; - - while ( received_only_unsolicited ) { - res = NULL; - if (( rc = ldap_result( ld, msgid, 1, (struct timeval *)NULL, &res )) - == -1 ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - return( ldap_get_lderrno( ld, NULL, NULL )); - } - - /* - * Special handling for unsolicited notifications: - * 1. Parse and display contents. - * 2. go back and wait for another (real) result. - */ - if ( rc == LDAP_RES_EXTENDED - && ldap_msgid( res ) == LDAP_RES_UNSOLICITED ) { - rc = ldaptool_print_extended_response( ld, res, - "Unsolicited response" ); - } else { - rc = parse_result( ld, res, servercredp, msg, 1 ); - received_only_unsolicited = 0; /* we're done */ - } - } - - return( rc ); -} - - -static int -parse_result( LDAP *ld, LDAPMessage *res, struct berval **servercredp, - char *msg, int freeit ) -{ - int rc, lderr, errno; - int pw_days=0, pw_hrs=0, pw_mins=0, pw_secs=0; /* for pwpolicy */ - char **refs = NULL; - LDAPControl **ctrls; - - if (( rc = ldap_parse_result( ld, res, &lderr, NULL, NULL, &refs, - &ctrls, 0 )) != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - ldap_msgfree( res ); - return( rc ); - } - - /* check for authentication response control & PWPOLICY control*/ - if ( NULL != ctrls ) { - int i; - char *s; - - for ( i = 0; NULL != ctrls[i]; ++i ) { - if ( 0 == strcmp( ctrls[i]->ldctl_oid, - LDAP_CONTROL_AUTH_RESPONSE )) { - s = ctrls[i]->ldctl_value.bv_val; - if ( NULL == s ) { - s = "Null"; - } else if ( *s == '\0' ) { - s = "Anonymous"; - } - fprintf( stderr, "%s: bound as %s\n", ldaptool_progname, s ); - } - - if ( 0 == strcmp( ctrls[i]->ldctl_oid, - LDAP_CONTROL_PWEXPIRING )) { - - /* Warn the user his passwd is to expire */ - errno = 0; - pw_secs = atoi(ctrls[i]->ldctl_value.bv_val); - if ( pw_secs > 0 && errno != ERANGE ) { - if ( pw_secs > 86400 ) { - pw_days = ( pw_secs / 86400 ); - pw_secs = ( pw_secs % 86400 ); - } - if ( pw_secs > 3600 ) { - pw_hrs = ( pw_secs / 3600 ); - pw_secs = ( pw_secs % 3600 ); - } - if ( pw_secs > 60 ) { - pw_mins = ( pw_secs / 60 ); - pw_secs = ( pw_secs % 60 ); - } - - printf("%s: Warning ! Your password will expire after ", ldaptool_progname); - if ( pw_days ) { - printf ("%d days, ", pw_days); - } - if ( pw_hrs ) { - printf ("%d hrs, ", pw_hrs); - } - if ( pw_mins ) { - printf ("%d mins, ", pw_mins); - } - printf("%d seconds.\n", pw_secs); - - } - } - } - ldap_controls_free( ctrls ); - } - - if ( servercredp != NULL && ( rc = ldap_parse_sasl_bind_result( ld, res, - servercredp, 0 )) != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - ldap_msgfree( res ); - return( rc ); - } - - if ( freeit ) { - ldap_msgfree( res ); - } - - if ( LDAPTOOL_RESULT_IS_AN_ERROR( lderr )) { - ldaptool_print_lderror( ld, msg, LDAPTOOL_CHECK4SSL_IF_APPROP ); - } - - if ( refs != NULL ) { - ldaptool_print_referrals( refs ); - ldap_value_free( refs ); - } - - return( lderr ); -} - - -/* - * if -M was passed on the command line, create and return a "Manage DSA IT" - * LDAPv3 control. If not, return NULL. - */ -LDAPControl * -ldaptool_create_manage_dsait_control( void ) -{ - LDAPControl *ctl; - - if ( !send_manage_dsait_ctrl ) { - return( NULL ); - } - - if (( ctl = (LDAPControl *)calloc( 1, sizeof( LDAPControl ))) == NULL || - ( ctl->ldctl_oid = strdup( LDAP_CONTROL_MANAGEDSAIT )) == NULL ) { - perror( "calloc" ); - exit( LDAP_NO_MEMORY ); - } - - ctl->ldctl_iscritical = 1; - - return( ctl ); -} - -/* - * if -y "dn" was supplied on the command line, create the control - */ -LDAPControl * -ldaptool_create_proxyauth_control( LDAP *ld ) -{ - LDAPControl *ctl = NULL; - int rc; - - - if ( !proxyauth_id) - return( NULL ); - - if ( 2 == proxyauth_version ) { - rc = ldap_create_proxiedauth_control( ld, proxyauth_id, &ctl); - } else { - rc = ldap_create_proxyauth_control( ld, proxyauth_id, 1, &ctl); - } - if ( rc != LDAP_SUCCESS) - { - if (ctl) - ldap_control_free( ctl); - return NULL; - } - return( ctl ); -} - -void -ldaptool_add_control_to_array( LDAPControl *ctrl, LDAPControl **array) -{ - - int i; - for (i=0; i< CONTROL_REQUESTS; i++) - { - if (*(array + i) == NULL) - { - *(array + i +1) = NULL; - *(array + i) = ctrl; - return ; - } - } - fprintf(stderr, "%s: failed to store request control!!!!!!\n", - ldaptool_progname); -} - -/* - * Dispose of all controls in array and prepare array for reuse. - */ -void -ldaptool_reset_control_array( LDAPControl **array ) -{ - int i; - - for ( i = 0; i < CONTROL_REQUESTS; i++ ) { - if ( array[i] != NULL ) { - ldap_control_free( array[i] ); - array[i] = NULL; - } - } -} - -/* - * This function calculates control value and its length. *value can - * be pointing to plain value, ":b64encoded value" or "bv_len; ++j ) { - if ( !isascii( bvp->bv_val[ j ] )) { - is_ascii = 0; - break; - } - } - - return( is_ascii ); -} - - -#ifdef LDAP_DEBUG_MEMORY -#define LDAPTOOL_ALLOC_FREED 0xF001 -#define LDAPTOOL_ALLOC_INUSE 0xF002 - -static void * -ldaptool_debug_alloc( void *ptr, size_t size ) -{ - int *statusp; - void *systemptr; - - if ( ptr == NULL ) { - systemptr = NULL; - } else { - systemptr = (void *)((char *)ptr - sizeof(int)); - } - - if (( statusp = (int *)realloc( systemptr, size + sizeof(int))) == NULL ) { - fprintf( stderr, "%s: realloc( 0x%x, %d) failed\n", - ldaptool_progname, systemptr, size ); - return( NULL ); - } - - *statusp = LDAPTOOL_ALLOC_INUSE; - - return( (char *)statusp + sizeof(int)); -} - - -static void * -ldaptool_debug_realloc( void *ptr, size_t size ) -{ - void *p; - - if ( ldaptool_dbg_lvl & LDAP_DEBUG_TRACE ) { - fprintf( stderr, "%s: => realloc( 0x%x, %d )\n", - ldaptool_progname, ptr, size ); - } - - p = ldaptool_debug_alloc( ptr, size ); - - if ( ldaptool_dbg_lvl & LDAP_DEBUG_TRACE ) { - fprintf( stderr, "%s: 0x%x <= realloc()\n", ldaptool_progname, p ); - } - - return( p ); -} - - -static void * -ldaptool_debug_malloc( size_t size ) -{ - void *p; - - if ( ldaptool_dbg_lvl & LDAP_DEBUG_TRACE ) { - fprintf( stderr, "%s: => malloc( %d)\n", ldaptool_progname, size ); - } - - p = ldaptool_debug_alloc( NULL, size ); - - if ( ldaptool_dbg_lvl & LDAP_DEBUG_TRACE ) { - fprintf( stderr, "%s: 0x%x <= malloc()\n", ldaptool_progname, p ); - } - - return( p ); -} - - -static void * -ldaptool_debug_calloc( size_t nelem, size_t elsize ) -{ - void *p; - - if ( ldaptool_dbg_lvl & LDAP_DEBUG_TRACE ) { - fprintf( stderr, "%s: => calloc( %d, %d )\n", - ldaptool_progname, nelem, elsize ); - } - - if (( p = ldaptool_debug_alloc( NULL, nelem * elsize )) != NULL ) { - memset( p, 0, nelem * elsize ); - } - - if ( ldaptool_dbg_lvl & LDAP_DEBUG_TRACE ) { - fprintf( stderr, "%s: 0x%x <= calloc()\n", ldaptool_progname, p ); - } - - return( p ); -} - - -static void -ldaptool_debug_free( void *ptr ) -{ - int *statusp = (int *)((char *)ptr - sizeof(int)); - - if ( ldaptool_dbg_lvl & LDAP_DEBUG_TRACE ) { - fprintf( stderr, "%s: => free( 0x%x )\n", ldaptool_progname, ptr ); - } - - if ( ptr == NULL ) { - fprintf( stderr, "%s: bad free( 0x0 ) attempted (NULL pointer)\n", - ldaptool_progname ); - } else if ( *statusp != LDAPTOOL_ALLOC_INUSE ) { - fprintf( stderr, "%s: bad free( 0x%x ) attempted" - " (block not in use; status is %d)\n", - ldaptool_progname, ptr, *statusp ); - } else { - *statusp = LDAPTOOL_ALLOC_FREED; - free( statusp ); - } -} -#endif /* LDAP_DEBUG_MEMORY */ - - -#if defined(NET_SSL) -/* - * Derive key database path from certificate database path and return a - * malloc'd string. - * - * We just return an exact copy of "certdbpath" unless it ends in "cert.db", - * "cert5.db", or "cert7.db". In those cases we strip off everything from - * "cert" on and append "key.db", "key5.db", or "key3.db" as appropriate. - * Strangely enough cert7.db and key3.db go together. - */ -static char * -certpath2keypath( char *certdbpath ) -{ - char *keydbpath, *appendstr; - int len, striplen; - - if ( certdbpath == NULL ) { - return( NULL ); - } - - if (( keydbpath = strdup( certdbpath )) == NULL ) { - perror( "strdup" ); - exit( LDAP_NO_MEMORY ); - } - - len = strlen( keydbpath ); - if ( len > 7 && - strcasecmp( "cert.db", keydbpath + len - 7 ) == 0 ) { - striplen = 7; - appendstr = "key.db"; - - } else if ( len > 8 && - strcasecmp( "cert5.db", keydbpath + len - 8 ) == 0 ) { - striplen = 8; - appendstr = "key5.db"; - } else if ( len > 8 && - strcasecmp( "cert7.db", keydbpath + len - 8 ) == 0 ) { - striplen = 8; - appendstr = "key3.db"; - } else { - striplen = 0; - } - - if ( striplen > 0 ) { - /* - * The following code assumes that strlen( appendstr ) < striplen! - */ - strcpy( keydbpath + len - striplen, appendstr ); - } - - return( keydbpath ); -} - -#ifdef LDAP_TOOL_PKCS11 -static -char * -buildTokenCertName( const char *tokenName, const char *certName) -{ - - int tokenlen = strlen(tokenName); - int len = tokenlen + strlen(certName) +2; - char *result; - - if (( result = malloc( len )) != NULL) { - strcpy(result, tokenName); - *(result+tokenlen) = ':'; - ++tokenlen; - strcpy(result+tokenlen, certName); - } else { - perror("malloc"); - exit( LDAP_NO_MEMORY ); - } - return result; -} - - - -static -int -ldaptool_getcertpath( void *context, char **certlocp ) -{ - - *certlocp = ssl_certdbpath; - if ( ldaptool_verbose ) { - if (ssl_certdbpath) - { - printf("ldaptool_getcertpath -- %s\n", ssl_certdbpath ); - } - else - { - printf("ldaptool_getcertpath -- (null)\n"); - } - - } - return LDAP_SUCCESS; -} - -int -ldaptool_getcertname( void *context, char **certnamep ) -{ - - *certnamep = ssl_certname; - if ( ldaptool_verbose ) { - if (ssl_certname) - { - printf("ldaptool_getcertname -- %s\n", *certnamep); - } - else - { - printf("ldaptool_getcertname -- (null)\n"); - } - } - return LDAP_SUCCESS; -} - -int -ldaptool_getkeypath(void *context, char **keylocp ) -{ - *keylocp = ssl_keydbpath; - if ( ldaptool_verbose ) { - if (ssl_keydbpath) - { - printf("ldaptool_getkeypath -- %s\n",*keylocp); - } - else - { - printf("ldaptool_getkeypath -- (null)\n"); - } - } - - return LDAP_SUCCESS; -} - -int -ldaptool_gettokenname( void *context, char **tokennamep ) -{ - - *tokennamep = pkcs_token; - if ( ldaptool_verbose ) { - if (pkcs_token) - { - printf("ldaptool_gettokenname -- %s\n",*tokennamep); - } - else - { - printf("ldaptool_gettokenname -- (null)\n"); - } - } - - return LDAP_SUCCESS; -} -int -ldaptool_gettokenpin( void *context, const char *tokennamep, char **tokenpinp) -{ - -#if 0 - char *localtoken; -#endif - -/* XXXceb this stuff is removed for the time being. - * This function should return the pin from ssl_password - */ - - - *tokenpinp = ssl_passwd; - return LDAP_SUCCESS; - -#if 0 - - ldaptool_gettokenname( NULL, &localtoken); - - if (strcmp( localtoken, tokennamep)) - - *tokenpinp = pkcs_pin; - else - *tokenpinp = NULL; - - if ( ldaptool_verbose ) { - if (pkcs_pin) - { - printf("ldaptool_getokenpin --%s\n", tokenpinp); - } - else - { - printf("ldaptool_getokenpin -- (null)\n"); - } - } - return LDAP_SUCCESS; -#endif -} - -int -ldaptool_getmodpath( void *context, char **modulep ) -{ - *modulep = ssl_secmodpath; - if ( ldaptool_verbose ) { - if (ssl_secmodpath) - { - printf("ldaptool_getmodpath -- %s\n", *modulep); - } - else - { - printf("ldaptool_getmodpath -- (null)\n"); - } - } - - return LDAP_SUCCESS; -} - -int -ldaptool_getdonglefilename( void *context, char **filename ) -{ - *filename = ssl_donglefile; - if ( ldaptool_verbose ) { - if (ssl_donglefile) - { - printf("ldaptool_getdonglefilename -- %s\n", *filename); - } - else - { - printf("ldaptool_getdonglefilename -- (null)\n"); - } - - } - - return LDAP_SUCCESS; -} - -static int -ldaptool_setcallbacks( struct ldapssl_pkcs_fns *pfns) -{ - pfns->pkcs_getcertpath = (int (*)(void *, char **))ldaptool_getcertpath; - pfns->pkcs_getcertname = (int (*)(void *, char **))ldaptool_getcertname; - pfns->pkcs_getkeypath = (int (*)(void *, char **)) ldaptool_getkeypath; - pfns->pkcs_getmodpath = (int (*)(void *, char **)) ldaptool_getmodpath; - pfns->pkcs_getpin = (int (*)(void *, const char*, char **)) ldaptool_gettokenpin; - pfns->pkcs_gettokenname = (int (*)(void *, char **)) ldaptool_gettokenname; - pfns->pkcs_getdonglefilename = (int (*)(void *, char **)) ldaptool_getdonglefilename; - pfns->local_structure_id=PKCS_STRUCTURE_ID; - return LDAP_SUCCESS; -} - - - -#ifdef FORTEZZA -static int -ldaptool_fortezza_init( int exit_on_error ) -{ - int rc, errcode; - - if ( fortezza_personality == NULL && fortezza_cardmask == 0 ) { /* no FORTEZZA desired */ - SSL_EnableGroup( SSL_GroupFortezza, DSFalse ); /* disable FORTEZZA */ - return( 0 ); - } - - if (( rc = FortezzaConfigureServer( ldaptool_fortezza_getpin, fortezza_cardmask, - fortezza_personality, ldaptool_fortezza_alert, NULL, &errcode, - fortezza_krlfile )) < 0 ) { - fprintf( stderr, - "%s: FORTEZZA initialization failed (error %d - %s)\n", - ldaptool_progname, errcode, - ldaptool_fortezza_err2string( errcode )); - if ( exit_on_error ) { - exit( LDAP_LOCAL_ERROR ); - } - - SSL_EnableGroup( SSL_GroupFortezza, DSFalse ); /* disable FORTEZZA */ - return( -1 ); - } - - SSL_EnableGroup( SSL_GroupFortezza, DSTrue ); /* enable FORTEZZA */ - return( 0 ); -} - - -static int -ldaptool_fortezza_alert( void *arg, PRBool onOpen, char *string, - int value1, void *value2 ) -{ - fprintf( stderr, "%s: FORTEZZA alert: ", ldaptool_progname ); - fprintf( stderr, string, value1, value2 ); - fprintf( stderr, "\n" ); - return( 1 ); -} - - -static void * -ldaptool_fortezza_getpin( char **passwordp ) -{ - *passwordp = fortezza_pin; - return( *passwordp ); -} - - -/* - * convert a Fortezza error code (as returned by FortezzaConfigureServer() - * into a human-readable string. - * - * Error strings are intentionally similar to those found in - * ns/netsite/lib/libadmin/httpcon.c - */ -static char * -ldaptool_fortezza_err2string( int err ) -{ - char *s; - - switch( err ) { - case FORTEZZA_BADPASSWD: - s = "invalid pin number"; - break; - case FORTEZZA_BADCARD: - s = "bad or missing card"; - break; - case FORTEZZA_MISSING_KRL: - s = "bad or missing compromised key list"; - break; - case FORTEZZA_CERT_INIT_ERROR: - s = "unable to initialize certificate cache. either a cert on " - "the card is bad, or an old FORTEZZA certificate is in a" - "readonly database"; - break; - case FORTEZZA_EXPIRED_CERT: - s = "unable to verify certificate"; - break; - default: - s = "unknown error"; - } - - return( s ); -} - -#endif /* FORTEZZA */ -#endif /* LDAP_TOOL_PKCS11 */ -#endif /* NET_SSL */ - -int -ldaptool_boolean_str2value ( const char *ptr, int strict ) -{ - if (strict) { - if ( !(strcasecmp(ptr, "true"))) { - return 1; - } - else if ( !(strcasecmp(ptr, "false"))) { - return 0; - } - else { - return (-1); - } - } - else { - if ( !(strcasecmp(ptr, "true")) || - !(strcasecmp(ptr, "t")) || - !(strcmp(ptr, "1")) ) { - return (1); - } - else if ( !(strcasecmp(ptr, "false")) || - !(strcasecmp(ptr, "f")) || - !(strcmp(ptr, "0")) ) { - return (0); - } - else { - return (-1); - } - } -} diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/convutf8.cpp b/mozilla/directory/c-sdk/ldap/clients/tools/convutf8.cpp deleted file mode 100644 index 2a602b9227e..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/convutf8.cpp +++ /dev/null @@ -1,598 +0,0 @@ -/* - * 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 -#include - -#ifndef HAVE_LIBNLS - -#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_LIBNLS */ - -#define NSPR20 - -#ifdef XP_WIN32 -#define VC_EXTRALEAN -#include -#include -#endif - -extern char *ldaptool_charset; -static int charsetset = 0; - -extern "C" { -char *ldaptool_convdir = NULL; -char *ldaptool_local2UTF8( const char * ); -} - -#ifndef XP_WIN32 -char * GetNormalizedLocaleName(void); - -#include "unistring.h" -#include "nlsenc.h" - -extern NLS_StaticConverterRegistry _STATICLINK_NSJPN_; -extern NLS_StaticConverterRegistry _STATICLINK_NSCCK_; -extern NLS_StaticConverterRegistry _STATICLINK_NSSB_; - -char * -GetNormalizedLocaleName(void) -{ -#ifdef _HPUX_SOURCE - - int len; - char *locale; - - locale = setlocale(LC_CTYPE, ""); - if (locale && *locale) { - len = strlen(locale); - } else { - locale = "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 LIBNLS 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 LIBNLS 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 LIBNLS 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 LIBNLS 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 LIBNLS 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 LIBNLS 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; - NLS_ErrorCode err; - - if (src == NULL) - { - return NULL; - } - else if (*src == 0) - { - utf8 = strdup(src); - return utf8; - } - - if( (ldaptool_charset != NULL) && (!strcmp( ldaptool_charset, "" )) - && (!charsetset) ) - { - locale = GetNormalizedLocaleName(); - ldaptool_charset = GetCharsetFromLocale(locale); - free( locale ); - charsetset = 1; - } - else - if( (ldaptool_charset != NULL) && strcmp( ldaptool_charset, "" ) - && (!charsetset) ) - { - newcharset = GetCharsetFromLocale( ldaptool_charset ); - free( ldaptool_charset ); - ldaptool_charset = newcharset; - charsetset = 1; - } - - if (ldaptool_charset == NULL) { - return strdup(src); - } - - if (NLS_EncInitialize(NULL, ldaptool_convdir) != NLS_SUCCESS || - NLS_RegisterStaticLibrary(_STATICLINK_NSJPN_) != NLS_SUCCESS || - NLS_RegisterStaticLibrary(_STATICLINK_NSCCK_) != NLS_SUCCESS || - NLS_RegisterStaticLibrary(_STATICLINK_NSSB_) != NLS_SUCCESS) { - return strdup(src); - } - - outLen = NLS_GetResultBufferSize( (byte *) src, - strlen( src ) * sizeof(char), - ldaptool_charset, - NLS_ENCODING_UTF_8 ); - - utf8 = (char *) malloc( outLen/sizeof(UniChar) ); - if( utf8 == NULL ) - return strdup(src); - - err = NLS_ConvertBuffer( ldaptool_charset, - NLS_ENCODING_UTF_8, - (byte*)src, - strlen(src) * sizeof(char), - (byte*)utf8, - outLen, - &resultLen ); - - NLS_EncTerminate(); - -#else - utf8 = _convertor(src, FALSE); - if( utf8 == NULL ) - utf8 = strdup(src); -#endif - - return utf8; -} -#endif /* HAVE_LIBNLS */ - -#ifndef HAVE_LIBNLS -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/examples-from-ldif-spec.ldif b/mozilla/directory/c-sdk/ldap/clients/tools/examples-from-ldif-spec.ldif deleted file mode 100644 index ec291fcb069..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/examples-from-ldif-spec.ldif +++ /dev/null @@ -1,181 +0,0 @@ -# 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=,o=Airius -objectclass: top -objectclass: organizationalUnit -ou:: 5Za25qWt6YOo -# ou:: -ou;lang-ja:: 5Za25qWt6YOo -# ou;lang-ja:: -ou;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2 -# ou;lang-ja:: -ou;lang-en: Sales -description: Japanese office - -dn:: dWlkPXJvZ2FzYXdhcmEsb3U95Za25qWt6YOoLG89QWlyaXVz -# dn:: uid=,ou=,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:: -sn;lang-ja:: 5bCP56yg5Y6f -# sn;lang-ja:: -cn;lang-ja:: 5bCP56yg5Y6fIOODreODieODi+ODvA== -# cn;lang-ja:: -title;lang-ja:: 5Za25qWt6YOoIOmDqOmVtw== -# title;lang-ja:: -preferredlanguage: ja -givenname:: 44Ot44OJ44OL44O8 -# givenname:: -sn:: 5bCP56yg5Y6f -# sn:: -cn:: 5bCP56yg5Y6fIOODreODieODi+ODvA== -# cn:: -title:: 5Za25qWt6YOoIOmDqOmVtw== -# title:: -givenname;lang-ja;phonetic:: 44KN44Gp44Gr44O8 -# givenname;lang-ja;phonetic:: -sn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJ -# sn;lang-ja;phonetic:: -cn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJIOOCjeOBqeOBq+ODvA== -# cn;lang-ja;phonetic:: -title;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2IOOBtuOBoeOCh+OBhg== -# title;lang-ja;phonetic:: -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 -- diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/fileurl.c b/mozilla/directory/c-sdk/ldap/clients/tools/fileurl.c deleted file mode 100644 index 2b66537b577..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/fileurl.c +++ /dev/null @@ -1,488 +0,0 @@ -/* - * 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 /* 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, :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 */ - struct stat fstats; - - /* recognize "attr :< url" syntax if LDIF version is >= 1 */ - if ( recognize_url_syntax && *value == '<' ) { - const char *url; - char *path; - - for ( url = value + 1; isspace( *url ); ++url ) { - ; /* NULL */ - } - - /* - * We only support file:// URLs for now. - */ - 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 = fopen( 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'; -} diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/fileurl.h b/mozilla/directory/c-sdk/ldap/clients/tools/fileurl.h deleted file mode 100644 index abca5605fbe..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/fileurl.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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, :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 diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/ldapcmp.c b/mozilla/directory/c-sdk/ldap/clients/tools/ldapcmp.c deleted file mode 100644 index 00139c44d7d..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/ldapcmp.c +++ /dev/null @@ -1,603 +0,0 @@ -/* - * 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 "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] [attributes...]\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" ); - 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, even if -o used */ - ++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, msgid; - 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 ( 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 */ diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/ldapcompare.c b/mozilla/directory/c-sdk/ldap/clients/tools/ldapcompare.c deleted file mode 100644 index 2fca92b4ef7..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/ldapcompare.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * 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 "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:= 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 )); -} diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/ldapdelete.c b/mozilla/directory/c-sdk/ldap/clients/tools/ldapdelete.c deleted file mode 100644 index 7034bad62a1..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/ldapdelete.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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 "ldaptool.h" - -static int contoper; -static LDAP *ld; - -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 ); - 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; - - 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 ); -} diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/ldapmodify.c b/mozilla/directory/c-sdk/ldap/clients/tools/ldapmodify.c deleted file mode 100644 index c6bd8bf9fe8..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/ldapmodify.c +++ /dev/null @@ -1,1027 +0,0 @@ -/* - * 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): - */ - -/* ldapmodify.c - generic program to modify or add entries using LDAP */ - -#include "ldaptool.h" -#include "fileurl.h" - -static int newval, contoper, force, valsfromfiles, display_binary_values; -static int ldif_version = -1; /* -1 => unknown version */ -static LDAP *ld; -static char *rejfile = NULL; -static char *bulkimport_suffix = NULL; -static int ldapmodify_quiet = 0; - -#define LDAPMOD_MAXLINE 4096 - -/* strings found in replog/LDIF entries (mostly lifted from slurpd/slurp.h) */ -#define T_REPLICA_STR "replica" -#define T_DN_STR "dn" -#define T_VERSION_STR "version" -#define T_CHANGETYPESTR "changetype" -#define T_ADDCTSTR "add" -#define T_MODIFYCTSTR "modify" -#define T_DELETECTSTR "delete" -#define T_RENAMECTSTR "rename" /* non-standard */ -#define T_MODDNCTSTR "moddn" -#define T_MODRDNCTSTR "modrdn" -#define T_MODOPADDSTR "add" -#define T_MODOPREPLACESTR "replace" -#define T_MODOPDELETESTR "delete" -#define T_MODSEPSTR "-" -#define T_NEWRDNSTR "newrdn" -#define T_NEWSUPERIORSTR "newsuperior" -#define T_NEWPARENTSTR "newparent" -#define T_DELETEOLDRDNSTR "deleteoldrdn" -#define T_NEWSUPERIORSTR "newsuperior" -#define T_NEWPARENTSTR "newparent" /* non-standard */ - -/* bulk import */ -#define BULKIMPORT_START_OID "2.16.840.1.113730.3.5.7" -#define BULKIMPORT_STOP_OID "2.16.840.1.113730.3.5.8" - -static void options_callback( int option, char *optarg ); -static int process_ldapmod_rec( char *rbuf ); -static int process_ldif_rec( char *rbuf ); -static void addmodifyop( LDAPMod ***pmodsp, int modop, char *attr, - char *value, int vlen ); -static int domodify( char *dn, LDAPMod **pmods, int newentry ); -static int dodelete( char *dn ); -static int dorename( char *dn, char *newrdn, char *newparent, - int deleteoldrdn ); -static void freepmods( LDAPMod **pmods ); -static char *read_one_record( FILE *fp ); -static char *strdup_and_trim( char *s ); - -static void -usage( void ) -{ - fprintf( stderr, "usage: %s [options]\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, " -A\t\tdisplay non-ASCII values in conjunction with -v\n" ); - fprintf( stderr, " -f file\tread modifications from file (default: standard input)\n" ); - if ( strcmp( ldaptool_progname, "ldapmodify" ) == 0 ){ - fprintf( stderr, " -a\t\tadd entries\n" ); - } - fprintf( stderr, " -b\t\tread values that start with / from files (for bin attrs)\n" ); - fprintf( stderr, " -F\t\tforce application of all changes, regardless of\n" ); - fprintf( stderr, " \t\treplica lines\n" ); - fprintf( stderr, " -e rejfile\tsave rejected entries in \"rejfile\"\n" ); - fprintf( stderr, " -B suffix\tbulk import to \"suffix\"\n"); - fprintf( stderr, " -q\t\tbe quiet when adding/modifying entries\n" ); - exit( LDAP_PARAM_ERROR ); -} - - -int -main( int argc, char **argv ) -{ - char *rbuf, *saved_rbuf, *start, *p, *q; - FILE *rfp = NULL; - int rc, use_ldif, deref, optind; - LDAPControl *ldctrl; - - -#ifdef notdef -#ifdef HPUX11 -#ifndef __LP64__ - _main( argc, argv); -#endif /* __LP64_ */ -#endif /* HPUX11 */ -#endif - - valsfromfiles = display_binary_values = 0; - - optind = ldaptool_process_args( argc, argv, "aAbcFe:B:q", 0, - options_callback ); - - - if ( optind == -1 ) { - usage(); - } - - if ( !newval && strcmp( ldaptool_progname, "ldapadd" ) == 0 ) { - newval = 1; - } - - if ( ldaptool_fp == NULL ) { - ldaptool_fp = stdin; - } - - if ( argc - optind != 0 ) { - 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 (( 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); - } - - rc = 0; - - /* turn on bulk import?*/ - if (bulkimport_suffix) { - struct berval bv, *retdata; - char *retoid; - - bv.bv_val = bulkimport_suffix; - bv.bv_len = strlen(bulkimport_suffix); - if ((rc = ldap_extended_operation_s(ld, - BULKIMPORT_START_OID, &bv, NULL, - NULL, &retoid, &retdata)) != 0) { - fprintf(stderr, "Error: unable to service " - "extended operation request\n\t'%s' for " - "bulk import\n\t(error:%d:'%s')\n", - BULKIMPORT_START_OID, rc, ldap_err2string(rc)); - return (rc); - } - if (retoid) - ldap_memfree(retoid); - if (retdata) - ber_bvfree(retdata); - } - - while (( rc == 0 || contoper ) && - ( rbuf = read_one_record( ldaptool_fp )) != NULL ) { - /* - * we assume record is ldif/slapd.replog if the first line - * has a colon that appears to the left of any equal signs, OR - * if the first line consists entirely of digits (an entry id) - */ - use_ldif = ( p = strchr( rbuf, ':' )) != NULL && - ( q = strchr( rbuf, '\n' )) != NULL && p < q && - (( q = strchr( rbuf, '=' )) == NULL || p < q ); - - start = rbuf; - saved_rbuf = strdup( rbuf ); - - if ( !use_ldif && ( q = strchr( rbuf, '\n' )) != NULL ) { - for ( p = rbuf; p < q; ++p ) { - if ( !isdigit( *p )) { - break; - } - } - if ( p >= q ) { - use_ldif = 1; - start = q + 1; - } - } - - if ( use_ldif ) { - rc = process_ldif_rec( start ); - } else { - rc = process_ldapmod_rec( start ); - } - if ( rc != LDAP_SUCCESS && rejfile != NULL ) { - /* Write this record to the reject file */ - int newfile = 0; - struct stat stbuf; - if ( stat( rejfile, &stbuf ) < 0 ) { - if ( errno == ENOENT ) { - newfile = 1; - } - } - if (( rfp = fopen( rejfile, "a" )) == NULL ) { - fprintf( stderr, "Cannot open error file \"%s\" - " - "erroneous entries will not be saved\n", rejfile ); - rejfile = NULL; - } else { - if ( newfile == 0 ) { - fputs( "\n", rfp ); - } - fprintf( rfp, "# Error: %s\n", ldap_err2string( rc )); - fputs( saved_rbuf, rfp ); - fclose( rfp ); - rfp = NULL; - } - } - - free( rbuf ); - free( saved_rbuf ); - } - ldaptool_reset_control_array( ldaptool_request_ctrls ); - - /* turn off bulk import?*/ - if (bulkimport_suffix) { - struct berval bv, *retdata; - char *retoid; - - bv.bv_val = ""; - bv.bv_len = 0; - if ((rc = ldap_extended_operation_s(ld, - BULKIMPORT_STOP_OID, &bv, NULL, - NULL, &retoid, &retdata)) != 0) { - - fprintf(stderr, "Error: unable to service " - "extended operation request\n\t '%s' for " - "bulk import\n\t(rc:%d:'%s')\n", - BULKIMPORT_STOP_OID, rc, ldap_err2string(rc)); - return (rc); - } - if (retoid) - ldap_memfree(retoid); - if (retdata) - ber_bvfree(retdata); - } - - ldaptool_cleanup( ld ); - return( rc ); -} - - -static void -options_callback( int option, char *optarg ) -{ - switch( option ) { - case 'a': /* add */ - newval = 1; - break; - case 'b': /* read values from files (for binary attributes) */ - valsfromfiles = 1; - break; - case 'A': /* display non-ASCII values when -v is used */ - display_binary_values = 1; - break; - case 'c': /* continuous operation */ - contoper = 1; - break; - case 'F': /* force all changes records to be used */ - force = 1; - break; - case 'e': - rejfile = strdup( optarg ); - break; - case 'B': /* bulk import option */ - bulkimport_suffix = strdup( optarg ); - break; - case 'q': /* quiet mode on add/modify operations */ - ldapmodify_quiet = 1; - break; - default: - usage(); - } -} - - - -static int -process_ldif_rec( char *rbuf ) -{ - char *line, *dn, *type, *value, *newrdn, *newparent, *p; - char *ctrl_oid=NULL, *ctrl_value=NULL; - int ctrl_criticality=1; - LDAPControl *ldctrl; - int rc, linenum, vlen, modop, replicaport; - int expect_modop, expect_sep, expect_chgtype_or_control, expect_newrdn; - int expect_deleteoldrdn, expect_newparent, rename, moddn; - int deleteoldrdn, saw_replica, use_record, new_entry, delete_entry; - int got_all, got_value; - LDAPMod **pmods; - - new_entry = newval; - - rc = got_all = saw_replica = delete_entry = expect_modop = 0; - expect_deleteoldrdn = expect_newrdn = expect_newparent = expect_sep = 0; - expect_chgtype_or_control = linenum = got_value = rename = moddn = 0; - deleteoldrdn = 1; - use_record = force; - pmods = NULL; - dn = newrdn = newparent = NULL; - - while ( rc == 0 && ( line = ldif_getline( &rbuf )) != NULL ) { - ++linenum; - if ( expect_sep && strcasecmp( line, T_MODSEPSTR ) == 0 ) { - expect_sep = 0; - expect_modop = 1; - - /*If we see a separator in the input stream, - but we didn't get a value from the last modify - then we have to fill pmods with an empty value*/ - if (modop == LDAP_MOD_REPLACE && !got_value){ - addmodifyop( &pmods, modop, value, NULL, 0); - } - - got_value = 0; - continue; - } - - if ( ldif_parse_line( line, &type, &value, &vlen ) < 0 ) { - fprintf( stderr, "%s: invalid format (line %d of entry: %s)\n", - ldaptool_progname, linenum, dn == NULL ? "" : dn ); - fprintf( stderr, "%s: line contents: (%s)\n", - ldaptool_progname, line ); - rc = LDAP_PARAM_ERROR; - break; - } - -evaluate_line: - if ( dn == NULL ) { - if ( !use_record && strcasecmp( type, T_REPLICA_STR ) == 0 ) { - ++saw_replica; - if (( p = strchr( value, ':' )) == NULL ) { - replicaport = LDAP_PORT; - } else { - *p++ = '\0'; - replicaport = atoi( p ); - } - if ( strcasecmp( value, ldaptool_host ) == 0 && - replicaport == ldaptool_port ) { - use_record = 1; - } - - } else if ( strcasecmp( type, T_DN_STR ) == 0 ) { - if (( dn = strdup( value )) == NULL ) { - perror( "strdup" ); - exit( LDAP_NO_MEMORY ); - } - expect_chgtype_or_control = 1; - - } else if ( strcasecmp( type, T_VERSION_STR ) == 0 ) { - ldif_version = atoi( value ); - if ( ldif_version != LDIF_VERSION_ONE ) { - fprintf( stderr, "%s: LDIF version %d is not supported;" - " use version: %d\n", ldaptool_progname, ldif_version, - LDIF_VERSION_ONE ); - exit( LDAP_PARAM_ERROR ); - } - if ( ldaptool_verbose ) { - printf( "Processing a version %d LDIF file...\n", - ldif_version ); - } - - /* Now check if there's something left to process */ - /* and if not, go get the new record, else continue */ - if ( *rbuf == '\0' ) { - return( 0 ); - } - - } else if ( !saw_replica ) { - printf( "%s: skipping change record: no dn: line\n", - ldaptool_progname ); - return( 0 ); - } - - continue; /* skip all lines until we see "dn:" */ - } - - if ( expect_chgtype_or_control ) { - expect_chgtype_or_control = 0; - if ( !use_record && saw_replica ) { - printf( "%s: skipping change record for entry: %s\n\t(LDAP host/port does not match replica: lines)\n", - ldaptool_progname, dn ); - free( dn ); - return( 0 ); - } - - if ( strcasecmp( type, "control" ) == 0 ) { - value = strdup_and_trim( value ); - if (ldaptool_parse_ctrl_arg(value, ' ', &ctrl_oid, - &ctrl_criticality, &ctrl_value, &vlen)) { - usage(); - } - ldctrl = calloc(1,sizeof(LDAPControl)); - if (ctrl_value) { - rc = ldaptool_berval_from_ldif_value( ctrl_value, vlen, - &(ldctrl->ldctl_value), - 1 /* recognize file URLs */, 0 /* always try file */, - 1 /* report errors */ ); - if ((rc = ldaptool_fileurlerr2ldaperr( rc )) != LDAP_SUCCESS) { - fprintf( stderr, "Unable to parse %s\n", ctrl_value); - usage(); - } - } - ldctrl->ldctl_oid = ctrl_oid; - ldctrl->ldctl_iscritical = ctrl_criticality; - ldaptool_add_control_to_array(ldctrl, ldaptool_request_ctrls); - expect_chgtype_or_control = 1; - continue; - } - - if ( strcasecmp( type, T_CHANGETYPESTR ) == 0 ) { - value = strdup_and_trim( value ); - if ( strcasecmp( value, T_MODIFYCTSTR ) == 0 ) { - new_entry = 0; - expect_modop = 1; - } else if ( strcasecmp( value, T_ADDCTSTR ) == 0 ) { - new_entry = 1; - modop = LDAP_MOD_ADD; - } else if ( strcasecmp( value, T_MODRDNCTSTR ) == 0 ) { - expect_newrdn = 1; - moddn = 1; - } else if ( strcasecmp( value, T_MODDNCTSTR ) == 0 ) { - expect_newrdn = 1; - moddn = 1; - } else if ( strcasecmp( value, T_RENAMECTSTR ) == 0 ) { - expect_newrdn = 1; - rename = 1; - } else if ( strcasecmp( value, T_DELETECTSTR ) == 0 ) { - got_all = delete_entry = 1; - } else { - fprintf( stderr, - "%s: unknown %s \"%s\" (line %d of entry: %s)\n", - ldaptool_progname, T_CHANGETYPESTR, value, - linenum, dn ); - rc = LDAP_PARAM_ERROR; - } - free( value ); - continue; - } else if ( newval ) { /* missing changetype => add */ - new_entry = 1; - modop = LDAP_MOD_ADD; - } else { - /*The user MUST put in changetype: blah - unless adding a new entry with either -a or ldapadd*/ - fprintf(stderr, "%s: Missing changetype operation specification.\n\tThe dn line must be followed by \"changetype: operation\"\n\t(unless ldapmodify is called with -a option)\n\twhere operation is add|delete|modify|modrdn|moddn|rename\n\t\"%s\" is not a valid changetype operation specification\n\t(line %d of entry %s)\n", - ldaptool_progname, type, linenum, dn); - rc = LDAP_PARAM_ERROR; - /*expect_modop = 1; missing changetype => modify */ - } - } - - if ( expect_modop ) { - expect_modop = 0; - expect_sep = 1; - if ( strcasecmp( type, T_MODOPADDSTR ) == 0 ) { - modop = LDAP_MOD_ADD; - continue; - } else if ( strcasecmp( type, T_MODOPREPLACESTR ) == 0 ) { - modop = LDAP_MOD_REPLACE; - continue; - } else if ( strcasecmp( type, T_MODOPDELETESTR ) == 0 ) { - modop = LDAP_MOD_DELETE; - addmodifyop( &pmods, modop, value, NULL, 0 ); - continue; - } else { /*Bug 27479. Remove default add operation*/ - fprintf(stderr, "%s: Invalid parameter \"%s\" specified for changetype modify (line %d of entry %s)\n", - ldaptool_progname, type, linenum, dn); - rc = LDAP_PARAM_ERROR; - } - - } - - if ( expect_newrdn ) { - if ( strcasecmp( type, T_NEWRDNSTR ) == 0 ) { - if ( *value == '\0' ) { - fprintf( stderr, - "%s: newrdn value missing (line %d of entry: %s)\n", - ldaptool_progname, linenum, dn == NULL ? "" : dn ); - rc = LDAP_PARAM_ERROR; - } else if (( newrdn = strdup( value )) == NULL ) { - perror( "strdup" ); - exit( LDAP_NO_MEMORY ); - } else { - expect_newrdn = 0; - if ( rename ) { - expect_newparent = 1; - } else { - expect_deleteoldrdn = 1; - } - } - } else { - fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry %s)\n", - ldaptool_progname, T_NEWRDNSTR, type, linenum, dn ); - rc = LDAP_PARAM_ERROR; - } - } else if ( expect_newparent ) { - expect_newparent = 0; - if ( rename ) { - expect_deleteoldrdn = 1; - } - if ( strcasecmp( type, T_NEWPARENTSTR ) == 0 - || strcasecmp( type, T_NEWSUPERIORSTR ) == 0 ) { - if (( newparent = strdup( value )) == NULL ) { - perror( "strdup" ); - exit( LDAP_NO_MEMORY ); - } - } else { - /* Since this is an optional argument for rename/moddn, cause - * the current line to be re-evaluated if newparent doesn't - * follow deleteoldrdn. - */ - newparent = NULL; - goto evaluate_line; - } - } else if ( expect_deleteoldrdn ) { - if ( strcasecmp( type, T_DELETEOLDRDNSTR ) == 0 ) { - if ( *value == '\0' ) { - fprintf( stderr, - "%s: missing 0 or 1 (line %d of entry: %s)\n", - ldaptool_progname, linenum, dn == NULL ? "" : dn ); - rc = LDAP_PARAM_ERROR; - } else { - deleteoldrdn = ( *value == '0' ) ? 0 : 1; - expect_deleteoldrdn = 0; - if ( moddn ) { - expect_newparent = 1; - } - } - } else { - fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry %s)\n", - ldaptool_progname, T_DELETEOLDRDNSTR, type, linenum, - dn ); - rc = LDAP_PARAM_ERROR; - } - got_all = 1; - } else if ( got_all ) { - fprintf( stderr, - "%s: extra lines at end (line %d of entry %s)\n", - ldaptool_progname, linenum, dn ); - rc = LDAP_PARAM_ERROR; - got_all = 1; - } else { - addmodifyop( &pmods, modop, type, value, vlen ); - /*There was a value to replace*/ - got_value = 1; - - } - } - - if ( rc == 0 ) { - if ( delete_entry ) { - rc = dodelete( dn ); - } else if ( newrdn != NULL ) { - rc = dorename( dn, newrdn, newparent, deleteoldrdn ); - rename = 0; - } else { - - /*Patch to fix Bug 22183 - If pmods is null, then there is no - attribute to replace, so we alloc - an empty pmods*/ - if (modop == LDAP_MOD_REPLACE && !got_value && expect_sep){ - addmodifyop( &pmods, modop, value, NULL, 0); - }/*End Patch*/ - - - rc = domodify( dn, pmods, new_entry ); - } - - if ( rc == LDAP_SUCCESS ) { - rc = 0; - } - } - - if ( dn != NULL ) { - free( dn ); - } - if ( newrdn != NULL ) { - free( newrdn ); - } - if ( newparent != NULL ) { - free( newparent ); - } - if ( pmods != NULL ) { - freepmods( pmods ); - } - - return( rc ); -} - - -static int -process_ldapmod_rec( char *rbuf ) -{ - char *line, *dn, *p, *q, *attr, *value; - int rc, linenum, modop; - LDAPMod **pmods; - - pmods = NULL; - dn = NULL; - linenum = 0; - line = rbuf; - rc = 0; - - while ( rc == 0 && rbuf != NULL && *rbuf != '\0' ) { - ++linenum; - if (( p = strchr( rbuf, '\n' )) == NULL ) { - rbuf = NULL; - } else { - if ( *(p-1) == '\\' ) { /* lines ending in '\' are continued */ - strcpy( p - 1, p ); - rbuf = p; - continue; - } - *p++ = '\0'; - rbuf = p; - } - - if ( dn == NULL ) { /* first line contains DN */ - if (( dn = strdup( line )) == NULL ) { - perror( "strdup" ); - exit( LDAP_NO_MEMORY ); - } - } else { - if (( p = strchr( line, '=' )) == NULL ) { - value = NULL; - p = line + strlen( line ); - } else { - *p++ = '\0'; - value = p; - } - - for ( attr = line; *attr != '\0' && isspace( *attr ); ++attr ) { - ; /* skip attribute leading white space */ - } - - for ( q = p - 1; q > attr && isspace( *q ); --q ) { - *q = '\0'; /* remove attribute trailing white space */ - } - - if ( value != NULL ) { - while ( isspace( *value )) { - ++value; /* skip value leading white space */ - } - for ( q = value + strlen( value ) - 1; q > value && - isspace( *q ); --q ) { - *q = '\0'; /* remove value trailing white space */ - } - if ( *value == '\0' ) { - value = NULL; - } - - } - - if ( value == NULL && newval ) { - fprintf( stderr, "%s: missing value on line %d (attr is %s)\n", - ldaptool_progname, linenum, attr ); - rc = LDAP_PARAM_ERROR; - } else { - switch ( *attr ) { - case '-': - modop = LDAP_MOD_DELETE; - ++attr; - break; - case '+': - modop = LDAP_MOD_ADD; - ++attr; - break; - default: - /*Bug 27479. Remove the add default*/ - fprintf(stderr, "%s: Invalid parameter specified for changetype modify (line %d of entry %s)\n", - ldaptool_progname, linenum, dn); - rc = LDAP_PARAM_ERROR; - } - - addmodifyop( &pmods, modop, attr, value, - ( value == NULL ) ? 0 : strlen( value )); - } - } - - line = rbuf; - } - - if ( rc == 0 ) { - if ( dn == NULL ) { - rc = LDAP_PARAM_ERROR; - } else if (( rc = domodify( dn, pmods, newval )) == LDAP_SUCCESS ){ - rc = 0; - } - } - - if ( pmods != NULL ) { - freepmods( pmods ); - } - if ( dn != NULL ) { - free( dn ); - } - - return( rc ); -} - - -static void -addmodifyop( LDAPMod ***pmodsp, int modop, char *attr, char *value, int vlen ) -{ - LDAPMod **pmods; - int i, j, rc; - struct berval *bvp; - - pmods = *pmodsp; - modop |= LDAP_MOD_BVALUES; - - i = 0; - if ( pmods != NULL ) { - for ( ; pmods[ i ] != NULL; ++i ) { - if ( strcasecmp( pmods[ i ]->mod_type, attr ) == 0 && - pmods[ i ]->mod_op == modop ) { - break; - } - } - } - - if ( pmods == NULL || pmods[ i ] == NULL ) { - if (( pmods = (LDAPMod **)LDAPTOOL_SAFEREALLOC( pmods, (i + 2) * - sizeof( LDAPMod * ))) == NULL ) { - perror( "realloc" ); - exit( LDAP_NO_MEMORY ); - } - *pmodsp = pmods; - pmods[ i + 1 ] = NULL; - if (( pmods[ i ] = (LDAPMod *)calloc( 1, sizeof( LDAPMod ))) - == NULL ) { - perror( "calloc" ); - exit( LDAP_NO_MEMORY ); - } - pmods[ i ]->mod_op = modop; - if (( pmods[ i ]->mod_type = strdup( attr )) == NULL ) { - perror( "strdup" ); - exit( LDAP_NO_MEMORY ); - } - } - - if ( value != NULL ) { - j = 0; - if ( pmods[ i ]->mod_bvalues != NULL ) { - for ( ; pmods[ i ]->mod_bvalues[ j ] != NULL; ++j ) { - ; - } - } - if (( pmods[ i ]->mod_bvalues = (struct berval **) - LDAPTOOL_SAFEREALLOC( pmods[ i ]->mod_bvalues, - (j + 2) * sizeof( struct berval * ))) == NULL ) { - perror( "realloc" ); - exit( LDAP_NO_MEMORY ); - } - pmods[ i ]->mod_bvalues[ j + 1 ] = NULL; - if (( bvp = (struct berval *)malloc( sizeof( struct berval ))) - == NULL ) { - perror( "malloc" ); - exit( LDAP_NO_MEMORY ); - } - pmods[ i ]->mod_bvalues[ j ] = bvp; - - - rc = ldaptool_berval_from_ldif_value( value, vlen, bvp, - ( ldif_version >= LDIF_VERSION_ONE ), valsfromfiles, - 1 /* report errors */ ); - if ( rc != LDAPTOOL_FILEURL_SUCCESS ) { - exit( ldaptool_fileurlerr2ldaperr( rc )); - } - } -} - - -static int -domodify( char *dn, LDAPMod **pmods, int newentry ) -{ - int i, j, notascii, op; - struct berval *bvp; - - if ( pmods == NULL ) { - fprintf( stderr, "%s: no attributes to change or add (entry %s)\n", - ldaptool_progname, dn ); - return( LDAP_PARAM_ERROR ); - } - - if ( ldaptool_verbose ) { - for ( i = 0; pmods[ i ] != NULL; ++i ) { - op = pmods[ i ]->mod_op & ~LDAP_MOD_BVALUES; - printf( "%s %s:\n", op == LDAP_MOD_REPLACE ? - "replace" : op == LDAP_MOD_ADD ? - "add" : "delete", pmods[ i ]->mod_type ); - if ( pmods[ i ]->mod_bvalues != NULL ) { - for ( j = 0; pmods[ i ]->mod_bvalues[ j ] != NULL; ++j ) { - bvp = pmods[ i ]->mod_bvalues[ j ]; - notascii = 0; - if ( !display_binary_values ) { - notascii = !ldaptool_berval_is_ascii( bvp ); - } - if ( notascii ) { - printf( "\tNOT ASCII (%ld bytes)\n", bvp->bv_len ); - } else { - printf( "\t%s\n", bvp->bv_val ); - } - } - } - } - } - - if ( !ldapmodify_quiet) { - if ( newentry ) { - printf( "%sadding new entry %s\n", - ldaptool_not ? "!" : "", dn ); - } else { - printf( "%smodifying entry %s\n", - ldaptool_not ? "!" : "", dn ); - } - } - - if ( !ldaptool_not ) { - if ( newentry ) { - unsigned int sleep_interval = 2; /* seconds */ - - while ((i = ldaptool_add_ext_s( ld, dn, pmods, - ldaptool_request_ctrls, NULL, "ldap_add" )) - == LDAP_BUSY) { - if ( sleep_interval > 3600 ) { - printf("ldap_add: Unable to complete request. "); - printf("Server is too "); - printf("busy servicing other requests\n"); - break; - } - if ( !ldapmodify_quiet ) { - printf("ldap_add: LDAP_BUSY returned by server. "); - printf("Will retry operation "); - printf("in %d seconds\n", sleep_interval); - } - sleep( sleep_interval ); - sleep_interval *= 2; - } - } else { - i = ldaptool_modify_ext_s( ld, dn, pmods, ldaptool_request_ctrls, - NULL, "ldap_modify" ); - } - if ( i == LDAP_SUCCESS && ldaptool_verbose ) { - printf( "modify complete\n" ); - } - } else { - i = LDAP_SUCCESS; - } - - if ( !ldapmodify_quiet) { - putchar( '\n' ); - } - - return( i ); -} - - -static int -dodelete( char *dn ) -{ - int rc; - - printf( "%sdeleting entry %s\n", ldaptool_not ? "!" : "", dn ); - if ( !ldaptool_not ) { - if (( rc = ldaptool_delete_ext_s( ld, dn, ldaptool_request_ctrls, - NULL, "ldap_delete" )) == LDAP_SUCCESS && ldaptool_verbose ) { - printf( "delete complete" ); - } - } else { - rc = LDAP_SUCCESS; - } - - putchar( '\n' ); - - return( rc ); -} - - -static int -dorename( char *dn, char *newrdn, char *newparent, int deleteoldrdn ) -{ - int rc; - - if ( ldaptool_verbose ) { - if ( newparent == NULL ) { - printf( "new RDN: %s (%skeep existing values)\n", - newrdn, deleteoldrdn ? "do not " : "" ); - } else { - printf( "new RDN: %s, new parent %s (%skeep existing values)\n", - newrdn, newparent, deleteoldrdn ? "do not " : "" ); - } - } - - printf( "%smodifying RDN of entry %s%s\n", - ldaptool_not ? "!" : "", dn, ( newparent == NULL ) ? "" : - "and/or moving it beneath a new parent\n" ); - - if ( !ldaptool_not ) { - if (( rc = ldaptool_rename_s( ld, dn, newrdn, newparent, deleteoldrdn, - ldaptool_request_ctrls, NULL, "ldap_rename" )) == LDAP_SUCCESS - && ldaptool_verbose ) { - printf( "rename completed\n" ); - } - } else { - rc = LDAP_SUCCESS; - } - - putchar( '\n' ); - - return( rc ); -} - - -static void -freepmods( LDAPMod **pmods ) -{ - int i; - - for ( i = 0; pmods[ i ] != NULL; ++i ) { - if ( pmods[ i ]->mod_bvalues != NULL ) { - ber_bvecfree( pmods[ i ]->mod_bvalues ); - } - if ( pmods[ i ]->mod_type != NULL ) { - free( pmods[ i ]->mod_type ); - } - free( pmods[ i ] ); - } - free( pmods ); -} - - -static char * -read_one_record( FILE *fp ) -{ - int len, gotnothing; - char *buf, line[ LDAPMOD_MAXLINE ]; - int lcur, lmax; - - lcur = lmax = 0; - buf = NULL; - gotnothing = 1; - - while ( fgets( line, sizeof(line), fp ) != NULL ) { - if ( (len = strlen( line )) < 2 ) { - if ( gotnothing ) { - continue; - } else { - break; - } - } - - /* Check if the blank line starts with '\r' (CR) */ - if ( ((len = strlen( line )) == 2) && (line[0] == '\r') ) { - if ( gotnothing ) { - continue; - } else { - break; - } - } - - if ( *line == '#' ) { - continue; /* skip comment lines */ - } - - gotnothing = 0; - if ( lcur + len + 1 > lmax ) { - lmax = LDAPMOD_MAXLINE - * (( lcur + len + 1 ) / LDAPMOD_MAXLINE + 1 ); - if (( buf = (char *)LDAPTOOL_SAFEREALLOC( buf, lmax )) == NULL ) { - perror( "realloc" ); - exit( LDAP_NO_MEMORY ); - } - } - strcpy( buf + lcur, line ); - lcur += len; - } - - return( buf ); -} - - -/* - * strdup and trim trailing blanks - */ -static char * -strdup_and_trim( char *s ) -{ - char *p; - - if (( s = strdup( s )) == NULL ) { - perror( "strdup" ); - exit( LDAP_NO_MEMORY ); - } - - p = s + strlen( s ) - 1; - while ( p >= s && isspace( *p )) { - --p; - } - *++p = '\0'; - - return( s ); -} diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/ldapmodrdn.c b/mozilla/directory/c-sdk/ldap/clients/tools/ldapmodrdn.c deleted file mode 100644 index 7c35b6b23a6..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/ldapmodrdn.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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 ); -} - - -main( argc, argv ) - 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 ); -} diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/ldapsearch.c b/mozilla/directory/c-sdk/ldap/clients/tools/ldapsearch.c deleted file mode 100644 index 6980a8eb4fd..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/ldapsearch.c +++ /dev/null @@ -1,1185 +0,0 @@ -/* - * 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): - */ - -/* ldapsearch.c - generic program to search LDAP */ - -#include "ldaptool.h" -#include "fileurl.h" - -#define VLV_PARAM_SEP ':' - -static void usage( void ); -static int dosearch( LDAP *ld, char *base, int scope, char **attrs, - int attrsonly, char *filtpatt, char *value); -static void write_string_attr_value( char *attrname, char *strval, - unsigned long opts ); -#define LDAPTOOL_WRITEVALOPT_SUPPRESS_NAME 0x01 -static int write_ldif_value( char *type, char *value, unsigned long vallen, - unsigned long ldifoptions ); -static void print_entry( LDAP *ld, LDAPMessage *entry, int attrsonly ); -static void options_callback( int option, char *optarg ); -static void parse_and_display_reference( LDAP *ld, LDAPMessage *ref ); -static char *sortresult2string(unsigned long result); -static char *changetype_num2string( int chgtype ); -static char *msgtype2str( int msgtype ); - -/* - * Prefix used in names of pseudo attributes added to the entry LDIF - * output if we receive an entryChangeNotification control with an entry - * (requested using persistent search). - */ -#define LDAPTOOL_PSEARCH_ATTR_PREFIX "persistentSearch-" - - -static void -usage( void ) -{ - fprintf( stderr, "usage: %s -b basedn [options] filter [attributes...]\n", ldaptool_progname ); - fprintf( stderr, " %s -b basedn [options] -f file [attributes...]\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, " filter\tRFC-2254 compliant LDAP search filter\n" ); - fprintf( stderr, " file\tfile containing a sequence of LDAP search filters to use\n" ); - fprintf( stderr, " attributes\twhitespace-separated list of attributes to retrieve\n" ); - fprintf( stderr, "\t\t(if no attribute list is given, all are retrieved)\n" ); - fprintf( stderr, "options:\n" ); - ldaptool_common_usage( 0 ); -#if defined( XP_WIN32 ) - fprintf( stderr, " -t\t\twrite values to files in temp directory.\n" ); -#else - fprintf( stderr, " -t\t\twrite values to files in /tmp\n" ); -#endif - fprintf( stderr, " -U\t\tproduce file URLs in conjunction with -t\n" ); - fprintf( stderr, " -e\t\tminimize base-64 encoding of values\n" ); - fprintf( stderr, " -u\t\tinclude User Friendly entry names in the output\n" ); - fprintf( stderr, " -o\t\tprint entries using old format (default is LDIF)\n" ); - fprintf( stderr, " -T\t\tdon't fold (wrap) long lines (default is to fold)\n" ); - fprintf( stderr, " -1\t\tomit leading \"version: %d\" line in LDIF output\n", LDIF_VERSION_ONE ); - fprintf( stderr, " -A\t\tretrieve attribute names only (no values)\n" ); - fprintf( stderr, " -B\t\tprint non-ASCII values when old format (-o) is used\n" ); - fprintf( stderr, " -x\t\tperforming sorting on server\n" ); - fprintf( stderr, " -F sep\tprint `sep' instead of `%s' between attribute names\n", LDAPTOOL_DEFSEP ); - fprintf( stderr, " \tand values\n" ); - fprintf( stderr, " -S attr\tsort the results by attribute `attr'\n" ); - fprintf( stderr, " -s scope\tone of base, one, or sub (default is sub)\n" ); - fprintf( stderr, " -a deref\tone of never, always, search, or find (default: never)\n" ); - fprintf( stderr, " \t(alias dereferencing)\n" ); - fprintf( stderr, " -l time lim\ttime limit (in seconds) for search\n" ); - fprintf( stderr, " -z size lim\tsize limit (in entries) for search\n" ); - fprintf( stderr, " -C ps:changetype[:changesonly[:entrychgcontrols]]\n" ); - fprintf( stderr, "\t\tchangetypes are add,delete,modify,moddn,any\n" ); - fprintf( stderr, "\t\tchangesonly and entrychgcontrols are boolean values\n" ); - fprintf( stderr, "\t\t(default is 1)\n" ); - fprintf( stderr, " -G before%cafter%cindex%ccount | before%cafter%cvalue where 'before' and\n", VLV_PARAM_SEP, VLV_PARAM_SEP, VLV_PARAM_SEP, VLV_PARAM_SEP, VLV_PARAM_SEP ); - fprintf( stderr, "\t\t'after' are the number of entries surrounding 'index.'\n"); - fprintf( stderr, "\t\t'count' is the content count, 'value' is the search value.\n"); - - exit( LDAP_PARAM_ERROR ); -} - -static char *base = NULL; -static char *sep = LDAPTOOL_DEFSEP; -static char **sortattr = NULL; -static char *vlv_value = NULL; -static int sortsize = 0; -static int *skipsortattr = NULL; -static int includeufn, allow_binary, vals2tmp, ldif, scope, deref; -static int attrsonly, timelimit, sizelimit, server_sort, fold; -static int minimize_base64, produce_file_urls; -static int use_vlv = 0, vlv_before, vlv_after, vlv_index, vlv_count; -static int use_psearch=0; -static int write_ldif_version = 1; - -/* Persistent search variables */ -static int chgtype=0, changesonly=1, return_echg_ctls=1; - - -int -main( int argc, char **argv ) -{ - char *filtpattern, **attrs; - int rc, optind, i, first; - LDAP *ld; - - deref = LDAP_DEREF_NEVER; - allow_binary = vals2tmp = attrsonly = 0; - minimize_base64 = produce_file_urls = 0; - ldif = 1; - fold = 1; - sizelimit = timelimit = 0; - scope = LDAP_SCOPE_SUBTREE; - server_sort = 0; - -#ifdef notdef -#ifdef HPUX11 -#ifndef __LP64__ - _main( argc, argv); -#endif /* __LP64_ */ -#endif /* HPUX11 */ -#endif - - - ldaptool_reset_control_array( ldaptool_request_ctrls ); - optind = ldaptool_process_args( argc, argv, "ABLTU1eotuxa:b:F:G:l:S:s:z:C:", - 0, options_callback ); - - if ( optind == -1 ) { - usage(); - } - - if ( base == NULL ) { - if (( base = getenv( "LDAP_BASEDN" )) == NULL ) { - usage(); - } - } - if ( sortattr ) { - for ( sortsize = 0; sortattr[sortsize] != NULL; sortsize++ ) { - ; /* NULL */ - } - sortsize++; /* add in the final NULL field */ - skipsortattr = (int *) malloc( sortsize * sizeof(int *) ); - if ( skipsortattr == NULL ) { - fprintf( stderr, "Out of memory\n" ); - exit( LDAP_NO_MEMORY ); - } - memset( (char *) skipsortattr, 0, sortsize * sizeof(int *) ); - } else if ( server_sort ) { - server_sort = 0; /* ignore this option if no sortattrs were given */ - } - - if ( argc - optind < 1 ) { - if ( ldaptool_fp == NULL ) { - usage(); - } - attrs = NULL; - filtpattern = "%s"; - } else { /* there are additional args (filter + attrs) */ - if ( ldaptool_fp == NULL || strstr( argv[ optind ], "%s" ) != NULL ) { - filtpattern = ldaptool_local2UTF8( argv[ optind ] ); - ++optind; - } else { - filtpattern = "%s"; - } - - if ( argv[ optind ] == NULL ) { - attrs = NULL; - } else if ( sortattr == NULL || *sortattr == '\0' || server_sort) { - attrs = &argv[ optind ]; - } else { - attrs = ldap_charray_dup( &argv[ optind ] ); - if ( attrs == NULL ) { - fprintf( stderr, "Out of memory\n" ); - exit( LDAP_NO_MEMORY ); - } - for ( i = 0; i < (sortsize - 1); i++ ) { - if ( !ldap_charray_inlist( attrs, sortattr[i] ) ) { - if ( ldap_charray_add( &attrs, sortattr[i] ) != 0 ) { - fprintf( stderr, "Out of memory\n" ); - exit( LDAP_NO_MEMORY ); - } - /* - * attribute in the search list only for the purpose of - * sorting - */ - skipsortattr[i] = 1; - } - } - } - } - - ld = ldaptool_ldap_init( 0 ); - - if ( !ldaptool_not ) { - ldap_set_option( ld, LDAP_OPT_DEREF, &deref ); - ldap_set_option( ld, LDAP_OPT_TIMELIMIT, &timelimit ); - ldap_set_option( ld, LDAP_OPT_SIZELIMIT, &sizelimit ); - } - - ldaptool_bind( ld ); - - if ( ldaptool_verbose ) { - printf( "filter pattern: %s\nreturning: ", filtpattern ); - if ( attrs == NULL ) { - printf( "ALL" ); - } else { - for ( i = 0; attrs[ i ] != NULL; ++i ) { - printf( "%s ", attrs[ i ] ); - } - } - putchar( '\n' ); - } - - if ( ldaptool_fp == NULL ) { - char *conv; - - conv = ldaptool_local2UTF8( base ); - rc = dosearch( ld, conv, scope, attrs, attrsonly, filtpattern, "" ); - if( conv != NULL ) - free( conv ); - } else { - int done = 0; - - rc = LDAP_SUCCESS; - first = 1; - while ( rc == LDAP_SUCCESS && !done ) { - char *linep = NULL; - int increment = 0; - int c, index; - - /* allocate initial block of memory */ - if ((linep = (char *)malloc(BUFSIZ)) == NULL) { - fprintf( stderr, "Out of memory\n" ); - exit( LDAP_NO_MEMORY ); - } - increment++; - index = 0; - while ((c = fgetc( ldaptool_fp )) != '\n' && c != EOF) { - - /* check if we will overflow the buffer */ - if ((c != EOF) && (index == ((increment * BUFSIZ) -1))) { - - /* if we did, add another BUFSIZ worth of bytes */ - if ((linep = (char *) - realloc(linep, (increment + 1) * BUFSIZ)) == NULL) { - fprintf( stderr, "Out of memory\n" ); - exit( LDAP_NO_MEMORY ); - } - increment++; - } - linep[index++] = c; - } - - if (c == EOF) { - done = 1; - break; - } - - linep[index] = '\0'; - - if ( !first ) { - putchar( '\n' ); - } else { - first = 0; - } - rc = dosearch( ld, base, scope, attrs, attrsonly, filtpattern, - linep ); - free (linep); - } - } - - ldaptool_cleanup( ld ); - return( rc ); -} - - -static void -options_callback( int option, char *optarg ) -{ - char *s, *p, *temp_arg, *ps_ptr, *ps_arg; - int i=0; - - switch( option ) { - case 'u': /* include UFN */ - ++includeufn; - break; - case 't': /* write attribute values to /tmp files */ - ++vals2tmp; - break; - case 'U': /* produce file URLs in conjunction with -t */ - ++produce_file_urls; - break; - case 'e': /* minimize base-64 encoding of values */ - ++minimize_base64; - break; - case 'A': /* retrieve attribute names only -- no values */ - ++attrsonly; - break; - case 'L': /* print entries in LDIF format -- now the default */ - break; - case 'o': /* print entries using old ldapsearch format */ - ldif = 0; - break; - case 'B': /* allow binary values to be printed, even if -o used */ - ++allow_binary; - break; - case '1': /* omit leading "version: #" line from LDIF output */ - write_ldif_version = 0; - 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 'a': /* set alias deref option */ - if ( strncasecmp( optarg, "never", 5 ) == 0 ) { - deref = LDAP_DEREF_NEVER; - } else if ( strncasecmp( optarg, "search", 5 ) == 0 ) { - deref = LDAP_DEREF_SEARCHING; - } else if ( strncasecmp( optarg, "find", 4 ) == 0 ) { - deref = LDAP_DEREF_FINDING; - } else if ( strncasecmp( optarg, "always", 6 ) == 0 ) { - deref = LDAP_DEREF_ALWAYS; - } else { - fprintf( stderr, "alias deref should be never, search, find, or always\n" ); - usage(); - } - break; - - case 'F': /* field separator */ - sep = strdup( optarg ); - break; - case 'b': /* searchbase */ - base = strdup( optarg ); - break; - case 'l': /* time limit */ - timelimit = atoi( optarg ); - break; - case 'x': /* server sorting requested */ - server_sort = 1; - break; - case 'z': /* size limit */ - sizelimit = atoi( optarg ); - break; - case 'S': /* sort attribute */ - ldap_charray_add( &sortattr, strdup( optarg ) ); - break; - case 'T': /* don't fold lines */ - fold = 0; - break; - case 'G': /* do the virtual list setup */ - use_vlv++; - s = strchr(optarg, VLV_PARAM_SEP ); - - if (s != NULL) - { - vlv_before = atoi(optarg); - s++; - vlv_after = atoi( s ); - s = strchr(s, VLV_PARAM_SEP ); - if (s != NULL) - { - s++; - /* below is a small set of logic to implement the following cases - * -G23:23:wilber - * -G23:23:"wilber:wright" - * -G23:23:'wilber' - * -G23:23:wilber wright - * all of the above are before, after, value - NOTE: a colon not in a quoted - * string will break the parser!!!! - * -G23:23:45:600 - * above is index, count encoding - */ - - if (*s == '\'' || *s == '"') - { - vlv_value = strdup( s ); - } - else - { - if (strchr( s, VLV_PARAM_SEP )) - { - /* we have an index + count option */ - vlv_index = atoi( s ); - vlv_count = atoi( strchr( s, VLV_PARAM_SEP) + 1); - } - else - { - /* we don't have a quote surrounding the assertion value - * do we need to??? - */ - vlv_value = strdup( s ); - } - } - } - else - { - fprintf( stderr,"Illegal 'after' paramater for virtual list\n" ); - exit( LDAP_PARAM_ERROR ); - } - - } - else - { - fprintf( stderr,"Illegal 'before' paramater for virtual list\n" ); - exit( LDAP_PARAM_ERROR ); - } - break; - case 'C': - use_psearch++; - if ( (ps_arg = strdup( optarg)) == NULL ) { - perror ("strdup"); - exit (LDAP_NO_MEMORY); - } - - ps_ptr=strtok(ps_arg, ":"); - if (ps_ptr == NULL || (strcasecmp(ps_ptr, "ps")) ) { - fprintf (stderr, "Invalid argument for -C\n"); - usage(); - } - if (ps_ptr=strtok(NULL, ":")) { - if ( (temp_arg = strdup( ps_ptr )) == NULL ) { - perror ("strdup"); - exit (LDAP_NO_MEMORY); - } - } else { - fprintf (stderr, "Invalid argument for -C\n"); - usage(); - } - if (ps_ptr=strtok(NULL, ":")) { - if ( (changesonly = ldaptool_boolean_str2value(ps_ptr, 0)) == -1) { - fprintf(stderr, "Invalid option value: %s\n", ps_ptr); - usage(); - } - } - if (ps_ptr=strtok(NULL, ":")) { - if ( (return_echg_ctls = ldaptool_boolean_str2value(ps_ptr, 0)) == -1) { - fprintf(stderr, "Invalid option value: %s\n", ps_ptr); - usage(); - } - } - - /* Now parse the temp_arg and build chgtype as - * the changetypes are encountered */ - - if ((ps_ptr = strtok( temp_arg, "," )) == NULL) { - usage(); - } else { - while ( ps_ptr ) { - if ((strcasecmp(ps_ptr, "add"))==0) - chgtype |= LDAP_CHANGETYPE_ADD; - else if ((strcasecmp(ps_ptr, "delete"))==0) - chgtype |= LDAP_CHANGETYPE_DELETE; - else if ((strcasecmp(ps_ptr, "modify"))==0) - chgtype |= LDAP_CHANGETYPE_MODIFY; - else if ((strcasecmp(ps_ptr, "moddn"))==0) - chgtype |= LDAP_CHANGETYPE_MODDN; - else if ((strcasecmp(ps_ptr, "any"))==0) - chgtype = LDAP_CHANGETYPE_ANY; - else { - fprintf(stderr, "Unknown changetype: %s\n", ps_ptr); - usage(); - } - ps_ptr = strtok( NULL, "," ); - } - } - break; - default: - usage(); - break; - } -} - - -static int -dosearch( ld, base, scope, attrs, attrsonly, filtpatt, value ) - LDAP *ld; - char *base; - int scope; - char **attrs; - int attrsonly; - char *filtpatt; - char *value; -{ - char **refs = NULL, filter[ BUFSIZ ], *filterp = NULL; - int rc, first, matches; - LDAPMessage *res, *e; - LDAPControl *ldctrl; - LDAPControl **ctrl_response_array = NULL; - LDAPVirtualList vlv_data; - int msgid = 0; - int length = 0; - - length = strlen( filtpatt ) + strlen ( value ) +1; - if ( length > BUFSIZ ) { - if ((filterp = (char *) - malloc ( length )) == NULL) { - perror( "filter and/or pattern too long?" ); - exit (LDAP_PARAM_ERROR); - } - } else { - filterp = filter; - } - -#ifdef HAVE_SNPRINTF - if ( snprintf( filterp, length, filtpatt, value ) < 0 ) { - perror( "snprintf filter (filter and/or pattern too long?)" ); - exit( LDAP_PARAM_ERROR ); - } -#else - sprintf( filterp, filtpatt, value ); -#endif - - if ( *filterp == '\0' ) { /* treat empty filter is a shortcut for oc=* */ - strcpy( filterp, "(objectclass=*)" ); - } - - if ( ldaptool_verbose ) { - /* - * Display the filter that will be used. Add surrounding parens. - * if they are missing. - */ - if ( '(' == *filterp ) { - printf( "filter is: %s\n", filterp ); - } else { - printf( "filter is: (%s)\n", filterp ); - } - } - - if ( ldaptool_not ) { - if (filterp != filter) - free (filterp); - return( LDAP_SUCCESS ); - } - - 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 (use_psearch) { - if ( ldap_create_persistentsearch_control( ld, chgtype, - changesonly, return_echg_ctls, - 1, &ldctrl ) != LDAP_SUCCESS ) - { - ldap_perror( ld, "ldap_create_persistentsearch_control" ); - return (1); - } - ldaptool_add_control_to_array(ldctrl, ldaptool_request_ctrls); - } - - - if (server_sort) { - /* First make a sort key list from the attribute list we have */ - LDAPsortkey **keylist = NULL; - int i = 0; - char *sortattrs = NULL; - char *s = NULL; - int string_length = 0; - - /* Count the sort strings */ - for (i = 0; i < sortsize - 1 ; i++) { - string_length += strlen(sortattr[i]) + 1; - } - - sortattrs = (char *) malloc(string_length + 1); - if (NULL == sortattrs) { - fprintf( stderr, "Out of memory\n" ); - exit( LDAP_NO_MEMORY ); - } - - s = sortattrs; - for (i = 0; i < sortsize - 1 ; i++) { - memcpy(s, sortattr[i], strlen(sortattr[i])); - s += strlen(sortattr[i]); - *s++ = ' '; - } - - sortattrs[string_length] = '\0'; - - ldap_create_sort_keylist(&keylist,sortattrs); - free(sortattrs); - sortattrs = NULL; - - /* Then make a control for the sort attributes we have */ - rc = ldap_create_sort_control(ld,keylist,0,&ldctrl); - ldap_free_sort_keylist(keylist); - if ( rc != LDAP_SUCCESS ) { - if (filterp != filter) - free (filterp); - return( ldaptool_print_lderror( ld, "ldap_create_sort_control", - LDAPTOOL_CHECK4SSL_IF_APPROP )); - } - - ldaptool_add_control_to_array(ldctrl, ldaptool_request_ctrls); - - } - /* remember server side sorting must be available for vlv!!!! */ - - if (use_vlv) - { - vlv_data.ldvlist_before_count = vlv_before; - vlv_data.ldvlist_after_count = vlv_after; - if ( ldaptool_verbose ) { - printf( "vlv data %lu, %lu, ", - vlv_data.ldvlist_before_count, - vlv_data.ldvlist_after_count - ); - } - if (vlv_value) - { - vlv_data.ldvlist_attrvalue = vlv_value; - vlv_data.ldvlist_size = 0; - vlv_data.ldvlist_index = 0; - if ( ldaptool_verbose ) { - printf( "%s, 0, 0\n", vlv_data.ldvlist_attrvalue); - } - } - else - { - vlv_data.ldvlist_attrvalue = NULL; - vlv_data.ldvlist_size = vlv_count; - vlv_data.ldvlist_index = vlv_index; - if ( ldaptool_verbose ) { - printf( "(null), %lu, %lu\n", vlv_data.ldvlist_size, vlv_data.ldvlist_index ); - } - } - - if ( rc != LDAP_SUCCESS ) { - if (filterp != filter) - free (filterp); - return( ldaptool_print_lderror( ld, "ldap_create_sort_control", - LDAPTOOL_CHECK4SSL_IF_APPROP )); - } - if (LDAP_SUCCESS != (rc = ldap_create_virtuallist_control(ld, - &vlv_data, &ldctrl))) - { - if (filterp != filter) - free (filterp); - return( ldaptool_print_lderror( ld, - "ldap_create_virtuallist_control", - LDAPTOOL_CHECK4SSL_IF_APPROP )); - } - - ldaptool_add_control_to_array(ldctrl, ldaptool_request_ctrls); - - } - - if ( ldap_search_ext( ld, base, scope, filterp, attrs, attrsonly, - ldaptool_request_ctrls, NULL, NULL, -1, &msgid ) - != LDAP_SUCCESS ) { - if (filterp != filter) - free (filterp); - return( ldaptool_print_lderror( ld, "ldap_search", - LDAPTOOL_CHECK4SSL_IF_APPROP )); - } - - - matches = 0; - first = 1; - if ( sortattr && !server_sort ) { - rc = ldap_result( ld, LDAP_RES_ANY, 1, NULL, &res ); - } else { - while ( (rc = ldap_result( ld, LDAP_RES_ANY, 0, NULL, &res )) != - LDAP_RES_SEARCH_RESULT && rc != -1 ) { - if ( rc != LDAP_RES_SEARCH_ENTRY ) { - if ( rc == LDAP_RES_SEARCH_REFERENCE ) { - parse_and_display_reference( ld, res ); - } else if ( rc == LDAP_RES_EXTENDED - && ldap_msgid( res ) == LDAP_RES_UNSOLICITED ) { - ldaptool_print_extended_response( ld, res, - "Unsolicited response" ); - } else { - fprintf( stderr, "%s: ignoring LDAP response message" - " type 0x%x (%s)\n", - ldaptool_progname, rc, msgtype2str( rc )); - } - ldap_msgfree( res ); - continue; - } - matches++; - e = ldap_first_entry( ld, res ); - if ( !first ) { - putchar( '\n' ); - } else { - first = 0; - } - print_entry( ld, e, attrsonly ); - ldap_msgfree( res ); - } - } - if ( rc == -1 ) { - if (filterp != filter) - free (filterp); - return( ldaptool_print_lderror( ld, "ldap_result", - LDAPTOOL_CHECK4SSL_IF_APPROP )); - } - - if ( ldap_parse_result( ld, res, &rc, NULL, NULL, &refs, - &ctrl_response_array, 0 ) != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, "ldap_parse_result", - LDAPTOOL_CHECK4SSL_IF_APPROP ); - } else if ( rc != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, "ldap_search", - LDAPTOOL_CHECK4SSL_IF_APPROP ); - } - /* Parse the returned sort control */ - if (server_sort) { - unsigned long result = 0; - char *attribute; - - if ( LDAP_SUCCESS != ldap_parse_sort_control(ld,ctrl_response_array,&result,&attribute) ) { - ldaptool_print_lderror(ld, "ldap_parse_sort_control", - LDAPTOOL_CHECK4SSL_IF_APPROP ); - ldap_controls_free(ctrl_response_array); - ldap_msgfree(res); - if (filterp != filter) - free (filterp); - return ( ldap_get_lderrno( ld, NULL, NULL ) ); - } - - if (0 == result) { - if ( ldaptool_verbose ) { - printf( "Server indicated results sorted OK\n"); - } - } else { - if (NULL != attribute) { - printf("Server reported sorting error %ld: %s, attribute in error\"%s\"\n",result,sortresult2string(result),attribute); - } else { - printf("Server reported sorting error %ld: %s\n",result,sortresult2string(result)); - } - } - - } - - if (use_vlv) - { - unsigned long vpos, vcount; - int vresult; - if ( LDAP_SUCCESS != ldap_parse_virtuallist_control(ld,ctrl_response_array,&vpos, &vcount,&vresult) ) { - ldaptool_print_lderror( ld, "ldap_parse_virtuallist_control", - LDAPTOOL_CHECK4SSL_IF_APPROP ); - ldap_controls_free(ctrl_response_array); - ldap_msgfree(res); - if (filterp != filter) - free (filterp); - return ( ldap_get_lderrno( ld, NULL, NULL ) ); - } - - if (0 == vresult) { - if ( ldaptool_verbose ) { - printf( "Server indicated virtual list positioning OK\n"); - } - printf("index %lu content count %lu\n", vpos, vcount); - - } else { - printf("Server reported sorting error %d: %s\n",vresult,sortresult2string(vresult)); - - } - - } - - ldap_controls_free(ctrl_response_array); - - if ( sortattr != NULL && !server_sort) { - - (void) ldap_multisort_entries( ld, &res, - ( *sortattr == NULL ) ? NULL : sortattr, - (LDAP_CMP_CALLBACK *)strcasecmp ); - matches = 0; - first = 1; - for ( e = ldap_first_entry( ld, res ); e != NULLMSG; - e = ldap_next_entry( ld, e ) ) { - matches++; - if ( !first ) { - putchar( '\n' ); - } else { - first = 0; - } - print_entry( ld, e, attrsonly ); - } - } - - if ( ldaptool_verbose ) { - printf( "%d matches\n", matches ); - } - - if ( refs != NULL ) { - ldaptool_print_referrals( refs ); - ldap_value_free( refs ); - } - - if (filterp != filter) - free (filterp); - - ldap_msgfree( res ); - return( rc ); -} - - -static void -print_entry( ld, entry, attrsonly ) - LDAP *ld; - LDAPMessage *entry; - int attrsonly; -{ - char *a, *dn, *ufn, tmpfname[ BUFSIZ ]; - 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 ); - write_string_attr_value( "dn", dn, LDAPTOOL_WRITEVALOPT_SUPPRESS_NAME ); - if ( includeufn ) { - ufn = ldap_dn2ufn( dn ); - write_string_attr_value( "ufn", ufn, - LDAPTOOL_WRITEVALOPT_SUPPRESS_NAME ); - free( ufn ); - } - ldap_memfree( dn ); - - if ( use_psearch ) { - LDAPControl **ectrls; - int chgtype, chgnumpresent; - long chgnum; - char *prevdn, intbuf[ 128 ]; - - if ( ldap_get_entry_controls( ld, entry, &ectrls ) == LDAP_SUCCESS ) { - if ( ldap_parse_entrychange_control( ld, ectrls, &chgtype, - &prevdn, &chgnumpresent, &chgnum ) == LDAP_SUCCESS ) { - write_string_attr_value( - LDAPTOOL_PSEARCH_ATTR_PREFIX "changeType", - changetype_num2string( chgtype ), 0 ); - if ( chgnumpresent ) { - sprintf( intbuf, "%d", chgnum ); - write_string_attr_value( - LDAPTOOL_PSEARCH_ATTR_PREFIX "changeNumber", - intbuf, 0 ); - } - if ( NULL != prevdn ) { - write_string_attr_value( - LDAPTOOL_PSEARCH_ATTR_PREFIX "previousDN", - prevdn, 0 ); - ldap_memfree( prevdn ); - } - } - } - } - - 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, 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 ) { -#ifdef HAVE_SNPRINTF - if ( snprintf( tmpfname, sizeof(tmpfname), - "%s/ldapsearch-%s-XXXXXX", - ldaptool_get_tmp_dir(), a ) < 0 ) { - perror( "snprintf tmpfname (attribute name too long?)" ); - exit( LDAP_PARAM_ERROR ); - } -#else - sprintf( tmpfname, "%s/ldapsearch-%s-XXXXXX", - ldaptool_get_tmp_dir(), a ); -#endif - tmpfp = NULL; - - if ( mktemp( tmpfname ) == NULL ) { - perror( tmpfname ); - } else if (( tmpfp = fopen( tmpfname, mode)) == NULL ) { - perror( tmpfname ); - } else if ( bvals[ i ]->bv_len > 0 && - fwrite( bvals[ i ]->bv_val, - bvals[ i ]->bv_len, 1, tmpfp ) == 0 ) { - perror( tmpfname ); - } else if ( ldif ) { - if ( produce_file_urls ) { - char *url; - - if ( ldaptool_path2fileurl( tmpfname, &url ) != - LDAPTOOL_FILEURL_SUCCESS ) { - perror( "ldaptool_path2fileurl" ); - } else { - write_ldif_value( a, url, strlen( url ), - LDIF_OPT_VALUE_IS_URL ); - free( url ); - } - } else { - write_ldif_value( a, tmpfname, strlen( tmpfname ), - 0 ); - } - } 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, 0 ); - } else { - printf( "%s%s%s\n", a, sep, - notascii ? "NOT ASCII" : bvals[ i ]->bv_val ); - } - } - } - ber_bvecfree( bvals ); - } - ldap_memfree( a ); - } - - if ( ldap_get_lderrno( ld, NULL, NULL ) != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, "ldap_first_attribute/ldap_next_attribute", - LDAPTOOL_CHECK4SSL_IF_APPROP ); - } - - if ( ber != NULL ) { - ber_free( ber, 0 ); - } -} - - -static void -write_string_attr_value( char *attrname, char *strval, unsigned long opts ) -{ - if ( strval == NULL ) { - strval = ""; - } - if ( ldif ) { - write_ldif_value( attrname, strval, strlen( strval ), 0 ); - } else if ( 0 != ( opts & LDAPTOOL_WRITEVALOPT_SUPPRESS_NAME )) { - printf( "%s\n", strval ); - } else { - printf( "%s%s%s\n", attrname, sep, strval ); - } -} - - -static int -write_ldif_value( char *type, char *value, unsigned long vallen, - unsigned long ldifoptions ) -{ - char *ldif; - static int wrote_version = 0; - - if ( write_ldif_version && !wrote_version ) { - char versionbuf[ 64 ]; - - wrote_version = 1; - sprintf( versionbuf, "%d", LDIF_VERSION_ONE ); - write_ldif_value( "version", versionbuf, strlen( versionbuf ), 0 ); - } - - if ( !fold ) { - ldifoptions |= LDIF_OPT_NOWRAP; - } - if ( minimize_base64 ) { - ldifoptions |= LDIF_OPT_MINIMAL_ENCODING; - } - - if (( ldif = ldif_type_and_value_with_options( type, value, (int)vallen, - ldifoptions )) == NULL ) { - return( -1 ); - } - - fputs( ldif, stdout ); - free( ldif ); - - return( 0 ); -} - - -static char * -sortresult2string(unsigned long result) -{ - /* - success (0), -- results are sorted - operationsError (1), -- server internal failure - timeLimitExceeded (3), -- timelimit reached before - -- sorting was completed - strongAuthRequired (8), -- refused to return sorted - -- results via insecure - -- protocol - adminLimitExceeded (11), -- too many matching entries - -- for the server to sort - noSuchAttribute (16), -- unrecognized attribute - -- type in sort key - inappropriateMatching (18), -- unrecognized or inappro- - -- priate matching rule in - -- sort key - insufficientAccessRights (50), -- refused to return sorted - -- results to this client - busy (51), -- too busy to process - unwillingToPerform (53), -- unable to sort - other (80) - */ - - switch (result) { - case 0: return ("success"); - case 1: return ("operations error"); - case 3: return ("time limit exceeded"); - case 8: return ("strong auth required"); - case 11: return ("admin limit exceeded"); - case 16: return ("no such attribute"); - case 18: return ("unrecognized or inappropriate matching rule"); - case 50: return ("insufficient access rights"); - case 51: return ("too busy"); - case 53: return ("unable to sort"); - case 80: - default: return ("Er...Other ?"); - } -} - - -static void -parse_and_display_reference( LDAP *ld, LDAPMessage *ref ) -{ - int i; - char **refs; - - if ( ldap_parse_reference( ld, ref, &refs, NULL, 0 ) != LDAP_SUCCESS ) { - ldaptool_print_lderror( ld, "ldap_parse_reference", - LDAPTOOL_CHECK4SSL_IF_APPROP ); - } else if ( refs != NULL && refs[ 0 ] != NULL ) { - fputs( "Unfollowed continuation reference(s):\n", stderr ); - for ( i = 0; refs[ i ] != NULL; ++i ) { - fprintf( stderr, " %s\n", refs[ i ] ); - } - ldap_value_free( refs ); - } -} - - -/*possible operations a client can invoke -- copied from ldaprot.h */ - -#ifndef LDAP_REQ_BIND -#define LDAP_REQ_BIND 0x60L /* application + constructed */ -#define LDAP_REQ_UNBIND 0x42L /* application + primitive */ -#define LDAP_REQ_SEARCH 0x63L /* application + constructed */ -#define LDAP_REQ_MODIFY 0x66L /* application + constructed */ -#define LDAP_REQ_ADD 0x68L /* application + constructed */ -#define LDAP_REQ_DELETE 0x4aL /* application + primitive */ -#define LDAP_REQ_RENAME 0x6cL /* application + constructed */ -#define LDAP_REQ_COMPARE 0x6eL /* application + constructed */ -#define LDAP_REQ_ABANDON 0x50L /* application + primitive */ -#define LDAP_REQ_EXTENDED 0x77L /* application + constructed */ -#endif /* LDAP_REQ_BIND */ - - - -struct ldapsearch_type2str { - - int ldst2s_type; /* message type */ - char *ldst2s_string; /* descriptive string */ -}; - - -static struct ldapsearch_type2str ldapsearch_msgtypes[] = { - - /* results: */ - { LDAP_RES_BIND, "bind result" }, - { LDAP_RES_SEARCH_REFERENCE, "continuation reference" }, - { LDAP_RES_SEARCH_ENTRY, "entry" }, - { LDAP_RES_SEARCH_RESULT, "search result" }, - { LDAP_RES_MODIFY, "modify result" }, - { LDAP_RES_ADD, "add result" }, - { LDAP_RES_DELETE, "delete result" }, - { LDAP_RES_MODDN, "rename result" }, - { LDAP_RES_COMPARE, "compare result" }, - { LDAP_RES_EXTENDED, "extended operation result" }, - /* requests: */ - { LDAP_REQ_BIND, "bind request" }, - { LDAP_REQ_UNBIND, "unbind request" }, - { LDAP_REQ_SEARCH, "search request" }, - { LDAP_REQ_MODIFY, "modify request" }, - { LDAP_REQ_ADD, "add request" }, - { LDAP_REQ_DELETE, "delete request" }, - { LDAP_REQ_RENAME, "rename request" }, - { LDAP_REQ_COMPARE, "compare request" }, - { LDAP_REQ_ABANDON, "abandon request" }, - { LDAP_REQ_EXTENDED, "extended request" }, - -}; - - -#define LDAPSEARCHTOOL_NUMTYPES (sizeof(ldapsearch_msgtypes) \ - / sizeof(struct ldapsearch_type2str)) - - -/* -* Return a descriptive string given an LDAP result message type (tag). -*/ -static char * -msgtype2str( int msgtype ) -{ - char *s = "unknown"; - int i; - - s = "unknown"; - for ( i = 0; i < LDAPSEARCHTOOL_NUMTYPES; ++i ) { - if ( msgtype == ldapsearch_msgtypes[ i ].ldst2s_type ) { - s = ldapsearch_msgtypes[ i ].ldst2s_string; - } - } - return( s ); -} - - -/* - * Return a descriptive string given a Persistent Search change type - */ -static char * -changetype_num2string( int chgtype ) -{ - char *s = "unknown"; - - switch( chgtype ) { - case LDAP_CHANGETYPE_ADD: - s = "add"; - break; - case LDAP_CHANGETYPE_DELETE: - s = "delete"; - break; - case LDAP_CHANGETYPE_MODIFY: - s = "modify"; - break; - case LDAP_CHANGETYPE_MODDN: - s = "moddn"; - break; - } - - return( s ); -} diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/ldaptool.h b/mozilla/directory/c-sdk/ldap/clients/tools/ldaptool.h deleted file mode 100644 index 477680624c1..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/ldaptool.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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 -#include -#include -#include - -#ifdef AIX -#include -#endif - - -#ifdef SCOOS -#include -#endif - -#ifdef _WINDOWS -#define WIN32_LEAN_AND_MEAN -#include -extern int getopt (int argc, char *const *argv, const char *optstring); -#else -#include -#include -#include -#endif - -#include - -#ifndef SCOOS -#include -#endif - -#include -#include - -#if defined(NET_SSL) -#include -#endif - - -#include - -#include -#ifndef NO_LIBLCACHE -#include -#endif - -#include -#include - -#if defined(NET_SSL) -#include -#endif - -#include - -#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_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 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 ); -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 * ); -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); - - -#ifdef __cplusplus -} -#endif - -#endif /* LDAPTOOL_H */ diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/ntuserpin.c b/mozilla/directory/c-sdk/ldap/clients/tools/ntuserpin.c deleted file mode 100644 index eafa576404f..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/ntuserpin.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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 -#include "ntuserpin.h" - -#undef Debug -#undef OFF -#undef LITTLE_ENDIAN - -#include -#include -#include - - -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 ) */ - diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/ntuserpin.h b/mozilla/directory/c-sdk/ldap/clients/tools/ntuserpin.h deleted file mode 100644 index 55ad0ea3512..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/ntuserpin.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 diff --git a/mozilla/directory/c-sdk/ldap/clients/tools/tools.mak b/mozilla/directory/c-sdk/ldap/clients/tools/tools.mak deleted file mode 100644 index f6ba877faed..00000000000 --- a/mozilla/directory/c-sdk/ldap/clients/tools/tools.mak +++ /dev/null @@ -1,1812 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -!IF "$(CFG)" == "" -CFG=libldif - Win32 Debug -!MESSAGE No configuration specified. Defaulting to libldif - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "ldapdelete - Win32 Release" && "$(CFG)" !=\ - "ldapdelete - Win32 Debug" && "$(CFG)" != "libutil - Win32 Release" && "$(CFG)"\ - != "libutil - Win32 Debug" && "$(CFG)" != "ldapmodify - Win32 Release" &&\ - "$(CFG)" != "ldapmodify - Win32 Debug" && "$(CFG)" !=\ - "ldapsearch - Win32 Release" && "$(CFG)" != "ldapsearch - Win32 Debug" &&\ - "$(CFG)" != "ldapmodrdn - Win32 Release" && "$(CFG)" !=\ - "ldapmodrdn - Win32 Debug" && "$(CFG)" != "libldif - Win32 Release" && "$(CFG)"\ - != "libldif - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE on this makefile -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "tools.mak" CFG="libldif - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ldapdelete - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "ldapdelete - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "libutil - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "libutil - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "ldapmodify - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "ldapmodify - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "ldapsearch - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "ldapsearch - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "ldapmodrdn - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "ldapmodrdn - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "libldif - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "libldif - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF -################################################################################ -# Begin Project -# PROP Target_Last_Scanned "libldif - Win32 Debug" - -!IF "$(CFG)" == "ldapdelete - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ldapdelete\Release" -# PROP BASE Intermediate_Dir "ldapdelete\Release" -# PROP BASE Target_Dir "ldapdelete" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "release" -# PROP Intermediate_Dir "release\ldapdelete" -# PROP Target_Dir "ldapdelete" -OUTDIR=.\release -INTDIR=.\release\ldapdelete - -ALL : "libutil - Win32 Release" "$(OUTDIR)\ldapdelete.exe" - -CLEAN : - -@erase "$(INTDIR)\ldapdelete.obj" - -@erase "$(OUTDIR)\ldapdelete.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\dist\WINNT3.51_dbg.obj\include\nspr20\pr" /I "include" /I "..\..\include" /I "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr" /D "NET_SSL" /D "NDEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /GX /O2 /I\ - "..\..\dist\WINNT3.51_dbg.obj\include\nspr20\pr" /I "include" /I\ - "..\..\include" /I "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr" /D "NET_SSL"\ - /D "NDEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE"\ - /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D\ - "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32"\ - /Fp"$(INTDIR)/ldapdelete.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\release\ldapdelete/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/ldapdelete.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib nsldap32.lib nslch32.lib rpcrt4.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libsec-export.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libdbm.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libnspr20.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libxp.lib libutil.lib /nologo /subsystem:console /machine:I386 /force /LIBPATH:release -# SUBTRACT LINK32 /pdb:none /nodefaultlib -LINK32_FLAGS=nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib wsock32.lib nsldap32.lib nslch32.lib rpcrt4.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libsec-export.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libdbm.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libnspr20.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libxp.lib libutil.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)/ldapdelete.pdb"\ - /machine:I386 /force /out:"$(OUTDIR)/ldapdelete.exe" /LIBPATH:release -LINK32_OBJS= \ - "$(INTDIR)\ldapdelete.obj" \ - "$(OUTDIR)\libutil.lib" - -"$(OUTDIR)\ldapdelete.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ldapdelete - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ldapdelete\Debug" -# PROP BASE Intermediate_Dir "ldapdelete\Debug" -# PROP BASE Target_Dir "ldapdelete" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "debug" -# PROP Intermediate_Dir "debug\ldapdelete" -# PROP Target_Dir "ldapdelete" -OUTDIR=.\debug -INTDIR=.\debug\ldapdelete - -ALL : "libutil - Win32 Debug" "$(OUTDIR)\ldapdelete.exe" - -CLEAN : - -@erase "$(INTDIR)\ldapdelete.obj" - -@erase "$(INTDIR)\vc40.idb" - -@erase "$(INTDIR)\vc40.pdb" - -@erase "$(OUTDIR)\ldapdelete.exe" - -@erase "$(OUTDIR)\ldapdelete.ilk" - -@erase "$(OUTDIR)\ldapdelete.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od /I "include" /I "..\..\include" /I "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr" /D "_DEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "NET_SSL" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /Gm /GX /Zi /Od /I "include" /I "..\..\include" /I\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr" /D "_DEBUG" /D "_CONSOLE" /D\ - "_WINDOWS" /D "LDAP_DEBUG" /D "NET_SSL" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS"\ - /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D\ - "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32"\ - /Fp"$(INTDIR)/ldapdelete.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c -CPP_OBJS=.\debug\ldapdelete/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/ldapdelete.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 -# ADD LINK32 nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib rpcrt4.lib nsldap32.lib nslch32.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libsec-export.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libdbm.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libnspr20.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libxp.lib libutil.lib /nologo /subsystem:console /debug /machine:I386 /force /LIBPATH:debug -# SUBTRACT LINK32 /pdb:none /nodefaultlib -LINK32_FLAGS=nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib wsock32.lib rpcrt4.lib nsldap32.lib nslch32.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libsec-export.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libdbm.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libnspr20.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libxp.lib libutil.lib /nologo\ - /subsystem:console /incremental:yes /pdb:"$(OUTDIR)/ldapdelete.pdb" /debug\ - /machine:I386 /force /out:"$(OUTDIR)/ldapdelete.exe" /LIBPATH:debug -LINK32_OBJS= \ - "$(INTDIR)\ldapdelete.obj" \ - "$(OUTDIR)\libutil.lib" - -"$(OUTDIR)\ldapdelete.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "libutil - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "libutil\Release" -# PROP BASE Intermediate_Dir "libutil\Release" -# PROP BASE Target_Dir "libutil" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "release" -# PROP Intermediate_Dir "release\libutil" -# PROP Target_Dir "libutil" -OUTDIR=.\release -INTDIR=.\release\libutil - -ALL : "$(OUTDIR)\libutil.lib" - -CLEAN : - -@erase "$(INTDIR)\getopt.obj" - -@erase "$(INTDIR)\ntdebug.obj" - -@erase "$(INTDIR)\ntstubs.obj" - -@erase "$(OUTDIR)\libutil.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "o:\ns\include" /I "o:\ns\dist\public" /I "o:\ns\dist\public\nspr" /D "NDEBUG" /D "_WIN32" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /D "NET_SSL" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "include" /I "o:\ns\include" /I\ - "o:\ns\dist\public" /I "o:\ns\dist\public\nspr" /D "NDEBUG" /D "_WIN32" /D\ - "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D\ - "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D\ - "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /D "NET_SSL"\ - /Fp"$(INTDIR)/libutil.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\release\libutil/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/libutil.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo -LIB32_FLAGS=/nologo /out:"$(OUTDIR)/libutil.lib" -LIB32_OBJS= \ - "$(INTDIR)\getopt.obj" \ - "$(INTDIR)\ntdebug.obj" \ - "$(INTDIR)\ntstubs.obj" - -"$(OUTDIR)\libutil.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "libutil - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "libutil\Debug" -# PROP BASE Intermediate_Dir "libutil\Debug" -# PROP BASE Target_Dir "libutil" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "debug" -# PROP Intermediate_Dir "debug\libutil" -# PROP Target_Dir "libutil" -OUTDIR=.\debug -INTDIR=.\debug\libutil - -ALL : "$(OUTDIR)\libutil.lib" - -CLEAN : - -@erase "$(INTDIR)\getopt.obj" - -@erase "$(INTDIR)\ntdebug.obj" - -@erase "$(INTDIR)\ntstubs.obj" - -@erase "$(OUTDIR)\libutil.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /Z7 /Od /I "include" /I "o:\ns\include" /I "o:\ns\dist\public" /I "o:\ns\dist\public\nspr" /D "_DEBUG" /D "_WIN32" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /D "NET_SSL" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /GX /Z7 /Od /I "include" /I "o:\ns\include" /I\ - "o:\ns\dist\public" /I "o:\ns\dist\public\nspr" /D "_DEBUG" /D "_WIN32" /D\ - "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D\ - "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D\ - "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /D "NET_SSL"\ - /Fp"$(INTDIR)/libutil.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\debug\libutil/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/libutil.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo -LIB32_FLAGS=/nologo /out:"$(OUTDIR)/libutil.lib" -LIB32_OBJS= \ - "$(INTDIR)\getopt.obj" \ - "$(INTDIR)\ntdebug.obj" \ - "$(INTDIR)\ntstubs.obj" - -"$(OUTDIR)\libutil.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ldapmodify - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ldapmodify\Release" -# PROP BASE Intermediate_Dir "ldapmodify\Release" -# PROP BASE Target_Dir "ldapmodify" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "release" -# PROP Intermediate_Dir "release\ldapmodify" -# PROP Target_Dir "ldapmodify" -OUTDIR=.\release -INTDIR=.\release\ldapmodify - -ALL : "libldif - Win32 Release" "libutil - Win32 Release"\ - "$(OUTDIR)\ldapmodify.exe" - -CLEAN : - -@erase "$(INTDIR)\ldapmodify.obj" - -@erase "$(OUTDIR)\ldapmodify.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\dist\WINNT3.51_dbg.obj\include\nspr20\pr" /I "include" /I "..\..\include" /I "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr" /D "NET_SSL" /D "NDEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /GX /O2 /I\ - "..\..\dist\WINNT3.51_dbg.obj\include\nspr20\pr" /I "include" /I\ - "..\..\include" /I "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr" /D "NET_SSL"\ - /D "NDEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE"\ - /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D\ - "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32"\ - /Fp"$(INTDIR)/ldapmodify.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\release\ldapmodify/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/ldapmodify.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib nsldap32.lib nslch32.lib rpcrt4.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libsec-export.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libdbm.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libnspr20.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libxp.lib libutil.lib /nologo /subsystem:console /machine:I386 /force /LIBPATH:release -# SUBTRACT LINK32 /pdb:none /nodefaultlib -LINK32_FLAGS=nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib wsock32.lib nsldap32.lib nslch32.lib rpcrt4.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libsec-export.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libdbm.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libnspr20.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libxp.lib libutil.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)/ldapmodify.pdb"\ - /machine:I386 /force /out:"$(OUTDIR)/ldapmodify.exe" /LIBPATH:release -LINK32_OBJS= \ - "$(INTDIR)\ldapmodify.obj" \ - "$(OUTDIR)\libutil.lib" \ - ".\debug\libldif.lib" - -"$(OUTDIR)\ldapmodify.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ldapmodify - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ldapmodify\Debug" -# PROP BASE Intermediate_Dir "ldapmodify\Debug" -# PROP BASE Target_Dir "ldapmodify" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "debug" -# PROP Intermediate_Dir "debug\ldapmodify" -# PROP Target_Dir "ldapmodify" -OUTDIR=.\debug -INTDIR=.\debug\ldapmodify - -ALL : "libldif - Win32 Debug" "libutil - Win32 Debug"\ - "$(OUTDIR)\ldapmodify.exe" - -CLEAN : - -@erase "$(INTDIR)\ldapmodify.obj" - -@erase "$(INTDIR)\vc40.idb" - -@erase "$(INTDIR)\vc40.pdb" - -@erase "$(OUTDIR)\ldapmodify.exe" - -@erase "$(OUTDIR)\ldapmodify.ilk" - -@erase "$(OUTDIR)\ldapmodify.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od /I "include" /I "..\..\include" /I "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr" /D "_DEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "NET_SSL" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /Gm /GX /Zi /Od /I "include" /I "..\..\include" /I\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr" /D "_DEBUG" /D "_CONSOLE" /D\ - "_WINDOWS" /D "LDAP_DEBUG" /D "NET_SSL" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS"\ - /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D\ - "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32"\ - /Fp"$(INTDIR)/ldapmodify.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c -CPP_OBJS=.\debug\ldapmodify/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/ldapmodify.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 -# ADD LINK32 nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib rpcrt4.lib nsldap32.lib nslch32.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libsec-export.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libdbm.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libnspr20.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libxp.lib libutil.lib /nologo /subsystem:console /debug /machine:I386 /force /LIBPATH:debug -# SUBTRACT LINK32 /pdb:none /nodefaultlib -LINK32_FLAGS=nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib wsock32.lib rpcrt4.lib nsldap32.lib nslch32.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libsec-export.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libdbm.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libnspr20.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libxp.lib libutil.lib /nologo\ - /subsystem:console /incremental:yes /pdb:"$(OUTDIR)/ldapmodify.pdb" /debug\ - /machine:I386 /force /out:"$(OUTDIR)/ldapmodify.exe" /LIBPATH:debug -LINK32_OBJS= \ - "$(INTDIR)\ldapmodify.obj" \ - "$(OUTDIR)\libldif.lib" \ - "$(OUTDIR)\libutil.lib" - -"$(OUTDIR)\ldapmodify.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ldapsearch - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ldapsearch\Release" -# PROP BASE Intermediate_Dir "ldapsearch\Release" -# PROP BASE Target_Dir "ldapsearch" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "release" -# PROP Intermediate_Dir "release\ldapsearch" -# PROP Target_Dir "ldapsearch" -OUTDIR=.\release -INTDIR=.\release\ldapsearch - -ALL : "libldif - Win32 Release" "libutil - Win32 Release"\ - "$(OUTDIR)\ldapsearch.exe" - -CLEAN : - -@erase "$(INTDIR)\ldapsearch.obj" - -@erase "$(OUTDIR)\ldapsearch.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\dist\WINNT3.51_opt.obj\include\nspr20\pr" /I "include" /I "..\..\include" /I "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr" /D "NDEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "NET_SSL" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /GX /O2 /I\ - "..\..\dist\WINNT3.51_opt.obj\include\nspr20\pr" /I "include" /I\ - "..\..\include" /I "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr" /D "NDEBUG"\ - /D "_CONSOLE" /D "_WINDOWS" /D "NET_SSL" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE"\ - /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D\ - "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32"\ - /Fp"$(INTDIR)/ldapsearch.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\release\ldapsearch/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/ldapsearch.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib nsldap32.lib nslch32.lib rpcrt4.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libsec-export.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libdbm.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libnspr20.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libxp.lib libutil.lib /nologo /subsystem:console /machine:I386 /force /LIBPATH:release -# SUBTRACT LINK32 /pdb:none /nodefaultlib -LINK32_FLAGS=nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib wsock32.lib nsldap32.lib nslch32.lib rpcrt4.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libsec-export.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libdbm.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libnspr20.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libxp.lib libutil.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)/ldapsearch.pdb"\ - /machine:I386 /force /out:"$(OUTDIR)/ldapsearch.exe" /LIBPATH:release -LINK32_OBJS= \ - "$(INTDIR)\ldapsearch.obj" \ - "$(OUTDIR)\libutil.lib" \ - ".\debug\libldif.lib" - -"$(OUTDIR)\ldapsearch.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ldapsearch - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ldapsearch\Debug" -# PROP BASE Intermediate_Dir "ldapsearch\Debug" -# PROP BASE Target_Dir "ldapsearch" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "debug" -# PROP Intermediate_Dir "debug\ldapsearch" -# PROP Target_Dir "ldapsearch" -OUTDIR=.\debug -INTDIR=.\debug\ldapsearch - -ALL : "libldif - Win32 Debug" "libutil - Win32 Debug"\ - "$(OUTDIR)\ldapsearch.exe" - -CLEAN : - -@erase "$(INTDIR)\ldapsearch.obj" - -@erase "$(INTDIR)\vc40.idb" - -@erase "$(INTDIR)\vc40.pdb" - -@erase "$(OUTDIR)\ldapsearch.exe" - -@erase "$(OUTDIR)\ldapsearch.ilk" - -@erase "$(OUTDIR)\ldapsearch.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od /I "include" /I "..\..\include" /I "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr" /D "_DEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "NET_SSL" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /Gm /GX /Zi /Od /I "include" /I "..\..\include" /I\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr" /D "_DEBUG" /D "_CONSOLE" /D\ - "_WINDOWS" /D "LDAP_DEBUG" /D "NET_SSL" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS"\ - /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D\ - "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32"\ - /Fp"$(INTDIR)/ldapsearch.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c -CPP_OBJS=.\debug\ldapsearch/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/ldapsearch.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 -# ADD LINK32 nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib rpcrt4.lib nsldap32.lib nslch32.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libsec-export.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libdbm.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libnspr20.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libxp.lib libutil.lib /nologo /subsystem:console /debug /machine:I386 /force /LIBPATH:debug -# SUBTRACT LINK32 /pdb:none /nodefaultlib -LINK32_FLAGS=nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib wsock32.lib rpcrt4.lib nsldap32.lib nslch32.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libsec-export.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libdbm.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libnspr20.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libxp.lib libutil.lib /nologo\ - /subsystem:console /incremental:yes /pdb:"$(OUTDIR)/ldapsearch.pdb" /debug\ - /machine:I386 /force /out:"$(OUTDIR)/ldapsearch.exe" /LIBPATH:debug -LINK32_OBJS= \ - "$(INTDIR)\ldapsearch.obj" \ - "$(OUTDIR)\libldif.lib" \ - "$(OUTDIR)\libutil.lib" - -"$(OUTDIR)\ldapsearch.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ldapmodrdn\Release" -# PROP BASE Intermediate_Dir "ldapmodrdn\Release" -# PROP BASE Target_Dir "ldapmodrdn" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "release" -# PROP Intermediate_Dir "release\ldapmodrdn" -# PROP Target_Dir "ldapmodrdn" -OUTDIR=.\release -INTDIR=.\release\ldapmodrdn - -ALL : "libutil - Win32 Release" "$(OUTDIR)\ldapmodrdn.exe" - -CLEAN : - -@erase "$(INTDIR)\ldapmodrdn.obj" - -@erase "$(OUTDIR)\ldapmodrdn.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\dist\WINNT3.51_dbg.obj\include\nspr20\pr" /I "include" /I "..\..\include" /I "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr" /D "NET_SSL" /D "NDEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /GX /O2 /I\ - "..\..\dist\WINNT3.51_dbg.obj\include\nspr20\pr" /I "include" /I\ - "..\..\include" /I "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr" /D "NET_SSL"\ - /D "NDEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE"\ - /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D\ - "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32"\ - /Fp"$(INTDIR)/ldapmodrdn.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\release\ldapmodrdn/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/ldapmodrdn.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib nsldap32.lib nslch32.lib rpcrt4.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libsec-export.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libdbm.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libnspr20.lib ..\..\dist\WINNT4.0_OPT.OBJ\lib\libxp.lib libutil.lib /nologo /subsystem:console /machine:I386 /force /LIBPATH:release -# SUBTRACT LINK32 /pdb:none /nodefaultlib -LINK32_FLAGS=nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib wsock32.lib nsldap32.lib nslch32.lib rpcrt4.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libsec-export.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libdbm.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libnspr20.lib\ - ..\..\dist\WINNT4.0_OPT.OBJ\lib\libxp.lib libutil.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)/ldapmodrdn.pdb"\ - /machine:I386 /force /out:"$(OUTDIR)/ldapmodrdn.exe" /LIBPATH:release -LINK32_OBJS= \ - "$(INTDIR)\ldapmodrdn.obj" \ - "$(OUTDIR)\libutil.lib" - -"$(OUTDIR)\ldapmodrdn.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ldapmodrdn\Debug" -# PROP BASE Intermediate_Dir "ldapmodrdn\Debug" -# PROP BASE Target_Dir "ldapmodrdn" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "debug" -# PROP Intermediate_Dir "debug\ldapmodrdn" -# PROP Target_Dir "ldapmodrdn" -OUTDIR=.\debug -INTDIR=.\debug\ldapmodrdn - -ALL : "libutil - Win32 Debug" "$(OUTDIR)\ldapmodrdn.exe" - -CLEAN : - -@erase "$(INTDIR)\ldapmodrdn.obj" - -@erase "$(INTDIR)\vc40.idb" - -@erase "$(INTDIR)\vc40.pdb" - -@erase "$(OUTDIR)\ldapmodrdn.exe" - -@erase "$(OUTDIR)\ldapmodrdn.ilk" - -@erase "$(OUTDIR)\ldapmodrdn.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od /I "include" /I "..\..\include" /I "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr" /D "_DEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "LDAP_DEBUG" /D "NET_SSL" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /Gm /GX /Zi /Od /I "include" /I "..\..\include" /I\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr" /D "_DEBUG" /D "_CONSOLE" /D\ - "_WINDOWS" /D "LDAP_DEBUG" /D "NET_SSL" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS"\ - /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D\ - "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32"\ - /Fp"$(INTDIR)/ldapmodrdn.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c -CPP_OBJS=.\debug\ldapmodrdn/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/ldapmodrdn.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 -# ADD LINK32 nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib rpcrt4.lib nsldap32.lib nslch32.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libsec-export.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libdbm.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libnspr20.lib ..\..\dist\WINNT4.0_DBG.OBJ\lib\libxp.lib libutil.lib /nologo /subsystem:console /debug /machine:I386 /force /LIBPATH:debug -# SUBTRACT LINK32 /pdb:none /nodefaultlib -LINK32_FLAGS=nssldap32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib wsock32.lib rpcrt4.lib nsldap32.lib nslch32.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libsec-export.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libdbm.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libnspr20.lib\ - ..\..\dist\WINNT4.0_DBG.OBJ\lib\libxp.lib libutil.lib /nologo\ - /subsystem:console /incremental:yes /pdb:"$(OUTDIR)/ldapmodrdn.pdb" /debug\ - /machine:I386 /force /out:"$(OUTDIR)/ldapmodrdn.exe" /LIBPATH:debug -LINK32_OBJS= \ - "$(INTDIR)\ldapmodrdn.obj" \ - "$(OUTDIR)\libutil.lib" - -"$(OUTDIR)\ldapmodrdn.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "libldif - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "libldif\Release" -# PROP BASE Intermediate_Dir "libldif\Release" -# PROP BASE Target_Dir "libldif" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "debug" -# PROP Intermediate_Dir "debug\libldif" -# PROP Target_Dir "libldif" -OUTDIR=.\debug -INTDIR=.\debug\libldif - -ALL : "libutil - Win32 Release" "$(OUTDIR)\libldif.lib" - -CLEAN : - -@erase "$(INTDIR)\line64.obj" - -@erase "$(OUTDIR)\libldif.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "..\..\include" /I "o:\ns\include" /I "o:\ns\dist\public\nspr" /D "NDEBUG" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /D "NET_SSL" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "include" /I "..\..\include" /I\ - "o:\ns\include" /I "o:\ns\dist\public\nspr" /D "NDEBUG" /D "_WINDOWS" /D\ - "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D\ - "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D\ - "SYSERRLIST_IN_STDIO" /D "WIN32" /D "NET_SSL" /Fp"$(INTDIR)/libldif.pch" /YX\ - /Fo"$(INTDIR)/" /c -CPP_OBJS=.\debug\libldif/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/libldif.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo -LIB32_FLAGS=/nologo /out:"$(OUTDIR)/libldif.lib" -LIB32_OBJS= \ - "$(INTDIR)\line64.obj" \ - ".\release\libutil.lib" - -"$(OUTDIR)\libldif.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "libldif - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "libldif\Debug" -# PROP BASE Intermediate_Dir "libldif\Debug" -# PROP BASE Target_Dir "libldif" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "debug" -# PROP Intermediate_Dir "debug\libldif" -# PROP Target_Dir "libldif" -OUTDIR=.\debug -INTDIR=.\debug\libldif - -ALL : "libutil - Win32 Debug" "$(OUTDIR)\libldif.lib" - -CLEAN : - -@erase "$(INTDIR)\line64.obj" - -@erase "$(OUTDIR)\libldif.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /Z7 /Od /I "include" /I "..\..\include" /I "o:\ns\include" /I "o:\ns\dist\public\nspr" /D "_DEBUG" /D "_WINDOWS" /D "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D "SYSERRLIST_IN_STDIO" /D "WIN32" /D "NET_SSL" /YX /c -# SUBTRACT CPP /u -CPP_PROJ=/nologo /MD /W3 /GX /Z7 /Od /I "include" /I "..\..\include" /I\ - "o:\ns\include" /I "o:\ns\dist\public\nspr" /D "_DEBUG" /D "_WINDOWS" /D\ - "LDAP_DEBUG" /D "LDBM_USE_DBBTREE" /D "NEEDPROTOS" /D "WIN32_KERNEL_THREADS" /D\ - "LDAP_REFERRALS" /D "WINDOWS" /D "XP_PC" /D "XP_WIN32" /D "USE_NSPR_MT" /D\ - "SYSERRLIST_IN_STDIO" /D "WIN32" /D "NET_SSL" /Fp"$(INTDIR)/libldif.pch" /YX\ - /Fo"$(INTDIR)/" /c -CPP_OBJS=.\debug\libldif/ -CPP_SBRS=.\. - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/libldif.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo -LIB32_FLAGS=/nologo /out:"$(OUTDIR)/libldif.lib" -LIB32_OBJS= \ - "$(INTDIR)\line64.obj" \ - "$(OUTDIR)\libutil.lib" - -"$(OUTDIR)\libldif.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ENDIF - -################################################################################ -# Begin Target - -# Name "ldapdelete - Win32 Release" -# Name "ldapdelete - Win32 Debug" - -!IF "$(CFG)" == "ldapdelete - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapdelete - Win32 Debug" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE=.\clients\tools\ldapdelete.c - -!IF "$(CFG)" == "ldapdelete - Win32 Release" - -DEP_CPP_LDAPD=\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md/_unixos.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md/sunos4.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md\prcpucfg.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\obsolete\protypes.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prarena.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prcpucfg.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prinrval.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prio.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prlong.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prmem.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prprf.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prtime.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prtypes.h"\ - "..\..\include\cdefs.h"\ - "..\..\include\ds.h"\ - "..\..\include\mcom_db.h"\ - "..\..\include\sec.h"\ - "..\..\include\secerr.h"\ - "..\..\include\winfile.h"\ - "..\..\include\xp_core.h"\ - "..\..\include\xp_debug.h"\ - "..\..\include\xp_error.h"\ - "..\..\include\xp_file.h"\ - "..\..\include\xp_list.h"\ - "..\..\include\xp_mcom.h"\ - "..\..\include\xp_mem.h"\ - "..\..\include\xp_str.h"\ - "..\..\include\xp_trace.h"\ - "..\..\include\xpassert.h"\ - ".\include\lber.h"\ - ".\include\ldap.h"\ - ".\include\ldap_ssl.h"\ - ".\include\ldaplog.h"\ - {$(INCLUDE)}"\sys\STAT.H"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - -NODEP_CPP_LDAPD=\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\protypes.h"\ - "..\..\include\macmem.h"\ - "..\..\include\prmacos.h"\ - - -"$(INTDIR)\ldapdelete.obj" : $(SOURCE) $(DEP_CPP_LDAPD) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "ldapdelete - Win32 Debug" - -DEP_CPP_LDAPD=\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md/_unixos.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md/sunos4.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md\prcpucfg.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\obsolete\protypes.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prarena.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prcpucfg.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prinrval.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prio.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prlong.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prmem.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prprf.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prtime.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prtypes.h"\ - "..\..\include\cdefs.h"\ - "..\..\include\ds.h"\ - "..\..\include\mcom_db.h"\ - "..\..\include\sec.h"\ - "..\..\include\secerr.h"\ - "..\..\include\winfile.h"\ - "..\..\include\xp_core.h"\ - "..\..\include\xp_debug.h"\ - "..\..\include\xp_error.h"\ - "..\..\include\xp_file.h"\ - "..\..\include\xp_list.h"\ - "..\..\include\xp_mcom.h"\ - "..\..\include\xp_mem.h"\ - "..\..\include\xp_str.h"\ - "..\..\include\xp_trace.h"\ - "..\..\include\xpassert.h"\ - ".\include\lber.h"\ - ".\include\ldap.h"\ - ".\include\ldap_ssl.h"\ - ".\include\ldaplog.h"\ - {$(INCLUDE)}"\sys\STAT.H"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - -NODEP_CPP_LDAPD=\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\protypes.h"\ - "..\..\include\macmem.h"\ - "..\..\include\prmacos.h"\ - - -"$(INTDIR)\ldapdelete.obj" : $(SOURCE) $(DEP_CPP_LDAPD) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -# End Source File -################################################################################ -# Begin Project Dependency - -# Project_Dep_Name "libutil" - -!IF "$(CFG)" == "ldapdelete - Win32 Release" - -"libutil - Win32 Release" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapdelete - Win32 Debug" - -"libutil - Win32 Debug" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Debug" - -!ENDIF - -# End Project Dependency -# End Target -################################################################################ -# Begin Target - -# Name "libutil - Win32 Release" -# Name "libutil - Win32 Debug" - -!IF "$(CFG)" == "libutil - Win32 Release" - -!ELSEIF "$(CFG)" == "libutil - Win32 Debug" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE=.\libraries\libutil\getopt.c -DEP_CPP_GETOP=\ - ".\include\lber.h"\ - - -"$(INTDIR)\getopt.obj" : $(SOURCE) $(DEP_CPP_GETOP) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\libraries\libutil\ntdebug.c -DEP_CPP_NTDEB=\ - ".\include\lber.h"\ - ".\include\ldap.h"\ - ".\include\ldaplog.h"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - -NODEP_CPP_NTDEB=\ - ".\libraries\libutil\proto-slap.h"\ - ".\libraries\libutil\slap.h"\ - - -"$(INTDIR)\ntdebug.obj" : $(SOURCE) $(DEP_CPP_NTDEB) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\libraries\libutil\ntstubs.c - -"$(INTDIR)\ntstubs.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -# End Target -################################################################################ -# Begin Target - -# Name "ldapmodify - Win32 Release" -# Name "ldapmodify - Win32 Debug" - -!IF "$(CFG)" == "ldapmodify - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapmodify - Win32 Debug" - -!ENDIF - -################################################################################ -# Begin Project Dependency - -# Project_Dep_Name "libutil" - -!IF "$(CFG)" == "ldapmodify - Win32 Release" - -"libutil - Win32 Release" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapmodify - Win32 Debug" - -"libutil - Win32 Debug" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Debug" - -!ENDIF - -# End Project Dependency -################################################################################ -# Begin Source File - -SOURCE=.\clients\tools\ldapmodify.c - -!IF "$(CFG)" == "ldapmodify - Win32 Release" - -DEP_CPP_LDAPM=\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md/_unixos.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md/sunos4.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md\prcpucfg.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\obsolete\protypes.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prarena.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prcpucfg.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prinrval.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prio.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prlong.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prmem.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prprf.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prtime.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prtypes.h"\ - "..\..\include\cdefs.h"\ - "..\..\include\ds.h"\ - "..\..\include\mcom_db.h"\ - "..\..\include\sec.h"\ - "..\..\include\secerr.h"\ - "..\..\include\winfile.h"\ - "..\..\include\xp_core.h"\ - "..\..\include\xp_debug.h"\ - "..\..\include\xp_error.h"\ - "..\..\include\xp_file.h"\ - "..\..\include\xp_list.h"\ - "..\..\include\xp_mcom.h"\ - "..\..\include\xp_mem.h"\ - "..\..\include\xp_str.h"\ - "..\..\include\xp_trace.h"\ - "..\..\include\xpassert.h"\ - ".\include\lber.h"\ - ".\include\ldap.h"\ - ".\include\ldap_ssl.h"\ - ".\include\ldaplog.h"\ - ".\include\ldif.h"\ - ".\include\portable.h"\ - {$(INCLUDE)}"\sys\STAT.H"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - -NODEP_CPP_LDAPM=\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\protypes.h"\ - "..\..\include\macmem.h"\ - "..\..\include\prmacos.h"\ - - -"$(INTDIR)\ldapmodify.obj" : $(SOURCE) $(DEP_CPP_LDAPM) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "ldapmodify - Win32 Debug" - -DEP_CPP_LDAPM=\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md/_unixos.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md/sunos4.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md\prcpucfg.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\obsolete\protypes.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prarena.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prcpucfg.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prinrval.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prio.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prlong.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prmem.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prprf.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prtime.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prtypes.h"\ - "..\..\include\cdefs.h"\ - "..\..\include\ds.h"\ - "..\..\include\mcom_db.h"\ - "..\..\include\sec.h"\ - "..\..\include\secerr.h"\ - "..\..\include\winfile.h"\ - "..\..\include\xp_core.h"\ - "..\..\include\xp_debug.h"\ - "..\..\include\xp_error.h"\ - "..\..\include\xp_file.h"\ - "..\..\include\xp_list.h"\ - "..\..\include\xp_mcom.h"\ - "..\..\include\xp_mem.h"\ - "..\..\include\xp_str.h"\ - "..\..\include\xp_trace.h"\ - "..\..\include\xpassert.h"\ - ".\include\lber.h"\ - ".\include\ldap.h"\ - ".\include\ldap_ssl.h"\ - ".\include\ldaplog.h"\ - ".\include\ldif.h"\ - ".\include\portable.h"\ - {$(INCLUDE)}"\sys\STAT.H"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - -NODEP_CPP_LDAPM=\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\protypes.h"\ - "..\..\include\macmem.h"\ - "..\..\include\prmacos.h"\ - - -"$(INTDIR)\ldapmodify.obj" : $(SOURCE) $(DEP_CPP_LDAPM) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -# End Source File -################################################################################ -# Begin Project Dependency - -# Project_Dep_Name "libldif" - -!IF "$(CFG)" == "ldapmodify - Win32 Release" - -"libldif - Win32 Release" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libldif - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapmodify - Win32 Debug" - -"libldif - Win32 Debug" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libldif - Win32 Debug" - -!ENDIF - -# End Project Dependency -# End Target -################################################################################ -# Begin Target - -# Name "ldapsearch - Win32 Release" -# Name "ldapsearch - Win32 Debug" - -!IF "$(CFG)" == "ldapsearch - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapsearch - Win32 Debug" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE=.\clients\tools\ldapsearch.c - -!IF "$(CFG)" == "ldapsearch - Win32 Release" - -DEP_CPP_LDAPS=\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md/_unixos.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md/sunos4.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md\prcpucfg.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\obsolete\protypes.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prarena.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prcpucfg.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prinrval.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prio.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prlong.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prmem.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prprf.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prtime.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prtypes.h"\ - "..\..\include\cdefs.h"\ - "..\..\include\ds.h"\ - "..\..\include\mcom_db.h"\ - "..\..\include\sec.h"\ - "..\..\include\secerr.h"\ - "..\..\include\winfile.h"\ - "..\..\include\xp_core.h"\ - "..\..\include\xp_debug.h"\ - "..\..\include\xp_error.h"\ - "..\..\include\xp_file.h"\ - "..\..\include\xp_list.h"\ - "..\..\include\xp_mcom.h"\ - "..\..\include\xp_mem.h"\ - "..\..\include\xp_str.h"\ - "..\..\include\xp_trace.h"\ - "..\..\include\xpassert.h"\ - ".\include\lber.h"\ - ".\include\ldap.h"\ - ".\include\ldap_ssl.h"\ - ".\include\ldaplog.h"\ - ".\include\ldif.h"\ - ".\include\portable.h"\ - {$(INCLUDE)}"\sys\STAT.H"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - -NODEP_CPP_LDAPS=\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\protypes.h"\ - "..\..\include\macmem.h"\ - "..\..\include\prmacos.h"\ - - -"$(INTDIR)\ldapsearch.obj" : $(SOURCE) $(DEP_CPP_LDAPS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "ldapsearch - Win32 Debug" - -DEP_CPP_LDAPS=\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md/_unixos.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md/sunos4.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md\prcpucfg.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\obsolete\protypes.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prarena.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prcpucfg.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prinrval.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prio.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prlong.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prmem.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prprf.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prtime.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prtypes.h"\ - "..\..\include\cdefs.h"\ - "..\..\include\ds.h"\ - "..\..\include\mcom_db.h"\ - "..\..\include\sec.h"\ - "..\..\include\secerr.h"\ - "..\..\include\winfile.h"\ - "..\..\include\xp_core.h"\ - "..\..\include\xp_debug.h"\ - "..\..\include\xp_error.h"\ - "..\..\include\xp_file.h"\ - "..\..\include\xp_list.h"\ - "..\..\include\xp_mcom.h"\ - "..\..\include\xp_mem.h"\ - "..\..\include\xp_str.h"\ - "..\..\include\xp_trace.h"\ - "..\..\include\xpassert.h"\ - ".\include\lber.h"\ - ".\include\ldap.h"\ - ".\include\ldap_ssl.h"\ - ".\include\ldaplog.h"\ - ".\include\ldif.h"\ - ".\include\portable.h"\ - {$(INCLUDE)}"\sys\STAT.H"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - -NODEP_CPP_LDAPS=\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\protypes.h"\ - "..\..\include\macmem.h"\ - "..\..\include\prmacos.h"\ - - -"$(INTDIR)\ldapsearch.obj" : $(SOURCE) $(DEP_CPP_LDAPS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -# End Source File -################################################################################ -# Begin Project Dependency - -# Project_Dep_Name "libutil" - -!IF "$(CFG)" == "ldapsearch - Win32 Release" - -"libutil - Win32 Release" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapsearch - Win32 Debug" - -"libutil - Win32 Debug" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Debug" - -!ENDIF - -# End Project Dependency -################################################################################ -# Begin Project Dependency - -# Project_Dep_Name "libldif" - -!IF "$(CFG)" == "ldapsearch - Win32 Release" - -"libldif - Win32 Release" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libldif - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapsearch - Win32 Debug" - -"libldif - Win32 Debug" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libldif - Win32 Debug" - -!ENDIF - -# End Project Dependency -# End Target -################################################################################ -# Begin Target - -# Name "ldapmodrdn - Win32 Release" -# Name "ldapmodrdn - Win32 Debug" - -!IF "$(CFG)" == "ldapmodrdn - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Debug" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE=.\clients\tools\ldapmodrdn.c - -!IF "$(CFG)" == "ldapmodrdn - Win32 Release" - -DEP_CPP_LDAPMO=\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md/_unixos.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md/sunos4.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\md\prcpucfg.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\obsolete\protypes.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prarena.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prcpucfg.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prinrval.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prio.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prlong.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prmem.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prprf.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prtime.h"\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\prtypes.h"\ - "..\..\include\cdefs.h"\ - "..\..\include\ds.h"\ - "..\..\include\mcom_db.h"\ - "..\..\include\sec.h"\ - "..\..\include\secerr.h"\ - "..\..\include\winfile.h"\ - "..\..\include\xp_core.h"\ - "..\..\include\xp_debug.h"\ - "..\..\include\xp_error.h"\ - "..\..\include\xp_file.h"\ - "..\..\include\xp_list.h"\ - "..\..\include\xp_mcom.h"\ - "..\..\include\xp_mem.h"\ - "..\..\include\xp_str.h"\ - "..\..\include\xp_trace.h"\ - "..\..\include\xpassert.h"\ - ".\include\lber.h"\ - ".\include\ldap.h"\ - ".\include\ldap_ssl.h"\ - ".\include\ldaplog.h"\ - {$(INCLUDE)}"\sys\STAT.H"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - -NODEP_CPP_LDAPMO=\ - "..\..\dist\WINNT4.0_OPT.OBJ\include\nspr20\pr\protypes.h"\ - "..\..\include\macmem.h"\ - "..\..\include\prmacos.h"\ - - -"$(INTDIR)\ldapmodrdn.obj" : $(SOURCE) $(DEP_CPP_LDAPMO) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Debug" - -DEP_CPP_LDAPMO=\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md/_unixos.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md/sunos4.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\md\prcpucfg.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\obsolete\protypes.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prarena.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prcpucfg.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prinrval.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prio.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prlong.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prmem.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prprf.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prtime.h"\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\prtypes.h"\ - "..\..\include\cdefs.h"\ - "..\..\include\ds.h"\ - "..\..\include\mcom_db.h"\ - "..\..\include\sec.h"\ - "..\..\include\secerr.h"\ - "..\..\include\winfile.h"\ - "..\..\include\xp_core.h"\ - "..\..\include\xp_debug.h"\ - "..\..\include\xp_error.h"\ - "..\..\include\xp_file.h"\ - "..\..\include\xp_list.h"\ - "..\..\include\xp_mcom.h"\ - "..\..\include\xp_mem.h"\ - "..\..\include\xp_str.h"\ - "..\..\include\xp_trace.h"\ - "..\..\include\xpassert.h"\ - ".\include\lber.h"\ - ".\include\ldap.h"\ - ".\include\ldap_ssl.h"\ - ".\include\ldaplog.h"\ - {$(INCLUDE)}"\sys\STAT.H"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - -NODEP_CPP_LDAPMO=\ - "..\..\dist\WINNT4.0_DBG.OBJ\include\nspr20\pr\protypes.h"\ - "..\..\include\macmem.h"\ - "..\..\include\prmacos.h"\ - - -"$(INTDIR)\ldapmodrdn.obj" : $(SOURCE) $(DEP_CPP_LDAPMO) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -# End Source File -################################################################################ -# Begin Project Dependency - -# Project_Dep_Name "libutil" - -!IF "$(CFG)" == "ldapmodrdn - Win32 Release" - -"libutil - Win32 Release" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Release" - -!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Debug" - -"libutil - Win32 Debug" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Debug" - -!ENDIF - -# End Project Dependency -# End Target -################################################################################ -# Begin Target - -# Name "libldif - Win32 Release" -# Name "libldif - Win32 Debug" - -!IF "$(CFG)" == "libldif - Win32 Release" - -!ELSEIF "$(CFG)" == "libldif - Win32 Debug" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE=.\libraries\libldif\line64.c -DEP_CPP_LINE6=\ - ".\include\ldaplog.h"\ - ".\include\ldif.h"\ - {$(INCLUDE)}"\sys\TYPES.H"\ - - -"$(INTDIR)\line64.obj" : $(SOURCE) $(DEP_CPP_LINE6) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Project Dependency - -# Project_Dep_Name "libutil" - -!IF "$(CFG)" == "libldif - Win32 Release" - -"libutil - Win32 Release" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Release" - -!ELSEIF "$(CFG)" == "libldif - Win32 Debug" - -"libutil - Win32 Debug" : - $(MAKE) /$(MAKEFLAGS) /F ".\tools.mak" CFG="libutil - Win32 Debug" - -!ENDIF - -# End Project Dependency -# End Target -# End Project -################################################################################ diff --git a/mozilla/directory/c-sdk/ldap/configure b/mozilla/directory/c-sdk/ldap/configure deleted file mode 100755 index 884ce3f3061..00000000000 --- a/mozilla/directory/c-sdk/ldap/configure +++ /dev/null @@ -1,798 +0,0 @@ -#! /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 </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 < 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 <> $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 <> $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 - diff --git a/mozilla/directory/c-sdk/ldap/configure.in b/mozilla/directory/c-sdk/ldap/configure.in deleted file mode 100644 index a5b702497d9..00000000000 --- a/mozilla/directory/c-sdk/ldap/configure.in +++ /dev/null @@ -1,50 +0,0 @@ -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 -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]) diff --git a/mozilla/directory/c-sdk/ldap/docs/README b/mozilla/directory/c-sdk/ldap/docs/README deleted file mode 100644 index bddd2628688..00000000000 --- a/mozilla/directory/c-sdk/ldap/docs/README +++ /dev/null @@ -1,17 +0,0 @@ -================================================================= - iPlanet LDAP SDK for C, version 5.0 -================================================================= - -Documentation for this release of the LDAP SDK for C is located -at the following URL: - - http://docs.iplanet.com/docs/manuals/directory.html#SDKC - -The documentation set includes the "Release Notes" (in HTML -format) and the "Netscape LDAP SDK for C Programmer's Guide." -The Programmer's Guide is available in PDF and HTML formats. - -Please note that the LDAP SDK for C library is most of the time -ahead of our official documentation. For example, we currently -don't have a 5.0 branded version of the documentation, however, -using the latest 4.1 version should be sufficient. diff --git a/mozilla/directory/c-sdk/ldap/docs/redist.txt b/mozilla/directory/c-sdk/ldap/docs/redist.txt deleted file mode 100644 index 9c09f661680..00000000000 --- a/mozilla/directory/c-sdk/ldap/docs/redist.txt +++ /dev/null @@ -1,43 +0,0 @@ -The enclosed file[s] Exhibit A is licensed to you (either an individual -or a single entity, not including affiliates) pursuant to the terms -and conditions of the "Netscape ONE SDK END-USER LICENSE AGREEMENT" -between you and Netscape (the "Agreement"). Any use, copying, -distribution or other disposition of the file[s] in Exhibit A is governed -by the Agreement. For purposes of the Agreement, the file[s] in Exhibit A -is considered to be a "Redistributable Element," as defined in the -Agreement, and any distribution of the file[s] in Exhibit A shall be -subject to the same restrictions governing "Redistributable Element." - - -Exhibit A - -The following files of the Netscape Directory SDK are redistributable: - - lib/nsldap32v50.dll, lib/nsldap32v50.dll, (MS Windows 95/98 & NT) - lib/nsldappr32v50.dll, lib/nsldapssl32v50.dll, (MS Windows 95/98 & NT) - lib/nsldapssl32v50.lib,lib/nsldappr32v50.lib (MS Windows 95/98 & NT) - lib/libnspr3.dll, lib/libplc3.dll, (Windows NT) - lib/libplds3.dll (Windows NT) - lib/nsiutil32v50.lib (Windows NT) - lib/nsldif32v50.lib (Windows NT) - lib/nsldif32v50.lib (Windows NT) - lib/nss.dll, lib/ssl.dll (MS Windows 95/98 & NT) - lib/nspr3.dll, lib/plc3.dll, lib/plds3.dll (MS Windows 95/98) - lib/plc3.so, lib/libplds3.so, lib/libnspr3.so, (UNIX) - lib/libldapssl50.so (UNIX) - lib/libldap50.so (UNIX) - lib/libfreebl_hybrid_3.so (UNIX) - lib/libfreebl_pure32_3.so (UNIX) - lib/libiutil50.so (UNIX) - lib/libfreebl_hybrid_3.sl (HPUX) - lib/libfreebl_pure32_3.sl (HPUX) - lib/plc3.sl, lib/libplds3.sl, lib/libnspr3.sl, (HPUX) - lib/libldapssl50.sl (HPUX) - lib/libiutil50.sl (HPUX) - -For purposes of this Agreement, format of Files shall have an operating -system-generic file specification format to specify multiple files. The -following are examples of this format: - - "lib/*.class" (all files in the subdirectory "lib/" ending in .class ) - diff --git a/mozilla/directory/c-sdk/ldap/docs/release.gif b/mozilla/directory/c-sdk/ldap/docs/release.gif deleted file mode 100755 index 4f8591a280a..00000000000 Binary files a/mozilla/directory/c-sdk/ldap/docs/release.gif and /dev/null differ diff --git a/mozilla/directory/c-sdk/ldap/docs/relnotes_41.htm b/mozilla/directory/c-sdk/ldap/docs/relnotes_41.htm deleted file mode 100755 index 794941c210b..00000000000 --- a/mozilla/directory/c-sdk/ldap/docs/relnotes_41.htm +++ /dev/null @@ -1,500 +0,0 @@ - - -Release Notes for Netscape LDAP SDK for C, version 4.1 - - - - - - - - -

- -

NETSCAPE DIRECTORY -SERVER

- -

LDAP SDK for C, version 4.1

- -

Last updated November 15, 2000

- -

-


- - - - - - - - -
  - -

-CONTENTS

- -

These release notes include:

- - - -
-

SUPPORTED -PLATFORMS

- -

The LDAP SDK for C, version 4.1 provides support for the following platforms:

- -
    -
  • SunOS 5.6 (32-bit) -
  • SunOS 5.8 (64-bit) -
  • AIX 4.3.2 -
  • Digital Tru64 (Digital Unix 4.0d) -
  • HP-UX 11.0 (both 32-bit and 64-bit) -
  • Linux 2.2 (for x86) (glibc 2.0) -
  • Windows NT 4.0 sp6 -
  • Windows 95, Windows 98 -
- -

-


-

INSTALLING THE SDK

- -

Follow these instructions to install the Netscape LDAP SDK for C:

- -
    -
  • For UNIX systems (Solaris, AIX, Digital Tru64, HP/UX, Linux) -
      -
    1. Save the appropriate UNIX file to disk. -
    2. Uncompress the gzip file by typing: -
          gunzip <filename>.tar.gz
      -
    3. Unpack the resulting tar file by typing: -
          tar xvof <filename>.tar
      -
    4. -
    - -
  • For Win32 systems (Windows NT and Windows 95) -
      -
    1. Save the file named dk41x32s.exe to disk. -
    2. Install the SDK by double-clicking the file in File Manager or Windows Explorer. -
    -
- -

Note that you should install this version of the LDAP SDK for C into a different directory than any other installed version of this software.

- - - -

-


-

NEW FEATURES AND ENHANCEMENTS

- -

This section of enhancements details the changes that were made to both versions 4.0 and 4.1 of the LDAP SDK for C.

- -

The following set of modifications were made to the LDAP SDK for C, version 4.1:

- -
    -
  • The LDAP SDK for C library names were changed to indicate the new version of the SDK. For example, the new Solaris version of the SDK library is libldapssl41.so. For information on how to build and link applications that uses this SDK, see the make files for the SDK examples. -

    - -

  • Various changes were made to the LDAP SDK for C to align it with the LDAPv3, described in RFC 2251. You can find this RFC at the following URL: - -
    -http://www.ietf.org/rfc/rfc2251.txt?number=2251 -
    - -
  • Non-blocking connect functionality has been added. For more information, please see -LDAP_X_OPT_CONNECT_TIMEOUT. -

    - -

  • A new extended I/O function callback scheme was added to the SDK. The ldap_x_ext_io_fns struct has been added to hold extended I/O function pointers. The ldap.h file outlines the new callbacks. -

    - -

  • Netscape Portable Runtime library (NSPR) support was added. The library, libldappr was added to provide a simple way for an application that is using NSPR to tie libldap into their environment. The ldappr.h file outlines the new interface. The library libldapr is statically linked in the version of the SDK that is available from both Mozilla and iPlanet's web sites. - -

    The new example nsprio.c shows how to use the new interfaces. Note that before you can compile the example, you will need to rework the makefile to include NSPR v3.5.1. You can checkout the NSPR 3.5.1 source from www.mozilla.org with the following CVS command: - -

    -cvs co -r NSPRPUB_RELEASE_3_5_1 mozilla/nsprpub
    -
    - -

    Make sure to set your CVSROOT environment variable as described on http://www.mozilla.org/cvs.html before running the cvs checkout command. For information on NSPR and its API, see http://www.mozilla.org/docs/refList/refNSPR/.

    - -

  • The ldap_search*() line of functions was modified as follows: -
      -
    • The ldap_search*() line of functions now return LDAP_PARAM_ERROR if a sizelimit smaller than -1 is passed to the function call.
    • - -
    • The ldap_search*() line of functions now set *result to NULL in all error situations.
    • -
    -

    - -

  • The ldapmodify utility was modified as follows: -
      -
    • The -A option was added, which causes the tool to display non-ASCII values in conjunction with the -v option.
    • - -
    • The -B and -q options were added, which provide support for the bulk import feature available in the iPlanet Directory Server, version 5.0.
    • - - -
    • Support for the version directive was added. -
    • Support for changetype with moddn was added. -
    • Improved the LDIF output to provide better support for file URLs. -
    -

    - -

  • The ldapsearch utility was modified as follows: -
      -
    • The -e option was added, which minimizes base-64 encoding of values.
      -By default, ldapsearch will always produce ASCII values and any non-ASCII values (such as UTF-8 characters) as base-64 encoded characters. The new -e option causes ldapsearch to return as much real data as is possible. With -e, only values or DNs that contain an '\r', an '\n', or that start with ':', ' ', or '<' are base-64 encoded. Note that the -e option may cause ldapsearch to produce LDIF that does not conform to RFC 2849, found at (ftp://ftp.isi.edu/in-notes/rfc2849.txt).
    • - -
    • The -U option was added, which operates in conjunction with the -t option (which causes ldapsearch to produce file URLs).
    • - -
    • To conform with RFC 2849, ldapsearch now outputs a "version: 1" line at the start of all LDIF. A new -1 (minus 1) option has been added to ldapsearch to suppress this line.
    • - -
    • The ldapsearch utility has been modified to support a zero length filter, represented as either "" or NULL. The zero-length filter "" is now an alias for "(objectclass=*)".
    • -
    -

    - -

  • The following new examples have been added to the SDK: -
      -
    • csearch -- search with ldap_memcache
    • -
    • ssnoauth -- search over SSL
    • -
    • ssearch -- search over SSL with cert based authentication
    • -
    • nsprio -- example usage of the extended IO callbacks
    • -
    • psearch -- uses persistent search
    • -
    • srvsort -- shows server-side sorting
    • -
    • ppolicy -- shows use of password policies
    • -
    • crtfilt -- demonstrates the use of ldap_create_filter()
    • -
    -

    -

- - - -

The following set of modifications were made to the LDAP SDK for C, version 4.0:

- -
    -
  • The ldap.h header file was modified as follows: -
      -
    • Support was added for discovery of API version information at run-time with the LDAP_OPT_API_INFO option and LDAPAPIInfo structure. - -
    • Support was added for the discovery of API extensions at run-time with the LDAP_OPT_API_FEATURE_INFO and LDAPAPIFeatureInfo structures. - -
    • The following macros were added to support the discovery of API version information at compile-time: LDAP_VENDOR_VERSION, LDAP_VENDOR_NAME, and LDAP_API_VERSION. - -
    • A set pf LDAP_API_FEATURE_* macros were added to support the discovery of API extensions at compile-time. - -
    • The LDAP_OPT_PRIVATE_EXTENSION_BASE macro was added. - -
    • The ldap_unbind_ext() function was added. - -
    • The ldap_mods_u name was added to the mod_vals union. - -
    • A number of function parameters were modified to be declared with const. -
    -

    - -

  • The ldap_get_option() function was modified as follows: -
      -
    • Support for the LDAP_OPT_HOST_NAME option was added. - -
    • The function now returns a duplicate copy of data when LDAP_OPT_SERVER_CONTROLS, LDAP_OPT_CLIENT_CONTROLS, or LDAP_OPT_ERROR_STRING are retrieved. - -
    • The LDAP_OPT_MATCHED_DN option was added. - -
    • Support for LDAP_OPT_ERROR_NUMBER and LDAP_OPT_ERROR_STRING were added. -
    -

    - -

  • The lber.h header file was modified as follows: -
      -
    • Support was added for the LBER_USE_DER option. - -
    • Several internal datatypes were changed to provide support for liblber. In the header file, see the definition for _LP64 for details. - -
    • The typedef BerValue was added to the berval struct, as follows: -
      -
      -typedef struct berval {
      -  unsigned long bv_len;
      -  char          *bv_val;
      -} BerValue;
      -
      -
      -
    -

    - -

  • Support was added for receiving unsolicited LDAPv3 notification messages. -

    - -

  • The header files disptmpl.h and srchpref.h are now shipped with the SDK. -

    - -

  • When using SSL client authentication with the command-line utilities, you are no longer required to provide the Cert DB password with the -W option on the command line. If you do not specify the -W option, the command-line utility will prompt you for your Cert DB password. - -

    Alternatively, you can provide a path to a PIN file that contains your Cert DB password. The format of a PIN file is the same as the PIN file that you would use for a 4.1 Netscape Directory Server. That is, if your Cert DB password is secret12, then you would enter the following line into your PIN file: - -

    -
    Internal (Software) Token:secret12
    -
    - -

    You would then point to this file using the -I option on the command line utility. For example:

    - -
    -
    -I /h/bjensen/.netscape/my_pin_file
    -
    - -

    The use of either the PIN file or interactive prompting for your password means that your Cert DB password is not exposed through process examination (that is, by using the ps command on Unix).

    -
- - -

-


-

LDAP_X_OPT_CONNECT_TIMEOUT

- -

The LDAP SDK for C, v4.1 provides a new option that allows you to control the TCP/IP timeout. Normally connection attempts will block for a period of time when the connection is for a host that is not reachable. LDAP_X_OPT_CONNECT_TIMEOUT allows you to control the amount of time for which a connection attempt will block in the event that the host is not reachable. You can tell the SDK to return immediately, return after an amount of time that you specify, or to block indefinitely.

- -

The timeout value is set on a per-session handle basis and you can control the default timeout that is used by all session handles. Use ldap_set_option() to set the timeout value. Use ldap_get_option() to return the timeout value that is set for the current session handle.

- -

Timeout Values

- -

To support this option, the following special values are now available:

-
    -
  • LDAP_X_IO_TIMEOUT_NO_WAIT -- The connection attempt returns immediately even if the server is reachable.

    - -
  • LDAP_X_IO_TIMEOUT_NO_TIMEOUT -- The connection attempt will block until the host responds, or for the duration of the platform's connection timeout. Depending on the platform, the default connection timeout can be anywhere from 20 seconds to 3 minutes or longer. This value is the default.

    -
- -

In addition, you can specify a timeout value in milliseconds.

- -

Setting the Timeout Value

-

The following code fragment sets the timeout value for the session handle to 10 seconds.

- -
-#include <stdio.h>
-#include "ldap.h"
-
-#define HOST "mydirectory.siroe.com"
-#define PORT 389
-
-...
-
-LDAP *ld;
-LDAPMessage *result;
-int rc, version;
-
-/* timeout is specified in milliseconds. 10000 = 10 seconds. */
-int timeout = 10000;
-
-...
-
-if ( ( ld = ldap_init( HOST, PORT ) ) == NULL ) {
-	perror( "ldap_init" );
-	return( -1 );
-}
-
-if ( ldap_set_option( ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout ) != LDAP_SUCCESS ) {
-	rc = ldap_get_lderrno( ld, NULL, NULL);
-	fprintf( stderr, "ldap_set_option: %s\n", ldap_err2string( rc ) );
-	ldap_unbind( ld );
-	return (rc);
-}
-
-...
-
- -

You can also control the default timeout for all LDAP session handles by setting the LDAP * value to NULL using ldap_set_option(). For example:

- -
-int timeout = LDAP_X_IO_TIMEOUT_WAIT;
-
-ldap_set_option( NULL, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout );
-
-/* the default timeout is now set for all new ldap connections that 
-    are created after this call to ldap_set_option. */
-
- -

Retrieving the Timeout Value

- -

The following code fragment retrieves the timeout value for the current session handle.

- -
-#include <stdio.h>
-#include "ldap.h"
-
-#define HOST "mydirectory.siroe.com"
-#define PORT 389
-
-...
-
-LDAP *ld;
-LDAPMessage *result;
-int rc, version, timeout;
-
-...
-
-if ( ( ld = ldap_init( HOST, PORT ) ) == NULL ) {
-  perror( "ldap_init" );
-  return( -1 );
-}
-
-if ( ldap_get_option( ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout ) != LDAP_SUCCESS ) {
-  rc = ldap_get_lderrno( ld, NULL, NULL);
-  fprintf( stderr, "ldap_set_option: %s\n", ldap_err2string( rc ) );
-  ldap_unbind( ld );
-  return (rc);
-}
-
-switch( timeout ) {
-  case LDAP_X_IO_TIMEOUT_NO_WAIT:
-    printf("The connection is set to not block\n");
-    break;
-
-  case LDAP_X_IO_TIMEOUT_NO_TIMEOUT:
-    printf("The connection is set to block indefinitely\n");
-    break;
-
-  default:
-    printf("The connection timeout is set to %d seconds", (timeout/1000) );
-    break;
-}
-
-...
-
- -

-


-

LDAP library/API Version Mismatch Error Messages

- -

This feature was added to version 4.0 of the LDAP SDK for C.

- -

Various macros and structures have been added to the SDK to allow for compile-time and run-time discovery of the API version. Their intended use is to allow you to ensure that you are compiling and running with the correct version of the LDAP SDK for C. These features are in line with the latest LDAP SDK for C API Internet Draft.

- -

As a result of these changes, the command line tools bundled with the LDAP SDK for C now check to ensure that they are running with the correct version of the library. If your library path variable (LD_LIBRARY_PATH on most Unix systems and the PATH variable on Windows NT) is set so that an old version of the LDAP SDK for C library is in use, then the command line tools can return one of the following error messages:

- -
ldapsearch: unable to retrieve LDAP library version information; 
-        this program requires an LDAP library that implements revision 
-        2003 or greater of the LDAP API. 
-
-ldapsearch: this program requires an LDAP library that implements revision 
-        2003 or greater of the LDAP API; running with revision 2002. 
-
-ldapsearch: this program requires Netscape Communications Corp.'s LDAP 
-        library version 3.20 or greater; running with version 3.00.
- -

By default, the tools will exit if they see a mismatch in versions. To override the version mismatch, you can use -0 option (zero, not 'o') with the tools, but results may vary.

- -

-


-

64-Bit Safe Changes

- -

This feature was added to version 4.0 of the LDAP SDK for C.

- -

Internal data types for liblber have been upgraded so that the data types are 64-bit safe. This is done in the following section of code in lber.h:

- -
-/*
- * Implementation-specific integer data types.  If living in an LP64
- * environment (where sizeof(long) is 64 bits), we use unsigned ints;
- * otherwise we use unsigned longs.  The goal is to always use 32-bit
- * quantities and to also be backwards compatible with previous SDK
- * versions which used unsigned longs.
- */
-
-#if defined(_LP64)
-       typedef unsigned int ber_len_t;
-       typedef          int ber_signed_len_t;
-       typedef unsigned int ber_tag_t;
-       typedef          int ber_int_t;
-#else
-       typedef unsigned long ber_len_t;
-       typedef          long ber_signed_len_t;
-       typedef unsigned long ber_tag_t;
-       typedef          long ber_int_t;
-#endif
-
- -

This change makes liblber consistent between environments where int data types are 32 bits and those where they are 64 bits. However, this change may cause some compilers, especially c++ compilers where strong type checking is enforced, to emit warnings or errors when you recompile old code.

- -

-


-

ldap_url_parse() with Space-Separated Lists of Hosts

- -

This feature was added to version 4.0 of the LDAP SDK for C.

- -

You can now pass ldap_url_parse() a string that uses the following format:

- -
ldap://host1:port1 host2:port2 host2:port3 ... hostn:portn/<basedn>
- -

Using this formatting, ldap_url_parse() will return results that are acceptable to ldap_init(). For example:

- -
-LDAP *ld;
-LDAPURLDesc *ludpp;
-int res;
-
-char *url = "ldap://phonebook.example.com:2389 directory.example.com:389/o=example.com";
-
-res = ldap_url_parse(url, &ludpp);
-ld = ldap_init(ludpp->host, ludpp->port);
-
- -

This input causes ldap_init() to try to connect to each host and port in the URL string until it finds a host with which it can connect.

- -

Note that ludpp->port is set to the port identified on the last host in the URL string. If ludpp->port is used as shown here, then the last port identified on the URL string becomes the default port for any hosts for which a port is not explicitly set. Using the example above, suppose the URL string contained the following:

- -
-ldap://phonebook.example.com phonebook2.example.com phonebook3.example.com:2389/o=example.com
-
- -

Here, ldap_init() would use port 2389 for all the hosts that it tries. If the last host in the string does not identify a port, then ludpp->port is set to zero (0). Setting the port to 0 tells ldap_init() to use the default port, which is 389 for ldap:// urls and 636 for ldaps:// urls.

- -

-


-

KNOWN -PROBLEMS

- -

The following is a known bug in this release of the LDAP SDK for C:

- -
    -
  • The IO Connect Timeout feature does not work on Windows NT with SSL. That is, the Windows NT connection always blocks for the Windows NT TCP/IP timeout value (approximately 50 seconds) in the event that the host is not reachable. This is because the PR_Connect() function in the Windows NT version of NSPR does not timeout, and so a timeout value cannot be set for it. This problem will be resolved in a future release when a fixed version of NSPR becomes available. (42900)
  • -
- -

-


-

MORE -INFORMATION

- -

Netscape and iPlanet provide binary releases of this SDK. However, note that this SDK is also available in source code form as part of the Mozilla.org open source project. Refer to the following site for more information on how you can get the source code and contribute to the further development of this SDK:

- -
http://www.mozilla.org/directory
- -

Product Documentation

- -

The LDAP SDK for C Programmer's Guide, version 4.1 is available in HTML and PDF formats. You can access this manual at the following site: http://docs.iplanet.com/docs/manuals/directory.html#SDK.

- -

Installation instructions and release notes for all iPlanet and Netscape servers are posted at http://docs.iplanet.com/docs/manuals/index.html.

- -

Reporting Problems with the LDAP SDK for C

- -

Please submit problem reports to the netscape.public.mozilla.directory newsgroup and/or mailing list. For information on locating this and other Mozilla newsgroups and mailing lists, please see http://www.mozilla.org/community.html -

- -

 

-
 
- -
- -
Copyright 2000 © Sun Microsystems, Inc. Some preexisting portions Copyright © 2000 Netscape Communications Corp. All Rights Reserved.
- - - diff --git a/mozilla/directory/c-sdk/ldap/docs/relnotes_5x.htm b/mozilla/directory/c-sdk/ldap/docs/relnotes_5x.htm deleted file mode 100644 index 79b3aa78093..00000000000 --- a/mozilla/directory/c-sdk/ldap/docs/relnotes_5x.htm +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - Release notes for LDAP C SDK 5.x - - - -

-Release Notes for LDAP C SDK 5.x

-Michael Hein mhein@sun.com -
  -

LDAP C SDK 5.0 (3/28/2001) -
LDAP C SDK 5.01 (06/13/2001) -
LDAP C SDK 5.02 (07/03/2001) -
LDAP C SDK 5.03 (08/02/2001) -
LDAP C SDK 5.04 -(08/15/2001) -
LDAP C SDK 5.05 -(10/04/2001) -
  -

LDAP C SDK 5.0 (3/28/2001) -(Available on www.iplanet.com) -

-Bugs/enhancements fixed in this release:

- -
    -
  • -Migrated to NSS 3.2 and NSPR 4.1
  • - -
  • -Build system rewritten to accommodate move to mozilla
  • - -
  • -530135 - simple filters are truncated
  • - -
  • -520548 - only print info if -vv is used
  • - -
  • -529868 - support "version 2" proxied auth control
  • - -
  • -Various bugs reported through Mozilla.org fixed in this release
  • -
- -


LDAP C SDK 5.01 (06/13/2001) -

-Bugs/enhancements fixed in this release:

- -
    -
  • -540490 - ber_scanf leaks memory on encoding errors
  • - -
  • -don't link libldap with NSPR libraries
  • - -
  • -543857 - broken command line utilities because of ber_scanf() changes
  • - -
  • -394822 - command line tools should support password policy
  • - -
  • -539148 - Unix ldapmodify cannot parse NT replica dump
  • - -
  • -526153 - -Z option is not checked in case of SSL client auth
  • - -
  • -Added files in coreconf as needed for Linux 7.1 build
  • - -
  • -(added to tip of ldapcsdk_branch_50 branch)
  • - -
  • -Took out libdbm module as we are no longer dependent on  it (NSS includes -it) as we don't build static ldap library versions anymore
  • - -
  • -546204 - HP-UX command line utilities not working
  • - -
  • -added SunOS5.8_i86pc.mk, SunOS5.9.mk, SunOS5.9_i86pc.mk, and updated SunOS5.mk -for Solaris x86 support
  • - -
  • -misc changes for i86 support
  • -
- -


LDAP C SDK 5.02 (07/03/2001) -

-Bugs/enhancements fixed in this release:

-  -
    -
  • -header file reorg.  The ldap.h header file has now been split up into -4 separate files (ldap-standard.h, ldap-extension.h, ldap-deprecated.h, -and ldap-to-be-deprecated.h) and a new file, ldap-platform.h has been added -to the distribution.  As per LDAP C API draft, user is only required -to ldap.h and the files list above are included automatically.
  • - -
  • -ltest builds once again (Solaris only).
  • - -
  • -Use IPv6 (if available) when NSPR I/O is used via libprldap.
  • - -
  • -Change the cmd line utilities to always use NSPR I/O via libprldap.
  • - -
  • -Add support for IPv6 addresses (in square brackets) to the ldap_init() -call and libldap's LDAP URL parser.
  • - -
  • -Export ldap-platform.h and ldappr.h (shipped as public headers).
  • - -
  • -Add top-level COMPS_FROM_OBJDIR=1 gmake option for use in the non-coreconf -case.
  • - -
  • -Remove outdated build instructions.
  • - -
  • -Add support for building examples within a source tree.
  • - -
  • -nsprio now takes an optional hostport argument.
  • - -
  • -add check for ld_mutex != NULL in LDAP_MUTEX_LOCK/UNLOCK macros This fixes -a crash that can occur when using libprldap.
  • - -
  • -73830 - Calling ldap_init() with a NULL hostname results in core.  -The crash occurred because the host pointer ("localhost") was being freed -twice. Now we ensure that the host is set to NULL by ldap_x_hostlist_next() -in the special case when NULL was passed into ldap_x_hostlist_first(), -which is more consistent to the caller and eliminates the double free problem.
  • - -
  • -nsprio build fixes
  • - -
  • -build static libldap50.a library and include in distribution (Note this -is the ldap library only.  We do not ship the ssl enable library as -a static library.  When you use this library you will have to link -with the static liblber library as well)
  • - -
  • -Cannot use the __declspec (thread) semantics for thread local storage if -one want to use LoadLibrary to dynamically load DLL at runtime.  This -issue was found on NT only and cause PerLdap to fail.
  • -
- -


LDAP C SDK 5.03 (08/02/2001) -

-Bugs/enhancements fixed in this release:

- -
    -
  • -345002 - Implement persistent search (345002)
  • - -
  • -550410 - "-s" scope implementation
  • - -
  • -550409 - fix for false success report in verbose mode
  • - -
  • -Include liblber functions in Linux libldap build
  • - -
  • -BER speedup changes (via writev)
  • - -
  • -Update components to NSS 3.3,  NSPR 4.12, and SVRCORE 3.3
  • - -
  • -553151 - Abnormal behavior of get_get_next_buffer() under extreme conditions
  • - -
  • -package up additional header files for internal product builds
  • -
- -
  -

LDAP C SDK -5.04 (08/15/2001) -

-Bugs/enhancements fixed in this release:

- -
    -
  • -555890 - ldapsearch is broken on NT/Linux/OSF
  • - -
  • -added the new packaging script for www.iplanet.com
  • -
- -


-
LDAP C SDK 5.05 (10/04/2001) (This release is targeted -for www.iplanet.com) -

-Bugs/enhancements fixed in this release:

- -
    -
  • -new option to command line utilities to alllow for -w - to prompt for the -simple bind password from the command line
  • - -
  • -new option to command line utilities to allow for -j to read the simple -bind password from a specified file name
  • - -
  • -misc. ber changes to io.c
  • - -
  • -take out -lC in tools/clients/Makefile.client since we are now picking -up clean forte6 components
  • - -
  • -558135 - smart referrals with three contiguous slashes don't work
  • - -
  • -allow for the setting of controls via command line interface
  • - -
  • -bump to forte6.2 component for Solaris 5.8 (This change only applies to -the NSS component)
  • - -
  • -559670 - use of select() cause problems with > 1024 connections in iDS -chaining code
  • - -
  • -support sun4m architecture
  • -
- - - diff --git a/mozilla/directory/c-sdk/ldap/examples/Makefile b/mozilla/directory/c-sdk/ldap/examples/Makefile deleted file mode 100644 index a39fcbc28ee..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/Makefile +++ /dev/null @@ -1,282 +0,0 @@ -# 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): -# -# -# UNIX Makefile for Directory SDK examples -# -# SSL examples are not built by default. Use 'make ssl' to build them. -# NSPR examples are not built by default. Use 'make nspr' to build them. -# - -############################################################################### -# If you are not building on Solaris, you will need to comment out the -# Solaris section and uncomment the appropriate section for your platform. -# -# Chances are you will need to do a little bit of work in order to get the -# examples to compile. If you are not compiling on Solaris, use the -# Solaris builds as a model for the libraries you need etc. Chances are -# they are the most up-to-date -# - -# For Solaris (32 bit) -EXTRACFLAGS= -EXTRALDFLAGS=-lsocket -lnsl -EXTRANSPRLDFLAGS=-mt -SLDAPLIB=ldap50 -lssldap50 -lssl3 -lnss3 -LDAPLIB=ldap50 -LDAPPRLIB=prldap50 -NSPRLIB=nspr4 -CC=cc - -# For Solaris (64 bit) -#EXTRACFLAGS= -#EXTRALDFLAGS=-lsocket -lnsl -#EXTRANSPRLDFLAGS=-mt -#SLDAPLIB=ldap50 -lssldap50 -lssl3 -lnss3 -#LDAPLIB=ldap50 -#LDAPPRLIB=prldap50 -#NSPRLIB=nspr4 -#CC=cc -xarch=v9 - -# For HP/UX (32 bit) -#EXTRACFLAGS=-Dhpux -D_HPUX_SOURCE -D_REENTRANT -Aa -#EXTRALDFLAGS=-Wl,+s+b -#SLDAPLIB=ldap50 -lssldap50 -lssl3 -lnss3 -#LDAPLIB=ldap50 -#LDAPPRLIB=prldap50 -#NSPRLIB=nspr4 -#CC=cc - -# For HP/UX (64 bit) -#EXTRACFLAGS=-DHPUX11 -DIS_64 +e +DA2.0W +DChpux +DS2.0 -#EXTRACFLAGS+=-D_LARGEFILE64_SOURCE -D_PR_HAVE_OFF64_T -#EXTRALDFLAGS=-lpthread +DA2.0W +DS2.0 -#SLDAPLIB=ldap50 -lssldap50 -lssl3 -lnss3 -#LDAPLIB=ldap50 -#LDAPPRLIB=prldap50 -#NSPRLIB=nspr4 -#CC=/opt/ansic/bin/cc - - -# For IRIX -#EXTRACFLAGS= -#EXTRALDFLAGS= -#SLDAPLIB=ldap50 -lssldap50 -lssl3 -lnss3 -#LDAPLIB=ldap50 -#LDAPPRLIB=prldap50 -#NSPRLIB=nspr4 -#CC=cc - -# For AIX -#EXTRACFLAGS= -#EXTRALDFLAGS=-brtl -#SLDAPLIB=ldap50 -lssldap50 -lssl3 -lnss3 -#LDAPLIB=ldap50 -#LDAPPRLIB=prldap50 -#NSPRLIB=nspr4 -#CC=cc - -# For Digital UNIX 4.0 -#EXTRACFLAGS= -#EXTRALDFLAGS=-taso -rpath ../lib -#SLDAPLIB=ldap50 -lssldap50 -lssl3 -lnss3 -#LDAPLIB=ldap50 -#LDAPPRLIB=prldap50 -#NSPRLIB=nspr4 -#CC=cc - -# For Linux 2.2 -#EXTRACFLAGS= -#EXTRALDFLAGS=-lpthread -#LDAPLIB=ldapssl50 -#LDAPLIB=ldap50 -#LDAPPRLIB=prldap50 -#NSPRLIB=nspr4 -#CC=gcc - -############################################################################### -# You should not need to change anything below here.... - -INTERNAL_LIBLDAP_HEADERS=$(wildcard ../libraries/libldap/*.h) -ifeq (,$(findstring h, $(INTERNAL_LIBLDAP_HEADERS))) -IN_SRC_TREE=0 -else -IN_SRC_TREE=1 -endif - -ifneq ($(IN_SRC_TREE),1) -# we are not in the C SDK source tree... so must be in a binary distribution -INCDIR=../include -LIBDIR=../lib -NSPRINCDIR=../include -NSPRLIBDIR=../lib - -else -# we are in the C SDK source tree... paths to headers and libs are different -NS_DEPTH = ../../.. -LDAP_SRC = .. -NSCP_DISTDIR = ../../../../dist -NSPR_TREE = ../.. -MOD_DEPTH = ../.. - -ifeq ($(HAVE_CCONF), 1) -COMPS_FROM_OBJDIR=1 -endif - -include $(NSPR_TREE)/config/config.mk - -ifeq ($(COMPS_FROM_OBJDIR),1) -NSPR_DISTDIR=$(NSCP_DISTDIR)/$(OBJDIR_NAME) -else -NSPR_DISTDIR=$(NSCP_DISTDIR) -endif - -INCDIR=$(NSCP_DISTDIR)/public/ldap -LIBDIR=$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -NSPRINCDIR=$(NSPR_DISTDIR)/include -NSPRLIBDIR=$(NSPR_DISTDIR)/lib -endif - -LIBS=-L$(LIBDIR) -l$(LDAPLIB) $(EXTRALDFLAGS) -NSPRLIBS=$(EXTRANSPRLDFLAGS) -L$(NSPRLIBDIR) -l$(NSPRLIB) -l$(LDAPPRLIB) -SLIBS=-L$(LIBDIR) $(NSPRLIBS) -l$(SLDAPLIB) $(EXTRALDFLAGS) -OPTFLAGS=-g -CFLAGS=$(OPTFLAGS) -I$(INCDIR) -I$(NSPRINCDIR) $(EXTRACFLAGS) -NSPRCFLAGS=-I$(NSPRINCDIR) - -PROGS=search asearch csearch psearch rdentry getattrs srvrsort modattrs add del compare modrdn ppolicy getfilt crtfilt - -SSLPROGS=ssnoauth ssearch - -NSPRPROGS=nsprio - -ALLPROGS= $(PROGS) $(SSLPROGS) $(NSPRPROGS) - -standard: $(PROGS) - -ssl: $(SSLPROGS) - -nspr: $(NSPRPROGS) - -all: $(ALLPROGS) - -purify: $(PROGS) - make clean; make CC="purify $(CC)" - -search: search.o - $(CC) -o search search.o $(LIBS) - -search.o: examples.h - -csearch: csearch.o - $(CC) -o csearch csearch.o $(LIBS) - -csearch.o: examples.h - -psearch: psearch.o - $(CC) -o psearch psearch.o $(LIBS) - -psearch.o: examples.h - -ssearch: ssearch.o - $(CC) -o ssearch ssearch.o $(SLIBS) - -ssearch.o: examples.h - -ssnoauth: ssnoauth.o - $(CC) -o ssnoauth ssnoauth.o $(SLIBS) - -ssnoauth.o: examples.h - -rdentry: rdentry.o - $(CC) -o rdentry rdentry.o $(LIBS) - -rdentry.o: examples.h - -getattrs: getattrs.o - $(CC) -o getattrs getattrs.o $(LIBS) - -getattrs.o: examples.h - -srvrsort: srvrsort.o - $(CC) -o srvrsort srvrsort.o $(LIBS) - -srvrsort.o: examples.h - -modattrs: modattrs.o - $(CC) -o modattrs modattrs.o $(LIBS) - -modattrs.o: examples.h - -asearch: asearch.o - $(CC) -o asearch asearch.o $(LIBS) - -asearch.o: examples.h - -add: add.o - $(CC) -o add add.o $(LIBS) - -add.o: examples.h - -del: del.o - $(CC) -o del del.o $(LIBS) - -del.o: examples.h - -compare: compare.o - $(CC) -o compare compare.o $(LIBS) - -compare.o: examples.h - -modrdn: modrdn.o - $(CC) -o modrdn modrdn.o $(LIBS) - -modrdn.o: examples.h - -ppolicy: ppolicy.o - $(CC) -o ppolicy ppolicy.o $(LIBS) - -ppolicy.o: examples.h - -getfilt: getfilt.o - $(CC) -o getfilt getfilt.o $(LIBS) - -getfilt.o: examples.h - -crtfilt: crtfilt.o - $(CC) -o crtfilt crtfilt.o $(LIBS) - -crtfilt.o: examples.h - -nsprio: nsprio.o - $(CC) -o nsprio nsprio.o $(LIBS) $(NSPRLIBS) - -nsprio.o: examples.h - -runall: $(PROGS) - @for i in $(PROGS); do \ - echo "-------------------------------------------------"; \ - echo "Executing $$i example..."; \ - ./$$i; \ - echo "$$i example done."; \ - done - -clean: - /bin/rm -f $(ALLPROGS) *.o a.out core diff --git a/mozilla/directory/c-sdk/ldap/examples/README b/mozilla/directory/c-sdk/ldap/examples/README deleted file mode 100644 index c4b42f3a1f9..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/README +++ /dev/null @@ -1,132 +0,0 @@ - Directory SDK Examples - ---------------------- - -This directory contains some sample LDAP code to help you understand -how to use the Directory SDK. These examples are designed to work against -the sample data contained in the Netscape Directory Server 4.x -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. - -------------------- -Synchronous samples -------------------- -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. - - - ---------------------- -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 Netscape Directory Server -3.0 and later. - - - -------------------- -Additional examples -------------------- -The Macintosh or Windows versions of the Directory SDK also include -sample project files. A sample CodeWarrior project file is included -in the macintosh directory. - -Sample Visual C++ makefiles for a Windows application (winldap) are -included in the windows directory. The Win32 version of the makefile -is named winldap.mak; the Win16 version of the makefile is named LDAP16.MAK. - -If you want to fix up the additional examples and recontribute them back -to mozilla they will gladly be accepted :-) - diff --git a/mozilla/directory/c-sdk/ldap/examples/add.c b/mozilla/directory/c-sdk/ldap/examples/add.c deleted file mode 100644 index 98093d7447d..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/add.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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++; -} diff --git a/mozilla/directory/c-sdk/ldap/examples/asearch.c b/mozilla/directory/c-sdk/ldap/examples/asearch.c deleted file mode 100644 index 2bf939fb7f9..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/asearch.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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++; -} diff --git a/mozilla/directory/c-sdk/ldap/examples/compare.c b/mozilla/directory/c-sdk/ldap/examples/compare.c deleted file mode 100644 index 4c5da957436..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/compare.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/crtfilt.c b/mozilla/directory/c-sdk/ldap/examples/crtfilt.c deleted file mode 100644 index 4c589e5e4e0..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/crtfilt.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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 ); - } -} diff --git a/mozilla/directory/c-sdk/ldap/examples/csearch.c b/mozilla/directory/c-sdk/ldap/examples/csearch.c deleted file mode 100644 index 8dae288e112..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/csearch.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/del.c b/mozilla/directory/c-sdk/ldap/examples/del.c deleted file mode 100644 index 8c231719218..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/del.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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++; -} diff --git a/mozilla/directory/c-sdk/ldap/examples/examples.h b/mozilla/directory/c-sdk/ldap/examples/examples.h deleted file mode 100644 index d5f4f20cbdf..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/examples.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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): - */ - -/* - * Common definitions for ldap example programs. - * - */ - -#include -#include -#include -#include - -#include - -/* - * Host name of LDAP server - */ -#define MY_HOST "localhost" - -/* - * Port number where LDAP server is running - */ -#define MY_PORT LDAP_PORT - -/* - * Port number where LDAPS server is running - */ -#define MY_SSL_PORT LDAPS_PORT - -/* - * DN of directory manager entry. This entry should have write access to - * the entire directory. - */ -#define MGR_DN "cn=Directory Manager" - -/* - * Password for manager DN. - */ -#define MGR_PW "secret99" - -/* - * Subtree to search - */ -#define MY_SEARCHBASE "dc=example,dc=com" - -/* - * Place where people entries are stored - */ -#define PEOPLE_BASE "ou=People, " MY_SEARCHBASE - -/* - * DN of a user entry. This entry does not need any special access to the - * directory (it is not used to perform modifies, for example). - */ -#define USER_DN "uid=scarter, " PEOPLE_BASE - -/* - * Password of the user entry. - */ -#define USER_PW "sprain" - -/* - * Filter to use when searching. This one searches for all entries with the - * surname (last name) of "Jensen". - */ -#define MY_FILTER "(sn=Jensen)" - -/* - * Entry to retrieve - */ -#define ENTRYDN "uid=bjensen, " PEOPLE_BASE - -/* - * Password for Babs' entry - */ -#define ENTRYPW "hifalutin" - -/* - * Name of file containing filters - */ -#define MY_FILTERFILE "xmplflt.conf" - -/* - * Tag to use when retrieveing filters - */ -#define MY_FILTERTAG "ldap-example" - diff --git a/mozilla/directory/c-sdk/ldap/examples/getattrs.c b/mozilla/directory/c-sdk/ldap/examples/getattrs.c deleted file mode 100644 index 77f3328d5bc..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/getattrs.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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): - */ - -/* - * Retrieve several attributes of a particular entry. - */ - -#include "examples.h" - - -int -main( int argc, char **argv ) -{ - LDAP *ld; - LDAPMessage *result, *e; - char **vals, *attrs[ 5 ]; - int i; - - /* get a handle to an LDAP connection */ - if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) { - perror( "ldap_init" ); - return( 1 ); - } - - attrs[ 0 ] = "cn"; /* Get canonical name(s) (full name) */ - attrs[ 1 ] = "sn"; /* Get surname(s) (last name) */ - attrs[ 2 ] = "mail"; /* Get email address(es) */ - attrs[ 3 ] = "telephonenumber"; /* Get telephone number(s) */ - attrs[ 4 ] = NULL; - - if ( ldap_search_s( ld, ENTRYDN, LDAP_SCOPE_BASE, - "(objectclass=*)", attrs, 0, &result ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_search_s" ); - return( 1 ); - } - - /* print it out */ - if (( e = ldap_first_entry( ld, result )) != NULL ) { - if (( vals = ldap_get_values( ld, e, "cn" )) != NULL ) { - printf( "Full name:\n" ); - for ( i = 0; vals[i] != NULL; i++ ) { - printf( "\t%s\n", vals[i] ); - } - ldap_value_free( vals ); - } - if (( vals = ldap_get_values( ld, e, "sn" )) != NULL ) { - printf( "Last name (surname):\n" ); - for ( i = 0; vals[i] != NULL; i++ ) { - printf( "\t%s\n", vals[i] ); - } - ldap_value_free( vals ); - } - if (( vals = ldap_get_values( ld, e, "mail" )) != NULL ) { - printf( "Email address:\n" ); - for ( i = 0; vals[i] != NULL; i++ ) { - printf( "\t%s\n", vals[i] ); - } - ldap_value_free( vals ); - } - if (( vals = ldap_get_values( ld, e, "telephonenumber" )) != NULL ) { - printf( "Telephone number:\n" ); - for ( i = 0; vals[i] != NULL; i++ ) { - printf( "\t%s\n", vals[i] ); - } - ldap_value_free( vals ); - } - } - ldap_msgfree( result ); - ldap_unbind( ld ); - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/getfilt.c b/mozilla/directory/c-sdk/ldap/examples/getfilt.c deleted file mode 100644 index 04176c19286..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/getfilt.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 for a user-provided string, using a filter configuration file. - * The filter config file controls which type of search is done, based - * on what the user types. - */ - -#include "examples.h" - -int -main( int argc, char **argv ) -{ - LDAP *ld; - LDAPMessage *result, *e; - BerElement *ber; - char *a, *dn; - char **vals; - int i; - LDAPFiltDesc *ldfp; - LDAPFiltInfo *ldfi; - char buf[ 80 ]; - int found; - - /* Open the filter config file */ - if (( ldfp = ldap_init_getfilter( MY_FILTERFILE )) == NULL ) { - fprintf( stderr, "Can't open filter file \"%s\"\n", MY_FILTERFILE ); - return( 1 ); - } - /* Read a string to search for */ - printf( "Enter a string to search for: " ); - gets( buf ); - if ( strlen( buf ) == 0 ) { - fprintf( stderr, "usage: %s search-string\n", argv[ 0 ]); - return( 1 ); - } - /* get a handle to an LDAP connection */ - printf( "Initializing LDAP library... " ); fflush( stdout ); - if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) { - perror( "ldap_init" ); - return( 1 ); - } - printf( "done.\n" ); fflush( stdout ); - /* authenticate to the directory as nobody */ - printf( "Binding to the directory... " ); fflush( stdout ); - if ( ldap_simple_bind_s( ld, NULL, NULL ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_simple_bind_s" ); - return( 1 ); - } - printf( "done.\n" ); fflush( stdout ); - /* search for what the user typed */ - found = 0; - for ( ldfi = ldap_getfirstfilter( ldfp, MY_FILTERTAG, buf ); - ldfi != NULL; ldfi = ldap_getnextfilter( ldfp )) { - printf( "Filter: \"%s\"... ", ldfi->lfi_filter ); - fflush( stdout ); - if ( ldap_search_s( ld, MY_SEARCHBASE, ldfi->lfi_scope, - ldfi->lfi_filter, NULL, 0, &result ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_search_s" ); - return( 1 ); - } else { - found = ldap_count_entries( ld, result ); - printf( "done. Entries found: %d\n", found ); fflush( stdout ); - if ( found > 0 ) { - /* Matching entries found - break */ - break; - } else { - ldap_msgfree( result ); - } - } - } - if ( found == 0 ) { - printf( "No matching entries found\n" ); - } else { - printf( "Found %d %s match%s for \"%s\"\n\n", found, - ldfi->lfi_desc, found == 1 ? "" : "es", buf ); - /* 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 ); - } - ldap_getfilter_free( ldfp ); - ldap_unbind( ld ); - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/macintosh/asearch (2i).68k.u b/mozilla/directory/c-sdk/ldap/examples/macintosh/asearch (2i).68k.u deleted file mode 100755 index 978b8dc4cb5..00000000000 Binary files a/mozilla/directory/c-sdk/ldap/examples/macintosh/asearch (2i).68k.u and /dev/null differ diff --git a/mozilla/directory/c-sdk/ldap/examples/macintosh/asearch (4i).68k.u b/mozilla/directory/c-sdk/ldap/examples/macintosh/asearch (4i).68k.u deleted file mode 100755 index dfc92485aea..00000000000 Binary files a/mozilla/directory/c-sdk/ldap/examples/macintosh/asearch (4i).68k.u and /dev/null differ diff --git a/mozilla/directory/c-sdk/ldap/examples/macintosh/asearch PPC.u b/mozilla/directory/c-sdk/ldap/examples/macintosh/asearch PPC.u deleted file mode 100755 index 44d2b915bbd..00000000000 Binary files a/mozilla/directory/c-sdk/ldap/examples/macintosh/asearch PPC.u and /dev/null differ diff --git a/mozilla/directory/c-sdk/ldap/examples/modattrs.c b/mozilla/directory/c-sdk/ldap/examples/modattrs.c deleted file mode 100644 index be59c957e44..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/modattrs.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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): - */ - -/* - * Modify an entry: - * - replace any existing "mail" attribute values with "babs@example.com" - * - add a new value to the "description" attribute - */ - -#include "examples.h" - -int -main( int argc, char **argv ) -{ - LDAP *ld; - LDAPMod mod0, mod1, *mods[ 3 ]; - char *vals0[ 2 ], *vals1[ 2 ], buf[ 128 ]; - time_t now; - - /* get an LDAP session handle and authenticate */ - if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) { - perror( "ldap_init" ); - return( 1 ); - } - if ( ldap_simple_bind_s( ld, MGR_DN, MGR_PW ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_simple_bind_s" ); - return( 1 ); - } - - /* construct the list of modifications to make */ - mod0.mod_op = LDAP_MOD_REPLACE; - mod0.mod_type = "mail"; - vals0[0] = "babs@example.com"; - vals0[1] = NULL; - mod0.mod_values = vals0; - - mod1.mod_op = LDAP_MOD_ADD; - mod1.mod_type = "description"; - time( &now ); - sprintf( buf, "This entry was modified with the modattrs program on %s", - ctime( &now )); - /* Get rid of \n which ctime put on the end of the time string */ - if ( buf[ strlen( buf ) - 1 ] == '\n' ) { - buf[ strlen( buf ) - 1 ] = '\0'; - } - vals1[ 0 ] = buf; - vals1[ 1 ] = NULL; - mod1.mod_values = vals1; - - mods[ 0 ] = &mod0; - mods[ 1 ] = &mod1; - mods[ 2 ] = NULL; - - /* make the change and clean up after ourselves */ - if ( ldap_modify_s( ld, ENTRYDN, mods ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_modify_s" ); - return( 1 ); - } - ldap_unbind( ld ); - printf( "modification was successful\n" ); - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/modrdn.c b/mozilla/directory/c-sdk/ldap/examples/modrdn.c deleted file mode 100644 index 98559ef130f..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/modrdn.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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): - */ - -/* - * Modify the RDN (relative distinguished name) of an entry. In this - * example, we change the dn "cn=Jacques Smith,ou=People,dc=example,dc=com - * to "cn=Jacques M Smith,ou=People,dc=example,dc=com. - * - * Since it is an error to either (1) attempt to modrdn an entry which - * does not exist, or (2) modrdn an entry where the destination name - * already exists, we take some steps, for this example, to make sure - * we'll succeed. We (1) add "cn=Jacques Smith" (if the entry exists, - * we just ignore the error, and (2) delete "cn=Jacques M Smith" (if the - * entry doesn't exist, we ignore the error). - * - * We pass 0 for the "deleteoldrdn" argument to ldap_modrdn2_s(). This - * means that after we change the RDN, the server will put the value - * "Jacques Smith" into the cn attribute of the new entry, in addition to - * "Jacques M Smith". - */ - -#include "examples.h" - -#define NMODS 4 - -unsigned long global_counter = 0; - -static void free_mods( LDAPMod **mods ); - -int -main( int argc, char **argv ) -{ - LDAP *ld; - char *dn, *ndn, *nrdn; - int i; - int rc; - LDAPMod **mods; - - /* Values we'll use in creating the entry */ - char *objectclass_values[] = { "top", "person", "organizationalPerson", - "inetOrgPerson", NULL }; - char *cn_values[] = { "Jacques Smith", NULL }; - char *sn_values[] = { "Smith", NULL }; - char *givenname_values[] = { "Jacques", NULL }; - - /* Specify the DN we're adding */ - dn = "cn=Jacques Smith, " PEOPLE_BASE; /* see examples.h */ - /* the destination DN */ - ndn = "cn=Jacques M Smith, " PEOPLE_BASE; /* see examples.h */ - /* the new RDN */ - nrdn = "cn=Jacques M Smith"; - - /* 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 ); - } - - if (( mods = ( LDAPMod ** ) malloc(( NMODS + 1 ) * sizeof( LDAPMod *))) - == NULL ) { - fprintf( stderr, "Cannot allocate memory for mods array\n" ); - return( 1 ); - } - /* Construct the array of values to add */ - for ( i = 0; i < NMODS; i++ ) { - if (( mods[ i ] = ( LDAPMod * ) malloc( sizeof( LDAPMod ))) == NULL ) { - fprintf( stderr, "Cannot allocate memory for mods element\n" ); - return( 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 ] = NULL; - - - /* Add the entry */ - if (( rc = ldap_add_s( ld, dn, mods )) != LDAP_SUCCESS ) { - /* If entry exists already, fine. Ignore this error. */ - if ( rc == LDAP_ALREADY_EXISTS ) { - printf( "Entry \"%s is already in the directory.\n", dn ); - } else { - ldap_perror( ld, "ldap_add_s" ); - free_mods( mods ); - return( 1 ); - } - } else { - printf( "Added entry \"%s\".\n", dn ); - } - free_mods( mods ); - - /* Delete the destination entry, for this example */ - if (( rc = ldap_delete_s( ld, ndn )) != LDAP_SUCCESS ) { - /* If entry does not exist, fine. Ignore this error. */ - if ( rc == LDAP_NO_SUCH_OBJECT ) { - printf( "Entry \"%s\" is not in the directory. " - "No need to delete.\n", ndn ); - } else { - ldap_perror( ld, "ldap_delete_s" ); - return( 1 ); - } - } else { - printf( "Deleted entry \"%s\".\n", ndn ); - } - - /* Do the modrdn operation */ - if ( ldap_modrdn2_s( ld, dn, nrdn, 0 ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_modrdn2_s" ); - return( 1 ); - } - - printf( "The modrdn operation was successful. Entry\n" - "\"%s\" has been changed to\n" - "\"%s\".\n", dn, ndn ); - - ldap_unbind( ld ); - 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 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/nsprio.c b/mozilla/directory/c-sdk/ldap/examples/nsprio.c deleted file mode 100644 index ccc209f1e04..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/nsprio.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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): - */ - -/* - * A version of asearch.c that uses NSPR (Netscape Portable Runtime) I/O. - * - * 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" -#include -#include - -static void do_other_work(); - -unsigned long global_counter = 0; - -int -main( int argc, char **argv ) -{ - LDAP *ld; - LDAPMessage *result, *e; - BerElement *ber; - char *host, *a, *dn; - char **vals; - int i; - int rc; - int finished; - int msgid; - int num_entries = 0; - struct timeval zerotime; - - if ( argc > 1 ) { - host = argv[1]; - } else { - host = MY_HOST; - } - - zerotime.tv_sec = zerotime.tv_usec = 0L; - - if ( prldap_install_routines( NULL, 1 /* shared */ ) != LDAP_SUCCESS ) { - ldap_perror( NULL, "prldap_install_routines" ); - return( 1 ); - } - - /* get a handle to an LDAP connection */ - if ( (ld = ldap_init( host, MY_PORT )) == NULL ) { - perror( host ); - 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++; -} diff --git a/mozilla/directory/c-sdk/ldap/examples/ppolicy.c b/mozilla/directory/c-sdk/ldap/examples/ppolicy.c deleted file mode 100644 index ee2d41a8cf9..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/ppolicy.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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): - */ - -/* - * Attempt to bind to the directory, and report back any password - * expiration information received. - */ -#include "examples.h" - -#define NO_PASSWORD_CONTROLS 0 -#define PASSWORD_EXPIRED -1 - -static void doUsage() { - printf( "Usage: ppolicy HOST PORT DN PASSWORD\n" ); -} - -static int -check_controls( LDAPControl **ctrls ) { - int i; - char buf[256]; - int status = NO_PASSWORD_CONTROLS; - - if ( ctrls == NULL ) { - return NO_PASSWORD_CONTROLS; - } - - for ( i = 0; ctrls[ i ] != NULL; ++i ) { - memcpy( buf, ctrls[ i ]->ldctl_value.bv_val, - ctrls[ i ]->ldctl_value.bv_len ); - buf[ctrls[ i ]->ldctl_value.bv_len] = 0; - if( !strcmp( LDAP_CONTROL_PWEXPIRED, ctrls[ i ]->ldctl_oid ) ) { - status = PASSWORD_EXPIRED; - } else if ( !strcmp( LDAP_CONTROL_PWEXPIRING, - ctrls[ i ]->ldctl_oid ) ) { - status = atoi( buf ); - } - } - - return status; -} - -static void -process_other_errors( int lderr ) { - fprintf( stderr, "ldap_parse_result: %s", - ldap_err2string( lderr )); - if ( LDAP_CONNECT_ERROR == lderr ) { - perror( " - " ); - } else { - fputc( '\n', stderr ); - } -} - -static void -process_other_messages( char *errmsg ) { - if ( errmsg != NULL ) { - if ( *errmsg != '\0' ) { - fprintf( stderr, "Additional info: %s\n", - errmsg ); - } - ldap_memfree( errmsg ); - } -} - - -int -main( int argc, char **argv ) { - LDAP *ld; - char *dn; - char *password; - char *host; - int port; - int rc = 0; - int version = LDAP_VERSION3; - int msgid; - LDAPMessage *result; - LDAPControl **ctrls; - int lderr; - int password_status = 0; - char *matcheddn, *errmsg, **refs; - - if ( argc == 1 ) { - host = MY_HOST; - port = MY_PORT; - dn = USER_DN; - password = USER_PW; - } else if ( argc == 5 ) { - host = argv[1]; - port = atoi( argv[2] ); - dn = argv[3]; - password = argv[4]; - } else { - doUsage(); - return( 1 ); - } - - /* get a handle to an LDAP connection */ - if ( (ld = ldap_init( host, port )) == NULL ) { - perror( "ldap_init" ); - return( 1 ); - } - - if (ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) != 0) { - ldap_perror( ld, "ldap_set_option"); - return ( 1 ); - } - - /* authenticate to the directory */ -#ifdef SYNCHRONOUS_BIND - /* Synchronous bind */ - ldap_simple_bind_s( ld, dn, password ); - lderr = ldap_get_lderrno( ld, NULL, &errmsg ); - if ( LDAP_SUCCESS == lderr ) { - printf( "Authentication successful\n" ); - } else { - rc = -1; - if ( LDAP_INVALID_CREDENTIALS == lderr ) { - fprintf( stderr, "Invalid credentials\n" ); - } else { - process_other_errors( lderr ); - } - if ( errmsg != NULL ) { - if ( strstr( errmsg, "password expired" ) != NULL ) { - fprintf( stderr, "Password expired\n" ); - } else { - fprintf( stderr, "Additional info: %s\n", - errmsg ); - } - ldap_memfree( errmsg ); - } - } - /* You can't get the controls with a synchronous bind, so we - can't report if the password is about to expire */ - -#else - /* Asynchronous bind */ - if ( msgid = ldap_simple_bind( ld, dn, password ) < 0 ) { - ldap_perror( ld, "ldap_simple_bind" ); - rc = -1; - } else { - rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ONE, - (struct timeval *)NULL, &result ); - if ( rc == LDAP_RES_BIND ) { - if ( ldap_parse_result( ld, result, &lderr, &matcheddn, &errmsg, - &refs, &ctrls, 0 ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_parse_result" ); - } else { - if ( LDAP_SUCCESS == lderr ) { - printf( "Authentication successful\n" ); - } else { - if ( LDAP_INVALID_CREDENTIALS == lderr ) { - fprintf( stderr, "Invalid credentials\n" ); - } else { - process_other_errors( lderr ); - } - if ( errmsg != NULL ) { - if ( strstr( errmsg, "password expired" ) != NULL ) { - fprintf( stderr, "Password expired\n" ); - } else { - fprintf( stderr, "Additional info: %s\n", - errmsg ); - } - ldap_memfree( errmsg ); - } - } - - password_status = check_controls( ctrls ); - ldap_controls_free( ctrls ); - if ( password_status == PASSWORD_EXPIRED ) { - fprintf( stderr, - "Password expired and must be reset\n" ); - } else if ( password_status > 0 ) { - fprintf( stderr, - "Password will expire in %d seconds\n", - password_status ); - } - rc = 0; - } - } else { - fprintf( stderr, "ldap_result returned %d\n", rc ); - ldap_perror( ld, "ldap_result" ); - rc = -1; - } - } -#endif - - if ( LDAP_SUCCESS == lderr ) { - ldap_unbind( ld ); - } - - return rc; -} diff --git a/mozilla/directory/c-sdk/ldap/examples/psearch.c b/mozilla/directory/c-sdk/ldap/examples/psearch.c deleted file mode 100644 index 616aaf53b6d..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/psearch.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * 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 a Persistent Search to monitor the directory server for changes to - * all people entries whose surname (last name) is "Jensen". - * - */ - -#include "examples.h" - -static char *changetype_num2string( int chgtype ); - -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; - int version = LDAP_VERSION3; - LDAPControl *ctrls[2], *psctrl, **ectrls; - - /* arrange to use LDAP version 3 */ - if ( ldap_set_option( NULL, LDAP_OPT_PROTOCOL_VERSION, &version ) != 0 ) { - perror( "ldap_set_option" ); - return( 1 ); - } - - /* 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" ); - ldap_unbind( ld ); - return( 1 ); - } - - /* construct the Persistent Search control */ - if ( ldap_create_persistentsearch_control( ld, LDAP_CHANGETYPE_ANY, - 1 /* changesOnly */, 1 /* request entry change controls */, - 1 /* critical */, &psctrl ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_create_persistentsearch_control" ); - ldap_unbind( ld ); - return( 1 ); - } - ctrls[0] = psctrl; - ctrls[1] = NULL; - - /* issue a persistent search for all entries with surname of Jensen */ - if ( LDAP_SUCCESS != ldap_search_ext( ld, MY_SEARCHBASE, - LDAP_SCOPE_SUBTREE, MY_FILTER, NULL /* all attrs */, - 0 /* get attrs and values */, ctrls, NULL /* no client ctrls */, - NULL /* no timeout */, 0 /* no sizelimit */, &msgid )) { - ldap_perror( ld, "ldap_search_ext" ); - ldap_unbind( ld ); - return( 1 ); - } - - ldap_control_free( psctrl ); /* no longer needed */ - - /* - * Loop, polling for results until finished. - * Since this is a persistent search, this loop won't end until the - * server shuts down or we lose the connection for some other reason. - * We could abandon the persistent search or close the connection of - * course, but we don't in this example. - */ - 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, NULL /* no timeout */, &result ); - switch ( rc ) { - case -1: - /* some error occurred */ - ldap_perror( ld, "ldap_result" ); - ldap_unbind( ld ); - 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; - } - num_entries++; - - /* for each entry print out name */ - if (( dn = ldap_get_dn( ld, e )) != NULL ) { - printf( "dn: %s\n", dn ); - ldap_memfree( dn ); - } - - /* print entry change info. if it was returned */ - if ( LDAP_SUCCESS == ldap_get_entry_controls( ld, e, &ectrls )) { - int chgtype, chgnumpresent; - long chgnum; - char *prevdn; - - if ( LDAP_SUCCESS == ldap_parse_entrychange_control( ld, - ectrls, &chgtype, &prevdn, &chgnumpresent, &chgnum )) { - printf( "changeType: %s\n", - changetype_num2string( chgtype )); - if ( prevdn != NULL ) { - printf( "previousDN: %s\n", prevdn ); - ldap_memfree( prevdn ); - } - if ( chgnumpresent ) { - printf( "changeNumber: %d\n", chgnum ); - } - ldap_controls_free( ectrls ); - } - } - - /* print out all attrs and values */ - 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 ); - } - } - - /* All done. Print a summary. */ - printf( "%d entries retrieved.\n", num_entries ); - ldap_unbind( ld ); - return( 0 ); -} - - -static char * -changetype_num2string( int chgtype ) -{ - static char buf[ 25 ]; - char *s; - - switch( chgtype ) { - case LDAP_CHANGETYPE_ADD: - s = "add"; - break; - case LDAP_CHANGETYPE_DELETE: - s = "delete"; - break; - case LDAP_CHANGETYPE_MODIFY: - s = "modify"; - break; - case LDAP_CHANGETYPE_MODDN: - s = "moddn"; - break; - default: - sprintf( s, "unknown (%d)", chgtype ); - } - - return( s ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/rdentry.c b/mozilla/directory/c-sdk/ldap/examples/rdentry.c deleted file mode 100644 index 7ae9a8ce7e7..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/rdentry.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 the specific entry ENTRYDN (defined in examples.h) - * Retrieve all attributes from the entry. - * - */ - -#include "examples.h" - -int -main( int argc, char **argv ) -{ - LDAP *ld; - LDAPMessage *result, *e; - BerElement *ber; - char *a, *dn; - char **vals; - int i; - - /* 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 Babs' entry */ - if ( ldap_search_s( ld, ENTRYDN, LDAP_SCOPE_SUBTREE, - "(objectclass=*)", NULL, 0, &result ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_search_s" ); - 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 ); - ldap_unbind( ld ); - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/search.c b/mozilla/directory/c-sdk/ldap/examples/search.c deleted file mode 100644 index fd218d0636d..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/search.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - * - */ - -#include "examples.h" - -int -main( int argc, char **argv ) -{ - LDAP *ld; - LDAPMessage *result, *e; - BerElement *ber; - char *a, *dn; - char **vals; - int i; - - /* 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" ); - ldap_unbind( ld ); - return( 1 ); - } - /* 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 ); - ldap_unbind( ld ); - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/srvrsort.c b/mozilla/directory/c-sdk/ldap/examples/srvrsort.c deleted file mode 100644 index 20d123826a5..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/srvrsort.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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. Ask the server to sort the entries - * first by sn (last name) and then in reverse order by givenname (first name). - */ - -#include "examples.h" - -int -main( int argc, char **argv ) -{ - LDAP *ld; - LDAPMessage *result, *e; - char *attrfail, *matched = NULL, *errmsg = NULL; - char **vals, **referrals; - int rc, parse_rc, version; - unsigned long sortrc; - LDAPControl *sortctrl = NULL; - LDAPControl *requestctrls[ 2 ]; - LDAPControl **resultctrls = NULL; - LDAPsortkey **sortkeylist; - - /* Arrange for all connections to 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 ); - } - - /* Authenticate as Directory Manager */ - if ( ldap_simple_bind_s( ld, MGR_DN, MGR_PW ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_simple_bind_s" ); - ldap_unbind( ld ); - return( 1 ); - } - - /* - * Create a sort key list that specifies the sort order of the results. - * Sort the results by last name first, then by first name. - */ - ldap_create_sort_keylist( &sortkeylist, "description -givenname" ); - - /* Create the sort control. */ - rc = ldap_create_sort_control( ld, sortkeylist, 1, &sortctrl ); - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_create_sort_control: %s\n", - ldap_err2string( rc ) ); - ldap_unbind( ld ); - return( 1 ); - } - requestctrls[ 0 ] = sortctrl; - requestctrls[ 1 ] = NULL; - - /* Search for all entries in Sunnyvale */ - - rc = ldap_search_ext_s( ld, PEOPLE_BASE, LDAP_SCOPE_SUBTREE, - "(objectclass=person)", NULL, 0, requestctrls, NULL, NULL, 0, - &result ); - - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_search_ext_s: %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( parse_rc ) ); - ldap_unbind( ld ); - return( 1 ); - } - - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_search_ext_s: %s\n", - ldap_err2string( rc ) ); - if ( errmsg != NULL && *errmsg != '\0' ) { - fprintf( stderr, "%s\n", errmsg ); - } - - ldap_unbind( ld ); - return( 1 ); - } - - parse_rc = ldap_parse_sort_control( ld, resultctrls, &sortrc, - &attrfail ); - - if ( parse_rc != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_parse_sort_control: %s\n", - ldap_err2string( parse_rc ) ); - ldap_unbind( ld ); - return( 1 ); - } - - if ( sortrc != LDAP_SUCCESS ) { - fprintf( stderr, "Sort error: %s\n", ldap_err2string( sortrc )); - if ( attrfail != NULL && *attrfail != '\0' ) { - fprintf( stderr, "Bad attribute: %s\n", attrfail); - } - 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 ((vals = ldap_get_values( ld, e, "sn")) != NULL ) { - if ( vals[0] != NULL ) { - printf( "%s", vals[0] ); - } - ldap_value_free( vals ); - } - - if ((vals = ldap_get_values( ld, e, "givenname")) != NULL ) { - if ( vals[0] != NULL ) { - printf( "\t%s", vals[0] ); - } - ldap_value_free( vals ); - } - - putchar( '\n' ); - } - - ldap_msgfree( result ); - ldap_free_sort_keylist( sortkeylist ); - ldap_control_free( sortctrl ); - ldap_controls_free( resultctrls ); - ldap_unbind( ld ); - - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/ssearch.c b/mozilla/directory/c-sdk/ldap/examples/ssearch.c deleted file mode 100644 index ff62f3d7bda..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/ssearch.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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 an SSL connection to 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. - * - * Authenticate using a client certificate. - * - */ - -#include "examples.h" -#include "ldap_ssl.h" - -#define MY_CERTDB "/usr/netscape4/alias/client-cert.db" -#define MY_KEYDB "/usr/netscape4/alias/client-key.db" -#define MY_KEYNICKNAME "Server-Key" -#define MY_CERTNICKNAME "Server-Cert" -#define MY_KEYPASSWD "secret" - -int -main( int argc, char **argv ) -{ - LDAP *ld; - LDAPMessage *result, *e; - BerElement *ber; - char *a, *dn; - char **vals; - int i; - - /* Initialize the client */ - if ( ldapssl_clientauth_init( MY_CERTDB, NULL, 1 /* need key db */, - MY_KEYDB, NULL ) < 0 ) { - perror( "ldapssl_clientauth_init" ); - return( 1 ); - } - - /* get a handle to an LDAP connection */ - if ( (ld = ldapssl_init( MY_HOST, MY_SSL_PORT, 1 )) == NULL ) { - perror( "ldapssl_init" ); - return( 1 ); - } - - /* use LDAPv3 */ - i = LDAP_VERSION3; - if ( ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &i ) < 0 ) { - ldap_perror( ld, "ldap_set_option LDAPv3" ); - ldap_unbind( ld ); - return( 1 ); - } - - /* enable certificate-based client authentication. */ - if ( ldapssl_enable_clientauth( ld, MY_KEYNICKNAME, MY_KEYPASSWD, - MY_CERTNICKNAME ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldapssl_enable_clientauth" ); - ldap_unbind( ld ); - return( 1 ); - } - - if ( ldap_sasl_bind_s( ld, NULL, LDAP_SASL_EXTERNAL, NULL, NULL, NULL, - NULL ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_sasl_bind_s EXTERNAL" ); - ldap_unbind( ld ); - return( 1 ); - } - - /* search for all entries with surname of Jensen */ - if ( ldap_search_s( ld, PEOPLE_BASE, LDAP_SCOPE_SUBTREE, - "(sn=jensen)", 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 ); - ldap_unbind( ld ); - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/ssnoauth.c b/mozilla/directory/c-sdk/ldap/examples/ssnoauth.c deleted file mode 100644 index 35b17bdae7e..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/ssnoauth.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 an SSL connection to 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. - * - */ - -#include "examples.h" -#include "ldap_ssl.h" - -#define MY_CERTDB_PATH "/u/mhein/.netscape/" - -int -main( int argc, char **argv ) -{ - LDAP *ld; - LDAPMessage *result, *e; - BerElement *ber; - char *a, *dn; - char **vals; - int i; - - /* Initialize the client */ - if ( ldapssl_client_init( MY_CERTDB_PATH, NULL ) < 0 ) { - perror( "ldapssl_client_init" ); - return( 1 ); - } - - /* get a handle to an LDAP connection */ - if ( (ld = ldapssl_init( MY_HOST, MY_PORT, 1 )) == NULL ) { - perror( "ldapssl_init" ); - return( 1 ); - } - - /* use LDAPv3 */ - i = LDAP_VERSION3; - if ( ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &i ) < 0 ) { - ldap_perror( ld, "ldap_set_option LDAPv3" ); - ldap_unbind( ld ); - return( 1 ); - } - - /* search for all entries with surname of Jensen */ - if ( ldap_search_s( ld, PEOPLE_BASE, LDAP_SCOPE_SUBTREE, - "(sn=jensen)", 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 ); - ldap_unbind( ld ); - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/win32.mak b/mozilla/directory/c-sdk/ldap/examples/win32.mak deleted file mode 100644 index 375a7b530b8..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/win32.mak +++ /dev/null @@ -1,145 +0,0 @@ -# -# Copyright (c) 1996-1998. Netscape Communications Corporation. All -# rights reserved. -# -# -# Win32 GNU Makefile for Directory SDK examples -# -# build the examples by typing: gmake -f win32.mak -# SSL examples are not built by default. Use 'gmake -f win32.mak ssl' -# NSPR examples are not built by default. Use 'gmake -f win32.mak nspr' -# - - -# For Win32 (NT) -LDAPLIB=nsldap32v50 -SSLDAPLIB=nsldapssl32v50 -PRLDAPLIB=nsldappr32v50 -NSPRLIB=libnspr4 -EXTRACFLAGS=-nologo -W3 -GT -GX -D_X86_ -Dx386 -DWIN32 -D_WINDOWS -c -Od -EXTRALDFLAGS=/NOLOGO /PDB:NONE /DEBUG /DEBUGTYPE:BOTH /SUBSYSTEM:console /FIXED:NO - - -############################################################################### -# You should not need to change anything below here.... - -INTERNAL_LIBLDAP_HEADERS=$(wildcard ../libraries/libldap/*.h) -ifeq (,$(findstring h, $(INTERNAL_LIBLDAP_HEADERS))) -IN_SRC_TREE=0 -else -IN_SRC_TREE=1 -endif - -ifneq ($(IN_SRC_TREE),1) -# we are not in the C SDK source tree... so must be in a binary distribution -INCDIR=../include -LIBDIR=../lib -NSPRINCDIR=../include -NSPRLIBDIR=../lib - -else -# we are in the C SDK source tree... paths to headers and libs are different -NS_DEPTH = ../../.. -LDAP_SRC = .. -NSCP_DISTDIR = ../../../../dist -NSPR_TREE = ../.. -MOD_DEPTH = ../.. - -ifeq ($(HAVE_CCONF), 1) -COMPS_FROM_OBJDIR=1 -endif - -include $(NSPR_TREE)/config/config.mk - -ifeq ($(COMPS_FROM_OBJDIR),1) -NSPR_DISTDIR=$(NSCP_DISTDIR)/$(OBJDIR_NAME) -else -NSPR_DISTDIR=$(NSCP_DISTDIR) -endif - -INCDIR=$(NSCP_DISTDIR)/public/ldap -LIBDIR=$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -NSPRINCDIR=$(NSPR_DISTDIR)/include -NSPRLIBDIR=$(NSPR_DISTDIR)/lib -endif - -SYSLIBS=wsock32.lib kernel32.lib user32.lib shell32.lib -LIBS=$(LIBDIR)/$(LDAPLIB).lib $(LIBDIR)/$(SSLDAPLIB).lib $(LIBDIR)/$(PRLDAPLIB).lib $(NSPRLIBDIR)/$(NSPRLIB).lib - -CC=cl -OPTFLAGS=-MD -CFLAGS=$(OPTFLAGS) $(EXTRACFLAGS) -I$(INCDIR) -I$(NSPRINCDIR) -LINK=link -LDFLAGS=$(EXTRALDFLAGS) - - -PROGS=search asearch csearch psearch rdentry getattrs srvrsort modattrs add del compare modrdn ppolicy getfilt crtfilt -EXES=$(addsuffix .exe,$(PROGS)) - -SSLPROGS=ssnoauth ssearch -SSLEXES=$(addsuffix .exe,$(SSLPROGS)) - -NSPRPROGS=nsprio -NSPREXES=$(addsuffix .exe,$(NSPRPROGS)) - -ALLEXES= $(EXES) $(SSLEXES) $(NSPREXES) - -standard: $(EXES) - -ssl: $(SSLEXES) - -nspr: $(NSPREXES) - -all: $(ALLEXES) - -search.obj: examples.h - -csearch.obj: examples.h - -psearch.obj: examples.h - -ssearch.obj: examples.h - -ssnoauth.obj: examples.h - -rdentry.obj: examples.h - -getattrs.obj: examples.h - -srvrsort.obj: examples.h - -modattrs.obj: examples.h - -asearch.obj: examples.h - -add.obj: examples.h - -del.obj: examples.h - -compare.obj: examples.h - -modrdn.obj: examples.h - -ppolicy.obj: examples.h - -getfilt.obj: examples.h - -crtfilt.obj: examples.h - -nsprio.obj: examples.h - -runall: $(EXES) - @for i in $(PROGS); do \ - echo '-------------------------------------------------'; \ - ./$$i; \ - done - -clean: - rm -f $(ALLEXES) *.obj - -%.obj : %.c - $(CC) $(CFLAGS) $< -Fo$@ - - -%.exe : %.obj - $(LINK) -OUT:$@ $(LDFLAGS) $(SYSLIBS) $< $(LIBS) diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/ConnDlg.cpp b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/ConnDlg.cpp deleted file mode 100644 index 65a2515de8d..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/ConnDlg.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// ConnDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "winldap.h" -#include "ConnDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// ConnDlg dialog - - -ConnDlg::ConnDlg(CWnd* pParent /*=NULL*/) - : CDialog(ConnDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(ConnDlg) - m_dirHost = _T(""); - m_dirPort = 0; - //}}AFX_DATA_INIT -} - - -void ConnDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(ConnDlg) - DDX_Text(pDX, IDC_DIR_HOST, m_dirHost); - DDX_Text(pDX, IDC_DIR_PORT, m_dirPort); - DDV_MinMaxInt(pDX, m_dirPort, 1, 32000); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(ConnDlg, CDialog) - //{{AFX_MSG_MAP(ConnDlg) - // NOTE: the ClassWizard will add message map macros here - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// ConnDlg message handlers diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/ConnDlg.h b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/ConnDlg.h deleted file mode 100644 index 6a3667dbc17..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/ConnDlg.h +++ /dev/null @@ -1,36 +0,0 @@ -// ConnDlg.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// ConnDlg dialog - -class ConnDlg : public CDialog -{ -// Construction -public: - ConnDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(ConnDlg) - enum { IDD = IDD_CONNECT_DIALOG }; - CString m_dirHost; - int m_dirPort; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(ConnDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(ConnDlg) - // NOTE: the ClassWizard will add member functions here - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LDAP16.DEF b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LDAP16.DEF deleted file mode 100644 index 862b8719d3b..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LDAP16.DEF +++ /dev/null @@ -1,8 +0,0 @@ -NAME LDAP16 -EXETYPE WINDOWS -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE MULTIPLE -HEAPSIZE 1024 - -EXPORTS -; ===List your explicitly exported functions here=== diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LDAP16.MAK b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LDAP16.MAK deleted file mode 100644 index d37827cfba4..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LDAP16.MAK +++ /dev/null @@ -1,186 +0,0 @@ -# Microsoft Visual C++ generated build script - Do not modify - -PROJ = LDAP16 -DEBUG = 0 -PROGTYPE = 0 -CALLER = -ARGS = -DLLS = -D_RCDEFINES = -d_DEBUG -R_RCDEFINES = -dNDEBUG -ORIGIN = MSVC -ORIGIN_VER = 1.00 -PROJPATH = C:\NETSCAPE\LDAPSDK\EXAMPLES\WINDOWS\WINLDAP\ -USEMFC = 1 -CC = cl -CPP = cl -CXX = cl -CCREATEPCHFLAG = -CPPCREATEPCHFLAG = -CUSEPCHFLAG = -CPPUSEPCHFLAG = -FIRSTC = -FIRSTCPP = CONNDLG.CPP -RC = rc -CFLAGS_D_WEXE = /nologo /G3 /W3 /Zi /AL /Od /D "_DEBUG" /D "_AFX_NO_AFXCMN_SUPPORT" /D "_WINDOWS" /FR /GA /Fd"LDAP16.PDB" -CFLAGS_R_WEXE = /nologo /W3 /AL /O1 /D "NDEBUG" /D "_AFX_NO_AFXCMN_SUPPORT" /D "_WINDOWS" /FR /GA -LFLAGS_D_WEXE = /NOLOGO /NOD /PACKC:61440 /STACK:10240 /ALIGN:16 /ONERROR:NOEXE /CO -LFLAGS_R_WEXE = /NOLOGO /NOD /PACKC:61440 /STACK:10240 /ALIGN:16 /ONERROR:NOEXE -LIBS_D_WEXE = nsldap.lib lafxcwd oldnames libw llibcew commdlg.lib shell.lib -LIBS_R_WEXE = nsldap.lib lafxcw oldnames libw llibcew commdlg.lib shell.lib -RCFLAGS = /nologo -RESFLAGS = /nologo -RUNFLAGS = -DEFFILE = LDAP16.DEF -OBJS_EXT = -LIBS_EXT = -!if "$(DEBUG)" == "1" -CFLAGS = $(CFLAGS_D_WEXE) -LFLAGS = $(LFLAGS_D_WEXE) -LIBS = $(LIBS_D_WEXE) -MAPFILE = nul -RCDEFINES = $(D_RCDEFINES) -!else -CFLAGS = $(CFLAGS_R_WEXE) -LFLAGS = $(LFLAGS_R_WEXE) -LIBS = $(LIBS_R_WEXE) -MAPFILE = nul -RCDEFINES = $(R_RCDEFINES) -!endif -!if [if exist MSVC.BND del MSVC.BND] -!endif -SBRS = CONNDLG.SBR \ - LDAPDOC.SBR \ - LDAPVIEW.SBR \ - MAINFRM.SBR \ - PROPDLG.SBR \ - SRCHDLG.SBR \ - STDAFX.SBR \ - WINLDAP.SBR - - -CONNDLG_DEP = c:\netscape\ldapsdk\examples\windows\winldap\stdafx.h \ - c:\netscape\ldapsdk\examples\windows\winldap\winldap.h \ - c:\netscape\ldapsdk\examples\windows\winldap\conndlg.h - - -LDAPDOC_DEP = c:\netscape\ldapsdk\examples\windows\winldap\stdafx.h \ - c:\netscape\ldapsdk\examples\windows\winldap\winldap.h \ - c:\netscape\ldapsdk\examples\windows\winldap\ldapdoc.h - - -LDAPVIEW_DEP = c:\netscape\ldapsdk\examples\windows\winldap\stdafx.h \ - c:\netscape\ldapsdk\include\ldap.h \ - c:\netscape\ldapsdk\include\lber.h \ - c:\netscape\ldapsdk\examples\windows\winldap\winldap.h \ - c:\netscape\ldapsdk\examples\windows\winldap\ldapdoc.h \ - c:\netscape\ldapsdk\examples\windows\winldap\ldapview.h \ - c:\netscape\ldapsdk\examples\windows\winldap\propdlg.h - - -MAINFRM_DEP = c:\netscape\ldapsdk\examples\windows\winldap\stdafx.h \ - c:\netscape\ldapsdk\include\ldap.h \ - c:\netscape\ldapsdk\include\lber.h \ - c:\netscape\ldapsdk\examples\windows\winldap\winldap.h \ - c:\netscape\ldapsdk\examples\windows\winldap\mainfrm.h - - -PROPDLG_DEP = c:\netscape\ldapsdk\examples\windows\winldap\stdafx.h \ - c:\netscape\ldapsdk\include\ldap.h \ - c:\netscape\ldapsdk\include\lber.h \ - c:\netscape\ldapsdk\examples\windows\winldap\winldap.h \ - c:\netscape\ldapsdk\examples\windows\winldap\propdlg.h - - -SRCHDLG_DEP = c:\netscape\ldapsdk\examples\windows\winldap\stdafx.h \ - c:\netscape\ldapsdk\include\ldap.h \ - c:\netscape\ldapsdk\include\lber.h \ - c:\netscape\ldapsdk\examples\windows\winldap\winldap.h \ - c:\netscape\ldapsdk\examples\windows\winldap\srchdlg.h - - -STDAFX_DEP = c:\netscape\ldapsdk\examples\windows\winldap\stdafx.h - - -WINLDAP_DEP = c:\netscape\ldapsdk\examples\windows\winldap\stdafx.h \ - c:\netscape\ldapsdk\include\ldap.h \ - c:\netscape\ldapsdk\include\lber.h \ - c:\netscape\ldapsdk\examples\windows\winldap\winldap.h \ - c:\netscape\ldapsdk\examples\windows\winldap\mainfrm.h \ - c:\netscape\ldapsdk\examples\windows\winldap\ldapdoc.h \ - c:\netscape\ldapsdk\examples\windows\winldap\ldapview.h \ - c:\netscape\ldapsdk\examples\windows\winldap\conndlg.h \ - c:\netscape\ldapsdk\examples\windows\winldap\srchdlg.h - - -LDAP16_RCDEP = c:\netscape\ldapsdk\examples\windows\winldap\res\winldap.ico \ - c:\netscape\ldapsdk\examples\windows\winldap\res\winldap.rc2 - - -all: $(PROJ).EXE $(PROJ).BSC - -CONNDLG.OBJ: CONNDLG.CPP $(CONNDLG_DEP) - $(CPP) $(CFLAGS) $(CPPCREATEPCHFLAG) /c CONNDLG.CPP - -LDAPDOC.OBJ: LDAPDOC.CPP $(LDAPDOC_DEP) - $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c LDAPDOC.CPP - -LDAPVIEW.OBJ: LDAPVIEW.CPP $(LDAPVIEW_DEP) - $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c LDAPVIEW.CPP - -MAINFRM.OBJ: MAINFRM.CPP $(MAINFRM_DEP) - $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c MAINFRM.CPP - -PROPDLG.OBJ: PROPDLG.CPP $(PROPDLG_DEP) - $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c PROPDLG.CPP - -SRCHDLG.OBJ: SRCHDLG.CPP $(SRCHDLG_DEP) - $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c SRCHDLG.CPP - -STDAFX.OBJ: STDAFX.CPP $(STDAFX_DEP) - $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c STDAFX.CPP - -WINLDAP.OBJ: WINLDAP.CPP $(WINLDAP_DEP) - $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c WINLDAP.CPP - -LDAP16.RES: LDAP16.RC $(LDAP16_RCDEP) - $(RC) $(RCFLAGS) $(RCDEFINES) -r LDAP16.RC - - -$(PROJ).EXE:: LDAP16.RES - -$(PROJ).EXE:: CONNDLG.OBJ LDAPDOC.OBJ LDAPVIEW.OBJ MAINFRM.OBJ PROPDLG.OBJ SRCHDLG.OBJ \ - STDAFX.OBJ WINLDAP.OBJ $(OBJS_EXT) $(DEFFILE) - echo >NUL @<<$(PROJ).CRF -STDAFX.OBJ + -CONNDLG.OBJ + -LDAPDOC.OBJ + -LDAPVIEW.OBJ + -MAINFRM.OBJ + -PROPDLG.OBJ + -SRCHDLG.OBJ + -WINLDAP.OBJ + -$(OBJS_EXT) -$(PROJ).EXE -$(MAPFILE) -C:\MSVC\LIB\+ -C:\MSVC\MFC\LIB\+ -..\..\..\lib\+ -$(LIBS) -$(DEFFILE); -<< - link $(LFLAGS) @$(PROJ).CRF - $(RC) $(RESFLAGS) LDAP16.RES $@ - @copy $(PROJ).CRF MSVC.BND - -$(PROJ).EXE:: LDAP16.RES - if not exist MSVC.BND $(RC) $(RESFLAGS) LDAP16.RES $@ - -run: $(PROJ).EXE - $(PROJ) $(RUNFLAGS) - - -$(PROJ).BSC: $(SBRS) - bscmake @<< -/o$@ $(SBRS) -<< diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LDAP16.RC b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LDAP16.RC deleted file mode 100644 index 2c3c3690dcc..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LDAP16.RC +++ /dev/null @@ -1,241 +0,0 @@ -//Microsoft App Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////// -// -// From TEXTINCLUDE 2 -// -#include "afxres.h" - -//////////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -#ifdef APSTUDIO_INVOKED - -//////////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""res\\winldap.rc2"" // non-App Studio edited resources\r\n" - "\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "\0" -END - -///////////////////////////////////////////////////////////////////////// -#endif // APSTUDIO_INVOKED - - -//////////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -IDR_MAINFRAME ICON DISCARDABLE res\winldap.ico - - -//////////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAINFRAME MENU PRELOAD DISCARDABLE -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&Connect...\tCtrl+N", ID_FILE_CONNECT - MENUITEM "&Disconnect\tCtrl+D", ID_FILE_DISCONNECT - MENUITEM "&Search...\tCtrl+S", ID_FILE_SEARCH - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_APP_EXIT - END - POPUP "&Help" - BEGIN - MENUITEM "&About Test16...", ID_APP_ABOUT - END -END - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE -BEGIN - "N", ID_FILE_NEW, VIRTKEY,CONTROL - "O", ID_FILE_OPEN, VIRTKEY,CONTROL - "S", ID_FILE_SAVE, VIRTKEY,CONTROL - "Z", ID_EDIT_UNDO, VIRTKEY,CONTROL - "X", ID_EDIT_CUT, VIRTKEY,CONTROL - "C", ID_EDIT_COPY, VIRTKEY,CONTROL - "V", ID_EDIT_PASTE, VIRTKEY,CONTROL - VK_BACK, ID_EDIT_UNDO, VIRTKEY,ALT - VK_DELETE, ID_EDIT_CUT, VIRTKEY,SHIFT - VK_INSERT, ID_EDIT_COPY, VIRTKEY,CONTROL - VK_INSERT, ID_EDIT_PASTE, VIRTKEY,SHIFT - VK_F6, ID_NEXT_PANE, VIRTKEY - VK_F6, ID_PREV_PANE, VIRTKEY,SHIFT -END - - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOG DISCARDABLE 34, 22, 217, 55 -CAPTION "About Test16" -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -FONT 8, "MS Sans Serif" -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 - LTEXT "Test16 Application Version 1.0",IDC_STATIC,40,10,119,8 - LTEXT "Copyright \251 1997",IDC_STATIC,40,25,119,8 - DEFPUSHBUTTON "OK",IDOK,176,6,32,14,WS_GROUP -END - -IDD_CONNECT_DIALOG DIALOG DISCARDABLE 0, 0, 186, 76 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Connect to Directory Server" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,35,55,50,14 - PUSHBUTTON "Cancel",IDCANCEL,103,55,50,14 - RTEXT "Host name:",IDC_STATIC,21,17,52,12 - EDITTEXT IDC_DIR_PORT,79,33,92,14,ES_AUTOHSCROLL - RTEXT "Port number:",IDC_STATIC,28,36,45,12 - EDITTEXT IDC_DIR_HOST,79,14,92,14,ES_AUTOHSCROLL -END - -IDD_SEARCH_DIALOG DIALOG DISCARDABLE 0, 0, 186, 103 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Search parameters" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,39,82,50,14 - PUSHBUTTON "Cancel",IDCANCEL,105,82,50,14 - RTEXT "Directory base:",IDC_STATIC,7,16,54,12 - EDITTEXT IDC_SEARCH_BASE,65,13,106,14,ES_AUTOHSCROLL - RTEXT "Search filter:",IDC_STATIC,10,34,51,12 - EDITTEXT IDC_SEARCH_FILTER,65,31,105,14,ES_AUTOHSCROLL - CONTROL "Base",IDC_SCOPE_BASE,"Button",BS_AUTORADIOBUTTON,23,60, - 32,10 - CONTROL "One level",IDC_SCOPE_ONE,"Button",BS_AUTORADIOBUTTON,69, - 60,46,10 - CONTROL "Subtree",IDC_SCOPE_SUB,"Button",BS_AUTORADIOBUTTON,121, - 60,41,10 - GROUPBOX "Scope",IDC_STATIC,13,49,159,24 -END - -IDD_ENTRY_PROPERTIES DIALOG DISCARDABLE 0, 0, 273, 202 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Properties" -FONT 8, "MS Sans Serif" -BEGIN -END - - -//////////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - IDR_MAINFRAME "winldap\n\nWinlda\n\n\nWinldap.Document\nWinlda Document" -END -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - AFX_IDS_APP_TITLE "Test16 Windows Application" - AFX_IDS_IDLEMESSAGE "Ready" -END -STRINGTABLE DISCARDABLE -BEGIN - ID_INDICATOR_EXT "EXT" - ID_INDICATOR_CAPS "CAP" - ID_INDICATOR_NUM "NUM" - ID_INDICATOR_SCRL "SCRL" - ID_INDICATOR_OVR "OVR" - ID_INDICATOR_REC "REC" -END -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_NEW "Create a new document" - ID_FILE_OPEN "Open an existing document" - ID_FILE_CLOSE "Close the active document" - ID_FILE_SAVE "Save the active document" - ID_FILE_SAVE_AS "Save the active document with a new name" - ID_APP_ABOUT "Display program information, version number and copyright" - ID_APP_EXIT "Quit the application; prompts to save documents" - ID_FILE_MRU_FILE1 "Open this document" - ID_FILE_MRU_FILE2 "Open this document" - ID_FILE_MRU_FILE3 "Open this document" - ID_FILE_MRU_FILE4 "Open this document" - ID_NEXT_PANE "Switch to the next window pane" - ID_PREV_PANE "Switch back to the previous window pane" - ID_EDIT_CLEAR "Erase the selection" - ID_EDIT_CLEAR_ALL "Erase everything" - ID_EDIT_COPY "Copy the selection and put it on the Clipboard" - ID_EDIT_CUT "Cut the selection and put it on the Clipboard" - ID_EDIT_FIND "Find the specified text" - ID_EDIT_PASTE "Insert Clipboard contents" - ID_EDIT_REPEAT "Repeat the last action" - ID_EDIT_REPLACE "Replace specific text with different text" - ID_EDIT_SELECT_ALL "Select the entire document" - ID_EDIT_UNDO "Undo the last action" - ID_EDIT_REDO "Redo the previously undone action" -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_SCSIZE "Change the window size" - AFX_IDS_SCMOVE "Change the window position" - AFX_IDS_SCMINIMIZE "Reduce the window to an icon" - AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" - AFX_IDS_SCNEXTWINDOW "Switch to the next document window" - AFX_IDS_SCPREVWINDOW "Switch to the previous document window" - AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" - AFX_IDS_SCRESTORE "Restore the window to normal size" - AFX_IDS_SCTASKLIST "Activate Task List" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_CONNECT "Connect to Directory Server" - ID_FILE_DISCONNECT "Disconnect from Directory Server" - ID_FILE_SEARCH "Search in Directory" -END - - -#ifndef APSTUDIO_INVOKED -//////////////////////////////////////////////////////////////////////////////// -// -// From TEXTINCLUDE 3 -// - -#include "res\winldap.rc2" // non-App Studio edited resources - -#include "afxres.rc" // Standard components - -//////////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapDoc.cpp b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapDoc.cpp deleted file mode 100644 index 6998a59bff6..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapDoc.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// LdapDoc.cpp : implementation of the LdapDoc class -// - -#include "stdafx.h" -#include "winldap.h" - -#include "LdapDoc.h" - -#ifdef _DEBUG -#ifdef _WIN32 -#define new DEBUG_NEW -#endif -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// LdapDoc - -IMPLEMENT_DYNCREATE(LdapDoc, CDocument) - -BEGIN_MESSAGE_MAP(LdapDoc, CDocument) - //{{AFX_MSG_MAP(LdapDoc) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// LdapDoc construction/destruction - -LdapDoc::LdapDoc() -{ -} - -LdapDoc::~LdapDoc() -{ -} - -BOOL LdapDoc::OnNewDocument() -{ - if (!CDocument::OnNewDocument()) - return FALSE; - - SetTitle( "" ); - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// -// LdapDoc serialization - -void LdapDoc::Serialize(CArchive& ar) -{ - if (ar.IsStoring()) - { - } - else - { - } -} - -///////////////////////////////////////////////////////////////////////////// -// LdapDoc diagnostics - -#ifdef _DEBUG -void LdapDoc::AssertValid() const -{ - CDocument::AssertValid(); -} - -void LdapDoc::Dump(CDumpContext& dc) const -{ - CDocument::Dump(dc); -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// LdapDoc commands diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapDoc.h b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapDoc.h deleted file mode 100644 index a538d0b3226..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapDoc.h +++ /dev/null @@ -1,42 +0,0 @@ -// LdapDoc.h : interface of the LdapDoc class -// -///////////////////////////////////////////////////////////////////////////// - -class LdapDoc : public CDocument -{ -protected: // create from serialization only - LdapDoc(); - DECLARE_DYNCREATE(LdapDoc) - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(LdapDoc) - public: - virtual BOOL OnNewDocument(); - virtual void Serialize(CArchive& ar); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~LdapDoc(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(LdapDoc) - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapView.cpp b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapView.cpp deleted file mode 100644 index 8cb908ad5b3..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapView.cpp +++ /dev/null @@ -1,190 +0,0 @@ -// LdapView.cpp : implementation of the LdapView class -// - -#include "stdafx.h" -#include "ldap.h" -#include "winldap.h" - -#include "LdapDoc.h" -#include "LdapView.h" -#include "PropDlg.h" - -#ifdef _DEBUG -#ifdef _WIN32 -#define new DEBUG_NEW -#endif -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// LdapView - -IMPLEMENT_DYNCREATE(LdapView, CView) - -BEGIN_MESSAGE_MAP(LdapView, CView) - //{{AFX_MSG_MAP(LdapView) - ON_WM_SIZE() - ON_LBN_DBLCLK(5000,OnListDoubleClick) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// LdapView construction/destruction - -LdapView::LdapView() -{ -} - -LdapView::~LdapView() -{ -} - -BOOL LdapView::PreCreateWindow(CREATESTRUCT& cs) -{ - return CView::PreCreateWindow(cs); -} - -///////////////////////////////////////////////////////////////////////////// -// LdapView drawing - -void LdapView::OnDraw(CDC* pDC) -{ - LdapDoc* pDoc = GetDocument(); - ASSERT_VALID(pDoc); -} - -void LdapView::OnInitialUpdate() -{ - CView::OnInitialUpdate(); - // Create a list box the same size as the client area - CRect rect; - GetClientRect( &rect ); - m_list.Create( WS_CHILD|WS_VISIBLE|WS_VSCROLL|LBS_NOTIFY, rect, this, 5000 ); -} - -void LdapView::AddLine( LPCSTR line, const char *dn ) -{ - // Add a string to the list box - int ind = m_list.AddString( line ); - if ( NULL != dn ) - m_list.SetItemDataPtr( ind, (void *)strdup(dn) ); -} - -void LdapView::ClearLines() -{ - // Remove all lines from the list box - int nCount = m_list.GetCount(); - while ( nCount > 0 ) - { - char *str = (char *)m_list.GetItemDataPtr( 0 ); - if ( str ) - free( str ); - nCount = m_list.DeleteString( 0 ); - } -} - -///////////////////////////////////////////////////////////////////////////// -// LdapView diagnostics - -#ifdef _DEBUG -void LdapView::AssertValid() const -{ - CView::AssertValid(); -} - -void LdapView::Dump(CDumpContext& dc) const -{ - CView::Dump(dc); -} - -LdapDoc* LdapView::GetDocument() // non-debug version is inline -{ - ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(LdapDoc))); - return (LdapDoc*)m_pDocument; -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// LdapView message handlers - -void LdapView::OnSize(UINT nType, int cx, int cy) -{ - // Make sure the list box is resized along with the View - CView::OnSize(nType, cx, cy); - if ( ::IsWindow( m_list.m_hWnd ) ) - m_list.SetWindowPos( &wndTop, 0, 0, cx, cy, SWP_NOZORDER ); -} - -// Fetch all attributes of an entry, and display them in a dialog -void LdapView::showProperties( LDAP *ld, char *dn ) -{ - PropDlg dlg; - if ( ldap_search( ld, dn, LDAP_SCOPE_BASE, "objectclass=*", - NULL, FALSE ) == -1 ) - { - AfxMessageBox( "Failed to start asynchronous search" ); - return; - } - - LDAPMessage *res; - int rc; - // Process results as they come in - while ( (rc = ldap_result( ld, LDAP_RES_ANY, 0, NULL, &res )) - == LDAP_RES_SEARCH_ENTRY ) - { - LDAPMessage *e = ldap_first_entry( ld, res ); - BerElement *ber; - // Loop over attributes in this entry - for ( char *a = ldap_first_attribute( ld, e, &ber ); a != NULL; - a = ldap_next_attribute( ld, e, ber ) ) - { - struct berval **bvals; - if ( (bvals = ldap_get_values_len( ld, e, a )) != NULL ) - { - dlg.AddLine( a ); - // Loop over values for this attribute - for ( int i = 0; bvals[i] != NULL; i++ ) - { - CString val; - val.Format( " %s", bvals[ i ]->bv_val ); - dlg.AddLine( val ); - } - ber_bvecfree( bvals ); - } - } - if ( ber != NULL ) - ber_free( ber, 0 ); - ldap_msgfree( res ); - } - if ( rc == -1 ) - { - AfxMessageBox( "Error on ldap_result" ); - return; - } - else if (( rc = ldap_result2error( ld, res, 0 )) != LDAP_SUCCESS ) - { - char *errString = ldap_err2string( rc ); - AfxMessageBox( errString ); - } - ldap_msgfree( res ); - // Set the title of the dialog to the distinguished name, and display it - dlg.SetTitle( dn ); - dlg.DoModal(); -} - -// Catch double-clicks on the list box, and fetch properties for a dn -void LdapView::OnListDoubleClick() -{ - int ind = m_list.GetCurSel(); - if ( ind >= 0 ) - { - char *dn = (char *)m_list.GetItemDataPtr( ind ); - if ( NULL != dn ) - { - LDAP *ld = ((LdapApp *)AfxGetApp())->GetConnection(); - if ( NULL != ld ) - showProperties( ld, dn ); - } - } -} diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapView.h b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapView.h deleted file mode 100644 index 1fdf82f160c..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/LdapView.h +++ /dev/null @@ -1,60 +0,0 @@ -// LdapView.h : interface of the LdapView class -// -///////////////////////////////////////////////////////////////////////////// - -class LdapView : public CView -{ -protected: // create from serialization only - LdapView(); - DECLARE_DYNCREATE(LdapView) - -// Attributes -public: - LdapDoc* GetDocument(); - -private: - CListBox m_list; - -// Operations -public: - void AddLine( LPCSTR line, const char *dn=NULL ); - void ClearLines(); - -private: - void showProperties( LDAP *ld, char *dn ); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(LdapView) - public: - virtual void OnDraw(CDC* pDC); // overridden to draw this view - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - protected: - virtual void OnInitialUpdate(); // called first time after construct - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~LdapView(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(LdapView) - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnListDoubleClick(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -#ifndef _DEBUG // debug version in LdapView.cpp -inline LdapDoc* LdapView::GetDocument() - { return (LdapDoc*)m_pDocument; } -#endif - -///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/MainFrm.cpp b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/MainFrm.cpp deleted file mode 100644 index f5d2c28ec21..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/MainFrm.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// MainFrm.cpp : implementation of the CMainFrame class -// - -#include "stdafx.h" -#include "winldap.h" - -#include "MainFrm.h" - -#ifdef _DEBUG -#ifdef _WIN32 -#define new DEBUG_NEW -#endif -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame - -IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) - -BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) - //{{AFX_MSG_MAP(CMainFrame) - ON_WM_CREATE() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -static UINT indicators[] = -{ - ID_SEPARATOR, // status line indicator - ID_INDICATOR_CAPS, - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, -}; - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame construction/destruction - -CMainFrame::CMainFrame() -{ -} - -CMainFrame::~CMainFrame() -{ -} - -int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CFrameWnd::OnCreate(lpCreateStruct) == -1) - return -1; - - if (!m_wndStatusBar.Create(this) || - !m_wndStatusBar.SetIndicators(indicators, - sizeof(indicators)/sizeof(UINT))) - { - TRACE0("Failed to create status bar\n"); - return -1; // fail to create - } - - return 0; -} - -BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) -{ - return CFrameWnd::PreCreateWindow(cs); -} - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame diagnostics - -#ifdef _DEBUG -void CMainFrame::AssertValid() const -{ - CFrameWnd::AssertValid(); -} - -void CMainFrame::Dump(CDumpContext& dc) const -{ - CFrameWnd::Dump(dc); -} - -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame message handlers diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/MainFrm.h b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/MainFrm.h deleted file mode 100644 index 07bf52d673e..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/MainFrm.h +++ /dev/null @@ -1,43 +0,0 @@ -// MainFrm.h : interface of the CMainFrame class -// -///////////////////////////////////////////////////////////////////////////// - -class CMainFrame : public CFrameWnd -{ -protected: // create from serialization only - CMainFrame(); - DECLARE_DYNCREATE(CMainFrame) - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMainFrame) - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CMainFrame(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: // control bar embedded members - CStatusBar m_wndStatusBar; - CToolBar m_wndToolBar; - -// Generated message map functions -protected: - //{{AFX_MSG(CMainFrame) - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/PropDlg.cpp b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/PropDlg.cpp deleted file mode 100644 index e8080b2316b..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/PropDlg.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// PropDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "winldap.h" -#include "PropDlg.h" - -#ifdef _DEBUG -#ifdef _WIN32 -#define new DEBUG_NEW -#endif -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// PropDlg dialog - - -PropDlg::PropDlg(CWnd* pParent /*=NULL*/) - : CDialog(PropDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(PropDlg) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -void PropDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(PropDlg) - // NOTE: the ClassWizard will add DDX and DDV calls here - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(PropDlg, CDialog) - //{{AFX_MSG_MAP(PropDlg) - ON_WM_SIZE() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// PropDlg message handlers - -void PropDlg::OnSize(UINT nType, int cx, int cy) -{ - CDialog::OnSize(nType, cx, cy); - - if ( ::IsWindow( m_list.m_hWnd ) ) - m_list.SetWindowPos( &wndTop, 0, 0, cx, cy, SWP_NOZORDER ); -} - -BOOL PropDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - if ( m_title.GetLength() > 0 ) - SetWindowText( m_title ); - CRect rect; - GetClientRect( &rect ); - m_list.Create( WS_CHILD|WS_VISIBLE|WS_VSCROLL|LBS_NOTIFY, rect, this, 5000 ); - - POSITION pos; - // Iterate through the list in head-to-tail order. - for( pos = m_strings.GetHeadPosition(); pos != NULL; ) - { - m_list.AddString( m_strings.GetNext( pos ) ); - } - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void PropDlg::AddLine( const char *str ) -{ - m_strings.AddTail( str ); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/PropDlg.h b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/PropDlg.h deleted file mode 100644 index f681642a2b0..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/PropDlg.h +++ /dev/null @@ -1,45 +0,0 @@ -// PropDlg.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// PropDlg dialog - -class PropDlg : public CDialog -{ -// Construction -public: - PropDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(PropDlg) - enum { IDD = IDD_ENTRY_PROPERTIES }; - // NOTE: the ClassWizard will add data members here - //}}AFX_DATA - - void SetTitle( const char *str ) { m_title = str; } - -private: - CListBox m_list; - CStringList m_strings; - CString m_title; - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(PropDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -public: - void AddLine( const char *line ); - -protected: - - // Generated message map functions - //{{AFX_MSG(PropDlg) - afx_msg void OnSize(UINT nType, int cx, int cy); - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/Resource.h b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/Resource.h deleted file mode 100644 index e938bbccf1c..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/Resource.h +++ /dev/null @@ -1,32 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by winldap.rc -// -#define IDD_ABOUTBOX 100 -#define IDR_MAINFRAME 128 -#define IDR_WINLDATYPE 129 -#define IDD_CONNECT_DIALOG 130 -#define IDD_SEARCH_DIALOG 131 -#define IDD_ENTRY_PROPERTIES 132 -#define IDC_SEARCH_BASE 1000 -#define IDC_DIR_PORT 1001 -#define IDC_SEARCH_FILTER 1001 -#define IDC_DIR_HOST 1002 -#define IDC_SCOPE_BASE 1002 -#define IDC_SCOPE_ONE 1003 -#define IDC_SCOPE_SUB 1004 -#define ID_FILE_CONNECT 32771 -#define ID_FILE_DISCONNECT 32772 -#define ID_FILE_SEARCH 32773 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 133 -#define _APS_NEXT_COMMAND_VALUE 32774 -#define _APS_NEXT_CONTROL_VALUE 1003 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/SrchDlg.cpp b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/SrchDlg.cpp deleted file mode 100644 index 782e47dedbf..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/SrchDlg.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// SrchDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "ldap.h" -#include "winldap.h" -#include "SrchDlg.h" - -#ifdef _DEBUG -#ifdef _WIN32 -#define new DEBUG_NEW -#endif -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// SearchDlg dialog - - -SearchDlg::SearchDlg(CWnd* pParent /*=NULL*/) - : CDialog(SearchDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(SearchDlg) - m_searchBase = _T(""); - m_searchFilter = _T(""); - //}}AFX_DATA_INIT -} - - -void SearchDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(SearchDlg) - DDX_Text(pDX, IDC_SEARCH_BASE, m_searchBase); - DDX_Text(pDX, IDC_SEARCH_FILTER, m_searchFilter); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(SearchDlg, CDialog) - //{{AFX_MSG_MAP(SearchDlg) - ON_BN_CLICKED(IDC_SCOPE_BASE, OnScopeBase) - ON_BN_DOUBLECLICKED(IDC_SCOPE_BASE, OnScopeBase) - ON_BN_CLICKED(IDC_SCOPE_ONE, OnScopeOne) - ON_BN_DOUBLECLICKED(IDC_SCOPE_ONE, OnScopeOne) - ON_BN_CLICKED(IDC_SCOPE_SUB, OnScopeSub) - ON_BN_DOUBLECLICKED(IDC_SCOPE_SUB, OnScopeSub) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// SearchDlg message handlers - -BOOL SearchDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - switch( m_scope ) - { - case LDAP_SCOPE_SUBTREE: - ((CButton *)GetDlgItem( IDC_SCOPE_SUB ))->SetCheck( 1 ); - break; - case LDAP_SCOPE_BASE: - ((CButton *)GetDlgItem( IDC_SCOPE_BASE ))->SetCheck( 1 ); - break; - case LDAP_SCOPE_ONELEVEL: - ((CButton *)GetDlgItem( IDC_SCOPE_ONE ))->SetCheck( 1 ); - break; - } - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void SearchDlg::OnScopeBase() -{ - m_scope = LDAP_SCOPE_BASE; -} - -void SearchDlg::OnScopeOne() -{ - m_scope = LDAP_SCOPE_ONELEVEL; -} - -void SearchDlg::OnScopeSub() -{ - m_scope = LDAP_SCOPE_SUBTREE; -} diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/SrchDlg.h b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/SrchDlg.h deleted file mode 100644 index 1b0c0714378..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/SrchDlg.h +++ /dev/null @@ -1,47 +0,0 @@ -// SrchDlg.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// SearchDlg dialog - -class SearchDlg : public CDialog -{ -// Construction -public: - SearchDlg(CWnd* pParent = NULL); // standard constructor - -public: - void SetScope( int scope ) { m_scope = scope; } - int GetScope() { return m_scope; } - -private: - int m_scope; - -public: -// Dialog Data - //{{AFX_DATA(SearchDlg) - enum { IDD = IDD_SEARCH_DIALOG }; - CString m_searchBase; - CString m_searchFilter; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(SearchDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(SearchDlg) - virtual BOOL OnInitDialog(); - afx_msg void OnScopeBase(); - afx_msg void OnScopeOne(); - afx_msg void OnScopeSub(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/StdAfx.cpp b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/StdAfx.cpp deleted file mode 100644 index eb9e17657bc..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/StdAfx.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// winldap.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/StdAfx.h b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/StdAfx.h deleted file mode 100644 index 9ff48947f9b..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/StdAfx.h +++ /dev/null @@ -1,18 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#ifdef _WIN32 -#include -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT -#endif - - - diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/LdapDoc.ico b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/LdapDoc.ico deleted file mode 100644 index 2a1f1ae6ef1..00000000000 Binary files a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/LdapDoc.ico and /dev/null differ diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/Toolbar.bmp b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/Toolbar.bmp deleted file mode 100644 index d501723c1ce..00000000000 Binary files a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/Toolbar.bmp and /dev/null differ diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/winldap.ico b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/winldap.ico deleted file mode 100644 index 6cf11ea5d08..00000000000 Binary files a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/winldap.ico and /dev/null differ diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/winldap.rc2 b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/winldap.rc2 deleted file mode 100644 index e298e789cdb..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/res/winldap.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// WINLDAP.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.cpp b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.cpp deleted file mode 100644 index 51cef5af5dd..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.cpp +++ /dev/null @@ -1,299 +0,0 @@ -// winldap.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "ldap.h" -#include "winldap.h" - -#include "MainFrm.h" -#include "LdapDoc.h" -#include "LdapView.h" -#include "ConnDlg.h" -#include "SrchDlg.h" - -#ifdef _DEBUG -#ifdef _WIN32 -#define new DEBUG_NEW -#endif -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// LdapApp - -BEGIN_MESSAGE_MAP(LdapApp, CWinApp) - //{{AFX_MSG_MAP(LdapApp) - ON_COMMAND(ID_APP_ABOUT, OnAppAbout) - ON_COMMAND(ID_FILE_CONNECT, OnFileConnect) - ON_UPDATE_COMMAND_UI(ID_FILE_CONNECT, OnUpdateFileConnect) - ON_COMMAND(ID_FILE_DISCONNECT, OnFileDisconnect) - ON_UPDATE_COMMAND_UI(ID_FILE_DISCONNECT, OnUpdateFileDisconnect) - ON_COMMAND(ID_FILE_SEARCH, OnFileSearch) - ON_UPDATE_COMMAND_UI(ID_FILE_SEARCH, OnUpdateFileSearch) - //}}AFX_MSG_MAP - // Standard file based document commands - ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) - ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// LdapApp construction - -LdapApp::LdapApp() -{ - m_ld = NULL; - m_connected = FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only LdapApp object - -LdapApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// LdapApp initialization - -BOOL LdapApp::InitInstance() -{ - // Standard initialization -#ifdef _WIN32 -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif -#endif - - LoadStdProfileSettings(); // Load standard INI file options (including MRU) - - // Register document templates - - CSingleDocTemplate* pDocTemplate; - pDocTemplate = new CSingleDocTemplate( - IDR_MAINFRAME, - RUNTIME_CLASS(LdapDoc), - RUNTIME_CLASS(CMainFrame), // main SDI frame window - RUNTIME_CLASS(LdapView)); - AddDocTemplate(pDocTemplate); - -#ifdef _WIN32 - // Parse command line for standard shell commands, DDE, file open - CCommandLineInfo cmdInfo; - ParseCommandLine(cmdInfo); - - // Dispatch commands specified on the command line - if (!ProcessShellCommand(cmdInfo)) - return FALSE; -#else - // create a new (empty) document - OnFileNew(); - - if (m_lpCmdLine[0] != '\0') - { - } -#endif - - m_dirHost = GetProfileString( "Connection", "host", "localhost" ); - m_dirPort = GetProfileInt( "Connection", "port", 389 ); - m_searchBase = GetProfileString( "Search", "base", "dc=example,dc=com" ); - - m_scope = GetProfileInt( "Search", "scope", LDAP_SCOPE_SUBTREE ); - m_searchFilter = GetProfileString( "Search", "filter", "objectclass=*" ); - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About - -class CAboutDlg : public CDialog -{ -public: - CAboutDlg(); - -// Dialog Data - //{{AFX_DATA(CAboutDlg) - enum { IDD = IDD_ABOUTBOX }; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CAboutDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - //{{AFX_MSG(CAboutDlg) - // No message handlers - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ - //{{AFX_DATA_INIT(CAboutDlg) - //}}AFX_DATA_INIT -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CAboutDlg) - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) - //{{AFX_MSG_MAP(CAboutDlg) - // No message handlers - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -// App command to run the dialog -void LdapApp::OnAppAbout() -{ - CAboutDlg aboutDlg; - aboutDlg.DoModal(); -} - -///////////////////////////////////////////////////////////////////////////// -// LdapApp commands - -// Initialize an anonymous connection to a Directory Server -void LdapApp::OnFileConnect() -{ - ConnDlg dlg; - dlg.m_dirHost = m_dirHost; - dlg.m_dirPort = m_dirPort; - if ( IDOK == dlg.DoModal() ) - { - m_dirHost = dlg.m_dirHost; - m_dirPort = dlg.m_dirPort; - m_ld = ldap_init( m_dirHost, m_dirPort ); - if ( NULL != m_ld ) - { - // Bind as anonymous - if ( ldap_bind_s( m_ld, "", "", LDAP_AUTH_SIMPLE ) - != LDAP_SUCCESS ) - { - AfxMessageBox( "Error binding!" ); - return; - } - } - else - { - AfxMessageBox( "Error connecting!" ); - return; - } - m_connected = TRUE; - LdapView *view = (LdapView *)((CFrameWnd *)AfxGetMainWnd())->GetActiveView(); - if ( view ) - { - CString title; - title.Format( "Host %s, port %d", m_dirHost, m_dirPort ); - view->GetDocument()->SetTitle( title ); - } - } -} - -void LdapApp::OnUpdateFileConnect(CCmdUI* pCmdUI) -{ - pCmdUI->Enable( !IsConnected() ); -} - -// Disconnect (unbind from) a Directory Server -void LdapApp::OnFileDisconnect() -{ - ldap_unbind( m_ld ); - m_ld = NULL; - m_connected = FALSE; - LdapView *view = (LdapView *)((CFrameWnd *)AfxGetMainWnd())->GetActiveView(); - if ( view ) - { - view->GetDocument()->SetTitle( "" ); - } -} - -void LdapApp::OnUpdateFileDisconnect(CCmdUI* pCmdUI) -{ - pCmdUI->Enable( IsConnected() ); -} - -// Search for and report distinguished names (no attributes) -void LdapApp::OnFileSearch() -{ - SearchDlg dlg; - dlg.m_searchBase = m_searchBase; - dlg.SetScope( m_scope ); - dlg.m_searchFilter = m_searchFilter; - // Get desired search parameters - if ( IDOK == dlg.DoModal() ) - { - m_searchBase = dlg.m_searchBase; - m_searchFilter = dlg.m_searchFilter; - m_scope = dlg.GetScope(); - // Clear the result list - LdapView *view = (LdapView *)((CFrameWnd *)AfxGetMainWnd())->GetActiveView(); - if ( view ) - view->ClearLines(); - char *attrs[2]; - // "dn" is a pseudo-attribute; it is always returned anyway, but not as - // an attribute - attrs[0] = "dn"; - attrs[1] = NULL; - if ( ldap_search( m_ld, m_searchBase, m_scope, m_searchFilter, - attrs, FALSE ) == -1 ) - { - AfxMessageBox( "Failed to start asynchronous search" ); - return; - } - LDAPMessage *res; - int rc; - // Fetch all results as they become available - while ( (rc = ldap_result( m_ld, LDAP_RES_ANY, 0, NULL, &res )) - == LDAP_RES_SEARCH_ENTRY ) - { - LDAPMessage *e = ldap_first_entry( m_ld, res ); - // Get the distinguished name and show it - char *dn = ldap_get_dn( m_ld, e ); - if ( view ) - view->AddLine( dn, dn ); - ldap_memfree( dn ); - ldap_msgfree( res ); - // Let the view be updated -#ifdef _WIN32 - Sleep( 0 ); -#else - Yield(); -#endif - } - if ( rc == -1 ) - { - AfxMessageBox( "Error on ldap_result" ); - return; - } - else if (( rc = ldap_result2error( m_ld, res, 0 )) != LDAP_SUCCESS ) - { - char *errString = ldap_err2string( rc ); - AfxMessageBox( errString ); - } - ldap_msgfree( res ); - } -} - -void LdapApp::OnUpdateFileSearch(CCmdUI* pCmdUI) -{ - pCmdUI->Enable( IsConnected() ); -} - -int LdapApp::ExitInstance() -{ - WriteProfileString( "Connection", "host", m_dirHost ); - WriteProfileInt( "Connection", "port", m_dirPort ); - WriteProfileString( "Search", "base", m_searchBase ); - WriteProfileInt( "Search", "scope", m_scope ); - WriteProfileString( "Search", "filter", m_searchFilter ); - - return CWinApp::ExitInstance(); -} diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.h b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.h deleted file mode 100644 index a6a141e5b9f..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.h +++ /dev/null @@ -1,61 +0,0 @@ -// winldap.h : main header file for the WINLDAP application -// - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols - -#ifndef _LDAP_H -struct LDAP; -#endif - -///////////////////////////////////////////////////////////////////////////// -// LdapApp: -// See winldap.cpp for the implementation of this class -// - -class LdapApp : public CWinApp -{ -public: - LdapApp(); - -public: - BOOL IsConnected() { return m_connected; } - LDAP *GetConnection() { return m_ld; } - -private: - BOOL m_connected; - CString m_dirHost; - int m_dirPort; - CString m_searchBase; - CString m_searchFilter; - int m_scope; - LDAP *m_ld; - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(LdapApp) - public: - virtual BOOL InitInstance(); - virtual int ExitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(LdapApp) - afx_msg void OnAppAbout(); - afx_msg void OnFileConnect(); - afx_msg void OnUpdateFileConnect(CCmdUI* pCmdUI); - afx_msg void OnFileDisconnect(); - afx_msg void OnUpdateFileDisconnect(CCmdUI* pCmdUI); - afx_msg void OnFileSearch(); - afx_msg void OnUpdateFileSearch(CCmdUI* pCmdUI); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - - -///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.mak b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.mak deleted file mode 100644 index 01ec9f5e49c..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.mak +++ /dev/null @@ -1,404 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -!IF "$(CFG)" == "" -CFG=winldap - Win32 Debug -!MESSAGE No configuration specified. Defaulting to winldap - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "winldap - Win32 Release" && "$(CFG)" !=\ - "winldap - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE on this makefile -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "winldap.mak" CFG="winldap - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "winldap - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "winldap - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF -################################################################################ -# Begin Project -# PROP Target_Last_Scanned "winldap - Win32 Debug" -MTL=mktyplib.exe -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "winldap - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -OUTDIR=.\Release -INTDIR=.\Release - -ALL : "$(OUTDIR)\winldap.exe" - -CLEAN : - -@erase "$(INTDIR)\ConnDlg.obj" - -@erase "$(INTDIR)\LdapDoc.obj" - -@erase "$(INTDIR)\LdapView.obj" - -@erase "$(INTDIR)\MainFrm.obj" - -@erase "$(INTDIR)\PropDlg.obj" - -@erase "$(INTDIR)\SrchDlg.obj" - -@erase "$(INTDIR)\StdAfx.obj" - -@erase "$(INTDIR)\winldap.obj" - -@erase "$(INTDIR)\winldap.pch" - -@erase "$(INTDIR)\winldap.res" - -@erase "$(OUTDIR)\winldap.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c -CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ - "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/winldap.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/"\ - /c -CPP_OBJS=.\Release/ -CPP_SBRS=.\. -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /win32 -MTL_PROJ=/nologo /D "NDEBUG" /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -RSC_PROJ=/l 0x409 /fo"$(INTDIR)/winldap.res" /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/winldap.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 nsldapssl32v30.lib /nologo /subsystem:windows /machine:I386 -LINK32_FLAGS=nsldapssl32v30.lib /nologo /subsystem:windows /incremental:no\ - /pdb:"$(OUTDIR)/winldap.pdb" /machine:I386 /out:"$(OUTDIR)/winldap.exe" -LINK32_OBJS= \ - "$(INTDIR)\ConnDlg.obj" \ - "$(INTDIR)\LdapDoc.obj" \ - "$(INTDIR)\LdapView.obj" \ - "$(INTDIR)\MainFrm.obj" \ - "$(INTDIR)\PropDlg.obj" \ - "$(INTDIR)\SrchDlg.obj" \ - "$(INTDIR)\StdAfx.obj" \ - "$(INTDIR)\winldap.obj" \ - "$(INTDIR)\winldap.res" - -"$(OUTDIR)\winldap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "winldap - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -OUTDIR=.\Debug -INTDIR=.\Debug - -ALL : "$(OUTDIR)\winldap.exe" - -CLEAN : - -@erase "$(INTDIR)\ConnDlg.obj" - -@erase "$(INTDIR)\LdapDoc.obj" - -@erase "$(INTDIR)\LdapView.obj" - -@erase "$(INTDIR)\MainFrm.obj" - -@erase "$(INTDIR)\PropDlg.obj" - -@erase "$(INTDIR)\SrchDlg.obj" - -@erase "$(INTDIR)\StdAfx.obj" - -@erase "$(INTDIR)\vc40.idb" - -@erase "$(INTDIR)\vc40.pdb" - -@erase "$(INTDIR)\winldap.obj" - -@erase "$(INTDIR)\winldap.pch" - -@erase "$(INTDIR)\winldap.res" - -@erase "$(OUTDIR)\winldap.exe" - -@erase "$(OUTDIR)\winldap.ilk" - -@erase "$(OUTDIR)\winldap.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c -CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ - /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/winldap.pch" /Yu"stdafx.h"\ - /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c -CPP_OBJS=.\Debug/ -CPP_SBRS=.\. -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /win32 -MTL_PROJ=/nologo /D "_DEBUG" /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -RSC_PROJ=/l 0x409 /fo"$(INTDIR)/winldap.res" /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/winldap.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 -# ADD LINK32 nsldapssl32v30.lib /nologo /subsystem:windows /debug /machine:I386 -LINK32_FLAGS=nsldapssl32v30.lib /nologo /subsystem:windows /incremental:yes\ - /pdb:"$(OUTDIR)/winldap.pdb" /debug /machine:I386 /out:"$(OUTDIR)/winldap.exe" -LINK32_OBJS= \ - "$(INTDIR)\ConnDlg.obj" \ - "$(INTDIR)\LdapDoc.obj" \ - "$(INTDIR)\LdapView.obj" \ - "$(INTDIR)\MainFrm.obj" \ - "$(INTDIR)\PropDlg.obj" \ - "$(INTDIR)\SrchDlg.obj" \ - "$(INTDIR)\StdAfx.obj" \ - "$(INTDIR)\winldap.obj" \ - "$(INTDIR)\winldap.res" - -"$(OUTDIR)\winldap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -################################################################################ -# Begin Target - -# Name "winldap - Win32 Release" -# Name "winldap - Win32 Debug" - -!IF "$(CFG)" == "winldap - Win32 Release" - -!ELSEIF "$(CFG)" == "winldap - Win32 Debug" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE=.\winldap.cpp -DEP_CPP_WINLD=\ - ".\ConnDlg.h"\ - ".\LdapDoc.h"\ - ".\LdapView.h"\ - ".\MainFrm.h"\ - ".\SrchDlg.h"\ - ".\StdAfx.h"\ - ".\winldap.h"\ - "d:\projects\ldapsdk\include\lber.h"\ - {$(INCLUDE)}"\ldap.h"\ - {$(INCLUDE)}"\sys\time.h"\ - {$(INCLUDE)}"\sys\types.h"\ - - -"$(INTDIR)\winldap.obj" : $(SOURCE) $(DEP_CPP_WINLD) "$(INTDIR)"\ - "$(INTDIR)\winldap.pch" - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\StdAfx.cpp -DEP_CPP_STDAF=\ - ".\StdAfx.h"\ - - -!IF "$(CFG)" == "winldap - Win32 Release" - -# ADD CPP /Yc"stdafx.h" - -BuildCmds= \ - $(CPP) /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ - "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/winldap.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/"\ - /c $(SOURCE) \ - - -"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" - $(BuildCmds) - -"$(INTDIR)\winldap.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" - $(BuildCmds) - -!ELSEIF "$(CFG)" == "winldap - Win32 Debug" - -# ADD CPP /Yc"stdafx.h" - -BuildCmds= \ - $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ - /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/winldap.pch" /Yc"stdafx.h"\ - /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE) \ - - -"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" - $(BuildCmds) - -"$(INTDIR)\winldap.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" - $(BuildCmds) - -!ENDIF - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\MainFrm.cpp -DEP_CPP_MAINF=\ - ".\MainFrm.h"\ - ".\StdAfx.h"\ - ".\winldap.h"\ - - -"$(INTDIR)\MainFrm.obj" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\ - "$(INTDIR)\winldap.pch" - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\LdapDoc.cpp -DEP_CPP_LDAPD=\ - ".\LdapDoc.h"\ - ".\StdAfx.h"\ - ".\winldap.h"\ - - -"$(INTDIR)\LdapDoc.obj" : $(SOURCE) $(DEP_CPP_LDAPD) "$(INTDIR)"\ - "$(INTDIR)\winldap.pch" - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\LdapView.cpp -DEP_CPP_LDAPV=\ - ".\LdapDoc.h"\ - ".\LdapView.h"\ - ".\PropDlg.h"\ - ".\StdAfx.h"\ - ".\winldap.h"\ - "d:\projects\ldapsdk\include\lber.h"\ - {$(INCLUDE)}"\ldap.h"\ - {$(INCLUDE)}"\sys\time.h"\ - {$(INCLUDE)}"\sys\types.h"\ - - -"$(INTDIR)\LdapView.obj" : $(SOURCE) $(DEP_CPP_LDAPV) "$(INTDIR)"\ - "$(INTDIR)\winldap.pch" - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\winldap.rc -DEP_RSC_WINLDA=\ - ".\res\LdapDoc.ico"\ - ".\res\winldap.ico"\ - ".\res\winldap.rc2"\ - - -"$(INTDIR)\winldap.res" : $(SOURCE) $(DEP_RSC_WINLDA) "$(INTDIR)" - $(RSC) $(RSC_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\ConnDlg.cpp -DEP_CPP_CONND=\ - ".\ConnDlg.h"\ - ".\StdAfx.h"\ - ".\winldap.h"\ - - -"$(INTDIR)\ConnDlg.obj" : $(SOURCE) $(DEP_CPP_CONND) "$(INTDIR)"\ - "$(INTDIR)\winldap.pch" - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\SrchDlg.cpp -DEP_CPP_SRCHD=\ - ".\SrchDlg.h"\ - ".\StdAfx.h"\ - ".\winldap.h"\ - "d:\projects\ldapsdk\include\lber.h"\ - {$(INCLUDE)}"\ldap.h"\ - {$(INCLUDE)}"\sys\time.h"\ - {$(INCLUDE)}"\sys\types.h"\ - - -"$(INTDIR)\SrchDlg.obj" : $(SOURCE) $(DEP_CPP_SRCHD) "$(INTDIR)"\ - "$(INTDIR)\winldap.pch" - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\PropDlg.cpp -DEP_CPP_PROPD=\ - ".\PropDlg.h"\ - ".\StdAfx.h"\ - ".\winldap.h"\ - - -"$(INTDIR)\PropDlg.obj" : $(SOURCE) $(DEP_CPP_PROPD) "$(INTDIR)"\ - "$(INTDIR)\winldap.pch" - - -# End Source File -# End Target -# End Project -################################################################################ diff --git a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.rc b/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.rc deleted file mode 100644 index 32c686b00b0..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/windows/winldap/winldap.rc +++ /dev/null @@ -1,406 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif\r\n" - "#include ""res\\winldap.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\winldap.ico" -IDR_WINLDATYPE ICON DISCARDABLE "res\\LdapDoc.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAINFRAME MENU PRELOAD DISCARDABLE -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&Connect...\tCtrl+N", ID_FILE_CONNECT - MENUITEM "&Disconnect\tCtrl+D", ID_FILE_DISCONNECT - MENUITEM "&Search...\tCtrl+S", ID_FILE_SEARCH - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_APP_EXIT - END - POPUP "&View" - BEGIN - MENUITEM "&Toolbar", ID_VIEW_TOOLBAR - MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR - END - POPUP "&Help" - BEGIN - MENUITEM "&About winldap...", ID_APP_ABOUT - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE -BEGIN - "N", ID_FILE_NEW, VIRTKEY, CONTROL - "O", ID_FILE_OPEN, VIRTKEY, CONTROL - "S", ID_FILE_SAVE, VIRTKEY, CONTROL - "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL - "X", ID_EDIT_CUT, VIRTKEY, CONTROL - "C", ID_EDIT_COPY, VIRTKEY, CONTROL - "V", ID_EDIT_PASTE, VIRTKEY, CONTROL - VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT - VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT - VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL - VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT - VK_F6, ID_NEXT_PANE, VIRTKEY - VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 55 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About winldap" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,11,17,21,20 - LTEXT "WinLdap - sample LDAP client",IDC_STATIC,40,10,119,8, - SS_NOPREFIX - LTEXT "Copyright © 1997",IDC_STATIC,40,25,119,8 - DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP -END - -IDD_CONNECT_DIALOG DIALOG DISCARDABLE 0, 0, 186, 76 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Connect to Directory Server" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,35,55,50,14 - PUSHBUTTON "Cancel",IDCANCEL,103,55,50,14 - RTEXT "Host name:",IDC_STATIC,21,17,52,12 - EDITTEXT IDC_DIR_PORT,79,33,92,14,ES_AUTOHSCROLL - RTEXT "Port number:",IDC_STATIC,28,36,45,12 - EDITTEXT IDC_DIR_HOST,79,14,92,14,ES_AUTOHSCROLL -END - -IDD_SEARCH_DIALOG DIALOG DISCARDABLE 0, 0, 186, 103 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Search parameters" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,39,82,50,14 - PUSHBUTTON "Cancel",IDCANCEL,105,82,50,14 - RTEXT "Directory base:",IDC_STATIC,7,16,54,12 - EDITTEXT IDC_SEARCH_BASE,65,13,106,14,ES_AUTOHSCROLL - RTEXT "Search filter:",IDC_STATIC,10,34,51,12 - EDITTEXT IDC_SEARCH_FILTER,65,31,105,14,ES_AUTOHSCROLL - CONTROL "Base",IDC_SCOPE_BASE,"Button",BS_AUTORADIOBUTTON,23,60, - 32,10 - CONTROL "One level",IDC_SCOPE_ONE,"Button",BS_AUTORADIOBUTTON,69, - 60,46,10 - CONTROL "Subtree",IDC_SCOPE_SUB,"Button",BS_AUTORADIOBUTTON,121, - 60,41,10 - GROUPBOX "Scope",IDC_STATIC,13,49,159,24 -END - -IDD_ENTRY_PROPERTIES DIALOG DISCARDABLE 0, 0, 273, 202 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Properties" -FONT 8, "MS Sans Serif" -BEGIN -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "WINLDAP MFC Application\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "WINLDAP\0" - VALUE "LegalCopyright", "Copyright © 1997\0" - VALUE "OriginalFilename", "WINLDAP.EXE\0" - VALUE "ProductName", "WINLDAP Application\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 210 - TOPMARGIN, 7 - BOTTOMMARGIN, 48 - END - - IDD_CONNECT_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 69 - END - - IDD_SEARCH_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 96 - END - - IDD_ENTRY_PROPERTIES, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 266 - TOPMARGIN, 7 - BOTTOMMARGIN, 195 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - IDR_MAINFRAME "winldap\n\nWinlda\n\n\nWinldap.Document\nWinlda Document" -END - -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - AFX_IDS_APP_TITLE "winldap" - AFX_IDS_IDLEMESSAGE "Ready" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_INDICATOR_EXT "EXT" - ID_INDICATOR_CAPS "CAP" - ID_INDICATOR_NUM "NUM" - ID_INDICATOR_SCRL "SCRL" - ID_INDICATOR_OVR "OVR" - ID_INDICATOR_REC "REC" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_NEW "Create a new document\nNew" - ID_FILE_OPEN "Open an existing document\nOpen" - ID_FILE_CLOSE "Close the active document\nClose" - ID_FILE_SAVE "Save the active document\nSave" - ID_FILE_SAVE_AS "Save the active document with a new name\nSave As" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_APP_ABOUT "Display program information, version number and copyright\nAbout" - ID_APP_EXIT "Quit the application; prompts to save documents\nExit" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_MRU_FILE1 "Open this document" - ID_FILE_MRU_FILE2 "Open this document" - ID_FILE_MRU_FILE3 "Open this document" - ID_FILE_MRU_FILE4 "Open this document" - ID_FILE_MRU_FILE5 "Open this document" - ID_FILE_MRU_FILE6 "Open this document" - ID_FILE_MRU_FILE7 "Open this document" - ID_FILE_MRU_FILE8 "Open this document" - ID_FILE_MRU_FILE9 "Open this document" - ID_FILE_MRU_FILE10 "Open this document" - ID_FILE_MRU_FILE11 "Open this document" - ID_FILE_MRU_FILE12 "Open this document" - ID_FILE_MRU_FILE13 "Open this document" - ID_FILE_MRU_FILE14 "Open this document" - ID_FILE_MRU_FILE15 "Open this document" - ID_FILE_MRU_FILE16 "Open this document" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_NEXT_PANE "Switch to the next window pane\nNext Pane" - ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_WINDOW_SPLIT "Split the active window into panes\nSplit" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_EDIT_CLEAR "Erase the selection\nErase" - ID_EDIT_CLEAR_ALL "Erase everything\nErase All" - ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" - ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" - ID_EDIT_FIND "Find the specified text\nFind" - ID_EDIT_PASTE "Insert Clipboard contents\nPaste" - ID_EDIT_REPEAT "Repeat the last action\nRepeat" - ID_EDIT_REPLACE "Replace specific text with different text\nReplace" - ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" - ID_EDIT_UNDO "Undo the last action\nUndo" - ID_EDIT_REDO "Redo the previously undone action\nRedo" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" - ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar" -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_SCSIZE "Change the window size" - AFX_IDS_SCMOVE "Change the window position" - AFX_IDS_SCMINIMIZE "Reduce the window to an icon" - AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" - AFX_IDS_SCNEXTWINDOW "Switch to the next document window" - AFX_IDS_SCPREVWINDOW "Switch to the previous document window" - AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_SCRESTORE "Restore the window to normal size" - AFX_IDS_SCTASKLIST "Activate Task List" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_CONNECT "Connect to Directory Server" - ID_FILE_DISCONNECT "Disconnect from Directory Server" - ID_FILE_SEARCH "Search in Directory" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif -#include "res\winldap.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/mozilla/directory/c-sdk/ldap/examples/xmplflt.conf b/mozilla/directory/c-sdk/ldap/examples/xmplflt.conf deleted file mode 100644 index 3ebfb35387d..00000000000 --- a/mozilla/directory/c-sdk/ldap/examples/xmplflt.conf +++ /dev/null @@ -1,43 +0,0 @@ -# example ldap filter file -# -# lines like this that start with # or empty lines are ignored -# -# syntax: -# -# -# [] -# [] -# -# [] ... -# -# The "desc" should describe the filter and it should correctly complete -# both of the following phrases: -# -# One match was found for... -# Three matches were found for... -# -# The scope is optional, and should be one of: -# "base" -# "onelevel" -# "subtree" -# if it is included. -# - -"ldap-example" - "=" " " "%v" "arbitrary filter" - - "^[+]*[0-9][ 0-9-]*$" " " "(telephoneNumber=*%v)" "phone number" - - "@" " " "(mail=%v)" "email address" - "(mail=%v*)" "start of email address" - - "^.[. _].*" ". _" "(cn=%v1* %v2-)" "first initial" - - ".*[. _].$" ". _" "(cn=%v1-*)" "last initial" - - "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact" - "(|(sn~=%v1-)(cn~=%v1-))" "approximate" - - ".*" ". " "(|(cn=%v1)(sn=%v1)(uid=%v1))" "exact" - "(|(cn~=%v1)(sn~=%v1))" "approximate" - diff --git a/mozilla/directory/c-sdk/ldap/include/MANIFEST b/mozilla/directory/c-sdk/ldap/include/MANIFEST deleted file mode 100644 index 3e327684d5d..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/MANIFEST +++ /dev/null @@ -1,4 +0,0 @@ -disptmpl.h -lber.h -ldap.h -srchpref.h diff --git a/mozilla/directory/c-sdk/ldap/include/Makefile.client b/mozilla/directory/c-sdk/ldap/include/Makefile.client deleted file mode 100644 index 8495f630d5f..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/Makefile.client +++ /dev/null @@ -1,96 +0,0 @@ -# -# 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 = ../.. -XPDIST = ../../../../dist - -CHMOD = chmod -RM = rm -f -SED = sed - -HEADERS = \ - disptmpl.h \ - lber.h \ - ldap.h \ - ldap-extension.h \ - ldap-platform.h \ - ldap-to-be-deprecated.h \ - ldap-deprecated.h \ - ldap_ssl.h \ - ldappr.h \ - iutil.h \ - srchpref.h \ - $(NULL) - -PRIVATEHEADERS = \ - ../libraries/libldap/ldap-int.h \ - ../libraries/liblber/lber-int.h \ - portable.h \ - ldaprot.h \ - ldaplog.h \ - $(NULL) - -GENERATED_HEADERS = ldap-standard.h - -include $(NSPR_TREE)/config/rules.mk -include ../../build.mk - -ETCDIR = $(DIST)/etc -INCLUDEDIR = $(XPDIST)/public/ldap -PRIVATEINCDIR = $(XPDIST)/public/ldap-private -DELHEADERS = $(addprefix $(INCLUDEDIR)/, $(HEADERS)) -GENHEADERS = $(addprefix $(INCLUDEDIR)/, $(GENERATED_HEADERS)) - -ifeq ($(OS_ARCH), WINNT) -# Is this correct? -DIRVER_PATH = $(DEPTH)/netsite/ldap/build -else -DIRVER_PATH = ../$(DIST)/bin -endif - -DIRVER_PROG = $(DIRVER_PATH)/dirver$(BIN_SUFFIX) - - -########################################################################### - -all export:: $(INCLUDEDIR) $(GENHEADERS) - $(NSINSTALL) -D $(PRIVATEINCDIR) - $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR) - $(INSTALL) $(INSTALLFLAGS) -m 644 $(PRIVATEHEADERS) $(PRIVATEINCDIR) - -$(INCLUDEDIR): FORCE - $(NSINSTALL) -D $(INCLUDEDIR) - -$(INCLUDEDIR)/ldap-standard.h: ldap-standard-tmpl.h - perl ../build/replace.pl \ - LDAP_VENDOR_NAME="$(VENDOR_NAME)" \ - LDAP_VENDOR_VERSION="$(VENDOR_VERSION)" \ - < $< > $@ - -install:: export - -clean:: FORCE - -$(RM) $(GENHEADERS) - -FORCE: diff --git a/mozilla/directory/c-sdk/ldap/include/Makefile.in b/mozilla/directory/c-sdk/ldap/include/Makefile.in deleted file mode 100644 index 563308373a5..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/Makefile.in +++ /dev/null @@ -1,51 +0,0 @@ -DEPTH = ../../../.. -srcdir = @srcdir@ -ldaptopsrcdir = @top_srcdir@ - -CHMOD = chmod -RM = rm -f -SED = sed - -HEADERS = \ - disptmpl.h \ - lber.h \ - ldap.h \ - srchpref.h \ - $(NULL) -HEADERS := $(addprefix $(srcdir)/, $(HEADERS)) - -include ../build/autoconf.mk -include $(NSPR_TREE)/config/rules.mk - -GARBAGE += sdkver.h dirver.h - -ETCDIR = $(DIST)/etc - -DIR_VERSION := 2.0 -DIRSDK_VERSION := 1.0 - -ifeq ($(OS_ARCH), WINNT) -# Is this correct? -DIRVER_PATH = $(DEPTH)/netsite/ldap/build -else -DIRVER_PATH = $(DIST)/bin -endif - -DIRVER_PROG = $(DIRVER_PATH)/dirver$(BIN_SUFFIX) - -########################################################################### - -all export:: sdkver.h dirver.h FORCE - $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(DIST)/include - -sdkver.h: $(DIRVER_PROG) - @$< $(DIRSDK_VERSION) UseSystemDate $@ - -dirver.h: $(DIRVER_PROG) - @$< $(DIR_VERSION) UseSystemDate $@ - -install:: export - -clean:: - -FORCE: diff --git a/mozilla/directory/c-sdk/ldap/include/avl.h b/mozilla/directory/c-sdk/ldap/include/avl.h deleted file mode 100755 index a73ae31bee3..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/avl.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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): - */ - -/* avl.h - avl tree definitions */ -/* - * Copyright (c) 1993 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - - -#ifndef _AVL -#define _AVL - -/* - * this structure represents a generic avl tree node. - */ - -typedef struct avlnode { - caddr_t avl_data; - signed char avl_bf; - struct avlnode *avl_left; - struct avlnode *avl_right; -} Avlnode; - -#define NULLAVL ((Avlnode *) NULL) - -/* balance factor values */ -#define LH -1 -#define EH 0 -#define RH 1 - -/* avl routines */ -#define avl_getone(x) (x == 0 ? 0 : (x)->avl_data) -#define avl_onenode(x) (x == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0)) -extern int avl_insert(); -extern caddr_t avl_delete(); -extern caddr_t avl_find(); -extern caddr_t avl_getfirst(); -extern caddr_t avl_getnext(); -extern int avl_dup_error(); -extern int avl_apply(); -extern int avl_free(); - -/* apply traversal types */ -#define AVL_PREORDER 1 -#define AVL_INORDER 2 -#define AVL_POSTORDER 3 -/* what apply returns if it ran out of nodes */ -#define AVL_NOMORE -6 - -#ifndef _IFP -#define _IFP -typedef int (*IFP)(); -#endif - -caddr_t avl_find_lin( Avlnode *root, caddr_t data, IFP fcmp ); - -#endif /* _AVL */ diff --git a/mozilla/directory/c-sdk/ldap/include/dblayer.h b/mozilla/directory/c-sdk/ldap/include/dblayer.h deleted file mode 100755 index bff23c5194d..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/dblayer.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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): - */ - -/* This file is no longer used */ diff --git a/mozilla/directory/c-sdk/ldap/include/disptmpl.h b/mozilla/directory/c-sdk/ldap/include/disptmpl.h deleted file mode 100644 index b1ef6d73a6d..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/disptmpl.h +++ /dev/null @@ -1,364 +0,0 @@ -/* - * 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) 1993, 1994 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - * - * disptmpl.h: display template library defines - */ - -#ifndef _DISPTMPL_H -#define _DISPTMPL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* calling conventions used by library */ -#ifndef LDAP_CALL -#if defined( _WINDOWS ) || defined( _WIN32 ) -#define LDAP_C __cdecl -#ifndef _WIN32 -#define __stdcall _far _pascal -#define LDAP_CALLBACK _loadds -#else -#define LDAP_CALLBACK -#endif /* _WIN32 */ -#define LDAP_PASCAL __stdcall -#define LDAP_CALL LDAP_PASCAL -#else /* _WINDOWS */ -#define LDAP_C -#define LDAP_CALLBACK -#define LDAP_PASCAL -#define LDAP_CALL -#endif /* _WINDOWS */ -#endif /* LDAP_CALL */ - -#define LDAP_TEMPLATE_VERSION 1 - -/* - * general types of items (confined to most significant byte) - */ -#define LDAP_SYN_TYPE_TEXT 0x01000000L -#define LDAP_SYN_TYPE_IMAGE 0x02000000L -#define LDAP_SYN_TYPE_BOOLEAN 0x04000000L -#define LDAP_SYN_TYPE_BUTTON 0x08000000L -#define LDAP_SYN_TYPE_ACTION 0x10000000L - - -/* - * syntax options (confined to second most significant byte) - */ -#define LDAP_SYN_OPT_DEFER 0x00010000L - - -/* - * display template item syntax ids (defined by common agreement) - * these are the valid values for the ti_syntaxid of the tmplitem - * struct (defined below). A general type is encoded in the - * most-significant 8 bits, and some options are encoded in the next - * 8 bits. The lower 16 bits are reserved for the distinct types. - */ -#define LDAP_SYN_CASEIGNORESTR ( 1 | LDAP_SYN_TYPE_TEXT ) -#define LDAP_SYN_MULTILINESTR ( 2 | LDAP_SYN_TYPE_TEXT ) -#define LDAP_SYN_DN ( 3 | LDAP_SYN_TYPE_TEXT ) -#define LDAP_SYN_BOOLEAN ( 4 | LDAP_SYN_TYPE_BOOLEAN ) -#define LDAP_SYN_JPEGIMAGE ( 5 | LDAP_SYN_TYPE_IMAGE ) -#define LDAP_SYN_JPEGBUTTON ( 6 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER ) -#define LDAP_SYN_FAXIMAGE ( 7 | LDAP_SYN_TYPE_IMAGE ) -#define LDAP_SYN_FAXBUTTON ( 8 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER ) -#define LDAP_SYN_AUDIOBUTTON ( 9 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER ) -#define LDAP_SYN_TIME ( 10 | LDAP_SYN_TYPE_TEXT ) -#define LDAP_SYN_DATE ( 11 | LDAP_SYN_TYPE_TEXT ) -#define LDAP_SYN_LABELEDURL ( 12 | LDAP_SYN_TYPE_TEXT ) -#define LDAP_SYN_SEARCHACTION ( 13 | LDAP_SYN_TYPE_ACTION ) -#define LDAP_SYN_LINKACTION ( 14 | LDAP_SYN_TYPE_ACTION ) -#define LDAP_SYN_ADDDNACTION ( 15 | LDAP_SYN_TYPE_ACTION ) -#define LDAP_SYN_VERIFYDNACTION ( 16 | LDAP_SYN_TYPE_ACTION ) -#define LDAP_SYN_RFC822ADDR ( 17 | LDAP_SYN_TYPE_TEXT ) - - -/* - * handy macros - */ -#define LDAP_GET_SYN_TYPE( syid ) ((syid) & 0xFF000000UL ) -#define LDAP_GET_SYN_OPTIONS( syid ) ((syid) & 0x00FF0000UL ) - - -/* - * display options for output routines (used by entry2text and friends) - */ -/* - * use calculated label width (based on length of longest label in - * template) instead of contant width - */ -#define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001L -#define LDAP_DISP_OPT_HTMLBODYONLY 0x00000002L - -/* - * perform search actions (applies to ldap_entry2text_search only) - */ -#define LDAP_DISP_OPT_DOSEARCHACTIONS 0x00000002L - -/* - * include additional info. relevant to "non leaf" entries only - * used by ldap_entry2html and ldap_entry2html_search to include "Browse" - * and "Move Up" HREFs - */ -#define LDAP_DISP_OPT_NONLEAF 0x00000004L - - -/* - * display template item options (may not apply to all types) - * if this bit is set in ti_options, it applies. - */ -#define LDAP_DITEM_OPT_READONLY 0x00000001L -#define LDAP_DITEM_OPT_SORTVALUES 0x00000002L -#define LDAP_DITEM_OPT_SINGLEVALUED 0x00000004L -#define LDAP_DITEM_OPT_HIDEIFEMPTY 0x00000008L -#define LDAP_DITEM_OPT_VALUEREQUIRED 0x00000010L -#define LDAP_DITEM_OPT_HIDEIFFALSE 0x00000020L /* booleans only */ - - - -/* - * display template item structure - */ -struct ldap_tmplitem { - unsigned long ti_syntaxid; - unsigned long ti_options; - char *ti_attrname; - char *ti_label; - char **ti_args; - struct ldap_tmplitem *ti_next_in_row; - struct ldap_tmplitem *ti_next_in_col; - void *ti_appdata; -}; - - -#define NULLTMPLITEM ((struct ldap_tmplitem *)0) - -#define LDAP_SET_TMPLITEM_APPDATA( ti, datap ) \ - (ti)->ti_appdata = (void *)(datap) - -#define LDAP_GET_TMPLITEM_APPDATA( ti, type ) \ - (type)((ti)->ti_appdata) - -#define LDAP_IS_TMPLITEM_OPTION_SET( ti, option ) \ - (((ti)->ti_options & option ) != 0 ) - - -/* - * object class array structure - */ -struct ldap_oclist { - char **oc_objclasses; - struct ldap_oclist *oc_next; -}; - -#define NULLOCLIST ((struct ldap_oclist *)0) - - -/* - * add defaults list - */ -struct ldap_adddeflist { - int ad_source; -#define LDAP_ADSRC_CONSTANTVALUE 1 -#define LDAP_ADSRC_ADDERSDN 2 - char *ad_attrname; - char *ad_value; - struct ldap_adddeflist *ad_next; -}; - -#define NULLADLIST ((struct ldap_adddeflist *)0) - - -/* - * display template global options - * if this bit is set in dt_options, it applies. - */ -/* - * users should be allowed to try to add objects of these entries - */ -#define LDAP_DTMPL_OPT_ADDABLE 0x00000001L - -/* - * users should be allowed to do "modify RDN" operation of these entries - */ -#define LDAP_DTMPL_OPT_ALLOWMODRDN 0x00000002L - -/* - * this template is an alternate view, not a primary view - */ -#define LDAP_DTMPL_OPT_ALTVIEW 0x00000004L - - -/* - * display template structure - */ -struct ldap_disptmpl { - char *dt_name; - char *dt_pluralname; - char *dt_iconname; - unsigned long dt_options; - char *dt_authattrname; - char *dt_defrdnattrname; - char *dt_defaddlocation; - struct ldap_oclist *dt_oclist; - struct ldap_adddeflist *dt_adddeflist; - struct ldap_tmplitem *dt_items; - void *dt_appdata; - struct ldap_disptmpl *dt_next; -}; - -#define NULLDISPTMPL ((struct ldap_disptmpl *)0) - -#define LDAP_SET_DISPTMPL_APPDATA( dt, datap ) \ - (dt)->dt_appdata = (void *)(datap) - -#define LDAP_GET_DISPTMPL_APPDATA( dt, type ) \ - (type)((dt)->dt_appdata) - -#define LDAP_IS_DISPTMPL_OPTION_SET( dt, option ) \ - (((dt)->dt_options & option ) != 0 ) - -#define LDAP_TMPL_ERR_VERSION 1 -#define LDAP_TMPL_ERR_MEM 2 -#define LDAP_TMPL_ERR_SYNTAX 3 -#define LDAP_TMPL_ERR_FILE 4 - -/* - * buffer size needed for entry2text and vals2text - */ -#define LDAP_DTMPL_BUFSIZ 8192 - -typedef int (*writeptype)( void *writeparm, char *p, int len ); - -LDAP_API(int) -LDAP_CALL -ldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp ); - -LDAP_API(int) -LDAP_CALL -ldap_init_templates_buf( char *buf, long buflen, - struct ldap_disptmpl **tmpllistp ); - -LDAP_API(void) -LDAP_CALL -ldap_free_templates( struct ldap_disptmpl *tmpllist ); - -LDAP_API(struct ldap_disptmpl *) -LDAP_CALL -ldap_first_disptmpl( struct ldap_disptmpl *tmpllist ); - -LDAP_API(struct ldap_disptmpl *) -LDAP_CALL -ldap_next_disptmpl( struct ldap_disptmpl *tmpllist, - struct ldap_disptmpl *tmpl ); - -LDAP_API(struct ldap_disptmpl *) -LDAP_CALL -ldap_name2template( char *name, struct ldap_disptmpl *tmpllist ); - -LDAP_API(struct ldap_disptmpl *) -LDAP_CALL -ldap_oc2template( char **oclist, struct ldap_disptmpl *tmpllist ); - -LDAP_API(char **) -LDAP_CALL -ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, int exclude, - unsigned long syntaxmask ); - -LDAP_API(struct ldap_tmplitem *) -LDAP_CALL -ldap_first_tmplrow( struct ldap_disptmpl *tmpl ); - -LDAP_API(struct ldap_tmplitem *) -LDAP_CALL -ldap_next_tmplrow( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row ); - -LDAP_API(struct ldap_tmplitem *) -LDAP_CALL -ldap_first_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row ); - -LDAP_API(struct ldap_tmplitem *) -LDAP_CALL -ldap_next_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row, - struct ldap_tmplitem *col ); - -LDAP_API(int) -LDAP_CALL -ldap_entry2text( LDAP *ld, char *buf, LDAPMessage *entry, - struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, - writeptype writeproc, void *writeparm, char *eol, int rdncount, - unsigned long opts ); - -LDAP_API(int) -LDAP_CALL -ldap_vals2text( LDAP *ld, char *buf, char **vals, char *label, int labelwidth, - unsigned long syntaxid, writeptype writeproc, void *writeparm, - char *eol, int rdncount ); - -LDAP_API(int) -LDAP_CALL -ldap_entry2text_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry, - struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, - writeptype writeproc, void *writeparm, char *eol, int rdncount, - unsigned long opts ); - -LDAP_API(int) -LDAP_CALL -ldap_entry2html( LDAP *ld, char *buf, LDAPMessage *entry, - struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, - writeptype writeproc, void *writeparm, char *eol, int rdncount, - unsigned long opts, char *urlprefix, char *base ); - -LDAP_API(int) -LDAP_CALL -ldap_vals2html( LDAP *ld, char *buf, char **vals, char *label, int labelwidth, - unsigned long syntaxid, writeptype writeproc, void *writeparm, - char *eol, int rdncount, char *urlprefix ); - -LDAP_API(int) -LDAP_CALL -ldap_entry2html_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry, - struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, - writeptype writeproc, void *writeparm, char *eol, int rdncount, - unsigned long opts, char *urlprefix ); - -LDAP_API(char *) -LDAP_CALL -ldap_tmplerr2string( int err ); - -#ifdef __cplusplus -} -#endif -#endif /* _DISPTMPL_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/iutil.h b/mozilla/directory/c-sdk/ldap/include/iutil.h deleted file mode 100644 index 69b5432359a..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/iutil.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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): - */ - -/* - * Interface for libiutil the innosoft migration library - * - */ - -#ifndef _IUTIL_H -#define _IUTIL_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* from iutil-lock.c */ - -#ifdef _WINDOWS -#define LDAP_MUTEX_T HANDLE - -extern char *ldap_strdup(); -extern unsigned char *ldap_utf8_nextchar(); -extern char **ldap_explode_ava(); -extern int ldap_utf8_toupper(); - -int pthread_mutex_init( LDAP_MUTEX_T *mp, void *attr); -static void * pthread_mutex_alloc( void ); -int pthread_mutex_destroy( LDAP_MUTEX_T *mp ); -static void pthread_mutex_free( void *mutexp ); -int pthread_mutex_lock( LDAP_MUTEX_T *mp ); -int pthread_mutex_unlock( LDAP_MUTEX_T *mp ); - -#endif /* _WINDOWS */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* _IUTIL_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/lber.h b/mozilla/directory/c-sdk/ldap/include/lber.h deleted file mode 100644 index fb24507d70d..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/lber.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - * 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): - */ -/* lber.h - header file for ber_* functions */ -#ifndef _LBER_H -#define _LBER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include /* to pick up size_t typedef */ - -/* - * Note that LBER_ERROR and LBER_DEFAULT are values that can never appear - * as valid BER tags, and so it is safe to use them to report errors. In - * fact, any tag for which the following is true is invalid: - * (( tag & 0x00000080 ) != 0 ) && (( tag & 0xFFFFFF00 ) != 0 ) - */ -#define LBER_ERROR 0xffffffffUL -#define LBER_DEFAULT 0xffffffffUL -#define LBER_END_OF_SEQORSET 0xfffffffeUL - -/* BER classes and mask */ -#define LBER_CLASS_UNIVERSAL 0x00 -#define LBER_CLASS_APPLICATION 0x40 -#define LBER_CLASS_CONTEXT 0x80 -#define LBER_CLASS_PRIVATE 0xc0 -#define LBER_CLASS_MASK 0xc0 - -/* BER encoding type and mask */ -#define LBER_PRIMITIVE 0x00 -#define LBER_CONSTRUCTED 0x20 -#define LBER_ENCODING_MASK 0x20 - -#define LBER_BIG_TAG_MASK 0x1f -#define LBER_MORE_TAG_MASK 0x80 - -/* general BER types we know about */ -#define LBER_BOOLEAN 0x01L -#define LBER_INTEGER 0x02L -#define LBER_BITSTRING 0x03L -#define LBER_OCTETSTRING 0x04L -#define LBER_NULL 0x05L -#define LBER_ENUMERATED 0x0aL -#define LBER_SEQUENCE 0x30L -#define LBER_SET 0x31L - -/* BerElement set/get options */ -#define LBER_OPT_REMAINING_BYTES 0x01 -#define LBER_OPT_TOTAL_BYTES 0x02 -#define LBER_OPT_USE_DER 0x04 -#define LBER_OPT_TRANSLATE_STRINGS 0x08 -#define LBER_OPT_BYTES_TO_WRITE 0x10 -#define LBER_OPT_MEMALLOC_FN_PTRS 0x20 -#define LBER_OPT_DEBUG_LEVEL 0x40 -/* - * LBER_USE_DER is defined for compatibility with the C LDAP API RFC. - * In our implementation, we recognize it (instead of the numerically - * identical LBER_OPT_REMAINING_BYTES) in calls to ber_alloc_t() and - * ber_init_w_nullchar() only. Callers of ber_set_option() or - * ber_get_option() must use LBER_OPT_USE_DER instead. Sorry! - */ -#define LBER_USE_DER 0x01 - - -/* Sockbuf set/get options */ -#define LBER_SOCKBUF_OPT_TO_FILE 0x001 -#define LBER_SOCKBUF_OPT_TO_FILE_ONLY 0x002 -#define LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE 0x004 -#define LBER_SOCKBUF_OPT_NO_READ_AHEAD 0x008 -#define LBER_SOCKBUF_OPT_DESC 0x010 -#define LBER_SOCKBUF_OPT_COPYDESC 0x020 -#define LBER_SOCKBUF_OPT_READ_FN 0x040 -#define LBER_SOCKBUF_OPT_WRITE_FN 0x080 -#define LBER_SOCKBUF_OPT_EXT_IO_FNS 0x100 -#define LBER_SOCKBUF_OPT_VALID_TAG 0x200 - -#define LBER_OPT_ON ((void *) 1) -#define LBER_OPT_OFF ((void *) 0) - - -typedef struct berval { - unsigned long bv_len; - char *bv_val; -} BerValue; - -typedef struct berelement BerElement; -typedef struct sockbuf Sockbuf; -typedef int (*BERTranslateProc)( char **bufp, unsigned long *buflenp, - int free_input ); -#ifndef macintosh -#if defined( _WINDOWS ) || defined( _WIN32) || defined( _CONSOLE ) -#include /* for SOCKET */ -typedef SOCKET LBER_SOCKET; -#else -typedef int LBER_SOCKET; -#endif /* _WINDOWS */ -#else /* macintosh */ -typedef void *LBER_SOCKET; -#endif /* macintosh */ - -/* calling conventions used by library */ -#ifndef LDAP_CALL -#if defined( _WINDOWS ) || defined( _WIN32 ) -#define LDAP_C __cdecl -#ifndef _WIN32 -#define __stdcall _far _pascal -#define LDAP_CALLBACK _loadds -#else -#define LDAP_CALLBACK -#endif /* _WIN32 */ -#define LDAP_PASCAL __stdcall -#define LDAP_CALL LDAP_PASCAL -#else /* _WINDOWS */ -#define LDAP_C -#define LDAP_CALLBACK -#define LDAP_PASCAL -#define LDAP_CALL -#endif /* _WINDOWS */ -#endif /* LDAP_CALL */ - -/* - * function prototypes for lber library - */ - -#ifndef LDAP_API -#if defined( _WINDOWS ) || defined( _WIN32 ) -#define LDAP_API(rt) rt -#else /* _WINDOWS */ -#define LDAP_API(rt) rt -#endif /* _WINDOWS */ -#endif /* LDAP_API */ - -struct lextiof_socket_private; /* Defined by the extended I/O */ - /* callback functions */ -struct lextiof_session_private; /* Defined by the extended I/O */ - /* callback functions */ - -/* This is modeled after the PRIOVec that is passed to the NSPR - writev function! The void* is a char* in that struct */ -typedef struct ldap_x_iovec { - char *ldapiov_base; - int ldapiov_len; -} ldap_x_iovec; - -/* - * libldap read and write I/O function callbacks. The rest of the I/O callback - * types are defined in ldap.h - */ -typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_READ_CALLBACK)( LBER_SOCKET s, - void *buf, int bufsize ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_WRITE_CALLBACK)( LBER_SOCKET s, - const void *buf, int len ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_READ_CALLBACK)( int s, - void *buf, int bufsize, struct lextiof_socket_private *socketarg ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_WRITE_CALLBACK)( int s, - const void *buf, int len, struct lextiof_socket_private *socketarg ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_WRITEV_CALLBACK)(int s, - const ldap_x_iovec iov[], int iovcnt, struct lextiof_socket_private *socketarg); - - -/* - * Structure for use with LBER_SOCKBUF_OPT_EXT_IO_FNS: - */ -struct lber_x_ext_io_fns { - /* lbextiofn_size should always be set to LBER_X_EXTIO_FNS_SIZE */ - int lbextiofn_size; - LDAP_X_EXTIOF_READ_CALLBACK *lbextiofn_read; - LDAP_X_EXTIOF_WRITE_CALLBACK *lbextiofn_write; - struct lextiof_socket_private *lbextiofn_socket_arg; - LDAP_X_EXTIOF_WRITEV_CALLBACK *lbextiofn_writev; -}; -#define LBER_X_EXTIO_FNS_SIZE sizeof(struct lber_x_ext_io_fns) - -/* - * liblber memory allocation callback functions. These are global to all - * Sockbufs and BerElements. Install your own functions by using a call - * like this: ber_set_option( NULL, LBER_OPT_MEMALLOC_FN_PTRS, &memalloc_fns ); - */ -typedef void * (LDAP_C LDAP_CALLBACK LDAP_MALLOC_CALLBACK)( size_t size ); -typedef void * (LDAP_C LDAP_CALLBACK LDAP_CALLOC_CALLBACK)( size_t nelem, - size_t elsize ); -typedef void * (LDAP_C LDAP_CALLBACK LDAP_REALLOC_CALLBACK)( void *ptr, - size_t size ); -typedef void (LDAP_C LDAP_CALLBACK LDAP_FREE_CALLBACK)( void *ptr ); - -struct lber_memalloc_fns { - LDAP_MALLOC_CALLBACK *lbermem_malloc; - LDAP_CALLOC_CALLBACK *lbermem_calloc; - LDAP_REALLOC_CALLBACK *lbermem_realloc; - LDAP_FREE_CALLBACK *lbermem_free; -}; - -/* - * decode routines - */ -LDAP_API(unsigned long) LDAP_CALL ber_get_tag( BerElement *ber ); -LDAP_API(unsigned long) LDAP_CALL ber_skip_tag( BerElement *ber, - unsigned long *len ); -LDAP_API(unsigned long) LDAP_CALL ber_peek_tag( BerElement *ber, - unsigned long *len ); -LDAP_API(unsigned long) LDAP_CALL ber_get_int( BerElement *ber, long *num ); -LDAP_API(unsigned long) LDAP_CALL ber_get_stringb( BerElement *ber, char *buf, - unsigned long *len ); -LDAP_API(unsigned long) LDAP_CALL ber_get_stringa( BerElement *ber, - char **buf ); -LDAP_API(unsigned long) LDAP_CALL ber_get_stringal( BerElement *ber, - struct berval **bv ); -LDAP_API(unsigned long) LDAP_CALL ber_get_bitstringa( BerElement *ber, - char **buf, unsigned long *len ); -LDAP_API(unsigned long) LDAP_CALL ber_get_null( BerElement *ber ); -LDAP_API(unsigned long) LDAP_CALL ber_get_boolean( BerElement *ber, - int *boolval ); -LDAP_API(unsigned long) LDAP_CALL ber_first_element( BerElement *ber, - unsigned long *len, char **last ); -LDAP_API(unsigned long) LDAP_CALL ber_next_element( BerElement *ber, - unsigned long *len, char *last ); -LDAP_API(unsigned long) LDAP_C ber_scanf( BerElement *ber, const char *fmt, - ... ); -LDAP_API(void) LDAP_CALL ber_bvfree( struct berval *bv ); -LDAP_API(void) LDAP_CALL ber_bvecfree( struct berval **bv ); -LDAP_API(void) LDAP_CALL ber_svecfree( char **vals ); -LDAP_API(struct berval *) LDAP_CALL ber_bvdup( const struct berval *bv ); -LDAP_API(void) LDAP_CALL ber_set_string_translators( BerElement *ber, - BERTranslateProc encode_proc, BERTranslateProc decode_proc ); -LDAP_API(BerElement *) LDAP_CALL ber_init( const struct berval *bv ); - -/* - * encoding routines - */ -LDAP_API(int) LDAP_CALL ber_put_enum( BerElement *ber, long num, - unsigned long tag ); -LDAP_API(int) LDAP_CALL ber_put_int( BerElement *ber, long num, - unsigned long tag ); -LDAP_API(int) LDAP_CALL ber_put_ostring( BerElement *ber, char *str, - unsigned long len, unsigned long tag ); -LDAP_API(int) LDAP_CALL ber_put_string( BerElement *ber, char *str, - unsigned long tag ); -LDAP_API(int) LDAP_CALL ber_put_bitstring( BerElement *ber, char *str, - unsigned long bitlen, unsigned long tag ); -LDAP_API(int) LDAP_CALL ber_put_null( BerElement *ber, unsigned long tag ); -LDAP_API(int) LDAP_CALL ber_put_boolean( BerElement *ber, int boolval, - unsigned long tag ); -LDAP_API(int) LDAP_CALL ber_start_seq( BerElement *ber, unsigned long tag ); -LDAP_API(int) LDAP_CALL ber_start_set( BerElement *ber, unsigned long tag ); -LDAP_API(int) LDAP_CALL ber_put_seq( BerElement *ber ); -LDAP_API(int) LDAP_CALL ber_put_set( BerElement *ber ); -LDAP_API(int) LDAP_C ber_printf( BerElement *ber, const char *fmt, ... ); -LDAP_API(int) LDAP_CALL ber_flatten( BerElement *ber, - struct berval **bvPtr ); - -/* - * miscellaneous routines - */ -LDAP_API(void) LDAP_CALL ber_free( BerElement *ber, int freebuf ); -LDAP_API(void) LDAP_CALL ber_special_free(void* buf, BerElement *ber); -LDAP_API(int) LDAP_CALL ber_flush( Sockbuf *sb, BerElement *ber, int freeit ); -LDAP_API(BerElement*) LDAP_CALL ber_alloc( void ); -LDAP_API(BerElement*) LDAP_CALL der_alloc( void ); -LDAP_API(BerElement*) LDAP_CALL ber_alloc_t( int options ); -LDAP_API(void*) LDAP_CALL ber_special_alloc(size_t size, BerElement **ppBer); -LDAP_API(BerElement*) LDAP_CALL ber_dup( BerElement *ber ); -LDAP_API(unsigned long) LDAP_CALL ber_get_next( Sockbuf *sb, unsigned long *len, - BerElement *ber ); -LDAP_API(unsigned long) LDAP_CALL ber_get_next_buffer( void *buffer, - size_t buffer_size, unsigned long *len, BerElement *ber, - unsigned long *Bytes_Scanned ); -LDAP_API(unsigned long) LDAP_CALL ber_get_next_buffer_ext( void *buffer, - size_t buffer_size, unsigned long *len, BerElement *ber, - unsigned long *Bytes_Scanned, Sockbuf *sb ); -LDAP_API(long) LDAP_CALL ber_read( BerElement *ber, char *buf, - unsigned long len ); -LDAP_API(long) LDAP_CALL ber_write( BerElement *ber, char *buf, - unsigned long len, int nosos ); -LDAP_API(void) LDAP_CALL ber_init_w_nullchar( BerElement *ber, int options ); -LDAP_API(void) LDAP_CALL ber_reset( BerElement *ber, int was_writing ); -LDAP_API(int) LDAP_CALL ber_set_option( BerElement *ber, int option, - void *value ); -LDAP_API(int) LDAP_CALL ber_get_option( BerElement *ber, int option, - void *value ); -LDAP_API(Sockbuf*) LDAP_CALL ber_sockbuf_alloc( void ); -LDAP_API(void) LDAP_CALL ber_sockbuf_free( Sockbuf* p ); -LDAP_API(int) LDAP_CALL ber_sockbuf_set_option( Sockbuf *sb, int option, - void *value ); -LDAP_API(int) LDAP_CALL ber_sockbuf_get_option( Sockbuf *sb, int option, - void *value ); - -#ifdef __cplusplus -} -#endif -#endif /* _LBER_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/lcache.h b/mozilla/directory/c-sdk/ldap/include/lcache.h deleted file mode 100644 index 2a968d068b0..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/lcache.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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): - */ - -/* lcache.h - ldap persistent cache */ -#ifndef _LCACHE_H -#define _LCACHE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* calling conventions used by library */ -#ifndef LDAP_CALL -#if defined( _WINDOWS ) || defined( _WIN32 ) -#define LDAP_C __cdecl -#ifndef _WIN32 -#define __stdcall _far _pascal -#define LDAP_CALLBACK _loadds -#else -#define LDAP_CALLBACK -#endif /* _WIN32 */ -#define LDAP_PASCAL __stdcall -#define LDAP_CALL LDAP_PASCAL -#else /* _WINDOWS */ -#define LDAP_C -#define LDAP_CALLBACK -#define LDAP_PASCAL -#define LDAP_CALL -#endif /* _WINDOWS */ -#endif /* LDAP_CALL */ - -LDAP_API(int) LDAP_C lcache_init( LDAP *ld, void *arg ); -LDAP_API(int) LDAP_C lcache_bind( LDAP *ld, int msgid, unsigned long tag, - const char *dn, struct berval *cred, int method ); -LDAP_API(int) LDAP_C lcache_unbind( LDAP *ld, int msgid, unsigned long tag ); -LDAP_API(int) LDAP_C lcache_search( LDAP *ld, int msgid, unsigned long tag, - const char *dn, int scope, const char *filter, char **attrs, - int attrsonly ); -LDAP_API(int) LDAP_C lcache_compare( LDAP *ld, int msgid, unsigned long tag, - const char *dn, const char *attr, struct berval *val ); -LDAP_API(int) LDAP_C lcache_add( LDAP *ld, int msgid, unsigned long tag, - const char *dn, LDAPMod **entry ); -LDAP_API(int) LDAP_C lcache_delete( LDAP *ld, int msgid, unsigned long tag, - const char *dn ); -LDAP_API(int) LDAP_C lcache_rename( LDAP *ld, int msgid, unsigned long tag, - const char *dn, const char *newrdn, const char *newparent, - int deleteoldrdn ); -LDAP_API(int) LDAP_C lcache_modify( LDAP *ld, int msgid, unsigned long tag, - const char *dn, LDAPMod **mods ); -LDAP_API(int) LDAP_C lcache_modrdn( LDAP *ld, int msgid, unsigned long tag, - const char *dn, const char *newrdn, int deleteoldrdn ); -LDAP_API(int) LDAP_C lcache_result( LDAP *ld, int msgid, int all, - struct timeval *timeout, LDAPMessage **result ); -LDAP_API(int) LDAP_C lcache_flush( LDAP *ld, char *dn, char *filter ); - -#ifdef __cplusplus -} -#endif - -#endif /* _LCACHE_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/ldap-deprecated.h b/mozilla/directory/c-sdk/ldap/include/ldap-deprecated.h deleted file mode 100644 index 95ed62ff2b0..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldap-deprecated.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * 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-deprecated.h - deprecated functions and declarations - * - * A deprecated API is an API that we recommend you no longer use, - * due to improvements in the LDAP C SDK. While deprecated APIs are - * currently still implemented, they may be removed in future - * implementations, and we recommend using other APIs. - * - * This file contain functions and declarations which have - * outlived their usefullness and have been deprecated. In many - * cases functions and declarations have been replaced with newer - * extended functions. In no way should applications rely on the - * declarations and defines within this files as they can and will - * disappear without any notice. - */ - -#ifndef _LDAP_DEPRECATED_H -#define _LDAP_DEPRECATED_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * establish an ldap session - */ -LDAP_API(LDAP *) LDAP_CALL ldap_open( const char *host, int port ); - -/* - * Authentication methods: - */ -#define LDAP_AUTH_NONE 0x00L -#define LDAP_AUTH_SIMPLE 0x80L -#define LDAP_AUTH_SASL 0xa3L -LDAP_API(int) LDAP_CALL ldap_bind( LDAP *ld, const char *who, - const char *passwd, int authmethod ); -LDAP_API(int) LDAP_CALL ldap_bind_s( LDAP *ld, const char *who, - const char *cred, int method ); - -LDAP_API(int) LDAP_CALL ldap_modrdn( LDAP *ld, const char *dn, - const char *newrdn ); -LDAP_API(int) LDAP_CALL ldap_modrdn_s( LDAP *ld, const char *dn, - const char *newrdn ); -LDAP_API(int) LDAP_CALL ldap_modrdn2( LDAP *ld, const char *dn, - const char *newrdn, int deleteoldrdn ); -LDAP_API(int) LDAP_CALL ldap_modrdn2_s( LDAP *ld, const char *dn, - const char *newrdn, int deleteoldrdn); - -LDAP_API(void) LDAP_CALL ldap_perror( LDAP *ld, const char *s ); -LDAP_API(int) LDAP_CALL ldap_result2error( LDAP *ld, LDAPMessage *r, - int freeit ); - -/* - * Preferred language and get_lang_values (an API extension -- - * LDAP_API_FEATURE_X_GETLANGVALUES) - * - * The following two APIs are deprecated - */ - -#define LDAP_OPT_PREFERRED_LANGUAGE 0x14 /* 20 - API extension */ -LDAP_API(char **) LDAP_CALL ldap_get_lang_values( LDAP *ld, LDAPMessage *entry, - const char *target, char **type ); -LDAP_API(struct berval **) LDAP_CALL ldap_get_lang_values_len( LDAP *ld, - LDAPMessage *entry, const char *target, char **type ); - -/* - * Asynchronous I/O (an API extension). - */ -/* - * This option enables completely asynchronous IO. It works by using ioctl() - * on the fd, (or tlook()) - */ -#define LDAP_OPT_ASYNC_CONNECT 0x63 /* 99 - API extension */ - -/* - * functions and definitions that have been replaced by new improved ones - */ -/* - * Use ldap_get_option() with LDAP_OPT_API_INFO and an LDAPAPIInfo structure - * instead of ldap_version(). - */ -typedef struct _LDAPVersion { - int sdk_version; /* Version of the SDK, * 100 */ - int protocol_version; /* Highest protocol version supported, * 100 */ - int SSL_version; /* SSL version if this SDK supports it, * 100 */ - int security_level; /* highest level available */ - int reserved[4]; -} LDAPVersion; -#define LDAP_SECURITY_NONE 0 -LDAP_API(int) LDAP_CALL ldap_version( LDAPVersion *ver ); - -/* use ldap_create_filter() instead of ldap_build_filter() */ -LDAP_API(void) LDAP_CALL ldap_build_filter( char *buf, unsigned long buflen, - char *pattern, char *prefix, char *suffix, char *attr, - char *value, char **valwords ); -/* use ldap_set_filter_additions() instead of ldap_setfilteraffixes() */ -LDAP_API(void) LDAP_CALL ldap_setfilteraffixes( LDAPFiltDesc *lfdp, - char *prefix, char *suffix ); - -/* older result types a server can return -- use LDAP_RES_MODDN instead */ -#define LDAP_RES_MODRDN LDAP_RES_MODDN -#define LDAP_RES_RENAME LDAP_RES_MODDN - -/* older error messages */ -#define LDAP_AUTH_METHOD_NOT_SUPPORTED LDAP_STRONG_AUTH_NOT_SUPPORTED - -/* - * Generalized cache callback interface: - */ -#define LDAP_OPT_CACHE_FN_PTRS 0x0D /* 13 - API extension */ -#define LDAP_OPT_CACHE_STRATEGY 0x0E /* 14 - API extension */ -#define LDAP_OPT_CACHE_ENABLE 0x0F /* 15 - API extension */ - -/* cache strategies */ -#define LDAP_CACHE_CHECK 0 -#define LDAP_CACHE_POPULATE 1 -#define LDAP_CACHE_LOCALDB 2 - -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_BIND_CALLBACK)( LDAP *ld, int msgid, - unsigned long tag, const char *dn, const struct berval *creds, - int method); -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_UNBIND_CALLBACK)( LDAP *ld, - int unused0, unsigned long unused1 ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_SEARCH_CALLBACK)( LDAP *ld, - int msgid, unsigned long tag, const char *base, int scope, - const char LDAP_CALLBACK *filter, char **attrs, int attrsonly ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_COMPARE_CALLBACK)( LDAP *ld, - int msgid, unsigned long tag, const char *dn, const char *attr, - const struct berval *value ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_ADD_CALLBACK)( LDAP *ld, - int msgid, unsigned long tag, const char *dn, LDAPMod **attrs ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_DELETE_CALLBACK)( LDAP *ld, - int msgid, unsigned long tag, const char *dn ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_MODIFY_CALLBACK)( LDAP *ld, - int msgid, unsigned long tag, const char *dn, LDAPMod **mods ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_MODRDN_CALLBACK)( LDAP *ld, - int msgid, unsigned long tag, const char *dn, const char *newrdn, - int deleteoldrdn ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_RESULT_CALLBACK)( LDAP *ld, - int msgid, int all, struct timeval *timeout, LDAPMessage **result ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_FLUSH_CALLBACK)( LDAP *ld, - const char *dn, const char *filter ); - -struct ldap_cache_fns { - void *lcf_private; - LDAP_CF_BIND_CALLBACK *lcf_bind; - LDAP_CF_UNBIND_CALLBACK *lcf_unbind; - LDAP_CF_SEARCH_CALLBACK *lcf_search; - LDAP_CF_COMPARE_CALLBACK *lcf_compare; - LDAP_CF_ADD_CALLBACK *lcf_add; - LDAP_CF_DELETE_CALLBACK *lcf_delete; - LDAP_CF_MODIFY_CALLBACK *lcf_modify; - LDAP_CF_MODRDN_CALLBACK *lcf_modrdn; - LDAP_CF_RESULT_CALLBACK *lcf_result; - LDAP_CF_FLUSH_CALLBACK *lcf_flush; -}; - -LDAP_API(int) LDAP_CALL ldap_cache_flush( LDAP *ld, const char *dn, - const char *filter ); - - -#ifdef __cplusplus -} -#endif -#endif /* _LDAP_DEPRECATED_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/ldap-extension.h b/mozilla/directory/c-sdk/ldap/include/ldap-extension.h deleted file mode 100644 index ea089d538f9..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldap-extension.h +++ /dev/null @@ -1,654 +0,0 @@ -/* - * 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-extension.h - extensions to the ldap c api specification */ - -#ifndef _LDAP_EXTENSION_H -#define _LDAP_EXTENSION_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDAP_PORT_MAX 65535 /* API extension */ -#define LDAP_VERSION1 1 /* API extension */ -#define LDAP_VERSION LDAP_VERSION2 /* API extension */ - - -/* - * C LDAP features we support that are not (yet) part of the LDAP C API - * Internet Draft. Use the ldap_get_option() call with an option value of - * LDAP_OPT_API_FEATURE_INFO to retrieve information about a feature. - * - * Note that this list is incomplete; it includes only the most widely - * used extensions. Also, the version is 1 for all of these for now. - */ -#define LDAP_API_FEATURE_SERVER_SIDE_SORT 1 -#define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 1 -#define LDAP_API_FEATURE_PERSISTENT_SEARCH 1 -#define LDAP_API_FEATURE_PROXY_AUTHORIZATION 1 -#define LDAP_API_FEATURE_X_LDERRNO 1 -#define LDAP_API_FEATURE_X_MEMCACHE 1 -#define LDAP_API_FEATURE_X_IO_FUNCTIONS 1 -#define LDAP_API_FEATURE_X_EXTIO_FUNCTIONS 1 -#define LDAP_API_FEATURE_X_DNS_FUNCTIONS 1 -#define LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS 1 -#define LDAP_API_FEATURE_X_THREAD_FUNCTIONS 1 -#define LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS 1 -#define LDAP_API_FEATURE_X_GETLANGVALUES 1 -#define LDAP_API_FEATURE_X_CLIENT_SIDE_SORT 1 -#define LDAP_API_FEATURE_X_URL_FUNCTIONS 1 -#define LDAP_API_FEATURE_X_FILTER_FUNCTIONS 1 - -#define LDAP_ROOT_DSE "" /* API extension */ - -#define LDAP_OPT_DESC 0x01 /* 1 */ - -#define NULLMSG ((LDAPMessage *)0) - -/*built-in SASL methods */ -#define LDAP_SASL_EXTERNAL "EXTERNAL" /* TLS/SSL extension */ - -/* possible error codes we can be returned */ -#define LDAP_PARTIAL_RESULTS 0x09 /* 9 (UMich LDAPv2 extn) */ -#define NAME_ERROR(n) ((n & 0xf0) == 0x20) - -#define LDAP_SORT_CONTROL_MISSING 0x3C /* 60 (server side sort extn) */ -#define LDAP_INDEX_RANGE_ERROR 0x3D /* 61 (VLV extn) */ - -/* - * LDAPv3 server controls we know about - */ -#define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2" -#define LDAP_CONTROL_SORTREQUEST "1.2.840.113556.1.4.473" -#define LDAP_CONTROL_SORTRESPONSE "1.2.840.113556.1.4.474" -#define LDAP_CONTROL_PERSISTENTSEARCH "2.16.840.1.113730.3.4.3" -#define LDAP_CONTROL_ENTRYCHANGE "2.16.840.1.113730.3.4.7" -#define LDAP_CONTROL_VLVREQUEST "2.16.840.1.113730.3.4.9" -#define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10" -#define LDAP_CONTROL_PROXYAUTH "2.16.840.1.113730.3.4.12" /* version 1 -*/ -#define LDAP_CONTROL_PROXIEDAUTH "2.16.840.1.113730.3.4.18" /* version 2 -*/ - -/* Authentication request and response controls */ -#define LDAP_CONTROL_AUTH_REQUEST "2.16.840.1.113730.3.4.16" -#define LDAP_CONTROL_AUTH_RESPONSE "2.16.840.1.113730.3.4.15" - -/* Password information sent back to client */ -#define LDAP_CONTROL_PWEXPIRED "2.16.840.1.113730.3.4.4" -#define LDAP_CONTROL_PWEXPIRING "2.16.840.1.113730.3.4.5" - -/* Suppress virtual/inherited attribute values */ -#define LDAP_CONTROL_REAL_ATTRS_ONLY "2.16.840.1.113730.3.4.17" - -/* Only return virtual/inherited attribute values */ -#define LDAP_CONTROL_VIRTUAL_ATTRS_ONLY "2.16.840.1.113730.3.4.19" - - -LDAP_API(void) LDAP_CALL ldap_ber_free( BerElement *ber, int freebuf ); - -/* - * Server side sorting of search results (an LDAPv3 extension -- - * LDAP_API_FEATURE_SERVER_SIDE_SORT) - */ -typedef struct LDAPsortkey { /* structure for a sort-key */ - char * sk_attrtype; - char * sk_matchruleoid; - int sk_reverseorder; -} LDAPsortkey; - -LDAP_API(int) LDAP_CALL ldap_create_sort_control( LDAP *ld, - LDAPsortkey **sortKeyList, const char ctl_iscritical, - LDAPControl **ctrlp ); -LDAP_API(int) LDAP_CALL ldap_parse_sort_control( LDAP *ld, - LDAPControl **ctrls, unsigned long *result, char **attribute ); - -LDAP_API(void) LDAP_CALL ldap_free_sort_keylist( LDAPsortkey **sortKeyList ); -LDAP_API(int) LDAP_CALL ldap_create_sort_keylist( LDAPsortkey ***sortKeyList, - const char *string_rep ); - - -/* - * Virtual list view (an LDAPv3 extension -- LDAP_API_FEATURE_VIRTUAL_LIST_VIEW) - */ -/* - * structure that describes a VirtualListViewRequest control. - * note that ldvlist_index and ldvlist_size are only relevant to - * ldap_create_virtuallist_control() if ldvlist_attrvalue is NULL. - */ -typedef struct ldapvirtuallist { - unsigned long ldvlist_before_count; /* # entries before target */ - unsigned long ldvlist_after_count; /* # entries after target */ - char *ldvlist_attrvalue; /* jump to this value */ - unsigned long ldvlist_index; /* list offset */ - unsigned long ldvlist_size; /* number of items in vlist */ - void *ldvlist_extradata; /* for use by application */ -} LDAPVirtualList; - -/* - * VLV functions: - */ -LDAP_API(int) LDAP_CALL ldap_create_virtuallist_control( LDAP *ld, - LDAPVirtualList *ldvlistp, LDAPControl **ctrlp ); - -LDAP_API(int) LDAP_CALL ldap_parse_virtuallist_control( LDAP *ld, - LDAPControl **ctrls, unsigned long *target_posp, - unsigned long *list_sizep, int *errcodep ); - -/* - * Routines for creating persistent search controls and for handling - * "entry changed notification" controls (an LDAPv3 extension -- - * LDAP_API_FEATURE_PERSISTENT_SEARCH) - */ -#define LDAP_CHANGETYPE_ADD 1 -#define LDAP_CHANGETYPE_DELETE 2 -#define LDAP_CHANGETYPE_MODIFY 4 -#define LDAP_CHANGETYPE_MODDN 8 -#define LDAP_CHANGETYPE_ANY (1|2|4|8) -LDAP_API(int) LDAP_CALL ldap_create_persistentsearch_control( LDAP *ld, - int changetypes, int changesonly, int return_echg_ctls, - char ctl_iscritical, LDAPControl **ctrlp ); -LDAP_API(int) LDAP_CALL ldap_parse_entrychange_control( LDAP *ld, - LDAPControl **ctrls, int *chgtypep, char **prevdnp, - int *chgnumpresentp, long *chgnump ); - -/* - * Routines for creating Proxied Authorization controls (an LDAPv3 - * extension -- LDAP_API_FEATURE_PROXY_AUTHORIZATION) - * ldap_create_proxyauth_control() is for the old (version 1) control. - * ldap_create_proxiedauth_control() is for the newer (version 2) control. - */ -LDAP_API(int) LDAP_CALL ldap_create_proxyauth_control( LDAP *ld, - const char *dn, const char ctl_iscritical, LDAPControl **ctrlp ); -LDAP_API(int) LDAP_CALL ldap_create_proxiedauth_control( LDAP *ld, - const char *authzid, LDAPControl **ctrlp ); - -/* - * Functions to get and set LDAP error information (API extension -- - * LDAP_API_FEATURE_X_LDERRNO ) - * - * By using LDAP_OPT_THREAD_FN_PTRS, you can arrange for the error info. to - * be thread-specific. - */ -LDAP_API(int) LDAP_CALL ldap_get_lderrno( LDAP *ld, char **m, char **s ); -LDAP_API(int) LDAP_CALL ldap_set_lderrno( LDAP *ld, int e, char *m, char *s ); - - -/* - * LDAP URL functions and definitions (an API extension -- - * LDAP_API_FEATURE_X_URL_FUNCTIONS) - */ -/* - * types for ldap URL handling - */ -typedef struct ldap_url_desc { - char *lud_host; - int lud_port; - char *lud_dn; - char **lud_attrs; - int lud_scope; - char *lud_filter; - unsigned long lud_options; -#define LDAP_URL_OPT_SECURE 0x01 - char *lud_string; /* for internal use only */ -} LDAPURLDesc; - -#define NULLLDAPURLDESC ((LDAPURLDesc *)NULL) - -/* - * possible errors returned by ldap_url_parse() - */ -#define LDAP_URL_ERR_NOTLDAP 1 /* URL doesn't begin with "ldap://" */ -#define LDAP_URL_ERR_NODN 2 /* URL has no DN (required) */ -#define LDAP_URL_ERR_BADSCOPE 3 /* URL scope string is invalid */ -#define LDAP_URL_ERR_MEM 4 /* can't allocate memory space */ -#define LDAP_URL_ERR_PARAM 5 /* bad parameter to an URL function */ -#define LDAP_URL_UNRECOGNIZED_CRITICAL_EXTENSION 6 - -/* - * URL functions: - */ -LDAP_API(int) LDAP_CALL ldap_is_ldap_url( const char *url ); -LDAP_API(int) LDAP_CALL ldap_url_parse( const char *url, LDAPURLDesc **ludpp ); -LDAP_API(void) LDAP_CALL ldap_free_urldesc( LDAPURLDesc *ludp ); -LDAP_API(int) LDAP_CALL ldap_url_search( LDAP *ld, const char *url, - int attrsonly ); -LDAP_API(int) LDAP_CALL ldap_url_search_s( LDAP *ld, const char *url, - int attrsonly, LDAPMessage **res ); -LDAP_API(int) LDAP_CALL ldap_url_search_st( LDAP *ld, const char *url, - int attrsonly, struct timeval *timeout, LDAPMessage **res ); - - -/* - * Function to dispose of an array of LDAPMod structures (an API extension). - * Warning: don't use this unless the mods array was allocated using the - * same memory allocator as is being used by libldap. - */ -LDAP_API(void) LDAP_CALL ldap_mods_free( LDAPMod **mods, int freemods ); - -/* - * SSL option (an API extension): - */ -#define LDAP_OPT_SSL 0x0A /* 10 - API extension */ - -/* - * Referral hop limit (an API extension): - */ -#define LDAP_OPT_REFERRAL_HOP_LIMIT 0x10 /* 16 - API extension */ - -/* - * Rebind callback function (an API extension) - */ -#define LDAP_OPT_REBIND_FN 0x06 /* 6 - API extension */ -#define LDAP_OPT_REBIND_ARG 0x07 /* 7 - API extension */ -typedef int (LDAP_CALL LDAP_CALLBACK LDAP_REBINDPROC_CALLBACK)( LDAP *ld, - char **dnp, char **passwdp, int *authmethodp, int freeit, void *arg); -LDAP_API(void) LDAP_CALL ldap_set_rebind_proc( LDAP *ld, - LDAP_REBINDPROC_CALLBACK *rebindproc, void *arg ); - -/* - * Thread function callbacks (an API extension -- - * LDAP_API_FEATURE_X_THREAD_FUNCTIONS). - */ -#define LDAP_OPT_THREAD_FN_PTRS 0x05 /* 5 - API extension */ - -/* - * Thread callback functions: - */ -typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_ALLOC_CALLBACK)( void ); -typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_FREE_CALLBACK)( void *m ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_LOCK_CALLBACK)( void *m ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_UNLOCK_CALLBACK)( void *m ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_ERRNO_CALLBACK)( void ); -typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SET_ERRNO_CALLBACK)( int e ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_LDERRNO_CALLBACK)( - char **matchedp, char **errmsgp, void *arg ); -typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SET_LDERRNO_CALLBACK)( int err, - char *matched, char *errmsg, void *arg ); - -/* - * Structure to hold thread function pointers: - */ -struct ldap_thread_fns { - LDAP_TF_MUTEX_ALLOC_CALLBACK *ltf_mutex_alloc; - LDAP_TF_MUTEX_FREE_CALLBACK *ltf_mutex_free; - LDAP_TF_MUTEX_LOCK_CALLBACK *ltf_mutex_lock; - LDAP_TF_MUTEX_UNLOCK_CALLBACK *ltf_mutex_unlock; - LDAP_TF_GET_ERRNO_CALLBACK *ltf_get_errno; - LDAP_TF_SET_ERRNO_CALLBACK *ltf_set_errno; - LDAP_TF_GET_LDERRNO_CALLBACK *ltf_get_lderrno; - LDAP_TF_SET_LDERRNO_CALLBACK *ltf_set_lderrno; - void *ltf_lderrno_arg; -}; - -/* - * Extended I/O function callbacks option (an API extension -- - * LDAP_API_FEATURE_X_EXTIO_FUNCTIONS). - */ -#define LDAP_X_OPT_EXTIO_FN_PTRS (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F00) - /* 0x4000 + 0x0F00 = 0x4F00 = 20224 - API extension */ - -/* - * These extended I/O function callbacks echo the BSD socket API but accept - * an extra pointer parameter at the end of their argument list that can - * be used by client applications for their own needs. For some of the calls, - * the pointer is a session argument of type struct lextiof_session_private * - * that is associated with the LDAP session handle (LDAP *). For others, the - * pointer is a socket specific struct lextiof_socket_private * argument that - * is associated with a particular socket (a TCP connection). - * - * The lextiof_session_private and lextiof_socket_private structures are not - * defined by the LDAP C API; users of this extended I/O interface should - * define these themselves. - * - * The combination of the integer socket number (i.e., lpoll_fd, which is - * the value returned by the CONNECT callback) and the application specific - * socket argument (i.e., lpoll_socketarg, which is the value set in *sockargpp - * by the CONNECT callback) must be unique. - * - * The types for the extended READ and WRITE callbacks are actually in lber.h. - * - * The CONNECT callback gets passed both the session argument (sessionarg) - * and a pointer to a socket argument (socketargp) so it has the - * opportunity to set the socket-specific argument. The CONNECT callback - * also takes a timeout parameter whose value can be set by calling - * ldap_set_option( ld, LDAP_X_OPT_..., &val ). The units used for the - * timeout parameter are milliseconds. - * - * A POLL interface is provided instead of a select() one. The timeout is - * in milliseconds. - * - * A NEWHANDLE callback function is also provided. It is called right - * after the LDAP session handle is created, e.g., during ldap_init(). - * If the NEWHANDLE callback returns anything other than LDAP_SUCCESS, - * the session handle allocation fails. - * - * A DISPOSEHANDLE callback function is also provided. It is called right - * before the LDAP session handle and its contents are destroyed, e.g., - * during ldap_unbind(). - */ - -/* - * Special timeout values for poll and connect: - */ -#define LDAP_X_IO_TIMEOUT_NO_WAIT 0 /* return immediately */ -#define LDAP_X_IO_TIMEOUT_NO_TIMEOUT (-1) /* block indefinitely */ - -/* LDAP poll()-like descriptor: - */ -typedef struct ldap_x_pollfd { /* used by LDAP_X_EXTIOF_POLL_CALLBACK */ - int lpoll_fd; /* integer file descriptor / socket */ - struct lextiof_socket_private - *lpoll_socketarg; - /* pointer socket and for use by */ - /* application */ - short lpoll_events; /* requested event */ - short lpoll_revents; /* returned event */ -} LDAP_X_PollFD; - -/* Event flags for lpoll_events and lpoll_revents: - */ -#define LDAP_X_POLLIN 0x01 /* regular data ready for reading */ -#define LDAP_X_POLLPRI 0x02 /* high priority data available */ -#define LDAP_X_POLLOUT 0x04 /* ready for writing */ -#define LDAP_X_POLLERR 0x08 /* error occurred -- only in lpoll_revents */ -#define LDAP_X_POLLHUP 0x10 /* connection closed -- only in lpoll_revents */ -#define LDAP_X_POLLNVAL 0x20 /* invalid lpoll_fd -- only in lpoll_revents */ - -/* Options passed to LDAP_X_EXTIOF_CONNECT_CALLBACK to modify socket behavior: - */ -#define LDAP_X_EXTIOF_OPT_NONBLOCKING 0x01 /* turn on non-blocking mode */ -#define LDAP_X_EXTIOF_OPT_SECURE 0x02 /* turn on 'secure' mode */ - - -/* extended I/O callback function prototypes: - */ -typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_CONNECT_CALLBACK )( - const char *hostlist, int port, /* host byte order */ - int timeout /* milliseconds */, - unsigned long options, /* bitmapped options */ - struct lextiof_session_private *sessionarg, - struct lextiof_socket_private **socketargp ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_CLOSE_CALLBACK )( - int s, struct lextiof_socket_private *socketarg ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_POLL_CALLBACK)( - LDAP_X_PollFD fds[], int nfds, int timeout /* milliseconds */, - struct lextiof_session_private *sessionarg ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_NEWHANDLE_CALLBACK)( - LDAP *ld, struct lextiof_session_private *sessionarg ); -typedef void (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK)( - LDAP *ld, struct lextiof_session_private *sessionarg ); - - -/* Structure to hold extended I/O function pointers: - */ -struct ldap_x_ext_io_fns { - /* lextiof_size should always be set to LDAP_X_EXTIO_FNS_SIZE */ - int lextiof_size; - LDAP_X_EXTIOF_CONNECT_CALLBACK *lextiof_connect; - LDAP_X_EXTIOF_CLOSE_CALLBACK *lextiof_close; - LDAP_X_EXTIOF_READ_CALLBACK *lextiof_read; - LDAP_X_EXTIOF_WRITE_CALLBACK *lextiof_write; - LDAP_X_EXTIOF_POLL_CALLBACK *lextiof_poll; - LDAP_X_EXTIOF_NEWHANDLE_CALLBACK *lextiof_newhandle; - LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *lextiof_disposehandle; - void *lextiof_session_arg; - LDAP_X_EXTIOF_WRITEV_CALLBACK *lextiof_writev; -}; -#define LDAP_X_EXTIO_FNS_SIZE sizeof(struct ldap_x_ext_io_fns) - -/* - * Utility functions for parsing space-separated host lists (useful for - * implementing an extended I/O CONNECT callback function). - */ -struct ldap_x_hostlist_status; -LDAP_API(int) LDAP_CALL ldap_x_hostlist_first( const char *hostlist, - int defport, char **hostp, int *portp /* host byte order */, - struct ldap_x_hostlist_status **statusp ); -LDAP_API(int) LDAP_CALL ldap_x_hostlist_next( char **hostp, - int *portp /* host byte order */, struct ldap_x_hostlist_status *status -); -LDAP_API(void) LDAP_CALL ldap_x_hostlist_statusfree( - struct ldap_x_hostlist_status *status ); - -/* - * Client side sorting of entries (an API extension -- - * LDAP_API_FEATURE_X_CLIENT_SIDE_SORT) - */ -/* - * Client side sorting callback functions: - */ -typedef const struct berval* (LDAP_C LDAP_CALLBACK - LDAP_KEYGEN_CALLBACK)( void *arg, LDAP *ld, LDAPMessage *entry ); -typedef int (LDAP_C LDAP_CALLBACK - LDAP_KEYCMP_CALLBACK)( void *arg, const struct berval*, - const struct berval* ); -typedef void (LDAP_C LDAP_CALLBACK - LDAP_KEYFREE_CALLBACK)( void *arg, const struct berval* ); -typedef int (LDAP_C LDAP_CALLBACK - LDAP_CMP_CALLBACK)(const char *val1, const char *val2); -typedef int (LDAP_C LDAP_CALLBACK - LDAP_VALCMP_CALLBACK)(const char **val1p, const char **val2p); - -/* - * Client side sorting functions: - */ -LDAP_API(int) LDAP_CALL ldap_keysort_entries( LDAP *ld, LDAPMessage **chain, - void *arg, LDAP_KEYGEN_CALLBACK *gen, LDAP_KEYCMP_CALLBACK *cmp, - LDAP_KEYFREE_CALLBACK *fre ); -LDAP_API(int) LDAP_CALL ldap_multisort_entries( LDAP *ld, LDAPMessage **chain, - char **attr, LDAP_CMP_CALLBACK *cmp ); -LDAP_API(int) LDAP_CALL ldap_sort_entries( LDAP *ld, LDAPMessage **chain, - char *attr, LDAP_CMP_CALLBACK *cmp ); -LDAP_API(int) LDAP_CALL ldap_sort_values( LDAP *ld, char **vals, - LDAP_VALCMP_CALLBACK *cmp ); -LDAP_API(int) LDAP_C LDAP_CALLBACK ldap_sort_strcasecmp( const char **a, - const char **b ); - - -/* - * Filter functions and definitions (an API extension -- - * LDAP_API_FEATURE_X_FILTER_FUNCTIONS) - */ -/* - * Structures, constants, and types for filter utility routines: - */ -typedef struct ldap_filt_info { - char *lfi_filter; - char *lfi_desc; - int lfi_scope; /* LDAP_SCOPE_BASE, etc */ - int lfi_isexact; /* exact match filter? */ - struct ldap_filt_info *lfi_next; -} LDAPFiltInfo; - -#define LDAP_FILT_MAXSIZ 1024 - -typedef struct ldap_filt_list LDAPFiltList; /* opaque filter list handle */ -typedef struct ldap_filt_desc LDAPFiltDesc; /* opaque filter desc handle */ - -/* - * Filter utility functions: - */ -LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_init_getfilter( char *fname ); -LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_init_getfilter_buf( char *buf, - long buflen ); -LDAP_API(LDAPFiltInfo *) LDAP_CALL ldap_getfirstfilter( LDAPFiltDesc *lfdp, - char *tagpat, char *value ); -LDAP_API(LDAPFiltInfo *) LDAP_CALL ldap_getnextfilter( LDAPFiltDesc *lfdp ); -LDAP_API(int) LDAP_CALL ldap_set_filter_additions( LDAPFiltDesc *lfdp, - char *prefix, char *suffix ); -LDAP_API(int) LDAP_CALL ldap_create_filter( char *buf, unsigned long buflen, - char *pattern, char *prefix, char *suffix, char *attr, - char *value, char **valwords ); -LDAP_API(void) LDAP_CALL ldap_getfilter_free( LDAPFiltDesc *lfdp ); - -/* - * Friendly mapping structure and routines (an API extension) - */ -typedef struct friendly { - char *f_unfriendly; - char *f_friendly; -} *FriendlyMap; -LDAP_API(char *) LDAP_CALL ldap_friendly_name( char *filename, char *name, - FriendlyMap *map ); -LDAP_API(void) LDAP_CALL ldap_free_friendlymap( FriendlyMap *map ); - -/* - * In Memory Cache (an API extension -- LDAP_API_FEATURE_X_MEMCACHE) - */ -typedef struct ldapmemcache LDAPMemCache; /* opaque in-memory cache handle */ - -LDAP_API(int) LDAP_CALL ldap_memcache_init( unsigned long ttl, - unsigned long size, char **baseDNs, struct ldap_thread_fns *thread_fns, - LDAPMemCache **cachep ); -LDAP_API(int) LDAP_CALL ldap_memcache_set( LDAP *ld, LDAPMemCache *cache ); -LDAP_API(int) LDAP_CALL ldap_memcache_get( LDAP *ld, LDAPMemCache **cachep ); -LDAP_API(void) LDAP_CALL ldap_memcache_flush( LDAPMemCache *cache, char *dn, - int scope ); -LDAP_API(void) LDAP_CALL ldap_memcache_destroy( LDAPMemCache *cache ); -LDAP_API(void) LDAP_CALL ldap_memcache_update( LDAPMemCache *cache ); - -/* - * Timeout value for nonblocking connect call - */ -#define LDAP_X_OPT_CONNECT_TIMEOUT (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F01) - /* 0x4000 + 0x0F01 = 0x4F01 = 20225 - API extension */ - -/* - * Memory allocation callback functions (an API extension -- - * LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS). These are global and can - * not be set on a per-LDAP session handle basis. Install your own - * functions by making a call like this: - * ldap_set_option( NULL, LDAP_OPT_MEMALLOC_FN_PTRS, &memalloc_fns ); - * - * look in lber.h for the function typedefs themselves. - */ -#define LDAP_OPT_MEMALLOC_FN_PTRS 0x61 /* 97 - API extension */ - -struct ldap_memalloc_fns { - LDAP_MALLOC_CALLBACK *ldapmem_malloc; - LDAP_CALLOC_CALLBACK *ldapmem_calloc; - LDAP_REALLOC_CALLBACK *ldapmem_realloc; - LDAP_FREE_CALLBACK *ldapmem_free; -}; - - -/* - * Memory allocation functions (an API extension) - */ -void *ldap_x_malloc( size_t size ); -void *ldap_x_calloc( size_t nelem, size_t elsize ); -void *ldap_x_realloc( void *ptr, size_t size ); -void ldap_x_free( void *ptr ); - -/* - * Server reconnect (an API extension). - */ -#define LDAP_OPT_RECONNECT 0x62 /* 98 - API extension */ - - -/* - * Extra thread callback functions (an API extension -- - * LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS) - */ -#define LDAP_OPT_EXTRA_THREAD_FN_PTRS 0x65 /* 101 - API extension */ - -typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_TRYLOCK_CALLBACK)( void *m ); -typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_ALLOC_CALLBACK)( void ); -typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_FREE_CALLBACK)( void *s ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_WAIT_CALLBACK)( void *s ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_POST_CALLBACK)( void *s ); -typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_THREADID_CALLBACK)(void); - -struct ldap_extra_thread_fns { - LDAP_TF_MUTEX_TRYLOCK_CALLBACK *ltf_mutex_trylock; - LDAP_TF_SEMA_ALLOC_CALLBACK *ltf_sema_alloc; - LDAP_TF_SEMA_FREE_CALLBACK *ltf_sema_free; - LDAP_TF_SEMA_WAIT_CALLBACK *ltf_sema_wait; - LDAP_TF_SEMA_POST_CALLBACK *ltf_sema_post; - LDAP_TF_THREADID_CALLBACK *ltf_threadid_fn; -}; - -/* - * Debugging level (an API extension) - */ -#define LDAP_OPT_DEBUG_LEVEL 0x6E /* 110 - API extension */ -/* On UNIX, there's only one copy of ldap_debug */ -/* On NT, each dll keeps its own module_ldap_debug, which */ -/* points to the process' ldap_debug and needs initializing after load */ -#ifdef _WIN32 -extern int *module_ldap_debug; -typedef void (*set_debug_level_fn_t)(int*); -#endif - -#ifdef LDAP_DNS -#define LDAP_OPT_DNS 0x0C /* 12 - API extension */ -#endif - -/* - * UTF-8 routines (should these move into libnls?) - */ -/* number of bytes in character */ -LDAP_API(int) LDAP_CALL ldap_utf8len( const char* ); -/* find next character */ -LDAP_API(char*) LDAP_CALL ldap_utf8next( char* ); -/* find previous character */ -LDAP_API(char*) LDAP_CALL ldap_utf8prev( char* ); -/* copy one character */ -LDAP_API(int) LDAP_CALL ldap_utf8copy( char* dst, const char* src ); -/* total number of characters */ -LDAP_API(size_t) LDAP_CALL ldap_utf8characters( const char* ); -/* get one UCS-4 character, and move *src to the next character */ -LDAP_API(unsigned long) LDAP_CALL ldap_utf8getcc( const char** src ); -/* UTF-8 aware strtok_r() */ -LDAP_API(char*) LDAP_CALL ldap_utf8strtok_r( char* src, const char* brk, char** -next); - -/* like isalnum(*s) in the C locale */ -LDAP_API(int) LDAP_CALL ldap_utf8isalnum( char* s ); -/* like isalpha(*s) in the C locale */ -LDAP_API(int) LDAP_CALL ldap_utf8isalpha( char* s ); -/* like isdigit(*s) in the C locale */ -LDAP_API(int) LDAP_CALL ldap_utf8isdigit( char* s ); -/* like isxdigit(*s) in the C locale */ -LDAP_API(int) LDAP_CALL ldap_utf8isxdigit(char* s ); -/* like isspace(*s) in the C locale */ -LDAP_API(int) LDAP_CALL ldap_utf8isspace( char* s ); - -#define LDAP_UTF8LEN(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8len (s) : 1) -#define LDAP_UTF8NEXT(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8next(s) : ( s)+1) -#define LDAP_UTF8INC(s) ((0x80 & *(unsigned char*)(s)) ? s=ldap_utf8next(s) : ++s) - -#define LDAP_UTF8PREV(s) ldap_utf8prev(s) -#define LDAP_UTF8DEC(s) (s=ldap_utf8prev(s)) - -#define LDAP_UTF8COPY(d,s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8copy(d,s) : ((*(d) = *(s)), 1)) -#define LDAP_UTF8GETCC(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8getcc (&s) : *s++) -#define LDAP_UTF8GETC(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8getcc ((const char**)&s) : *s++) - - -#ifdef __cplusplus -} -#endif -#endif /* _LDAP_EXTENSION_H */ - diff --git a/mozilla/directory/c-sdk/ldap/include/ldap-platform.h b/mozilla/directory/c-sdk/ldap/include/ldap-platform.h deleted file mode 100644 index 5d5ff6e1616..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldap-platform.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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-platform.h - platform transparency */ - -#ifndef _LDAP_PLATFORM_H -#define _LDAP_PLATFORM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined( XP_OS2 ) -#include "os2sock.h" -#elif defined (WIN32) || defined (_WIN32) || defined( _CONSOLE ) -#include -# if defined( _WINDOWS ) -# include -# endif -#elif defined(macintosh) -#ifndef LDAP_TYPE_TIMEVAL_DEFINED -#include -#endif -#ifndef LDAP_TYPE_SOCKET_DEFINED /* API extension */ -#include "macsock.h" -#endif -#else /* everything else, e.g., Unix */ -#ifndef LDAP_TYPE_TIMEVAL_DEFINED -#include -#endif -#ifndef LDAP_TYPE_SOCKET_DEFINED /* API extension */ -#include -#include -#endif -#endif - -#ifdef _AIX -#include -#endif /* _AIX */ - -/* - * LDAP_API macro definition: - */ -#ifndef LDAP_API -#if defined( _WINDOWS ) || defined( _WIN32 ) -#define LDAP_API(rt) rt -#else /* _WINDOWS */ -#define LDAP_API(rt) rt -#endif /* _WINDOWS */ -#endif /* LDAP_API */ - -#ifdef __cplusplus -} -#endif -#endif /* _LDAP_PLATFORM_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/ldap-standard-tmpl.h b/mozilla/directory/c-sdk/ldap/include/ldap-standard-tmpl.h deleted file mode 100644 index e63aed33d8d..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldap-standard-tmpl.h +++ /dev/null @@ -1,438 +0,0 @@ -/* This file is a template. The generated file is ldap-standard.h> -/* - * 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-standard.h - standards base header file for libldap */ -/* This file contain the defines and function prototypes matching */ -/* very closely to the latest LDAP C API draft */ - -#ifndef _LDAP_STANDARD_H -#define _LDAP_STANDARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "ldap-platform.h" - -#include "lber.h" - -#define LDAP_PORT 389 -#define LDAPS_PORT 636 -#define LDAP_VERSION2 2 -#define LDAP_VERSION3 3 -#define LDAP_VERSION_MIN LDAP_VERSION1 -#define LDAP_VERSION_MAX LDAP_VERSION3 - -#define LDAP_VENDOR_VERSION {{LDAP_VENDOR_VERSION}} /* version # * 100 */ -#define LDAP_VENDOR_NAME "{{LDAP_VENDOR_NAME}}" -/* - * The following will be an RFC number once the LDAP C API Internet Draft - * is published as a Proposed Standard RFC. For now we use 2000 + the - * draft revision number (currently 5) since we are close to compliance - * with revision 5 of the draft. - */ -#define LDAP_API_VERSION 2005 - - -#define LDAP_NO_ATTRS "1.1" -#define LDAP_ALL_USER_ATTRS "*" - -/* - * Standard options (used with ldap_set_option() and ldap_get_option): - */ -#define LDAP_OPT_API_INFO 0x00 /* 0 */ -#define LDAP_OPT_DEREF 0x02 /* 2 */ -#define LDAP_OPT_SIZELIMIT 0x03 /* 3 */ -#define LDAP_OPT_TIMELIMIT 0x04 /* 4 */ -#define LDAP_OPT_REFERRALS 0x08 /* 8 */ -#define LDAP_OPT_RESTART 0x09 /* 9 */ -#define LDAP_OPT_PROTOCOL_VERSION 0x11 /* 17 */ -#define LDAP_OPT_SERVER_CONTROLS 0x12 /* 18 */ -#define LDAP_OPT_CLIENT_CONTROLS 0x13 /* 19 */ -#define LDAP_OPT_API_FEATURE_INFO 0x15 /* 21 */ -#define LDAP_OPT_HOST_NAME 0x30 /* 48 */ -#define LDAP_OPT_ERROR_NUMBER 0x31 /* 49 */ -#define LDAP_OPT_ERROR_STRING 0x32 /* 50 */ -#define LDAP_OPT_MATCHED_DN 0x33 /* 51 */ - -/* - * Well-behaved private and experimental extensions will use option values - * between 0x4000 (16384) and 0x7FFF (32767) inclusive. - */ -#define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x4000 /* to 0x7FFF inclusive */ - -/* for on/off options */ -#define LDAP_OPT_ON ((void *)1) -#define LDAP_OPT_OFF ((void *)0) - -typedef struct ldap LDAP; /* opaque connection handle */ -typedef struct ldapmsg LDAPMessage; /* opaque result/entry handle */ - -/* structure representing an LDAP modification */ -typedef struct ldapmod { - int mod_op; /* kind of mod + form of values*/ -#define LDAP_MOD_ADD 0x00 -#define LDAP_MOD_DELETE 0x01 -#define LDAP_MOD_REPLACE 0x02 -#define LDAP_MOD_BVALUES 0x80 - char *mod_type; /* attribute name to modify */ - union mod_vals_u { - char **modv_strvals; - struct berval **modv_bvals; - } mod_vals; /* values to add/delete/replace */ -#define mod_values mod_vals.modv_strvals -#define mod_bvalues mod_vals.modv_bvals -} LDAPMod; - - -/* - * structure for holding ldapv3 controls - */ -typedef struct ldapcontrol { - char *ldctl_oid; - struct berval ldctl_value; - char ldctl_iscritical; -} LDAPControl; - - -/* - * LDAP API information. Can be retrieved by using a sequence like: - * - * LDAPAPIInfo ldai; - * ldai.ldapai_info_version = LDAP_API_INFO_VERSION; - * if ( ldap_get_option( NULL, LDAP_OPT_API_INFO, &ldia ) == 0 ) ... - */ -#define LDAP_API_INFO_VERSION 1 -typedef struct ldapapiinfo { - int ldapai_info_version; /* version of this struct (1) */ - int ldapai_api_version; /* revision of API supported */ - int ldapai_protocol_version; /* highest LDAP version supported */ - char **ldapai_extensions; /* names of API extensions */ - char *ldapai_vendor_name; /* name of supplier */ - int ldapai_vendor_version; /* supplier-specific version times 100 */ -} LDAPAPIInfo; - - -/* - * LDAP API extended features info. Can be retrieved by using a sequence like: - * - * LDAPAPIFeatureInfo ldfi; - * ldfi.ldapaif_info_version = LDAP_FEATURE_INFO_VERSION; - * ldfi.ldapaif_name = "VIRTUAL_LIST_VIEW"; - * if ( ldap_get_option( NULL, LDAP_OPT_API_FEATURE_INFO, &ldfi ) == 0 ) ... - */ -#define LDAP_FEATURE_INFO_VERSION 1 -typedef struct ldap_apifeature_info { - int ldapaif_info_version; /* version of this struct (1) */ - char *ldapaif_name; /* name of supported feature */ - int ldapaif_version; /* revision of supported feature */ -} LDAPAPIFeatureInfo; - - -/* possible result types a server can return */ -#define LDAP_RES_BIND 0x61L /* 97 */ -#define LDAP_RES_SEARCH_ENTRY 0x64L /* 100 */ -#define LDAP_RES_SEARCH_RESULT 0x65L /* 101 */ -#define LDAP_RES_MODIFY 0x67L /* 103 */ -#define LDAP_RES_ADD 0x69L /* 105 */ -#define LDAP_RES_DELETE 0x6BL /* 107 */ -#define LDAP_RES_MODDN 0x6DL /* 109 */ -#define LDAP_RES_COMPARE 0x6FL /* 111 */ -#define LDAP_RES_SEARCH_REFERENCE 0x73L /* 115 */ -#define LDAP_RES_EXTENDED 0x78L /* 120 */ - -/* Special values for ldap_result() "msgid" parameter */ -#define LDAP_RES_ANY (-1) -#define LDAP_RES_UNSOLICITED 0 - -/* built-in SASL methods */ -#define LDAP_SASL_SIMPLE 0 /* special value used for simple bind */ - -/* search scopes */ -#define LDAP_SCOPE_BASE 0x00 -#define LDAP_SCOPE_ONELEVEL 0x01 -#define LDAP_SCOPE_SUBTREE 0x02 - -/* alias dereferencing */ -#define LDAP_DEREF_NEVER 0x00 -#define LDAP_DEREF_SEARCHING 0x01 -#define LDAP_DEREF_FINDING 0x02 -#define LDAP_DEREF_ALWAYS 0x03 - -/* predefined size/time limits */ -#define LDAP_NO_LIMIT 0 - -/* allowed values for "all" ldap_result() parameter */ -#define LDAP_MSG_ONE 0x00 -#define LDAP_MSG_ALL 0x01 -#define LDAP_MSG_RECEIVED 0x02 - -/* possible error codes we can be returned */ -#define LDAP_SUCCESS 0x00 /* 0 */ -#define LDAP_OPERATIONS_ERROR 0x01 /* 1 */ -#define LDAP_PROTOCOL_ERROR 0x02 /* 2 */ -#define LDAP_TIMELIMIT_EXCEEDED 0x03 /* 3 */ -#define LDAP_SIZELIMIT_EXCEEDED 0x04 /* 4 */ -#define LDAP_COMPARE_FALSE 0x05 /* 5 */ -#define LDAP_COMPARE_TRUE 0x06 /* 6 */ -#define LDAP_STRONG_AUTH_NOT_SUPPORTED 0x07 /* 7 */ -#define LDAP_STRONG_AUTH_REQUIRED 0x08 /* 8 */ -#define LDAP_REFERRAL 0x0a /* 10 - LDAPv3 */ -#define LDAP_ADMINLIMIT_EXCEEDED 0x0b /* 11 - LDAPv3 */ -#define LDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c /* 12 - LDAPv3 */ -#define LDAP_CONFIDENTIALITY_REQUIRED 0x0d /* 13 */ -#define LDAP_SASL_BIND_IN_PROGRESS 0x0e /* 14 - LDAPv3 */ - -#define LDAP_NO_SUCH_ATTRIBUTE 0x10 /* 16 */ -#define LDAP_UNDEFINED_TYPE 0x11 /* 17 */ -#define LDAP_INAPPROPRIATE_MATCHING 0x12 /* 18 */ -#define LDAP_CONSTRAINT_VIOLATION 0x13 /* 19 */ -#define LDAP_TYPE_OR_VALUE_EXISTS 0x14 /* 20 */ -#define LDAP_INVALID_SYNTAX 0x15 /* 21 */ - -#define LDAP_NO_SUCH_OBJECT 0x20 /* 32 */ -#define LDAP_ALIAS_PROBLEM 0x21 /* 33 */ -#define LDAP_INVALID_DN_SYNTAX 0x22 /* 34 */ -#define LDAP_IS_LEAF 0x23 /* 35 (not used in LDAPv3) */ -#define LDAP_ALIAS_DEREF_PROBLEM 0x24 /* 36 */ - -#define LDAP_INAPPROPRIATE_AUTH 0x30 /* 48 */ -#define LDAP_INVALID_CREDENTIALS 0x31 /* 49 */ -#define LDAP_INSUFFICIENT_ACCESS 0x32 /* 50 */ -#define LDAP_BUSY 0x33 /* 51 */ -#define LDAP_UNAVAILABLE 0x34 /* 52 */ -#define LDAP_UNWILLING_TO_PERFORM 0x35 /* 53 */ -#define LDAP_LOOP_DETECT 0x36 /* 54 */ - -#define LDAP_NAMING_VIOLATION 0x40 /* 64 */ -#define LDAP_OBJECT_CLASS_VIOLATION 0x41 /* 65 */ -#define LDAP_NOT_ALLOWED_ON_NONLEAF 0x42 /* 66 */ -#define LDAP_NOT_ALLOWED_ON_RDN 0x43 /* 67 */ -#define LDAP_ALREADY_EXISTS 0x44 /* 68 */ -#define LDAP_NO_OBJECT_CLASS_MODS 0x45 /* 69 */ -#define LDAP_RESULTS_TOO_LARGE 0x46 /* 70 - CLDAP */ -#define LDAP_AFFECTS_MULTIPLE_DSAS 0x47 /* 71 */ - -#define LDAP_OTHER 0x50 /* 80 */ -#define LDAP_SERVER_DOWN 0x51 /* 81 */ -#define LDAP_LOCAL_ERROR 0x52 /* 82 */ -#define LDAP_ENCODING_ERROR 0x53 /* 83 */ -#define LDAP_DECODING_ERROR 0x54 /* 84 */ -#define LDAP_TIMEOUT 0x55 /* 85 */ -#define LDAP_AUTH_UNKNOWN 0x56 /* 86 */ -#define LDAP_FILTER_ERROR 0x57 /* 87 */ -#define LDAP_USER_CANCELLED 0x58 /* 88 */ -#define LDAP_PARAM_ERROR 0x59 /* 89 */ -#define LDAP_NO_MEMORY 0x5a /* 90 */ -#define LDAP_CONNECT_ERROR 0x5b /* 91 */ -#define LDAP_NOT_SUPPORTED 0x5c /* 92 - LDAPv3 */ -#define LDAP_CONTROL_NOT_FOUND 0x5d /* 93 - LDAPv3 */ -#define LDAP_NO_RESULTS_RETURNED 0x5e /* 94 - LDAPv3 */ -#define LDAP_MORE_RESULTS_TO_RETURN 0x5f /* 95 - LDAPv3 */ -#define LDAP_CLIENT_LOOP 0x60 /* 96 - LDAPv3 */ -#define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* 97 - LDAPv3 */ - -/* - * LDAPv3 unsolicited notification messages we know about - */ -#define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036" - -/* - * Client controls we know about - */ -#define LDAP_CONTROL_REFERRALS "1.2.840.113556.1.4.616" - -/* - * Initializing an ldap sesssion, set session handle options, and - * closing an ldap session functions - */ -LDAP_API(LDAP *) LDAP_CALL ldap_init( const char *defhost, int defport ); -LDAP_API(int) LDAP_CALL ldap_set_option( LDAP *ld, int option, - const void *optdata ); -LDAP_API(int) LDAP_CALL ldap_get_option( LDAP *ld, int option, void *optdata ); -LDAP_API(int) LDAP_CALL ldap_unbind( LDAP *ld ); -LDAP_API(int) LDAP_CALL ldap_unbind_s( LDAP *ld ); - -/* - * perform ldap operations - */ -LDAP_API(int) LDAP_CALL ldap_abandon( LDAP *ld, int msgid ); -LDAP_API(int) LDAP_CALL ldap_add( LDAP *ld, const char *dn, LDAPMod **attrs ); -LDAP_API(int) LDAP_CALL ldap_add_s( LDAP *ld, const char *dn, LDAPMod **attrs ); -LDAP_API(int) LDAP_CALL ldap_simple_bind( LDAP *ld, const char *who, - const char *passwd ); -LDAP_API(int) LDAP_CALL ldap_simple_bind_s( LDAP *ld, const char *who, - const char *passwd ); -LDAP_API(int) LDAP_CALL ldap_modify( LDAP *ld, const char *dn, LDAPMod **mods ); -LDAP_API(int) LDAP_CALL ldap_modify_s( LDAP *ld, const char *dn, - LDAPMod **mods ); -LDAP_API(int) LDAP_CALL ldap_compare( LDAP *ld, const char *dn, - const char *attr, const char *value ); -LDAP_API(int) LDAP_CALL ldap_compare_s( LDAP *ld, const char *dn, - const char *attr, const char *value ); -LDAP_API(int) LDAP_CALL ldap_delete( LDAP *ld, const char *dn ); -LDAP_API(int) LDAP_CALL ldap_delete_s( LDAP *ld, const char *dn ); -LDAP_API(int) LDAP_CALL ldap_search( LDAP *ld, const char *base, int scope, - const char *filter, char **attrs, int attrsonly ); -LDAP_API(int) LDAP_CALL ldap_search_s( LDAP *ld, const char *base, int scope, - const char *filter, char **attrs, int attrsonly, LDAPMessage **res ); -LDAP_API(int) LDAP_CALL ldap_search_st( LDAP *ld, const char *base, int scope, - const char *filter, char **attrs, int attrsonly, - struct timeval *timeout, LDAPMessage **res ); - -/* - * obtain result from ldap operation - */ -LDAP_API(int) LDAP_CALL ldap_result( LDAP *ld, int msgid, int all, - struct timeval *timeout, LDAPMessage **result ); - -/* - * peeking inside LDAP Messages and deallocating LDAP Messages - */ -LDAP_API(int) LDAP_CALL ldap_msgfree( LDAPMessage *lm ); -LDAP_API(int) LDAP_CALL ldap_msgid( LDAPMessage *lm ); -LDAP_API(int) LDAP_CALL ldap_msgtype( LDAPMessage *lm ); - - -/* - * Routines to parse/deal with results and errors returned - */ -LDAP_API(char *) LDAP_CALL ldap_err2string( int err ); -LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_entry( LDAP *ld, - LDAPMessage *chain ); -LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_entry( LDAP *ld, - LDAPMessage *entry ); -LDAP_API(int) LDAP_CALL ldap_count_entries( LDAP *ld, LDAPMessage *chain ); -LDAP_API(char *) LDAP_CALL ldap_get_dn( LDAP *ld, LDAPMessage *entry ); -LDAP_API(char *) LDAP_CALL ldap_dn2ufn( const char *dn ); -LDAP_API(char **) LDAP_CALL ldap_explode_dn( const char *dn, - const int notypes ); -LDAP_API(char **) LDAP_CALL ldap_explode_rdn( const char *rdn, - const int notypes ); -LDAP_API(char *) LDAP_CALL ldap_first_attribute( LDAP *ld, LDAPMessage *entry, - BerElement **ber ); -LDAP_API(char *) LDAP_CALL ldap_next_attribute( LDAP *ld, LDAPMessage *entry, - BerElement *ber ); -LDAP_API(char **) LDAP_CALL ldap_get_values( LDAP *ld, LDAPMessage *entry, - const char *target ); -LDAP_API(struct berval **) LDAP_CALL ldap_get_values_len( LDAP *ld, - LDAPMessage *entry, const char *target ); -LDAP_API(int) LDAP_CALL ldap_count_values( char **vals ); -LDAP_API(int) LDAP_CALL ldap_count_values_len( struct berval **vals ); -LDAP_API(void) LDAP_CALL ldap_value_free( char **vals ); -LDAP_API(void) LDAP_CALL ldap_value_free_len( struct berval **vals ); -LDAP_API(void) LDAP_CALL ldap_memfree( void *p ); - - -/* - * LDAPv3 extended operation calls - */ -/* - * Note: all of the new asynchronous calls return an LDAP error code, - * not a message id. A message id is returned via the int *msgidp - * parameter (usually the last parameter) if appropriate. - */ -LDAP_API(int) LDAP_CALL ldap_abandon_ext( LDAP *ld, int msgid, - LDAPControl **serverctrls, LDAPControl **clientctrls ); -LDAP_API(int) LDAP_CALL ldap_add_ext( LDAP *ld, const char *dn, LDAPMod **attrs, - LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp ); -LDAP_API(int) LDAP_CALL ldap_add_ext_s( LDAP *ld, const char *dn, - LDAPMod **attrs, LDAPControl **serverctrls, LDAPControl **clientctrls ); -LDAP_API(int) LDAP_CALL ldap_sasl_bind( LDAP *ld, const char *dn, - const char *mechanism, const struct berval *cred, - LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp ); -LDAP_API(int) LDAP_CALL ldap_sasl_bind_s( LDAP *ld, const char *dn, - const char *mechanism, const struct berval *cred, - LDAPControl **serverctrls, LDAPControl **clientctrls, - struct berval **servercredp ); -LDAP_API(int) LDAP_CALL ldap_modify_ext( LDAP *ld, const char *dn, - LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls, - int *msgidp ); -LDAP_API(int) LDAP_CALL ldap_modify_ext_s( LDAP *ld, const char *dn, - LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls ); -LDAP_API(int) LDAP_CALL ldap_rename( LDAP *ld, const char *dn, - const char *newrdn, const char *newparent, int deleteoldrdn, - LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp ); -LDAP_API(int) LDAP_CALL ldap_rename_s( LDAP *ld, const char *dn, - const char *newrdn, const char *newparent, int deleteoldrdn, - LDAPControl **serverctrls, LDAPControl **clientctrls ); -LDAP_API(int) LDAP_CALL ldap_compare_ext( LDAP *ld, const char *dn, - const char *attr, const struct berval *bvalue, - LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp ); -LDAP_API(int) LDAP_CALL ldap_compare_ext_s( LDAP *ld, const char *dn, - const char *attr, const struct berval *bvalue, - LDAPControl **serverctrls, LDAPControl **clientctrls ); -LDAP_API(int) LDAP_CALL ldap_delete_ext( LDAP *ld, const char *dn, - LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp ); -LDAP_API(int) LDAP_CALL ldap_delete_ext_s( LDAP *ld, const char *dn, - LDAPControl **serverctrls, LDAPControl **clientctrls ); -LDAP_API(int) LDAP_CALL ldap_search_ext( LDAP *ld, const char *base, - int scope, const char *filter, char **attrs, int attrsonly, - LDAPControl **serverctrls, LDAPControl **clientctrls, - struct timeval *timeoutp, int sizelimit, int *msgidp ); -LDAP_API(int) LDAP_CALL ldap_search_ext_s( LDAP *ld, const char *base, - int scope, const char *filter, char **attrs, int attrsonly, - LDAPControl **serverctrls, LDAPControl **clientctrls, - struct timeval *timeoutp, int sizelimit, LDAPMessage **res ); -LDAP_API(int) LDAP_CALL ldap_extended_operation( LDAP *ld, - const char *requestoid, const struct berval *requestdata, - LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp ); -LDAP_API(int) LDAP_CALL ldap_extended_operation_s( LDAP *ld, - const char *requestoid, const struct berval *requestdata, - LDAPControl **serverctrls, LDAPControl **clientctrls, - char **retoidp, struct berval **retdatap ); -LDAP_API(int) LDAP_CALL ldap_unbind_ext( LDAP *ld, LDAPControl **serverctrls, - LDAPControl **clientctrls ); - - -/* - * LDAPv3 extended parsing / result handling calls - */ -LDAP_API(int) LDAP_CALL ldap_parse_sasl_bind_result( LDAP *ld, - LDAPMessage *res, struct berval **servercredp, int freeit ); -LDAP_API(int) LDAP_CALL ldap_parse_result( LDAP *ld, LDAPMessage *res, - int *errcodep, char **matcheddnp, char **errmsgp, char ***referralsp, - LDAPControl ***serverctrlsp, int freeit ); -LDAP_API(int) LDAP_CALL ldap_parse_extended_result( LDAP *ld, LDAPMessage *res, - char **retoidp, struct berval **retdatap, int freeit ); -LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_message( LDAP *ld, - LDAPMessage *res ); -LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_message( LDAP *ld, - LDAPMessage *msg ); -LDAP_API(int) LDAP_CALL ldap_count_messages( LDAP *ld, LDAPMessage *res ); -LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_reference( LDAP *ld, - LDAPMessage *res ); -LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_reference( LDAP *ld, - LDAPMessage *ref ); -LDAP_API(int) LDAP_CALL ldap_count_references( LDAP *ld, LDAPMessage *res ); -LDAP_API(int) LDAP_CALL ldap_parse_reference( LDAP *ld, LDAPMessage *ref, - char ***referralsp, LDAPControl ***serverctrlsp, int freeit ); -LDAP_API(int) LDAP_CALL ldap_get_entry_controls( LDAP *ld, LDAPMessage *entry, - LDAPControl ***serverctrlsp ); -LDAP_API(void) LDAP_CALL ldap_control_free( LDAPControl *ctrl ); -LDAP_API(void) LDAP_CALL ldap_controls_free( LDAPControl **ctrls ); - -#ifdef __cplusplus -} -#endif -#endif /* _LDAP_STANDARD_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/ldap-to-be-deprecated.h b/mozilla/directory/c-sdk/ldap/include/ldap-to-be-deprecated.h deleted file mode 100644 index 11746ffc2dd..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldap-to-be-deprecated.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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-to-be-deprecated.h - functions and declaration which will be - * deprecated in a future release. - * - * A deprecated API is an API that we recommend you no longer use, - * due to improvements in the LDAP C SDK. While deprecated APIs are - * currently still implemented, they may be removed in future - * implementations, and we recommend using other APIs. - * - * This header file will act as a first warning before moving functions - * into an unsupported/deprecated state. If your favorite application - * depend on any declaration and defines, and there is a good reason - * for not porting to new functions, Speak up now or they may disappear - * in a future release - */ - -#ifndef _LDAP_TOBE_DEPRECATED_H -#define _LDAP_TOBE_DEPRECATED_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * I/O function callbacks option (an API extension -- - * LDAP_API_FEATURE_X_IO_FUNCTIONS). - * Use of the extended I/O functions instead is recommended - */ -#define LDAP_OPT_IO_FN_PTRS 0x0B /* 11 - API extension */ - -/* - * I/O callback functions (note that types for the read and write callbacks - * are actually in lber.h): - */ -typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_SELECT_CALLBACK)( int nfds, - fd_set *readfds, fd_set *writefds, fd_set *errorfds, - struct timeval *timeout ); -typedef LBER_SOCKET (LDAP_C LDAP_CALLBACK LDAP_IOF_SOCKET_CALLBACK)( - int domain, int type, int protocol ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_IOCTL_CALLBACK)( LBER_SOCKET s, - int option, ... ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_CONNECT_CALLBACK )( - LBER_SOCKET s, struct sockaddr *name, int namelen ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_CLOSE_CALLBACK )( - LBER_SOCKET s ); -typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_SSL_ENABLE_CALLBACK )( - LBER_SOCKET s ); - -/* - * Structure to hold I/O function pointers: - */ -struct ldap_io_fns { - LDAP_IOF_READ_CALLBACK *liof_read; - LDAP_IOF_WRITE_CALLBACK *liof_write; - LDAP_IOF_SELECT_CALLBACK *liof_select; - LDAP_IOF_SOCKET_CALLBACK *liof_socket; - LDAP_IOF_IOCTL_CALLBACK *liof_ioctl; - LDAP_IOF_CONNECT_CALLBACK *liof_connect; - LDAP_IOF_CLOSE_CALLBACK *liof_close; - LDAP_IOF_SSL_ENABLE_CALLBACK *liof_ssl_enable; -}; - -/* - * DNS resolver callbacks (an API extension --LDAP_API_FEATURE_X_DNS_FUNCTIONS). - * Note that gethostbyaddr() is not currently used. - */ -#define LDAP_OPT_DNS_FN_PTRS 0x60 /* 96 - API extension */ - -typedef struct LDAPHostEnt { - char *ldaphe_name; /* official name of host */ - char **ldaphe_aliases; /* alias list */ - int ldaphe_addrtype; /* host address type */ - int ldaphe_length; /* length of address */ - char **ldaphe_addr_list; /* list of addresses from name server */ -} LDAPHostEnt; - -typedef LDAPHostEnt * (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYNAME)( - const char *name, LDAPHostEnt *result, char *buffer, - int buflen, int *statusp, void *extradata ); -typedef LDAPHostEnt * (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYADDR)( - const char *addr, int length, int type, LDAPHostEnt *result, - char *buffer, int buflen, int *statusp, void *extradata ); - -struct ldap_dns_fns { - void *lddnsfn_extradata; - int lddnsfn_bufsize; - LDAP_DNSFN_GETHOSTBYNAME *lddnsfn_gethostbyname; - LDAP_DNSFN_GETHOSTBYADDR *lddnsfn_gethostbyaddr; -}; - -/* - * experimental DN format support - */ -LDAP_API(char **) LDAP_CALL ldap_explode_dns( const char *dn ); -LDAP_API(int) LDAP_CALL ldap_is_dns_dn( const char *dn ); - - -/* - * user friendly naming/searching routines - */ -typedef int (LDAP_C LDAP_CALLBACK LDAP_CANCELPROC_CALLBACK)( void *cl ); -LDAP_API(int) LDAP_CALL ldap_ufn_search_c( LDAP *ld, char *ufn, - char **attrs, int attrsonly, LDAPMessage **res, - LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm ); -LDAP_API(int) LDAP_CALL ldap_ufn_search_ct( LDAP *ld, char *ufn, - char **attrs, int attrsonly, LDAPMessage **res, - LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm, - char *tag1, char *tag2, char *tag3 ); -LDAP_API(int) LDAP_CALL ldap_ufn_search_s( LDAP *ld, char *ufn, - char **attrs, int attrsonly, LDAPMessage **res ); -LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_ufn_setfilter( LDAP *ld, char *fname ); -LDAP_API(void) LDAP_CALL ldap_ufn_setprefix( LDAP *ld, char *prefix ); -LDAP_API(int) LDAP_C ldap_ufn_timeout( void *tvparam ); - -/* - * utility routines - */ -LDAP_API(int) LDAP_CALL ldap_charray_add( char ***a, char *s ); -LDAP_API(int) LDAP_CALL ldap_charray_merge( char ***a, char **s ); -LDAP_API(void) LDAP_CALL ldap_charray_free( char **array ); -LDAP_API(int) LDAP_CALL ldap_charray_inlist( char **a, char *s ); -LDAP_API(char **) LDAP_CALL ldap_charray_dup( char **a ); -LDAP_API(char **) LDAP_CALL ldap_str2charray( char *str, char *brkstr ); -LDAP_API(int) LDAP_CALL ldap_charray_position( char **a, char *s ); - -/* from ldap_ssl.h - the pkcs function and declaration */ -typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_TOKEN_CALLBACK)(void *context, char **tokenname); -typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_PIN_CALLBACK)(void *context, const char *tokenname, char **tokenpin); -typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTPATH_CALLBACK)(void *context, char **certpath); -typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_KEYPATH_CALLBACK)(void *context,char **keypath); -typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_MODPATH_CALLBACK)(void *context, char **modulepath); -typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTNAME_CALLBACK)(void *context, char **certname); -typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK)(void *context, char **filename); - -#define PKCS_STRUCTURE_ID 1 -struct ldapssl_pkcs_fns { - int local_structure_id; - void *local_data; - LDAP_PKCS_GET_CERTPATH_CALLBACK *pkcs_getcertpath; - LDAP_PKCS_GET_CERTNAME_CALLBACK *pkcs_getcertname; - LDAP_PKCS_GET_KEYPATH_CALLBACK *pkcs_getkeypath; - LDAP_PKCS_GET_MODPATH_CALLBACK *pkcs_getmodpath; - LDAP_PKCS_GET_PIN_CALLBACK *pkcs_getpin; - LDAP_PKCS_GET_TOKEN_CALLBACK *pkcs_gettokenname; - LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK *pkcs_getdonglefilename; - -}; - -LDAP_API(int) LDAP_CALL ldapssl_pkcs_init( const struct ldapssl_pkcs_fns *pfns); - -#ifdef __cplusplus -} -#endif -#endif /* _LDAP_TOBE_DEPRECATED_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/ldap.h b/mozilla/directory/c-sdk/ldap/include/ldap.h deleted file mode 100644 index c00a7cba811..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldap.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.h - general header file for libldap */ - -#ifndef _LDAP_H -#define _LDAP_H - -/* Standard LDAP API functions and declarations */ -#include "ldap-standard.h" - -/* Extensions to the LDAP standard */ -#include "ldap-extension.h" - -/* A deprecated API is an API that we recommend you no longer use, - * due to improvements in the LDAP C SDK. While deprecated APIs are - * currently still implemented, they may be removed in future - * implementations, and we recommend using other APIs. - */ - -/* Soon-to-be deprecated functions and declarations */ -#include "ldap-to-be-deprecated.h" - -/* Deprecated functions and declarations */ -#include "ldap-deprecated.h" - -#endif /* _LDAP_H */ - diff --git a/mozilla/directory/c-sdk/ldap/include/ldap_ssl.h b/mozilla/directory/c-sdk/ldap/include/ldap_ssl.h deleted file mode 100755 index 4455c66b4e8..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldap_ssl.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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): - */ - -#if !defined(LDAP_SSL_H) -#define LDAP_SSL_H - -/* ldap_ssl.h - prototypes for LDAP over SSL functions */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * these three defines resolve the SSL strength - * setting auth weak, diables all cert checking - * the CNCHECK tests for the man in the middle hack - */ -#define LDAPSSL_AUTH_WEAK 0 -#define LDAPSSL_AUTH_CERT 1 -#define LDAPSSL_AUTH_CNCHECK 2 - - -/* - * Initialize LDAP library for SSL - */ -LDAP * LDAP_CALL ldapssl_init( const char *defhost, int defport, - int defsecure ); - -/* - * Install I/O routines to make SSL over LDAP possible. - * Use this after ldap_init() or just use ldapssl_init() instead. - */ -int LDAP_CALL ldapssl_install_routines( LDAP *ld ); - - -/* The next three functions initialize the security code for SSL - * The first one ldapssl_client_init() does initialization for SSL only - * The next one supports ldapssl_clientauth_init() intializes security - * for SSL for client authentication. The third function initializes - * security for doing SSL with client authentication, and PKCS, that is, - * the third function initializes the security module database (secmod.db). - * The parameters are as follows: - * const char *certdbpath - path to the cert file. This can be a shortcut - * to the directory name, if so cert7.db will be postfixed to the string. - * void *certdbhandle - Normally this is NULL. This memory will need - * to be freed. - * int needkeydb - boolean. Must be !=0 if client Authentification - * is required - * char *keydbpath - path to the key database. This can be a shortcut - * to the directory name, if so key3.db will be postfixed to the string. - * void *keydbhandle - Normally this is NULL, This memory will need - * to be freed - * int needsecmoddb - boolean. Must be !=0 to assure that the correct - * security module is loaded into memory - * char *secmodpath - path to the secmod. This can be a shortcut to the - * directory name, if so secmod.db will be postfixed to the string. - * - * These three functions are mutually exclusive. You can only call - * one. This means that, for a given process, you must call the - * appropriate initialization function for the life of the process. - */ - - -/* - * Initialize the secure parts (Security and SSL) of the runtime for use - * by a client application. This is only called once. - */ -int LDAP_CALL ldapssl_client_init( - const char *certdbpath, void *certdbhandle ); -/* - * Initialize the secure parts (Security and SSL) of the runtime for use - * by a client application that may want to do SSL client authentication. - */ -int LDAP_CALL ldapssl_clientauth_init( - const char *certdbpath, void *certdbhandle, - const int needkeydb, const char *keydbpath, void *keydbhandle ); - -/* - * Initialize the secure parts (Security and SSL) of the runtime for use - * by a client application that may want to do SSL client authentication. - */ -int LDAP_CALL ldapssl_advclientauth_init( - const char *certdbpath, void *certdbhandle, - const int needkeydb, const char *keydbpath, void *keydbhandle, - const int needsecmoddb, const char *secmoddbpath, - const int sslstrength ); - - - -/* - * get a meaningful error string back from the security library - * this function should be called, if ldap_err2string doesn't - * identify the error code. - */ -const char * LDAP_CALL ldapssl_err2string( const int prerrno ); - - -/* - * Enable SSL client authentication on the given ld. - */ -int LDAP_CALL ldapssl_enable_clientauth( LDAP *ld, char *keynickname, - char *keypasswd, char *certnickname ); - -#ifdef __cplusplus -} -#endif -#endif /* !defined(LDAP_SSL_H) */ - - - - - diff --git a/mozilla/directory/c-sdk/ldap/include/ldaplog.h b/mozilla/directory/c-sdk/ldap/include/ldaplog.h deleted file mode 100644 index 1b365b4f82e..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldaplog.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 _LDAPLOG_H -#define _LDAPLOG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDAP_DEBUG_TRACE 0x00001 -#define LDAP_DEBUG_PACKETS 0x00002 -#define LDAP_DEBUG_ARGS 0x00004 -#define LDAP_DEBUG_CONNS 0x00008 -#define LDAP_DEBUG_BER 0x00010 -#define LDAP_DEBUG_FILTER 0x00020 -#define LDAP_DEBUG_CONFIG 0x00040 -#define LDAP_DEBUG_ACL 0x00080 -#define LDAP_DEBUG_STATS 0x00100 -#define LDAP_DEBUG_STATS2 0x00200 -#define LDAP_DEBUG_SHELL 0x00400 -#define LDAP_DEBUG_PARSE 0x00800 -#define LDAP_DEBUG_HOUSE 0x01000 -#define LDAP_DEBUG_REPL 0x02000 -#define LDAP_DEBUG_ANY 0x04000 -#define LDAP_DEBUG_CACHE 0x08000 -#define LDAP_DEBUG_PLUGIN 0x10000 - -/* debugging stuff */ -/* Disable by default */ -#define LDAPDebug( level, fmt, arg1, arg2, arg3 ) - -#ifdef LDAP_DEBUG -# undef LDAPDebug - -/* SLAPD_LOGGING should not be on for WINSOCK (16-bit Windows) */ -# if defined(SLAPD_LOGGING) -# ifdef _WIN32 - extern int *module_ldap_debug; -# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \ - { \ - if ( *module_ldap_debug & level ) { \ - slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \ - } \ - } -# else /* _WIN32 */ - extern int ldap_debug; -# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \ - { \ - if ( ldap_debug & level ) { \ - slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \ - } \ - } -# endif /* Win32 */ -# else /* no SLAPD_LOGGING */ - extern void ber_err_print( char * ); - extern int ldap_debug; -# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \ - if ( ldap_debug & level ) { \ - char msg[256]; \ - sprintf( msg, fmt, arg1, arg2, arg3 ); \ - ber_err_print( msg ); \ - } -# endif /* SLAPD_LOGGING */ -#endif /* LDAP_DEBUG */ - -#ifdef __cplusplus -} -#endif - -#endif /* _LDAP_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/ldappr.h b/mozilla/directory/c-sdk/ldap/include/ldappr.h deleted file mode 100755 index e30d0aa3dfa..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldappr.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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 LDAP_PR_H -#define LDAP_PR_H - -#include "nspr.h" - -/* - * ldappr.h - prototypes for functions that tie libldap into NSPR (Netscape - * Portable Runtime). - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Function: prldap_init(). - * - * Create a new LDAP session handle, but with NSPR I/O, threading, and DNS - * functions installed. - * - * Pass a non-zero value for the 'shared' parameter if you plan to use - * this LDAP * handle from more than one thread. - * - * Returns an LDAP session handle (or NULL if an error occurs). - */ -LDAP * LDAP_CALL prldap_init( const char *defhost, int defport, int shared ); - - -/* - * Function: prldap_install_routines(). - * - * Install NSPR I/O, threading, and DNS functions so they will be used by - * 'ld'. - * - * If 'ld' is NULL, the functions are installed as the default functions - * for all new LDAP * handles). - * - * Pass a non-zero value for the 'shared' parameter if you plan to use - * this LDAP * handle from more than one thread. - * - * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). - */ -int LDAP_CALL prldap_install_routines( LDAP *ld, int shared ); - - -/** - ** Note: the types and functions below are only useful for developers - ** who need to layer one or more custom extended I/O functions on top of - ** the standard NSPR I/O functions installed by a call to prldap_init() - ** or prldap_install_routines(). Layering can be accomplished after - ** prldap_init() or prldap_install_routines() has completed successfully - ** by: - ** - ** 1) Calling ldap_get_option( ..., LDAP_X_OPT_EXTIO_FN_PTRS, ... ). - ** - ** 2) Saving the function pointer of one or more of the standard functions. - ** - ** 3) Replacing one or more standard functions in the ldap_x_ext_io_fns - ** struct with new functions that optionally do some preliminary work, - ** call the standard function (via the function pointer saved in step 2), - ** and optionally do some followup work. - */ - -/* - * Data structure for session information. - * seinfo_size should be set to PRLDAP_SESSIONINFO_SIZE before use. - */ -struct prldap_session_private; - -typedef struct prldap_session_info { - int seinfo_size; - struct prldap_session_private *seinfo_appdata; -} PRLDAPSessionInfo; -#define PRLDAP_SESSIONINFO_SIZE sizeof( PRLDAPSessionInfo ) - - -/* - * Function: prldap_set_session_info(). - * - * Given an LDAP session handle or a session argument such is passed to - * SOCKET, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks, - * set some application-specific data. If ld is NULL, arg is used. If - * both ld and arg are NULL, LDAP_PARAM_ERROR is returned. - * - * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). - */ -int LDAP_CALL prldap_set_session_info( LDAP *ld, void *sessionarg, - PRLDAPSessionInfo *seip ); - - -/* - * Function: prldap_get_session_info(). - * - * Given an LDAP session handle or a session argument such is passed to - * SOCKET, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks, - * retrieve some application-specific data. If ld is NULL, arg is used. If - * both ld and arg are NULL, LDAP_PARAM_ERROR is returned. - * - * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in - * which case the fields in the structure that seip points to are filled in). - */ -int LDAP_CALL prldap_get_session_info( LDAP *ld, void *sessionarg, - PRLDAPSessionInfo *seip ); - - -/* - * Data structure for socket specific information. - * Note: soinfo_size should be set to PRLDAP_SOCKETINFO_SIZE before use. - */ -struct prldap_socket_private; -typedef struct prldap_socket_info { - int soinfo_size; - PRFileDesc *soinfo_prfd; - struct prldap_socket_private *soinfo_appdata; -} PRLDAPSocketInfo; -#define PRLDAP_SOCKETINFO_SIZE sizeof( PRLDAPSocketInfo ) - - -/* - * Function: prldap_set_socket_info(). - * - * Given an integer fd and a socket argument such as those passed to the - * extended I/O callback functions, set socket specific information. - * - * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). - * - * Note: it is only safe to change soinfo_prfd from within the SOCKET - * extended I/O callback function. - */ -int LDAP_CALL prldap_set_socket_info( int fd, void *socketarg, - PRLDAPSocketInfo *soip ); - -/* - * Function: prldap_get_socket_info(). - * - * Given an integer fd and a socket argument such as those passed to the - * extended I/O callback functions, retrieve socket specific information. - * - * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in - * which case the fields in the structure that soip points to are filled in). - */ -int LDAP_CALL prldap_get_socket_info( int fd, void *socketarg, - PRLDAPSocketInfo *soip ); - -#ifdef __cplusplus -} -#endif -#endif /* !defined(LDAP_PR_H) */ diff --git a/mozilla/directory/c-sdk/ldap/include/ldaprot.h b/mozilla/directory/c-sdk/ldap/include/ldaprot.h deleted file mode 100644 index f22fc4ff3c7..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldaprot.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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 _LDAPROT_H -#define _LDAPROT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDAP_VERSION1 1 -#define LDAP_VERSION2 2 -#define LDAP_VERSION3 3 -#define LDAP_VERSION LDAP_VERSION2 - -#define COMPAT20 -#define COMPAT30 -#if defined(COMPAT20) || defined(COMPAT30) -#define COMPAT -#endif - -#define LDAP_URL_PREFIX "ldap://" -#define LDAP_URL_PREFIX_LEN 7 -#define LDAPS_URL_PREFIX "ldaps://" -#define LDAPS_URL_PREFIX_LEN 8 -#define LDAP_REF_STR "Referral:\n" -#define LDAP_REF_STR_LEN 10 - -/* - * specific LDAP instantiations of BER types we know about - */ - -/* general stuff */ -#define LDAP_TAG_MESSAGE 0x30L /* tag is 16 + constructed bit */ -#define OLD_LDAP_TAG_MESSAGE 0x10L /* forgot the constructed bit */ -#define LDAP_TAG_MSGID 0x02L /* INTEGER */ -#define LDAP_TAG_LDAPDN 0x04L /* OCTET STRING */ -#define LDAP_TAG_CONTROLS 0xa0L /* context specific + constructed + 0 */ -#define LDAP_TAG_REFERRAL 0xa3L /* context specific + constructed + 3 */ -#define LDAP_TAG_NEWSUPERIOR 0x80L /* context specific + primitive + 0 */ -#define LDAP_TAG_MRA_OID 0x81L /* context specific + primitive + 1 */ -#define LDAP_TAG_MRA_TYPE 0x82L /* context specific + primitive + 2 */ -#define LDAP_TAG_MRA_VALUE 0x83L /* context specific + primitive + 3 */ -#define LDAP_TAG_MRA_DNATTRS 0x84L /* context specific + primitive + 4 */ -#define LDAP_TAG_EXOP_REQ_OID 0x80L /* context specific + primitive + 0 */ -#define LDAP_TAG_EXOP_REQ_VALUE 0x81L /* context specific + primitive + 1 */ -#define LDAP_TAG_EXOP_RES_OID 0x8aL /* context specific + primitive + 10 */ -#define LDAP_TAG_EXOP_RES_VALUE 0x8bL /* context specific + primitive + 11 */ -#define LDAP_TAG_SK_MATCHRULE 0x80L /* context specific + primitive + 0 */ -#define LDAP_TAG_SK_REVERSE 0x81L /* context specific + primitive + 1 */ -#define LDAP_TAG_SR_ATTRTYPE 0x80L /* context specific + primitive + 0 */ -#define LDAP_TAG_SASL_RES_CREDS 0x87L /* context specific + primitive + 7 */ -#define LDAP_TAG_VLV_BY_INDEX 0xa0L /* context specific + constructed + 0 */ -#define LDAP_TAG_VLV_BY_VALUE 0x81L /* context specific + primitive + 1 */ - -/* possible operations a client can invoke */ -#define LDAP_REQ_BIND 0x60L /* application + constructed + 0 */ -#define LDAP_REQ_UNBIND 0x42L /* application + primitive + 2 */ -#define LDAP_REQ_SEARCH 0x63L /* application + constructed + 3 */ -#define LDAP_REQ_MODIFY 0x66L /* application + constructed + 6 */ -#define LDAP_REQ_ADD 0x68L /* application + constructed + 8 */ -#define LDAP_REQ_DELETE 0x4aL /* application + primitive + 10 */ -#define LDAP_REQ_MODRDN 0x6cL /* application + constructed + 12 */ -#define LDAP_REQ_MODDN 0x6cL /* application + constructed + 12 */ -#define LDAP_REQ_RENAME 0x6cL /* application + constructed + 12 */ -#define LDAP_REQ_COMPARE 0x6eL /* application + constructed + 14 */ -#define LDAP_REQ_ABANDON 0x50L /* application + primitive + 16 */ -#define LDAP_REQ_EXTENDED 0x77L /* application + constructed + 23 */ - -/* U-M LDAP release 3.0 compatibility stuff */ -#define LDAP_REQ_UNBIND_30 0x62L -#define LDAP_REQ_DELETE_30 0x6aL -#define LDAP_REQ_ABANDON_30 0x70L - -/* - * old broken stuff for backwards compatibility - forgot application tag - * and constructed/primitive bit - */ -#define OLD_LDAP_REQ_BIND 0x00L -#define OLD_LDAP_REQ_UNBIND 0x02L -#define OLD_LDAP_REQ_SEARCH 0x03L -#define OLD_LDAP_REQ_MODIFY 0x06L -#define OLD_LDAP_REQ_ADD 0x08L -#define OLD_LDAP_REQ_DELETE 0x0aL -#define OLD_LDAP_REQ_MODRDN 0x0cL -#define OLD_LDAP_REQ_MODDN 0x0cL -#define OLD_LDAP_REQ_COMPARE 0x0eL -#define OLD_LDAP_REQ_ABANDON 0x10L - -/* old broken stuff for backwards compatibility */ -#define OLD_LDAP_RES_BIND 0x01L -#define OLD_LDAP_RES_SEARCH_ENTRY 0x04L -#define OLD_LDAP_RES_SEARCH_RESULT 0x05L -#define OLD_LDAP_RES_MODIFY 0x07L -#define OLD_LDAP_RES_ADD 0x09L -#define OLD_LDAP_RES_DELETE 0x0bL -#define OLD_LDAP_RES_MODRDN 0x0dL -#define OLD_LDAP_RES_MODDN 0x0dL -#define OLD_LDAP_RES_COMPARE 0x0fL - -/* U-M LDAP 3.0 compatibility auth methods */ -#define LDAP_AUTH_SIMPLE_30 0xa0L /* context specific + constructed */ -#define LDAP_AUTH_KRBV41_30 0xa1L /* context specific + constructed */ -#define LDAP_AUTH_KRBV42_30 0xa2L /* context specific + constructed */ - -/* old broken stuff */ -#define OLD_LDAP_AUTH_SIMPLE 0x00L -#define OLD_LDAP_AUTH_KRBV4 0x01L -#define OLD_LDAP_AUTH_KRBV42 0x02L - -/* U-M LDAP 3.0 compatibility filter types */ -#define LDAP_FILTER_PRESENT_30 0xa7L /* context specific + constructed */ - -/* filter types */ -#define LDAP_FILTER_AND 0xa0L /* context specific + constructed + 0 */ -#define LDAP_FILTER_OR 0xa1L /* context specific + constructed + 1 */ -#define LDAP_FILTER_NOT 0xa2L /* context specific + constructed + 2 */ -#define LDAP_FILTER_EQUALITY 0xa3L /* context specific + constructed + 3 */ -#define LDAP_FILTER_SUBSTRINGS 0xa4L /* context specific + constructed + 4 */ -#define LDAP_FILTER_GE 0xa5L /* context specific + constructed + 5 */ -#define LDAP_FILTER_LE 0xa6L /* context specific + constructed + 6 */ -#define LDAP_FILTER_PRESENT 0x87L /* context specific + primitive + 7 */ -#define LDAP_FILTER_APPROX 0xa8L /* context specific + constructed + 8 */ -#define LDAP_FILTER_EXTENDED 0xa9L /* context specific + constructed + 0 */ - -/* old broken stuff */ -#define OLD_LDAP_FILTER_AND 0x00L -#define OLD_LDAP_FILTER_OR 0x01L -#define OLD_LDAP_FILTER_NOT 0x02L -#define OLD_LDAP_FILTER_EQUALITY 0x03L -#define OLD_LDAP_FILTER_SUBSTRINGS 0x04L -#define OLD_LDAP_FILTER_GE 0x05L -#define OLD_LDAP_FILTER_LE 0x06L -#define OLD_LDAP_FILTER_PRESENT 0x07L -#define OLD_LDAP_FILTER_APPROX 0x08L - -/* substring filter component types */ -#define LDAP_SUBSTRING_INITIAL 0x80L /* context specific + primitive + 0 */ -#define LDAP_SUBSTRING_ANY 0x81L /* context specific + primitive + 1 */ -#define LDAP_SUBSTRING_FINAL 0x82L /* context specific + primitive + 2 */ - -/* extended filter component types */ -#define LDAP_FILTER_EXTENDED_OID 0x81L /* context spec. + prim. + 1 */ -#define LDAP_FILTER_EXTENDED_TYPE 0x82L /* context spec. + prim. + 2 */ -#define LDAP_FILTER_EXTENDED_VALUE 0x83L /* context spec. + prim. + 3 */ -#define LDAP_FILTER_EXTENDED_DNATTRS 0x84L /* context spec. + prim. + 4 */ - -/* U-M LDAP 3.0 compatibility substring filter component types */ -#define LDAP_SUBSTRING_INITIAL_30 0xa0L /* context specific */ -#define LDAP_SUBSTRING_ANY_30 0xa1L /* context specific */ -#define LDAP_SUBSTRING_FINAL_30 0xa2L /* context specific */ - -/* old broken stuff */ -#define OLD_LDAP_SUBSTRING_INITIAL 0x00L -#define OLD_LDAP_SUBSTRING_ANY 0x01L -#define OLD_LDAP_SUBSTRING_FINAL 0x02L - -#ifdef __cplusplus -} -#endif -#endif /* _LDAPROT_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/ldbm.h b/mozilla/directory/c-sdk/ldap/include/ldbm.h deleted file mode 100755 index 366b821abe4..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldbm.h +++ /dev/null @@ -1,384 +0,0 @@ -/* - * 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): - */ - -/* ldbm.h - ldap dbm compatibility routine header file */ - -#ifndef _LDBM_H_ -#define _LDBM_H_ - -/* define LDAP_USE_DB185 to get the old db library, otherwise, use db2.0 */ -#ifndef LDAP_USE_DB185 -#define LDAP_USE_DB20 -#endif - -#ifdef LDBM_USE_GDBM - -/***************************************************************** - * * - * use gdbm if possible * - * * - *****************************************************************/ - -#include - -typedef datum Datum; - -typedef GDBM_FILE LDBM; - -extern gdbm_error gdbm_errno; - -/* for ldbm_open */ -#define LDBM_READER GDBM_READER -#define LDBM_WRITER GDBM_WRITER -#define LDBM_WRCREAT GDBM_WRCREAT -#define LDBM_NEWDB GDBM_NEWDB -#define LDBM_FAST GDBM_FAST - -#define LDBM_SUFFIX ".gdbm" - -/* for ldbm_insert */ -#define LDBM_INSERT GDBM_INSERT -#define LDBM_REPLACE GDBM_REPLACE -#define LDBM_SYNC 0x80000000 - -#else /* end of gdbm */ - -#ifdef LDBM_USE_DBHASH - -/***************************************************************** - * * - * use berkeley db hash package * - * * - *****************************************************************/ - -#include -#include -#include -#include -#include - -typedef DBT Datum; -#define dsize size -#define dptr data - -typedef DB *LDBM; - -#define DB_TYPE DB_HASH - -/* for ldbm_open */ -#define LDBM_READER O_RDONLY -#define LDBM_WRITER O_RDWR -#define LDBM_WRCREAT (O_RDWR|O_CREAT) -#define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT) -#define LDBM_FAST 0 - -#define LDBM_SUFFIX ".dbh" - -/* for ldbm_insert */ -#define LDBM_INSERT R_NOOVERWRITE -#define LDBM_REPLACE 0 -#define LDBM_SYNC 0x80000000 - -#else /* end of db hash */ - -#ifdef LDBM_USE_DBBTREE - -/***************************************************************** - * * - * use berkeley db btree package * - * * - *****************************************************************/ - -#ifndef LDAP_USE_DB20 /* old-db needed us to include these system headers first */ -#include -#include -#include -#include -#endif - -#include - -#define DB_TYPE DB_BTREE - -#define LDBM_ORDERED 1 - -#ifdef LDAP_USE_DB20 - -/* pull in parts of the new interface , this comes from dblayer.h */ - -typedef struct _tag_dblayer_session{ - DB_ENV db_env; -} *dblayer_session, dblayer_session_struct; - - -/* for ldbm_insert */ -#define LDBM_INSERT DB_NOOVERWRITE -#define LDBM_REPLACE 0 /* Db2.0 default is to replace */ -#define LDBM_SYNC 0x80000000 - -typedef DBT Datum; -#define dsize size -#define dptr data - -typedef struct _ldbm { - DB *pReal_DB; - DBC *pCursor; -} _ldbmstruct, *LDBM; - -/* for ldbm_open */ -#define LDBM_READER DB_RDONLY -#define LDBM_WRITER 0 -#define LDBM_WRCREAT DB_CREATE -#define LDBM_NEWDB (DB_TRUNCATE | DB_CREATE) -#define LDBM_FAST 0 - -#define LDBM_SUFFIX ".db2" -#else /* DB 1.85 */ - -/* for ldbm_insert */ -#define LDBM_INSERT R_NOOVERWRITE -#define LDBM_REPLACE 0 -#define LDBM_SYNC 0x80000000 - -typedef DBT Datum; -#define dsize size -#define dptr data - -typedef DB *LDBM; -/* for ldbm_open */ -#define LDBM_READER O_RDONLY -#define LDBM_WRITER O_RDWR -#define LDBM_WRCREAT (O_RDWR|O_CREAT) -#define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT) -#define LDBM_FAST 0 - -#define LDBM_SUFFIX ".dbb" -#endif /* LDAP_USE_DB20 */ - -#else /* end of db btree */ - -#ifdef LDBM_USE_NDBM - -/***************************************************************** - * * - * if none of the above use ndbm, the standard unix thing * - * * - *****************************************************************/ - -#include -#ifndef O_RDONLY -#include -#endif - -typedef datum Datum; - -typedef DBM *LDBM; - -/* for ldbm_open */ -#define LDBM_READER O_RDONLY -#define LDBM_WRITER O_WRONLY -#define LDBM_WRCREAT (O_RDWR|O_CREAT) -#define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT) -#define LDBM_FAST 0 - -#define LDBM_SUFFIX ".ndbm" - -/* for ldbm_insert */ -#define LDBM_INSERT DBM_INSERT -#define LDBM_REPLACE DBM_REPLACE -#define LDBM_SYNC 0 - -#else /* end of ndbm */ - -#ifdef LDBM_USE_CISAM - -/***************************************************************** - * * - * use CISAM db package * - * * - *****************************************************************/ - -#include -#include -#include -#include -#include "isam.h" - -extern int errno; - -struct datum { - void *dptr; /* data */ - size_t dsize; /* data length */ -}; - -typedef struct datum Datum; - -struct ldbm { - int fd; /* all callers expect a ptr */ - int cur_recnum; /* for reading sequentially */ -}; - -typedef struct ldbm *LDBM; - -/* for ldbm_open */ -#define LDBM_READER (ISINPUT | ISVARLEN | ISMANULOCK) -#define LDBM_WRITER (ISINOUT | ISVARLEN | ISMANULOCK) -#define LDBM_WRCREAT (ISINOUT | ISVARLEN | ISMANULOCK | ISEXCLLOCK) -#define LDBM_NEWDB (ISINOUT | ISVARLEN | ISMANULOCK | ISEXCLLOCK) -#define LDBM_FAST 0 - -#define LDBM_SUFFIX "" -#define LDBM_ORDERED 1 - -/* for ldbm_insert */ -#define LDBM_INSERT 1 -#define LDBM_REPLACE 0 -#define LDBM_SYNC 0x80000000 - -#else /* end of cisam */ - -#ifdef LDBM_USE_TRIO - -/***************************************************************** - * * - * use C-Index/II from Trio * - * * - *****************************************************************/ - -#include -#include -#include -#include -#include "cndx.h" - -#define CRDCREAT 0x100 - -extern int errno; - -struct datum { - void *dptr; /* data */ - size_t dsize; /* data length */ -}; - -typedef struct datum Datum; - -typedef CFILE *LDBM; - -/* for ldbm_open */ -#define LDBM_READER (CRDONLY) -#define LDBM_WRITER (CRDWRITE) -#define LDBM_WRCREAT (CRDWRITE | CRDCREAT) -#define LDBM_NEWDB (CRDWRITE | CRDCREAT) -#define LDBM_FAST 0 - -#define LDBM_SUFFIX ".c2i" -#define LDBM_ORDERED 1 - -/* for ldbm_insert */ -#define LDBM_INSERT 1 -#define LDBM_REPLACE 0 -#define LDBM_SYNC 0x80000000 - - -#else /* end of trio */ - -#ifdef LDBM_USE_CTREE - -/***************************************************************** - * * - * use Faircom Ctree db package * - * * - *****************************************************************/ - -#include -#include -#include -#include - -#include "ctstdr.h" -#include "ctoptn.h" -#include "ctaerr.h" -#include "ctdecl.h" -#include "cterrc.h" - -extern int errno; - -struct datum { - void *dptr; /* data */ - size_t dsize; /* data length */ -}; - -typedef struct datum Datum; -typedef IFIL *LDBM; - -/* for ldbm_open */ -#define LDBM_READER 0 -#define LDBM_WRITER 0 -#define LDBM_WRCREAT 1 -#define LDBM_NEWDB 1 -#define LDBM_FAST 0 - -#define LDBM_SUFFIX "" -#define LDBM_ORDERED 1 - -/* for ldbm_insert */ -#define LDBM_INSERT 1 -#define LDBM_REPLACE 0 -#define LDBM_SYNC 0x80000000 - -#endif /* ctree */ -#endif /* trio */ -#endif /* cisam */ -#endif /* ndbm */ -#endif /* db hash */ -#endif /* db btree */ -#endif /* gdbm */ - -/* - * name: file name without the suffix - * rw: read/write flags - * mode: this has the desired permissions mode on the file - * dbcachesize: advisory cache size in bytes - */ -LDBM ldbm_open( char *name, int rw, int mode, int dbcachesize ); -#ifdef LDAP_USE_DB20 -/* This is a stopgap measure to allow us to associate a session with ldbm_ calls */ -LDBM ldbm_open2( dblayer_session session, char *name, int rw, int mode); -/* These are stolen from beta2's dblayer.h */ -int dblayer_session_open(char *home_dir, char* log_dir, char* temp_dir, int cachesize, dblayer_session session) ; -int dblayer_session_terminate(dblayer_session session) ; -#endif -int ldbm_close( LDBM ldbm ); -void ldbm_sync( LDBM ldbm ); -void ldbm_datum_free( LDBM ldbm, Datum data ); -Datum ldbm_datum_dup( LDBM ldbm, Datum data ); -Datum ldbm_fetch( LDBM ldbm, Datum key ); -int ldbm_store( LDBM ldbm, Datum key, Datum data, int flags ); -int ldbm_delete( LDBM ldbm, Datum key ); -Datum ldbm_firstkey( LDBM ldbm ); -Datum ldbm_nextkey( LDBM ldbm, Datum key ); -Datum ldbm_prevkey( LDBM ldbm, Datum key ); -Datum ldbm_lastkey( LDBM ldbm ); -Datum ldbm_cursorkey( LDBM ldbm, Datum key ); -int ldbm_errno( LDBM ldbm ); - -#endif /* _ldbm_h_ */ diff --git a/mozilla/directory/c-sdk/ldap/include/ldif.h b/mozilla/directory/c-sdk/ldap/include/ldif.h deleted file mode 100644 index 3d0769e0ad7..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ldif.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -#ifndef _LDIF_H -#define _LDIF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDIF_VERSION_ONE 1 /* LDIF standard version */ - -#define LDIF_MAX_LINE_WIDTH 76 /* maximum length of LDIF lines */ - -/* - * Macro to calculate maximum number of bytes that the base64 equivalent - * of an item that is "vlen" bytes long will take up. Base64 encoding - * uses one byte for every six bits in the value plus up to two pad bytes. - */ -#define LDIF_BASE64_LEN(vlen) (((vlen) * 4 / 3 ) + 3) - -/* - * Macro to calculate maximum size that an LDIF-encoded type (length - * tlen) and value (length vlen) will take up: room for type + ":: " + - * first newline + base64 value + continued lines. Each continued line - * needs room for a newline and a leading space character. - */ -#define LDIF_SIZE_NEEDED(tlen,vlen) \ - ((tlen) + 4 + LDIF_BASE64_LEN(vlen) \ - + ((LDIF_BASE64_LEN(vlen) + tlen + 3) / LDIF_MAX_LINE_WIDTH * 2 )) - -/* - * Options for ldif_put_type_and_value_with_options() and - * ldif_type_and_value_with_options(). - */ -#define LDIF_OPT_NOWRAP 0x01UL -#define LDIF_OPT_VALUE_IS_URL 0x02UL -#define LDIF_OPT_MINIMAL_ENCODING 0x04UL - -int ldif_parse_line( char *line, char **type, char **value, int *vlen); -char * ldif_getline( char **next ); -void ldif_put_type_and_value( char **out, char *t, char *val, int vlen ); -void ldif_put_type_and_value_nowrap( char **out, char *t, char *val, int vlen ); -void ldif_put_type_and_value_with_options( char **out, char *t, char *val, - int vlen, unsigned long options ); -char *ldif_type_and_value( char *type, char *val, int vlen ); -char *ldif_type_and_value_nowrap( char *type, char *val, int vlen ); -char *ldif_type_and_value_with_options( char *type, char *val, int vlen, - unsigned long options ); -int ldif_base64_decode( char *src, unsigned char *dst ); -int ldif_base64_encode( unsigned char *src, char *dst, int srclen, - int lenused ); -int ldif_base64_encode_nowrap( unsigned char *src, char *dst, int srclen, - int lenused ); -char *ldif_get_entry( FILE *fp, int *lineno ); - -#ifdef __cplusplus -} -#endif - -#endif /* _LDIF_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/lthread.h b/mozilla/directory/c-sdk/ldap/include/lthread.h deleted file mode 100755 index b1cf9fcf776..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/lthread.h +++ /dev/null @@ -1,440 +0,0 @@ -/* - * 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): - */ - -/* lthread.h - ldap threads header file */ - -#ifndef _LTHREAD_H -#define _LTHREAD_H - -#if defined( THREAD_SUNOS4_LWP ) -/*********************************** - * * - * thread definitions for sunos4 * - * * - ***********************************/ - -#define _THREAD - -#include -#include - -typedef void *(*VFP)(); - -/* thread attributes and thread type */ -typedef int pthread_attr_t; -typedef thread_t pthread_t; - -/* default attr states */ -#define pthread_mutexattr_default NULL -#define pthread_condattr_default NULL - -/* thread state - joinable or not */ -#define PTHREAD_CREATE_JOINABLE 0 -#define PTHREAD_CREATE_DETACHED 1 -/* thread scope - who is in scheduling pool */ -#define PTHREAD_SCOPE_PROCESS 0 -#define PTHREAD_SCOPE_SYSTEM 1 - -/* mutex attributes and mutex type */ -typedef int pthread_mutexattr_t; -typedef mon_t pthread_mutex_t; - -/* mutex and condition variable scope - process or system */ -#define PTHREAD_SHARE_PRIVATE 0 -#define PTHREAD_SHARE_PROCESS 1 - -/* condition variable attributes and condition variable type */ -typedef int pthread_condattr_t; -typedef struct lwpcv { - int lcv_created; - cv_t lcv_cv; -} pthread_cond_t; - -#else /* end sunos4 */ - -#if defined( THREAD_SUNOS5_LWP ) -/*********************************** - * * - * thread definitions for sunos5 * - * * - ***********************************/ - -#define _THREAD - -#include -#include - -typedef void *(*VFP)(); - -/* sunos5 threads are preemptive */ -#define PTHREAD_PREEMPTIVE 1 - -/* thread attributes and thread type */ -typedef int pthread_attr_t; -typedef thread_t pthread_t; - -/* default attr states */ -#define pthread_mutexattr_default NULL -#define pthread_condattr_default NULL - -/* thread state - joinable or not */ -#define PTHREAD_CREATE_JOINABLE 0 -#define PTHREAD_CREATE_DETACHED THR_DETACHED -/* thread scope - who is in scheduling pool */ -#define PTHREAD_SCOPE_PROCESS 0 -#define PTHREAD_SCOPE_SYSTEM THR_BOUND - -/* mutex attributes and mutex type */ -typedef int pthread_mutexattr_t; -typedef mutex_t pthread_mutex_t; - -/* mutex and condition variable scope - process or system */ -#define PTHREAD_SHARE_PRIVATE USYNC_THREAD -#define PTHREAD_SHARE_PROCESS USYNC_PROCESS - -/* condition variable attributes and condition variable type */ -typedef int pthread_condattr_t; -typedef cond_t pthread_cond_t; - -#else /* end sunos5 */ - -#if defined( THREAD_MIT_PTHREADS ) -/*********************************** - * * - * definitions for mit pthreads * - * * - ***********************************/ - -#define _THREAD - -#include - -#else /* end mit pthreads */ - -#if defined( THREAD_AIX_PTHREADS ) -/*********************************** - * * - * definitions for aix pthreads * - * * - ***********************************/ - -#define _THREAD - -#include - -typedef void *(*VFP)(void *); - -/* thread state - joinable or not */ -#define PTHREAD_CREATE_JOINABLE 0 - -/* default attr states */ -#define pthread_mutexattr_default NULL -#define pthread_condattr_default NULL - -#else /* aix pthreads */ - -#if defined( THREAD_HP_DCE_PTHREADS ) -/************************************** - * * - * definitions for HP dce pthreads * - * * - **************************************/ - -#define _THREAD -typedef void *(*VFP)(); - -#include - -/* dce threads are preemptive */ -#define PTHREAD_PREEMPTIVE 1 - -/* pthread_kill() is a noop on HP */ -#define PTHREAD_KILL_IS_NOOP 1 - -/* thread state - joinable or not */ -#define PTHREAD_CREATE_JOINABLE 0 -#define PTHREAD_CREATE_DETACHED 1 - -#define pthread_attr_init( a ) pthread_attr_create( a ) -#define pthread_attr_destroy( a ) pthread_attr_delete( a ) -#define pthread_attr_setdetachstate( a, b ) \ - pthread_attr_setdetach_np( a, b ) -/* - * HP's DCE threads implementation passes a (pthread_attr_t *) - * for the second argument. So, we need to fake things a bit. - * hpdce_pthread_create_detached() is in thread.c. Note that we - * create threads and detach them. If you need to create a joinable - * thread, you need to call hpdce_pthread_create_joinable() directly. - */ -#define pthread_create( a, b, c, d ) \ - hpdce_pthread_create_detached( a, b, c, d ) - -int -hpdce_pthread_create_joinable( pthread_t *tid, pthread_attr_t *attr, - VFP func, void *arg ); -int hpdce_pthread_create_detached( pthread_t *tid, pthread_attr_t *attr, - VFP func, void *arg ); -#else /* HP dce pthreads */ - -#if defined( THREAD_DCE_PTHREADS ) -/*********************************** - * * - * definitions for dce pthreads * - * * - ***********************************/ - -#define _THREAD -typedef void *(*VFP)(); - -#include - -/* dce threads are preemptive */ -#define PTHREAD_PREEMPTIVE 1 - -/* thread state - joinable or not */ -#ifndef PTHREAD_CREATE_JOINABLE -#define PTHREAD_CREATE_JOINABLE 0 -#endif -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - -#define pthread_attr_init( a ) pthread_attr_create( a ) -#define pthread_attr_destroy( a ) pthread_attr_delete( a ) -#define pthread_attr_setdetachstate( a, b ) \ - pthread_attr_setdetach_np( a, b ) -#if defined( OSF1 ) -/* pthread_create's second parameter is passed by value, not by reference. - * To work around this, call another function instead: - */ -#define pthread_create( a, b, c, d ) std_pthread_create( a, b, c, d ) -extern int -std_pthread_create (pthread_t *tid, - pthread_attr_t *attr, - pthread_startroutine_t func, - pthread_addr_t arg); /* defined in thread.c */ - -/* OSF1 doesn't support pthread_kill() */ -#define PTHREAD_KILL_IS_NOOP 1 - -#endif /* OSF1 */ - -#else /* dce pthreads */ - -#if defined( THREAD_SGI_SPROC ) -/*********************************** - * * - * thread definitions for sgi irix * - * * - ***********************************/ - -#define _THREAD - -#include -#include -#include -#include -#include - -typedef void *(*VFP)(void *); - -/* sgi threads are preemptive */ -#define PTHREAD_PREEMPTIVE 1 - -/* thread attributes and thread type */ -typedef int pthread_attr_t; -typedef pid_t pthread_t; - -/* default attr states */ -#define pthread_mutexattr_default 0 -#define pthread_condattr_default 0 - -/* thread state - joinable or not */ -#define PTHREAD_CREATE_JOINABLE 0 -#define PTHREAD_CREATE_DETACHED 1 -/* thread scope - who is in scheduling pool */ -#define PTHREAD_SCOPE_PROCESS 0 -#define PTHREAD_SCOPE_SYSTEM 1 - -/* mutex attributes and mutex type */ -typedef int pthread_mutexattr_t; -typedef int pthread_mutex_t; - -/* mutex and condition variable scope - process or system */ -#define PTHREAD_SHARE_PRIVATE 0 -#define PTHREAD_SHARE_PROCESS 1 - -/* condition variable attributes and condition variable type */ -typedef int pthread_condattr_t; -struct irix_cv_waiter { - pid_t icvw_pid; - struct irix_cv_waiter *icvw_next; -}; -typedef struct irix_cv { - pthread_mutex_t icv_mutex; - pthread_mutex_t *icv_waitermutex; - struct irix_cv_waiter *icv_waiterq; -} pthread_cond_t; - -#else - -#if defined( WIN32_KERNEL_THREADS ) - -/*********************************** - * * - * thread definitions for Win32 * - * * - ***********************************/ - -#define _THREAD - -#include -#include -#include "ldap.h" -#include "ldaplog.h" - -typedef void (*VFP)(void *); - -/* Win32 threads are preemptive */ -#define PTHREAD_PREEMPTIVE 1 - -/* thread attributes and thread type */ -typedef int pthread_attr_t; -typedef HANDLE pthread_t; - -/* default attr states */ -#define pthread_mutexattr_default 0 -#define pthread_condattr_default 0 - -/* thread state - joinable or not */ -#define PTHREAD_CREATE_JOINABLE 0 -#define PTHREAD_CREATE_DETACHED 1 -/* thread scope - who is in scheduling pool */ -#define PTHREAD_SCOPE_PROCESS 0 -#define PTHREAD_SCOPE_SYSTEM 1 - -/* mutex attributes and mutex type */ -typedef int pthread_mutexattr_t; -typedef HANDLE pthread_mutex_t; - -/* mutex and condition variable scope - process or system */ -#define PTHREAD_SHARE_PRIVATE 0 -#define PTHREAD_SHARE_PROCESS 1 - -/* condition variable attributes and condition variable type */ -typedef int pthread_condattr_t; - -/* simulated condition variable */ -struct win32_cv_waiter { - pthread_t icvw_pthread; - struct win32_cv_waiter *icvw_next; -}; -typedef struct win32_cv { - pthread_mutex_t icv_mutex; - pthread_mutex_t *icv_waitermutex; - struct win32_cv_waiter *icv_waiterq; -} pthread_cond_t; - -#endif /* NATIVE_WIN32_THREADS */ -#endif /* sgi sproc */ -#endif /* dce pthreads */ -#endif /* hp dce pthreads */ -#endif /* aix pthreads */ -#endif /* mit pthreads */ -#endif /* sunos5 */ -#endif /* sunos4 */ - -#ifndef _THREAD - -/*********************************** - * * - * thread definitions for no * - * underlying library support * - * * - ***********************************/ - -typedef void *(*VFP)(); - -/* thread attributes and thread type */ -typedef int pthread_attr_t; -typedef int pthread_t; - -/* default attr states */ -#define pthread_mutexattr_default NULL -#define pthread_condattr_default NULL - -/* thread state - joinable or not */ -#define PTHREAD_CREATE_JOINABLE 0 -#define PTHREAD_CREATE_DETACHED 0 -/* thread scope - who is in scheduling pool */ -#define PTHREAD_SCOPE_PROCESS 0 -#define PTHREAD_SCOPE_SYSTEM 0 - -/* mutex attributes and mutex type */ -typedef int pthread_mutexattr_t; -typedef int pthread_mutex_t; - -/* mutex and condition variable scope - process or system */ -#define PTHREAD_SHARE_PRIVATE 0 -#define PTHREAD_SHARE_PROCESS 0 - -/* condition variable attributes and condition variable type */ -typedef int pthread_condattr_t; -typedef int pthread_cond_t; - -#endif /* no threads support */ - -/* POSIX standard pthread function declarations: */ - -int pthread_attr_init( pthread_attr_t *attr ); -int pthread_attr_destroy( pthread_attr_t *attr ); -int pthread_attr_getdetachstate( pthread_attr_t *attr, int *detachstate ); -int pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate ); - -int pthread_create( pthread_t *tid, pthread_attr_t *attr, VFP func, void *arg ); -void pthread_yield(); -void pthread_exit(); -int pthread_kill( pthread_t tid, int sig ); -#if defined( hpux ) || defined( OSF1 ) || defined( AIXV4 ) /* declares pthread_join */ -#else -int pthread_join( pthread_t tid, int *status ); -#endif - -#if defined( hpux ) || defined( OSF1 ) /* declares pthread_mutex_init */ -#else -int pthread_mutex_init( pthread_mutex_t *mp, pthread_mutexattr_t *attr ); -#endif -int pthread_mutex_destroy( pthread_mutex_t *mp ); -int pthread_mutex_lock( pthread_mutex_t *mp ); -int pthread_mutex_unlock( pthread_mutex_t *mp ); -int pthread_mutex_trylock( pthread_mutex_t *mp ); - -#if defined( hpux ) || defined( OSF1 ) /* declares pthread_cond_init */ -#else -int pthread_cond_init( pthread_cond_t *cv, pthread_condattr_t *attr ); -#endif -int pthread_cond_destroy( pthread_cond_t *cv ); -int pthread_cond_wait( pthread_cond_t *cv, pthread_mutex_t *mp ); -int pthread_cond_signal( pthread_cond_t *cv ); -int pthread_cond_broadcast( pthread_cond_t *cv ); - -#endif /* _LTHREAD_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/ntslapdregparms.h b/mozilla/directory/c-sdk/ldap/include/ntslapdregparms.h deleted file mode 100755 index 58db7f979eb..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ntslapdregparms.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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): - */ - -/****************************************************** - * - * ntslapdregparms.h - NT Registry keys for Slapd. - * - ******************************************************/ - -#if defined( _WIN32 ) - -#if !defined( _NTSLAPDREGPARMS_H_ ) -#define _NTSLAPDREGPARMS_H_ - -#define COMPANY_KEY "SOFTWARE\\Netscape" -#define COMPANY_NAME "Netscape" -#define PROGRAM_GROUP_NAME "Netscape" -#define PRODUCT_NAME "slapd" -#define PRODUCT_BIN "ns-slapd" -#define SLAPD_EXE "slapd.exe" -#define SERVICE_EXE SLAPD_EXE -#define SLAPD_CONF "slapd.conf" -#define MAGNUS_CONF SLAPD_CONF -#define SLAPD_DONGLE_FILE "password.dng" -#define DONGLE_FILE_NAME SLAPD_DONGLE_FILE -#define PRODUCT_VERSION "1.0" -#define EVENTLOG_APPNAME "NetscapeSlapd" -#define DIRECTORY_SERVICE_PREFIX "Netscape Directory Server " -#define SERVICE_PREFIX DIRECTORY_SERVICE_PREFIX -#define CONFIG_PATH_KEY "ConfigurationPath" -#define EVENTLOG_MESSAGES_KEY "EventMessageFile" -#define EVENT_LOG_KEY "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application" -#define ADMIN_REGISTRY_ROOT_KEY "Admin Server" -#define SLAPD_REGISTRY_ROOT_KEY "Slapd Server" -#define PRODUCT_KEY SLAPD_REGISTRY_ROOT_KEY -#endif /* _NTSLAPDREGPARMS_H_ */ - -#endif /* _WIN32 */ diff --git a/mozilla/directory/c-sdk/ldap/include/ntwatchdog.h b/mozilla/directory/c-sdk/ldap/include/ntwatchdog.h deleted file mode 100755 index 315e95ee366..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/ntwatchdog.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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): - */ - -/****************************************************** - * - * ntwatchdog.h - Defs for NT Watchdog Service. - * - ******************************************************/ - -#if defined( _WIN32 ) - -#if !defined( _NTWATCHDOG_H_ ) -#define _NTWATCHDOG_H_ - -#define FILE_PATHSEP '/' - -#define SLAPD_ROOT "SLAPD_ROOT" // environment variable holding server root path -#define MORTALITY_KEY "MortalityTimeSecs" -#define MINRAMFREE_KEY "MinRamFree" -#define MINRAMTOTAL_KEY "MinRamTotal" -#define MINRAMPERSERVER_KEY "MinRamPerServer" -#define DEFAULT_MORTALITY_TIME 60 // seconds after startup up until server will NOT be restarted -#define DEFAULT_KILL_TIME 60 // seconds to wait for httpd.exe to shutdown -#define DEFAULT_CRON_TIME 60 // seconds to wait before rechecking cron.conf -#define DEFAULT_RESTART_TIME 10 // seconds to wait before restarting server -#define DEFAULT_MINRAMFREE 0 // KB free physical memory remaining -#define DEFAULT_MINRAMTOTAL (30 * 1024) // KB free physical memory installed -#define DEFAULT_MINRAMPERSERVER (15 * 1024) // KB free physical memory per server - -#define MSG_RESOURCES "Not enough physical memory to start server." - -// offsets for extra window bytes, used in Set/GetWindowLong() -#define GWL_PROCESS_HANDLE (sizeof(LONG) * 0) -#define GWL_PASSWORD_ADDR (sizeof(LONG) * 1) -#define GWL_PASSWORD_LENGTH (sizeof(LONG) * 2) - -#define MAX_LINE 512 -#define MAX_PASSWORD 256 - -#define CLOSEHANDLE(X) \ -{ \ - if(X) \ - { \ - CloseHandle(X); \ - X = 0; \ - } \ -} - -// in ntcron.c -LPTHREAD_START_ROUTINE CRON_ThreadProc(HANDLE hevWatchDogExit); - -// in watchdog.c -BOOL WD_SysLog(WORD fwEventType, DWORD IDEvent, char *szData); - -#endif /* _NTWATCHDOG_H_ */ -#endif /* _WIN32 */ diff --git a/mozilla/directory/c-sdk/ldap/include/portable.h b/mozilla/directory/c-sdk/ldap/include/portable.h deleted file mode 100644 index 766b2122156..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/portable.h +++ /dev/null @@ -1,420 +0,0 @@ -/* - * 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) 1994 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -#ifndef _PORTABLE_H -#define _PORTABLE_H - -/* - * portable.h for LDAP -- this is where we define common stuff to make - * life easier on various Unix systems. - * - * Unless you are porting LDAP to a new platform, you should not need to - * edit this file. - */ - -#ifndef SYSV -#if defined( hpux ) || defined( sunos5 ) || defined ( sgi ) || defined( SVR4 ) -#define SYSV -#endif -#endif - -/* - * under System V, use sysconf() instead of getdtablesize - */ -#if !defined( USE_SYSCONF ) && defined( SYSV ) -#define USE_SYSCONF -#endif - -/* - * under System V, daemons should use setsid() instead of detaching from their - * tty themselves - */ -#if !defined( USE_SETSID ) && defined( SYSV ) -#define USE_SETSID -#endif - -/* - * System V has socket options in filio.h - */ -#if !defined( NEED_FILIO ) && defined( SYSV ) && !defined( hpux ) && !defined( AIX ) -#define NEED_FILIO -#endif - -/* - * use lockf() under System V - */ -#if !defined( USE_LOCKF ) && ( defined( SYSV ) || defined( aix )) -#define USE_LOCKF -#endif - -/* - * on many systems, we should use waitpid() instead of waitN() - */ -#if !defined( USE_WAITPID ) && ( defined( SYSV ) || defined( sunos4 ) || defined( ultrix ) || defined( aix )) -#define USE_WAITPID -#endif - -/* - * define the wait status argument type - */ -#if ( defined( SunOS ) && SunOS < 40 ) || defined( nextstep ) -#define WAITSTATUSTYPE union wait -#else -#define WAITSTATUSTYPE int -#endif - -/* - * define the flags for wait - */ -#ifdef sunos5 -#define WAIT_FLAGS ( WNOHANG | WUNTRACED | WCONTINUED ) -#else -#define WAIT_FLAGS ( WNOHANG | WUNTRACED ) -#endif - -/* - * defined the options for openlog (syslog) - */ -#ifdef ultrix -#define OPENLOG_OPTIONS LOG_PID -#else -#define OPENLOG_OPTIONS ( LOG_PID | LOG_NOWAIT ) -#endif - -/* - * some systems don't have the BSD re_comp and re_exec routines - */ -#ifndef NEED_BSDREGEX -#if ( defined( SYSV ) || defined( VMS ) || defined( netbsd ) || defined( freebsd ) || defined( linux )) && !defined(sgi) -#define NEED_BSDREGEX -#endif -#endif - -/* - * many systems do not have the setpwfile() library routine... we just - * enable use for those systems we know have it. - */ -#ifndef HAVE_SETPWFILE -#if defined( sunos4 ) || defined( ultrix ) || defined( OSF1 ) -#define HAVE_SETPWFILE -#endif -#endif - -/* - * Are sys_errlist and sys_nerr declared in stdio.h? - */ -#ifndef SYSERRLIST_IN_STDIO -#if defined( freebsd ) -#define SYSERRLIST_IN_STDIO -#endif -#endif - - -/* - * Is snprintf() part of the standard C runtime library? - */ -#if !defined(HAVE_SNPRINTF) -#if defined(SOLARIS) || defined(LINUX) || defined(HPUX) -#define HAVE_SNPRINTF -#endif -#endif - - -/* - * Async IO. Use a non blocking implementation of connect() and - * dns functions - */ -#if !defined(LDAP_ASYNC_IO) -#if !defined(_WINDOWS) && !defined(macintosh) -#define LDAP_ASYNC_IO -#endif /* _WINDOWS */ -#endif - -/* - * for select() - */ -#if !defined(WINSOCK) && !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2) -#if defined(hpux) || defined(LINUX) || defined(SUNOS4) -#include -#else -#include -#endif -#if !defined(FD_SET) -#define NFDBITS 32 -#define FD_SETSIZE 32 -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) -#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) -#endif /* !FD_SET */ -#endif /* !WINSOCK && !_WINDOWS && !macintosh */ - - -/* - * for connect() -- must we block signals when calling connect()? This - * is necessary on some buggy UNIXes. - */ -#if !defined(LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED) && \ - ( defined(AIX) || defined(IRIX) || defined(HPUX) || defined(SUNOS4) \ - || defined(SOLARIS) || defined(OSF1) ||defined(freebsd)) -#define LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED -#endif - - -/* - * for signal() -- what do signal handling functions return? - */ -#ifndef SIG_FN -#ifdef sunos5 -# define SIG_FN void /* signal-catching functions return void */ -#else /* sunos5 */ -# ifdef BSD -# if (BSD >= 199006) || defined(NeXT) || defined(OSF1) || defined(sun) || defined(ultrix) || defined(apollo) || defined(POSIX_SIGNALS) -# define SIG_FN void /* signal-catching functions return void */ -# else -# define SIG_FN int /* signal-catching functions return int */ -# endif -# else /* BSD */ -# define SIG_FN void /* signal-catching functions return void */ -# endif /* BSD */ -#endif /* sunos5 */ -#endif /* SIG_FN */ - -/* - * toupper and tolower macros are different under bsd and sys v - */ -#if defined( SYSV ) && !defined( hpux ) -#define TOUPPER(c) (isascii(c) && islower(c) ? _toupper(c) : c) -#define TOLOWER(c) (isascii(c) && isupper(c) ? _tolower(c) : c) -#else -#define TOUPPER(c) (isascii(c) && islower(c) ? toupper(c) : c) -#define TOLOWER(c) (isascii(c) && isupper(c) ? tolower(c) : c) -#endif - -/* - * put a cover on the tty-related ioctl calls we need to use - */ -#if defined( NeXT ) || (defined(SunOS) && SunOS < 40) -#define TERMIO_TYPE struct sgttyb -#define TERMFLAG_TYPE int -#define GETATTR( fd, tiop ) ioctl((fd), TIOCGETP, (caddr_t)(tiop)) -#define SETATTR( fd, tiop ) ioctl((fd), TIOCSETP, (caddr_t)(tiop)) -#define GETFLAGS( tio ) (tio).sg_flags -#define SETFLAGS( tio, flags ) (tio).sg_flags = (flags) -#else -#define USE_TERMIOS -#define TERMIO_TYPE struct termios -#define TERMFLAG_TYPE tcflag_t -#define GETATTR( fd, tiop ) tcgetattr((fd), (tiop)) -#define SETATTR( fd, tiop ) tcsetattr((fd), TCSANOW /* 0 */, (tiop)) -#define GETFLAGS( tio ) (tio).c_lflag -#define SETFLAGS( tio, flags ) (tio).c_lflag = (flags) -#endif - -#if ( !defined( HPUX9 )) && ( !defined( sunos4 )) && ( !defined( SNI )) && \ - ( !defined( HAVE_TIME_R )) -#define HAVE_TIME_R -#endif - -#if defined( sunos5 ) || defined( aix ) -#define HAVE_GETPWNAM_R -#define HAVE_GETGRNAM_R -#endif - -#if defined(SNI) || defined(LINUX1_2) -int strcasecmp(const char *, const char *); -#ifdef SNI -int strncasecmp(const char *, const char *, int); -#endif /* SNI */ -#ifdef LINUX1_2 -int strncasecmp(const char *, const char *, size_t); -#endif /* LINUX1_2 */ -#endif /* SNI || LINUX1_2 */ - -#if defined(_WINDOWS) || defined(macintosh) || defined(XP_OS2) -#define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname( n ) -#define NSLDAPI_CTIME( c, b, l ) ctime( c ) -#define STRTOK( s1, s2, l ) strtok( s1, s2 ) -#else /* UNIX */ -#if defined(sgi) || defined(HPUX9) || defined(LINUX1_2) || defined(SCOOS) || \ - defined(UNIXWARE) || defined(SUNOS4) || defined(SNI) || defined(BSDI) || \ - defined(NCR) || defined(OSF1) || defined(NEC) || \ - ( defined(HPUX10) && !defined(_REENTRANT)) || defined(HPUX11) || \ - defined(UnixWare) || defined(LINUX) || (defined(AIX) && !defined(USE_REENTRANT_LIBC)) -#define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname( n ) -#elif defined(AIX) -/* Maybe this is for another version of AIX? - Commenting out for AIX 4.1 for Nova - Replaced with following to lines, stolen from the #else below -#define GETHOSTBYNAME_BUF_T struct hostent_data -*/ -typedef char GETHOSTBYNAME_buf_t [BUFSIZ /* XXX might be too small */]; -#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t -#define GETHOSTBYNAME( n, r, b, l, e ) \ - (memset (&b, 0, l), gethostbyname_r (n, r, &b) ? NULL : r) -#elif defined(HPUX10) -#define GETHOSTBYNAME_BUF_T struct hostent_data -#define GETHOSTBYNAME( n, r, b, l, e ) nsldapi_compat_gethostbyname_r( n, r, (char *)&b, l, e ) -#else -#include /* BUFSIZ */ -typedef char GETHOSTBYNAME_buf_t [BUFSIZ /* XXX might be too small */]; -#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t -#define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname_r( n, r, b, l, e ) -#endif -#if defined(HPUX9) || defined(LINUX1_2) || defined(LINUX2_0) || \ - defined(LINUX2_1) || defined(SUNOS4) || defined(SNI) || \ - defined(SCOOS) || defined(BSDI) || defined(NCR) || \ - defined(NEC) || ( defined(HPUX10) && !defined(_REENTRANT)) || \ - (defined(AIX) && !defined(USE_REENTRANT_LIBC)) -#define NSLDAPI_CTIME( c, b, l ) ctime( c ) -#elif defined(HPUX10) && defined(_REENTRANT) && !defined(HPUX11) -#define NSLDAPI_CTIME( c, b, l ) nsldapi_compat_ctime_r( c, b, l ) -#elif defined( IRIX6_2 ) || defined( IRIX6_3 ) || defined(UNIXWARE) \ - || defined(OSF1V4) || defined(AIX) || defined(UnixWare) || defined(hpux) || defined(HPUX11) -#define NSLDAPI_CTIME( c, b, l ) ctime_r( c, b ) -#elif defined( OSF1V3 ) -#define NSLDAPI_CTIME( c, b, l ) (ctime_r( c, b, l ) ? NULL : b) -#else -#define NSLDAPI_CTIME( c, b, l ) ctime_r( c, b, l ) -#endif -#if defined(hpux9) || defined(LINUX1_2) || defined(SUNOS4) || defined(SNI) || \ - defined(SCOOS) || defined(BSDI) || defined(NCR) || \ - defined(NEC) || defined(LINUX) || (defined(AIX) && !defined(USE_REENTRANT_LIBC)) -#define STRTOK( s1, s2, l ) strtok( s1, s2 ) -#else -#define HAVE_STRTOK_R -char *strtok_r(char *, const char *, char **); -#define STRTOK( s1, s2, l ) (char *)strtok_r( s1, s2, l ) -#endif /* STRTOK */ -#endif /* UNIX */ - -#if defined( ultrix ) || defined( nextstep ) -extern char *strdup(); -#endif /* ultrix || nextstep */ - -#if defined( sunos4 ) || defined( OSF1 ) -#define BSD_TIME 1 /* for servers/slapd/log.h */ -#endif /* sunos4 || osf */ - -#if !defined(_WINDOWS) && !defined(macintosh) -#include -#include /* for inet_addr() */ -#endif - -/* - * Define a portable type for IPv4 style Internet addresses (32 bits): - */ -#if ( defined(sunos5) && defined(_IN_ADDR_T)) || \ - defined(aix) || defined(HPUX11) || defined(OSF1) -typedef in_addr_t nsldapi_in_addr_t; -#else -typedef unsigned long nsldapi_in_addr_t; -#endif - -#ifdef SUNOS4 -#include /* for toupper() */ -int fprintf(FILE *, char *, ...); -int fseek(FILE *, long, int); -int fread(char *, int, int, FILE *); -int fclose(FILE *); -int fflush(FILE *); -int rewind(FILE *); -void *memmove(void *, const void *, size_t); -int strcasecmp(char *, char *); -int strncasecmp(char *, char *, int); -time_t time(time_t *); -void perror(char *); -int fputc(char, FILE *); -int fputs(char *, FILE *); -int re_exec(char *); -int socket(int, int, int); -void bzero(char *, int); -unsigned long inet_addr(char *); -char * inet_ntoa(struct in_addr); -int getdtablesize(); -int connect(int, struct sockaddr *, int); -#endif /* SUNOS4 */ - -/* #if defined(SUNOS4) || defined(SNI) */ -#if defined(SUNOS4) -int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); -#endif /* SUNOS4 || SNI */ - -/* - * SAFEMEMCPY is an overlap-safe copy from s to d of n bytes - */ -#ifdef macintosh -#define SAFEMEMCPY( d, s, n ) BlockMoveData( (Ptr)s, (Ptr)d, n ) -#else /* macintosh */ -#ifdef sunos4 -#define SAFEMEMCPY( d, s, n ) bcopy( s, d, n ) -#else /* sunos4 */ -#define SAFEMEMCPY( d, s, n ) memmove( d, s, n ) -#endif /* sunos4 */ -#endif /* macintosh */ - -#ifdef _WINDOWS - -#define strcasecmp strcmpi -#define strncasecmp _strnicmp -#define bzero(a, b) memset( a, 0, b ) -#define getpid _getpid -#define ioctl ioctlsocket -#define sleep(a) Sleep( a*1000 ) - -#define EMSGSIZE WSAEMSGSIZE -#define EWOULDBLOCK WSAEWOULDBLOCK -#define EHOSTUNREACH WSAEHOSTUNREACH - -#ifndef MAXPATHLEN -#define MAXPATHLEN _MAX_PATH -#endif - -/* We'd like this number to be prime for the hash - * into the Connection table */ -#define DS_MAX_NT_SOCKET_CONNECTIONS 2003 - -#elif defined(XP_OS2) - -#define strcasecmp strcmpi -#define strncasecmp strnicmp -#define bzero(a, b) memset( a, 0, b ) -#include "dirent.h" -#include /*for strcmpi()*/ -#include /*for ctime()*/ - -#endif /* XP_OS2 */ - - -#endif /* _PORTABLE_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/proto-ntutil.h b/mozilla/directory/c-sdk/ldap/include/proto-ntutil.h deleted file mode 100755 index 87dd187a6ef..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/proto-ntutil.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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): - */ - -/****************************************************** - * - * proto-ntutil.h - Prototypes for utility functions used - * throughout slapd on NT. - * - ******************************************************/ -#if defined( _WINDOWS ) - -#ifndef _PROTO_NTUTIL -#define _PROTO_NTUTIL - -/* - * - * ntreg.c - * - */ -extern int SlapdGetRegSZ( LPTSTR lpszRegKey, LPSTR lpszValueName, LPTSTR lpszValue ); - -/* - * - * getopt.c - * - */ -extern int getopt (int argc, char *const *argv, const char *optstring); - -/* - * - * ntevent.c - * - */ -extern BOOL MultipleInstances(); -extern BOOL SlapdIsAService(); -extern void InitializeSlapdLogging( LPTSTR lpszRegLocation, LPTSTR lpszEventLogName, LPTSTR lpszMessageFile ); -extern void ReportSlapdEvent(WORD wEventType, DWORD dwIdEvent, WORD wNumInsertStrings, - char *pszStrings); -extern BOOL ReportSlapdStatusToSCMgr( - SERVICE_STATUS *serviceStatus, - SERVICE_STATUS_HANDLE serviceStatusHandle, - HANDLE Event, - DWORD dwCurrentState, - DWORD dwWin32ExitCode, - DWORD dwCheckPoint, - DWORD dwWaitHint); -extern void WINAPI SlapdServiceCtrlHandler(DWORD dwOpcode); -extern BOOL SlapdGetServerNameFromCmdline(char *szServerName, char *szCmdLine); - -/* - * - * ntgetpassword.c - * - */ -#ifdef NET_SSL -extern char *Slapd_GetPassword(); -#ifdef FORTEZZA -extern char *Slapd_GetFortezzaPIN(); -#endif -extern void CenterDialog(HWND hwndParent, HWND hwndDialog); -#endif /* NET_SSL */ - -#endif /* _PROTO_NTUTIL */ - -#endif /* _WINDOWS */ diff --git a/mozilla/directory/c-sdk/ldap/include/regex.h b/mozilla/directory/c-sdk/ldap/include/regex.h deleted file mode 100644 index 8bc5a18ef50..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/regex.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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): - */ - -#if defined( macintosh ) || defined( DOS ) || defined( _WINDOWS ) || defined( NEED_BSDREGEX ) || defined( XP_OS2 ) -/* - * Copyright (c) 1993 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ -/* - * regex.h -- includes for regular expression matching routines - * 13 August 1993 Mark C Smith - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "ldap.h" - -#if !defined( NEEDPROTOS ) && defined( __STDC__ ) -#define NEEDPROTOS -#endif - -#ifdef _SLDAPD_H_ /* server build: no need to use LDAP_CALL stuff */ -#ifdef LDAP_CALL -#undef LDAP_CALL -#define LDAP_CALL -#endif -#endif - -#ifdef NEEDPROTOS -int re_init( void ); -void re_lock( void ); -int re_unlock( void ); -char * LDAP_CALL re_comp( char *pat ); -int LDAP_CALL re_exec( char *lp ); -void LDAP_CALL re_modw( char *s ); -int LDAP_CALL re_subs( char *src, char *dst ); -#else /* NEEDPROTOS */ -int re_init(); -void re_lock(); -int re_unlock(); -char * LDAP_CALL re_comp(); -int LDAP_CALL re_exec(); -void LDAP_CALL re_modw(); -int LDAP_CALL re_subs(); -#endif /* NEEDPROTOS */ - -#define re_fail( m, p ) - -#ifdef __cplusplus -} -#endif -#endif /* macintosh or DOS or or _WIN32 or NEED_BSDREGEX */ diff --git a/mozilla/directory/c-sdk/ldap/include/srchpref.h b/mozilla/directory/c-sdk/ldap/include/srchpref.h deleted file mode 100644 index 98319bb2ea9..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/srchpref.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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) 1993, 1994 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - * - * searchpref.h: display template library defines - */ - - -#ifndef _SRCHPREF_H -#define _SRCHPREF_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* calling conventions used by library */ -#ifndef LDAP_CALL -#if defined( _WINDOWS ) || defined( _WIN32 ) -#define LDAP_C __cdecl -#ifndef _WIN32 -#define __stdcall _far _pascal -#define LDAP_CALLBACK _loadds -#else -#define LDAP_CALLBACK -#endif /* _WIN32 */ -#define LDAP_PASCAL __stdcall -#define LDAP_CALL LDAP_PASCAL -#else /* _WINDOWS */ -#define LDAP_C -#define LDAP_CALLBACK -#define LDAP_PASCAL -#define LDAP_CALL -#endif /* _WINDOWS */ -#endif /* LDAP_CALL */ - -struct ldap_searchattr { - char *sa_attrlabel; - char *sa_attr; - /* max 32 matchtypes for now */ - unsigned long sa_matchtypebitmap; - char *sa_selectattr; - char *sa_selecttext; - struct ldap_searchattr *sa_next; -}; - -struct ldap_searchmatch { - char *sm_matchprompt; - char *sm_filter; - struct ldap_searchmatch *sm_next; -}; - -struct ldap_searchobj { - char *so_objtypeprompt; - unsigned long so_options; - char *so_prompt; - short so_defaultscope; - char *so_filterprefix; - char *so_filtertag; - char *so_defaultselectattr; - char *so_defaultselecttext; - struct ldap_searchattr *so_salist; - struct ldap_searchmatch *so_smlist; - struct ldap_searchobj *so_next; -}; - -#define NULLSEARCHOBJ ((struct ldap_searchobj *)0) - -/* - * global search object options - */ -#define LDAP_SEARCHOBJ_OPT_INTERNAL 0x00000001 - -#define LDAP_IS_SEARCHOBJ_OPTION_SET( so, option ) \ - (((so)->so_options & option ) != 0 ) - -#define LDAP_SEARCHPREF_VERSION_ZERO 0 -#define LDAP_SEARCHPREF_VERSION 1 - -#define LDAP_SEARCHPREF_ERR_VERSION 1 -#define LDAP_SEARCHPREF_ERR_MEM 2 -#define LDAP_SEARCHPREF_ERR_SYNTAX 3 -#define LDAP_SEARCHPREF_ERR_FILE 4 - - -LDAP_API(int) -LDAP_CALL -ldap_init_searchprefs( char *file, struct ldap_searchobj **solistp ); - -LDAP_API(int) -LDAP_CALL -ldap_init_searchprefs_buf( char *buf, long buflen, - struct ldap_searchobj **solistp ); - -LDAP_API(void) -LDAP_CALL -ldap_free_searchprefs( struct ldap_searchobj *solist ); - -LDAP_API(struct ldap_searchobj *) -LDAP_CALL -ldap_first_searchobj( struct ldap_searchobj *solist ); - -LDAP_API(struct ldap_searchobj *) -LDAP_CALL -ldap_next_searchobj( struct ldap_searchobj *sollist, - struct ldap_searchobj *so ); - -#ifdef __cplusplus -} -#endif -#endif /* _SRCHPREF_H */ diff --git a/mozilla/directory/c-sdk/ldap/include/sysexit-compat.h b/mozilla/directory/c-sdk/ldap/include/sysexit-compat.h deleted file mode 100755 index 241768dee3c..00000000000 --- a/mozilla/directory/c-sdk/ldap/include/sysexit-compat.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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) 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#)sysexits.h 4.5 (Berkeley) 7/6/88 - */ - -/* -** SYSEXITS.H -- Exit status codes for system programs. -** -** This include file attempts to categorize possible error -** exit statuses for system programs, notably delivermail -** and the Berkeley network. -** -** Error numbers begin at EX__BASE to reduce the possibility of -** clashing with other exit statuses that random programs may -** already return. The meaning of the codes is approximately -** as follows: -** -** EX_USAGE -- The command was used incorrectly, e.g., with -** the wrong number of arguments, a bad flag, a bad -** syntax in a parameter, or whatever. -** EX_DATAERR -- The input data was incorrect in some way. -** This should only be used for user's data & not -** system files. -** EX_NOINPUT -- An input file (not a system file) did not -** exist or was not readable. This could also include -** errors like "No message" to a mailer (if it cared -** to catch it). -** EX_NOUSER -- The user specified did not exist. This might -** be used for mail addresses or remote logins. -** EX_NOHOST -- The host specified did not exist. This is used -** in mail addresses or network requests. -** EX_UNAVAILABLE -- A service is unavailable. This can occur -** if a support program or file does not exist. This -** can also be used as a catchall message when something -** you wanted to do doesn't work, but you don't know -** why. -** EX_SOFTWARE -- An internal software error has been detected. -** This should be limited to non-operating system related -** errors as possible. -** EX_OSERR -- An operating system error has been detected. -** This is intended to be used for such things as "cannot -** fork", "cannot create pipe", or the like. It includes -** things like getuid returning a user that does not -** exist in the passwd file. -** EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, -** etc.) does not exist, cannot be opened, or has some -** sort of error (e.g., syntax error). -** EX_CANTCREAT -- A (user specified) output file cannot be -** created. -** EX_IOERR -- An error occurred while doing I/O on some file. -** EX_TEMPFAIL -- temporary failure, indicating something that -** is not really an error. In sendmail, this means -** that a mailer (e.g.) could not create a connection, -** and the request should be reattempted later. -** EX_PROTOCOL -- the remote system returned something that -** was "not possible" during a protocol exchange. -** EX_NOPERM -- You did not have sufficient permission to -** perform the operation. This is not intended for -** file system problems, which should use NOINPUT or -** CANTCREAT, but rather for higher level permissions. -** For example, kre uses this to restrict who students -** can send mail to. -** -** Maintained by Eric Allman (eric@berkeley, ucbvax!eric) -- -** please mail changes to me. -** -** @(#)sysexits.h 4.5 7/6/88 -*/ - -# define EX_OK 0 /* successful termination */ - -# define EX__BASE 64 /* base value for error messages */ - -# define EX_USAGE 64 /* command line usage error */ -# define EX_DATAERR 65 /* data format error */ -# define EX_NOINPUT 66 /* cannot open input */ -# define EX_NOUSER 67 /* addressee unknown */ -# define EX_NOHOST 68 /* host name unknown */ -# define EX_UNAVAILABLE 69 /* service unavailable */ -# define EX_SOFTWARE 70 /* internal software error */ -# define EX_OSERR 71 /* system error (e.g., can't fork) */ -# define EX_OSFILE 72 /* critical OS file missing */ -# define EX_CANTCREAT 73 /* can't create (user) output file */ -# define EX_IOERR 74 /* input/output error */ -# define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ -# define EX_PROTOCOL 76 /* remote error in protocol */ -# define EX_NOPERM 77 /* permission denied */ -# define EX_CONFIG 78 /* configuration error */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/Makefile.client b/mozilla/directory/c-sdk/ldap/libraries/Makefile.client deleted file mode 100644 index 88a1178df3b..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/Makefile.client +++ /dev/null @@ -1,59 +0,0 @@ -# -# 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 ../../config/arch.mk - -UNIXDIRLIST = liblber libldif libiutil libldap libprldap libssldap - -ifeq ($(OS_ARCH), WINNT) -UNIXDIRLIST += libutil -endif - -all export:: FORCE - @for i in $(UNIXDIRLIST); do \ - echo " cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) export"; \ - ( cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) export ); \ - done - -libs install:: FORCE - @for i in $(UNIXDIRLIST); do \ - echo " cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) install"; \ - ( cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) install ); \ - done - -clean clobber:: FORCE - @for i in $(UNIXDIRLIST); do \ - echo " cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) clean"; \ - ( cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) clean ); \ - done - -realclean clobber_all:: FORCE - @for i in $(UNIXDIRLIST); do \ - echo " cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) realclean"; \ - ( cd $$i; $(MAKE) -f Makefile.client $(MFLAGS) realclean ); \ - done - -FORCE: diff --git a/mozilla/directory/c-sdk/ldap/libraries/Makefile.in b/mozilla/directory/c-sdk/ldap/libraries/Makefile.in deleted file mode 100644 index 02806f903f0..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -DEPTH = ../../../.. -srcdir = @srcdir -ldaptopsrcdir = @top_srcdir@ - -UNIXDIRLIST = liblber libldap libprldap - -include ../build/autoconf.mk -include $(NSPR_TREE)/config/rules.mk - -all export:: FORCE - @for i in $(UNIXDIRLIST); do \ - echo " cd $$i; $(MAKE) $(MFLAGS) export"; \ - ( cd $$i; $(MAKE) $(MFLAGS) export ); \ - done - -libs install:: FORCE - @for i in $(UNIXDIRLIST); do \ - echo " cd $$i; $(MAKE) $(MFLAGS) install"; \ - ( cd $$i; $(MAKE) $(MFLAGS) install ); \ - done - -clean clobber:: FORCE - @for i in $(UNIXDIRLIST); do \ - echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \ - ( cd $$i; $(MAKE) $(MFLAGS) clean ); \ - done - -realclean clobber_all:: FORCE - @for i in $(UNIXDIRLIST); do \ - echo " cd $$i; $(MAKE) $(MFLAGS) realclean"; \ - ( cd $$i; $(MAKE) $(MFLAGS) realclean ); \ - done - -FORCE: diff --git a/mozilla/directory/c-sdk/ldap/libraries/genMakefile.client b/mozilla/directory/c-sdk/ldap/libraries/genMakefile.client deleted file mode 100644 index 4f165c3ce6a..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/genMakefile.client +++ /dev/null @@ -1,128 +0,0 @@ -# -# 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_SRC =.. -include ../../build.mk - -WINDEFDIR =msdos/winsock - -DEFLDAPW32 =$(WINDEFDIR)/nsldap32 -DEFNSSLDAPW32 =$(WINDEFDIR)/nssldap32 -DEFLDAPSSLW32 =$(WINDEFDIR)/nsldapssl32 -DEFLDAPW32CLIENT=$(WINDEFDIR)/ldap32 -DEFLDAPW16REV =$(WINDEFDIR)/nsldap -DEFLDAPW16 =$(WINDEFDIR)/libldap -DEFLDSSLW32 =$(WINDEFDIR)/ldapssl -DEFLCHW32 =$(WINDEFDIR)/nslch32 -DEFLDPRW32 =$(WINDEFDIR)/nsldappr32 -DEFLDPRINCL =$(WINDEFDIR)/nsldappr-incl - -FILES = $(DEFLDAPW32) $(DEFNSSLDAPW32) $(DEFLDAPSSLW32) \ - $(DEFLDAPW32CLIENT) $(DEFLDAPW16REV) $(DEFLDAPW16) \ - $(DEFLDSSLW32) $(DEFLCHW32) $(DEFLDPRW32) \ - $(DEFLDPRINCL) - -TDFFILES = $(addsuffix .tdf, $(FILES)) -DEFFILES = $(addsuffix .def, $(FILES)) - -ifeq ($(BUILD_OPT), 1) -GENEXPARGS=OPTIMIZE $(LDAPVERS) $(LDAPVERS_SUFFIX) -else -GENEXPARGS=DEBUG $(LDAPVERS) $(LDAPVERS_SUFFIX) -endif - -all: - @echo - @echo "This Makefile is intended to be run on a Unix box" - @echo "and will generated the necessary .def files for " - @echo "a Windows build. There is probably no reason why" - @echo "it has been run on Unix other than a long and" - @echo "glorius history :-)" - @echo - @echo "The valid options are:" - @echo "exportfiles - generate exportfiles - @echo "forceall - touch all of the tdf files - @echo "clean - clean up generated files - @echo - - -exportfiles: $(DEFLDAPW32).def $(DEFLDAPSSLW32).def \ - $(DEFLDAPW32CLIENT).def \ - $(DEFLDAPW16).def $(DEFLDAPW16REV).def \ - $(DEFLDSSLW32).def \ - $(DEFLDPRW32).def $(DEFLDPRINCL).def \ - $(DEFNSSLDAPW32).def - -PRLDAPEX =libprldap/libprldap.ex -LDAPSSLEX =libldap_ssl.ex -LDAPEX =libldap.ex - -# -# All the various flavors of Windows: -# - -$(DEFLDAPW32).def: $(DEFLDAPW32).tdf $(LDAPEX) $(OTHERDEFDEPS) - $(GENEXPORTS) Win32 $< $(LDAPEX) $(GENEXPARGS) > $@ - -$(DEFLDAPSSLW32).def: $(DEFLDAPSSLW32).tdf $(LDAPSSLEX) $(OTHERDEFDEPS) - $(GENEXPORTS) Win32 $< $(LDAPSSLEX) $(GENEXPARGS) > $@ - -$(DEFNSSLDAPW32).def: $(DEFNSSLDAPW32).tdf $(LDAPSSLEX) $(OTHERDEFDEPS) - $(GENEXPORTS) Win32 $< $(LDAPSSLEX) $(GENEXPARGS) > $@ - -$(DEFLDAPW32CLIENT).def: $(DEFLDAPW32CLIENT).tdf $(LDAPEX) $(OTHERDEFDEPS) - $(GENEXPORTS) Win32 $< $(LDAPEX) $(GENEXPARGS) > $@ - -$(DEFLDAPW16).def: $(DEFLDAPW16).tdf $(LDAPEX) $(OTHERDEFDEPS) - $(GENEXPORTS) Win16 $< $(LDAPEX) $(GENEXPARGS) > $@ - -$(DEFLDAPW16REV).def: $(DEFLDAPW16REV).tdf $(LDAPEX) $(OTHERDEFDEPS) - $(GENEXPORTS) Win16Rev $< $(LDAPEX) $(GENEXPARGS) > $@ - -$(DEFLDSSLW32).def: $(DEFLDSSLW32).tdf $(LDAPSSLEX) $(OTHERDEFDEPS) - $(GENEXPORTS) Win32 $< $(LDAPSSLEX) $(GENEXPARGS) > $@ - -$(DEFLDPRW32).def: $(DEFLDPRW32).tdf $(PRLDAPEX) $(OTHERDEFDEPS) - $(GENEXPORTS) Win32 $< $(PRLDAPEX) $(GENEXPARGS) > $@ - -$(DEFLDPRINCL).def: $(DEFLDPRINCL).tdf $(PRLDAPEX) $(OTHERDEFDEPS) - $(GENEXPORTS) Win32 $< $(PRLDAPEX) $(GENEXPARGS) > $@ - -ifeq ($(USE_DLL_EXPORTS_FILE), 1) -# generic rules to create standard export/map files -$(OBJDEST)/$(EXPLDAP).exp: $(LDAPEX) $(OTHERDEFDEPS) - $(GENEXPORTS) $(ARCH) Standard $< $(GENEXPARGS) > $@ - -$(OBJDEST)/$(EXPLDSSL).exp: $(LDAPSSLEX) $(OTHERDEFDEPS) - $(GENEXPORTS) $(ARCH) Standard $< $(GENEXPARGS) > $@ - -$(OBJDEST)/$(EXPLDPR).exp: $(PRLDAPEX) $(OTHERDEFDEPS) - $(GENEXPORTS) $(ARCH) Standard $< $(GENEXPARGS) > $@ -endif - -forceall: FORCE - touch $(TDFFILES) - -clean: FORCE - $(RM) $(DEFFILES) - -FORCE: diff --git a/mozilla/directory/c-sdk/ldap/libraries/libiutil/Makefile b/mozilla/directory/c-sdk/ldap/libraries/libiutil/Makefile deleted file mode 100644 index d6f041c96f6..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libiutil/Makefile +++ /dev/null @@ -1,46 +0,0 @@ - -# -# GNU Makefile for libiutil -# - -LDAP_SRC = ../.. -MCOM_ROOT = ../../../.. - -NOSTDCLEAN=true # don't let nsconfig.mk define target clean -NOSTDSTRIP=true # don't let nsconfig.mk define target strip -NSPR20=true # probably should be defined somewhere else (not sure where) - -OBJDEST = $(OBJDIR)/lib/libiutil -LIBDIR = $(LDAP_LIBDIR) - -include $(MCOM_ROOT)/netsite/nsdefs.mk -include $(MCOM_ROOT)/netsite/nsconfig.mk -include $(LDAP_SRC)/nsldap.mk - -CFLAGS += $(SLCFLAGS) - -LIBIUTIL_OBJS= iutil-lock.o - -OBJS = $(addprefix $(OBJDEST)/, $(LIBIUTIL_OBJS)) - -LIBIUTIL= $(addprefix $(LIBDIR)/, libiutil.$(LIB_SUFFIX)) - -clientSDK: all - -all: $(OBJDEST) $(LIBDIR) $(LIBIUTIL) - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBIUTIL): $(OBJS) - $(LINK_LIB) - -veryclean: clean - -clean: - $(RM) $(OBJS) - $(RM) $(LIBIUTIL) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - diff --git a/mozilla/directory/c-sdk/ldap/libraries/libiutil/Makefile.client b/mozilla/directory/c-sdk/ldap/libraries/libiutil/Makefile.client deleted file mode 100644 index 3aceb1fa484..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libiutil/Makefile.client +++ /dev/null @@ -1,103 +0,0 @@ -# -# 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 = ../../../../.. -NS_DEPTH = ../../../.. -LDAP_SRC = ../.. -NSCP_DISTDIR = ../../../../../dist -NSPR_TREE = ../../.. -MOD_DEPTH = ../../.. - -include $(NSPR_TREE)/config/rules.mk -include ../../../build.mk - -ifeq ($(HAVE_CCONF), 1) -SRCS = iutil-lock.c -else -SRCS = iutil-lock.c -endif - -ifeq ($(OS_ARCH), WINNT) -REALOBJS = $(SRCS:.c=.obj) -else -REALOBJS = $(SRCS:.c=.o) -endif - -IUTILOBJDEST = $(OBJDIR_NAME) -OBJS = $(addprefix $(IUTILOBJDEST)/, $(REALOBJS)) - -DISTHDIR = $(NSCP_DISTDIR)/public/ldap -HDIR = $(LDAP_SRC)/include - -ifeq ($(OS_ARCH), WINNT) -LIBIUTIL = $(addprefix $(IUTILOBJDEST)/, $(IUTIL_LIBNAME).$(LIB_SUFFIX)) -else -LIBIUTIL = $(addprefix $(IUTILOBJDEST)/, \ - lib$(IUTIL_LIBNAME).$(LIB_SUFFIX)) -endif -INSTALLDIR = $(DEPTH)/dist/$(OBJDIR_NAME) - -LOCAL_INCLUDES = -I$(PUBLIC)/nspr -INCLUDES += -I$(DISTHDIR) -I$(HDIR) -I$(INSTALLDIR)/include -I../../../../../dist/include -ifeq ($(HAVE_CCONF), 1) -INCLUDES += -I../libldap/ -endif -DEFINES += $(DEFS) - -PLATFORMCFLAGS = -DUSE_WAITPID -DNEEDPROTOS -PLATFORMLIBS = -THREADS = -THREADSLIB = - -########################################################################### - -versiont.c: Makefile.client Version.c - @$(RM) $@ - @(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \ - h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \ - -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ - -e "s|%VERSION%|$${v}|" \ - < Version.c > $@) - -all:: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBIUTIL) - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBIUTIL): $(OBJS) $(LIBDIR) - @echo ======= making $(LIBIUTIL) -ifdef SO_FILES_TO_REMOVE - -$(RM) $(SO_FILES_TO_REMOVE) -endif - $(LINK_LIB) - -veryclean:: clean - -clean:: - $(RM) $(OBJS) $(LIBIUTIL) - $(RM) -r $(IUTILOBJDEST) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - -install:: $(LIBIUTIL) - $(INSTALL) -m 444 $(LIBIUTIL) $(INSTALLDIR)/lib diff --git a/mozilla/directory/c-sdk/ldap/libraries/libiutil/README b/mozilla/directory/c-sdk/ldap/libraries/libiutil/README deleted file mode 100644 index 608cca33b3e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libiutil/README +++ /dev/null @@ -1,3 +0,0 @@ -There should be no reason for anyone to be using the -library which is produced in this directory.....it is -for mhein@netscape.com's use only diff --git a/mozilla/directory/c-sdk/ldap/libraries/libiutil/iutil-lock.c b/mozilla/directory/c-sdk/ldap/libraries/libiutil/iutil-lock.c deleted file mode 100644 index 0fdae2495eb..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libiutil/iutil-lock.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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): - */ - -/* - * Public interface for libiutil the innosoft migration library - * - */ - -#ifdef _WINDOWS - -#include "ldap.h" - -#define LDAP_MUTEX_T HANDLE - -int -pthread_mutex_init( LDAP_MUTEX_T *mp, void *attr) -{ - if ( (*mp = CreateMutex(NULL, FALSE, NULL)) == NULL ) - return( 1 ); - else - return( 0 ); -} - -static void * -pthread_mutex_alloc( void ) -{ - LDAP_MUTEX_T *mutexp; - - if ( (mutexp = malloc( sizeof(LDAP_MUTEX_T) )) != NULL ) { - pthread_mutex_init( mutexp, NULL ); - } - return( mutexp ); -} - -int -pthread_mutex_destroy( LDAP_MUTEX_T *mp ) -{ - if ( !(CloseHandle(*mp)) ) - return( 1 ); - else - return( 0 ); -} - -static void -pthread_mutex_free( void *mutexp ) -{ - pthread_mutex_destroy( (LDAP_MUTEX_T *) mutexp ); - free( mutexp ); -} - -int -pthread_mutex_lock( LDAP_MUTEX_T *mp ) -{ - if ( (WaitForSingleObject(*mp, INFINITE) != WAIT_OBJECT_0) ) - return( 1 ); - else - return( 0 ); -} - - -int -pthread_mutex_unlock( LDAP_MUTEX_T *mp ) -{ - if ( !(ReleaseMutex(*mp)) ) - return( 1 ); - else - return( 0 ); -} -#endif /* WINDOWS */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/Makefile.client b/mozilla/directory/c-sdk/ldap/libraries/liblber/Makefile.client deleted file mode 100644 index 5f8aec95800..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/Makefile.client +++ /dev/null @@ -1,97 +0,0 @@ -# -# 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 = ../../../../.. -NS_DEPTH = ../../../.. -LDAP_SRC = ../.. -NSCP_DISTDIR = ../../../../../dist -NSPR_TREE = ../../.. -MOD_DEPTH = ../../.. - -include $(NSPR_TREE)/config/rules.mk -include ../../../build.mk - -SRCS = decode.c \ - encode.c \ - io.c \ - bprint.c - -ifeq ($(OS_ARCH), WINNT) -REALOBJS = $(SRCS:.c=.obj) -else -REALOBJS = $(SRCS:.c=.o) -endif - -LBEROBJDEST = $(OBJDIR_NAME) -OBJS = $(addprefix $(LBEROBJDEST)/, $(REALOBJS)) - -HDIR = $(LDAP_SRC)/include - -ifeq ($(OS_ARCH), WINNT) -LIBLBER = $(addprefix $(LBEROBJDEST)/, $(LBER_LIBNAME).$(LIB_SUFFIX)) -else -LIBLBER = $(addprefix $(LBEROBJDEST)/, lib$(LBER_LIBNAME).$(LIB_SUFFIX)) -endif -INSTALLDIR = $(DEPTH)/dist/$(OBJDIR_NAME) - -LOCAL_INCLUDES = -INCLUDES += -I$(HDIR) -I$(INSTALLDIR)/include -I../../../../../dist/include -DEFINES += $(DEFS) - -PLATFORMCFLAGS = -DUSE_WAITPID -DNEEDPROTOS -PLATFORMLIBS = -THREADS = -THREADSLIB = - -########################################################################### - -versiont.c: Makefile.client Version.c - @$(RM) $@ - @(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \ - h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \ - -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ - -e "s|%VERSION%|$${v}|" \ - < Version.c > $@) - -all:: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLBER) - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBLBER): $(OBJS) $(LIBDIR) - @echo ======= making $(LIBLBER) -ifdef SO_FILES_TO_REMOVE - -$(RM) $(SO_FILES_TO_REMOVE) -endif - $(LINK_LIB) - -veryclean:: clean - -clean:: - $(RM) $(OBJS) $(LIBLBER) - $(RM) -r $(LBEROBJDEST) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - -install:: $(LIBLBER) - $(INSTALL) -m 444 $(LIBLBER) $(INSTALLDIR)/lib diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/Makefile.in b/mozilla/directory/c-sdk/ldap/libraries/liblber/Makefile.in deleted file mode 100644 index 0c7d67de219..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/Makefile.in +++ /dev/null @@ -1,80 +0,0 @@ -DEPTH = ../../../../.. -NS_DEPTH = ../../../.. -srcdir = @srcdir@ -ldaptopsrcdir = @top_srcdir@ - -RM = rm -f -SED = sed - -SRCS = decode.c \ - encode.c \ - io.c \ - bprint.c - -REALOBJS = $(SRCS:.c=.o) - -#OBJS = $(REALOBJS) versiont.o -OBJS = $(REALOBJS) - -HDIR = $(ldaptopsrcdir)/include - -LIBRARY_NAME = lber41 - -# -# DEFS are included in CFLAGS -# -DEFS = $(PLATFORMCFLAGS) $(LDAP_DEBUG) $(KERBEROS) $(AFSKERBEROS) \ - $(UOFM) $(UOFA) $(NO_USERINTERFACE) $(CLDAP) $(NO_CACHE) \ - $(LDAP_REFERRALS) $(LDAP_DNS) $(STR_TRANSLATION) \ - $(LIBLDAP_CHARSETS) $(LIBLDAP_DEF_CHARSET) \ - $(SLAPD_BACKENDS) $(LDBMBACKEND) $(LDBMINCLUDE) $(PHONETIC) - -include ../../build/autoconf.mk -include $(NSPR_TREE)/config/rules.mk - -LOCAL_INCLUDES = -I$(PUBLIC)/nspr -INCLUDES += -I$(HDIR) -DEFINES += $(DEFS) - -PLATFORMCFLAGS = -DUSE_WAITPID -DNEEDPROTOS -PLATFORMLIBS = -THREADS = -THREADSLIB = - -# -# To build slapd (the stand-alone ldap daemon), uncomment the MAKESLAPD -# line and select the SLAPD_BACKENDS you want to use. If you enable the -# LDBM backend, also select one of the LDBM backends. -# -MAKESLAPD = yes -SLAPD_BACKENDS = -DLDAP_LDBM -DLDAP_SHELL -DLDAP_PASSWD -LDBMBACKEND = -DLDBM_USE_NDBM - -# -# uncomment this line to enable debugging code (a good idea) -# -ifndef BUILD_OPT -LDAP_DEBUG = -DLDAP_DEBUG -endif - -# -# uncomment this line to enable support for LDAP referrals in libldap -# -LDAP_REFERRALS = -DLDAP_REFERRALS - -########################################################################### - -versiont.c: Makefile.client Version.c - @$(RM) $@ - @(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \ - h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \ - -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ - -e "s|%VERSION%|$${v}|" \ - < Version.c > $@) - -install:: $(LIBRARY) $(SHARED_LIBRARY) - $(INSTALL) -m 444 $(LIBRARY) $(DIST)/lib -ifdef MKSHLIB - $(INSTALL) -m 555 $(SHARED_LIBRARY) $(DIST)/lib - $(INSTALL) -m 555 $(SHARED_LIBRARY) $(DIST)/bin -endif diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/bprint.c b/mozilla/directory/c-sdk/ldap/libraries/liblber/bprint.c deleted file mode 100644 index 34b648456bd..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/bprint.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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): - */ - -/* bprint.c - a printing utility for debuging output */ -#include -#include "lber-int.h" - -#ifdef LDAP_DEBUG -/* - * Print arbitrary stuff, for debugging. - */ - -#define BPLEN 48 - -void -lber_bprint( char *data, int len ) -{ - static char hexdig[] = "0123456789abcdef"; - char out[ BPLEN ]; - int i = 0; - - memset( out, 0, BPLEN ); - for ( ;; ) { - if ( len < 1 ) { - char msg[BPLEN + 80]; - sprintf( msg, "\t%s\n", ( i == 0 ) ? "(end)" : out ); - ber_err_print( msg ); - break; - } - -#ifndef HEX - if ( isgraph( (unsigned char)*data )) { - out[ i ] = ' '; - out[ i+1 ] = *data; - } else { -#endif - out[ i ] = hexdig[ ( *data & 0xf0 ) >> 4 ]; - out[ i+1 ] = hexdig[ *data & 0x0f ]; -#ifndef HEX - } -#endif - i += 2; - len--; - data++; - - if ( i > BPLEN - 2 ) { - char msg[BPLEN + 80]; - sprintf( msg, "\t%s\n", out ); - ber_err_print( msg ); - memset( out, 0, BPLEN ); - i = 0; - continue; - } - out[ i++ ] = ' '; - } -} - -#endif - -void ber_err_print( char *data ) -{ -#ifdef USE_DEBUG_WIN - OutputDebugString( data ); -#else - fputs( data, stderr ); - fflush( stderr ); -#endif -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/decode.c b/mozilla/directory/c-sdk/ldap/libraries/liblber/decode.c deleted file mode 100644 index 2d6c4f618c9..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/decode.c +++ /dev/null @@ -1,759 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -/* decode.c - ber input decoding routines */ - -#include "lber-int.h" - -/* - * Note: ber_get_tag() only uses the ber_end and ber_ptr elements of ber. - * If that changes, the ber_peek_tag() and/or ber_skip_tag() implementations - * will need to be changed. - */ -/* return the tag - LBER_DEFAULT returned means trouble */ -unsigned long -LDAP_CALL -ber_get_tag( BerElement *ber ) -{ - unsigned char xbyte; - unsigned long tag; - char *tagp; - int i; - - if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 ) - return( LBER_DEFAULT ); - - if ( (xbyte & LBER_BIG_TAG_MASK) != LBER_BIG_TAG_MASK ) - return( (unsigned long) xbyte ); - - tagp = (char *) &tag; - tagp[0] = xbyte; - for ( i = 1; i < sizeof(long); i++ ) { - if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 ) - return( LBER_DEFAULT ); - - tagp[i] = xbyte; - - if ( ! (xbyte & LBER_MORE_TAG_MASK) ) - break; - } - - /* tag too big! */ - if ( i == sizeof(long) ) - return( LBER_DEFAULT ); - - /* want leading, not trailing 0's */ - return( tag >> (sizeof(long) - i - 1) ); -} - -/* - * Note: ber_skip_tag() only uses the ber_end and ber_ptr elements of ber. - * If that changes, the implementation of ber_peek_tag() will need to - * be changed. - */ -unsigned long -LDAP_CALL -ber_skip_tag( BerElement *ber, unsigned long *len ) -{ - unsigned long tag; - unsigned char lc; - int noctets, diff; - unsigned long netlen; - - /* - * Any ber element looks like this: tag length contents. - * Assuming everything's ok, we return the tag byte (we - * can assume a single byte), and return the length in len. - * - * Assumptions: - * 1) definite lengths - * 2) primitive encodings used whenever possible - */ - - /* - * First, we read the tag. - */ - - if ( (tag = ber_get_tag( ber )) == LBER_DEFAULT ) - return( LBER_DEFAULT ); - - /* - * Next, read the length. The first byte contains the length of - * the length. If bit 8 is set, the length is the long form, - * otherwise it's the short form. We don't allow a length that's - * greater than what we can hold in an unsigned long. - */ - - *len = netlen = 0; - if ( ber_read( ber, (char *) &lc, 1 ) != 1 ) - return( LBER_DEFAULT ); - if ( lc & 0x80 ) { - noctets = (lc & 0x7f); - if ( noctets > sizeof(unsigned long) ) - return( LBER_DEFAULT ); - diff = sizeof(unsigned long) - noctets; - if ( ber_read( ber, (char *) &netlen + diff, noctets ) - != noctets ) - return( LBER_DEFAULT ); - *len = LBER_NTOHL( netlen ); - } else { - *len = lc; - } - - return( tag ); -} - - -/* - * Note: Previously, we passed the "ber" parameter directly to ber_skip_tag(), - * saving and restoring the ber_ptr element only. We now take advantage - * of the fact that the only ber structure elements touched by ber_skip_tag() - * are ber_end and ber_ptr. If that changes, this code must change too. - */ -unsigned long -LDAP_CALL -ber_peek_tag( BerElement *ber, unsigned long *len ) -{ - BerElement bercopy; - - bercopy.ber_end = ber->ber_end; - bercopy.ber_ptr = ber->ber_ptr; - return( ber_skip_tag( &bercopy, len )); -} - -static int -ber_getnint( BerElement *ber, long *num, int len ) -{ - int i; - long value; - unsigned char buffer[sizeof(long)]; - /* - * The tag and length have already been stripped off. We should - * be sitting right before len bytes of 2's complement integer, - * ready to be read straight into an int. We may have to sign - * extend after we read it in. - */ - - if ( len > sizeof(long) ) - return( -1 ); - - /* read into the low-order bytes of netnum */ - if ( ber_read( ber, (char *) buffer, len ) != len ) - return( -1 ); - - /* This sets the required sign extension */ - if ( len != 0) { - value = 0x80 & buffer[0] ? (-1L) : 0; - } else { - value = 0; - } - - for ( i = 0; i < len; i++ ) - value = (value << 8) | buffer[i]; - - *num = value; - - return( len ); -} - -unsigned long -LDAP_CALL -ber_get_int( BerElement *ber, long *num ) -{ - unsigned long tag, len; - - if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT ) - return( LBER_DEFAULT ); - - /* - * len is being demoted to a long here -- possible conversion error - */ - - if ( ber_getnint( ber, num, (int)len ) != (long)len ) - return( LBER_DEFAULT ); - else - return( tag ); -} - -unsigned long -LDAP_CALL -ber_get_stringb( BerElement *ber, char *buf, unsigned long *len ) -{ - unsigned long datalen, tag; -#ifdef STR_TRANSLATION - char *transbuf; -#endif /* STR_TRANSLATION */ - - if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT ) - return( LBER_DEFAULT ); - if ( datalen > (*len - 1) ) - return( LBER_DEFAULT ); - - /* - * datalen is being demoted to a long here -- possible conversion error - */ - - if ( ber_read( ber, buf, datalen ) != (long) datalen ) - return( LBER_DEFAULT ); - - buf[datalen] = '\0'; - -#ifdef STR_TRANSLATION - if ( datalen > 0 && ( ber->ber_options & LBER_OPT_TRANSLATE_STRINGS ) - != 0 && ber->ber_decode_translate_proc != NULL ) { - transbuf = buf; - ++datalen; - if ( (*(ber->ber_decode_translate_proc))( &transbuf, &datalen, - 0 ) != 0 ) { - return( LBER_DEFAULT ); - } - if ( datalen > *len ) { - NSLBERI_FREE( transbuf ); - return( LBER_DEFAULT ); - } - SAFEMEMCPY( buf, transbuf, datalen ); - NSLBERI_FREE( transbuf ); - --datalen; - } -#endif /* STR_TRANSLATION */ - - *len = datalen; - return( tag ); -} - -unsigned long -LDAP_CALL -ber_get_stringa( BerElement *ber, char **buf ) -{ - unsigned long datalen, ndatalen, tag; - - if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT ) - return( LBER_DEFAULT ); - - if ( ((ndatalen = (size_t)datalen + 1) < (size_t) datalen) || - ( (*buf = (char *)NSLBERI_MALLOC( (size_t)ndatalen )) == NULL )) - return( LBER_DEFAULT ); - - /* - * datalen is being demoted to a long here -- possible conversion error - */ - if ( ber_read( ber, *buf, datalen ) != (long) datalen ) - return( LBER_DEFAULT ); - (*buf)[datalen] = '\0'; - -#ifdef STR_TRANSLATION - if ( datalen > 0 && ( ber->ber_options & LBER_OPT_TRANSLATE_STRINGS ) - != 0 && ber->ber_decode_translate_proc != NULL ) { - ++datalen; - if ( (*(ber->ber_decode_translate_proc))( buf, &datalen, 1 ) - != 0 ) { - NSLBERI_FREE( *buf ); - return( LBER_DEFAULT ); - } - } -#endif /* STR_TRANSLATION */ - - return( tag ); -} - -unsigned long -LDAP_CALL -ber_get_stringal( BerElement *ber, struct berval **bv ) -{ - unsigned long len, nlen, tag; - - if ( (*bv = (struct berval *)NSLBERI_MALLOC( sizeof(struct berval) )) - == NULL ) { - return( LBER_DEFAULT ); - } - - if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT ) { - return( LBER_DEFAULT ); - } - - if ( ((nlen = (size_t) len + 1) < (size_t)len) || - (((*bv)->bv_val = (char *)NSLBERI_MALLOC( (size_t)nlen )) - == NULL )) { - return( LBER_DEFAULT ); - } - - /* - * len is being demoted to a long here -- possible conversion error - */ - if ( ber_read( ber, (*bv)->bv_val, len ) != (int) len ) - return( LBER_DEFAULT ); - ((*bv)->bv_val)[len] = '\0'; - (*bv)->bv_len = len; - -#ifdef STR_TRANSLATION - if ( len > 0 && ( ber->ber_options & LBER_OPT_TRANSLATE_STRINGS ) != 0 - && ber->ber_decode_translate_proc != NULL ) { - ++len; - if ( (*(ber->ber_decode_translate_proc))( &((*bv)->bv_val), - &len, 1 ) != 0 ) { - NSLBERI_FREE( (*bv)->bv_val ); - return( LBER_DEFAULT ); - } - (*bv)->bv_len = len - 1; - } -#endif /* STR_TRANSLATION */ - - return( tag ); -} - -unsigned long -LDAP_CALL -ber_get_bitstringa( BerElement *ber, char **buf, unsigned long *blen ) -{ - unsigned long datalen, tag; - unsigned char unusedbits; - - if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT ) - return( LBER_DEFAULT ); - --datalen; - - if ( (*buf = (char *)NSLBERI_MALLOC( (size_t)datalen )) == NULL ) - return( LBER_DEFAULT ); - - if ( ber_read( ber, (char *)&unusedbits, 1 ) != 1 ) - return( LBER_DEFAULT ); - - /* - * datalen is being demoted to a long here -- possible conversion error - */ - if ( ber_read( ber, *buf, datalen ) != (long) datalen ) - return( LBER_DEFAULT ); - - *blen = datalen * 8 - unusedbits; - return( tag ); -} - -unsigned long -LDAP_CALL -ber_get_null( BerElement *ber ) -{ - unsigned long len, tag; - - if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT ) - return( LBER_DEFAULT ); - - if ( len != 0 ) - return( LBER_DEFAULT ); - - return( tag ); -} - -unsigned long -LDAP_CALL -ber_get_boolean( BerElement *ber, int *boolval ) -{ - long longbool; - int rc; - - rc = ber_get_int( ber, &longbool ); - *boolval = longbool; - - return( rc ); -} - -unsigned long -LDAP_CALL -ber_first_element( BerElement *ber, unsigned long *len, char **last ) -{ - /* skip the sequence header, use the len to mark where to stop */ - if ( ber_skip_tag( ber, len ) == LBER_DEFAULT ) { - return( LBER_ERROR ); - } - - *last = ber->ber_ptr + *len; - - if ( *last == ber->ber_ptr ) { - return( LBER_END_OF_SEQORSET ); - } - - return( ber_peek_tag( ber, len ) ); -} - -unsigned long -LDAP_CALL -ber_next_element( BerElement *ber, unsigned long *len, char *last ) -{ - if ( ber->ber_ptr == last ) { - return( LBER_END_OF_SEQORSET ); - } - - return( ber_peek_tag( ber, len ) ); -} - -/* VARARGS */ -unsigned long -LDAP_C -ber_scanf( BerElement *ber, const char *fmt, ... ) -{ - va_list ap; - char *last, *p; - char *s, **ss, ***sss; - struct berval ***bv, **bvp, *bval; - int *i, j; - long *l, rc, tag; - unsigned long *t; - unsigned long len; - size_t array_size; - - va_start( ap, fmt ); - -#ifdef LDAP_DEBUG - if ( lber_debug & 64 ) { - char msg[80]; - sprintf( msg, "ber_scanf fmt (%s) ber:\n", fmt ); - ber_err_print( msg ); - ber_dump( ber, 1 ); - } -#endif - for ( rc = 0, p = (char *) fmt; *p && rc != LBER_DEFAULT; p++ ) { - switch ( *p ) { - case 'a': /* octet string - allocate storage as needed */ - ss = va_arg( ap, char ** ); - rc = ber_get_stringa( ber, ss ); - break; - - case 'b': /* boolean */ - i = va_arg( ap, int * ); - rc = ber_get_boolean( ber, i ); - break; - - case 'e': /* enumerated */ - case 'i': /* int */ - l = va_arg( ap, long * ); - rc = ber_get_int( ber, l ); - break; - - case 'l': /* length of next item */ - l = va_arg( ap, long * ); - rc = ber_peek_tag( ber, (unsigned long *)l ); - break; - - case 'n': /* null */ - rc = ber_get_null( ber ); - break; - - case 's': /* octet string - in a buffer */ - s = va_arg( ap, char * ); - l = va_arg( ap, long * ); - rc = ber_get_stringb( ber, s, (unsigned long *)l ); - break; - - case 'o': /* octet string in a supplied berval */ - bval = va_arg( ap, struct berval * ); - ber_peek_tag( ber, &bval->bv_len ); - rc = ber_get_stringa( ber, &bval->bv_val ); - break; - - case 'O': /* octet string - allocate & include length */ - bvp = va_arg( ap, struct berval ** ); - rc = ber_get_stringal( ber, bvp ); - break; - - case 'B': /* bit string - allocate storage as needed */ - ss = va_arg( ap, char ** ); - l = va_arg( ap, long * ); /* for length, in bits */ - rc = ber_get_bitstringa( ber, ss, (unsigned long *)l ); - break; - - case 't': /* tag of next item */ - t = va_arg( ap, unsigned long * ); - *t = rc = ber_peek_tag( ber, &len ); - break; - - case 'T': /* skip tag of next item */ - t = va_arg( ap, unsigned long * ); - *t = rc = ber_skip_tag( ber, &len ); - break; - - case 'v': /* sequence of strings */ - sss = va_arg( ap, char *** ); - *sss = NULL; - j = 0; - array_size = 0; - for ( tag = ber_first_element( ber, &len, &last ); - tag != LBER_DEFAULT && tag != LBER_END_OF_SEQORSET - && rc != LBER_DEFAULT; - tag = ber_next_element( ber, &len, last ) ) { - if ( *sss == NULL ) { - /* Make room for at least 15 strings */ - *sss = (char **)NSLBERI_MALLOC(16 * sizeof(char *) ); - array_size = 16; - } else { - if ( (size_t)(j+2) > array_size) { - /* We'v overflowed our buffer */ - *sss = (char **)NSLBERI_REALLOC( *sss, (array_size * 2) * sizeof(char *) ); - array_size = array_size * 2; - } - } - rc = ber_get_stringa( ber, &((*sss)[j]) ); - j++; - } - if ( rc != LBER_DEFAULT && - tag != LBER_END_OF_SEQORSET ) { - rc = LBER_DEFAULT; - } - if ( j > 0 ) - (*sss)[j] = NULL; - break; - - case 'V': /* sequence of strings + lengths */ - bv = va_arg( ap, struct berval *** ); - *bv = NULL; - j = 0; - for ( tag = ber_first_element( ber, &len, &last ); - tag != LBER_DEFAULT && tag != LBER_END_OF_SEQORSET - && rc != LBER_DEFAULT; - tag = ber_next_element( ber, &len, last ) ) { - if ( *bv == NULL ) { - *bv = (struct berval **)NSLBERI_MALLOC( - 2 * sizeof(struct berval *) ); - } else { - *bv = (struct berval **)NSLBERI_REALLOC( - *bv, - (j + 2) * sizeof(struct berval *) ); - } - rc = ber_get_stringal( ber, &((*bv)[j]) ); - j++; - } - if ( rc != LBER_DEFAULT && - tag != LBER_END_OF_SEQORSET ) { - rc = LBER_DEFAULT; - } - if ( j > 0 ) - (*bv)[j] = NULL; - break; - - case 'x': /* skip the next element - whatever it is */ - if ( (rc = ber_skip_tag( ber, &len )) == LBER_DEFAULT ) - break; - ber->ber_ptr += len; - break; - - case '{': /* begin sequence */ - case '[': /* begin set */ - if ( *(p + 1) != 'v' && *(p + 1) != 'V' ) - rc = ber_skip_tag( ber, &len ); - break; - - case '}': /* end sequence */ - case ']': /* end set */ - break; - - default: - { - char msg[80]; - sprintf( msg, "unknown fmt %c\n", *p ); - ber_err_print( msg ); - } - rc = LBER_DEFAULT; - break; - } - } - - va_end( ap ); - - if (rc == LBER_DEFAULT) { - va_start( ap, fmt ); - for ( p--; fmt < p && *fmt; fmt++ ) { - switch ( *fmt ) { - case 'a': /* octet string - allocate storage as needed */ - ss = va_arg( ap, char ** ); - NSLBERI_FREE(*ss); - *ss = NULL; - break; - - case 'b': /* boolean */ - i = va_arg( ap, int * ); - break; - - case 'e': /* enumerated */ - case 'i': /* int */ - l = va_arg( ap, long * ); - break; - - case 'l': /* length of next item */ - l = va_arg( ap, long * ); - break; - - case 'n': /* null */ - break; - - case 's': /* octet string - in a buffer */ - s = va_arg( ap, char * ); - l = va_arg( ap, long * ); - break; - - case 'o': /* octet string in a supplied berval */ - bval = va_arg( ap, struct berval * ); - if (bval->bv_val) NSLBERI_FREE(bval->bv_val); - memset(bval, 0, sizeof(struct berval)); - break; - - case 'O': /* octet string - allocate & include length */ - bvp = va_arg( ap, struct berval ** ); - ber_bvfree(*bvp); - bvp = NULL; - break; - - case 'B': /* bit string - allocate storage as needed */ - ss = va_arg( ap, char ** ); - l = va_arg( ap, long * ); /* for length, in bits */ - if (*ss) NSLBERI_FREE(*ss); - *ss = NULL; - break; - - case 't': /* tag of next item */ - t = va_arg( ap, unsigned long * ); - break; - - case 'T': /* skip tag of next item */ - t = va_arg( ap, unsigned long * ); - break; - - case 'v': /* sequence of strings */ - sss = va_arg( ap, char *** ); - ber_svecfree(*sss); - *sss = NULL; - break; - - case 'V': /* sequence of strings + lengths */ - bv = va_arg( ap, struct berval *** ); - ber_bvecfree(*bv); - *bv = NULL; - break; - - case 'x': /* skip the next element - whatever it is */ - break; - - case '{': /* begin sequence */ - case '[': /* begin set */ - break; - - case '}': /* end sequence */ - case ']': /* end set */ - break; - - default: - break; - } - } /* for */ - va_end( ap ); - } /* if */ - - return( rc ); -} - -void -LDAP_CALL -ber_bvfree( struct berval *bv ) -{ - if ( bv != NULL ) { - if ( bv->bv_val != NULL ) { - NSLBERI_FREE( bv->bv_val ); - } - NSLBERI_FREE( (char *) bv ); - } -} - -void -LDAP_CALL -ber_bvecfree( struct berval **bv ) -{ - int i; - - if ( bv != NULL ) { - for ( i = 0; bv[i] != NULL; i++ ) { - ber_bvfree( bv[i] ); - } - NSLBERI_FREE( (char *) bv ); - } -} - -struct berval * -LDAP_CALL -ber_bvdup( const struct berval *bv ) -{ - struct berval *new; - - if ( (new = (struct berval *)NSLBERI_MALLOC( sizeof(struct berval) )) - == NULL ) { - return( NULL ); - } - if ( bv->bv_val == NULL ) { - new->bv_val = NULL; - new->bv_len = 0; - } else { - if ( (new->bv_val = (char *)NSLBERI_MALLOC( bv->bv_len + 1 )) - == NULL ) { - return( NULL ); - } - SAFEMEMCPY( new->bv_val, bv->bv_val, (size_t) bv->bv_len ); - new->bv_val[bv->bv_len] = '\0'; - new->bv_len = bv->bv_len; - } - - return( new ); -} - -void -LDAP_CALL -ber_svecfree( char **vals ) -{ - int i; - - if ( vals == NULL ) - return; - for ( i = 0; vals[i] != NULL; i++ ) - NSLBERI_FREE( vals[i] ); - NSLBERI_FREE( (char *) vals ); -} - -#ifdef STR_TRANSLATION -void -LDAP_CALL -ber_set_string_translators( - BerElement *ber, - BERTranslateProc encode_proc, - BERTranslateProc decode_proc -) -{ - ber->ber_encode_translate_proc = encode_proc; - ber->ber_decode_translate_proc = decode_proc; -} -#endif /* STR_TRANSLATION */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/dtest.c b/mozilla/directory/c-sdk/ldap/libraries/liblber/dtest.c deleted file mode 100644 index 31173e72bad..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/dtest.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ -/* dtest.c - lber decoding test program */ - -#include -#include -#ifdef MACOS -#include -#include -#else /* MACOS */ -#ifdef _WIN32 -#include -#else -#include -#include -#endif /* _WIN32 */ -#endif /* MACOS */ -#include "lber.h" - -int -SSL_Recv( int s, char *b, unsigned l, int dummy ) -{ - return( read( s, b, l ) ); -} - -SSL_Send( int s, char *b, unsigned l, int dummy ) -{ - return( write( s, b, l ) ); -} - -static void usage( char *name ) -{ - fprintf( stderr, "usage: %s < berfile\n", name ); -} - -main( int argc, char **argv ) -{ - long i, fd; - unsigned long len; - int tag; - BerElement *ber; - Sockbuf *sb; - extern int lber_debug; - - lber_debug = 255; - if ( argc > 1 ) { - usage( argv[0] ); - exit( 1 ); - } - - sb = ber_sockbuf_alloc(); - fd = 0; - ber_sockbuf_set_option( sb, LBER_SOCKBUF_OPT_DESC, &fd ); - - if ( (ber = der_alloc()) == NULL ) { - perror( "ber_alloc" ); - exit( 1 ); - } - - if ( (tag = ber_get_next( sb, &len, ber )) == LBER_ERROR ) { - perror( "ber_get_next" ); - exit( 1 ); - } - printf( "message has tag 0x%x and length %ld\n", tag, len ); - - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/encode.c b/mozilla/directory/c-sdk/ldap/libraries/liblber/encode.c deleted file mode 100644 index 0fe2e752413..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/encode.c +++ /dev/null @@ -1,668 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -/* encode.c - ber output encoding routines */ - -#include "lber-int.h" - -static int -ber_calc_taglen( unsigned long tag ) -{ - int i; - long mask; - - /* find the first non-all-zero byte in the tag */ - for ( i = sizeof(long) - 1; i > 0; i-- ) { - mask = (0xffL << (i * 8)); - /* not all zero */ - if ( tag & mask ) - break; - } - - return( i + 1 ); -} - -static int -ber_put_tag( BerElement *ber, unsigned long tag, int nosos ) -{ - int taglen; - unsigned long ntag; - - taglen = ber_calc_taglen( tag ); - - ntag = LBER_HTONL( tag ); - - return( ber_write( ber, ((char *) &ntag) + sizeof(long) - taglen, - taglen, nosos ) ); -} - -static int -ber_calc_lenlen( unsigned long len ) -{ - /* - * short len if it's less than 128 - one byte giving the len, - * with bit 8 0. - */ - - if ( len <= 0x7F ) - return( 1 ); - - /* - * long len otherwise - one byte with bit 8 set, giving the - * length of the length, followed by the length itself. - */ - - if ( len <= 0xFF ) - return( 2 ); - if ( len <= 0xFFFFL ) - return( 3 ); - if ( len <= 0xFFFFFFL ) - return( 4 ); - - return( 5 ); -} - -static int -ber_put_len( BerElement *ber, unsigned long len, int nosos ) -{ - int i; - char lenlen; - long mask; - unsigned long netlen; - - /* - * short len if it's less than 128 - one byte giving the len, - * with bit 8 0. - */ - - if ( len <= 127 ) { - netlen = LBER_HTONL( len ); - return( ber_write( ber, (char *) &netlen + sizeof(long) - 1, - 1, nosos ) ); - } - - /* - * long len otherwise - one byte with bit 8 set, giving the - * length of the length, followed by the length itself. - */ - - /* find the first non-all-zero byte */ - for ( i = sizeof(long) - 1; i > 0; i-- ) { - mask = (0xffL << (i * 8)); - /* not all zero */ - if ( len & mask ) - break; - } - lenlen = ++i; - if ( lenlen > 4 ) - return( -1 ); - lenlen |= 0x80; - - /* write the length of the length */ - if ( ber_write( ber, &lenlen, 1, nosos ) != 1 ) - return( -1 ); - - /* write the length itself */ - netlen = LBER_HTONL( len ); - if ( ber_write( ber, (char *) &netlen + (sizeof(long) - i), i, nosos ) - != i ) - return( -1 ); - - return( i + 1 ); -} - -static int -ber_put_int_or_enum( BerElement *ber, long num, unsigned long tag ) -{ - int i, sign, taglen; - int len, lenlen; - long netnum, mask; - - sign = (num < 0); - - /* - * high bit is set - look for first non-all-one byte - * high bit is clear - look for first non-all-zero byte - */ - for ( i = sizeof(long) - 1; i > 0; i-- ) { - mask = (0xffL << (i * 8)); - - if ( sign ) { - /* not all ones */ - if ( (num & mask) != mask ) - break; - } else { - /* not all zero */ - if ( num & mask ) - break; - } - } - - /* - * we now have the "leading byte". if the high bit on this - * byte matches the sign bit, we need to "back up" a byte. - */ - mask = (num & (0x80L << (i * 8))); - if ( (mask && !sign) || (sign && !mask) ) - i++; - - len = i + 1; - - if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 ) - return( -1 ); - - if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 ) - return( -1 ); - i++; - netnum = LBER_HTONL( num ); - if ( ber_write( ber, (char *) &netnum + (sizeof(long) - i), i, 0 ) - == i) - /* length of tag + length + contents */ - return( taglen + lenlen + i ); - - return( -1 ); -} - -int -LDAP_CALL -ber_put_enum( BerElement *ber, long num, unsigned long tag ) -{ - if ( tag == LBER_DEFAULT ) - tag = LBER_ENUMERATED; - - return( ber_put_int_or_enum( ber, num, tag ) ); -} - -int -LDAP_CALL -ber_put_int( BerElement *ber, long num, unsigned long tag ) -{ - if ( tag == LBER_DEFAULT ) - tag = LBER_INTEGER; - - return( ber_put_int_or_enum( ber, num, tag ) ); -} - -int -LDAP_CALL -ber_put_ostring( BerElement *ber, char *str, unsigned long len, - unsigned long tag ) -{ - int taglen, lenlen, rc; -#ifdef STR_TRANSLATION - int free_str; -#endif /* STR_TRANSLATION */ - - if ( tag == LBER_DEFAULT ) - tag = LBER_OCTETSTRING; - - if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 ) - return( -1 ); - -#ifdef STR_TRANSLATION - if ( len > 0 && ( ber->ber_options & LBER_OPT_TRANSLATE_STRINGS ) != 0 - && ber->ber_encode_translate_proc != NULL ) { - if ( (*(ber->ber_encode_translate_proc))( &str, &len, 0 ) - != 0 ) { - return( -1 ); - } - free_str = 1; - } else { - free_str = 0; - } -#endif /* STR_TRANSLATION */ - - /* - * Note: below is a spot where we limit ber_write - * to signed long (instead of unsigned long) - */ - - if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 || - ber_write( ber, str, len, 0 ) != (long) len ) { - rc = -1; - } else { - /* return length of tag + length + contents */ - rc = taglen + lenlen + len; - } - -#ifdef STR_TRANSLATION - if ( free_str ) { - NSLBERI_FREE( str ); - } -#endif /* STR_TRANSLATION */ - - return( rc ); -} - -int -LDAP_CALL -ber_put_string( BerElement *ber, char *str, unsigned long tag ) -{ - return( ber_put_ostring( ber, str, strlen( str ), tag )); -} - -int -LDAP_CALL -ber_put_bitstring( BerElement *ber, char *str, - unsigned long blen /* in bits */, unsigned long tag ) -{ - int taglen, lenlen, len; - unsigned char unusedbits; - - if ( tag == LBER_DEFAULT ) - tag = LBER_BITSTRING; - - if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 ) - return( -1 ); - - len = ( blen + 7 ) / 8; - unusedbits = (unsigned char) (len * 8 - blen); - if ( (lenlen = ber_put_len( ber, len + 1, 0 )) == -1 ) - return( -1 ); - - if ( ber_write( ber, (char *)&unusedbits, 1, 0 ) != 1 ) - return( -1 ); - - if ( ber_write( ber, str, len, 0 ) != len ) - return( -1 ); - - /* return length of tag + length + unused bit count + contents */ - return( taglen + 1 + lenlen + len ); -} - -int -LDAP_CALL -ber_put_null( BerElement *ber, unsigned long tag ) -{ - int taglen; - - if ( tag == LBER_DEFAULT ) - tag = LBER_NULL; - - if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 ) - return( -1 ); - - if ( ber_put_len( ber, 0, 0 ) != 1 ) - return( -1 ); - - return( taglen + 1 ); -} - -int -LDAP_CALL -ber_put_boolean( BerElement *ber, int boolval, unsigned long tag ) -{ - int taglen; - unsigned char trueval = 0xff; - unsigned char falseval = 0x00; - - if ( tag == LBER_DEFAULT ) - tag = LBER_BOOLEAN; - - if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 ) - return( -1 ); - - if ( ber_put_len( ber, 1, 0 ) != 1 ) - return( -1 ); - - if ( ber_write( ber, (char *)(boolval ? &trueval : &falseval), 1, 0 ) - != 1 ) - return( -1 ); - - return( taglen + 2 ); -} - -#define FOUR_BYTE_LEN 5 - - -/* the idea here is roughly this: we maintain a stack of these Seqorset - * structures. This is pushed when we see the beginning of a new set or - * sequence. It is popped when we see the end of a set or sequence. - * Since we don't want to malloc and free these structures all the time, - * we pre-allocate a small set of them within the ber element structure. - * thus we need to spot when we've overflowed this stack and fall back to - * malloc'ing instead. - */ -static int -ber_start_seqorset( BerElement *ber, unsigned long tag ) -{ - Seqorset *new_sos; - - /* can we fit into the local stack ? */ - if (ber->ber_sos_stack_posn < SOS_STACK_SIZE) { - /* yes */ - new_sos = &ber->ber_sos_stack[ber->ber_sos_stack_posn]; - } else { - /* no */ - if ( (new_sos = (Seqorset *)NSLBERI_MALLOC( sizeof(Seqorset))) - == NULLSEQORSET ) { - return( -1 ); - } - } - ber->ber_sos_stack_posn++; - - if ( ber->ber_sos == NULLSEQORSET ) - new_sos->sos_first = ber->ber_ptr; - else - new_sos->sos_first = ber->ber_sos->sos_ptr; - - /* Set aside room for a 4 byte length field */ - new_sos->sos_ptr = new_sos->sos_first + ber_calc_taglen( tag ) + FOUR_BYTE_LEN; - new_sos->sos_tag = tag; - - new_sos->sos_next = ber->ber_sos; - new_sos->sos_clen = 0; - - ber->ber_sos = new_sos; - if (ber->ber_sos->sos_ptr > ber->ber_end) { - nslberi_ber_realloc(ber, ber->ber_sos->sos_ptr - ber->ber_end); - } - return( 0 ); -} - -int -LDAP_CALL -ber_start_seq( BerElement *ber, unsigned long tag ) -{ - if ( tag == LBER_DEFAULT ) - tag = LBER_SEQUENCE; - - return( ber_start_seqorset( ber, tag ) ); -} - -int -LDAP_CALL -ber_start_set( BerElement *ber, unsigned long tag ) -{ - if ( tag == LBER_DEFAULT ) - tag = LBER_SET; - - return( ber_start_seqorset( ber, tag ) ); -} - -static int -ber_put_seqorset( BerElement *ber ) -{ - unsigned long len, netlen; - int taglen, lenlen; - unsigned char ltag = 0x80 + FOUR_BYTE_LEN - 1; - Seqorset *next; - Seqorset **sos = &ber->ber_sos; - - /* - * If this is the toplevel sequence or set, we need to actually - * write the stuff out. Otherwise, it's already been put in - * the appropriate buffer and will be written when the toplevel - * one is written. In this case all we need to do is update the - * length and tag. - */ - - len = (*sos)->sos_clen; - netlen = LBER_HTONL( len ); - if ( sizeof(long) > 4 && len > 0xFFFFFFFFUL ) - return( -1 ); - - if ( ber->ber_options & LBER_OPT_USE_DER ) { - lenlen = ber_calc_lenlen( len ); - } else { - lenlen = FOUR_BYTE_LEN; - } - - if ( (next = (*sos)->sos_next) == NULLSEQORSET ) { - /* write the tag */ - if ( (taglen = ber_put_tag( ber, (*sos)->sos_tag, 1 )) == -1 ) - return( -1 ); - - if ( ber->ber_options & LBER_OPT_USE_DER ) { - /* Write the length in the minimum # of octets */ - if ( ber_put_len( ber, len, 1 ) == -1 ) - return( -1 ); - - if (lenlen != FOUR_BYTE_LEN) { - /* - * We set aside FOUR_BYTE_LEN bytes for - * the length field. Move the data if - * we don't actually need that much - */ - SAFEMEMCPY( (*sos)->sos_first + taglen + - lenlen, (*sos)->sos_first + taglen + - FOUR_BYTE_LEN, len ); - } - } else { - /* Fill FOUR_BYTE_LEN bytes for length field */ - /* one byte of length length */ - if ( ber_write( ber, (char *)<ag, 1, 1 ) != 1 ) - return( -1 ); - - /* the length itself */ - if ( ber_write( ber, (char *) &netlen + sizeof(long) - - (FOUR_BYTE_LEN - 1), FOUR_BYTE_LEN - 1, 1 ) - != FOUR_BYTE_LEN - 1 ) - return( -1 ); - } - /* The ber_ptr is at the set/seq start - move it to the end */ - ber->ber_ptr += len; - } else { - unsigned long ntag; - - /* the tag */ - taglen = ber_calc_taglen( (*sos)->sos_tag ); - ntag = LBER_HTONL( (*sos)->sos_tag ); - SAFEMEMCPY( (*sos)->sos_first, (char *) &ntag + - sizeof(long) - taglen, taglen ); - - if ( ber->ber_options & LBER_OPT_USE_DER ) { - ltag = (lenlen == 1) ? (unsigned char)len : - (unsigned char) (0x80 + (lenlen - 1)); - } - - /* one byte of length length */ - SAFEMEMCPY( (*sos)->sos_first + 1, <ag, 1 ); - - if ( ber->ber_options & LBER_OPT_USE_DER ) { - if (lenlen > 1) { - /* Write the length itself */ - SAFEMEMCPY( (*sos)->sos_first + 2, - (char *)&netlen + sizeof(unsigned long) - - (lenlen - 1), - lenlen - 1 ); - } - if (lenlen != FOUR_BYTE_LEN) { - /* - * We set aside FOUR_BYTE_LEN bytes for - * the length field. Move the data if - * we don't actually need that much - */ - SAFEMEMCPY( (*sos)->sos_first + taglen + - lenlen, (*sos)->sos_first + taglen + - FOUR_BYTE_LEN, len ); - } - } else { - /* the length itself */ - SAFEMEMCPY( (*sos)->sos_first + taglen + 1, - (char *) &netlen + sizeof(long) - - (FOUR_BYTE_LEN - 1), FOUR_BYTE_LEN - 1 ); - } - - next->sos_clen += (taglen + lenlen + len); - next->sos_ptr += (taglen + lenlen + len); - } - - /* we're done with this seqorset, so free it up */ - /* was this one from the local stack ? */ - if (ber->ber_sos_stack_posn <= SOS_STACK_SIZE) { - /* yes */ - } else { - /* no */ - NSLBERI_FREE( (char *) (*sos) ); - } - ber->ber_sos_stack_posn--; - *sos = next; - - return( taglen + lenlen + len ); -} - -int -LDAP_CALL -ber_put_seq( BerElement *ber ) -{ - return( ber_put_seqorset( ber ) ); -} - -int -LDAP_CALL -ber_put_set( BerElement *ber ) -{ - return( ber_put_seqorset( ber ) ); -} - -/* VARARGS */ -int -LDAP_C -ber_printf( BerElement *ber, const char *fmt, ... ) -{ - va_list ap; - char *s, **ss; - struct berval **bv; - int rc, i; - unsigned long len; - - va_start( ap, fmt ); - -#ifdef LDAP_DEBUG - if ( lber_debug & 64 ) { - char msg[80]; - sprintf( msg, "ber_printf fmt (%s)\n", fmt ); - ber_err_print( msg ); - } -#endif - - for ( rc = 0; *fmt && rc != -1; fmt++ ) { - switch ( *fmt ) { - case 'b': /* boolean */ - i = va_arg( ap, int ); - rc = ber_put_boolean( ber, i, ber->ber_tag ); - break; - - case 'i': /* int */ - i = va_arg( ap, int ); - rc = ber_put_int( ber, (long)i, ber->ber_tag ); - break; - - case 'e': /* enumeration */ - i = va_arg( ap, int ); - rc = ber_put_enum( ber, (long)i, ber->ber_tag ); - break; - - case 'n': /* null */ - rc = ber_put_null( ber, ber->ber_tag ); - break; - - case 'o': /* octet string (non-null terminated) */ - s = va_arg( ap, char * ); - len = va_arg( ap, int ); - rc = ber_put_ostring( ber, s, len, ber->ber_tag ); - break; - - case 's': /* string */ - s = va_arg( ap, char * ); - rc = ber_put_string( ber, s, ber->ber_tag ); - break; - - case 'B': /* bit string */ - s = va_arg( ap, char * ); - len = va_arg( ap, int ); /* in bits */ - rc = ber_put_bitstring( ber, s, len, ber->ber_tag ); - break; - - case 't': /* tag for the next element */ - ber->ber_tag = va_arg( ap, unsigned long ); - ber->ber_usertag = 1; - break; - - case 'v': /* vector of strings */ - if ( (ss = va_arg( ap, char ** )) == NULL ) - break; - for ( i = 0; ss[i] != NULL; i++ ) { - if ( (rc = ber_put_string( ber, ss[i], - ber->ber_tag )) == -1 ) - break; - } - break; - - case 'V': /* sequences of strings + lengths */ - if ( (bv = va_arg( ap, struct berval ** )) == NULL ) - break; - for ( i = 0; bv[i] != NULL; i++ ) { - if ( (rc = ber_put_ostring( ber, bv[i]->bv_val, - bv[i]->bv_len, ber->ber_tag )) == -1 ) - break; - } - break; - - case '{': /* begin sequence */ - rc = ber_start_seq( ber, ber->ber_tag ); - break; - - case '}': /* end sequence */ - rc = ber_put_seqorset( ber ); - break; - - case '[': /* begin set */ - rc = ber_start_set( ber, ber->ber_tag ); - break; - - case ']': /* end set */ - rc = ber_put_seqorset( ber ); - break; - - default: { - char msg[80]; - sprintf( msg, "unknown fmt %c\n", *fmt ); - ber_err_print( msg ); - rc = -1; - break; - } - } - - if ( ber->ber_usertag == 0 ) - ber->ber_tag = LBER_DEFAULT; - else - ber->ber_usertag = 0; - } - - va_end( ap ); - - return( rc ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/etest.c b/mozilla/directory/c-sdk/ldap/libraries/liblber/etest.c deleted file mode 100644 index a64c2602812..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/etest.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -/* test.c - lber encoding test program */ - -#include -#include -#ifdef MACOS -#include -#include -#include -#include -#else /* MACOS */ -#include -#ifdef _WIN32 -#include -#else -#include -#endif /* _WIN32 */ -#endif /* MACOS */ -#include "lber.h" - -int -SSL_Recv( int s, char *b, unsigned l, int dummy ) -{ - return( read( s, b, l ) ); -} - -SSL_Send( int s, char *b, unsigned l, int dummy ) -{ - return( write( s, b, l ) ); -} - -int -getline( char *prompt, char c, char *buf, int bsize ) -{ - char *p; - - if ( prompt != NULL ) { - fprintf( stderr, "%s: ", prompt ); - } else { - fprintf( stderr, "enter value for '%c': ", c ); - } - if ( fgets( buf, bsize, stdin ) == NULL ) { - return( -1 ); - } - if ( (p = strchr( buf, '\n' )) != NULL ) { - *p = '\0'; - } - - return( 0 ); -} - - -static void usage( char *name ) -{ - fprintf( stderr, "usage: %s fmtstring\n", name ); -} - -main( int argc, char **argv ) -{ - int rc, fd; - char *s, *p; - void *arg1, *arg2; - Sockbuf *sb; - BerElement *ber; - char fmt[2]; - char buf[BUFSIZ]; - extern int lber_debug; - - lber_debug = 255; - if ( argc < 2 ) { - usage( argv[0] ); - exit( 1 ); - } - - sb = ber_sockbuf_alloc(); - fd = 1; - ber_sockbuf_set_option( sb, LBER_SOCKBUF_OPT_DESC, &fd ); - - if ( (ber = der_alloc()) == NULL ) { - perror( "ber_alloc" ); - exit( 1 ); - } - - rc = 0; - fmt[1] = '\0'; - for ( s = argv[1]; *s; s++ ) { - switch ( *s ) { - case 'i': /* int */ - case 'b': /* boolean */ - case 'e': /* enumeration */ - getline( NULL, *s, buf, sizeof(buf) ); - arg1 = (void *) atoi( buf ); - break; - - case 'n': /* null */ - arg1 = NULL; - break; - - case 'o': /* octet string (non-null terminated) */ - getline( NULL, *s, buf, sizeof(buf) ); - arg1 = (void *) buf; - arg2 = (void *) strlen( buf ); - break; - - case 's': /* string */ - getline( NULL, *s, buf, sizeof(buf) ); - arg1 = (void *) buf; - break; - - case 'B': /* bit string */ - getline( NULL, *s, buf, sizeof(buf) ); - arg1 = (void *) buf; - arg2 = (void *) strlen( buf ); - break; - - case 't': /* tag for the next element */ - getline( NULL, *s, buf, sizeof(buf) ); - arg1 = (void *) buf; - break; - - case '{': /* begin sequence */ - case '}': /* end sequence */ - case '[': /* begin set */ - case ']': /* end set */ - break; - - default: - fprintf( stderr, "unknown fmt %c\n", *s ); - rc = -1; - break; - } - - fmt[0] = *s; - if ( ber_printf( ber, fmt, arg1, arg2 ) == -1 ) { - fprintf( stderr, "ber_printf\n" ); - exit( 1 ); - } - } - - if ( ber_flush( sb, ber, 1 ) != 0 ) { - perror( "ber_flush" ); - rc = -1; - } - - return( rc ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/idtest.c b/mozilla/directory/c-sdk/ldap/libraries/liblber/idtest.c deleted file mode 100644 index 12d5aea9bdf..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/idtest.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -/* idtest.c - ber decoding test program using isode libraries */ - -#include -#include -#include - -static usage( char *name ) -{ - fprintf( stderr, "usage: %s\n", name ); -} - -main( int argc, char **argv ) -{ - PE pe; - PS psin, psout, pserr; - - /* read the pe from standard in */ - if ( (psin = ps_alloc( std_open )) == NULLPS ) { - perror( "ps_alloc" ); - exit( 1 ); - } - if ( std_setup( psin, stdin ) == NOTOK ) { - perror( "std_setup" ); - exit( 1 ); - } - /* write the pe to standard out */ - if ( (psout = ps_alloc( std_open )) == NULLPS ) { - perror( "ps_alloc" ); - exit( 1 ); - } - if ( std_setup( psout, stdout ) == NOTOK ) { - perror( "std_setup" ); - exit( 1 ); - } - /* pretty print it to standard error */ - if ( (pserr = ps_alloc( std_open )) == NULLPS ) { - perror( "ps_alloc" ); - exit( 1 ); - } - if ( std_setup( pserr, stderr ) == NOTOK ) { - perror( "std_setup" ); - exit( 1 ); - } - - while ( (pe = ps2pe( psin )) != NULLPE ) { - pe2pl( pserr, pe ); - pe2ps( psout, pe ); - } - - exit( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/io.c b/mozilla/directory/c-sdk/ldap/libraries/liblber/io.c deleted file mode 100644 index 49ca3ed98d3..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/io.c +++ /dev/null @@ -1,1484 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ -/* io.c - ber general i/o routines */ - -#include "lber-int.h" - -#define bergetc( sb, len ) ( sb->sb_ber.ber_end > sb->sb_ber.ber_ptr ? \ - (unsigned char)*sb->sb_ber.ber_ptr++ : \ - ber_filbuf( sb, len )) - -# ifdef macintosh -/* - * MacTCP/OpenTransport - */ -# define read( s, b, l ) tcpread( s, 0, (unsigned char *)b, l, NULL ) -# define MAX_WRITE 65535 -# define BerWrite( sb, b, l ) tcpwrite( sb->sb_sd, (unsigned char *)(b), (lsb_sd, b, l, 0 ) -# else /* _WIN32 */ -/* - * everything else (Unix/BSD 4.3 socket API) - */ -# define BerWrite( sb, b, l ) write( sb->sb_sd, b, l ) -# define udp_read( sb, b, l, al ) recvfrom(sb->sb_sd, (char *)b, l, 0, \ - (struct sockaddr *)sb->sb_fromaddr, \ - (al = sizeof(struct sockaddr), &al)) -# define udp_write( sb, b, l ) sendto(sb->sb_sd, (char *)(b), l, 0, \ - (struct sockaddr *)sb->sb_useaddr, sizeof(struct sockaddr)) -# endif /* _WIN32 */ -# endif /* macintosh */ - -#ifndef udp_read -#define udp_read( sb, b, l, al ) CLDAP NOT SUPPORTED -#define udp_write( sb, b, l ) CLDAP NOT SUPPORTED -#endif /* udp_read */ - -#define EXBUFSIZ 1024 - -#ifdef LDAP_DEBUG -int lber_debug; -#endif - -/* - * function prototypes - */ -static void nslberi_install_compat_io_fns( Sockbuf *sb ); -static int nslberi_extread_compat( int s, void *buf, int len, - struct lextiof_socket_private *arg ); -static int nslberi_extwrite_compat( int s, const void *buf, int len, - struct lextiof_socket_private *arg ); -static unsigned long get_tag( Sockbuf *sb, BerElement *ber); -static unsigned long get_ber_len( BerElement *ber); -static unsigned long read_len_in_ber( Sockbuf *sb, BerElement *ber); - -/* - * internal global structure for memory allocation callback functions - */ -static struct lber_memalloc_fns nslberi_memalloc_fns; - - -/* - * buffered read from "sb". - * returns value of first character read on success and -1 on error. - */ -static int -ber_filbuf( Sockbuf *sb, long len ) -{ - short rc; -#ifdef CLDAP - int addrlen; -#endif /* CLDAP */ - - if ( sb->sb_ber.ber_buf == NULL ) { - if ( (sb->sb_ber.ber_buf = (char *)NSLBERI_MALLOC( - READBUFSIZ )) == NULL ) { - return( -1 ); - } - sb->sb_ber.ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER; - sb->sb_ber.ber_ptr = sb->sb_ber.ber_buf; - sb->sb_ber.ber_end = sb->sb_ber.ber_buf; - } - - if ( sb->sb_naddr > 0 ) { -#ifdef CLDAP - rc = udp_read(sb, sb->sb_ber.ber_buf, READBUFSIZ, addrlen ); -#ifdef LDAP_DEBUG - if ( lber_debug ) { - char msg[80]; - sprintf( msg, "ber_filbuf udp_read %d bytes\n", - rc ); - ber_err_print( msg ); - if ( lber_debug > 1 && rc > 0 ) - lber_bprint( sb->sb_ber.ber_buf, rc ); - } -#endif /* LDAP_DEBUG */ -#else /* CLDAP */ - rc = -1; -#endif /* CLDAP */ - } else { - if ( sb->sb_ext_io_fns.lbextiofn_read != NULL ) { - rc = sb->sb_ext_io_fns.lbextiofn_read( - sb->sb_sd, sb->sb_ber.ber_buf, - ((sb->sb_options & LBER_SOCKBUF_OPT_NO_READ_AHEAD) - && (len < READBUFSIZ)) ? len : READBUFSIZ, - sb->sb_ext_io_fns.lbextiofn_socket_arg ); - } else { - rc = read( sb->sb_sd, sb->sb_ber.ber_buf, - ((sb->sb_options & LBER_SOCKBUF_OPT_NO_READ_AHEAD) - && (len < READBUFSIZ)) ? len : READBUFSIZ ); - } - } - - if ( rc > 0 ) { - sb->sb_ber.ber_ptr = sb->sb_ber.ber_buf + 1; - sb->sb_ber.ber_end = sb->sb_ber.ber_buf + rc; - return( (unsigned char)*sb->sb_ber.ber_buf ); - } - - return( -1 ); -} - - -static long -BerRead( Sockbuf *sb, char *buf, long len ) -{ - int c; - long nread = 0; - - while ( len > 0 ) { - if ( (c = bergetc( sb, len )) < 0 ) { - if ( nread > 0 ) - break; - return( c ); - } - *buf++ = c; - nread++; - len--; - } - - return( nread ); -} - - -/* - * Note: ber_read() only uses the ber_end and ber_ptr elements of ber. - * Functions like ber_get_tag(), ber_skip_tag, and ber_peek_tag() rely on - * that fact, so if this code is changed to use any additional elements of - * the ber structure, those functions will need to be changed as well. - */ -long -LDAP_CALL -ber_read( BerElement *ber, char *buf, unsigned long len ) -{ - unsigned long actuallen, nleft; - - nleft = ber->ber_end - ber->ber_ptr; - actuallen = nleft < len ? nleft : len; - - SAFEMEMCPY( buf, ber->ber_ptr, (size_t)actuallen ); - - ber->ber_ptr += actuallen; - - return( (long)actuallen ); -} - -/* - * enlarge the ber buffer. - * return 0 on success, -1 on error. - */ -int -nslberi_ber_realloc( BerElement *ber, unsigned long len ) -{ - unsigned long need, have, total; - size_t have_bytes; - Seqorset *s; - long off; - char *oldbuf; - - have_bytes = ber->ber_end - ber->ber_buf; - have = have_bytes / EXBUFSIZ; - need = (len < EXBUFSIZ ? 1 : (len + (EXBUFSIZ - 1)) / EXBUFSIZ); - total = have * EXBUFSIZ + need * EXBUFSIZ; - - oldbuf = ber->ber_buf; - - if (ber->ber_buf == NULL) { - if ( (ber->ber_buf = (char *)NSLBERI_MALLOC( (size_t)total )) - == NULL ) { - return( -1 ); - } - ber->ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER; - } else { - if ( ber->ber_flags & LBER_FLAG_NO_FREE_BUFFER ) { - /* transition to malloc'd buffer */ - if ( (ber->ber_buf = (char *)NSLBERI_MALLOC( - (size_t)total )) == NULL ) { - return( -1 ); - } - ber->ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER; - /* copy existing data into new malloc'd buffer */ - SAFEMEMCPY( ber->ber_buf, oldbuf, have_bytes ); - } else { - if ( (ber->ber_buf = (char *)NSLBERI_REALLOC( - ber->ber_buf,(size_t)total )) == NULL ) { - return( -1 ); - } - } - } - - ber->ber_end = ber->ber_buf + total; - - /* - * If the stinking thing was moved, we need to go through and - * reset all the sos and ber pointers. Offsets would've been - * a better idea... oh well. - */ - - if ( ber->ber_buf != oldbuf ) { - ber->ber_ptr = ber->ber_buf + (ber->ber_ptr - oldbuf); - - for ( s = ber->ber_sos; s != NULLSEQORSET; s = s->sos_next ) { - off = s->sos_first - oldbuf; - s->sos_first = ber->ber_buf + off; - - off = s->sos_ptr - oldbuf; - s->sos_ptr = ber->ber_buf + off; - } - } - - return( 0 ); -} - -/* - * returns "len" on success and -1 on failure. - */ -long -LDAP_CALL -ber_write( BerElement *ber, char *buf, unsigned long len, int nosos ) -{ - if ( nosos || ber->ber_sos == NULL ) { - if ( ber->ber_ptr + len > ber->ber_end ) { - if ( nslberi_ber_realloc( ber, len ) != 0 ) - return( -1 ); - } - SAFEMEMCPY( ber->ber_ptr, buf, (size_t)len ); - ber->ber_ptr += len; - return( len ); - } else { - if ( ber->ber_sos->sos_ptr + len > ber->ber_end ) { - if ( nslberi_ber_realloc( ber, len ) != 0 ) - return( -1 ); - } - SAFEMEMCPY( ber->ber_sos->sos_ptr, buf, (size_t)len ); - ber->ber_sos->sos_ptr += len; - ber->ber_sos->sos_clen += len; - return( len ); - } -} - -void -LDAP_CALL -ber_free( BerElement *ber, int freebuf ) -{ - if ( ber != NULL ) { - if ( freebuf && - !(ber->ber_flags & LBER_FLAG_NO_FREE_BUFFER)) { - NSLBERI_FREE(ber->ber_buf); - } - NSLBERI_FREE( (char *) ber ); - } -} - -/* - * return >= 0 on success, -1 on failure. - */ -int -LDAP_CALL -ber_flush( Sockbuf *sb, BerElement *ber, int freeit ) -{ - long nwritten = 0, towrite, rc, total; - int i = 0; - ldap_x_iovec ber_struct_copy[BER_ARRAY_QUANTITY]; - - if (ber->ber_rwptr == NULL) { - ber->ber_rwptr = ber->ber_buf; - } - - /* loop until it's all written */ - if (sb->sb_ext_io_fns.lbextiofn_writev != NULL) { - - /* build the copy of the ber_struct */ - memcpy(&(ber_struct_copy), &(ber->ber_struct), sizeof(ber_struct_copy)); - ber_struct_copy[BER_STRUCT_TAG].ldapiov_base = &(ber->ber_tag_contents[0]); - ber_struct_copy[BER_STRUCT_LEN].ldapiov_base = &(ber->ber_len_contents[0]); - ber_struct_copy[BER_STRUCT_PRE].ldapiov_base = &(ber->ber_pre_contents[0]); - if (ber->ber_rwptr > ber->ber_buf) { - ber_struct_copy[BER_STRUCT_VAL].ldapiov_base = ber->ber_rwptr; - } else { - ber_struct_copy[BER_STRUCT_VAL].ldapiov_base = ber->ber_buf; - } - ber_struct_copy[BER_STRUCT_VAL].ldapiov_len = ber->ber_ptr - ber->ber_rwptr; - - /* add the sizes of the different buffers to write with writev */ - for(total = 0, i = 0; i < BER_ARRAY_QUANTITY; ++i) { - total += ber_struct_copy[i].ldapiov_len; - } - towrite = total; - - /* begin loop here */ - while (1) { - if ((rc = sb->sb_ext_io_fns.lbextiofn_writev - (sb->sb_sd, ber_struct_copy, BER_ARRAY_QUANTITY, - sb->sb_ext_io_fns.lbextiofn_socket_arg)) == 0) { - return(towrite); - } else if (rc < 0) { - return(rc); - } else { - towrite -= rc; - if (towrite > 0) { - nwritten = towrite; - /* go backwards through the buffers finding the place you stopped... */ - for (i = BER_ARRAY_QUANTITY - 1; i >= 0; --i) { - if (ber_struct_copy[i].ldapiov_len >= nwritten) { - ber_struct_copy[i].ldapiov_base = ber_struct_copy[i].ldapiov_base + ber_struct_copy[i].ldapiov_len - nwritten; - ber_struct_copy[i].ldapiov_len = nwritten; - /* ... then set all of the other buffers to 0 size because they've already been written */ - for (--i; i >= 0; --i) { - ber_struct_copy[i].ldapiov_len = 0; - } - break; /* Not necessary */ - } - else { - nwritten -= ber_struct_copy[i].ldapiov_len; - } - } - } - else { - ber->ber_rwptr = NULL; - if( freeit ) { - ber_free( ber, 1 ); - } - return(0); - } - } - } - } - - towrite = ber->ber_ptr - ber->ber_rwptr; - -#ifdef LDAP_DEBUG - if ( lber_debug ) { - char msg[80]; - sprintf( msg, "ber_flush: %ld bytes to sd %ld%s\n", towrite, - sb->sb_sd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)" - : "" ); - ber_err_print( msg ); - if ( lber_debug > 1 ) - lber_bprint( ber->ber_rwptr, towrite ); - } -#endif -#if !defined(macintosh) && !defined(DOS) - if ( sb->sb_options & (LBER_SOCKBUF_OPT_TO_FILE | LBER_SOCKBUF_OPT_TO_FILE_ONLY) ) { - rc = write( sb->sb_copyfd, ber->ber_buf, towrite ); - if ( sb->sb_options & LBER_SOCKBUF_OPT_TO_FILE_ONLY ) { - return( (int)rc ); - } - } -#endif - - nwritten = 0; - do { - if (sb->sb_naddr > 0) { -#ifdef CLDAP - rc = udp_write( sb, ber->ber_buf + nwritten, - (size_t)towrite ); -#else /* CLDAP */ - rc = -1; -#endif /* CLDAP */ - if ( rc <= 0 ) - return( -1 ); - /* fake error if write was not atomic */ - if (rc < towrite) { -#if !defined( macintosh ) && !defined( DOS ) - errno = EMSGSIZE; /* For Win32, see portable.h */ -#endif - return( -1 ); - } - } else { - if ( sb->sb_ext_io_fns.lbextiofn_write != NULL ) { - if ( (rc = sb->sb_ext_io_fns.lbextiofn_write( - sb->sb_sd, ber->ber_rwptr, (size_t)towrite, - sb->sb_ext_io_fns.lbextiofn_socket_arg )) - <= 0 ) { - return( -1 ); - } - } else { - if ( (rc = BerWrite( sb, ber->ber_rwptr, - (size_t) towrite )) <= 0 ) { - return( -1 ); - } - } - } - towrite -= rc; - nwritten += rc; - ber->ber_rwptr += rc; - } while ( towrite > 0 ); - - if ( freeit ) - ber_free( ber, 1 ); - - return( 0 ); -} - - -/* we pre-allocate a buffer to save the extra malloc later */ -BerElement * -LDAP_CALL -ber_alloc_t( int options ) -{ - BerElement *ber; - - if ( (ber = (BerElement*)NSLBERI_CALLOC( 1, - sizeof(struct berelement) + EXBUFSIZ )) == NULL ) { - return( NULL ); - } - - /* - * for compatibility with the C LDAP API standard, we recognize - * LBER_USE_DER as LBER_OPT_USE_DER. See lber.h for a bit more info. - */ - if ( options & LBER_USE_DER ) { - options &= ~LBER_USE_DER; - options |= LBER_OPT_USE_DER; - } - - ber->ber_tag = LBER_DEFAULT; - ber->ber_options = options; - ber->ber_buf = (char*)ber + sizeof(struct berelement); - ber->ber_ptr = ber->ber_buf; - ber->ber_end = ber->ber_buf + EXBUFSIZ; - ber->ber_flags = LBER_FLAG_NO_FREE_BUFFER; - - return( ber ); -} - - -BerElement * -LDAP_CALL -ber_alloc() -{ - return( ber_alloc_t( 0 ) ); -} - -BerElement * -LDAP_CALL -der_alloc() -{ - return( ber_alloc_t( LBER_OPT_USE_DER ) ); -} - -BerElement * -LDAP_CALL -ber_dup( BerElement *ber ) -{ - BerElement *new; - - if ( (new = ber_alloc()) == NULL ) - return( NULL ); - - *new = *ber; - - return( new ); -} - - -void -LDAP_CALL -ber_init_w_nullchar( BerElement *ber, int options ) -{ - (void) memset( (char *)ber, '\0', sizeof(struct berelement) ); - ber->ber_tag = LBER_DEFAULT; - - /* - * For compatibility with the C LDAP API standard, we recognize - * LBER_USE_DER as LBER_OPT_USE_DER. See lber.h for a bit more info. - */ - if ( options & LBER_USE_DER ) { - options &= ~LBER_USE_DER; - options |= LBER_OPT_USE_DER; - } - - ber->ber_options = options; -} - -void -LDAP_CALL -ber_reset( BerElement *ber, int was_writing ) -{ - if ( was_writing ) { - ber->ber_end = ber->ber_ptr; - ber->ber_ptr = ber->ber_buf; - } else { - ber->ber_ptr = ber->ber_end; - } - - ber->ber_rwptr = NULL; - - memset(ber->ber_struct, 0, BER_CONTENTS_STRUCT_SIZE); -} - - -#ifdef LDAP_DEBUG - -void -ber_dump( BerElement *ber, int inout ) -{ - char msg[128]; - sprintf( msg, "ber_dump: buf 0x%lx, ptr 0x%lx, rwptr 0x%lx, end 0x%lx\n", - ber->ber_buf, ber->ber_ptr, ber->ber_rwptr, ber->ber_end ); - ber_err_print( msg ); - if ( inout == 1 ) { - sprintf( msg, " current len %ld, contents:\n", - ber->ber_end - ber->ber_ptr ); - ber_err_print( msg ); - lber_bprint( ber->ber_ptr, ber->ber_end - ber->ber_ptr ); - } else { - sprintf( msg, " current len %ld, contents:\n", - ber->ber_ptr - ber->ber_buf ); - ber_err_print( msg ); - lber_bprint( ber->ber_buf, ber->ber_ptr - ber->ber_buf ); - } -} - -void -ber_sos_dump( Seqorset *sos ) -{ - char msg[80]; - ber_err_print ( "*** sos dump ***\n" ); - while ( sos != NULLSEQORSET ) { - sprintf( msg, "ber_sos_dump: clen %ld first 0x%lx ptr 0x%lx\n", - sos->sos_clen, sos->sos_first, sos->sos_ptr ); - ber_err_print( msg ); - sprintf( msg, " current len %ld contents:\n", - sos->sos_ptr - sos->sos_first ); - ber_err_print( msg ); - lber_bprint( sos->sos_first, sos->sos_ptr - sos->sos_first ); - - sos = sos->sos_next; - } - ber_err_print( "*** end dump ***\n" ); -} - -#endif - -/* return the tag - LBER_DEFAULT returned means trouble - * assumes the tag is only one byte! */ -static unsigned long -get_tag( Sockbuf *sb, BerElement *ber) -{ - unsigned char xbyte; - - if ( (BerRead( sb, (char *) &xbyte, 1 )) != 1 ) { - return( LBER_DEFAULT ); - } - - if ( (xbyte & LBER_BIG_TAG_MASK) == LBER_BIG_TAG_MASK ) { - return( LBER_DEFAULT ); - } - - ber->ber_tag_contents[0] = xbyte; - ber->ber_struct[BER_STRUCT_TAG].ldapiov_len = 1; - return((unsigned long)xbyte); -} - - -/* Error checking? */ -/* Takes a ber and returns the actual length in a long */ -static unsigned long -get_ber_len( BerElement *ber) -{ - int noctets; - unsigned long len = 0; - char xbyte; - - xbyte = ber->ber_len_contents[0]; - - /* long form */ - if (xbyte & 0x80) { - noctets = (int) (xbyte & 0x7f); - if (noctets >= MAX_LEN_SIZE) { - return(LBER_DEFAULT); - } - memcpy((char*) &len + sizeof(unsigned long) - noctets, &ber->ber_len_contents[1], noctets); - len = LBER_NTOHL(len); - return(len); - } else { - return((unsigned long)(xbyte)); - } -} - -/* LBER_DEFAULT means trouble - reads in the length, stores it in ber->ber_struct, and returns get_ber_len */ -static unsigned long -read_len_in_ber( Sockbuf *sb, BerElement *ber) -{ - unsigned char xbyte; - int noctets; - int rc = 0; - - /* - * Next, read the length. The first byte contains the length - * of the length. If bit 8 is set, the length is the long - * form, otherwise it's the short form. We don't allow a - * length that's greater than what we can hold in a long (2GB) - */ - - if ( BerRead( sb, (char *) &xbyte, 1 ) != 1 ) { - return( LBER_DEFAULT ); - } - - ber->ber_len_contents[0] = xbyte; - - /* long form of the length value */ - if ( xbyte & 0x80 ) { - noctets = (xbyte & 0x7f); - if ( noctets >= MAX_LEN_SIZE ) - return( LBER_DEFAULT ); - while (rc < noctets) { - if ( (rc += BerRead( sb, &(ber->ber_len_contents[1]) + rc, noctets - rc )) <= 0) { - return( LBER_DEFAULT ); - } - } - ber->ber_struct[BER_STRUCT_LEN].ldapiov_len = 1 + noctets; - } else { /* short form of the length value */ - ber->ber_struct[BER_STRUCT_LEN].ldapiov_len = 1; - } - return(get_ber_len(ber)); -} - - -unsigned long -LDAP_CALL -ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber ) -{ - unsigned long tag, toread, newlen; - long rc; - -#ifdef LDAP_DEBUG - if ( lber_debug ) - ber_err_print( "ber_get_next\n" ); -#endif - - /* - * first time through - malloc the buffer, set up ptrs, and - * read the tag and the length and as much of the rest as we can - */ - - if ( ber->ber_rwptr == NULL ) { - /* read the tag */ - if ((tag = get_tag(sb, ber)) == LBER_DEFAULT ) { - return( LBER_DEFAULT ); - } - - if((sb->sb_options & LBER_SOCKBUF_OPT_VALID_TAG) && - (tag != sb->sb_valid_tag)) { - return( LBER_DEFAULT); - } - - ber->ber_tag_contents[0] = (char)tag; /* we only handle 1 byte tags */ - - /* read the length */ - if ((newlen = read_len_in_ber(sb, ber)) == LBER_DEFAULT ) { - return( LBER_DEFAULT ); - } - - /* - * Finally, malloc a buffer for the contents and read it in. - * It's this buffer that's passed to all the other ber decoding - * routines. - */ - -#if defined( DOS ) && !( defined( _WIN32 ) || defined(XP_OS2) ) - if ( newlen > 65535 ) { /* DOS can't allocate > 64K */ - return( LBER_DEFAULT ); - } -#endif /* DOS && !_WIN32 */ - - if ( ( sb->sb_options & LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE ) - && newlen > sb->sb_max_incoming ) { - return( LBER_DEFAULT ); - } - - if ( (ber->ber_buf = (char *)NSLBERI_CALLOC( 1,(size_t)newlen )) - == NULL ) { - return( LBER_DEFAULT ); - } - - ber->ber_len = newlen; - ber->ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER; - ber->ber_ptr = ber->ber_buf; - ber->ber_end = ber->ber_buf + newlen; - ber->ber_rwptr = ber->ber_buf; - } - - /* OK, we've malloc-ed the buffer; now read the rest of the expected length */ - toread = (unsigned long)ber->ber_end - (unsigned long)ber->ber_rwptr; - do { - if ( (rc = BerRead( sb, ber->ber_rwptr, (long)toread )) <= 0 ) { - return( LBER_DEFAULT ); - } - - toread -= rc; - ber->ber_rwptr += rc; - } while ( toread > 0 ); - -#ifdef LDAP_DEBUG - if ( lber_debug ) { - char msg[80]; - sprintf( msg, "ber_get_next: tag 0x%lx len %ld contents:\n", - tag, ber->ber_len ); - ber_err_print( msg ); - if ( lber_debug > 1 ) - ber_dump( ber, 1 ); - } -#endif - - ber->ber_rwptr = NULL; - *len = newlen; - ber->ber_struct[BER_STRUCT_VAL].ldapiov_len = newlen; - return(tag); -} - -Sockbuf * -LDAP_CALL -ber_sockbuf_alloc() -{ - return( (Sockbuf *)NSLBERI_CALLOC( 1, sizeof(struct sockbuf) ) ); -} - -void -LDAP_CALL -ber_sockbuf_free(Sockbuf *p) -{ - if ( p != NULL ) { - if ( p->sb_ber.ber_buf != NULL && - !(p->sb_ber.ber_flags & LBER_FLAG_NO_FREE_BUFFER) ) { - NSLBERI_FREE( p->sb_ber.ber_buf ); - } - NSLBERI_FREE(p); - } -} - -/* - * return 0 on success and -1 on error - */ -int -LDAP_CALL -ber_set_option( struct berelement *ber, int option, void *value ) -{ - - /* - * memory allocation callbacks are global, so it is OK to pass - * NULL for ber. Handle this as a special case. - */ - if ( option == LBER_OPT_MEMALLOC_FN_PTRS ) { - /* struct copy */ - nslberi_memalloc_fns = *((struct lber_memalloc_fns *)value); - return( 0 ); - } - - /* - * lber_debug is global, so it is OK to pass - * NULL for ber. Handle this as a special case. - */ - if ( option == LBER_OPT_DEBUG_LEVEL ) { -#ifdef LDAP_DEBUG - lber_debug = *(int *)value; -#endif - return( 0 ); - } - - /* - * all the rest require a non-NULL ber - */ - if ( !NSLBERI_VALID_BERELEMENT_POINTER( ber )) { - return( -1 ); - } - - switch ( option ) { - case LBER_OPT_USE_DER: - case LBER_OPT_TRANSLATE_STRINGS: - if ( value != NULL ) { - ber->ber_options |= option; - } else { - ber->ber_options &= ~option; - } - break; - case LBER_OPT_REMAINING_BYTES: - ber->ber_end = ber->ber_ptr + *((unsigned long *)value); - break; - case LBER_OPT_TOTAL_BYTES: - ber->ber_end = ber->ber_buf + *((unsigned long *)value); - break; - case LBER_OPT_BYTES_TO_WRITE: - ber->ber_ptr = ber->ber_buf + *((unsigned long *)value); - break; - default: - return( -1 ); - } - - return( 0 ); -} - -/* - * return 0 on success and -1 on error - */ -int -LDAP_CALL -ber_get_option( struct berelement *ber, int option, void *value ) -{ - /* - * memory callocation callbacks are global, so it is OK to pass - * NULL for ber. Handle this as a special case - */ - if ( option == LBER_OPT_MEMALLOC_FN_PTRS ) { - /* struct copy */ - *((struct lber_memalloc_fns *)value) = nslberi_memalloc_fns; - return( 0 ); - } - - /* - * lber_debug is global, so it is OK to pass - * NULL for ber. Handle this as a special case. - */ - if ( option == LBER_OPT_DEBUG_LEVEL ) { -#ifdef LDAP_DEBUG - *(int *)value = lber_debug; -#endif - return( 0 ); - } - /* - * all the rest require a non-NULL ber - */ - if ( !NSLBERI_VALID_BERELEMENT_POINTER( ber )) { - return( -1 ); - } - - switch ( option ) { - case LBER_OPT_USE_DER: - case LBER_OPT_TRANSLATE_STRINGS: - *((int *) value) = (ber->ber_options & option); - break; - case LBER_OPT_REMAINING_BYTES: - *((unsigned long *) value) = ber->ber_end - ber->ber_ptr; - break; - case LBER_OPT_TOTAL_BYTES: - *((unsigned long *) value) = ber->ber_end - ber->ber_buf; - break; - case LBER_OPT_BYTES_TO_WRITE: - *((unsigned long *) value) = ber->ber_ptr - ber->ber_buf; - break; - default: - return( -1 ); - } - - return( 0 ); -} - -/* - * return 0 on success and -1 on error - */ -int -LDAP_CALL -ber_sockbuf_set_option( Sockbuf *sb, int option, void *value ) -{ - struct lber_x_ext_io_fns *extiofns; - - if ( !NSLBERI_VALID_SOCKBUF_POINTER( sb )) { - return( -1 ); - } - - switch ( option ) { - case LBER_SOCKBUF_OPT_VALID_TAG: - sb->sb_valid_tag= *((unsigned long *) value); - if ( value != NULL ) { - sb->sb_options |= option; - } else { - sb->sb_options &= ~option; - } - break; - case LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE: - sb->sb_max_incoming = *((unsigned long *) value); - /* FALL */ - case LBER_SOCKBUF_OPT_TO_FILE: - case LBER_SOCKBUF_OPT_TO_FILE_ONLY: - case LBER_SOCKBUF_OPT_NO_READ_AHEAD: - if ( value != NULL ) { - sb->sb_options |= option; - } else { - sb->sb_options &= ~option; - } - break; - case LBER_SOCKBUF_OPT_DESC: - sb->sb_sd = *((LBER_SOCKET *) value); - break; - case LBER_SOCKBUF_OPT_COPYDESC: - sb->sb_copyfd = *((LBER_SOCKET *) value); - break; - case LBER_SOCKBUF_OPT_READ_FN: - sb->sb_io_fns.lbiof_read = (LDAP_IOF_READ_CALLBACK *) value; - nslberi_install_compat_io_fns( sb ); - break; - case LBER_SOCKBUF_OPT_WRITE_FN: - sb->sb_io_fns.lbiof_write = (LDAP_IOF_WRITE_CALLBACK *) value; - nslberi_install_compat_io_fns( sb ); - break; - case LBER_SOCKBUF_OPT_EXT_IO_FNS: - extiofns = (struct lber_x_ext_io_fns *) value; - if ( extiofns == NULL ) { /* remove */ - (void)memset( (char *)&sb->sb_ext_io_fns, '\0', - sizeof(sb->sb_ext_io_fns )); - } else if ( extiofns->lbextiofn_size - == LBER_X_EXTIO_FNS_SIZE ) { - /* struct copy */ - sb->sb_ext_io_fns = *extiofns; - } else if ( extiofns->lbextiofn_size - == LBER_X_EXTIO_FNS_SIZE_REV0 ) { - /* backwards compatiblity for older struct */ - sb->sb_ext_io_fns.lbextiofn_size = - LBER_X_EXTIO_FNS_SIZE; - sb->sb_ext_io_fns.lbextiofn_read = - extiofns->lbextiofn_read; - sb->sb_ext_io_fns.lbextiofn_write = - extiofns->lbextiofn_write; - sb->sb_ext_io_fns.lbextiofn_writev = NULL; - sb->sb_ext_io_fns.lbextiofn_socket_arg = - extiofns->lbextiofn_socket_arg; - } else { - return( -1 ); - } - break; - default: - return( -1 ); - } - - return( 0 ); -} - -/* - * return 0 on success and -1 on error - */ -int -LDAP_CALL -ber_sockbuf_get_option( Sockbuf *sb, int option, void *value ) -{ - struct lber_x_ext_io_fns *extiofns; - - if ( !NSLBERI_VALID_SOCKBUF_POINTER( sb )) { - return( -1 ); - } - - switch ( option ) { - case LBER_SOCKBUF_OPT_VALID_TAG: - *((unsigned long *) value) = sb->sb_valid_tag; - break; - case LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE: - *((unsigned long *) value) = sb->sb_max_incoming; - break; - case LBER_SOCKBUF_OPT_TO_FILE: - case LBER_SOCKBUF_OPT_TO_FILE_ONLY: - case LBER_SOCKBUF_OPT_NO_READ_AHEAD: - *((int *) value) = (sb->sb_options & option); - break; - case LBER_SOCKBUF_OPT_DESC: - *((LBER_SOCKET *) value) = sb->sb_sd; - break; - case LBER_SOCKBUF_OPT_COPYDESC: - *((LBER_SOCKET *) value) = sb->sb_copyfd; - break; - case LBER_SOCKBUF_OPT_READ_FN: - *((LDAP_IOF_READ_CALLBACK **) value) - = sb->sb_io_fns.lbiof_read; - break; - case LBER_SOCKBUF_OPT_WRITE_FN: - *((LDAP_IOF_WRITE_CALLBACK **) value) - = sb->sb_io_fns.lbiof_write; - break; - case LBER_SOCKBUF_OPT_EXT_IO_FNS: - extiofns = (struct lber_x_ext_io_fns *) value; - if ( extiofns == NULL ) { - return( -1 ); - } else if ( extiofns->lbextiofn_size - == LBER_X_EXTIO_FNS_SIZE ) { - /* struct copy */ - *extiofns = sb->sb_ext_io_fns; - } else if ( extiofns->lbextiofn_size - == LBER_X_EXTIO_FNS_SIZE_REV0 ) { - /* backwards compatiblity for older struct */ - extiofns->lbextiofn_read = sb->sb_ext_io_fns.lbextiofn_read; - extiofns->lbextiofn_write = sb->sb_ext_io_fns.lbextiofn_write; - extiofns->lbextiofn_socket_arg = sb->sb_ext_io_fns.lbextiofn_socket_arg; - } else { - return( -1 ); - } - break; - default: - return( -1 ); - } - - return( 0 ); -} - - -/* new dboreham code below: */ - -struct byte_buffer { - unsigned char *p; - int offset; - int length; -}; -typedef struct byte_buffer byte_buffer; - - -/* This call allocates us a BerElement structure plus some extra memory. - * It returns a pointer to the BerElement, plus a pointer to the extra memory. - * This routine also allocates a ber data buffer within the same block, thus - * saving a call to calloc later when we read data. - */ -void* -LDAP_CALL -ber_special_alloc(size_t size, BerElement **ppBer) -{ - char *mem = NULL; - - /* Make sure mem size requested is aligned */ - if (0 != ( size & 0x03 )) { - size += (sizeof(long) - (size & 0x03)); - } - - mem = NSLBERI_MALLOC(sizeof(struct berelement) + EXBUFSIZ + size ); - if (NULL == mem) { - return NULL; - } - *ppBer = (BerElement*) (mem + size); - memset(*ppBer,0,sizeof(struct berelement)); - (*ppBer)->ber_tag = LBER_DEFAULT; - (*ppBer)->ber_buf = mem + size + sizeof(struct berelement); - (*ppBer)->ber_ptr = (*ppBer)->ber_buf; - (*ppBer)->ber_end = (*ppBer)->ber_buf + EXBUFSIZ; - (*ppBer)->ber_flags = LBER_FLAG_NO_FREE_BUFFER; - return (void*)mem; -} - -void -LDAP_CALL -ber_special_free(void* buf, BerElement *ber) -{ - if (!(ber->ber_flags & LBER_FLAG_NO_FREE_BUFFER)) { - NSLBERI_FREE(ber->ber_buf); - } - NSLBERI_FREE( buf ); -} - -static int -read_bytes(byte_buffer *b, unsigned char *return_buffer, int bytes_to_read) -{ - /* copy up to bytes_to_read bytes into the caller's buffer, return the number of bytes copied */ - int bytes_to_copy = 0; - - if (bytes_to_read <= (b->length - b->offset) ) { - bytes_to_copy = bytes_to_read; - } else { - bytes_to_copy = (b->length - b->offset); - } - if (1 == bytes_to_copy) { - *return_buffer = *(b->p+b->offset++); - } else - if (0 == bytes_to_copy) { - ; - } else - { - memcpy(return_buffer,b->p+b->offset,bytes_to_copy); - b->offset += bytes_to_copy; - } - return bytes_to_copy; -} - -/* return the tag - LBER_DEFAULT returned means trouble */ -static unsigned long -get_buffer_tag(byte_buffer *sb ) -{ - unsigned char xbyte; - unsigned long tag; - char *tagp; - int i; - - if ( (i = read_bytes( sb, &xbyte, 1 )) != 1 ) { - return( LBER_DEFAULT ); - } - - if ( (xbyte & LBER_BIG_TAG_MASK) != LBER_BIG_TAG_MASK ) { - return( (unsigned long) xbyte ); - } - - tagp = (char *) &tag; - tagp[0] = xbyte; - for ( i = 1; i < sizeof(long); i++ ) { - if ( read_bytes( sb, &xbyte, 1 ) != 1 ) - return( LBER_DEFAULT ); - - tagp[i] = xbyte; - - if ( ! (xbyte & LBER_MORE_TAG_MASK) ) - break; - } - - /* tag too big! */ - if ( i == sizeof(long) ) - return( LBER_DEFAULT ); - - /* want leading, not trailing 0's */ - return( tag >> (sizeof(long) - i - 1) ); -} - -/* Like ber_get_next, but from a byte buffer the caller already has. */ -/* Bytes_Scanned returns the number of bytes we actually looked at in the buffer. */ -/* ber_get_next_buffer is now implemented in terms of ber_get_next_buffer_ext */ -/* and is here for backward compatibility. This new function allows us to pass */ -/* the Sockbuf structure along */ - -unsigned long -LDAP_CALL -ber_get_next_buffer( void *buffer, size_t buffer_size, unsigned long *len, - BerElement *ber, unsigned long *Bytes_Scanned ) -{ - return (ber_get_next_buffer_ext( buffer, buffer_size, len, ber, - Bytes_Scanned, NULL)); -} - -unsigned long -LDAP_CALL -ber_get_next_buffer_ext( void *buffer, size_t buffer_size, unsigned long *len, - BerElement *ber, unsigned long *Bytes_Scanned, Sockbuf *sock ) -{ - unsigned long tag = 0, netlen, toread; - unsigned char lc; - long rc; - int noctets, diff; - byte_buffer sb = {0}; - - - /* - * Any ber element looks like this: tag length contents. - * Assuming everything's ok, we return the tag byte (we - * can assume a single byte), return the length in len, - * and the rest of the undecoded element in buf. - * - * Assumptions: - * 1) small tags (less than 128) - * 2) definite lengths - * 3) primitive encodings used whenever possible - */ - - /* - * first time through - malloc the buffer, set up ptrs, and - * read the tag and the length and as much of the rest as we can - */ - - sb.p = buffer; - sb.length = buffer_size; - - if ( ber->ber_rwptr == NULL ) { - /* - * First, we read the tag. - */ - - /* if we have been called before with a fragment not - * containing a comlete length, we have no rwptr but - * a tag already - */ - if ( ber->ber_tag == LBER_DEFAULT ) { - if ( (tag = get_buffer_tag( &sb )) == LBER_DEFAULT ) { - goto premature_exit; - } - ber->ber_tag = tag; - } - - if((sock->sb_options & LBER_SOCKBUF_OPT_VALID_TAG) && - (tag != sock->sb_valid_tag)) { - *Bytes_Scanned=0; - return( LBER_DEFAULT); - } - - /* - * Next, read the length. The first byte contains the length - * of the length. If bit 8 is set, the length is the long - * form, otherwise it's the short form. We don't allow a - * length that's greater than what we can hold in an unsigned - * long. - */ - - /* if the length is in long form and we don't get it in one - * fragment, we should handle this (TBD). - */ - - *len = netlen = 0; - if ( read_bytes( &sb, &lc, 1 ) != 1 ) { - goto premature_exit; - } - if ( lc & 0x80 ) { - noctets = (lc & 0x7f); - if ( noctets > sizeof(unsigned long) ) - goto premature_exit; - diff = sizeof(unsigned long) - noctets; - if ( read_bytes( &sb, (unsigned char *)&netlen + diff, - noctets ) != noctets ) { - goto premature_exit; - } - *len = LBER_NTOHL( netlen ); - } else { - *len = lc; - } - ber->ber_len = *len; - - /* - * Finally, malloc a buffer for the contents and read it in. - * It's this buffer that's passed to all the other ber decoding - * routines. - */ - -#if defined( DOS ) && !defined( _WIN32 ) - if ( *len > 65535 ) { /* DOS can't allocate > 64K */ - goto premature_exit; - } -#endif /* DOS && !_WIN32 */ - - if ( (sock != NULL) && - ( sock->sb_options & LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE ) - && (*len > sock->sb_max_incoming) ) { - return( LBER_DEFAULT ); - } - - if ( ber->ber_buf + *len > ber->ber_end ) { - if ( nslberi_ber_realloc( ber, *len ) != 0 ) - goto premature_exit; - } - ber->ber_ptr = ber->ber_buf; - ber->ber_end = ber->ber_buf + *len; - ber->ber_rwptr = ber->ber_buf; - } - - toread = (unsigned long)ber->ber_end - (unsigned long)ber->ber_rwptr; - do { - if ( (rc = read_bytes( &sb, (unsigned char *)ber->ber_rwptr, - (long)toread )) <= 0 ) { - goto premature_exit; - } - - toread -= rc; - ber->ber_rwptr += rc; - } while ( toread > 0 ); - - *len = ber->ber_len; - *Bytes_Scanned = sb.offset; - return( ber->ber_tag ); - -premature_exit: - /* - * we're here because we hit the end of the buffer before seeing - * all of the PDU - */ - *Bytes_Scanned = sb.offset; - return(LBER_DEFAULT); -} - - -/* The ber_flatten routine allocates a struct berval whose contents - * are a BER encoding taken from the ber argument. The bvPtr pointer - * points to the returned berval, which must be freed using - * ber_bvfree(). This routine returns 0 on success and -1 on error. - * The use of ber_flatten on a BerElement in which all '{' and '}' - * format modifiers have not been properly matched can result in a - * berval whose contents are not a valid BER encoding. - * Note that the ber_ptr is not modified. - */ -int -LDAP_CALL -ber_flatten( BerElement *ber, struct berval **bvPtr ) -{ - struct berval *new; - unsigned long len; - - /* allocate a struct berval */ - if ( (new = (struct berval *)NSLBERI_MALLOC( sizeof(struct berval) )) - == NULL ) { - return( -1 ); - } - - /* - * Copy everything from the BerElement's ber_buf to ber_ptr - * into the berval structure. - */ - if ( ber == NULL ) { - new->bv_val = NULL; - new->bv_len = 0; - } else { - len = ber->ber_ptr - ber->ber_buf; - if ( ( new->bv_val = (char *)NSLBERI_MALLOC( len + 1 )) == NULL ) { - ber_bvfree( new ); - return( -1 ); - } - SAFEMEMCPY( new->bv_val, ber->ber_buf, (size_t)len ); - new->bv_val[len] = '\0'; - new->bv_len = len; - } - - /* set bvPtr pointer to point to the returned berval */ - *bvPtr = new; - - return( 0 ); -} - - -/* - * The ber_init function constructs and returns a new BerElement - * containing a copy of the data in the bv argument. ber_init - * returns the null pointer on error. - */ -BerElement * -LDAP_CALL -ber_init( const struct berval *bv ) -{ - BerElement *ber; - - /* construct BerElement */ - if (( ber = ber_alloc_t( 0 )) != NULLBER ) { - /* copy data from the bv argument into BerElement */ - /* XXXmcs: had to cast unsigned long bv_len to long */ - if ( (ber_write ( ber, bv->bv_val, bv->bv_len, 0 )) - != (long)bv->bv_len ) { - ber_free( ber, 1 ); - return( NULL ); - } - } - - /* - * reset ber_ptr back to the beginning of buffer so that this new - * and initialized ber element can be READ - */ - ber_reset( ber, 1); - - /* - * return a ptr to a new BerElement containing a copy of the data - * in the bv argument or a null pointer on error - */ - return( ber ); -} - - -/* - * memory allocation functions. - */ -void * -nslberi_malloc( size_t size ) -{ - return( nslberi_memalloc_fns.lbermem_malloc == NULL ? - malloc( size ) : - nslberi_memalloc_fns.lbermem_malloc( size )); -} - - -void * -nslberi_calloc( size_t nelem, size_t elsize ) -{ - return( nslberi_memalloc_fns.lbermem_calloc == NULL ? - calloc( nelem, elsize ) : - nslberi_memalloc_fns.lbermem_calloc( nelem, elsize )); -} - - -void * -nslberi_realloc( void *ptr, size_t size ) -{ - return( nslberi_memalloc_fns.lbermem_realloc == NULL ? - realloc( ptr, size ) : - nslberi_memalloc_fns.lbermem_realloc( ptr, size )); -} - - -void -nslberi_free( void *ptr ) -{ - if ( nslberi_memalloc_fns.lbermem_free == NULL ) { - free( ptr ); - } else { - nslberi_memalloc_fns.lbermem_free( ptr ); - } -} - - -/* - ****************************************************************************** - * functions to bridge the gap between new extended I/O functions that are - * installed using ber_sockbuf_set_option( ..., LBER_SOCKBUF_OPT_EXT_IO_FNS, - * ... ). - * - * the basic strategy is to use the new extended arg to hold a pointer to the - * Sockbuf itself so we can find the old functions and call them. - * note that the integer socket s passed in is not used. we use the sb_sd - * from the Sockbuf itself because it is the correct type. - */ -static int -nslberi_extread_compat( int s, void *buf, int len, - struct lextiof_socket_private *arg ) -{ - Sockbuf *sb = (Sockbuf *)arg; - - return( sb->sb_io_fns.lbiof_read( sb->sb_sd, buf, len )); -} - - -static int -nslberi_extwrite_compat( int s, const void *buf, int len, - struct lextiof_socket_private *arg ) -{ - Sockbuf *sb = (Sockbuf *)arg; - - return( sb->sb_io_fns.lbiof_write( sb->sb_sd, buf, len )); -} - - -/* - * Install I/O compatiblity functions. This can't fail. - */ -static void -nslberi_install_compat_io_fns( Sockbuf *sb ) -{ - sb->sb_ext_io_fns.lbextiofn_size = LBER_X_EXTIO_FNS_SIZE; - sb->sb_ext_io_fns.lbextiofn_read = nslberi_extread_compat; - sb->sb_ext_io_fns.lbextiofn_write = nslberi_extwrite_compat; - sb->sb_ext_io_fns.lbextiofn_writev = NULL; - sb->sb_ext_io_fns.lbextiofn_socket_arg = (void *)sb; -} -/* - * end of compat I/O functions - ****************************************************************************** - */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/liblber/lber-int.h b/mozilla/directory/c-sdk/ldap/libraries/liblber/lber-int.h deleted file mode 100644 index a2b3278b8e8..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/liblber/lber-int.h +++ /dev/null @@ -1,306 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ -/* lbet-int.h - internal header file for liblber */ - -#ifndef _LBERINT_H -#define _LBERINT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -#ifdef macintosh -# include "ldap-macos.h" -#else /* macintosh */ -#if !defined(BSDI) -# include -#endif -# include -# include -#if defined(SUNOS4) || defined(SCOOS) -# include -#endif -#if defined( _WINDOWS ) -# define WIN32_LEAN_AND_MEAN -# include -# include -/* No stderr in a 16-bit Windows DLL */ -# if defined(_WINDLL) && !defined(_WIN32) -# define USE_DBG_WIN -# endif -# else -#if !defined(XP_OS2) -/* # include */ -# include -# include -# include -#endif -# endif /* defined( _WINDOWS ) */ -#endif /* macintosh */ - -#include -#include -#include "portable.h" - -#ifdef _WINDOWS -#include -#include -#endif /* _WINDOWS */ - -#ifdef XP_OS2 -#include -#include -#endif /* XP_OS2 */ - -/* No stderr in a 16-bit Windows DLL */ -#if defined(_WINDLL) && !defined(_WIN32) -#define stderr NULL -#endif - -#include "lber.h" - -#ifdef macintosh -#define NSLDAPI_LBER_SOCKET_IS_PTR -#endif - -#define OLD_LBER_SEQUENCE 0x10L /* w/o constructed bit - broken */ -#define OLD_LBER_SET 0x11L /* w/o constructed bit - broken */ - -#ifndef _IFP -#define _IFP -typedef int (LDAP_C LDAP_CALLBACK *IFP)(); -#endif - -typedef struct seqorset { - unsigned long sos_clen; - unsigned long sos_tag; - char *sos_first; - char *sos_ptr; - struct seqorset *sos_next; -} Seqorset; -#define NULLSEQORSET ((Seqorset *) 0) - -#define SOS_STACK_SIZE 8 /* depth of the pre-allocated sos structure stack */ - - -#define MAX_TAG_SIZE (1 + sizeof(long)) /* One byte for the length of the tag */ -#define MAX_LEN_SIZE (1 + sizeof(long)) /* One byte for the length of the length */ -#define MAX_VALUE_PREFIX_SIZE 4 -#define BER_ARRAY_QUANTITY 5 /* 0:Tag 1:Length 2:Value-prefix 3:Value 4:Value-suffix */ -#define BER_STRUCT_TAG 0 -#define BER_STRUCT_LEN 1 -#define BER_STRUCT_PRE 2 -#define BER_STRUCT_VAL 3 -#define BER_STRUCT_SUF 4 - -struct berelement { - ldap_x_iovec ber_struct[BER_ARRAY_QUANTITY]; /* See above */ - - char ber_tag_contents[MAX_TAG_SIZE]; - char ber_len_contents[MAX_LEN_SIZE]; - char ber_pre_contents[MAX_VALUE_PREFIX_SIZE]; - - char *ber_buf; /* update the value value when writing in case realloc is called */ - char *ber_ptr; - char *ber_end; - struct seqorset *ber_sos; - unsigned long ber_tag; /* Remove me someday */ - unsigned long ber_len; /* Remove me someday */ - int ber_usertag; - char ber_options; - char *ber_rwptr; - BERTranslateProc ber_encode_translate_proc; - BERTranslateProc ber_decode_translate_proc; - int ber_flags; -#define LBER_FLAG_NO_FREE_BUFFER 1 /* don't free ber_buf */ - int ber_sos_stack_posn; - Seqorset ber_sos_stack[SOS_STACK_SIZE]; -}; - -#define BER_CONTENTS_STRUCT_SIZE (sizeof(ldap_x_iovec) * BER_ARRAY_QUANTITY) - - - -#define NULLBER ((BerElement *)NULL) - -#ifdef LDAP_DEBUG -void ber_dump( BerElement *ber, int inout ); -#endif - - - -/* - * structure for read/write I/O callback functions. - */ -struct nslberi_io_fns { - LDAP_IOF_READ_CALLBACK *lbiof_read; - LDAP_IOF_WRITE_CALLBACK *lbiof_write; -}; - - -/* - * Old structure for use with LBER_SOCKBUF_OPT_EXT_IO_FNS: - */ -struct lber_x_ext_io_fns_rev0 { - /* lbextiofn_size should always be set to LBER_X_EXTIO_FNS_SIZE */ - int lbextiofn_size; - LDAP_X_EXTIOF_READ_CALLBACK *lbextiofn_read; - LDAP_X_EXTIOF_WRITE_CALLBACK *lbextiofn_write; - struct lextiof_socket_private *lbextiofn_socket_arg; -}; -#define LBER_X_EXTIO_FNS_SIZE_REV0 sizeof(struct lber_x_ext_io_fns_rev0) - - - -struct sockbuf { - LBER_SOCKET sb_sd; - BerElement sb_ber; - int sb_naddr; /* > 0 implies using CLDAP (UDP) */ - void *sb_useaddr; /* pointer to sockaddr to use next */ - void *sb_fromaddr; /* pointer to message source sockaddr */ - void **sb_addrs; /* actually an array of pointers to - sockaddrs */ - - int sb_options; /* to support copying ber elements */ - LBER_SOCKET sb_copyfd; /* for LBER_SOCKBUF_OPT_TO_FILE* opts */ - unsigned long sb_max_incoming; - unsigned long sb_valid_tag; /* valid tag to accept */ - struct nslberi_io_fns - sb_io_fns; /* classic I/O callback functions */ - - struct lber_x_ext_io_fns - sb_ext_io_fns; /* extended I/O callback functions */ -}; -#define NULLSOCKBUF ((Sockbuf *)NULL) - - -#ifndef NSLBERI_LBER_INT_FRIEND -/* - * Everything from this point on is excluded if NSLBERI_LBER_INT_FRIEND is - * defined. The code under ../libraries/libldap defines this. - */ - -#define READBUFSIZ 8192 - -/* - * macros used to check validity of data structures and parameters - */ -#define NSLBERI_VALID_BERELEMENT_POINTER( ber ) \ - ( (ber) != NULLBER ) - -#define NSLBERI_VALID_SOCKBUF_POINTER( sb ) \ - ( (sb) != NULLSOCKBUF ) - - -#if defined(_WIN32) && defined(_ALPHA) -#define LBER_HTONL( _l ) \ - ((((_l)&0xff)<<24) + (((_l)&0xff00)<<8) + \ - (((_l)&0xff0000)>>8) + (((_l)&0xff000000)>>24)) -#define LBER_NTOHL(_l) LBER_HTONL(_l) - -#elif !defined(__alpha) || defined(VMS) - -#define LBER_HTONL( l ) htonl( l ) -#define LBER_NTOHL( l ) ntohl( l ) - -#else /* __alpha */ -/* - * htonl and ntohl on the DEC Alpha under OSF 1 seem to only swap the - * lower-order 32-bits of a (64-bit) long, so we define correct versions - * here. - */ -#define LBER_HTONL( l ) (((long)htonl( (l) & 0x00000000FFFFFFFF )) << 32 \ - | htonl( ( (l) & 0xFFFFFFFF00000000 ) >> 32 )) - -#define LBER_NTOHL( l ) (((long)ntohl( (l) & 0x00000000FFFFFFFF )) << 32 \ - | ntohl( ( (l) & 0xFFFFFFFF00000000 ) >> 32 )) -#endif /* __alpha */ - - -/* function prototypes */ -#ifdef LDAP_DEBUG -void lber_bprint( char *data, int len ); -#endif -void ber_err_print( char *data ); -void *nslberi_malloc( size_t size ); -void *nslberi_calloc( size_t nelem, size_t elsize ); -void *nslberi_realloc( void *ptr, size_t size ); -void nslberi_free( void *ptr ); -int nslberi_ber_realloc( BerElement *ber, unsigned long len ); - - - -/* blame: dboreham - * slapd spends much of its time doing memcpy's for the ber code. - * Most of these are single-byte, so we special-case those and speed - * things up considerably. - */ - -#ifdef sunos4 -#define THEMEMCPY( d, s, n ) bcopy( s, d, n ) -#else /* sunos4 */ -#define THEMEMCPY( d, s, n ) memmove( d, s, n ) -#endif /* sunos4 */ - -#ifdef SAFEMEMCPY -#undef SAFEMEMCPY -#define SAFEMEMCPY(d,s,n) if (1 == n) *((char*)d) = *((char*)s); else THEMEMCPY(d,s,n); -#endif - -/* - * Memory allocation done in liblber should all go through one of the - * following macros. This is so we can plug-in alternative memory - * allocators, etc. as the need arises. - */ -#define NSLBERI_MALLOC( size ) nslberi_malloc( size ) -#define NSLBERI_CALLOC( nelem, elsize ) nslberi_calloc( nelem, elsize ) -#define NSLBERI_REALLOC( ptr, size ) nslberi_realloc( ptr, size ) -#define NSLBERI_FREE( ptr ) nslberi_free( ptr ) - -/* allow the library to access the debug variable */ - -extern int lber_debug; - -#endif /* !NSLBERI_LBER_INT_FRIEND */ - - -#ifdef __cplusplus -} -#endif -#endif /* _LBERINT_H */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap.ex b/mozilla/directory/c-sdk/ldap/libraries/libldap.ex deleted file mode 100644 index b1edd30bf6a..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap.ex +++ /dev/null @@ -1,271 +0,0 @@ -10 ldap_abandon -11 ldap_add -13 ldap_unbind - -#14 ldap_enable_cache -#15 ldap_disable_cache -#16 ldap_destroy_cache -#17 ldap_flush_cache -#18 ldap_uncache_entry - -19 ldap_compare -20 ldap_delete -21 ldap_result2error -22 ldap_err2string -23 ldap_modify -24 ldap_modrdn -25 ldap_open -26 ldap_first_entry -27 ldap_next_entry -30 ldap_get_dn -31 ldap_dn2ufn -32 ldap_first_attribute -33 ldap_next_attribute -34 ldap_get_values -35 ldap_get_values_len -36 ldap_count_entries -37 ldap_count_values -38 ldap_value_free -39 ldap_explode_dn -40 ldap_result -41 ldap_msgfree -43 ldap_search -44 ldap_add_s -45 ldap_bind_s -46 ldap_unbind_s -47 ldap_delete_s -48 ldap_modify_s -49 ldap_modrdn_s -50 ldap_search_s -51 ldap_search_st -52 ldap_compare_s -53 ldap_ufn_search_c -54 ldap_ufn_search_s -55 ldap_init_getfilter -56 ldap_getfilter_free -57 ldap_getfirstfilter -58 ldap_getnextfilter -59 ldap_simple_bind -60 ldap_simple_bind_s -61 ldap_bind -62 ldap_friendly_name -63 ldap_free_friendlymap -64 ldap_ufn_search_ct - -#65 ldap_set_cache_options -#66 ldap_uncache_request - -67 ldap_modrdn2 -68 ldap_modrdn2_s -69 ldap_ufn_setfilter -70 ldap_ufn_setprefix -71 ldap_ufn_timeout C -72 ldap_init_getfilter_buf -73 ldap_setfilteraffixes -74 ldap_sort_entries -75 ldap_sort_values -76 ldap_sort_strcasecmp C -77 ldap_count_values_len -78 ldap_name2template -79 ldap_value_free_len - -# manually comment and uncomment these five as necessary -#80 ldap_kerberos_bind1 -#81 ldap_kerberos_bind2 -#82 ldap_kerberos_bind_s -#83 ldap_kerberos_bind1_s -#84 ldap_kerberos_bind2_s - -85 ldap_init -86 ldap_is_dns_dn -87 ldap_explode_dns -88 ldap_mods_free - -89 ldap_is_ldap_url -90 ldap_free_urldesc -91 ldap_url_parse -92 ldap_url_search -93 ldap_url_search_s -94 ldap_url_search_st -95 ldap_set_rebind_proc -100 ber_skip_tag -101 ber_peek_tag -102 ber_get_int -103 ber_get_stringb -104 ber_get_stringa -105 ber_get_stringal -106 ber_get_bitstringa -107 ber_get_null -108 ber_get_boolean -109 ber_first_element -110 ber_next_element -111 ber_scanf C -112 ber_bvfree -113 ber_bvecfree -114 ber_put_int -115 ber_put_ostring -116 ber_put_string -117 ber_put_bitstring -118 ber_put_null -119 ber_put_boolean -120 ber_start_seq -121 ber_start_set -122 ber_put_seq -123 ber_put_set -124 ber_printf C -125 ber_read -126 ber_write -127 ber_free -128 ber_flush -129 ber_alloc -130 ber_dup -131 ber_get_next -132 ber_get_tag -133 ber_put_enum -134 der_alloc -135 ber_alloc_t -136 ber_bvdup -137 ber_init_w_nullchar -138 ber_reset -139 ber_get_option -140 ber_set_option -141 ber_sockbuf_alloc -142 ber_sockbuf_get_option -143 ber_sockbuf_set_option -144 ber_init -145 ber_flatten -146 ber_special_alloc -147 ber_special_free -148 ber_get_next_buffer -149 ber_err_print C -150 ber_sockbuf_free -151 ber_get_next_buffer_ext -152 ber_svecfree - -200 ldap_memfree -201 ldap_ber_free - -300 ldap_init_searchprefs -301 ldap_init_searchprefs_buf -302 ldap_free_searchprefs -303 ldap_first_searchobj -304 ldap_next_searchobj -305 ldap_build_filter - -400 ldap_init_templates -401 ldap_init_templates_buf -402 ldap_free_templates -403 ldap_first_disptmpl -404 ldap_next_disptmpl -405 ldap_oc2template -406 ldap_tmplattrs -407 ldap_first_tmplrow -408 ldap_next_tmplrow -409 ldap_first_tmplcol -410 ldap_next_tmplcol -411 ldap_entry2text_search -412 ldap_entry2text -413 ldap_vals2text -414 ldap_entry2html -415 ldap_entry2html_search -416 ldap_vals2html -417 ldap_tmplerr2string -418 ldap_set_option -419 ldap_get_option -420 ldap_charray_merge -430 ldap_get_lderrno -431 ldap_set_lderrno -432 ldap_perror -433 ldap_set_filter_additions -434 ldap_create_filter -440 ldap_version -441 ldap_multisort_entries -442 ldap_msgid -443 ldap_explode_rdn -444 ldap_msgtype -445 ldap_cache_flush -446 ldap_str2charray -447 ldap_charray_add -448 ldap_charray_dup -449 ldap_charray_free - -# Windows ordinals 450-469 are reserved for SSL routines - -470 ldap_charray_inlist -471 ldap_charray_position -472 ldap_rename -473 ldap_rename_s -474 ldap_utf8len -475 ldap_utf8next -476 ldap_utf8prev -477 ldap_utf8copy -478 ldap_utf8characters -479 ldap_utf8strtok_r -480 ldap_utf8isalnum -481 ldap_utf8isalpha -482 ldap_utf8isdigit -483 ldap_utf8isxdigit -484 ldap_utf8isspace -485 ldap_control_free -486 ldap_controls_free -487 ldap_sasl_bind -488 ldap_sasl_bind_s -489 ldap_parse_sasl_bind_result -# LDAPv3 simple paging controls are not supported by Netscape at this time. -# 490 ldap_create_page_control -# 491 ldap_parse_page_control -492 ldap_create_sort_control -493 ldap_parse_sort_control -# an LDAPv3 language control was proposed but then retracted. -# 494 ldap_create_language_control -495 ldap_get_lang_values -496 ldap_get_lang_values_len -497 ldap_free_sort_keylist -498 ldap_create_sort_keylist -499 ldap_utf8getcc -500 ldap_get_entry_controls -501 ldap_create_persistentsearch_control -502 ldap_parse_entrychange_control -503 ldap_parse_result -504 ldap_parse_extended_result -505 ldap_parse_reference -506 ldap_abandon_ext -507 ldap_add_ext -508 ldap_add_ext_s -509 ldap_modify_ext -510 ldap_modify_ext_s -511 ldap_first_message -512 ldap_next_message -513 ldap_compare_ext -514 ldap_compare_ext_s -515 ldap_delete_ext -516 ldap_delete_ext_s -517 ldap_search_ext -518 ldap_search_ext_s -519 ldap_extended_operation -520 ldap_extended_operation_s -521 ldap_first_reference -522 ldap_next_reference -523 ldap_count_references -524 ldap_count_messages -525 ldap_create_virtuallist_control -526 ldap_parse_virtuallist_control -527 ldap_create_proxyauth_control -528 ldap_unbind_ext -529 ldap_x_hostlist_first -530 ldap_x_hostlist_next -531 ldap_x_hostlist_statusfree -532 ldap_x_malloc -533 ldap_x_calloc -534 ldap_x_realloc -535 ldap_x_free -536 ldap_create_proxiedauth_control -1000 ldap_memcache_init -1001 ldap_memcache_set -1002 ldap_memcache_get -1003 ldap_memcache_flush -1004 ldap_memcache_destroy -1005 ldap_memcache_update -1006 ldap_keysort_entries -0 ldap_debug G full -0 lber_debug G full diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.client b/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.client deleted file mode 100644 index f2e0f4c86cf..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.client +++ /dev/null @@ -1,266 +0,0 @@ -# -# 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 = ../../../../.. -NS_DEPTH = ../../../.. -LDAP_SRC = ../.. -NSCP_DISTDIR = ../../../../../dist -NSPR_TREE = ../../.. -MOD_DEPTH = ../../.. - -include $(NSPR_TREE)/config/rules.mk -include ../../../build.mk - -SRCS = abandon.c \ - add.c \ - bind.c \ - cache.c \ - charray.c \ - charset.c \ - compare.c \ - compat.c \ - control.c \ - countvalues.c \ - delete.c \ - disptmpl.c \ - dsparse.c \ - error.c \ - extendop.c \ - free.c \ - freevalues.c \ - friendly.c \ - getattr.c \ - getdn.c \ - getdxbyname.c \ - getentry.c \ - getfilter.c \ - getoption.c \ - getvalues.c \ - memcache.c \ - message.c \ - modify.c \ - open.c \ - os-ip.c \ - proxyauthctrl.c \ - psearch.c \ - referral.c \ - regex.c \ - rename.c \ - request.c \ - reslist.c \ - result.c \ - saslbind.c \ - sbind.c \ - search.c \ - setoption.c \ - sort.c \ - sortctrl.c \ - srchpref.c \ - tmplout.c \ - ufn.c \ - unbind.c \ - unescape.c \ - url.c \ - utf8.c \ - vlistctrl.c - -ifeq ($(OS_ARCH), WINNT) -SRCS +=dllmain.c -SRCS +=mozock.c -endif - -ifeq ($(OS_ARCH), WINNT) -REALOBJS = $(SRCS:.c=.obj) -else -REALOBJS = $(SRCS:.c=.o) -endif - -LDAPOBJDEST = $(OBJDIR_NAME) -OBJS = $(addprefix $(LDAPOBJDEST)/, $(REALOBJS)) - -DISTHDIR = $(NSCP_DISTDIR)/public/ldap -HDIR = $(LDAP_SRC)/include - -ifeq ($(OS_ARCH), WINNT) -LIBLDAP = $(addprefix $(LDAPOBJDEST)/, $(LDAP_LIBNAME).$(DLL_SUFFIX)) -DLLLDAP = $(addprefix $(LDAPOBJDEST)/, $(LDAP_LIBNAME).$(LIB_SUFFIX)) -else -LIBLDAP = $(addprefix $(LDAPOBJDEST)/, lib$(LDAP_LIBNAME).$(DLL_SUFFIX)) -DLLLDAP = $(addprefix $(LDAPOBJDEST)/, lib$(LDAP_LIBNAME).$(LIB_SUFFIX)) -endif -INSTALLDIR = $(DEPTH)/dist/$(OBJDIR_NAME) - -LOCAL_INCLUDES = -I$(PUBLIC)/nspr -INCLUDES += -I$(DISTHDIR) -I$(HDIR) -I$(INSTALLDIR)/include \ - -I../../../../../dist/include -DEFINES += $(DEFS) - -PLATFORMCFLAGS = -DUSE_WAITPID -DNEEDPROTOS -#PLATFORMLIBS = -THREADS = -THREADSLIB = - -ETCFILES = ldapfilter.conf \ - ldapfriendly \ - ldapsearchprefs.conf \ - ldaptemplates.conf \ - $(NULL) - -ETCDIR = $(INSTALLDIR)/etc - -# -# if you want things to run in a different directory from where they -# are installed, set this accordingly (this path gets compiled into a -# few binaries). otherwise, leave it alone. -# -RUNTIMEETCDIR = $(ETCDIR) - -# -# shared library symbol export definitions -# -ifeq ($(USE_DLL_EXPORTS_FILE), 1) -ifeq ($(OS_ARCH), WINNT) -GENEXPORTS=cmd /c $(PERL) $(LDAP_SRC)/build/genexports.pl -else -GENEXPORTS=$(PERL) $(LDAP_SRC)/build/genexports.pl -endif - -# variable definitions for exported symbols -ifeq ($(OS_ARCH), WINNT) - LDAP_EXPORT_DEFS=../msdos/winsock/nsldap32.def -else - LDAP_EXPORT_DEFS= $(LDAPOBJDEST)/libldap.exp -endif - -LDAP_EXPORT_FLAGS=$(addprefix $(DLLEXPORTS_PREFIX), $(LDAP_EXPORT_DEFS)) - -GENEXPARGS=$(BUILD_DEBUG) $(LDAPVERS_SUFFIX) $(LDAPVERS) -endif # USE_DLL_EXPORTS_FILE - -ifeq ($(OS_ARCH), SunOS) -EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LBER_LIBNAME) -EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib -endif - -ifeq ($(OS_ARCH), Linux) -EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LBER_LIBNAME) -EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib -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/$(LDIF_LIBNAME).lib -EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(LBER_LIBNAME).lib -endif - -ifeq ($(OS_ARCH), OSF1) -EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LBER_LIBNAME) -EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib -EXTRA_LIBS += -L/usr/lib -lcxx -lpthread -lrt -lmach -lexc -endif - -ifeq ($(OS_ARCH), AIX) -EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LBER_LIBNAME) -EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib -EXTRA_LIBS += -ldl -brtl -lpthreads -lc_r -lm -endif - -ifeq ($(OS_ARCH), HP-UX) -EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LBER_LIBNAME) -EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib -EXTRA_LIBS += -ldld -lm -lpthread -endif - -OBJDEST = $(OBJDIR_NAME) - -########################################################################### - -ifeq ($(USE_DLL_EXPORTS_FILE), 1) -# recursive gmake rule to create exported symbols file -$(LDAP_EXPORT_DEFS):: ../libldap.ex -ifeq ($(OS_ARCH), WINNT) - $(GENEXPORTS) Win32 Standard $< $(GENEXPARGS) > $@ -else - $(GENEXPORTS) $(OS_ARCH) Standard $< $(GENEXPARGS) > $@ -endif -endif # USE_DLL_EXPORTS_FILE - -versiont.c: Makefile.client Version.c - @$(RM) $@ - @(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \ - h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \ - -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ - -e "s|%VERSION%|$${v}|" \ - < Version.c > $@) - -all:: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLDAP) $(DLLLDAP) - -ltest:: $(LIBLDAP) test.o - $(LINK_EXE) test.o - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBLDAP): $(OBJS) $(LIBDIR) $(LDAP_EXPORT_DEFS) - @echo ======= making $(LIBLDAP) -ifdef SO_FILES_TO_REMOVE - -$(RM) $(SO_FILES_TO_REMOVE) -endif - $(LINK_DLL) $(DSO_LDOPTS) $(LDAP_EXPORT_FLAGS) $(EXTRA_LIBS) - -$(DLLLDAP): $(OBJS) $(LIBDIR) $(LDAP_EXPORT_DEFS) - @echo ======= making $(DLLLDAP) -ifdef SO_FILES_TO_REMOVE - -$(RM) $(SO_FILES_TO_REMOVE) -endif -ifeq ($(OS_ARCH), AIX) - $(LINK_LIB) ../liblber/$(OBJDIR_NAME)/*.a -else -ifeq ($(OS_ARCH), Linux) - $(LINK_LIB) ../liblber/$(OBJDIR_NAME)/*.a -else - $(LINK_LIB) $(EXTRA_LIBS) -endif -endif - -veryclean:: clean - -clean:: - $(RM) $(OBJS) $(LIBLDAP) - $(RM) -r $(LDAPOBJDEST) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - -install:: $(LIBLDAP) $(DLLLDAP) -ifdef MKSHLIB - $(INSTALL) -m 555 $(LIBLDAP) $(INSTALLDIR)/lib - $(INSTALL) -m 555 $(DLLLDAP) $(INSTALLDIR)/lib -endif -ifeq ($(OS_ARCH), WINNT) - $(INSTALL) -m 555 $(LIBLDAP) $(INSTALLDIR)/lib - $(INSTALL) -m 555 $(DLLLDAP) $(INSTALLDIR)/lib -endif - $(INSTALL) -m 555 $(ETCFILES) $(ETCDIR) - diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in b/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in deleted file mode 100644 index 54e631ff770..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in +++ /dev/null @@ -1,160 +0,0 @@ -DEPTH = ../../../../.. -NS_DEPTH = ../../../.. -srcdir = @srcdir@ -ldaptopsrcdir = @top_srcdir@ - -RM = rm -f -SED = sed - -SRCS = abandon.c \ - add.c \ - bind.c \ - cache.c \ - charray.c \ - charset.c \ - compare.c \ - compat.c \ - control.c \ - countvalues.c \ - delete.c \ - disptmpl.c \ - dsparse.c \ - error.c \ - extendop.c \ - free.c \ - freevalues.c \ - friendly.c \ - getattr.c \ - getdn.c \ - getdxbyname.c \ - getentry.c \ - getfilter.c \ - getoption.c \ - getvalues.c \ - memcache.c \ - message.c \ - modify.c \ - open.c \ - os-ip.c \ - proxyauthctrl.c \ - psearch.c \ - referral.c \ - regex.c \ - rename.c \ - request.c \ - reslist.c \ - result.c \ - saslbind.c \ - sbind.c \ - search.c \ - setoption.c \ - sort.c \ - sortctrl.c \ - srchpref.c \ - tmplout.c \ - ufn.c \ - unbind.c \ - unescape.c \ - url.c \ - utf8.c \ - vlistctrl.c - -REALOBJS = $(SRCS:.c=.o) - -#OBJS = $(REALOBJS) versiont.o -OBJS = $(REALOBJS) - -HDIR = $(ldaptopsrcdir)/include -HDIR2 = ../../include - -CFLAGS = $(INCLUDES) $(DEFINES) - -LIBRARY_NAME = ldap41 - -# -# DEFS are included in CFLAGS -# -DEFS = $(PLATFORMCFLAGS) $(LDAP_DEBUG) $(KERBEROS) $(AFSKERBEROS) \ - $(UOFM) $(UOFA) $(NO_USERINTERFACE) $(CLDAP) $(NO_CACHE) \ - $(LDAP_REFERRALS) $(LDAP_DNS) $(STR_TRANSLATION) \ - $(LIBLDAP_CHARSETS) $(LIBLDAP_DEF_CHARSET) \ - $(SLAPD_BACKENDS) $(LDBMBACKEND) $(LDBMINCLUDE) $(PHONETIC) - -include ../../build/autoconf.mk -include $(NSPR_TREE)/config/rules.mk - -LOCAL_INCLUDES = -I$(PUBLIC)/nspr -INCLUDES += -I$(HDIR) -I$(HDIR2) $(KRBINCLUDEFLAG) -DEFINES += $(DEFS) -DFILTERFILE=./ldapfilter.conf \ - -DTEMPLATEFILE=./ldaptemplates.conf \ - -DNDEBUG -UMOZILLA_CLIENT - -# So we actually get the definition of hostent_data.... -ifeq ($(OS_ARCH),AIX) -DEFINES += -D_THREAD_SAFE -endif - -GARBAGE += $(ETCDIR)/ldapfriendly $(ETCDIR)/ldapfilter.conf \ - $(ETCDIR)/ldaptemplates.conf $(ETCDIR)/ldapsearchprefs.conf - -PLATFORMCFLAGS = -DUSE_WAITPID -DNEEDPROTOS -PLATFORMLIBS = -THREADS = -THREADSLIB = - -ETCFILES = ldapfilter.conf \ - ldapfriendly \ - ldapsearchprefs.conf \ - ldaptemplates.conf \ - $(NULL) - -ETCDIR = $(DIST)/etc - -# -# if you want things to run in a different directory from where they -# are installed, set this accordingly (this path gets compiled into a -# few binaries). otherwise, leave it alone. -# -RUNTIMEETCDIR = $(ETCDIR) - -# -# To build slapd (the stand-alone ldap daemon), uncomment the MAKESLAPD -# line and select the SLAPD_BACKENDS you want to use. If you enable the -# LDBM backend, also select one of the LDBM backends. -# -MAKESLAPD = yes -SLAPD_BACKENDS = -DLDAP_LDBM -DLDAP_SHELL -DLDAP_PASSWD -LDBMBACKEND = -DLDBM_USE_NDBM - -# -# uncomment this line to enable debugging code (a good idea) -# -ifndef BUILD_OPT -LDAP_DEBUG = -DLDAP_DEBUG -endif - -# -# uncomment this line to enable support for LDAP referrals in libldap -# -LDAP_REFERRALS = -DLDAP_REFERRALS - -########################################################################### - -versiont.c: Makefile.client Version.c - @$(RM) $@ - @(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \ - h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \ - -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ - -e "s|%VERSION%|$${v}|" \ - < Version.c > $@) - -install:: $(LIBRARY) $(SHARED_LIBRARY) - $(INSTALL) -m 444 $(LIBRARY) $(DIST)/lib -ifdef MKSHLIB - $(INSTALL) -m 555 $(SHARED_LIBRARY) $(DIST)/lib - $(INSTALL) -m 555 $(SHARED_LIBRARY) $(DIST)/bin -endif - -# XXX currently we don't install any of these config files; what to do? -# -# $(INSTALL) $(INSTALLFLAGS) -m 644 $(ETCFILES) $(ETCDIR) diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/abandon.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/abandon.c deleted file mode 100644 index db5b968c6cc..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/abandon.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * abandon.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -static int do_abandon( LDAP *ld, int origid, int msgid, - LDAPControl **serverctrls, LDAPControl **clientctrls ); - -/* - * ldap_abandon - perform an ldap abandon operation. Parameters: - * - * ld LDAP descriptor - * msgid The message id of the operation to abandon - * - * ldap_abandon returns 0 if everything went ok, -1 otherwise. - * - * Example: - * ldap_abandon( ld, msgid ); - */ -int -LDAP_CALL -ldap_abandon( LDAP *ld, int msgid ) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_abandon %d\n", msgid, 0, 0 ); - LDAPDebug( LDAP_DEBUG_TRACE, "4e65747363617065\n", msgid, 0, 0 ); - LDAPDebug( LDAP_DEBUG_TRACE, "466f726576657221\n", msgid, 0, 0 ); - - if ( ldap_abandon_ext( ld, msgid, NULL, NULL ) == LDAP_SUCCESS ) { - return( 0 ); - } - - return( -1 ); -} - - -/* - * LDAPv3 extended abandon. - * Returns an LDAP error code. - */ -int -LDAP_CALL -ldap_abandon_ext( LDAP *ld, int msgid, LDAPControl **serverctrls, - LDAPControl **clientctrls ) -{ - int rc; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_abandon_ext %d\n", msgid, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK ); - LDAP_MUTEX_LOCK( ld, LDAP_REQ_LOCK ); - rc = do_abandon( ld, msgid, msgid, serverctrls, clientctrls ); - - /* - * XXXmcs should use cache function pointers to hook in memcache - */ - ldap_memcache_abandon( ld, msgid ); - - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - - return( rc ); -} - - -/* - * Abandon all outstanding requests for msgid (included child requests - * spawned when chasing referrals). This function calls itself recursively. - * No locking is done is this function so it must be done by the caller. - * Returns an LDAP error code and sets it in LDAP *ld as well - */ -static int -do_abandon( LDAP *ld, int origid, int msgid, LDAPControl **serverctrls, - LDAPControl **clientctrls ) -{ - BerElement *ber; - int i, bererr, lderr, sendabandon; - Sockbuf *sb; - LDAPRequest *lr = NULL; - - /* - * An abandon request looks like this: - * AbandonRequest ::= MessageID - */ - LDAPDebug( LDAP_DEBUG_TRACE, "do_abandon origid %d, msgid %d\n", - origid, msgid, 0 ); - - /* optimistic */ - lderr = LDAP_SUCCESS; - -/* - * this is not the best implementation... - * the code special cases the when async io is enabled. - * The logic is clear this way, at the cost of code bloat. - * This logic should be cleaned up post nova 4.5 rtm - */ - if (ld->ld_options & LDAP_BITOPT_ASYNC) - { - /* Don't send an abandon message unless there is something to abandon. */ - sendabandon = 0; - - /* Find the request that we are abandoning. */ - if (ld->ld_requests != NULL) { - for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) { - if ( lr->lr_msgid == msgid ) { /* this message */ - if ( origid == msgid && lr->lr_parent != NULL ) { - /* don't let caller abandon child requests! */ - lderr = LDAP_PARAM_ERROR; - goto set_errorcode_and_return; - } - if ( lr->lr_status == LDAP_REQST_INPROGRESS ) { - /* We only need to send an abandon message if the request - * is in progress. - */ - sendabandon = 1; - } - break; - } - if ( lr->lr_origid == msgid ) { /* child: abandon it */ - (void)do_abandon( ld, msgid, lr->lr_msgid, - serverctrls, clientctrls ); - /* we ignore errors from child abandons... */ - } - } - } - } - else - { - sendabandon = 1; - /* find the request that we are abandoning */ - for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) { - if ( lr->lr_msgid == msgid ) { /* this message */ - break; - } - if ( lr->lr_origid == msgid ) { /* child: abandon it */ - (void)do_abandon( ld, msgid, lr->lr_msgid, - serverctrls, clientctrls ); - /* we ignore errors from child abandons... */ - } - } - - if ( lr != NULL ) { - if ( origid == msgid && lr->lr_parent != NULL ) { - /* don't let caller abandon child requests! */ - lderr = LDAP_PARAM_ERROR; - goto set_errorcode_and_return; - } - if ( lr->lr_status != LDAP_REQST_INPROGRESS ) { - /* no need to send abandon message */ - sendabandon = 0; - } - } - } - if ( ldap_msgdelete( ld, msgid ) == 0 ) { - /* we had all the results and deleted them */ - goto set_errorcode_and_return; - } - - if ( sendabandon ) { - /* create a message to send */ - if (( lderr = nsldapi_alloc_ber_with_options( ld, &ber )) == - LDAP_SUCCESS ) { - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); -#ifdef CLDAP - if ( ld->ld_dbp->sb_naddr > 0 ) { - bererr = ber_printf( ber, "{isti", - ++ld->ld_msgid, ld->ld_cldapdn, - LDAP_REQ_ABANDON, msgid ); - } else { -#endif /* CLDAP */ - bererr = ber_printf( ber, "{iti", - ++ld->ld_msgid, LDAP_REQ_ABANDON, msgid ); -#ifdef CLDAP - } -#endif /* CLDAP */ - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - if ( bererr == -1 || - ( lderr = nsldapi_put_controls( ld, serverctrls, - 1, ber )) != LDAP_SUCCESS ) { - lderr = LDAP_ENCODING_ERROR; - ber_free( ber, 1 ); - } else { - /* send the message */ - if ( lr != NULL ) { - sb = lr->lr_conn->lconn_sb; - } else { - sb = ld->ld_sbp; - } - if ( nsldapi_ber_flush( ld, sb, ber, 1, 0 ) - != 0 ) { - lderr = LDAP_SERVER_DOWN; - } - } - } - } - - if ( lr != NULL ) { - if ( sendabandon ) { - nsldapi_free_connection( ld, lr->lr_conn, NULL, NULL, - 0, 1 ); - } - if ( origid == msgid ) { - nsldapi_free_request( ld, lr, 0 ); - } - } - - - LDAP_MUTEX_LOCK( ld, LDAP_ABANDON_LOCK ); - if ( ld->ld_abandoned == NULL ) { - if ( (ld->ld_abandoned = (int *)NSLDAPI_MALLOC( 2 - * sizeof(int) )) == NULL ) { - lderr = LDAP_NO_MEMORY; - LDAP_MUTEX_UNLOCK( ld, LDAP_ABANDON_LOCK ); - goto set_errorcode_and_return; - } - i = 0; - } else { - for ( i = 0; ld->ld_abandoned[i] != -1; i++ ) - ; /* NULL */ - if ( (ld->ld_abandoned = (int *)NSLDAPI_REALLOC( (char *) - ld->ld_abandoned, (i + 2) * sizeof(int) )) == NULL ) { - lderr = LDAP_NO_MEMORY; - LDAP_MUTEX_UNLOCK( ld, LDAP_ABANDON_LOCK ); - goto set_errorcode_and_return; - } - } - ld->ld_abandoned[i] = msgid; - ld->ld_abandoned[i + 1] = -1; - LDAP_MUTEX_UNLOCK( ld, LDAP_ABANDON_LOCK ); - -set_errorcode_and_return: - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - return( lderr ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/add.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/add.c deleted file mode 100644 index 31a4faa2631..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/add.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * add.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -/* - * ldap_add - initiate an ldap add operation. Parameters: - * - * ld LDAP descriptor - * dn DN of the entry to add - * mods List of attributes for the entry. This is a null- - * terminated array of pointers to LDAPMod structures. - * only the type and values in the structures need be - * filled in. - * - * Example: - * LDAPMod *attrs[] = { - * { 0, "cn", { "babs jensen", "babs", 0 } }, - * { 0, "sn", { "jensen", 0 } }, - * { 0, "objectClass", { "person", 0 } }, - * 0 - * } - * msgid = ldap_add( ld, dn, attrs ); - */ -int -LDAP_CALL -ldap_add( LDAP *ld, const char *dn, LDAPMod **attrs ) -{ - int msgid; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_add\n", 0, 0, 0 ); - - if ( ldap_add_ext( ld, dn, attrs, NULL, NULL, &msgid ) - == LDAP_SUCCESS ) { - return( msgid ); - } else { - return( -1 ); /* error is in ld handle */ - } -} - - -/* - * LDAPv3 extended add. - * Returns an LDAP error code. - */ -int -LDAP_CALL -ldap_add_ext( LDAP *ld, const char *dn, LDAPMod **attrs, - LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp ) -{ - BerElement *ber; - int i, rc, lderr; - - /* - * An add request looks like this: - * AddRequest ::= SEQUENCE { - * entry DistinguishedName, - * attrs SEQUENCE OF SEQUENCE { - * type AttributeType, - * values SET OF AttributeValue - * } - * } - */ - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_add_ext\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( !NSLDAPI_VALID_LDAPMESSAGE_POINTER( msgidp )) - { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - if ( !NSLDAPI_VALID_NONEMPTY_LDAPMOD_ARRAY( attrs ) - || msgidp == NULL ) { - lderr = LDAP_PARAM_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - return( lderr ); - } - - if ( dn == NULL ) { - dn = ""; - } - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - *msgidp = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - /* see if we should add to the cache */ - if ( ld->ld_cache_on && ld->ld_cache_add != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - if ( (rc = (ld->ld_cache_add)( ld, *msgidp, LDAP_REQ_ADD, dn, - attrs )) != 0 ) { - *msgidp = rc; - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - return( LDAP_SUCCESS ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - } - - /* create a message to send */ - if (( lderr = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( lderr ); - } - - if ( ber_printf( ber, "{it{s{", *msgidp, LDAP_REQ_ADD, dn ) - == -1 ) { - lderr = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - ber_free( ber, 1 ); - return( lderr ); - } - - /* for each attribute in the entry... */ - for ( i = 0; attrs[i] != NULL; i++ ) { - if ( ( attrs[i]->mod_op & LDAP_MOD_BVALUES) != 0 ) { - rc = ber_printf( ber, "{s[V]}", attrs[i]->mod_type, - attrs[i]->mod_bvalues ); - } else { - rc = ber_printf( ber, "{s[v]}", attrs[i]->mod_type, - attrs[i]->mod_values ); - } - if ( rc == -1 ) { - lderr = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - ber_free( ber, 1 ); - return( lderr ); - } - } - - if ( ber_printf( ber, "}}" ) == -1 ) { - lderr = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - ber_free( ber, 1 ); - return( lderr ); - } - - if (( lderr = nsldapi_put_controls( ld, serverctrls, 1, ber )) - != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( lderr ); - } - - /* send the message */ - rc = nsldapi_send_initial_request( ld, *msgidp, LDAP_REQ_ADD, - (char *) dn, ber ); - *msgidp = rc; - return( rc < 0 ? LDAP_GET_LDERRNO( ld, NULL, NULL ) : LDAP_SUCCESS ); -} - -int -LDAP_CALL -ldap_add_s( LDAP *ld, const char *dn, LDAPMod **attrs ) -{ - return( ldap_add_ext_s( ld, dn, attrs, NULL, NULL )); -} - -int LDAP_CALL -ldap_add_ext_s( LDAP *ld, const char *dn, LDAPMod **attrs, - LDAPControl **serverctrls, LDAPControl **clientctrls ) -{ - int err, msgid; - LDAPMessage *res; - - if (( err = ldap_add_ext( ld, dn, attrs, serverctrls, clientctrls, - &msgid )) != LDAP_SUCCESS ) { - return( err ); - } - - if ( ldap_result( ld, msgid, 1, (struct timeval *)NULL, &res ) == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - return( ldap_result2error( ld, res, 1 ) ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/bind.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/bind.c deleted file mode 100644 index 0432025e24b..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/bind.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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): - */ -/* - * bind.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -/* - * ldap_bind - bind to the ldap server. The dn and password - * of the entry to which to bind are supplied, along with the authentication - * method to use. The msgid of the bind request is returned on success, - * -1 if there's trouble. Note, the kerberos support assumes the user already - * has a valid tgt for now. ldap_result() should be called to find out the - * outcome of the bind request. - * - * Example: - * ldap_bind( ld, "cn=manager, o=university of michigan, c=us", "secret", - * LDAP_AUTH_SIMPLE ) - */ - -int -LDAP_CALL -ldap_bind( LDAP *ld, const char *dn, const char *passwd, int authmethod ) -{ - /* - * The bind request looks like this: - * BindRequest ::= SEQUENCE { - * version INTEGER, - * name DistinguishedName, -- who - * authentication CHOICE { - * simple [0] OCTET STRING -- passwd - * } - * } - * all wrapped up in an LDAPMessage sequence. - */ - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_bind\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); - } - - switch ( authmethod ) { - case LDAP_AUTH_SIMPLE: - return( ldap_simple_bind( ld, dn, passwd ) ); - - default: - LDAP_SET_LDERRNO( ld, LDAP_AUTH_UNKNOWN, NULL, NULL ); - return( -1 ); - } -} - -/* - * ldap_bind_s - bind to the ldap server. The dn and password - * of the entry to which to bind are supplied, along with the authentication - * method to use. This routine just calls whichever bind routine is - * appropriate and returns the result of the bind (e.g. LDAP_SUCCESS or - * some other error indication). Note, the kerberos support assumes the - * user already has a valid tgt for now. - * - * Examples: - * ldap_bind_s( ld, "cn=manager, o=university of michigan, c=us", - * "secret", LDAP_AUTH_SIMPLE ) - * ldap_bind_s( ld, "cn=manager, o=university of michigan, c=us", - * NULL, LDAP_AUTH_KRBV4 ) - */ -int -LDAP_CALL -ldap_bind_s( LDAP *ld, const char *dn, const char *passwd, int authmethod ) -{ - int err; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_bind_s\n", 0, 0, 0 ); - - switch ( authmethod ) { - case LDAP_AUTH_SIMPLE: - return( ldap_simple_bind_s( ld, dn, passwd ) ); - - default: - err = LDAP_AUTH_UNKNOWN; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } -} - - -void -LDAP_CALL -ldap_set_rebind_proc( LDAP *ld, LDAP_REBINDPROC_CALLBACK *rebindproc, - void *arg ) -{ - if ( ld == NULL ) { - if ( !nsldapi_initialized ) { - nsldapi_initialize_defaults(); - } - ld = &nsldapi_ld_defaults; - } - - if ( NSLDAPI_VALID_LDAP_POINTER( ld )) { - LDAP_MUTEX_LOCK( ld, LDAP_OPTION_LOCK ); - ld->ld_rebind_fn = rebindproc; - ld->ld_rebind_arg = arg; - LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK ); - } -} - - -/* - * return a pointer to the bind DN for the default connection (a copy is - * not made). If there is no bind DN available, NULL is returned. - */ -char * -nsldapi_get_binddn( LDAP *ld ) -{ - char *binddn; - - binddn = NULL; /* default -- assume they are not bound */ - - LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK ); - if ( NULL != ld->ld_defconn && LDAP_CONNST_CONNECTED == - ld->ld_defconn->lconn_status && ld->ld_defconn->lconn_bound ) { - if (( binddn = ld->ld_defconn->lconn_binddn ) == NULL ) { - binddn = ""; - } - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - - return( binddn ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/cache.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/cache.c deleted file mode 100644 index 8d4b8de4bdd..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/cache.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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) 1993 The Regents of the University of Michigan. - * All rights reserved. - */ -/* - * cache.c - generic caching support for LDAP - */ - -#include "ldap-int.h" - -/* - * ldap_cache_flush - flush part of the LDAP cache. returns an - * ldap error code (LDAP_SUCCESS, LDAP_NO_SUCH_OBJECT, etc.). - */ - -int -LDAP_CALL -ldap_cache_flush( LDAP *ld, const char *dn, const char *filter ) -{ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( dn == NULL ) { - dn = ""; - } - - return( (ld->ld_cache_flush)( ld, dn, filter ) ); -} - -/* - * nsldapi_add_result_to_cache - add an ldap entry we just read off the network - * to the ldap cache. this routine parses the ber for the entry and - * constructs the appropriate add request. this routine calls the - * cache add routine to actually add the entry. - */ - -void -nsldapi_add_result_to_cache( LDAP *ld, LDAPMessage *m ) -{ - char *dn; - LDAPMod **mods; - int i, max, rc; - char *a; - BerElement *ber; - char buf[50]; - struct berval bv; - struct berval *bvp[2]; - - LDAPDebug( LDAP_DEBUG_TRACE, "=> nsldapi_add_result_to_cache id %d type %d\n", - m->lm_msgid, m->lm_msgtype, 0 ); - if ( m->lm_msgtype != LDAP_RES_SEARCH_ENTRY || - ld->ld_cache_add == NULL ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "<= nsldapi_add_result_to_cache not added\n", 0, 0, 0 ); - return; - } - -#define GRABSIZE 5 - - dn = ldap_get_dn( ld, m ); - mods = (LDAPMod **)NSLDAPI_MALLOC( GRABSIZE * sizeof(LDAPMod *) ); - max = GRABSIZE; - for ( i = 0, a = ldap_first_attribute( ld, m, &ber ); a != NULL; - a = ldap_next_attribute( ld, m, ber ), i++ ) { - if ( i == (max - 1) ) { - max += GRABSIZE; - mods = (LDAPMod **)NSLDAPI_REALLOC( mods, - sizeof(LDAPMod *) * max ); - } - - mods[i] = (LDAPMod *)NSLDAPI_CALLOC( 1, sizeof(LDAPMod) ); - mods[i]->mod_op = LDAP_MOD_BVALUES; - mods[i]->mod_type = a; - mods[i]->mod_bvalues = ldap_get_values_len( ld, m, a ); - } - if ( ber != NULL ) { - ber_free( ber, 0 ); - } - if (( rc = LDAP_GET_LDERRNO( ld, NULL, NULL )) != LDAP_SUCCESS ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "<= nsldapi_add_result_to_cache error: failed to construct mod list (%s)\n", - ldap_err2string( rc ), 0, 0 ); - ldap_mods_free( mods, 1 ); - return; - } - - /* update special cachedtime attribute */ - if ( i == (max - 1) ) { - max++; - mods = (LDAPMod **)NSLDAPI_REALLOC( mods, - sizeof(LDAPMod *) * max ); - } - mods[i] = (LDAPMod *)NSLDAPI_CALLOC( 1, sizeof(LDAPMod) ); - mods[i]->mod_op = LDAP_MOD_BVALUES; - mods[i]->mod_type = "cachedtime"; - sprintf( buf, "%d", time( NULL ) ); - bv.bv_val = buf; - bv.bv_len = strlen( buf ); - bvp[0] = &bv; - bvp[1] = NULL; - mods[i]->mod_bvalues = bvp; - mods[++i] = NULL; - - /* msgid of -1 means don't send the result */ - rc = (ld->ld_cache_add)( ld, -1, m->lm_msgtype, dn, mods ); - LDAPDebug( LDAP_DEBUG_TRACE, - "<= nsldapi_add_result_to_cache added (rc %d)\n", rc, 0, 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/charray.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/charray.c deleted file mode 100644 index a0f4a2fb416..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/charray.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * 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): - */ -/* charray.c - routines for dealing with char * arrays */ - - -#include "ldap-int.h" - -/* - * Add s at the end of the array of strings *a. - * Return 0 for success, -1 for failure. - */ -int -LDAP_CALL -ldap_charray_add( - char ***a, - char *s -) -{ - int n; - - if ( *a == NULL ) { - *a = (char **)NSLDAPI_MALLOC( 2 * sizeof(char *) ); - if ( *a == NULL ) { - return -1; - } - n = 0; - } else { - for ( n = 0; *a != NULL && (*a)[n] != NULL; n++ ) { - ; /* NULL */ - } - - *a = (char **)NSLDAPI_REALLOC( (char *) *a, - (n + 2) * sizeof(char *) ); - if ( *a == NULL ) { - return -1; - } - } - - (*a)[n++] = s; - (*a)[n] = NULL; - return 0; -} - -/* - * Add array of strings s at the end of the array of strings *a. - * Return 0 for success, -1 for failure. - */ -int -LDAP_CALL -ldap_charray_merge( - char ***a, - char **s -) -{ - int i, n, nn; - - if ( (s == NULL) || (s[0] == NULL) ) - return 0; - - for ( n = 0; *a != NULL && (*a)[n] != NULL; n++ ) { - ; /* NULL */ - } - for ( nn = 0; s[nn] != NULL; nn++ ) { - ; /* NULL */ - } - - *a = (char **)NSLDAPI_REALLOC( (char *) *a, - (n + nn + 1) * sizeof(char *) ); - if ( *a == NULL ) { - return -1; - } - - for ( i = 0; i < nn; i++ ) { - (*a)[n + i] = s[i]; - } - (*a)[n + nn] = NULL; - return 0; -} - -void -LDAP_CALL -ldap_charray_free( char **array ) -{ - char **a; - - if ( array == NULL ) { - return; - } - - for ( a = array; *a != NULL; a++ ) { - if ( *a != NULL ) { - NSLDAPI_FREE( *a ); - } - } - NSLDAPI_FREE( (char *) array ); -} - -int -LDAP_CALL -ldap_charray_inlist( - char **a, - char *s -) -{ - int i; - - if ( a == NULL ) - return( 0 ); - - for ( i = 0; a[i] != NULL; i++ ) { - if ( strcasecmp( s, a[i] ) == 0 ) { - return( 1 ); - } - } - - return( 0 ); -} - -/* - * Duplicate the array of strings a, return NULL upon any memory failure. - */ -char ** -LDAP_CALL -ldap_charray_dup( char **a ) -{ - int i; - char **new; - - for ( i = 0; a[i] != NULL; i++ ) - ; /* NULL */ - - new = (char **)NSLDAPI_MALLOC( (i + 1) * sizeof(char *) ); - if ( new == NULL ) { - return NULL; - } - - for ( i = 0; a[i] != NULL; i++ ) { - new[i] = nsldapi_strdup( a[i] ); - if ( new[i] == NULL ) { - int j; - - for ( j = 0; j < i; j++ ) - NSLDAPI_FREE( new[j] ); - NSLDAPI_FREE( new ); - return NULL; - } - } - new[i] = NULL; - - return( new ); -} - -/* - * Tokenize the string str, return NULL upon any memory failure. - * XXX: on many platforms this function is not thread safe because it - * uses strtok(). - */ -char ** -LDAP_CALL -ldap_str2charray( char *str, char *brkstr ) - /* This implementation fails if brkstr contains multibyte characters. - But it works OK if str is UTF-8 and brkstr is 7-bit ASCII. - */ -{ - char **res; - char *s; - int i; - - i = 1; - for ( s = str; *s; s++ ) { - if ( strchr( brkstr, *s ) != NULL ) { - i++; - } - } - - res = (char **)NSLDAPI_MALLOC( (i + 1) * sizeof(char *) ); - if ( res == NULL ) { - return NULL; - } - i = 0; - for ( s = strtok( str, brkstr ); s != NULL; s = strtok( NULL, - brkstr ) ) { - res[i++] = nsldapi_strdup( s ); - if ( res[i - 1] == NULL ) { - int j; - - for ( j = 0; j < (i - 1); j++ ) - NSLDAPI_FREE( res[j] ); - NSLDAPI_FREE( res ); - return NULL; - } - } - res[i] = NULL; - - return( res ); -} - -int -LDAP_CALL -ldap_charray_position( char **a, char *s ) -{ - int i; - - for ( i = 0; a[i] != NULL; i++ ) { - if ( strcasecmp( s, a[i] ) == 0 ) { - return( i ); - } - } - - return( -1 ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/charset.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/charset.c deleted file mode 100644 index 85792483500..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/charset.c +++ /dev/null @@ -1,1830 +0,0 @@ -/* - * 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) 1995 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * charset.c - */ - -#include "ldap-int.h" - -#ifdef STR_TRANSLATION - -void -ldap_set_string_translators( LDAP *ld, BERTranslateProc encode_proc, - BERTranslateProc decode_proc ) -{ - if ( ld == NULL ) { - if ( !nsldapi_initialized ) { - nsldapi_initialize_defaults(); - } - ld = &nsldapi_ld_defaults; - } - - if ( NSLDAPI_VALID_LDAP_POINTER( ld )) { - ld->ld_lber_encode_translate_proc = encode_proc; - ld->ld_lber_decode_translate_proc = decode_proc; - } -} - - -void -ldap_enable_translation( LDAP *ld, LDAPMessage *entry, int enable ) -{ - char *optionsp; - - if ( ld == NULL ) { - if ( !nsldapi_initialized ) { - nsldapi_initialize_defaults(); - } - ld = &nsldapi_ld_defaults; - } - - optionsp = ( entry == NULLMSG ) ? &ld->ld_lberoptions : - &entry->lm_ber->ber_options; - - if ( enable ) { - *optionsp |= LBER_OPT_TRANSLATE_STRINGS; - } else { - *optionsp &= ~LBER_OPT_TRANSLATE_STRINGS; - } -} - - -int -ldap_translate_from_t61( LDAP *ld, char **bufp, unsigned long *lenp, - int free_input ) -{ - if ( ld->ld_lber_decode_translate_proc == NULL ) { - return( LDAP_SUCCESS ); - } - - return( (*ld->ld_lber_decode_translate_proc)( bufp, lenp, free_input )); -} - - -int -ldap_translate_to_t61( LDAP *ld, char **bufp, unsigned long *lenp, - int free_input ) -{ - if ( ld->ld_lber_encode_translate_proc == NULL ) { - return( LDAP_SUCCESS ); - } - - return( (*ld->ld_lber_encode_translate_proc)( bufp, lenp, free_input )); -} - - -/* - ** Character translation routine notes: - * - * On entry: bufp points to a "string" to be converted (not necessarily - * zero-terminated) and buflenp points to the length of the buffer. - * - * On exit: bufp should point to a malloc'd result. If free_input is - * non-zero then the original bufp will be freed. *buflenp should be - * set to the new length. Zero bytes in the input buffer must be left - * as zero bytes. - * - * Return values: any ldap error code (LDAP_SUCCESS if all goes well). - */ - - -#ifdef LDAP_CHARSET_8859 - -#if LDAP_CHARSET_8859 == 88591 -#define ISO_8859 1 -#elif LDAP_CHARSET_8859 == 88592 -#define ISO_8859 2 -#elif LDAP_CHARSET_8859 == 88593 -#define ISO_8859 3 -#elif LDAP_CHARSET_8859 == 88594 -#define ISO_8859 4 -#elif LDAP_CHARSET_8859 == 88595 -#define ISO_8859 5 -#elif LDAP_CHARSET_8859 == 88596 -#define ISO_8859 6 -#elif LDAP_CHARSET_8859 == 88597 -#define ISO_8859 7 -#elif LDAP_CHARSET_8859 == 88598 -#define ISO_8859 8 -#elif LDAP_CHARSET_8859 == 88599 -#define ISO_8859 9 -#elif LDAP_CHARSET_8859 == 885910 -#define ISO_8859 10 -#else -#define ISO_8859 0 -#endif - -/* - * the following ISO_8859 to/afrom T.61 character set translation code is - * based on the code found in Enrique Silvestre Mora's iso-t61.c, found - * as part of this package: - * ftp://pereiii.uji.es/pub/uji-ftp/unix/ldap/iso-t61.translation.tar.Z - * Enrique is now (10/95) at this address: enrique.silvestre@uv.es - * - * changes made by mcs@umich.edu 12 October 1995: - * Change calling conventions of iso8859_t61() and t61_iso8859() to - * match libldap conventions; rename to ldap_8859_to_t61() and - * ldap_t61_to_8859(). - * Change conversion routines to deal with non-zero terminated strings. - * ANSI-ize functions and include prototypes. - */ - -/* iso-t61.c - ISO-T61 translation routines (version: 0.2.1, July-1994) */ -/* - * Copyright (c) 1994 Enrique Silvestre Mora, Universitat Jaume I, Spain. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the Universitat Jaume I. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. -*/ - - -#include -#include -#include - -/* Character set used: ISO 8859-1, ISO 8859-2, ISO 8859-3, ... */ -/* #define ISO_8859 1 */ - -#ifndef ISO_8859 -# define ISO_8859 0 -#endif - -typedef unsigned char Byte; -typedef struct { Byte a, b; } Couple; - -#ifdef NEEDPROTOS -static Byte *c_to_hh( Byte *o, Byte c ); -static Byte *c_to_cc( Byte *o, Couple *cc, Byte c ); -static int hh_to_c( Byte *h ); -static Byte *cc_to_t61( Byte *o, Byte *s ); -#else /* NEEDPROTOS */ -static Byte *c_to_hh(); -static Byte *c_to_cc(); -static int hh_to_c(); -static Byte *cc_to_t61(); -#endif /* NEEDPROTOS */ - -/* - Character choosed as base in diacritics alone: NO-BREAK SPACE. - (The standard say it must be a blank space, 0x20.) -*/ -#define ALONE 0xA0 - -static Couple diacritic[16] = { -#if (ISO_8859 == 1) || (ISO_8859 == 9) - {0,0}, {'`',0}, {0xb4,0}, {'^',0}, - {'~',0}, {0xaf,0}, {'(',ALONE}, {'.',ALONE}, - {0xa8,0}, {0,0}, {'0',ALONE}, {0xb8,0}, - {0,0}, {'"',ALONE}, {';',ALONE}, {'<',ALONE}, -#elif (ISO_8859 == 2) - {0,0}, {'`',0}, {0xb4,0}, {'^',0}, - {'~',0}, {'-',ALONE}, {0xa2,0}, {0xff,0}, - {0xa8,0}, {0,0}, {'0',ALONE}, {0xb8,0}, - {0,0}, {0xbd,0}, {0xb2,0}, {0xb7,0} -#elif (ISO_8859 == 3) - {0,0}, {'`',0}, {0xb4,0}, {'^',0}, - {'~',0}, {'-',ALONE}, {0xa2,0}, {0xff,0}, - {0xa8,0}, {0,0}, {'0',ALONE}, {0xb8,0}, - {0,0}, {'"',ALONE}, {';',ALONE}, {'<',ALONE} -#elif (ISO_8859 == 4) - {0,0}, {'`',0}, {0xb4,0}, {'^',0}, - {'~',0}, {0xaf,0}, {'(',ALONE}, {0xff,0}, - {0xa8,0}, {0,0}, {'0',ALONE}, {0xb8,0}, - {0,0}, {'"',ALONE}, {0xb2,0}, {0xb7,0} -#else - {0,0}, {'`',0}, {'\'',ALONE}, {'^',0}, - {'~',0}, {'-',ALONE}, {'(',ALONE}, {'.',ALONE}, - {':',ALONE}, {0,0}, {'0',ALONE}, {',',ALONE}, - {0,0}, {'"',ALONE}, {';',ALONE}, {'<',ALONE} -#endif -}; - -/* - --- T.61 (T.51) letters with diacritics: conversion to ISO 8859-n ----- - A, C, D, E, G, H, I, J, K, - L, N, O, R, S, T, U, W, Y, Z. - ----------------------------------------------------------------------- -*/ -static int letter_w_diacritic[16][38] = { -#if (ISO_8859 == 1) - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xc0,0, 0, 0xc8,0, 0, 0xcc,0, 0, - 0, 0, 0xd2,0, 0, 0, 0xd9,0, 0, 0, - 0xe0,0, 0, 0xe8,0, 0, 0xec,0, 0, - 0, 0, 0xf2,0, 0, 0, 0xf9,0, 0, 0, - 0xc1,-1, 0, 0xc9,0, 0, 0xcd,0, 0, - -1, -1, 0xd3,-1, -1, 0, 0xda,0, 0xdd,-1, - 0xe1,-1, 0, 0xe9,0, 0, 0xed,0, 0, - -1, -1, 0xf3,-1, -1, 0, 0xfa,0, 0xfd,-1, - 0xc2,-1, 0, 0xca,-1, -1, 0xce,-1, 0, - 0, 0, 0xd4,0, -1, 0, 0xdb,-1, -1, 0, - 0xe2,-1, 0, 0xea,-1, -1, 0xee,-1, 0, - 0, 0, 0xf4,0, -1, 0, 0xfb,-1, -1, 0, - 0xc3,0, 0, 0, 0, 0, -1, 0, 0, - 0, 0xd1,0xd5,0, 0, 0, -1, 0, 0, 0, - 0xe3,0, 0, 0, 0, 0, -1, 0, 0, - 0, 0xf1,0xf5,0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, 0, -1, -1, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 0, -1, 0, -1, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 0xc4,0, 0, 0xcb,0, 0, 0xcf,0, 0, - 0, 0, 0xd6,0, 0, 0, 0xdc,0, -1, 0, - 0xe4,0, 0, 0xeb,0, 0, 0xef,0, 0, - 0, 0, 0xf6,0, 0, 0, 0xfc,0, 0xff,0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xc5,0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0xe5,0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, 0xc7,0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, -1, -1, 0, 0, 0, 0, - 0, 0xe7,0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, -1, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, -1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, -1, -1, 0, 0, 0, -1, - 0, -1, -1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, -1, -1, 0, 0, 0, -1 -#elif (ISO_8859 == 2) - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0xc1,0xc6,0, 0xc9,0, 0, 0xcd,0, 0, - 0xc5,0xd1,0xd3,0xc0,0xa6,0, 0xda,0, 0xdd,0xac, - 0xe1,0xe6,0, 0xe9,0, 0, 0xed,0, 0, - 0xe5,0xf1,0xf3,0xe0,0xb6,0, 0xfa,0, 0xfd,0xbc, - 0xc2,-1, 0, -1, -1, -1, 0xce,-1, 0, - 0, 0, 0xd4,0, -1, 0, -1, -1, -1, 0, - 0xe2,-1, 0, -1, -1, -1, 0xee,-1, 0, - 0, 0, 0xf4,0, -1, 0, -1, -1, -1, 0, - -1, 0, 0, 0, 0, 0, -1, 0, 0, - 0, -1, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, 0, 0, -1, 0, 0, - 0, -1, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0xc3,0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0xe3,0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, 0, -1, -1, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xaf, - 0, -1, 0, -1, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xbf, - 0xc4,0, 0, 0xcb,0, 0, -1, 0, 0, - 0, 0, 0xd6,0, 0, 0, 0xdc,0, -1, 0, - 0xe4,0, 0, 0xeb,0, 0, -1, 0, 0, - 0, 0, 0xf6,0, 0, 0, 0xfc,0, -1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xd9,0, 0, 0, - -1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xf9,0, 0, 0, - 0, 0xc7,0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, 0xaa,0xde,0, 0, 0, 0, - 0, 0xe7,0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, 0xba,0xfe,0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xd5,0, 0, 0, 0xdb,0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xf5,0, 0, 0, 0xfb,0, 0, 0, - 0xa1,0, 0, 0xca,0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0xb1,0, 0, 0xea,0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, 0xc8,0xcf,0xcc,0, 0, 0, 0, 0, - 0xa5,0xd2,0, 0xd8,0xa9,0xab,0, 0, 0, 0xae, - 0, 0xe8,0xef,0xec,0, 0, 0, 0, 0, - 0xb5,0xf2,0, 0xf8,0xb9,0xbb,0, 0, 0, 0xbe -#elif (ISO_8859 == 3) - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xc0,0, 0, 0xc8,0, 0, 0xcc,0, 0, - 0, 0, 0xd2,0, 0, 0, 0xd9,0, 0, 0, - 0xe0,0, 0, 0xe8,0, 0, 0xec,0, 0, - 0, 0, 0xf2,0, 0, 0, 0xf9,0, 0, 0, - 0xc1,-1, 0, 0xc9,0, 0, 0xcd,0, 0, - -1, -1, 0xd3,-1, -1, 0, 0xda,0, -1, -1, - 0xe1,-1, 0, 0xe9,0, 0, 0xed,0, 0, - -1, -1, 0xf3,-1, -1, 0, 0xfa,0, -1, -1, - 0xc2,0xc6,0, 0xca,0xd8,0xa6,0xce,0xac,0, - 0, 0, 0xd4,0, 0xde,0, 0xdb,-1, -1, 0, - 0xe2,0xe6,0, 0xea,0xf8,0xb6,0xee,0xbc,0, - 0, 0, 0xf4,0, 0xfe,0, 0xfb,-1, -1, 0, - -1, 0, 0, 0, 0, 0, -1, 0, 0, - 0, 0xd1,-1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, 0, 0, -1, 0, 0, - 0, 0xf1,-1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, 0xab,0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xdd,0, 0, 0, - -1, 0, 0, 0, 0xbb,0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xfd,0, 0, 0, - 0, 0xc5,0, -1, 0xd5,0, 0xa9,0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xaf, - 0, 0xe5,0, -1, 0xf5,0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xbf, - 0xc4,0, 0, 0xcb,0, 0, 0xcf,0, 0, - 0, 0, 0xd6,0, 0, 0, 0xdc,0, -1, 0, - 0xe4,0, 0, 0xeb,0, 0, 0xef,0, 0, - 0, 0, 0xf6,0, 0, 0, 0xfc,0, -1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, 0xc7,0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, 0xaa,-1, 0, 0, 0, 0, - 0, 0xe7,0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, 0xba,-1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, -1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, -1, -1, 0, 0, 0, -1, - 0, -1, -1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, -1, -1, 0, 0, 0, -1 -#elif (ISO_8859 == 4) - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0xc1,-1, 0, 0xc9,0, 0, 0xcd,0, 0, - -1, -1, -1, -1, -1, 0, 0xda,0, -1, -1, - 0xe1,-1, 0, 0xe9,0, 0, 0xed,0, 0, - -1, -1, -1, -1, -1, 0, 0xfa,0, -1, -1, - 0xc2,-1, 0, -1, -1, -1, 0xce,-1, 0, - 0, 0, 0xd4,0, -1, 0, 0xdb,-1, -1, 0, - 0xe2,-1, 0, -1, -1, -1, 0xee,-1, 0, - 0, 0, 0xf4,0, -1, 0, 0xfb,-1, -1, 0, - 0xc3,0, 0, 0, 0, 0, 0xa5,0, 0, - 0, -1, 0xd5,0, 0, 0, 0xdd,0, 0, 0, - 0xe3,0, 0, 0, 0, 0, 0xb5,0, 0, - 0, -1, 0xf5,0, 0, 0, 0xfd,0, 0, 0, - 0xc0,0, 0, 0xaa,0, 0, 0xcf,0, 0, - 0, 0, 0xd2,0, 0, 0, 0xde,0, 0, 0, - 0xe0,0, 0, 0xba,0, 0, 0xef,0, 0, - 0, 0, 0xf2,0, 0, 0, 0xfe,0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, 0, 0xcc,-1, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 0, -1, 0, 0xec,-1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 0xc4,0, 0, 0xcb,0, 0, -1, 0, 0, - 0, 0, 0xd6,0, 0, 0, 0xdc,0, -1, 0, - 0xe4,0, 0, 0xeb,0, 0, -1, 0, 0, - 0, 0, 0xf6,0, 0, 0, 0xfc,0, -1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xc5,0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0xe5,0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, 0, 0, 0xab,0, 0, 0, 0xd3, - 0xa6,0xd1,0, 0xa3,-1, -1, 0, 0, 0, 0, - 0, -1, 0, 0, 0xbb,0, 0, 0, 0xf3, - 0xb6,0xf1,0, 0xb3,-1, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0xa1,0, 0, 0xca,0, 0, 0xc7,0, 0, - 0, 0, 0, 0, 0, 0, 0xd9,0, 0, 0, - 0xb1,0, 0, 0xea,0, 0, 0xe7,0, 0, - 0, 0, 0, 0, 0, 0, 0xf9,0, 0, 0, - 0, 0xc8,-1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, 0xa9,-1, 0, 0, 0, 0xae, - 0, 0xe8,-1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, 0xb9,-1, 0, 0, 0, 0xbe -#elif (ISO_8859 == 9) - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xc0,0, 0, 0xc8,0, 0, 0xcc,0, 0, - 0, 0, 0xd2,0, 0, 0, 0xd9,0, 0, 0, - 0xe0,0, 0, 0xe8,0, 0, -1, 0, 0, - 0, 0, 0xf2,0, 0, 0, 0xf9,0, 0, 0, - 0xc1,-1, 0, 0xc9,0, 0, 0xcd,0, 0, - -1, -1, 0xd3,-1, -1, 0, 0xda,0, -1, -1, - 0xe1,-1, 0, 0xe9,0, 0, 0xed,0, 0, - -1, -1, 0xf3,-1, -1, 0, 0xfa,0, -1, -1, - 0xc2,-1, 0, 0xca,-1, -1, 0xce,-1, 0, - 0, 0, 0xd4,0, -1, 0, 0xdb,-1, -1, 0, - 0xe2,-1, 0, -1, -1, -1, 0xee,-1, 0, - 0, 0, 0xf4,0, -1, 0, 0xfb,-1, -1, 0, - 0xc3,0, 0, 0, 0, 0, -1, 0, 0, - 0, 0xd1,0xd5,0, 0, 0, -1, 0, 0, 0, - 0xe3,0, 0, 0, 0, 0, -1, 0, 0, - 0, 0xf1,0xf5,0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, 0xef,0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, 0xd0,0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, 0xf0,0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, 0, -1, -1, 0, 0xdd,0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 0, -1, 0, 0xec,-1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 0xc4,0, 0, 0xcb,0, 0, 0xcf,0, 0, - 0, 0, 0xd6,0, 0, 0, 0xdc,0, -1, 0, - 0xe4,0, 0, 0xeb,0, 0, -1, 0, 0, - 0, 0, 0xf6,0, 0, 0, 0xfc,0, 0xff,0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xc5,0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0xe5,0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, 0xc7,0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, 0xde,-1, 0, 0, 0, 0, - 0, 0xe7,0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, 0xfe,-1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0xea,0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, -1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, -1, -1, 0, 0, 0, -1, - 0, -1, -1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, -1, -1, 0, 0, 0, -1 -#elif (ISO_8859 == 10) - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0xc1,-1, 0, 0xc9,0, 0, 0xcd,0, 0, - -1, -1, 0xd3,-1, -1, 0, 0xda,0, 0xdd,-1, - 0xe1,-1, 0, 0xe9,0, 0, 0xed,0, 0, - -1, -1, 0xf3,-1, -1, 0, 0xfa,0, 0xfd,-1, - 0xc2,-1, 0, -1, -1, -1, 0xce,-1, 0, - 0, 0, 0xd4,0, -1, 0, 0xdb,-1, -1, 0, - 0xe2,-1, 0, -1, -1, -1, 0xee,-1, 0, - 0, 0, 0xf4,0, -1, 0, 0xfb,-1, -1, 0, - 0xc3,0, 0, 0, 0, 0, 0xa5,0, 0, - 0, -1, 0xd5,0, 0, 0, 0xd7,0, 0, 0, - 0xe3,0, 0, 0, 0, 0, 0xb5,0, 0, - 0, -1, 0xf5,0, 0, 0, 0xf7,0, 0, 0, - 0xc0,0, 0, 0xa2,0, 0, 0xa4,0, 0, - 0, 0, 0xd2,0, 0, 0, 0xae,0, 0, 0, - 0xe0,0, 0, 0xb2,0, 0, 0xb4,0, 0, - 0, 0, 0xf2,0, 0, 0, 0xbe,0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, 0, 0xcc,-1, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 0, -1, 0, 0xec,-1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 0xc4,0, 0, 0xcb,0, 0, 0xcf,0, 0, - 0, 0, 0xd6,0, 0, 0, 0xdc,0, -1, 0, - 0xe4,0, 0, 0xeb,0, 0, 0xef,0, 0, - 0, 0, 0xf6,0, 0, 0, 0xfc,0, -1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xc5,0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0xe5,0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, 0, 0, 0xa3,0, 0, 0, 0xa6, - 0xa8,0xd1,0, -1, -1, -1, 0, 0, 0, 0, - 0, -1, 0, 0, 0xb3,0, 0, 0, 0xb6, - 0xb8,0xf1,0, -1, -1, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0xa1,0, 0, 0xca,0, 0, 0xc7,0, 0, - 0, 0, 0, 0, 0, 0, 0xd9,0, 0, 0, - 0xb1,0, 0, 0xea,0, 0, 0xe7,0, 0, - 0, 0, 0, 0, 0, 0, 0xf9,0, 0, 0, - 0, 0xc8,-1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, 0xaa,-1, 0, 0, 0, 0xac, - 0, 0xe8,-1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, 0xba,-1, 0, 0, 0, 0xbc -#else - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, -1, 0, -1, 0, 0, -1, 0, 0, - -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, - -1, -1, 0, -1, 0, 0, -1, 0, 0, - -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, - -1, -1, 0, -1, -1, -1, -1, -1, 0, - 0, 0, -1, 0, -1, 0, -1, -1, -1, 0, - -1, -1, 0, -1, -1, -1, -1, -1, 0, - 0, 0, -1, 0, -1, 0, -1, -1, -1, 0, - -1, 0, 0, 0, 0, 0, -1, 0, 0, - 0, -1, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, 0, 0, -1, 0, 0, - 0, -1, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, 0, -1, -1, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 0, -1, 0, -1, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, 0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, -1, -1, 0, 0, 0, 0, - 0, -1, 0, 0, -1, 0, 0, 0, -1, - -1, -1, 0, -1, -1, -1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, -1, 0, 0, -1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 0, -1, -1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, -1, -1, 0, 0, 0, -1, - 0, -1, -1, -1, 0, 0, 0, 0, 0, - -1, -1, 0, -1, -1, -1, 0, 0, 0, -1 -#endif -}; - -/* ---- T.61 characters [0xA0 .. 0xBF] ----------------- -*/ -static Couple trans_t61a_iso8859[32] = { -#if (ISO_8859 == 1) || (ISO_8859 == 9) - {'N','S'}, {0xa1,0}, {0xa2,0}, {0xa3,0}, - {'D','O'}, {0xa5,0}, {'C','u'}, {0xa7,0}, - {0xa4,0}, {'\'','6'},{'"','6'}, {0xab,0}, - {'<','-'}, {'-','!'}, {'-','>'}, {'-','v'}, - {0xb0,0}, {0xb1,0}, {0xb2,0}, {0xb3,0}, - {0xd7,0}, {0xb5,0}, {0xb6,0}, {0xb7,0}, - {0xf7,0}, {'\'','9'},{'"','9'}, {0xbb,0}, - {0xbc,0}, {0xbd,0}, {0xbe,0}, {0xbf,0} -#elif (ISO_8859 == 2) || (ISO_8859 == 4) - {'N','S'}, {'!','I'}, {'C','t'}, {'P','d'}, - {'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0}, - {0xa4,0}, {'\'','6'},{'"','6'}, {'<','<'}, - {'<','-'}, {'-','!'}, {'-','>'}, {'-','v'}, - {0xb0,0}, {'+','-'}, {'2','S'}, {'3','S'}, - {0xd7,0}, {'M','y'}, {'P','I'}, {'.','M'}, - {0xf7,0}, {'\'','9'},{'"','9'}, {'>','>'}, - {'1','4'}, {'1','2'}, {'3','4'}, {'?','I'}, -#elif (ISO_8859 == 3) - {'N','S'}, {'!','I'}, {'C','t'}, {0xa3,0}, - {'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0}, - {0xa4,0}, {'\'','6'},{'"','6'}, {'<','<'}, - {'<','-'}, {'-','!'}, {'-','>'}, {'-','v'}, - {0xb0,0}, {'+','-'}, {0xb2,0}, {0xb3,0}, - {0xd7,0}, {0xb5,0}, {'P','I'}, {0xb7,0}, - {0xf7,0}, {'\'','9'},{'"','9'}, {'>','>'}, - {'1','4'}, {0xbd,0}, {'3','4'}, {'?','I'} -#elif (ISO_8859 == 10) - {'N','S'}, {'!','I'}, {'C','t'}, {'P','d'}, - {'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0}, - {'C','u'}, {'\'','6'},{'"','6'}, {'<','<'}, - {'<','-'}, {'-','!'}, {'-','>'}, {'-','v'}, - {0xb0,0}, {'+','-'}, {'2','S'}, {'3','S'}, - {'*','X'}, {'M','y'}, {'P','I'}, {0xb7,0}, - {'-',':'}, {'\'','9'},{'"','9'}, {'>','>'}, - {'1','4'}, {'1','2'}, {'3','4'}, {'?','I'} -#else - {'N','S'}, {'!','I'}, {'C','t'}, {'P','d'}, - {'D','O'}, {'Y','e'}, {'C','u'}, {'S','E'}, - {'X','O'}, {'\'','6'},{'"','6'}, {'<','<'}, - {'<','-'}, {'-','!'}, {'-','>'}, {'-','v'}, - {'D','G'}, {'+','-'}, {'2','S'}, {'3','S'}, - {'*','X'}, {'M','y'}, {'P','I'}, {'.','M'}, - {'-',':'}, {'\'','9'},{'"','9'}, {'>','>'}, - {'1','4'}, {'1','2'}, {'3','4'}, {'?','I'} -#endif -}; - -/* ---- T.61 characters [0xE0 .. 0xFF] ----------------- -*/ -static Couple trans_t61b_iso8859[48] = { -#if (ISO_8859 == 1) - {'-','M'}, {0xb9,0}, {0xae,0}, {0xa9,0}, - {'T','M'}, {'M','8'}, {0xac,0}, {0xa6,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {'1','8'}, {'3','8'}, {'5','8'}, {'7','8'}, - {'O','m'}, {0xc6,0}, {0xd0,0}, {0xaa,0}, - {'H','/'}, {0,0}, {'I','J'}, {'L','.'}, - {'L','/'}, {0xd8,0}, {'O','E'}, {0xba,0}, - {0xde,0}, {'T','/'}, {'N','G'}, {'\'','n'}, - {'k','k'}, {0xe6,0}, {'d','/'}, {0xf0,0}, - {'h','/'}, {'i','.'}, {'i','j'}, {'l','.'}, - {'l','/'}, {0xf8,0}, {'o','e'}, {0xdf,0}, - {0xfe,0}, {'t','/'}, {'n','g'}, {'-','-'} -#elif (ISO_8859 == 2) - {'-','M'}, {'1','S'}, {'R','g'}, {'C','o'}, - {'T','M'}, {'M','8'}, {'N','O'}, {'B','B'}, - {0,0}, {0,0}, {0,0}, {0,0}, - {'1','8'}, {'3','8'}, {'5','8'}, {'7','8'}, - {'O','m'}, {'A','E'}, {0xd0,0}, {'-','a'}, - {'H','/'}, {0,0}, {'I','J'}, {'L','.'}, - {0xa3,0}, {'O','/'}, {'O','E'}, {'-','o'}, - {'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'}, - {'k','k'}, {'a','e'}, {0xf0,0}, {'d','-'}, - {'h','/'}, {'i','.'}, {'i','j'}, {'l','.'}, - {0xb3,0}, {'o','/'}, {'o','e'}, {0xdf,0}, - {'t','h'}, {'t','/'}, {'n','g'}, {'-','-'} -#elif (ISO_8859 == 3) - {'-','M'}, {'1','S'}, {'R','g'}, {'C','o'}, - {'T','M'}, {'M','8'}, {'N','O'}, {'B','B'}, - {0,0}, {0,0}, {0,0}, {0,0}, - {'1','8'}, {'3','8'}, {'5','8'}, {'7','8'}, - {'O','m'}, {'A','E'}, {'D','/'}, {'-','a'}, - {0xa1,0}, {0,0}, {'I','J'}, {'L','.'}, - {'L','/'}, {'O','/'}, {'O','E'}, {'-','o'}, - {'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'}, - {'k','k'}, {'a','e'}, {'d','/'}, {'d','-'}, - {0xb1,0}, {0xb9,0}, {'i','j'}, {'l','.'}, - {'l','/'}, {'o','/'}, {'o','e'}, {0xdf,0}, - {'t','h'}, {'t','/'}, {'n','g'}, {'-','-'} -#elif (ISO_8859 == 4) - {'-','M'}, {'1','S'}, {'R','g'}, {'C','o'}, - {'T','M'}, {'M','8'}, {'N','O'}, {'B','B'}, - {0,0}, {0,0}, {0,0}, {0,0}, - {'1','8'}, {'3','8'}, {'5','8'}, {'7','8'}, - {'O','m'}, {0xc6,0}, {0xd0,0}, {'-','a'}, - {'H','/'}, {0,0}, {'I','J'}, {'L','.'}, - {'L','/'}, {0xd8,0}, {'O','E'}, {'-','o'}, - {'T','H'}, {0xac,0}, {0xbd,0}, {'\'','n'}, - {0xa2,0}, {0xe6,0}, {0xf0,0}, {'d','-'}, - {'h','/'}, {'i','.'}, {'i','j'}, {'l','.'}, - {'l','/'}, {0xf8,0}, {'o','e'}, {0xdf,0}, - {'t','h'}, {0xbc,0}, {0xbf,0}, {'-','-'} -#elif (ISO_8859 == 9) - {'-','M'}, {0xb9,0}, {0xae,0}, {0xa9,0}, - {'T','M'}, {'M','8'}, {0xac,0}, {0xa6,0}, - {0,0}, {0,0}, {0,0}, {0,0}, - {'1','8'}, {'3','8'}, {'5','8'}, {'7','8'}, - {'O','m'}, {0xc6,0}, {'D','/'}, {0xaa,0}, - {'H','/'}, {0,0}, {'I','J'}, {'L','.'}, - {'L','/'}, {0xd8,0}, {'O','E'}, {0xba,0}, - {'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'}, - {'k','k'}, {0xe6,0}, {'d','/'}, {'d','-'}, - {'h','/'}, {0xfd,0}, {'i','j'}, {'l','.'}, - {'l','/'}, {0xf8,0}, {'o','e'}, {0xdf,0}, - {'t','h'}, {'t','/'}, {'n','g'}, {'-','-'} -#elif (ISO_8859 == 10) - {0xbd,0}, {'1','S'}, {'R','g'}, {'C','o'}, - {'T','M'}, {'M','8'}, {'N','O'}, {'B','B'}, - {0,0}, {0,0}, {0,0}, {0,0}, - {'1','8'}, {'3','8'}, {'5','8'}, {'7','8'}, - {'O','m'}, {0xc6,0}, {0xa9,0}, {'-','a'}, - {'H','/'}, {0,0}, {'I','J'}, {'L','.'}, - {'L','/'}, {0xd8,0}, {'O','E'}, {'-','o'}, - {0xde,0}, {0xab,0}, {0xaf,0}, {'\'','n'}, - {0xff,0}, {0xe6,0}, {0xb9,0}, {0xf0,0}, - {'h','/'}, {'i','.'}, {'i','j'}, {'l','.'}, - {'l','/'}, {0xf8,0}, {'o','e'}, {0xdf,0}, - {0xfe,0}, {0xbb,0}, {0xbf,0}, {'-','-'} -#else - {'-','M'}, {'1','S'}, {'R','g'}, {'C','o'}, - {'T','M'}, {'M','8'}, {'N','O'}, {'B','B'}, - {0,0}, {0,0}, {0,0}, {0,0}, - {'1','8'}, {'3','8'}, {'5','8'}, {'7','8'}, - {'O','m'}, {'A','E'}, {'D','/'}, {'-','a'}, - {'H','/'}, {0,0}, {'I','J'}, {'L','.'}, - {'L','/'}, {'O','/'}, {'O','E'}, {'-','o'}, - {'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'}, - {'k','k'}, {'a','e'}, {'d','/'}, {'d','-'}, - {'h','/'}, {'i','.'}, {'i','j'}, {'l','.'}, - {'l','/'}, {'o','/'}, {'o','e'}, {'s','s'}, - {'t','h'}, {'t','-'}, {'n','g'}, {'-','-'} -#endif -}; - -/* ---- ISO 8859-n characters <0xA0 .. 0xFF> ------------------- -*/ -#if (ISO_8859 == 1) -static Couple trans_iso8859_t61[96] = { - {0xa0,0}, {0xa1,0}, {0xa2,0}, {0xa3,0}, - {0xa8,0}, {0xa5,0}, {0xd7,0}, {0xa7,0}, - {0xc8,ALONE}, {0xd3,0}, {0xe3,0}, {0xab,0}, - {0xd6,0}, {0xff,0}, {0xd2,0}, {0xc5,ALONE}, - {0xb0,0}, {0xb1,0}, {0xb2,0}, {0xb3,0}, - {0xc2,ALONE}, {0xb5,0}, {0xb6,0}, {0xb7,0}, - {0xcb,ALONE}, {0xd1,0}, {0xeb,0}, {0xbb,0}, - {0xbc,0}, {0xbd,0}, {0xbe,0}, {0xbf,0}, - {0xc1,'A'}, {0xc2,'A'}, {0xc3,'A'}, {0xc4,'A'}, - {0xc8,'A'}, {0xca,'A'}, {0xe1,0}, {0xcb,'C'}, - {0xc1,'E'}, {0xc2,'E'}, {0xc3,'E'}, {0xc8,'E'}, - {0xc1,'I'}, {0xc2,'I'}, {0xc3,'I'}, {0xc8,'I'}, - {0xe2,0}, {0xc4,'N'}, {0xc1,'O'}, {0xc2,'O'}, - {0xc3,'O'}, {0xc4,'O'}, {0xc8,'O'}, {0xb4,0}, - {0xe9,0}, {0xc1,'U'}, {0xc2,'U'}, {0xc3,'U'}, - {0xc8,'U'}, {0xc2,'Y'}, {0xec,0}, {0xfb,0}, - {0xc1,'a'}, {0xc2,'a'}, {0xc3,'a'}, {0xc4,'a'}, - {0xc8,'a'}, {0xca,'a'}, {0xf1,0}, {0xcb,'c'}, - {0xc1,'e'}, {0xc2,'e'}, {0xc3,'e'}, {0xc8,'e'}, - {0xc1,'i'}, {0xc2,'i'}, {0xc3,'i'}, {0xc8,'i'}, - {0xf3,0}, {0xc4,'n'}, {0xc1,'o'}, {0xc2,'o'}, - {0xc3,'o'}, {0xc4,'o'}, {0xc8,'o'}, {0xb8,0}, - {0xf9,0}, {0xc1,'u'}, {0xc2,'u'}, {0xc3,'u'}, - {0xc8,'u'}, {0xc2,'y'}, {0xfc,0}, {0xc8,'y'} -}; -#elif (ISO_8859 == 2) -static Couple trans_iso8859_t61[96] = { - {0xa0,0}, {0xce,'A'}, {0xc6,ALONE}, {0xe8,0}, - {0xa8,0}, {0xcf,'L'}, {0xc2,'S'}, {0xa7,0}, - {0xc8,ALONE}, {0xcf,'S'}, {0xcb,'S'}, {0xcf,'T'}, - {0xc2,'Z'}, {0xff,0}, {0xcf,'Z'}, {0xc7,'Z'}, - {0xb0,0}, {0xce,'a'}, {0xce,ALONE}, {0xf8,0}, - {0xc2,ALONE}, {0xcf,'l'}, {0xc2,'s'}, {0xcf,ALONE}, - {0xcb,ALONE}, {0xcf,'s'}, {0xcb,'s'}, {0xcf,'t'}, - {0xc2,'z'}, {0xcd,ALONE}, {0xcf,'z'}, {0xc7,'z'}, - {0xc2,'R'}, {0xc2,'A'}, {0xc3,'A'}, {0xc6,'A'}, - {0xc8,'A'}, {0xc2,'L'}, {0xc2,'C'}, {0xcb,'C'}, - {0xcf,'C'}, {0xc2,'E'}, {0xce,'E'}, {0xc8,'E'}, - {0xcf,'E'}, {0xc2,'I'}, {0xc3,'I'}, {0xcf,'D'}, - {0xe2,0}, {0xc2,'N'}, {0xcf,'N'}, {0xc2,'O'}, - {0xc3,'O'}, {0xcd,'O'}, {0xc8,'O'}, {0xb4,0}, - {0xcf,'R'}, {0xca,'U'}, {0xc2,'U'}, {0xcd,'U'}, - {0xc8,'U'}, {0xc2,'Y'}, {0xcb,'T'}, {0xfb,0}, - {0xc2,'r'}, {0xc2,'a'}, {0xc3,'a'}, {0xc6,'a'}, - {0xc8,'a'}, {0xc2,'l'}, {0xc2,'c'}, {0xcb,'c'}, - {0xcf,'c'}, {0xc2,'e'}, {0xce,'e'}, {0xc8,'e'}, - {0xcf,'e'}, {0xc2,'i'}, {0xc3,'i'}, {0xcf,'d'}, - {0xf2,0}, {0xc2,'n'}, {0xcf,'n'}, {0xc2,'o'}, - {0xc3,'o'}, {0xcd,'o'}, {0xc8,'o'}, {0xb8,0}, - {0xcf,'r'}, {0xca,'u'}, {0xc2,'u'}, {0xcd,'u'}, - {0xc8,'u'}, {0xc2,'y'}, {0xcb,'t'}, {0xc7,ALONE} -}; -#elif (ISO_8859 == 3) -static Couple trans_iso8859_t61[96] = { - {0xa0,0}, {0xe4,0}, {0xc6,ALONE}, {0xa3,0}, - {0xa8,0}, {0,0}, {0xc3,'H'}, {0xa7,0}, - {0xc8,ALONE}, {0xc7,'I'}, {0xcb,'S'}, {0xc6,'G'}, - {0xc3,'J'}, {0xff,0}, {0,0}, {0xc7,'Z'}, - {0xb0,0}, {0xf4,0}, {0xb2,0}, {0xb3,0}, - {0xc2,ALONE}, {0xb5,0}, {0xc3,'h'}, {0xb7,0}, - {0xcb,ALONE}, {0xf5,0}, {0xcb,'s'}, {0xc6,'g'}, - {0xc3,'j'}, {0xbd,0}, {0,0}, {0xc7,'z'}, - {0xc1,'A'}, {0xc2,'A'}, {0xc3,'A'}, {0,0}, - {0xc8,'A'}, {0xc7,'C'}, {0xc3,'C'}, {0xcb,'C'}, - {0xc1,'E'}, {0xc2,'E'}, {0xc3,'E'}, {0xc8,'E'}, - {0xc1,'I'}, {0xc2,'I'}, {0xc3,'I'}, {0xc8,'I'}, - {0,0}, {0xc4,'N'}, {0xc1,'O'}, {0xc2,'O'}, - {0xc3,'O'}, {0xc7,'G'}, {0xc8,'O'}, {0xb4,0}, - {0xc3,'G'}, {0xc1,'U'}, {0xc2,'U'}, {0xc3,'U'}, - {0xc8,'U'}, {0xc6,'U'}, {0xc3,'S'}, {0xfb,0}, - {0xc1,'a'}, {0xc2,'a'}, {0xc3,'a'}, {0,0}, - {0xc8,'a'}, {0xc7,'c'}, {0xc3,'c'}, {0xcb,'c'}, - {0xc1,'e'}, {0xc2,'e'}, {0xc3,'e'}, {0xc8,'e'}, - {0xc1,'i'}, {0xc2,'i'}, {0xc3,'i'}, {0xc8,'i'}, - {0,0}, {0xc4,'n'}, {0xc1,'o'}, {0xc2,'o'}, - {0xc3,'o'}, {0xc7,'g'}, {0xc8,'o'}, {0xb8,0}, - {0xc3,'g'}, {0xc1,'u'}, {0xc2,'u'}, {0xc3,'u'}, - {0xc8,'u'}, {0xc6,'u'}, {0xc3,'s'}, {0xc7,ALONE} -}; -#elif (ISO_8859 == 4) -static Couple trans_iso8859_t61[96] = { - {0xa0,0}, {0xce,'A'}, {0xf0,0}, {0xcb,'R'}, - {0xa8,0}, {0xc4,'I'}, {0xcb,'L'}, {0xa7,0}, - {0xc8,ALONE}, {0xcf,'S'}, {0xc5,'E'}, {0xcb,'G'}, - {0xed,0}, {0xff,0}, {0xcf,'Z'}, {0xc5,ALONE}, - {0xb0,0}, {0xce,'a'}, {0xce,ALONE}, {0xcb,'r'}, - {0xc2,ALONE}, {0xc4,'i'}, {0xcb,'l'}, {0xcf,ALONE}, - {0xcb,ALONE}, {0xcf,'s'}, {0xc5,'e'}, {0xcb,'g'}, - {0xfd,0}, {0xee,0}, {0xcf,'z'}, {0xfe,0}, - {0xc5,'A'}, {0xc2,'A'}, {0xc3,'A'}, {0xc4,'A'}, - {0xc8,'A'}, {0xca,'A'}, {0xe1,0}, {0xce,'I'}, - {0xcf,'C'}, {0xc2,'E'}, {0xce,'E'}, {0xc8,'E'}, - {0xc7,'E'}, {0xc2,'I'}, {0xc3,'I'}, {0xc5,'I'}, - {0xe2,0}, {0xcb,'N'}, {0xc5,'O'}, {0xcb,'K'}, - {0xc3,'O'}, {0xc4,'O'}, {0xc8,'O'}, {0xb4,0}, - {0xe9,0}, {0xce,'U'}, {0xc2,'U'}, {0xc3,'U'}, - {0xc8,'U'}, {0xc4,'U'}, {0xc5,'U'}, {0xfb,0}, - {0xc5,'a'}, {0xc2,'a'}, {0xc3,'a'}, {0xc4,'a'}, - {0xc8,'a'}, {0xca,'a'}, {0xf1,0}, {0xce,'i'}, - {0xcf,'c'}, {0xc2,'e'}, {0xce,'e'}, {0xc8,'e'}, - {0xc7,'e'}, {0xc2,'i'}, {0xc3,'i'}, {0xc5,'i'}, - {0xf2,0}, {0xcb,'n'}, {0xc5,'o'}, {0xcb,'k'}, - {0xc3,'o'}, {0xc4,'o'}, {0xc8,'o'}, {0xb8,0}, - {0xf9,0}, {0xce,'u'}, {0xc2,'u'}, {0xc3,'u'}, - {0xc8,'u'}, {0xc4,'u'}, {0xc5,'u'}, {0xc7,ALONE} -}; -#elif (ISO_8859 == 9) -static Couple trans_iso8859_t61[96] = { - {0xa0,0}, {0xa1,0}, {0xa2,0}, {0xa3,0}, - {0xa8,0}, {0xa5,0}, {0xd7,0}, {0xa7,0}, - {0xc8,ALONE}, {0xd3,0}, {0xe3,0}, {0xab,0}, - {0xd6,0}, {0xff,0}, {0xd2,0}, {0xc5,ALONE}, - {0xb0,0}, {0xb1,0}, {0xb2,0}, {0xb3,0}, - {0xc2,ALONE}, {0xb5,0}, {0xb6,0}, {0xb7,0}, - {0xcb,ALONE}, {0xd1,0}, {0xeb,0}, {0xbb,0}, - {0xbc,0}, {0xbd,0}, {0xbe,0}, {0xbf,0}, - {0xc1,'A'}, {0xc2,'A'}, {0xc3,'A'}, {0xc4,'A'}, - {0xc8,'A'}, {0xca,'A'}, {0xe1,0}, {0xcb,'C'}, - {0xc1,'E'}, {0xc2,'E'}, {0xc3,'E'}, {0xc8,'E'}, - {0xc1,'I'}, {0xc2,'I'}, {0xc3,'I'}, {0xc8,'I'}, - {0xc6,'G'}, {0xc4,'N'}, {0xc1,'O'}, {0xc2,'O'}, - {0xc3,'O'}, {0xc4,'O'}, {0xc8,'O'}, {0xb4,0}, - {0xe9,0}, {0xc1,'U'}, {0xc2,'U'}, {0xc3,'U'}, - {0xc8,'U'}, {0xc7,'I'}, {0xcb,'S'}, {0xfb,0}, - {0xc1,'a'}, {0xc2,'a'}, {0xc3,'a'}, {0xc4,'a'}, - {0xc8,'a'}, {0xca,'a'}, {0xf1,0}, {0xcb,'c'}, - {0xc1,'e'}, {0xc2,'e'}, {0xce,'e'}, {0xc8,'e'}, - {0xc7,'e'}, {0xc2,'i'}, {0xc3,'i'}, {0xc5,'i'}, - {0xc6,'g'}, {0xc4,'n'}, {0xc1,'o'}, {0xc2,'o'}, - {0xc3,'o'}, {0xc4,'o'}, {0xc8,'o'}, {0xb8,0}, - {0xf9,0}, {0xc1,'u'}, {0xc2,'u'}, {0xc3,'u'}, - {0xc8,'u'}, {0xf5,0}, {0xcb,'s'}, {0xc8,'y'} -}; -#elif (ISO_8859 == 10) -static Couple trans_iso8859_t61[96] = { - {0xa0,0}, {0xce,'A'}, {0xc5,'E'}, {0xcb,'G'}, - {0xc5,'I'}, {0xc4,'I'}, {0xcb,'K'}, {0xa7,0}, - {0xcb,'L'}, {0xe2,0}, {0xcf,'S'}, {0xed,0}, - {0xcf,'Z'}, {0xff,0}, {0xc5,'U'}, {0xee,0}, - {0xb0,0}, {0xce,'a'}, {0xc5,'e'}, {0xcb,'g'}, - {0xc5,'i'}, {0xc4,'i'}, {0xcb,'k'}, {0xb7,0}, - {0xcb,'l'}, {0xf2,0}, {0xcf,'s'}, {0xfd,0}, - {0xcf,'z'}, {0xd0,0}, {0xc5,'u'}, {0xfe,0}, - {0xc5,'A'}, {0xc2,'A'}, {0xc3,'A'}, {0xc4,'A'}, - {0xc8,'A'}, {0xca,'A'}, {0xe1,0}, {0xce,'I'}, - {0xcf,'C'}, {0xc2,'E'}, {0xce,'E'}, {0xc8,'E'}, - {0xc7,'E'}, {0xc2,'I'}, {0xc3,'I'}, {0xc8,'I'}, - {0,0}, {0xcb,'N'}, {0xc5,'O'}, {0xc2,'O'}, - {0xc3,'O'}, {0xc4,'O'}, {0xc8,'O'}, {0xc4,'U'}, - {0xe9,0}, {0xce,'U'}, {0xc2,'U'}, {0xc3,'U'}, - {0xc8,'U'}, {0xc2,'Y'}, {0xec,0}, {0xfb,0}, - {0xc5,'a'}, {0xc2,'a'}, {0xc3,'a'}, {0xc4,'a'}, - {0xc8,'a'}, {0xca,'a'}, {0xf1,0}, {0xce,'i'}, - {0xcf,'c'}, {0xc2,'e'}, {0xce,'e'}, {0xc8,'e'}, - {0xc7,'e'}, {0xc2,'i'}, {0xc3,'i'}, {0xc8,'i'}, - {0xf3,0}, {0xcb,'n'}, {0xc5,'o'}, {0xc2,'o'}, - {0xc3,'o'}, {0xc4,'o'}, {0xc8,'o'}, {0xc4,'u'}, - {0xf9,0}, {0xce,'u'}, {0xc2,'u'}, {0xc3,'u'}, - {0xc8,'u'}, {0xc2,'y'}, {0xfc,0}, {0xf0,0} -}; -#endif - - -static Byte * -c_to_hh( Byte *o, Byte c ) -{ - Byte n; - - *o++ = '{'; *o++ = 'x'; - n = c >> 4; - *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n; - n = c & 0x0F; - *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n; - *o++ = '}'; - return o; -} - - -static Byte * -c_to_cc( Byte *o, Couple *cc, Byte c ) -{ - if ( (*cc).a != 0 ) { - if ( (*cc).b == 0 ) - *o++ = (*cc).a; - else { - *o++ = '{'; - *o++ = (*cc).a; - *o++ = (*cc).b; - *o++ = '}'; - } - return o; - } - else - return c_to_hh( o, c ); -} - -/* --- routine to convert from T.61 to ISO 8859-n --- */ - -int -ldap_t61_to_8859( char **bufp, unsigned long *buflenp, int free_input ) -{ - Byte *s, *oo, *o; - unsigned int n; - int c; - unsigned long len; - Couple *cc; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_t61_to_8859 input length: %ld\n", - *buflenp, 0, 0 ); - - len = *buflenp; - s = (Byte *) *bufp; - - if ( (o = oo = (Byte *)NSLDAPI_MALLOC( 2 * len + 64 )) == NULL ) { - return( 1 ); - } - - while ( (char *)s - *(char **)bufp < len ) { - switch ( *s >> 4 ) { - - case 0xA: case 0xB: - o = c_to_cc( o, &trans_t61a_iso8859[ *s - 0xA0 ], *s ); - s++; - break; - - case 0xD: case 0xE: case 0xF: - o = c_to_cc( o, &trans_t61b_iso8859[ *s - 0xD0 ], *s ); - s++; - break; - - case 0xC: - if ( (*s == 0xC0) || (*s == 0xC9) || (*s == 0xCC) ) { - o = c_to_hh( o, *s++ ); - break; - } - - n = (*s++) - 0xC0; - switch ( *s ) { - - case 'A': c = letter_w_diacritic[n][0]; break; - case 'C': c = letter_w_diacritic[n][1]; break; - case 'D': c = letter_w_diacritic[n][2]; break; - case 'E': c = letter_w_diacritic[n][3]; break; - case 'G': c = letter_w_diacritic[n][4]; break; - case 'H': c = letter_w_diacritic[n][5]; break; - case 'I': c = letter_w_diacritic[n][6]; break; - case 'J': c = letter_w_diacritic[n][7]; break; - case 'K': c = letter_w_diacritic[n][8]; break; - case 'L': c = letter_w_diacritic[n][9]; break; - case 'N': c = letter_w_diacritic[n][10]; break; - case 'O': c = letter_w_diacritic[n][11]; break; - case 'R': c = letter_w_diacritic[n][12]; break; - case 'S': c = letter_w_diacritic[n][13]; break; - case 'T': c = letter_w_diacritic[n][14]; break; - case 'U': c = letter_w_diacritic[n][15]; break; - case 'W': c = letter_w_diacritic[n][16]; break; - case 'Y': c = letter_w_diacritic[n][17]; break; - case 'Z': c = letter_w_diacritic[n][18]; break; - - case 'a': c = letter_w_diacritic[n][19]; break; - case 'c': c = letter_w_diacritic[n][20]; break; - case 'd': c = letter_w_diacritic[n][21]; break; - case 'e': c = letter_w_diacritic[n][22]; break; - case 'g': c = letter_w_diacritic[n][23]; break; - case 'h': c = letter_w_diacritic[n][24]; break; - case 'i': c = letter_w_diacritic[n][25]; break; - case 'j': c = letter_w_diacritic[n][26]; break; - case 'k': c = letter_w_diacritic[n][27]; break; - case 'l': c = letter_w_diacritic[n][28]; break; - case 'n': c = letter_w_diacritic[n][29]; break; - case 'o': c = letter_w_diacritic[n][30]; break; - case 'r': c = letter_w_diacritic[n][31]; break; - case 's': c = letter_w_diacritic[n][32]; break; - case 't': c = letter_w_diacritic[n][33]; break; - case 'u': c = letter_w_diacritic[n][34]; break; - case 'w': c = letter_w_diacritic[n][35]; break; - case 'y': c = letter_w_diacritic[n][36]; break; - case 'z': c = letter_w_diacritic[n][37]; break; - - case ALONE: c = (( !diacritic[n].b ) ? diacritic[n].a : -1); - break; - - default: c = 0; - } - - if ( c > 0 ) { - *o++ = c; s++; - } else { - *o++ = '{'; - if ( c == -1 ) { - *o++ = ( ( *s == ALONE ) ? ' ' : *s ); - s++; - } else { - *o++ = '"'; - } - *o++ = diacritic[n].a; - *o++ = '}'; - } - break; - -#if (ISO_8859 == 0) - case 0x8: case 0x9: - *o++ = 0x1B; /* */ - *o++ = *s++ - 0x40; - break; -#endif - - default: - *o++ = *s++; - } - } - - len = o - oo; - o = oo; - - if ( (oo = (Byte *)NSLDAPI_REALLOC( o, len )) == NULL ) { - NSLDAPI_FREE( o ); - return( 1 ); - } - - if ( free_input ) { - NSLDAPI_FREE( *bufp ); - } - *bufp = (char *) oo; - *buflenp = len; - return( 0 ); -} - - -static int -hh_to_c( Byte *h ) -{ - Byte c; - - if ( (*h >= '0') && (*h <= '9') ) c = *h++ - '0'; - else if ( (*h >= 'A') && (*h <= 'F') ) c = *h++ - 'A' + 10; - else if ( (*h >= 'a') && (*h <= 'f') ) c = *h++ - 'a' + 10; - else return -1; - - c <<= 4; - - if ( (*h >= '0') && (*h <= '9') ) c |= *h - '0'; - else if ( (*h >= 'A') && (*h <= 'F') ) c |= *h - 'A' + 10; - else if ( (*h >= 'a') && (*h <= 'f') ) c |= *h - 'a' + 10; - else return -1; - - return c; -} - - -static Byte * -cc_to_t61( Byte *o, Byte *s ) -{ - int n, c = 0; - - switch ( *(s + 1) ) { - - case '`': c = -1; break; /* */ - - case '!': - switch ( *s ) { - case '!': c = 0x7C; break; /* */ - case '(': c = 0x7B; break; /* */ - case '-': c = 0xAD; break; /* */ - default: c = -1; /* */ - } - break; - -#if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \ - (ISO_8859 == 4) || (ISO_8859 == 9) - case 0xB4: -#endif - case '\'': c = -2; break; /* */ - - case '^': c = -3; break; /* */ - - case '>': - switch ( *s ) { - case ')': c = 0x5D; break; /* */ - case '>': c = 0xBB; break; /* */ - case '-': c = 0xAE; break; /* */ - default: c = -3; /* */ - } - break; - - case '~': - case '?': c = -4; break; /* */ - -#if (ISO_8859 == 1) || (ISO_8859 == 4) || (ISO_8859 == 9) - case 0xAF: c = -5; break; /* */ -#endif - - case '-': - switch ( *s ) { - case '-': c = 0xFF; break; /* */ - case '<': c = 0xAC; break; /* */ - case '+': c = 0xB1; break; /* */ - case 'd': c = 0xF3; break; /* */ - default: c = -5; /* */ - } - break; - -#if (ISO_8859 == 2) || (ISO_8859 == 3) - case 0xA2: c = -6; break; /* */ -#endif - - case '(': - if ( *s == '<' ) c = 0x5B; /* */ - else c = -6; /* */ - break; - -#if (ISO_8859 == 2) || (ISO_8859 == 3) || (ISO_8859 == 4) - case 0xFF: c = -7; break; /* */ -#endif - - case '.': - switch ( *s ) { - case 'i': c = 0xF5; break; /* */ - case 'L': c = 0xE7; break; /* */ - case 'l': c = 0xF7; break; /* */ - default: c = -7; /* */ - } - break; - -#if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \ - (ISO_8859 == 4) || (ISO_8859 == 9) - case 0xA8: c = -8; break; /* */ -#endif - - case ':': - if ( *s == '-') c = 0xB8; /* */ - else c = -8; /* */ - break; - -#if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \ - (ISO_8859 == 4) || (ISO_8859 == 9) || (ISO_8859 == 10) - case 0xB0: -#endif - case '0': c = -10; break; /* */ - -#if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \ - (ISO_8859 == 4) || (ISO_8859 == 9) - case 0xB8: -#endif - case ',': c = -11; break; /* */ - -#if (ISO_8859 == 2) - case 0xBD: -#endif - case '"': c = -13; break; /* */ - -#if (ISO_8859 == 2) || (ISO_8859 == 4) - case 0xB2: -#endif - case ';': c = -14; break; /* */ - -#if (ISO_8859 == 2) || (ISO_8859 == 4) - case 0xB7: c = -15; break; /* */ -#endif - - case ')': - if ( *s == '!' ) c = 0x7D; /* */ - break; - - case '<': - if ( *s == '<' ) c = 0xAB; /* */ - else c = -15; /* */ - break; - - case '/': - switch ( *s ) { - case '/': c = 0x5C; break; /* */ - case 'D': c = 0xE2; break; /* */ - case 'd': c = 0xF2; break; /* */ - case 'H': c = 0xE4; break; /* */ - case 'h': c = 0xF4; break; /* */ - case 'L': c = 0xE8; break; /* */ - case 'l': c = 0xF8; break; /* */ - case 'O': c = 0xE9; break; /* */ - case 'o': c = 0xF9; break; /* */ - case 'T': c = 0xED; break; /* */ - case 't': c = 0xFD; break; /* */ - } - break; - - case '2': - if ( *s == '1' ) c = 0xBD; /* */ - break; - - case '4': - switch ( *s ) { - case '1': c = 0xBC; break; /* */ - case '3': c = 0xBE; break; /* */ - } - break; - - case '6': - switch ( *s ) { - case '\'': c = 0xA9; break; /* */ - case '"': c = 0xAA; break; /* */ - } - break; - - case '8': - switch ( *s ) { - case '1': c = 0xDC; break; /* */ - case '3': c = 0xDD; break; /* */ - case '5': c = 0xDE; break; /* */ - case '7': c = 0xDF; break; /* */ - case 'M': c = 0xD5; break; /* */ - } - break; - - case '9': - switch ( *s ) { - case '\'': c = 0xB9; break; /* */ - case '"': c = 0xBA; break; /* */ - } - break; - - case 'A': - if ( *s == 'A' ) c = -10; /* + */ - break; - - case 'a': - switch ( *s ) { - case '-': c = 0xE3; break; /* */ - case 'a': c = -10; break; /* + */ - } - break; - - case 'B': - if ( *s == 'B' ) c = 0xD7; /* */ - break; - - case 'b': - if ( *s == 'N' ) c = 0xA6; /* */ - break; - - case 'd': - if ( *s == 'P' ) c = 0xA3; /* */ - break; - - case 'E': - switch ( *s ) { - case 'S': c = 0xA7; break; /* */ - case 'A': c = 0xE1; break; /* */ - case 'O': c = 0xEA; break; /* */ - } - break; - - case 'e': - switch ( *s ) { - case 'a': c = 0xF1; break; /* */ - case 'o': c = 0xFA; break; /* */ - case 'Y': c = 0xA5; break; /* */ - } - break; - - case 'G': - switch ( *s ) { - case 'D': c = 0xB0; break; /* */ - case 'N': c = 0xEE; break; /* */ - } - break; - - case 'g': - switch ( *s ) { - case 'R': c = 0xD2; break; /* */ - case 'n': c = 0xFE; break; /* */ - } - break; - - case 'H': - if ( *s == 'T' ) c = 0xEC; /* */ - break; - - case 'h': - if ( *s == 't' ) c = 0xFC; /* */ - break; - - case 'I': - switch ( *s ) { - case 'P': c = 0xB6; break; /* */ - case '!': c = 0xA1; break; /* */ - case '?': c = 0xBF; break; /* */ - } - break; - - case 'J': - if ( *s == 'I' ) c = 0xE6; /* */ - break; - - case 'j': - if ( *s == 'i' ) c = 0xF6; /* */ - break; - - case 'k': - if ( *s == 'k' ) c = 0xF0; /* */ - break; - - case 'M': - switch ( *s ) { - case '.': c = 0xB7; break; /* */ - case '-': c = 0xD0; break; /* */ - case 'T': c = 0xD4; break; /* */ - } - break; - - case 'm': - switch ( *s ) { - case '\'': /* RFC 1345 */ - case ' ': c = -5; break; /* */ - case 'O': c = 0xE0; break; /* */ - } - break; - - case 'n': - if ( *s == '\'' ) c = 0xEF; /* */ - break; - - case 'O': - switch ( *s ) { - case 'D': c = 0xA4; break; /* */ - case 'N': c = 0xD6; break; /* */ - } - break; - - case 'o': - switch ( *s ) { - case 'C': c = 0xD3; break; /* */ - case '-': c = 0xEB; break; /* */ - } - break; - - case 'S': - switch ( *s ) { - case '1': c = 0xD1; break; /* */ - case '2': c = 0xB2; break; /* */ - case '3': c = 0xB3; break; /* */ - case 'N': c = 0xA0; break; /* */ - } - break; - - case 's': - if ( *s == 's' ) c = 0xFB; /* */ - break; - - case 't': - if ( *s == 'C' ) c = 0xA2; /* */ - break; - - case 'u': - if ( *s == 'C' ) c = 0xA8; /* */ - break; - - case 'v': - if ( *s == '-' ) c = 0xAF; /* */ - break; - - case 'X': - if ( *s == '*' ) c = 0xB4; /* */ - break; - - case 'y': - if ( *s == 'M' ) c = 0xB5; /* */ - break; - } - - if ( c > 0 ) { - *o++ = c; - return o; - } else if ( !c ) - return NULL; - - /* else: c < 0 */ - n = -c; - switch ( *s ) { - - case 'A': c = letter_w_diacritic[n][0]; break; - case 'C': c = letter_w_diacritic[n][1]; break; - case 'D': c = letter_w_diacritic[n][2]; break; - case 'E': c = letter_w_diacritic[n][3]; break; - case 'G': c = letter_w_diacritic[n][4]; break; - case 'H': c = letter_w_diacritic[n][5]; break; - case 'I': c = letter_w_diacritic[n][6]; break; - case 'J': c = letter_w_diacritic[n][7]; break; - case 'K': c = letter_w_diacritic[n][8]; break; - case 'L': c = letter_w_diacritic[n][9]; break; - case 'N': c = letter_w_diacritic[n][10]; break; - case 'O': c = letter_w_diacritic[n][11]; break; - case 'R': c = letter_w_diacritic[n][12]; break; - case 'S': c = letter_w_diacritic[n][13]; break; - case 'T': c = letter_w_diacritic[n][14]; break; - case 'U': c = letter_w_diacritic[n][15]; break; - case 'W': c = letter_w_diacritic[n][16]; break; - case 'Y': c = letter_w_diacritic[n][17]; break; - case 'Z': c = letter_w_diacritic[n][18]; break; - - case 'a': c = letter_w_diacritic[n][19]; break; - case 'c': c = letter_w_diacritic[n][20]; break; - case 'd': c = letter_w_diacritic[n][21]; break; - case 'e': c = letter_w_diacritic[n][22]; break; - case 'g': c = letter_w_diacritic[n][23]; break; - case 'h': c = letter_w_diacritic[n][24]; break; - case 'i': c = letter_w_diacritic[n][25]; break; - case 'j': c = letter_w_diacritic[n][26]; break; - case 'k': c = letter_w_diacritic[n][27]; break; - case 'l': c = letter_w_diacritic[n][28]; break; - case 'n': c = letter_w_diacritic[n][29]; break; - case 'o': c = letter_w_diacritic[n][30]; break; - case 'r': c = letter_w_diacritic[n][31]; break; - case 's': c = letter_w_diacritic[n][32]; break; - case 't': c = letter_w_diacritic[n][33]; break; - case 'u': c = letter_w_diacritic[n][34]; break; - case 'w': c = letter_w_diacritic[n][35]; break; - case 'y': c = letter_w_diacritic[n][36]; break; - case 'z': c = letter_w_diacritic[n][37]; break; - - case '\'': - case ' ': c = -1; break; - - default: c = 0; - } - - if ( !c ) - return NULL; - - *o++ = n + 0xC0; - *o++ = ( ( (*s == ' ') || (*s == '\'') ) ? ALONE : *s ); - return o; -} - - -/* --- routine to convert from ISO 8859-n to T.61 --- */ - -int -ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input ) -{ - Byte *s, *oo, *o, *aux; - int c; - unsigned long len; - Couple *cc; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_8859_to_t61 input length: %ld\n", - *buflenp, 0, 0 ); - - len = *buflenp; - s = (Byte *) *bufp; - - if ( (o = oo = (Byte *)NSLDAPI_MALLOC( 2 * len + 64 )) == NULL ) { - return( 1 ); - } - - while ( (char *)s - *(char **)bufp < len ) { - switch( *s >> 5 ) { - - case 2: - switch ( *s ) { - - case '^': *o++ = 0xC3; *o++ = ALONE; s++; break; - - case '\\': - s++; - if ( (c = hh_to_c( s )) != -1 ) { - *o++ = c; - s += 2; - } else - *o++ = '\\'; - break; - - default: *o++ = *s++; - } - break; - - case 3: - switch ( *s ) { - - case '`': *o++ = 0xC1; *o++ = ALONE; s++; break; - case '~': *o++ = 0xC4; *o++ = ALONE; s++; break; - - case '{': - s++; - if ( *(s + 2) == '}' ) { - if ( (aux = cc_to_t61( o, s )) != NULL ) { - o = aux; - s += 3; - } else { - *o++ = '{'; - } - } else if ( (*(s + 3) == '}') && ( (*s == 'x') || (*s == 'X') ) && - ( (c = hh_to_c( s + 1 )) != -1 ) ) { - *o++ = c; - s += 4; - } else { - *o++ = '{'; - } - break; - - default: - *o++ = *s++; - } - break; - -#if (ISO_8859 == 0) - case 4: case 5: case 6: case 7: - s++; - break; -#else - case 5: case 6: case 7: -# if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \ - (ISO_8859 == 4) || (ISO_8859 == 9) || (ISO_8859 == 10) - if ( (*(cc = &trans_iso8859_t61[ *s - 0xA0 ])).a ) { - *o++ = (*cc).a; - if ( (*cc).b ) *o++ = (*cc).b; - } -# endif - s++; - break; -#endif - - default: - *o++ = *s++; - } - } - - len = o - oo; - o = oo; - - if ( (oo = (Byte *)NSLDAPI_REALLOC( o, len )) == NULL ) { - NSLDAPI_FREE( o ); - return( 1 ); - } - - if ( free_input ) { - NSLDAPI_FREE( *bufp ); - } - *bufp = (char *) oo; - *buflenp = len; - return( 0 ); -} - - -#ifdef NOT_NEEDED_IN_LIBLDAP /* mcs@umich.edu 12 Oct 1995 */ -/* --- routine to convert "escaped" (\hh) characters to 8bits --- */ - -void convert_escaped_to_8bit( s ) -char *s; -{ - char *o = s; - int c; - - while ( *s ) { - if ( *s == '\\' ) { - if ( (c = hh_to_c( ++s )) != -1 ) { - *o++ = c; - s += 2; - } else - *o++ = '\\'; - } else - *o++ = *s++; - } - *o = '\0'; -} - -/* --- routine to convert 8bits characters to the "escaped" (\hh) form --- */ - -char *convert_8bit_to_escaped( s ) -Byte *s; -{ - Byte *o, *oo; - Byte n; - - if ( (o = oo = (Byte *)NSLDAPI_MALLOC( 2 * strlen( s ) + 64 )) == NULL ) { - return( NULL ); - } - - while ( *s ) { - if ( *s < 0x80 ) - *o++ = *s++; - else { - *o++ = '\\'; - n = *s >> 4; - *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n; - n = *s++ & 0x0F; - *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n; - } - } - *o = '\0'; - - o = oo; - - if ( (oo = (Byte *)NSLDAPI_REALLOC( o, strlen( o ) + 1 )) == NULL ) { - NSLDAPI_FREE( o ); - return( NULL ); - } - - return( (char *)oo ); -} - -/* --- routine to convert from T.61 to printable characters --- */ - -/* - printable characters [RFC 1488]: 'A'..'Z', 'a'..'z', '0'..'9', - '\'', '(', ')', '+', ',', '-', '.', '/', ':', '?, ' '. - - that conversion is language dependent. -*/ - -static Couple last_t61_printabled[32] = { - {0,0}, {'A','E'}, {'D',0}, {0,0}, - {'H',0}, {0,0}, {'I','J'}, {'L',0}, - {'L',0}, {'O',0}, {'O','E'}, {0,0}, - {'T','H'}, {'T',0}, {'N','G'}, {'n',0}, - {'k',0}, {'a','e'}, {'d',0}, {'d',0}, - {'h',0}, {'i',0}, {'i','j'}, {'l',0}, - {'l',0}, {'o',0}, {'o','e'}, {'s','s'}, - {'t','h'}, {'t',0}, {'n','g'}, {0,0} -}; - -char *t61_printable( s ) -Byte *s; -{ - Byte *o, *oo; - Byte n; - Couple *cc; - - if ( (o = oo = (Byte *)NSLDAPI_MALLOC( 2 * strlen( s ) + 64 )) == NULL ) { - return( NULL ); - } - - while ( *s ) { - if ( ( (*s >= 'A') && (*s <= 'Z') ) || - ( (*s >= 'a') && (*s <= 'z') ) || - ( (*s >= '0') && (*s <= '9') ) || - ( (*s >= '\'') && (*s <= ')') ) || - ( (*s >= '+') && (*s <= '/') ) || - ( *s == '?' ) || ( *s == ' ' ) ) - *o++ = *s++; - else { - if ( *s >= 0xE0 ) { - if ( (*(cc = &last_t61_printabled[ *s - 0xE0 ])).a ) { - *o++ = (*cc).a; - if ( (*cc).b ) *o++ = (*cc).b; - } - } - else if ( (*s >> 4) == 0xC ) { - switch ( *s ) { - case 0xCA: /* ring */ - switch ( *(s + 1) ) { - case 'A': *o++ = 'A'; *o++ = 'A'; s++; break; /* Swedish */ - case 'a': *o++ = 'a'; *o++ = 'a'; s++; break; /* Swedish */ - } - break; - - case 0xC8: /* diaeresis */ - switch ( *(s + 1) ) { - case 'Y': *o++ = 'I'; *o++ = 'J'; s++; break; /* Dutch */ - case 'y': *o++ = 'i'; *o++ = 'j'; s++; break; /* Dutch */ - } - break; - } - } - s++; - } - } - *o = '\0'; - - o = oo; - - if ( (oo = (Byte *)NSLDAPI_REALLOC( o, strlen( o ) + 1 )) == NULL ) { - NSLDAPI_FREE( o ); - return( NULL ); - } - - return( (char *)oo ); -} -#endif /* NOT_NEEDED_IN_LIBLDAP */ /* mcs@umich.edu 12 Oct 1995 */ - -#endif /* LDAP_CHARSET_8859 */ -#endif /* STR_TRANSLATION */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/cldap.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/cldap.c deleted file mode 100644 index 1db2cd3a80c..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/cldap.c +++ /dev/null @@ -1,569 +0,0 @@ -/* - * 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) 1990, 1994 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * cldap.c - synchronous, retrying interface to the cldap protocol - */ - - -#ifdef CLDAP - -XXX not MT-safe XXX - -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990, 1994 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif - -#include -#include -#include -#ifdef macintosh -#include -#include "macos.h" -#else /* macintosh */ -#ifdef DOS -#include "msdos.h" -#else /* DOS */ -#ifdef _WINDOWS -#include -#else /* _WINDOWS */ -#include -#include -#include -#include -#include -#endif /* _WINDOWS */ -#endif /* DOS */ -#endif /* macintosh */ - -#include "ldap-int.h" - -#define DEF_CLDAP_TIMEOUT 3 -#define DEF_CLDAP_TRIES 4 - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK ((unsigned long) 0x7f000001) -#endif - - -struct cldap_retinfo { - int cri_maxtries; - int cri_try; - int cri_useaddr; - long cri_timeout; -}; - -#ifdef NEEDPROTOS -static int add_addr( LDAP *ld, struct sockaddr *sap ); -static int cldap_result( LDAP *ld, int msgid, LDAPMessage **res, - struct cldap_retinfo *crip, char *base ); -static int cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber, - LDAPMessage **res, char *base ); -#else /* NEEDPROTOS */ -static int add_addr(); -static int cldap_result(); -static int cldap_parsemsg(); -#endif /* NEEDPROTOS */ - -/* - * cldap_open - initialize and connect to an ldap server. A magic cookie to - * be used for future communication is returned on success, NULL on failure. - * - * Example: - * LDAP *ld; - * ld = cldap_open( hostname, port ); - */ - -LDAP * -cldap_open( char *host, int port ) -{ - int s; - ldap_x_in_addr_t address; - struct sockaddr_in sock; - struct hostent *hp; - LDAP *ld; - char *p; - int i; - - LDAPDebug( LDAP_DEBUG_TRACE, "cldap_open\n", 0, 0, 0 ); - - if ( port == 0 ) { - port = LDAP_PORT; - } - - if ( (s = socket( AF_INET, SOCK_DGRAM, 0 )) < 0 ) { - return( NULL ); - } - - sock.sin_addr.s_addr = 0; - sock.sin_family = AF_INET; - sock.sin_port = 0; - if ( bind(s, (struct sockaddr *) &sock, sizeof(sock)) < 0) { - close( s ); - return( NULL ); - } - - if (( ld = ldap_init( host, port )) == NULL ) { - close( s ); - return( NULL ); - } - if ( (ld->ld_sbp->sb_fromaddr = (void *)NSLDAPI_CALLOC( 1, - sizeof( struct sockaddr ))) == NULL ) { - NSLDAPI_FREE( ld ); - close( s ); - return( NULL ); - } - ld->ld_sbp->sb_sd = s; - ld->ld_sbp->sb_naddr = 0; - ld->ld_version = LDAP_VERSION; - - sock.sin_family = AF_INET; - sock.sin_port = htons( port ); - - /* - * 'host' may be a space-separated list. - */ - if ( host != NULL ) { - for ( ; host != NULL; host = p ) { - if (( p = strchr( host, ' ' )) != NULL ) { - for (*p++ = '\0'; *p == ' '; p++) { - ; - } - } - - if ( (address = inet_addr( host )) == -1 ) { -/* XXXmcs: need to use DNS callbacks here XXX */ -XXX - if ( (hp = gethostbyname( host )) == NULL ) { - LDAP_SET_ERRNO( ld, EHOSTUNREACH ); - continue; - } - - for ( i = 0; hp->h_addr_list[ i ] != 0; ++i ) { - SAFEMEMCPY( (char *)&sock.sin_addr.s_addr, - (char *)hp->h_addr_list[ i ], - sizeof(sock.sin_addr.s_addr)); - if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) { - close( s ); - NSLDAPI_FREE( ld ); - return( NULL ); - } - } - - } else { - sock.sin_addr.s_addr = address; - if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) { - close( s ); - NSLDAPI_FREE( ld ); - return( NULL ); - } - } - - if ( ld->ld_host == NULL ) { - ld->ld_host = nsldapi_strdup( host ); - } - } - - } else { - address = INADDR_LOOPBACK; - sock.sin_addr.s_addr = htonl( address ); - if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) { - close( s ); - NSLDAPI_FREE( ld ); - return( NULL ); - } - } - - if ( ld->ld_sbp->sb_addrs == NULL - || ( ld->ld_defconn = nsldapi_new_connection( ld, NULL, 1,0,0 )) == NULL ) { - NSLDAPI_FREE( ld ); - return( NULL ); - } - - ld->ld_sbp->sb_useaddr = ld->ld_sbp->sb_addrs[ 0 ]; - cldap_setretryinfo( ld, 0, 0 ); - -#ifdef LDAP_DEBUG - putchar( '\n' ); - for ( i = 0; i < ld->ld_sbp->sb_naddr; ++i ) { - LDAPDebug( LDAP_DEBUG_TRACE, "end of cldap_open address %d is %s\n", - i, inet_ntoa( ((struct sockaddr_in *) - ld->ld_sbp->sb_addrs[ i ])->sin_addr ), 0 ); - } -#endif - - return( ld ); -} - - - -void -cldap_close( LDAP *ld ) -{ - ldap_ld_free( ld, NULL, NULL, 0 ); -} - - -void -cldap_setretryinfo( LDAP *ld, int tries, int timeout ) -{ - ld->ld_cldaptries = ( tries <= 0 ) ? DEF_CLDAP_TRIES : tries; - ld->ld_cldaptimeout = ( timeout <= 0 ) ? DEF_CLDAP_TIMEOUT : timeout; -} - - -int -cldap_search_s( LDAP *ld, char *base, int scope, char *filter, char **attrs, - int attrsonly, LDAPMessage **res, char *logdn ) -{ - int ret, msgid; - struct cldap_retinfo cri; - - *res = NULLMSG; - - (void) memset( &cri, 0, sizeof( cri )); - - if ( logdn != NULL ) { - ld->ld_cldapdn = logdn; - } else if ( ld->ld_cldapdn == NULL ) { - ld->ld_cldapdn = ""; - } - - do { - if ( cri.cri_try != 0 ) { - --ld->ld_msgid; /* use same id as before */ - } - ld->ld_sbp->sb_useaddr = ld->ld_sbp->sb_addrs[ cri.cri_useaddr ]; - - LDAPDebug( LDAP_DEBUG_TRACE, "cldap_search_s try %d (to %s)\n", - cri.cri_try, inet_ntoa( ((struct sockaddr_in *) - ld->ld_sbp->sb_useaddr)->sin_addr ), 0 ); - - if ( (msgid = ldap_search( ld, base, scope, filter, attrs, - attrsonly )) == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } -#ifndef NO_CACHE - if ( ld->ld_cache != NULL && ld->ld_responses != NULL ) { - LDAPDebug( LDAP_DEBUG_TRACE, "cldap_search_s res from cache\n", - 0, 0, 0 ); - *res = ld->ld_responses; - ld->ld_responses = ld->ld_responses->lm_next; - return( ldap_result2error( ld, *res, 0 )); - } -#endif /* NO_CACHE */ - ret = cldap_result( ld, msgid, res, &cri, base ); - } while (ret == -1); - - return( ret ); -} - - -static int -add_addr( LDAP *ld, struct sockaddr *sap ) -{ - struct sockaddr *newsap, **addrs; - - if (( newsap = (struct sockaddr *)NSLDAPI_MALLOC( - sizeof( struct sockaddr ))) == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - - if ( ld->ld_sbp->sb_naddr == 0 ) { - addrs = (struct sockaddr **)NSLDAPI_MALLOC( sizeof(struct sockaddr *)); - } else { - addrs = (struct sockaddr **)NSLDAPI_REALLOC( ld->ld_sbp->sb_addrs, - ( ld->ld_sbp->sb_naddr + 1 ) * sizeof(struct sockaddr *)); - } - - if ( addrs == NULL ) { - NSLDAPI_FREE( newsap ); - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - - SAFEMEMCPY( (char *)newsap, (char *)sap, sizeof( struct sockaddr )); - addrs[ ld->ld_sbp->sb_naddr++ ] = newsap; - ld->ld_sbp->sb_addrs = (void **)addrs; - return( 0 ); -} - - -static int -cldap_result( LDAP *ld, int msgid, LDAPMessage **res, - struct cldap_retinfo *crip, char *base ) -{ - Sockbuf *sb = ld->ld_sbp; - BerElement ber; - char *logdn; - int ret, fromaddr, i; - long id; - struct timeval tv; - - fromaddr = -1; - - if ( crip->cri_try == 0 ) { - crip->cri_maxtries = ld->ld_cldaptries * sb->sb_naddr; - crip->cri_timeout = ld->ld_cldaptimeout; - crip->cri_useaddr = 0; - LDAPDebug( LDAP_DEBUG_TRACE, "cldap_result tries %d timeout %d\n", - ld->ld_cldaptries, ld->ld_cldaptimeout, 0 ); - } - - if ((tv.tv_sec = crip->cri_timeout / sb->sb_naddr) < 1 ) { - tv.tv_sec = 1; - } - tv.tv_usec = 0; - - LDAPDebug( LDAP_DEBUG_TRACE, - "cldap_result waiting up to %d seconds for a response\n", - tv.tv_sec, 0, 0 ); - ber_init_w_nullchar( &ber, 0 ); - nsldapi_set_ber_options( ld, &ber ); - - if ( cldap_getmsg( ld, &tv, &ber ) == -1 ) { - ret = LDAP_GET_LDERRNO( ld, NULL, NULL ); - LDAPDebug( LDAP_DEBUG_TRACE, "cldap_getmsg returned -1 (%d)\n", - ret, 0, 0 ); - } else if ( LDAP_GET_LDERRNO( ld, NULL, NULL ) == LDAP_TIMEOUT ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "cldap_result timed out\n", 0, 0, 0 ); - /* - * It timed out; is it time to give up? - */ - if ( ++crip->cri_try >= crip->cri_maxtries ) { - ret = LDAP_TIMEOUT; - --crip->cri_try; - } else { - if ( ++crip->cri_useaddr >= sb->sb_naddr ) { - /* - * new round: reset address to first one and - * double the timeout - */ - crip->cri_useaddr = 0; - crip->cri_timeout <<= 1; - } - ret = -1; - } - - } else { - /* - * Got a response. It should look like: - * { msgid, logdn, { searchresponse...}} - */ - logdn = NULL; - - if ( ber_scanf( &ber, "ia", &id, &logdn ) == LBER_ERROR ) { - NSLDAPI_FREE( ber.ber_buf ); /* gack! */ - ret = LDAP_DECODING_ERROR; - LDAPDebug( LDAP_DEBUG_TRACE, - "cldap_result: ber_scanf returned LBER_ERROR (%d)\n", - ret, 0, 0 ); - } else if ( id != msgid ) { - NSLDAPI_FREE( ber.ber_buf ); /* gack! */ - LDAPDebug( LDAP_DEBUG_TRACE, - "cldap_result: looking for msgid %d; got %ld\n", - msgid, id, 0 ); - ret = -1; /* ignore and keep looking */ - } else { - /* - * got a result: determine which server it came from - * decode into ldap message chain - */ - for ( fromaddr = 0; fromaddr < sb->sb_naddr; ++fromaddr ) { - if ( memcmp( &((struct sockaddr_in *) - sb->sb_addrs[ fromaddr ])->sin_addr, - &((struct sockaddr_in *)sb->sb_fromaddr)->sin_addr, - sizeof( struct in_addr )) == 0 ) { - break; - } - } - ret = cldap_parsemsg( ld, msgid, &ber, res, base ); - NSLDAPI_FREE( ber.ber_buf ); /* gack! */ - LDAPDebug( LDAP_DEBUG_TRACE, - "cldap_result got result (%d)\n", ret, 0, 0 ); - } - - if ( logdn != NULL ) { - NSLDAPI_FREE( logdn ); - } - } - - - /* - * If we are giving up (successfully or otherwise) then - * abandon any outstanding requests. - */ - if ( ret != -1 ) { - i = crip->cri_try; - if ( i >= sb->sb_naddr ) { - i = sb->sb_naddr - 1; - } - - for ( ; i >= 0; --i ) { - if ( i == fromaddr ) { - continue; - } - sb->sb_useaddr = sb->sb_addrs[ i ]; - LDAPDebug( LDAP_DEBUG_TRACE, "cldap_result abandoning id %d (to %s)\n", - msgid, inet_ntoa( ((struct sockaddr_in *) - sb->sb_useaddr)->sin_addr ), 0 ); - (void) ldap_abandon( ld, msgid ); - } - } - - LDAP_SET_LDERRNO( ld, ret, NULL, NULL ); - return( ret ); -} - - -static int -cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber, - LDAPMessage **res, char *base ) -{ - unsigned long tag, len; - int baselen, slen, rc; - char *dn, *p, *cookie; - LDAPMessage *chain, *prev, *ldm; - struct berval *bv; - - rc = LDAP_DECODING_ERROR; /* pessimistic */ - ldm = chain = prev = NULLMSG; - baselen = ( base == NULL ) ? 0 : strlen( base ); - bv = NULL; - - for ( tag = ber_first_element( ber, &len, &cookie ); - tag != LBER_ERROR && tag != LBER_END_OF_SEQOFSET - && rc != LDAP_SUCCESS; - tag = ber_next_element( ber, &len, cookie )) { - if (( ldm = (LDAPMessage *)NSLDAPI_CALLOC( 1, sizeof(LDAPMessage))) - == NULL ) { - rc = LDAP_NO_MEMORY; - break; /* return with error */ - } else if (( rc = nsldapi_alloc_ber_with_options( ld, &ldm->lm_ber )) - != LDAP_SUCCESS ) { - break; /* return with error*/ - } - ldm->lm_msgid = msgid; - ldm->lm_msgtype = tag; - - if ( tag == LDAP_RES_SEARCH_RESULT ) { - LDAPDebug( LDAP_DEBUG_TRACE, "cldap_parsemsg got search result\n", - 0, 0, 0 ); - - if ( ber_get_stringal( ber, &bv ) == LBER_DEFAULT ) { - break; /* return w/error */ - } - - if ( ber_printf( ldm->lm_ber, "to", tag, bv->bv_val, - (int)bv->bv_len /* XXX lossy cast */ ) == -1 ) { - break; /* return w/error */ - } - ber_bvfree( bv ); - bv = NULL; - rc = LDAP_SUCCESS; - - } else if ( tag == LDAP_RES_SEARCH_ENTRY ) { - if ( ber_scanf( ber, "{aO", &dn, &bv ) == LBER_ERROR ) { - break; /* return w/error */ - } - LDAPDebug( LDAP_DEBUG_TRACE, "cldap_parsemsg entry %s\n", dn, 0, 0 ); - if ( dn != NULL && *(dn + ( slen = strlen(dn)) - 1) == '*' && - baselen > 0 ) { - /* - * substitute original searchbase for trailing '*' - */ - if (( p = (char *)NSLDAPI_MALLOC( slen + baselen )) == NULL ) { - rc = LDAP_NO_MEMORY; - NSLDAPI_FREE( dn ); - break; /* return w/error */ - } - strcpy( p, dn ); - strcpy( p + slen - 1, base ); - NSLDAPI_FREE( dn ); - dn = p; - } - - if ( ber_printf( ldm->lm_ber, "t{so}", tag, dn, bv->bv_val, - (int)bv->bv_len /* XXX lossy cast */ ) == -1 ) { - break; /* return w/error */ - } - NSLDAPI_FREE( dn ); - ber_bvfree( bv ); - bv = NULL; - - } else { - LDAPDebug( LDAP_DEBUG_TRACE, "cldap_parsemsg got unknown tag %d\n", - tag, 0, 0 ); - rc = LDAP_PROTOCOL_ERROR; - break; /* return w/error */ - } - - /* Reset message ber so we can read from it later. Gack! */ - ldm->lm_ber->ber_end = ldm->lm_ber->ber_ptr; - ldm->lm_ber->ber_ptr = ldm->lm_ber->ber_buf; - -#ifdef LDAP_DEBUG - if ( ldap_debug & LDAP_DEBUG_PACKETS ) { - char msg[80]; - sprintf( msg, "cldap_parsemsg add message id %d type %d:\n", - ldm->lm_msgid, ldm->lm_msgtype ); - ber_err_print( msg ); - ber_dump( ldm->lm_ber, 1 ); - } -#endif /* LDAP_DEBUG */ - -#ifndef NO_CACHE - if ( ld->ld_cache != NULL ) { - nsldapi_add_result_to_cache( ld, ldm ); - } -#endif /* NO_CACHE */ - - if ( chain == NULL ) { - chain = ldm; - } else { - prev->lm_chain = ldm; - } - prev = ldm; - ldm = NULL; - } - - /* dispose of any leftovers */ - if ( ldm != NULL ) { - if ( ldm->lm_ber != NULLBER ) { - ber_free( ldm->lm_ber, 1 ); - } - NSLDAPI_FREE( ldm ); - } - if ( bv != NULL ) { - ber_bvfree( bv ); - } - - /* return chain, calling result2error if we got anything at all */ - *res = chain; - return(( *res == NULLMSG ) ? rc : ldap_result2error( ld, *res, 0 )); -} -#endif /* CLDAP */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/compare.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/compare.c deleted file mode 100644 index dbd9abbdf90..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/compare.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * compare.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -/* - * ldap_compare - perform an ldap compare operation. The dn - * of the entry to compare to and the attribute and value to compare (in - * attr and value) are supplied. The msgid of the response is returned. - * - * Example: - * ldap_compare( ld, "c=us@cn=bob", "userPassword", "secret" ) - */ -int -LDAP_CALL -ldap_compare( LDAP *ld, const char *dn, const char *attr, const char *value ) -{ - int msgid; - struct berval bv; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_compare\n", 0, 0, 0 ); - - bv.bv_val = (char *)value; - bv.bv_len = ( value == NULL ) ? 0 : strlen( value ); - - if ( ldap_compare_ext( ld, dn, attr, &bv, NULL, NULL, &msgid ) - == LDAP_SUCCESS ) { - return( msgid ); - } else { - return( -1 ); /* error is in ld handle */ - } -} - -int -LDAP_CALL -ldap_compare_ext( LDAP *ld, const char *dn, const char *attr, - const struct berval *bvalue, LDAPControl **serverctrls, - LDAPControl **clientctrls, int *msgidp ) -{ - BerElement *ber; - int rc, lderr; - - /* The compare request looks like this: - * CompareRequest ::= SEQUENCE { - * entry DistinguishedName, - * ava SEQUENCE { - * type AttributeType, - * value AttributeValue - * } - * } - * and must be wrapped in an LDAPMessage. - */ - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_compare_ext\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - if ( attr == NULL || bvalue == NULL || bvalue->bv_len == 0 - || msgidp == NULL ) { - lderr = LDAP_PARAM_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - return( lderr ); - } - - if ( dn == NULL ) { - dn = ""; - } - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - *msgidp = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - /* check the cache */ - if ( ld->ld_cache_on && ld->ld_cache_compare != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - if ( (rc = (ld->ld_cache_compare)( ld, *msgidp, - LDAP_REQ_COMPARE, dn, attr, bvalue )) != 0 ) { - *msgidp = rc; - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - return( LDAP_SUCCESS ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - } - - /* create a message to send */ - if (( lderr = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( lderr ); - } - - if ( ber_printf( ber, "{it{s{so}}", *msgidp, LDAP_REQ_COMPARE, dn, - attr, bvalue->bv_val, (int)bvalue->bv_len /* XXX lossy cast */ ) - == -1 ) { - lderr = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - ber_free( ber, 1 ); - return( lderr ); - } - - if (( lderr = nsldapi_put_controls( ld, serverctrls, 1, ber )) - != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( lderr ); - } - - /* send the message */ - rc = nsldapi_send_initial_request( ld, *msgidp, LDAP_REQ_COMPARE, - (char *)dn, ber ); - *msgidp = rc; - return( rc < 0 ? LDAP_GET_LDERRNO( ld, NULL, NULL ) : LDAP_SUCCESS ); -} - -int -LDAP_CALL -ldap_compare_s( LDAP *ld, const char *dn, const char *attr, - const char *value ) -{ - struct berval bv; - - bv.bv_val = (char *)value; - bv.bv_len = ( value == NULL ) ? 0 : strlen( value ); - - return( ldap_compare_ext_s( ld, dn, attr, &bv, NULL, NULL )); -} - -int -LDAP_CALL -ldap_compare_ext_s( LDAP *ld, const char *dn, const char *attr, - const struct berval *bvalue, LDAPControl **serverctrls, - LDAPControl **clientctrls ) -{ - int err, msgid; - LDAPMessage *res; - - if (( err = ldap_compare_ext( ld, dn, attr, bvalue, serverctrls, - clientctrls, &msgid )) != LDAP_SUCCESS ) { - return( err ); - } - - if ( ldap_result( ld, msgid, 1, (struct timeval *)NULL, &res ) - == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - return( ldap_result2error( ld, res, 1 ) ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/compat.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/compat.c deleted file mode 100644 index 9055903e3ae..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/compat.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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) 1994 The Regents of the University of Michigan. - * All rights reserved. - */ -/* - * compat.c - compatibility routines. - * - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1994 The Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -#ifdef notdef -#if defined( HPUX10 ) && defined( _REENTRANT ) -extern int h_errno; - -struct hostent * -nsldapi_compat_gethostbyname_r( const char *name, struct hostent *result, - char *buffer, int buflen, int *h_errnop ) -{ - struct hostent_data *hep; - - if ( buflen < sizeof(struct hostent_data)) { /* sanity check */ - *h_errnop = NO_RECOVERY; /* XXX best error code to use? */ - return( NULL ); - } - - hep = (struct hostent_data *)buffer; - hep->current = NULL; - - if ( gethostbyname_r( name, result, hep ) == -1) { - *h_errnop = h_errno; /* XXX don't see anywhere else to get this */ - return NULL; - } - return result; -} - -char * -nsldapi_compat_ctime_r( const time_t *clock, char *buf, int buflen ) -{ - NSLDAPI_CTIME1( clock, buf, buflen ); - return buf; -} -#endif /* HPUX10 && _REENTRANT */ -#endif diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/control.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/control.c deleted file mode 100644 index 8d4963524c8..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/control.c +++ /dev/null @@ -1,493 +0,0 @@ -/* - * 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): - */ -/* control.c - routines to handle ldapv3 controls */ - -#include "ldap-int.h" - -static LDAPControl *ldap_control_dup( LDAPControl *ctrl ); -static int ldap_control_copy_contents( LDAPControl *ctrl_dst, - LDAPControl *ctrl_src ); - -/* - * Append a list of LDAPv3 controls to ber. If ctrls is NULL, use default - * set of controls from ld. - * Return an LDAP error code (LDAP_SUCCESS if all goes well). - * If closeseq is non-zero, we do an extra ber_put_seq() as well. - */ -int -nsldapi_put_controls( LDAP *ld, LDAPControl **ctrls, int closeseq, - BerElement *ber ) -{ - LDAPControl *c; - int rc, i; - - rc = LDAP_ENCODING_ERROR; /* the most popular error */ - - /* if no controls were passed in, use global list from LDAP * */ - LDAP_MUTEX_LOCK( ld, LDAP_CTRL_LOCK ); - if ( ctrls == NULL ) { - ctrls = ld->ld_servercontrols; - } - - /* if there are no controls then we are done */ - if ( ctrls == NULL || ctrls[ 0 ] == NULL ) { - goto clean_exit; - } - - /* - * If we're using LDAPv2 or earlier we can't send any controls, so - * we just ignore them unless one is marked critical, in which case - * we return an error. - */ - if ( NSLDAPI_LDAP_VERSION( ld ) < LDAP_VERSION3 ) { - for ( i = 0; ctrls != NULL && ctrls[i] != NULL; i++ ) { - if ( ctrls[i]->ldctl_iscritical ) { - rc = LDAP_NOT_SUPPORTED; - goto error_exit; - } - } - goto clean_exit; - } - - /* - * encode the controls as a Sequence of Sequence - */ - if ( ber_printf( ber, "t{", LDAP_TAG_CONTROLS ) == -1 ) { - goto error_exit; - } - - for ( i = 0; ctrls[i] != NULL; i++ ) { - c = ctrls[i]; - - if ( ber_printf( ber, "{s", c->ldctl_oid ) == -1 ) { - goto error_exit; - } - - /* criticality is "BOOLEAN DEFAULT FALSE" */ - /* therefore, it should only be encoded if it exists AND is TRUE */ - if ( c->ldctl_iscritical ) { - if ( ber_printf( ber, "b", (int)c->ldctl_iscritical ) - == -1 ) { - goto error_exit; - } - } - - if ( c->ldctl_value.bv_val != NULL ) { - if ( ber_printf( ber, "o", c->ldctl_value.bv_val, - (int)c->ldctl_value.bv_len /* XXX lossy cast */ ) - == -1 ) { - goto error_exit; - } - } - - if ( ber_put_seq( ber ) == -1 ) { - goto error_exit; - } - } - - if ( ber_put_seq( ber ) == -1 ) { - goto error_exit; - } - -clean_exit: - LDAP_MUTEX_UNLOCK( ld, LDAP_CTRL_LOCK ); - if ( closeseq && ber_put_seq( ber ) == -1 ) { - goto error_exit; - } - return( LDAP_SUCCESS ); - -error_exit: - LDAP_MUTEX_UNLOCK( ld, LDAP_CTRL_LOCK ); - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); -} - - -/* - * Pull controls out of "ber" (if any present) and return them in "controlsp." - * Returns an LDAP error code. - */ -int -nsldapi_get_controls( BerElement *ber, LDAPControl ***controlsp ) -{ - LDAPControl *newctrl; - unsigned long tag, len; - int rc, maxcontrols, curcontrols; - char *last; - - /* - * Each LDAPMessage can have a set of controls appended - * to it. Controls are used to extend the functionality - * of an LDAP operation (e.g., add an attribute size limit - * to the search operation). These controls look like this: - * - * Controls ::= SEQUENCE OF Control - * - * Control ::= SEQUENCE { - * controlType LDAPOID, - * criticality BOOLEAN DEFAULT FALSE, - * controlValue OCTET STRING - * } - */ - LDAPDebug( LDAP_DEBUG_TRACE, "=> nsldapi_get_controls\n", 0, 0, 0 ); - - *controlsp = NULL; - - /* - * check to see if controls were included - */ - if ( ber_get_option( ber, LBER_OPT_REMAINING_BYTES, &len ) != 0 ) { - return( LDAP_DECODING_ERROR ); /* unexpected error */ - } - if ( len == 0 ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "<= nsldapi_get_controls no controls\n", 0, 0, 0 ); - return( LDAP_SUCCESS ); /* no controls */ - } - if (( tag = ber_peek_tag( ber, &len )) != LDAP_TAG_CONTROLS ) { - if ( tag == LBER_ERROR ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "<= nsldapi_get_controls LDAP_PROTOCOL_ERROR\n", - 0, 0, 0 ); - return( LDAP_DECODING_ERROR ); /* decoding error */ - } - /* - * We found something other than controls. This should never - * happen in LDAPv3, but we don't treat this is a hard error -- - * we just ignore the extra stuff. - */ - LDAPDebug( LDAP_DEBUG_TRACE, - "<= nsldapi_get_controls ignoring unrecognized data in message (tag 0x%x)\n", - tag, 0, 0 ); - return( LDAP_SUCCESS ); - } - - maxcontrols = curcontrols = 0; - for ( tag = ber_first_element( ber, &len, &last ); - tag != LBER_ERROR && tag != LBER_END_OF_SEQORSET; - tag = ber_next_element( ber, &len, last ) ) { - if ( curcontrols >= maxcontrols - 1 ) { -#define CONTROL_GRABSIZE 5 - maxcontrols += CONTROL_GRABSIZE; - *controlsp = (struct ldapcontrol **)NSLDAPI_REALLOC( - (char *)*controlsp, maxcontrols * - sizeof(struct ldapcontrol *) ); - if ( *controlsp == NULL ) { - rc = LDAP_NO_MEMORY; - goto free_and_return; - } - } - if (( newctrl = (struct ldapcontrol *)NSLDAPI_CALLOC( 1, - sizeof(LDAPControl))) == NULL ) { - rc = LDAP_NO_MEMORY; - goto free_and_return; - } - - (*controlsp)[curcontrols++] = newctrl; - (*controlsp)[curcontrols] = NULL; - - if ( ber_scanf( ber, "{a", &newctrl->ldctl_oid ) - == LBER_ERROR ) { - rc = LDAP_DECODING_ERROR; - goto free_and_return; - } - - /* the criticality is optional */ - if ( ber_peek_tag( ber, &len ) == LBER_BOOLEAN ) { - int aint; - - if ( ber_scanf( ber, "b", &aint ) == LBER_ERROR ) { - rc = LDAP_DECODING_ERROR; - goto free_and_return; - } - newctrl->ldctl_iscritical = (char)aint; /* XXX lossy cast */ - } else { - /* absent is synonomous with FALSE */ - newctrl->ldctl_iscritical = 0; - } - - /* the control value is optional */ - if ( ber_peek_tag( ber, &len ) == LBER_OCTETSTRING ) { - if ( ber_scanf( ber, "o", &newctrl->ldctl_value ) - == LBER_ERROR ) { - rc = LDAP_DECODING_ERROR; - goto free_and_return; - } - } else { - (newctrl->ldctl_value).bv_val = NULL; - (newctrl->ldctl_value).bv_len = 0; - } - - } - - if ( tag == LBER_ERROR ) { - rc = LDAP_DECODING_ERROR; - goto free_and_return; - } - - LDAPDebug( LDAP_DEBUG_TRACE, - "<= nsldapi_get_controls found %d controls\n", curcontrols, 0, 0 ); - return( LDAP_SUCCESS ); - -free_and_return:; - ldap_controls_free( *controlsp ); - *controlsp = NULL; - LDAPDebug( LDAP_DEBUG_TRACE, - "<= nsldapi_get_controls error 0x%x\n", rc, 0, 0 ); - return( rc ); -} - - -void -LDAP_CALL -ldap_control_free( LDAPControl *ctrl ) -{ - if ( ctrl != NULL ) { - if ( ctrl->ldctl_oid != NULL ) { - NSLDAPI_FREE( ctrl->ldctl_oid ); - } - if ( ctrl->ldctl_value.bv_val != NULL ) { - NSLDAPI_FREE( ctrl->ldctl_value.bv_val ); - } - NSLDAPI_FREE( (char *)ctrl ); - } -} - - -void -LDAP_CALL -ldap_controls_free( LDAPControl **ctrls ) -{ - int i; - - if ( ctrls != NULL ) { - for ( i = 0; ctrls[i] != NULL; i++ ) { - ldap_control_free( ctrls[i] ); - } - NSLDAPI_FREE( (char *)ctrls ); - } -} - - - -#if 0 -LDAPControl ** -LDAP_CALL -ldap_control_append( LDAPControl **ctrl_src, LDAPControl *ctrl ) -{ - int nctrls = 0; - LDAPControl **ctrlp; - int i; - - if ( NULL == ctrl ) - return ( NULL ); - - /* Count the existing controls */ - if ( NULL != ctrl_src ) { - while( NULL != ctrl_src[nctrls] ) { - nctrls++; - } - } - - /* allocate the new control structure */ - if ( ( ctrlp = (LDAPControl **)NSLDAPI_MALLOC( sizeof(LDAPControl *) - * (nctrls + 2) ) ) == NULL ) { - return( NULL ); - } - memset( ctrlp, 0, sizeof(*ctrlp) * (nctrls + 2) ); - - for( i = 0; i < (nctrls + 1); i++ ) { - if ( i < nctrls ) { - ctrlp[i] = ldap_control_dup( ctrl_src[i] ); - } else { - ctrlp[i] = ldap_control_dup( ctrl ); - } - if ( NULL == ctrlp[i] ) { - ldap_controls_free( ctrlp ); - return( NULL ); - } - } - return ctrlp; -} -#endif /* 0 */ - - -/* - * Replace *ldctrls with a copy of newctrls. - * returns 0 if successful. - * return -1 if not and set error code inside LDAP *ld. - */ -int -nsldapi_dup_controls( LDAP *ld, LDAPControl ***ldctrls, LDAPControl **newctrls ) -{ - int count; - - if ( *ldctrls != NULL ) { - ldap_controls_free( *ldctrls ); - } - - if ( newctrls == NULL || newctrls[0] == NULL ) { - *ldctrls = NULL; - return( 0 ); - } - - for ( count = 0; newctrls[ count ] != NULL; ++count ) { - ; - } - - if (( *ldctrls = (LDAPControl **)NSLDAPI_MALLOC(( count + 1 ) * - sizeof( LDAPControl *))) == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - (*ldctrls)[ count ] = NULL; - - for ( count = 0; newctrls[ count ] != NULL; ++count ) { - if (( (*ldctrls)[ count ] = - ldap_control_dup( newctrls[ count ] )) == NULL ) { - ldap_controls_free( *ldctrls ); - *ldctrls = NULL; - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - } - - return( 0 ); -} - - -/* - * return a malloc'd copy of "ctrl" (NULL if memory allocation fails) - */ -static LDAPControl * -/* LDAP_CALL */ /* keep this routine internal for now */ -ldap_control_dup( LDAPControl *ctrl ) -{ - LDAPControl *rctrl; - - if (( rctrl = (LDAPControl *)NSLDAPI_MALLOC( sizeof( LDAPControl ))) - == NULL ) { - return( NULL ); - } - - if ( ldap_control_copy_contents( rctrl, ctrl ) != LDAP_SUCCESS ) { - NSLDAPI_FREE( rctrl ); - return( NULL ); - } - - return( rctrl ); -} - - -/* - * duplicate the contents of "ctrl_src" and place in "ctrl_dst" - */ -static int -/* LDAP_CALL */ /* keep this routine internal for now */ -ldap_control_copy_contents( LDAPControl *ctrl_dst, LDAPControl *ctrl_src ) -{ - size_t len; - - if ( NULL == ctrl_dst || NULL == ctrl_src ) { - return( LDAP_PARAM_ERROR ); - } - - ctrl_dst->ldctl_iscritical = ctrl_src->ldctl_iscritical; - - /* fill in the fields of this new control */ - if (( ctrl_dst->ldctl_oid = nsldapi_strdup( ctrl_src->ldctl_oid )) - == NULL ) { - return( LDAP_NO_MEMORY ); - } - - len = (size_t)(ctrl_src->ldctl_value).bv_len; - if ( ctrl_src->ldctl_value.bv_val == NULL || len <= 0 ) { - ctrl_dst->ldctl_value.bv_len = 0; - ctrl_dst->ldctl_value.bv_val = NULL; - } else { - ctrl_dst->ldctl_value.bv_len = len; - if (( ctrl_dst->ldctl_value.bv_val = NSLDAPI_MALLOC( len )) - == NULL ) { - NSLDAPI_FREE( ctrl_dst->ldctl_oid ); - return( LDAP_NO_MEMORY ); - } - SAFEMEMCPY( ctrl_dst->ldctl_value.bv_val, - ctrl_src->ldctl_value.bv_val, len ); - } - - return ( LDAP_SUCCESS ); -} - - - -/* - * build an allocated LDAPv3 control. Returns an LDAP error code. - */ -int -nsldapi_build_control( char *oid, BerElement *ber, int freeber, char iscritical, - LDAPControl **ctrlp ) -{ - int rc; - struct berval *bvp; - - if ( ber == NULL ) { - bvp = NULL; - } else { - /* allocate struct berval with contents of the BER encoding */ - rc = ber_flatten( ber, &bvp ); - if ( freeber ) { - ber_free( ber, 1 ); - } - if ( rc == -1 ) { - return( LDAP_NO_MEMORY ); - } - } - - /* allocate the new control structure */ - if (( *ctrlp = (LDAPControl *)NSLDAPI_MALLOC( sizeof(LDAPControl))) - == NULL ) { - if ( bvp != NULL ) { - ber_bvfree( bvp ); - } - return( LDAP_NO_MEMORY ); - } - - /* fill in the fields of this new control */ - (*ctrlp)->ldctl_iscritical = iscritical; - if (( (*ctrlp)->ldctl_oid = nsldapi_strdup( oid )) == NULL ) { - NSLDAPI_FREE( *ctrlp ); - if ( bvp != NULL ) { - ber_bvfree( bvp ); - } - return( LDAP_NO_MEMORY ); - } - - if ( bvp == NULL ) { - (*ctrlp)->ldctl_value.bv_len = 0; - (*ctrlp)->ldctl_value.bv_val = NULL; - } else { - (*ctrlp)->ldctl_value = *bvp; /* struct copy */ - NSLDAPI_FREE( bvp ); /* free container, not contents! */ - } - - return( LDAP_SUCCESS ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/countvalues.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/countvalues.c deleted file mode 100644 index c3da12e343e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/countvalues.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * countvalues.c - */ - -#include "ldap-int.h" - -int -LDAP_CALL -ldap_count_values( char **vals ) -{ - int i; - - if ( vals == NULL ) - return( 0 ); - - for ( i = 0; vals[i] != NULL; i++ ) - ; /* NULL */ - - return( i ); -} - -int -LDAP_CALL -ldap_count_values_len( struct berval **vals ) -{ - return( ldap_count_values( (char **) vals ) ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/delete.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/delete.c deleted file mode 100644 index 7bf20093666..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/delete.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -/* - * ldap_delete - initiate an ldap delete operation. Parameters: - * - * ld LDAP descriptor - * dn DN of the object to delete - * - * Example: - * msgid = ldap_delete( ld, dn ); - */ -int -LDAP_CALL -ldap_delete( LDAP *ld, const char *dn ) -{ - int msgid; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 ); - - if ( ldap_delete_ext( ld, dn, NULL, NULL, &msgid ) == LDAP_SUCCESS ) { - return( msgid ); - } else { - return( -1 ); /* error is in ld handle */ - } -} - -int -LDAP_CALL -ldap_delete_ext( LDAP *ld, const char *dn, LDAPControl **serverctrls, - LDAPControl **clientctrls, int *msgidp ) -{ - BerElement *ber; - int rc, lderr; - - /* - * A delete request looks like this: - * DelRequet ::= DistinguishedName, - */ - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_delete_ext\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( !NSLDAPI_VALID_LDAPMESSAGE_POINTER( msgidp )) - { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - if ( dn == NULL ) { - dn = ""; - } - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - *msgidp = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - /* see if we should add to the cache */ - if ( ld->ld_cache_on && ld->ld_cache_delete != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - if ( (rc = (ld->ld_cache_delete)( ld, *msgidp, LDAP_REQ_DELETE, - dn )) != 0 ) { - *msgidp = rc; - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - return( LDAP_SUCCESS ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - } - - /* create a message to send */ - if (( lderr = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( lderr ); - } - - if ( ber_printf( ber, "{its", *msgidp, LDAP_REQ_DELETE, dn ) - == -1 ) { - lderr = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - ber_free( ber, 1 ); - return( lderr ); - } - - if (( lderr = nsldapi_put_controls( ld, serverctrls, 1, ber )) - != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( lderr ); - } - - /* send the message */ - rc = nsldapi_send_initial_request( ld, *msgidp, LDAP_REQ_DELETE, - (char *)dn, ber ); - *msgidp = rc; - return( rc < 0 ? LDAP_GET_LDERRNO( ld, NULL, NULL ) : LDAP_SUCCESS ); -} - -int -LDAP_CALL -ldap_delete_s( LDAP *ld, const char *dn ) -{ - return( ldap_delete_ext_s( ld, dn, NULL, NULL )); -} - -int -LDAP_CALL -ldap_delete_ext_s( LDAP *ld, const char *dn, LDAPControl **serverctrls, - LDAPControl **clientctrls ) -{ - int err, msgid; - LDAPMessage *res; - - if (( err = ldap_delete_ext( ld, dn, serverctrls, clientctrls, - &msgid )) != LDAP_SUCCESS ) { - return( err ); - } - - if ( ldap_result( ld, msgid, 1, (struct timeval *)NULL, &res ) == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - return( ldap_result2error( ld, res, 1 ) ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/disptmpl.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/disptmpl.c deleted file mode 100644 index bbcd656b9d1..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/disptmpl.c +++ /dev/null @@ -1,757 +0,0 @@ -/* - * 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) 1993, 1994 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ -/* - * disptmpl.c: display template library routines for LDAP clients - */ - -#include "ldap-int.h" -#include "disptmpl.h" - -static void free_disptmpl( struct ldap_disptmpl *tmpl ); -static int read_next_tmpl( char **bufp, long *blenp, - struct ldap_disptmpl **tmplp, int dtversion ); -int nsldapi_next_line_tokens( char **bufp, long *blenp, char ***toksp ); -void nsldapi_free_strarray( char **sap ); - -static char *tmploptions[] = { - "addable", "modrdn", - "altview", - NULL -}; - - -static unsigned long tmploptvals[] = { - LDAP_DTMPL_OPT_ADDABLE, LDAP_DTMPL_OPT_ALLOWMODRDN, - LDAP_DTMPL_OPT_ALTVIEW, -}; - - -static char *itemtypes[] = { - "cis", "mls", "dn", - "bool", "jpeg", "jpegbtn", - "fax", "faxbtn", "audiobtn", - "time", "date", "url", - "searchact", "linkact", "adddnact", - "addact", "verifyact", "mail", - NULL -}; - -static unsigned long itemsynids[] = { - LDAP_SYN_CASEIGNORESTR, LDAP_SYN_MULTILINESTR, LDAP_SYN_DN, - LDAP_SYN_BOOLEAN, LDAP_SYN_JPEGIMAGE, LDAP_SYN_JPEGBUTTON, - LDAP_SYN_FAXIMAGE, LDAP_SYN_FAXBUTTON, LDAP_SYN_AUDIOBUTTON, - LDAP_SYN_TIME, LDAP_SYN_DATE, LDAP_SYN_LABELEDURL, - LDAP_SYN_SEARCHACTION, LDAP_SYN_LINKACTION, LDAP_SYN_ADDDNACTION, - LDAP_SYN_ADDDNACTION, LDAP_SYN_VERIFYDNACTION,LDAP_SYN_RFC822ADDR, -}; - - -static char *itemoptions[] = { - "ro", "sort", - "1val", "hide", - "required", "hideiffalse", - NULL -}; - - -static unsigned long itemoptvals[] = { - LDAP_DITEM_OPT_READONLY, LDAP_DITEM_OPT_SORTVALUES, - LDAP_DITEM_OPT_SINGLEVALUED, LDAP_DITEM_OPT_HIDEIFEMPTY, - LDAP_DITEM_OPT_VALUEREQUIRED, LDAP_DITEM_OPT_HIDEIFFALSE, -}; - - -#define ADDEF_CONSTANT "constant" -#define ADDEF_ADDERSDN "addersdn" - - -int -LDAP_CALL -ldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp ) -{ - FILE *fp; - char *buf; - long rlen, len; - int rc, eof; - - *tmpllistp = NULLDISPTMPL; - - if (( fp = fopen( file, "r" )) == NULL ) { - return( LDAP_TMPL_ERR_FILE ); - } - - if ( fseek( fp, 0L, SEEK_END ) != 0 ) { /* move to end to get len */ - fclose( fp ); - return( LDAP_TMPL_ERR_FILE ); - } - - len = ftell( fp ); - - if ( fseek( fp, 0L, SEEK_SET ) != 0 ) { /* back to start of file */ - fclose( fp ); - return( LDAP_TMPL_ERR_FILE ); - } - - if (( buf = NSLDAPI_MALLOC( (size_t)len )) == NULL ) { - fclose( fp ); - return( LDAP_TMPL_ERR_MEM ); - } - - rlen = fread( buf, 1, (size_t)len, fp ); - eof = feof( fp ); - fclose( fp ); - - if ( rlen != len && !eof ) { /* error: didn't get the whole file */ - NSLDAPI_FREE( buf ); - return( LDAP_TMPL_ERR_FILE ); - } - - rc = ldap_init_templates_buf( buf, rlen, tmpllistp ); - NSLDAPI_FREE( buf ); - - return( rc ); -} - - -int -LDAP_CALL -ldap_init_templates_buf( char *buf, long buflen, - struct ldap_disptmpl **tmpllistp ) -{ - int rc = 0, version; - char **toks; - struct ldap_disptmpl *prevtmpl, *tmpl; - - *tmpllistp = prevtmpl = NULLDISPTMPL; - - if ( nsldapi_next_line_tokens( &buf, &buflen, &toks ) != 2 || - strcasecmp( toks[ 0 ], "version" ) != 0 ) { - nsldapi_free_strarray( toks ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - version = atoi( toks[ 1 ] ); - nsldapi_free_strarray( toks ); - if ( version != LDAP_TEMPLATE_VERSION ) { - return( LDAP_TMPL_ERR_VERSION ); - } - - while ( buflen > 0 && ( rc = read_next_tmpl( &buf, &buflen, &tmpl, - version )) == 0 && tmpl != NULLDISPTMPL ) { - if ( prevtmpl == NULLDISPTMPL ) { - *tmpllistp = tmpl; - } else { - prevtmpl->dt_next = tmpl; - } - prevtmpl = tmpl; - } - - if ( rc != 0 ) { - ldap_free_templates( *tmpllistp ); - } - - return( rc ); -} - - - -void -LDAP_CALL -ldap_free_templates( struct ldap_disptmpl *tmpllist ) -{ - struct ldap_disptmpl *tp, *nexttp; - - if ( tmpllist != NULL ) { - for ( tp = tmpllist; tp != NULL; tp = nexttp ) { - nexttp = tp->dt_next; - free_disptmpl( tp ); - } - } -} - - -static void -free_disptmpl( struct ldap_disptmpl *tmpl ) -{ - if ( tmpl != NULL ) { - if ( tmpl->dt_name != NULL ) { - NSLDAPI_FREE( tmpl->dt_name ); - } - - if ( tmpl->dt_pluralname != NULL ) { - NSLDAPI_FREE( tmpl->dt_pluralname ); - } - - if ( tmpl->dt_iconname != NULL ) { - NSLDAPI_FREE( tmpl->dt_iconname ); - } - - if ( tmpl->dt_authattrname != NULL ) { - NSLDAPI_FREE( tmpl->dt_authattrname ); - } - - if ( tmpl->dt_defrdnattrname != NULL ) { - NSLDAPI_FREE( tmpl->dt_defrdnattrname ); - } - - if ( tmpl->dt_defaddlocation != NULL ) { - NSLDAPI_FREE( tmpl->dt_defaddlocation ); - } - - if ( tmpl->dt_oclist != NULL ) { - struct ldap_oclist *ocp, *nextocp; - - for ( ocp = tmpl->dt_oclist; ocp != NULL; ocp = nextocp ) { - nextocp = ocp->oc_next; - nsldapi_free_strarray( ocp->oc_objclasses ); - NSLDAPI_FREE( ocp ); - } - } - - if ( tmpl->dt_adddeflist != NULL ) { - struct ldap_adddeflist *adp, *nextadp; - - for ( adp = tmpl->dt_adddeflist; adp != NULL; adp = nextadp ) { - nextadp = adp->ad_next; - if( adp->ad_attrname != NULL ) { - NSLDAPI_FREE( adp->ad_attrname ); - } - if( adp->ad_value != NULL ) { - NSLDAPI_FREE( adp->ad_value ); - } - NSLDAPI_FREE( adp ); - } - } - - if ( tmpl->dt_items != NULL ) { - struct ldap_tmplitem *rowp, *nextrowp, *colp, *nextcolp; - - for ( rowp = tmpl->dt_items; rowp != NULL; rowp = nextrowp ) { - nextrowp = rowp->ti_next_in_col; - for ( colp = rowp; colp != NULL; colp = nextcolp ) { - nextcolp = colp->ti_next_in_row; - if ( colp->ti_attrname != NULL ) { - NSLDAPI_FREE( colp->ti_attrname ); - } - if ( colp->ti_label != NULL ) { - NSLDAPI_FREE( colp->ti_label ); - } - if ( colp->ti_args != NULL ) { - nsldapi_free_strarray( colp->ti_args ); - } - NSLDAPI_FREE( colp ); - } - } - } - - NSLDAPI_FREE( tmpl ); - } -} - - -struct ldap_disptmpl * -LDAP_CALL -ldap_first_disptmpl( struct ldap_disptmpl *tmpllist ) -{ - return( tmpllist ); -} - - -struct ldap_disptmpl * -LDAP_CALL -ldap_next_disptmpl( struct ldap_disptmpl *tmpllist, - struct ldap_disptmpl *tmpl ) -{ - return( tmpl == NULLDISPTMPL ? tmpl : tmpl->dt_next ); -} - - -struct ldap_disptmpl * -LDAP_CALL -ldap_name2template( char *name, struct ldap_disptmpl *tmpllist ) -{ - struct ldap_disptmpl *dtp; - - for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULLDISPTMPL; - dtp = ldap_next_disptmpl( tmpllist, dtp )) { - if ( strcasecmp( name, dtp->dt_name ) == 0 ) { - return( dtp ); - } - } - - return( NULLDISPTMPL ); -} - - -struct ldap_disptmpl * -LDAP_CALL -ldap_oc2template( char **oclist, struct ldap_disptmpl *tmpllist ) -{ - struct ldap_disptmpl *dtp; - struct ldap_oclist *oclp; - int i, j, needcnt, matchcnt; - - if ( tmpllist == NULL || oclist == NULL || oclist[ 0 ] == NULL ) { - return( NULLDISPTMPL ); - } - - for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULLDISPTMPL; - dtp = ldap_next_disptmpl( tmpllist, dtp )) { - for ( oclp = dtp->dt_oclist; oclp != NULLOCLIST; - oclp = oclp->oc_next ) { - needcnt = matchcnt = 0; - for ( i = 0; oclp->oc_objclasses[ i ] != NULL; ++i ) { - for ( j = 0; oclist[ j ] != NULL; ++j ) { - if ( strcasecmp( oclist[ j ], oclp->oc_objclasses[ i ] ) - == 0 ) { - ++matchcnt; - } - } - ++needcnt; - } - - if ( matchcnt == needcnt ) { - return( dtp ); - } - } - } - - return( NULLDISPTMPL ); -} - - -struct ldap_tmplitem * -LDAP_CALL -ldap_first_tmplrow( struct ldap_disptmpl *tmpl ) -{ - return( tmpl->dt_items ); -} - - -struct ldap_tmplitem * -LDAP_CALL -ldap_next_tmplrow( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row ) -{ - return( row == NULLTMPLITEM ? row : row->ti_next_in_col ); -} - - -struct ldap_tmplitem * -LDAP_CALL -ldap_first_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row ) -{ - return( row ); -} - - -struct ldap_tmplitem * -LDAP_CALL -ldap_next_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row, - struct ldap_tmplitem *col ) -{ - return( col == NULLTMPLITEM ? col : col->ti_next_in_row ); -} - - -char ** -LDAP_CALL -ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, - int exclude, unsigned long syntaxmask ) -{ -/* - * this routine should filter out duplicate attributes... - */ - struct ldap_tmplitem *tirowp, *ticolp; - int i, attrcnt, memerr; - char **attrs; - - attrcnt = 0; - memerr = 0; - - if (( attrs = (char **)NSLDAPI_MALLOC( sizeof( char * ))) == NULL ) { - return( NULL ); - } - - if ( includeattrs != NULL ) { - for ( i = 0; !memerr && includeattrs[ i ] != NULL; ++i ) { - if (( attrs = (char **)NSLDAPI_REALLOC( attrs, ( attrcnt + 2 ) * - sizeof( char * ))) == NULL || ( attrs[ attrcnt++ ] = - nsldapi_strdup( includeattrs[ i ] )) == NULL ) { - memerr = 1; - } else { - attrs[ attrcnt ] = NULL; - } - } - } - - for ( tirowp = ldap_first_tmplrow( tmpl ); - !memerr && tirowp != NULLTMPLITEM; - tirowp = ldap_next_tmplrow( tmpl, tirowp )) { - for ( ticolp = ldap_first_tmplcol( tmpl, tirowp ); - ticolp != NULLTMPLITEM; - ticolp = ldap_next_tmplcol( tmpl, tirowp, ticolp )) { - - if ( syntaxmask != 0 ) { - if (( exclude && - ( syntaxmask & ticolp->ti_syntaxid ) != 0 ) || - ( !exclude && - ( syntaxmask & ticolp->ti_syntaxid ) == 0 )) { - continue; - } - } - - if ( ticolp->ti_attrname != NULL ) { - if (( attrs = (char **)NSLDAPI_REALLOC( attrs, ( attrcnt + 2 ) - * sizeof( char * ))) == NULL || ( attrs[ attrcnt++ ] = - nsldapi_strdup( ticolp->ti_attrname )) == NULL ) { - memerr = 1; - } else { - attrs[ attrcnt ] = NULL; - } - } - } - } - - if ( memerr || attrcnt == 0 ) { - for ( i = 0; i < attrcnt; ++i ) { - if ( attrs[ i ] != NULL ) { - NSLDAPI_FREE( attrs[ i ] ); - } - } - - NSLDAPI_FREE( (char *)attrs ); - return( NULL ); - } - - return( attrs ); -} - - -static int -read_next_tmpl( char **bufp, long *blenp, struct ldap_disptmpl **tmplp, - int dtversion ) -{ - int i, j, tokcnt, samerow, adsource; - char **toks, *itemopts; - struct ldap_disptmpl *tmpl = NULL; - struct ldap_oclist *ocp = NULL, *prevocp = NULL; - struct ldap_adddeflist *adp = NULL, *prevadp = NULL; - struct ldap_tmplitem *rowp = NULL, *ip = NULL, *previp = NULL; - - /* - * template name comes first - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - return( tokcnt == 0 ? 0 : LDAP_TMPL_ERR_SYNTAX ); - } - - if (( tmpl = (struct ldap_disptmpl *)NSLDAPI_CALLOC( 1, - sizeof( struct ldap_disptmpl ))) == NULL ) { - nsldapi_free_strarray( toks ); - return( LDAP_TMPL_ERR_MEM ); - } - tmpl->dt_name = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * template plural name comes next - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - tmpl->dt_pluralname = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * template icon name is next - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - tmpl->dt_iconname = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * template options come next - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) < 1 ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - for ( i = 0; toks[ i ] != NULL; ++i ) { - for ( j = 0; tmploptions[ j ] != NULL; ++j ) { - if ( strcasecmp( toks[ i ], tmploptions[ j ] ) == 0 ) { - tmpl->dt_options |= tmploptvals[ j ]; - } - } - } - nsldapi_free_strarray( toks ); - - /* - * object class list is next - */ - while (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) > 0 ) { - if (( ocp = (struct ldap_oclist *)NSLDAPI_CALLOC( 1, - sizeof( struct ldap_oclist ))) == NULL ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_MEM ); - } - ocp->oc_objclasses = toks; - if ( tmpl->dt_oclist == NULL ) { - tmpl->dt_oclist = ocp; - } else { - prevocp->oc_next = ocp; - } - prevocp = ocp; - } - if ( tokcnt < 0 ) { - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - - /* - * read name of attribute to authenticate as - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - if ( toks[ 0 ][ 0 ] != '\0' ) { - tmpl->dt_authattrname = toks[ 0 ]; - } else { - NSLDAPI_FREE( toks[ 0 ] ); - } - NSLDAPI_FREE( (char *)toks ); - - /* - * read default attribute to use for RDN - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - tmpl->dt_defrdnattrname = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * read default location for new entries - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - if ( toks[ 0 ][ 0 ] != '\0' ) { - tmpl->dt_defaddlocation = toks[ 0 ]; - } else { - NSLDAPI_FREE( toks[ 0 ] ); - } - NSLDAPI_FREE( (char *)toks ); - - /* - * read list of rules used to define default values for new entries - */ - while (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) > 0 ) { - if ( strcasecmp( ADDEF_CONSTANT, toks[ 0 ] ) == 0 ) { - adsource = LDAP_ADSRC_CONSTANTVALUE; - } else if ( strcasecmp( ADDEF_ADDERSDN, toks[ 0 ] ) == 0 ) { - adsource = LDAP_ADSRC_ADDERSDN; - } else { - adsource = 0; - } - if ( adsource == 0 || tokcnt < 2 || - ( adsource == LDAP_ADSRC_CONSTANTVALUE && tokcnt != 3 ) || - ( adsource == LDAP_ADSRC_ADDERSDN && tokcnt != 2 )) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - - if (( adp = (struct ldap_adddeflist *)NSLDAPI_CALLOC( 1, - sizeof( struct ldap_adddeflist ))) == NULL ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_MEM ); - } - adp->ad_source = adsource; - adp->ad_attrname = toks[ 1 ]; - if ( adsource == LDAP_ADSRC_CONSTANTVALUE ) { - adp->ad_value = toks[ 2 ]; - } - NSLDAPI_FREE( toks[ 0 ] ); - NSLDAPI_FREE( (char *)toks ); - - if ( tmpl->dt_adddeflist == NULL ) { - tmpl->dt_adddeflist = adp; - } else { - prevadp->ad_next = adp; - } - prevadp = adp; - } - - /* - * item list is next - */ - samerow = 0; - while (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) > 0 ) { - if ( strcasecmp( toks[ 0 ], "item" ) == 0 ) { - if ( tokcnt < 4 ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - - if (( ip = (struct ldap_tmplitem *)NSLDAPI_CALLOC( 1, - sizeof( struct ldap_tmplitem ))) == NULL ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_MEM ); - } - - /* - * find syntaxid from config file string - */ - while (( itemopts = strrchr( toks[ 1 ], ',' )) != NULL ) { - *itemopts++ = '\0'; - for ( i = 0; itemoptions[ i ] != NULL; ++i ) { - if ( strcasecmp( itemopts, itemoptions[ i ] ) == 0 ) { - break; - } - } - if ( itemoptions[ i ] == NULL ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - ip->ti_options |= itemoptvals[ i ]; - } - - for ( i = 0; itemtypes[ i ] != NULL; ++i ) { - if ( strcasecmp( toks[ 1 ], itemtypes[ i ] ) == 0 ) { - break; - } - } - if ( itemtypes[ i ] == NULL ) { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - - NSLDAPI_FREE( toks[ 0 ] ); - NSLDAPI_FREE( toks[ 1 ] ); - ip->ti_syntaxid = itemsynids[ i ]; - ip->ti_label = toks[ 2 ]; - if ( toks[ 3 ][ 0 ] == '\0' ) { - ip->ti_attrname = NULL; - NSLDAPI_FREE( toks[ 3 ] ); - } else { - ip->ti_attrname = toks[ 3 ]; - } - if ( toks[ 4 ] != NULL ) { /* extra args. */ - for ( i = 0; toks[ i + 4 ] != NULL; ++i ) { - ; - } - if (( ip->ti_args = (char **)NSLDAPI_CALLOC( i + 1, - sizeof( char * ))) == NULL ) { - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_MEM ); - } - for ( i = 0; toks[ i + 4 ] != NULL; ++i ) { - ip->ti_args[ i ] = toks[ i + 4 ]; - } - } - NSLDAPI_FREE( (char *)toks ); - - if ( tmpl->dt_items == NULL ) { - tmpl->dt_items = rowp = ip; - } else if ( samerow ) { - previp->ti_next_in_row = ip; - } else { - rowp->ti_next_in_col = ip; - rowp = ip; - } - previp = ip; - samerow = 0; - } else if ( strcasecmp( toks[ 0 ], "samerow" ) == 0 ) { - nsldapi_free_strarray( toks ); - samerow = 1; - } else { - nsldapi_free_strarray( toks ); - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - } - if ( tokcnt < 0 ) { - free_disptmpl( tmpl ); - return( LDAP_TMPL_ERR_SYNTAX ); - } - - *tmplp = tmpl; - return( 0 ); -} - - -struct tmplerror { - int e_code; - char *e_reason; -}; - -static struct tmplerror ldap_tmplerrlist[] = { - { LDAP_TMPL_ERR_VERSION, "Bad template version" }, - { LDAP_TMPL_ERR_MEM, "Out of memory" }, - { LDAP_TMPL_ERR_SYNTAX, "Bad template syntax" }, - { LDAP_TMPL_ERR_FILE, "File error reading template" }, - { -1, 0 } -}; - -char * -LDAP_CALL -ldap_tmplerr2string( int err ) -{ - int i; - - for ( i = 0; ldap_tmplerrlist[i].e_code != -1; i++ ) { - if ( err == ldap_tmplerrlist[i].e_code ) - return( ldap_tmplerrlist[i].e_reason ); - } - - return( "Unknown error" ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/dllmain.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/dllmain.c deleted file mode 100644 index 28001c06fc7..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/dllmain.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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): - */ -/* - * Microsoft Windows specifics for LIBLDAP DLL - */ -#include "ldap.h" -#include "lber.h" - - -#ifdef _WIN32 -/* Lifted from Q125688 - * How to Port a 16-bit DLL to a Win32 DLL - * on the MSVC 4.0 CD - */ -BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) -{ - switch (fdwReason) - { - case DLL_PROCESS_ATTACH: - /* Code from LibMain inserted here. Return TRUE to keep the - DLL loaded or return FALSE to fail loading the DLL. - - You may have to modify the code in your original LibMain to - account for the fact that it may be called more than once. - You will get one DLL_PROCESS_ATTACH for each process that - loads the DLL. This is different from LibMain which gets - called only once when the DLL is loaded. The only time this - is critical is when you are using shared data sections. - If you are using shared data sections for statically - allocated data, you will need to be careful to initialize it - only once. Check your code carefully. - - Certain one-time initializations may now need to be done for - each process that attaches. You may also not need code from - your original LibMain because the operating system may now - be doing it for you. - */ - /* - * 16 bit code calls UnlockData() - * which is mapped to UnlockSegment in windows.h - * in 32 bit world UnlockData is not defined anywhere - * UnlockSegment is mapped to GlobalUnfix in winbase.h - * and the docs for both UnlockSegment and GlobalUnfix say - * ".. function is oboslete. Segments have no meaning - * in the 32-bit environment". So we do nothing here. - */ - /* If we are building a version that includes the security libraries, - * we have to initialize Winsock here. If not, we can defer until the - * first real socket call is made (in mozock.c). - */ -#ifdef LINK_SSL - { - WSADATA wsaData; - WSAStartup(0x0101, &wsaData); - } -#endif - - break; - - case DLL_THREAD_ATTACH: - /* Called each time a thread is created in a process that has - already loaded (attached to) this DLL. Does not get called - for each thread that exists in the process before it loaded - the DLL. - - Do thread-specific initialization here. - */ - break; - - case DLL_THREAD_DETACH: - /* Same as above, but called when a thread in the process - exits. - - Do thread-specific cleanup here. - */ - break; - - case DLL_PROCESS_DETACH: - /* Code from _WEP inserted here. This code may (like the - LibMain) not be necessary. Check to make certain that the - operating system is not doing it for you. - */ -#ifdef LINK_SSL - WSACleanup(); -#endif - - break; - } - /* The return value is only used for DLL_PROCESS_ATTACH; all other - conditions are ignored. */ - return TRUE; // successful DLL_PROCESS_ATTACH -} -#else -int CALLBACK -LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine ) -{ - /*UnlockData( 0 );*/ - return( 1 ); -} - -BOOL CALLBACK __loadds WEP(BOOL fSystemExit) -{ - WSACleanup(); - return TRUE; -} - -#endif - -#ifdef LDAP_DEBUG -#ifndef _WIN32 -#include -#include - -void LDAP_C LDAPDebug( int level, char* fmt, ... ) -{ - static char debugBuf[1024]; - - if (ldap_debug & level) - { - va_list ap; - va_start (ap, fmt); - _snprintf (debugBuf, sizeof(debugBuf), fmt, ap); - va_end (ap); - - OutputDebugString (debugBuf); - } -} -#endif -#endif - -#ifndef _WIN32 - -/* The 16-bit version of the RTL does not implement perror() */ - -#include - -void perror( const char *msg ) -{ - char buf[128]; - wsprintf( buf, "%s: error %d\n", msg, WSAGetLastError()) ; - OutputDebugString( buf ); -} - -#endif diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/dsparse.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/dsparse.c deleted file mode 100644 index cf6e78cc6a1..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/dsparse.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * 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) 1993, 1994 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ -/* - * dsparse.c: parsing routines used by display template and search - * preference file library routines for LDAP clients. - * - */ - -#include "ldap-int.h" - -static int next_line( char **bufp, long *blenp, char **linep ); -static char *next_token( char ** sp ); - -int -nsldapi_next_line_tokens( char **bufp, long *blenp, char ***toksp ) -{ - char *p, *line, *token, **toks; - int rc, tokcnt; - - *toksp = NULL; - - if (( rc = next_line( bufp, blenp, &line )) <= 0 ) { - return( rc ); - } - - if (( toks = (char **)NSLDAPI_CALLOC( 1, sizeof( char * ))) == NULL ) { - NSLDAPI_FREE( line ); - return( -1 ); - } - tokcnt = 0; - - p = line; - while (( token = next_token( &p )) != NULL ) { - if (( toks = (char **)NSLDAPI_REALLOC( toks, ( tokcnt + 2 ) * - sizeof( char * ))) == NULL ) { - NSLDAPI_FREE( (char *)toks ); - NSLDAPI_FREE( line ); - return( -1 ); - } - toks[ tokcnt ] = token; - toks[ ++tokcnt ] = NULL; - } - - if ( tokcnt == 1 && strcasecmp( toks[ 0 ], "END" ) == 0 ) { - tokcnt = 0; - nsldapi_free_strarray( toks ); - toks = NULL; - } - - NSLDAPI_FREE( line ); - - if ( tokcnt == 0 ) { - if ( toks != NULL ) { - NSLDAPI_FREE( (char *)toks ); - } - } else { - *toksp = toks; - } - - return( tokcnt ); -} - - -static int -next_line( char **bufp, long *blenp, char **linep ) -{ - char *linestart, *line, *p; - long plen; - - linestart = *bufp; - p = *bufp; - plen = *blenp; - - do { - for ( linestart = p; plen > 0; ++p, --plen ) { - if ( *p == '\r' ) { - if ( plen > 1 && *(p+1) == '\n' ) { - ++p; - --plen; - } - break; - } - - if ( *p == '\n' ) { - if ( plen > 1 && *(p+1) == '\r' ) { - ++p; - --plen; - } - break; - } - } - ++p; - --plen; - } while ( plen > 0 && ( *linestart == '#' || linestart + 1 == p )); - - - *bufp = p; - *blenp = plen; - - - if ( plen <= 0 ) { - *linep = NULL; - return( 0 ); /* end of file */ - } - - if (( line = NSLDAPI_MALLOC( p - linestart )) == NULL ) { - *linep = NULL; - return( -1 ); /* fatal error */ - } - - SAFEMEMCPY( line, linestart, p - linestart ); - line[ p - linestart - 1 ] = '\0'; - *linep = line; - return( strlen( line )); -} - - -static char * -next_token( char **sp ) -{ - int in_quote = 0; - char *p, *tokstart, *t; - - if ( **sp == '\0' ) { - return( NULL ); - } - - p = *sp; - - while ( ldap_utf8isspace( p )) { /* skip leading white space */ - ++p; - } - - if ( *p == '\0' ) { - return( NULL ); - } - - if ( *p == '\"' ) { - in_quote = 1; - ++p; - } - t = tokstart = p; - - for ( ;; ) { - if ( *p == '\0' || ( ldap_utf8isspace( p ) && !in_quote )) { - if ( *p != '\0' ) { - ++p; - } - *t++ = '\0'; /* end of token */ - break; - } - - if ( *p == '\"' ) { - in_quote = !in_quote; - ++p; - } else { - *t++ = *p++; - } - } - - *sp = p; - - if ( t == tokstart ) { - return( NULL ); - } - - return( nsldapi_strdup( tokstart )); -} - - -void -nsldapi_free_strarray( char **sap ) -{ - int i; - - if ( sap != NULL ) { - for ( i = 0; sap[ i ] != NULL; ++i ) { - NSLDAPI_FREE( sap[ i ] ); - } - NSLDAPI_FREE( (char *)sap ); - } -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/error.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/error.c deleted file mode 100644 index aa497beaf2d..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/error.c +++ /dev/null @@ -1,462 +0,0 @@ -/* - * 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 "ldap-int.h" - -struct ldaperror { - int e_code; - char *e_reason; -}; - -static struct ldaperror ldap_errlist[] = { - { LDAP_SUCCESS, "Success" }, - { LDAP_OPERATIONS_ERROR, "Operations error" }, - { LDAP_PROTOCOL_ERROR, "Protocol error" }, - { LDAP_TIMELIMIT_EXCEEDED, "Timelimit exceeded" }, - { LDAP_SIZELIMIT_EXCEEDED, "Sizelimit exceeded" }, - { LDAP_COMPARE_FALSE, "Compare false" }, - { LDAP_COMPARE_TRUE, "Compare true" }, - { LDAP_STRONG_AUTH_NOT_SUPPORTED, "Authentication method not supported" }, - { LDAP_STRONG_AUTH_REQUIRED, "Strong authentication required" }, - { LDAP_PARTIAL_RESULTS, "Partial results and referral received" }, - { LDAP_REFERRAL, "Referral received" }, - { LDAP_ADMINLIMIT_EXCEEDED, "Administrative limit exceeded" }, - { LDAP_UNAVAILABLE_CRITICAL_EXTENSION, "Unavailable critical extension" }, - { LDAP_CONFIDENTIALITY_REQUIRED, "Confidentiality required" }, - { LDAP_SASL_BIND_IN_PROGRESS, "SASL bind in progress" }, - - { LDAP_NO_SUCH_ATTRIBUTE, "No such attribute" }, - { LDAP_UNDEFINED_TYPE, "Undefined attribute type" }, - { LDAP_INAPPROPRIATE_MATCHING, "Inappropriate matching" }, - { LDAP_CONSTRAINT_VIOLATION, "Constraint violation" }, - { LDAP_TYPE_OR_VALUE_EXISTS, "Type or value exists" }, - { LDAP_INVALID_SYNTAX, "Invalid syntax" }, - - { LDAP_NO_SUCH_OBJECT, "No such object" }, - { LDAP_ALIAS_PROBLEM, "Alias problem" }, - { LDAP_INVALID_DN_SYNTAX, "Invalid DN syntax" }, - { LDAP_IS_LEAF, "Object is a leaf" }, - { LDAP_ALIAS_DEREF_PROBLEM, "Alias dereferencing problem" }, - - { LDAP_INAPPROPRIATE_AUTH, "Inappropriate authentication" }, - { LDAP_INVALID_CREDENTIALS, "Invalid credentials" }, - { LDAP_INSUFFICIENT_ACCESS, "Insufficient access" }, - { LDAP_BUSY, "DSA is busy" }, - { LDAP_UNAVAILABLE, "DSA is unavailable" }, - { LDAP_UNWILLING_TO_PERFORM, "DSA is unwilling to perform" }, - { LDAP_LOOP_DETECT, "Loop detected" }, - { LDAP_SORT_CONTROL_MISSING, "Sort Control is missing" }, - { LDAP_INDEX_RANGE_ERROR, "Search results exceed the range specified by the offsets" }, - - { LDAP_NAMING_VIOLATION, "Naming violation" }, - { LDAP_OBJECT_CLASS_VIOLATION, "Object class violation" }, - { LDAP_NOT_ALLOWED_ON_NONLEAF, "Operation not allowed on nonleaf" }, - { LDAP_NOT_ALLOWED_ON_RDN, "Operation not allowed on RDN" }, - { LDAP_ALREADY_EXISTS, "Already exists" }, - { LDAP_NO_OBJECT_CLASS_MODS, "Cannot modify object class" }, - { LDAP_RESULTS_TOO_LARGE, "Results too large" }, - { LDAP_AFFECTS_MULTIPLE_DSAS, "Affects multiple servers" }, - - { LDAP_OTHER, "Unknown error" }, - { LDAP_SERVER_DOWN, "Can't contact LDAP server" }, - { LDAP_LOCAL_ERROR, "Local error" }, - { LDAP_ENCODING_ERROR, "Encoding error" }, - { LDAP_DECODING_ERROR, "Decoding error" }, - { LDAP_TIMEOUT, "Timed out" }, - { LDAP_AUTH_UNKNOWN, "Unknown authentication method" }, - { LDAP_FILTER_ERROR, "Bad search filter" }, - { LDAP_USER_CANCELLED, "User cancelled operation" }, - { LDAP_PARAM_ERROR, "Bad parameter to an ldap routine" }, - { LDAP_NO_MEMORY, "Out of memory" }, - { LDAP_CONNECT_ERROR, "Can't connect to the LDAP server" }, - { LDAP_NOT_SUPPORTED, "Not supported by this version of the LDAP protocol" }, - { LDAP_CONTROL_NOT_FOUND, "Requested LDAP control not found" }, - { LDAP_NO_RESULTS_RETURNED, "No results returned" }, - { LDAP_MORE_RESULTS_TO_RETURN, "More results to return" }, - { LDAP_CLIENT_LOOP, "Client detected loop" }, - { LDAP_REFERRAL_LIMIT_EXCEEDED, "Referral hop limit exceeded" }, - { -1, 0 } -}; - -char * -LDAP_CALL -ldap_err2string( int err ) -{ - int i; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_err2string\n", 0, 0, 0 ); - - for ( i = 0; ldap_errlist[i].e_code != -1; i++ ) { - if ( err == ldap_errlist[i].e_code ) - return( ldap_errlist[i].e_reason ); - } - - return( "Unknown error" ); -} - - -static char * -nsldapi_safe_strerror( e ) -{ - char *s; - - if (( s = strerror( e )) == NULL ) { - s = "unknown error"; - } - - return( s ); -} - - -void -LDAP_CALL -ldap_perror( LDAP *ld, const char *s ) -{ - int i, err; - char *matched, *errmsg, *separator; - char msg[1024]; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_perror\n", 0, 0, 0 ); - - if ( s == NULL ) { - s = separator = ""; - } else { - separator = ": "; - } - - if ( ld == NULL ) { - sprintf( msg, "%s%s%s", s, separator, - nsldapi_safe_strerror( errno ) ); - ber_err_print( msg ); - return; - } - - LDAP_MUTEX_LOCK( ld, LDAP_ERR_LOCK ); - err = LDAP_GET_LDERRNO( ld, &matched, &errmsg ); - for ( i = 0; ldap_errlist[i].e_code != -1; i++ ) { - if ( err == ldap_errlist[i].e_code ) { - sprintf( msg, "%s%s%s", s, separator, - ldap_errlist[i].e_reason ); - ber_err_print( msg ); - if ( err == LDAP_CONNECT_ERROR ) { - ber_err_print( " - " ); - ber_err_print( nsldapi_safe_strerror( - LDAP_GET_ERRNO( ld ))); - } - ber_err_print( "\n" ); - if ( matched != NULL && *matched != '\0' ) { - sprintf( msg, "%s%smatched: %s\n", - s, separator, matched ); - ber_err_print( msg ); - } - if ( errmsg != NULL && *errmsg != '\0' ) { - sprintf( msg, "%s%sadditional info: %s\n", - s, separator, errmsg ); - ber_err_print( msg ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_ERR_LOCK ); - return; - } - } - sprintf( msg, "%s%sNot an LDAP errno %d\n", s, separator, err ); - ber_err_print( msg ); - LDAP_MUTEX_UNLOCK( ld, LDAP_ERR_LOCK ); -} - -int -LDAP_CALL -ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit ) -{ - int lderr_parse, lderr; - - lderr_parse = ldap_parse_result( ld, r, &lderr, NULL, NULL, NULL, - NULL, freeit ); - - if ( lderr_parse != LDAP_SUCCESS ) { - return( lderr_parse ); - } - - return( lderr ); -} - -int -LDAP_CALL -ldap_get_lderrno( LDAP *ld, char **m, char **s ) -{ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); /* punt */ - } - - if ( ld->ld_get_lderrno_fn == NULL ) { - if ( m != NULL ) { - *m = ld->ld_matched; - } - if ( s != NULL ) { - *s = ld->ld_error; - } - return( ld->ld_errno ); - } else { - return( ld->ld_get_lderrno_fn( m, s, ld->ld_lderrno_arg ) ); - } -} - - -/* - * Note: there is no need for callers of ldap_set_lderrno() to lock the - * ld mutex. If applications intend to share an LDAP session handle - * between threads they *must* perform their own locking around the - * session handle or they must install a "set lderrno" thread callback - * function. - * - */ -int -LDAP_CALL -ldap_set_lderrno( LDAP *ld, int e, char *m, char *s ) -{ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( ld->ld_set_lderrno_fn != NULL ) { - ld->ld_set_lderrno_fn( e, m, s, ld->ld_lderrno_arg ); - } else { - LDAP_MUTEX_LOCK( ld, LDAP_ERR_LOCK ); - ld->ld_errno = e; - if ( ld->ld_matched ) { - NSLDAPI_FREE( ld->ld_matched ); - } - ld->ld_matched = m; - if ( ld->ld_error ) { - NSLDAPI_FREE( ld->ld_error ); - } - ld->ld_error = s; - LDAP_MUTEX_UNLOCK( ld, LDAP_ERR_LOCK ); - } - - return( LDAP_SUCCESS ); -} - - -/* - * Returns an LDAP error that says whether parse succeeded. The error code - * from the LDAP result itself is returned in the errcodep result parameter. - * If any of the result params. (errcodep, matchednp, errmsgp, referralsp, - * or serverctrlsp) are NULL we don't return that info. - */ -int -LDAP_CALL -ldap_parse_result( LDAP *ld, LDAPMessage *res, int *errcodep, char **matchednp, - char **errmsgp, char ***referralsp, LDAPControl ***serverctrlsp, - int freeit ) -{ - LDAPMessage *lm; - int err, errcode; - char *m, *e; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_parse_result\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || - !NSLDAPI_VALID_LDAPMESSAGE_POINTER( res )) { - return( LDAP_PARAM_ERROR ); - } - - /* skip over entries and references to find next result in this chain */ - for ( lm = res; lm != NULL; lm = lm->lm_chain ) { - if ( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY && - lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE ) { - break; - } - } - - if ( lm == NULL ) { - err = LDAP_NO_RESULTS_RETURNED; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - - err = nsldapi_parse_result( ld, lm->lm_msgtype, lm->lm_ber, &errcode, - &m, &e, referralsp, serverctrlsp ); - - if ( err == LDAP_SUCCESS ) { - if ( errcodep != NULL ) { - *errcodep = errcode; - } - if ( matchednp != NULL ) { - *matchednp = nsldapi_strdup( m ); - } - if ( errmsgp != NULL ) { - *errmsgp = nsldapi_strdup( e ); - } - - /* - * if there are more result messages in the chain, arrange to - * return the special LDAP_MORE_RESULTS_TO_RETURN "error" code. - */ - for ( lm = lm->lm_chain; lm != NULL; lm = lm->lm_chain ) { - if ( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY && - lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE ) { - err = LDAP_MORE_RESULTS_TO_RETURN; - break; - } - } - } else { - m = e = NULL; - } - - if ( freeit ) { - ldap_msgfree( res ); - } - - LDAP_SET_LDERRNO( ld, ( err == LDAP_SUCCESS ) ? errcode : err, m, e ); - - return( err ); -} - - -/* - * returns an LDAP error code indicating success or failure of parsing - * does NOT set any error information inside "ld" - */ -int -nsldapi_parse_result( LDAP *ld, int msgtype, BerElement *rber, int *errcodep, - char **matchednp, char **errmsgp, char ***referralsp, - LDAPControl ***serverctrlsp ) -{ - BerElement ber; - unsigned long len; - int berrc, err, errcode; - long along; - char *m, *e; - - /* - * Parse the result message. LDAPv3 result messages look like this: - * - * LDAPResult ::= SEQUENCE { - * resultCode ENUMERATED { ... }, - * matchedDN LDAPDN, - * errorMessage LDAPString, - * referral [3] Referral OPTIONAL - * opSpecificStuff OPTIONAL - * } - * - * all wrapped up in an LDAPMessage sequence which looks like this: - * LDAPMessage ::= SEQUENCE { - * messageID MessageID, - * LDAPResult CHOICE { ... }, // message type - * controls [0] Controls OPTIONAL - * } - * - * LDAPv2 messages don't include referrals or controls. - * LDAPv1 messages don't include matchedDN, referrals, or controls. - * - * ldap_result() pulls out the message id, so by the time a result - * message gets here we are sitting at the start of the LDAPResult. - */ - - err = LDAP_SUCCESS; /* optimistic */ - m = e = NULL; - if ( matchednp != NULL ) { - *matchednp = NULL; - } - if ( errmsgp != NULL ) { - *errmsgp = NULL; - } - if ( referralsp != NULL ) { - *referralsp = NULL; - } - if ( serverctrlsp != NULL ) { - *serverctrlsp = NULL; - } - ber = *rber; /* struct copy */ - - if ( NSLDAPI_LDAP_VERSION( ld ) < LDAP_VERSION2 ) { - berrc = ber_scanf( &ber, "{ia}", &along, &e ); - errcode = (int)along; /* XXX lossy cast */ - } else { - if (( berrc = ber_scanf( &ber, "{iaa", &along, &m, &e )) - != LBER_ERROR ) { - errcode = (int)along; /* XXX lossy cast */ - /* check for optional referrals */ - if ( ber_peek_tag( &ber, &len ) == LDAP_TAG_REFERRAL ) { - if ( referralsp == NULL ) { - /* skip referrals */ - berrc = ber_scanf( &ber, "x" ); - } else { - /* suck out referrals */ - berrc = ber_scanf( &ber, "v", - referralsp ); - } - } else if ( referralsp != NULL ) { - *referralsp = NULL; - } - } - - if ( berrc != LBER_ERROR ) { - /* - * skip past optional operation-specific elements: - * bind results - serverSASLcreds - * extendedop results - OID plus value - */ - if ( msgtype == LDAP_RES_BIND ) { - if ( ber_peek_tag( &ber, &len ) == - LDAP_TAG_SASL_RES_CREDS ) { - berrc = ber_scanf( &ber, "x" ); - } - } else if ( msgtype == LDAP_RES_EXTENDED ) { - if ( ber_peek_tag( &ber, &len ) == - LDAP_TAG_EXOP_RES_OID ) { - berrc = ber_scanf( &ber, "x" ); - } - if ( berrc != LBER_ERROR && - ber_peek_tag( &ber, &len ) == - LDAP_TAG_EXOP_RES_VALUE ) { - berrc = ber_scanf( &ber, "x" ); - } - } - } - - /* pull out controls (if requested and any are present) */ - if ( berrc != LBER_ERROR && serverctrlsp != NULL && - ( berrc = ber_scanf( &ber, "}" )) != LBER_ERROR ) { - err = nsldapi_get_controls( &ber, serverctrlsp ); - } - } - - if ( berrc == LBER_ERROR && err == LDAP_SUCCESS ) { - err = LDAP_DECODING_ERROR; - } - - if ( errcodep != NULL ) { - *errcodep = errcode; - } - if ( matchednp != NULL ) { - *matchednp = m; - } else if ( m != NULL ) { - NSLDAPI_FREE( m ); - } - if ( errmsgp != NULL ) { - *errmsgp = e; - } else if ( e != NULL ) { - NSLDAPI_FREE( e ); - } - - return( err ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/extendop.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/extendop.c deleted file mode 100644 index aa4303622fa..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/extendop.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * 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 "ldap-int.h" - -/* - * ldap_extended_operation - initiate an arbitrary ldapv3 extended operation. - * the oid and data of the extended operation are supplied. Returns an - * LDAP error code. - * - * Example: - * struct berval exdata; - * char *exoid; - * int err, msgid; - * ... fill in oid and data ... - * err = ldap_extended_operation( ld, exoid, &exdata, NULL, NULL, &msgid ); - */ - -int -LDAP_CALL -ldap_extended_operation( - LDAP *ld, - const char *exoid, - const struct berval *exdata, - LDAPControl **serverctrls, - LDAPControl **clientctrls, - int *msgidp -) -{ - BerElement *ber; - int rc, msgid; - - /* - * the ldapv3 extended operation request looks like this: - * - * ExtendedRequest ::= [APPLICATION 23] SEQUENCE { - * requestName LDAPOID, - * requestValue OCTET STRING - * } - * - * all wrapped up in an LDAPMessage sequence. - */ - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_extended_operation\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - - /* only ldapv3 or higher can do extended operations */ - if ( NSLDAPI_LDAP_VERSION( ld ) < LDAP_VERSION3 ) { - rc = LDAP_NOT_SUPPORTED; - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); - } - - if ( msgidp == NULL || exoid == NULL || *exoid == '\0' ) { - rc = LDAP_PARAM_ERROR; - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - msgid = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - -#if 0 - if ( ld->ld_cache_on && ld->ld_cache_extendedop != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - if ( (rc = (ld->ld_cache_extendedop)( ld, msgid, - LDAP_REQ_EXTENDED, exoid, cred )) != 0 ) { - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - return( rc ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - } -#endif - - /* create a message to send */ - if (( rc = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( rc ); - } - - /* fill it in */ - if ( ber_printf( ber, "{it{tsto}", msgid, LDAP_REQ_EXTENDED, - LDAP_TAG_EXOP_REQ_OID, exoid, LDAP_TAG_EXOP_REQ_VALUE, - exdata->bv_val, (int)exdata->bv_len /* XXX lossy cast */ ) == -1 ) { - rc = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - ber_free( ber, 1 ); - return( rc ); - } - - if (( rc = nsldapi_put_controls( ld, serverctrls, 1, ber )) - != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( rc ); - } - - /* send the message */ - rc = nsldapi_send_initial_request( ld, msgid, LDAP_REQ_EXTENDED, NULL, - ber ); - *msgidp = rc; - return( rc < 0 ? LDAP_GET_LDERRNO( ld, NULL, NULL ) : LDAP_SUCCESS ); -} - - -/* - * ldap_extended_operation_s - perform an arbitrary ldapv3 extended operation. - * the oid and data of the extended operation are supplied. LDAP_SUCCESS - * is returned upon success, the ldap error code otherwise. - * - * Example: - * struct berval exdata, exretval; - * char *exoid; - * int rc; - * ... fill in oid and data ... - * rc = ldap_extended_operation_s( ld, exoid, &exdata, &exretval ); - */ -int -LDAP_CALL -ldap_extended_operation_s( - LDAP *ld, - const char *requestoid, - const struct berval *requestdata, - LDAPControl **serverctrls, - LDAPControl **clientctrls, - char **retoidp, - struct berval **retdatap -) -{ - int err, msgid; - LDAPMessage *result; - - if (( err = ldap_extended_operation( ld, requestoid, requestdata, - serverctrls, clientctrls, &msgid )) != LDAP_SUCCESS ) { - return( err ); - } - - if ( ldap_result( ld, msgid, 1, (struct timeval *) 0, &result ) - == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - if (( err = ldap_parse_extended_result( ld, result, retoidp, retdatap, - 0 )) != LDAP_SUCCESS ) { - ldap_msgfree( result ); - return( err ); - } - - return( ldap_result2error( ld, result, 1 ) ); -} - - -/* - * Pull the oid returned by the server and the data out of an extended - * operation result. Return an LDAP error code. - */ -int -LDAP_CALL -ldap_parse_extended_result( - LDAP *ld, - LDAPMessage *res, - char **retoidp, /* may be NULL */ - struct berval **retdatap, /* may be NULL */ - int freeit -) -{ - struct berelement ber; - unsigned long len; - long err; - char *m, *e, *roid; - struct berval *rdata; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_parse_extended_result\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( !NSLDAPI_VALID_LDAPMESSAGE_EXRESULT_POINTER( res )) { - return( LDAP_PARAM_ERROR ); - } - - m = e = NULL; - ber = *(res->lm_ber); - if ( NSLDAPI_LDAP_VERSION( ld ) < LDAP_VERSION3 ) { - LDAP_SET_LDERRNO( ld, LDAP_NOT_SUPPORTED, NULL, NULL ); - return( LDAP_NOT_SUPPORTED ); - } - - if ( ber_scanf( &ber, "{iaa", &err, &m, &e ) == LBER_ERROR ) { - goto decoding_error; - } - roid = NULL; - if ( ber_peek_tag( &ber, &len ) == LDAP_TAG_EXOP_RES_OID ) { - if ( ber_scanf( &ber, "a", &roid ) == LBER_ERROR ) { - goto decoding_error; - } - } - if ( retoidp != NULL ) { - *retoidp = roid; - } else if ( roid != NULL ) { - NSLDAPI_FREE( roid ); - } - - rdata = NULL; - if ( ber_peek_tag( &ber, &len ) == LDAP_TAG_EXOP_RES_VALUE ) { - if ( ber_scanf( &ber, "O", &rdata ) == LBER_ERROR ) { - goto decoding_error; - } - } - if ( retdatap != NULL ) { - *retdatap = rdata; - } else if ( rdata != NULL ) { - ber_bvfree( rdata ); - } - - LDAP_SET_LDERRNO( ld, err, m, e ); - - if ( freeit ) { - ldap_msgfree( res ); - } - - return( LDAP_SUCCESS ); - -decoding_error:; - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL ); - return( LDAP_DECODING_ERROR ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/free.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/free.c deleted file mode 100644 index 2ed2d4bcc79..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/free.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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) 1994 The Regents of the University of Michigan. - * All rights reserved. - */ -/* - * free.c - some free routines are included here to avoid having to - * link in lots of extra code when not using certain features - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1994 The Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -void -LDAP_CALL -ldap_getfilter_free( LDAPFiltDesc *lfdp ) -{ - LDAPFiltList *flp, *nextflp; - LDAPFiltInfo *fip, *nextfip; - - if ( lfdp == NULL ) { - return; - } - - for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = nextflp ) { - for ( fip = flp->lfl_ilist; fip != NULL; fip = nextfip ) { - nextfip = fip->lfi_next; - NSLDAPI_FREE( fip->lfi_filter ); - NSLDAPI_FREE( fip->lfi_desc ); - NSLDAPI_FREE( fip ); - } - nextflp = flp->lfl_next; - NSLDAPI_FREE( flp->lfl_pattern ); - NSLDAPI_FREE( flp->lfl_delims ); - NSLDAPI_FREE( flp->lfl_tag ); - NSLDAPI_FREE( flp ); - } - - if ( lfdp->lfd_curvalcopy != NULL ) { - NSLDAPI_FREE( lfdp->lfd_curvalcopy ); - } - if ( lfdp->lfd_curvalwords != NULL ) { - NSLDAPI_FREE( lfdp->lfd_curvalwords ); - } - if ( lfdp->lfd_filtprefix != NULL ) { - NSLDAPI_FREE( lfdp->lfd_filtprefix ); - } - if ( lfdp->lfd_filtsuffix != NULL ) { - NSLDAPI_FREE( lfdp->lfd_filtsuffix ); - } - - NSLDAPI_FREE( lfdp ); -} - - -/* - * free a null-terminated array of pointers to mod structures. the - * structures are freed, not the array itself, unless the freemods - * flag is set. - */ -void -LDAP_CALL -ldap_mods_free( LDAPMod **mods, int freemods ) -{ - int i; - - if ( !NSLDAPI_VALID_LDAPMOD_ARRAY( mods )) { - return; - } - - for ( i = 0; mods[i] != NULL; i++ ) { - if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) { - if ( mods[i]->mod_bvalues != NULL ) { - ber_bvecfree( mods[i]->mod_bvalues ); - } - } else if ( mods[i]->mod_values != NULL ) { - ldap_value_free( mods[i]->mod_values ); - } - if ( mods[i]->mod_type != NULL ) { - NSLDAPI_FREE( mods[i]->mod_type ); - } - NSLDAPI_FREE( (char *) mods[i] ); - } - - if ( freemods ) - NSLDAPI_FREE( (char *) mods ); -} - - -/* - * ldap_memfree() is needed to ensure that memory allocated by the C runtime - * assocated with libldap is freed by the same runtime code. - */ -void -LDAP_CALL -ldap_memfree( void *s ) -{ - if ( s != NULL ) { - NSLDAPI_FREE( s ); - } -} - - -/* - * ldap_ber_free() is just a cover for ber_free() - * ber_free() checks for ber == NULL, so we don't bother. - */ -void -LDAP_CALL -ldap_ber_free( BerElement *ber, int freebuf ) -{ - ber_free( ber, freebuf ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/freevalues.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/freevalues.c deleted file mode 100644 index 3f936e277b4..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/freevalues.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * freevalues.c - */ - -#include "ldap-int.h" - -void -LDAP_CALL -ldap_value_free( char **vals ) -{ - int i; - - if ( vals == NULL ) - return; - for ( i = 0; vals[i] != NULL; i++ ) - NSLDAPI_FREE( vals[i] ); - NSLDAPI_FREE( (char *) vals ); -} - -void -LDAP_CALL -ldap_value_free_len( struct berval **vals ) -{ - int i; - - if ( vals == NULL ) - return; - for ( i = 0; vals[i] != NULL; i++ ) { - NSLDAPI_FREE( vals[i]->bv_val ); - NSLDAPI_FREE( vals[i] ); - } - NSLDAPI_FREE( (char *) vals ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/friendly.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/friendly.c deleted file mode 100644 index 2a32102afd8..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/friendly.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * friendly.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -char * -LDAP_CALL -ldap_friendly_name( char *filename, char *name, FriendlyMap *map ) -{ - int i, entries; - FILE *fp; - char *s; - char buf[BUFSIZ]; - - if ( map == NULL ) { - return( name ); - } - if ( NULL == name) - { - return (name); - } - - if ( *map == NULL ) { - if ( (fp = fopen( filename, "r" )) == NULL ) - return( name ); - - entries = 0; - while ( fgets( buf, sizeof(buf), fp ) != NULL ) { - if ( buf[0] != '#' ) - entries++; - } - rewind( fp ); - - if ( (*map = (FriendlyMap)NSLDAPI_MALLOC( (entries + 1) * - sizeof(struct friendly) )) == NULL ) { - fclose( fp ); - return( name ); - } - - i = 0; - while ( fgets( buf, sizeof(buf), fp ) != NULL && i < entries ) { - if ( buf[0] == '#' ) - continue; - - if ( (s = strchr( buf, '\n' )) != NULL ) - *s = '\0'; - - if ( (s = strchr( buf, '\t' )) == NULL ) - continue; - *s++ = '\0'; - - if ( *s == '"' ) { - int esc = 0, found = 0; - - for ( ++s; *s && !found; s++ ) { - switch ( *s ) { - case '\\': - esc = 1; - break; - case '"': - if ( !esc ) - found = 1; - /* FALL */ - default: - esc = 0; - break; - } - } - } - - (*map)[i].f_unfriendly = nsldapi_strdup( buf ); - (*map)[i].f_friendly = nsldapi_strdup( s ); - i++; - } - - fclose( fp ); - (*map)[i].f_unfriendly = NULL; - } - - for ( i = 0; (*map)[i].f_unfriendly != NULL; i++ ) { - if ( strcasecmp( name, (*map)[i].f_unfriendly ) == 0 ) - return( (*map)[i].f_friendly ); - } - return( name ); -} - - -void -LDAP_CALL -ldap_free_friendlymap( FriendlyMap *map ) -{ - struct friendly* pF; - - if ( map == NULL || *map == NULL ) { - return; - } - - for ( pF = *map; pF->f_unfriendly; pF++ ) { - NSLDAPI_FREE( pF->f_unfriendly ); - NSLDAPI_FREE( pF->f_friendly ); - } - NSLDAPI_FREE( *map ); - *map = NULL; -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/getattr.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/getattr.c deleted file mode 100644 index a3eedc27165..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/getattr.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * getattr.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - - -static unsigned long -bytes_remaining( BerElement *ber ) -{ - unsigned long len; - - if ( ber_get_option( ber, LBER_OPT_REMAINING_BYTES, &len ) != 0 ) { - return( 0 ); /* not sure what else to do.... */ - } - return( len ); -} - - -char * -LDAP_CALL -ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber ) -{ - char *attr; - int err; - long seqlength; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_first_attribute\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( NULL ); /* punt */ - } - - if ( ber == NULL || !NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( entry )) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( NULL ); - } - - if ( nsldapi_alloc_ber_with_options( ld, ber ) != LDAP_SUCCESS ) { - return( NULL ); - } - - **ber = *entry->lm_ber; - - attr = NULL; /* pessimistic */ - err = LDAP_DECODING_ERROR; /* ditto */ - - /* - * Skip past the sequence, dn, and sequence of sequence. - * Reset number of bytes remaining so we confine the rest of our - * decoding to the current sequence. - */ - if ( ber_scanf( *ber, "{xl{", &seqlength ) != LBER_ERROR && - ber_set_option( *ber, LBER_OPT_REMAINING_BYTES, &seqlength ) - == 0 ) { - /* snarf the attribute type, and skip the set of values, - * leaving us positioned right before the next attribute - * type/value sequence. - */ - if ( ber_scanf( *ber, "{ax}", &attr ) != LBER_ERROR || - bytes_remaining( *ber ) == 0 ) { - err = LDAP_SUCCESS; - } - } - - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - if ( attr == NULL || err != LDAP_SUCCESS ) { - ber_free( *ber, 0 ); - *ber = NULL; - } - return( attr ); -} - -/* ARGSUSED */ -char * -LDAP_CALL -ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber ) -{ - char *attr; - int err; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_next_attribute\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( NULL ); /* punt */ - } - - if ( ber == NULL || !NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( entry )) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( NULL ); - } - - attr = NULL; /* pessimistic */ - err = LDAP_DECODING_ERROR; /* ditto */ - - /* skip sequence, snarf attribute type, skip values */ - if ( ber_scanf( ber, "{ax}", &attr ) != LBER_ERROR || - bytes_remaining( ber ) == 0 ) { - err = LDAP_SUCCESS; - } - - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( attr ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/getdn.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/getdn.c deleted file mode 100644 index 48610b34d2e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/getdn.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * 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) 1994 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * getdn.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -char * -LDAP_CALL -ldap_get_dn( LDAP *ld, LDAPMessage *entry ) -{ - char *dn; - struct berelement tmp; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_get_dn\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( NULL ); /* punt */ - } - - if ( !NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( entry )) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( NULL ); - } - - tmp = *entry->lm_ber; /* struct copy */ - if ( ber_scanf( &tmp, "{a", &dn ) == LBER_ERROR ) { - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL ); - return( NULL ); - } - - return( dn ); -} - -char * -LDAP_CALL -ldap_dn2ufn( const char *dn ) -{ - char *p, *ufn, *r; - size_t plen; - int state; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_dn2ufn\n", 0, 0, 0 ); - - if ( dn == NULL ) { - dn = ""; - } - - if ( ldap_is_dns_dn( dn ) || ( p = strchr( dn, '=' )) == NULL ) - return( nsldapi_strdup( (char *)dn )); - - ufn = nsldapi_strdup( ++p ); - -#define INQUOTE 1 -#define OUTQUOTE 2 - state = OUTQUOTE; - for ( p = ufn, r = ufn; *p; p += plen ) { - plen = 1; - switch ( *p ) { - case '\\': - if ( *++p == '\0' ) - plen=0; - else { - *r++ = '\\'; - r += (plen = LDAP_UTF8COPY(r,p)); - } - break; - case '"': - if ( state == INQUOTE ) - state = OUTQUOTE; - else - state = INQUOTE; - *r++ = *p; - break; - case ';': - case ',': - if ( state == OUTQUOTE ) - *r++ = ','; - else - *r++ = *p; - break; - case '=': - if ( state == INQUOTE ) - *r++ = *p; - else { - char *rsave = r; - LDAP_UTF8DEC(r); - *rsave = '\0'; - while ( !ldap_utf8isspace( r ) && *r != ';' - && *r != ',' && r > ufn ) - LDAP_UTF8DEC(r); - LDAP_UTF8INC(r); - - if ( strcasecmp( r, "c" ) - && strcasecmp( r, "o" ) - && strcasecmp( r, "ou" ) - && strcasecmp( r, "st" ) - && strcasecmp( r, "l" ) - && strcasecmp( r, "dc" ) - && strcasecmp( r, "uid" ) - && strcasecmp( r, "cn" ) ) { - r = rsave; - *r++ = '='; - } - } - break; - default: - r += (plen = LDAP_UTF8COPY(r,p)); - break; - } - } - *r = '\0'; - - return( ufn ); -} - -char ** -LDAP_CALL -ldap_explode_dns( const char *dn ) -{ - int ncomps, maxcomps; - char *s, *cpydn; - char **rdns; -#ifdef HAVE_STRTOK_R /* defined in portable.h */ - char *lasts; -#endif - - if ( dn == NULL ) { - dn = ""; - } - - if ( (rdns = (char **)NSLDAPI_MALLOC( 8 * sizeof(char *) )) == NULL ) { - return( NULL ); - } - - maxcomps = 8; - ncomps = 0; - cpydn = nsldapi_strdup( (char *)dn ); - for ( s = STRTOK( cpydn, "@.", &lasts ); s != NULL; - s = STRTOK( NULL, "@.", &lasts ) ) { - if ( ncomps == maxcomps ) { - maxcomps *= 2; - if ( (rdns = (char **)NSLDAPI_REALLOC( rdns, maxcomps * - sizeof(char *) )) == NULL ) { - NSLDAPI_FREE( cpydn ); - return( NULL ); - } - } - rdns[ncomps++] = nsldapi_strdup( s ); - } - rdns[ncomps] = NULL; - NSLDAPI_FREE( cpydn ); - - return( rdns ); -} - -#define LDAP_DN 1 -#define LDAP_RDN 2 - -static char ** -ldap_explode( const char *dn, const int notypes, const int nametype ) -{ - char *p, *q, *rdnstart, **rdns = NULL; - size_t plen = 0; - int state, count = 0, endquote, len, goteq; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_explode\n", 0, 0, 0 ); - - if ( dn == NULL ) { - dn = ""; - } - -#if 0 - if ( ldap_is_dns_dn( dn ) ) { - return( ldap_explode_dns( dn ) ); - } -#endif - - while ( ldap_utf8isspace( (char *)dn )) { /* ignore leading spaces */ - ++dn; - } - - p = rdnstart = (char *) dn; - state = OUTQUOTE; - goteq = 0; - - do { - p += plen; - plen = 1; - switch ( *p ) { - case '\\': - if ( *++p == '\0' ) - p--; - else - plen = LDAP_UTF8LEN(p); - break; - case '"': - if ( state == INQUOTE ) - state = OUTQUOTE; - else - state = INQUOTE; - break; - case '+': if ( nametype != LDAP_RDN ) break; - case ';': - case ',': - case '\0': - if ( state == OUTQUOTE ) { - /* - * semicolon and comma are not valid RDN - * separators. - */ - if ( nametype == LDAP_RDN && - ( *p == ';' || *p == ',' || !goteq)) { - ldap_charray_free( rdns ); - return NULL; - } - if ( (*p == ',' || *p == ';') && !goteq ) { - /* If we get here, we have a case similar - * to =,,= - * This is not a valid dn */ - ldap_charray_free( rdns ); - return NULL; - } - goteq = 0; - ++count; - if ( rdns == NULL ) { - if (( rdns = (char **)NSLDAPI_MALLOC( 8 - * sizeof( char *))) == NULL ) - return( NULL ); - } else if ( count >= 8 ) { - if (( rdns = (char **)NSLDAPI_REALLOC( - rdns, (count+1) * - sizeof( char *))) == NULL ) - return( NULL ); - } - rdns[ count ] = NULL; - endquote = 0; - if ( notypes ) { - for ( q = rdnstart; - q < p && *q != '='; ++q ) { - ; - } - if ( q < p ) { /* *q == '=' */ - rdnstart = ++q; - } - if ( *rdnstart == '"' ) { - ++rdnstart; - } - - if ( *(p-1) == '"' ) { - endquote = 1; - --p; - } - } - - len = p - rdnstart; - if (( rdns[ count-1 ] = (char *)NSLDAPI_CALLOC( - 1, len + 1 )) != NULL ) { - SAFEMEMCPY( rdns[ count-1 ], rdnstart, - len ); - if ( !endquote ) { - /* trim trailing spaces */ - while ( len > 0 && - ldap_utf8isspace( - &rdns[count-1][len-1] )) { - --len; - } - } - rdns[ count-1 ][ len ] = '\0'; - } - - /* - * Don't forget to increment 'p' back to where - * it should be. If we don't, then we will - * never get past an "end quote." - */ - if ( endquote == 1 ) - p++; - - rdnstart = *p ? p + 1 : p; - while ( ldap_utf8isspace( rdnstart )) - ++rdnstart; - } - break; - case '=': - if ( state == OUTQUOTE ) { - goteq = 1; - } - /* FALL */ - default: - plen = LDAP_UTF8LEN(p); - break; - } - } while ( *p ); - - return( rdns ); -} - -char ** -LDAP_CALL -ldap_explode_dn( const char *dn, const int notypes ) -{ - return( ldap_explode( dn, notypes, LDAP_DN ) ); -} - -char ** -LDAP_CALL -ldap_explode_rdn( const char *rdn, const int notypes ) -{ - return( ldap_explode( rdn, notypes, LDAP_RDN ) ); -} - -int -LDAP_CALL -ldap_is_dns_dn( const char *dn ) -{ - return( dn != NULL && dn[ 0 ] != '\0' && strchr( dn, '=' ) == NULL && - strchr( dn, ',' ) == NULL ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/getdxbyname.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/getdxbyname.c deleted file mode 100644 index 7768d1f9ecc..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/getdxbyname.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * 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) 1995 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * nsldapi_getdxbyname - retrieve DX records from the DNS (from - * TXT records for now) - */ - -#include - -#ifdef LDAP_DNS - -XXX not MT-safe XXX - -#include -#include - -#ifdef macintosh -#include -#include "macos.h" -#endif /* macintosh */ - -#ifdef _WINDOWS -#include -#endif - -#if !defined(macintosh) && !defined(DOS) && !defined( _WINDOWS ) -#include -#include -#include -#include -#include -#include -#include -#include -#endif -#include "ldap-int.h" - -#if defined( DOS ) -#include "msdos.h" -#endif /* DOS */ - - -#ifdef NEEDPROTOS -static char ** decode_answer( unsigned char *answer, int len ); -#else /* NEEDPROTOS */ -static char **decode_answer(); -#endif /* NEEDPROTOS */ - -extern int h_errno; -extern char *h_errlist[]; - - -#define MAX_TO_SORT 32 - - -/* - * nsldapi_getdxbyname - lookup DNS DX records for domain and return an ordered - * array. - */ -char ** -nsldapi_getdxbyname( char *domain ) -{ - unsigned char buf[ PACKETSZ ]; - char **dxs; - int rc; - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_getdxbyname( %s )\n", domain, 0, 0 ); - - memset( buf, 0, sizeof( buf )); - - /* XXX not MT safe XXX */ - if (( rc = res_search( domain, C_IN, T_TXT, buf, sizeof( buf ))) < 0 - || ( dxs = decode_answer( buf, rc )) == NULL ) { - /* - * punt: return list conisting of the original domain name only - */ - if (( dxs = (char **)NSLDAPI_MALLOC( 2 * sizeof( char * ))) == NULL || - ( dxs[ 0 ] = nsldapi_strdup( domain )) == NULL ) { - if ( dxs != NULL ) { - NSLDAPI_FREE( dxs ); - } - dxs = NULL; - } else { - dxs[ 1 ] = NULL; - } - } - - return( dxs ); -} - - -static char ** -decode_answer( unsigned char *answer, int len ) -{ - HEADER *hp; - char buf[ 256 ], **dxs; - unsigned char *eom, *p; - int ancount, err, rc, type, class, dx_count, rr_len; - int dx_pref[ MAX_TO_SORT ]; - -#ifdef LDAP_DEBUG - if ( ldap_debug & LDAP_DEBUG_PACKETS ) { -/* __p_query( answer ); */ - } -#endif /* LDAP_DEBUG */ - - dxs = NULL; - hp = (HEADER *)answer; - eom = answer + len; - - if ( ntohs( hp->qdcount ) != 1 ) { - h_errno = NO_RECOVERY; - return( NULL ); - } - - ancount = ntohs( hp->ancount ); - if ( ancount < 1 ) { - h_errno = NO_DATA; - return( NULL ); - } - - /* - * skip over the query - */ - p = answer + HFIXEDSZ; - if (( rc = dn_expand( answer, eom, p, buf, sizeof( buf ))) < 0 ) { - h_errno = NO_RECOVERY; - return( NULL ); - } - p += ( rc + QFIXEDSZ ); - - /* - * pull out the answers we are interested in - */ - err = dx_count = 0; - while ( ancount > 0 && err == 0 && p < eom ) { - if (( rc = dn_expand( answer, eom, p, buf, sizeof( buf ))) < 0 ) { - err = NO_RECOVERY; - continue; - } - p += rc; /* skip over name */ - type = _getshort( p ); - p += INT16SZ; - class = _getshort( p ); - p += INT16SZ; - p += INT32SZ; /* skip over TTL */ - rr_len = _getshort( p ); - p += INT16SZ; - if ( class == C_IN && type == T_TXT ) { - int i, n, pref, txt_len; - char *q, *r; - - q = (char *)p; - while ( q < (char *)p + rr_len && err == 0 ) { - if ( *q >= 3 && strncasecmp( q + 1, "dx:", 3 ) == 0 ) { - txt_len = *q - 3; - r = q + 4; - while ( isspace( *r )) { - ++r; - --txt_len; - } - pref = 0; - while ( isdigit( *r )) { - pref *= 10; - pref += ( *r - '0' ); - ++r; - --txt_len; - } - if ( dx_count < MAX_TO_SORT - 1 ) { - dx_pref[ dx_count ] = pref; - } - while ( isspace( *r )) { - ++r; - --txt_len; - } - if ( dx_count == 0 ) { - dxs = (char **)NSLDAPI_MALLOC( 2 * sizeof( char * )); - } else { - dxs = (char **)NSLDAPI_REALLOC( dxs, - ( dx_count + 2 ) * sizeof( char * )); - } - if ( dxs == NULL || ( dxs[ dx_count ] = - (char *)NSLDAPI_CALLOC( 1, txt_len + 1 )) - == NULL ) { - err = NO_RECOVERY; - continue; - } - SAFEMEMCPY( dxs[ dx_count ], r, txt_len ); - dxs[ ++dx_count ] = NULL; - } - q += ( *q + 1 ); /* move past last TXT record */ - } - } - p += rr_len; - } - - if ( err == 0 ) { - if ( dx_count == 0 ) { - err = NO_DATA; - } else { - /* - * sort records based on associated preference value - */ - int i, j, sort_count, tmp_pref; - char *tmp_dx; - - sort_count = ( dx_count < MAX_TO_SORT ) ? dx_count : MAX_TO_SORT; - for ( i = 0; i < sort_count; ++i ) { - for ( j = i + 1; j < sort_count; ++j ) { - if ( dx_pref[ i ] > dx_pref[ j ] ) { - tmp_pref = dx_pref[ i ]; - dx_pref[ i ] = dx_pref[ j ]; - dx_pref[ j ] = tmp_pref; - tmp_dx = dxs[ i ]; - dxs[ i ] = dxs[ j ]; - dxs[ j ] = tmp_dx; - } - } - } - } - } - - h_errno = err; - return( dxs ); -} - -#endif /* LDAP_DNS */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/getentry.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/getentry.c deleted file mode 100644 index 3c08a628f1d..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/getentry.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * getentry.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -LDAPMessage * -LDAP_CALL -ldap_first_entry( LDAP *ld, LDAPMessage *chain ) -{ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || chain == NULLMSG ) { - return( NULLMSG ); - } - - if ( chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) { - return( chain ); - } - - return( ldap_next_entry( ld, chain )); -} - - -LDAPMessage * -LDAP_CALL -ldap_next_entry( LDAP *ld, LDAPMessage *entry ) -{ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || entry == NULLMSG ) { - return( NULLMSG ); - } - - for ( entry = entry->lm_chain; entry != NULLMSG; - entry = entry->lm_chain ) { - if ( entry->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) { - return( entry ); - } - } - - return( NULLMSG ); -} - -int -LDAP_CALL -ldap_count_entries( LDAP *ld, LDAPMessage *chain ) -{ - int i; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); - } - - for ( i = 0; chain != NULL; chain = chain->lm_chain ) { - if ( chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) { - ++i; - } - } - - return( i ); -} - - -int -LDAP_CALL -ldap_get_entry_controls( LDAP *ld, LDAPMessage *entry, - LDAPControl ***serverctrlsp ) -{ - int rc; - BerElement tmpber; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_get_entry_controls\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( !NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( entry ) - || serverctrlsp == NULL ) { - rc = LDAP_PARAM_ERROR; - goto report_error_and_return; - } - - *serverctrlsp = NULL; - tmpber = *entry->lm_ber; /* struct copy */ - - /* skip past dn and entire attribute/value list */ - if ( ber_scanf( &tmpber, "{xx" ) == LBER_ERROR ) { - rc = LDAP_DECODING_ERROR; - goto report_error_and_return; - } - - rc = nsldapi_get_controls( &tmpber, serverctrlsp ); - -report_error_and_return: - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/getfilter.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/getfilter.c deleted file mode 100644 index 9b6e566c3d8..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/getfilter.c +++ /dev/null @@ -1,536 +0,0 @@ -/* - * 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) 1993 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * getfilter.c -- optional add-on to libldap - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" -#include "regex.h" -#include /* sprintf */ - -static int break_into_words( char *str, char *delims, char ***wordsp ); -int nsldapi_next_line_tokens( char **bufp, long *blenp, char ***toksp ); -void nsldapi_free_strarray( char **sap ); - -#if !defined( macintosh ) && !defined( DOS ) -extern char * LDAP_CALL re_comp(); -#endif - -#define FILT_MAX_LINE_LEN 1024 - -LDAPFiltDesc * -LDAP_CALL -ldap_init_getfilter( char *fname ) -{ - FILE *fp; - char *buf; - long rlen, len; - int eof; - LDAPFiltDesc *lfdp; - - if (( fp = fopen( fname, "r" )) == NULL ) { - return( NULL ); - } - - if ( fseek( fp, 0L, SEEK_END ) != 0 ) { /* move to end to get len */ - fclose( fp ); - return( NULL ); - } - - len = ftell( fp ); - - if ( fseek( fp, 0L, SEEK_SET ) != 0 ) { /* back to start of file */ - fclose( fp ); - return( NULL ); - } - - if (( buf = NSLDAPI_MALLOC( (size_t)len )) == NULL ) { - fclose( fp ); - return( NULL ); - } - - rlen = fread( buf, 1, (size_t)len, fp ); - eof = feof( fp ); - fclose( fp ); - - if ( rlen != len && !eof ) { /* error: didn't get the whole file */ - NSLDAPI_FREE( buf ); - return( NULL ); - } - - - lfdp = ldap_init_getfilter_buf( buf, rlen ); - NSLDAPI_FREE( buf ); - - return( lfdp ); -} - - -LDAPFiltDesc * -LDAP_CALL -ldap_init_getfilter_buf( char *buf, long buflen ) -{ - LDAPFiltDesc *lfdp; - LDAPFiltList *flp, *nextflp; - LDAPFiltInfo *fip, *nextfip; - char *tag, **tok; - int tokcnt, i; - - if ( (buf == NULL) || (buflen < 0) || - ( lfdp = (LDAPFiltDesc *)NSLDAPI_CALLOC(1, sizeof( LDAPFiltDesc))) - == NULL ) { - return( NULL ); - } - - flp = nextflp = NULL; - fip = NULL; - tag = NULL; - - while ( buflen > 0 && ( tokcnt = nsldapi_next_line_tokens( &buf, &buflen, - &tok )) > 0 ) { - switch( tokcnt ) { - case 1: /* tag line */ - if ( tag != NULL ) { - NSLDAPI_FREE( tag ); - } - tag = tok[ 0 ]; - NSLDAPI_FREE( tok ); - break; - case 4: - case 5: /* start of filter info. list */ - if (( nextflp = (LDAPFiltList *)NSLDAPI_CALLOC( 1, - sizeof( LDAPFiltList ))) == NULL ) { - ldap_getfilter_free( lfdp ); - return( NULL ); - } - nextflp->lfl_tag = nsldapi_strdup( tag ); - nextflp->lfl_pattern = tok[ 0 ]; - if ( re_comp( nextflp->lfl_pattern ) != NULL ) { - char msg[256]; - ldap_getfilter_free( lfdp ); - sprintf( msg, "bad regular expresssion %s\n", - nextflp->lfl_pattern ); - ber_err_print( msg ); - nsldapi_free_strarray( tok ); - return( NULL ); - } - - nextflp->lfl_delims = tok[ 1 ]; - nextflp->lfl_ilist = NULL; - nextflp->lfl_next = NULL; - if ( flp == NULL ) { /* first one */ - lfdp->lfd_filtlist = nextflp; - } else { - flp->lfl_next = nextflp; - } - flp = nextflp; - fip = NULL; - for ( i = 2; i < 5; ++i ) { - tok[ i - 2 ] = tok[ i ]; - } - /* fall through */ - - case 2: - case 3: /* filter, desc, and optional search scope */ - if ( nextflp != NULL ) { /* add to info list */ - if (( nextfip = (LDAPFiltInfo *)NSLDAPI_CALLOC( 1, - sizeof( LDAPFiltInfo ))) == NULL ) { - ldap_getfilter_free( lfdp ); - nsldapi_free_strarray( tok ); - return( NULL ); - } - if ( fip == NULL ) { /* first one */ - nextflp->lfl_ilist = nextfip; - } else { - fip->lfi_next = nextfip; - } - fip = nextfip; - nextfip->lfi_next = NULL; - nextfip->lfi_filter = tok[ 0 ]; - nextfip->lfi_desc = tok[ 1 ]; - if ( tok[ 2 ] != NULL ) { - if ( strcasecmp( tok[ 2 ], "subtree" ) == 0 ) { - nextfip->lfi_scope = LDAP_SCOPE_SUBTREE; - } else if ( strcasecmp( tok[ 2 ], "onelevel" ) == 0 ) { - nextfip->lfi_scope = LDAP_SCOPE_ONELEVEL; - } else if ( strcasecmp( tok[ 2 ], "base" ) == 0 ) { - nextfip->lfi_scope = LDAP_SCOPE_BASE; - } else { - nsldapi_free_strarray( tok ); - ldap_getfilter_free( lfdp ); - return( NULL ); - } - NSLDAPI_FREE( tok[ 2 ] ); - tok[ 2 ] = NULL; - } else { - nextfip->lfi_scope = LDAP_SCOPE_SUBTREE; /* default */ - } - nextfip->lfi_isexact = ( strchr( tok[ 0 ], '*' ) == NULL && - strchr( tok[ 0 ], '~' ) == NULL ); - NSLDAPI_FREE( tok ); - } - break; - - default: - nsldapi_free_strarray( tok ); - ldap_getfilter_free( lfdp ); - return( NULL ); - } - } - - if ( tag != NULL ) { - NSLDAPI_FREE( tag ); - } - - return( lfdp ); -} - - -int -LDAP_CALL -ldap_set_filter_additions( LDAPFiltDesc *lfdp, char *prefix, char *suffix ) -{ - if ( lfdp == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - if ( lfdp->lfd_filtprefix != NULL ) { - NSLDAPI_FREE( lfdp->lfd_filtprefix ); - } - lfdp->lfd_filtprefix = ( prefix == NULL ) ? NULL : nsldapi_strdup( prefix ); - - if ( lfdp->lfd_filtsuffix != NULL ) { - NSLDAPI_FREE( lfdp->lfd_filtsuffix ); - } - lfdp->lfd_filtsuffix = ( suffix == NULL ) ? NULL : nsldapi_strdup( suffix ); - - return( LDAP_SUCCESS ); -} - - -/* - * ldap_setfilteraffixes() is deprecated -- use ldap_set_filter_additions() - */ -void -LDAP_CALL -ldap_setfilteraffixes( LDAPFiltDesc *lfdp, char *prefix, char *suffix ) -{ - (void)ldap_set_filter_additions( lfdp, prefix, suffix ); -} - - -LDAPFiltInfo * -LDAP_CALL -ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value ) -{ - LDAPFiltList *flp; - - if ( lfdp == NULL || tagpat == NULL || value == NULL ) { - return( NULL ); /* punt */ - } - - if ( lfdp->lfd_curvalcopy != NULL ) { - NSLDAPI_FREE( lfdp->lfd_curvalcopy ); - NSLDAPI_FREE( lfdp->lfd_curvalwords ); - } - - lfdp->lfd_curval = value; - lfdp->lfd_curfip = NULL; - - for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = flp->lfl_next ) { - if ( re_comp( tagpat ) == NULL && re_exec( flp->lfl_tag ) == 1 - && re_comp( flp->lfl_pattern ) == NULL - && re_exec( lfdp->lfd_curval ) == 1 ) { - lfdp->lfd_curfip = flp->lfl_ilist; - break; - } - } - - if ( lfdp->lfd_curfip == NULL ) { - return( NULL ); - } - - if (( lfdp->lfd_curvalcopy = nsldapi_strdup( value )) == NULL ) { - return( NULL ); - } - - if ( break_into_words( lfdp->lfd_curvalcopy, flp->lfl_delims, - &lfdp->lfd_curvalwords ) < 0 ) { - NSLDAPI_FREE( lfdp->lfd_curvalcopy ); - lfdp->lfd_curvalcopy = NULL; - return( NULL ); - } - - return( ldap_getnextfilter( lfdp )); -} - - -LDAPFiltInfo * -LDAP_CALL -ldap_getnextfilter( LDAPFiltDesc *lfdp ) -{ - LDAPFiltInfo *fip; - - if ( lfdp == NULL || ( fip = lfdp->lfd_curfip ) == NULL ) { - return( NULL ); - } - - lfdp->lfd_curfip = fip->lfi_next; - - ldap_build_filter( lfdp->lfd_filter, LDAP_FILT_MAXSIZ, fip->lfi_filter, - lfdp->lfd_filtprefix, lfdp->lfd_filtsuffix, NULL, - lfdp->lfd_curval, lfdp->lfd_curvalwords ); - lfdp->lfd_retfi.lfi_filter = lfdp->lfd_filter; - lfdp->lfd_retfi.lfi_desc = fip->lfi_desc; - lfdp->lfd_retfi.lfi_scope = fip->lfi_scope; - lfdp->lfd_retfi.lfi_isexact = fip->lfi_isexact; - - return( &lfdp->lfd_retfi ); -} - - -static char* -filter_add_strn( char *f, char *flimit, char *v, size_t vlen ) - /* Copy v into f. If flimit is too small, return NULL; - * otherwise return (f + vlen). - */ -{ - auto size_t flen = flimit - f; - if ( vlen > flen ) { /* flimit is too small */ - if ( flen > 0 ) SAFEMEMCPY( f, v, flen ); - return NULL; - } - if ( vlen > 0 ) SAFEMEMCPY( f, v, vlen ); - return f + vlen; -} - -static char* -filter_add_value( char *f, char *flimit, char *v, int escape_all ) - /* Copy v into f, but with parentheses escaped. But only escape * and \ - * if escape_all is non-zero so that either "*" or "\2a" can be used in - * v, with different meanings. - * If flimit is too small, return NULL; otherwise - * return (f + the number of bytes copied). - */ -{ - auto char x[4]; - auto size_t slen; - while ( f && *v ) { - switch ( *v ) { - case '*': - if ( escape_all ) { - f = filter_add_strn( f, flimit, "\\2a", 3 ); - v++; - } else { - if ( f < flimit ) { - *f++ = *v++; - } else { - f = NULL; /* overflow */ - } - } - break; - - case '(': - case ')': - sprintf( x, "\\%02x", (unsigned)*v ); - f = filter_add_strn( f, flimit, x, 3 ); - v++; - break; - - case '\\': - if ( escape_all ) { - f = filter_add_strn( f, flimit, "\\5c", 3 ); - v++; - } else { - slen = (ldap_utf8isxdigit( v+1 ) && - ldap_utf8isxdigit( v+2 )) ? 3 : (v[1] ? 2 : 1); - f = filter_add_strn( f, flimit, v, slen ); - v += slen; - } - break; - - default: - if ( f < flimit ) { - *f++ = *v++; - } else { - f = NULL; /* overflow */ - } - break; - } - } - return f; -} - -int -LDAP_CALL -ldap_create_filter( char *filtbuf, unsigned long buflen, char *pattern, - char *prefix, char *suffix, char *attr, char *value, char **valwords ) -{ - char *p, *f, *flimit; - int i, wordcount, wordnum, endwordnum, escape_all; - - /* - * there is some confusion on what to create for a filter if - * attr or value are null pointers. For now we just leave them - * as TO BE DEALT with - */ - - if ( filtbuf == NULL || buflen == 0 || pattern == NULL ){ - return( LDAP_PARAM_ERROR ); - } - - if ( valwords == NULL ) { - wordcount = 0; - } else { - for ( wordcount = 0; valwords[ wordcount ] != NULL; ++wordcount ) { - ; - } - } - - f = filtbuf; - flimit = filtbuf + buflen - 1; - - if ( prefix != NULL ) { - f = filter_add_strn( f, flimit, prefix, strlen( prefix )); - } - - for ( p = pattern; f != NULL && *p != '\0'; ++p ) { - if ( *p == '%' ) { - ++p; - if ( *p == 'v' || *p == 'e' ) { - escape_all = ( *p == 'e' ); - if ( ldap_utf8isdigit( p+1 )) { - ++p; - wordnum = *p - '1'; - if ( *(p+1) == '-' ) { - ++p; - if ( ldap_utf8isdigit( p+1 )) { - ++p; - endwordnum = *p - '1'; /* e.g., "%v2-4" */ - if ( endwordnum > wordcount - 1 ) { - endwordnum = wordcount - 1; - } - } else { - endwordnum = wordcount - 1; /* e.g., "%v2-" */ - } - } else { - endwordnum = wordnum; /* e.g., "%v2" */ - } - - if ( wordcount > 0 ) { - for ( i = wordnum; i <= endwordnum; ++i ) { - if ( i > wordnum ) { /* add blank btw words */ - f = filter_add_strn( f, flimit, " ", 1 ); - if ( f == NULL ) break; - } - f = filter_add_value( f, flimit, valwords[ i ], - escape_all ); - if ( f == NULL ) break; - } - } - } else if ( *(p+1) == '$' ) { - ++p; - if ( wordcount > 0 ) { - wordnum = wordcount - 1; - f = filter_add_value( f, flimit, - valwords[ wordnum ], escape_all ); - } - } else if ( value != NULL ) { - f = filter_add_value( f, flimit, value, escape_all ); - } - } else if ( *p == 'a' && attr != NULL ) { - f = filter_add_strn( f, flimit, attr, strlen( attr )); - } else { - *f++ = *p; - } - } else { - *f++ = *p; - } - if ( f > flimit ) { /* overflow */ - f = NULL; - } - } - - if ( suffix != NULL && f != NULL) { - f = filter_add_strn( f, flimit, suffix, strlen( suffix )); - } - - if ( f == NULL ) { - *flimit = '\0'; - return( LDAP_SIZELIMIT_EXCEEDED ); - } - *f = '\0'; - return( LDAP_SUCCESS ); -} - - -/* - * ldap_build_filter() is deprecated -- use ldap_create_filter() instead - */ -void -LDAP_CALL -ldap_build_filter( char *filtbuf, unsigned long buflen, char *pattern, - char *prefix, char *suffix, char *attr, char *value, char **valwords ) -{ - (void)ldap_create_filter( filtbuf, buflen, pattern, prefix, suffix, attr, - value, valwords ); -} - - -static int -break_into_words( char *str, char *delims, char ***wordsp ) -{ - char *word, **words; - int count; - char *lasts; - - if (( words = (char **)NSLDAPI_CALLOC( 1, sizeof( char * ))) == NULL ) { - return( -1 ); - } - count = 0; - words[ count ] = NULL; - - word = ldap_utf8strtok_r( str, delims, &lasts ); - while ( word != NULL ) { - if (( words = (char **)NSLDAPI_REALLOC( words, - ( count + 2 ) * sizeof( char * ))) == NULL ) { - return( -1 ); - } - - words[ count ] = word; - words[ ++count ] = NULL; - word = ldap_utf8strtok_r( NULL, delims, &lasts ); - } - - *wordsp = words; - return( count ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/getoption.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/getoption.c deleted file mode 100644 index 56dafa46c2d..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/getoption.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * 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 "ldap-int.h" - -#define LDAP_GET_BITOPT( ld, bit ) \ - ((ld)->ld_options & bit ) != 0 ? 1 : 0 - -static int nsldapi_get_api_info( LDAPAPIInfo *aip ); -static int nsldapi_get_feature_info( LDAPAPIFeatureInfo *fip ); - - -int -LDAP_CALL -ldap_get_option( LDAP *ld, int option, void *optdata ) -{ - int rc = 0; - - if ( !nsldapi_initialized ) { - nsldapi_initialize_defaults(); - } - - /* - * optdata MUST be a valid pointer... - */ - if (NULL == optdata) - { - return(LDAP_PARAM_ERROR); - } - /* - * process global options (not associated with an LDAP session handle) - */ - if ( option == LDAP_OPT_MEMALLOC_FN_PTRS ) { - /* struct copy */ - *((struct ldap_memalloc_fns *)optdata) = nsldapi_memalloc_fns; - return( 0 ); - } - - if ( option == LDAP_OPT_API_INFO ) { - rc = nsldapi_get_api_info( (LDAPAPIInfo *)optdata ); - if ( rc != LDAP_SUCCESS ) { - if ( ld != NULL ) { - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - } - return( -1 ); - } - return( 0 ); - } - /* - * LDAP_OPT_DEBUG_LEVEL is global - */ - if (LDAP_OPT_DEBUG_LEVEL == option) - { -#ifdef LDAP_DEBUG - *((int *) optdata) = ldap_debug; -#endif /* LDAP_DEBUG */ - return ( 0 ); - } - - /* - * if ld is NULL, arrange to return options from our default settings - */ - if ( ld == NULL ) { - ld = &nsldapi_ld_defaults; - } - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); /* punt */ - } - - - if (ld != &nsldapi_ld_defaults) - LDAP_MUTEX_LOCK( ld, LDAP_OPTION_LOCK ); - switch( option ) { -#ifdef LDAP_DNS - case LDAP_OPT_DNS: - *((int *) optdata) = LDAP_GET_BITOPT( ld, LDAP_BITOPT_DNS ); - break; -#endif - - case LDAP_OPT_REFERRALS: - *((int *) optdata) = - LDAP_GET_BITOPT( ld, LDAP_BITOPT_REFERRALS ); - break; - - case LDAP_OPT_SSL: - *((int *) optdata) = LDAP_GET_BITOPT( ld, LDAP_BITOPT_SSL ); - break; - - case LDAP_OPT_RESTART: - *((int *) optdata) = LDAP_GET_BITOPT( ld, LDAP_BITOPT_RESTART ); - break; - - case LDAP_OPT_RECONNECT: - *((int *) optdata) = - LDAP_GET_BITOPT( ld, LDAP_BITOPT_RECONNECT ); - break; - -#ifdef LDAP_ASYNC_IO - case LDAP_OPT_ASYNC_CONNECT: - *((int *) optdata) = - LDAP_GET_BITOPT( ld, LDAP_BITOPT_ASYNC ); - break; -#endif /* LDAP_ASYNC_IO */ - - /* stuff in the sockbuf */ - case LDAP_OPT_DESC: - if ( ber_sockbuf_get_option( ld->ld_sbp, - LBER_SOCKBUF_OPT_DESC, optdata ) != 0 ) { - LDAP_SET_LDERRNO( ld, LDAP_LOCAL_ERROR, NULL, NULL ); - rc = -1; - } - break; - - /* fields in the LDAP structure */ - case LDAP_OPT_DEREF: - *((int *) optdata) = ld->ld_deref; - break; - case LDAP_OPT_SIZELIMIT: - *((int *) optdata) = ld->ld_sizelimit; - break; - case LDAP_OPT_TIMELIMIT: - *((int *) optdata) = ld->ld_timelimit; - break; - case LDAP_OPT_REFERRAL_HOP_LIMIT: - *((int *) optdata) = ld->ld_refhoplimit; - break; - case LDAP_OPT_PROTOCOL_VERSION: - *((int *) optdata) = ld->ld_version; - break; - case LDAP_OPT_SERVER_CONTROLS: - /* fall through */ - case LDAP_OPT_CLIENT_CONTROLS: - *((LDAPControl ***)optdata) = NULL; - /* nsldapi_dup_controls returns -1 and sets lderrno on error */ - rc = nsldapi_dup_controls( ld, (LDAPControl ***)optdata, - ( option == LDAP_OPT_SERVER_CONTROLS ) ? - ld->ld_servercontrols : ld->ld_clientcontrols ); - break; - - /* rebind proc */ - case LDAP_OPT_REBIND_FN: - *((LDAP_REBINDPROC_CALLBACK **) optdata) = ld->ld_rebind_fn; - break; - case LDAP_OPT_REBIND_ARG: - *((void **) optdata) = ld->ld_rebind_arg; - break; - - /* i/o function pointers */ - case LDAP_OPT_IO_FN_PTRS: - if ( ld->ld_io_fns_ptr == NULL ) { - memset( optdata, 0, sizeof( struct ldap_io_fns )); - } else { - /* struct copy */ - *((struct ldap_io_fns *)optdata) = *(ld->ld_io_fns_ptr); - } - break; - - /* extended i/o function pointers */ - case LDAP_X_OPT_EXTIO_FN_PTRS: - if ( ((struct ldap_x_ext_io_fns *) optdata)->lextiof_size == LDAP_X_EXTIO_FNS_SIZE_REV0) { - ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_close = ld->ld_extclose_fn; - ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_connect = ld->ld_extconnect_fn; - ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_read = ld->ld_extread_fn; - ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_write = ld->ld_extwrite_fn; - ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_poll = ld->ld_extpoll_fn; - ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_newhandle = ld->ld_extnewhandle_fn; - ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_disposehandle = ld->ld_extdisposehandle_fn; - ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_session_arg = ld->ld_ext_session_arg; - } else if ( ((struct ldap_x_ext_io_fns *) optdata)->lextiof_size == - LDAP_X_EXTIO_FNS_SIZE ) { - /* struct copy */ - *((struct ldap_x_ext_io_fns *) optdata) = ld->ld_ext_io_fns; - } else { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - rc = -1; - } - break; - - /* thread function pointers */ - case LDAP_OPT_THREAD_FN_PTRS: - /* struct copy */ - *((struct ldap_thread_fns *) optdata) = ld->ld_thread; - break; - - /* DNS function pointers */ - case LDAP_OPT_DNS_FN_PTRS: - /* struct copy */ - *((struct ldap_dns_fns *) optdata) = ld->ld_dnsfn; - break; - - /* cache function pointers */ - case LDAP_OPT_CACHE_FN_PTRS: - /* struct copy */ - *((struct ldap_cache_fns *) optdata) = ld->ld_cache; - break; - case LDAP_OPT_CACHE_STRATEGY: - *((int *) optdata) = ld->ld_cache_strategy; - break; - case LDAP_OPT_CACHE_ENABLE: - *((int *) optdata) = ld->ld_cache_on; - break; - - case LDAP_OPT_ERROR_NUMBER: - *((int *) optdata) = LDAP_GET_LDERRNO( ld, NULL, NULL ); - break; - - case LDAP_OPT_ERROR_STRING: - (void)LDAP_GET_LDERRNO( ld, NULL, (char **)optdata ); - *((char **) optdata) = nsldapi_strdup( *((char **) optdata )); - break; - - case LDAP_OPT_MATCHED_DN: - (void)LDAP_GET_LDERRNO( ld, (char **)optdata, NULL ); - *((char **) optdata) = nsldapi_strdup( *((char **) optdata )); - break; - - case LDAP_OPT_PREFERRED_LANGUAGE: - if ( NULL != ld->ld_preferred_language ) { - *((char **) optdata) = - nsldapi_strdup(ld->ld_preferred_language); - } else { - *((char **) optdata) = NULL; - } - break; - - case LDAP_OPT_API_FEATURE_INFO: - rc = nsldapi_get_feature_info( (LDAPAPIFeatureInfo *)optdata ); - if ( rc != LDAP_SUCCESS ) { - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - rc = -1; - } - break; - - case LDAP_OPT_HOST_NAME: - *((char **) optdata) = nsldapi_strdup( ld->ld_defhost ); - break; - - case LDAP_X_OPT_CONNECT_TIMEOUT: - *((int *) optdata) = ld->ld_connect_timeout; - break; - - default: - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - rc = -1; - } - if (ld != &nsldapi_ld_defaults) - LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK ); - return( rc ); -} - - -/* - * Table of extended API features we support. - * The first field is the version of the info. strcuture itself; we do not - * use the ones from this table so it is okay to leave as zero. - */ -static LDAPAPIFeatureInfo nsldapi_extensions[] = { - { 0, "SERVER_SIDE_SORT", LDAP_API_FEATURE_SERVER_SIDE_SORT }, - { 0, "VIRTUAL_LIST_VIEW", LDAP_API_FEATURE_VIRTUAL_LIST_VIEW }, - { 0, "PERSISTENT_SEARCH", LDAP_API_FEATURE_PERSISTENT_SEARCH }, - { 0, "PROXY_AUTHORIZATION", LDAP_API_FEATURE_PROXY_AUTHORIZATION }, - { 0, "X_LDERRNO", LDAP_API_FEATURE_X_LDERRNO }, - { 0, "X_MEMCACHE", LDAP_API_FEATURE_X_MEMCACHE }, - { 0, "X_IO_FUNCTIONS", LDAP_API_FEATURE_X_IO_FUNCTIONS }, - { 0, "X_EXTIO_FUNCTIONS", LDAP_API_FEATURE_X_EXTIO_FUNCTIONS }, - { 0, "X_DNS_FUNCTIONS", LDAP_API_FEATURE_X_DNS_FUNCTIONS }, - { 0, "X_MEMALLOC_FUNCTIONS", LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS }, - { 0, "X_THREAD_FUNCTIONS", LDAP_API_FEATURE_X_THREAD_FUNCTIONS }, - { 0, "X_EXTHREAD_FUNCTIONS", LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS }, - { 0, "X_GETLANGVALUES", LDAP_API_FEATURE_X_GETLANGVALUES }, - { 0, "X_CLIENT_SIDE_SORT", LDAP_API_FEATURE_X_CLIENT_SIDE_SORT }, - { 0, "X_URL_FUNCTIONS", LDAP_API_FEATURE_X_URL_FUNCTIONS }, - { 0, "X_FILTER_FUNCTIONS", LDAP_API_FEATURE_X_FILTER_FUNCTIONS }, -}; - -#define NSLDAPI_EXTENSIONS_COUNT \ - (sizeof(nsldapi_extensions)/sizeof(LDAPAPIFeatureInfo)) - -/* - * Retrieve information about this implementation of the LDAP API. - * Returns an LDAP error code. - */ -static int -nsldapi_get_api_info( LDAPAPIInfo *aip ) -{ - int i; - - if ( aip == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - aip->ldapai_api_version = LDAP_API_VERSION; - - if ( aip->ldapai_info_version != LDAP_API_INFO_VERSION ) { - aip->ldapai_info_version = LDAP_API_INFO_VERSION; - return( LDAP_PARAM_ERROR ); - } - - aip->ldapai_protocol_version = LDAP_VERSION_MAX; - aip->ldapai_vendor_version = LDAP_VENDOR_VERSION; - - if (( aip->ldapai_vendor_name = nsldapi_strdup( LDAP_VENDOR_NAME )) - == NULL ) { - return( LDAP_NO_MEMORY ); - } - - if ( NSLDAPI_EXTENSIONS_COUNT < 1 ) { - aip->ldapai_extensions = NULL; - } else { - if (( aip->ldapai_extensions = NSLDAPI_CALLOC( - NSLDAPI_EXTENSIONS_COUNT + 1, sizeof(char *))) == NULL ) { - NSLDAPI_FREE( aip->ldapai_vendor_name ); - aip->ldapai_vendor_name = NULL; - return( LDAP_NO_MEMORY ); - } - - for ( i = 0; i < NSLDAPI_EXTENSIONS_COUNT; ++i ) { - if (( aip->ldapai_extensions[i] = nsldapi_strdup( - nsldapi_extensions[i].ldapaif_name )) == NULL ) { - ldap_value_free( aip->ldapai_extensions ); - NSLDAPI_FREE( aip->ldapai_vendor_name ); - aip->ldapai_extensions = NULL; - aip->ldapai_vendor_name = NULL; - return( LDAP_NO_MEMORY ); - } - } - } - - return( LDAP_SUCCESS ); -} - - -/* - * Retrieves information about a specific extended feature of the LDAP API/ - * Returns an LDAP error code. - */ -static int -nsldapi_get_feature_info( LDAPAPIFeatureInfo *fip ) -{ - int i; - - if ( fip == NULL || fip->ldapaif_name == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - if ( fip->ldapaif_info_version != LDAP_FEATURE_INFO_VERSION ) { - fip->ldapaif_info_version = LDAP_FEATURE_INFO_VERSION; - return( LDAP_PARAM_ERROR ); - } - - for ( i = 0; i < NSLDAPI_EXTENSIONS_COUNT; ++i ) { - if ( strcmp( fip->ldapaif_name, - nsldapi_extensions[i].ldapaif_name ) == 0 ) { - fip->ldapaif_version = - nsldapi_extensions[i].ldapaif_version; - break; - } - } - - return(( i < NSLDAPI_EXTENSIONS_COUNT ) ? LDAP_SUCCESS - : LDAP_PARAM_ERROR ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/getvalues.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/getvalues.c deleted file mode 100644 index b0750a85e02..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/getvalues.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * getvalues.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - - -static void ** -internal_ldap_get_values( LDAP *ld, LDAPMessage *entry, const char *target, - int lencall ) -{ - struct berelement ber; - char *attr; - int rc; - void **vals; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( NULL ); /* punt */ - } - if ( target == NULL || - !NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( entry )) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( NULL ); - } - - ber = *entry->lm_ber; - - /* skip sequence, dn, sequence of, and snag the first attr */ - if ( ber_scanf( &ber, "{x{{a", &attr ) == LBER_ERROR ) { - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL ); - return( NULL ); - } - - rc = strcasecmp( (char *)target, attr ); - NSLDAPI_FREE( attr ); - if ( rc != 0 ) { - while ( 1 ) { - if ( ber_scanf( &ber, "x}{a", &attr ) == LBER_ERROR ) { - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, - NULL, NULL ); - return( NULL ); - } - - rc = strcasecmp( (char *)target, attr ); - if ( rc == 0 ) { - NSLDAPI_FREE( attr ); - break; - } - NSLDAPI_FREE( attr ); - } - } - - /* - * if we get this far, we've found the attribute and are sitting - * just before the set of values. - */ - - if ( lencall ) { - rc = ber_scanf( &ber, "[V]", &vals ); - } else { - rc = ber_scanf( &ber, "[v]", &vals ); - } - - if ( rc == LBER_ERROR ) { - rc = LDAP_DECODING_ERROR; - } else { - rc = LDAP_SUCCESS; - } - - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - - return(( rc == LDAP_SUCCESS ) ? vals : NULL ); -} - - -/* For language-sensitive attribute matching, we are looking for a - language tag that looks like one of the following: - - cn - cn;lang-en - cn;lang-en-us - cn;lang-ja - cn;lang-ja-JP-kanji - - The base language specification consists of two letters following - "lang-". After that, there may be additional language-specific - narrowings preceded by a "-". In our processing we go from the - specific to the general, preferring a complete subtype match, but - accepting a partial one. For example: - - For a request for "cn;lang-en-us", we would return cn;lang-en-us - if present, otherwise cn;lang-en if present, otherwise cn. - - Besides the language subtype, there may be other subtypes: - - cn;lang-ja;binary (Unlikely!) - cn;lang-ja;phonetic - - If not in the target, they are ignored. If they are in the target, - they must be in the attribute to match. -*/ -#define LANG_SUBTYPE_INDEX_NONE -1 -#define LANG_SUBTYPE_INDEX_DUPLICATE -2 - -typedef struct { - int start; - int length; -} _SubStringIndex; - -static int -parse_subtypes( const char *target, int *baseLenp, char **langp, - _SubStringIndex **subs, int *nsubtypes ) -{ - int nSubtypes = 0; - int ind = 0; - char *nextToken; - _SubStringIndex *result = NULL; - int langIndex; - int targetLen; - int subtypeStart; - - langIndex = LANG_SUBTYPE_INDEX_NONE; - *subs = NULL; - *langp = NULL; - *baseLenp = 0; - *nsubtypes = 0; - targetLen = strlen( target ); - - /* Parse past base attribute */ - nextToken = strchr( target, ';' ); - if ( NULL != nextToken ) { - subtypeStart = nextToken - target + 1; - *baseLenp = subtypeStart - 1; - } - else { - subtypeStart = targetLen; - *baseLenp = subtypeStart; - } - ind = subtypeStart; - - /* How many subtypes? */ - nextToken = (char *)target + subtypeStart; - while ( nextToken && *nextToken ) { - char *thisToken = nextToken; - nextToken = strchr( thisToken, ';' ); - if ( NULL != nextToken ) - nextToken++; - if ( 0 == strncasecmp( thisToken, "lang-", 5 ) ) { - /* If there was a previous lang tag, this is illegal! */ - if ( langIndex != LANG_SUBTYPE_INDEX_NONE ) { - langIndex = LANG_SUBTYPE_INDEX_DUPLICATE; - return langIndex; - } - else { - langIndex = nSubtypes; - } - } else { - nSubtypes++; - } - } - /* No language subtype? */ - if ( langIndex < 0 ) - return langIndex; - - /* Allocate array of non-language subtypes */ - if ( nSubtypes > 0 ) { - result = (_SubStringIndex *)NSLDAPI_MALLOC( sizeof(*result) - * nSubtypes ); - memset( result, 0, sizeof(*result) * nSubtypes ); - } - ind = 0; - nSubtypes = 0; - ind = subtypeStart; - nextToken = (char *)target + subtypeStart; - while ( nextToken && *nextToken ) { - char *thisToken = nextToken; - int len; - nextToken = strchr( thisToken, ';' ); - if ( NULL != nextToken ) { - len = nextToken - thisToken; - nextToken++; - } - else { - nextToken = (char *)target + targetLen; - len = nextToken - thisToken; - } - if ( 0 == strncasecmp( thisToken, "lang-", 5 ) ) { - int i; - *langp = (char *)NSLDAPI_MALLOC( len + 1 ); - for( i = 0; i < len; i++ ) - (*langp)[i] = toupper( target[ind+i] ); - (*langp)[len] = 0; - } - else { - result[nSubtypes].start = thisToken - target; - result[nSubtypes].length = len; - nSubtypes++; - } - } - *subs = result; - *nsubtypes = nSubtypes; - return langIndex; -} - - -static int -check_lang_match( const char *target, const char *baseTarget, - _SubStringIndex *targetTypes, - int ntargetTypes, char *targetLang, char *attr ) -{ - int langIndex; - _SubStringIndex *subtypes; - int baseLen; - char *lang; - int nsubtypes; - int mismatch = 0; - int match = -1; - int i; - - /* Get all subtypes in the attribute name */ - langIndex = parse_subtypes( attr, &baseLen, &lang, &subtypes, &nsubtypes ); - - /* Check if there any required non-language subtypes which are - not in this attribute */ - for( i = 0; i < ntargetTypes; i++ ) { - char *t = (char *)target+targetTypes[i].start; - int tlen = targetTypes[i].length; - int j; - for( j = 0; j < nsubtypes; j++ ) { - char *a = attr + subtypes[j].start; - int alen = subtypes[j].length; - if ( (tlen == alen) && !strncasecmp( t, a, tlen ) ) - break; - } - if ( j >= nsubtypes ) { - mismatch = 1; - break; - } - } - if ( mismatch ) { - if ( NULL != subtypes ) - NSLDAPI_FREE( subtypes ); - if ( NULL != lang ) - NSLDAPI_FREE( lang ); - return -1; - } - - /* If there was no language subtype... */ - if ( langIndex < 0 ) { - if ( NULL != subtypes ) - NSLDAPI_FREE( subtypes ); - if ( NULL != lang ) - NSLDAPI_FREE( lang ); - if ( LANG_SUBTYPE_INDEX_NONE == langIndex ) - return 0; - else - return -1; - } - - /* Okay, now check the language subtag */ - i = 0; - while( targetLang[i] && lang[i] && - (toupper(targetLang[i]) == toupper(lang[i])) ) - i++; - - /* The total length can't be longer than the requested subtype */ - if ( !lang[i] || (lang[i] == ';') ) { - /* If the found subtype is shorter than the requested one, the next - character in the requested one should be "-" */ - if ( !targetLang[i] || (targetLang[i] == '-') ) - match = i; - } - return match; -} - -static int check_base_match( const char *target, char *attr ) -{ - int i = 0; - int rc; - while( target[i] && attr[i] && (toupper(target[i]) == toupper(attr[i])) ) - i++; - rc = ( !target[i] && (!attr[i] || (';' == attr[i])) ); - return rc; -} - -static void ** -internal_ldap_get_lang_values( LDAP *ld, LDAPMessage *entry, - const char *target, char **type, int lencall ) -{ - struct berelement ber; - char *attr = NULL; - int rc; - void **vals = NULL; - int langIndex; - _SubStringIndex *subtypes; - int nsubtypes; - char *baseTarget = NULL; - int bestMatch = 0; - char *lang = NULL; - int len; - int firstAttr = 1; - char *bestType = NULL; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( NULL ); - } - if ( (target == NULL) || - !NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( entry )) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( NULL ); - } - - /* A language check was requested, so see if there really is a - language subtype in the attribute spec */ - langIndex = parse_subtypes( target, &len, &lang, - &subtypes, &nsubtypes ); - if ( langIndex < 0 ) { - if ( NULL != subtypes ) { - NSLDAPI_FREE( subtypes ); - subtypes = NULL; - } - vals = internal_ldap_get_values( ld, entry, target, lencall ); - if ( NULL != type ) - *type = nsldapi_strdup( target ); - return vals; - } else { - /* Get just the base attribute name */ - baseTarget = (char *)NSLDAPI_MALLOC( len + 1 ); - memcpy( baseTarget, target, len ); - baseTarget[len] = 0; - } - - ber = *entry->lm_ber; - - /* Process all attributes in the entry */ - while ( 1 ) { - int foundMatch = 0; - if ( NULL != attr ) - NSLDAPI_FREE( attr ); - if ( firstAttr ) { - firstAttr = 0; - /* skip sequence, dn, sequence of, and snag the first attr */ - if ( ber_scanf( &ber, "{x{{a", &attr ) == LBER_ERROR ) { - break; - } - } else { - if ( ber_scanf( &ber, "{a", &attr ) == LBER_ERROR ) { - break; - } - } - - if ( check_base_match( (const char *)baseTarget, attr ) ) { - int thisMatch = check_lang_match( target, baseTarget, - subtypes, nsubtypes, lang, attr ); - if ( thisMatch > bestMatch ) { - if ( vals ) - NSLDAPI_FREE( vals ); - foundMatch = 1; - bestMatch = thisMatch; - if ( NULL != bestType ) - NSLDAPI_FREE( bestType ); - bestType = attr; - attr = NULL; - } - } - if ( foundMatch ) { - if ( lencall ) { - rc = ber_scanf( &ber, "[V]}", &vals ); - } else { - rc = ber_scanf( &ber, "[v]}", &vals ); - } - } else { - ber_scanf( &ber, "x}" ); - } - } - - NSLDAPI_FREE( lang ); - NSLDAPI_FREE( baseTarget ); - NSLDAPI_FREE( subtypes ); - - if ( NULL != type ) - *type = bestType; - else if ( NULL != bestType ) - NSLDAPI_FREE( bestType ); - - if ( NULL == vals ) { - rc = LDAP_DECODING_ERROR; - } else { - rc = LDAP_SUCCESS; - } - - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - - return( vals ); -} - - -char ** -LDAP_CALL -ldap_get_values( LDAP *ld, LDAPMessage *entry, const char *target ) -{ - return( (char **) internal_ldap_get_values( ld, entry, target, 0 ) ); -} - -struct berval ** -LDAP_CALL -ldap_get_values_len( LDAP *ld, LDAPMessage *entry, const char *target ) -{ - return( (struct berval **) internal_ldap_get_values( ld, entry, target, - 1 ) ); -} - -char ** -LDAP_CALL -ldap_get_lang_values( LDAP *ld, LDAPMessage *entry, const char *target, - char **type ) -{ - return( (char **) internal_ldap_get_lang_values( ld, entry, - target, type, 0 ) ); -} - -struct berval ** -LDAP_CALL -ldap_get_lang_values_len( LDAP *ld, LDAPMessage *entry, const char *target, - char **type ) -{ - return( (struct berval **) internal_ldap_get_lang_values( ld, entry, - target, type, 1 ) ); -} - diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/globals.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/globals.c deleted file mode 100644 index 48e1eca5416..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/globals.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * LIBLDAP globals.c -- LDAP library global variables - */ - - -#ifdef LDAP_DEBUG -int ldap_debug; -#endif diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldap-int.h b/mozilla/directory/c-sdk/ldap/libraries/libldap/ldap-int.h deleted file mode 100644 index dae46a78baa..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldap-int.h +++ /dev/null @@ -1,807 +0,0 @@ -/* - * 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 _LDAPINT_H -#define _LDAPINT_H - -#include -#include -#include -#include -#include -#include -#ifdef hpux -#include -#endif /* hpux */ - -#ifdef _WINDOWS -# define FD_SETSIZE 256 /* number of connections we support */ -# define WIN32_LEAN_AND_MEAN -# include -#elif defined(macintosh) -#include "ldap-macos.h" -#elif defined(XP_OS2) -#include -#else /* _WINDOWS */ -# include -# include -# include -# include -# include -# include -#if !defined(hpux) && !defined(SUNOS4) && !defined(LINUX) -# include -#endif /* !defined(hpux) and others */ -#endif /* _WINDOWS */ - -#if defined(IRIX) -#include -#endif /* IRIX */ - -#define NSLBERI_LBER_INT_FRIEND -#ifdef macintosh -#include "lber-int.h" -#else /* macintosh */ -#include "../liblber/lber-int.h" -#endif /* macintosh */ - -#include "ldap.h" -#include "ldaprot.h" -#include "ldaplog.h" -#include "portable.h" - -#ifdef LDAP_ASYNC_IO -#ifdef NEED_FILIO -#include /* to get FIONBIO for ioctl() call */ -#else /* NEED_FILIO */ -#if !defined( _WINDOWS) && !defined (macintosh) -#include /* to get FIONBIO for ioctl() call */ -#endif /* _WINDOWS && macintosh */ -#endif /* NEED_FILIO */ -#endif /* LDAP_ASYNC_IO */ - -#ifdef USE_SYSCONF -# include -#endif /* USE_SYSCONF */ - -#if !defined(_WINDOWS) && !defined(macintosh) && !defined(LINUX) && !defined(BSDI) -#define NSLDAPI_HAVE_POLL 1 -#endif - -/* SSL version, or 0 if not built with SSL */ -#if defined(NET_SSL) -# define SSL_VERSION 3 -#else -# define SSL_VERSION 0 -#endif - - -#define LDAP_URL_URLCOLON "URL:" -#define LDAP_URL_URLCOLON_LEN 4 - -#define LDAP_LDAP_REF_STR LDAP_URL_PREFIX -#define LDAP_LDAP_REF_STR_LEN LDAP_URL_PREFIX_LEN -#define LDAP_LDAPS_REF_STR LDAPS_URL_PREFIX -#define LDAP_LDAPS_REF_STR_LEN LDAPS_URL_PREFIX_LEN - -/* default limit on nesting of referrals */ -#define LDAP_DEFAULT_REFHOPLIMIT 5 -#ifdef LDAP_DNS -#define LDAP_DX_REF_STR "dx://" -#define LDAP_DX_REF_STR_LEN 5 -#endif /* LDAP_DNS */ - -typedef enum { - LDAP_CACHE_LOCK, - LDAP_MEMCACHE_LOCK, - LDAP_MSGID_LOCK, - LDAP_REQ_LOCK, - LDAP_RESP_LOCK, - LDAP_ABANDON_LOCK, - LDAP_CTRL_LOCK, - LDAP_OPTION_LOCK, - LDAP_ERR_LOCK, - LDAP_CONN_LOCK, - LDAP_IOSTATUS_LOCK, /* serializes access to ld->ld_iostatus */ - LDAP_RESULT_LOCK, - LDAP_PEND_LOCK, - LDAP_THREADID_LOCK, - LDAP_MAX_LOCK -} LDAPLock; - -/* - * This structure represents both ldap messages and ldap responses. - * These are really the same, except in the case of search responses, - * where a response has multiple messages. - */ - -struct ldapmsg { - int lm_msgid; /* the message id */ - int lm_msgtype; /* the message type */ - BerElement *lm_ber; /* the ber encoded message contents */ - struct ldapmsg *lm_chain; /* for search - next msg in the resp */ - struct ldapmsg *lm_next; /* next response */ - int lm_fromcache; /* memcache: origin of message */ -}; - -/* - * structure for tracking LDAP server host, ports, DNs, etc. - */ -typedef struct ldap_server { - char *lsrv_host; - char *lsrv_dn; /* if NULL, use default */ - int lsrv_port; - unsigned long lsrv_options; /* boolean options */ -#define LDAP_SRV_OPT_SECURE 0x01 - struct ldap_server *lsrv_next; -} LDAPServer; - -/* - * structure for representing an LDAP server connection - */ -typedef struct ldap_conn { - Sockbuf *lconn_sb; - BerElement *lconn_ber; /* non-NULL if in midst of msg. */ - int lconn_version; /* LDAP protocol version */ - int lconn_refcnt; - unsigned long lconn_lastused; /* time */ - int lconn_status; -#define LDAP_CONNST_NEEDSOCKET 1 -#define LDAP_CONNST_CONNECTING 2 -#define LDAP_CONNST_CONNECTED 3 -#define LDAP_CONNST_DEAD 4 - LDAPServer *lconn_server; - char *lconn_binddn; /* DN of last successful bind */ - int lconn_bound; /* has a bind been done? */ - char *lconn_krbinstance; - struct ldap_conn *lconn_next; -} LDAPConn; - - -/* - * structure used to track outstanding requests - */ -typedef struct ldapreq { - int lr_msgid; /* the message id */ - int lr_status; /* status of request */ -#define LDAP_REQST_INPROGRESS 1 -#define LDAP_REQST_CHASINGREFS 2 -#define LDAP_REQST_NOTCONNECTED 3 -#define LDAP_REQST_WRITING 4 -#define LDAP_REQST_CONNDEAD 5 /* associated conn. has failed */ - int lr_outrefcnt; /* count of outstanding referrals */ - int lr_origid; /* original request's message id */ - int lr_parentcnt; /* count of parent requests */ - int lr_res_msgtype; /* result message type */ - int lr_res_errno; /* result LDAP errno */ - char *lr_res_error; /* result error string */ - char *lr_res_matched;/* result matched DN string */ - BerElement *lr_ber; /* ber encoded request contents */ - LDAPConn *lr_conn; /* connection used to send request */ - char *lr_binddn; /* request is a bind for this DN */ - struct ldapreq *lr_parent; /* request that spawned this referral */ - struct ldapreq *lr_child; /* list of requests we spawned */ - struct ldapreq *lr_sibling; /* next referral spawned */ - struct ldapreq *lr_prev; /* ld->ld_requests previous request */ - struct ldapreq *lr_next; /* ld->ld_requests next request */ -} LDAPRequest; - -typedef struct ldappend { - void *lp_sema; /* semaphore to post */ - int lp_msgid; /* message id */ - LDAPMessage *lp_result; /* result storage */ - struct ldappend *lp_prev; /* previous pending */ - struct ldappend *lp_next; /* next pending */ -} LDAPPend; - -/* - * forward declaration for I/O status structure (defined in os-ip.c) - */ -typedef struct nsldapi_iostatus_info NSLDAPIIOStatus; - -/* - * old extended IO structure (before writev callback was added) - */ -struct ldap_x_ext_io_fns_rev0 { - int lextiof_size; - LDAP_X_EXTIOF_CONNECT_CALLBACK *lextiof_connect; - LDAP_X_EXTIOF_CLOSE_CALLBACK *lextiof_close; - LDAP_X_EXTIOF_READ_CALLBACK *lextiof_read; - LDAP_X_EXTIOF_WRITE_CALLBACK *lextiof_write; - LDAP_X_EXTIOF_POLL_CALLBACK *lextiof_poll; - LDAP_X_EXTIOF_NEWHANDLE_CALLBACK *lextiof_newhandle; - LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *lextiof_disposehandle; - void *lextiof_session_arg; -}; -#define LDAP_X_EXTIO_FNS_SIZE_REV0 sizeof(struct ldap_x_ext_io_fns_rev0) - - -/* - * structure representing an ldap connection - */ -struct ldap { - struct sockbuf *ld_sbp; /* pointer to socket desc. & buffer */ - char *ld_host; - int ld_version; /* LDAP protocol version */ - char ld_lberoptions; - int ld_deref; - - int ld_timelimit; - int ld_sizelimit; - - struct ldap_filt_desc *ld_filtd; /* from getfilter for ufn searches */ - char *ld_ufnprefix; /* for incomplete ufn's */ - - int ld_errno; - char *ld_error; - char *ld_matched; - int ld_msgid; - - /* do not mess with these */ - LDAPRequest *ld_requests; /* list of outstanding requests */ - LDAPMessage *ld_responses; /* list of outstanding responses */ - int *ld_abandoned; /* array of abandoned requests */ - char *ld_cldapdn; /* DN used in connectionless search */ - - /* it is OK to change these next four values directly */ - int ld_cldaptries; /* connectionless search retry count */ - int ld_cldaptimeout;/* time between retries */ - int ld_refhoplimit; /* limit on referral nesting */ - unsigned long ld_options; /* boolean options */ - -#define LDAP_BITOPT_REFERRALS 0x80000000 -#define LDAP_BITOPT_SSL 0x40000000 -#define LDAP_BITOPT_DNS 0x20000000 -#define LDAP_BITOPT_RESTART 0x10000000 -#define LDAP_BITOPT_RECONNECT 0x08000000 -#define LDAP_BITOPT_ASYNC 0x04000000 - - /* do not mess with the rest though */ - char *ld_defhost; /* full name of default server */ - int ld_defport; /* port of default server */ - BERTranslateProc ld_lber_encode_translate_proc; - BERTranslateProc ld_lber_decode_translate_proc; - LDAPConn *ld_defconn; /* default connection */ - LDAPConn *ld_conns; /* list of all server connections */ - NSLDAPIIOStatus *ld_iostatus; /* status info. about network sockets */ - LDAP_REBINDPROC_CALLBACK *ld_rebind_fn; - void *ld_rebind_arg; - - /* function pointers, etc. for extended I/O */ - struct ldap_x_ext_io_fns ld_ext_io_fns; -#define ld_extio_size ld_ext_io_fns.lextiof_size -#define ld_extclose_fn ld_ext_io_fns.lextiof_close -#define ld_extconnect_fn ld_ext_io_fns.lextiof_connect -#define ld_extread_fn ld_ext_io_fns.lextiof_read -#define ld_extwrite_fn ld_ext_io_fns.lextiof_write -#define ld_extwritev_fn ld_ext_io_fns.lextiof_writev -#define ld_extpoll_fn ld_ext_io_fns.lextiof_poll -#define ld_extnewhandle_fn ld_ext_io_fns.lextiof_newhandle -#define ld_extdisposehandle_fn ld_ext_io_fns.lextiof_disposehandle -#define ld_ext_session_arg ld_ext_io_fns.lextiof_session_arg - - /* allocated pointer for older I/O functions */ - struct ldap_io_fns *ld_io_fns_ptr; -#define NSLDAPI_USING_CLASSIC_IO_FUNCTIONS( ld ) ((ld)->ld_io_fns_ptr != NULL) - - /* function pointers, etc. for DNS */ - struct ldap_dns_fns ld_dnsfn; -#define ld_dns_extradata ld_dnsfn.lddnsfn_extradata -#define ld_dns_bufsize ld_dnsfn.lddnsfn_bufsize -#define ld_dns_gethostbyname_fn ld_dnsfn.lddnsfn_gethostbyname -#define ld_dns_gethostbyaddr_fn ld_dnsfn.lddnsfn_gethostbyaddr - - /* function pointers, etc. for threading */ - struct ldap_thread_fns ld_thread; -#define ld_mutex_alloc_fn ld_thread.ltf_mutex_alloc -#define ld_mutex_free_fn ld_thread.ltf_mutex_free -#define ld_mutex_lock_fn ld_thread.ltf_mutex_lock -#define ld_mutex_unlock_fn ld_thread.ltf_mutex_unlock -#define ld_get_errno_fn ld_thread.ltf_get_errno -#define ld_set_errno_fn ld_thread.ltf_set_errno -#define ld_get_lderrno_fn ld_thread.ltf_get_lderrno -#define ld_set_lderrno_fn ld_thread.ltf_set_lderrno -#define ld_lderrno_arg ld_thread.ltf_lderrno_arg - void **ld_mutex; - - /* function pointers, etc. for caching */ - int ld_cache_on; - int ld_cache_strategy; - struct ldap_cache_fns ld_cache; -#define ld_cache_config ld_cache.lcf_config -#define ld_cache_bind ld_cache.lcf_bind -#define ld_cache_unbind ld_cache.lcf_unbind -#define ld_cache_search ld_cache.lcf_search -#define ld_cache_compare ld_cache.lcf_compare -#define ld_cache_add ld_cache.lcf_add -#define ld_cache_delete ld_cache.lcf_delete -#if 0 -#define ld_cache_rename ld_cache.lcf_rename -#endif -#define ld_cache_modify ld_cache.lcf_modify -#define ld_cache_modrdn ld_cache.lcf_modrdn -#define ld_cache_abandon ld_cache.lcf_abandon -#define ld_cache_result ld_cache.lcf_result -#define ld_cache_flush ld_cache.lcf_flush -#define ld_cache_arg ld_cache.lcf_arg - - /* ldapv3 controls */ - LDAPControl **ld_servercontrols; - LDAPControl **ld_clientcontrols; - - /* Preferred language */ - char *ld_preferred_language; - - /* MemCache */ - LDAPMemCache *ld_memcache; - - /* Pending results */ - LDAPPend *ld_pend; /* list of pending results */ - - /* extra thread function pointers */ - struct ldap_extra_thread_fns ld_thread2; - - /* With the 4.0 version of the LDAP SDK */ - /* the extra thread functions except for */ - /* the ld_threadid_fn has been disabled */ - /* Look at the release notes for the full */ - /* explanation */ -#define ld_mutex_trylock_fn ld_thread2.ltf_mutex_trylock -#define ld_sema_alloc_fn ld_thread2.ltf_sema_alloc -#define ld_sema_free_fn ld_thread2.ltf_sema_free -#define ld_sema_wait_fn ld_thread2.ltf_sema_wait -#define ld_sema_post_fn ld_thread2.ltf_sema_post -#define ld_threadid_fn ld_thread2.ltf_threadid_fn - - /* extra data for mutex handling in referrals */ - void *ld_mutex_threadid[LDAP_MAX_LOCK]; - unsigned long ld_mutex_refcnt[LDAP_MAX_LOCK]; - - /* connect timeout value */ - int ld_connect_timeout; -}; - -/* allocate/free mutex */ -#define LDAP_MUTEX_ALLOC( ld ) \ - (((ld)->ld_mutex_alloc_fn != NULL) ? (ld)->ld_mutex_alloc_fn() : NULL) - -/* allocate/free mutex */ -#define LDAP_MUTEX_FREE( ld, m ) \ - if ( (ld)->ld_mutex_free_fn != NULL && m != NULL ) { \ - (ld)->ld_mutex_free_fn( m ); \ - } - -/* enter/exit critical sections */ -/* - * The locks assume that the locks are thread safe. XXXmcs: which means??? - * - * Note that we test for both ld_mutex_lock_fn != NULL AND ld_mutex != NULL. - * This is necessary because there is a window in ldap_init() between the - * time we set the ld_mutex_lock_fn pointer and the time we allocate the - * mutexes in which external code COULD be called which COULD make a call to - * something like ldap_get_option(), which uses LDAP_MUTEX_LOCK(). The - * libprldap code does this in its newhandle callback (prldap_newhandle). - */ - -#define LDAP_MUTEX_LOCK(ld, lock) \ - if ((ld)->ld_mutex_lock_fn != NULL && ld->ld_mutex != NULL) { \ - if ((ld)->ld_threadid_fn != NULL) { \ - if ((ld)->ld_mutex_threadid[lock] == (ld)->ld_threadid_fn()) { \ - (ld)->ld_mutex_refcnt[lock]++; \ - } else { \ - (ld)->ld_mutex_lock_fn(ld->ld_mutex[lock]); \ - (ld)->ld_mutex_threadid[lock] = ld->ld_threadid_fn(); \ - (ld)->ld_mutex_refcnt[lock] = 1; \ - } \ - } else { \ - (ld)->ld_mutex_lock_fn(ld->ld_mutex[lock]); \ - } \ - } - -#define LDAP_MUTEX_UNLOCK(ld, lock) \ - if ((ld)->ld_mutex_lock_fn != NULL && ld->ld_mutex != NULL) { \ - if ((ld)->ld_threadid_fn != NULL) { \ - if ((ld)->ld_mutex_threadid[lock] == (ld)->ld_threadid_fn()) { \ - (ld)->ld_mutex_refcnt[lock]--; \ - if ((ld)->ld_mutex_refcnt[lock] <= 0) { \ - (ld)->ld_mutex_threadid[lock] = (void *) -1; \ - (ld)->ld_mutex_refcnt[lock] = 0; \ - (ld)->ld_mutex_unlock_fn(ld->ld_mutex[lock]); \ - } \ - } \ - } else { \ - ld->ld_mutex_unlock_fn(ld->ld_mutex[lock]); \ - } \ - } - -/* Backward compatibility locks */ -#define LDAP_MUTEX_BC_LOCK( ld, i ) \ - /* the ld_mutex_trylock_fn is always set to NULL */ \ - /* in setoption.c as the extra thread functions were */ \ - /* turned off in the 4.0 SDK. This check will */ \ - /* always be true */ \ - if( (ld)->ld_mutex_trylock_fn == NULL ) { \ - LDAP_MUTEX_LOCK( ld, i ) ; \ - } -#define LDAP_MUTEX_BC_UNLOCK( ld, i ) \ - /* the ld_mutex_trylock_fn is always set to NULL */ \ - /* in setoption.c as the extra thread functions were */ \ - /* turned off in the 4.0 SDK. This check will */ \ - /* always be true */ \ - if( (ld)->ld_mutex_trylock_fn == NULL ) { \ - LDAP_MUTEX_UNLOCK( ld, i ) ; \ - } - -/* allocate/free semaphore */ -#define LDAP_SEMA_ALLOC( ld ) \ - (((ld)->ld_sema_alloc_fn != NULL) ? (ld)->ld_sema_alloc_fn() : NULL) -#define LDAP_SEMA_FREE( ld, m ) \ - if ( (ld)->ld_sema_free_fn != NULL && m != NULL ) { \ - (ld)->ld_sema_free_fn( m ); \ - } - -/* wait/post binary semaphore */ -#define LDAP_SEMA_WAIT( ld, lp ) \ - if ( (ld)->ld_sema_wait_fn != NULL ) { \ - (ld)->ld_sema_wait_fn( lp->lp_sema ); \ - } -#define LDAP_SEMA_POST( ld, lp ) \ - if ( (ld)->ld_sema_post_fn != NULL ) { \ - (ld)->ld_sema_post_fn( lp->lp_sema ); \ - } -#define POST( ld, y, z ) \ - /* the ld_mutex_trylock_fn is always set to NULL */ \ - /* in setoption.c as the extra thread functions were */ \ - /* turned off in the 4.0 SDK. This check will */ \ - /* always be false */ \ - if( (ld)->ld_mutex_trylock_fn != NULL ) { \ - nsldapi_post_result( ld, y, z ); \ - } - -/* get/set errno */ -#ifndef macintosh -#define LDAP_SET_ERRNO( ld, e ) \ - if ( (ld)->ld_set_errno_fn != NULL ) { \ - (ld)->ld_set_errno_fn( e ); \ - } else { \ - errno = e; \ - } -#define LDAP_GET_ERRNO( ld ) \ - (((ld)->ld_get_errno_fn != NULL) ? \ - (ld)->ld_get_errno_fn() : errno) -#else /* macintosh */ -#define LDAP_SET_ERRNO( ld, e ) \ - if ( (ld)->ld_set_errno_fn != NULL ) { \ - (ld)->ld_set_errno_fn( e ); \ - } -#define LDAP_GET_ERRNO( ld ) \ - (((ld)->ld_get_errno_fn != NULL) ? \ - (ld)->ld_get_errno_fn() : 0) -#endif - - -/* get/set ldap-specific errno */ -#define LDAP_SET_LDERRNO( ld, e, m, s ) ldap_set_lderrno( ld, e, m, s ) -#define LDAP_GET_LDERRNO( ld, m, s ) ldap_get_lderrno( ld, m, s ) - -/* - * your standard "mimimum of two values" macro - */ -#define NSLDAPI_MIN(a, b) (((a) < (b)) ? (a) : (b)) - -/* - * handy macro to check whether LDAP struct is set up for CLDAP or not - */ -#define LDAP_IS_CLDAP( ld ) ( ld->ld_sbp->sb_naddr > 0 ) - -/* - * handy macro to check errno "e" for an "in progress" sort of error - */ -#if defined(macintosh) || defined(_WINDOWS) -#define NSLDAPI_ERRNO_IO_INPROGRESS( e ) ((e) == EWOULDBLOCK || (e) == EAGAIN) -#else -#ifdef EAGAIN -#define NSLDAPI_ERRNO_IO_INPROGRESS( e ) ((e) == EWOULDBLOCK || (e) == EINPROGRESS || (e) == EAGAIN) -#else /* EAGAIN */ -#define NSLDAPI_ERRNO_IO_INPROGRESS( e ) ((e) == EWOULDBLOCK || (e) == EINPROGRESS) -#endif /* EAGAIN */ -#endif /* macintosh || _WINDOWS*/ - -/* - * macro to return the LDAP protocol version we are using - */ -#define NSLDAPI_LDAP_VERSION( ld ) ( (ld)->ld_defconn == NULL ? \ - (ld)->ld_version : \ - (ld)->ld_defconn->lconn_version ) - -/* - * Structures used for handling client filter lists. - */ -#define LDAP_FILT_MAXSIZ 1024 - -struct ldap_filt_list { - char *lfl_tag; - char *lfl_pattern; - char *lfl_delims; - struct ldap_filt_info *lfl_ilist; - struct ldap_filt_list *lfl_next; -}; - -struct ldap_filt_desc { - LDAPFiltList *lfd_filtlist; - LDAPFiltInfo *lfd_curfip; - LDAPFiltInfo lfd_retfi; - char lfd_filter[ LDAP_FILT_MAXSIZ ]; - char *lfd_curval; - char *lfd_curvalcopy; - char **lfd_curvalwords; - char *lfd_filtprefix; - char *lfd_filtsuffix; -}; - -/* - * "internal" globals used to track defaults and memory allocation callbacks: - * (the actual definitions are in open.c) - */ -extern struct ldap nsldapi_ld_defaults; -extern struct ldap_memalloc_fns nsldapi_memalloc_fns; -extern int nsldapi_initialized; - - -/* - * Memory allocation done in liblber should all go through one of the - * following macros. This is so we can plug-in alternative memory - * allocators, etc. as the need arises. - */ -#define NSLDAPI_MALLOC( size ) ldap_x_malloc( size ) -#define NSLDAPI_CALLOC( nelem, elsize ) ldap_x_calloc( nelem, elsize ) -#define NSLDAPI_REALLOC( ptr, size ) ldap_x_realloc( ptr, size ) -#define NSLDAPI_FREE( ptr ) ldap_x_free( ptr ) - - -/* - * macros used to check validity of data structures and parameters - */ -#define NSLDAPI_VALID_LDAP_POINTER( ld ) \ - ( (ld) != NULL ) - -#define NSLDAPI_VALID_LDAPMESSAGE_POINTER( lm ) \ - ( (lm) != NULL ) - -#define NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( lm ) \ - ( (lm) != NULL && (lm)->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) - -#define NSLDAPI_VALID_LDAPMESSAGE_REFERENCE_POINTER( lm ) \ - ( (lm) != NULL && (lm)->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ) - -#define NSLDAPI_VALID_LDAPMESSAGE_BINDRESULT_POINTER( lm ) \ - ( (lm) != NULL && (lm)->lm_msgtype == LDAP_RES_BIND ) - -#define NSLDAPI_VALID_LDAPMESSAGE_EXRESULT_POINTER( lm ) \ - ( (lm) != NULL && (lm)->lm_msgtype == LDAP_RES_EXTENDED ) - -#define NSLDAPI_VALID_LDAPMOD_ARRAY( mods ) \ - ( (mods) != NULL ) - -#define NSLDAPI_VALID_NONEMPTY_LDAPMOD_ARRAY( mods ) \ - ( (mods) != NULL && (mods)[0] != NULL ) - -#define NSLDAPI_IS_SEARCH_ENTRY( code ) \ - ((code) == LDAP_RES_SEARCH_ENTRY) - -#define NSLDAPI_IS_SEARCH_RESULT( code ) \ - ((code) == LDAP_RES_SEARCH_RESULT) - -#define NSLDAPI_SEARCH_RELATED_RESULT( code ) \ - (NSLDAPI_IS_SEARCH_RESULT( code ) || NSLDAPI_IS_SEARCH_ENTRY( code )) - -/* - * in bind.c - */ -char *nsldapi_get_binddn( LDAP *ld ); - -/* - * in cache.c - */ -void nsldapi_add_result_to_cache( LDAP *ld, LDAPMessage *result ); - -/* - * in dsparse.c - */ -int nsldapi_next_line_tokens( char **bufp, long *blenp, char ***toksp ); -void nsldapi_free_strarray( char **sap ); - -/* - * in error.c - */ -int nsldapi_parse_result( LDAP *ld, int msgtype, BerElement *rber, - int *errcodep, char **matchednp, char **errmsgp, char ***referralsp, - LDAPControl ***serverctrlsp ); - -/* - * in open.c - */ -void nsldapi_initialize_defaults( void ); -int nsldapi_open_ldap_defconn( LDAP *ld ); -char *nsldapi_strdup( const char *s ); /* if s is NULL, returns NULL */ - -/* - * in os-ip.c - */ -int nsldapi_connect_to_host( LDAP *ld, Sockbuf *sb, const char *host, - int port, int secure, char **krbinstancep ); -void nsldapi_close_connection( LDAP *ld, Sockbuf *sb ); - -int nsldapi_iostatus_poll( LDAP *ld, struct timeval *timeout ); -void nsldapi_iostatus_free( LDAP *ld ); -int nsldapi_iostatus_interest_write( LDAP *ld, Sockbuf *sb ); -int nsldapi_iostatus_interest_read( LDAP *ld, Sockbuf *sb ); -int nsldapi_iostatus_interest_clear( LDAP *ld, Sockbuf *sb ); -int nsldapi_iostatus_is_read_ready( LDAP *ld, Sockbuf *sb ); -int nsldapi_iostatus_is_write_ready( LDAP *ld, Sockbuf *sb ); -int nsldapi_install_lber_extiofns( LDAP *ld, Sockbuf *sb ); -int nsldapi_install_compat_io_fns( LDAP *ld, struct ldap_io_fns *iofns ); - -/* - * if referral.c - */ -int nsldapi_parse_reference( LDAP *ld, BerElement *rber, char ***referralsp, - LDAPControl ***serverctrlsp ); - - -/* - * in result.c - */ -int ldap_msgdelete( LDAP *ld, int msgid ); -int nsldapi_result_nolock( LDAP *ld, int msgid, int all, int unlock_permitted, - struct timeval *timeout, LDAPMessage **result ); -int nsldapi_wait_result( LDAP *ld, int msgid, int all, struct timeval *timeout, - LDAPMessage **result ); -int nsldapi_post_result( LDAP *ld, int msgid, LDAPMessage *result ); - -/* - * in request.c - */ -int nsldapi_send_initial_request( LDAP *ld, int msgid, unsigned long msgtype, - char *dn, BerElement *ber ); -int nsldapi_alloc_ber_with_options( LDAP *ld, BerElement **berp ); -void nsldapi_set_ber_options( LDAP *ld, BerElement *ber ); -int nsldapi_ber_flush( LDAP *ld, Sockbuf *sb, BerElement *ber, int freeit, - int async ); -int nsldapi_send_server_request( LDAP *ld, BerElement *ber, int msgid, - LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc, - char *bindreqdn, int bind ); -LDAPConn *nsldapi_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb, - int connect, int bind ); -LDAPRequest *nsldapi_find_request_by_msgid( LDAP *ld, int msgid ); -void nsldapi_free_request( LDAP *ld, LDAPRequest *lr, int free_conn ); -void nsldapi_free_connection( LDAP *ld, LDAPConn *lc, - LDAPControl **serverctrls, LDAPControl **clientctrls, - int force, int unbind ); -void nsldapi_dump_connection( LDAP *ld, LDAPConn *lconns, int all ); -void nsldapi_dump_requests_and_responses( LDAP *ld ); -int nsldapi_chase_v2_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, - int *totalcountp, int *chasingcountp ); -int nsldapi_chase_v3_refs( LDAP *ld, LDAPRequest *lr, char **refs, - int is_reference, int *totalcountp, int *chasingcountp ); -int nsldapi_append_referral( LDAP *ld, char **referralsp, char *s ); -void nsldapi_connection_lost_nolock( LDAP *ld, Sockbuf *sb ); - -/* - * in search.c - */ -int nsldapi_build_search_req( LDAP *ld, const char *base, int scope, - const char *filter, char **attrs, int attrsonly, - LDAPControl **serverctrls, LDAPControl **clientctrls, - int timelimit, int sizelimit, int msgid, BerElement **berp ); - -/* - * in unbind.c - */ -int ldap_ld_free( LDAP *ld, LDAPControl **serverctrls, - LDAPControl **clientctrls, int close ); -int nsldapi_send_unbind( LDAP *ld, Sockbuf *sb, LDAPControl **serverctrls, - LDAPControl **clientctrls ); - -#ifdef LDAP_DNS -/* - * in getdxbyname.c - */ -char **nsldapi_getdxbyname( char *domain ); - -#endif /* LDAP_DNS */ - -/* - * in unescape.c - */ -void nsldapi_hex_unescape( char *s ); - -/* - * in reslist.c - */ -LDAPMessage *ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e ); -void ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e ); - -/* - * in compat.c - */ -#ifdef hpux -char *nsldapi_compat_ctime_r( const time_t *clock, char *buf, int buflen ); -struct hostent *nsldapi_compat_gethostbyname_r( const char *name, - struct hostent *result, char *buffer, int buflen, int *h_errnop ); -#endif /* hpux */ - -/* - * in control.c - */ -int nsldapi_put_controls( LDAP *ld, LDAPControl **ctrls, int closeseq, - BerElement *ber ); -int nsldapi_get_controls( BerElement *ber, LDAPControl ***controlsp ); -int nsldapi_dup_controls( LDAP *ld, LDAPControl ***ldctrls, - LDAPControl **newctrls ); -int nsldapi_build_control( char *oid, BerElement *ber, int freeber, - char iscritical, LDAPControl **ctrlp ); - - -/* - * in url.c - */ -int nsldapi_url_parse( const char *inurl, LDAPURLDesc **ludpp, - int dn_required ); - - -/* - * in charset.c - * - * If we ever want to expose character set translation functionality to - * users of libldap, all of these prototypes will need to be moved to ldap.h - */ -#ifdef STR_TRANSLATION -void ldap_set_string_translators( LDAP *ld, - BERTranslateProc encode_proc, BERTranslateProc decode_proc ); -int ldap_translate_from_t61( LDAP *ld, char **bufp, - unsigned long *lenp, int free_input ); -int ldap_translate_to_t61( LDAP *ld, char **bufp, - unsigned long *lenp, int free_input ); -void ldap_enable_translation( LDAP *ld, LDAPMessage *entry, - int enable ); -#ifdef LDAP_CHARSET_8859 -int ldap_t61_to_8859( char **bufp, unsigned long *buflenp, - int free_input ); -int ldap_8859_to_t61( char **bufp, unsigned long *buflenp, - int free_input ); -#endif /* LDAP_CHARSET_8859 */ -#endif /* STR_TRANSLATION */ - -/* - * in memcache.h - */ -int ldap_memcache_createkey( LDAP *ld, const char *base, int scope, - const char *filter, char **attrs, int attrsonly, - LDAPControl **serverctrls, LDAPControl **clientctrls, - unsigned long *keyp ); -int ldap_memcache_result( LDAP *ld, int msgid, unsigned long key ); -int ldap_memcache_new( LDAP *ld, int msgid, unsigned long key, - const char *basedn ); -int ldap_memcache_append( LDAP *ld, int msgid, int bLast, LDAPMessage *result ); -int ldap_memcache_abandon( LDAP *ld, int msgid ); - -#endif /* _LDAPINT_H */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldapfilter.conf b/mozilla/directory/c-sdk/ldap/libraries/libldap/ldapfilter.conf deleted file mode 100644 index c602f7d2e71..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldapfilter.conf +++ /dev/null @@ -1,105 +0,0 @@ -# ldap filter file -# -# lines like this that start with # or empty lines are ignored -# -# syntax: -# -# -# [] -# [] -# -# [] ... -# -# The "desc" should describe the filter and it should correctly complete -# both of the following phrases: -# -# One match was found for... -# Three matches were found for... -# -# The scope is optional, and should be one of: -# "base" -# "onelevel" -# "subtree" -# if it is included. -# - -"finger and ud and go500 and go500gw subtree and web500gw subtree and rp500 and rcpt500 and ufn last" - "=" " " "%v" "arbitrary filter" - - "^[0-9][0-9-]*$" " " "(telephoneNumber=*%v)" "phone number" - - "@" " " "(mail=%v)" "email address" - "(mail=%v*)" "start of email address" - - "^.[. _].*" ". _" "(cn=%v1* %v2-)" "first initial" - - ".*[. _].$" ". _" "(cn=%v1-*)" "last initial" - - "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact" - "(|(sn~=%v1-)(cn~=%v1-))" "approximate" - - ".*" ". " "(|(cn=%v1)(sn=%v1)(uid=%v1))" "exact" - "(|(cn~=%v1)(sn~=%v1))" "approximate" - -"go500gw onelevel and web500gw onelevel and ufn first and ufn intermediate" - "=" " " "%v" "arbitrary filter" - - "^..$" " " "(|(o=%v)(c=%v)(l=%v)(co=%v))" "exact" - "(|(o~=%v)(c~=%v)(l~=%v)(co~=%v))" "approximate" - - " " " " "(|(o=%v)(l=%v)(co=%v)(ou=%v))" "exact" - "(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))" "approximate" - - "\." " " "(associatedDomain=%v)" "exact" - - ".*" " " "(|(o=%v)(l=%v)(co=%v)(ou=%v))" "exact" - "(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))" "approximate" - - -# -# xax500 -# - -"xax500" - "=" " " "(%v)" "arbitrary filter" - - "^[0-9][0-9-]*$" " " "(telephoneNumber=*%v)" "phone number" - - "@" " " "(mail=%v)" "email address" - "(mail=%v*)" "start of email address" - - "^.[. _].*" ". _" "(cn=%v1* %v2-)" "first initial" - - ".*[. _].$" ". _" "(cn=%v1-*)" "last initial" - - "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact" - "(|(sn~=%v1-)(cn~=%v1-))" "approximate" - - ".*" ". " "(|(cn=%v1)(sn=%v1)(uid=%v1))" "exact" - "(|(cn=%v1)(sn~=%v1))" "approximate" - - -"xax500-auth" - "=" " " "(%v)" "arbitrary filter" - - "^[0-9][0-9-]*$" " " "(telephoneNumber=*%v)" "phone number" - - "@" " " "(mail=%v)" "email address" - "(mail=%v*)" "start of email address" - - "^.[. _].*" ". _" "(cn=%v1* %v2-)" "first initial" - - ".*[. _].$" ". _" "(cn=%v1-*)" "last initial" - - "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact" - "(|(sn~=%v1-)(cn~=%v1-))" "approximate" - - ".*" ". " "(|(cn=%v1)(sn=%v1)(uid=%v1))" "exact" - "(|(cn=%v1)(sn~=%v1))" "approximate" - -"list500" - "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact" - "(|(sn~=%v1-)(cn~=%v1-))" "approximate" - - ".*" ". " "(|(cn=%v1)(sn=%v1)(uid=%v1))" "exact" - "(|(cn~=%v1)(sn~=%v1))" "approximate" diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldapfriendly b/mozilla/directory/c-sdk/ldap/libraries/libldap/ldapfriendly deleted file mode 100644 index 3605090ca9e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldapfriendly +++ /dev/null @@ -1,242 +0,0 @@ -AD Andorra -AE United Arab Emirates -AF Afghanistan -AG Antigua and Barbuda -AI Anguilla -AL Albania -AM Armenia -AN Netherlands Antilles -AO Angola -AQ Antarctica -AR Argentina -AS American Samoa -AT Austria -AU Australia -AW Aruba -AZ Azerbaijan -BA Bosnia and Herzegowina -BB Barbados -BD Bangladesh -BE Belgium -BF Burkina Faso -BG Bulgaria -BH Bahrain -BI Burundi -BJ Benin -BM Bermuda -BN Brunei Darussalam -BO Bolivia -BR Brazil -BS Bahamas -BT Bhutan -BV Bouvet Island -BW Botswana -BY Belarus -BZ Belize -CA Canada -CC Cocos (Keeling) Islands -CF Central African Republic -CG Congo -CH Switzerland -CI Cote d'Ivoire -CK Cook Islands -CL Chile -CM Cameroon -CN China -CO Colombia -CR Costa Rica -CS Former Czechoslovakia -CU Cuba -CV Cape Verde -CX Christmas Island -CY Cyprus -CZ Czech Republic -DE Germany -DJ Djibouti -DK Denmark -DM Dominica -DO Dominican Republic -DZ Algeria -EC Ecuador -EE Estonia -EG Egypt -EH Western Sahara -ER Eritrea -ES Spain -ET Ethiopia -FI Finland -FJ Fiji -FK Falkland Islands (Malvinas) -FM Micronesia -FO Faroe Islands -FR France -FX France, Metropolitan -GA Gabon -GB United Kingdom -GD Grenada -GE Georgia -GF French Guiana -GH Ghana -GI Gibraltar -GL Greenland -GM Gambia -GN Guinea -GP Guadeloupe -GQ Equatorial Guinea -GR Greece -GS South Georgia and the South Sandwich Islands -GT Guatemala -GU Guam -GW Guinea-Bissau -GY Guyana -HK Hong Kong -HM Heard and McDonald Islands -HN Honduras -HR Croatia -HT Haiti -HU Hungary -ID Indonesia -IE Ireland -IL Israel -IN India -IO British Indian Ocean Territory -IQ Iraq -IR Iran -IS Iceland -IT Italy -JM Jamaica -JO Jordan -JP Japan -KE Kenya -KG Kyrgyzstan -KH Cambodia -KI Kiribati -KM Comoros -KN Saint Kitts and Nevis -KP Korea, Democratic People's Republic of -KR Korea, Republic of -KW Kuwait -KY Cayman Islands -KZ Kazakhstan -LA Laos -LB Lebanon -LC Saint Lucia -LI Liechtenstein -LK Sri Lanka -LR Liberia -LS Lesotho -LT Lithuania -LU Luxembourg -LV Latvia -LY Libya -MA Morocco -MC Monaco -MD Moldova -MG Madagascar -MH Marshall Islands -MK Macedonia -ML Mali -MM Myanmar -MN Mongolia -MO Macau -MP Northern Mariana Islands -MQ Martinique -MR Mauritania -MS Montserrat -MT Malta -MU Mauritius -MV Maldives -MW Malawi -MX Mexico -MY Malaysia -MZ Mozambique -NA Namibia -NC New Caledonia -NE Niger -NF Norfolk Island -NG Nigeria -NI Nicaragua -NL Netherlands -NO Norway -NP Nepal -NR Nauru -NU Niue -NZ New Zealand -OM Oman -PA Panama -PE Peru -PF French Polynesia -PG Papua New Guinea -PH Philippines -PK Pakistan -PL Poland -PM St. Pierre and Miquelon -PN Pitcairn -PR Puerto Rico -PT Portugal -PW Palau -PY Paraguay -QA Qatar -RE Reunion -RO Romania -RU Russian Federation -RW Rwanda -SA Saudi Arabia -SB Solomon Islands -SC Seychelles -SD Sudan -SE Sweden -SG Singapore -SH St. Helena -SI Slovenia -SJ Svalbard and Jan Mayen Islands -SK Slovakia (Slovak Republic) -SL Sierra Leone -SM San Marino -SN Senegal -SO Somalia -SR Suriname -ST Sao Tome and Principe -SU Former Soviet Union -SV El Salvador -SY Syria -SZ Swaziland -TC Turks and Caicos Islands -TD Chad -TF French Southern Territories -TG Togo -TH Thailand -TJ Tajikistan -TK Tokelau -TM Turkmenistan -TN Tunisia -TO Tonga -TP East Timor -TR Turkey -TT Trinidad and Tobago -TV Tuvalu -TW Taiwan -TZ Tanzania -UA Ukraine -UG Uganda -UK United Kingdom -UM United States Minor Outlying Islands -US United States of America -UY Uruguay -UZ Uzbekistan -VA Vatican City State (Holy See) -VC Saint Vincent and the Grenadines -VE Venezuela -VG Virgin Islands (British) -VI Virgin Islands (U.S.) -VN Viet Nam -VU Vanuatu -WF Wallis and Futuna Islands -WS Samoa -YE Yemen -YT Mayotte -YU Yugoslavia -ZA South Africa -ZM Zambia -ZR Zaire -ZW Zimbabwe diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldapsearchprefs.conf b/mozilla/directory/c-sdk/ldap/libraries/libldap/ldapsearchprefs.conf deleted file mode 100644 index 1946f42653f..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldapsearchprefs.conf +++ /dev/null @@ -1,153 +0,0 @@ -# Version should be 1 now -Version 1 -# -# -# Name for this search object -People -# options (the only one supported right now is "internal" which means that -# this search object should not be presented directly to the user) -# use "" for none -"" -# Label to place before text box user types in -"Search For:" -# Filter prefix to append to all "More Choices" searches -"(&(objectClass=person)" -# Tag to use for "Fewer Choices" searches - from ldapfilter.conf file -"xax500" -# If a search results in > 1 match, retrieve this attribute to help -# user disambiguate the entries... -title -# ...and label it with this string: -"Title" -# Search scope to use when searching -subtree -# Follows a list of "More Choices" search options. Format is: -# Label, attribute, select-bitmap, extra attr display name, extra attr ldap name -# If last two are null, "Fewer Choices" name/attributes used -"Common Name" cn 11111 "" "" -"Surname" sn 11111 "" "" -"Business Phone" "telephoneNumber" 11101 "" "" -"E-Mail Address" "mail" 11111 "" "" -"Uniqname" "uid" 11111 "" "" -"Title" title 11111 "" "" -END -# Match types -"exactly matches" "(%a=%v))" -"approximately matches" "(%a~=%v))" -"starts with" "(%a=%v*))" -"ends with" "(%a=*%v))" -"contains" "(%a=*%v*))" -END -# -# -# -Groups -"" -"Search For:" -"(&(objectClass=rfc822MailGroup)" -"xax500" -multilineDescription -"Description" -subtree -"Common Name" cn 11111 "" "" -"Description" multilineDescription 11101 "" "" -"Owner" "owner" 00001 "owner" "Owner" -"LDAP Member" "member" 00001 "" "" -"E-Mail Member" "mail" 00101 "" "" -END -"exactly matches" "(%a=%v))" -"approximately matches" "(%a~=%v))" -"starts with" "(%a=%v*))" -"ends with" "(%a=*%v))" -"contains" "(%a=*%v*))" -END -# -# -# -"Joinable Groups" -"" -"Search For:" -"(&(&(objectClass=rfc822MailGroup)(joinable=TRUE))" -"xax500" -multilineDescription -"Description" -subtree -"Common Name" cn 11111 "" "" -"Description" multilineDescription 11101 "" "" -"Owner" "owner" 00001 "owner" "Owner" -"LDAP Member" "member" 00001 "" "" -"E-Mail Member" "mail" 00101 "" "" -END -"exactly matches" "(%a=%v))" -"approximately matches" "(%a~=%v))" -"starts with" "(%a=%v*))" -"ends with" "(%a=*%v))" -"contains" "(%a=*%v*))" -END -# -# -# -Services -"" -"Search For:" -"(&(objectClass=service)" -"xax500" -multilineDescription -"Description" -subtree -"Common Name" cn 11111 "" "" -"Description" multilineDescription 11101 "" "" -"Owner" "owner" 00001 "owner" "Owner" -"Keywords" "keywords" 11111 "" "" -"Hours" "hoursOfOperation" 11111 "" "" -END -"exactly matches" "(%a=%v))" -"approximately matches" "(%a~=%v))" -"starts with" "(%a=%v*))" -"ends with" "(%a=*%v))" -"contains" "(%a=*%v*))" -END -# -# -# -Organizations -"" -"Search For:" -"(&(objectClass=organization)" -"xax500" -multilineDescription -"Description" -subtree -"Name" organizationName 01111 "" "" -"Location" localityName 11111 "" "" -"Phone Number" "telephoneNumber" 10111 "" "" -"Description" description 10111 "" "" -END -"exactly matches" "(%a=%v))" -"approximately matches" "(%a~=%v))" -"starts with" "(%a=%v*))" -"ends with" "(%a=*%v))" -"contains" "(%a=*%v*))" -END -# -# -# -Documents -"" -"Search For:" -"(&(objectClass=document)" -"xax500" -multilineDescription -"Description" -subtree -"Document Title" cn 11111 "" "" -"Keyword" "keywords" 11111 "" "" -"Category" "category" 11111 "" "" -"Document Number" "documentIdentifier" 11111 "" "" -END -"exactly matches" "(%a=%v))" -"approximately matches" "(%a~=%v))" -"starts with" "(%a=%v*))" -"ends with" "(%a=*%v))" -"contains" "(%a=*%v*))" -END diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldaptemplates.conf b/mozilla/directory/c-sdk/ldap/libraries/libldap/ldaptemplates.conf deleted file mode 100644 index 89cda12c098..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/ldaptemplates.conf +++ /dev/null @@ -1,677 +0,0 @@ -########################################################################## -# LDAP display templates -########################################################################## - -# -# Version must be 1 -# -Version 1 - -########################################################################## -# U-M Person template -########################################################################## -# -# template name and plural name come first -"U-M Person" -"U-M People" - -# name of the icon that is associated with this template -"person icon" - -# blank-separated list of template options ("" for none) -# addable - end-user should be allowed to add these types of entries -# modrdn - end-user can change the name of these entries -# altview - this template is referred to in another template's -# "linkact" item -"addable" - -# -# objectclass list -umichPerson person -END - -# -# name of attribute to authenticate as ("" means auth as this entry) -"" - -# -# default attribute name to use when forming RDN of a new entry -# -cn - -# -# default location when adding new entries (DN; "" means no default) -"o=University of Michigan, c=US" - -# -# rules used to define default values for new entries -END - -# -# -# list of items for display -# each line is either: -# item (type) (attribute) (attr name) (extra args...) -# to define an item or -# samerow -# to keep the next item on the same row as the previous -# -# valid types are: -# cis - case ignore string -# mls - multiline string -# dn - -# mail - case ignore string that contains an RFC822 mail address -# bool - boolean value -# jpeg - inlined JPEG image -# jpegbtn - JPEG image button -# fax - inlined Fax image -# faxbtn - Fax image button -# audiobtn - audio button -# time - time value -# date - time value displayed as a date only -# url - labeled URL for links to items in WWW -# searchact - search action -# linkact - link to another template -# -# valid options (comma separated list appended to the type) are: -# ro - attribute is read only; don't let user edit it -# sort - order the values of this attribute -# 1val - disallow entry of multiple values -# required - this attribute should have at least one value -# hide - don't show this item if attribute has no values -# hideiffalse - hide item if value is FALSE (for type 'bool' only) -# -item jpegbtn "View Photo" jpegPhoto "Next Photo" -item audiobtn "Play Sound" audio -item cis,ro,sort "Also Known As" cn -item mail "E-Mail Address" mail -item cis "Work Phone" telephoneNumber -item cis "Fax Number" facsimileTelephoneNumber -item cis "Pager Number" pager -item mls "Work Address" postalAddress -item cis,sort "Title" title -item cis,ro "Uniqname" uid -item mls "Description" multiLineDescription -item cis "Home Phone" homePhone -item mls "Home Address" homePostalAddress -item url "More Info (URL)" labeledURL -item dn,sort "See Also" seeAlso -item cis "Favorite Beverage" drink -item cis "Notice" notice -item bool,hideiffalse "On Vacation" onVacation -item mls,1val "Vacation Message" vacationMessage -item bool,hideiffalse "Do Not Allow Updates" noBatchUpdates -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -item searchact "Find Groups Added To" "" "-dnt" "(&(objectclass=rfc822mailgroup)(member=%v))" "multiLineDescription" "Description" "" -item searchact "List Owned Groups" "" "-dnt" "(&(objectclass=rfc822mailgroup)(owner=%v))" "title" "Title" "" -item linkact "Other Addresses" "" "other addresses" -END - - -########################################################################## -# Person template -########################################################################## -"Person" -"People" -"person icon" - -# template options -addable -# -# objectclass list -person -END -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -# -cn - -# default location when adding new entries -"" - -# -# rules used to define default values for new entries -END - -# -# list of items for display -item jpegbtn "View Photo" jpegPhoto "Next Photo" -item audiobtn "Play Sound" audio -item cis,sort "Also Known As" cn -item cis,sort "Title" title -item mls "Work Address" postalAddress -item cis "Work Phone" telephoneNumber -item cis "Fax Number" facsimileTelephoneNumber -item cis "Pager Number" pager -item mls "Home Address" homePostalAddress -item cis "Home Phone" homePhone -item cis "User ID" uid -item mail "E-Mail Address" mail -item cis "Description" description -item cis "Favorite Beverage" drink -item dn,sort "See Also" seeAlso -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -END - - -########################################################################## -# Group template -########################################################################## -"Group" -"Groups" -"group icon" - -# template options -addable modrdn - -# objectclass list -rfc822MailGroup -END - -# name of attribute to authenticate as -"owner" - -# default attribute name to use when forming RDN of a new entry -# -cn - -# default location when adding new entries -"ou=User Groups, ou=Groups, o=University of Michigan, c=US" - -# -# rules used to define default values for new entries -constant "associatedDomain" "umich.edu" -constant "joinable" "FALSE" -addersdn "owner" -addersdn "member" -addersdn "errorsTo" -addersdn "requestsTo" -END - -# -# -# list of items for display -# each line is either: -# item (type) (attribute) (attr name) (extra args...) -# to define an item or -# samerow -# -# list of items for display -item cis,sort "Also Known As" cn -item mls "Description" multiLineDescription -item cis "Phone Number" telephoneNumber -item cis "Fax Number" facsimileTelephoneNumber -item mls "Address" postalAddress -item dn,required,sort "Owner" owner -item url "More Info (URL)" labeledURL -item dn,sort "See Also" seeAlso -item dn,sort "Errors To" errorsTo -item dn,sort "Requests To" requestsTo -item cis "Associated Domain" associatedDomain -item cis "Moderator" moderator -item bool "Suppress 'No E-Mail Address' Errors" suppressNoEmailError -item bool "Others May Join" joinable -item dn,sort "LDAP Members" member -item mail,sort "E-Mail Errors To" rfc822ErrorsTo -item mail,sort "E-Mail Requests To" rfc822RequestsTo -item mail,sort "E-Mail Members" mail -item cis "Notice" notice -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -item searchact "Subscribers" "" "-dnt" "memberOfGroup=%v" "title" "Title" "joinable" -item verifyact "Verify Members" "member" "mail" "E-Mail Address" -END - -########################################################################## -# Organization template -########################################################################## -"Organization" -"Organizations" -"organization icon" - -# template options -"" - -# objectclass list -organization -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -o - -# default location when adding new entries -"" - -# rules used to define default values for new entries -constant "o" "foo" -END - -# -# -# list of items for display -# each line is either: -# item (type) (attribute) (attr name) (extra args...) -# to define an item or -# samerow -# -# list of items for display -item cis,sort "Name" o -item cis "Location" l -item mls "Address" postalAddress -item cis "Phone Number" telephoneNumber -item cis "Fax Number" facsimileTelephoneNumber -item cis "Description" description -item dn,sort "See Also" seeAlso -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -END - - -########################################################################## -# Service template -########################################################################## -"Service" -"Services" -"service icon" - -# template options -"addable" - -# objectclass list -service -END - -# name of attribute to authenticate as -"owner" - -# default attribute name to use when forming RDN of a new entry -cn - -# default location when adding new entries -"ou=Services, o=University of Michigan, c=US" - -# rules used to define default values for new entries -addersdn "owner" -END - -# -# -# list of items for display -# each line is either: -# item (type) (attribute) (attr name) (extra args...) -# to define an item or -# samerow -# -# list of items for display -item jpegbtn "View Photo" jpegPhoto -item cis,sort "Name" cn -item mls "Description" multilineDescription -item cis "Provider" provider -item cis,sort "Service Area" serviceArea -item mail "E-mail Address" mail -item cis "Phone" telephoneNumber -item cis "Fax Number" facsimileTelephoneNumber -item mls "Postal Address" postalAddress -item cis "Hours" hoursOfOperation -item url "More Info (URL)" labeledURL -item dn,sort "Depends On" dependentUpon -item dn,sort "See Also" seeAlso -item cis,sort "Platform" platform -item cis,sort "Product" product -item cis,sort "Keywords" keywords -item cis "FCE Rating" serviceRating -item date "Date Rated" ratingTime -item mls "Rating Description" ratingDescription -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -item dn,required,sort "Owner" owner -END - - -########################################################################## -# Organizational Role template -########################################################################## -"Organizational Role" -"Organizational Roles" -"person icon" - -# template options -"" - -# objectclass list -organizationalRole -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -cn - -# default location when adding new entries -"" - -# rules used to define default values for new entries -END - -# -# -# list of items for display -# each line is either: -# item (type) (attribute) (attr name) (extra args...) -# to define an item or -# samerow -# -# list of items for display -item cis,sort "Name" cn -item cis "Description" description -item dn "Role Occupant" roleOccupant -item dn,sort "See Also" seeAlso -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -END - - -########################################################################## -# Organizational Unit template -########################################################################## -"Organizational Unit" -"Organizational Units" -"organization icon" - -# template options -"" - -# objectclass list -organizationalUnit -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -cn - -# default location when adding new entries -"" - -# rules used to define default values for new entries -END - -# Item list -item cis "Organization Unit Name" ou -item cis "Title" title -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -END - - - -########################################################################## -# Application Entity template -########################################################################## -"Application Entity" -"Application Entities" -"application icon" - -# template options -"" - -# objectclass list -applicationEntity -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -cn - -# default location when adding new entries -"" - -# rules used to define default values for new entries -END - -# Item list -item cis,sort "Name" cn -item cis "Location" l -item cis "Description" description -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -END - -########################################################################## -# Document template -########################################################################## -"Document" -"Documents" -"document icon" - -# template options -"" - -# objectclass list -document -umichDocument -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -cn - -# default location when adding new entries -"" - -# rules used to define default values for new entries -END - -# -# Item list -item cis "Document ID" documentIdentifier -item cis "Title" documentTitle -item cis "Series Title" documentSeriesTitle -item cis "Version" documentVersion -item cis,sort "Service Area" serviceArea -item mls "Abstract" multiLineAbstract -item url "More Info (URL)" labeledURL -item dn,sort "Availability" documentAvailable -item dn,sort "See Also" seeAlso -item cis,sort "Platform" platform -item cis,sort "Product" product -item cis,sort "Keyword" keywords -item dn,sort "Author" documentAuthor -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -item dn,required "Owner" owner -END - -########################################################################## -# Document description template -########################################################################## -"DocumentDescription" -"DocumentDescriptions" -"document description icon" - -# template options -"" - -# objectclass list -documentDescription -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -cn - -# default location when adding new entries -"" - -# rules used to define default values for new entries -END - -# -# Item list -item mls "Description" multilineDescription -item url "More Info (URL)" labeledURL -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -item dn,required "Owner" owner -END - -########################################################################## -# Image template -########################################################################## -"Image" -"Images" -"image icon" - -# template options -"" - -# objectclass list -image -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -cn - -# default location when adding new entries -"" - -# rules used to define default values for new entries -END - -# -# Item list -item cis "Name" cn -item mls "Description" multilineDescription -item jpegbtn "View Photo(s)" jpegPhoto -item cis "Citation" citation -item cis "Copyright" copyright -item cis "Keywords" keywords -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -item dn,required "Owner" owner -END - - - -########################################################################## -# Country template -########################################################################## -"Country" -"Countries" -"country icon" - -# template options -"" - -# objectclass list -friendlyCountry -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -c - -# default location when adding new entries -"" - -# rules used to define default values for new entries -END - -# Item list -item cis "Country Name" co -item cis "Country Code" c -item cis "Description" description -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -END - -########################################################################## -# Locality template -########################################################################## -"Locality" -"Localities" -"locality icon" - -# template options -"" - -# objectclass list -locality -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -l - -# default location when adding new entries -"" - -# rules used to define default values for new entries -END - -# -# Item list -item cis "Name" l -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -END - - -########################################################################## -# "Other Addresses" template -########################################################################## -"Others Addresses" -"Other Addresses" -"other addr icon" - -# template options -"altview" - -# objectclass list -END - -# name of attribute to authenticate as -"" - -# default attribute name to use when forming RDN of a new entry -"" - -# default location when adding new entries -"" - -# rules used to define default values for new entries -END - -# Item list -item cis "Street Address" streetAddress -item cis "Locality" l -item cis "State or Province" st -item cis "Postal Code" postalCode -item cis,hide "X.400 Address" mhsORAddresses -item cis,hide "X.400 Address" textEncodedORAddress -Item cis "Other Mailbox" otherMailbox -item time,ro "Last Modified" lastModifiedTime -item dn,ro "Modified By" lastModifiedBy -END diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/memcache.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/memcache.c deleted file mode 100644 index 8f11f2f89f9..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/memcache.c +++ /dev/null @@ -1,2188 +0,0 @@ -/* - * 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): - */ -/* - * - * memcache.c - routines that implement an in-memory cache. - * - * To Do: 1) ber_dup_ext(). - * 2) referrals and reference? - */ - -#include -#include "ldap-int.h" - -/* - * Extra size allocated to BerElement. - * XXXmcs: must match EXBUFSIZ in liblber/io.c? - */ -#define EXTRA_SIZE 1024 - -/* Mode constants for function memcache_access() */ -#define MEMCACHE_ACCESS_ADD 0 -#define MEMCACHE_ACCESS_APPEND 1 -#define MEMCACHE_ACCESS_APPEND_LAST 2 -#define MEMCACHE_ACCESS_FIND 3 -#define MEMCACHE_ACCESS_DELETE 4 -#define MEMCACHE_ACCESS_DELETE_ALL 5 -#define MEMCACHE_ACCESS_UPDATE 6 -#define MEMCACHE_ACCESS_FLUSH 7 -#define MEMCACHE_ACCESS_FLUSH_ALL 8 -#define MEMCACHE_ACCESS_FLUSH_LRU 9 - -/* Mode constants for function memcache_adj_size */ -#define MEMCACHE_SIZE_DEDUCT 0 -#define MEMCACHE_SIZE_ADD 1 - -#define MEMCACHE_SIZE_ENTRIES 1 -#define MEMCACHE_SIZE_NON_ENTRIES 2 - -/* Size used for calculation if given size of cache is 0 */ -#define MEMCACHE_DEF_SIZE 131072 /* 128K bytes */ - -/* Index into different list structure */ -#define LIST_TTL 0 -#define LIST_LRU 1 -#define LIST_TMP 2 -#define LIST_TOTAL 3 - -/* Macros to make code more readable */ -#define NSLDAPI_VALID_MEMCACHE_POINTER( cp ) ( (cp) != NULL ) -#define NSLDAPI_STR_NONNULL( s ) ( (s) ? (s) : "" ) -#define NSLDAPI_SAFE_STRLEN( s ) ( (s) ? strlen((s)) + 1 : 1 ) - -/* Macros dealing with mutex */ -#define LDAP_MEMCACHE_MUTEX_LOCK( c ) \ - if ( (c) && ((c)->ldmemc_lock_fns).ltf_mutex_lock ) { \ - ((c)->ldmemc_lock_fns).ltf_mutex_lock( (c)->ldmemc_lock ); \ - } - -#define LDAP_MEMCACHE_MUTEX_UNLOCK( c ) \ - if ( (c) && ((c)->ldmemc_lock_fns).ltf_mutex_unlock ) { \ - ((c)->ldmemc_lock_fns).ltf_mutex_unlock( (c)->ldmemc_lock ); \ - } - -#define LDAP_MEMCACHE_MUTEX_ALLOC( c ) \ - ((c) && ((c)->ldmemc_lock_fns).ltf_mutex_alloc ? \ - ((c)->ldmemc_lock_fns).ltf_mutex_alloc() : NULL) - -#define LDAP_MEMCACHE_MUTEX_FREE( c ) \ - if ( (c) && ((c)->ldmemc_lock_fns).ltf_mutex_free ) { \ - ((c)->ldmemc_lock_fns).ltf_mutex_free( (c)->ldmemc_lock ); \ - } - -/* Macros used for triming unnecessary spaces in a basedn */ -#define NSLDAPI_IS_SPACE( c ) \ - (((c) == ' ') || ((c) == '\t') || ((c) == '\n')) - -#define NSLDAPI_IS_SEPARATER( c ) \ - ((c) == ',') - -/* Hash table callback function pointer definition */ -typedef int (*HashFuncPtr)(int table_size, void *key); -typedef int (*PutDataPtr)(void **ppTableData, void *key, void *pData); -typedef int (*GetDataPtr)(void *pTableData, void *key, void **ppData); -typedef int (*RemoveDataPtr)(void **ppTableData, void *key, void **ppData); -typedef int (*MiscFuncPtr)(void **ppTableData, void *key, void *pData); -typedef void (*ClrTableNodePtr)(void **ppTableData, void *pData); - -/* Structure of a node in a hash table */ -typedef struct HashTableNode_struct { - void *pData; -} HashTableNode; - -/* Structure of a hash table */ -typedef struct HashTable_struct { - HashTableNode *table; - int size; - HashFuncPtr hashfunc; - PutDataPtr putdata; - GetDataPtr getdata; - MiscFuncPtr miscfunc; - RemoveDataPtr removedata; - ClrTableNodePtr clrtablenode; -} HashTable; - -/* Structure uniquely identifies a search request */ -typedef struct ldapmemcacheReqId_struct { - LDAP *ldmemcrid_ld; - int ldmemcrid_msgid; -} ldapmemcacheReqId; - -/* Structure representing a ldap handle associated to memcache */ -typedef struct ldapmemcacheld_struct { - LDAP *ldmemcl_ld; - struct ldapmemcacheld_struct *ldmemcl_next; -} ldapmemcacheld; - -/* Structure representing header of a search result */ -typedef struct ldapmemcacheRes_struct { - char *ldmemcr_basedn; - unsigned long ldmemcr_crc_key; - unsigned long ldmemcr_resSize; - unsigned long ldmemcr_timestamp; - LDAPMessage *ldmemcr_resHead; - LDAPMessage *ldmemcr_resTail; - ldapmemcacheReqId ldmemcr_req_id; - struct ldapmemcacheRes_struct *ldmemcr_next[LIST_TOTAL]; - struct ldapmemcacheRes_struct *ldmemcr_prev[LIST_TOTAL]; - struct ldapmemcacheRes_struct *ldmemcr_htable_next; -} ldapmemcacheRes; - -/* Structure for memcache statistics */ -typedef struct ldapmemcacheStats_struct { - unsigned long ldmemcstat_tries; - unsigned long ldmemcstat_hits; -} ldapmemcacheStats; - -/* Structure of a memcache object */ -struct ldapmemcache { - unsigned long ldmemc_ttl; - unsigned long ldmemc_size; - unsigned long ldmemc_size_used; - unsigned long ldmemc_size_entries; - char **ldmemc_basedns; - void *ldmemc_lock; - ldapmemcacheld *ldmemc_lds; - HashTable *ldmemc_resTmp; - HashTable *ldmemc_resLookup; - ldapmemcacheRes *ldmemc_resHead[LIST_TOTAL]; - ldapmemcacheRes *ldmemc_resTail[LIST_TOTAL]; - struct ldap_thread_fns ldmemc_lock_fns; - ldapmemcacheStats ldmemc_stats; -}; - -/* Function prototypes */ -static int memcache_exist(LDAP *ld); -static int memcache_add_to_ld(LDAP *ld, int msgid, LDAPMessage *pMsg); -static int memcache_compare_dn(const char *main_dn, const char *dn, int scope); -static int memcache_dup_message(LDAPMessage *res, int msgid, int fromcache, - LDAPMessage **ppResCopy, unsigned long *pSize); -static BerElement* memcache_ber_dup(BerElement* pBer, unsigned long *pSize); - -static void memcache_trim_basedn_spaces(char *basedn); -static int memcache_validate_basedn(LDAPMemCache *cache, const char *basedn); -static int memcache_get_ctrls_len(LDAPControl **ctrls); -static void memcache_append_ctrls(char *buf, LDAPControl **serverCtrls, - LDAPControl **clientCtrls); -static int memcache_adj_size(LDAPMemCache *cache, unsigned long size, - int usageFlags, int bAdd); -static int memcache_free_entry(LDAPMemCache *cache, ldapmemcacheRes *pRes); -static int memcache_expired(LDAPMemCache *cache, ldapmemcacheRes *pRes, - unsigned long curTime); -static int memcache_add_to_list(LDAPMemCache *cache, ldapmemcacheRes *pRes, - int index); -static int memcache_add_res_to_list(ldapmemcacheRes *pRes, LDAPMessage *pMsg, - unsigned long size); -static int memcache_free_from_list(LDAPMemCache *cache, ldapmemcacheRes *pRes, - int index); -static int memcache_search(LDAP *ld, unsigned long key, LDAPMessage **ppRes); -static int memcache_add(LDAP *ld, unsigned long key, int msgid, - const char *basedn); -static int memcache_append(LDAP *ld, int msgid, LDAPMessage *pRes); -static int memcache_append_last(LDAP *ld, int msgid, LDAPMessage *pRes); -static int memcache_remove(LDAP *ld, int msgid); -#if 0 /* function not used */ -static int memcache_remove_all(LDAP *ld); -#endif /* 0 */ -static int memcache_access(LDAPMemCache *cache, int mode, - void *pData1, void *pData2, void *pData3); -#ifdef LDAP_DEBUG -static void memcache_print_list( LDAPMemCache *cache, int index ); -static void memcache_report_statistics( LDAPMemCache *cache ); -#endif /* LDAP_DEBUG */ - -static int htable_calculate_size(int sizelimit); -static int htable_sizeinbytes(HashTable *pTable); -static int htable_put(HashTable *pTable, void *key, void *pData); -static int htable_get(HashTable *pTable, void *key, void **ppData); -static int htable_misc(HashTable *pTable, void *key, void *pData); -static int htable_remove(HashTable *pTable, void *key, void **ppData); -static int htable_removeall(HashTable *pTable, void *pData); -static int htable_create(int size_limit, HashFuncPtr hashf, - PutDataPtr putDataf, GetDataPtr getDataf, - RemoveDataPtr removeDataf, ClrTableNodePtr clrNodef, - MiscFuncPtr miscOpf, HashTable **ppTable); -static int htable_free(HashTable *pTable); - -static int msgid_hashf(int table_size, void *key); -static int msgid_putdata(void **ppTableData, void *key, void *pData); -static int msgid_getdata(void *pTableData, void *key, void **ppData); -static int msgid_removedata(void **ppTableData, void *key, void **ppData); -static int msgid_clear_ld_items(void **ppTableData, void *key, void *pData); -static void msgid_clearnode(void **ppTableData, void *pData); - -static int attrkey_hashf(int table_size, void *key); -static int attrkey_putdata(void **ppTableData, void *key, void *pData); -static int attrkey_getdata(void *pTableData, void *key, void **ppData); -static int attrkey_removedata(void **ppTableData, void *key, void **ppData); -static void attrkey_clearnode(void **ppTableData, void *pData); - -static unsigned long crc32_convert(char *buf, int len); - -/* Create a memcache object. */ -int -LDAP_CALL -ldap_memcache_init( unsigned long ttl, unsigned long size, - char **baseDNs, struct ldap_thread_fns *thread_fns, - LDAPMemCache **cachep ) -{ - unsigned long total_size = 0; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_memcache_init\n", 0, 0, 0 ); - - if ( cachep == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - if ((*cachep = (LDAPMemCache*)NSLDAPI_CALLOC(1, - sizeof(LDAPMemCache))) == NULL) { - return ( LDAP_NO_MEMORY ); - } - - total_size += sizeof(LDAPMemCache); - - (*cachep)->ldmemc_ttl = ttl; - (*cachep)->ldmemc_size = size; - (*cachep)->ldmemc_lds = NULL; - - /* Non-zero default size needed for calculating size of hash tables */ - size = (size ? size : MEMCACHE_DEF_SIZE); - - if (thread_fns) { - memcpy(&((*cachep)->ldmemc_lock_fns), thread_fns, - sizeof(struct ldap_thread_fns)); - } else { - memset(&((*cachep)->ldmemc_lock_fns), 0, - sizeof(struct ldap_thread_fns)); - } - - (*cachep)->ldmemc_lock = LDAP_MEMCACHE_MUTEX_ALLOC( *cachep ); - - /* Cache basedns */ - if (baseDNs != NULL) { - - int i; - - for (i = 0; baseDNs[i]; i++) { - ; - } - - (*cachep)->ldmemc_basedns = (char**)NSLDAPI_CALLOC(i + 1, - sizeof(char*)); - - if ((*cachep)->ldmemc_basedns == NULL) { - ldap_memcache_destroy(*cachep); - *cachep = NULL; - return ( LDAP_NO_MEMORY ); - } - - total_size += (i + 1) * sizeof(char*); - - for (i = 0; baseDNs[i]; i++) { - (*cachep)->ldmemc_basedns[i] = nsldapi_strdup(baseDNs[i]); - total_size += strlen(baseDNs[i]) + 1; - } - - (*cachep)->ldmemc_basedns[i] = NULL; - } - - /* Create hash table for temporary cache */ - if (htable_create(size, msgid_hashf, msgid_putdata, msgid_getdata, - msgid_removedata, msgid_clearnode, msgid_clear_ld_items, - &((*cachep)->ldmemc_resTmp)) != LDAP_SUCCESS) { - ldap_memcache_destroy(*cachep); - *cachep = NULL; - return( LDAP_NO_MEMORY ); - } - - total_size += htable_sizeinbytes((*cachep)->ldmemc_resTmp); - - /* Create hash table for primary cache */ - if (htable_create(size, attrkey_hashf, attrkey_putdata, - attrkey_getdata, attrkey_removedata, attrkey_clearnode, - NULL, &((*cachep)->ldmemc_resLookup)) != LDAP_SUCCESS) { - ldap_memcache_destroy(*cachep); - *cachep = NULL; - return( LDAP_NO_MEMORY ); - } - - total_size += htable_sizeinbytes((*cachep)->ldmemc_resLookup); - - /* See if there is enough room so far */ - if (memcache_adj_size(*cachep, total_size, MEMCACHE_SIZE_NON_ENTRIES, - MEMCACHE_SIZE_ADD) != LDAP_SUCCESS) { - ldap_memcache_destroy(*cachep); - *cachep = NULL; - return( LDAP_SIZELIMIT_EXCEEDED ); - } - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_memcache_init new cache 0x%x\n", - *cachep, 0, 0 ); - - return( LDAP_SUCCESS ); -} - -/* Associates a ldap handle to a memcache object. */ -int -LDAP_CALL -ldap_memcache_set( LDAP *ld, LDAPMemCache *cache ) -{ - int nRes = LDAP_SUCCESS; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_memcache_set\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) ) - return( LDAP_PARAM_ERROR ); - - LDAP_MUTEX_LOCK( ld, LDAP_MEMCACHE_LOCK ); - - if (ld->ld_memcache != cache) { - - LDAPMemCache *c = ld->ld_memcache; - ldapmemcacheld *pCur = NULL; - ldapmemcacheld *pPrev = NULL; - - /* First dissociate handle from old cache */ - - LDAP_MEMCACHE_MUTEX_LOCK( c ); - - pCur = (c ? c->ldmemc_lds : NULL); - for (; pCur; pCur = pCur->ldmemcl_next) { - if (pCur->ldmemcl_ld == ld) - break; - pPrev = pCur; - } - - if (pCur) { - - ldapmemcacheReqId reqid; - - reqid.ldmemcrid_ld = ld; - reqid.ldmemcrid_msgid = -1; - htable_misc(c->ldmemc_resTmp, (void*)&reqid, (void*)c); - - if (pPrev) - pPrev->ldmemcl_next = pCur->ldmemcl_next; - else - c->ldmemc_lds = pCur->ldmemcl_next; - NSLDAPI_FREE(pCur); - pCur = NULL; - - memcache_adj_size(c, sizeof(ldapmemcacheld), - MEMCACHE_SIZE_NON_ENTRIES, MEMCACHE_SIZE_DEDUCT); - } - - LDAP_MEMCACHE_MUTEX_UNLOCK( c ); - - ld->ld_memcache = NULL; - - /* Exit if no new cache is specified */ - if (cache == NULL) { - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - return( LDAP_SUCCESS ); - } - - /* Then associate handle with new cache */ - - LDAP_MEMCACHE_MUTEX_LOCK( cache ); - - if ((nRes = memcache_adj_size(cache, sizeof(ldapmemcacheld), - MEMCACHE_SIZE_NON_ENTRIES, MEMCACHE_SIZE_ADD)) != LDAP_SUCCESS) { - LDAP_MEMCACHE_MUTEX_UNLOCK( cache ); - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - return nRes; - } - - pCur = (ldapmemcacheld*)NSLDAPI_CALLOC(1, sizeof(ldapmemcacheld)); - if (pCur == NULL) { - memcache_adj_size(cache, sizeof(ldapmemcacheld), - MEMCACHE_SIZE_NON_ENTRIES, MEMCACHE_SIZE_DEDUCT); - nRes = LDAP_NO_MEMORY; - } else { - pCur->ldmemcl_ld = ld; - pCur->ldmemcl_next = cache->ldmemc_lds; - cache->ldmemc_lds = pCur; - ld->ld_memcache = cache; - } - - LDAP_MEMCACHE_MUTEX_UNLOCK( cache ); - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - - return nRes; -} - -/* Retrieves memcache with which the ldap handle has been associated. */ -int -LDAP_CALL -ldap_memcache_get( LDAP *ld, LDAPMemCache **cachep ) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_memcache_get ld: 0x%x\n", ld, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || cachep == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_MEMCACHE_LOCK ); - *cachep = ld->ld_memcache; - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - - return( LDAP_SUCCESS ); -} - -/* - * Function that stays inside libldap and proactively expires items from - * the given cache. This should be called from a newly created thread since - * it will not return until after ldap_memcache_destroy() is called. - */ -void -LDAP_CALL -ldap_memcache_update( LDAPMemCache *cache ) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_memcache_update: cache 0x%x\n", - cache, 0, 0 ); - - if ( !NSLDAPI_VALID_MEMCACHE_POINTER( cache )) { - return; - } - - LDAP_MEMCACHE_MUTEX_LOCK( cache ); - memcache_access(cache, MEMCACHE_ACCESS_UPDATE, NULL, NULL, NULL); - LDAP_MEMCACHE_MUTEX_UNLOCK( cache ); -} - -/* Removes specified entries from given memcache. */ -void -LDAP_CALL -ldap_memcache_flush( LDAPMemCache *cache, char *dn, int scope ) -{ - LDAPDebug( LDAP_DEBUG_TRACE, - "ldap_memcache_flush( cache: 0x%x, dn: %s, scope: %d)\n", - cache, ( dn == NULL ) ? "(null)" : dn, scope ); - - if ( !NSLDAPI_VALID_MEMCACHE_POINTER( cache )) { - return; - } - - LDAP_MEMCACHE_MUTEX_LOCK( cache ); - - if (!dn) { - memcache_access(cache, MEMCACHE_ACCESS_FLUSH_ALL, NULL, NULL, NULL); - } else { - memcache_access(cache, MEMCACHE_ACCESS_FLUSH, - (void*)dn, (void*)scope, NULL); - } - - LDAP_MEMCACHE_MUTEX_UNLOCK( cache ); -} - -/* Destroys the given memcache. */ -void -LDAP_CALL -ldap_memcache_destroy( LDAPMemCache *cache ) -{ - int i = 0; - unsigned long size = sizeof(LDAPMemCache); - ldapmemcacheld *pNode = NULL, *pNextNode = NULL; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_memcache_destroy( 0x%x )\n", - cache, 0, 0 ); - - if ( !NSLDAPI_VALID_MEMCACHE_POINTER( cache )) { - return; - } - - /* Dissociate all ldap handes from this cache. */ - LDAP_MEMCACHE_MUTEX_LOCK( cache ); - - for (pNode = cache->ldmemc_lds; pNode; pNode = pNextNode, i++) { - LDAP_MUTEX_LOCK( pNode->ldmemcl_ld, LDAP_MEMCACHE_LOCK ); - cache->ldmemc_lds = pNode->ldmemcl_next; - pNode->ldmemcl_ld->ld_memcache = NULL; - LDAP_MUTEX_UNLOCK( pNode->ldmemcl_ld, LDAP_MEMCACHE_LOCK ); - pNextNode = pNode->ldmemcl_next; - NSLDAPI_FREE(pNode); - } - - size += i * sizeof(ldapmemcacheld); - - LDAP_MEMCACHE_MUTEX_UNLOCK( cache ); - - /* Free array of basedns */ - if (cache->ldmemc_basedns) { - for (i = 0; cache->ldmemc_basedns[i]; i++) { - size += strlen(cache->ldmemc_basedns[i]) + 1; - NSLDAPI_FREE(cache->ldmemc_basedns[i]); - } - size += (i + 1) * sizeof(char*); - NSLDAPI_FREE(cache->ldmemc_basedns); - } - - /* Free hash table used for temporary cache */ - if (cache->ldmemc_resTmp) { - size += htable_sizeinbytes(cache->ldmemc_resTmp); - memcache_access(cache, MEMCACHE_ACCESS_DELETE_ALL, NULL, NULL, NULL); - htable_free(cache->ldmemc_resTmp); - } - - /* Free hash table used for primary cache */ - if (cache->ldmemc_resLookup) { - size += htable_sizeinbytes(cache->ldmemc_resLookup); - memcache_access(cache, MEMCACHE_ACCESS_FLUSH_ALL, NULL, NULL, NULL); - htable_free(cache->ldmemc_resLookup); - } - - memcache_adj_size(cache, size, MEMCACHE_SIZE_NON_ENTRIES, - MEMCACHE_SIZE_DEDUCT); - - LDAP_MEMCACHE_MUTEX_FREE( cache ); - - NSLDAPI_FREE(cache); -} - -/************************* Internal API Functions ****************************/ - -/* Creates an integer key by applying the Cyclic Reduntency Check algorithm on - a long string formed by concatenating all the search parameters plus the - current bind DN. The key is used in the cache for looking up cached - entries. It is assumed that the CRC algorithm will generate - different integers from different byte strings. */ -int -ldap_memcache_createkey(LDAP *ld, const char *base, int scope, - const char *filter, char **attrs, - int attrsonly, LDAPControl **serverctrls, - LDAPControl **clientctrls, unsigned long *keyp) -{ - int nRes, i, j, i_smallest; - int len; - int defport; - char buf[50]; - char *tmp, *defhost, *binddn, *keystr, *tmpbase; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || (keyp == NULL) ) - return( LDAP_PARAM_ERROR ); - - *keyp = 0; - - if (!memcache_exist(ld)) - return( LDAP_LOCAL_ERROR ); - - LDAP_MUTEX_LOCK( ld, LDAP_MEMCACHE_LOCK ); - LDAP_MEMCACHE_MUTEX_LOCK( ld->ld_memcache ); - nRes = memcache_validate_basedn(ld->ld_memcache, base); - LDAP_MEMCACHE_MUTEX_UNLOCK( ld->ld_memcache ); - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - - if (nRes != LDAP_SUCCESS) - return nRes; - - defhost = NSLDAPI_STR_NONNULL(ld->ld_defhost); - defport = ld->ld_defport; - tmpbase = nsldapi_strdup(NSLDAPI_STR_NONNULL(base)); - memcache_trim_basedn_spaces(tmpbase); - - if ((binddn = nsldapi_get_binddn(ld)) == NULL) - binddn = ""; - - sprintf(buf, "%i\n%i\n%i\n", defport, scope, (attrsonly ? 1 : 0)); - len = NSLDAPI_SAFE_STRLEN(buf) + NSLDAPI_SAFE_STRLEN(tmpbase) + - NSLDAPI_SAFE_STRLEN(filter) + NSLDAPI_SAFE_STRLEN(defhost) + - NSLDAPI_SAFE_STRLEN(binddn); - - if (attrs) { - for (i = 0; attrs[i]; i++) { - - for (i_smallest = j = i; attrs[j]; j++) { - if (strcasecmp(attrs[i_smallest], attrs[j]) > 0) - i_smallest = j; - } - - if (i != i_smallest) { - tmp = attrs[i]; - attrs[i] = attrs[i_smallest]; - attrs[i_smallest] = tmp; - } - - len += NSLDAPI_SAFE_STRLEN(attrs[i]); - } - } else { - len += 1; - } - - len += memcache_get_ctrls_len(serverctrls) + - memcache_get_ctrls_len(clientctrls) + 1; - - if ((keystr = (char*)NSLDAPI_CALLOC(len, sizeof(char))) == NULL) { - NSLDAPI_FREE(defhost); - return( LDAP_NO_MEMORY ); - } - - sprintf(keystr, "%s\n%s\n%s\n%s\n%s\n", binddn, tmpbase, - NSLDAPI_STR_NONNULL(defhost), NSLDAPI_STR_NONNULL(filter), - NSLDAPI_STR_NONNULL(buf)); - - if (attrs) { - for (i = 0; attrs[i]; i++) { - strcat(keystr, NSLDAPI_STR_NONNULL(attrs[i])); - strcat(keystr, "\n"); - } - } else { - strcat(keystr, "\n"); - } - - for (tmp = keystr; *tmp; - *tmp += (*tmp >= 'a' && *tmp <= 'z' ? 'A'-'a' : 0), tmp++) { - ; - } - - memcache_append_ctrls(keystr, serverctrls, clientctrls); - - /* CRC algorithm */ - *keyp = crc32_convert(keystr, len); - - NSLDAPI_FREE(keystr); - NSLDAPI_FREE(tmpbase); - - return LDAP_SUCCESS; -} - -/* Searches the cache for the right cached entries, and if found, attaches - them to the given ldap handle. This function relies on locking by the - caller. */ -int -ldap_memcache_result(LDAP *ld, int msgid, unsigned long key) -{ - int nRes; - LDAPMessage *pMsg = NULL; - - LDAPDebug( LDAP_DEBUG_TRACE, - "ldap_memcache_result( ld: 0x%x, msgid: %d, key: 0x%8.8lx)\n", - ld, msgid, key ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || (msgid < 0) ) { - return( LDAP_PARAM_ERROR ); - } - - if (!memcache_exist(ld)) { - return( LDAP_LOCAL_ERROR ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_MEMCACHE_LOCK ); - LDAP_MEMCACHE_MUTEX_LOCK( ld->ld_memcache ); - - /* Search the cache and append the results to ld if found */ - ++ld->ld_memcache->ldmemc_stats.ldmemcstat_tries; - if ((nRes = memcache_search(ld, key, &pMsg)) == LDAP_SUCCESS) { - nRes = memcache_add_to_ld(ld, msgid, pMsg); - ++ld->ld_memcache->ldmemc_stats.ldmemcstat_hits; - LDAPDebug( LDAP_DEBUG_TRACE, - "ldap_memcache_result: key 0x%8.8lx found in cache\n", - key, 0, 0 ); - } else { - LDAPDebug( LDAP_DEBUG_TRACE, - "ldap_memcache_result: key 0x%8.8lx not found in cache\n", - key, 0, 0 ); - } - -#ifdef LDAP_DEBUG - memcache_print_list( ld->ld_memcache, LIST_LRU ); - memcache_report_statistics( ld->ld_memcache ); -#endif /* LDAP_DEBUG */ - - LDAP_MEMCACHE_MUTEX_UNLOCK( ld->ld_memcache ); - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - - return nRes; -} - -/* Creates a new header in the cache so that entries arriving from the - directory server can later be cached under the header. */ -int -ldap_memcache_new(LDAP *ld, int msgid, unsigned long key, const char *basedn) -{ - int nRes; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) ) { - return( LDAP_PARAM_ERROR ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_MEMCACHE_LOCK ); - - if (!memcache_exist(ld)) { - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - return( LDAP_LOCAL_ERROR ); - } - - LDAP_MEMCACHE_MUTEX_LOCK( ld->ld_memcache ); - nRes = memcache_add(ld, key, msgid, basedn); - LDAP_MEMCACHE_MUTEX_UNLOCK( ld->ld_memcache ); - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - - return nRes; -} - -/* Appends a chain of entries to an existing cache header. Parameter "bLast" - indicates whether there will be more entries arriving for the search in - question. */ -int -ldap_memcache_append(LDAP *ld, int msgid, int bLast, LDAPMessage *result) -{ - int nRes = LDAP_SUCCESS; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_memcache_append( ld: 0x%x, ", ld, 0, 0 ); - LDAPDebug( LDAP_DEBUG_TRACE, "msgid %d, bLast: %d, result: 0x%x)\n", - msgid, bLast, result ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || !result ) { - return( LDAP_PARAM_ERROR ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_MEMCACHE_LOCK ); - - if (!memcache_exist(ld)) { - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - return( LDAP_LOCAL_ERROR ); - } - - LDAP_MEMCACHE_MUTEX_LOCK( ld->ld_memcache ); - - if (!bLast) - nRes = memcache_append(ld, msgid, result); - else - nRes = memcache_append_last(ld, msgid, result); - - LDAPDebug( LDAP_DEBUG_TRACE, - "ldap_memcache_append: %s result for msgid %d\n", - ( nRes == LDAP_SUCCESS ) ? "added" : "failed to add", msgid , 0 ); - - LDAP_MEMCACHE_MUTEX_UNLOCK( ld->ld_memcache ); - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - - return nRes; -} - -/* Removes partially cached results for a search as a result of calling - ldap_abandon() by the client. */ -int -ldap_memcache_abandon(LDAP *ld, int msgid) -{ - int nRes; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || (msgid < 0) ) { - return( LDAP_PARAM_ERROR ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_MEMCACHE_LOCK ); - - if (!memcache_exist(ld)) { - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - return( LDAP_LOCAL_ERROR ); - } - - LDAP_MEMCACHE_MUTEX_LOCK( ld->ld_memcache ); - nRes = memcache_remove(ld, msgid); - LDAP_MEMCACHE_MUTEX_UNLOCK( ld->ld_memcache ); - LDAP_MUTEX_UNLOCK( ld, LDAP_MEMCACHE_LOCK ); - - return nRes; -} - -/*************************** helper functions *******************************/ - -/* Removes extraneous spaces in a basedn so that basedns differ by only those - spaces will be treated as equal. Extraneous spaces are those that - precedes the basedn and those that follow a comma. */ -/* - * XXXmcs: this is a bit too agressive... we need to deal with the fact that - * commas and spaces may be quoted, in which case it is wrong to remove them. - */ -static void -memcache_trim_basedn_spaces(char *basedn) -{ - char *pRead, *pWrite; - - if (!basedn) - return; - - for (pWrite = pRead = basedn; *pRead; ) { - for (; *pRead && NSLDAPI_IS_SPACE(*pRead); pRead++) { - ; - } - for (; *pRead && !NSLDAPI_IS_SEPARATER(*pRead); - *(pWrite++) = *(pRead++)) { - ; - } - *(pWrite++) = (*pRead ? *(pRead++) : *pRead); - } -} - -/* Verifies whether the results of a search should be cached or not by - checking if the search's basedn falls under any of the basedns for which - the memcache is responsible. */ -static int -memcache_validate_basedn(LDAPMemCache *cache, const char *basedn) -{ - int i; - - if ( cache->ldmemc_basedns == NULL ) { - return( LDAP_SUCCESS ); - } - -#if 1 - if (basedn == NULL) { - basedn = ""; - } -#else - /* XXXmcs: I do not understand this code... */ - if (basedn == NULL) - return (cache->ldmemc_basedns && cache->ldmemc_basedns[0] ? - LDAP_OPERATIONS_ERROR : LDAP_SUCCESS); - } -#endif - - for (i = 0; cache->ldmemc_basedns[i]; i++) { - if (memcache_compare_dn(basedn, cache->ldmemc_basedns[i], - LDAP_SCOPE_SUBTREE) == LDAP_COMPARE_TRUE) { - return( LDAP_SUCCESS ); - } - } - - return( LDAP_OPERATIONS_ERROR ); -} - -/* Calculates the length of the buffer needed to concatenate the contents of - a ldap control. */ -static int -memcache_get_ctrls_len(LDAPControl **ctrls) -{ - int len = 0, i; - - if (ctrls) { - for (i = 0; ctrls[i]; i++) { - len += strlen(NSLDAPI_STR_NONNULL(ctrls[i]->ldctl_oid)) + - (ctrls[i]->ldctl_value).bv_len + 4; - } - } - - return len; -} - -/* Contenates the contents of client and server controls to a buffer. */ -static void -memcache_append_ctrls(char *buf, LDAPControl **serverCtrls, - LDAPControl **clientCtrls) -{ - int i, j; - char *pCh = buf + strlen(buf); - LDAPControl **ctrls; - - for (j = 0; j < 2; j++) { - - if ((ctrls = (j ? clientCtrls : serverCtrls)) == NULL) - continue; - - for (i = 0; ctrls[i]; i++) { - sprintf(pCh, "%s\n", NSLDAPI_STR_NONNULL(ctrls[i]->ldctl_oid)); - pCh += strlen(NSLDAPI_STR_NONNULL(ctrls[i]->ldctl_oid)) + 1; - if ((ctrls[i]->ldctl_value).bv_len > 0) { - memcpy(pCh, (ctrls[i]->ldctl_value).bv_val, - (ctrls[i]->ldctl_value).bv_len); - pCh += (ctrls[i]->ldctl_value).bv_len; - } - sprintf(pCh, "\n%i\n", (ctrls[i]->ldctl_iscritical ? 1 : 0)); - pCh += 3; - } - } -} - -/* Increases or decreases the size (in bytes) the given memcache currently - uses. If the size goes over the limit, the function returns an error. */ -static int -memcache_adj_size(LDAPMemCache *cache, unsigned long size, - int usageFlags, int bAdd) -{ - LDAPDebug( LDAP_DEBUG_TRACE, - "memcache_adj_size: attempting to %s %ld %s bytes...\n", - bAdd ? "add" : "remove", size, - ( usageFlags & MEMCACHE_SIZE_ENTRIES ) ? "entry" : "non-entry" ); - - if (bAdd) { - cache->ldmemc_size_used += size; - if ((cache->ldmemc_size > 0) && - (cache->ldmemc_size_used > cache->ldmemc_size)) { - - if (size > cache->ldmemc_size_entries) { - cache->ldmemc_size_used -= size; - LDAPDebug( LDAP_DEBUG_TRACE, - "memcache_adj_size: failed (size > size_entries %ld).\n", - cache->ldmemc_size_entries, 0, 0 ); - return( LDAP_SIZELIMIT_EXCEEDED ); - } - - while (cache->ldmemc_size_used > cache->ldmemc_size) { - if (memcache_access(cache, MEMCACHE_ACCESS_FLUSH_LRU, - NULL, NULL, NULL) != LDAP_SUCCESS) { - cache->ldmemc_size_used -= size; - LDAPDebug( LDAP_DEBUG_TRACE, - "memcache_adj_size: failed (LRU flush failed).\n", - 0, 0, 0 ); - return( LDAP_SIZELIMIT_EXCEEDED ); - } - } - } - if (usageFlags & MEMCACHE_SIZE_ENTRIES) - cache->ldmemc_size_entries += size; - } else { - cache->ldmemc_size_used -= size; - assert(cache->ldmemc_size_used >= 0); - if (usageFlags & MEMCACHE_SIZE_ENTRIES) - cache->ldmemc_size_entries -= size; - } - -#ifdef LDAP_DEBUG - if ( cache->ldmemc_size == 0 ) { /* no size limit */ - LDAPDebug( LDAP_DEBUG_TRACE, - "memcache_adj_size: succeeded (new size: %ld bytes).\n", - cache->ldmemc_size_used, 0, 0 ); - } else { - LDAPDebug( LDAP_DEBUG_TRACE, - "memcache_adj_size: succeeded (new size: %ld bytes, " - "free space: %ld bytes).\n", cache->ldmemc_size_used, - cache->ldmemc_size - cache->ldmemc_size_used, 0 ); - } -#endif /* LDAP_DEBUG */ - - return( LDAP_SUCCESS ); -} - -/* Searches the cache for results for a particular search identified by - parameter "key", which was generated ldap_memcache_createkey(). */ -static int -memcache_search(LDAP *ld, unsigned long key, LDAPMessage **ppRes) -{ - int nRes; - ldapmemcacheRes *pRes; - - *ppRes = NULL; - - if (!memcache_exist(ld)) - return LDAP_LOCAL_ERROR; - - nRes = memcache_access(ld->ld_memcache, MEMCACHE_ACCESS_FIND, - (void*)&key, (void*)(&pRes), NULL); - - if (nRes != LDAP_SUCCESS) - return nRes; - - *ppRes = pRes->ldmemcr_resHead; - assert((pRes->ldmemcr_req_id).ldmemcrid_msgid == -1); - - return( LDAP_SUCCESS ); -} - -/* Adds a new header into the cache as a place holder for entries - arriving later. */ -static int -memcache_add(LDAP *ld, unsigned long key, int msgid, - const char *basedn) -{ - ldapmemcacheReqId reqid; - - if (!memcache_exist(ld)) - return LDAP_LOCAL_ERROR; - - reqid.ldmemcrid_msgid = msgid; - reqid.ldmemcrid_ld = ld; - - return memcache_access(ld->ld_memcache, MEMCACHE_ACCESS_ADD, - (void*)&key, (void*)&reqid, (void*)basedn); -} - -/* Appends search entries arriving from the dir server to the cache. */ -static int -memcache_append(LDAP *ld, int msgid, LDAPMessage *pRes) -{ - ldapmemcacheReqId reqid; - - if (!memcache_exist(ld)) - return LDAP_LOCAL_ERROR; - - reqid.ldmemcrid_msgid = msgid; - reqid.ldmemcrid_ld = ld; - - return memcache_access(ld->ld_memcache, MEMCACHE_ACCESS_APPEND, - (void*)&reqid, (void*)pRes, NULL); -} - -/* Same as memcache_append(), but the entries being appended are the - last from the dir server. Once all entries for a search have arrived, - the entries are moved from secondary to primary cache, and a time - stamp is given to the entries. */ -static int -memcache_append_last(LDAP *ld, int msgid, LDAPMessage *pRes) -{ - ldapmemcacheReqId reqid; - - if (!memcache_exist(ld)) - return LDAP_LOCAL_ERROR; - - reqid.ldmemcrid_msgid = msgid; - reqid.ldmemcrid_ld = ld; - - return memcache_access(ld->ld_memcache, MEMCACHE_ACCESS_APPEND_LAST, - (void*)&reqid, (void*)pRes, NULL); -} - -/* Removes entries from the temporary cache. */ -static int -memcache_remove(LDAP *ld, int msgid) -{ - ldapmemcacheReqId reqid; - - if (!memcache_exist(ld)) - return LDAP_LOCAL_ERROR; - - reqid.ldmemcrid_msgid = msgid; - reqid.ldmemcrid_ld = ld; - - return memcache_access(ld->ld_memcache, MEMCACHE_ACCESS_DELETE, - (void*)&reqid, NULL, NULL); -} - -#if 0 /* this function is not used */ -/* Wipes out everything in the temporary cache directory. */ -static int -memcache_remove_all(LDAP *ld) -{ - if (!memcache_exist(ld)) - return LDAP_LOCAL_ERROR; - - return memcache_access(ld->ld_memcache, MEMCACHE_ACCESS_DELETE_ALL, - NULL, NULL, NULL); -} -#endif /* 0 */ - -/* Returns TRUE or FALSE */ -static int -memcache_exist(LDAP *ld) -{ - return (ld->ld_memcache != NULL); -} - -/* Attaches cached entries to an ldap handle. */ -static int -memcache_add_to_ld(LDAP *ld, int msgid, LDAPMessage *pMsg) -{ - int nRes = LDAP_SUCCESS; - LDAPMessage **r; - LDAPMessage *pCopy; - - nRes = memcache_dup_message(pMsg, msgid, 1, &pCopy, NULL); - if (nRes != LDAP_SUCCESS) - return nRes; - - for (r = &(ld->ld_responses); *r; r = &((*r)->lm_next)) - if ((*r)->lm_msgid == msgid) - break; - - if (*r) - for (r = &((*r)->lm_chain); *r; r = &((*r)->lm_chain)) { - ; - } - - *r = pCopy; - - return nRes; -} - -/* Check if main_dn is included in {dn, scope} */ -static int -memcache_compare_dn(const char *main_dn, const char *dn, int scope) -{ - int nRes; - char **components = NULL; - char **main_components = NULL; - - components = ldap_explode_dn(dn, 0); - main_components = ldap_explode_dn(main_dn, 0); - - if (!components || !main_components) { - nRes = LDAP_COMPARE_TRUE; - } - else { - - int i, main_i; - - main_i = ldap_count_values(main_components) - 1; - i = ldap_count_values(components) - 1; - - for (; i >= 0 && main_i >= 0; i--, main_i--) { - if (strcasecmp(main_components[main_i], components[i])) - break; - } - - if (i >= 0 && main_i >= 0) { - nRes = LDAP_COMPARE_FALSE; - } - else if (i < 0 && main_i < 0) { - if (scope != LDAP_SCOPE_ONELEVEL) - nRes = LDAP_COMPARE_TRUE; - else - nRes = LDAP_COMPARE_FALSE; - } - else if (main_i < 0) { - nRes = LDAP_COMPARE_FALSE; - } - else { - if (scope == LDAP_SCOPE_BASE) - nRes = LDAP_COMPARE_FALSE; - else if (scope == LDAP_SCOPE_SUBTREE) - nRes = LDAP_COMPARE_TRUE; - else if (main_i == 0) - nRes = LDAP_COMPARE_TRUE; - else - nRes = LDAP_COMPARE_FALSE; - } - } - - if (components) - ldap_value_free(components); - - if (main_components) - ldap_value_free(main_components); - - return nRes; -} - -/* Dup a complete separate copy of a berelement, including the buffers - the berelement points to. */ -static BerElement* -memcache_ber_dup(BerElement* pBer, unsigned long *pSize) -{ - BerElement *p = ber_dup(pBer); - - *pSize = 0; - - if (p) { - - *pSize += sizeof(BerElement) + EXTRA_SIZE; - - if (p->ber_len <= EXTRA_SIZE) { - p->ber_flags |= LBER_FLAG_NO_FREE_BUFFER; - p->ber_buf = (char*)p + sizeof(BerElement); - } else { - p->ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER; - p->ber_buf = (char*)NSLDAPI_CALLOC(1, p->ber_len); - *pSize += (p->ber_buf ? p->ber_len : 0); - } - - if (p->ber_buf) { - p->ber_ptr = p->ber_buf + (pBer->ber_ptr - pBer->ber_buf); - p->ber_end = p->ber_buf + p->ber_len; - memcpy(p->ber_buf, pBer->ber_buf, p->ber_len); - } else { - ber_free(p, 0); - p = NULL; - *pSize = 0; - } - } - - return p; -} - -/* Dup a entry or a chain of entries. */ -static int -memcache_dup_message(LDAPMessage *res, int msgid, int fromcache, - LDAPMessage **ppResCopy, unsigned long *pSize) -{ - int nRes = LDAP_SUCCESS; - unsigned long ber_size; - LDAPMessage *pCur; - LDAPMessage **ppCurNew; - - *ppResCopy = NULL; - - if (pSize) - *pSize = 0; - - /* Make a copy of res */ - for (pCur = res, ppCurNew = ppResCopy; pCur; - pCur = pCur->lm_chain, ppCurNew = &((*ppCurNew)->lm_chain)) { - - if ((*ppCurNew = (LDAPMessage*)NSLDAPI_CALLOC(1, - sizeof(LDAPMessage))) == NULL) { - nRes = LDAP_NO_MEMORY; - break; - } - - memcpy(*ppCurNew, pCur, sizeof(LDAPMessage)); - (*ppCurNew)->lm_next = NULL; - (*ppCurNew)->lm_ber = memcache_ber_dup(pCur->lm_ber, &ber_size); - (*ppCurNew)->lm_msgid = msgid; - (*ppCurNew)->lm_fromcache = (fromcache != 0); - - if (pSize) - *pSize += sizeof(LDAPMessage) + ber_size; - } - - if ((nRes != LDAP_SUCCESS) && (*ppResCopy != NULL)) { - ldap_msgfree(*ppResCopy); - *ppResCopy = NULL; - if (pSize) - *pSize = 0; - } - - return nRes; -} - -/************************* Cache Functions ***********************/ - -/* Frees a cache header. */ -static int -memcache_free_entry(LDAPMemCache *cache, ldapmemcacheRes *pRes) -{ - if (pRes) { - - unsigned long size = sizeof(ldapmemcacheRes); - - if (pRes->ldmemcr_basedn) { - size += strlen(pRes->ldmemcr_basedn) + 1; - NSLDAPI_FREE(pRes->ldmemcr_basedn); - } - - if (pRes->ldmemcr_resHead) { - size += pRes->ldmemcr_resSize; - ldap_msgfree(pRes->ldmemcr_resHead); - } - - NSLDAPI_FREE(pRes); - - memcache_adj_size(cache, size, MEMCACHE_SIZE_ENTRIES, - MEMCACHE_SIZE_DEDUCT); - } - - return( LDAP_SUCCESS ); -} - -/* Detaches a cache header from the list of headers. */ -static int -memcache_free_from_list(LDAPMemCache *cache, ldapmemcacheRes *pRes, int index) -{ - if (pRes->ldmemcr_prev[index]) - pRes->ldmemcr_prev[index]->ldmemcr_next[index] = - pRes->ldmemcr_next[index]; - - if (pRes->ldmemcr_next[index]) - pRes->ldmemcr_next[index]->ldmemcr_prev[index] = - pRes->ldmemcr_prev[index]; - - if (cache->ldmemc_resHead[index] == pRes) - cache->ldmemc_resHead[index] = pRes->ldmemcr_next[index]; - - if (cache->ldmemc_resTail[index] == pRes) - cache->ldmemc_resTail[index] = pRes->ldmemcr_prev[index]; - - pRes->ldmemcr_prev[index] = NULL; - pRes->ldmemcr_next[index] = NULL; - - return( LDAP_SUCCESS ); -} - -/* Inserts a new cache header to a list of headers. */ -static int -memcache_add_to_list(LDAPMemCache *cache, ldapmemcacheRes *pRes, int index) -{ - if (cache->ldmemc_resHead[index]) - cache->ldmemc_resHead[index]->ldmemcr_prev[index] = pRes; - else - cache->ldmemc_resTail[index] = pRes; - - pRes->ldmemcr_prev[index] = NULL; - pRes->ldmemcr_next[index] = cache->ldmemc_resHead[index]; - cache->ldmemc_resHead[index] = pRes; - - return( LDAP_SUCCESS ); -} - -/* Appends a chain of entries to the given cache header. */ -static int -memcache_add_res_to_list(ldapmemcacheRes *pRes, LDAPMessage *pMsg, - unsigned long size) -{ - if (pRes->ldmemcr_resTail) - pRes->ldmemcr_resTail->lm_chain = pMsg; - else - pRes->ldmemcr_resHead = pMsg; - - for (pRes->ldmemcr_resTail = pMsg; - pRes->ldmemcr_resTail->lm_chain; - pRes->ldmemcr_resTail = pRes->ldmemcr_resTail->lm_chain) { - ; - } - - pRes->ldmemcr_resSize += size; - - return( LDAP_SUCCESS ); -} - - -#ifdef LDAP_DEBUG -static void -memcache_print_list( LDAPMemCache *cache, int index ) -{ - char *name; - ldapmemcacheRes *restmp; - - switch( index ) { - case LIST_TTL: - name = "TTL"; - break; - case LIST_LRU: - name = "LRU"; - break; - case LIST_TMP: - name = "TMP"; - break; - case LIST_TOTAL: - name = "TOTAL"; - break; - default: - name = "unknown"; - } - - LDAPDebug( LDAP_DEBUG_TRACE, "memcache 0x%x %s list:\n", - cache, name, 0 ); - for ( restmp = cache->ldmemc_resHead[index]; restmp != NULL; - restmp = restmp->ldmemcr_next[index] ) { - LDAPDebug( LDAP_DEBUG_TRACE, - " key: 0x%8.8lx, ld: 0x%x, msgid: %d\n", - restmp->ldmemcr_crc_key, - restmp->ldmemcr_req_id.ldmemcrid_ld, - restmp->ldmemcr_req_id.ldmemcrid_msgid ); - } - LDAPDebug( LDAP_DEBUG_TRACE, "memcache 0x%x end of %s list.\n", - cache, name, 0 ); -} -#endif /* LDAP_DEBUG */ - -/* Tells whether a cached result has expired. */ -static int -memcache_expired(LDAPMemCache *cache, ldapmemcacheRes *pRes, - unsigned long curTime) -{ - if (!cache->ldmemc_ttl) - return 0; - - return ((unsigned long)difftime( - (time_t)curTime, - (time_t)(pRes->ldmemcr_timestamp)) >= - cache->ldmemc_ttl); -} - -/* Operates the cache in a central place. */ -static int -memcache_access(LDAPMemCache *cache, int mode, - void *pData1, void *pData2, void *pData3) -{ - int nRes = LDAP_SUCCESS; - unsigned long size = 0; - - /* Add a new cache header to the cache. */ - if (mode == MEMCACHE_ACCESS_ADD) { - unsigned long key = *((unsigned long*)pData1); - char *basedn = (char*)pData3; - ldapmemcacheRes *pRes = NULL; - - nRes = htable_get(cache->ldmemc_resTmp, pData2, (void**)&pRes); - if (nRes == LDAP_SUCCESS) - return( LDAP_ALREADY_EXISTS ); - - pRes = (ldapmemcacheRes*)NSLDAPI_CALLOC(1, sizeof(ldapmemcacheRes)); - if (pRes == NULL) - return( LDAP_NO_MEMORY ); - - pRes->ldmemcr_crc_key = key; - pRes->ldmemcr_req_id = *((ldapmemcacheReqId*)pData2); - pRes->ldmemcr_basedn = (basedn ? nsldapi_strdup(basedn) : NULL); - - size += sizeof(ldapmemcacheRes) + strlen(basedn) + 1; - nRes = memcache_adj_size(cache, size, MEMCACHE_SIZE_ENTRIES, - MEMCACHE_SIZE_ADD); - if (nRes == LDAP_SUCCESS) - nRes = htable_put(cache->ldmemc_resTmp, pData2, (void*)pRes); - if (nRes == LDAP_SUCCESS) - memcache_add_to_list(cache, pRes, LIST_TMP); - else - memcache_free_entry(cache, pRes); - } - /* Append entries to an existing cache header. */ - else if ((mode == MEMCACHE_ACCESS_APPEND) || - (mode == MEMCACHE_ACCESS_APPEND_LAST)) { - - LDAPMessage *pMsg = (LDAPMessage*)pData2; - LDAPMessage *pCopy = NULL; - ldapmemcacheRes *pRes = NULL; - - nRes = htable_get(cache->ldmemc_resTmp, pData1, (void**)&pRes); - if (nRes != LDAP_SUCCESS) - return nRes; - - nRes = memcache_dup_message(pMsg, pMsg->lm_msgid, 0, &pCopy, &size); - if (nRes != LDAP_SUCCESS) { - nRes = htable_remove(cache->ldmemc_resTmp, pData1, NULL); - assert(nRes == LDAP_SUCCESS); - memcache_free_from_list(cache, pRes, LIST_TMP); - memcache_free_entry(cache, pRes); - return nRes; - } - - nRes = memcache_adj_size(cache, size, MEMCACHE_SIZE_ENTRIES, - MEMCACHE_SIZE_ADD); - if (nRes != LDAP_SUCCESS) { - ldap_msgfree(pCopy); - nRes = htable_remove(cache->ldmemc_resTmp, pData1, NULL); - assert(nRes == LDAP_SUCCESS); - memcache_free_from_list(cache, pRes, LIST_TMP); - memcache_free_entry(cache, pRes); - return nRes; - } - - memcache_add_res_to_list(pRes, pCopy, size); - - if (mode == MEMCACHE_ACCESS_APPEND) - return( LDAP_SUCCESS ); - - nRes = htable_remove(cache->ldmemc_resTmp, pData1, NULL); - assert(nRes == LDAP_SUCCESS); - memcache_free_from_list(cache, pRes, LIST_TMP); - (pRes->ldmemcr_req_id).ldmemcrid_ld = NULL; - (pRes->ldmemcr_req_id).ldmemcrid_msgid = -1; - pRes->ldmemcr_timestamp = (unsigned long)time(NULL); - - if ((nRes = htable_put(cache->ldmemc_resLookup, - (void*)&(pRes->ldmemcr_crc_key), - (void*)pRes)) == LDAP_SUCCESS) { - memcache_add_to_list(cache, pRes, LIST_TTL); - memcache_add_to_list(cache, pRes, LIST_LRU); - } else { - memcache_free_entry(cache, pRes); - } - } - /* Search for cached entries for a particular search. */ - else if (mode == MEMCACHE_ACCESS_FIND) { - - ldapmemcacheRes **ppRes = (ldapmemcacheRes**)pData2; - - nRes = htable_get(cache->ldmemc_resLookup, pData1, (void**)ppRes); - if (nRes != LDAP_SUCCESS) - return nRes; - - if (!memcache_expired(cache, *ppRes, (unsigned long)time(0))) { - memcache_free_from_list(cache, *ppRes, LIST_LRU); - memcache_add_to_list(cache, *ppRes, LIST_LRU); - return( LDAP_SUCCESS ); - } - - nRes = htable_remove(cache->ldmemc_resLookup, pData1, NULL); - assert(nRes == LDAP_SUCCESS); - memcache_free_from_list(cache, *ppRes, LIST_TTL); - memcache_free_from_list(cache, *ppRes, LIST_LRU); - memcache_free_entry(cache, *ppRes); - nRes = LDAP_NO_SUCH_OBJECT; - *ppRes = NULL; - } - /* Remove cached entries in the temporary cache. */ - else if (mode == MEMCACHE_ACCESS_DELETE) { - - ldapmemcacheRes *pCurRes = NULL; - - if ((nRes = htable_remove(cache->ldmemc_resTmp, pData1, - (void**)&pCurRes)) == LDAP_SUCCESS) { - memcache_free_from_list(cache, pCurRes, LIST_TMP); - memcache_free_entry(cache, pCurRes); - } - } - /* Wipe out the temporary cache. */ - else if (mode == MEMCACHE_ACCESS_DELETE_ALL) { - - nRes = htable_removeall(cache->ldmemc_resTmp, (void*)cache); - } - /* Remove expired entries from primary cache. */ - else if (mode == MEMCACHE_ACCESS_UPDATE) { - - ldapmemcacheRes *pCurRes = cache->ldmemc_resTail[LIST_TTL]; - unsigned long curTime = (unsigned long)time(NULL); - - for (; pCurRes; pCurRes = cache->ldmemc_resTail[LIST_TTL]) { - - if (!memcache_expired(cache, pCurRes, curTime)) - break; - - nRes = htable_remove(cache->ldmemc_resLookup, - (void*)&(pCurRes->ldmemcr_crc_key), NULL); - assert(nRes == LDAP_SUCCESS); - memcache_free_from_list(cache, pCurRes, LIST_TTL); - memcache_free_from_list(cache, pCurRes, LIST_LRU); - memcache_free_entry(cache, pCurRes); - } - } - /* Wipe out the primary cache. */ - else if (mode == MEMCACHE_ACCESS_FLUSH_ALL) { - - ldapmemcacheRes *pCurRes = cache->ldmemc_resHead[LIST_TTL]; - - nRes = htable_removeall(cache->ldmemc_resLookup, (void*)cache); - - for (; pCurRes; pCurRes = cache->ldmemc_resHead[LIST_TTL]) { - memcache_free_from_list(cache, pCurRes, LIST_LRU); - cache->ldmemc_resHead[LIST_TTL] = - cache->ldmemc_resHead[LIST_TTL]->ldmemcr_next[LIST_TTL]; - memcache_free_entry(cache, pCurRes); - } - cache->ldmemc_resTail[LIST_TTL] = NULL; - } - /* Remove cached entries in both primary and temporary cache. */ - else if (mode == MEMCACHE_ACCESS_FLUSH) { - - int i, list_id, bDone; - int scope = (int)pData2; - char *dn = (char*)pData1; - char *dnTmp; - BerElement ber; - LDAPMessage *pMsg; - ldapmemcacheRes *pRes; - - if (cache->ldmemc_basedns) { - for (i = 0; cache->ldmemc_basedns[i]; i++) { - if ((memcache_compare_dn(cache->ldmemc_basedns[i], dn, - LDAP_SCOPE_SUBTREE) == LDAP_COMPARE_TRUE) || - (memcache_compare_dn(dn, cache->ldmemc_basedns[i], - LDAP_SCOPE_SUBTREE) == LDAP_COMPARE_TRUE)) - break; - } - if (cache->ldmemc_basedns[i] == NULL) - return( LDAP_SUCCESS ); - } - - for (i = 0; i < 2; i++) { - - list_id = (i == 0 ? LIST_TTL : LIST_TMP); - - for (pRes = cache->ldmemc_resHead[list_id]; pRes != NULL; - pRes = pRes->ldmemcr_next[list_id]) { - - if ((memcache_compare_dn(pRes->ldmemcr_basedn, dn, - LDAP_SCOPE_SUBTREE) != LDAP_COMPARE_TRUE) && - (memcache_compare_dn(dn, pRes->ldmemcr_basedn, - LDAP_SCOPE_SUBTREE) != LDAP_COMPARE_TRUE)) - continue; - - for (pMsg = pRes->ldmemcr_resHead, bDone = 0; - !bDone && pMsg; pMsg = pMsg->lm_chain) { - - if (!NSLDAPI_IS_SEARCH_ENTRY( pMsg->lm_msgtype )) - continue; - - ber = *(pMsg->lm_ber); - if (ber_scanf(&ber, "{a", &dnTmp) != LBER_ERROR) { - bDone = (memcache_compare_dn(dnTmp, dn, scope) == - LDAP_COMPARE_TRUE); - ldap_memfree(dnTmp); - } - } - - if (!bDone) - continue; - - if (list_id == LIST_TTL) { - nRes = htable_remove(cache->ldmemc_resLookup, - (void*)&(pRes->ldmemcr_crc_key), NULL); - assert(nRes == LDAP_SUCCESS); - memcache_free_from_list(cache, pRes, LIST_TTL); - memcache_free_from_list(cache, pRes, LIST_LRU); - } else { - nRes = htable_remove(cache->ldmemc_resTmp, - (void*)&(pRes->ldmemcr_req_id), NULL); - assert(nRes == LDAP_SUCCESS); - memcache_free_from_list(cache, pRes, LIST_TMP); - } - memcache_free_entry(cache, pRes); - } - } - } - /* Flush least recently used entries from cache */ - else if (mode == MEMCACHE_ACCESS_FLUSH_LRU) { - - ldapmemcacheRes *pRes = cache->ldmemc_resTail[LIST_LRU]; - - if (pRes == NULL) - return LDAP_NO_SUCH_OBJECT; - - LDAPDebug( LDAP_DEBUG_TRACE, - "memcache_access FLUSH_LRU: removing key 0x%8.8lx\n", - pRes->ldmemcr_crc_key, 0, 0 ); - nRes = htable_remove(cache->ldmemc_resLookup, - (void*)&(pRes->ldmemcr_crc_key), NULL); - assert(nRes == LDAP_SUCCESS); - memcache_free_from_list(cache, pRes, LIST_TTL); - memcache_free_from_list(cache, pRes, LIST_LRU); - memcache_free_entry(cache, pRes); - } - /* Unknown command */ - else { - nRes = LDAP_PARAM_ERROR; - } - - return nRes; -} - - -#ifdef LDAP_DEBUG -static void -memcache_report_statistics( LDAPMemCache *cache ) -{ - unsigned long hitrate; - - if ( cache->ldmemc_stats.ldmemcstat_tries == 0 ) { - hitrate = 0; - } else { - hitrate = ( 100L * cache->ldmemc_stats.ldmemcstat_hits ) / - cache->ldmemc_stats.ldmemcstat_tries; - } - LDAPDebug( LDAP_DEBUG_STATS, "memcache 0x%x:\n", cache, 0, 0 ); - LDAPDebug( LDAP_DEBUG_STATS, " tries: %ld hits: %ld hitrate: %ld%%\n", - cache->ldmemc_stats.ldmemcstat_tries, - cache->ldmemc_stats.ldmemcstat_hits, hitrate ); - if ( cache->ldmemc_size <= 0 ) { /* no size limit */ - LDAPDebug( LDAP_DEBUG_STATS, " memory bytes used: %ld\n", - cache->ldmemc_size_used, 0, 0 ); - } else { - LDAPDebug( LDAP_DEBUG_STATS, " memory bytes used: %ld free: %ld\n", - cache->ldmemc_size_used, - cache->ldmemc_size - cache->ldmemc_size_used, 0 ); - } -} -#endif /* LDAP_DEBUG */ - -/************************ Hash Table Functions *****************************/ - -/* Calculates size (# of entries) of hash table given the size limit for - the cache. */ -static int -htable_calculate_size(int sizelimit) -{ - int i, j; - int size = (int)(((double)sizelimit / - (double)(sizeof(BerElement) + EXTRA_SIZE)) / 1.5); - - /* Get a prime # */ - size = (size & 0x1 ? size : size + 1); - for (i = 3, j = size / 2; i < j; i++) { - if ((size % i) == 0) { - size += 2; - i = 3; - j = size / 2; - } - } - - return size; -} - -/* Returns the size in bytes of the given hash table. */ -static int -htable_sizeinbytes(HashTable *pTable) -{ - if (!pTable) - return 0; - - return (pTable->size * sizeof(HashTableNode)); -} - -/* Inserts an item into the hash table. */ -static int -htable_put(HashTable *pTable, void *key, void *pData) -{ - int index = pTable->hashfunc(pTable->size, key); - - if (index >= 0 && index < pTable->size) - return pTable->putdata(&(pTable->table[index].pData), key, pData); - - return( LDAP_OPERATIONS_ERROR ); -} - -/* Retrieves an item from the hash table. */ -static int -htable_get(HashTable *pTable, void *key, void **ppData) -{ - int index = pTable->hashfunc(pTable->size, key); - - *ppData = NULL; - - if (index >= 0 && index < pTable->size) - return pTable->getdata(pTable->table[index].pData, key, ppData); - - return( LDAP_OPERATIONS_ERROR ); -} - -/* Performs a miscellaneous operation on a hash table entry. */ -static int -htable_misc(HashTable *pTable, void *key, void *pData) -{ - if (pTable->miscfunc) { - int index = pTable->hashfunc(pTable->size, key); - if (index >= 0 && index < pTable->size) - return pTable->miscfunc(&(pTable->table[index].pData), key, pData); - } - - return( LDAP_OPERATIONS_ERROR ); -} - -/* Removes an item from the hash table. */ -static int -htable_remove(HashTable *pTable, void *key, void **ppData) -{ - int index = pTable->hashfunc(pTable->size, key); - - if (ppData) - *ppData = NULL; - - if (index >= 0 && index < pTable->size) - return pTable->removedata(&(pTable->table[index].pData), key, ppData); - - return( LDAP_OPERATIONS_ERROR ); -} - -/* Removes everything in the hash table. */ -static int -htable_removeall(HashTable *pTable, void *pData) -{ - int i; - - for (i = 0; i < pTable->size; i++) - pTable->clrtablenode(&(pTable->table[i].pData), pData); - - return( LDAP_SUCCESS ); -} - -/* Creates a new hash table. */ -static int -htable_create(int size_limit, HashFuncPtr hashf, - PutDataPtr putDataf, GetDataPtr getDataf, - RemoveDataPtr removeDataf, ClrTableNodePtr clrNodef, - MiscFuncPtr miscOpf, HashTable **ppTable) -{ - size_limit = htable_calculate_size(size_limit); - - if ((*ppTable = (HashTable*)NSLDAPI_CALLOC(1, sizeof(HashTable))) == NULL) - return( LDAP_NO_MEMORY ); - - (*ppTable)->table = (HashTableNode*)NSLDAPI_CALLOC(size_limit, - sizeof(HashTableNode)); - if ((*ppTable)->table == NULL) { - NSLDAPI_FREE(*ppTable); - *ppTable = NULL; - return( LDAP_NO_MEMORY ); - } - - (*ppTable)->size = size_limit; - (*ppTable)->hashfunc = hashf; - (*ppTable)->putdata = putDataf; - (*ppTable)->getdata = getDataf; - (*ppTable)->miscfunc = miscOpf; - (*ppTable)->removedata = removeDataf; - (*ppTable)->clrtablenode = clrNodef; - - return( LDAP_SUCCESS ); -} - -/* Destroys a hash table. */ -static int -htable_free(HashTable *pTable) -{ - NSLDAPI_FREE(pTable->table); - NSLDAPI_FREE(pTable); - return( LDAP_SUCCESS ); -} - -/**************** Hash table callbacks for temporary cache ****************/ - -/* Hash function */ -static int -msgid_hashf(int table_size, void *key) -{ - unsigned code = (unsigned)((ldapmemcacheReqId*)key)->ldmemcrid_ld; - return (((code << 20) + (code >> 12)) % table_size); -} - -/* Called by hash table to insert an item. */ -static int -msgid_putdata(void **ppTableData, void *key, void *pData) -{ - ldapmemcacheReqId *pReqId = (ldapmemcacheReqId*)key; - ldapmemcacheRes *pRes = (ldapmemcacheRes*)pData; - ldapmemcacheRes **ppHead = (ldapmemcacheRes**)ppTableData; - ldapmemcacheRes *pCurRes = *ppHead; - ldapmemcacheRes *pPrev = NULL; - - for (; pCurRes; pCurRes = pCurRes->ldmemcr_htable_next) { - if ((pCurRes->ldmemcr_req_id).ldmemcrid_ld == pReqId->ldmemcrid_ld) - break; - pPrev = pCurRes; - } - - if (pCurRes) { - for (; pCurRes; pCurRes = pCurRes->ldmemcr_next[LIST_TTL]) { - if ((pCurRes->ldmemcr_req_id).ldmemcrid_msgid == - pReqId->ldmemcrid_msgid) - return( LDAP_ALREADY_EXISTS ); - pPrev = pCurRes; - } - pPrev->ldmemcr_next[LIST_TTL] = pRes; - pRes->ldmemcr_prev[LIST_TTL] = pPrev; - pRes->ldmemcr_next[LIST_TTL] = NULL; - } else { - if (pPrev) - pPrev->ldmemcr_htable_next = pRes; - else - *ppHead = pRes; - pRes->ldmemcr_htable_next = NULL; - } - - return( LDAP_SUCCESS ); -} - -/* Called by hash table to retrieve an item. */ -static int -msgid_getdata(void *pTableData, void *key, void **ppData) -{ - ldapmemcacheReqId *pReqId = (ldapmemcacheReqId*)key; - ldapmemcacheRes *pCurRes = (ldapmemcacheRes*)pTableData; - - *ppData = NULL; - - for (; pCurRes; pCurRes = pCurRes->ldmemcr_htable_next) { - if ((pCurRes->ldmemcr_req_id).ldmemcrid_ld == pReqId->ldmemcrid_ld) - break; - } - - if (!pCurRes) - return( LDAP_NO_SUCH_OBJECT ); - - for (; pCurRes; pCurRes = pCurRes->ldmemcr_next[LIST_TTL]) { - if ((pCurRes->ldmemcr_req_id).ldmemcrid_msgid == - pReqId->ldmemcrid_msgid) { - *ppData = (void*)pCurRes; - return( LDAP_SUCCESS ); - } - } - - return( LDAP_NO_SUCH_OBJECT ); -} - -/* Called by hash table to remove an item. */ -static int -msgid_removedata(void **ppTableData, void *key, void **ppData) -{ - ldapmemcacheRes *pHead = *((ldapmemcacheRes**)ppTableData); - ldapmemcacheRes *pCurRes = NULL; - ldapmemcacheRes *pPrev = NULL; - ldapmemcacheReqId *pReqId = (ldapmemcacheReqId*)key; - - if (ppData) - *ppData = NULL; - - for (; pHead; pHead = pHead->ldmemcr_htable_next) { - if ((pHead->ldmemcr_req_id).ldmemcrid_ld == pReqId->ldmemcrid_ld) - break; - pPrev = pHead; - } - - if (!pHead) - return( LDAP_NO_SUCH_OBJECT ); - - for (pCurRes = pHead; pCurRes; pCurRes = pCurRes->ldmemcr_next[LIST_TTL]) { - if ((pCurRes->ldmemcr_req_id).ldmemcrid_msgid == - pReqId->ldmemcrid_msgid) - break; - } - - if (!pCurRes) - return( LDAP_NO_SUCH_OBJECT ); - - if (ppData) { - pCurRes->ldmemcr_next[LIST_TTL] = NULL; - pCurRes->ldmemcr_prev[LIST_TTL] = NULL; - pCurRes->ldmemcr_htable_next = NULL; - *ppData = (void*)pCurRes; - } - - if (pCurRes != pHead) { - if (pCurRes->ldmemcr_prev[LIST_TTL]) - pCurRes->ldmemcr_prev[LIST_TTL]->ldmemcr_next[LIST_TTL] = - pCurRes->ldmemcr_next[LIST_TTL]; - if (pCurRes->ldmemcr_next[LIST_TTL]) - pCurRes->ldmemcr_next[LIST_TTL]->ldmemcr_prev[LIST_TTL] = - pCurRes->ldmemcr_prev[LIST_TTL]; - return( LDAP_SUCCESS ); - } - - if (pPrev) { - if (pHead->ldmemcr_next[LIST_TTL]) { - pPrev->ldmemcr_htable_next = pHead->ldmemcr_next[LIST_TTL]; - pHead->ldmemcr_next[LIST_TTL]->ldmemcr_htable_next = - pHead->ldmemcr_htable_next; - } else { - pPrev->ldmemcr_htable_next = pHead->ldmemcr_htable_next; - } - } else { - if (pHead->ldmemcr_next[LIST_TTL]) { - *((ldapmemcacheRes**)ppTableData) = pHead->ldmemcr_next[LIST_TTL]; - pHead->ldmemcr_next[LIST_TTL]->ldmemcr_htable_next = - pHead->ldmemcr_htable_next; - } else { - *((ldapmemcacheRes**)ppTableData) = pHead->ldmemcr_htable_next; - } - } - - return( LDAP_SUCCESS ); -} - -/* Called by hash table to remove all cached entries associated to searches - being performed using the given ldap handle. */ -static int -msgid_clear_ld_items(void **ppTableData, void *key, void *pData) -{ - LDAPMemCache *cache = (LDAPMemCache*)pData; - ldapmemcacheRes *pHead = *((ldapmemcacheRes**)ppTableData); - ldapmemcacheRes *pPrev = NULL; - ldapmemcacheRes *pCurRes = NULL; - ldapmemcacheReqId *pReqId = (ldapmemcacheReqId*)key; - - for (; pHead; pHead = pHead->ldmemcr_htable_next) { - if ((pHead->ldmemcr_req_id).ldmemcrid_ld == pReqId->ldmemcrid_ld) - break; - pPrev = pHead; - } - - if (!pHead) - return( LDAP_NO_SUCH_OBJECT ); - - if (pPrev) - pPrev->ldmemcr_htable_next = pHead->ldmemcr_htable_next; - else - *((ldapmemcacheRes**)ppTableData) = pHead->ldmemcr_htable_next; - - for (pCurRes = pHead; pHead; pCurRes = pHead) { - pHead = pHead->ldmemcr_next[LIST_TTL]; - memcache_free_from_list(cache, pCurRes, LIST_TMP); - memcache_free_entry(cache, pCurRes); - } - - return( LDAP_SUCCESS ); -} - -/* Called by hash table for removing all items in the table. */ -static void -msgid_clearnode(void **ppTableData, void *pData) -{ - LDAPMemCache *cache = (LDAPMemCache*)pData; - ldapmemcacheRes **ppHead = (ldapmemcacheRes**)ppTableData; - ldapmemcacheRes *pSubHead = *ppHead; - ldapmemcacheRes *pCurRes = NULL; - - for (; *ppHead; pSubHead = *ppHead) { - ppHead = &((*ppHead)->ldmemcr_htable_next); - for (pCurRes = pSubHead; pSubHead; pCurRes = pSubHead) { - pSubHead = pSubHead->ldmemcr_next[LIST_TTL]; - memcache_free_from_list(cache, pCurRes, LIST_TMP); - memcache_free_entry(cache, pCurRes); - } - } -} - -/********************* Hash table for primary cache ************************/ - -/* Hash function */ -static int -attrkey_hashf(int table_size, void *key) -{ - return ((*((unsigned long*)key)) % table_size); -} - -/* Called by hash table to insert an item. */ -static int -attrkey_putdata(void **ppTableData, void *key, void *pData) -{ - unsigned long attrkey = *((unsigned long*)key); - ldapmemcacheRes **ppHead = (ldapmemcacheRes**)ppTableData; - ldapmemcacheRes *pRes = *ppHead; - - for (; pRes; pRes = pRes->ldmemcr_htable_next) { - if (pRes->ldmemcr_crc_key == attrkey) - return( LDAP_ALREADY_EXISTS ); - } - - pRes = (ldapmemcacheRes*)pData; - pRes->ldmemcr_htable_next = *ppHead; - *ppHead = pRes; - - return( LDAP_SUCCESS ); -} - -/* Called by hash table to retrieve an item. */ -static int -attrkey_getdata(void *pTableData, void *key, void **ppData) -{ - unsigned long attrkey = *((unsigned long*)key); - ldapmemcacheRes *pRes = (ldapmemcacheRes*)pTableData; - - for (; pRes; pRes = pRes->ldmemcr_htable_next) { - if (pRes->ldmemcr_crc_key == attrkey) { - *ppData = (void*)pRes; - return( LDAP_SUCCESS ); - } - } - - *ppData = NULL; - - return( LDAP_NO_SUCH_OBJECT ); -} - -/* Called by hash table to remove an item. */ -static int -attrkey_removedata(void **ppTableData, void *key, void **ppData) -{ - unsigned long attrkey = *((unsigned long*)key); - ldapmemcacheRes **ppHead = (ldapmemcacheRes**)ppTableData; - ldapmemcacheRes *pRes = *ppHead; - ldapmemcacheRes *pPrev = NULL; - - for (; pRes; pRes = pRes->ldmemcr_htable_next) { - if (pRes->ldmemcr_crc_key == attrkey) { - if (ppData) - *ppData = (void*)pRes; - if (pPrev) - pPrev->ldmemcr_htable_next = pRes->ldmemcr_htable_next; - else - *ppHead = pRes->ldmemcr_htable_next; - pRes->ldmemcr_htable_next = NULL; - return( LDAP_SUCCESS ); - } - pPrev = pRes; - } - - if (ppData) - *ppData = NULL; - - return( LDAP_NO_SUCH_OBJECT ); -} - -/* Called by hash table for removing all items in the table. */ -static void -attrkey_clearnode(void **ppTableData, void *pData) -{ - ldapmemcacheRes **ppHead = (ldapmemcacheRes**)ppTableData; - ldapmemcacheRes *pRes = *ppHead; - - (void)pData; - - for (; *ppHead; pRes = *ppHead) { - ppHead = &((*ppHead)->ldmemcr_htable_next); - pRes->ldmemcr_htable_next = NULL; - } -} - -/***************************** CRC algorithm ********************************/ - -/* From http://www.faqs.org/faqs/compression-faq/part1/section-25.html */ - -/* - * Build auxiliary table for parallel byte-at-a-time CRC-32. - */ -#define NSLDAPI_CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ - -static unsigned long crc32_table[256] = { - 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, - 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, - 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, - 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, - 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, - 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, - 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, - 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, - 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, - 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, - 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, - 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, - 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, - 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, - 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, - 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, - 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, - 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, - 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, - 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, - 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, - 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, - 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, - 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, - 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, - 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, - 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, - 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, - 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, - 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, - 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, - 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, - 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, - 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, - 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, - 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, - 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, - 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, - 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, - 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, - 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, - 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, - 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; - -/* Initialized first time "crc32()" is called. If you prefer, you can - * statically initialize it at compile time. [Another exercise.] - */ - -static unsigned long -crc32_convert(char *buf, int len) -{ - char *p; -#ifdef OSF1V4D - unsigned int crc; -#else - unsigned long crc; /* FIXME: this is not 32-bits on all platforms! */ -#endif /* OSF1V4D */ - - crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ - for (p = buf; len > 0; ++p, --len) - crc = ((crc << 8) ^ crc32_table[(crc >> 24) ^ *p]) & 0xffffffff; - - return (unsigned long) ~crc; /* transmit complement, per CRC-32 spec */ -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/message.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/message.c deleted file mode 100644 index dd2dc622832..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/message.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 "ldap-int.h" - -int -LDAP_CALL -ldap_msgid( LDAPMessage *lm ) -{ - if ( !NSLDAPI_VALID_LDAPMESSAGE_POINTER( lm )) { - return( -1 ); - } - - return( lm->lm_msgid ); -} - -int -LDAP_CALL -ldap_msgtype( LDAPMessage *lm ) -{ - if ( !NSLDAPI_VALID_LDAPMESSAGE_POINTER( lm )) { - return( -1 ); - } - - return( lm->lm_msgtype ); -} - - -LDAPMessage * -LDAP_CALL -ldap_first_message( LDAP *ld, LDAPMessage *chain ) -{ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( NULLMSG ); /* punt */ - } - - return( chain ); -} - - -LDAPMessage * -LDAP_CALL -ldap_next_message( LDAP *ld, LDAPMessage *msg ) -{ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( NULLMSG ); /* punt */ - } - - if ( msg == NULLMSG || msg->lm_chain == NULLMSG ) { - return( NULLMSG ); - } - - return( msg->lm_chain ); -} - - -int -LDAP_CALL -ldap_count_messages( LDAP *ld, LDAPMessage *chain ) -{ - int i; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); - } - - for ( i = 0; chain != NULL; chain = chain->lm_chain ) { - i++; - } - - return( i ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/modify.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/modify.c deleted file mode 100644 index 7e44a9b471b..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/modify.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * modify.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -/* - * ldap_modify - initiate an ldap modify operation. Parameters: - * - * ld LDAP descriptor - * dn DN of the object to modify - * mods List of modifications to make. This is null-terminated - * array of struct ldapmod's, specifying the modifications - * to perform. - * - * Example: - * LDAPMod *mods[] = { - * { LDAP_MOD_ADD, "cn", { "babs jensen", "babs", 0 } }, - * { LDAP_MOD_REPLACE, "sn", { "jensen", 0 } }, - * 0 - * } - * msgid = ldap_modify( ld, dn, mods ); - */ -int -LDAP_CALL -ldap_modify( LDAP *ld, const char *dn, LDAPMod **mods ) -{ - int msgid; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 ); - - if ( ldap_modify_ext( ld, dn, mods, NULL, NULL, &msgid ) - == LDAP_SUCCESS ) { - return( msgid ); - } else { - return( -1 ); /* error is in ld handle */ - } -} - -int -LDAP_CALL -ldap_modify_ext( LDAP *ld, const char *dn, LDAPMod **mods, - LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp ) -{ - BerElement *ber; - int i, rc, lderr; - - /* - * A modify request looks like this: - * ModifyRequet ::= SEQUENCE { - * object DistinguishedName, - * modifications SEQUENCE OF SEQUENCE { - * operation ENUMERATED { - * add (0), - * delete (1), - * replace (2) - * }, - * modification SEQUENCE { - * type AttributeType, - * values SET OF AttributeValue - * } - * } - * } - */ - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_modify_ext\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - if ( !NSLDAPI_VALID_LDAPMESSAGE_POINTER( msgidp )) - { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - - if ( !NSLDAPI_VALID_NONEMPTY_LDAPMOD_ARRAY( mods )) { - lderr = LDAP_PARAM_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - return( lderr ); - } - if ( dn == NULL ) { - dn = ""; - } - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - *msgidp = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - /* see if we should add to the cache */ - if ( ld->ld_cache_on && ld->ld_cache_modify != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - if ( (rc = (ld->ld_cache_modify)( ld, *msgidp, LDAP_REQ_MODIFY, - dn, mods )) != 0 ) { - *msgidp = rc; - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - return( LDAP_SUCCESS ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - } - - /* create a message to send */ - if (( lderr = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( lderr ); - } - - if ( ber_printf( ber, "{it{s{", *msgidp, LDAP_REQ_MODIFY, dn ) - == -1 ) { - lderr = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - ber_free( ber, 1 ); - return( lderr ); - } - - /* for each modification to be performed... */ - for ( i = 0; mods[i] != NULL; i++ ) { - if (( mods[i]->mod_op & LDAP_MOD_BVALUES) != 0 ) { - rc = ber_printf( ber, "{e{s[V]}}", - mods[i]->mod_op & ~LDAP_MOD_BVALUES, - mods[i]->mod_type, mods[i]->mod_bvalues ); - } else { - rc = ber_printf( ber, "{e{s[v]}}", mods[i]->mod_op, - mods[i]->mod_type, mods[i]->mod_values ); - } - - if ( rc == -1 ) { - lderr = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - ber_free( ber, 1 ); - return( lderr ); - } - } - - if ( ber_printf( ber, "}}" ) == -1 ) { - lderr = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - ber_free( ber, 1 ); - return( lderr ); - } - - if (( lderr = nsldapi_put_controls( ld, serverctrls, 1, ber )) - != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( lderr ); - } - - /* send the message */ - rc = nsldapi_send_initial_request( ld, *msgidp, LDAP_REQ_MODIFY, - (char *)dn, ber ); - *msgidp = rc; - return( rc < 0 ? LDAP_GET_LDERRNO( ld, NULL, NULL ) : LDAP_SUCCESS ); -} - -int -LDAP_CALL -ldap_modify_s( LDAP *ld, const char *dn, LDAPMod **mods ) -{ - return( ldap_modify_ext_s( ld, dn, mods, NULL, NULL )); -} - -int -LDAP_CALL -ldap_modify_ext_s( LDAP *ld, const char *dn, LDAPMod **mods, - LDAPControl **serverctrls, LDAPControl **clientctrls ) -{ - int msgid, err; - LDAPMessage *res; - - if (( err = ldap_modify_ext( ld, dn, mods, serverctrls, clientctrls, - &msgid )) != LDAP_SUCCESS ) { - return( err ); - } - - if ( ldap_result( ld, msgid, 1, (struct timeval *)NULL, &res ) == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - return( ldap_result2error( ld, res, 1 ) ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/mozock.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/mozock.c deleted file mode 100644 index 43d78c99b6e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/mozock.c +++ /dev/null @@ -1,694 +0,0 @@ -/* - * 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 -#include -#include - -// Purpose of this file is to implement an intermediate layer to our network -// services, the winsock. -// This intermediate layer will be able to function with and without a working -// winsock being present. -// The attempt to activate the winsock happens as would normally be expected, -// through the calling application's entry point to us, WSAStartup. - - -// Name of the winsock we would like to load. -// Diffs between OSs, Win32s is out in the cold if running 32 bits unless -// they also have a winsock name wsock32.dll. -#ifndef _WIN32 -#define SZWINSOCK "winsock.dll" -#else -#define SZWINSOCK "wsock32.dll" -#endif - -// Here is the enumeration for the winsock functions we have currently -// overridden (needed to run). Add more when needed. -// We use these to access proc addresses, and to hold a table of strings -// to obtain the proc addresses. -enum SockProc { - sp_WSAAsyncGetHostByName = 0, - sp_WSAAsyncSelect, - sp_WSACleanup, - sp_WSAGetLastError, - sp_WSASetLastError, - sp_WSAStartup, - sp___WSAFDIsSet, - sp_accept, - sp_bind, - sp_closesocket, - sp_connect, - sp_gethostbyname, - sp_gethostbyaddr, - sp_gethostname, - sp_getpeername, - sp_getsockname, - sp_getsockopt, - sp_getprotobyname, - sp_htonl, - sp_htons, - sp_inet_addr, - sp_ioctlsocket, - sp_listen, - sp_ntohl, - sp_ntohs, - sp_recv, - sp_select, - sp_send, - sp_setsockopt, - sp_shutdown, - sp_socket, - sp_inet_ntoa, - - sp_MaxProcs // Total count. -}; - -// Array of function names used in GetProcAddress to fill in our -// proc array when needed. -// This array must match the enumerations exactly. -char *spName[(int)sp_MaxProcs] = { - "WSAAsyncGetHostByName", - "WSAAsyncSelect", - "WSACleanup", - "WSAGetLastError", - "WSASetLastError", - "WSAStartup", - "__WSAFDIsSet", - "accept", - "bind", - "closesocket", - "connect", - "gethostbyname", - "gethostbyaddr", - "gethostname", - "getpeername", - "getsockname", - "getsockopt", - "getprotobyname", - "htonl", - "htons", - "inet_addr", - "ioctlsocket", - "listen", - "ntohl", - "ntohs", - "recv", - "select", - "send", - "setsockopt", - "shutdown", - "socket", - "inet_ntoa" -}; - -// Array of proc addresses to the winsock functions. -// These can be NULL, indicating their absence (as in the case we couldn't -// load the winsock.dll or one of the functions wasn't loaded). -// The procs assigned in must corellate with the enumerations exactly. -FARPROC spArray[(int)sp_MaxProcs]; - -// Typedef all the different types of functions that we must cast the -// procs to in order to call without the compiler barfing. -// Prefix is always sp. -// Retval is next, spelled out. -// Parameters in their order are next, spelled out. -typedef int (PASCAL FAR *sp_int_WORD_LPWSADATA)(WORD, LPWSADATA); -typedef int (PASCAL FAR *sp_int_void)(void); -typedef HANDLE (PASCAL FAR *sp_HANDLE_HWND_uint_ccharFARp_charFARp_int)(HWND, unsigned int, const char FAR *, char FAR *, int); -typedef int (PASCAL FAR *sp_int_SOCKET_HWND_uint_long)(SOCKET, HWND, unsigned int, long); -typedef void (PASCAL FAR *sp_void_int)(int); -typedef int (PASCAL FAR *sp_int_SOCKET_fdsetFARp)(SOCKET, fd_set FAR *); -typedef SOCKET(PASCAL FAR *sp_SOCKET_SOCKET_sockaddrFARp_intFARp)(SOCKET, struct sockaddr FAR *, int FAR *); -typedef int (PASCAL FAR *sp_int_SOCKET_csockaddrFARp_int)(SOCKET, const struct sockaddr FAR *, int); -typedef int (PASCAL FAR *sp_int_SOCKET)(SOCKET); -typedef struct hostent FAR *(PASCAL FAR *sp_hostentFARp_ccharFARp)(const char FAR *); -typedef struct hostent FAR *(PASCAL FAR *sp_hostentFARp_ccharFARp_int_int)(const char FAR *, int, int); -typedef int (PASCAL FAR *sp_int_charFARp_int)(char FAR *, int); -typedef int (PASCAL FAR *sp_int_SOCKET_sockaddrFARp_intFARp)(SOCKET, struct sockaddr FAR *, int FAR *); -typedef int (PASCAL FAR *sp_int_SOCKET_int_int_charFARp_intFARp)(SOCKET, int, int, char FAR *, int FAR *); -typedef u_long (PASCAL FAR *sp_ulong_ulong)(u_long); -typedef u_short (PASCAL FAR *sp_ushort_ushort)(u_short); -typedef unsigned long (PASCAL FAR *sp_ulong_ccharFARp)(const char FAR *); -typedef int (PASCAL FAR *sp_int_SOCKET_long_ulongFARp)(SOCKET, long, u_long FAR *); -typedef int (PASCAL FAR *sp_int_SOCKET_int)(SOCKET, int); -typedef int (PASCAL FAR *sp_int_SOCKET_charFARp_int_int)(SOCKET, char FAR *, int, int); -typedef int (PASCAL FAR *sp_int_int_fdsetFARp_fdsetFARp_fdsetFARp_ctimevalFARp)(int,fd_set FAR *,fd_set FAR *,fd_set FAR *,const struct timeval FAR*); -typedef int (PASCAL FAR *sp_int_SOCKET_ccharFARp_int_int)(SOCKET, const char FAR *, int, int); -typedef int (PASCAL FAR *sp_int_SOCKET_int_int_ccharFARp_int)(SOCKET, int, int, const char FAR *, int); -typedef SOCKET (PASCAL FAR *sp_SOCKET_int_int_int)(int, int, int); -typedef char FAR * (PASCAL FAR *sp_charFARp_in_addr)(struct in_addr in); -typedef struct protoent FAR * (PASCAL FAR *sp_protoentFARcchar)(const char FAR *); - -// Handle to the winsock, if loaded. -HINSTANCE hWinsock = NULL; - -#ifndef _WIN32 -// Last error code for the winsock. -int ispError = 0; -#endif - - -BOOL IsWinsockLoaded (int sp) -{ - if (hWinsock == NULL) - { - WSADATA wsaData; -#ifdef _WIN32 - static LONG sc_init = 0; - static DWORD sc_done = 0; - static CRITICAL_SECTION sc; -#endif - /* We need to wait here because another thread might be - in the routine already */ -#ifdef _WIN32 - if (0 == InterlockedExchange(&sc_init,1)) { - InitializeCriticalSection(&sc); - sc_done = 1; - } - while (0 == sc_done) Sleep(0); - EnterCriticalSection(&sc); - if (hWinsock == NULL) { -#endif - WSAStartup(0x0101, &wsaData); -#ifdef _WIN32 - } - LeaveCriticalSection(&sc); -#endif - } -// Quick macro to tell if the winsock has actually loaded for a particular -// function. -// Debug version is a little more strict to make sure you get the names right. -#ifdef DEBUG - return hWinsock != NULL && spArray[(int)(sp)] != NULL; -#else // A little faster - return hWinsock != NULL; -#endif -} - -// Here are the functions that we have taken over by not directly linking -// with the winsock import library or importing through the def file. - -/* In win16 we simulate blocking commands as follows. Prior to issuing the - * command we make the socket not-blocking (WSAAsyncSelect does that). - * We then issue the command and see if it would have blocked. If so, we - * yield the processor and go to sleep until an event occurs that unblocks - * us (WSAAsyncSelect allowed us to register what that condition is). We - * keep repeating until we do not get a would-block indication when issuing - * the command. At that time we unregister the notification condition and - * return the result of the command to the caller. - */ - -//#ifndef _WIN32 -#if 0 -#define NON_BLOCKING(command,condition,index,type) \ - type iret; \ - HWND hWndFrame = AfxGetApp()->m_pMainWnd->m_hWnd; \ - while (TRUE) { \ - if (WSAAsyncSelect(s, hWndFrame, msg_NetActivity, condition) \ - == SOCKET_ERROR) { \ - break; \ - } \ - if(IsWinsockLoaded(index)) { \ - iret=command; \ - if (!(iret==SOCKET_ERROR && WSAGetLastError()==WSAEWOULDBLOCK)) { \ - WSAAsyncSelect(s, hWndFrame, msg_NetActivity, 0); \ - return iret; \ - } \ - PR_Yield(); \ - } else { \ - break; \ - } \ - } -#else -#define NON_BLOCKING(command,condition,index,type) \ - if(IsWinsockLoaded(index)) { \ - return command; \ - } -#endif - -int PASCAL FAR WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) { - // Our default return value is failure, though we change this regardless. - int iRetval = WSAVERNOTSUPPORTED; - HINSTANCE MyHandle; - - // Before doing anything, clear out our proc array. - memset(spArray, 0, sizeof(spArray)); - - // attempt to load the real winsock. - MyHandle = LoadLibrary(SZWINSOCK); -#ifdef _WIN32 - if(MyHandle != NULL) { -#else - if(MyHandle > HINSTANCE_ERROR) { -#endif - // Winsock was loaded. - // Get the proc addresses for each needed function next. - int spTraverse; - for(spTraverse = 0; spTraverse < (int)sp_MaxProcs; spTraverse++) { - spArray[spTraverse] = GetProcAddress(MyHandle, spName[spTraverse]); - if ( NULL == spArray[spTraverse] ) - return iRetval;// Bad winsock? Bad function name? - } - - hWinsock = MyHandle; - // AllRight, attempt to make our first proxied call. - if(IsWinsockLoaded(sp_WSAStartup)) { - iRetval = ((sp_int_WORD_LPWSADATA)spArray[sp_WSAStartup])(wVersionRequested, lpWSAData); - } - - // If the return value is still an error at this point, we unload the DLL, - // so that we can act as though nothing happened and the user - // gets no network access. - if(iRetval != 0) { - // Clear out our proc array. - memset(spArray, 0, sizeof(spArray)); - - // Free up the winsock. - FreeLibrary(MyHandle); - MyHandle = NULL; - } - } -#ifndef _WIN32 - else { - // Failed to load. - // Set this to NULL so it is clear. - hWinsock = NULL; - } -#endif - - - // Check our return value, if it isn't success, then we need to fake - // our own winsock implementation. - if(iRetval != 0) { - // We always return success. - iRetval = 0; - - // Fill in the structure. - // Return the version requested as the version supported. - lpWSAData->wVersion = wVersionRequested; - lpWSAData->wHighVersion = wVersionRequested; - - // Fill in a discription. - strcpy(lpWSAData->szDescription, "Mozock DLL internal implementation."); - strcpy(lpWSAData->szSystemStatus, "Winsock running, allowing no network access."); - - // Report a nice round number for sockets and datagram sizes. - lpWSAData->iMaxSockets = 4096; - lpWSAData->iMaxUdpDg = 4096; - - // No vendor information. - lpWSAData->lpVendorInfo = NULL; - } - - return(iRetval); -} - -int PASCAL FAR WSACleanup(void) { - int iRetval = 0; - - // Handling normally or internally. - // When IsWinsockLoaded() is called and hWinsock is NULL, it winds up calling WSAStartup - // which wedges rpcrt4.dll on win95 with some winsock implementations. Bug: 81359. - if(hWinsock && IsWinsockLoaded(sp_WSACleanup)) { - // Call their cleanup routine. - // We could set the return value here, but it is meaning less. - // We always return success. - iRetval = ((sp_int_void)spArray[sp_WSACleanup])(); - //ASSERT(iRetval == 0); - iRetval = 0; - } - - // Wether or not it succeeded, we free off the library here. - // Clear out our proc table too. - memset(spArray, 0, sizeof(spArray)); - if(hWinsock != NULL) { - FreeLibrary(hWinsock); - hWinsock = NULL; - } - - return(iRetval); -} - -HANDLE PASCAL FAR WSAAsyncGetHostByName(HWND hWnd, unsigned int wMsg, const char FAR *name, char FAR *buf, int buflen) { - // Normal or shim. - if(IsWinsockLoaded(sp_WSAAsyncGetHostByName)) { - return(((sp_HANDLE_HWND_uint_ccharFARp_charFARp_int)spArray[sp_WSAAsyncGetHostByName])(hWnd, wMsg, name, buf, buflen)); - } - - // Must return error here. - // Set our last error value to be that the net is down. - WSASetLastError(WSAENETDOWN); - return(NULL); -} - -int PASCAL FAR WSAAsyncSelect(SOCKET s, HWND hWnd, unsigned int wMsg, long lEvent) { - // Normal or shim. - if(IsWinsockLoaded(sp_WSAAsyncSelect)) { - return(((sp_int_SOCKET_HWND_uint_long)spArray[sp_WSAAsyncSelect])(s, hWnd, wMsg, lEvent)); - } - - // Must return error here. - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR WSAGetLastError(void) { - // See if someone else can handle. - if(IsWinsockLoaded(sp_WSAGetLastError)) { - return(((sp_int_void)spArray[sp_WSAGetLastError])()); - } - -#ifndef _WIN32 - { - // Fake it. - int iRetval = ispError; - ispError = 0; - return(iRetval); - } -#else - // Use default OS handler. - return(GetLastError()); -#endif -} - -void PASCAL FAR WSASetLastError(int iError) { - // See if someone else can handle. - if(IsWinsockLoaded(sp_WSASetLastError)) { - ((sp_void_int)spArray[sp_WSASetLastError])(iError); - return; - } - -#ifndef _WIN32 - // Fake it. - ispError = iError; - return; -#else - // Use default OS handler. - SetLastError(iError); - return; -#endif -} - -int PASCAL FAR __WSAFDIsSet(SOCKET fd, fd_set FAR *set) { - int i; - - // See if someone else will handle. - if(IsWinsockLoaded(sp___WSAFDIsSet)) { - return(((sp_int_SOCKET_fdsetFARp)spArray[sp___WSAFDIsSet])(fd, set)); - } - - // Default implementation. - i = set->fd_count; - while (i--) { - if (set->fd_array[i] == fd) { - return 1; - } - } - return 0; -} - -SOCKET PASCAL FAR accept(SOCKET s, struct sockaddr FAR *addr, int FAR *addrlen) { - // Internally or shim - NON_BLOCKING( - (((sp_SOCKET_SOCKET_sockaddrFARp_intFARp)spArray[sp_accept])(s, addr, addrlen)), - FD_ACCEPT, sp_accept, SOCKET); - - // Fail. - WSASetLastError(WSAENETDOWN); - return(INVALID_SOCKET); -} - -int PASCAL FAR bind(SOCKET s, const struct sockaddr FAR *name, int namelen) { - // Internally or shim - if(IsWinsockLoaded(sp_bind)) { - return(((sp_int_SOCKET_csockaddrFARp_int)spArray[sp_bind])(s, name, namelen)); - } - - // Fail. - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR closesocket(SOCKET s) { - // Internally or shim. - NON_BLOCKING( - (((sp_int_SOCKET)spArray[sp_closesocket])(s)), - FD_CLOSE, sp_closesocket, int); - - // Error. - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR connect(SOCKET s, const struct sockaddr FAR *name, int namelen) { - // Internally or shim. - if(IsWinsockLoaded(sp_connect)) { - /* This could block and so it would seem that the NON_BLOCK - * macro should be used here. However it was causing a crash - * and so it was decided to allow blocking here instead - */ - return (((sp_int_SOCKET_csockaddrFARp_int)spArray[sp_connect])(s, name, namelen)); - } - - // Err. - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -struct hostent FAR * PASCAL FAR gethostbyname(const char FAR *name) { - if(IsWinsockLoaded(sp_gethostbyname)) { - return(((sp_hostentFARp_ccharFARp)spArray[sp_gethostbyname])(name)); - } - - WSASetLastError(WSAENETDOWN); - return(NULL); -} - -struct hostent FAR * PASCAL FAR gethostbyaddr(const char FAR *addr, int len, int type) { - if(IsWinsockLoaded(sp_gethostbyaddr)) { - return(((sp_hostentFARp_ccharFARp_int_int)spArray[sp_gethostbyaddr])(addr, len, type)); - } - - WSASetLastError(WSAENETDOWN); - return(NULL); -} - -int PASCAL FAR gethostname(char FAR *name, int namelen) { - if(IsWinsockLoaded(sp_gethostname)) { - return(((sp_int_charFARp_int)spArray[sp_gethostname])(name, namelen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR getpeername(SOCKET s, struct sockaddr FAR *name, int FAR *namelen) { - if(IsWinsockLoaded(sp_getpeername)) { - return(((sp_int_SOCKET_sockaddrFARp_intFARp)spArray[sp_getpeername])(s, name, namelen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR getsockname(SOCKET s, struct sockaddr FAR *name, int FAR *namelen) { - if(IsWinsockLoaded(sp_getsockname)) { - return(((sp_int_SOCKET_sockaddrFARp_intFARp)spArray[sp_getsockname])(s, name, namelen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR getsockopt(SOCKET s, int level, int optname, char FAR *optval, int FAR *optlen) { - if(IsWinsockLoaded(sp_getsockopt)) { - return(((sp_int_SOCKET_int_int_charFARp_intFARp)spArray[sp_getsockopt])(s, level, optname, optval, optlen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -struct protoent FAR * PASCAL getprotobyname(const char FAR * name) { - if(IsWinsockLoaded(sp_getprotobyname)) { - return(((sp_protoentFARcchar)spArray[sp_getprotobyname])(name)); - } - - WSASetLastError(WSAENETDOWN); - return NULL; -} - -u_long PASCAL FAR htonl(u_long hostlong) { - if(IsWinsockLoaded(sp_htonl)) { - return(((sp_ulong_ulong)spArray[sp_htonl])(hostlong)); - } - -#ifndef _WIN32 - return - (((hostlong&0xff)<<24) + ((hostlong&0xff00)<<8) + - ((hostlong&0xff0000)>>8) + ((hostlong&0xff000000)>>24)); - -#else - // Just return what was passed in. - return(hostlong); -#endif -} - -u_short PASCAL FAR htons(u_short hostshort) { - if(IsWinsockLoaded(sp_htons)) { - return(((sp_ushort_ushort)spArray[sp_htons])(hostshort)); - } - -#ifndef _WIN32 - return (((hostshort&0xff)<<8) + ((hostshort&0xff00)>>8)); - -#else - // Just return what was passed in. - return(hostshort); -#endif -} - -u_long PASCAL FAR ntohl(u_long hostlong) { - if(IsWinsockLoaded(sp_ntohl)) { - return(((sp_ulong_ulong)spArray[sp_ntohl])(hostlong)); - } - -#ifndef _WIN32 - return - (((hostlong&0xff)<<24) + ((hostlong&0xff00)<<8) + - ((hostlong&0xff0000)>>8) + ((hostlong&0xff000000)>>24)); - -#else - // Just return what was passed in. - return(hostlong); -#endif -} - -u_short PASCAL FAR ntohs(u_short hostshort) { - if(IsWinsockLoaded(sp_ntohs)) { - return(((sp_ushort_ushort)spArray[sp_ntohs])(hostshort)); - } - -#ifndef _WIN32 - return (((hostshort&0xff)<<8) + ((hostshort&0xff00)>>8)); - -#else - // Just return what was passed in. - return(hostshort); -#endif -} - -unsigned long PASCAL FAR inet_addr(const char FAR *cp) { - if(IsWinsockLoaded(sp_inet_addr)) { - return(((sp_ulong_ccharFARp)spArray[sp_inet_addr])(cp)); - } - - return(INADDR_NONE); -} - -int PASCAL FAR ioctlsocket(SOCKET s, long cmd, u_long FAR *argp) { - if(IsWinsockLoaded(sp_ioctlsocket)) { - return(((sp_int_SOCKET_long_ulongFARp)spArray[sp_ioctlsocket])(s, cmd, argp)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR listen(SOCKET s, int backlog) { - if(IsWinsockLoaded(sp_listen)) { - return(((sp_int_SOCKET_int)spArray[sp_listen])(s, backlog)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR recv(SOCKET s, char FAR *buf, int len, int flags) { - NON_BLOCKING( - (((sp_int_SOCKET_charFARp_int_int)spArray[sp_recv])(s, buf, len, flags)), - FD_READ, sp_recv, int); - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR select(int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout) { - // If there's nothing to do, stop now before we go off into dll land. - // Optimization, boyz. - if((readfds && readfds->fd_count) || (writefds && writefds->fd_count) || (exceptfds && exceptfds->fd_count)) { - if(IsWinsockLoaded(sp_select)) { - return(((sp_int_int_fdsetFARp_fdsetFARp_fdsetFARp_ctimevalFARp)spArray[sp_select])(nfds,readfds,writefds,exceptfds,timeout)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); - } - - // No need to go to the DLL, there is nothing to do. - return(0); -} - -int PASCAL FAR send(SOCKET s, const char FAR *buf, int len, int flags) { - NON_BLOCKING( - - (((sp_int_SOCKET_ccharFARp_int_int)spArray[sp_send])(s, buf, len, flags)), - FD_WRITE, sp_send, int); - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR setsockopt(SOCKET s, int level, int optname, const char FAR *optval, int optlen) { - if(IsWinsockLoaded(sp_setsockopt)) { - return(((sp_int_SOCKET_int_int_ccharFARp_int)spArray[sp_setsockopt])(s, level, optname, optval, optlen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR shutdown(SOCKET s, int how) { - if(IsWinsockLoaded(sp_shutdown)) { - return(((sp_int_SOCKET_int)spArray[sp_shutdown])(s, how)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -SOCKET PASCAL FAR socket(int af, int type, int protocol) { - if(IsWinsockLoaded(sp_socket)) { - return(((sp_SOCKET_int_int_int)spArray[sp_socket])(af, type, protocol)); - } - - WSASetLastError(WSAENETDOWN); - return(INVALID_SOCKET); -} - -char FAR * PASCAL FAR inet_ntoa(struct in_addr in) { - if(IsWinsockLoaded(sp_inet_ntoa)) { - return ((sp_charFARp_in_addr)spArray[sp_inet_ntoa])(in); - } - - WSASetLastError(WSAENETDOWN); - return NULL; -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/nsprthreadtest.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/nsprthreadtest.c deleted file mode 100644 index 208e9b2250e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/nsprthreadtest.c +++ /dev/null @@ -1,606 +0,0 @@ -/* - * 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 -#include -#include - -#define NAME "cn=Directory Manager" -#define PASSWORD "secret99" -#define BASE "dc=example,dc=com" - -static int simplebind( LDAP *ld, char *msg, int tries ); -static void search_thread( void * ); -static void modify_thread( void * ); -static void add_thread( void * ); -static void delete_thread( void * ); -static void set_ld_error(); -static int get_ld_error(); -static void set_errno(); -static int get_errno(); -static void tsd_setup(); -static void *my_mutex_alloc( void ); -static void my_mutex_free( void * ); -static int my_mutex_lock( void * ); -static int my_mutex_unlock( void * ); -static LDAPHostEnt *my_gethostbyname( const char *name, LDAPHostEnt *result, - char *buffer, int buflen, int *statusp, void *extradata ); -static LDAPHostEnt *my_gethostbyaddr( const char *addr, int length, - int type, LDAPHostEnt *result, char *buffer, int buflen, - int *statusp, void *extradata ); -static LDAPHostEnt *copyPRHostEnt2LDAPHostEnt( LDAPHostEnt *ldhp, - PRHostEnt *prhp ); - -typedef struct ldapmsgwrapper { - LDAPMessage *lmw_messagep; - struct ldapmsgwrapper *lmw_next; -} ldapmsgwrapper; - - -#define CONNECTION_ERROR( lderr ) ( (lderr) == LDAP_SERVER_DOWN || \ - (lderr) == LDAP_CONNECT_ERROR ) - - -LDAP *ld; -PRUintn tsdindex; -#ifdef LDAP_MEMCACHE -LDAPMemCache *memcache = NULL; -#define MEMCACHE_SIZE (256*1024) /* 256K bytes */ -#define MEMCACHE_TTL (15*60) /* 15 minutes */ -#endif - - -main( int argc, char **argv ) -{ - PRThread *search_tid, *search_tid2, *search_tid3; - PRThread *search_tid4, *modify_tid, *add_tid; - PRThread *delete_tid; - struct ldap_thread_fns tfns; - struct ldap_dns_fns dnsfns; - int rc; - - if ( argc != 3 ) { - fprintf( stderr, "usage: %s host port\n", argv[0] ); - exit( 1 ); - } - - PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 0 ); - if ( PR_NewThreadPrivateIndex( &tsdindex, NULL ) != PR_SUCCESS ) { - perror( "PR_NewThreadPrivateIndex" ); - exit( 1 ); - } - tsd_setup(); /* for main thread */ - - if ( (ld = ldap_init( argv[1], atoi( argv[2] ) )) == NULL ) { - perror( "ldap_open" ); - exit( 1 ); - } - - /* set thread function pointers */ - memset( &tfns, '\0', sizeof(struct ldap_thread_fns) ); - tfns.ltf_mutex_alloc = my_mutex_alloc; - tfns.ltf_mutex_free = my_mutex_free; - tfns.ltf_mutex_lock = my_mutex_lock; - tfns.ltf_mutex_unlock = my_mutex_unlock; - tfns.ltf_get_errno = get_errno; - tfns.ltf_set_errno = set_errno; - tfns.ltf_get_lderrno = get_ld_error; - tfns.ltf_set_lderrno = set_ld_error; - tfns.ltf_lderrno_arg = NULL; - if ( ldap_set_option( ld, LDAP_OPT_THREAD_FN_PTRS, (void *) &tfns ) - != 0 ) { - ldap_perror( ld, "ldap_set_option: thread functions" ); - exit( 1 ); - } - - /* set DNS function pointers */ - memset( &dnsfns, '\0', sizeof(struct ldap_dns_fns) ); - dnsfns.lddnsfn_bufsize = PR_NETDB_BUF_SIZE; - dnsfns.lddnsfn_gethostbyname = my_gethostbyname; - dnsfns.lddnsfn_gethostbyaddr = my_gethostbyaddr; - if ( ldap_set_option( ld, LDAP_OPT_DNS_FN_PTRS, (void *)&dnsfns ) - != 0 ) { - ldap_perror( ld, "ldap_set_option: DNS functions" ); - exit( 1 ); - } - -#ifdef LDAP_MEMCACHE - /* create the in-memory cache */ - if (( rc = ldap_memcache_init( MEMCACHE_TTL, MEMCACHE_SIZE, NULL, - &tfns, &memcache )) != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_memcache_init failed - %s\n", - ldap_err2string( rc )); - exit( 1 ); - } - if (( rc = ldap_memcache_set( ld, memcache )) != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_memcache_set failed - %s\n", - ldap_err2string( rc )); - exit( 1 ); - } -#endif - - /* - * set option so that the next call to ldap_simple_bind_s() after - * the server connection is lost will attempt to reconnect. - */ - if ( ldap_set_option( ld, LDAP_OPT_RECONNECT, LDAP_OPT_ON ) != 0 ) { - ldap_perror( ld, "ldap_set_option: reconnect" ); - exit( 1 ); - } - - /* initial bind */ - if ( simplebind( ld, "ldap_simple_bind_s/main", 1 ) != LDAP_SUCCESS ) { - exit( 1 ); - } - - /* create the operation threads */ - if ( (search_tid = PR_CreateThread( PR_USER_THREAD, search_thread, - "1", PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, - 0 )) == NULL ) { - perror( "PR_CreateThread search_thread" ); - exit( 1 ); - } - if ( (modify_tid = PR_CreateThread( PR_USER_THREAD, modify_thread, - "2", PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, - 0 )) == NULL ) { - perror( "PR_CreateThread modify_thread" ); - exit( 1 ); - } - if ( (search_tid2 = PR_CreateThread( PR_USER_THREAD, search_thread, - "3", PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, - 0 )) == NULL ) { - perror( "PR_CreateThread search_thread 2" ); - exit( 1 ); - } - if ( (add_tid = PR_CreateThread( PR_USER_THREAD, add_thread, - "4", PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, - 0 )) == NULL ) { - perror( "PR_CreateThread add_thread" ); - exit( 1 ); - } - if ( (search_tid3 = PR_CreateThread( PR_USER_THREAD, search_thread, - "5", PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, - 0 )) == NULL ) { - perror( "PR_CreateThread search_thread 3" ); - exit( 1 ); - } - if ( (delete_tid = PR_CreateThread( PR_USER_THREAD, delete_thread, - "6", PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, - 0 )) == NULL ) { - perror( "PR_CreateThread delete_thread" ); - exit( 1 ); - } - if ( (search_tid4 = PR_CreateThread( PR_USER_THREAD, search_thread, - "7", PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, - 0 )) == NULL ) { - perror( "PR_CreateThread search_thread 4" ); - exit( 1 ); - } - - PR_Cleanup(); - return( 0 ); -} - - -static int -simplebind( LDAP *ld, char *msg, int tries ) -{ - int rc; - - while ( tries-- > 0 ) { - rc = ldap_simple_bind_s( ld, NAME, PASSWORD ); - if ( rc != LDAP_SUCCESS ) { - ldap_perror( ld, msg ); - } - if ( tries == 0 || !CONNECTION_ERROR( rc )) { - return( rc ); - } - fprintf( stderr, - "%s: sleeping for 5 secs - will try %d more time(s)...\n", - msg, tries ); - sleep( 5 ); - } - - return( rc ); -} - - -static void -search_thread( void *arg1 ) -{ - LDAPMessage *res; - LDAPMessage *e; - char *a; - char **v; - char *dn; - BerElement *ber; - int i, rc, msgid; - void *tsd; - char *id = arg1; - - printf( "search_thread\n" ); - tsd_setup(); - for ( ;; ) { - printf( "%sSearching...\n", id ); - if ( (msgid = ldap_search( ld, BASE, LDAP_SCOPE_SUBTREE, - "(objectclass=*)", NULL, 0 )) == -1 ) { - ldap_perror( ld, "ldap_search_s" ); - rc = ldap_get_lderrno( ld, NULL, NULL ); - if ( CONNECTION_ERROR( rc ) && simplebind( ld, - "bind-search_thread", 5 ) != LDAP_SUCCESS ) { - return; - } - continue; - } - while ( (rc = ldap_result( ld, msgid, 0, NULL, &res )) - == LDAP_RES_SEARCH_ENTRY ) { - for ( e = ldap_first_entry( ld, res ); e != NULL; - e = ldap_next_entry( ld, e ) ) { - dn = ldap_get_dn( ld, e ); - /* printf( "%sdn: %s\n", id, dn ); */ - free( dn ); - for ( a = ldap_first_attribute( ld, e, &ber ); - a != NULL; a = ldap_next_attribute( ld, e, - ber ) ) { - v = ldap_get_values( ld, e, a ); - for ( i = 0; v && v[i] != 0; i++ ) { - /* - printf( "%s%s: %s\n", id, a, - v[i] ); - */ - } - ldap_value_free( v ); - ldap_memfree( a ); - } - if ( ber != NULL ) { - ber_free( ber, 0 ); - } - } - ldap_msgfree( res ); - /* printf( "%s\n", id ); */ - } - - if ( rc == -1 || ldap_result2error( ld, res, 0 ) != - LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_search" ); - } else { - printf( "%sDone with one round\n", id ); - } - - if ( rc == -1 ) { - rc = ldap_get_lderrno( ld, NULL, NULL ); - if ( CONNECTION_ERROR( rc ) && simplebind( ld, - "bind-search_thread", 5 ) != LDAP_SUCCESS ) { - return; - } - } - } -} - -static void -modify_thread( void *arg1 ) -{ - LDAPMessage *res; - LDAPMessage *e; - int i, modentry, entries, msgid, rc; - LDAPMod mod; - LDAPMod *mods[2]; - char *vals[2]; - char *dn; - char *id = arg1; - ldapmsgwrapper *list, *lmwp, *lastlmwp; - - printf( "modify_thread\n" ); - tsd_setup(); - if ( (msgid = ldap_search( ld, BASE, LDAP_SCOPE_SUBTREE, - "(objectclass=*)", NULL, 0 )) == -1 ) { - ldap_perror( ld, "ldap_search_s" ); - exit( 1 ); - } - entries = 0; - list = lastlmwp = NULL; - while ( (rc = ldap_result( ld, msgid, 0, NULL, &res )) - == LDAP_RES_SEARCH_ENTRY ) { - entries++; - if (( lmwp = (ldapmsgwrapper *) - malloc( sizeof( ldapmsgwrapper ))) == NULL ) { - perror( "modify_thread: malloc" ); - exit( 1 ); - } - lmwp->lmw_messagep = res; - lmwp->lmw_next = NULL; - if ( lastlmwp == NULL ) { - list = lastlmwp = lmwp; - } else { - lastlmwp->lmw_next = lmwp; - } - lastlmwp = lmwp; - } - if ( rc == -1 || ldap_result2error( ld, res, 0 ) != LDAP_SUCCESS ) { - ldap_perror( ld, "modify_thread: ldap_search" ); - exit( 1 ); - } else { - entries++; - printf( "%sModify got %d entries\n", id, entries ); - } - - mods[0] = &mod; - mods[1] = NULL; - vals[0] = "bar"; - vals[1] = NULL; - for ( ;; ) { - modentry = rand() % entries; - for ( i = 0, lmwp = list; lmwp != NULL && i < modentry; - i++, lmwp = lmwp->lmw_next ) { - /* NULL */ - } - - if ( lmwp == NULL ) { - fprintf( stderr, - "%sModify could not find entry %d of %d\n", - id, modentry, entries ); - continue; - } - e = lmwp->lmw_messagep; - printf( "%sPicked entry %d of %d\n", id, i, entries ); - dn = ldap_get_dn( ld, e ); - mod.mod_op = LDAP_MOD_REPLACE; - mod.mod_type = "description"; - mod.mod_values = vals; - printf( "%sModifying (%s)\n", id, dn ); - if (( rc = ldap_modify_s( ld, dn, mods )) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_modify_s" ); - if ( CONNECTION_ERROR( rc ) && simplebind( ld, - "bind-modify_thread", 5 ) != LDAP_SUCCESS ) { - return; - } - } - free( dn ); - } -} - -static void -add_thread( void *arg1 ) -{ - LDAPMod mod[5]; - LDAPMod *mods[6]; - char dn[BUFSIZ], name[40]; - char *cnvals[2], *snvals[2], *ocvals[2]; - int i, rc; - char *id = arg1; - - printf( "add_thread\n" ); - tsd_setup(); - for ( i = 0; i < 5; i++ ) { - mods[i] = &mod[i]; - } - mods[5] = NULL; - mod[0].mod_op = 0; - mod[0].mod_type = "cn"; - mod[0].mod_values = cnvals; - cnvals[1] = NULL; - mod[1].mod_op = 0; - mod[1].mod_type = "sn"; - mod[1].mod_values = snvals; - snvals[1] = NULL; - mod[2].mod_op = 0; - mod[2].mod_type = "objectclass"; - mod[2].mod_values = ocvals; - ocvals[0] = "person"; - ocvals[1] = NULL; - mods[3] = NULL; - - for ( ;; ) { - sprintf( name, "%d", rand() ); - sprintf( dn, "cn=%s, " BASE, name ); - cnvals[0] = name; - snvals[0] = name; - - printf( "%sAdding entry (%s)\n", id, dn ); - if (( rc = ldap_add_s( ld, dn, mods )) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_add_s" ); - if ( CONNECTION_ERROR( rc ) && simplebind( ld, - "bind-add_thread", 5 ) != LDAP_SUCCESS ) { - return; - } - } - } -} - -static void -delete_thread( void *arg1 ) -{ - LDAPMessage *res; - char dn[BUFSIZ], name[40]; - int entries, msgid, rc; - char *id = arg1; - - printf( "delete_thread\n" ); - tsd_setup(); - if ( (msgid = ldap_search( ld, BASE, LDAP_SCOPE_SUBTREE, - "(objectclass=*)", NULL, 0 )) == -1 ) { - ldap_perror( ld, "delete_thread: ldap_search_s" ); - exit( 1 ); - } - entries = 0; - while ( (rc = ldap_result( ld, msgid, 0, NULL, &res )) - == LDAP_RES_SEARCH_ENTRY ) { - entries++; - ldap_msgfree( res ); - } - entries++; - if ( rc == -1 || ldap_result2error( ld, res, 1 ) != LDAP_SUCCESS ) { - ldap_perror( ld, "delete_thread: ldap_search" ); - } else { - printf( "%sDelete got %d entries\n", id, entries ); - } - - for ( ;; ) { - sprintf( name, "%d", rand() ); - sprintf( dn, "cn=%s, " BASE, name ); - - printf( "%sDeleting entry (%s)\n", id, dn ); - if (( rc = ldap_delete_s( ld, dn )) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_delete_s" ); - if ( CONNECTION_ERROR( rc ) && simplebind( ld, - "bind-delete_thread", 5 ) != LDAP_SUCCESS ) { - return; - } - } - } -} - -struct ldap_error { - int le_errno; - char *le_matched; - char *le_errmsg; -}; - -static void -tsd_setup() -{ - void *tsd; - - tsd = (void *) PR_GetThreadPrivate( tsdindex ); - if ( tsd != NULL ) { - fprintf( stderr, "tsd non-null!\n" ); - exit( 1 ); - } - tsd = (void *) calloc( 1, sizeof(struct ldap_error) ); - if ( PR_SetThreadPrivate( tsdindex, tsd ) != 0 ) { - perror( "PR_SetThreadPrivate" ); - exit( 1 ); - } -} - -static void -set_ld_error( int err, char *matched, char *errmsg, void *dummy ) -{ - struct ldap_error *le; - - le = (void *) PR_GetThreadPrivate( tsdindex ); - le->le_errno = err; - if ( le->le_matched != NULL ) { - ldap_memfree( le->le_matched ); - } - le->le_matched = matched; - if ( le->le_errmsg != NULL ) { - ldap_memfree( le->le_errmsg ); - } - le->le_errmsg = errmsg; -} - -static int -get_ld_error( char **matchedp, char **errmsgp, void *dummy ) -{ - struct ldap_error *le; - - le = PR_GetThreadPrivate( tsdindex ); - if ( matchedp != NULL ) { - *matchedp = le->le_matched; - } - if ( errmsgp != NULL ) { - *errmsgp = le->le_errmsg; - } - return( le->le_errno ); -} - -static void -set_errno( int oserrno ) -{ - /* XXXmcs: should this be PR_SetError( oserrno, 0 )? */ - PR_SetError( PR_UNKNOWN_ERROR, oserrno ); -} - -static int -get_errno( void ) -{ - /* XXXmcs: should this be PR_GetError()? */ - return( PR_GetOSError()); -} - -static void * -my_mutex_alloc( void ) -{ - return( (void *)PR_NewLock()); -} - -static void -my_mutex_free( void *mutex ) -{ - PR_DestroyLock( (PRLock *)mutex ); -} - -static int -my_mutex_lock( void *mutex ) -{ - PR_Lock( (PRLock *)mutex ); - return( 0 ); -} - -static int -my_mutex_unlock( void *mutex ) -{ - if ( PR_Unlock( (PRLock *)mutex ) == PR_FAILURE ) { - return( -1 ); - } - - return( 0 ); -} - -static LDAPHostEnt * -my_gethostbyname( const char *name, LDAPHostEnt *result, - char *buffer, int buflen, int *statusp, void *extradata ) -{ - PRHostEnt prhent; - - if ( PR_GetHostByName( name, buffer, buflen, - &prhent ) != PR_SUCCESS ) { - return( NULL ); - } - - return( copyPRHostEnt2LDAPHostEnt( result, &prhent )); -} - -static LDAPHostEnt * -my_gethostbyaddr( const char *addr, int length, int type, LDAPHostEnt *result, - char *buffer, int buflen, int *statusp, void *extradata ) -{ - PRHostEnt prhent; - - if ( PR_GetHostByAddr( (PRNetAddr *)addr, buffer, buflen, - &prhent ) != PR_SUCCESS ) { - return( NULL ); - } - - return( copyPRHostEnt2LDAPHostEnt( result, &prhent )); -} - -static LDAPHostEnt * -copyPRHostEnt2LDAPHostEnt( LDAPHostEnt *ldhp, PRHostEnt *prhp ) -{ - ldhp->ldaphe_name = prhp->h_name; - ldhp->ldaphe_aliases = prhp->h_aliases; - ldhp->ldaphe_addrtype = prhp->h_addrtype; - ldhp->ldaphe_length = prhp->h_length; - ldhp->ldaphe_addr_list = prhp->h_addr_list; - return( ldhp ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/open.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/open.c deleted file mode 100644 index 934d3e235c6..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/open.c +++ /dev/null @@ -1,793 +0,0 @@ -/* - * 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) 1995 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * open.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -#define VI_PRODUCTVERSION 3 - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK ((unsigned long) 0x7f000001) -#endif - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif - -#ifdef LDAP_DEBUG -int ldap_debug; -#endif - -#ifdef _WINDOWS -#define USE_WINDOWS_TLS /* thread local storage */ -#endif - -/* - * global defaults for callbacks are stored here. callers of the API set - * these by passing a NULL "ld" to ldap_set_option(). Everything in - * nsldapi_ld_defaults can be overridden on a per-ld basis as well (the - * memory allocation functions are global to all ld's). - */ -struct ldap nsldapi_ld_defaults; -struct ldap_memalloc_fns nsldapi_memalloc_fns = { 0, 0, 0, 0 }; -int nsldapi_initialized = 0; - -#ifndef _WINDOWS -#include -static pthread_key_t nsldapi_key; - -struct nsldapi_ldap_error { - int le_errno; - char *le_matched; - char *le_errmsg; -}; -#elif defined (USE_WINDOWS_TLS) -static DWORD dwTlsIndex; -struct nsldapi_ldap_error { - int le_errno; - char *le_matched; - char *le_errmsg; -}; -#else /* use static tls */ -__declspec ( thread ) int nsldapi_gldaperrno; -__declspec ( thread ) char *nsldapi_gmatched = NULL; -__declspec ( thread ) char *nsldapi_gldaperror = NULL; -#endif /* USE_WINDOWS_TLS */ - - -#ifdef _WINDOWS -#define LDAP_MUTEX_T HANDLE - -int -pthread_mutex_init( LDAP_MUTEX_T *mp, void *attr) -{ - if ( (*mp = CreateMutex(NULL, FALSE, NULL)) == NULL ) - return( 1 ); - else - return( 0 ); -} - -static void * -pthread_mutex_alloc( void ) -{ - LDAP_MUTEX_T *mutexp; - - if ( (mutexp = malloc( sizeof(LDAP_MUTEX_T) )) != NULL ) { - pthread_mutex_init( mutexp, NULL ); - } - return( mutexp ); -} - -int -pthread_mutex_destroy( LDAP_MUTEX_T *mp ) -{ - if ( !(CloseHandle(*mp)) ) - return( 1 ); - else - return( 0 ); -} - -static void -pthread_mutex_free( void *mutexp ) -{ - pthread_mutex_destroy( (LDAP_MUTEX_T *) mutexp ); - free( mutexp ); -} - -int -pthread_mutex_lock( LDAP_MUTEX_T *mp ) -{ - if ( (WaitForSingleObject(*mp, INFINITE) != WAIT_OBJECT_0) ) - return( 1 ); - else - return( 0 ); -} - -int -pthread_mutex_unlock( LDAP_MUTEX_T *mp ) -{ - if ( !(ReleaseMutex(*mp)) ) - return( 1 ); - else - return( 0 ); -} - -static int -get_errno( void ) -{ - return errno; -} - -static void -set_errno( int Errno ) -{ - errno = Errno; -} - -#ifdef USE_WINDOWS_TLS -static void -set_ld_error( int err, char *matched, char *errmsg, void *dummy ) -{ - struct nsldapi_ldap_error *le; - void *tsd; - - le = TlsGetValue( dwTlsIndex ); - - if (le == NULL) { - tsd = (void *)calloc(1, sizeof(struct nsldapi_ldap_error)); - TlsSetValue( dwTlsIndex, tsd ); - } - - le = TlsGetValue ( dwTlsIndex ); - - if (le == NULL) - return; - - le->le_errno = err; - - if ( le->le_matched != NULL ) { - ldap_memfree( le->le_matched ); - } - le->le_matched = matched; - - if ( le->le_errmsg != NULL ) { - ldap_memfree( le->le_errmsg ); - } - le->le_errmsg = errmsg; -} - -static int -get_ld_error ( char **matched, char **errmsg, void *dummy ) -{ - struct nsldapi_ldap_error *le; - - le = TlsGetValue( dwTlsIndex ); - if ( matched != NULL ) { - *matched = le->le_matched; - } - - if ( errmsg != NULL ) { - *errmsg = le->le_errmsg; - } - - return( le->le_errno ); -} -#else -static int -get_ld_error( char **LDMatched, char **LDError, void * Args ) -{ - if ( LDMatched != NULL ) - { - *LDMatched = nsldapi_gmatched; - } - if ( LDError != NULL ) - { - *LDError = nsldapi_gldaperror; - } - return nsldapi_gldaperrno; -} - -static void -set_ld_error( int LDErrno, char * LDMatched, char * LDError, - void * Args ) -{ - /* Clean up any previous string storage. */ - if ( nsldapi_gmatched != NULL ) - { - ldap_memfree( nsldapi_gmatched ); - } - if ( nsldapi_gldaperror != NULL ) - { - ldap_memfree( nsldapi_gldaperror ); - } - - nsldapi_gldaperrno = LDErrno; - nsldapi_gmatched = LDMatched; - nsldapi_gldaperror = LDError; -} -#endif /* USE_WINDOWS_TLS */ -#else /* IF ! _WINDOWS */ -static void * -pthread_mutex_alloc( void ) -{ - pthread_mutex_t *mutexp; - - if ( (mutexp = malloc( sizeof(pthread_mutex_t) )) != NULL ) { - pthread_mutex_init( mutexp, NULL ); - } - return( mutexp ); -} - -static void -pthread_mutex_free( void *mutexp ) -{ - pthread_mutex_destroy( (pthread_mutex_t *) mutexp ); - free( mutexp ); -} - -static void -set_ld_error( int err, char *matched, char *errmsg, void *dummy ) -{ - struct nsldapi_ldap_error *le; - void *tsd; - - le = pthread_getspecific( nsldapi_key ); - - if (le == NULL) { - tsd = (void *)calloc(1, sizeof(struct nsldapi_ldap_error)); - pthread_setspecific( nsldapi_key, tsd ); - } - - le = pthread_getspecific( nsldapi_key ); - - if (le == NULL) - return; - - le->le_errno = err; - - if ( le->le_matched != NULL ) { - ldap_memfree( le->le_matched ); - } - le->le_matched = matched; - - if ( le->le_errmsg != NULL ) { - ldap_memfree( le->le_errmsg ); - } - le->le_errmsg = errmsg; -} - -static int -get_ld_error( char **matched, char **errmsg, void *dummy ) -{ - struct nsldapi_ldap_error *le; - - le = pthread_getspecific( nsldapi_key ); - if ( matched != NULL ) { - *matched = le->le_matched; - } - if ( errmsg != NULL ) { - *errmsg = le->le_errmsg; - } - return( le->le_errno ); -} - -static void -set_errno( int err ) -{ - errno = err; -} - -static int -get_errno( void ) -{ - return( errno ); -} -#endif /* ! _WINDOWS */ - -static struct ldap_thread_fns - nsldapi_default_thread_fns = { - (void *(*)(void))pthread_mutex_alloc, - (void (*)(void *))pthread_mutex_free, - (int (*)(void *))pthread_mutex_lock, - (int (*)(void *))pthread_mutex_unlock, - (int (*)(void))get_errno, - (void (*)(int))set_errno, - (int (*)(char **, char **, void *))get_ld_error, - (void (*)(int, char *, char *, void *))set_ld_error, - 0 }; - -static struct ldap_extra_thread_fns - nsldapi_default_extra_thread_fns = { - 0, 0, 0, 0, 0, -#ifdef _WINDOWS - 0 -#else - (void *(*)(void))pthread_self -#endif /* _WINDOWS */ - }; - -void -nsldapi_initialize_defaults( void ) -{ - - if ( nsldapi_initialized ) { - return; - } - -#ifndef _WINDOWS - if ( pthread_key_create(&nsldapi_key, free ) != 0) { - perror("pthread_key_create"); - } -#elif defined(USE_WINDOWS_TLS) - dwTlsIndex = TlsAlloc(); -#endif /* USE_WINDOWS_TLS */ - - nsldapi_initialized = 1; - memset( &nsldapi_memalloc_fns, 0, sizeof( nsldapi_memalloc_fns )); - memset( &nsldapi_ld_defaults, 0, sizeof( nsldapi_ld_defaults )); - nsldapi_ld_defaults.ld_options = LDAP_BITOPT_REFERRALS; - nsldapi_ld_defaults.ld_version = LDAP_VERSION2; - nsldapi_ld_defaults.ld_lberoptions = LBER_OPT_USE_DER; - nsldapi_ld_defaults.ld_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT; - -#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET ) - nsldapi_ld_defaults.ld_lberoptions |= LBER_OPT_TRANSLATE_STRINGS; -#if LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET - ldap_set_string_translators( &nsldapi_ld_defaults, ldap_8859_to_t61, - ldap_t61_to_8859 ); -#endif /* LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET */ -#endif /* STR_TRANSLATION && LDAP_DEFAULT_CHARSET */ - - /* set default connect timeout (in milliseconds) */ - /* this was picked as it is the standard tcp timeout as well */ - nsldapi_ld_defaults.ld_connect_timeout = LDAP_X_IO_TIMEOUT_NO_TIMEOUT; - - /* load up default platform specific locking routines */ - if (ldap_set_option( NULL, LDAP_OPT_THREAD_FN_PTRS, - (void *)&nsldapi_default_thread_fns) != LDAP_SUCCESS) { - return; - } - -#ifndef _WINDOWS - /* load up default threadid function */ - if (ldap_set_option( NULL, LDAP_OPT_EXTRA_THREAD_FN_PTRS, - (void *)&nsldapi_default_extra_thread_fns) != LDAP_SUCCESS) { - return; - } -#endif /* _WINDOWS */ -} - - -/* - * ldap_version - report version levels for important properties - * This function is deprecated. Use ldap_get_option( ..., LDAP_OPT_API_INFO, - * ... ) instead. - * - * Example: - * LDAPVersion ver; - * ldap_version( &ver ); - * if ( (ver.sdk_version < 100) || (ver.SSL_version < 300) ) - * fprintf( stderr, "LDAP SDK level insufficient\n" ); - * - * or: - * if ( ldap_version(NULL) < 100 ) - * fprintf( stderr, "LDAP SDK level insufficient\n" ); - * - */ - -int -LDAP_CALL -ldap_version( LDAPVersion *ver ) -{ - if ( NULL != ver ) - { - memset( ver, 0, sizeof(*ver) ); - ver->sdk_version = (int)(VI_PRODUCTVERSION * 100); - ver->protocol_version = LDAP_VERSION_MAX * 100; - ver->SSL_version = SSL_VERSION * 100; - /* - * set security to none by default - */ - - ver->security_level = LDAP_SECURITY_NONE; -#if defined(LINK_SSL) -#if defined(NS_DOMESTIC) - ver->security_level = 128; -#elif defined(NSS_EXPORT) - ver->security_level = 40; -#endif -#endif - - } - return (int)(VI_PRODUCTVERSION * 100); -} - -/* - * ldap_open - initialize and connect to an ldap server. A magic cookie to - * be used for future communication is returned on success, NULL on failure. - * "host" may be a space-separated list of hosts or IP addresses - * - * Example: - * LDAP *ld; - * ld = ldap_open( hostname, port ); - */ - -LDAP * -LDAP_CALL -ldap_open( const char *host, int port ) -{ - LDAP *ld; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 ); - - if (( ld = ldap_init( host, port )) == NULL ) { - return( NULL ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK ); - if ( nsldapi_open_ldap_defconn( ld ) < 0 ) { - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - ldap_ld_free( ld, NULL, NULL, 0 ); - return( NULL ); - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_open successful, ld_host is %s\n", - ( ld->ld_host == NULL ) ? "(null)" : ld->ld_host, 0, 0 ); - - return( ld ); -} - - -/* - * ldap_init - initialize the LDAP library. A magic cookie to be used for - * future communication is returned on success, NULL on failure. - * "defhost" may be a space-separated list of hosts or IP addresses - * - * Example: - * LDAP *ld; - * ld = ldap_init( default_hostname, default_port ); - */ -LDAP * -LDAP_CALL -ldap_init( const char *defhost, int defport ) -{ - LDAP *ld; - int i; - - if ( !nsldapi_initialized ) { - nsldapi_initialize_defaults(); - } - - if ( defport < 0 || defport > LDAP_PORT_MAX ) { - LDAPDebug( LDAP_DEBUG_ANY, - "ldap_init: port %d is invalid (port numbers must range from 1 to %d)\n", - defport, LDAP_PORT_MAX, 0 ); -#if !defined( macintosh ) && !defined( DOS ) - errno = EINVAL; -#endif - return( NULL ); - } - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_init\n", 0, 0, 0 ); - - if ( (ld = (LDAP*)NSLDAPI_MALLOC( sizeof(struct ldap) )) == NULL ) { - return( NULL ); - } - - /* copy defaults */ - SAFEMEMCPY( ld, &nsldapi_ld_defaults, sizeof( struct ldap )); - if ( nsldapi_ld_defaults.ld_io_fns_ptr != NULL ) { - if (( ld->ld_io_fns_ptr = (struct ldap_io_fns *)NSLDAPI_MALLOC( - sizeof( struct ldap_io_fns ))) == NULL ) { - NSLDAPI_FREE( (char *)ld ); - return( NULL ); - } - /* struct copy */ - *(ld->ld_io_fns_ptr) = *(nsldapi_ld_defaults.ld_io_fns_ptr); - } - - /* call the new handle I/O callback if one is defined */ - if ( ld->ld_extnewhandle_fn != NULL ) { - /* - * We always pass the session extended I/O argument to - * the new handle callback. - */ - if ( ld->ld_extnewhandle_fn( ld, ld->ld_ext_session_arg ) - != LDAP_SUCCESS ) { - NSLDAPI_FREE( (char*)ld ); - return( NULL ); - } - } - - /* allocate session-specific resources */ - if (( ld->ld_sbp = ber_sockbuf_alloc()) == NULL || - ( defhost != NULL && - ( ld->ld_defhost = nsldapi_strdup( defhost )) == NULL ) || - ((ld->ld_mutex = (void **) NSLDAPI_CALLOC( LDAP_MAX_LOCK, sizeof(void *))) == NULL )) { - if ( ld->ld_sbp != NULL ) { - ber_sockbuf_free( ld->ld_sbp ); - } - if( ld->ld_mutex != NULL ) { - NSLDAPI_FREE( ld->ld_mutex ); - } - NSLDAPI_FREE( (char*)ld ); - return( NULL ); - } - - /* install Sockbuf I/O functions if set in LDAP * */ - if ( ld->ld_extread_fn != NULL || ld->ld_extwrite_fn != NULL ) { - struct lber_x_ext_io_fns lberiofns; - - memset( &lberiofns, 0, sizeof( lberiofns )); - - lberiofns.lbextiofn_size = LBER_X_EXTIO_FNS_SIZE; - lberiofns.lbextiofn_read = ld->ld_extread_fn; - lberiofns.lbextiofn_write = ld->ld_extwrite_fn; - lberiofns.lbextiofn_writev = ld->ld_extwritev_fn; - lberiofns.lbextiofn_socket_arg = NULL; - ber_sockbuf_set_option( ld->ld_sbp, LBER_SOCKBUF_OPT_EXT_IO_FNS, - (void *)&lberiofns ); - } - - /* allocate mutexes */ - for( i=0; ild_mutex[i] = LDAP_MUTEX_ALLOC( ld ); - ld->ld_mutex_threadid[i] = (void *) -1; - ld->ld_mutex_refcnt[i] = 0; - } - - /* set default port */ - ld->ld_defport = ( defport == 0 ) ? LDAP_PORT : defport; - - return( ld ); -} - - -/* returns 0 if connection opened and -1 if an error occurs */ -int -nsldapi_open_ldap_defconn( LDAP *ld ) -{ - LDAPServer *srv; - - if (( srv = (LDAPServer *)NSLDAPI_CALLOC( 1, sizeof( LDAPServer ))) == - NULL || ( ld->ld_defhost != NULL && ( srv->lsrv_host = - nsldapi_strdup( ld->ld_defhost )) == NULL )) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - srv->lsrv_port = ld->ld_defport; - - if (( ld->ld_options & LDAP_BITOPT_SSL ) != 0 ) { - srv->lsrv_options |= LDAP_SRV_OPT_SECURE; - } - - if (( ld->ld_defconn = nsldapi_new_connection( ld, &srv, 1, 1, 0 )) - == NULL ) { - if ( ld->ld_defhost != NULL ) { - NSLDAPI_FREE( srv->lsrv_host ); - } - NSLDAPI_FREE( (char *)srv ); - return( -1 ); - } - ++ld->ld_defconn->lconn_refcnt; /* so it never gets closed/freed */ - - return( 0 ); -} - - -struct ldap_x_hostlist_status { - char *lhs_hostlist; - char *lhs_nexthost; - int lhs_defport; -}; - -/* - * Return the first host and port in hostlist (setting *hostp and *portp). - * Return value is an LDAP API error code (LDAP_SUCCESS if all goes well). - * Note that a NULL or zero-length hostlist causes the host "127.0.0.1" to - * be returned. - */ -int LDAP_CALL -ldap_x_hostlist_first( const char *hostlist, int defport, char **hostp, - int *portp, struct ldap_x_hostlist_status **statusp ) -{ - - if ( NULL == hostp || NULL == portp || NULL == statusp ) { - return( LDAP_PARAM_ERROR ); - } - - if ( NULL == hostlist || *hostlist == '\0' ) { - *hostp = nsldapi_strdup( "127.0.0.1" ); - if ( NULL == *hostp ) { - return( LDAP_NO_MEMORY ); - } - *portp = defport; - *statusp = NULL; - return( LDAP_SUCCESS ); - } - - *statusp = NSLDAPI_CALLOC( 1, sizeof( struct ldap_x_hostlist_status )); - if ( NULL == *statusp ) { - return( LDAP_NO_MEMORY ); - } - (*statusp)->lhs_hostlist = nsldapi_strdup( hostlist ); - if ( NULL == (*statusp)->lhs_hostlist ) { - return( LDAP_NO_MEMORY ); - } - (*statusp)->lhs_nexthost = (*statusp)->lhs_hostlist; - (*statusp)->lhs_defport = defport; - return( ldap_x_hostlist_next( hostp, portp, *statusp )); -} - -/* - * Return the next host and port in hostlist (setting *hostp and *portp). - * Return value is an LDAP API error code (LDAP_SUCCESS if all goes well). - * If no more hosts are available, LDAP_SUCCESS is returned but *hostp is set - * to NULL. - */ -int LDAP_CALL -ldap_x_hostlist_next( char **hostp, int *portp, - struct ldap_x_hostlist_status *status ) -{ - char *q; - int squarebrackets = 0; - - if ( NULL == hostp || NULL == portp ) { - return( LDAP_PARAM_ERROR ); - } - - if ( NULL == status || NULL == status->lhs_nexthost ) { - *hostp = NULL; - return( LDAP_SUCCESS ); - } - - /* - * skip past leading '[' if present (IPv6 addresses may be surrounded - * with square brackets, e.g., [fe80::a00:20ff:fee5:c0b4]:389 - */ - if ( status->lhs_nexthost[0] == '[' ) { - ++status->lhs_nexthost; - squarebrackets = 1; - } - - /* copy host into *hostp */ - if ( NULL != ( q = strchr( status->lhs_nexthost, ' ' ))) { - size_t len = q - status->lhs_nexthost; - *hostp = NSLDAPI_MALLOC( len + 1 ); - if ( NULL == *hostp ) { - return( LDAP_NO_MEMORY ); - } - strncpy( *hostp, status->lhs_nexthost, len ); - (*hostp)[len] = '\0'; - status->lhs_nexthost += ( len + 1 ); - } else { /* last host */ - *hostp = nsldapi_strdup( status->lhs_nexthost ); - if ( NULL == *hostp ) { - return( LDAP_NO_MEMORY ); - } - status->lhs_nexthost = NULL; - } - - /* - * Look for closing ']' and skip past it before looking for port. - */ - if ( squarebrackets && NULL != ( q = strchr( *hostp, ']' ))) { - *q++ = '\0'; - } else { - q = *hostp; - } - - /* determine and set port */ - if ( NULL != ( q = strchr( q, ':' ))) { - *q++ = '\0'; - *portp = atoi( q ); - } else { - *portp = status->lhs_defport; - } - - return( LDAP_SUCCESS ); -} - - -void LDAP_CALL -ldap_x_hostlist_statusfree( struct ldap_x_hostlist_status *status ) -{ - if ( NULL != status ) { - if ( NULL != status->lhs_hostlist ) { - NSLDAPI_FREE( status->lhs_hostlist ); - } - NSLDAPI_FREE( status ); - } -} - - - -/* - * memory allocation functions. we include these in open.c since every - * LDAP application is likely to pull the rest of the code in this file - * in anyways. - */ -void * -ldap_x_malloc( size_t size ) -{ - return( nsldapi_memalloc_fns.ldapmem_malloc == NULL ? - malloc( size ) : - nsldapi_memalloc_fns.ldapmem_malloc( size )); -} - - -void * -ldap_x_calloc( size_t nelem, size_t elsize ) -{ - return( nsldapi_memalloc_fns.ldapmem_calloc == NULL ? - calloc( nelem, elsize ) : - nsldapi_memalloc_fns.ldapmem_calloc( nelem, elsize )); -} - - -void * -ldap_x_realloc( void *ptr, size_t size ) -{ - return( nsldapi_memalloc_fns.ldapmem_realloc == NULL ? - realloc( ptr, size ) : - nsldapi_memalloc_fns.ldapmem_realloc( ptr, size )); -} - - -void -ldap_x_free( void *ptr ) -{ - if ( nsldapi_memalloc_fns.ldapmem_free == NULL ) { - free( ptr ); - } else { - nsldapi_memalloc_fns.ldapmem_free( ptr ); - } -} - - -/* if s is NULL, returns NULL */ -char * -nsldapi_strdup( const char *s ) -{ - char *p; - - if ( s == NULL || - (p = (char *)NSLDAPI_MALLOC( strlen( s ) + 1 )) == NULL ) - return( NULL ); - - strcpy( p, s ); - - return( p ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/os-ip.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/os-ip.c deleted file mode 100644 index 17c972b0b3a..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/os-ip.c +++ /dev/null @@ -1,1721 +0,0 @@ -/* - * 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) 1995 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * os-ip.c -- platform-specific TCP & UDP related code - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -/* On Solaris we currently have a problem with > 1024 socket descriptors in */ -/* the non-blocking connect code due to the select() implementation */ -/* We will temporarily get around this problem by upping the max number */ -/* of socket descriptors for select as described on the select() man page */ -/* (mhein) */ - -#ifdef SOLARIS -#define FD_SETSIZE 65536 -#endif - -#include "ldap-int.h" -#ifdef LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED -#include -#endif - -#ifdef NSLDAPI_HAVE_POLL -#include -#endif - - -#ifdef _WINDOWS -#define NSLDAPI_INVALID_OS_SOCKET( s ) ((s) == INVALID_SOCKET) -#else -#define NSLDAPI_INVALID_OS_SOCKET( s ) ((s) < 0 ) -#endif - - -#define NSLDAPI_POLL_ARRAY_GROWTH 5 /* grow arrays 5 elements at a time */ - - -/* - * Structures and union for tracking status of network sockets - */ -#ifdef NSLDAPI_HAVE_POLL -struct nsldapi_os_statusinfo { /* used with native OS poll() */ - struct pollfd *ossi_pollfds; - int ossi_pollfds_size; -}; -#else /* NSLDAPI_HAVE_POLL */ -struct nsldapi_os_statusinfo { /* used with native OS select() */ - fd_set ossi_readfds; - fd_set ossi_writefds; - fd_set ossi_use_readfds; - fd_set ossi_use_writefds; -}; -#endif /* else NSLDAPI_HAVE_POLL */ - -struct nsldapi_cb_statusinfo { /* used with ext. I/O poll() callback */ - LDAP_X_PollFD *cbsi_pollfds; - int cbsi_pollfds_size; -}; - -/* - * NSLDAPI_CB_POLL_MATCH() evaluates to non-zero (true) if the Sockbuf *sdp - * matches the LDAP_X_PollFD pollfd. - */ -#ifdef _WINDOWS -#define NSLDAPI_CB_POLL_SD_CAST (unsigned int) -#else -#define NSLDAPI_CB_POLL_SD_CAST -#endif -#define NSLDAPI_CB_POLL_MATCH( sbp, pollfd ) \ - ((sbp)->sb_sd == NSLDAPI_CB_POLL_SD_CAST ((pollfd).lpoll_fd) && \ - (sbp)->sb_ext_io_fns.lbextiofn_socket_arg == (pollfd).lpoll_socketarg) - - -struct nsldapi_iostatus_info { - int ios_type; -#define NSLDAPI_IOSTATUS_TYPE_OSNATIVE 1 /* poll() or select() */ -#define NSLDAPI_IOSTATUS_TYPE_CALLBACK 2 /* poll()-like */ - int ios_read_count; - int ios_write_count; - union { - struct nsldapi_os_statusinfo ios_osinfo; - struct nsldapi_cb_statusinfo ios_cbinfo; - } ios_status; -}; - - -#ifdef NSLDAPI_HAVE_POLL -static int nsldapi_add_to_os_pollfds( int fd, - struct nsldapi_os_statusinfo *pip, short events ); -static int nsldapi_clear_from_os_pollfds( int fd, - struct nsldapi_os_statusinfo *pip, short events ); -static int nsldapi_find_in_os_pollfds( int fd, - struct nsldapi_os_statusinfo *pip, short revents ); -#endif /* NSLDAPI_HAVE_POLL */ - -static int nsldapi_iostatus_init_nolock( LDAP *ld ); -static int nsldapi_add_to_cb_pollfds( Sockbuf *sb, - struct nsldapi_cb_statusinfo *pip, short events ); -static int nsldapi_clear_from_cb_pollfds( Sockbuf *sb, - struct nsldapi_cb_statusinfo *pip, short events ); -static int nsldapi_find_in_cb_pollfds( Sockbuf *sb, - struct nsldapi_cb_statusinfo *pip, short revents ); - - -#ifdef irix -#ifndef _PR_THREADS -/* - * XXXmcs: on IRIX NSPR's poll() and select() wrappers will crash if NSPR - * has not been initialized. We work around the problem by bypassing - * the NSPR wrapper functions and going directly to the OS' functions. - */ -#define NSLDAPI_POLL _poll -#define NSLDAPI_SELECT _select -extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout); -extern int _select(int nfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout); -#else /* _PR_THREADS */ -#define NSLDAPI_POLL poll -#define NSLDAPI_SELECT select -#endif /* else _PR_THREADS */ -#else /* irix */ -#define NSLDAPI_POLL poll -#define NSLDAPI_SELECT select -#endif /* else irix */ - - -static LBER_SOCKET nsldapi_os_socket( LDAP *ld, int secure, int domain, - int type, int protocol ); -static int nsldapi_os_ioctl( LBER_SOCKET s, int option, int *statusp ); -static int nsldapi_os_connect_with_to( LBER_SOCKET s, struct sockaddr *name, - int namelen, int msec_timeout ); - -/* - * Function typedefs used by nsldapi_try_each_host() - */ -typedef LBER_SOCKET (NSLDAPI_SOCKET_FN)( LDAP *ld, int secure, int domain, - int type, int protocol ); -typedef int (NSLDAPI_IOCTL_FN)( LBER_SOCKET s, int option, int *statusp ); -typedef int (NSLDAPI_CONNECT_WITH_TO_FN )( LBER_SOCKET s, struct sockaddr *name, - int namelen, int msec_timeout ); -typedef int (NSLDAPI_CONNECT_FN )( LBER_SOCKET s, struct sockaddr *name, - int namelen ); -typedef int (NSLDAPI_CLOSE_FN )( LBER_SOCKET s ); - -static int nsldapi_try_each_host( LDAP *ld, const char *hostlist, int defport, - int secure, NSLDAPI_SOCKET_FN *socketfn, NSLDAPI_IOCTL_FN *ioctlfn, - NSLDAPI_CONNECT_WITH_TO_FN *connectwithtofn, - NSLDAPI_CONNECT_FN *connectfn, NSLDAPI_CLOSE_FN *closefn ); - - -static int -nsldapi_os_closesocket( LBER_SOCKET s ) -{ - int rc; - -#ifdef _WINDOWS - rc = closesocket( s ); -#else - rc = close( s ); -#endif - return( rc ); -} - - -static LBER_SOCKET -nsldapi_os_socket( LDAP *ld, int secure, int domain, int type, int protocol ) -{ - int s, invalid_socket; - char *errmsg = NULL; - - if ( secure ) { - LDAP_SET_LDERRNO( ld, LDAP_LOCAL_ERROR, NULL, - nsldapi_strdup( "secure mode not supported" )); - return( -1 ); - } - - s = socket( domain, type, protocol ); - - /* - * if the socket() call failed or it returned a socket larger - * than we can deal with, return a "local error." - */ - if ( NSLDAPI_INVALID_OS_SOCKET( s )) { - errmsg = "unable to create a socket"; - invalid_socket = 1; - } else { /* valid socket -- check for overflow */ - invalid_socket = 0; -#if !defined(NSLDAPI_HAVE_POLL) && !defined(_WINDOWS) - /* not on Windows and do not have poll() */ - if ( s >= FD_SETSIZE ) { - errmsg = "can't use socket >= FD_SETSIZE"; - } -#endif - } - - if ( errmsg != NULL ) { /* local socket error */ - if ( !invalid_socket ) { - nsldapi_os_closesocket( s ); - } - errmsg = nsldapi_strdup( errmsg ); - LDAP_SET_LDERRNO( ld, LDAP_LOCAL_ERROR, NULL, errmsg ); - return( -1 ); - } - - return( s ); -} - - - -/* - * Non-blocking connect call function - */ -static int -nsldapi_os_connect_with_to(LBER_SOCKET sockfd, struct sockaddr *saptr, - int salen, int msec) -{ -#ifndef _WINDOWS - int flags; -#endif /* _WINDOWS */ - int n, error; - int len; - fd_set rset, wset; - struct timeval tval; -#ifdef _WINDOWS - int nonblock = 1; - int block = 0; - fd_set eset; -#endif /* _WINDOWS */ - - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_connect_nonblock timeout: %d (msec)\n", - msec, 0, 0); - -#ifdef _WINDOWS - ioctlsocket(sockfd, FIONBIO, &nonblock); -#else - flags = fcntl(sockfd, F_GETFL, 0); - fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); -#endif /* _WINDOWS */ - - error = 0; - if ((n = connect(sockfd, saptr, salen)) < 0) -#ifdef _WINDOWS - if ((n != SOCKET_ERROR) && (WSAGetLastError() != WSAEWOULDBLOCK)) { -#else - if (errno != EINPROGRESS) { -#endif /* _WINDOWS */ -#ifdef LDAP_DEBUG - if ( ldap_debug & LDAP_DEBUG_TRACE ) { - perror("connect"); - } -#endif - return (-1); - } - - /* success */ - if (n == 0) - goto done; - - FD_ZERO(&rset); - FD_SET(sockfd, &rset); - wset = rset; - -#ifdef _WINDOWS - eset = rset; -#endif /* _WINDOWS */ - - if (msec < 0 && msec != LDAP_X_IO_TIMEOUT_NO_TIMEOUT) { - LDAPDebug( LDAP_DEBUG_TRACE, "Invalid timeout value detected.." - "resetting connect timeout to default value " - "(LDAP_X_IO_TIMEOUT_NO_TIMEOUT\n", 0, 0, 0); - msec = LDAP_X_IO_TIMEOUT_NO_TIMEOUT; - } else { - if (msec != 0) - tval.tv_sec = msec / 1000; - else - tval.tv_sec = 0; - tval.tv_usec = 0; - } - - /* if timeval structure == NULL, select will block indefinitely */ - /* != NULL, and value == 0, select will */ - /* not block */ - /* Windows is a bit quirky on how it behaves w.r.t nonblocking */ - /* connects. If the connect fails, the exception fd, eset, is */ - /* set to show the failure. The first argument in select is */ - /* ignored */ - -#ifdef _WINDOWS - if ((n = select(sockfd +1, &rset, &wset, &eset, - (msec != LDAP_X_IO_TIMEOUT_NO_TIMEOUT) ? &tval : NULL)) == 0) { - errno = WSAETIMEDOUT; - return (-1); - } - /* if wset is set, the connect worked */ - if (FD_ISSET(sockfd, &wset) || FD_ISSET(sockfd, &rset)) { - len = sizeof(error); - if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char *)&error, &len) - < 0) - return (-1); - goto done; - } - - /* if eset is set, the connect failed */ - if (FD_ISSET(sockfd, &eset)) { - return (-1); - } - - /* failure on select call */ - if (n == SOCKET_ERROR) { - perror("select error: SOCKET_ERROR returned"); - return (-1); - } -#else - if ((n = select(sockfd +1, &rset, &wset, NULL, - (msec != LDAP_X_IO_TIMEOUT_NO_TIMEOUT) ? &tval : NULL)) == 0) { - errno = ETIMEDOUT; - return (-1); - } - if (FD_ISSET(sockfd, &rset) || FD_ISSET(sockfd, &wset)) { - len = sizeof(error); - if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char *)&error, &len) - < 0) - return (-1); -#ifdef LDAP_DEBUG - } else if ( ldap_debug & LDAP_DEBUG_TRACE ) { - perror("select error: sockfd not set"); -#endif - } -#endif /* _WINDOWS */ - -done: -#ifdef _WINDOWS - ioctlsocket(sockfd, FIONBIO, &block); -#else - fcntl(sockfd, F_SETFL, flags); -#endif /* _WINDOWS */ - - if (error) { - errno = error; - return (-1); - } - - return (0); -} - - -static int -nsldapi_os_ioctl( LBER_SOCKET s, int option, int *statusp ) -{ - int err; -#ifdef _WINDOWS - u_long iostatus; -#endif - - if ( FIONBIO != option ) { - return( -1 ); - } - -#ifdef _WINDOWS - iostatus = *(u_long *)statusp; - err = ioctlsocket( s, FIONBIO, &iostatus ); -#else - err = ioctl( s, FIONBIO, (caddr_t)statusp ); -#endif - - return( err ); -} - - -int -nsldapi_connect_to_host( LDAP *ld, Sockbuf *sb, const char *hostlist, - int defport, int secure, char **krbinstancep ) -/* - * "defport" must be in host byte order - * zero is returned upon success, -1 if fatal error, -2 EINPROGRESS - * if -1 is returned, ld_errno is set - */ -{ - int s; - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_connect_to_host: %s, port: %d\n", - NULL == hostlist ? "NULL" : hostlist, defport, 0 ); - - /* - * If an extended I/O connect callback has been defined, just use it. - */ - if ( NULL != ld->ld_extconnect_fn ) { - unsigned long connect_opts = 0; - - if ( ld->ld_options & LDAP_BITOPT_ASYNC) { - connect_opts |= LDAP_X_EXTIOF_OPT_NONBLOCKING; - } - if ( secure ) { - connect_opts |= LDAP_X_EXTIOF_OPT_SECURE; - } - s = ld->ld_extconnect_fn( hostlist, defport, - ld->ld_connect_timeout, connect_opts, - ld->ld_ext_session_arg, - &sb->sb_ext_io_fns.lbextiofn_socket_arg ); - - } else { - s = nsldapi_try_each_host( ld, hostlist, - defport, secure, nsldapi_os_socket, - nsldapi_os_ioctl, nsldapi_os_connect_with_to, - NULL, nsldapi_os_closesocket ); - } - - if ( s < 0 ) { - LDAP_SET_LDERRNO( ld, LDAP_CONNECT_ERROR, NULL, NULL ); - return( -1 ); - } - - sb->sb_sd = s; - - /* - * Set krbinstancep (canonical name of host for use by Kerberos). - */ -#ifdef KERBEROS - char *p; - - if (( *krbinstancep = nsldapi_host_connected_to( sb )) != NULL - && ( p = strchr( *krbinstancep, '.' )) != NULL ) { - *p = '\0'; - } -#else /* KERBEROS */ - *krbinstancep = NULL; -#endif /* KERBEROS */ - - return( 0 ); -} - - -/* - * Returns a socket number if successful and -1 if an error occurs. - */ -static int -nsldapi_try_each_host( LDAP *ld, const char *hostlist, - int defport, int secure, NSLDAPI_SOCKET_FN *socketfn, - NSLDAPI_IOCTL_FN *ioctlfn, NSLDAPI_CONNECT_WITH_TO_FN *connectwithtofn, - NSLDAPI_CONNECT_FN *connectfn, NSLDAPI_CLOSE_FN *closefn ) -{ - int rc, i, s, err, connected, use_hp; - int parse_err, port; - struct sockaddr_in sin; - nsldapi_in_addr_t address; - char **addrlist, *ldhpbuf, *ldhpbuf_allocd; - char *host; - LDAPHostEnt ldhent, *ldhp; - struct hostent *hp; - struct ldap_x_hostlist_status *status; -#ifdef GETHOSTBYNAME_BUF_T - GETHOSTBYNAME_BUF_T hbuf; - struct hostent hent; -#endif /* GETHOSTBYNAME_BUF_T */ - - connected = 0; - parse_err = ldap_x_hostlist_first( hostlist, defport, &host, &port, - &status ); - while ( !connected && LDAP_SUCCESS == parse_err && host != NULL ) { - ldhpbuf_allocd = NULL; - ldhp = NULL; - hp = NULL; - s = 0; - use_hp = 0; - addrlist = NULL; - - - if (( address = inet_addr( host )) == -1 ) { - if ( ld->ld_dns_gethostbyname_fn == NULL ) { - if (( hp = GETHOSTBYNAME( host, &hent, hbuf, - sizeof(hbuf), &err )) != NULL ) { - addrlist = hp->h_addr_list; - } - } else { - /* - * DNS callback installed... use it. - */ -#ifdef GETHOSTBYNAME_buf_t - /* avoid allocation by using hbuf if large enough */ - if ( sizeof( hbuf ) < ld->ld_dns_bufsize ) { - ldhpbuf = ldhpbuf_allocd - = NSLDAPI_MALLOC( ld->ld_dns_bufsize ); - } else { - ldhpbuf = (char *)hbuf; - } -#else /* GETHOSTBYNAME_buf_t */ - ldhpbuf = ldhpbuf_allocd = NSLDAPI_MALLOC( - ld->ld_dns_bufsize ); -#endif /* else GETHOSTBYNAME_buf_t */ - - if ( ldhpbuf == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, - NULL, NULL ); - ldap_memfree( host ); - ldap_x_hostlist_statusfree( status ); - return( -1 ); - } - - if (( ldhp = ld->ld_dns_gethostbyname_fn( host, - &ldhent, ldhpbuf, ld->ld_dns_bufsize, &err, - ld->ld_dns_extradata )) != NULL ) { - addrlist = ldhp->ldaphe_addr_list; - } - } - - if ( addrlist == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_CONNECT_ERROR, NULL, NULL ); - LDAP_SET_ERRNO( ld, EHOSTUNREACH ); /* close enough */ - if ( ldhpbuf_allocd != NULL ) { - NSLDAPI_FREE( ldhpbuf_allocd ); - } - ldap_memfree( host ); - ldap_x_hostlist_statusfree( status ); - return( -1 ); - } - use_hp = 1; - } - - rc = -1; - for ( i = 0; !use_hp || ( addrlist[ i ] != 0 ); i++ ) { - if ( -1 == ( s = (*socketfn)( ld, secure, AF_INET, - SOCK_STREAM, 0 ))) { - if ( ldhpbuf_allocd != NULL ) { - NSLDAPI_FREE( ldhpbuf_allocd ); - } - ldap_memfree( host ); - ldap_x_hostlist_statusfree( status ); - return( -1 ); - } - - if ( ld->ld_options & LDAP_BITOPT_ASYNC ) { - int iostatus = 1; - - err = (*ioctlfn)( s, FIONBIO, &iostatus ); - if ( err == -1 ) { - LDAPDebug( LDAP_DEBUG_ANY, - "FIONBIO ioctl failed on %d\n", - s, 0, 0 ); - } - } - - (void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in )); - sin.sin_family = AF_INET; - sin.sin_port = htons( (unsigned short)port ); - - SAFEMEMCPY( (char *) &sin.sin_addr.s_addr, - ( use_hp ? (char *) addrlist[ i ] : - (char *) &address ), sizeof( sin.sin_addr.s_addr) ); - - { -#ifdef LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED -/* - * Block all of the signals that might interrupt connect() since there - * is an OS bug that causes connect() to fail if it is restarted. Look in - * ns/netsite/ldap/include/portable.h for the definition of - * LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED - */ - sigset_t ints_off, oldset; - - sigemptyset( &ints_off ); - sigaddset( &ints_off, SIGALRM ); - sigaddset( &ints_off, SIGIO ); - sigaddset( &ints_off, SIGCLD ); - - sigprocmask( SIG_BLOCK, &ints_off, &oldset ); -#endif /* LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED */ - - if ( NULL != connectwithtofn ) { - err = (*connectwithtofn)(s, - (struct sockaddr *)&sin, - sizeof(struct sockaddr_in), - ld->ld_connect_timeout); - } else { - err = (*connectfn)(s, - (struct sockaddr *)&sin, - sizeof(struct sockaddr_in)); - } -#ifdef LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED -/* - * restore original signal mask - */ - sigprocmask( SIG_SETMASK, &oldset, 0 ); -#endif /* LDAP_CONNECT_MUST_NOT_BE_INTERRUPTED */ - - } - if ( err >= 0 ) { - connected = 1; - rc = 0; - break; - } else { - if ( ld->ld_options & LDAP_BITOPT_ASYNC) { -#ifdef _WINDOWS - if (err == -1 && WSAGetLastError() == WSAEWOULDBLOCK) - LDAP_SET_ERRNO( ld, EWOULDBLOCK ); -#endif /* _WINDOWS */ - err = LDAP_GET_ERRNO( ld ); - if ( NSLDAPI_ERRNO_IO_INPROGRESS( err )) { - LDAPDebug( LDAP_DEBUG_TRACE, "connect would block...\n", - 0, 0, 0 ); - rc = -2; - break; - } - } - -#ifdef LDAP_DEBUG - if ( ldap_debug & LDAP_DEBUG_TRACE ) { - perror( (char *)inet_ntoa( sin.sin_addr )); - } -#endif - (*closefn)( s ); - if ( !use_hp ) { - break; - } - } - } - - ldap_memfree( host ); - parse_err = ldap_x_hostlist_next( &host, &port, status ); - } - - if ( ldhpbuf_allocd != NULL ) { - NSLDAPI_FREE( ldhpbuf_allocd ); - } - ldap_memfree( host ); - ldap_x_hostlist_statusfree( status ); - - if ( connected ) { - LDAPDebug( LDAP_DEBUG_TRACE, "sd %d connected to: %s\n", - s, inet_ntoa( sin.sin_addr ), 0 ); - } - - return( rc == 0 ? s : -1 ); -} - - -void -nsldapi_close_connection( LDAP *ld, Sockbuf *sb ) -{ - if ( ld->ld_extclose_fn == NULL ) { - nsldapi_os_closesocket( sb->sb_sd ); - } else { - ld->ld_extclose_fn( sb->sb_sd, - sb->sb_ext_io_fns.lbextiofn_socket_arg ); - } -} - - -#ifdef KERBEROS -char * -nsldapi_host_connected_to( Sockbuf *sb ) -{ - struct hostent *hp; - char *p; - int len; - struct sockaddr_in sin; - - (void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in )); - len = sizeof( sin ); - if ( getpeername( sb->sb_sd, (struct sockaddr *)&sin, &len ) == -1 ) { - return( NULL ); - } - - /* - * do a reverse lookup on the addr to get the official hostname. - * this is necessary for kerberos to work right, since the official - * hostname is used as the kerberos instance. - */ -#error XXXmcs: need to use DNS callbacks here - if (( hp = gethostbyaddr( (char *) &sin.sin_addr, - sizeof( sin.sin_addr ), AF_INET )) != NULL ) { - if ( hp->h_name != NULL ) { - return( nsldapi_strdup( hp->h_name )); - } - } - - return( NULL ); -} -#endif /* KERBEROS */ - - -/* - * Returns 0 if all goes well and -1 if an error occurs (error code set in ld) - * Also allocates initializes ld->ld_iostatus if needed.. - */ -int -nsldapi_iostatus_interest_write( LDAP *ld, Sockbuf *sb ) -{ - NSLDAPIIOStatus *iosp; - - LDAP_MUTEX_LOCK( ld, LDAP_IOSTATUS_LOCK ); - - if ( ld->ld_iostatus == NULL - && nsldapi_iostatus_init_nolock( ld ) < 0 ) { - LDAP_MUTEX_UNLOCK( ld, LDAP_IOSTATUS_LOCK ); - return( -1 ); - } - - iosp = ld->ld_iostatus; - - if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_OSNATIVE ) { -#ifdef NSLDAPI_HAVE_POLL - if ( nsldapi_add_to_os_pollfds( sb->sb_sd, - &iosp->ios_status.ios_osinfo, POLLOUT )) { - ++iosp->ios_write_count; - } -#else /* NSLDAPI_HAVE_POLL */ - if ( !FD_ISSET( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_writefds )) { - FD_SET( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_writefds ); - ++iosp->ios_write_count; - } -#endif /* else NSLDAPI_HAVE_POLL */ - - } else if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_CALLBACK ) { - if ( nsldapi_add_to_cb_pollfds( sb, - &iosp->ios_status.ios_cbinfo, LDAP_X_POLLOUT )) { - ++iosp->ios_write_count; - } - - } else { - LDAPDebug( LDAP_DEBUG_ANY, - "nsldapi_iostatus_interest_write: unknown I/O type %d\n", - iosp->ios_type, 0, 0 ); - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_IOSTATUS_LOCK ); - - return( 0 ); -} - - -/* - * Returns 0 if all goes well and -1 if an error occurs (error code set in ld) - * Also allocates initializes ld->ld_iostatus if needed.. - */ -int -nsldapi_iostatus_interest_read( LDAP *ld, Sockbuf *sb ) -{ - NSLDAPIIOStatus *iosp; - - LDAP_MUTEX_LOCK( ld, LDAP_IOSTATUS_LOCK ); - - if ( ld->ld_iostatus == NULL - && nsldapi_iostatus_init_nolock( ld ) < 0 ) { - LDAP_MUTEX_UNLOCK( ld, LDAP_IOSTATUS_LOCK ); - return( -1 ); - } - - iosp = ld->ld_iostatus; - - if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_OSNATIVE ) { -#ifdef NSLDAPI_HAVE_POLL - if ( nsldapi_add_to_os_pollfds( sb->sb_sd, - &iosp->ios_status.ios_osinfo, POLLIN )) { - ++iosp->ios_read_count; - } -#else /* NSLDAPI_HAVE_POLL */ - if ( !FD_ISSET( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_readfds )) { - FD_SET( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_readfds ); - ++iosp->ios_read_count; - } -#endif /* else NSLDAPI_HAVE_POLL */ - - } else if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_CALLBACK ) { - if ( nsldapi_add_to_cb_pollfds( sb, - &iosp->ios_status.ios_cbinfo, LDAP_X_POLLIN )) { - ++iosp->ios_read_count; - } - } else { - LDAPDebug( LDAP_DEBUG_ANY, - "nsldapi_iostatus_interest_read: unknown I/O type %d\n", - iosp->ios_type, 0, 0 ); - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_IOSTATUS_LOCK ); - - return( 0 ); -} - - -/* - * Returns 0 if all goes well and -1 if an error occurs (error code set in ld) - * Also allocates initializes ld->ld_iostatus if needed.. - */ -int -nsldapi_iostatus_interest_clear( LDAP *ld, Sockbuf *sb ) -{ - NSLDAPIIOStatus *iosp; - - LDAP_MUTEX_LOCK( ld, LDAP_IOSTATUS_LOCK ); - - if ( ld->ld_iostatus == NULL - && nsldapi_iostatus_init_nolock( ld ) < 0 ) { - LDAP_MUTEX_UNLOCK( ld, LDAP_IOSTATUS_LOCK ); - return( -1 ); - } - - iosp = ld->ld_iostatus; - - if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_OSNATIVE ) { -#ifdef NSLDAPI_HAVE_POLL - if ( nsldapi_clear_from_os_pollfds( sb->sb_sd, - &iosp->ios_status.ios_osinfo, POLLOUT )) { - --iosp->ios_write_count; - } - if ( nsldapi_clear_from_os_pollfds( sb->sb_sd, - &iosp->ios_status.ios_osinfo, POLLIN )) { - --iosp->ios_read_count; - } -#else /* NSLDAPI_HAVE_POLL */ - if ( FD_ISSET( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_writefds )) { - FD_CLR( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_writefds ); - --iosp->ios_write_count; - } - if ( FD_ISSET( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_readfds )) { - FD_CLR( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_readfds ); - --iosp->ios_read_count; - } -#endif /* else NSLDAPI_HAVE_POLL */ - - } else if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_CALLBACK ) { - if ( nsldapi_clear_from_cb_pollfds( sb, - &iosp->ios_status.ios_cbinfo, LDAP_X_POLLOUT )) { - --iosp->ios_write_count; - } - if ( nsldapi_clear_from_cb_pollfds( sb, - &iosp->ios_status.ios_cbinfo, LDAP_X_POLLIN )) { - --iosp->ios_read_count; - } - } else { - LDAPDebug( LDAP_DEBUG_ANY, - "nsldapi_iostatus_interest_clear: unknown I/O type %d\n", - iosp->ios_type, 0, 0 ); - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_IOSTATUS_LOCK ); - - return( 0 ); -} - - -/* - * Return a non-zero value if sb is ready for write. - */ -int -nsldapi_iostatus_is_write_ready( LDAP *ld, Sockbuf *sb ) -{ - int rc; - NSLDAPIIOStatus *iosp; - - LDAP_MUTEX_LOCK( ld, LDAP_IOSTATUS_LOCK ); - iosp = ld->ld_iostatus; - - if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_OSNATIVE ) { -#ifdef NSLDAPI_HAVE_POLL - /* - * if we are using poll() we do something a little tricky: if - * any bits in the socket's returned events field other than - * POLLIN (ready for read) are set, we return true. This - * is done so we notice when a server closes a connection - * or when another error occurs. The actual error will be - * noticed later when we call write() or send(). - */ - rc = nsldapi_find_in_os_pollfds( sb->sb_sd, - &iosp->ios_status.ios_osinfo, ~POLLIN ); - -#else /* NSLDAPI_HAVE_POLL */ - rc = FD_ISSET( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_use_writefds ); -#endif /* else NSLDAPI_HAVE_POLL */ - - } else if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_CALLBACK ) { - rc = nsldapi_find_in_cb_pollfds( sb, - &iosp->ios_status.ios_cbinfo, ~LDAP_X_POLLIN ); - - } else { - LDAPDebug( LDAP_DEBUG_ANY, - "nsldapi_iostatus_is_write_ready: unknown I/O type %d\n", - iosp->ios_type, 0, 0 ); - rc = 0; - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_IOSTATUS_LOCK ); - return( rc ); -} - - -/* - * Return a non-zero value if sb is ready for read. - */ -int -nsldapi_iostatus_is_read_ready( LDAP *ld, Sockbuf *sb ) -{ - int rc; - NSLDAPIIOStatus *iosp; - - LDAP_MUTEX_LOCK( ld, LDAP_IOSTATUS_LOCK ); - iosp = ld->ld_iostatus; - - if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_OSNATIVE ) { -#ifdef NSLDAPI_HAVE_POLL - /* - * if we are using poll() we do something a little tricky: if - * any bits in the socket's returned events field other than - * POLLOUT (ready for write) are set, we return true. This - * is done so we notice when a server closes a connection - * or when another error occurs. The actual error will be - * noticed later when we call read() or recv(). - */ - rc = nsldapi_find_in_os_pollfds( sb->sb_sd, - &iosp->ios_status.ios_osinfo, ~POLLOUT ); - -#else /* NSLDAPI_HAVE_POLL */ - rc = FD_ISSET( sb->sb_sd, - &iosp->ios_status.ios_osinfo.ossi_use_readfds ); -#endif /* else NSLDAPI_HAVE_POLL */ - - } else if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_CALLBACK ) { - rc = nsldapi_find_in_cb_pollfds( sb, - &iosp->ios_status.ios_cbinfo, ~LDAP_X_POLLOUT ); - - } else { - LDAPDebug( LDAP_DEBUG_ANY, - "nsldapi_iostatus_is_read_ready: unknown I/O type %d\n", - iosp->ios_type, 0, 0 ); - rc = 0; - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_IOSTATUS_LOCK ); - return( rc ); -} - - -/* - * Allocated and initialize ld->ld_iostatus if not already done. - * Should be called with LDAP_IOSTATUS_LOCK locked. - * Returns 0 if all goes well and -1 if not (sets error in ld) - */ -static int -nsldapi_iostatus_init_nolock( LDAP *ld ) -{ - NSLDAPIIOStatus *iosp; - - if ( ld->ld_iostatus != NULL ) { - return( 0 ); - } - - if (( iosp = (NSLDAPIIOStatus *)NSLDAPI_CALLOC( 1, - sizeof( NSLDAPIIOStatus ))) == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - - if ( ld->ld_extpoll_fn == NULL ) { - iosp->ios_type = NSLDAPI_IOSTATUS_TYPE_OSNATIVE; -#ifndef NSLDAPI_HAVE_POLL - FD_ZERO( &iosp->ios_status.ios_osinfo.ossi_readfds ); - FD_ZERO( &iosp->ios_status.ios_osinfo.ossi_writefds ); -#endif /* !NSLDAPI_HAVE_POLL */ - - } else { - iosp->ios_type = NSLDAPI_IOSTATUS_TYPE_CALLBACK; - } - - ld->ld_iostatus = iosp; - return( 0 ); -} - - -void -nsldapi_iostatus_free( LDAP *ld ) -{ - if ( ld == NULL ) { - return; - } - - - /* clean up classic I/O compatibility glue */ - if ( ld->ld_io_fns_ptr != NULL ) { - if ( ld->ld_ext_session_arg != NULL ) { - NSLDAPI_FREE( ld->ld_ext_session_arg ); - } - NSLDAPI_FREE( ld->ld_io_fns_ptr ); - } - - /* clean up I/O status tracking info. */ - if ( ld->ld_iostatus != NULL ) { - NSLDAPIIOStatus *iosp = ld->ld_iostatus; - - if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_OSNATIVE ) { -#ifdef NSLDAPI_HAVE_POLL - if ( iosp->ios_status.ios_osinfo.ossi_pollfds - != NULL ) { - NSLDAPI_FREE( - iosp->ios_status.ios_osinfo.ossi_pollfds ); - } -#endif /* NSLDAPI_HAVE_POLL */ - - } else if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_CALLBACK ) { - if ( iosp->ios_status.ios_cbinfo.cbsi_pollfds - != NULL ) { - NSLDAPI_FREE( - iosp->ios_status.ios_cbinfo.cbsi_pollfds ); - } - } else { - LDAPDebug( LDAP_DEBUG_ANY, - "nsldapi_iostatus_free: unknown I/O type %d\n", - iosp->ios_type, 0, 0 ); - } - - NSLDAPI_FREE( iosp ); - } -} - - -static int -nsldapi_get_select_table_size( void ) -{ - static int tblsize = 0; /* static */ - - if ( tblsize == 0 ) { -#if defined(_WINDOWS) || defined(XP_OS2) - tblsize = FOPEN_MAX; /* ANSI spec. */ -#else -#ifdef USE_SYSCONF - tblsize = sysconf( _SC_OPEN_MAX ); -#else /* USE_SYSCONF */ - tblsize = getdtablesize(); -#endif /* else USE_SYSCONF */ -#endif /* else _WINDOWS */ - - if ( tblsize >= FD_SETSIZE ) { - /* - * clamp value so we don't overrun the fd_set structure - */ - tblsize = FD_SETSIZE - 1; - } - } - - return( tblsize ); -} - -static int -nsldapi_tv2ms( struct timeval *tv ) -{ - if ( tv == NULL ) { - return( -1 ); /* infinite timout for poll() */ - } - - return( tv->tv_sec * 1000 + tv->tv_usec / 1000 ); -} - - -int -nsldapi_iostatus_poll( LDAP *ld, struct timeval *timeout ) -{ - int rc; - NSLDAPIIOStatus *iosp; - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_iostatus_poll\n", 0, 0, 0 ); - - LDAP_MUTEX_LOCK( ld, LDAP_IOSTATUS_LOCK ); - iosp = ld->ld_iostatus; - - if ( iosp == NULL || - ( iosp->ios_read_count <= 0 && iosp->ios_read_count <= 0 )) { - rc = 0; /* simulate a timeout */ - - } else if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_OSNATIVE ) { -#ifdef NSLDAPI_HAVE_POLL - - rc = NSLDAPI_POLL( iosp->ios_status.ios_osinfo.ossi_pollfds, - iosp->ios_status.ios_osinfo.ossi_pollfds_size, - nsldapi_tv2ms( timeout )); - -#else /* NSLDAPI_HAVE_POLL */ - - /* two (potentially large) struct copies */ - iosp->ios_status.ios_osinfo.ossi_use_readfds - = iosp->ios_status.ios_osinfo.ossi_readfds; - iosp->ios_status.ios_osinfo.ossi_use_writefds - = iosp->ios_status.ios_osinfo.ossi_writefds; - -#ifdef HPUX9 - rc = NSLDAPI_SELECT( nsldapi_get_select_table_size(), - (int *)&iosp->ios_status.ios_osinfo.ossi_use_readfds - (int *)&iosp->ios_status.ios_osinfo.ossi_use_writefds, - NULL, timeout ); -#else - rc = NSLDAPI_SELECT( nsldapi_get_select_table_size(), - &iosp->ios_status.ios_osinfo.ossi_use_readfds, - &iosp->ios_status.ios_osinfo.ossi_use_writefds, - NULL, timeout ); -#endif /* else HPUX9 */ -#endif /* else NSLDAPI_HAVE_POLL */ - - } else if ( iosp->ios_type == NSLDAPI_IOSTATUS_TYPE_CALLBACK ) { - /* - * We always pass the session extended I/O argument to - * the extended poll() callback. - */ - rc = ld->ld_extpoll_fn( - iosp->ios_status.ios_cbinfo.cbsi_pollfds, - iosp->ios_status.ios_cbinfo.cbsi_pollfds_size, - nsldapi_tv2ms( timeout ), ld->ld_ext_session_arg ); - - } else { - LDAPDebug( LDAP_DEBUG_ANY, - "nsldapi_iostatus_poll: unknown I/O type %d\n", - iosp->ios_type, 0, 0 ); - rc = 0; /* simulate a timeout (what else to do?) */ - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_IOSTATUS_LOCK ); - return( rc ); -} - - -#ifdef NSLDAPI_HAVE_POLL -/* - * returns 1 if "fd" was added to pollfds. - * returns 1 if some of the bits in "events" were added to pollfds. - * returns 0 if no changes were made. - */ -static int -nsldapi_add_to_os_pollfds( int fd, struct nsldapi_os_statusinfo *pip, - short events ) -{ - int i, openslot; - - /* first we check to see if "fd" is already in our pollfds */ - openslot = -1; - for ( i = 0; i < pip->ossi_pollfds_size; ++i ) { - if ( pip->ossi_pollfds[ i ].fd == fd ) { - if (( pip->ossi_pollfds[ i ].events & events ) - != events ) { - pip->ossi_pollfds[ i ].events |= events; - return( 1 ); - } else { - return( 0 ); - } - } - if ( pip->ossi_pollfds[ i ].fd == -1 && openslot == -1 ) { - openslot = i; /* remember for later */ - } - } - - /* - * "fd" is not currently being poll'd on -- add to array. - * if we need to expand the pollfds array, we do it in increments of - * NSLDAPI_POLL_ARRAY_GROWTH (#define near the top of this file). - */ - if ( openslot == -1 ) { - struct pollfd *newpollfds; - - if ( pip->ossi_pollfds_size == 0 ) { - newpollfds = (struct pollfd *)NSLDAPI_MALLOC( - NSLDAPI_POLL_ARRAY_GROWTH - * sizeof( struct pollfd )); - } else { - newpollfds = (struct pollfd *)NSLDAPI_REALLOC( - pip->ossi_pollfds, (NSLDAPI_POLL_ARRAY_GROWTH - + pip->ossi_pollfds_size) - * sizeof( struct pollfd )); - } - if ( newpollfds == NULL ) { /* XXXmcs: no way to return err! */ - return( 0 ); - } - pip->ossi_pollfds = newpollfds; - openslot = pip->ossi_pollfds_size; - pip->ossi_pollfds_size += NSLDAPI_POLL_ARRAY_GROWTH; - for ( i = openslot + 1; i < pip->ossi_pollfds_size; ++i ) { - pip->ossi_pollfds[ i ].fd = -1; - pip->ossi_pollfds[ i ].events = - pip->ossi_pollfds[ i ].revents = 0; - } - } - pip->ossi_pollfds[ openslot ].fd = fd; - pip->ossi_pollfds[ openslot ].events = events; - pip->ossi_pollfds[ openslot ].revents = 0; - return( 1 ); -} - - -/* - * returns 1 if any "events" from "fd" were removed from pollfds - * returns 0 of "fd" wasn't in pollfds or if events did not overlap. - */ -static int -nsldapi_clear_from_os_pollfds( int fd, struct nsldapi_os_statusinfo *pip, - short events ) -{ - int i; - - for ( i = 0; i < pip->ossi_pollfds_size; ++i ) { - if ( pip->ossi_pollfds[i].fd == fd ) { - if (( pip->ossi_pollfds[ i ].events & events ) != 0 ) { - pip->ossi_pollfds[ i ].events &= ~events; - if ( pip->ossi_pollfds[ i ].events == 0 ) { - pip->ossi_pollfds[i].fd = -1; - } - return( 1 ); /* events overlap */ - } else { - return( 0 ); /* events do not overlap */ - } - } - } - - return( 0 ); /* "fd" was not found */ -} - - -/* - * returns 1 if any "revents" from "fd" were set in pollfds revents field. - * returns 0 if not. - */ -static int -nsldapi_find_in_os_pollfds( int fd, struct nsldapi_os_statusinfo *pip, - short revents ) -{ - int i; - - for ( i = 0; i < pip->ossi_pollfds_size; ++i ) { - if ( pip->ossi_pollfds[i].fd == fd ) { - if (( pip->ossi_pollfds[ i ].revents & revents ) != 0 ) { - return( 1 ); /* revents overlap */ - } else { - return( 0 ); /* revents do not overlap */ - } - } - } - - return( 0 ); /* "fd" was not found */ -} -#endif /* NSLDAPI_HAVE_POLL */ - - -/* - * returns 1 if "sb" was added to pollfds. - * returns 1 if some of the bits in "events" were added to pollfds. - * returns 0 if no changes were made. - */ -static int -nsldapi_add_to_cb_pollfds( Sockbuf *sb, struct nsldapi_cb_statusinfo *pip, - short events ) -{ - int i, openslot; - - /* first we check to see if "sb" is already in our pollfds */ - openslot = -1; - for ( i = 0; i < pip->cbsi_pollfds_size; ++i ) { - if ( NSLDAPI_CB_POLL_MATCH( sb, pip->cbsi_pollfds[ i ] )) { - if (( pip->cbsi_pollfds[ i ].lpoll_events & events ) - != events ) { - pip->cbsi_pollfds[ i ].lpoll_events |= events; - return( 1 ); - } else { - return( 0 ); - } - } - if ( pip->cbsi_pollfds[ i ].lpoll_fd == -1 && openslot == -1 ) { - openslot = i; /* remember for later */ - } - } - - /* - * "sb" is not currently being poll'd on -- add to array. - * if we need to expand the pollfds array, we do it in increments of - * NSLDAPI_POLL_ARRAY_GROWTH (#define near the top of this file). - */ - if ( openslot == -1 ) { - LDAP_X_PollFD *newpollfds; - - if ( pip->cbsi_pollfds_size == 0 ) { - newpollfds = (LDAP_X_PollFD *)NSLDAPI_MALLOC( - NSLDAPI_POLL_ARRAY_GROWTH - * sizeof( LDAP_X_PollFD )); - } else { - newpollfds = (LDAP_X_PollFD *)NSLDAPI_REALLOC( - pip->cbsi_pollfds, (NSLDAPI_POLL_ARRAY_GROWTH - + pip->cbsi_pollfds_size) - * sizeof( LDAP_X_PollFD )); - } - if ( newpollfds == NULL ) { /* XXXmcs: no way to return err! */ - return( 0 ); - } - pip->cbsi_pollfds = newpollfds; - openslot = pip->cbsi_pollfds_size; - pip->cbsi_pollfds_size += NSLDAPI_POLL_ARRAY_GROWTH; - for ( i = openslot + 1; i < pip->cbsi_pollfds_size; ++i ) { - pip->cbsi_pollfds[ i ].lpoll_fd = -1; - pip->cbsi_pollfds[ i ].lpoll_socketarg = NULL; - pip->cbsi_pollfds[ i ].lpoll_events = - pip->cbsi_pollfds[ i ].lpoll_revents = 0; - } - } - pip->cbsi_pollfds[ openslot ].lpoll_fd = sb->sb_sd; - pip->cbsi_pollfds[ openslot ].lpoll_socketarg = - sb->sb_ext_io_fns.lbextiofn_socket_arg; - pip->cbsi_pollfds[ openslot ].lpoll_events = events; - pip->cbsi_pollfds[ openslot ].lpoll_revents = 0; - return( 1 ); -} - - -/* - * returns 1 if any "events" from "sb" were removed from pollfds - * returns 0 of "sb" wasn't in pollfds or if events did not overlap. - */ -static int -nsldapi_clear_from_cb_pollfds( Sockbuf *sb, - struct nsldapi_cb_statusinfo *pip, short events ) -{ - int i; - - for ( i = 0; i < pip->cbsi_pollfds_size; ++i ) { - if ( NSLDAPI_CB_POLL_MATCH( sb, pip->cbsi_pollfds[ i ] )) { - if (( pip->cbsi_pollfds[ i ].lpoll_events - & events ) != 0 ) { - pip->cbsi_pollfds[ i ].lpoll_events &= ~events; - if ( pip->cbsi_pollfds[ i ].lpoll_events - == 0 ) { - pip->cbsi_pollfds[i].lpoll_fd = -1; - } - return( 1 ); /* events overlap */ - } else { - return( 0 ); /* events do not overlap */ - } - } - } - - return( 0 ); /* "sb" was not found */ -} - - -/* - * returns 1 if any "revents" from "sb" were set in pollfds revents field. - * returns 0 if not. - */ -static int -nsldapi_find_in_cb_pollfds( Sockbuf *sb, struct nsldapi_cb_statusinfo *pip, - short revents ) -{ - int i; - - for ( i = 0; i < pip->cbsi_pollfds_size; ++i ) { - if ( NSLDAPI_CB_POLL_MATCH( sb, pip->cbsi_pollfds[ i ] )) { - if (( pip->cbsi_pollfds[ i ].lpoll_revents - & revents ) != 0 ) { - return( 1 ); /* revents overlap */ - } else { - return( 0 ); /* revents do not overlap */ - } - } - } - - return( 0 ); /* "sb" was not found */ -} - - -/* - * Install read and write functions into lber layer / sb - */ -int -nsldapi_install_lber_extiofns( LDAP *ld, Sockbuf *sb ) -{ - struct lber_x_ext_io_fns lberiofns; - - if ( NULL != sb ) { - lberiofns.lbextiofn_size = LBER_X_EXTIO_FNS_SIZE; - lberiofns.lbextiofn_read = ld->ld_extread_fn; - lberiofns.lbextiofn_write = ld->ld_extwrite_fn; - lberiofns.lbextiofn_writev = ld->ld_extwritev_fn; - lberiofns.lbextiofn_socket_arg = ld->ld_ext_session_arg; - - if ( ber_sockbuf_set_option( sb, LBER_SOCKBUF_OPT_EXT_IO_FNS, - &lberiofns ) != 0 ) { - return( LDAP_LOCAL_ERROR ); - } - } - - return( LDAP_SUCCESS ); -} - - -/* - ****************************************************************************** - * One struct and several functions to bridge the gap between new extended - * I/O functions that are installed using ldap_set_option( ..., - * LDAP_OPT_EXTIO_FN_PTRS, ... ) and the original "classic" I/O functions - * (installed using LDAP_OPT_IO_FN_PTRS) follow. - * - * Our basic strategy is to use the new extended arg to hold a pointer to a - * structure that contains a pointer to the LDAP * (which contains pointers - * to the old functions so we can call them) as well as a pointer to an - * LBER_SOCKET to hold the socket used by the classic functions (the new - * functions use a simple int for the socket). - */ -typedef struct nsldapi_compat_socket_info { - LBER_SOCKET csi_socket; - LDAP *csi_ld; -} NSLDAPICompatSocketInfo; - -static int LDAP_CALLBACK -nsldapi_ext_compat_read( int s, void *buf, int len, - struct lextiof_socket_private *arg ) -{ - NSLDAPICompatSocketInfo *csip = (NSLDAPICompatSocketInfo *)arg; - struct ldap_io_fns *iofns = csip->csi_ld->ld_io_fns_ptr; - - return( iofns->liof_read( csip->csi_socket, buf, len )); -} - - -static int LDAP_CALLBACK -nsldapi_ext_compat_write( int s, const void *buf, int len, - struct lextiof_socket_private *arg ) -{ - NSLDAPICompatSocketInfo *csip = (NSLDAPICompatSocketInfo *)arg; - struct ldap_io_fns *iofns = csip->csi_ld->ld_io_fns_ptr; - - return( iofns->liof_write( csip->csi_socket, buf, len )); -} - - -static int LDAP_CALLBACK -nsldapi_ext_compat_poll( LDAP_X_PollFD fds[], int nfds, int timeout, - struct lextiof_session_private *arg ) -{ - NSLDAPICompatSocketInfo *csip = (NSLDAPICompatSocketInfo *)arg; - struct ldap_io_fns *iofns = csip->csi_ld->ld_io_fns_ptr; - fd_set readfds, writefds; - int i, rc, maxfd = 0; - struct timeval tv, *tvp; - - /* - * Prepare fd_sets for select() - */ - FD_ZERO( &readfds ); - FD_ZERO( &writefds ); - for ( i = 0; i < nfds; ++i ) { - if ( fds[ i ].lpoll_fd < 0 ) { - continue; - } - - if ( fds[ i ].lpoll_fd >= FD_SETSIZE ) { - LDAP_SET_ERRNO( csip->csi_ld, EINVAL ); - return( -1 ); - } - - if ( 0 != ( fds[i].lpoll_events & LDAP_X_POLLIN )) { - FD_SET( fds[i].lpoll_fd, &readfds ); - } - - if ( 0 != ( fds[i].lpoll_events & LDAP_X_POLLOUT )) { - FD_SET( fds[i].lpoll_fd, &writefds ); - } - - fds[i].lpoll_revents = 0; /* clear revents */ - - if ( fds[i].lpoll_fd >= maxfd ) { - maxfd = fds[i].lpoll_fd; - } - } - - /* - * select() using callback. - */ - ++maxfd; - if ( timeout == -1 ) { - tvp = NULL; - } else { - tv.tv_sec = timeout / 1000; - tv.tv_usec = 1000 * ( timeout - tv.tv_sec * 1000 ); - tvp = &tv; - } - rc = iofns->liof_select( maxfd, &readfds, &writefds, NULL, tvp ); - if ( rc <= 0 ) { /* timeout or fatal error */ - return( rc ); - } - - /* - * Use info. in fd_sets to populate poll() revents. - */ - for ( i = 0; i < nfds; ++i ) { - if ( fds[ i ].lpoll_fd < 0 ) { - continue; - } - - if ( 0 != ( fds[i].lpoll_events & LDAP_X_POLLIN ) - && FD_ISSET( fds[i].lpoll_fd, &readfds )) { - fds[i].lpoll_revents |= LDAP_X_POLLIN; - } - - if ( 0 != ( fds[i].lpoll_events & LDAP_X_POLLOUT ) - && FD_ISSET( fds[i].lpoll_fd, &writefds )) { - fds[i].lpoll_revents |= LDAP_X_POLLOUT; - } - - /* XXXmcs: any other cases to deal with? LDAP_X_POLLERR? */ - } - - return( rc ); -} - - -static LBER_SOCKET -nsldapi_compat_socket( LDAP *ld, int secure, int domain, int type, - int protocol ) -{ - int s; - - s = ld->ld_io_fns_ptr->liof_socket( domain, type, protocol ); - - if ( s >= 0 ) { - char *errmsg = NULL; - -#ifdef NSLDAPI_HAVE_POLL - if ( ld->ld_io_fns_ptr->liof_select != NULL - && s >= FD_SETSIZE ) { - errmsg = "can't use socket >= FD_SETSIZE"; - } -#elif !defined(_WINDOWS) /* not on Windows and do not have poll() */ - if ( s >= FD_SETSIZE ) { - errmsg = "can't use socket >= FD_SETSIZE"; - } -#endif - - if ( NULL == errmsg && secure && - ld->ld_io_fns_ptr->liof_ssl_enable( s ) < 0 ) { - errmsg = "failed to enable secure mode"; - } - - if ( NULL != errmsg ) { - if ( NULL == ld->ld_io_fns_ptr->liof_close ) { - nsldapi_os_closesocket( s ); - } else { - ld->ld_io_fns_ptr->liof_close( s ); - } - LDAP_SET_LDERRNO( ld, LDAP_LOCAL_ERROR, NULL, - nsldapi_strdup( errmsg )); - return( -1 ); - } - } - - return( s ); -} - - -/* - * Note: timeout is ignored because we have no way to pass it via - * the old I/O callback interface. - */ -static int LDAP_CALLBACK -nsldapi_ext_compat_connect( const char *hostlist, int defport, int timeout, - unsigned long options, struct lextiof_session_private *sessionarg, - struct lextiof_socket_private **socketargp ) -{ - NSLDAPICompatSocketInfo *defcsip; - struct ldap_io_fns *iofns; - int s, secure; - NSLDAPI_SOCKET_FN *socketfn; - NSLDAPI_IOCTL_FN *ioctlfn; - NSLDAPI_CONNECT_WITH_TO_FN *connectwithtofn; - NSLDAPI_CONNECT_FN *connectfn; - NSLDAPI_CLOSE_FN *closefn; - - defcsip = (NSLDAPICompatSocketInfo *)sessionarg; - iofns = defcsip->csi_ld->ld_io_fns_ptr; - - if ( 0 != ( options & LDAP_X_EXTIOF_OPT_SECURE )) { - if ( NULL == iofns->liof_ssl_enable ) { - LDAP_SET_ERRNO( defcsip->csi_ld, EINVAL ); - return( -1 ); - } - secure = 1; - } else { - secure = 0; - } - - socketfn = ( iofns->liof_socket == NULL ) ? - nsldapi_os_socket : nsldapi_compat_socket; - ioctlfn = ( iofns->liof_ioctl == NULL ) ? - nsldapi_os_ioctl : (NSLDAPI_IOCTL_FN *)(iofns->liof_ioctl); - if ( NULL == iofns->liof_connect ) { - connectwithtofn = nsldapi_os_connect_with_to; - connectfn = NULL; - } else { - connectwithtofn = NULL; - connectfn = iofns->liof_connect; - } - closefn = ( iofns->liof_close == NULL ) ? - nsldapi_os_closesocket : iofns->liof_close; - - s = nsldapi_try_each_host( defcsip->csi_ld, hostlist, defport, - secure, socketfn, ioctlfn, connectwithtofn, - connectfn, closefn ); - - if ( s >= 0 ) { - NSLDAPICompatSocketInfo *csip; - - if (( csip = (NSLDAPICompatSocketInfo *)NSLDAPI_CALLOC( 1, - sizeof( NSLDAPICompatSocketInfo ))) == NULL ) { - (*closefn)( s ); - LDAP_SET_LDERRNO( defcsip->csi_ld, LDAP_NO_MEMORY, - NULL, NULL ); - return( -1 ); - } - - csip->csi_socket = s; - csip->csi_ld = defcsip->csi_ld; - *socketargp = (void *)csip; - - /* - * We always return 1, which is a valid but not unique socket - * (file descriptor) number. The extended I/O functions only - * require that the combination of the void *arg and the int - * socket be unique. Since we allocate the - * NSLDAPICompatSocketInfo that we assign to arg, we meet - * that requirement. - */ - s = 1; - } - - return( s ); -} - - -static int LDAP_CALLBACK -nsldapi_ext_compat_close( int s, struct lextiof_socket_private *arg ) -{ - NSLDAPICompatSocketInfo *csip = (NSLDAPICompatSocketInfo *)arg; - struct ldap_io_fns *iofns = csip->csi_ld->ld_io_fns_ptr; - int rc; - - rc = iofns->liof_close( csip->csi_socket ); - - NSLDAPI_FREE( csip ); - - return( rc ); -} - -/* - * Install the I/O functions. - * Return an LDAP error code (LDAP_SUCCESS if all goes well). - */ -int -nsldapi_install_compat_io_fns( LDAP *ld, struct ldap_io_fns *iofns ) -{ - NSLDAPICompatSocketInfo *defcsip; - - if (( defcsip = (NSLDAPICompatSocketInfo *)NSLDAPI_CALLOC( 1, - sizeof( NSLDAPICompatSocketInfo ))) == NULL ) { - return( LDAP_NO_MEMORY ); - } - - defcsip->csi_socket = -1; - defcsip->csi_ld = ld; - - if ( ld->ld_io_fns_ptr != NULL ) { - (void)memset( (char *)ld->ld_io_fns_ptr, 0, - sizeof( struct ldap_io_fns )); - } else if (( ld->ld_io_fns_ptr = (struct ldap_io_fns *)NSLDAPI_CALLOC( - 1, sizeof( struct ldap_io_fns ))) == NULL ) { - NSLDAPI_FREE( defcsip ); - return( LDAP_NO_MEMORY ); - } - - /* struct copy */ - *(ld->ld_io_fns_ptr) = *iofns; - - ld->ld_extio_size = LBER_X_EXTIO_FNS_SIZE; - ld->ld_ext_session_arg = defcsip; - ld->ld_extread_fn = nsldapi_ext_compat_read; - ld->ld_extwrite_fn = nsldapi_ext_compat_write; - ld->ld_extpoll_fn = nsldapi_ext_compat_poll; - ld->ld_extconnect_fn = nsldapi_ext_compat_connect; - ld->ld_extclose_fn = nsldapi_ext_compat_close; - - return( nsldapi_install_lber_extiofns( ld, ld->ld_sbp )); -} -/* - * end of compat I/O functions - ****************************************************************************** - */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/proxyauthctrl.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/proxyauthctrl.c deleted file mode 100644 index 6ea85cf6726..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/proxyauthctrl.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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 "ldap-int.h" - -/* ldap_create_proxyauth_control - - Create a "version 1" proxied authorization control. - - Parameters are - - ld LDAP pointer to the desired connection - - dn The dn used in the proxy auth - - ctl_iscritical Indicates whether the control is critical of not. If - this field is non-zero, the operation will only be car- - ried out if the control is recognized by the server - and/or client - - ctrlp the address of a place to put the constructed control -*/ - -int -LDAP_CALL -ldap_create_proxyauth_control ( - LDAP *ld, - const char *dn, - const char ctl_iscritical, - LDAPControl **ctrlp -) -{ - BerElement *ber; - int rc; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( ctrlp == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return ( LDAP_PARAM_ERROR ); - } - if (NULL == dn) - { - dn = ""; - } - - /* create a ber package to hold the controlValue */ - if ( ( nsldapi_alloc_ber_with_options( ld, &ber ) ) != LDAP_SUCCESS ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( LDAP_NO_MEMORY ); - } - - - - if ( LBER_ERROR == ber_printf( ber, - "{s}", - dn ) ) - { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - - rc = nsldapi_build_control( LDAP_CONTROL_PROXYAUTH, ber, 1, - ctl_iscritical, ctrlp ); - - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); - -} - - -/* ldap_create_proxiedauth_control - - Create a "version 2" proxied authorization control. - - Parameters are - - ld LDAP pointer to the desired connection - - authzid The authorization identity used in the proxy auth, - e.g., dn:uid=bjensen,dc=example,dc=com - - ctrlp the address of a place to put the constructed control -*/ - -int -LDAP_CALL -ldap_create_proxiedauth_control ( - LDAP *ld, - const char *authzid, - LDAPControl **ctrlp -) -{ - BerElement *ber; - int rc; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( ctrlp == NULL || authzid == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return ( LDAP_PARAM_ERROR ); - } - - /* create a ber package to hold the controlValue */ - if ( ( nsldapi_alloc_ber_with_options( ld, &ber ) ) != LDAP_SUCCESS ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( LDAP_NO_MEMORY ); - } - - - - if ( LBER_ERROR == ber_printf( ber, - "s", - authzid ) ) - { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - - rc = nsldapi_build_control( LDAP_CONTROL_PROXIEDAUTH, ber, 1, 1, ctrlp ); - - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); - -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/psearch.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/psearch.c deleted file mode 100644 index 04c54003625..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/psearch.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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): - */ -/* - * psearch.c - Persistent search and "Entry Change Notification" support. - */ -#include "ldap-int.h" - - -int -LDAP_CALL -ldap_create_persistentsearch_control( LDAP *ld, int changetypes, - int changesonly, int return_echg_ctls, char ctl_iscritical, - LDAPControl **ctrlp ) -{ - BerElement *ber; - int rc; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( ctrlp == NULL || ( changetypes & ~LDAP_CHANGETYPE_ANY ) != 0 ) { - rc = LDAP_PARAM_ERROR; - goto report_error_and_return; - } - - /* - * create a Persistent Search control. The control value looks like this: - * - * PersistentSearch ::= SEQUENCE { - * changeTypes INTEGER, - * -- the changeTypes field is the logical OR of - * -- one or more of these values: add (1), delete (2), - * -- modify (4), modDN (8). It specifies which types of - * -- changes will cause an entry to be returned. - * changesOnly BOOLEAN, -- skip initial search? - * returnECs BOOLEAN, -- return "Entry Change" controls? - * } - */ - if (( nsldapi_alloc_ber_with_options( ld, &ber )) != LDAP_SUCCESS ) { - rc = LDAP_NO_MEMORY; - goto report_error_and_return; - } - - if ( ber_printf( ber, "{ibb}", changetypes, changesonly, - return_echg_ctls ) == -1 ) { - ber_free( ber, 1 ); - rc = LDAP_ENCODING_ERROR; - goto report_error_and_return; - } - - rc = nsldapi_build_control( LDAP_CONTROL_PERSISTENTSEARCH, ber, 1, - ctl_iscritical, ctrlp ); - -report_error_and_return: - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); -} - - -int -LDAP_CALL -ldap_parse_entrychange_control( LDAP *ld, LDAPControl **ctrls, int *chgtypep, - char **prevdnp, int *chgnumpresentp, long *chgnump ) -{ - BerElement *ber; - int rc, i, changetype; - unsigned long len; - long along; - char *previousdn; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - /* - * find the entry change notification in the list of controls - */ - for ( i = 0; ctrls != NULL && ctrls[i] != NULL; ++i ) { - if ( strcmp( ctrls[i]->ldctl_oid, LDAP_CONTROL_ENTRYCHANGE ) == 0 ) { - break; - } - } - - if ( ctrls == NULL || ctrls[i] == NULL ) { - rc = LDAP_CONTROL_NOT_FOUND; - goto report_error_and_return; - } - - /* - * allocate a BER element from the control value and parse it. The control - * value should look like this: - * - * EntryChangeNotification ::= SEQUENCE { - * changeType ENUMERATED { - * add (1), -- these values match the - * delete (2), -- values used for changeTypes - * modify (4), -- in the PersistentSearch control. - * modDN (8), - * }, - * previousDN LDAPDN OPTIONAL, -- modDN ops. only - * changeNumber INTEGER OPTIONAL, -- if supported - * } - */ - if (( ber = ber_init( &(ctrls[i]->ldctl_value))) == NULL ) { - rc = LDAP_NO_MEMORY; - goto report_error_and_return; - } - - if ( ber_scanf( ber, "{e", &along ) == LBER_ERROR ) { - ber_free( ber, 1 ); - rc = LDAP_DECODING_ERROR; - goto report_error_and_return; - } - changetype = (int)along; /* XXX lossy cast */ - - if ( changetype == LDAP_CHANGETYPE_MODDN ) { - if ( ber_scanf( ber, "a", &previousdn ) == LBER_ERROR ) { - ber_free( ber, 1 ); - rc = LDAP_DECODING_ERROR; - goto report_error_and_return; - } - } else { - previousdn = NULL; - } - - if ( chgtypep != NULL ) { - *chgtypep = changetype; - } - if ( prevdnp != NULL ) { - *prevdnp = previousdn; - } else if ( previousdn != NULL ) { - NSLDAPI_FREE( previousdn ); - } - - if ( chgnump != NULL ) { /* check for optional changenumber */ - if ( ber_peek_tag( ber, &len ) == LBER_INTEGER - && ber_get_int( ber, chgnump ) != LBER_ERROR ) { - if ( chgnumpresentp != NULL ) { - *chgnumpresentp = 1; - } - } else { - if ( chgnumpresentp != NULL ) { - *chgnumpresentp = 0; - } - } - } - - ber_free( ber, 1 ); - rc = LDAP_SUCCESS; - -report_error_and_return: - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/pthreadtest.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/pthreadtest.c deleted file mode 100644 index 4d786e96515..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/pthreadtest.c +++ /dev/null @@ -1,1013 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include - -#include - -/* Authentication and search information. */ -#define NAME "cn=Directory Manager" -#define PASSWORD "rtfm11111" -#define BASE "dc=example,dc=com" -#define SCOPE LDAP_SCOPE_SUBTREE - -static void *modify_thread(); -static void *add_thread(); -static void *delete_thread(); -static void *bind_thread(); -static void *compare_thread(); -static void *search_thread(); -static void *my_mutex_alloc(); -static void my_mutex_free(); -void *my_sema_alloc( void ); -void my_sema_free( void * ); -int my_sema_wait( void * ); -int my_sema_post( void * ); -static void set_ld_error(); -static int get_ld_error(); -static void set_errno(); -static int get_errno(); -static void tsd_setup(); -static void tsd_cleanup(); -static int get_random_id( void ); -static char *get_id_str( int id ); - -/* Linked list of LDAPMessage structs for search results. */ -typedef struct ldapmsgwrapper { - LDAPMessage *lmw_messagep; - struct ldapmsgwrapper *lmw_next; -} ldapmsgwrapper; - -LDAP *ld; -pthread_key_t key; -int maxid = MAXINT; -int maxops = 0; /* zero means no limit */ -int range_filters = 0; /* if non-zero use >= and >= filters */ - -main( int argc, char **argv ) - -{ - pthread_attr_t attr; - pthread_t *threadids; - void *status; - struct ldap_thread_fns tfns; - struct ldap_extra_thread_fns extrafns; - int rc, c, errflg, i, inited_attr; - int doadd, dodelete, domodify, docompare, dosearch, dobind; - int option_extthreads, option_restart; - int each_thread_count, thread_count; - extern int optind; - extern char *optarg; - - doadd = dodelete = domodify = docompare = dobind = dosearch = 0; - option_extthreads = option_restart = 0; - inited_attr = 0; - errflg = 0; - each_thread_count = 1; /* how many of each type of thread? */ - rc = LDAP_SUCCESS; /* optimistic */ - - while (( c = getopt( argc, argv, "abcdmrsERi:n:o:S:" )) != EOF ) { - switch( c ) { - case 'a': /* perform add operations */ - ++doadd; - break; - case 'b': /* perform bind operations */ - ++dobind; - break; - case 'c': /* perform compare operations */ - ++docompare; - break; - case 'd': /* perform delete operations */ - ++dodelete; - break; - case 'm': /* perform modify operations */ - ++domodify; - break; - case 'r': /* use range filters in searches */ - ++range_filters; - break; - case 's': /* perform search operations */ - ++dosearch; - break; - case 'E': /* use extended thread functions */ - ++option_extthreads; - break; - case 'R': /* turn on LDAP_OPT_RESTART */ - ++option_restart; - break; - case 'i': /* highest # used for entry names */ - maxid = atoi( optarg ); - break; - case 'n': /* # threads for each operation */ - if (( each_thread_count = atoi( optarg )) < 1 ) { - fprintf( stderr, "thread count must be > 0\n" ); - ++errflg; - } - break; - case 'o': /* operations to perform per thread */ - if (( maxops = atoi( optarg )) < 0 ) { - fprintf( stderr, - "operation limit must be >= 0\n" ); - ++errflg; - } - break; - case 'S': /* random number seed */ - if ( *optarg == 'r' ) { - int seed = (int)time( (time_t *)0 ); - srandom( seed ); - printf( "Random seed: %d\n", seed ); - } else { - srandom( atoi( optarg )); - } - break; - default: - ++errflg; - break; - } - } - - /* Check command-line syntax. */ - thread_count = each_thread_count * ( doadd + dodelete + domodify - + dobind + docompare + dosearch ); - if ( thread_count < 1 ) { - fprintf( stderr, - "Specify at least one of -a, -b, -c, -d, -m, or -s\n" ); - ++errflg; - } - - if ( errflg || argc - optind != 2 ) { - fprintf( stderr, "usage: %s [-abcdmrsER] [-i id] [-n thr]" - " [-o oplim] [-S sd] host port\n", argv[0] ); - fputs( "\nWhere:\n" - "\t\"id\" is the highest entry id (name) to use" - " (default is MAXINT)\n" - "\t\"thr\" is the number of threads for each operation" - " (default is 1)\n" - "\t\"oplim\" is the number of ops done by each thread" - " (default is infinite)\n" - "\t\"sd\" is a random() number seed (default is 1). Use" - " the letter r for\n" - "\t\tsd to seed random() using time of day.\n" - "\t\"host\" is the hostname of an LDAP directory server\n" - "\t\"port\" is the TCP port of the LDAP directory server\n" - , stderr ); - fputs( "\nAnd the single character options are:\n" - "\t-a\tstart thread(s) to perform add operations\n" - "\t-b\tstart thread(s) to perform bind operations\n" - "\t-c\tstart thread(s) to perform compare operations\n" - "\t-d\tstart thread(s) to perform delete operations\n" - "\t-m\tstart thread(s) to perform modify operations\n" - "\t-s\tstart thread(s) to perform search operations\n" - "\t-r\tuse range filters in searches\n" - "\t-E\tinstall LDAP_OPT_EXTRA_THREAD_FN_PTRS\n" - "\t-R\tturn on LDAP_OPT_RESTART\n", stderr ); - - return( LDAP_PARAM_ERROR ); - } - - /* Create a key. */ - if ( pthread_key_create( &key, free ) != 0 ) { - perror( "pthread_key_create" ); - } - tsd_setup(); - - /* Allocate space for thread ids */ - if (( threadids = (pthread_t *)calloc( thread_count, - sizeof( pthread_t ))) == NULL ) { - rc = LDAP_LOCAL_ERROR; - goto clean_up_and_return; - } - - - /* Initialize the LDAP session. */ - if (( ld = ldap_init( argv[optind], atoi( argv[optind+1] ))) == NULL ) { - perror( "ldap_init" ); - rc = LDAP_LOCAL_ERROR; - goto clean_up_and_return; - } - - /* Set the function pointers for dealing with mutexes - and error information. */ - memset( &tfns, '\0', sizeof(struct ldap_thread_fns) ); - tfns.ltf_mutex_alloc = (void *(*)(void)) my_mutex_alloc; - tfns.ltf_mutex_free = (void (*)(void *)) my_mutex_free; - tfns.ltf_mutex_lock = (int (*)(void *)) pthread_mutex_lock; - tfns.ltf_mutex_unlock = (int (*)(void *)) pthread_mutex_unlock; - tfns.ltf_get_errno = get_errno; - tfns.ltf_set_errno = set_errno; - tfns.ltf_get_lderrno = get_ld_error; - tfns.ltf_set_lderrno = set_ld_error; - tfns.ltf_lderrno_arg = NULL; - - /* Set up this session to use those function pointers. */ - - rc = ldap_set_option( ld, LDAP_OPT_THREAD_FN_PTRS, (void *) &tfns ); - if ( rc < 0 ) { - rc = ldap_get_lderrno( ld, NULL, NULL ); - fprintf( stderr, - "ldap_set_option (LDAP_OPT_THREAD_FN_PTRS): %s\n", - ldap_err2string( rc ) ); - goto clean_up_and_return; - } - - if ( option_extthreads ) { - /* Set the function pointers for working with semaphores. */ - - memset( &extrafns, '\0', sizeof(struct ldap_extra_thread_fns) ); - extrafns.ltf_mutex_trylock = - (int (*)(void *)) pthread_mutex_trylock; - extrafns.ltf_sema_alloc = (void *(*)(void)) my_sema_alloc; - extrafns.ltf_sema_free = (void (*)(void *)) my_sema_free; - extrafns.ltf_sema_wait = (int (*)(void *)) my_sema_wait; - extrafns.ltf_sema_post = (int (*)(void *)) my_sema_post; - - /* Set up this session to use those function pointers. */ - - if ( ldap_set_option( ld, LDAP_OPT_EXTRA_THREAD_FN_PTRS, - (void *) &extrafns ) != 0 ) { - rc = ldap_get_lderrno( ld, NULL, NULL ); - ldap_perror( ld, "ldap_set_option" - " (LDAP_OPT_EXTRA_THREAD_FN_PTRS)" ); - goto clean_up_and_return; - } - } - - - if ( option_restart && ldap_set_option( ld, LDAP_OPT_RESTART, - LDAP_OPT_ON ) != 0 ) { - rc = ldap_get_lderrno( ld, NULL, NULL ); - ldap_perror( ld, "ldap_set_option(LDAP_OPT_RESTART)" ); - goto clean_up_and_return; - } - - /* Attempt to bind to the server. */ - rc = ldap_simple_bind_s( ld, NAME, PASSWORD ); - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_simple_bind_s: %s\n", - ldap_err2string( rc ) ); - goto clean_up_and_return; - } - - /* Initialize the attribute. */ - if ( pthread_attr_init( &attr ) != 0 ) { - perror( "pthread_attr_init" ); - rc = LDAP_LOCAL_ERROR; - goto clean_up_and_return; - } - ++inited_attr; - - /* Specify that the threads are joinable. */ - pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ); - - /* Create all the requested threads */ - thread_count = 0; - if ( domodify ) { - for ( i = 0; i < each_thread_count; ++i ) { - if ( pthread_create( &threadids[thread_count], &attr, - modify_thread, get_id_str(thread_count) ) != 0 ) { - perror( "pthread_create modify_thread" ); - rc = LDAP_LOCAL_ERROR; - goto clean_up_and_return; - } - ++thread_count; - } - } - - if ( doadd ) { - for ( i = 0; i < each_thread_count; ++i ) { - if ( pthread_create( &threadids[thread_count], &attr, - add_thread, get_id_str(thread_count) ) != 0 ) { - perror( "pthread_create add_thread" ); - rc = LDAP_LOCAL_ERROR; - goto clean_up_and_return; - } - ++thread_count; - } - } - - if ( dodelete ) { - for ( i = 0; i < each_thread_count; ++i ) { - if ( pthread_create( &threadids[thread_count], &attr, - delete_thread, get_id_str(thread_count) ) != 0 ) { - perror( "pthread_create delete_thread" ); - rc = LDAP_LOCAL_ERROR; - goto clean_up_and_return; - } - ++thread_count; - } - } - - if ( dobind ) { - for ( i = 0; i < each_thread_count; ++i ) { - if ( pthread_create( &threadids[thread_count], &attr, - bind_thread, get_id_str(thread_count) ) != 0 ) { - perror( "pthread_create bind_thread" ); - rc = LDAP_LOCAL_ERROR; - goto clean_up_and_return; - } - ++thread_count; - } - } - - if ( docompare ) { - for ( i = 0; i < each_thread_count; ++i ) { - if ( pthread_create( &threadids[thread_count], &attr, - compare_thread, get_id_str(thread_count) ) != 0 ) { - perror( "pthread_create compare_thread" ); - rc = LDAP_LOCAL_ERROR; - goto clean_up_and_return; - } - ++thread_count; - } - } - - if ( dosearch ) { - for ( i = 0; i < each_thread_count; ++i ) { - if ( pthread_create( &threadids[thread_count], &attr, - search_thread, get_id_str(thread_count) ) != 0 ) { - perror( "pthread_create search_thread" ); - rc = LDAP_LOCAL_ERROR; - goto clean_up_and_return; - } - ++thread_count; - } - } - - /* Wait until these threads exit. */ - for ( i = 0; i < thread_count; ++i ) { - pthread_join( threadids[i], &status ); - } - -clean_up_and_return: - if ( ld != NULL ) { - set_ld_error( 0, NULL, NULL, NULL ); /* disposes of memory */ - ldap_unbind( ld ); - } - if ( threadids != NULL ) { - free( threadids ); - } - if ( inited_attr ) { - pthread_attr_destroy( &attr ); - } - tsd_cleanup(); - - return( rc ); -} - - -static void * -modify_thread( char *id ) -{ - LDAPMessage *res; - LDAPMessage *e; - int i, modentry, num_entries, msgid, parse_rc, finished; - int rc, opcount; - LDAPMod mod; - LDAPMod *mods[2]; - char *vals[2]; - char *dn; - ldapmsgwrapper *list, *lmwp, *lastlmwp; - struct timeval zerotime; - void *voidrc = (void *)0; - - zerotime.tv_sec = zerotime.tv_usec = 0L; - - printf( "Starting modify_thread %s.\n", id ); - opcount = 0; - tsd_setup(); - - rc = ldap_search_ext( ld, BASE, SCOPE, "(objectclass=*)", - NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &msgid ); - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "Thread %s error: Modify thread: " - "ldap_search_ext: %s\n", id, ldap_err2string( rc ) ); - exit( 1 ); - } - list = lastlmwp = NULL; - finished = 0; - num_entries = 0; - while ( !finished ) { - rc = ldap_result( ld, msgid, LDAP_MSG_ONE, &zerotime, &res ); - switch ( rc ) { - case -1: - rc = ldap_get_lderrno( ld, NULL, NULL ); - fprintf( stderr, "ldap_result: %s\n", ldap_err2string( rc ) ); - exit( 1 ); - break; - case 0: - break; - /* Keep track of the number of entries found. */ - case LDAP_RES_SEARCH_ENTRY: - num_entries++; - if (( lmwp = (ldapmsgwrapper *) - malloc( sizeof( ldapmsgwrapper ))) == NULL ) { - fprintf( stderr, "Thread %s: Modify thread: Cannot malloc\n", id ); - exit( 1 ); - } - lmwp->lmw_messagep = res; - lmwp->lmw_next = NULL; - if ( lastlmwp == NULL ) { - list = lastlmwp = lmwp; - } else { - lastlmwp->lmw_next = lmwp; - } - lastlmwp = lmwp; - break; - case LDAP_RES_SEARCH_REFERENCE: - break; - case LDAP_RES_SEARCH_RESULT: - finished = 1; - parse_rc = ldap_parse_result( ld, res, &rc, NULL, NULL, NULL, NULL, 1 ); - if ( parse_rc != LDAP_SUCCESS ) { - fprintf( stderr, "Thread %s error: can't parse result code.\n", id ); - exit( 1 ); - } else { - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "Thread %s error: ldap_search: %s\n", id, ldap_err2string( rc ) ); - } else { - printf( "Thread %s: Got %d results.\n", id, num_entries ); - } - } - break; - default: - break; - } - } - - mods[0] = &mod; - mods[1] = NULL; - vals[0] = "bar"; - vals[1] = NULL; - - for ( ;; ) { - modentry = random() % num_entries; - for ( i = 0, lmwp = list; lmwp != NULL && i < modentry; - i++, lmwp = lmwp->lmw_next ) { - /* NULL */ - } - - if ( lmwp == NULL ) { - fprintf( stderr, - "Thread %s: Modify thread could not find entry %d of %d\n", - id, modentry, num_entries ); - continue; - } - - e = lmwp->lmw_messagep; - printf( "Thread %s: Modify thread picked entry %d of %d\n", id, i, num_entries ); - dn = ldap_get_dn( ld, e ); - - mod.mod_op = LDAP_MOD_REPLACE; - mod.mod_type = "description"; - mod.mod_values = vals; - printf( "Thread %s: Modifying (%s)\n", id, dn ); - - rc = ldap_modify_ext_s( ld, dn, mods, NULL, NULL ); - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_modify_ext_s: %s\n", - ldap_err2string( rc ) ); - if ( rc == LDAP_SERVER_DOWN ) { - perror( "ldap_modify_ext_s" ); - voidrc = (void *)1; - goto modify_cleanup_and_return; - } - } - free( dn ); - - ++opcount; - if ( maxops != 0 && opcount >= maxops ) { - break; - } - } - -modify_cleanup_and_return: - printf( "Thread %s: attempted %d modify operations\n", id, opcount ); - set_ld_error( 0, NULL, NULL, NULL ); /* disposes of memory */ - tsd_cleanup(); - free( id ); - return voidrc; -} - - -static void * -add_thread( char *id ) -{ - LDAPMod mod[4]; - LDAPMod *mods[5]; - char dn[BUFSIZ], name[40]; - char *cnvals[2], *snvals[2], *pwdvals[2], *ocvals[3]; - int i, rc, opcount; - void *voidrc = (void *)0; - - printf( "Starting add_thread %s.\n", id ); - opcount = 0; - tsd_setup(); - - for ( i = 0; i < 4; i++ ) { - mods[i] = &mod[i]; - } - - mods[4] = NULL; - - mod[0].mod_op = 0; - mod[0].mod_type = "cn"; - mod[0].mod_values = cnvals; - cnvals[1] = NULL; - mod[1].mod_op = 0; - mod[1].mod_type = "sn"; - mod[1].mod_values = snvals; - snvals[1] = NULL; - mod[2].mod_op = 0; - mod[2].mod_type = "objectclass"; - mod[2].mod_values = ocvals; - ocvals[0] = "top"; - ocvals[1] = "person"; - ocvals[2] = NULL; - mod[3].mod_op = 0; - mod[3].mod_type = "userPassword"; - mod[3].mod_values = pwdvals; - pwdvals[1] = NULL; - mods[4] = NULL; - - for ( ;; ) { - sprintf( name, "%d", get_random_id() ); - sprintf( dn, "cn=%s, " BASE, name ); - cnvals[0] = name; - snvals[0] = name; - pwdvals[0] = name; - - printf( "Thread %s: Adding entry (%s)\n", id, dn ); - rc = ldap_add_ext_s( ld, dn, mods, NULL, NULL ); - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_add_ext_s: %s\n", - ldap_err2string( rc ) ); - if ( rc == LDAP_SERVER_DOWN ) { - perror( "ldap_add_ext_s" ); - voidrc = (void *)1; - goto add_cleanup_and_return; - } - } - - ++opcount; - if ( maxops != 0 && opcount >= maxops ) { - break; - } - } - -add_cleanup_and_return: - printf( "Thread %s: attempted %d add operations\n", id, opcount ); - set_ld_error( 0, NULL, NULL, NULL ); /* disposes of memory */ - tsd_cleanup(); - free( id ); - return voidrc; -} - - -static void * -delete_thread( char *id ) -{ - LDAPMessage *res; - char dn[BUFSIZ], name[40]; - int num_entries, msgid, rc, parse_rc, finished, opcount; - struct timeval zerotime; - void *voidrc = (void *)0; - - zerotime.tv_sec = zerotime.tv_usec = 0L; - - printf( "Starting delete_thread %s.\n", id ); - opcount = 0; - tsd_setup(); - - rc = ldap_search_ext( ld, BASE, SCOPE, "(objectclass=*)", - NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &msgid ); - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "Thread %s error: Delete thread: " - "ldap_search_ext: %s\n", id, ldap_err2string( rc ) ); - exit( 1 ); - } - - finished = 0; - num_entries = 0; - while ( !finished ) { - rc = ldap_result( ld, msgid, LDAP_MSG_ONE, &zerotime, &res ); - switch ( rc ) { - case -1: - rc = ldap_get_lderrno( ld, NULL, NULL ); - fprintf( stderr, "ldap_result: %s\n", ldap_err2string( rc ) ); - exit( 1 ); - break; - case 0: - break; - /* Keep track of the number of entries found. */ - case LDAP_RES_SEARCH_ENTRY: - num_entries++; - break; - case LDAP_RES_SEARCH_REFERENCE: - break; - case LDAP_RES_SEARCH_RESULT: - finished = 1; - parse_rc = ldap_parse_result( ld, res, &rc, NULL, NULL, NULL, NULL, 1 ); - if ( parse_rc != LDAP_SUCCESS ) { - fprintf( stderr, "Thread %s error: can't parse result code.\n", id ); - exit( 1 ); - } else { - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "Thread %s error: ldap_search: %s\n", id, ldap_err2string( rc ) ); - } else { - printf( "Thread %s: Got %d results.\n", id, num_entries ); - } - } - break; - default: - break; - } - } - - for ( ;; ) { - sprintf( name, "%d", get_random_id() ); - sprintf( dn, "cn=%s, " BASE, name ); - printf( "Thread %s: Deleting entry (%s)\n", id, dn ); - - if (( rc = ldap_delete_ext_s( ld, dn, NULL, NULL )) - != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_delete_ext_s" ); - if ( rc == LDAP_SERVER_DOWN ) { - perror( "ldap_delete_ext_s" ); - voidrc = (void *)1; - goto delete_cleanup_and_return; - } - } - - ++opcount; - if ( maxops != 0 && opcount >= maxops ) { - break; - } - } - -delete_cleanup_and_return: - printf( "Thread %s: attempted %d delete operations\n", id, opcount ); - set_ld_error( 0, NULL, NULL, NULL ); /* disposes of memory */ - tsd_cleanup(); - free( id ); - return voidrc; -} - - -static void * -bind_thread( char *id ) -{ - char dn[BUFSIZ], name[40]; - int rc, opcount; - void *voidrc = (void *)0; - - printf( "Starting bind_thread %s.\n", id ); - opcount = 0; - tsd_setup(); - - for ( ;; ) { - sprintf( name, "%d", get_random_id() ); - sprintf( dn, "cn=%s, " BASE, name ); - printf( "Thread %s: Binding as entry (%s)\n", id, dn ); - - if (( rc = ldap_simple_bind_s( ld, dn, name )) - != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_simple_bind_s" ); - if ( rc == LDAP_SERVER_DOWN ) { - perror( "ldap_simple_bind_s" ); - voidrc = (void *)1; - goto bind_cleanup_and_return; - } - } else { - printf( "Thread %s: bound as entry (%s)\n", id, dn ); - } - - ++opcount; - if ( maxops != 0 && opcount >= maxops ) { - break; - } - } - -bind_cleanup_and_return: - printf( "Thread %s: attempted %d bind operations\n", id, opcount ); - set_ld_error( 0, NULL, NULL, NULL ); /* disposes of memory */ - tsd_cleanup(); - free( id ); - return voidrc; -} - - -static void * -compare_thread( char *id ) -{ - char dn[BUFSIZ], name[40], cmpval[40]; - int rc, randval, opcount; - struct berval bv; - void *voidrc = (void *)0; - - printf( "Starting compare_thread %s.\n", id ); - opcount = 0; - tsd_setup(); - - for ( ;; ) { - randval = get_random_id(); - sprintf( name, "%d", randval ); - sprintf( dn, "cn=%s, " BASE, name ); - sprintf( cmpval, "%d", randval + random() % 3 ); - bv.bv_val = cmpval; - bv.bv_len = strlen( cmpval ); - - printf( "Thread %s: Comparing cn in entry (%s) with %s\n", - id, dn, cmpval ); - - rc = ldap_compare_ext_s( ld, dn, "cn", &bv, NULL, NULL ); - switch ( rc ) { - case LDAP_COMPARE_TRUE: - printf( "Thread %s: entry (%s) contains cn %s\n", - id, dn, cmpval ); - break; - case LDAP_COMPARE_FALSE: - printf( "Thread %s: entry (%s) doesn't contain cn %s\n", - id, dn, cmpval ); - break; - default: - ldap_perror( ld, "ldap_compare_ext_s" ); - if ( rc == LDAP_SERVER_DOWN ) { - perror( "ldap_compare_ext_s" ); - voidrc = (void *)1; - goto compare_cleanup_and_return; - } - } - - ++opcount; - if ( maxops != 0 && opcount >= maxops ) { - break; - } - } - -compare_cleanup_and_return: - printf( "Thread %s: attempted %d compare operations\n", id, opcount ); - set_ld_error( 0, NULL, NULL, NULL ); /* disposes of memory */ - tsd_cleanup(); - free( id ); - return voidrc; -} - - -static void * -search_thread( char *id ) -{ - LDAPMessage *res, *entry; - char *dn, filter[40]; - int rc, opcount; - void *voidrc = (void *)0; - - printf( "Starting search_thread %s.\n", id ); - opcount = 0; - tsd_setup(); - - for ( ;; ) { - if ( range_filters ) { - switch( get_random_id() % 3 ) { - case 0: - sprintf( filter, "(cn>=%d)", get_random_id()); - break; - case 1: - sprintf( filter, "(cn<=%d)", get_random_id()); - break; - case 2: - sprintf( filter, "(&(cn>=%d)(cn<=%d))", - get_random_id(), get_random_id() ); - break; - } - } else { - sprintf( filter, "cn=%d", get_random_id() ); - } - - printf( "Thread %s: Searching for entry (%s)\n", id, filter ); - - res = NULL; - if (( rc = ldap_search_ext_s( ld, BASE, SCOPE, filter, NULL, 0, - NULL, NULL, NULL, 0, &res )) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_search_ext_s" ); - if ( rc == LDAP_SERVER_DOWN ) { - perror( "ldap_search_ext_s" ); - voidrc = (void *)1; - goto search_cleanup_and_return; - } - } - if ( res != NULL ) { - entry = ldap_first_entry( ld, res ); - if ( entry == NULL ) { - printf( "Thread %s: found no entries\n", id ); - } else { - dn = ldap_get_dn( ld, entry ); - printf( - "Thread %s: found entry (%s); %d total\n", - id, dn == NULL ? "(Null)" : dn, - ldap_count_entries( ld, res )); - ldap_memfree( dn ); - } - ldap_msgfree( res ); - } - - ++opcount; - if ( maxops != 0 && opcount >= maxops ) { - break; - } - } - -search_cleanup_and_return: - printf( "Thread %s: attempted %d search operations\n", id, opcount ); - set_ld_error( 0, NULL, NULL, NULL ); /* disposes of memory */ - tsd_cleanup(); - free( id ); - return voidrc; -} - - -static void * -my_mutex_alloc( void ) -{ - pthread_mutex_t *mutexp; - - if ( (mutexp = malloc( sizeof(pthread_mutex_t) )) != NULL ) { - pthread_mutex_init( mutexp, NULL ); - } - return( mutexp ); -} - - -void * -my_sema_alloc( void ) -{ - sema_t *semptr; - - if( (semptr = malloc( sizeof(sema_t) ) ) != NULL ) { - sema_init( semptr, 0, USYNC_THREAD, NULL ); - } - return ( semptr ); -} - - -static void -my_mutex_free( void *mutexp ) -{ - pthread_mutex_destroy( (pthread_mutex_t *) mutexp ); - free( mutexp ); -} - - -void -my_sema_free( void *semptr ) -{ - sema_destroy( (sema_t *) semptr ); - free( semptr ); -} - - -int -my_sema_wait( void *semptr ) -{ - if( semptr != NULL ) - return( sema_wait( (sema_t *) semptr ) ); - else - return( -1 ); -} - - -int -my_sema_post( void *semptr ) -{ - if( semptr != NULL ) - return( sema_post( (sema_t *) semptr ) ); - else - return( -1 ); -} - - -struct ldap_error { - int le_errno; - char *le_matched; - char *le_errmsg; -}; - - -static void -tsd_setup() -{ - void *tsd; - tsd = pthread_getspecific( key ); - if ( tsd != NULL ) { - fprintf( stderr, "tsd non-null!\n" ); - pthread_exit( NULL ); - } - - tsd = (void *) calloc( 1, sizeof(struct ldap_error) ); - pthread_setspecific( key, tsd ); -} - - -static void -tsd_cleanup() -{ - void *tsd; - - if (( tsd = pthread_getspecific( key )) != NULL ) { - pthread_setspecific( key, NULL ); - free( tsd ); - } -} - - -static void -set_ld_error( int err, char *matched, char *errmsg, void *dummy ) -{ - struct ldap_error *le; - - le = pthread_getspecific( key ); - - le->le_errno = err; - - if ( le->le_matched != NULL ) { - ldap_memfree( le->le_matched ); - } - le->le_matched = matched; - - if ( le->le_errmsg != NULL ) { - ldap_memfree( le->le_errmsg ); - } - le->le_errmsg = errmsg; -} - - -static int -get_ld_error( char **matchedp, char **errmsgp, void *dummy ) -{ - struct ldap_error *le; - - le = pthread_getspecific( key ); - if ( matchedp != NULL ) { - *matchedp = le->le_matched; - } - if ( errmsgp != NULL ) { - *errmsgp = le->le_errmsg; - } - return( le->le_errno ); -} - - -static void -set_errno( int err ) -{ - errno = err; -} - - -static int -get_errno( void ) -{ - return( errno ); -} - - -static int -get_random_id() -{ - return( random() % maxid ); -} - - -static char * -get_id_str( int id ) -{ - char idstr[ 10 ]; - - sprintf( idstr, "%d", id ); - return( strdup( idstr )); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/referral.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/referral.c deleted file mode 100644 index 2be7c9f34d9..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/referral.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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): - */ -/* - * referral.c - routines for handling LDAPv3 referrals and references. - */ - -#include "ldap-int.h" - - -LDAPMessage * -LDAP_CALL -ldap_first_reference( LDAP *ld, LDAPMessage *res ) -{ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || res == NULLMSG ) { - return( NULLMSG ); - } - - if ( res->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ) { - return( res ); - } - - return( ldap_next_reference( ld, res )); -} - - -LDAPMessage * -LDAP_CALL -ldap_next_reference( LDAP *ld, LDAPMessage *ref ) -{ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || ref == NULLMSG ) { - return( NULLMSG ); /* punt */ - } - - for ( ref = ref->lm_chain; ref != NULLMSG; ref = ref->lm_chain ) { - if ( ref->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ) { - return( ref ); - } - } - - return( NULLMSG ); -} - - -int -LDAP_CALL -ldap_count_references( LDAP *ld, LDAPMessage *res ) -{ - int i; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); - } - - for ( i = 0; res != NULL; res = res->lm_chain ) { - if ( res->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ) { - ++i; - } - } - - return( i ); -} - - -/* - * returns an LDAP error code. - */ -int -LDAP_CALL -ldap_parse_reference( LDAP *ld, LDAPMessage *ref, char ***referralsp, - LDAPControl ***serverctrlsp, int freeit ) -{ - int err; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || - !NSLDAPI_VALID_LDAPMESSAGE_REFERENCE_POINTER( ref )) { - return( LDAP_PARAM_ERROR ); - } - - err = nsldapi_parse_reference( ld, ref->lm_ber, referralsp, - serverctrlsp ); - - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - - if ( freeit ) { - ldap_msgfree( ref ); - } - - return( err ); -} - - -/* - * returns an LDAP error code indicating success or failure of parsing - * does NOT set any error information inside "ld" - */ -int -nsldapi_parse_reference( LDAP *ld, BerElement *rber, char ***referralsp, - LDAPControl ***serverctrlsp ) -{ - int err; - BerElement ber; - char **refs; - - /* - * Parse a searchResultReference message. These are used in LDAPv3 - * and beyond and look like this: - * - * SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL - * - * all wrapped up in an LDAPMessage sequence which looks like this: - * - * LDAPMessage ::= SEQUENCE { - * messageID MessageID, - * SearchResultReference - * controls [0] Controls OPTIONAL - * } - * - * ldap_result() pulls out the message id, so by the time a result - * message gets here we are conveniently sitting at the start of the - * SearchResultReference itself. - */ - err = LDAP_SUCCESS; /* optimistic */ - ber = *rber; /* struct copy */ - - if ( ber_scanf( &ber, "{v", &refs ) == LBER_ERROR ) { - err = LDAP_DECODING_ERROR; - } else if ( serverctrlsp != NULL ) { - /* pull out controls (if requested and any are present) */ - if ( ber_scanf( &ber, "}" ) == LBER_ERROR ) { - err = LDAP_DECODING_ERROR; - } else { - err = nsldapi_get_controls( &ber, serverctrlsp ); - } - } - - if ( referralsp == NULL ) { - ldap_value_free( refs ); - } else { - *referralsp = refs; - } - - return( err ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/regex.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/regex.c deleted file mode 100644 index 120d9b62396..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/regex.c +++ /dev/null @@ -1,905 +0,0 @@ -/* - * 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 "ldap-int.h" -#if defined( macintosh ) || defined( DOS ) || defined( _WINDOWS ) || defined( NEED_BSDREGEX ) || defined( XP_OS2) -#include "regex.h" - -/* - * regex - Regular expression pattern matching and replacement - * - * By: Ozan S. Yigit (oz) - * Dept. of Computer Science - * York University - * - * These routines are the PUBLIC DOMAIN equivalents of regex - * routines as found in 4.nBSD UN*X, with minor extensions. - * - * These routines are derived from various implementations found - * in software tools books, and Conroy's grep. They are NOT derived - * from licensed/restricted software. - * For more interesting/academic/complicated implementations, - * see Henry Spencer's regexp routines, or GNU Emacs pattern - * matching module. - * - * Use the actual CCL code in the CLO - * section of pmatch. No need for a recursive - * pmatch call. - * - * Use a bitmap table to set char bits in an - * 8-bit chunk. - * - * Interfaces: - * re_comp: compile a regular expression into a NFA. - * - * char *re_comp(s) - * char *s; - * - * re_exec: execute the NFA to match a pattern. - * - * int re_exec(s) - * char *s; - * - * re_modw change re_exec's understanding of what a "word" - * looks like (for \< and \>) by adding into the - * hidden word-syntax table. - * - * void re_modw(s) - * char *s; - * - * re_subs: substitute the matched portions in a new string. - * - * int re_subs(src, dst) - * char *src; - * char *dst; - * - * re_fail: failure routine for re_exec. - * - * void re_fail(msg, op) - * char *msg; - * char op; - * - * Regular Expressions: - * - * [1] char matches itself, unless it is a special - * character (metachar): . \ [ ] * + ^ $ - * - * [2] . matches any character. - * - * [3] \ matches the character following it, except - * when followed by a left or right round bracket, - * a digit 1 to 9 or a left or right angle bracket. - * (see [7], [8] and [9]) - * It is used as an escape character for all - * other meta-characters, and itself. When used - * in a set ([4]), it is treated as an ordinary - * character. - * - * [4] [set] matches one of the characters in the set. - * If the first character in the set is "^", - * it matches a character NOT in the set, i.e. - * complements the set. A shorthand S-E is - * used to specify a set of characters S upto - * E, inclusive. The special characters "]" and - * "-" have no special meaning if they appear - * as the first chars in the set. - * examples: match: - * - * [a-z] any lowercase alpha - * - * [^]-] any char except ] and - - * - * [^A-Z] any char except uppercase - * alpha - * - * [a-zA-Z] any alpha - * - * [5] * any regular expression form [1] to [4], followed by - * closure char (*) matches zero or more matches of - * that form. - * - * [6] + same as [5], except it matches one or more. - * - * [7] a regular expression in the form [1] to [10], enclosed - * as \(form\) matches what form matches. The enclosure - * creates a set of tags, used for [8] and for - * pattern substution. The tagged forms are numbered - * starting from 1. - * - * [8] a \ followed by a digit 1 to 9 matches whatever a - * previously tagged regular expression ([7]) matched. - * - * [9] \< a regular expression starting with a \< construct - * \> and/or ending with a \> construct, restricts the - * pattern matching to the beginning of a word, and/or - * the end of a word. A word is defined to be a character - * string beginning and/or ending with the characters - * A-Z a-z 0-9 and _. It must also be preceded and/or - * followed by any character outside those mentioned. - * - * [10] a composite regular expression xy where x and y - * are in the form [1] to [10] matches the longest - * match of x followed by a match for y. - * - * [11] ^ a regular expression starting with a ^ character - * $ and/or ending with a $ character, restricts the - * pattern matching to the beginning of the line, - * or the end of line. [anchors] Elsewhere in the - * pattern, ^ and $ are treated as ordinary characters. - * - * - * Acknowledgements: - * - * HCR's Hugh Redelmeier has been most helpful in various - * stages of development. He convinced me to include BOW - * and EOW constructs, originally invented by Rob Pike at - * the University of Toronto. - * - * References: - * Software tools Kernighan & Plauger - * Software tools in Pascal Kernighan & Plauger - * Grep [rsx-11 C dist] David Conroy - * ed - text editor Un*x Programmer's Manual - * Advanced editing on Un*x B. W. Kernighan - * RegExp routines Henry Spencer - * - * Notes: - * - * This implementation uses a bit-set representation for character - * classes for speed and compactness. Each character is represented - * by one bit in a 128-bit block. Thus, CCL always takes a - * constant 16 bytes in the internal nfa, and re_exec does a single - * bit comparison to locate the character in the set. - * - * Examples: - * - * pattern: foo*.* - * compile: CHR f CHR o CLO CHR o END CLO ANY END END - * matches: fo foo fooo foobar fobar foxx ... - * - * pattern: fo[ob]a[rz] - * compile: CHR f CHR o CCL bitset CHR a CCL bitset END - * matches: fobar fooar fobaz fooaz - * - * pattern: foo\\+ - * compile: CHR f CHR o CHR o CHR \ CLO CHR \ END END - * matches: foo\ foo\\ foo\\\ ... - * - * pattern: \(foo\)[1-3]\1 (same as foo[1-3]foo) - * compile: BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END - * matches: foo1foo foo2foo foo3foo - * - * pattern: \(fo.*\)-\1 - * compile: BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END - * matches: foo-foo fo-fo fob-fob foobar-foobar ... - */ - -#define MAXNFA 1024 -#define MAXTAG 10 - -#define OKP 1 -#define NOP 0 - -#define CHR 1 -#define ANY 2 -#define CCL 3 -#define BOL 4 -#define EOL 5 -#define BOT 6 -#define EOT 7 -#define BOW 8 -#define EOW 9 -#define REF 10 -#define CLO 11 - -#define END 0 - -/* - * The following defines are not meant to be changeable. - * They are for readability only. - */ -#define MAXCHR 128 -#define CHRBIT 8 -#define BITBLK MAXCHR/CHRBIT -#define BLKIND 0170 -#define BITIND 07 - -#define ASCIIB 0177 - -/* Plain char, on the other hand, may be signed or unsigned; it depends on - * the platform and perhaps a compiler option. A hard fact of life, in C. - * - * 6-April-1999 mcs@netscape.com: replaced CHAR with REGEXCHAR to avoid - * conflicts with system types on Win32. Changed typedef - * for REGEXCHAR to always be unsigned, which seems right. - */ -typedef unsigned char REGEXCHAR; - -static int tagstk[MAXTAG]; /* subpat tag stack..*/ -static REGEXCHAR nfa[MAXNFA]; /* automaton.. */ -static int sta = NOP; /* status of lastpat */ - -static REGEXCHAR bittab[BITBLK]; /* bit table for CCL */ - /* pre-set bits... */ -static REGEXCHAR bitarr[] = {1,2,4,8,16,32,64,128}; - -static void -chset(REGEXCHAR c) -{ - bittab[((c) & (unsigned)BLKIND) >> 3] |= bitarr[(c) & BITIND]; -} - -#define badpat(x) (*nfa = END, x) -#define store(x) *mp++ = x - -char * -LDAP_CALL -re_comp( char *pat ) -{ - register REGEXCHAR *p; /* pattern pointer */ - register REGEXCHAR *mp=nfa; /* nfa pointer */ - register REGEXCHAR *lp; /* saved pointer.. */ - register REGEXCHAR *sp=nfa; /* another one.. */ - - register int tagi = 0; /* tag stack index */ - register int tagc = 1; /* actual tag count */ - - register int n; - register REGEXCHAR mask; /* xor mask -CCL/NCL */ - int c1, c2; - - if (!pat || !*pat) { - if (sta) { - return 0; - } else { - return badpat("No previous regular expression"); - } - } - sta = NOP; - - for (p = (REGEXCHAR*)pat; *p; p++) { - lp = mp; - switch(*p) { - - case '.': /* match any char.. */ - store(ANY); - break; - - case '^': /* match beginning.. */ - if (p == (REGEXCHAR*)pat) - store(BOL); - else { - store(CHR); - store(*p); - } - break; - - case '$': /* match endofline.. */ - if (!*(p+1)) - store(EOL); - else { - store(CHR); - store(*p); - } - break; - - case '[': /* match char class..*/ - store(CCL); - - if (*++p == '^') { - mask = 0377; - p++; - } - else - mask = 0; - - if (*p == '-') /* real dash */ - chset(*p++); - if (*p == ']') /* real brac */ - chset(*p++); - while (*p && *p != ']') { - if (*p == '-' && *(p+1) && *(p+1) != ']') { - p++; - c1 = *(p-2) + 1; - c2 = *p++; - while (c1 <= c2) - chset((REGEXCHAR)c1++); - } -#ifdef EXTEND - else if (*p == '\\' && *(p+1)) { - p++; - chset(*p++); - } -#endif - else - chset(*p++); - } - if (!*p) - return badpat("Missing ]"); - - for (n = 0; n < BITBLK; bittab[n++] = (REGEXCHAR) 0) - store(mask ^ bittab[n]); - - break; - - case '*': /* match 0 or more.. */ - case '+': /* match 1 or more.. */ - if (p == (REGEXCHAR*)pat) - return badpat("Empty closure"); - lp = sp; /* previous opcode */ - if (*lp == CLO) /* equivalence.. */ - break; - switch(*lp) { - - case BOL: - case BOT: - case EOT: - case BOW: - case EOW: - case REF: - return badpat("Illegal closure"); - default: - break; - } - - if (*p == '+') - for (sp = mp; lp < sp; lp++) - store(*lp); - - store(END); - store(END); - sp = mp; - while (--mp > lp) - *mp = mp[-1]; - store(CLO); - mp = sp; - break; - - case '\\': /* tags, backrefs .. */ - switch(*++p) { - - case '(': - if (tagc < MAXTAG) { - tagstk[++tagi] = tagc; - store(BOT); - store(tagc++); - } - else - return badpat("Too many \\(\\) pairs"); - break; - case ')': - if (*sp == BOT) - return badpat("Null pattern inside \\(\\)"); - if (tagi > 0) { - store(EOT); - store(tagstk[tagi--]); - } - else - return badpat("Unmatched \\)"); - break; - case '<': - store(BOW); - break; - case '>': - if (*sp == BOW) - return badpat("Null pattern inside \\<\\>"); - store(EOW); - break; - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - n = *p-'0'; - if (tagi > 0 && tagstk[tagi] == n) - return badpat("Cyclical reference"); - if (tagc > n) { - store(REF); - store(n); - } - else - return badpat("Undetermined reference"); - break; -#ifdef EXTEND - case 'b': - store(CHR); - store('\b'); - break; - case 'n': - store(CHR); - store('\n'); - break; - case 'f': - store(CHR); - store('\f'); - break; - case 'r': - store(CHR); - store('\r'); - break; - case 't': - store(CHR); - store('\t'); - break; -#endif - default: - store(CHR); - store(*p); - } - break; - - default : /* an ordinary char */ - store(CHR); - store(*p); - break; - } - sp = lp; - } - if (tagi > 0) - return badpat("Unmatched \\("); - store(END); - sta = OKP; - return 0; -} - - -static REGEXCHAR *bol; -static REGEXCHAR *bopat[MAXTAG]; -static REGEXCHAR *eopat[MAXTAG]; -#ifdef NEEDPROTOS -static REGEXCHAR *pmatch( REGEXCHAR *lp, REGEXCHAR *ap ); -#else /* NEEDPROTOS */ -static REGEXCHAR *pmatch(); -#endif /* NEEDPROTOS */ - -/* - * re_exec: - * execute nfa to find a match. - * - * special cases: (nfa[0]) - * BOL - * Match only once, starting from the - * beginning. - * CHR - * First locate the character without - * calling pmatch, and if found, call - * pmatch for the remaining string. - * END - * re_comp failed, poor luser did not - * check for it. Fail fast. - * - * If a match is found, bopat[0] and eopat[0] are set - * to the beginning and the end of the matched fragment, - * respectively. - * - */ - -int -LDAP_CALL -re_exec( char *lp ) -{ - register REGEXCHAR c; - register REGEXCHAR *ep = 0; - register REGEXCHAR *ap = nfa; - - bol = (REGEXCHAR*)lp; - - bopat[0] = 0; - bopat[1] = 0; - bopat[2] = 0; - bopat[3] = 0; - bopat[4] = 0; - bopat[5] = 0; - bopat[6] = 0; - bopat[7] = 0; - bopat[8] = 0; - bopat[9] = 0; - - switch(*ap) { - - case BOL: /* anchored: match from BOL only */ - ep = pmatch((REGEXCHAR*)lp,ap); - break; - case CHR: /* ordinary char: locate it fast */ - c = *(ap+1); - while (*lp && *(REGEXCHAR*)lp != c) - lp++; - if (!*lp) /* if EOS, fail, else fall thru. */ - return 0; - default: /* regular matching all the way. */ - do { - if ((ep = pmatch((REGEXCHAR*)lp,ap))) - break; - lp++; - } while (*lp); - - break; - case END: /* munged automaton. fail always */ - return 0; - } - if (!ep) - return 0; - - bopat[0] = (REGEXCHAR*)lp; - eopat[0] = ep; - return 1; -} - -/* - * pmatch: internal routine for the hard part - * - * This code is partly snarfed from an early grep written by - * David Conroy. The backref and tag stuff, and various other - * innovations are by oz. - * - * special case optimizations: (nfa[n], nfa[n+1]) - * CLO ANY - * We KNOW .* will match everything upto the - * end of line. Thus, directly go to the end of - * line, without recursive pmatch calls. As in - * the other closure cases, the remaining pattern - * must be matched by moving backwards on the - * string recursively, to find a match for xy - * (x is ".*" and y is the remaining pattern) - * where the match satisfies the LONGEST match for - * x followed by a match for y. - * CLO CHR - * We can again scan the string forward for the - * single char and at the point of failure, we - * execute the remaining nfa recursively, same as - * above. - * - * At the end of a successful match, bopat[n] and eopat[n] - * are set to the beginning and end of subpatterns matched - * by tagged expressions (n = 1 to 9). - * - */ - -#ifndef re_fail -extern void re_fail(); -#endif /* re_fail */ - -/* - * character classification table for word boundary operators BOW - * and EOW. the reason for not using ctype macros is that we can - * let the user add into our own table. see re_modw. This table - * is not in the bitset form, since we may wish to extend it in the - * future for other character classifications. - * - * TRUE for 0-9 A-Z a-z _ - */ -static char chrtyp[MAXCHR] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0 - }; - -#define HIBIT 0200 -#define inascii(x) (0177&(x)) -#define iswordc(x) chrtyp[inascii(x)] -#define isinset(x,y) (((y)&HIBIT)?0:((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])) - -/* - * skip values for CLO XXX to skip past the closure - */ - -#define ANYSKIP 2 /* [CLO] ANY END ... */ -#define CHRSKIP 3 /* [CLO] CHR chr END ... */ -#define CCLSKIP 18 /* [CLO] CCL 16bytes END ... */ - -static REGEXCHAR * -pmatch( REGEXCHAR *lp, REGEXCHAR *ap) -{ - register int op, c, n; - register REGEXCHAR *e; /* extra pointer for CLO */ - register REGEXCHAR *bp; /* beginning of subpat.. */ - register REGEXCHAR *ep; /* ending of subpat.. */ - REGEXCHAR *are; /* to save the line ptr. */ - - while ((op = *ap++) != END) - switch(op) { - - case CHR: - if (*lp++ != *ap++) - return 0; - break; - case ANY: - if (!*lp++) - return 0; - break; - case CCL: - c = *lp++; - if (!isinset(ap,c)) - return 0; - ap += BITBLK; - break; - case BOL: - if (lp != bol) - return 0; - break; - case EOL: - if (*lp) - return 0; - break; - case BOT: - bopat[*ap++] = lp; - break; - case EOT: - eopat[*ap++] = lp; - break; - case BOW: - if ((lp!=bol && iswordc(lp[-1])) || !iswordc(*lp)) - return 0; - break; - case EOW: - if (lp==bol || !iswordc(lp[-1]) || iswordc(*lp)) - return 0; - break; - case REF: - n = *ap++; - bp = bopat[n]; - ep = eopat[n]; - while (bp < ep) - if (*bp++ != *lp++) - return 0; - break; - case CLO: - are = lp; - switch(*ap) { - - case ANY: - while (*lp) - lp++; - n = ANYSKIP; - break; - case CHR: - c = *(ap+1); - while (*lp && c == *lp) - lp++; - n = CHRSKIP; - break; - case CCL: - while ((c = *lp) && isinset(ap+1,c)) - lp++; - n = CCLSKIP; - break; - default: - re_fail("closure: bad nfa.", *ap); - return 0; - } - - ap += n; - - while (lp >= are) { - if ((e = pmatch(lp, ap))) - return e; - --lp; - } - return 0; - default: - re_fail("re_exec: bad nfa.", op); - return 0; - } - return lp; -} - -/* - * re_modw: - * add new characters into the word table to change re_exec's - * understanding of what a word should look like. Note that we - * only accept additions into the word definition. - * - * If the string parameter is 0 or null string, the table is - * reset back to the default containing A-Z a-z 0-9 _. [We use - * the compact bitset representation for the default table] - */ - -static REGEXCHAR deftab[16] = { - 0, 0, 0, 0, 0, 0, 0377, 003, 0376, 0377, 0377, 0207, - 0376, 0377, 0377, 007 -}; - -void -LDAP_CALL -re_modw( char *s ) -{ - register int i; - - if (!s || !*s) { - for (i = 0; i < MAXCHR; i++) - if (!isinset(deftab,i)) - iswordc(i) = 0; - } - else - while(*s) - iswordc(*s++) = 1; -} - -/* - * re_subs: - * substitute the matched portions of the src in dst. - * - * & substitute the entire matched pattern. - * - * \digit substitute a subpattern, with the given tag number. - * Tags are numbered from 1 to 9. If the particular - * tagged subpattern does not exist, null is substituted. - */ -int -LDAP_CALL -re_subs( char *src, char *dst) -{ - register char c; - register int pin; - register REGEXCHAR *bp; - register REGEXCHAR *ep; - - if (!*src || !bopat[0]) - return 0; - - while ((c = *src++)) { - switch(c) { - - case '&': - pin = 0; - break; - - case '\\': - c = *src++; - if (c >= '0' && c <= '9') { - pin = c - '0'; - break; - } - - default: - *dst++ = c; - continue; - } - - if ((bp = bopat[pin]) && (ep = eopat[pin])) { - while (*bp && bp < ep) - *dst++ = *(char*)bp++; - if (bp < ep) - return 0; - } - } - *dst = (char) 0; - return 1; -} - -#ifdef DEBUG - -/* No printf or exit in 16-bit Windows */ -#if defined( _WINDOWS ) && !defined( _WIN32 ) -static int LDAP_C printf( const char* pszFormat, ...) -{ - char buf[1024]; - va_list arglist; - va_start(arglist, pszFormat); - vsprintf(buf, pszFormat, arglist); - va_end(arglist); - OutputDebugString(buf); - return 0; -} -#define exit(v) return -#endif /* 16-bit Windows */ - - -#ifdef REGEX_DEBUG - -static void nfadump( REGEXCHAR *ap); - -/* - * symbolic - produce a symbolic dump of the nfa - */ -void -symbolic( char *s ) -{ - printf("pattern: %s\n", s); - printf("nfacode:\n"); - nfadump(nfa); -} - -static void -nfadump( REGEXCHAR *ap) -{ - register int n; - - while (*ap != END) - switch(*ap++) { - case CLO: - printf("CLOSURE"); - nfadump(ap); - switch(*ap) { - case CHR: - n = CHRSKIP; - break; - case ANY: - n = ANYSKIP; - break; - case CCL: - n = CCLSKIP; - break; - } - ap += n; - break; - case CHR: - printf("\tCHR %c\n",*ap++); - break; - case ANY: - printf("\tANY .\n"); - break; - case BOL: - printf("\tBOL -\n"); - break; - case EOL: - printf("\tEOL -\n"); - break; - case BOT: - printf("BOT: %d\n",*ap++); - break; - case EOT: - printf("EOT: %d\n",*ap++); - break; - case BOW: - printf("BOW\n"); - break; - case EOW: - printf("EOW\n"); - break; - case REF: - printf("REF: %d\n",*ap++); - break; - case CCL: - printf("\tCCL ["); - for (n = 0; n < MAXCHR; n++) - if (isinset(ap,(REGEXCHAR)n)) { - if (n < ' ') - printf("^%c", n ^ 0x040); - else - printf("%c", n); - } - printf("]\n"); - ap += BITBLK; - break; - default: - printf("bad nfa. opcode %o\n", ap[-1]); - exit(1); - break; - } -} -#endif /* REGEX_DEBUG */ -#endif /* DEBUG */ -#endif /* macintosh or DOS or _WINDOWS or NEED_BSDREGEX */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/rename.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/rename.c deleted file mode 100644 index fc986e7825d..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/rename.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * rename.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -/* - * ldap_rename - initiate an ldap modifyDN operation. Parameters: - * - * ld LDAP descriptor - * dn DN of the object to modify - * newrdn RDN that will form leftmost component of entry's new name - * newparent if present, this is the Distinguished Name of the entry - * which becomes the immediate parent of the existing entry - * deleteoldrdn nonzero means to delete old rdn values from the entry - * while zero means to retain them as attributes of the entry - * serverctrls list of LDAP server controls - * clientctrls list of client controls - * msgidp this result parameter will be set to the message id of the - * request if the ldap_rename() call succeeds - * - * Example: - * int rc; - * rc = ldap_rename( ld, dn, newrdn, newparent, deleteoldrdn, serverctrls, clientctrls, &msgid ); - */ -int -LDAP_CALL -ldap_rename( - LDAP *ld, - const char *dn, - const char *newrdn, - const char *newparent, - int deleteoldrdn, - LDAPControl **serverctrls, - LDAPControl **clientctrls, /* not used for anything yet */ - int *msgidp -) -{ - BerElement *ber; - int rc, err; - - /* - * A modify dn request looks like this: - * ModifyDNRequest ::= SEQUENCE { - * entry LDAPDN, - * newrdn RelativeLDAPDN, - * newparent [0] LDAPDN OPTIONAL, - * deleteoldrdn BOOLEAN - * } - */ - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_rename\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - if ( NULL == newrdn) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - - /* only ldapv3 or higher can do a proper rename - * (i.e. with non-NULL newparent and/or controls) - */ - - if (( NSLDAPI_LDAP_VERSION( ld ) < LDAP_VERSION3 ) - && ((newparent != NULL) || (serverctrls != NULL) - || (clientctrls != NULL))) { - LDAP_SET_LDERRNO( ld, LDAP_NOT_SUPPORTED, NULL, NULL ); - return( LDAP_NOT_SUPPORTED ); - } - - if ( msgidp == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - *msgidp = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - /* see if modRDN or modDN is handled by the cache */ - if ( ld->ld_cache_on ) { - if ( newparent == NULL && ld->ld_cache_modrdn != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - if ( (rc = (ld->ld_cache_modrdn)( ld, *msgidp, - LDAP_REQ_MODRDN, dn, newrdn, deleteoldrdn )) - != 0 ) { - *msgidp = rc; - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - return( LDAP_SUCCESS ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); -#if 0 - } else if ( ld->ld_cache_rename != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - if ( (rc = (ld->ld_cache_rename)( ld, *msgidp, - LDAP_REQ_MODDN, dn, newrdn, newparent, - deleteoldrdn )) != 0 ) { - *msgidp = rc; - return( LDAP_SUCCESS ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); -#endif - } - } - - /* create a message to send */ - if (( err = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( err ); - } - - /* fill it in */ - if ( ber_printf( ber, "{it{ssb", *msgidp, LDAP_REQ_MODDN, dn, - newrdn, deleteoldrdn ) == -1 ) { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - - if ( newparent == NULL ) { - if ( ber_printf( ber, "}" ) == -1 ) { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - } else { - if ( ber_printf( ber, "ts}", LDAP_TAG_NEWSUPERIOR, newparent ) - == -1 ) { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - } - - if (( rc = nsldapi_put_controls( ld, serverctrls, 1, ber )) - != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( rc ); - } - - /* send the message */ - rc = nsldapi_send_initial_request( ld, *msgidp, LDAP_REQ_MODDN, - (char *) dn, ber ); - *msgidp = rc; - return( rc < 0 ? LDAP_GET_LDERRNO( ld, NULL, NULL ) : LDAP_SUCCESS ); -} - -int -LDAP_CALL -ldap_modrdn2( LDAP *ld, const char *dn, const char *newrdn, int deleteoldrdn ) -{ - int msgid; - - if ( ldap_rename( ld, dn, newrdn, NULL, deleteoldrdn, NULL, NULL, &msgid ) == LDAP_SUCCESS ) { - return( msgid ); - } else { - return( -1 ); /* error is in ld handle */ - } -} - -int -LDAP_CALL -ldap_modrdn( LDAP *ld, const char *dn, const char *newrdn ) -{ - return( ldap_modrdn2( ld, dn, newrdn, 1 ) ); -} - -int -LDAP_CALL -ldap_rename_s( - LDAP *ld, - const char *dn, - const char *newrdn, - const char *newparent, - int deleteoldrdn, - LDAPControl **serverctrls, - LDAPControl **clientctrls /* not used for anything yet */ -) -{ - int msgid; - LDAPMessage *res; - - if ( ldap_rename( ld, dn, newrdn, newparent, deleteoldrdn, serverctrls, clientctrls, &msgid ) != LDAP_SUCCESS ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - if ( msgid == -1 ) - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - - if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - - return( ldap_result2error( ld, res, 1 ) ); -} - -int -LDAP_CALL -ldap_modrdn2_s( LDAP *ld, const char *dn, const char *newrdn, int deleteoldrdn ) -{ - int msgid; - LDAPMessage *res; - - if ( (msgid = ldap_modrdn2( ld, dn, newrdn, deleteoldrdn )) == -1 ) - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - - if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - - return( ldap_result2error( ld, res, 1 ) ); -} - -int -LDAP_CALL -ldap_modrdn_s( LDAP *ld, const char *dn, const char *newrdn ) -{ - return( ldap_modrdn2_s( ld, dn, newrdn, 1 ) ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/request.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/request.c deleted file mode 100644 index a6ae9ca2f1b..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/request.c +++ /dev/null @@ -1,1329 +0,0 @@ -/* - * 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) 1995 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * request.c - sending of ldap requests; handling of referrals - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -static LDAPConn *find_connection( LDAP *ld, LDAPServer *srv, int any ); -static void use_connection( LDAP *ld, LDAPConn *lc ); -static void free_servers( LDAPServer *srvlist ); -static int chase_one_referral( LDAP *ld, LDAPRequest *lr, LDAPRequest *origreq, - char *refurl, char *desc, int *unknownp ); -static int re_encode_request( LDAP *ld, BerElement *origber, - int msgid, LDAPURLDesc *ludp, BerElement **berp ); - -#ifdef LDAP_DNS -static LDAPServer *dn2servers( LDAP *ld, char *dn ); -#endif /* LDAP_DNS */ - - -/* returns an LDAP error code and also sets error inside LDAP * */ -int -nsldapi_alloc_ber_with_options( LDAP *ld, BerElement **berp ) -{ - int err; - - LDAP_MUTEX_LOCK( ld, LDAP_OPTION_LOCK ); - if (( *berp = ber_alloc_t( ld->ld_lberoptions )) == NULLBER ) { - err = LDAP_NO_MEMORY; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - } else { - err = LDAP_SUCCESS; -#ifdef STR_TRANSLATION - nsldapi_set_ber_options( ld, *berp ); -#endif /* STR_TRANSLATION */ - } - LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK ); - - return( err ); -} - - -void -nsldapi_set_ber_options( LDAP *ld, BerElement *ber ) -{ - ber->ber_options = ld->ld_lberoptions; -#ifdef STR_TRANSLATION - if (( ld->ld_lberoptions & LBER_OPT_TRANSLATE_STRINGS ) != 0 ) { - ber_set_string_translators( ber, - ld->ld_lber_encode_translate_proc, - ld->ld_lber_decode_translate_proc ); - } -#endif /* STR_TRANSLATION */ -} - - -/* returns the message id of the request or -1 if an error occurs */ -int -nsldapi_send_initial_request( LDAP *ld, int msgid, unsigned long msgtype, - char *dn, BerElement *ber ) -{ - LDAPServer *servers; - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_send_initial_request\n", 0,0,0 ); - -#ifdef LDAP_DNS - LDAP_MUTEX_LOCK( ld, LDAP_OPTION_LOCK ); - if (( ld->ld_options & LDAP_BITOPT_DNS ) != 0 && ldap_is_dns_dn( dn )) { - if (( servers = dn2servers( ld, dn )) == NULL ) { - ber_free( ber, 1 ); - LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK ); - return( -1 ); - } - -#ifdef LDAP_DEBUG - if ( ldap_debug & LDAP_DEBUG_TRACE ) { - LDAPServer *srv; - char msg[256]; - - for ( srv = servers; srv != NULL; - srv = srv->lsrv_next ) { - sprintf( msg, - "LDAP server %s: dn %s, port %d\n", - srv->lsrv_host, ( srv->lsrv_dn == NULL ) ? - "(default)" : srv->lsrv_dn, - srv->lsrv_port ); - ber_err_print( msg ); - } - } -#endif /* LDAP_DEBUG */ - } else { -#endif /* LDAP_DNS */ - /* - * use of DNS is turned off or this is an LDAP DN... - * use our default connection - */ - servers = NULL; -#ifdef LDAP_DNS - } - LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK ); -#endif /* LDAP_DNS */ - - return( nsldapi_send_server_request( ld, ber, msgid, NULL, - servers, NULL, ( msgtype == LDAP_REQ_BIND ) ? dn : NULL, 0 )); -} - - -/* returns the message id of the request or -1 if an error occurs */ -int -nsldapi_send_server_request( - LDAP *ld, /* session handle */ - BerElement *ber, /* message to send */ - int msgid, /* ID of message to send */ - LDAPRequest *parentreq, /* non-NULL for referred requests */ - LDAPServer *srvlist, /* servers to connect to (NULL for default) */ - LDAPConn *lc, /* connection to use (NULL for default) */ - char *bindreqdn, /* non-NULL for bind requests */ - int bind /* perform a bind after opening new conn.? */ -) -{ - LDAPRequest *lr; - int err; - int incparent; /* did we bump parent's ref count? */ - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_send_server_request\n", 0, 0, 0 ); - - incparent = 0; - LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK ); - if ( lc == NULL ) { - if ( srvlist == NULL ) { - if ( ld->ld_defconn == NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_OPTION_LOCK ); - if ( bindreqdn == NULL && ( ld->ld_options - & LDAP_BITOPT_RECONNECT ) != 0 ) { - LDAP_SET_LDERRNO( ld, LDAP_SERVER_DOWN, - NULL, NULL ); - ber_free( ber, 1 ); - LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - return( -1 ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK ); - - if ( nsldapi_open_ldap_defconn( ld ) < 0 ) { - ber_free( ber, 1 ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - return( -1 ); - } - } - lc = ld->ld_defconn; - } else { - if (( lc = find_connection( ld, srvlist, 1 )) == - NULL ) { - if ( bind && (parentreq != NULL) ) { - /* Remember the bind in the parent */ - incparent = 1; - ++parentreq->lr_outrefcnt; - } - - lc = nsldapi_new_connection( ld, &srvlist, 0, - 1, bind ); - } - free_servers( srvlist ); - } - } - - - /* - * the logic here is: - * if - * 1. no connections exists, - * or - * 2. if the connection is either not in the connected - * or connecting state in an async io model - * or - * 3. the connection is notin a connected state with normal (non async io) - */ - if ( lc == NULL - || ( (ld->ld_options & LDAP_BITOPT_ASYNC - && lc->lconn_status != LDAP_CONNST_CONNECTING - && lc->lconn_status != LDAP_CONNST_CONNECTED) - || (!(ld->ld_options & LDAP_BITOPT_ASYNC ) - && lc->lconn_status != LDAP_CONNST_CONNECTED) ) ) { - - ber_free( ber, 1 ); - if ( lc != NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_SERVER_DOWN, NULL, NULL ); - } - if ( incparent ) { - /* Forget about the bind */ - --parentreq->lr_outrefcnt; - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - return( -1 ); - } - - use_connection( ld, lc ); - if (( lr = (LDAPRequest *)NSLDAPI_CALLOC( 1, sizeof( LDAPRequest ))) == - NULL || ( bindreqdn != NULL && ( bindreqdn = - nsldapi_strdup( bindreqdn )) == NULL )) { - if ( lr != NULL ) { - NSLDAPI_FREE( lr ); - } - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - nsldapi_free_connection( ld, lc, NULL, NULL, 0, 0 ); - ber_free( ber, 1 ); - if ( incparent ) { - /* Forget about the bind */ - --parentreq->lr_outrefcnt; - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - return( -1 ); - } - lr->lr_binddn = bindreqdn; - lr->lr_msgid = msgid; - lr->lr_status = LDAP_REQST_INPROGRESS; - lr->lr_res_errno = LDAP_SUCCESS; /* optimistic */ - lr->lr_ber = ber; - lr->lr_conn = lc; - - if ( parentreq != NULL ) { /* sub-request */ - if ( !incparent ) { - /* Increment if we didn't do it before the bind */ - ++parentreq->lr_outrefcnt; - } - lr->lr_origid = parentreq->lr_origid; - lr->lr_parentcnt = parentreq->lr_parentcnt + 1; - lr->lr_parent = parentreq; - if ( parentreq->lr_child != NULL ) { - lr->lr_sibling = parentreq->lr_child; - } - parentreq->lr_child = lr; - } else { /* original request */ - lr->lr_origid = lr->lr_msgid; - } - - LDAP_MUTEX_LOCK( ld, LDAP_REQ_LOCK ); - if (( lr->lr_next = ld->ld_requests ) != NULL ) { - lr->lr_next->lr_prev = lr; - } - ld->ld_requests = lr; - lr->lr_prev = NULL; - - if (( err = nsldapi_ber_flush( ld, lc->lconn_sb, ber, 0, 1 )) != 0 ) { - - /* need to continue write later */ - if (ld->ld_options & LDAP_BITOPT_ASYNC && err == -2 ) { - lr->lr_status = LDAP_REQST_WRITING; - nsldapi_iostatus_interest_write( ld, lc->lconn_sb ); - } else { - - LDAP_SET_LDERRNO( ld, LDAP_SERVER_DOWN, NULL, NULL ); - nsldapi_free_request( ld, lr, 0 ); - nsldapi_free_connection( ld, lc, NULL, NULL, 0, 0 ); - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - return( -1 ); - } - - } else { - if ( parentreq == NULL ) { - ber->ber_end = ber->ber_ptr; - ber->ber_ptr = ber->ber_buf; - } - - /* sent -- waiting for a response */ - if (ld->ld_options & LDAP_BITOPT_ASYNC) { - lc->lconn_status = LDAP_CONNST_CONNECTED; - } - - nsldapi_iostatus_interest_read( ld, lc->lconn_sb ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - - LDAP_SET_LDERRNO( ld, LDAP_SUCCESS, NULL, NULL ); - return( msgid ); -} - - -/* - * returns -1 if a fatal error occurs. If async is non-zero and the flush - * would block, -2 is returned. - */ -int -nsldapi_ber_flush( LDAP *ld, Sockbuf *sb, BerElement *ber, int freeit, - int async ) -{ - int terrno; - - for ( ;; ) { - /* - * ber_flush() doesn't set errno on EOF, so we pre-set it to - * zero to avoid getting tricked by leftover "EAGAIN" errors - */ - LDAP_SET_ERRNO( ld, 0 ); - - if ( ber_flush( sb, ber, freeit ) == 0 ) { - return( 0 ); /* success */ - } - - terrno = LDAP_GET_ERRNO( ld ); - - if (ld->ld_options & LDAP_BITOPT_ASYNC) { - if ( terrno != 0 && !NSLDAPI_ERRNO_IO_INPROGRESS( terrno )) { - nsldapi_connection_lost_nolock( ld, sb ); - return( -1 ); /* fatal error */ - } - } - else if ( !NSLDAPI_ERRNO_IO_INPROGRESS( terrno )) { - - nsldapi_connection_lost_nolock( ld, sb ); - return( -1 ); /* fatal error */ - } - - if ( async ) { - return( -2 ); /* would block */ - } - } -} - -LDAPConn * -nsldapi_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb, - int connect, int bind ) -{ - int rc; - - LDAPConn *lc; - LDAPServer *prevsrv, *srv; - Sockbuf *sb = NULL; - - /* - * make a new LDAP server connection - */ - if (( lc = (LDAPConn *)NSLDAPI_CALLOC( 1, sizeof( LDAPConn ))) == NULL - || ( !use_ldsb && ( sb = ber_sockbuf_alloc()) == NULL )) { - if ( lc != NULL ) { - NSLDAPI_FREE( (char *)lc ); - } - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( NULL ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_OPTION_LOCK ); - if ( !use_ldsb ) { - /* - * we have allocated a new sockbuf - * set I/O routines to match those in default LDAP sockbuf - */ - IFP sb_fn; - struct lber_x_ext_io_fns extiofns; - - extiofns.lbextiofn_size = LBER_X_EXTIO_FNS_SIZE; - - if ( ber_sockbuf_get_option( ld->ld_sbp, - LBER_SOCKBUF_OPT_EXT_IO_FNS, &extiofns ) == 0 ) { - ber_sockbuf_set_option( sb, - LBER_SOCKBUF_OPT_EXT_IO_FNS, &extiofns ); - } - if ( ber_sockbuf_get_option( ld->ld_sbp, - LBER_SOCKBUF_OPT_READ_FN, (void *)&sb_fn ) == 0 - && sb_fn != NULL ) { - ber_sockbuf_set_option( sb, LBER_SOCKBUF_OPT_READ_FN, - (void *)sb_fn ); - } - if ( ber_sockbuf_get_option( ld->ld_sbp, - LBER_SOCKBUF_OPT_WRITE_FN, (void *)&sb_fn ) == 0 - && sb_fn != NULL ) { - ber_sockbuf_set_option( sb, LBER_SOCKBUF_OPT_WRITE_FN, - (void *)sb_fn ); - } - } - - lc->lconn_sb = ( use_ldsb ) ? ld->ld_sbp : sb; - lc->lconn_version = ld->ld_version; /* inherited */ - LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK ); - - if ( connect ) { - prevsrv = NULL; - /* - * save the return code for later - */ - for ( srv = *srvlistp; srv != NULL; srv = srv->lsrv_next ) { - rc = nsldapi_connect_to_host( ld, lc->lconn_sb, - srv->lsrv_host, srv->lsrv_port, - ( srv->lsrv_options & LDAP_SRV_OPT_SECURE ) != 0, - &lc->lconn_krbinstance ); - if (rc != -1) { - break; - } - prevsrv = srv; - } - - if ( srv == NULL ) { - if ( !use_ldsb ) { - NSLDAPI_FREE( (char *)lc->lconn_sb ); - } - NSLDAPI_FREE( (char *)lc ); - /* nsldapi_open_ldap_connection has already set ld_errno */ - return( NULL ); - } - - if ( prevsrv == NULL ) { - *srvlistp = srv->lsrv_next; - } else { - prevsrv->lsrv_next = srv->lsrv_next; - } - lc->lconn_server = srv; - } - - if (ld->ld_options & LDAP_BITOPT_ASYNC && rc == -2) - { - lc->lconn_status = LDAP_CONNST_CONNECTING; - } - else { - lc->lconn_status = LDAP_CONNST_CONNECTED; - } - - lc->lconn_next = ld->ld_conns; - ld->ld_conns = lc; - - /* - * XXX for now, we always do a synchronous bind. This will have - * to change in the long run... - */ - if ( bind ) { - int err, lderr, freepasswd, authmethod; - char *binddn, *passwd; - LDAPConn *savedefconn; - - freepasswd = err = 0; - - if ( ld->ld_rebind_fn == NULL ) { - binddn = passwd = ""; - authmethod = LDAP_AUTH_SIMPLE; - } else { - if (( lderr = (*ld->ld_rebind_fn)( ld, &binddn, &passwd, - &authmethod, 0, ld->ld_rebind_arg )) - == LDAP_SUCCESS ) { - freepasswd = 1; - } else { - LDAP_SET_LDERRNO( ld, lderr, NULL, NULL ); - err = -1; - } - } - - - if ( err == 0 ) { - savedefconn = ld->ld_defconn; - ld->ld_defconn = lc; - ++lc->lconn_refcnt; /* avoid premature free */ - - /* - * when binding, we will back down as low as LDAPv2 - * if we get back "protocol error" from bind attempts - */ - for ( ;; ) { - /* LDAP_MUTEX_UNLOCK(ld, LDAP_CONN_LOCK); */ - if (( lderr = ldap_bind_s( ld, binddn, passwd, - authmethod )) == LDAP_SUCCESS ) { - /* LDAP_MUTEX_LOCK(ld, LDAP_CONN_LOCK); */ - break; - } - /* LDAP_MUTEX_LOCK(ld, LDAP_CONN_LOCK); */ - if ( lc->lconn_version <= LDAP_VERSION2 - || lderr != LDAP_PROTOCOL_ERROR ) { - err = -1; - break; - } - --lc->lconn_version; /* try lower version */ - } - --lc->lconn_refcnt; - ld->ld_defconn = savedefconn; - } - - if ( freepasswd ) { - (*ld->ld_rebind_fn)( ld, &binddn, &passwd, - &authmethod, 1, ld->ld_rebind_arg ); - } - - if ( err != 0 ) { - nsldapi_free_connection( ld, lc, NULL, NULL, 1, 0 ); - lc = NULL; - } - } - - return( lc ); -} - - -#define LDAP_CONN_SAMEHOST( h1, h2 ) \ - (( (h1) == NULL && (h2) == NULL ) || \ - ( (h1) != NULL && (h2) != NULL && strcasecmp( (h1), (h2) ) == 0 )) - -static LDAPConn * -find_connection( LDAP *ld, LDAPServer *srv, int any ) -/* - * return an existing connection (if any) to the server srv - * if "any" is non-zero, check for any server in the "srv" chain - */ -{ - LDAPConn *lc; - LDAPServer *ls; - - for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) { - for ( ls = srv; ls != NULL; ls = ls->lsrv_next ) { - if ( LDAP_CONN_SAMEHOST( ls->lsrv_host, - lc->lconn_server->lsrv_host ) - && ls->lsrv_port == lc->lconn_server->lsrv_port - && ls->lsrv_options == - lc->lconn_server->lsrv_options ) { - return( lc ); - } - if ( !any ) { - break; - } - } - } - - return( NULL ); -} - - - -static void -use_connection( LDAP *ld, LDAPConn *lc ) -{ - ++lc->lconn_refcnt; - lc->lconn_lastused = time( 0 ); -} - - -void -nsldapi_free_connection( LDAP *ld, LDAPConn *lc, LDAPControl **serverctrls, - LDAPControl **clientctrls, int force, int unbind ) -{ - LDAPConn *tmplc, *prevlc; - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_free_connection\n", 0, 0, 0 ); - - if ( force || --lc->lconn_refcnt <= 0 ) { - if ( lc->lconn_status == LDAP_CONNST_CONNECTED ) { - nsldapi_iostatus_interest_clear( ld, lc->lconn_sb ); - if ( unbind ) { - nsldapi_send_unbind( ld, lc->lconn_sb, - serverctrls, clientctrls ); - } - } - nsldapi_close_connection( ld, lc->lconn_sb ); - prevlc = NULL; - for ( tmplc = ld->ld_conns; tmplc != NULL; - tmplc = tmplc->lconn_next ) { - if ( tmplc == lc ) { - if ( prevlc == NULL ) { - ld->ld_conns = tmplc->lconn_next; - } else { - prevlc->lconn_next = tmplc->lconn_next; - } - break; - } - prevlc = tmplc; - } - free_servers( lc->lconn_server ); - if ( lc->lconn_krbinstance != NULL ) { - NSLDAPI_FREE( lc->lconn_krbinstance ); - } - /* - * if this is the default connection (lc->lconn_sb==ld->ld_sbp) - * we do not free the Sockbuf here since it will be freed - * later inside ldap_unbind(). - */ - if ( lc->lconn_sb != ld->ld_sbp ) { - ber_sockbuf_free( lc->lconn_sb ); - lc->lconn_sb = NULL; - } - if ( lc->lconn_ber != NULLBER ) { - ber_free( lc->lconn_ber, 1 ); - } - if ( lc->lconn_binddn != NULL ) { - NSLDAPI_FREE( lc->lconn_binddn ); - } - NSLDAPI_FREE( lc ); - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_free_connection: actually freed\n", - 0, 0, 0 ); - } else { - lc->lconn_lastused = time( 0 ); - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_free_connection: refcnt %d\n", - lc->lconn_refcnt, 0, 0 ); - } -} - - -#ifdef LDAP_DEBUG -void -nsldapi_dump_connection( LDAP *ld, LDAPConn *lconns, int all ) -{ - LDAPConn *lc; - char msg[256]; -/* CTIME for this platform doesn't use this. */ -#if !defined(SUNOS4) && !defined(_WIN32) && !defined(LINUX) - char buf[26]; -#endif - - sprintf( msg, "** Connection%s:\n", all ? "s" : "" ); - ber_err_print( msg ); - for ( lc = lconns; lc != NULL; lc = lc->lconn_next ) { - if ( lc->lconn_server != NULL ) { - sprintf( msg, "* host: %s port: %d secure: %s%s\n", - ( lc->lconn_server->lsrv_host == NULL ) ? "(null)" - : lc->lconn_server->lsrv_host, - lc->lconn_server->lsrv_port, - ( lc->lconn_server->lsrv_options & - LDAP_SRV_OPT_SECURE ) ? "Yes" : - "No", ( lc->lconn_sb == ld->ld_sbp ) ? - " (default)" : "" ); - ber_err_print( msg ); - } - sprintf( msg, " refcnt: %d status: %s\n", lc->lconn_refcnt, - ( lc->lconn_status == LDAP_CONNST_NEEDSOCKET ) ? - "NeedSocket" : ( lc->lconn_status == - LDAP_CONNST_CONNECTING ) ? "Connecting" : - ( lc->lconn_status == LDAP_CONNST_DEAD ) ? "Dead" : - "Connected" ); - ber_err_print( msg ); - sprintf( msg, " last used: %s", - NSLDAPI_CTIME( (time_t *) &lc->lconn_lastused, buf, - sizeof(buf) )); - ber_err_print( msg ); - if ( lc->lconn_ber != NULLBER ) { - ber_err_print( " partial response has been received:\n" ); - ber_dump( lc->lconn_ber, 1 ); - } - ber_err_print( "\n" ); - - if ( !all ) { - break; - } - } -} - - -void -nsldapi_dump_requests_and_responses( LDAP *ld ) -{ - LDAPRequest *lr; - LDAPMessage *lm, *l; - char msg[256]; - - ber_err_print( "** Outstanding Requests:\n" ); - LDAP_MUTEX_LOCK( ld, LDAP_REQ_LOCK ); - if (( lr = ld->ld_requests ) == NULL ) { - ber_err_print( " Empty\n" ); - } - for ( ; lr != NULL; lr = lr->lr_next ) { - sprintf( msg, " * msgid %d, origid %d, status %s\n", - lr->lr_msgid, lr->lr_origid, ( lr->lr_status == - LDAP_REQST_INPROGRESS ) ? "InProgress" : - ( lr->lr_status == LDAP_REQST_CHASINGREFS ) ? "ChasingRefs" : - ( lr->lr_status == LDAP_REQST_NOTCONNECTED ) ? "NotConnected" : - ( lr->lr_status == LDAP_REQST_CONNDEAD ) ? "Dead" : - "Writing" ); - ber_err_print( msg ); - sprintf( msg, " outstanding referrals %d, parent count %d\n", - lr->lr_outrefcnt, lr->lr_parentcnt ); - ber_err_print( msg ); - if ( lr->lr_binddn != NULL ) { - sprintf( msg, " pending bind DN: <%s>\n", lr->lr_binddn ); - ber_err_print( msg ); - } - } - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - - ber_err_print( "** Response Queue:\n" ); - LDAP_MUTEX_LOCK( ld, LDAP_RESP_LOCK ); - if (( lm = ld->ld_responses ) == NULLMSG ) { - ber_err_print( " Empty\n" ); - } - for ( ; lm != NULLMSG; lm = lm->lm_next ) { - sprintf( msg, " * msgid %d, type %d\n", - lm->lm_msgid, lm->lm_msgtype ); - ber_err_print( msg ); - if (( l = lm->lm_chain ) != NULL ) { - ber_err_print( " chained responses:\n" ); - for ( ; l != NULLMSG; l = l->lm_chain ) { - sprintf( msg, - " * msgid %d, type %d\n", - l->lm_msgid, l->lm_msgtype ); - ber_err_print( msg ); - } - } - } - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); -} -#endif /* LDAP_DEBUG */ - - -void -nsldapi_free_request( LDAP *ld, LDAPRequest *lr, int free_conn ) -{ - LDAPRequest *tmplr, *nextlr; - - LDAPDebug( LDAP_DEBUG_TRACE, - "nsldapi_free_request 0x%x (origid %d, msgid %d)\n", - lr, lr->lr_origid, lr->lr_msgid ); - - if ( lr->lr_parent != NULL ) { - --lr->lr_parent->lr_outrefcnt; - } - - /* free all of our spawned referrals (child requests) */ - for ( tmplr = lr->lr_child; tmplr != NULL; tmplr = nextlr ) { - nextlr = tmplr->lr_sibling; - nsldapi_free_request( ld, tmplr, free_conn ); - } - - if ( free_conn ) { - nsldapi_free_connection( ld, lr->lr_conn, NULL, NULL, 0, 1 ); - } - - if ( lr->lr_prev == NULL ) { - ld->ld_requests = lr->lr_next; - } else { - lr->lr_prev->lr_next = lr->lr_next; - } - - if ( lr->lr_next != NULL ) { - lr->lr_next->lr_prev = lr->lr_prev; - } - - if ( lr->lr_ber != NULL ) { - ber_free( lr->lr_ber, 1 ); - } - - if ( lr->lr_res_error != NULL ) { - NSLDAPI_FREE( lr->lr_res_error ); - } - - if ( lr->lr_res_matched != NULL ) { - NSLDAPI_FREE( lr->lr_res_matched ); - } - - if ( lr->lr_binddn != NULL ) { - NSLDAPI_FREE( lr->lr_binddn ); - } - NSLDAPI_FREE( lr ); -} - - -static void -free_servers( LDAPServer *srvlist ) -{ - LDAPServer *nextsrv; - - while ( srvlist != NULL ) { - nextsrv = srvlist->lsrv_next; - if ( srvlist->lsrv_dn != NULL ) { - NSLDAPI_FREE( srvlist->lsrv_dn ); - } - if ( srvlist->lsrv_host != NULL ) { - NSLDAPI_FREE( srvlist->lsrv_host ); - } - NSLDAPI_FREE( srvlist ); - srvlist = nextsrv; - } -} - - -/* - * Initiate chasing of LDAPv2+ (Umich extension) referrals. - * - * Returns an LDAP error code. - * - * Note that *hadrefp will be set to 1 if one or more referrals were found in - * "*errstrp" (even if we can't chase them) and zero if none were found. - * - * XXX merging of errors in this routine needs to be improved. - */ -int -nsldapi_chase_v2_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, - int *totalcountp, int *chasingcountp ) -{ - char *p, *ref, *unfollowed; - LDAPRequest *origreq; - int rc, tmprc, len, unknown; - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_chase_v2_referrals\n", 0, 0, 0 ); - - *totalcountp = *chasingcountp = 0; - - if ( *errstrp == NULL ) { - return( LDAP_SUCCESS ); - } - - len = strlen( *errstrp ); - for ( p = *errstrp; len >= LDAP_REF_STR_LEN; ++p, --len ) { - if (( *p == 'R' || *p == 'r' ) && strncasecmp( p, - LDAP_REF_STR, LDAP_REF_STR_LEN ) == 0 ) { - *p = '\0'; - p += LDAP_REF_STR_LEN; - break; - } - } - - if ( len < LDAP_REF_STR_LEN ) { - return( LDAP_SUCCESS ); - } - - if ( lr->lr_parentcnt >= ld->ld_refhoplimit ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "more than %d referral hops (dropping)\n", - ld->ld_refhoplimit, 0, 0 ); - return( LDAP_REFERRAL_LIMIT_EXCEEDED ); - } - - /* find original request */ - for ( origreq = lr; origreq->lr_parent != NULL; - origreq = origreq->lr_parent ) { - ; - } - - unfollowed = NULL; - rc = LDAP_SUCCESS; - - /* parse out & follow referrals */ - for ( ref = p; rc == LDAP_SUCCESS && ref != NULL; ref = p ) { - if (( p = strchr( ref, '\n' )) != NULL ) { - *p++ = '\0'; - } else { - p = NULL; - } - - ++*totalcountp; - - rc = chase_one_referral( ld, lr, origreq, ref, "v2 referral", - &unknown ); - - if ( rc != LDAP_SUCCESS || unknown ) { - if (( tmprc = nsldapi_append_referral( ld, &unfollowed, - ref )) != LDAP_SUCCESS ) { - rc = tmprc; - } - } else { - ++*chasingcountp; - } - } - - NSLDAPI_FREE( *errstrp ); - *errstrp = unfollowed; - - return( rc ); -} - - -/* returns an LDAP error code */ -int -nsldapi_chase_v3_refs( LDAP *ld, LDAPRequest *lr, char **v3refs, - int is_reference, int *totalcountp, int *chasingcountp ) -{ - int i, rc, unknown; - LDAPRequest *origreq; - - *totalcountp = *chasingcountp = 0; - - if ( v3refs == NULL || v3refs[0] == NULL ) { - return( LDAP_SUCCESS ); - } - - *totalcountp = 1; - - if ( lr->lr_parentcnt >= ld->ld_refhoplimit ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "more than %d referral hops (dropping)\n", - ld->ld_refhoplimit, 0, 0 ); - return( LDAP_REFERRAL_LIMIT_EXCEEDED ); - } - - /* find original request */ - for ( origreq = lr; origreq->lr_parent != NULL; - origreq = origreq->lr_parent ) { - ; - } - - /* - * in LDAPv3, we just need to follow one referral in the set. - * we dp this by stopping as soon as we succeed in initiating a - * chase on any referral (basically this means we were able to connect - * to the server and bind). - */ - for ( i = 0; v3refs[i] != NULL; ++i ) { - rc = chase_one_referral( ld, lr, origreq, v3refs[i], - is_reference ? "v3 reference" : "v3 referral", &unknown ); - if ( rc == LDAP_SUCCESS && !unknown ) { - *chasingcountp = 1; - break; - } - } - - /* XXXmcs: should we save unfollowed referrals somewhere? */ - - return( rc ); /* last error is as good as any other I guess... */ -} - - -/* - * returns an LDAP error code - * - * XXXmcs: this function used to have #ifdef LDAP_DNS code in it but I - * removed it when I improved the parsing (we don't define LDAP_DNS - * here at Netscape). - */ -static int -chase_one_referral( LDAP *ld, LDAPRequest *lr, LDAPRequest *origreq, - char *refurl, char *desc, int *unknownp ) -{ - int rc, tmprc, secure, msgid; - LDAPServer *srv; - BerElement *ber; - LDAPURLDesc *ludp; - - *unknownp = 0; - ludp = NULLLDAPURLDESC; - - if ( nsldapi_url_parse( refurl, &ludp, 0 ) != 0 ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "ignoring unknown %s <%s>\n", desc, refurl, 0 ); - *unknownp = 1; - rc = LDAP_SUCCESS; - goto cleanup_and_return; - } - - secure = (( ludp->lud_options & LDAP_URL_OPT_SECURE ) != 0 ); - -/* XXXmcs: can't tell if secure is supported by connect callback */ - if ( secure && ld->ld_extconnect_fn == NULL ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "ignoring LDAPS %s <%s>\n", desc, refurl, 0 ); - *unknownp = 1; - rc = LDAP_SUCCESS; - goto cleanup_and_return; - } - - LDAPDebug( LDAP_DEBUG_TRACE, "chasing LDAP%s %s: <%s>\n", - secure ? "S" : "", desc, refurl ); - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - msgid = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - if (( tmprc = re_encode_request( ld, origreq->lr_ber, msgid, - ludp, &ber )) != LDAP_SUCCESS ) { - rc = tmprc; - goto cleanup_and_return; - } - - if (( srv = (LDAPServer *)NSLDAPI_CALLOC( 1, sizeof( LDAPServer ))) - == NULL ) { - ber_free( ber, 1 ); - rc = LDAP_NO_MEMORY; - goto cleanup_and_return; - } - - if ( ludp->lud_host == NULL && ld->ld_defhost == NULL ) { - srv->lsrv_host = NULL; - } else { - if ( ludp->lud_host == NULL ) { - srv->lsrv_host = - nsldapi_strdup( origreq->lr_conn->lconn_server->lsrv_host ); - LDAPDebug( LDAP_DEBUG_TRACE, - "chase_one_referral: using hostname '%s' from original " - "request on new request\n", - srv->lsrv_host, 0, 0); - } else { - srv->lsrv_host = nsldapi_strdup( ludp->lud_host ); - LDAPDebug( LDAP_DEBUG_TRACE, - "chase_one_referral: using hostname '%s' as specified " - "on new request\n", - srv->lsrv_host, 0, 0); - } - - if ( srv->lsrv_host == NULL ) { - NSLDAPI_FREE( (char *)srv ); - ber_free( ber, 1 ); - rc = LDAP_NO_MEMORY; - goto cleanup_and_return; - } - } - - if ( ludp->lud_port == 0 && ludp->lud_host == NULL ) { - srv->lsrv_port = origreq->lr_conn->lconn_server->lsrv_port; - LDAPDebug( LDAP_DEBUG_TRACE, - "chase_one_referral: using port (%d) from original " - "request on new request\n", - srv->lsrv_port, 0, 0); - } else { - srv->lsrv_port = ludp->lud_port; - LDAPDebug( LDAP_DEBUG_TRACE, - "chase_one_referral: using port (%d) as specified on " - "new request\n", - srv->lsrv_port, 0, 0); - } - - if ( secure ) { - srv->lsrv_options |= LDAP_SRV_OPT_SECURE; - } - - if ( nsldapi_send_server_request( ld, ber, msgid, - lr, srv, NULL, NULL, 1 ) < 0 ) { - rc = LDAP_GET_LDERRNO( ld, NULL, NULL ); - LDAPDebug( LDAP_DEBUG_ANY, "Unable to chase %s %s (%s)\n", - desc, refurl, ldap_err2string( rc )); - } else { - rc = LDAP_SUCCESS; - } - -cleanup_and_return: - if ( ludp != NULLLDAPURLDESC ) { - ldap_free_urldesc( ludp ); - } - - return( rc ); -} - - -/* returns an LDAP error code */ -int -nsldapi_append_referral( LDAP *ld, char **referralsp, char *s ) -{ - int first; - - if ( *referralsp == NULL ) { - first = 1; - *referralsp = (char *)NSLDAPI_MALLOC( strlen( s ) + - LDAP_REF_STR_LEN + 1 ); - } else { - first = 0; - *referralsp = (char *)NSLDAPI_REALLOC( *referralsp, - strlen( *referralsp ) + strlen( s ) + 2 ); - } - - if ( *referralsp == NULL ) { - return( LDAP_NO_MEMORY ); - } - - if ( first ) { - strcpy( *referralsp, LDAP_REF_STR ); - } else { - strcat( *referralsp, "\n" ); - } - strcat( *referralsp, s ); - - return( LDAP_SUCCESS ); -} - - - -/* returns an LDAP error code */ -static int -re_encode_request( LDAP *ld, BerElement *origber, int msgid, LDAPURLDesc *ludp, - BerElement **berp ) -{ -/* - * XXX this routine knows way too much about how the lber library works! - */ - unsigned long along, tag; - long ver; - int rc; - BerElement *ber; - struct berelement tmpber; - char *dn, *orig_dn; - - LDAPDebug( LDAP_DEBUG_TRACE, - "re_encode_request: new msgid %d, new dn <%s>\n", - msgid, ( ludp->lud_dn == NULL ) ? "NONE" : ludp->lud_dn, 0 ); - - tmpber = *origber; - - /* - * All LDAP requests are sequences that start with a message id. For - * everything except delete requests, this is followed by a sequence - * that is tagged with the operation code. For deletes, there is just - * a DN that is tagged with the operation code. - */ - - /* skip past msgid and get operation tag */ - if ( ber_scanf( &tmpber, "{it", &along, &tag ) == LBER_ERROR ) { - return( LDAP_DECODING_ERROR ); - } - - /* - * XXXmcs: we don't support scope or filters in search referrals yet, - * so if either were present we return an error which is probably - * better than just ignoring the extra info. - */ - if ( tag == LDAP_REQ_SEARCH && - ( ludp->lud_scope != -1 || ludp->lud_filter != NULL )) { - return( LDAP_LOCAL_ERROR ); - } - - if ( tag == LDAP_REQ_BIND ) { - /* bind requests have a version number before the DN */ - rc = ber_scanf( &tmpber, "{ia", &ver, &orig_dn ); - } else if ( tag == LDAP_REQ_DELETE ) { - /* delete requests DNs are not within a sequence */ - rc = ber_scanf( &tmpber, "a", &orig_dn ); - } else { - rc = ber_scanf( &tmpber, "{a", &orig_dn ); - } - - if ( rc == LBER_ERROR ) { - return( LDAP_DECODING_ERROR ); - } - - if ( ludp->lud_dn == NULL ) { - dn = orig_dn; - } else { - dn = ludp->lud_dn; - NSLDAPI_FREE( orig_dn ); - orig_dn = NULL; - } - - /* allocate and build the new request */ - if (( rc = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - if ( orig_dn != NULL ) { - NSLDAPI_FREE( orig_dn ); - } - return( rc ); - } - - if ( tag == LDAP_REQ_BIND ) { - rc = ber_printf( ber, "{it{is", msgid, tag, - (int)ver /* XXX lossy cast */, dn ); - } else if ( tag == LDAP_REQ_DELETE ) { - rc = ber_printf( ber, "{its}", msgid, tag, dn ); - } else { - rc = ber_printf( ber, "{it{s", msgid, tag, dn ); - } - - if ( orig_dn != NULL ) { - NSLDAPI_FREE( orig_dn ); - } -/* - * can't use "dn" or "orig_dn" from this point on (they've been freed) - */ - - if ( rc == -1 ) { - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - - if ( tag != LDAP_REQ_DELETE && - ( ber_write( ber, tmpber.ber_ptr, ( tmpber.ber_end - - tmpber.ber_ptr ), 0 ) != ( tmpber.ber_end - tmpber.ber_ptr ) - || ber_printf( ber, "}}" ) == -1 )) { - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - -#ifdef LDAP_DEBUG - if ( ldap_debug & LDAP_DEBUG_PACKETS ) { - LDAPDebug( LDAP_DEBUG_ANY, "re_encode_request new request is:\n", - 0, 0, 0 ); - ber_dump( ber, 0 ); - } -#endif /* LDAP_DEBUG */ - - *berp = ber; - return( LDAP_SUCCESS ); -} - - -LDAPRequest * -nsldapi_find_request_by_msgid( LDAP *ld, int msgid ) -{ - LDAPRequest *lr; - - for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) { - if ( msgid == lr->lr_msgid ) { - break; - } - } - - return( lr ); -} - - -/* - * nsldapi_connection_lost_nolock() resets "ld" to a non-connected, known - * state. It should be called whenever a fatal error occurs on the - * Sockbuf "sb." sb == NULL means we don't know specifically where - * the problem was so we assume all connections are bad. - */ -void -nsldapi_connection_lost_nolock( LDAP *ld, Sockbuf *sb ) -{ - LDAPRequest *lr; - - /* - * change status of all pending requests that are associated with "sb - * to "connection dead." - * also change the connection status to "dead" and remove it from - * the list of sockets we are interested in. - */ - for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) { - if ( sb == NULL || - ( lr->lr_conn != NULL && lr->lr_conn->lconn_sb == sb )) { - lr->lr_status = LDAP_REQST_CONNDEAD; - if ( lr->lr_conn != NULL ) { - lr->lr_conn->lconn_status = LDAP_CONNST_DEAD; - nsldapi_iostatus_interest_clear( ld, - lr->lr_conn->lconn_sb ); - } - } - } -} - - -#ifdef LDAP_DNS -static LDAPServer * -dn2servers( LDAP *ld, char *dn ) /* dn can also be a domain.... */ -{ - char *p, *domain, *host, *server_dn, **dxs; - int i, port; - LDAPServer *srvlist, *prevsrv, *srv; - - if (( domain = strrchr( dn, '@' )) != NULL ) { - ++domain; - } else { - domain = dn; - } - - if (( dxs = nsldapi_getdxbyname( domain )) == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( NULL ); - } - - srvlist = NULL; - - for ( i = 0; dxs[ i ] != NULL; ++i ) { - port = LDAP_PORT; - server_dn = NULL; - if ( strchr( dxs[ i ], ':' ) == NULL ) { - host = dxs[ i ]; - } else if ( strlen( dxs[ i ] ) >= 7 && - strncmp( dxs[ i ], "ldap://", 7 ) == 0 ) { - host = dxs[ i ] + 7; - if (( p = strchr( host, ':' )) == NULL ) { - p = host; - } else { - *p++ = '\0'; - port = atoi( p ); - } - if (( p = strchr( p, '/' )) != NULL ) { - server_dn = ++p; - if ( *server_dn == '\0' ) { - server_dn = NULL; - } - } - } else { - host = NULL; - } - - if ( host != NULL ) { /* found a server we can use */ - if (( srv = (LDAPServer *)NSLDAPI_CALLOC( 1, - sizeof( LDAPServer ))) == NULL ) { - free_servers( srvlist ); - srvlist = NULL; - break; /* exit loop & return */ - } - - /* add to end of list of servers */ - if ( srvlist == NULL ) { - srvlist = srv; - } else { - prevsrv->lsrv_next = srv; - } - prevsrv = srv; - - /* copy in info. */ - if (( srv->lsrv_host = nsldapi_strdup( host )) == NULL - || ( server_dn != NULL && ( srv->lsrv_dn = - nsldapi_strdup( server_dn )) == NULL )) { - free_servers( srvlist ); - srvlist = NULL; - break; /* exit loop & return */ - } - srv->lsrv_port = port; - } - } - - ldap_value_free( dxs ); - - if ( srvlist == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_SERVER_DOWN, NULL, NULL ); - } - - return( srvlist ); -} -#endif /* LDAP_DNS */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/reslist.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/reslist.c deleted file mode 100644 index e5c6051b2c5..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/reslist.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * reslist.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -LDAPMessage * -ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e ) -{ - LDAPMessage *tmp, *prev = NULL; - - for ( tmp = *list; tmp != NULL && tmp != e; tmp = tmp->lm_chain ) - prev = tmp; - - if ( tmp == NULL ) - return( NULL ); - - if ( prev == NULL ) - *list = tmp->lm_chain; - else - prev->lm_chain = tmp->lm_chain; - tmp->lm_chain = NULL; - - return( tmp ); -} - -void -ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e ) -{ - e->lm_chain = *list; - *list = e; -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/result.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/result.c deleted file mode 100644 index 4a5aa090832..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/result.c +++ /dev/null @@ -1,1443 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * result.c - wait for an ldap result - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -static int check_response_queue( LDAP *ld, int msgid, int all, - int do_abandon_check, LDAPMessage **result ); -static int ldap_abandoned( LDAP *ld, int msgid ); -static int ldap_mark_abandoned( LDAP *ld, int msgid ); -static int wait4msg( LDAP *ld, int msgid, int all, int unlock_permitted, - struct timeval *timeout, LDAPMessage **result ); -static int read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc, - LDAPMessage **result ); -static void check_for_refs( LDAP *ld, LDAPRequest *lr, BerElement *ber, - int ldapversion, int *totalcountp, int *chasingcountp ); -static int build_result_ber( LDAP *ld, BerElement **berp, LDAPRequest *lr ); -static void merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ); -#if defined( CLDAP ) -static int cldap_select1( LDAP *ld, struct timeval *timeout ); -#endif -static void link_pend( LDAP *ld, LDAPPend *lp ); -#if 0 /* these functions are no longer used */ -static void unlink_pend( LDAP *ld, LDAPPend *lp ); -static int unlink_msg( LDAP *ld, int msgid, int all ); -#endif /* 0 */ - -/* - * ldap_result - wait for an ldap result response to a message from the - * ldap server. If msgid is -1, any message will be accepted, otherwise - * ldap_result will wait for a response with msgid. If all is 0 the - * first message with id msgid will be accepted, otherwise, ldap_result - * will wait for all responses with id msgid and then return a pointer to - * the entire list of messages. This is only useful for search responses, - * which can be of two message types (zero or more entries, followed by an - * ldap result). The type of the first message received is returned. - * When waiting, any messages that have been abandoned are discarded. - * - * Example: - * ldap_result( s, msgid, all, timeout, result ) - */ -int -LDAP_CALL -ldap_result( - LDAP *ld, - int msgid, - int all, - struct timeval *timeout, - LDAPMessage **result -) -{ - int rc; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_result\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); /* punt */ - } - - LDAP_MUTEX_LOCK( ld, LDAP_RESULT_LOCK ); - - rc = nsldapi_result_nolock(ld, msgid, all, 1, timeout, result); - - LDAP_MUTEX_UNLOCK( ld, LDAP_RESULT_LOCK ); - - return( rc ); -} - - -int -nsldapi_result_nolock( LDAP *ld, int msgid, int all, int unlock_permitted, - struct timeval *timeout, LDAPMessage **result ) -{ - int rc; - - LDAPDebug( LDAP_DEBUG_TRACE, - "nsldapi_result_nolock (msgid=%d, all=%d)\n", msgid, all, 0 ); - - /* - * First, look through the list of responses we have received on - * this association and see if the response we're interested in - * is there. If it is, return it. If not, call wait4msg() to - * wait until it arrives or timeout occurs. - */ - - if ( result == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( -1 ); - } - - if ( check_response_queue( ld, msgid, all, 1, result ) != 0 ) { - LDAP_SET_LDERRNO( ld, LDAP_SUCCESS, NULL, NULL ); - rc = (*result)->lm_msgtype; - } else { - rc = wait4msg( ld, msgid, all, unlock_permitted, timeout, - result ); - } - - /* - * XXXmcs should use cache function pointers to hook in memcache - */ - if ( ld->ld_memcache != NULL && NSLDAPI_SEARCH_RELATED_RESULT( rc ) && - !((*result)->lm_fromcache )) { - ldap_memcache_append( ld, (*result)->lm_msgid, - (all || NSLDAPI_IS_SEARCH_RESULT( rc )), *result ); - } - - return( rc ); -} - - -/* - * Look through the list of queued responses for a message that matches the - * criteria in the msgid and all parameters. msgid == LDAP_RES_ANY matches - * all ids. - * - * If an appropriate message is found, a non-zero value is returned and the - * message is dequeued and assigned to *result. - * - * If not, *result is set to NULL and this function returns 0. - */ -static int -check_response_queue( LDAP *ld, int msgid, int all, int do_abandon_check, - LDAPMessage **result ) -{ - LDAPMessage *lm, *lastlm, *nextlm; - LDAPRequest *lr; - - LDAPDebug( LDAP_DEBUG_TRACE, - "=> check_response_queue (msgid=%d, all=%d)\n", msgid, all, 0 ); - - *result = NULL; - lastlm = NULL; - LDAP_MUTEX_LOCK( ld, LDAP_RESP_LOCK ); - for ( lm = ld->ld_responses; lm != NULL; lm = nextlm ) { - nextlm = lm->lm_next; - - if ( do_abandon_check && ldap_abandoned( ld, lm->lm_msgid ) ) { - ldap_mark_abandoned( ld, lm->lm_msgid ); - - if ( lastlm == NULL ) { - ld->ld_responses = lm->lm_next; - } else { - lastlm->lm_next = nextlm; - } - - ldap_msgfree( lm ); - - continue; - } - - if ( msgid == LDAP_RES_ANY || lm->lm_msgid == msgid ) { - LDAPMessage *tmp; - - if ( all == 0 - || (lm->lm_msgtype != LDAP_RES_SEARCH_RESULT - && lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE - && lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY) ) - break; - - for ( tmp = lm; tmp != NULL; tmp = tmp->lm_chain ) { - if ( tmp->lm_msgtype == LDAP_RES_SEARCH_RESULT ) - break; - } - - if ( tmp == NULL ) { - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - LDAPDebug( LDAP_DEBUG_TRACE, - "<= check_response_queue NOT FOUND\n", - 0, 0, 0 ); - return( 0 ); /* no message to return */ - } - - break; - } - lastlm = lm; - } - - /* - * if we did not find a message OR if the one we found is a result for - * a request that is still pending, return failure. - */ - if ( lm == NULL - || (( lr = nsldapi_find_request_by_msgid( ld, lm->lm_msgid )) - != NULL && lr->lr_outrefcnt > 0 )) { - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - LDAPDebug( LDAP_DEBUG_TRACE, - "<= check_response_queue NOT FOUND\n", - 0, 0, 0 ); - return( 0 ); /* no message to return */ - } - - if ( all == 0 ) { - if ( lm->lm_chain == NULL ) { - if ( lastlm == NULL ) { - ld->ld_responses = lm->lm_next; - } else { - lastlm->lm_next = lm->lm_next; - } - } else { - if ( lastlm == NULL ) { - ld->ld_responses = lm->lm_chain; - ld->ld_responses->lm_next = lm->lm_next; - } else { - lastlm->lm_next = lm->lm_chain; - lastlm->lm_next->lm_next = lm->lm_next; - } - } - } else { - if ( lastlm == NULL ) { - ld->ld_responses = lm->lm_next; - } else { - lastlm->lm_next = lm->lm_next; - } - } - - if ( all == 0 ) { - lm->lm_chain = NULL; - } - lm->lm_next = NULL; - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - - *result = lm; - LDAPDebug( LDAP_DEBUG_TRACE, - "<= check_response_queue returning msgid %d type %d\n", - lm->lm_msgid, lm->lm_msgtype, 0 ); - return( 1 ); /* a message was found and returned in *result */ -} - - -static int -wait4msg( LDAP *ld, int msgid, int all, int unlock_permitted, - struct timeval *timeout, LDAPMessage **result ) -{ - int rc; - struct timeval tv, *tvp; - long start_time = 0, tmp_time; - LDAPConn *lc, *nextlc; - LDAPRequest *lr; - -#ifdef LDAP_DEBUG - if ( timeout == NULL ) { - LDAPDebug( LDAP_DEBUG_TRACE, "wait4msg (infinite timeout)\n", - 0, 0, 0 ); - } else { - LDAPDebug( LDAP_DEBUG_TRACE, "wait4msg (timeout %ld sec, %ld usec)\n", - timeout->tv_sec, timeout->tv_usec, 0 ); - } -#endif /* LDAP_DEBUG */ - - /* check the cache */ - if ( ld->ld_cache_on && ld->ld_cache_result != NULL ) { - /* if ( unlock_permitted ) LDAP_MUTEX_UNLOCK( ld ); */ - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - rc = (ld->ld_cache_result)( ld, msgid, all, timeout, result ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - /* if ( unlock_permitted ) LDAP_MUTEX_LOCK( ld ); */ - if ( rc != 0 ) { - return( rc ); - } - if ( ld->ld_cache_strategy == LDAP_CACHE_LOCALDB ) { - LDAP_SET_LDERRNO( ld, LDAP_TIMEOUT, NULL, NULL ); - return( 0 ); /* timeout */ - } - } - - /* - * if we are looking for a specific msgid, check to see if it is - * associated with a dead connection and return an error if so. - */ - if ( msgid != LDAP_RES_ANY && msgid != LDAP_RES_UNSOLICITED ) { - LDAP_MUTEX_LOCK( ld, LDAP_REQ_LOCK ); - if (( lr = nsldapi_find_request_by_msgid( ld, msgid )) - == NULL ) { - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, - nsldapi_strdup( "unknown message id" )); - return( -1 ); /* could not find request for msgid */ - } - if ( lr->lr_conn != NULL && - lr->lr_conn->lconn_status == LDAP_CONNST_DEAD ) { - nsldapi_free_request( ld, lr, 1 ); - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - LDAP_SET_LDERRNO( ld, LDAP_SERVER_DOWN, NULL, NULL ); - return( -1 ); /* connection dead */ - } - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - } - - if ( timeout == NULL ) { - tvp = NULL; - } else { - tv = *timeout; - tvp = &tv; - start_time = (long)time( NULL ); - } - - rc = -2; - while ( rc == -2 ) { -#ifdef LDAP_DEBUG - if ( ldap_debug & LDAP_DEBUG_TRACE ) { - nsldapi_dump_connection( ld, ld->ld_conns, 1 ); - nsldapi_dump_requests_and_responses( ld ); - } -#endif /* LDAP_DEBUG */ - LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK ); - LDAP_MUTEX_LOCK( ld, LDAP_REQ_LOCK ); - for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) { - if ( lc->lconn_sb->sb_ber.ber_ptr < - lc->lconn_sb->sb_ber.ber_end ) { - rc = read1msg( ld, msgid, all, lc->lconn_sb, - lc, result ); - break; - } - } - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - - if ( lc == NULL ) { - rc = nsldapi_iostatus_poll( ld, tvp ); - -#if defined( LDAP_DEBUG ) && !defined( macintosh ) && !defined( DOS ) - if ( rc == -1 ) { - LDAPDebug( LDAP_DEBUG_TRACE, - "nsldapi_iostatus_poll returned -1: errno %d\n", - LDAP_GET_ERRNO( ld ), 0, 0 ); - } -#endif - -#if !defined( macintosh ) && !defined( DOS ) - if ( rc == 0 || ( rc == -1 && (( ld->ld_options & - LDAP_BITOPT_RESTART ) == 0 || - LDAP_GET_ERRNO( ld ) != EINTR ))) { -#else - if ( rc == -1 || rc == 0 ) { -#endif - LDAP_SET_LDERRNO( ld, (rc == -1 ? - LDAP_SERVER_DOWN : LDAP_TIMEOUT), NULL, - NULL ); - if ( rc == -1 ) { - LDAP_MUTEX_LOCK( ld, LDAP_REQ_LOCK ); - nsldapi_connection_lost_nolock( ld, - NULL ); - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - } - return( rc ); - } - - if ( rc == -1 ) { - rc = -2; /* select interrupted: loop */ - } else { - rc = -2; - LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK ); - LDAP_MUTEX_LOCK( ld, LDAP_REQ_LOCK ); - for ( lc = ld->ld_conns; rc == -2 && lc != NULL; - lc = nextlc ) { - nextlc = lc->lconn_next; - if ( lc->lconn_status == - LDAP_CONNST_CONNECTED && - nsldapi_iostatus_is_read_ready( ld, - lc->lconn_sb )) { - rc = read1msg( ld, msgid, all, - lc->lconn_sb, lc, result ); - } - else if (ld->ld_options & LDAP_BITOPT_ASYNC) { - if ( lr - && lc->lconn_status == LDAP_CONNST_CONNECTING - && nsldapi_iostatus_is_write_ready( ld, - lc->lconn_sb ) ) { - rc = nsldapi_ber_flush( ld, lc->lconn_sb, lr->lr_ber, 0, 1 ); - if ( rc == 0 ) { - rc = LDAP_RES_BIND; - lc->lconn_status = LDAP_CONNST_CONNECTED; - - lr->lr_ber->ber_end = lr->lr_ber->ber_ptr; - lr->lr_ber->ber_ptr = lr->lr_ber->ber_buf; - nsldapi_iostatus_interest_read( ld, lc->lconn_sb ); - } - else if ( rc == -1 ) { - LDAP_SET_LDERRNO( ld, LDAP_SERVER_DOWN, NULL, NULL ); - nsldapi_free_request( ld, lr, 0 ); - nsldapi_free_connection( ld, lc, NULL, NULL, - 0, 0 ); - } - } - - } - } - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - } - } - - /* - * It is possible that recursion occurred while chasing - * referrals and as a result the message we are looking - * for may have been placed on the response queue. Look - * for it there before continuing so we don't end up - * waiting on the network for a message that we already - * received! - */ - if ( rc == -2 && - check_response_queue( ld, msgid, all, 0, result ) != 0 ) { - LDAP_SET_LDERRNO( ld, LDAP_SUCCESS, NULL, NULL ); - rc = (*result)->lm_msgtype; - } - - /* - * honor the timeout if specified - */ - if ( rc == -2 && tvp != NULL ) { - tmp_time = (long)time( NULL ); - if (( tv.tv_sec -= ( tmp_time - start_time )) <= 0 ) { - rc = 0; /* timed out */ - LDAP_SET_LDERRNO( ld, LDAP_TIMEOUT, NULL, - NULL ); - break; - } - - LDAPDebug( LDAP_DEBUG_TRACE, "wait4msg: %ld secs to go\n", - tv.tv_sec, 0, 0 ); - start_time = tmp_time; - } - } - - return( rc ); -} - - -/* - * read1msg() should be called with LDAP_CONN_LOCK and LDAP_REQ_LOCK locked. - */ -static int -read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc, - LDAPMessage **result ) -{ - BerElement *ber; - LDAPMessage *new, *l, *prev, *chainprev, *tmp; - long id; - unsigned long tag, len; - int terrno, lderr, foundit = 0; - LDAPRequest *lr; - int rc, has_parent, message_can_be_returned; - int manufactured_result = 0; - - LDAPDebug( LDAP_DEBUG_TRACE, "read1msg\n", 0, 0, 0 ); - - message_can_be_returned = 1; /* the usual case... */ - - /* - * if we are not already in the midst of reading a message, allocate - * a ber that is associated with this connection - */ - if ( lc->lconn_ber == NULLBER && nsldapi_alloc_ber_with_options( ld, - &lc->lconn_ber ) != LDAP_SUCCESS ) { - return( -1 ); - } - - /* - * ber_get_next() doesn't set errno on EOF, so we pre-set it to - * zero to avoid getting tricked by leftover "EAGAIN" errors - */ - LDAP_SET_ERRNO( ld, 0 ); - - /* get the next message */ - if ( (tag = ber_get_next( sb, &len, lc->lconn_ber )) - != LDAP_TAG_MESSAGE ) { - terrno = LDAP_GET_ERRNO( ld ); - if ( terrno == EWOULDBLOCK || terrno == EAGAIN ) { - return( -2 ); /* try again */ - } - LDAP_SET_LDERRNO( ld, (tag == LBER_DEFAULT ? LDAP_SERVER_DOWN : - LDAP_LOCAL_ERROR), NULL, NULL ); - if ( tag == LBER_DEFAULT ) { - nsldapi_connection_lost_nolock( ld, sb ); - } - return( -1 ); - } - - /* - * Since we have received a complete message now, we pull this ber - * out of the connection structure and never read into it again. - */ - ber = lc->lconn_ber; - lc->lconn_ber = NULLBER; - - /* message id */ - if ( ber_get_int( ber, &id ) == LBER_ERROR ) { - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL ); - return( -1 ); - } - - /* if it's been abandoned, toss it */ - if ( ldap_abandoned( ld, (int)id ) ) { - ber_free( ber, 1 ); - return( -2 ); /* continue looking */ - } - - if ( id == LDAP_RES_UNSOLICITED ) { - lr = NULL; - } else if (( lr = nsldapi_find_request_by_msgid( ld, id )) == NULL ) { - LDAPDebug( LDAP_DEBUG_ANY, - "no request for response with msgid %ld (tossing)\n", - id, 0, 0 ); - ber_free( ber, 1 ); - return( -2 ); /* continue looking */ - } - - /* the message type */ - if ( (tag = ber_peek_tag( ber, &len )) == LBER_ERROR ) { - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL ); - return( -1 ); - } - LDAPDebug( LDAP_DEBUG_TRACE, "got %s msgid %ld, original id %d\n", - ( tag == LDAP_RES_SEARCH_ENTRY ) ? "ENTRY" : - ( tag == LDAP_RES_SEARCH_REFERENCE ) ? "REFERENCE" : "RESULT", id, - ( lr == NULL ) ? id : lr->lr_origid ); - - if ( lr != NULL ) { - id = lr->lr_origid; - lr->lr_res_msgtype = tag; - } - rc = -2; /* default is to keep looking (no response found) */ - - if ( id != LDAP_RES_UNSOLICITED && ( tag == LDAP_RES_SEARCH_REFERENCE || - tag != LDAP_RES_SEARCH_ENTRY )) { - int refchasing, reftotal, simple_request = 0; - - check_for_refs( ld, lr, ber, lc->lconn_version, &reftotal, - &refchasing ); - - if ( refchasing > 0 || lr->lr_outrefcnt > 0 ) { - /* - * we're chasing one or more new refs... - */ - ber_free( ber, 1 ); - ber = NULLBER; - lr->lr_status = LDAP_REQST_CHASINGREFS; - message_can_be_returned = 0; - - } else if ( tag != LDAP_RES_SEARCH_REFERENCE ) { - /* - * this request is complete... - */ - has_parent = ( lr->lr_parent != NULL ); - - if ( lr->lr_outrefcnt <= 0 && !has_parent ) { - /* request without any refs */ - simple_request = ( reftotal == 0 ); - } - - /* - * If this is not a child request and it is a bind - * request, reset the connection's bind DN and - * status based on the result of the operation. - */ - if ( !has_parent && - LDAP_RES_BIND == lr->lr_res_msgtype && - lr->lr_conn != NULL ) { - if ( lr->lr_conn->lconn_binddn != NULL ) { - NSLDAPI_FREE( - lr->lr_conn->lconn_binddn ); - } - if ( LDAP_SUCCESS == nsldapi_parse_result( ld, - lr->lr_res_msgtype, ber, &lderr, NULL, - NULL, NULL, NULL ) - && LDAP_SUCCESS == lderr ) { - lr->lr_conn->lconn_bound = 1; - lr->lr_conn->lconn_binddn = - lr->lr_binddn; - lr->lr_binddn = NULL; - } else { - lr->lr_conn->lconn_bound = 0; - lr->lr_conn->lconn_binddn = NULL; - } - } - - /* - * if this response is to a child request, we toss - * the message contents and just merge error info. - * into the parent. - */ - if ( has_parent ) { - ber_free( ber, 1 ); - ber = NULLBER; - } - while ( lr->lr_parent != NULL ) { - merge_error_info( ld, lr->lr_parent, lr ); - - lr = lr->lr_parent; - if ( --lr->lr_outrefcnt > 0 ) { - break; /* not completely done yet */ - } - } - - /* - * we recognize a request as complete when: - * 1) it has no outstanding referrals - * 2) it is not a child request - * 3) we have received a result for the request (i.e., - * something other than an entry or a reference). - */ - if ( lr->lr_outrefcnt <= 0 && lr->lr_parent == NULL && - lr->lr_res_msgtype != LDAP_RES_SEARCH_ENTRY && - lr->lr_res_msgtype != LDAP_RES_SEARCH_REFERENCE ) { - id = lr->lr_msgid; - tag = lr->lr_res_msgtype; - LDAPDebug( LDAP_DEBUG_TRACE, - "request %ld done\n", id, 0, 0 ); -LDAPDebug( LDAP_DEBUG_TRACE, -"res_errno: %d, res_error: <%s>, res_matched: <%s>\n", -lr->lr_res_errno, lr->lr_res_error ? lr->lr_res_error : "", -lr->lr_res_matched ? lr->lr_res_matched : "" ); - if ( !simple_request ) { - if ( ber != NULLBER ) { - ber_free( ber, 1 ); - ber = NULLBER; - } - if ( build_result_ber( ld, &ber, lr ) - != LDAP_SUCCESS ) { - rc = -1; /* fatal error */ - } else { - manufactured_result = 1; - } - } - - nsldapi_free_request( ld, lr, 1 ); - } else { - message_can_be_returned = 0; - } - } - } - - if ( ber == NULLBER ) { - return( rc ); - } - - /* make a new ldap message */ - if ( (new = (LDAPMessage*)NSLDAPI_CALLOC( 1, sizeof(struct ldapmsg) )) - == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - new->lm_msgid = (int)id; - new->lm_msgtype = tag; - new->lm_ber = ber; - - /* - * if this is a search entry or if this request is complete (i.e., - * there are no outstanding referrals) then add to cache and check - * to see if we should return this to the caller right away or not. - */ - if ( message_can_be_returned ) { - if ( ld->ld_cache_on ) { - nsldapi_add_result_to_cache( ld, new ); - } - - if ( msgid == LDAP_RES_ANY || id == msgid ) { - if ( new->lm_msgtype == LDAP_RES_SEARCH_RESULT ) { - /* - * return the first response we have for this - * search request later (possibly an entire - * chain of messages). - */ - foundit = 1; - } else if ( all == 0 - || (new->lm_msgtype != LDAP_RES_SEARCH_REFERENCE - && new->lm_msgtype != LDAP_RES_SEARCH_ENTRY) ) { - *result = new; - LDAP_SET_LDERRNO( ld, LDAP_SUCCESS, NULL, - NULL ); - return( tag ); - } - } - } - - /* - * if not, we must add it to the list of responses. if - * the msgid is already there, it must be part of an existing - * search response. - */ - - prev = NULL; - LDAP_MUTEX_LOCK( ld, LDAP_RESP_LOCK ); - for ( l = ld->ld_responses; l != NULL; l = l->lm_next ) { - if ( l->lm_msgid == new->lm_msgid ) - break; - prev = l; - } - - /* not part of an existing search response */ - if ( l == NULL ) { - if ( foundit ) { - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - *result = new; - LDAP_SET_LDERRNO( ld, LDAP_SUCCESS, NULL, NULL ); - return( tag ); - } - - new->lm_next = ld->ld_responses; - ld->ld_responses = new; - LDAPDebug( LDAP_DEBUG_TRACE, - "adding new response id %d type %d (looking for id %d)\n", - new->lm_msgid, new->lm_msgtype, msgid ); - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - if( message_can_be_returned ) - POST( ld, new->lm_msgid, new ); - return( -2 ); /* continue looking */ - } - - LDAPDebug( LDAP_DEBUG_TRACE, - "adding response id %d type %d (looking for id %d)\n", - new->lm_msgid, new->lm_msgtype, msgid ); - - /* - * part of a search response - add to end of list of entries - * - * the first step is to find the end of the list of entries and - * references. after the following loop is executed, tmp points to - * the last entry or reference in the chain. If there are none, - * tmp points to the search result. - */ - chainprev = NULL; - for ( tmp = l; tmp->lm_chain != NULL && - ( tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY - || tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ); - tmp = tmp->lm_chain ) { - chainprev = tmp; - } - - /* - * If this is a manufactured result message and a result is already - * queued we throw away the one that is queued and replace it with - * our new result. This is necessary so we don't end up returning - * more than one result. - */ - if ( manufactured_result && - tmp->lm_msgtype == LDAP_RES_SEARCH_RESULT ) { - /* - * the result is the only thing in the chain... replace it. - */ - new->lm_chain = tmp->lm_chain; - new->lm_next = tmp->lm_next; - if ( chainprev == NULL ) { - if ( prev == NULL ) { - ld->ld_responses = new; - } else { - prev->lm_next = new; - } - } else { - chainprev->lm_chain = new; - } - if ( l == tmp ) { - l = new; - } - ldap_msgfree( tmp ); - - } else if ( manufactured_result && tmp->lm_chain != NULL - && tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_RESULT ) { - /* - * entries or references are also present, so the result - * is the next entry after tmp. replace it. - */ - new->lm_chain = tmp->lm_chain->lm_chain; - new->lm_next = tmp->lm_chain->lm_next; - ldap_msgfree( tmp->lm_chain ); - tmp->lm_chain = new; - - } else if ( tmp->lm_msgtype == LDAP_RES_SEARCH_RESULT ) { - /* - * the result is the only thing in the chain... add before it. - */ - new->lm_chain = tmp; - if ( chainprev == NULL ) { - if ( prev == NULL ) { - ld->ld_responses = new; - } else { - prev->lm_next = new; - } - } else { - chainprev->lm_chain = new; - } - if ( l == tmp ) { - l = new; - } - - } else { - /* - * entries and/or references are present... add to the end - * of the entry/reference part of the chain. - */ - new->lm_chain = tmp->lm_chain; - tmp->lm_chain = new; - } - - /* - * return the first response or the whole chain if that's what - * we were looking for.... - */ - if ( foundit ) { - if ( all == 0 && l->lm_chain != NULL ) { - /* - * only return the first response in the chain - */ - if ( prev == NULL ) { - ld->ld_responses = l->lm_chain; - } else { - prev->lm_next = l->lm_chain; - } - l->lm_chain = NULL; - tag = l->lm_msgtype; - } else { - /* - * return all of the responses (may be a chain) - */ - if ( prev == NULL ) { - ld->ld_responses = l->lm_next; - } else { - prev->lm_next = l->lm_next; - } - } - *result = l; - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - LDAP_SET_LDERRNO( ld, LDAP_SUCCESS, NULL, NULL ); - return( tag ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - return( -2 ); /* continue looking */ -} - - -/* - * check for LDAPv2+ (UMich extension) or LDAPv3 referrals or references - * errors are merged in "lr". - */ -static void -check_for_refs( LDAP *ld, LDAPRequest *lr, BerElement *ber, - int ldapversion, int *totalcountp, int *chasingcountp ) -{ - int err, origerr; - char *errstr, *matcheddn, **v3refs; - - LDAPDebug( LDAP_DEBUG_TRACE, "check_for_refs\n", 0, 0, 0 ); - - *chasingcountp = *totalcountp = 0; - - if ( ldapversion < LDAP_VERSION2 || ( lr->lr_parent == NULL - && ( ld->ld_options & LDAP_BITOPT_REFERRALS ) == 0 )) { - /* referrals are not supported or are disabled */ - return; - } - - if ( lr->lr_res_msgtype == LDAP_RES_SEARCH_REFERENCE ) { - err = nsldapi_parse_reference( ld, ber, &v3refs, NULL ); - origerr = LDAP_REFERRAL; /* a small lie... */ - matcheddn = errstr = NULL; - } else { - err = nsldapi_parse_result( ld, lr->lr_res_msgtype, ber, - &origerr, &matcheddn, &errstr, &v3refs, NULL ); - } - - if ( err != LDAP_SUCCESS ) { - /* parse failed */ - return; - } - - if ( origerr == LDAP_REFERRAL ) { /* ldapv3 */ - if ( v3refs != NULL ) { - err = nsldapi_chase_v3_refs( ld, lr, v3refs, - ( lr->lr_res_msgtype == LDAP_RES_SEARCH_REFERENCE ), - totalcountp, chasingcountp ); - ldap_value_free( v3refs ); - } - } else if ( ldapversion == LDAP_VERSION2 - && origerr != LDAP_SUCCESS ) { - /* referrals may be present in the error string */ - err = nsldapi_chase_v2_referrals( ld, lr, &errstr, - totalcountp, chasingcountp ); - } - - /* set LDAP errno, message, and matched string appropriately */ - if ( lr->lr_res_error != NULL ) { - NSLDAPI_FREE( lr->lr_res_error ); - } - lr->lr_res_error = errstr; - - if ( lr->lr_res_matched != NULL ) { - NSLDAPI_FREE( lr->lr_res_matched ); - } - lr->lr_res_matched = matcheddn; - - if ( err == LDAP_SUCCESS && ( *chasingcountp == *totalcountp )) { - if ( *totalcountp > 0 && ( origerr == LDAP_PARTIAL_RESULTS - || origerr == LDAP_REFERRAL )) { - /* substitute success for referral error codes */ - lr->lr_res_errno = LDAP_SUCCESS; - } else { - /* preserve existing non-referral error code */ - lr->lr_res_errno = origerr; - } - } else if ( err != LDAP_SUCCESS ) { - /* error occurred while trying to chase referrals */ - lr->lr_res_errno = err; - } else { - /* some referrals were not recognized */ - lr->lr_res_errno = ( ldapversion == LDAP_VERSION2 ) - ? LDAP_PARTIAL_RESULTS : LDAP_REFERRAL; - } - - LDAPDebug( LDAP_DEBUG_TRACE, - "check_for_refs: new result: msgid %d, res_errno %d, ", - lr->lr_msgid, lr->lr_res_errno, 0 ); - LDAPDebug( LDAP_DEBUG_TRACE, " res_error <%s>, res_matched <%s>\n", - lr->lr_res_error ? lr->lr_res_error : "", - lr->lr_res_matched ? lr->lr_res_matched : "", 0 ); - LDAPDebug( LDAP_DEBUG_TRACE, - "check_for_refs: %d new refs(s); chasing %d of them\n", - *totalcountp, *chasingcountp, 0 ); -} - - -/* returns an LDAP error code and also sets it in LDAP * */ -static int -build_result_ber( LDAP *ld, BerElement **berp, LDAPRequest *lr ) -{ - unsigned long len; - long along; - BerElement *ber; - int err; - - if (( err = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( err ); - } - *berp = ber; - if ( ber_printf( ber, "{it{ess}}", lr->lr_msgid, - (long)lr->lr_res_msgtype, lr->lr_res_errno, - lr->lr_res_matched ? lr->lr_res_matched : "", - lr->lr_res_error ? lr->lr_res_error : "" ) == -1 ) { - return( LDAP_ENCODING_ERROR ); - } - - ber_reset( ber, 1 ); - if ( ber_skip_tag( ber, &len ) == LBER_ERROR || - ber_get_int( ber, &along ) == LBER_ERROR || - ber_peek_tag( ber, &len ) == LBER_ERROR ) { - return( LDAP_DECODING_ERROR ); - } - - return( LDAP_SUCCESS ); -} - - -static void -merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ) -{ -/* - * Merge error information in "lr" with "parentr" error code and string. - */ - if ( lr->lr_res_errno == LDAP_PARTIAL_RESULTS ) { - parentr->lr_res_errno = lr->lr_res_errno; - if ( lr->lr_res_error != NULL ) { - (void)nsldapi_append_referral( ld, &parentr->lr_res_error, - lr->lr_res_error ); - } - } else if ( lr->lr_res_errno != LDAP_SUCCESS && - parentr->lr_res_errno == LDAP_SUCCESS ) { - parentr->lr_res_errno = lr->lr_res_errno; - if ( parentr->lr_res_error != NULL ) { - NSLDAPI_FREE( parentr->lr_res_error ); - } - parentr->lr_res_error = lr->lr_res_error; - lr->lr_res_error = NULL; - if ( NAME_ERROR( lr->lr_res_errno )) { - if ( parentr->lr_res_matched != NULL ) { - NSLDAPI_FREE( parentr->lr_res_matched ); - } - parentr->lr_res_matched = lr->lr_res_matched; - lr->lr_res_matched = NULL; - } - } - - LDAPDebug( LDAP_DEBUG_TRACE, "merged parent (id %d) error info: ", - parentr->lr_msgid, 0, 0 ); - LDAPDebug( LDAP_DEBUG_TRACE, "result lderrno %d, error <%s>, matched <%s>\n", - parentr->lr_res_errno, parentr->lr_res_error ? - parentr->lr_res_error : "", parentr->lr_res_matched ? - parentr->lr_res_matched : "" ); -} - -#if defined( CLDAP ) -#if !defined( macintosh ) && !defined( DOS ) && !defined( _WINDOWS ) && !defined(XP_OS2) -/* XXXmcs: was revised to support extended I/O callbacks but never compiled! */ -static int -cldap_select1( LDAP *ld, struct timeval *timeout ) -{ - int rc; - static int tblsize = 0; - NSLDAPIIOStatus *iosp = ld->ld_iostatus; - - if ( tblsize == 0 ) { -#ifdef USE_SYSCONF - tblsize = sysconf( _SC_OPEN_MAX ); -#else /* USE_SYSCONF */ - tblsize = getdtablesize(); -#endif /* USE_SYSCONF */ - } - - if ( tblsize >= FD_SETSIZE ) { - /* - * clamp value so we don't overrun the fd_set structure - */ - tblsize = FD_SETSIZE - 1; - } - - if ( NSLDAPI_IOSTATUS_TYPE_OSNATIVE == iosp->ios_type ) { - fd_set readfds; - - FD_ZERO( &readfds ); - FD_SET( ld->ld_sbp->sb_sd, &readfds ); - - /* XXXmcs: UNIX platforms should use poll() */ - rc = select( tblsize, &readfds, 0, 0, timeout ) ); - - } else if ( NSLDAPI_IOSTATUS_TYPE_CALLBACK == iosp->ios_type ) { - LDAP_X_PollFD pollfds[ 1 ]; - - pollfds[0].lpoll_fd = ld->ld_sbp->sb_sd; - pollfds[0].lpoll_arg = ld->ld_sbp->sb_arg; - pollfds[0].lpoll_events = LDAP_X_POLLIN; - pollfds[0].lpoll_revents = 0; - rc = ld->ld_extpoll_fn( pollfds, 1, nsldapi_tv2ms( timeout ), - ld->ld_ext_session_arg ); - } else { - LDAPDebug( LDAP_DEBUG_ANY, - "nsldapi_iostatus_poll: unknown I/O type %d\n", - rc = 0; /* simulate a timeout (what else to do?) */ - } - - return( rc ); -} -#endif /* !macintosh */ - - -#ifdef macintosh -static int -cldap_select1( LDAP *ld, struct timeval *timeout ) -{ - /* XXXmcs: needs to be revised to support I/O callbacks */ - return( tcpselect( ld->ld_sbp->sb_sd, timeout )); -} -#endif /* macintosh */ - - -#if (defined( DOS ) && defined( WINSOCK )) || defined( _WINDOWS ) || defined(XP_OS2) -/* XXXmcs: needs to be revised to support extended I/O callbacks */ -static int -cldap_select1( LDAP *ld, struct timeval *timeout ) -{ - fd_set readfds; - int rc; - - FD_ZERO( &readfds ); - FD_SET( ld->ld_sbp->sb_sd, &readfds ); - - if ( NSLDAPI_IO_TYPE_STANDARD == ld->ldiou_type && - NULL != ld->ld_select_fn ) { - rc = ld->ld_select_fn( 1, &readfds, 0, 0, timeout ); - } else if ( NSLDAPI_IO_TYPE_EXTENDED == ld->ldiou_type && - NULL != ld->ld_extselect_fn ) { - rc = ld->ld_extselect_fn( ld->ld_ext_session_arg, 1, &readfds, 0, - 0, timeout ) ); - } else { - /* XXXmcs: UNIX platforms should use poll() */ - rc = select( 1, &readfds, 0, 0, timeout ) ); - } - - return( rc == SOCKET_ERROR ? -1 : rc ); -} -#endif /* WINSOCK || _WINDOWS */ -#endif /* CLDAP */ - -int -LDAP_CALL -ldap_msgfree( LDAPMessage *lm ) -{ - LDAPMessage *next; - int type = 0; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_msgfree\n", 0, 0, 0 ); - - for ( ; lm != NULL; lm = next ) { - next = lm->lm_chain; - type = lm->lm_msgtype; - ber_free( lm->lm_ber, 1 ); - NSLDAPI_FREE( (char *) lm ); - } - - return( type ); -} - -/* - * ldap_msgdelete - delete a message. It returns: - * 0 if the entire message was deleted - * -1 if the message was not found, or only part of it was found - */ -int -ldap_msgdelete( LDAP *ld, int msgid ) -{ - LDAPMessage *lm, *prev; - int msgtype; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_msgdelete\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); /* punt */ - } - - prev = NULL; - LDAP_MUTEX_LOCK( ld, LDAP_RESP_LOCK ); - for ( lm = ld->ld_responses; lm != NULL; lm = lm->lm_next ) { - if ( lm->lm_msgid == msgid ) - break; - prev = lm; - } - - if ( lm == NULL ) - { - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - return( -1 ); - } - - if ( prev == NULL ) - ld->ld_responses = lm->lm_next; - else - prev->lm_next = lm->lm_next; - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - - msgtype = ldap_msgfree( lm ); - if ( msgtype == LDAP_RES_SEARCH_ENTRY - || msgtype == LDAP_RES_SEARCH_REFERENCE ) { - return( -1 ); - } - - return( 0 ); -} - - -/* - * return 1 if message msgid is waiting to be abandoned, 0 otherwise - */ -static int -ldap_abandoned( LDAP *ld, int msgid ) -{ - int i; - - LDAP_MUTEX_LOCK( ld, LDAP_ABANDON_LOCK ); - if ( ld->ld_abandoned == NULL ) - { - LDAP_MUTEX_UNLOCK( ld, LDAP_ABANDON_LOCK ); - return( 0 ); - } - - for ( i = 0; ld->ld_abandoned[i] != -1; i++ ) - if ( ld->ld_abandoned[i] == msgid ) - { - LDAP_MUTEX_UNLOCK( ld, LDAP_ABANDON_LOCK ); - return( 1 ); - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_ABANDON_LOCK ); - return( 0 ); -} - - -static int -ldap_mark_abandoned( LDAP *ld, int msgid ) -{ - int i; - - LDAP_MUTEX_LOCK( ld, LDAP_ABANDON_LOCK ); - if ( ld->ld_abandoned == NULL ) - { - LDAP_MUTEX_UNLOCK( ld, LDAP_ABANDON_LOCK ); - return( -1 ); - } - - for ( i = 0; ld->ld_abandoned[i] != -1; i++ ) - if ( ld->ld_abandoned[i] == msgid ) - break; - - if ( ld->ld_abandoned[i] == -1 ) - { - LDAP_MUTEX_UNLOCK( ld, LDAP_ABANDON_LOCK ); - return( -1 ); - } - - for ( ; ld->ld_abandoned[i] != -1; i++ ) { - ld->ld_abandoned[i] = ld->ld_abandoned[i + 1]; - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_ABANDON_LOCK ); - return( 0 ); -} - - -#ifdef CLDAP -int -cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement **ber ) -{ - int rc; - unsigned long tag, len; - - if ( ld->ld_sbp->sb_ber.ber_ptr >= ld->ld_sbp->sb_ber.ber_end ) { - rc = cldap_select1( ld, timeout ); - if ( rc == -1 || rc == 0 ) { - LDAP_SET_LDERRNO( ld, (rc == -1 ? LDAP_SERVER_DOWN : - LDAP_TIMEOUT), NULL, NULL ); - return( rc ); - } - } - - /* get the next message */ - if ( (tag = ber_get_next( ld->ld_sbp, &len, ber )) - != LDAP_TAG_MESSAGE ) { - LDAP_SET_LDERRNO( ld, (tag == LBER_DEFAULT ? LDAP_SERVER_DOWN : - LDAP_LOCAL_ERROR), NULL, NULL ); - return( -1 ); - } - - return( tag ); -} -#endif /* CLDAP */ - -int -nsldapi_post_result( LDAP *ld, int msgid, LDAPMessage *result ) -{ - LDAPPend *lp; - - LDAPDebug( LDAP_DEBUG_TRACE, - "nsldapi_post_result(ld=0x%x, msgid=%d, result=0x%x)\n", - ld, msgid, result ); - LDAP_MUTEX_LOCK( ld, LDAP_PEND_LOCK ); - if( msgid == LDAP_RES_ANY ) { - /* - * Look for any pending request for which someone is waiting. - */ - for( lp = ld->ld_pend; lp != NULL; lp = lp->lp_next ) - { - if ( lp->lp_sema != NULL ) { - break; - } - } - /* - * If we did't find a pending request, lp is NULL at this - * point, and we will leave this function without doing - * anything more -- which is exactly what we want to do. - */ - } - else - { - /* - * Look for a pending request specific to this message id - */ - for( lp = ld->ld_pend; lp != NULL; lp = lp->lp_next ) - { - if( lp->lp_msgid == msgid ) - break; - } - - if( lp == NULL ) - { - /* - * No pending requests for this response... append to - * our pending result list. - */ - LDAPPend *newlp; - newlp = (LDAPPend *)NSLDAPI_CALLOC( 1, - sizeof( LDAPPend )); - if( newlp == NULL ) - { - LDAP_MUTEX_UNLOCK( ld, LDAP_PEND_LOCK ); - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, - NULL ); - return (-1); - } - newlp->lp_msgid = msgid; - newlp->lp_result = result; - link_pend( ld, newlp ); - } - } - - - if( lp != NULL ) - { - /* - * Wake up a thread that is waiting for this result. - */ - lp->lp_msgid = msgid; - lp->lp_result = result; - LDAP_SEMA_POST( ld, lp ); - } - - LDAP_MUTEX_UNLOCK( ld, LDAP_PEND_LOCK ); - return (0); -} - -static void -link_pend( LDAP *ld, LDAPPend *lp ) -{ - if (( lp->lp_next = ld->ld_pend ) != NULL ) - { - lp->lp_next->lp_prev = lp; - } - ld->ld_pend = lp; - lp->lp_prev = NULL; -} - -#if 0 /* these functions are no longer used */ -static void -unlink_pend( LDAP *ld, LDAPPend *lp ) -{ - if ( lp->lp_prev == NULL ) { - ld->ld_pend = lp->lp_next; - } else { - lp->lp_prev->lp_next = lp->lp_next; - } - - if ( lp->lp_next != NULL ) { - lp->lp_next->lp_prev = lp->lp_prev; - } -} - -static int -unlink_msg( LDAP *ld, int msgid, int all ) -{ - int rc; - LDAPMessage *lm, *lastlm, *nextlm; - - lastlm = NULL; - LDAP_MUTEX_LOCK( ld, LDAP_RESP_LOCK ); - for ( lm = ld->ld_responses; lm != NULL; lm = nextlm ) - { - nextlm = lm->lm_next; - - if ( lm->lm_msgid == msgid ) - { - LDAPMessage *tmp; - - if ( all == 0 - || (lm->lm_msgtype != LDAP_RES_SEARCH_RESULT - && lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE - && lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY) ) - break; - - for ( tmp = lm; tmp != NULL; tmp = tmp->lm_chain ) { - if ( tmp->lm_msgtype == LDAP_RES_SEARCH_RESULT ) - break; - } - if( tmp != NULL ) - break; - } - lastlm = lm; - } - - if( lm != NULL ) - { - - if ( all == 0 ) - { - if ( lm->lm_chain == NULL ) - { - if ( lastlm == NULL ) - ld->ld_responses = lm->lm_next; - else - lastlm->lm_next = lm->lm_next; - } - else - { - if ( lastlm == NULL ) - { - ld->ld_responses = lm->lm_chain; - ld->ld_responses->lm_next = lm->lm_next; - } - else - { - lastlm->lm_next = lm->lm_chain; - lastlm->lm_next->lm_next = lm->lm_next; - } - } - } - else - { - if ( lastlm == NULL ) - ld->ld_responses = lm->lm_next; - else - lastlm->lm_next = lm->lm_next; - } - - if ( all == 0 ) - lm->lm_chain = NULL; - lm->lm_next = NULL; - rc = lm->lm_msgtype; - } - else - { - rc = -2; - } - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - return ( rc ); -} -#endif /* 0 */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/saslbind.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/saslbind.c deleted file mode 100644 index 8807027188b..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/saslbind.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * 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 "ldap-int.h" - -/* - * ldap_sasl_bind - authenticate to the ldap server. The dn, mechanism, - * and credentials of the entry to which to bind are supplied. An LDAP - * error code is returned and if LDAP_SUCCESS is returned *msgidp is set - * to the id of the request initiated. - * - * Example: - * struct berval creds; - * LDAPControl **ctrls; - * int err, msgid; - * ... fill in creds with credentials ... - * ... fill in ctrls with server controls ... - * err = ldap_sasl_bind( ld, "cn=manager, o=university of michigan, c=us", - * "mechanismname", &creds, ctrls, NULL, &msgid ); - */ -int -LDAP_CALL -ldap_sasl_bind( - LDAP *ld, - const char *dn, - const char *mechanism, - const struct berval *cred, - LDAPControl **serverctrls, - LDAPControl **clientctrls, - int *msgidp -) -{ - BerElement *ber; - int rc, simple, msgid, ldapversion; - - /* - * The ldapv3 bind request looks like this: - * BindRequest ::= SEQUENCE { - * version INTEGER, - * name DistinguishedName, -- who - * authentication CHOICE { - * simple [0] OCTET STRING, -- passwd - * sasl [3] SaslCredentials -- v3 only - * } - * } - * SaslCredentials ::= SEQUENCE { - * mechanism LDAPString, - * credentials OCTET STRING - * } - * all wrapped up in an LDAPMessage sequence. - */ - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_sasl_bind\n", 0, 0, 0 ); - - if ( msgidp == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - - simple = ( mechanism == LDAP_SASL_SIMPLE ); - ldapversion = NSLDAPI_LDAP_VERSION( ld ); - - /* only ldapv3 or higher can do sasl binds */ - if ( !simple && ldapversion < LDAP_VERSION3 ) { - LDAP_SET_LDERRNO( ld, LDAP_NOT_SUPPORTED, NULL, NULL ); - return( LDAP_NOT_SUPPORTED ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - msgid = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - if ( dn == NULL ) - dn = ""; - - if ( ld->ld_cache_on && ld->ld_cache_bind != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - if ( (rc = (ld->ld_cache_bind)( ld, msgid, LDAP_REQ_BIND, dn, - cred, LDAP_AUTH_SASL )) != 0 ) { - *msgidp = rc; - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - return( LDAP_SUCCESS ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - } - - /* create a message to send */ - if (( rc = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( rc ); - } - - /* fill it in */ - if ( simple ) { /* simple bind; works in LDAPv2 or v3 */ - struct berval tmpcred; - - if ( cred == NULL ) { - tmpcred.bv_val = ""; - tmpcred.bv_len = 0; - cred = &tmpcred; - } - rc = ber_printf( ber, "{it{isto}", msgid, LDAP_REQ_BIND, - ldapversion, dn, LDAP_AUTH_SIMPLE, cred->bv_val, - (int)cred->bv_len /* XXX lossy cast */ ); - - } else { /* SASL bind; requires LDAPv3 or better */ - if ( cred == NULL ) { - rc = ber_printf( ber, "{it{ist{s}}", msgid, - LDAP_REQ_BIND, ldapversion, dn, LDAP_AUTH_SASL, - mechanism ); - } else { - rc = ber_printf( ber, "{it{ist{so}}", msgid, - LDAP_REQ_BIND, ldapversion, dn, LDAP_AUTH_SASL, - mechanism, cred->bv_val, - (int)cred->bv_len /* XXX lossy cast */ ); - } - } - - if ( rc == -1 ) { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - - if ( (rc = nsldapi_put_controls( ld, serverctrls, 1, ber )) - != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( rc ); - } - - /* send the message */ - rc = nsldapi_send_initial_request( ld, msgid, LDAP_REQ_BIND, - (char *)dn, ber ); - *msgidp = rc; - return( rc < 0 ? LDAP_GET_LDERRNO( ld, NULL, NULL ) : LDAP_SUCCESS ); -} - -/* - * ldap_sasl_bind_s - bind to the ldap server using sasl authentication - * The dn, mechanism, and credentials of the entry to which to bind are - * supplied. LDAP_SUCCESS is returned upon success, the ldap error code - * otherwise. - * - * Example: - * struct berval creds; - * ... fill in creds with credentials ... - * ldap_sasl_bind_s( ld, "cn=manager, o=university of michigan, c=us", - * "mechanismname", &creds ) - */ -int -LDAP_CALL -ldap_sasl_bind_s( - LDAP *ld, - const char *dn, - const char *mechanism, - const struct berval *cred, - LDAPControl **serverctrls, - LDAPControl **clientctrls, - struct berval **servercredp -) -{ - int err, msgid; - LDAPMessage *result; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_sasl_bind_s\n", 0, 0, 0 ); - - if ( ( err = ldap_sasl_bind( ld, dn, mechanism, cred, serverctrls, - clientctrls, &msgid )) != LDAP_SUCCESS ) - return( err ); - - if ( ldap_result( ld, msgid, 1, (struct timeval *) 0, &result ) == -1 ) - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - - if (( err = ldap_parse_sasl_bind_result( ld, result, servercredp, 0 )) - != LDAP_SUCCESS ) { - ldap_msgfree( result ); - return( err ); - } - - return( ldap_result2error( ld, result, 1 ) ); -} - - -/* returns an LDAP error code that indicates if parse succeeded or not */ -int -LDAP_CALL -ldap_parse_sasl_bind_result( - LDAP *ld, - LDAPMessage *res, - struct berval **servercredp, - int freeit -) -{ - BerElement ber; - int rc, err; - long along; - unsigned long len; - char *m, *e; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_parse_sasl_bind_result\n", 0, 0, 0 ); - - /* - * the ldapv3 SASL bind response looks like this: - * - * BindResponse ::= [APPLICATION 1] SEQUENCE { - * COMPONENTS OF LDAPResult, - * serverSaslCreds [7] OCTET STRING OPTIONAL - * } - * - * all wrapped up in an LDAPMessage sequence. - */ - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || - !NSLDAPI_VALID_LDAPMESSAGE_BINDRESULT_POINTER( res )) { - return( LDAP_PARAM_ERROR ); - } - - /* only ldapv3 or higher can do sasl binds */ - if ( NSLDAPI_LDAP_VERSION( ld ) < LDAP_VERSION3 ) { - LDAP_SET_LDERRNO( ld, LDAP_NOT_SUPPORTED, NULL, NULL ); - return( LDAP_NOT_SUPPORTED ); - } - - if ( servercredp != NULL ) { - *servercredp = NULL; - } - - ber = *(res->lm_ber); /* struct copy */ - - /* skip past message id, matched dn, error message ... */ - rc = ber_scanf( &ber, "{iaa}", &along, &m, &e ); - - if ( rc != LBER_ERROR && - ber_peek_tag( &ber, &len ) == LDAP_TAG_SASL_RES_CREDS ) { - rc = ber_get_stringal( &ber, servercredp ); - } - - if ( freeit ) { - ldap_msgfree( res ); - } - - if ( rc == LBER_ERROR ) { - err = LDAP_DECODING_ERROR; - } else { - err = (int) along; - } - - LDAP_SET_LDERRNO( ld, err, m, e ); - /* this is a little kludge for the 3.0 Barracuda/hammerhead relese */ - /* the docs state that the return is either LDAP_DECODING_ERROR */ - /* or LDAP_SUCCESS. Here we match the docs... it's cleaner in 3.1 */ - - if ( LDAP_DECODING_ERROR == err ) { - return (LDAP_DECODING_ERROR); - } else { - return( LDAP_SUCCESS ); - } -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/sbind.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/sbind.c deleted file mode 100644 index ba2137d7099..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/sbind.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * 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) 1993 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * sbind.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -static int simple_bind_nolock( LDAP *ld, const char *dn, const char *passwd, - int unlock_permitted ); -static int simple_bindifnot_s( LDAP *ld, const char *dn, const char *passwd ); - -/* - * ldap_simple_bind - bind to the ldap server. The dn and - * password of the entry to which to bind are supplied. The message id - * of the request initiated is returned. - * - * Example: - * ldap_simple_bind( ld, "cn=manager, o=university of michigan, c=us", - * "secret" ) - */ - -int -LDAP_CALL -ldap_simple_bind( LDAP *ld, const char *dn, const char *passwd ) -{ - int rc; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_simple_bind\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); - } - - rc = simple_bind_nolock( ld, dn, passwd, 1 ); - - return( rc ); -} - - -static int -simple_bind_nolock( LDAP *ld, const char *dn, const char *passwd, - int unlock_permitted ) -{ - BerElement *ber; - int rc, msgid; - - /* - * The bind request looks like this: - * BindRequest ::= SEQUENCE { - * version INTEGER, - * name DistinguishedName, -- who - * authentication CHOICE { - * simple [0] OCTET STRING -- passwd - * } - * } - * all wrapped up in an LDAPMessage sequence. - */ - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - msgid = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - if ( dn == NULL ) - dn = ""; - if ( passwd == NULL ) - passwd = ""; - - if ( ld->ld_cache_on && ld->ld_cache_bind != NULL ) { - struct berval bv; - - bv.bv_val = (char *)passwd; - bv.bv_len = strlen( passwd ); - /* if ( unlock_permitted ) LDAP_MUTEX_UNLOCK( ld ); */ - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - rc = (ld->ld_cache_bind)( ld, msgid, LDAP_REQ_BIND, dn, &bv, - LDAP_AUTH_SIMPLE ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - /* if ( unlock_permitted ) LDAP_MUTEX_LOCK( ld ); */ - if ( rc != 0 ) { - return( rc ); - } - } - - /* create a message to send */ - if (( rc = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( -1 ); - } - - /* fill it in */ - if ( ber_printf( ber, "{it{ists}", msgid, LDAP_REQ_BIND, - NSLDAPI_LDAP_VERSION( ld ), dn, LDAP_AUTH_SIMPLE, passwd ) == -1 ) { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( -1 ); - } - - if ( nsldapi_put_controls( ld, NULL, 1, ber ) != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( -1 ); - } - - /* send the message */ - return( nsldapi_send_initial_request( ld, msgid, LDAP_REQ_BIND, - (char *)dn, ber )); -} - - -/* - * ldap_simple_bind - bind to the ldap server using simple - * authentication. The dn and password of the entry to which to bind are - * supplied. LDAP_SUCCESS is returned upon success, the ldap error code - * otherwise. - * - * Example: - * ldap_simple_bind_s( ld, "cn=manager, o=university of michigan, c=us", - * "secret" ) - */ -int -LDAP_CALL -ldap_simple_bind_s( LDAP *ld, const char *dn, const char *passwd ) -{ - int msgid; - LDAPMessage *result; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_simple_bind_s\n", 0, 0, 0 ); - - if ( NSLDAPI_VALID_LDAP_POINTER( ld ) && - ( ld->ld_options & LDAP_BITOPT_RECONNECT ) != 0 ) { - return( simple_bindifnot_s( ld, dn, passwd )); - } - - if ( (msgid = ldap_simple_bind( ld, dn, passwd )) == -1 ) - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - - if ( ldap_result( ld, msgid, 1, (struct timeval *) 0, &result ) == -1 ) - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - - return( ldap_result2error( ld, result, 1 ) ); -} - - -/* - * simple_bindifnot_s() is like ldap_simple_bind_s() except that it only does - * a bind if the default connection is not currently bound. - * If a successful bind using the same DN has already taken place we just - * return LDAP_SUCCESS without conversing with the server at all. - */ -static int -simple_bindifnot_s( LDAP *ld, const char *dn, const char *passwd ) -{ - int msgid, rc; - LDAPMessage *result; - char *binddn; - - LDAPDebug( LDAP_DEBUG_TRACE, "simple_bindifnot_s\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( dn == NULL ) { - dn = ""; /* to make comparisons simpler */ - } - - /* - * if we are already bound using the same DN, just return LDAP_SUCCESS. - */ - if ( NULL != ( binddn = nsldapi_get_binddn( ld )) - && 0 == strcmp( dn, binddn )) { - rc = LDAP_SUCCESS; - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return rc; - } - - /* - * if the default connection has been lost and is now marked dead, - * dispose of the default connection so it will get re-established. - * - * if not, clear the bind DN and status to ensure that we don't - * report the wrong bind DN to a different thread while waiting - * for our bind result to return from the server. - */ - LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK ); - if ( NULL != ld->ld_defconn ) { - if ( LDAP_CONNST_DEAD == ld->ld_defconn->lconn_status ) { - nsldapi_free_connection( ld, ld->ld_defconn, NULL, NULL, 1, 0 ); - ld->ld_defconn = NULL; - } else if ( ld->ld_defconn->lconn_binddn != NULL ) { - NSLDAPI_FREE( ld->ld_defconn->lconn_binddn ); - ld->ld_defconn->lconn_binddn = NULL; - ld->ld_defconn->lconn_bound = 0; - } - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - - /* - * finally, bind (this will open a new connection if necessary) - * - * do everything under the protection of the result lock to - * ensure that only one thread will be in this code at a time. - * XXXmcs: we should use a condition variable instead? - */ - LDAP_MUTEX_LOCK( ld, LDAP_RESULT_LOCK ); - if ( (msgid = simple_bind_nolock( ld, dn, passwd, 0 )) == -1 ) { - rc = LDAP_GET_LDERRNO( ld, NULL, NULL ); - goto unlock_and_return; - } - - /* - * Note that at this point the bind request is on its way to the - * server and at any time now we will either be bound as the new - * DN (if the bind succeeded) or we will be bound as anonymous (if - * the bind failed). - */ - - /* - * Wait for the bind result. Code inside result.c:read1msg() - * takes care of setting the connection's bind DN and status. - */ - if ( nsldapi_result_nolock( ld, msgid, 1, 0, (struct timeval *) 0, - &result ) == -1 ) { - rc = LDAP_GET_LDERRNO( ld, NULL, NULL ); - goto unlock_and_return; - } - - rc = ldap_result2error( ld, result, 1 ); - -unlock_and_return: - LDAP_MUTEX_UNLOCK( ld, LDAP_RESULT_LOCK ); - return( rc ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/search.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/search.c deleted file mode 100644 index 018049ebc63..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/search.c +++ /dev/null @@ -1,1007 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * search.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -static int nsldapi_timeval2ldaplimit( struct timeval *timeoutp, - int defaultvalue ); -static int nsldapi_search( LDAP *ld, const char *base, int scope, - const char *filter, char **attrs, int attrsonly, - LDAPControl **serverctrls, LDAPControl **clientctrls, - int timelimit, int sizelimit, int *msgidp ); -static char *find_right_paren( char *s ); -static char *put_complex_filter( BerElement *ber, char *str, - unsigned long tag, int not ); -static int put_filter( BerElement *ber, char *str ); -static int unescape_filterval( char *str ); -static int hexchar2int( char c ); -static int is_valid_attr( char *a ); -static int put_simple_filter( BerElement *ber, char *str ); -static int put_substring_filter( BerElement *ber, char *type, - char *str ); -static int put_filter_list( BerElement *ber, char *str ); -static int nsldapi_search_s( LDAP *ld, const char *base, int scope, - const char *filter, char **attrs, int attrsonly, - LDAPControl **serverctrls, LDAPControl **clientctrls, - struct timeval *localtimeoutp, int timelimit, int sizelimit, - LDAPMessage **res ); - -/* - * ldap_search - initiate an ldap search operation. Parameters: - * - * ld LDAP descriptor - * base DN of the base object - * scope the search scope - one of LDAP_SCOPE_BASE, - * LDAP_SCOPE_ONELEVEL, LDAP_SCOPE_SUBTREE - * filter a string containing the search filter - * (e.g., "(|(cn=bob)(sn=bob))") - * attrs list of attribute types to return for matches - * attrsonly 1 => attributes only 0 => attributes and values - * - * Example: - * char *attrs[] = { "mail", "title", 0 }; - * msgid = ldap_search( ld, "c=us@o=UM", LDAP_SCOPE_SUBTREE, "cn~=bob", - * attrs, attrsonly ); - */ -int -LDAP_CALL -ldap_search( - LDAP *ld, - const char *base, - int scope, - const char *filter, - char **attrs, - int attrsonly -) -{ - int msgid; - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_search\n", 0, 0, 0 ); - - if ( ldap_search_ext( ld, base, scope, filter, attrs, attrsonly, NULL, - NULL, NULL, -1, &msgid ) == LDAP_SUCCESS ) { - return( msgid ); - } else { - return( -1 ); /* error is in ld handle */ - } -} - - -/* - * LDAPv3 extended search. - * Returns an LDAP error code. - */ -int -LDAP_CALL -ldap_search_ext( - LDAP *ld, - const char *base, - int scope, - const char *filter, - char **attrs, - int attrsonly, - LDAPControl **serverctrls, - LDAPControl **clientctrls, - struct timeval *timeoutp, /* NULL means use ld->ld_timelimit */ - int sizelimit, - int *msgidp -) -{ - /* - * It is an error to pass in a zero'd timeval. - */ - if ( timeoutp != NULL && timeoutp->tv_sec == 0 && - timeoutp->tv_usec == 0 ) { - if ( ld != NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - } - return( LDAP_PARAM_ERROR ); - } - - return( nsldapi_search( ld, base, scope, filter, attrs, attrsonly, - serverctrls, clientctrls, - nsldapi_timeval2ldaplimit( timeoutp, -1 ), sizelimit, msgidp )); -} - - -/* - * Like ldap_search_ext() except an integer timelimit is passed instead of - * using the overloaded struct timeval *timeoutp. - */ -static int -nsldapi_search( - LDAP *ld, - const char *base, - int scope, - const char *filter, - char **attrs, - int attrsonly, - LDAPControl **serverctrls, - LDAPControl **clientctrls, - int timelimit, /* -1 means use ld->ld_timelimit */ - int sizelimit, /* -1 means use ld->ld_sizelimit */ - int *msgidp -) -{ - BerElement *ber; - int rc, rc_key; - unsigned long key; /* XXXmcs: memcache */ - - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_search_ext\n", 0, 0, 0 ); - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( base == NULL ) { - base = ""; - } - - if ( filter == NULL ) { - filter = "(objectclass=*)"; - } - - if ( msgidp == NULL || ( scope != LDAP_SCOPE_BASE - && scope != LDAP_SCOPE_ONELEVEL && scope != LDAP_SCOPE_SUBTREE ) - || ( sizelimit < -1 )) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - *msgidp = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - /* - * XXXmcs: should use cache function pointers to hook in memcache - */ - if ( ld->ld_memcache == NULL ) { - rc_key = LDAP_NOT_SUPPORTED; - } else if (( rc_key = ldap_memcache_createkey( ld, base, scope, filter, - attrs, attrsonly, serverctrls, clientctrls, &key)) == LDAP_SUCCESS - && ldap_memcache_result( ld, *msgidp, key ) == LDAP_SUCCESS ) { - return LDAP_SUCCESS; - } - - /* check the cache */ - if ( ld->ld_cache_on && ld->ld_cache_search != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - if ( (rc = (ld->ld_cache_search)( ld, *msgidp, LDAP_REQ_SEARCH, - base, scope, filter, attrs, attrsonly )) != 0 ) { - *msgidp = rc; - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - return( LDAP_SUCCESS ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - } - - /* caching off or did not find it in the cache - check the net */ - if (( rc = nsldapi_build_search_req( ld, base, scope, filter, attrs, - attrsonly, serverctrls, clientctrls, timelimit, sizelimit, - *msgidp, &ber )) != LDAP_SUCCESS ) { - return( rc ); - } - - /* send the message */ - rc = nsldapi_send_initial_request( ld, *msgidp, LDAP_REQ_SEARCH, - (char *) base, ber ); - - /* - * XXXmcs: should use cache function pointers to hook in memcache - */ - if ( (rc_key == LDAP_SUCCESS) && (rc >= 0) ) { - ldap_memcache_new( ld, rc, key, base ); - } - - *msgidp = rc; - return( rc < 0 ? LDAP_GET_LDERRNO( ld, NULL, NULL ) : LDAP_SUCCESS ); -} - - -/* - * Convert a non-NULL timeoutp to a value in seconds that is appropriate to - * send in an LDAP search request. If timeoutp is NULL, return defaultvalue. - */ -static int -nsldapi_timeval2ldaplimit( struct timeval *timeoutp, int defaultvalue ) -{ - int timelimit; - - if ( NULL == timeoutp ) { - timelimit = defaultvalue; - } else if ( timeoutp->tv_sec > 0 ) { - timelimit = timeoutp->tv_sec; - } else if ( timeoutp->tv_usec > 0 ) { - timelimit = 1; /* minimum we can express in LDAP */ - } else { - /* - * both tv_sec and tv_usec are less than one (zero?) so - * to maintain compatiblity with our "zero means no limit" - * convention we pass no limit to the server. - */ - timelimit = 0; /* no limit */ - } - - return( timelimit ); -} - - -/* returns an LDAP error code and also sets it in ld */ -int -nsldapi_build_search_req( - LDAP *ld, - const char *base, - int scope, - const char *filter, - char **attrs, - int attrsonly, - LDAPControl **serverctrls, - LDAPControl **clientctrls, /* not used for anything yet */ - int timelimit, /* if -1, ld->ld_timelimit is used */ - int sizelimit, /* if -1, ld->ld_sizelimit is used */ - int msgid, - BerElement **berp -) -{ - BerElement *ber; - int err; - char *fdup; - - /* - * Create the search request. It looks like this: - * SearchRequest := [APPLICATION 3] SEQUENCE { - * baseObject DistinguishedName, - * scope ENUMERATED { - * baseObject (0), - * singleLevel (1), - * wholeSubtree (2) - * }, - * derefAliases ENUMERATED { - * neverDerefaliases (0), - * derefInSearching (1), - * derefFindingBaseObj (2), - * alwaysDerefAliases (3) - * }, - * sizelimit INTEGER (0 .. 65535), - * timelimit INTEGER (0 .. 65535), - * attrsOnly BOOLEAN, - * filter Filter, - * attributes SEQUENCE OF AttributeType - * } - * wrapped in an ldap message. - */ - - /* create a message to send */ - if (( err = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( err ); - } - - if ( base == NULL ) { - base = ""; - } - - if ( sizelimit == -1 ) { - sizelimit = ld->ld_sizelimit; - } - - if ( timelimit == -1 ) { - timelimit = ld->ld_timelimit; - } - -#ifdef CLDAP - if ( ld->ld_sbp->sb_naddr > 0 ) { - err = ber_printf( ber, "{ist{seeiib", msgid, - ld->ld_cldapdn, LDAP_REQ_SEARCH, base, scope, ld->ld_deref, - sizelimit, timelimit, attrsonly ); - } else { -#endif /* CLDAP */ - err = ber_printf( ber, "{it{seeiib", msgid, - LDAP_REQ_SEARCH, base, scope, ld->ld_deref, - sizelimit, timelimit, attrsonly ); -#ifdef CLDAP - } -#endif /* CLDAP */ - - if ( err == -1 ) { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - - fdup = nsldapi_strdup( filter ); - err = put_filter( ber, fdup ); - NSLDAPI_FREE( fdup ); - - if ( err == -1 ) { - LDAP_SET_LDERRNO( ld, LDAP_FILTER_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_FILTER_ERROR ); - } - - if ( ber_printf( ber, "{v}}", attrs ) == -1 ) { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - - if ( (err = nsldapi_put_controls( ld, serverctrls, 1, ber )) - != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( err ); - } - - *berp = ber; - return( LDAP_SUCCESS ); -} - -static char * -find_right_paren( char *s ) -{ - int balance, escape; - - balance = 1; - escape = 0; - while ( *s && balance ) { - if ( escape == 0 ) { - if ( *s == '(' ) - balance++; - else if ( *s == ')' ) - balance--; - } - if ( *s == '\\' && ! escape ) - escape = 1; - else - escape = 0; - if ( balance ) - s++; - } - - return( *s ? s : NULL ); -} - -static char * -put_complex_filter( - BerElement *ber, - char *str, - unsigned long tag, - int not -) -{ - char *next; - - /* - * We have (x(filter)...) with str sitting on - * the x. We have to find the paren matching - * the one before the x and put the intervening - * filters by calling put_filter_list(). - */ - - /* put explicit tag */ - if ( ber_printf( ber, "t{", tag ) == -1 ) - return( NULL ); - - str++; - if ( (next = find_right_paren( str )) == NULL ) - return( NULL ); - - *next = '\0'; - if ( put_filter_list( ber, str ) == -1 ) - return( NULL ); - *next++ = ')'; - - /* flush explicit tagged thang */ - if ( ber_printf( ber, "}" ) == -1 ) - return( NULL ); - - return( next ); -} - -static int -put_filter( BerElement *ber, char *str ) -{ - char *next; - int parens, balance, escape; - - /* - * A Filter looks like this: - * Filter ::= CHOICE { - * and [0] SET OF Filter, - * or [1] SET OF Filter, - * not [2] Filter, - * equalityMatch [3] AttributeValueAssertion, - * substrings [4] SubstringFilter, - * greaterOrEqual [5] AttributeValueAssertion, - * lessOrEqual [6] AttributeValueAssertion, - * present [7] AttributeType,, - * approxMatch [8] AttributeValueAssertion - * } - * - * SubstringFilter ::= SEQUENCE { - * type AttributeType, - * SEQUENCE OF CHOICE { - * initial [0] IA5String, - * any [1] IA5String, - * final [2] IA5String - * } - * } - * Note: tags in a choice are always explicit - */ - - LDAPDebug( LDAP_DEBUG_TRACE, "put_filter \"%s\"\n", str, 0, 0 ); - - parens = 0; - while ( *str ) { - switch ( *str ) { - case '(': - str++; - parens++; - switch ( *str ) { - case '&': - LDAPDebug( LDAP_DEBUG_TRACE, "put_filter: AND\n", - 0, 0, 0 ); - - if ( (str = put_complex_filter( ber, str, - LDAP_FILTER_AND, 0 )) == NULL ) - return( -1 ); - - parens--; - break; - - case '|': - LDAPDebug( LDAP_DEBUG_TRACE, "put_filter: OR\n", - 0, 0, 0 ); - - if ( (str = put_complex_filter( ber, str, - LDAP_FILTER_OR, 0 )) == NULL ) - return( -1 ); - - parens--; - break; - - case '!': - LDAPDebug( LDAP_DEBUG_TRACE, "put_filter: NOT\n", - 0, 0, 0 ); - - if ( (str = put_complex_filter( ber, str, - LDAP_FILTER_NOT, 1 )) == NULL ) - return( -1 ); - - parens--; - break; - - default: - LDAPDebug( LDAP_DEBUG_TRACE, - "put_filter: simple\n", 0, 0, 0 ); - - balance = 1; - escape = 0; - next = str; - while ( *next && balance ) { - if ( escape == 0 ) { - if ( *next == '(' ) - balance++; - else if ( *next == ')' ) - balance--; - } - if ( *next == '\\' && ! escape ) - escape = 1; - else - escape = 0; - if ( balance ) - next++; - } - if ( balance != 0 ) - return( -1 ); - - *next = '\0'; - if ( put_simple_filter( ber, str ) == -1 ) { - return( -1 ); - } - *next++ = ')'; - str = next; - parens--; - break; - } - break; - - case ')': - LDAPDebug( LDAP_DEBUG_TRACE, "put_filter: end\n", 0, 0, - 0 ); - if ( ber_printf( ber, "]" ) == -1 ) - return( -1 ); - str++; - parens--; - break; - - case ' ': - str++; - break; - - default: /* assume it's a simple type=value filter */ - LDAPDebug( LDAP_DEBUG_TRACE, "put_filter: default\n", 0, 0, - 0 ); - next = strchr( str, '\0' ); - if ( put_simple_filter( ber, str ) == -1 ) { - return( -1 ); - } - str = next; - break; - } - } - - return( parens ? -1 : 0 ); -} - - -/* - * Put a list of filters like this "(filter1)(filter2)..." - */ - -static int -put_filter_list( BerElement *ber, char *str ) -{ - char *next; - char save; - - LDAPDebug( LDAP_DEBUG_TRACE, "put_filter_list \"%s\"\n", str, 0, 0 ); - - while ( *str ) { - while ( *str && isspace( *str ) ) - str++; - if ( *str == '\0' ) - break; - - if ( (next = find_right_paren( str + 1 )) == NULL ) - return( -1 ); - save = *++next; - - /* now we have "(filter)" with str pointing to it */ - *next = '\0'; - if ( put_filter( ber, str ) == -1 ) - return( -1 ); - *next = save; - - str = next; - } - - return( 0 ); -} - - -/* - * is_valid_attr - returns 1 if a is a syntactically valid left-hand side - * of a filter expression, 0 otherwise. A valid string may contain only - * letters, numbers, hyphens, semi-colons, colons and periods. examples: - * cn - * cn;lang-fr - * 1.2.3.4;binary;dynamic - * mail;dynamic - * cn:dn:1.2.3.4 - * - * For compatibility with older servers, we also allow underscores in - * attribute types, even through they are not allowed by the LDAPv3 RFCs. - */ -static int -is_valid_attr( char *a ) -{ - for ( ; *a; a++ ) { - if ( !isascii( *a ) ) { - return( 0 ); - } else if ( !isalnum( *a ) ) { - switch ( *a ) { - case '-': - case '.': - case ';': - case ':': - case '_': - break; /* valid */ - default: - return( 0 ); - } - } - } - - return( 1 ); -} - -static char * -find_star( char *s ) -{ - for ( ; *s; ++s ) { - switch ( *s ) { - case '*': return s; - case '\\': - ++s; - if ( hexchar2int(s[0]) >= 0 && hexchar2int(s[1]) >= 0 ) ++s; - default: break; - } - } - return NULL; -} - -static int -put_simple_filter( BerElement *ber, char *str ) -{ - char *s, *s2, *s3, filterop; - char *value; - unsigned long ftype; - int rc, len; - char *oid; /* for v3 extended filter */ - int dnattr; /* for v3 extended filter */ - - LDAPDebug( LDAP_DEBUG_TRACE, "put_simple_filter \"%s\"\n", str, 0, 0 ); - - rc = -1; /* pessimistic */ - - if (( str = nsldapi_strdup( str )) == NULL ) { - return( rc ); - } - - if ( (s = strchr( str, '=' )) == NULL ) { - goto free_and_return; - } - value = s + 1; - *s-- = '\0'; - filterop = *s; - if ( filterop == '<' || filterop == '>' || filterop == '~' || - filterop == ':' ) { - *s = '\0'; - } - - if ( ! is_valid_attr( str ) ) { - goto free_and_return; - } - - switch ( filterop ) { - case '<': - ftype = LDAP_FILTER_LE; - break; - case '>': - ftype = LDAP_FILTER_GE; - break; - case '~': - ftype = LDAP_FILTER_APPROX; - break; - case ':': /* extended filter - v3 only */ - /* - * extended filter looks like this: - * - * [type][':dn'][':'oid]':='value - * - * where one of type or :oid is required. - * - */ - ftype = LDAP_FILTER_EXTENDED; - s2 = s3 = NULL; - if ( (s2 = strrchr( str, ':' )) == NULL ) { - goto free_and_return; - } - if ( strcasecmp( s2, ":dn" ) == 0 ) { - oid = NULL; - dnattr = 1; - *s2 = '\0'; - } else { - oid = s2 + 1; - dnattr = 0; - *s2 = '\0'; - if ( (s3 = strrchr( str, ':' )) != NULL ) { - if ( strcasecmp( s3, ":dn" ) == 0 ) { - dnattr = 1; - } else { - goto free_and_return; - } - *s3 = '\0'; - } - } - if ( (rc = ber_printf( ber, "t{", ftype )) == -1 ) { - goto free_and_return; - } - if ( oid != NULL ) { - if ( (rc = ber_printf( ber, "ts", LDAP_TAG_MRA_OID, - oid )) == -1 ) { - goto free_and_return; - } - } - if ( *str != '\0' ) { - if ( (rc = ber_printf( ber, "ts", - LDAP_TAG_MRA_TYPE, str )) == -1 ) { - goto free_and_return; - } - } - if (( len = unescape_filterval( value )) < 0 || - ( rc = ber_printf( ber, "totb}", LDAP_TAG_MRA_VALUE, - value, len, LDAP_TAG_MRA_DNATTRS, dnattr )) == -1 ) { - goto free_and_return; - } - rc = 0; - goto free_and_return; - break; - default: - if ( find_star( value ) == NULL ) { - ftype = LDAP_FILTER_EQUALITY; - } else if ( strcmp( value, "*" ) == 0 ) { - ftype = LDAP_FILTER_PRESENT; - } else { - rc = put_substring_filter( ber, str, value ); - goto free_and_return; - } - break; - } - - if ( ftype == LDAP_FILTER_PRESENT ) { - rc = ber_printf( ber, "ts", ftype, str ); - } else if (( len = unescape_filterval( value )) >= 0 ) { - rc = ber_printf( ber, "t{so}", ftype, str, value, len ); - } - if ( rc != -1 ) { - rc = 0; - } - -free_and_return: - NSLDAPI_FREE( str ); - return( rc ); -} - - -/* - * Undo in place both LDAPv2 (RFC-1960) and LDAPv3 (hexadecimal) escape - * sequences within the null-terminated string 'val'. The resulting value - * may contain null characters. - * - * If 'val' contains invalid escape sequences we return -1. - * Otherwise the length of the unescaped value is returned. - */ -static int -unescape_filterval( char *val ) -{ - int escape, firstdigit, ival; - char *s, *d; - - escape = 0; - for ( s = d = val; *s; s++ ) { - if ( escape ) { - /* - * first try LDAPv3 escape (hexadecimal) sequence - */ - if (( ival = hexchar2int( *s )) < 0 ) { - if ( firstdigit ) { - /* - * LDAPv2 (RFC1960) escape sequence - */ - *d++ = *s; - escape = 0; - } else { - return(-1); - } - } - if ( firstdigit ) { - *d = ( ival<<4 ); - firstdigit = 0; - } else { - *d++ |= ival; - escape = 0; - } - - } else if ( *s != '\\' ) { - *d++ = *s; - escape = 0; - - } else { - escape = 1; - firstdigit = 1; - } - } - - return( d - val ); -} - - -/* - * convert character 'c' that represents a hexadecimal digit to an integer. - * if 'c' is not a hexidecimal digit [0-9A-Fa-f], -1 is returned. - * otherwise the converted value is returned. - */ -static int -hexchar2int( char c ) -{ - if ( c >= '0' && c <= '9' ) { - return( c - '0' ); - } - if ( c >= 'A' && c <= 'F' ) { - return( c - 'A' + 10 ); - } - if ( c >= 'a' && c <= 'f' ) { - return( c - 'a' + 10 ); - } - return( -1 ); -} - -static int -put_substring_filter( BerElement *ber, char *type, char *val ) -{ - char *nextstar, gotstar = 0; - unsigned long ftype; - int len; - - LDAPDebug( LDAP_DEBUG_TRACE, "put_substring_filter \"%s=%s\"\n", type, - val, 0 ); - - if ( ber_printf( ber, "t{s{", LDAP_FILTER_SUBSTRINGS, type ) == -1 ) { - return( -1 ); - } - - for ( ; val != NULL; val = nextstar ) { - if ( (nextstar = find_star( val )) != NULL ) { - *nextstar++ = '\0'; - } - - if ( gotstar == 0 ) { - ftype = LDAP_SUBSTRING_INITIAL; - } else if ( nextstar == NULL ) { - ftype = LDAP_SUBSTRING_FINAL; - } else { - ftype = LDAP_SUBSTRING_ANY; - } - if ( *val != '\0' ) { - if (( len = unescape_filterval( val )) < 0 || - ber_printf( ber, "to", ftype, val, len ) == -1 ) { - return( -1 ); - } - } - - gotstar = 1; - } - - if ( ber_printf( ber, "}}" ) == -1 ) { - return( -1 ); - } - - return( 0 ); -} - -int -LDAP_CALL -ldap_search_st( - LDAP *ld, - const char *base, - int scope, - const char *filter, - char **attrs, - int attrsonly, - struct timeval *timeout, - LDAPMessage **res -) -{ - return( nsldapi_search_s( ld, base, scope, filter, attrs, attrsonly, - NULL, NULL, timeout, -1, -1, res )); -} - -int -LDAP_CALL -ldap_search_s( - LDAP *ld, - const char *base, - int scope, - const char *filter, - char **attrs, - int attrsonly, - LDAPMessage **res -) -{ - return( nsldapi_search_s( ld, base, scope, filter, attrs, attrsonly, - NULL, NULL, NULL, -1, -1, res )); -} - -int LDAP_CALL -ldap_search_ext_s( - LDAP *ld, - const char *base, - int scope, - const char *filter, - char **attrs, - int attrsonly, - LDAPControl **serverctrls, - LDAPControl **clientctrls, - struct timeval *timeoutp, - int sizelimit, - LDAPMessage **res -) -{ - return( nsldapi_search_s( ld, base, scope, filter, attrs, attrsonly, - serverctrls, clientctrls, timeoutp, - nsldapi_timeval2ldaplimit( timeoutp, -1 ), sizelimit, res )); -} - - -static int -nsldapi_search_s( - LDAP *ld, - const char *base, - int scope, - const char *filter, - char **attrs, - int attrsonly, - LDAPControl **serverctrls, - LDAPControl **clientctrls, - struct timeval *localtimeoutp, - int timelimit, /* -1 means use ld->ld_timelimit */ - int sizelimit, /* -1 means use ld->ld_sizelimit */ - LDAPMessage **res -) -{ - int err, msgid; - - /* - * It is an error to pass in a zero'd timeval. - */ - if ( localtimeoutp != NULL && localtimeoutp->tv_sec == 0 && - localtimeoutp->tv_usec == 0 ) { - if ( ld != NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - } - if ( res != NULL ) { - *res = NULL; - } - return( LDAP_PARAM_ERROR ); - } - - if (( err = nsldapi_search( ld, base, scope, filter, attrs, attrsonly, - serverctrls, clientctrls, timelimit, sizelimit, &msgid )) - != LDAP_SUCCESS ) { - if ( res != NULL ) { - *res = NULL; - } - return( err ); - } - - if ( ldap_result( ld, msgid, 1, localtimeoutp, res ) == -1 ) { - /* - * Error. ldap_result() sets *res to NULL for us. - */ - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - if ( LDAP_GET_LDERRNO( ld, NULL, NULL ) == LDAP_TIMEOUT ) { - (void) ldap_abandon( ld, msgid ); - err = LDAP_TIMEOUT; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - if ( res != NULL ) { - *res = NULL; - } - return( err ); - } - - return( ldap_result2error( ld, *res, 0 ) ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/setoption.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/setoption.c deleted file mode 100644 index 7405459f9c2..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/setoption.c +++ /dev/null @@ -1,320 +0,0 @@ -/* - * 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): - */ -/* - * setoption.c - ldap_set_option implementation - */ - -#include "ldap-int.h" - -#define LDAP_SETCLR_BITOPT( ld, bit, optdata ) \ - if ( optdata != NULL ) { \ - (ld)->ld_options |= bit; \ - } else { \ - (ld)->ld_options &= ~bit; \ - } - - -int -LDAP_CALL -ldap_set_option( LDAP *ld, int option, const void *optdata ) -{ - int rc, i; - char *matched, *errstr; - - if ( !nsldapi_initialized ) { - nsldapi_initialize_defaults(); - } - - /* - * process global options (not associated with an LDAP session handle) - */ - if ( option == LDAP_OPT_MEMALLOC_FN_PTRS ) { - struct lber_memalloc_fns memalloc_fns; - - /* set libldap ones via a struct copy */ - nsldapi_memalloc_fns = *((struct ldap_memalloc_fns *)optdata); - - /* also set liblber memory allocation callbacks */ - memalloc_fns.lbermem_malloc = - nsldapi_memalloc_fns.ldapmem_malloc; - memalloc_fns.lbermem_calloc = - nsldapi_memalloc_fns.ldapmem_calloc; - memalloc_fns.lbermem_realloc = - nsldapi_memalloc_fns.ldapmem_realloc; - memalloc_fns.lbermem_free = - nsldapi_memalloc_fns.ldapmem_free; - if ( ber_set_option( NULL, LBER_OPT_MEMALLOC_FN_PTRS, - &memalloc_fns ) != 0 ) { - return( -1 ); - } - - return( 0 ); - } - /* - * LDAP_OPT_DEBUG_LEVEL is global - */ - if (LDAP_OPT_DEBUG_LEVEL == option) - { -#ifdef LDAP_DEBUG - ldap_debug = *((int *) optdata); -#endif - return 0; - } - - /* - * if ld is NULL, arrange to modify our default settings - */ - if ( ld == NULL ) { - ld = &nsldapi_ld_defaults; -#ifdef LDAP_DEBUG - ldap_debug = 0; -#endif - - } - - /* - * process options that are associated with an LDAP session handle - */ - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); /* punt */ - } - - rc = 0; - if ( ld != &nsldapi_ld_defaults && - option != LDAP_OPT_EXTRA_THREAD_FN_PTRS) { - LDAP_MUTEX_LOCK( ld, LDAP_OPTION_LOCK ); - } - switch( option ) { - /* options that can be turned on and off */ -#ifdef LDAP_DNS - case LDAP_OPT_DNS: - LDAP_SETCLR_BITOPT( ld, LDAP_BITOPT_DNS, optdata ); - break; -#endif - - case LDAP_OPT_REFERRALS: - LDAP_SETCLR_BITOPT( ld, LDAP_BITOPT_REFERRALS, optdata ); - break; - - case LDAP_OPT_SSL: - LDAP_SETCLR_BITOPT( ld, LDAP_BITOPT_SSL, optdata ); - break; - - case LDAP_OPT_RESTART: - LDAP_SETCLR_BITOPT( ld, LDAP_BITOPT_RESTART, optdata ); - break; - - case LDAP_OPT_RECONNECT: - LDAP_SETCLR_BITOPT( ld, LDAP_BITOPT_RECONNECT, optdata ); - break; - -#ifdef LDAP_ASYNC_IO - case LDAP_OPT_ASYNC_CONNECT: - LDAP_SETCLR_BITOPT(ld, LDAP_BITOPT_ASYNC, optdata ); - break; -#endif /* LDAP_ASYNC_IO */ - - /* fields in the LDAP structure */ - case LDAP_OPT_DEREF: - ld->ld_deref = *((int *) optdata); - break; - case LDAP_OPT_SIZELIMIT: - ld->ld_sizelimit = *((int *) optdata); - break; - case LDAP_OPT_TIMELIMIT: - ld->ld_timelimit = *((int *) optdata); - break; - case LDAP_OPT_REFERRAL_HOP_LIMIT: - ld->ld_refhoplimit = *((int *) optdata); - break; - case LDAP_OPT_PROTOCOL_VERSION: - ld->ld_version = *((int *) optdata); - if ( ld->ld_defconn != NULL ) { /* also set in default conn. */ - ld->ld_defconn->lconn_version = ld->ld_version; - } - break; - case LDAP_OPT_SERVER_CONTROLS: - /* nsldapi_dup_controls returns -1 and sets lderrno on error */ - rc = nsldapi_dup_controls( ld, &ld->ld_servercontrols, - (LDAPControl **)optdata ); - break; - case LDAP_OPT_CLIENT_CONTROLS: - /* nsldapi_dup_controls returns -1 and sets lderrno on error */ - rc = nsldapi_dup_controls( ld, &ld->ld_clientcontrols, - (LDAPControl **)optdata ); - break; - - /* rebind proc */ - case LDAP_OPT_REBIND_FN: - ld->ld_rebind_fn = (LDAP_REBINDPROC_CALLBACK *) optdata; - break; - case LDAP_OPT_REBIND_ARG: - ld->ld_rebind_arg = (void *) optdata; - break; - - /* i/o function pointers */ - case LDAP_OPT_IO_FN_PTRS: - if (( rc = nsldapi_install_compat_io_fns( ld, - (struct ldap_io_fns *)optdata )) != LDAP_SUCCESS ) { - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - rc = -1; - } - break; - - /* extended i/o function pointers */ - case LDAP_X_OPT_EXTIO_FN_PTRS: - /* denotes use of old iofns struct (no writev) */ - if (((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_size == LDAP_X_EXTIO_FNS_SIZE_REV0) { - ld->ld_extio_size = LDAP_X_EXTIO_FNS_SIZE; - ld->ld_extclose_fn = ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_close; - ld->ld_extconnect_fn = ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_connect; - ld->ld_extread_fn = ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_read; - ld->ld_extwrite_fn = ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_write; - ld->ld_extpoll_fn = ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_poll; - ld->ld_extnewhandle_fn = ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_newhandle; - ld->ld_extdisposehandle_fn = ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_disposehandle; - ld->ld_ext_session_arg = ((struct ldap_x_ext_io_fns_rev0 *) optdata)->lextiof_session_arg; - ld->ld_extwritev_fn = NULL; - if ( ber_sockbuf_set_option( ld->ld_sbp, LBER_SOCKBUF_OPT_EXT_IO_FNS, - &(ld->ld_ext_io_fns) ) != 0 ) { - return( LDAP_LOCAL_ERROR ); - } - } - else { - /* struct copy */ - ld->ld_ext_io_fns = *((struct ldap_x_ext_io_fns *) optdata); - } - if (( rc = nsldapi_install_lber_extiofns( ld, ld->ld_sbp )) - != LDAP_SUCCESS ) { - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - rc = -1; - } - break; - - /* thread function pointers */ - case LDAP_OPT_THREAD_FN_PTRS: - /* struct copy */ - ld->ld_thread = *((struct ldap_thread_fns *) optdata); - if ( ld->ld_mutex_alloc_fn != NULL && - ld != &nsldapi_ld_defaults && - ld->ld_mutex != NULL ) { - for( i=0; ild_mutex[i] = (ld->ld_mutex_alloc_fn)(); - } - } - /* - * Because we have just replaced the locking functions, - * we return here without unlocking the LDAP_OPTION_LOCK. - */ - return (rc); - - /* extra thread function pointers */ - case LDAP_OPT_EXTRA_THREAD_FN_PTRS: - /* The extra thread funcs will only pick up the threadid */ - ld->ld_thread2 = *((struct ldap_extra_thread_fns *) optdata); - - /* Reset the rest of the structure preserving the threadid fn */ - ld->ld_mutex_trylock_fn = (LDAP_TF_MUTEX_TRYLOCK_CALLBACK *)NULL; - ld->ld_sema_alloc_fn = (LDAP_TF_SEMA_ALLOC_CALLBACK *) NULL; - ld->ld_sema_free_fn = (LDAP_TF_SEMA_FREE_CALLBACK *) NULL; - ld->ld_sema_wait_fn = (LDAP_TF_SEMA_WAIT_CALLBACK *) NULL; - ld->ld_sema_post_fn = (LDAP_TF_SEMA_POST_CALLBACK *) NULL; - - /* We assume that only one thread is active when replacing */ - /* the threadid function. We will now proceed and reset all */ - /* of the threadid/refcounts */ - for( i=0; ild_mutex_threadid[i] = (void *) -1; - ld->ld_mutex_refcnt[i] = 0; - } - - return (rc); - - /* DNS function pointers */ - case LDAP_OPT_DNS_FN_PTRS: - /* struct copy */ - ld->ld_dnsfn = *((struct ldap_dns_fns *) optdata); - break; - - /* cache function pointers */ - case LDAP_OPT_CACHE_FN_PTRS: - /* struct copy */ - ld->ld_cache = *((struct ldap_cache_fns *) optdata); - break; - case LDAP_OPT_CACHE_STRATEGY: - ld->ld_cache_strategy = *((int *) optdata); - break; - case LDAP_OPT_CACHE_ENABLE: - ld->ld_cache_on = *((int *) optdata); - break; - - case LDAP_OPT_ERROR_NUMBER: - LDAP_GET_LDERRNO( ld, &matched, &errstr ); - matched = nsldapi_strdup( matched ); - errstr = nsldapi_strdup( errstr ); - LDAP_SET_LDERRNO( ld, *((int *) optdata), matched, errstr ); - break; - - case LDAP_OPT_ERROR_STRING: - rc = LDAP_GET_LDERRNO( ld, &matched, NULL ); - matched = nsldapi_strdup( matched ); - LDAP_SET_LDERRNO( ld, rc, matched, - nsldapi_strdup((char *) optdata)); - rc = LDAP_SUCCESS; - break; - - case LDAP_OPT_MATCHED_DN: - rc = LDAP_GET_LDERRNO( ld, NULL, &errstr ); - errstr = nsldapi_strdup( errstr ); - LDAP_SET_LDERRNO( ld, rc, - nsldapi_strdup((char *) optdata), errstr ); - rc = LDAP_SUCCESS; - break; - - case LDAP_OPT_PREFERRED_LANGUAGE: - if ( NULL != ld->ld_preferred_language ) { - NSLDAPI_FREE(ld->ld_preferred_language); - } - ld->ld_preferred_language = nsldapi_strdup((char *) optdata); - break; - - case LDAP_OPT_HOST_NAME: - if ( NULL != ld->ld_defhost ) { - NSLDAPI_FREE(ld->ld_defhost); - } - ld->ld_defhost = nsldapi_strdup((char *) optdata); - break; - - case LDAP_X_OPT_CONNECT_TIMEOUT: - ld->ld_connect_timeout = *((int *) optdata); - break; - - default: - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - rc = -1; - } - - if ( ld != &nsldapi_ld_defaults ) { - LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK ); - } - return( rc ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/sort.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/sort.c deleted file mode 100644 index 8d46efe92c8..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/sort.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * 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) 1994 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ -/* - * sort.c: LDAP library entry and value sort routines - */ - -#include "ldap-int.h" - -/* This xp_qsort fixes a memory problem (ABR) on Solaris for the client. - * Server is welcome to use it too, but I wasn't sure if it - * would be ok to use XP code here. -slamm - * - * We don't want to require use of libxp when linking with libldap, so - * I'll leave use of xp_qsort as a MOZILLA_CLIENT-only thing for now. --mcs - */ -#if defined(MOZILLA_CLIENT) && defined(SOLARIS) -#include "xp_qsort.h" -#else -#define XP_QSORT qsort -#endif - -typedef struct keycmp { - void *kc_arg; - LDAP_KEYCMP_CALLBACK *kc_cmp; -} keycmp_t; - -typedef struct keything { - keycmp_t *kt_cmp; - const struct berval *kt_key; - LDAPMessage *kt_msg; -} keything_t; - -static int LDAP_C LDAP_CALLBACK -ldapi_keycmp( const void *Lv, const void *Rv ) -{ - auto keything_t **L = (keything_t**)Lv; - auto keything_t **R = (keything_t**)Rv; - auto keycmp_t *cmp = (*L)->kt_cmp; - return cmp->kc_cmp( cmp->kc_arg, (*L)->kt_key, (*R)->kt_key ); -} - -int -LDAP_CALL -ldap_keysort_entries( - LDAP *ld, - LDAPMessage **chain, - void *arg, - LDAP_KEYGEN_CALLBACK *gen, - LDAP_KEYCMP_CALLBACK *cmp, - LDAP_KEYFREE_CALLBACK *fre) -{ - size_t count, i; - keycmp_t kc = {0}; - keything_t **kt; - LDAPMessage *e, *last; - LDAPMessage **ep; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) - || chain == NULL || cmp == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - count = ldap_count_entries( ld, *chain ); - - kt = (keything_t**)NSLDAPI_MALLOC( count * (sizeof(keything_t*) + sizeof(keything_t)) ); - if ( kt == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - for ( i = 0; i < count; i++ ) { - kt[i] = i + (keything_t*)(kt + count); - } - kc.kc_arg = arg; - kc.kc_cmp = cmp; - - for ( e = *chain, i = 0; i < count; i++, e = e->lm_chain ) { - kt[i]->kt_msg = e; - kt[i]->kt_cmp = &kc; - kt[i]->kt_key = gen( arg, ld, e ); - if ( kt[i]->kt_key == NULL ) { - if ( fre ) while ( i-- > 0 ) fre( arg, kt[i]->kt_key ); - NSLDAPI_FREE( (char*)kt ); - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - } - last = e; - - XP_QSORT( (void*)kt, count, (size_t)sizeof(keything_t*), ldapi_keycmp ); - - ep = chain; - for ( i = 0; i < count; i++ ) { - *ep = kt[i]->kt_msg; - ep = &(*ep)->lm_chain; - if ( fre ) fre( arg, kt[i]->kt_key ); - } - *ep = last; - NSLDAPI_FREE( (char*)kt ); - return( 0 ); -} - - -struct entrything { - char **et_vals; - LDAPMessage *et_msg; -}; - -typedef int (LDAP_C LDAP_CALLBACK LDAP_CHARCMP_CALLBACK)(char*, char*); -typedef int (LDAP_C LDAP_CALLBACK LDAP_VOIDCMP_CALLBACK)(const void*, - const void*); - -static LDAP_CHARCMP_CALLBACK *et_cmp_fn; -static LDAP_VOIDCMP_CALLBACK et_cmp; - -int -LDAP_C -LDAP_CALLBACK -ldap_sort_strcasecmp( - const char **a, - const char **b -) -{ - /* XXXceb - * I am not 100% sure this is the way this should be handled. - * For now we will return a 0 on invalid. - */ - if (NULL == a || NULL == b) - return (0); - return( strcasecmp( (char *)*a, (char *)*b ) ); -} - -static int -LDAP_C -LDAP_CALLBACK -et_cmp( - const void *aa, - const void *bb -) -{ - int i, rc; - struct entrything *a = (struct entrything *)aa; - struct entrything *b = (struct entrything *)bb; - - if ( a->et_vals == NULL && b->et_vals == NULL ) - return( 0 ); - if ( a->et_vals == NULL ) - return( -1 ); - if ( b->et_vals == NULL ) - return( 1 ); - - for ( i = 0; a->et_vals[i] && b->et_vals[i]; i++ ) { - if ( (rc = (*et_cmp_fn)( a->et_vals[i], b->et_vals[i] )) - != 0 ) { - return( rc ); - } - } - - if ( a->et_vals[i] == NULL && b->et_vals[i] == NULL ) - return( 0 ); - if ( a->et_vals[i] == NULL ) - return( -1 ); - return( 1 ); -} - -int -LDAP_CALL -ldap_multisort_entries( - LDAP *ld, - LDAPMessage **chain, - char **attr, /* NULL => sort by DN */ - LDAP_CMP_CALLBACK *cmp -) -{ - int i, count; - struct entrything *et; - LDAPMessage *e, *last; - LDAPMessage **ep; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) - || chain == NULL || cmp == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - count = ldap_count_entries( ld, *chain ); - - if ( (et = (struct entrything *)NSLDAPI_MALLOC( count * - sizeof(struct entrything) )) == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - - e = *chain; - for ( i = 0; i < count; i++ ) { - et[i].et_msg = e; - et[i].et_vals = NULL; - if ( attr == NULL ) { - char *dn; - - dn = ldap_get_dn( ld, e ); - et[i].et_vals = ldap_explode_dn( dn, 1 ); - NSLDAPI_FREE( dn ); - } else { - int attrcnt; - char **vals; - - for ( attrcnt = 0; attr[attrcnt] != NULL; attrcnt++ ) { - vals = ldap_get_values( ld, e, attr[attrcnt] ); - if ( ldap_charray_merge( &(et[i].et_vals), vals ) - != 0 ) { - int j; - - /* XXX risky: ldap_value_free( vals ); */ - for ( j = 0; j <= i; j++ ) - ldap_value_free( et[j].et_vals ); - NSLDAPI_FREE( (char *) et ); - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, - NULL ); - return( -1 ); - } - if ( vals != NULL ) { - NSLDAPI_FREE( (char *)vals ); - } - } - } - - e = e->lm_chain; - } - last = e; - - et_cmp_fn = (LDAP_CHARCMP_CALLBACK *)cmp; - XP_QSORT( (void *) et, (size_t) count, - (size_t) sizeof(struct entrything), et_cmp ); - - ep = chain; - for ( i = 0; i < count; i++ ) { - *ep = et[i].et_msg; - ep = &(*ep)->lm_chain; - - ldap_value_free( et[i].et_vals ); - } - *ep = last; - NSLDAPI_FREE( (char *) et ); - - return( 0 ); -} - -int -LDAP_CALL -ldap_sort_entries( - LDAP *ld, - LDAPMessage **chain, - char *attr, /* NULL => sort by DN */ - LDAP_CMP_CALLBACK *cmp -) -{ - char *attrs[2]; - - attrs[0] = attr; - attrs[1] = NULL; - return( ldap_multisort_entries( ld, chain, attr ? attrs : NULL, cmp ) ); -} - -int -LDAP_CALL -ldap_sort_values( - LDAP *ld, - char **vals, - LDAP_VALCMP_CALLBACK *cmp -) -{ - int nel; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || cmp == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - if ( NULL == vals) - { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - for ( nel = 0; vals[nel] != NULL; nel++ ) - ; /* NULL */ - - XP_QSORT( vals, nel, sizeof(char *), (LDAP_VOIDCMP_CALLBACK *)cmp ); - - return( LDAP_SUCCESS ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/sortctrl.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/sortctrl.c deleted file mode 100644 index 5ebea69641f..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/sortctrl.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * 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 "ldap-int.h" - -/* ldap_create_sort_control: - - Parameters are - - ld LDAP pointer to the desired connection - - sortKeyList an array of sortkeys - - ctl_iscritical Indicates whether the control is critical of not. If - this field is non-zero, the operation will only be car- - ried out if the control is recognized by the server - and/or client - - ctrlp the address of a place to put the constructed control -*/ - -int -LDAP_CALL -ldap_create_sort_control ( - LDAP *ld, - LDAPsortkey **sortKeyList, - const char ctl_iscritical, - LDAPControl **ctrlp -) -{ - BerElement *ber; - int i, rc; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( sortKeyList == NULL || ctrlp == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return ( LDAP_PARAM_ERROR ); - } - - /* create a ber package to hold the controlValue */ - if ( ( nsldapi_alloc_ber_with_options( ld, &ber ) ) != LDAP_SUCCESS ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( LDAP_NO_MEMORY ); - } - - /* encode the start of the sequence of sequences into the ber */ - if ( ber_printf( ber, "{" ) == -1 ) { - goto encoding_error_exit; - } - - /* the sort control value will be encoded as a sequence of sequences - which are each encoded as one of the following: {s} or {sts} or {stb} or {ststb} - since the orderingRule and reverseOrder flag are both optional */ - for ( i = 0; sortKeyList[i] != NULL; i++ ) { - - /* encode the attributeType into the ber */ - if ( ber_printf( ber, "{s", (sortKeyList[i])->sk_attrtype ) - == -1 ) { - goto encoding_error_exit; - } - - /* encode the optional orderingRule into the ber */ - if ( (sortKeyList[i])->sk_matchruleoid != NULL ) { - if ( ber_printf( ber, "ts", LDAP_TAG_SK_MATCHRULE, - (sortKeyList[i])->sk_matchruleoid ) - == -1 ) { - goto encoding_error_exit; - } - } - - /* Encode the optional reverseOrder flag into the ber. */ - /* If the flag is false, it should be absent. */ - if ( (sortKeyList[i])->sk_reverseorder ) { - if ( ber_printf( ber, "tb}", LDAP_TAG_SK_REVERSE, - (sortKeyList[i])->sk_reverseorder ) == -1 ) { - goto encoding_error_exit; - } - } else { - if ( ber_printf( ber, "}" ) == -1 ) { - goto encoding_error_exit; - } - } - } - - /* encode the end of the sequence of sequences into the ber */ - if ( ber_printf( ber, "}" ) == -1 ) { - goto encoding_error_exit; - } - - rc = nsldapi_build_control( LDAP_CONTROL_SORTREQUEST, ber, 1, - ctl_iscritical, ctrlp ); - - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); - -encoding_error_exit: - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); -} - -/* ldap_parse_sort_control: - - Parameters are - - ld LDAP pointer to the desired connection - - ctrlp An array of controls obtained from calling - ldap_parse_result on the set of results returned by - the server - - result the address of a place to put the result code - - attribute the address of a place to put the name of the - attribute which cause the operation to fail, optionally - returned by the server */ - -int -LDAP_CALL -ldap_parse_sort_control ( - LDAP *ld, - LDAPControl **ctrlp, - unsigned long *result, - char **attribute -) -{ - BerElement *ber; - int i, foundSortControl; - LDAPControl *sortCtrlp; - unsigned long len, tag; - char *attr; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || result == NULL || - attribute == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - - /* find the sortControl in the list of controls if it exists */ - if ( ctrlp == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_CONTROL_NOT_FOUND, NULL, NULL ); - return ( LDAP_CONTROL_NOT_FOUND ); - } - foundSortControl = 0; - for ( i = 0; (( ctrlp[i] != NULL ) && ( !foundSortControl )); i++ ) { - foundSortControl = !strcmp( ctrlp[i]->ldctl_oid, LDAP_CONTROL_SORTRESPONSE ); - } - if ( !foundSortControl ) { - LDAP_SET_LDERRNO( ld, LDAP_CONTROL_NOT_FOUND, NULL, NULL ); - return ( LDAP_CONTROL_NOT_FOUND ); - } else { - /* let local var point to the sortControl */ - sortCtrlp = ctrlp[i-1]; - } - - /* allocate a Ber element with the contents of the sort_control's struct berval */ - if ( ( ber = ber_init( &sortCtrlp->ldctl_value ) ) == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( LDAP_NO_MEMORY ); - } - - /* decode the result from the Berelement */ - if ( ber_scanf( ber, "{i", result ) == LBER_ERROR ) { - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_DECODING_ERROR ); - } - - /* if the server returned one, decode the attribute from the Ber element */ - if ( ber_peek_tag( ber, &len ) == LDAP_TAG_SR_ATTRTYPE ) { - if ( ber_scanf( ber, "ta", &tag, &attr ) == LBER_ERROR ) { - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_DECODING_ERROR ); - } - *attribute = attr; - } else { - *attribute = NULL; - } - - if ( ber_scanf( ber, "}" ) == LBER_ERROR ) { - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_DECODING_ERROR ); - } - - /* the ber encoding is no longer needed */ - ber_free(ber,1); - - return( LDAP_SUCCESS ); -} - -/* Routines for the manipulation of string-representations of sort control keylists */ - -static int count_tokens(const char *s) -{ - int count = 0; - const char *p = s; - int whitespace = 1; - /* Loop along the string counting the number of times we see the - * beginning of non-whitespace. This tells us - * the number of tokens in the string - */ - while (*p != '\0') { - if (whitespace) { - if (!isspace(*p)) { - whitespace = 0; - count++; - } - } else { - if (isspace(*p)) { - whitespace = 1; - } - } - p++; - } - return count; -} - - -static int read_next_token(const char **s,LDAPsortkey **key) -{ - char c = 0; - const char *pos = *s; - int retval = 0; - LDAPsortkey *new_key = NULL; - - const char *matchrule_source = NULL; - int matchrule_size = 0; - const char *attrdesc_source = NULL; - int attrdesc_size = 0; - int reverse = 0; - - int state = 0; - - while ( ((c = *pos++) != '\0') && (state != 4) ) { - switch (state) { - case 0: - /* case where we've not seen the beginning of the attr yet */ - /* If we still see whitespace, nothing to do */ - if (!isspace(c)) { - /* Otherwise, something to look at */ - /* Is it a minus sign ? */ - if ('-' == c) { - reverse = 1; - } else { - attrdesc_source = pos - 1; - state = 1; - } - } - break; - case 1: - /* case where we've seen the beginning of the attr, but not the end */ - /* Is this char either whitespace or a ';' ? */ - if ( isspace(c) || (':' == c)) { - attrdesc_size = (pos - attrdesc_source) - 1; - if (':' == c) { - state = 2; - } else { - state = 4; - } - } - break; - case 2: - /* case where we've seen the end of the attr and want the beginning of match rule */ - if (!isspace(c)) { - matchrule_source = pos - 1; - state = 3; - } else { - state = 4; - } - break; - case 3: - /* case where we've seen the beginning of match rule and want to find the end */ - if (isspace(c)) { - matchrule_size = (pos - matchrule_source) - 1; - state = 4; - } - break; - default: - break; - } - } - - if (3 == state) { - /* means we fell off the end of the string looking for the end of the marching rule */ - matchrule_size = (pos - matchrule_source) - 1; - } - - if (1 == state) { - /* means we fell of the end of the string looking for the end of the attribute */ - attrdesc_size = (pos - attrdesc_source) - 1; - } - - if (NULL == attrdesc_source) { - /* Didn't find anything */ - return -1; - } - - new_key = (LDAPsortkey*)NSLDAPI_MALLOC(sizeof(LDAPsortkey)); - if (0 == new_key) { - return LDAP_NO_MEMORY; - } - - /* Allocate the strings */ - new_key->sk_attrtype = (char *)NSLDAPI_MALLOC(attrdesc_size + 1); - if (NULL != matchrule_source) { - new_key->sk_matchruleoid = (char *)NSLDAPI_MALLOC( - matchrule_size + 1); - } else { - new_key->sk_matchruleoid = NULL; - } - /* Copy over the strings */ - memcpy(new_key->sk_attrtype,attrdesc_source,attrdesc_size); - *(new_key->sk_attrtype + attrdesc_size) = '\0'; - if (NULL != matchrule_source) { - memcpy(new_key->sk_matchruleoid,matchrule_source,matchrule_size); - *(new_key->sk_matchruleoid + matchrule_size) = '\0'; - } - - new_key->sk_reverseorder = reverse; - - *s = pos - 1; - *key = new_key; - return retval; -} - -int -LDAP_CALL -ldap_create_sort_keylist ( - LDAPsortkey ***sortKeyList, - const char *string_rep -) -{ - int count = 0; - LDAPsortkey **pointer_array = NULL; - const char *current_position = NULL; - int retval = 0; - int i = 0; - - /* Figure out how many there are */ - if (NULL == string_rep) { - return LDAP_PARAM_ERROR; - } - if (NULL == sortKeyList) { - return LDAP_PARAM_ERROR; - } - count = count_tokens(string_rep); - if (0 == count) { - *sortKeyList = NULL; - return LDAP_PARAM_ERROR; - } - /* Allocate enough memory for the pointers */ - pointer_array = (LDAPsortkey**)NSLDAPI_MALLOC(sizeof(LDAPsortkey*) - * (count + 1) ); - if (NULL == pointer_array) { - return LDAP_NO_MEMORY; - } - /* Now walk along the string, allocating and filling in the LDAPsearchkey structure */ - current_position = string_rep; - - for (i = 0; i < count; i++) { - if (0 != (retval = read_next_token(¤t_position,&(pointer_array[i])))) { - pointer_array[count] = NULL; - ldap_free_sort_keylist(pointer_array); - *sortKeyList = NULL; - return retval; - } - } - pointer_array[count] = NULL; - *sortKeyList = pointer_array; - return LDAP_SUCCESS; -} - -void -LDAP_CALL -ldap_free_sort_keylist ( - LDAPsortkey **sortKeyList -) -{ - LDAPsortkey *this_one = NULL; - int i = 0; - - if ( NULL == sortKeyList ) { - return; - } - - /* Walk down the list freeing the LDAPsortkey structures */ - for (this_one = sortKeyList[0]; this_one ; this_one = sortKeyList[++i]) { - /* Free the strings, if present */ - if (NULL != this_one->sk_attrtype) { - NSLDAPI_FREE(this_one->sk_attrtype); - } - if (NULL != this_one->sk_matchruleoid) { - NSLDAPI_FREE(this_one->sk_matchruleoid); - } - NSLDAPI_FREE(this_one); - } - /* Free the pointer list */ - NSLDAPI_FREE(sortKeyList); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/srchpref.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/srchpref.c deleted file mode 100644 index 65630c51b15..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/srchpref.c +++ /dev/null @@ -1,421 +0,0 @@ -/* - * 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) 1993, 1994 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - * - */ -/* - * searchpref.c: search preferences library routines for LDAP clients - */ - -#include "ldap-int.h" -#include "srchpref.h" - -int nsldapi_next_line_tokens( char **bufp, long *blenp, char ***toksp ); -void nsldapi_free_strarray( char **sap ); -static void free_searchobj( struct ldap_searchobj *so ); -static int read_next_searchobj( char **bufp, long *blenp, - struct ldap_searchobj **sop, int soversion ); - - -static char *sobjoptions[] = { - "internal", - NULL -}; - - -static unsigned long sobjoptvals[] = { - LDAP_SEARCHOBJ_OPT_INTERNAL, -}; - - -int -LDAP_CALL -ldap_init_searchprefs( char *file, struct ldap_searchobj **solistp ) -{ - FILE *fp; - char *buf; - long rlen, len; - int rc, eof; - - if (( fp = fopen( file, "r" )) == NULL ) { - return( LDAP_SEARCHPREF_ERR_FILE ); - } - - if ( fseek( fp, 0L, SEEK_END ) != 0 ) { /* move to end to get len */ - fclose( fp ); - return( LDAP_SEARCHPREF_ERR_FILE ); - } - - len = ftell( fp ); - - if ( fseek( fp, 0L, SEEK_SET ) != 0 ) { /* back to start of file */ - fclose( fp ); - return( LDAP_SEARCHPREF_ERR_FILE ); - } - - if (( buf = NSLDAPI_MALLOC( (size_t)len )) == NULL ) { - fclose( fp ); - return( LDAP_SEARCHPREF_ERR_MEM ); - } - - rlen = fread( buf, 1, (size_t)len, fp ); - eof = feof( fp ); - fclose( fp ); - - if ( rlen != len && !eof ) { /* error: didn't get the whole file */ - NSLDAPI_FREE( buf ); - return( LDAP_SEARCHPREF_ERR_FILE ); - } - - rc = ldap_init_searchprefs_buf( buf, rlen, solistp ); - NSLDAPI_FREE( buf ); - - return( rc ); -} - - -int -LDAP_CALL -ldap_init_searchprefs_buf( char *buf, long buflen, - struct ldap_searchobj **solistp ) -{ - int rc = 0, version; - char **toks; - struct ldap_searchobj *prevso, *so; - - *solistp = prevso = NULLSEARCHOBJ; - - if ( nsldapi_next_line_tokens( &buf, &buflen, &toks ) != 2 || - strcasecmp( toks[ 0 ], "version" ) != 0 ) { - nsldapi_free_strarray( toks ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - version = atoi( toks[ 1 ] ); - nsldapi_free_strarray( toks ); - if ( version != LDAP_SEARCHPREF_VERSION && - version != LDAP_SEARCHPREF_VERSION_ZERO ) { - return( LDAP_SEARCHPREF_ERR_VERSION ); - } - - while ( buflen > 0 && ( rc = read_next_searchobj( &buf, &buflen, &so, - version )) == 0 && so != NULLSEARCHOBJ ) { - if ( prevso == NULLSEARCHOBJ ) { - *solistp = so; - } else { - prevso->so_next = so; - } - prevso = so; - } - - if ( rc != 0 ) { - ldap_free_searchprefs( *solistp ); - } - - return( rc ); -} - - - -void -LDAP_CALL -ldap_free_searchprefs( struct ldap_searchobj *solist ) -{ - struct ldap_searchobj *so, *nextso; - - if ( solist != NULL ) { - for ( so = solist; so != NULL; so = nextso ) { - nextso = so->so_next; - free_searchobj( so ); - } - } - /* XXX XXX need to do some work here */ -} - - -static void -free_searchobj( struct ldap_searchobj *so ) -{ - if ( so != NULL ) { - if ( so->so_objtypeprompt != NULL ) { - NSLDAPI_FREE( so->so_objtypeprompt ); - } - if ( so->so_prompt != NULL ) { - NSLDAPI_FREE( so->so_prompt ); - } - if ( so->so_filterprefix != NULL ) { - NSLDAPI_FREE( so->so_filterprefix ); - } - if ( so->so_filtertag != NULL ) { - NSLDAPI_FREE( so->so_filtertag ); - } - if ( so->so_defaultselectattr != NULL ) { - NSLDAPI_FREE( so->so_defaultselectattr ); - } - if ( so->so_defaultselecttext != NULL ) { - NSLDAPI_FREE( so->so_defaultselecttext ); - } - if ( so->so_salist != NULL ) { - struct ldap_searchattr *sa, *nextsa; - for ( sa = so->so_salist; sa != NULL; sa = nextsa ) { - nextsa = sa->sa_next; - if ( sa->sa_attrlabel != NULL ) { - NSLDAPI_FREE( sa->sa_attrlabel ); - } - if ( sa->sa_attr != NULL ) { - NSLDAPI_FREE( sa->sa_attr ); - } - if ( sa->sa_selectattr != NULL ) { - NSLDAPI_FREE( sa->sa_selectattr ); - } - if ( sa->sa_selecttext != NULL ) { - NSLDAPI_FREE( sa->sa_selecttext ); - } - NSLDAPI_FREE( sa ); - } - } - if ( so->so_smlist != NULL ) { - struct ldap_searchmatch *sm, *nextsm; - for ( sm = so->so_smlist; sm != NULL; sm = nextsm ) { - nextsm = sm->sm_next; - if ( sm->sm_matchprompt != NULL ) { - NSLDAPI_FREE( sm->sm_matchprompt ); - } - if ( sm->sm_filter != NULL ) { - NSLDAPI_FREE( sm->sm_filter ); - } - NSLDAPI_FREE( sm ); - } - } - NSLDAPI_FREE( so ); - } -} - - - -struct ldap_searchobj * -LDAP_CALL -ldap_first_searchobj( struct ldap_searchobj *solist ) -{ - return( solist ); -} - - -struct ldap_searchobj * -LDAP_CALL -ldap_next_searchobj( struct ldap_searchobj *solist, struct ldap_searchobj *so ) -{ - return( so == NULLSEARCHOBJ ? so : so->so_next ); -} - - - -static int -read_next_searchobj( char **bufp, long *blenp, struct ldap_searchobj **sop, - int soversion ) -{ - int i, j, tokcnt; - char **toks; - struct ldap_searchobj *so; - struct ldap_searchattr **sa; - struct ldap_searchmatch **sm; - - *sop = NULL; - - /* - * Object type prompt comes first - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - return( tokcnt == 0 ? 0 : LDAP_SEARCHPREF_ERR_SYNTAX ); - } - - if (( so = (struct ldap_searchobj *)NSLDAPI_CALLOC( 1, - sizeof( struct ldap_searchobj ))) == NULL ) { - nsldapi_free_strarray( toks ); - return( LDAP_SEARCHPREF_ERR_MEM ); - } - so->so_objtypeprompt = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * if this is post-version zero, options come next - */ - if ( soversion > LDAP_SEARCHPREF_VERSION_ZERO ) { - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) < 1 ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - for ( i = 0; toks[ i ] != NULL; ++i ) { - for ( j = 0; sobjoptions[ j ] != NULL; ++j ) { - if ( strcasecmp( toks[ i ], sobjoptions[ j ] ) == 0 ) { - so->so_options |= sobjoptvals[ j ]; - } - } - } - nsldapi_free_strarray( toks ); - } - - /* - * "Fewer choices" prompt is next - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - so->so_prompt = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * Filter prefix for "More Choices" searching is next - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - so->so_filterprefix = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * "Fewer Choices" filter tag comes next - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - so->so_filtertag = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * Selection (disambiguation) attribute comes next - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - so->so_defaultselectattr = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * Label for selection (disambiguation) attribute - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - so->so_defaultselecttext = toks[ 0 ]; - NSLDAPI_FREE( (char *)toks ); - - /* - * Search scope is next - */ - if (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) != 1 ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - if ( !strcasecmp(toks[ 0 ], "subtree" )) { - so->so_defaultscope = LDAP_SCOPE_SUBTREE; - } else if ( !strcasecmp(toks[ 0 ], "onelevel" )) { - so->so_defaultscope = LDAP_SCOPE_ONELEVEL; - } else if ( !strcasecmp(toks[ 0 ], "base" )) { - so->so_defaultscope = LDAP_SCOPE_BASE; - } else { - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - nsldapi_free_strarray( toks ); - - - /* - * "More Choices" search option list comes next - */ - sa = &( so->so_salist ); - while (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) > 0 ) { - if ( tokcnt < 5 ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - if (( *sa = ( struct ldap_searchattr * )NSLDAPI_CALLOC( 1, - sizeof( struct ldap_searchattr ))) == NULL ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_MEM ); - } - ( *sa )->sa_attrlabel = toks[ 0 ]; - ( *sa )->sa_attr = toks[ 1 ]; - ( *sa )->sa_selectattr = toks[ 3 ]; - ( *sa )->sa_selecttext = toks[ 4 ]; - /* Deal with bitmap */ - ( *sa )->sa_matchtypebitmap = 0; - for ( i = strlen( toks[ 2 ] ) - 1, j = 0; i >= 0; i--, j++ ) { - if ( toks[ 2 ][ i ] == '1' ) { - ( *sa )->sa_matchtypebitmap |= (1 << j); - } - } - NSLDAPI_FREE( toks[ 2 ] ); - NSLDAPI_FREE( ( char * ) toks ); - sa = &(( *sa )->sa_next); - } - *sa = NULL; - - /* - * Match types are last - */ - sm = &( so->so_smlist ); - while (( tokcnt = nsldapi_next_line_tokens( bufp, blenp, &toks )) > 0 ) { - if ( tokcnt < 2 ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_SYNTAX ); - } - if (( *sm = ( struct ldap_searchmatch * )NSLDAPI_CALLOC( 1, - sizeof( struct ldap_searchmatch ))) == NULL ) { - nsldapi_free_strarray( toks ); - ldap_free_searchprefs( so ); - return( LDAP_SEARCHPREF_ERR_MEM ); - } - ( *sm )->sm_matchprompt = toks[ 0 ]; - ( *sm )->sm_filter = toks[ 1 ]; - NSLDAPI_FREE( ( char * ) toks ); - sm = &(( *sm )->sm_next ); - } - *sm = NULL; - - *sop = so; - return( 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/svrcore.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/svrcore.c deleted file mode 100755 index 3810695b5aa..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/svrcore.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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): - */ - -/* This stub function allows us to get around - the linking error we were seeing on OSF - because of the svrcore component. This - module should be deleted as soon as the - svrcore mess is cleaned up */ - -#ifdef OSF1 -void SVRPLCY_InstallSSLPolicy() -{ - return; -} -#endif - diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/test.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/test.c deleted file mode 100644 index 725572e1284..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/test.c +++ /dev/null @@ -1,1849 +0,0 @@ -/* - * 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): - */ - -/* test.c - a simple test harness. */ -#include -#include -#include -#include -#ifdef MACOS -#ifdef THINK_C -#include -#include -#include -#endif /* THINK_C */ -#include "macos.h" -#else /* MACOS */ -#if defined( DOS ) -#include "msdos.h" -#if defined( WINSOCK ) -#include "console.h" -#endif /* WINSOCK */ -#else /* DOS */ -#ifdef _WINDOWS -#include -#include -#include -#include -//#include "console.h" -#else /* _WINDOWS */ -#include -#include -#include -#include -#include -#ifndef VMS -#include -#include -#endif /* VMS */ -#endif /* _WINDOWS */ -#endif /* DOS */ -#endif /* MACOS */ - -#undef NET_SSL - -#if defined(NET_SSL) -#include -static SECCertDBHandle certdbhandle; -#endif - -#include "ldap.h" -#include "disptmpl.h" -#include "ldaplog.h" -#ifndef NO_LIBLCACHE -#include "lcache.h" -#endif /* !NO_LIBLCACHE */ - -#if !defined( PCNFS ) && !defined( WINSOCK ) && !defined( MACOS ) -#define MOD_USE_BVALS -#endif /* !PCNFS && !WINSOCK && !MACOS */ - -static void handle_result( LDAP *ld, LDAPMessage *lm, int onlyone ); -static void print_ldap_result( LDAP *ld, LDAPMessage *lm, char *s ); -static void print_controls( LDAPControl **ctrls, int freeit ); -static void print_referrals( char **refs, int freeit ); -static void print_search_entry( LDAP *ld, LDAPMessage *res, int onlyone ); -static char *changetype_num2string( int chgtype ); -static void print_search_reference( LDAP *ld, LDAPMessage *res, int onlyone ); -static void free_list( char **list ); -static int entry2textwrite( void *fp, char *buf, int len ); -static void bprint( char *data, int len ); -static char **string2words( char *str, char *delims ); -static const char * url_parse_err2string( int e ); - -char *dnsuffix; - -#ifndef WINSOCK -static char * -getline( char *line, int len, FILE *fp, char *prompt ) -{ - printf(prompt); - - if ( fgets( line, len, fp ) == NULL ) - return( NULL ); - - line[ strlen( line ) - 1 ] = '\0'; - - return( line ); -} -#endif /* WINSOCK */ - -static char ** -get_list( char *prompt ) -{ - static char buf[256]; - int num; - char **result; - - num = 0; - result = (char **) 0; - while ( 1 ) { - getline( buf, sizeof(buf), stdin, prompt ); - - if ( *buf == '\0' ) - break; - - if ( result == (char **) 0 ) - result = (char **) malloc( sizeof(char *) ); - else - result = (char **) realloc( result, - sizeof(char *) * (num + 1) ); - - result[num++] = (char *) strdup( buf ); - } - if ( result == (char **) 0 ) - return( NULL ); - result = (char **) realloc( result, sizeof(char *) * (num + 1) ); - result[num] = NULL; - - return( result ); -} - - -static void -free_list( char **list ) -{ - int i; - - if ( list != NULL ) { - for ( i = 0; list[ i ] != NULL; ++i ) { - free( list[ i ] ); - } - free( (char *)list ); - } -} - - -#ifdef MOD_USE_BVALS -static int -file_read( char *path, struct berval *bv ) -{ - FILE *fp; - long rlen; - int eof; - - if (( fp = fopen( path, "r" )) == NULL ) { - perror( path ); - return( -1 ); - } - - if ( fseek( fp, 0L, SEEK_END ) != 0 ) { - perror( path ); - fclose( fp ); - return( -1 ); - } - - bv->bv_len = ftell( fp ); - - if (( bv->bv_val = (char *)malloc( bv->bv_len )) == NULL ) { - perror( "malloc" ); - fclose( fp ); - return( -1 ); - } - - if ( fseek( fp, 0L, SEEK_SET ) != 0 ) { - perror( path ); - fclose( fp ); - return( -1 ); - } - - rlen = fread( bv->bv_val, 1, bv->bv_len, fp ); - eof = feof( fp ); - fclose( fp ); - - if ( (unsigned long)rlen != bv->bv_len ) { - perror( path ); - free( bv->bv_val ); - return( -1 ); - } - - return( bv->bv_len ); -} -#endif /* MOD_USE_BVALS */ - - -static LDAPMod ** -get_modlist( char *prompt1, char *prompt2, char *prompt3 ) -{ - static char buf[256]; - int num; - LDAPMod tmp; - LDAPMod **result; -#ifdef MOD_USE_BVALS - struct berval **bvals; -#endif /* MOD_USE_BVALS */ - - num = 0; - result = NULL; - while ( 1 ) { - if ( prompt1 ) { - getline( buf, sizeof(buf), stdin, prompt1 ); - tmp.mod_op = atoi( buf ); - - if ( tmp.mod_op == -1 || buf[0] == '\0' ) - break; - } else { - tmp.mod_op = 0; - } - - getline( buf, sizeof(buf), stdin, prompt2 ); - if ( buf[0] == '\0' ) - break; - tmp.mod_type = strdup( buf ); - - tmp.mod_values = get_list( prompt3 ); -#ifdef MOD_USE_BVALS - if ( tmp.mod_values != NULL ) { - int i; - - for ( i = 0; tmp.mod_values[i] != NULL; ++i ) - ; - bvals = (struct berval **)calloc( i + 1, - sizeof( struct berval *)); - for ( i = 0; tmp.mod_values[i] != NULL; ++i ) { - bvals[i] = (struct berval *)malloc( - sizeof( struct berval )); - if ( strncmp( tmp.mod_values[i], "{FILE}", - 6 ) == 0 ) { - if ( file_read( tmp.mod_values[i] + 6, - bvals[i] ) < 0 ) { - return( NULL ); - } - } else { - bvals[i]->bv_val = tmp.mod_values[i]; - bvals[i]->bv_len = - strlen( tmp.mod_values[i] ); - } - } - tmp.mod_bvalues = bvals; - tmp.mod_op |= LDAP_MOD_BVALUES; - } -#endif /* MOD_USE_BVALS */ - - if ( result == NULL ) - result = (LDAPMod **) malloc( sizeof(LDAPMod *) ); - else - result = (LDAPMod **) realloc( result, - sizeof(LDAPMod *) * (num + 1) ); - - result[num] = (LDAPMod *) malloc( sizeof(LDAPMod) ); - *(result[num]) = tmp; /* struct copy */ - num++; - } - if ( result == NULL ) - return( NULL ); - result = (LDAPMod **) realloc( result, sizeof(LDAPMod *) * (num + 1) ); - result[num] = NULL; - - return( result ); -} - - -int LDAP_CALL LDAP_CALLBACK -bind_prompt( LDAP *ld, char **dnp, char **passwdp, int *authmethodp, - int freeit, void *dummy ) -{ - static char dn[256], passwd[256]; - - if ( !freeit ) { -#ifdef KERBEROS - getline( dn, sizeof(dn), stdin, - "re-bind method (0->simple, 1->krbv41, 2->krbv42, 3->krbv41&2)? " ); - if (( *authmethodp = atoi( dn )) == 3 ) { - *authmethodp = LDAP_AUTH_KRBV4; - } else { - *authmethodp |= 0x80; - } -#else /* KERBEROS */ - *authmethodp = LDAP_AUTH_SIMPLE; -#endif /* KERBEROS */ - - getline( dn, sizeof(dn), stdin, "re-bind dn? " ); - strcat( dn, dnsuffix ); - *dnp = dn; - - if ( *authmethodp == LDAP_AUTH_SIMPLE && dn[0] != '\0' ) { - getline( passwd, sizeof(passwd), stdin, - "re-bind password? " ); - } else { - passwd[0] = '\0'; - } - *passwdp = passwd; - } - - return( LDAP_SUCCESS ); -} - - -#define HEX2BIN( h ) ( (h) >= '0' && (h) <='0' ? (h) - '0' : (h) - 'A' + 10 ) - -void -berval_from_hex( struct berval *bvp, char *hexstr ) -{ - char *src, *dst, c, abyte; - - dst = bvp->bv_val; - bvp->bv_len = 0; - src = hexstr; - while ( *src != '\0' ) { - c = *src; - if ( isupper( c )) { - c = tolower( c ); - } - abyte = HEX2BIN( c ) << 4; - - ++src; - c = *src; - if ( isupper( c )) { - c = tolower( c ); - } - abyte |= HEX2BIN( c ); - ++src; - - *dst++ = abyte; - ++bvp->bv_len; - } -} - - -static void -add_control( LDAPControl ***ctrlsp, LDAPControl *newctrl ) -{ - int i; - - if ( *ctrlsp == NULL ) { - *ctrlsp = (LDAPControl **) calloc( 2, sizeof(LDAPControl *) ); - i = 0; - } else { - for ( i = 0; (*ctrlsp)[i] != NULL; i++ ) { - ; /* NULL */ - } - *ctrlsp = (LDAPControl **) realloc( *ctrlsp, - (i + 2) * sizeof(LDAPControl *) ); - } - (*ctrlsp)[i] = newctrl; - (*ctrlsp)[i+1] = NULL; -} - - -#ifdef TEST_CUSTOM_MALLOC - -typedef struct my_malloc_info { - long mmi_magic; - size_t mmi_actualsize; -} MyMallocInfo; -#define MY_MALLOC_MAGIC_NUMBER 0x19940618 - -#define MY_MALLOC_CHECK_MAGIC( p ) if ( ((MyMallocInfo *)( (p) - sizeof() - -void * -my_malloc( size_t size ) -{ - void *p; - MyMallocInfo *mmip; - - if (( p = malloc( size + sizeof( struct my_malloc_info ))) != NULL ) { - mmip = (MyMallocInfo *)p; - mmip->mmi_magic = MY_MALLOC_MAGIC_NUMBER; - mmip->mmi_actualsize = size; - } - - fprintf( stderr, "my_malloc: allocated ptr 0x%x, size %ld\n", - p, mmip->mmi_actualsize ); - - return( (char *)p + sizeof( MyMallocInfo )); -} - - -void * -my_calloc( size_t nelem, size_t elsize ) -{ - void *p; - - if (( p = my_malloc( nelem * elsize )) != NULL ) { - memset( p, 0, nelem * elsize ); - } - - return( p ); -} - - -void -my_free( void *ptr ) -{ - char *p; - MyMallocInfo *mmip; - - p = (char *)ptr; - p -= sizeof( MyMallocInfo ); - mmip = (MyMallocInfo *)p; - if ( mmip->mmi_magic != MY_MALLOC_MAGIC_NUMBER ) { - fprintf( stderr, - "my_malloc_check_magic: ptr 0x%x bad magic number\n", ptr ); - exit( 1 ); - } - - fprintf( stderr, "my_free: freeing ptr 0x%x, size %ld\n", - p, mmip->mmi_actualsize ); - - memset( p, 0, mmip->mmi_actualsize + sizeof( MyMallocInfo )); - free( p ); -} - - -void * -my_realloc( void *ptr, size_t size ) -{ - void *p; - MyMallocInfo *mmip; - - if ( ptr == NULL ) { - return( my_malloc( size )); - } - - mmip = (MyMallocInfo *)( (char *)ptr - sizeof( MyMallocInfo )); - if ( mmip->mmi_magic != MY_MALLOC_MAGIC_NUMBER ) { - fprintf( stderr, - "my_malloc_check_magic: ptr 0x%x bad magic number\n", ptr ); - exit( 1 ); - } - - if ( size <= mmip->mmi_actualsize ) { /* current block big enough? */ - return( ptr ); - } - - if (( p = my_malloc( size )) != NULL ) { - memcpy( p, ptr, mmip->mmi_actualsize ); - my_free( ptr ); - } - - return( p ); -} -#endif /* TEST_CUSTOM_MALLOC */ - -int -#ifdef WINSOCK -ldapmain( -#else /* WINSOCK */ -main( -#endif /* WINSOCK */ - int argc, char **argv ) -{ - LDAP *ld; - int rc, i, c, port, cldapflg, errflg, method, id, msgtype; - int version; - char line[256], command1, command2, command3; - char passwd[64], dn[256], rdn[64], attr[64], value[256]; - char filter[256], *host, **types; - char **exdn, *fnname; - int bound, all, scope, attrsonly, optval, ldapversion; - LDAPMessage *res; - LDAPMod **mods, **attrs; - struct timeval timeout, *tvp; - char *copyfname = NULL; - int copyoptions = 0; - LDAPURLDesc *ludp; - struct ldap_disptmpl *tmpllist = NULL; - int changetypes, changesonly, return_echg_ctls; - LDAPControl **tmpctrls, *newctrl, **controls = NULL; - char *usage = "usage: %s [-u] [-h host] [-d level] [-s dnsuffix] [-p port] [-t file] [-T file] [-V protocolversion]\n"; - - extern char *optarg; - extern int optind; - -#ifdef MACOS - if (( argv = get_list( "cmd line arg?" )) == NULL ) { - exit( 1 ); - } - for ( argc = 0; argv[ argc ] != NULL; ++argc ) { - ; - } -#endif /* MACOS */ - -#ifdef TEST_CUSTOM_MALLOC - { - struct ldap_memalloc_fns memalloc_fns; - - memalloc_fns.ldapmem_malloc = my_malloc; - memalloc_fns.ldapmem_calloc = my_calloc; - memalloc_fns.ldapmem_realloc = my_realloc; - memalloc_fns.ldapmem_free = my_free; - - if ( ldap_set_option( NULL, LDAP_OPT_MEMALLOC_FN_PTRS, - &memalloc_fns ) != 0 ) { - fputs( "ldap_set_option failed\n", stderr ); - exit( 1 ); - } - } -#endif /* TEST_CUSTOM_MALLOC */ - - host = NULL; - port = LDAP_PORT; - dnsuffix = ""; - cldapflg = errflg = 0; - ldapversion = 0; /* use default */ -#ifndef _WIN32 -#ifdef LDAP_DEBUG - ldap_debug = LDAP_DEBUG_ANY; -#endif -#endif - - while (( c = getopt( argc, argv, "uh:d:s:p:t:T:V:" )) != -1 ) { - switch( c ) { - case 'u': -#ifdef CLDAP - cldapflg++; -#else /* CLDAP */ - printf( "Compile with -DCLDAP for UDP support\n" ); -#endif /* CLDAP */ - break; - - case 'd': -#ifndef _WIN32 -#ifdef LDAP_DEBUG - ldap_debug = atoi( optarg ) | LDAP_DEBUG_ANY; - if ( ldap_debug & LDAP_DEBUG_PACKETS ) { - ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, - &ldap_debug ); - } -#else - printf( "Compile with -DLDAP_DEBUG for debugging\n" ); -#endif -#endif - break; - - case 'h': - host = optarg; - break; - - case 's': - dnsuffix = optarg; - break; - - case 'p': - port = atoi( optarg ); - break; - -#if !defined(MACOS) && !defined(DOS) - case 't': /* copy ber's to given file */ - copyfname = strdup( optarg ); - copyoptions = LBER_SOCKBUF_OPT_TO_FILE; - break; - - case 'T': /* only output ber's to given file */ - copyfname = strdup( optarg ); - copyoptions = (LBER_SOCKBUF_OPT_TO_FILE | - LBER_SOCKBUF_OPT_TO_FILE_ONLY); - break; -#endif - case 'V': /* LDAP protocol version */ - ldapversion = atoi( optarg ); - break; - - default: - ++errflg; - } - } - - if ( host == NULL && optind == argc - 1 ) { - host = argv[ optind ]; - ++optind; - } - - if ( errflg || optind < argc - 1 ) { - fprintf( stderr, usage, argv[ 0 ] ); - exit( 1 ); - } - - printf( "%sldap_init( %s, %d )\n", cldapflg ? "c" : "", - host == NULL ? "(null)" : host, port ); - - if ( cldapflg ) { -#ifdef CLDAP - ld = cldap_open( host, port ); -#endif /* CLDAP */ - } else { - ld = ldap_init( host, port ); - } - - if ( ld == NULL ) { - perror( "ldap_init" ); - exit(1); - } - - if ( ldapversion != 0 && ldap_set_option( ld, - LDAP_OPT_PROTOCOL_VERSION, (void *)&ldapversion ) != 0 ) { - ldap_perror( ld, "ldap_set_option (protocol version)" ); - exit(1); - } - -#ifdef notdef -#if !defined(MACOS) && !defined(DOS) - if ( copyfname != NULL ) { - int fd; - Sockbuf *sb; - - if ( (fd = open( copyfname, O_WRONLY | O_CREAT, 0600 )) - == -1 ) { - perror( copyfname ); - exit ( 1 ); - } - ldap_get_option( ld, LDAP_OPT_SOCKBUF, &sb ); - ber_sockbuf_set_option( sb, LBER_SOCKBUF_OPT_COPYDESC, - (void *) &fd ); - ber_sockbuf_set_option( sb, copyoptions, LBER_OPT_ON ); - } -#endif -#endif - - bound = 0; - timeout.tv_sec = 0; - timeout.tv_usec = 0; - tvp = &timeout; - - (void) memset( line, '\0', sizeof(line) ); - while ( getline( line, sizeof(line), stdin, "\ncommand? " ) != NULL ) { - command1 = line[0]; - command2 = line[1]; - command3 = line[2]; - - switch ( command1 ) { - case 'a': /* add or abandon */ - switch ( command2 ) { - case 'd': /* add */ - getline( dn, sizeof(dn), stdin, "dn? " ); - strcat( dn, dnsuffix ); - if ( (attrs = get_modlist( NULL, "attr? ", - "value? " )) == NULL ) - break; - if ( (id = ldap_add( ld, dn, attrs )) == -1 ) - ldap_perror( ld, "ldap_add" ); - else - printf( "Add initiated with id %d\n", - id ); - break; - - case 'b': /* abandon */ - getline( line, sizeof(line), stdin, "msgid? " ); - id = atoi( line ); - if ( ldap_abandon( ld, id ) != 0 ) - ldap_perror( ld, "ldap_abandon" ); - else - printf( "Abandon successful\n" ); - break; - default: - printf( "Possibilities: [ad]d, [ab]ort\n" ); - } - break; - - case 'v': /* ldap protocol version */ - getline( line, sizeof(line), stdin, - "ldap version? " ); - version = atoi( line ); - if ( ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, - (void *) &version ) != 0 ) { - ldap_perror( ld, "ldap_set_option" ); - } - break; - - case 'b': /* asynch bind */ - getline( line, sizeof(line), stdin, - "method 0->simple 3->sasl? " ); - method = atoi( line ); - if ( method == 0 ) { - method = LDAP_AUTH_SIMPLE; - } else if ( method == 3 ) { - method = LDAP_AUTH_SASL; - } - getline( dn, sizeof(dn), stdin, "dn? " ); - strcat( dn, dnsuffix ); - - if ( method == LDAP_AUTH_SIMPLE && dn[0] != '\0' ) { - } else { - passwd[0] = '\0'; - } - - if ( method == LDAP_AUTH_SIMPLE ) { - if ( dn[0] != '\0' ) { - getline( passwd, sizeof(passwd), stdin, - "password? " ); - } else { - passwd[0] = '\0'; - } - rc = ldap_simple_bind( ld, dn, passwd ); - } else { - struct berval cred; - char mechanism[BUFSIZ]; - - getline( mechanism, sizeof(mechanism), stdin, - "mechanism? " ); - getline( passwd, sizeof(passwd), stdin, - "credentials? " ); - cred.bv_val = passwd; - cred.bv_len = strlen( passwd ); - if ( ldap_sasl_bind( ld, dn, mechanism, &cred, - NULL, NULL, &rc ) != LDAP_SUCCESS ) { - rc = -1; - } - } - if ( rc == -1 ) { - fprintf( stderr, "ldap_bind failed\n" ); - ldap_perror( ld, "ldap_bind" ); - } else { - printf( "Bind initiated\n" ); - bound = 1; - } - break; - - case 'B': /* synch bind */ - getline( line, sizeof(line), stdin, - "method 0->simple 3->sasl? " ); - method = atoi( line ); - if ( method == 0 ) { - method = LDAP_AUTH_SIMPLE; - } else if ( method == 3 ) { - method = LDAP_AUTH_SASL; - } - getline( dn, sizeof(dn), stdin, "dn? " ); - strcat( dn, dnsuffix ); - - if ( method == LDAP_AUTH_SIMPLE && dn[0] != '\0' ) { - } else { - passwd[0] = '\0'; - } - - if ( method == LDAP_AUTH_SIMPLE ) { - if ( dn[0] != '\0' ) { - getline( passwd, sizeof(passwd), stdin, - "password? " ); - } else { - passwd[0] = '\0'; - } - rc = ldap_simple_bind_s( ld, dn, passwd ); - fnname = "ldap_simple_bind_s"; - } else { - struct berval cred; - char mechanism[BUFSIZ]; - - getline( mechanism, sizeof(mechanism), stdin, - "mechanism? " ); - getline( passwd, sizeof(passwd), stdin, - "credentials? " ); - cred.bv_val = passwd; - cred.bv_len = strlen( passwd ); - rc = ldap_sasl_bind_s( ld, dn, mechanism, - &cred, NULL, NULL, NULL ); - fnname = "ldap_sasl_bind_s"; - } - if ( rc != LDAP_SUCCESS ) { - fprintf( stderr, "%s failed\n", fnname ); - ldap_perror( ld, fnname ); - } else { - printf( "Bind successful\n" ); - bound = 1; - } - break; - - case 'c': /* compare */ - getline( dn, sizeof(dn), stdin, "dn? " ); - strcat( dn, dnsuffix ); - getline( attr, sizeof(attr), stdin, "attr? " ); - getline( value, sizeof(value), stdin, "value? " ); - - if ( (id = ldap_compare( ld, dn, attr, value )) == -1 ) - ldap_perror( ld, "ldap_compare" ); - else - printf( "Compare initiated with id %d\n", id ); - break; - - case 'x': /* extended operation */ - { - char oid[100]; - struct berval val; - - getline( oid, sizeof(oid), stdin, "oid? " ); - getline( value, sizeof(value), stdin, "value? " ); - - val.bv_val = value; - val.bv_len = strlen( value ); - if ( ldap_extended_operation( ld, oid, &val, NULL, - NULL, &id ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_extended_operation" ); - } else { - printf( "Extended op initiated with id %d\n", - id ); - } - } - break; - - case 'C': /* set cache parameters */ -#ifdef NO_LIBLCACHE - getline( line, sizeof(line), stdin, - "cache init (memcache 0)? " ); -#else - getline( line, sizeof(line), stdin, - "cache init (memcache 0, lcache 1)? " ); -#endif - i = atoi( line ); - if ( i == 0 ) { /* memcache */ - unsigned long ttl, size; - char **basedns, *dnarray[2]; - LDAPMemCache *mc; - - getline( line, sizeof(line), stdin, - "memcache ttl? " ); - ttl = atoi( line ); - getline( line, sizeof(line), stdin, - "memcache size? " ); - size = atoi( line ); - getline( line, sizeof(line), stdin, - "memcache baseDN? " ); - if ( *line == '\0' ) { - basedns = NULL; - } else { - dnarray[0] = line; - dnarray[1] = NULL; - basedns = dnarray; - } - if (( rc = ldap_memcache_init( ttl, size, - basedns, NULL, &mc )) != LDAP_SUCCESS ) { - fprintf( stderr, - "ldap_memcache_init: %s\n", - ldap_err2string( rc )); - } else if (( rc = ldap_memcache_set( ld, mc )) - != LDAP_SUCCESS ) { - fprintf( stderr, - "ldap_memcache_set: %s\n", - ldap_err2string( rc )); - } - -#ifndef NO_LIBLCACHE - } else if ( i == 1 ) { - getline( line, sizeof(line), stdin, - "cache config file? " ); - if ( line[0] != '\0' ) { - if ( lcache_init( ld, line ) != 0 ) { - perror( "ldap_cache_init" ); - break; - } - } - getline( line, sizeof(line), stdin, - "cache on/off (on 1, off 0)? " ); - if ( line[0] != '\0' ) { - i = atoi( line ); - if ( ldap_set_option( ld, - LDAP_OPT_CACHE_ENABLE, &i ) != 0 ) { - ldap_perror( ld, "ldap_cache_enable" ); - break; - } - } - getline( line, sizeof(line), stdin, - "cache strategy (check 0, populate 1, localdb 2)? " ); - if ( line[0] != '\0' ) { - i = atoi( line ); - if ( ldap_set_option( ld, - LDAP_OPT_CACHE_STRATEGY, &i ) - != 0 ) { - ldap_perror(ld, "ldap_cache_strategy"); - break; - } - } -#endif /* !NO_LIBLCACHE */ - - } else { - fprintf( stderr, "unknown cachetype %d\n", i ); - } - break; - - case 'd': /* turn on debugging */ -#ifndef _WIN32 -#ifdef LDAP_DEBUG - getline( line, sizeof(line), stdin, "debug level? " ); - ldap_debug = atoi( line ) | LDAP_DEBUG_ANY; - if ( ldap_debug & LDAP_DEBUG_PACKETS ) { - ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, - &ldap_debug ); - } -#else - printf( "Compile with -DLDAP_DEBUG for debugging\n" ); -#endif -#endif - break; - - case 'E': /* explode a dn */ - getline( line, sizeof(line), stdin, "dn? " ); - exdn = ldap_explode_dn( line, 0 ); - for ( i = 0; exdn != NULL && exdn[i] != NULL; i++ ) { - printf( "\t\"%s\"\n", exdn[i] ); - } - break; - - case 'R': /* explode an rdn */ - getline( line, sizeof(line), stdin, "rdn? " ); - exdn = ldap_explode_rdn( line, 0 ); - for ( i = 0; exdn != NULL && exdn[i] != NULL; i++ ) { - printf( "\t\"%s\"\n", exdn[i] ); - } - break; - - case 'm': /* modify or modifyrdn */ - if ( strncmp( line, "modify", 4 ) == 0 ) { - getline( dn, sizeof(dn), stdin, "dn? " ); - strcat( dn, dnsuffix ); - if ( (mods = get_modlist( - "mod (0=>add, 1=>delete, 2=>replace -1=>done)? ", - "attribute type? ", "attribute value? " )) - == NULL ) - break; - if ( (id = ldap_modify( ld, dn, mods )) == -1 ) - ldap_perror( ld, "ldap_modify" ); - else - printf( "Modify initiated with id %d\n", - id ); - } else if ( strncmp( line, "modrdn", 4 ) == 0 ) { - getline( dn, sizeof(dn), stdin, "dn? " ); - strcat( dn, dnsuffix ); - getline( rdn, sizeof(rdn), stdin, "newrdn? " ); - getline( line, sizeof(line), stdin, - "deleteoldrdn? " ); - if ( (id = ldap_modrdn2( ld, dn, rdn, - atoi(line) )) == -1 ) - ldap_perror( ld, "ldap_modrdn" ); - else - printf( "Modrdn initiated with id %d\n", - id ); - } else { - printf( "Possibilities: [modi]fy, [modr]dn\n" ); - } - break; - - case 'q': /* quit */ -#ifdef CLDAP - if ( cldapflg ) - cldap_close( ld ); -#endif /* CLDAP */ - if ( !cldapflg ) - ldap_unbind( ld ); - exit( 0 ); - break; - - case 'r': /* result or remove */ - switch ( command3 ) { - case 's': /* result */ - getline( line, sizeof(line), stdin, - "msgid (-1=>any)? " ); - if ( line[0] == '\0' ) - id = -1; - else - id = atoi( line ); - getline( line, sizeof(line), stdin, - "all (0=>any, 1=>all)? " ); - if ( line[0] == '\0' ) - all = 1; - else - all = atoi( line ); - if (( msgtype = ldap_result( ld, id, all, - tvp, &res )) < 1 ) { - ldap_perror( ld, "ldap_result" ); - break; - } - printf( "\nresult: msgtype %d msgid %d\n", - msgtype, ldap_msgid( res ) ); - handle_result( ld, res, 0 ); - res = NULL; - break; - - case 'm': /* remove */ - getline( dn, sizeof(dn), stdin, "dn? " ); - strcat( dn, dnsuffix ); - if ( (id = ldap_delete( ld, dn )) == -1 ) - ldap_perror( ld, "ldap_delete" ); - else - printf( "Remove initiated with id %d\n", - id ); - break; - - default: - printf( "Possibilities: [rem]ove, [res]ult\n" ); - break; - } - break; - - case 's': /* search */ - getline( dn, sizeof(dn), stdin, "searchbase? " ); - strcat( dn, dnsuffix ); - getline( line, sizeof(line), stdin, - "scope (0=Base, 1=One Level, 2=Subtree)? " ); - scope = atoi( line ); - getline( filter, sizeof(filter), stdin, - "search filter (e.g. sn=jones)? " ); - types = get_list( "attrs to return? " ); - getline( line, sizeof(line), stdin, - "attrsonly (0=attrs&values, 1=attrs only)? " ); - attrsonly = atoi( line ); - - if ( cldapflg ) { -#ifdef CLDAP - getline( line, sizeof(line), stdin, - "Requestor DN (for logging)? " ); - if ( cldap_search_s( ld, dn, scope, filter, types, - attrsonly, &res, line ) != 0 ) { - ldap_perror( ld, "cldap_search_s" ); - } else { - printf( "\nresult: msgid %d\n", - res->lm_msgid ); - handle_result( ld, res, 0 ); - res = NULL; - } -#endif /* CLDAP */ - } else { - if (( id = ldap_search( ld, dn, scope, filter, - types, attrsonly )) == -1 ) { - ldap_perror( ld, "ldap_search" ); - } else { - printf( "Search initiated with id %d\n", id ); - } - } - free_list( types ); - break; - - case 't': /* set timeout value */ - getline( line, sizeof(line), stdin, "timeout (-1=infinite)? " ); - timeout.tv_sec = atoi( line ); - if ( timeout.tv_sec < 0 ) { - tvp = NULL; - } else { - tvp = &timeout; - } - break; - - case 'U': /* set ufn search prefix */ - getline( line, sizeof(line), stdin, "ufn prefix? " ); - ldap_ufn_setprefix( ld, line ); - break; - - case 'u': /* user friendly search w/optional timeout */ - getline( dn, sizeof(dn), stdin, "ufn? " ); - strcat( dn, dnsuffix ); - types = get_list( "attrs to return? " ); - getline( line, sizeof(line), stdin, - "attrsonly (0=attrs&values, 1=attrs only)? " ); - attrsonly = atoi( line ); - - if ( command2 == 't' ) { - id = ldap_ufn_search_c( ld, dn, types, - attrsonly, &res, ldap_ufn_timeout, - &timeout ); - } else { - id = ldap_ufn_search_s( ld, dn, types, - attrsonly, &res ); - } - if ( res == NULL ) - ldap_perror( ld, "ldap_ufn_search" ); - else { - printf( "\nresult: err %d\n", id ); - handle_result( ld, res, 0 ); - res = NULL; - } - free_list( types ); - break; - - case 'l': /* URL search */ - getline( line, sizeof(line), stdin, - "attrsonly (0=attrs&values, 1=attrs only)? " ); - attrsonly = atoi( line ); - getline( line, sizeof(line), stdin, "LDAP URL? " ); - if (( id = ldap_url_search( ld, line, attrsonly )) - == -1 ) { - ldap_perror( ld, "ldap_url_search" ); - } else { - printf( "URL search initiated with id %d\n", id ); - } - break; - - case 'p': /* parse LDAP URL */ - getline( line, sizeof(line), stdin, "LDAP URL? " ); - if (( i = ldap_url_parse( line, &ludp )) != 0 ) { - fprintf( stderr, "ldap_url_parse: error %d (%s)\n", i, - url_parse_err2string( i )); - } else { - printf( "\t host: " ); - if ( ludp->lud_host == NULL ) { - printf( "DEFAULT\n" ); - } else { - printf( "<%s>\n", ludp->lud_host ); - } - printf( "\t port: " ); - if ( ludp->lud_port == 0 ) { - printf( "DEFAULT\n" ); - } else { - printf( "%d\n", ludp->lud_port ); - } - printf( "\tsecure: %s\n", ( ludp->lud_options & - LDAP_URL_OPT_SECURE ) != 0 ? "Yes" : "No" ); - printf( "\t dn: " ); - if ( ludp->lud_dn == NULL ) { - printf( "ROOT\n" ); - } else { - printf( "%s\n", ludp->lud_dn ); - } - printf( "\t attrs:" ); - if ( ludp->lud_attrs == NULL ) { - printf( " ALL" ); - } else { - for ( i = 0; ludp->lud_attrs[ i ] != NULL; ++i ) { - printf( " <%s>", ludp->lud_attrs[ i ] ); - } - } - printf( "\n\t scope: %s\n", ludp->lud_scope == LDAP_SCOPE_ONELEVEL ? - "ONE" : ludp->lud_scope == LDAP_SCOPE_BASE ? "BASE" : - ludp->lud_scope == LDAP_SCOPE_SUBTREE ? "SUB" : "**invalid**" ); - printf( "\tfilter: <%s>\n", ludp->lud_filter ); - ldap_free_urldesc( ludp ); - } - break; - - case 'n': /* set dn suffix, for convenience */ - getline( line, sizeof(line), stdin, "DN suffix? " ); - strcpy( dnsuffix, line ); - break; - - case 'N': /* add an LDAPv3 control */ - getline( line, sizeof(line), stdin, - "Control oid (. to clear list)? " ); - if ( *line == '.' && *(line+1) == '\0' ) { - controls = NULL; - } else { - newctrl = (LDAPControl *) malloc( - sizeof(LDAPControl) ); - newctrl->ldctl_oid = strdup( line ); - getline( line, sizeof(line), stdin, - "Control value? " ); - if ( strncmp( line, "0x", 2 ) == 0 ) { - newctrl->ldctl_value.bv_val = - (char *)malloc( strlen( line ) / 2 ); - berval_from_hex( &(newctrl->ldctl_value), - line + 2 ); - } else { - newctrl->ldctl_value.bv_val - = strdup( line ); - } - newctrl->ldctl_value.bv_len = strlen( line ); - getline( line, sizeof(line), stdin, - "Critical (0=no, 1=yes)? " ); - newctrl->ldctl_iscritical = atoi( line ); - add_control( &controls, newctrl ); - } - ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, - controls ); - ldap_get_option( ld, LDAP_OPT_SERVER_CONTROLS, - &tmpctrls ); - print_controls( tmpctrls, 0 ); - break; - - case 'P': /* add a persistent search control */ - getline( line, sizeof(line), stdin, "Changetypes to " - " return (additive - add (1), delete (2), " - "modify (4), modDN (8))? " ); - changetypes = atoi(line); - getline( line, sizeof(line), stdin, - "Return changes only (0=no, 1=yes)? " ); - changesonly = atoi(line); - getline( line, sizeof(line), stdin, "Return entry " - "change controls (0=no, 1=yes)? " ); - return_echg_ctls = atoi(line); - getline( line, sizeof(line), stdin, - "Critical (0=no, 1=yes)? " ); - if ( ldap_create_persistentsearch_control( ld, - changetypes, changesonly, return_echg_ctls, - (char)atoi(line), &newctrl ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_create_persistent" - "search_control" ); - } else { - add_control( &controls, newctrl ); - ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, - controls ); - ldap_get_option( ld, LDAP_OPT_SERVER_CONTROLS, - &tmpctrls ); - print_controls( tmpctrls, 0 ); - } - break; - - case 'o': /* set ldap options */ - getline( line, sizeof(line), stdin, "alias deref (0=never, 1=searching, 2=finding, 3=always)?" ); - i = atoi( line ); - ldap_set_option( ld, LDAP_OPT_DEREF, &i ); - getline( line, sizeof(line), stdin, "timelimit?" ); - i = atoi( line ); - ldap_set_option( ld, LDAP_OPT_TIMELIMIT, &i ); - getline( line, sizeof(line), stdin, "sizelimit?" ); - i = atoi( line ); - ldap_set_option( ld, LDAP_OPT_SIZELIMIT, &i ); - -#ifdef STR_TRANSLATION - getline( line, sizeof(line), stdin, - "Automatic translation of T.61 strings (0=no, 1=yes)?" ); - if ( atoi( line ) == 0 ) { - ld->ld_lberoptions &= ~LBER_OPT_TRANSLATE_STRINGS; - } else { - ld->ld_lberoptions |= LBER_OPT_TRANSLATE_STRINGS; -#ifdef LDAP_CHARSET_8859 - getline( line, sizeof(line), stdin, - "Translate to/from ISO-8859 (0=no, 1=yes?" ); - if ( atoi( line ) != 0 ) { - ldap_set_string_translators( ld, - ldap_8859_to_t61, - ldap_t61_to_8859 ); - } -#endif /* LDAP_CHARSET_8859 */ - } -#endif /* STR_TRANSLATION */ - -#ifdef LDAP_DNS - getline( line, sizeof(line), stdin, - "Use DN & DNS to determine where to send requests (0=no, 1=yes)?" ); - optval = ( atoi( line ) != 0 ); - ldap_set_option( ld, LDAP_OPT_DNS, (void *) optval ); -#endif /* LDAP_DNS */ - - getline( line, sizeof(line), stdin, - "Recognize and chase referrals (0=no, 1=yes)?" ); - optval = ( atoi( line ) != 0 ); - ldap_set_option( ld, LDAP_OPT_REFERRALS, - (void *) optval ); - if ( optval ) { - getline( line, sizeof(line), stdin, - "Prompt for bind credentials when chasing referrals (0=no, 1=yes)?" ); - if ( atoi( line ) != 0 ) { - ldap_set_rebind_proc( ld, bind_prompt, - NULL ); - } - } -#ifdef NET_SSL - getline( line, sizeof(line), stdin, - "Use Secure Sockets Layer - SSL (0=no, 1=yes)?" ); - optval = ( atoi( line ) != 0 ); - if ( optval ) { - getline( line, sizeof(line), stdin, - "security DB path?" ); - if ( ldapssl_client_init( (*line == '\0') ? - NULL : line, &certdbhandle ) < 0 ) { - perror( "ldapssl_client_init" ); - optval = 0; /* SSL not avail. */ - } else if ( ldapssl_install_routines( ld ) - < 0 ) { - ldap_perror( ld, - "ldapssl_install_routines" ); - optval = 0; /* SSL not avail. */ - } - } - - ldap_set_option( ld, LDAP_OPT_SSL, - optval ? LDAP_OPT_ON : LDAP_OPT_OFF ); -#endif - - getline( line, sizeof(line), stdin, "Reconnect?" ); - ldap_set_option( ld, LDAP_OPT_RECONNECT, - ( atoi( line ) == 0 ) ? LDAP_OPT_OFF : - LDAP_OPT_ON ); - break; - - case 'I': /* initialize display templates */ - getline( line, sizeof(line), stdin, - "Template file [ldaptemplates.conf]?" ); - if (( i = ldap_init_templates( *line == '\0' ? - "ldaptemplates.conf" : line, &tmpllist )) - != 0 ) { - fprintf( stderr, "ldap_init_templates: %s\n", - ldap_tmplerr2string( i )); - } - break; - - case 'T': /* read & display using template */ - getline( dn, sizeof(dn), stdin, "entry DN? " ); - strcat( dn, dnsuffix ); - if (( i = ldap_entry2text_search( ld, dn, NULL, NULL, - tmpllist, NULL, NULL, entry2textwrite, stdout, - "\n", 0, 0 )) != LDAP_SUCCESS ) { - fprintf( stderr, "ldap_entry2text_search: %s\n", - ldap_err2string( i )); - } - break; - - case 'L': /* set preferred language */ - getline( line, sizeof(line), stdin, - "Preferred language? " ); - if ( *line == '\0' ) { - ldap_set_option( ld, - LDAP_OPT_PREFERRED_LANGUAGE, NULL ); - } else { - ldap_set_option( ld, - LDAP_OPT_PREFERRED_LANGUAGE, line ); - } - break; - - case 'F': /* create filter */ - { - char filtbuf[ 512 ], pattern[ 512 ]; - char prefix[ 512 ], suffix[ 512 ]; - char attr[ 512 ], value[ 512 ]; - char *dupvalue, **words; - - getline( pattern, sizeof(pattern), stdin, - "pattern? " ); - getline( prefix, sizeof(prefix), stdin, - "prefix? " ); - getline( suffix, sizeof(suffix), stdin, - "suffix? " ); - getline( attr, sizeof(attr), stdin, - "attribute? " ); - getline( value, sizeof(value), stdin, - "value? " ); - - if (( dupvalue = strdup( value )) != NULL ) { - words = string2words( value, " " ); - } else { - words = NULL; - } - if ( ldap_create_filter( filtbuf, - sizeof(filtbuf), pattern, prefix, suffix, - attr, value, words) != 0 ) { - fprintf( stderr, - "ldap_create_filter failed\n" ); - } else { - printf( "filter is \"%s\"\n", filtbuf ); - } - if ( dupvalue != NULL ) free( dupvalue ); - if ( words != NULL ) free( words ); - } - break; - - case '?': /* help */ - case '\0': /* help */ - printf( "Commands: [ad]d [ab]andon [b]ind\n" ); - printf( " synch [B]ind [c]ompare [l]URL search\n" ); - printf( " [modi]fy [modr]dn [rem]ove\n" ); - printf( " [res]ult [s]earch [q]uit/unbind\n\n" ); - printf( " [u]fn search [ut]fn search with timeout\n" ); - printf( " [d]ebug [C]set cache parms[g]set msgid\n" ); - printf( " d[n]suffix [t]imeout [v]ersion\n" ); - printf( " [U]fn prefix [?]help [o]ptions\n" ); - printf( " [E]xplode dn [p]arse LDAP URL [R]explode RDN\n" ); - printf( " e[x]tended op [F]ilter create\n" ); - printf( " set co[N]trols set preferred [L]anguage\n" ); - printf( " add a [P]ersistent search control\n" ); - printf( " [I]nitialize display templates\n" ); - printf( " [T]read entry and display using template\n" ); - break; - - default: - printf( "Invalid command. Type ? for help.\n" ); - break; - } - - (void) memset( line, '\0', sizeof(line) ); - } - - return( 0 ); -} - -static void -handle_result( LDAP *ld, LDAPMessage *lm, int onlyone ) -{ - int msgtype; - - switch ( (msgtype = ldap_msgtype( lm )) ) { - case LDAP_RES_COMPARE: - printf( "Compare result\n" ); - print_ldap_result( ld, lm, "compare" ); - break; - - case LDAP_RES_SEARCH_RESULT: - printf( "Search result\n" ); - print_ldap_result( ld, lm, "search" ); - break; - - case LDAP_RES_SEARCH_ENTRY: - printf( "Search entry\n" ); - print_search_entry( ld, lm, onlyone ); - break; - - case LDAP_RES_SEARCH_REFERENCE: - printf( "Search reference\n" ); - print_search_reference( ld, lm, onlyone ); - break; - - case LDAP_RES_ADD: - printf( "Add result\n" ); - print_ldap_result( ld, lm, "add" ); - break; - - case LDAP_RES_DELETE: - printf( "Delete result\n" ); - print_ldap_result( ld, lm, "delete" ); - break; - - case LDAP_RES_MODIFY: - printf( "Modify result\n" ); - print_ldap_result( ld, lm, "modify" ); - break; - - case LDAP_RES_MODRDN: - printf( "ModRDN result\n" ); - print_ldap_result( ld, lm, "modrdn" ); - break; - - case LDAP_RES_BIND: - printf( "Bind result\n" ); - print_ldap_result( ld, lm, "bind" ); - break; - case LDAP_RES_EXTENDED: - if ( ldap_msgid( lm ) == LDAP_RES_UNSOLICITED ) { - printf( "Unsolicited result\n" ); - print_ldap_result( ld, lm, "unsolicited" ); - } else { - printf( "ExtendedOp result\n" ); - print_ldap_result( ld, lm, "extendedop" ); - } - break; - - default: - printf( "Unknown result type 0x%x\n", msgtype ); - print_ldap_result( ld, lm, "unknown" ); - } - - if ( !onlyone ) { - ldap_msgfree( lm ); - } -} - -static void -print_ldap_result( LDAP *ld, LDAPMessage *lm, char *s ) -{ - int lderr; - char *matcheddn, *errmsg, *oid, **refs; - LDAPControl **ctrls; - struct berval *servercred, *data; - - if ( ldap_parse_result( ld, lm, &lderr, &matcheddn, &errmsg, &refs, - &ctrls, 0 ) != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_parse_result" ); - } else { - fprintf( stderr, "%s: %s", s, ldap_err2string( lderr )); - if ( lderr == LDAP_CONNECT_ERROR ) { - perror( " - " ); - } else { - fputc( '\n', stderr ); - } - if ( errmsg != NULL ) { - if ( *errmsg != '\0' ) { - fprintf( stderr, "Additional info: %s\n", - errmsg ); - } - ldap_memfree( errmsg ); - } - if ( matcheddn != NULL ) { - if ( NAME_ERROR( lderr )) { - fprintf( stderr, "Matched DN: %s\n", - matcheddn ); - } - ldap_memfree( matcheddn ); - } - print_referrals( refs, 1 ); - print_controls( ctrls, 1 ); - } - - /* if SASL bind response, get and show server credentials */ - if ( ldap_msgtype( lm ) == LDAP_RES_BIND && - ldap_parse_sasl_bind_result( ld, lm, &servercred, 0 ) == - LDAP_SUCCESS && servercred != NULL ) { - fputs( "\tSASL server credentials:\n", stderr ); - bprint( servercred->bv_val, servercred->bv_len ); - ber_bvfree( servercred ); - } - - /* if ExtendedOp response, get and show oid plus data */ - if ( ldap_msgtype( lm ) == LDAP_RES_EXTENDED && - ldap_parse_extended_result( ld, lm, &oid, &data, 0 ) == - LDAP_SUCCESS ) { - if ( oid != NULL ) { - if ( strcmp ( oid, LDAP_NOTICE_OF_DISCONNECTION ) - == 0 ) { - printf( - "\t%s Notice of Disconnection (OID: %s)\n", - s, oid ); - } else { - printf( "\t%s OID: %s\n", s, oid ); - } - ldap_memfree( oid ); - } - if ( data != NULL ) { - printf( "\t%s data:\n", s ); - bprint( data->bv_val, data->bv_len ); - ber_bvfree( data ); - } - } -} - -static void -print_search_entry( LDAP *ld, LDAPMessage *res, int onlyone ) -{ - BerElement *ber; - char *a, *dn, *ufn; - struct berval **vals; - int i, count; - LDAPMessage *e, *msg; - LDAPControl **ectrls; - - count = 0; - for ( msg = ldap_first_message( ld, res ); - msg != NULL && ( !onlyone || count == 0 ); - msg = ldap_next_message( ld, msg ), ++count ) { - if ( ldap_msgtype( msg ) != LDAP_RES_SEARCH_ENTRY ) { - handle_result( ld, msg, 1 ); /* something else */ - continue; - } - e = msg; - - dn = ldap_get_dn( ld, e ); - printf( "\tDN: %s\n", dn ); - - ufn = ldap_dn2ufn( dn ); - printf( "\tUFN: %s\n", ufn ); -#ifdef WINSOCK - ldap_memfree( dn ); - ldap_memfree( ufn ); -#else /* WINSOCK */ - free( dn ); - free( ufn ); -#endif /* WINSOCK */ - - for ( a = ldap_first_attribute( ld, e, &ber ); a != NULL; - a = ldap_next_attribute( ld, e, ber ) ) { - printf( "\t\tATTR: %s\n", a ); - if ( (vals = ldap_get_values_len( ld, e, a )) - == NULL ) { - printf( "\t\t\t(no values)\n" ); - } else { - for ( i = 0; vals[i] != NULL; i++ ) { - int nonascii = 0; - unsigned long j; - - for ( j = 0; j < vals[i]->bv_len; j++ ) - if ( !isascii( vals[i]->bv_val[j] ) ) { - nonascii = 1; - break; - } - - if ( nonascii ) { - printf( "\t\t\tlength (%ld) (not ascii)\n", vals[i]->bv_len ); -#ifdef BPRINT_NONASCII - bprint( vals[i]->bv_val, - vals[i]->bv_len ); -#endif /* BPRINT_NONASCII */ - continue; - } - printf( "\t\t\tlength (%ld) %s\n", - vals[i]->bv_len, vals[i]->bv_val ); - } - ber_bvecfree( vals ); - } - ldap_memfree( a ); - } - if ( ldap_get_lderrno( ld, NULL, NULL ) != LDAP_SUCCESS ) { - ldap_perror( ld, - "ldap_first_attribute/ldap_next_attribute" ); - } - if ( ber != NULL ) { - ber_free( ber, 0 ); - } - - if ( ldap_get_entry_controls( ld, e, &ectrls ) - != LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_get_entry_controls" ); - } else { - int changetype, changenumpresent; - char *prevdn; - long changenum; - - if ( ldap_parse_entrychange_control( ld, ectrls, - &changetype, &prevdn, &changenumpresent, - &changenum ) == LDAP_SUCCESS ) { - fprintf( stderr, "EntryChangeNotification\n" - "\tchangeType: %s\n", - changetype_num2string( changetype )); - if ( prevdn != NULL ) { - fprintf( stderr, - "\tpreviousDN: \"%s\"\n", - prevdn ); - } - if ( changenumpresent ) { - fprintf( stderr, "\tchangeNumber: %d\n", - changenum ); - } - if ( prevdn != NULL ) { - free( prevdn ); - } - } - print_controls( ectrls, 1 ); - } - } -} - - -static char * -changetype_num2string( int chgtype ) -{ - static char buf[ 25 ]; - char *s; - - switch( chgtype ) { - case LDAP_CHANGETYPE_ADD: - s = "add"; - break; - case LDAP_CHANGETYPE_DELETE: - s = "delete"; - break; - case LDAP_CHANGETYPE_MODIFY: - s = "modify"; - break; - case LDAP_CHANGETYPE_MODDN: - s = "moddn"; - break; - default: - s = buf; - sprintf( s, "unknown (%d)", chgtype ); - } - - return( s ); -} - - -static void -print_search_reference( LDAP *ld, LDAPMessage *res, int onlyone ) -{ - LDAPMessage *msg; - LDAPControl **ctrls; - char **refs; - int count; - - count = 0; - for ( msg = ldap_first_message( ld, res ); - msg != NULL && ( !onlyone || count == 0 ); - msg = ldap_next_message( ld, msg ), ++count ) { - if ( ldap_msgtype( msg ) != LDAP_RES_SEARCH_REFERENCE ) { - handle_result( ld, msg, 1 ); /* something else */ - continue; - } - - if ( ldap_parse_reference( ld, msg, &refs, &ctrls, 0 ) != - LDAP_SUCCESS ) { - ldap_perror( ld, "ldap_parse_reference" ); - } else { - print_referrals( refs, 1 ); - print_controls( ctrls, 1 ); - } - } -} - - -static void -print_referrals( char **refs, int freeit ) -{ - int i; - - if ( refs == NULL ) { - return; - } - - fprintf( stderr, "Referrals:\n" ); - for ( i = 0; refs[ i ] != NULL; ++i ) { - fprintf( stderr, "\t%s\n", refs[ i ] ); - } - - if ( freeit ) { - ldap_value_free( refs ); - } -} - - -static void -print_controls( LDAPControl **ctrls, int freeit ) -{ - int i; - - if ( ctrls == NULL ) { - return; - } - - fprintf( stderr, "Controls:\n" ); - for ( i = 0; ctrls[ i ] != NULL; ++i ) { - if ( i > 0 ) { - fputs( "\t-----------\n", stderr ); - } - fprintf( stderr, "\toid: %s\n", ctrls[ i ]->ldctl_oid ); - fprintf( stderr, "\tcritical: %s\n", - ctrls[ i ]->ldctl_iscritical ? "YES" : "NO" ); - fputs( "\tvalue:\n", stderr ); - bprint( ctrls[ i ]->ldctl_value.bv_val, - ctrls[ i ]->ldctl_value.bv_len ); - } - - if ( freeit ) { - ldap_controls_free( ctrls ); - } -} - - -static int -entry2textwrite( void *fp, char *buf, int len ) -{ - return( fwrite( buf, len, 1, (FILE *)fp ) == 0 ? -1 : len ); -} - - -/* similar to getfilter.c:break_into_words() */ -static char ** -string2words( char *str, char *delims ) -{ - char *word, **words; - int count; - char *lasts; - - if (( words = (char **)calloc( 1, sizeof( char * ))) == NULL ) { - return( NULL ); - } - count = 0; - words[ count ] = NULL; - - word = ldap_utf8strtok_r( str, delims, &lasts ); - while ( word != NULL ) { - if (( words = (char **)realloc( words, - ( count + 2 ) * sizeof( char * ))) == NULL ) { - free( words ); - return( NULL ); - } - - words[ count ] = word; - words[ ++count ] = NULL; - word = ldap_utf8strtok_r( NULL, delims, &lasts ); - } - - return( words ); -} - - -static const char * -url_parse_err2string( int e ) -{ - const char *s = "unknown"; - - switch( e ) { - case LDAP_URL_ERR_NOTLDAP: - s = "URL doesn't begin with \"ldap://\""; - break; - case LDAP_URL_ERR_NODN: - s = "URL has no DN (required)"; - break; - case LDAP_URL_ERR_BADSCOPE: - s = "URL scope string is invalid"; - break; - case LDAP_URL_ERR_MEM: - s = "can't allocate memory space"; - break; - case LDAP_URL_ERR_PARAM: - s = "bad parameter to an URL function"; - break; - case LDAP_URL_UNRECOGNIZED_CRITICAL_EXTENSION: - s = "unrecognized critical URL extension"; - break; - } - - return( s ); -} - - -/* - * Print arbitrary stuff, for debugging. - */ - -#define BPLEN 48 -static void -bprint( char *data, int len ) -{ - static char hexdig[] = "0123456789abcdef"; - char out[ BPLEN ]; - int i = 0; - - memset( out, 0, BPLEN ); - for ( ;; ) { - if ( len < 1 ) { - fprintf( stderr, "\t%s\n", ( i == 0 ) ? "(end)" : out ); - break; - } - -#ifndef HEX - if ( isgraph( (unsigned char)*data )) { - out[ i ] = ' '; - out[ i+1 ] = *data; - } else { -#endif - out[ i ] = hexdig[ ( *data & 0xf0 ) >> 4 ]; - out[ i+1 ] = hexdig[ *data & 0x0f ]; -#ifndef HEX - } -#endif - i += 2; - len--; - data++; - - if ( i > BPLEN - 2 ) { - fprintf( stderr, "\t%s\n", out ); - memset( out, 0, BPLEN ); - i = 0; - continue; - } - out[ i++ ] = ' '; - } - - fflush( stderr ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/tmplout.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/tmplout.c deleted file mode 100644 index 8ce0530dcd4..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/tmplout.c +++ /dev/null @@ -1,1129 +0,0 @@ -/* - * 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): - */ - -/* - * tmplout.c: display template library output routines for LDAP clients - * - */ - -#include "ldap-int.h" -#include "disptmpl.h" - -#if defined(_WINDOWS) || defined(aix) || defined(SCOOS) || defined(OSF1) || defined(SOLARIS) -#include /* for struct tm and ctime */ -#endif - - -/* This is totally lame, since it should be coming from time.h, but isn't. */ -#if defined(SOLARIS) -char *ctime_r(const time_t *, char *, int); -#endif - -static int do_entry2text( LDAP *ld, char *buf, char *base, LDAPMessage *entry, - struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, - writeptype writeproc, void *writeparm, char *eol, int rdncount, - unsigned long opts, char *urlprefix ); -static int do_entry2text_search( LDAP *ld, char *dn, char *base, - LDAPMessage *entry, struct ldap_disptmpl *tmpllist, char **defattrs, - char ***defvals, writeptype writeproc, void *writeparm, char *eol, - int rdncount, unsigned long opts, char *urlprefix ); -static int do_vals2text( LDAP *ld, char *buf, char **vals, char *label, - int labelwidth, unsigned long syntaxid, writeptype writeproc, - void *writeparm, char *eol, int rdncount, char *urlprefix ); -static int max_label_len( struct ldap_disptmpl *tmpl ); -static int output_label( char *buf, char *label, int width, - writeptype writeproc, void *writeparm, char *eol, int html ); -static int output_dn( char *buf, char *dn, int width, int rdncount, - writeptype writeproc, void *writeparm, char *eol, char *urlprefix ); -static void strcat_escaped( char *s1, char *s2 ); -static char *time2text( char *ldtimestr, int dateonly ); -static long gtime( struct tm *tm ); -static int searchaction( LDAP *ld, char *buf, char *base, LDAPMessage *entry, - char *dn, struct ldap_tmplitem *tip, int labelwidth, int rdncount, - writeptype writeproc, void *writeparm, char *eol, char *urlprefix ); - -#define DEF_LABEL_WIDTH 15 -#define SEARCH_TIMEOUT_SECS 120 -#define OCATTRNAME "objectClass" - - -#define NONFATAL_LDAP_ERR( err ) ( err == LDAP_SUCCESS || \ - err == LDAP_TIMELIMIT_EXCEEDED || err == LDAP_SIZELIMIT_EXCEEDED ) - -#define DEF_LDAP_URL_PREFIX "ldap:///" - - -int -LDAP_CALL -ldap_entry2text( - LDAP *ld, - char *buf, /* NULL for "use internal" */ - LDAPMessage *entry, - struct ldap_disptmpl *tmpl, - char **defattrs, - char ***defvals, - writeptype writeproc, - void *writeparm, - char *eol, - int rdncount, - unsigned long opts -) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_entry2text\n", 0, 0, 0 ); - - return( do_entry2text( ld, buf, NULL, entry, tmpl, defattrs, defvals, - writeproc, writeparm, eol, rdncount, opts, NULL )); - -} - - - -int -LDAP_CALL -ldap_entry2html( - LDAP *ld, - char *buf, /* NULL for "use internal" */ - LDAPMessage *entry, - struct ldap_disptmpl *tmpl, - char **defattrs, - char ***defvals, - writeptype writeproc, - void *writeparm, - char *eol, - int rdncount, - unsigned long opts, - char *base, - char *urlprefix -) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_entry2html\n", 0, 0, 0 ); - - if ( urlprefix == NULL ) { - urlprefix = DEF_LDAP_URL_PREFIX; - } - - return( do_entry2text( ld, buf, base, entry, tmpl, defattrs, defvals, - writeproc, writeparm, eol, rdncount, opts, urlprefix )); -} - - -static int -do_entry2text( - LDAP *ld, - char *buf, /* NULL for use-internal */ - char *base, /* used for search actions */ - LDAPMessage *entry, - struct ldap_disptmpl *tmpl, - char **defattrs, - char ***defvals, - writeptype writeproc, - void *writeparm, - char *eol, - int rdncount, - unsigned long opts, - char *urlprefix /* if non-NULL, do HTML */ -) -{ - int i, err, html, show, labelwidth; - int freebuf, freevals; - char *dn, **vals; - struct ldap_tmplitem *rowp, *colp; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( writeproc == NULL || - !NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( entry )) { - err = LDAP_PARAM_ERROR; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - - if (( dn = ldap_get_dn( ld, entry )) == NULL ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - if ( buf == NULL ) { - if (( buf = NSLDAPI_MALLOC( LDAP_DTMPL_BUFSIZ )) == NULL ) { - err = LDAP_NO_MEMORY; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - NSLDAPI_FREE( dn ); - return( err ); - } - freebuf = 1; - } else { - freebuf = 0; - } - - html = ( urlprefix != NULL ); - - if ( html ) { - /* - * add HTML intro. and title - */ - if (!(( opts & LDAP_DISP_OPT_HTMLBODYONLY ) != 0 )) { - sprintf( buf, "%s%s%s%s - ", eol, eol, eol, - ( tmpl == NULL ) ? "Entry" : tmpl->dt_name ); - (*writeproc)( writeparm, buf, strlen( buf )); - output_dn( buf, dn, 0, rdncount, writeproc, writeparm, "", NULL ); - sprintf( buf, "%s%s%s%s

%s - ", eol, eol, - eol, eol, ( tmpl == NULL ) ? "Entry" : tmpl->dt_name ); - (*writeproc)( writeparm, buf, strlen( buf )); - output_dn( buf, dn, 0, rdncount, writeproc, writeparm, "", NULL ); - sprintf( buf, "

%s", eol ); - (*writeproc)( writeparm, buf, strlen( buf )); - } - - if (( opts & LDAP_DISP_OPT_NONLEAF ) != 0 && - ( vals = ldap_explode_dn( dn, 0 )) != NULL ) { - char *untagged; - - /* - * add "Move Up" link - */ - sprintf( buf, "
1 ) { - strcat_escaped( buf, ", " ); - } - strcat_escaped( buf, vals[ i ] ); - } - if ( vals[ 1 ] != NULL ) { - untagged = strchr( vals[ 1 ], '=' ); - } else { - untagged = "=The World"; - } - sprintf( buf + strlen( buf ), - "%s\">Move Up To %s%s
", - ( vals[ 1 ] == NULL ) ? "??one" : "", - ( untagged != NULL ) ? untagged + 1 : vals[ 1 ], eol ); - (*writeproc)( writeparm, buf, strlen( buf )); - - /* - * add "Browse" link - */ - untagged = strchr( vals[ 0 ], '=' ); - sprintf( buf, "Browse Below %s%s%s", - ( untagged != NULL ) ? untagged + 1 : vals[ 0 ], eol, eol ); - (*writeproc)( writeparm, buf, strlen( buf )); - - ldap_value_free( vals ); - } - - (*writeproc)( writeparm, "
", 4 ); /* horizontal rule */ - } else { - (*writeproc)( writeparm, "\"", 1 ); - output_dn( buf, dn, 0, rdncount, writeproc, writeparm, "", NULL ); - sprintf( buf, "\"%s", eol ); - (*writeproc)( writeparm, buf, strlen( buf )); - } - - if ( tmpl != NULL && ( opts & LDAP_DISP_OPT_AUTOLABELWIDTH ) != 0 ) { - labelwidth = max_label_len( tmpl ) + 3; - } else { - labelwidth = DEF_LABEL_WIDTH;; - } - - err = LDAP_SUCCESS; - - if ( tmpl == NULL ) { - BerElement *ber; - char *attr; - - ber = NULL; - for ( attr = ldap_first_attribute( ld, entry, &ber ); - NONFATAL_LDAP_ERR( err ) && attr != NULL; - attr = ldap_next_attribute( ld, entry, ber )) { - if (( vals = ldap_get_values( ld, entry, attr )) == NULL ) { - freevals = 0; - if ( defattrs != NULL ) { - for ( i = 0; defattrs[ i ] != NULL; ++i ) { - if ( strcasecmp( attr, defattrs[ i ] ) == 0 ) { - break; - } - } - if ( defattrs[ i ] != NULL ) { - vals = defvals[ i ]; - } - } - } else { - freevals = 1; - } - - if ( islower( *attr )) { /* cosmetic -- upcase attr. name */ - *attr = toupper( *attr ); - } - - err = do_vals2text( ld, buf, vals, attr, labelwidth, - LDAP_SYN_CASEIGNORESTR, writeproc, writeparm, eol, - rdncount, urlprefix ); - if ( freevals ) { - ldap_value_free( vals ); - } - } - if ( ber == NULL ) { - ber_free( ber, 0 ); - } - /* - * XXX check for errors in ldap_first_attribute/ldap_next_attribute - * here (but what should we do if there was one?) - */ - - } else { - for ( rowp = ldap_first_tmplrow( tmpl ); - NONFATAL_LDAP_ERR( err ) && rowp != NULLTMPLITEM; - rowp = ldap_next_tmplrow( tmpl, rowp )) { - for ( colp = ldap_first_tmplcol( tmpl, rowp ); colp != NULLTMPLITEM; - colp = ldap_next_tmplcol( tmpl, rowp, colp )) { - vals = NULL; - if ( colp->ti_attrname == NULL || ( vals = ldap_get_values( ld, - entry, colp->ti_attrname )) == NULL ) { - freevals = 0; - if ( !LDAP_IS_TMPLITEM_OPTION_SET( colp, - LDAP_DITEM_OPT_HIDEIFEMPTY ) && defattrs != NULL - && colp->ti_attrname != NULL ) { - for ( i = 0; defattrs[ i ] != NULL; ++i ) { - if ( strcasecmp( colp->ti_attrname, defattrs[ i ] ) - == 0 ) { - break; - } - } - if ( defattrs[ i ] != NULL ) { - vals = defvals[ i ]; - } - } - } else { - freevals = 1; - if ( LDAP_IS_TMPLITEM_OPTION_SET( colp, - LDAP_DITEM_OPT_SORTVALUES ) && vals[ 0 ] != NULL - && vals[ 1 ] != NULL ) { - ldap_sort_values(ld, vals, ldap_sort_strcasecmp); - } - } - - /* - * don't bother even calling do_vals2text() if no values - * or boolean with value false and "hide if false" option set - */ - show = ( vals != NULL && vals[ 0 ] != NULL ); - if ( show && LDAP_GET_SYN_TYPE( colp->ti_syntaxid ) - == LDAP_SYN_TYPE_BOOLEAN && LDAP_IS_TMPLITEM_OPTION_SET( - colp, LDAP_DITEM_OPT_HIDEIFFALSE ) && - toupper( vals[ 0 ][ 0 ] ) != 'T' ) { - show = 0; - } - - if ( colp->ti_syntaxid == LDAP_SYN_SEARCHACTION ) { - if (( opts & LDAP_DISP_OPT_DOSEARCHACTIONS ) != 0 ) { - if ( colp->ti_attrname == NULL || ( show && - toupper( vals[ 0 ][ 0 ] ) == 'T' )) { - err = searchaction( ld, buf, base, entry, dn, colp, - labelwidth, rdncount, writeproc, - writeparm, eol, urlprefix ); - } - } - show = 0; - } - - if ( show ) { - err = do_vals2text( ld, buf, vals, colp->ti_label, - labelwidth, colp->ti_syntaxid, writeproc, writeparm, - eol, rdncount, urlprefix ); - } - - if ( freevals ) { - ldap_value_free( vals ); - } - } - } - } - - if ( html && !(( opts & LDAP_DISP_OPT_HTMLBODYONLY ) != 0 )) { - sprintf( buf, "%s%s", eol, eol ); - (*writeproc)( writeparm, buf, strlen( buf )); - } - - NSLDAPI_FREE( dn ); - if ( freebuf ) { - NSLDAPI_FREE( buf ); - } - - return( err ); -} - - -int -LDAP_CALL -ldap_entry2text_search( - LDAP *ld, - char *dn, /* if NULL, use entry */ - char *base, /* if NULL, no search actions */ - LDAPMessage *entry, /* if NULL, use dn */ - struct ldap_disptmpl* tmpllist, /* if NULL, load default file */ - char **defattrs, - char ***defvals, - writeptype writeproc, - void *writeparm, - char *eol, - int rdncount, /* if 0, display full DN */ - unsigned long opts -) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_entry2text_search\n", 0, 0, 0 ); - - return( do_entry2text_search( ld, dn, base, entry, tmpllist, defattrs, - defvals, writeproc, writeparm, eol, rdncount, opts, NULL )); -} - - - -int -LDAP_CALL -ldap_entry2html_search( - LDAP *ld, - char *dn, /* if NULL, use entry */ - char *base, /* if NULL, no search actions */ - LDAPMessage *entry, /* if NULL, use dn */ - struct ldap_disptmpl* tmpllist, /* if NULL, load default file */ - char **defattrs, - char ***defvals, - writeptype writeproc, - void *writeparm, - char *eol, - int rdncount, /* if 0, display full DN */ - unsigned long opts, - char *urlprefix -) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_entry2html_search\n", 0, 0, 0 ); - - return( do_entry2text_search( ld, dn, base, entry, tmpllist, defattrs, - defvals, writeproc, writeparm, eol, rdncount, opts, urlprefix )); -} - - -static int -do_entry2text_search( - LDAP *ld, - char *dn, /* if NULL, use entry */ - char *base, /* if NULL, no search actions */ - LDAPMessage *entry, /* if NULL, use dn */ - struct ldap_disptmpl* tmpllist, /* if NULL, no template used */ - char **defattrs, - char ***defvals, - writeptype writeproc, - void *writeparm, - char *eol, - int rdncount, /* if 0, display full DN */ - unsigned long opts, - char *urlprefix -) -{ - int err, freedn, html; - char *buf, **fetchattrs, **vals; - LDAPMessage *ldmp; - struct ldap_disptmpl *tmpl; - struct timeval timeout; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( dn == NULL && entry == NULLMSG ) { - err = LDAP_PARAM_ERROR; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - - html = ( urlprefix != NULL ); - - timeout.tv_sec = SEARCH_TIMEOUT_SECS; - timeout.tv_usec = 0; - - if (( buf = NSLDAPI_MALLOC( LDAP_DTMPL_BUFSIZ )) == NULL ) { - err = LDAP_NO_MEMORY; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - - freedn = 0; - tmpl = NULL; - - if ( dn == NULL ) { - if (( dn = ldap_get_dn( ld, entry )) == NULL ) { - NSLDAPI_FREE( buf ); - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - freedn = 1; - } - - - if ( tmpllist != NULL ) { - ldmp = NULLMSG; - - if ( entry == NULL ) { - char *ocattrs[2]; - - ocattrs[0] = OCATTRNAME; - ocattrs[1] = NULL; -#ifdef CLDAP - if ( LDAP_IS_CLDAP( ld )) - err = cldap_search_s( ld, dn, LDAP_SCOPE_BASE, - "objectClass=*", ocattrs, 0, &ldmp, NULL ); - else -#endif /* CLDAP */ - err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, - "objectClass=*", ocattrs, 0, &timeout, &ldmp ); - - if ( err == LDAP_SUCCESS ) { - entry = ldap_first_entry( ld, ldmp ); - } - } - - if ( entry != NULL ) { - vals = ldap_get_values( ld, entry, OCATTRNAME ); - tmpl = ldap_oc2template( vals, tmpllist ); - if ( vals != NULL ) { - ldap_value_free( vals ); - } - } - if ( ldmp != NULL ) { - ldap_msgfree( ldmp ); - } - } - - entry = NULL; - - if ( tmpl == NULL ) { - fetchattrs = NULL; - } else { - fetchattrs = ldap_tmplattrs( tmpl, NULL, 1, LDAP_SYN_OPT_DEFER ); - } - -#ifdef CLDAP - if ( LDAP_IS_CLDAP( ld )) - err = cldap_search_s( ld, dn, LDAP_SCOPE_BASE, "objectClass=*", - fetchattrs, 0, &ldmp, NULL ); - else -#endif /* CLDAP */ - err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, "objectClass=*", - fetchattrs, 0, &timeout, &ldmp ); - - if ( freedn ) { - NSLDAPI_FREE( dn ); - } - if ( fetchattrs != NULL ) { - ldap_value_free( fetchattrs ); - } - - if ( err != LDAP_SUCCESS || - ( entry = ldap_first_entry( ld, ldmp )) == NULL ) { - NSLDAPI_FREE( buf ); - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - err = do_entry2text( ld, buf, base, entry, tmpl, defattrs, defvals, - writeproc, writeparm, eol, rdncount, opts, urlprefix ); - - NSLDAPI_FREE( buf ); - ldap_msgfree( ldmp ); - return( err ); -} - - -int -LDAP_CALL -ldap_vals2text( - LDAP *ld, - char *buf, /* NULL for "use internal" */ - char **vals, - char *label, - int labelwidth, /* 0 means use default */ - unsigned long syntaxid, - writeptype writeproc, - void *writeparm, - char *eol, - int rdncount -) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_vals2text\n", 0, 0, 0 ); - - return( do_vals2text( ld, buf, vals, label, labelwidth, syntaxid, - writeproc, writeparm, eol, rdncount, NULL )); -} - - -int -LDAP_CALL -ldap_vals2html( - LDAP *ld, - char *buf, /* NULL for "use internal" */ - char **vals, - char *label, - int labelwidth, /* 0 means use default */ - unsigned long syntaxid, - writeptype writeproc, - void *writeparm, - char *eol, - int rdncount, - char *urlprefix -) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_vals2html\n", 0, 0, 0 ); - - if ( urlprefix == NULL ) { - urlprefix = DEF_LDAP_URL_PREFIX; - } - - return( do_vals2text( ld, buf, vals, label, labelwidth, syntaxid, - writeproc, writeparm, eol, rdncount, urlprefix )); -} - - -static int -do_vals2text( - LDAP *ld, - char *buf, /* NULL for "use internal" */ - char **vals, - char *label, - int labelwidth, /* 0 means use default */ - unsigned long syntaxid, - writeptype writeproc, - void *writeparm, - char *eol, - int rdncount, - char *urlprefix -) -{ - int err, i, html, writeoutval, freebuf, notascii; - char *p, *s, *outval; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld ) || writeproc == NULL ) { - return( LDAP_PARAM_ERROR ); - } - - if ( vals == NULL ) { - return( LDAP_SUCCESS ); - } - - html = ( urlprefix != NULL ); - - switch( LDAP_GET_SYN_TYPE( syntaxid )) { - case LDAP_SYN_TYPE_TEXT: - case LDAP_SYN_TYPE_BOOLEAN: - break; /* we only bother with these two types... */ - default: - return( LDAP_SUCCESS ); - } - - if ( labelwidth == 0 || labelwidth < 0 ) { - labelwidth = DEF_LABEL_WIDTH; - } - - if ( buf == NULL ) { - if (( buf = NSLDAPI_MALLOC( LDAP_DTMPL_BUFSIZ )) == NULL ) { - err = LDAP_NO_MEMORY; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - freebuf = 1; - } else { - freebuf = 0; - } - - output_label( buf, label, labelwidth, writeproc, writeparm, eol, html ); - - for ( i = 0; vals[ i ] != NULL; ++i ) { - for ( p = vals[ i ]; *p != '\0'; ++p ) { - if ( !isascii( *p )) { - break; - } - } - notascii = ( *p != '\0' ); - outval = notascii ? "(unable to display non-ASCII text value)" - : vals[ i ]; - - writeoutval = 0; /* if non-zero, write outval after switch */ - - switch( syntaxid ) { - case LDAP_SYN_CASEIGNORESTR: - ++writeoutval; - break; - - case LDAP_SYN_RFC822ADDR: - if ( html ) { - strcpy( buf, "
%s
%s", outval, eol ); - (*writeproc)( writeparm, buf, strlen( buf )); - } else { - ++writeoutval; - } - break; - - case LDAP_SYN_DN: /* for now */ - output_dn( buf, outval, labelwidth, rdncount, writeproc, - writeparm, eol, urlprefix ); - break; - - case LDAP_SYN_MULTILINESTR: - if ( i > 0 && !html ) { - output_label( buf, label, labelwidth, writeproc, - writeparm, eol, html ); - } - - p = s = outval; - while (( s = strchr( s, '$' )) != NULL ) { - *s++ = '\0'; - while ( ldap_utf8isspace( s )) { - ++s; - } - if ( html ) { - sprintf( buf, "
%s
%s", p, eol ); - } else { - sprintf( buf, "%-*s%s%s", labelwidth, " ", p, eol ); - } - (*writeproc)( writeparm, buf, strlen( buf )); - p = s; - } - outval = p; - ++writeoutval; - break; - - case LDAP_SYN_BOOLEAN: - outval = toupper( outval[ 0 ] ) == 'T' ? "TRUE" : "FALSE"; - ++writeoutval; - break; - - case LDAP_SYN_TIME: - case LDAP_SYN_DATE: - outval = time2text( outval, syntaxid == LDAP_SYN_DATE ); - ++writeoutval; - break; - - case LDAP_SYN_LABELEDURL: - if ( !notascii && ( p = strchr( outval, '$' )) != NULL ) { - *p++ = '\0'; - while ( ldap_utf8isspace( p )) { - ++p; - } - s = outval; - } else if ( !notascii && ( s = strchr( outval, ' ' )) != NULL ) { - *s++ = '\0'; - while ( ldap_utf8isspace( s )) { - ++s; - } - p = outval; - } else { - s = "URL"; - p = outval; - } - - /* - * at this point `s' points to the label & `p' to the URL - */ - if ( html ) { - sprintf( buf, "
%s
%s", p, s, eol ); - } else { - sprintf( buf, "%-*s%s%s%-*s%s%s", labelwidth, " ", - s, eol, labelwidth + 2, " ",p , eol ); - } - (*writeproc)( writeparm, buf, strlen( buf )); - break; - - default: - sprintf( buf, " Can't display item type %ld%s", - syntaxid, eol ); - (*writeproc)( writeparm, buf, strlen( buf )); - } - - if ( writeoutval ) { - if ( html ) { - sprintf( buf, "
%s
%s", outval, eol ); - } else { - sprintf( buf, "%-*s%s%s", labelwidth, " ", outval, eol ); - } - (*writeproc)( writeparm, buf, strlen( buf )); - } - } - - if ( freebuf ) { - NSLDAPI_FREE( buf ); - } - - return( LDAP_SUCCESS ); -} - - -static int -max_label_len( struct ldap_disptmpl *tmpl ) -{ - struct ldap_tmplitem *rowp, *colp; - int len, maxlen; - - maxlen = 0; - - for ( rowp = ldap_first_tmplrow( tmpl ); rowp != NULLTMPLITEM; - rowp = ldap_next_tmplrow( tmpl, rowp )) { - for ( colp = ldap_first_tmplcol( tmpl, rowp ); colp != NULLTMPLITEM; - colp = ldap_next_tmplcol( tmpl, rowp, colp )) { - if (( len = strlen( colp->ti_label )) > maxlen ) { - maxlen = len; - } - } - } - - return( maxlen ); -} - - -static int -output_label( char *buf, char *label, int width, writeptype writeproc, - void *writeparm, char *eol, int html ) -{ - char *p; - - if ( html ) { - sprintf( buf, "
%s", label ); - } else { - auto size_t w; - sprintf( buf, " %s:", label ); - p = buf + strlen( buf ); - - for (w = ldap_utf8characters(buf); w < (size_t)width; ++w) { - *p++ = ' '; - } - - *p = '\0'; - strcat( buf, eol ); - } - - return ((*writeproc)( writeparm, buf, strlen( buf ))); -} - - -static int -output_dn( char *buf, char *dn, int width, int rdncount, - writeptype writeproc, void *writeparm, char *eol, char *urlprefix ) -{ - char **dnrdns; - int i; - - if (( dnrdns = ldap_explode_dn( dn, 1 )) == NULL ) { - return( -1 ); - } - - if ( urlprefix != NULL ) { - sprintf( buf, "
" ); - } else if ( width > 0 ) { - sprintf( buf, "%-*s", width, " " ); - } else { - *buf = '\0'; - } - - for ( i = 0; dnrdns[ i ] != NULL && ( rdncount == 0 || i < rdncount ); - ++i ) { - if ( i > 0 ) { - strcat( buf, ", " ); - } - strcat( buf, dnrdns[ i ] ); - } - - if ( urlprefix != NULL ) { - strcat( buf, "
" ); - } - - ldap_value_free( dnrdns ); - - strcat( buf, eol ); - - return ((*writeproc)( writeparm, buf, strlen( buf ))); -} - - - -#define HREF_CHAR_ACCEPTABLE( c ) (( c >= '-' && c <= '9' ) || \ - ( c >= '@' && c <= 'Z' ) || \ - ( c == '_' ) || \ - ( c >= 'a' && c <= 'z' )) - -static void -strcat_escaped( char *s1, char *s2 ) -{ - char *p, *q; - char *hexdig = "0123456789ABCDEF"; - - p = s1 + strlen( s1 ); - for ( q = s2; *q != '\0'; ++q ) { - if ( HREF_CHAR_ACCEPTABLE( *q )) { - *p++ = *q; - } else { - *p++ = '%'; - *p++ = hexdig[ 0x0F & ((*(unsigned char*)q) >> 4) ]; - *p++ = hexdig[ 0x0F & *q ]; - } - } - - *p = '\0'; -} - - -#define GET2BYTENUM( p ) (( *p - '0' ) * 10 + ( *(p+1) - '0' )) - -static char * -time2text( char *ldtimestr, int dateonly ) -{ - int len; - struct tm t; - char *p, *timestr, zone, *fmterr = "badly formatted time"; - time_t gmttime; -/* CTIME for this platform doesn't use this. */ -#if !defined(SUNOS4) && !defined(BSDI) && !defined(LINUX1_2) && \ - !defined(SNI) && !defined(_WIN32) && !defined(macintosh) && !defined(LINUX) - char buf[26]; -#endif - - memset( (char *)&t, 0, sizeof( struct tm )); - if (( len = (int)strlen( ldtimestr )) < 13 ) { - return( fmterr ); - } - if ( len > 15 ) { /* throw away excess from 4-digit year time string */ - len = 15; - } else if ( len == 14 ) { - len = 13; /* assume we have a time w/2-digit year (len=13) */ - } - - for ( p = ldtimestr; p - ldtimestr + 1 < len; ++p ) { - if ( !isdigit( *p )) { - return( fmterr ); - } - } - - p = ldtimestr; - t.tm_year = GET2BYTENUM( p ); p += 2; - if ( len == 15 ) { - t.tm_year = 100 * (t.tm_year - 19); - t.tm_year += GET2BYTENUM( p ); p += 2; - } - else { - /* 2 digit years...assumed to be in the range (19)70 through - (20)69 ...less than 70 (for now, 38) means 20xx */ - if(t.tm_year < 70) { - t.tm_year += 100; - } - } - t.tm_mon = GET2BYTENUM( p ) - 1; p += 2; - t.tm_mday = GET2BYTENUM( p ); p += 2; - t.tm_hour = GET2BYTENUM( p ); p += 2; - t.tm_min = GET2BYTENUM( p ); p += 2; - t.tm_sec = GET2BYTENUM( p ); p += 2; - - if (( zone = *p ) == 'Z' ) { /* GMT */ - zone = '\0'; /* no need to indicate on screen, so we make it null */ - } - - gmttime = gtime( &t ); - timestr = NSLDAPI_CTIME( &gmttime, buf, sizeof(buf) ); - - timestr[ strlen( timestr ) - 1 ] = zone; /* replace trailing newline */ - if ( dateonly ) { - strcpy( timestr + 11, timestr + 20 ); - } - - return( timestr ); -} - - - -/* gtime.c - inverse gmtime */ - -#if !defined( macintosh ) && !defined( _WINDOWS ) && !defined( DOS ) && !defined(XP_OS2) -#include -#endif /* !macintosh */ - -/* gtime(): the inverse of localtime(). - This routine was supplied by Mike Accetta at CMU many years ago. - */ - -static int dmsize[] = { - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -}; - -#define dysize(y) \ - (((y) % 4) ? 365 : (((y) % 100) ? 366 : (((y) % 400) ? 365 : 366))) - -/* -#define YEAR(y) ((y) >= 100 ? (y) : (y) + 1900) -*/ -#define YEAR(y) (((y) < 1900) ? ((y) + 1900) : (y)) - -/* */ - -static long gtime ( struct tm *tm ) -{ - register int i, - sec, - mins, - hour, - mday, - mon, - year; - register long result; - - if ((sec = tm -> tm_sec) < 0 || sec > 59 - || (mins = tm -> tm_min) < 0 || mins > 59 - || (hour = tm -> tm_hour) < 0 || hour > 24 - || (mday = tm -> tm_mday) < 1 || mday > 31 - || (mon = tm -> tm_mon + 1) < 1 || mon > 12) - return ((long) -1); - if (hour == 24) { - hour = 0; - mday++; - } - year = YEAR (tm -> tm_year); - - result = 0L; - for (i = 1970; i < year; i++) - result += dysize (i); - if (dysize (year) == 366 && mon >= 3) - result++; - while (--mon) - result += dmsize[mon - 1]; - result += mday - 1; - result = 24 * result + hour; - result = 60 * result + mins; - result = 60 * result + sec; - - return result; -} - -static int -searchaction( LDAP *ld, char *buf, char *base, LDAPMessage *entry, char *dn, - struct ldap_tmplitem *tip, int labelwidth, int rdncount, - writeptype writeproc, void *writeparm, char *eol, char *urlprefix ) -{ - int err = LDAP_SUCCESS, lderr, i, count, html; - char **vals, **members; - char *value, *filtpattern, *attr, *selectname; - char *retattrs[2], filter[ 256 ]; - LDAPMessage *ldmp; - struct timeval timeout; - - html = ( urlprefix != NULL ); - - for ( i = 0; tip->ti_args != NULL && tip->ti_args[ i ] != NULL; ++i ) { - ; - } - if ( i < 3 ) { - return( LDAP_PARAM_ERROR ); - } - attr = tip->ti_args[ 0 ]; - filtpattern = tip->ti_args[ 1 ]; - retattrs[ 0 ] = tip->ti_args[ 2 ]; - retattrs[ 1 ] = NULL; - selectname = tip->ti_args[ 3 ]; - - vals = NULL; - if ( attr == NULL ) { - value = NULL; - } else if ( strcasecmp( attr, "-dnb" ) == 0 ) { - return( LDAP_PARAM_ERROR ); - } else if ( strcasecmp( attr, "-dnt" ) == 0 ) { - value = dn; - } else if (( vals = ldap_get_values( ld, entry, attr )) != NULL ) { - value = vals[ 0 ]; - } else { - value = NULL; - } - - ldap_build_filter( filter, sizeof( filter ), filtpattern, NULL, NULL, NULL, - value, NULL ); - - if ( html ) { - /* - * if we are generating HTML, we add an HREF link that embodies this - * search action as an LDAP URL, instead of actually doing the search - * now. - */ - sprintf( buf, "
%s

%s", - tip->ti_label, eol ); - if ((*writeproc)( writeparm, buf, strlen( buf )) < 0 ) { - return( LDAP_LOCAL_ERROR ); - } - return( LDAP_SUCCESS ); - } - - timeout.tv_sec = SEARCH_TIMEOUT_SECS; - timeout.tv_usec = 0; - -#ifdef CLDAP - if ( LDAP_IS_CLDAP( ld )) - lderr = cldap_search_s( ld, base, LDAP_SCOPE_SUBTREE, filter, retattrs, - 0, &ldmp, NULL ); - else -#endif /* CLDAP */ - lderr = ldap_search_st( ld, base, LDAP_SCOPE_SUBTREE, filter, - retattrs, 0, &timeout, &ldmp ); - - if ( lderr == LDAP_SUCCESS || NONFATAL_LDAP_ERR( lderr )) { - if (( count = ldap_count_entries( ld, ldmp )) > 0 ) { - if (( members = (char **)NSLDAPI_MALLOC( (count + 1) - * sizeof(char *))) == NULL ) { - err = LDAP_NO_MEMORY; - } else { - for ( i = 0, entry = ldap_first_entry( ld, ldmp ); - entry != NULL; - entry = ldap_next_entry( ld, entry ), ++i ) { - members[ i ] = ldap_get_dn( ld, entry ); - } - members[ i ] = NULL; - - ldap_sort_values(ld,members, ldap_sort_strcasecmp); - - err = do_vals2text( ld, NULL, members, tip->ti_label, - html ? -1 : 0, LDAP_SYN_DN, writeproc, writeparm, - eol, rdncount, urlprefix ); - - ldap_value_free( members ); - } - } - ldap_msgfree( ldmp ); - } - - - if ( vals != NULL ) { - ldap_value_free( vals ); - } - - return(( err == LDAP_SUCCESS ) ? lderr : err ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/tmpltest.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/tmpltest.c deleted file mode 100644 index 7d261af6cb2..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/tmpltest.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * 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): - */ - -/* tmpltest.c - implements a test/config templates. */ -#include -#include - -#ifdef _WINDOWS -#include -#endif - -#include "ldap-int.h" -#include "disptmpl.h" -#include "srchpref.h" - -#ifdef MACOS -#include -#include -#endif /* MACOS */ - -#ifdef NEEDPROTOS -void dump_tmpl( struct ldap_disptmpl *tmpl ); -void dump_srchpref( struct ldap_searchobj *sp ); -#else /* NEEDPROTOS */ -void dump_tmpl(); -void dump_srchpref(); -#endif /* NEEDPROTOS */ - - -#define NULLSTRINGIFNULL( s ) ( s == NULL ? "(null)" : s ) - - -int -main( int argc, char **argv ) -{ - struct ldap_disptmpl *templates, *dtp; - struct ldap_searchobj *so, *sop; - int err; - -#ifdef MACOS - ccommand( &argv ); - for ( argc = 0; argv[ argc ] != NULL; ++argc ) { - ; - } - cshow( stdout ); -#endif /* MACOS */ - - if (( err = ldap_init_templates( "ldaptemplates.conf", &templates )) - != 0 ) { - fprintf( stderr, "ldap_init_templates failed (%d)\n", err ); - exit( 1 ); - } - - if (( err = ldap_init_searchprefs( "ldapsearchprefs.conf", &so )) - != 0 ) { - fprintf( stderr, "ldap_init_searchprefs failed (%d)\n", err ); - exit( 1 ); - } - - if ( argc == 1 ) { - printf( "*** Display Templates:\n" ); - for ( dtp = ldap_first_disptmpl( templates ); dtp != NULLDISPTMPL; - dtp = ldap_next_disptmpl( templates, dtp )) { - dump_tmpl( dtp ); - printf( "\n\n" ); - } - - printf( "\n\n*** Search Objects:\n" ); - for ( sop = ldap_first_searchobj( so ); sop != NULLSEARCHOBJ; - sop = ldap_next_searchobj( so, sop )) { - dump_srchpref( sop ); - printf( "\n\n" ); - } - - } else { - if (( dtp = ldap_oc2template( ++argv, templates )) == NULL ) { - fprintf( stderr, "no matching template found\n" ); - } else { - dump_tmpl( dtp ); - } - } - - - ldap_free_templates( templates ); - ldap_free_searchprefs( so ); - - exit( 0 ); -} - - -static char *syn_name[] = { - "?", "CIS", "MLS", "DN", "BOOL", "JPEG", "JPEGBTN", "FAX", "FAXBTN", - "AUDIOBTN", "TIME", "DATE", "URL", "SEARCHACT", "LINKACT", "ADDDNACT", - "VERIFYACT", -}; - -static char *syn_type[] = { - "?", "txt", "img", "?", "bool", "?", "?", "?", "btn", - "?", "?", "?", "?", "?", "?", "?", - "action", "?" -}; - -static char *includeattrs[] = { "objectClass", "sn", NULL }; - -static char *item_opts[] = { - "ro", "sort", "1val", "hide", "required", "hideiffalse", NULL -}; - -static unsigned long item_opt_vals[] = { - LDAP_DITEM_OPT_READONLY, LDAP_DITEM_OPT_SORTVALUES, - LDAP_DITEM_OPT_SINGLEVALUED, LDAP_DITEM_OPT_HIDEIFEMPTY, - LDAP_DITEM_OPT_VALUEREQUIRED, LDAP_DITEM_OPT_HIDEIFFALSE, -}; - - -void -dump_tmpl( struct ldap_disptmpl *tmpl ) -{ - struct ldap_tmplitem *rowp, *colp; - int i, rowcnt, colcnt; - char **fetchattrs; - struct ldap_oclist *ocp; - struct ldap_adddeflist *adp; - - printf( "** Template \"%s\" (plural \"%s\", icon \"%s\")\n", - NULLSTRINGIFNULL( tmpl->dt_name ), - NULLSTRINGIFNULL( tmpl->dt_pluralname ), - NULLSTRINGIFNULL( tmpl->dt_iconname )); - - printf( "object class list:\n" ); - for ( ocp = tmpl->dt_oclist; ocp != NULL; ocp = ocp->oc_next ) { - for ( i = 0; ocp->oc_objclasses[ i ] != NULL; ++i ) { - printf( "%s%s", i == 0 ? " " : " & ", - NULLSTRINGIFNULL( ocp->oc_objclasses[ i ] )); - } - putchar( '\n' ); - } - putchar( '\n' ); - - printf( "template options: " ); - if ( tmpl->dt_options == 0L ) { - printf( "NONE\n" ); - } else { - printf( "%s %s %s\n", LDAP_IS_DISPTMPL_OPTION_SET( tmpl, - LDAP_DTMPL_OPT_ADDABLE ) ? "addable" : "", - LDAP_IS_DISPTMPL_OPTION_SET( tmpl, LDAP_DTMPL_OPT_ALLOWMODRDN ) - ? "modrdn" : "", - LDAP_IS_DISPTMPL_OPTION_SET( tmpl, LDAP_DTMPL_OPT_ALTVIEW ) - ? "altview" : "" ); - } - - printf( "authenticate as attribute: %s\n", tmpl->dt_authattrname != NULL ? - tmpl->dt_authattrname : "" ); - - printf( "default RDN attribute: %s\n", tmpl->dt_defrdnattrname != NULL ? - tmpl->dt_defrdnattrname : "NONE" ); - - printf( "default add location: %s\n", tmpl->dt_defaddlocation != NULL ? - tmpl->dt_defaddlocation : "NONE" ); - - printf( "\nnew entry value default rules:\n" ); - for ( adp = tmpl->dt_adddeflist; adp != NULL; adp = adp->ad_next ) { - if ( adp->ad_source == LDAP_ADSRC_CONSTANTVALUE ) { - printf( " attribute %s <-- constant value \"%s\"\n", - NULLSTRINGIFNULL( adp->ad_attrname), - NULLSTRINGIFNULL( adp->ad_value )); - } else { - printf( " attribute %s <-- adder's DN\n", - NULLSTRINGIFNULL( adp->ad_attrname )); - } - } - putchar( '\n' ); - - printf( "\nfetch attributes & values:\n" ); - if (( fetchattrs = ldap_tmplattrs( tmpl, includeattrs, 1, - LDAP_SYN_OPT_DEFER )) == NULL ) { - printf( " \n" ); - } else { - for ( i = 0; fetchattrs[ i ] != NULL; ++i ) { - printf( " %s\n", fetchattrs[ i ] ); - free( fetchattrs[ i ] ); - } - free( (char *)fetchattrs ); - } - - printf( "\nfetch attributes only:\n" ); - if (( fetchattrs = ldap_tmplattrs( tmpl, NULL, 0, - LDAP_SYN_OPT_DEFER )) == NULL ) { - printf( " \n" ); - } else { - for ( i = 0; fetchattrs[ i ] != NULL; ++i ) { - printf( " %s\n", fetchattrs[ i ] ); - free( fetchattrs[ i ] ); - } - free( (char *)fetchattrs ); - } - - printf( "\ntemplate items:\n" ); - rowcnt = 0; - for ( rowp = ldap_first_tmplrow( tmpl ); rowp != NULLTMPLITEM; - rowp = ldap_next_tmplrow( tmpl, rowp )) { - ++rowcnt; - colcnt = 0; - for ( colp = ldap_first_tmplcol( tmpl, rowp ); colp != NULLTMPLITEM; - colp = ldap_next_tmplcol( tmpl, rowp, colp )) { - ++colcnt; - printf( " %2d-%d: %s (%s%s", rowcnt, colcnt, - syn_name[ colp->ti_syntaxid & 0x0000FFFF ], - syn_type[ LDAP_GET_SYN_TYPE( colp->ti_syntaxid ) >> 24 ], - (( LDAP_GET_SYN_OPTIONS( colp->ti_syntaxid ) & - LDAP_SYN_OPT_DEFER ) != 0 ) ? ",defer" : "" ); - - for ( i = 0; item_opts[ i ] != NULL; ++i ) { - if ( LDAP_IS_TMPLITEM_OPTION_SET( colp, item_opt_vals[ i ] )) { - printf( ",%s", NULLSTRINGIFNULL( item_opts[ i ] )); - } - } - - printf( "), %s, %s", NULLSTRINGIFNULL( colp->ti_attrname ), - NULLSTRINGIFNULL( colp->ti_label )); - if ( colp->ti_args != NULL ) { - printf( ",args=" ); - for ( i = 0; colp->ti_args[ i ] != NULL; ++i ) { - printf( "<%s>", NULLSTRINGIFNULL( colp->ti_args[ i ] )); - } - } - - putchar( '\n' ); - } - } -} - - -void -dump_srchpref( struct ldap_searchobj *so ) -{ - int i; - struct ldap_searchattr *sa; - struct ldap_searchmatch *sm; - - printf( "Object type prompt: %s\n", - NULLSTRINGIFNULL( so->so_objtypeprompt )); - printf( "Options: %s\n", - LDAP_IS_SEARCHOBJ_OPTION_SET( so, LDAP_SEARCHOBJ_OPT_INTERNAL ) ? - "internal" : "NONE" ); - printf( "Prompt: %s\n", NULLSTRINGIFNULL( so->so_prompt )); - printf( "Scope: " ); - switch ( so->so_defaultscope ) { - case LDAP_SCOPE_BASE: - printf( "LDAP_SCOPE_BASE" ); - break; - case LDAP_SCOPE_ONELEVEL: - printf( "LDAP_SCOPE_ONELEVEL" ); - break; - case LDAP_SCOPE_SUBTREE: - printf( "LDAP_SCOPE_SUBTREE" ); - break; - default: - printf("*** unknown!" ); - } - puts( "\n" ); - printf( "Filter prefix: %s\n", - NULLSTRINGIFNULL( so->so_filterprefix )); - printf( "Filter tag: %s\n", - NULLSTRINGIFNULL( so->so_filtertag )); - printf( "Default select attr: %s\n", - NULLSTRINGIFNULL( so->so_defaultselectattr )); - printf( "Default select text: %s\n", - NULLSTRINGIFNULL( so->so_defaultselecttext )); - printf( "Searchable attributes ---- \n" ); - for ( sa = so->so_salist; sa != NULL; sa = sa->sa_next ) { - printf( " Label: %s\n", NULLSTRINGIFNULL( sa->sa_attrlabel )); - printf( " Attribute: %s\n", NULLSTRINGIFNULL( sa->sa_attr )); - printf( " Select attr: %s\n", NULLSTRINGIFNULL( sa->sa_selectattr )); - printf( " Select text: %s\n", NULLSTRINGIFNULL( sa->sa_selecttext )); - printf( " Match types ---- \n" ); - for ( i = 0, sm = so->so_smlist; sm != NULL; i++, sm = sm->sm_next ) { - if (( sa->sa_matchtypebitmap >> i ) & 1 ) { - printf( " %s (%s)\n", - NULLSTRINGIFNULL( sm->sm_matchprompt ), - NULLSTRINGIFNULL( sm->sm_filter )); - } - } - } -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/ufn.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/ufn.c deleted file mode 100644 index 5f52ef28c07..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/ufn.c +++ /dev/null @@ -1,534 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * ufn.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -typedef int (LDAP_CALL *cancelptype)( void *cancelparm ); - -static int ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, - char *prefix, char **attrs, int attrsonly, - LDAPMessage **res, LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm, - char *tag1, char *tag2, char *tag3 ); -static LDAPMessage *ldap_msg_merge( LDAP *ld, LDAPMessage *a, LDAPMessage *b ); -static LDAPMessage *ldap_ufn_expand( LDAP *ld, - LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm, char **dns, - char *filter, int scope, char **attrs, int aonly, int *err ); - -/* - * ldap_ufn_search_ctx - do user friendly searching; provide cancel feature; - * specify ldapfilter.conf tags for each phase of search - * - * ld LDAP descriptor - * ufncomp the exploded user friendly name to look for - * ncomp number of elements in ufncomp - * prefix where to start searching - * attrs list of attribute types to return for matches - * attrsonly 1 => attributes only 0 => attributes and values - * res will contain the result of the search - * cancelproc routine that returns non-zero if operation should be - * cancelled. This can be NULL. If it is non-NULL, the - * routine will be called periodically. - * cancelparm void * that is passed to cancelproc - * tag[123] the ldapfilter.conf tag that will be used in phases - * 1, 2, and 3 of the search, respectively - * - * Example: - * char *attrs[] = { "mail", "title", 0 }; - * char *ufncomp[] = { "howes", "umich", "us", 0 } - * LDAPMessage *res; - * error = ldap_ufn_search_ctx( ld, ufncomp, 3, NULL, attrs, attrsonly, - * &res, acancelproc, along, "ufn first", - * "ufn intermediate", "ufn last" ); - */ - -static int -ldap_ufn_search_ctx( - LDAP *ld, - char **ufncomp, - int ncomp, - char *prefix, - char **attrs, - int attrsonly, - LDAPMessage **res, - LDAP_CANCELPROC_CALLBACK *cancelproc, - void *cancelparm, - char *tag1, - char *tag2, - char *tag3 -) -{ - char *dn, *ftag = NULL; - char **dns = NULL; - int max, i, err, scope = 0, phase, tries; - LDAPFiltInfo *fi; - LDAPMessage *tmpcand; - LDAPMessage *candidates; - static char *objattrs[] = { "objectClass", NULL }; - - /* - * look up ufn components from most to least significant. - * there are 3 phases. - * phase 1 search the root for orgs or countries - * phase 2 search for orgs - * phase 3 search for a person - * in phases 1 and 2, we are building a list of candidate DNs, - * below which we will search for the final component of the ufn. - * for each component we try the filters listed in the - * filterconfig file, first one-level (except the last compoment), - * then subtree. if any of them produce any results, we go on to - * the next component. - */ - - *res = NULL; - candidates = NULL; - phase = 1; - for ( ncomp--; ncomp != -1; ncomp-- ) { - if ( *ufncomp[ncomp] == '"' ) { - char *quote; - - if ( (quote = strrchr( ufncomp[ncomp], '"' )) != NULL ) - *quote = '\0'; - strcpy( ufncomp[ncomp], ufncomp[ncomp] + 1 ); - } - if ( ncomp == 0 ) - phase = 3; - - switch ( phase ) { - case 1: - ftag = tag1; - scope = LDAP_SCOPE_ONELEVEL; - break; - case 2: - ftag = tag2; - scope = LDAP_SCOPE_ONELEVEL; - break; - case 3: - ftag = tag3; - scope = LDAP_SCOPE_SUBTREE; - break; - } - - /* - * construct an array of DN's to search below from the - * list of candidates. - */ - - if ( candidates == NULL ) { - if ( prefix != NULL ) { - if ( (dns = (char **)NSLDAPI_MALLOC( - sizeof(char *) * 2 )) == NULL ) { - err = LDAP_NO_MEMORY; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - dns[0] = nsldapi_strdup( prefix ); - dns[1] = NULL; - } else { - dns = NULL; - } - } else { - i = 0, max = 0; - for ( tmpcand = candidates; tmpcand != NULL && - tmpcand->lm_msgtype != LDAP_RES_SEARCH_RESULT; - tmpcand = tmpcand->lm_chain ) - { - if ( (dn = ldap_get_dn( ld, tmpcand )) == NULL ) - continue; - - if ( dns == NULL ) { - if ( (dns = (char **)NSLDAPI_MALLOC( - sizeof(char *) * 8 )) == NULL ) { - err = LDAP_NO_MEMORY; - LDAP_SET_LDERRNO( ld, err, - NULL, NULL ); - return( err ); - } - max = 8; - } else if ( i >= max ) { - if ( (dns = (char **)NSLDAPI_REALLOC( - dns, sizeof(char *) * 2 * max )) - == NULL ) { - err = LDAP_NO_MEMORY; - LDAP_SET_LDERRNO( ld, err, - NULL, NULL ); - return( err ); - } - max *= 2; - } - dns[i++] = dn; - dns[i] = NULL; - } - ldap_msgfree( candidates ); - candidates = NULL; - } - tries = 0; - tryagain: - tries++; - for ( fi = ldap_getfirstfilter( ld->ld_filtd, ftag, - ufncomp[ncomp] ); fi != NULL; - fi = ldap_getnextfilter( ld->ld_filtd ) ) - { - if ( (candidates = ldap_ufn_expand( ld, cancelproc, - cancelparm, dns, fi->lfi_filter, scope, - phase == 3 ? attrs : objattrs, - phase == 3 ? attrsonly : 1, &err )) != NULL ) - { - break; - } - - if ( err == -1 || err == LDAP_USER_CANCELLED ) { - if ( dns != NULL ) { - ldap_value_free( dns ); - dns = NULL; - } - return( err ); - } - } - - if ( candidates == NULL ) { - if ( tries < 2 && phase != 3 ) { - scope = LDAP_SCOPE_SUBTREE; - goto tryagain; - } else { - if ( dns != NULL ) { - ldap_value_free( dns ); - dns = NULL; - } - return( err ); - } - } - - /* go on to the next component */ - if ( phase == 1 ) - phase++; - if ( dns != NULL ) { - ldap_value_free( dns ); - dns = NULL; - } - } - *res = candidates; - - return( err ); -} - -int -LDAP_CALL -ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, int attrsonly, - LDAPMessage **res, LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm, - char *tag1, char *tag2, char *tag3 ) -{ - char **ufncomp, **prefixcomp; - char *pbuf; - int ncomp, pcomp, i, err = 0; - - /* getfilter stuff must be inited before we are called */ - if ( ld->ld_filtd == NULL ) { - err = LDAP_PARAM_ERROR; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - - /* call ldap_explode_dn() to break the ufn into its components */ - if ( (ufncomp = ldap_explode_dn( ufn, 0 )) == NULL ) { - err = LDAP_LOCAL_ERROR; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - for ( ncomp = 0; ufncomp[ncomp] != NULL; ncomp++ ) - ; /* NULL */ - - /* more than two components => try it fully qualified first */ - if ( ncomp > 2 || ld->ld_ufnprefix == NULL ) { - err = ldap_ufn_search_ctx( ld, ufncomp, ncomp, NULL, attrs, - attrsonly, res, cancelproc, cancelparm, tag1, tag2, tag3 ); - - if ( ldap_count_entries( ld, *res ) > 0 ) { - ldap_value_free( ufncomp ); - return( err ); - } else { - ldap_msgfree( *res ); - *res = NULL; - } - } - - if ( ld->ld_ufnprefix == NULL ) { - ldap_value_free( ufncomp ); - return( err ); - } - - /* if that failed, or < 2 components, use the prefix */ - if ( (prefixcomp = ldap_explode_dn( ld->ld_ufnprefix, 0 )) == NULL ) { - ldap_value_free( ufncomp ); - err = LDAP_LOCAL_ERROR; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - for ( pcomp = 0; prefixcomp[pcomp] != NULL; pcomp++ ) - ; /* NULL */ - if ( (pbuf = (char *)NSLDAPI_MALLOC( strlen( ld->ld_ufnprefix ) + 1 )) - == NULL ) { - ldap_value_free( ufncomp ); - ldap_value_free( prefixcomp ); - err = LDAP_NO_MEMORY; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - - for ( i = 0; i < pcomp; i++ ) { - int j; - - *pbuf = '\0'; - for ( j = i; j < pcomp; j++ ) { - strcat( pbuf, prefixcomp[j] ); - if ( j + 1 < pcomp ) - strcat( pbuf, "," ); - } - err = ldap_ufn_search_ctx( ld, ufncomp, ncomp, pbuf, attrs, - attrsonly, res, cancelproc, cancelparm, tag1, tag2, tag3 ); - - if ( ldap_count_entries( ld, *res ) > 0 ) { - break; - } else { - ldap_msgfree( *res ); - *res = NULL; - } - } - - ldap_value_free( ufncomp ); - ldap_value_free( prefixcomp ); - NSLDAPI_FREE( pbuf ); - - return( err ); -} - -/* - * same as ldap_ufn_search_ct, except without the ability to specify - * ldapfilter.conf tags. - */ -int -LDAP_CALL -ldap_ufn_search_c( LDAP *ld, char *ufn, char **attrs, int attrsonly, - LDAPMessage **res, LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm ) -{ - return( ldap_ufn_search_ct( ld, ufn, attrs, attrsonly, res, cancelproc, - cancelparm, "ufn first", "ufn intermediate", "ufn last" ) ); -} - -/* - * same as ldap_ufn_search_c without the cancel function - */ -int -LDAP_CALL -ldap_ufn_search_s( LDAP *ld, char *ufn, char **attrs, int attrsonly, - LDAPMessage **res ) -{ - struct timeval tv; - - tv.tv_sec = ld->ld_timelimit; - - return( ldap_ufn_search_ct( ld, ufn, attrs, attrsonly, res, - ld->ld_timelimit ? ldap_ufn_timeout : NULL, - ld->ld_timelimit ? (void *) &tv : NULL, - "ufn first", "ufn intermediate", "ufn last" ) ); -} - - -/* - * ldap_msg_merge - merge two ldap search result chains. the more - * serious of the two error result codes is kept. - */ - -static LDAPMessage * -ldap_msg_merge( LDAP *ld, LDAPMessage *a, LDAPMessage *b ) -{ - LDAPMessage *end, *aprev, *aend, *bprev, *bend; - - if ( a == NULL ) - return( b ); - - if ( b == NULL ) - return( a ); - - /* find the ends of the a and b chains */ - aprev = NULL; - for ( aend = a; aend->lm_chain != NULL; aend = aend->lm_chain ) - aprev = aend; - bprev = NULL; - for ( bend = b; bend->lm_chain != NULL; bend = bend->lm_chain ) - bprev = bend; - - /* keep result a */ - if ( ldap_result2error( ld, aend, 0 ) != LDAP_SUCCESS ) { - /* remove result b */ - ldap_msgfree( bend ); - if ( bprev != NULL ) - bprev->lm_chain = NULL; - else - b = NULL; - end = aend; - if ( aprev != NULL ) - aprev->lm_chain = NULL; - else - a = NULL; - /* keep result b */ - } else { - /* remove result a */ - ldap_msgfree( aend ); - if ( aprev != NULL ) - aprev->lm_chain = NULL; - else - a = NULL; - end = bend; - if ( bprev != NULL ) - bprev->lm_chain = NULL; - else - b = NULL; - } - - if ( (a == NULL && b == NULL) || (a == NULL && bprev == NULL) || - (b == NULL && aprev == NULL) ) - return( end ); - - if ( a == NULL ) { - bprev->lm_chain = end; - return( b ); - } else if ( b == NULL ) { - aprev->lm_chain = end; - return( a ); - } else { - bprev->lm_chain = end; - aprev->lm_chain = b; - return( a ); - } -} - -static LDAPMessage * -ldap_ufn_expand( LDAP *ld, LDAP_CANCELPROC_CALLBACK *cancelproc, - void *cancelparm, char **dns, char *filter, int scope, - char **attrs, int aonly, int *err ) -{ - LDAPMessage *tmpcand, *tmpres; - char *dn; - int i, msgid; - struct timeval tv; - - /* search for this component below the current candidates */ - tmpcand = NULL; - i = 0; - do { - if ( dns != NULL ) - dn = dns[i]; - else - dn = ""; - - if (( msgid = ldap_search( ld, dn, scope, filter, attrs, - aonly )) == -1 ) { - ldap_msgfree( tmpcand ); - *err = LDAP_GET_LDERRNO( ld, NULL, NULL ); - return( NULL ); - } - - tv.tv_sec = 0; - tv.tv_usec = 100000; /* 1/10 of a second */ - - do { - *err = ldap_result( ld, msgid, 1, &tv, &tmpres ); - if ( *err == 0 && cancelproc != NULL && - (*cancelproc)( cancelparm ) != 0 ) { - ldap_abandon( ld, msgid ); - *err = LDAP_USER_CANCELLED; - LDAP_SET_LDERRNO( ld, *err, NULL, NULL ); - } - } while ( *err == 0 ); - - if ( *err == LDAP_USER_CANCELLED || *err < 0 || - ( *err = ldap_result2error( ld, tmpres, 0 )) == -1 ) { - ldap_msgfree( tmpcand ); - return( NULL ); - } - - tmpcand = ldap_msg_merge( ld, tmpcand, tmpres ); - - i++; - } while ( dns != NULL && dns[i] != NULL ); - - if ( ldap_count_entries( ld, tmpcand ) > 0 ) { - return( tmpcand ); - } else { - ldap_msgfree( tmpcand ); - return( NULL ); - } -} - -/* - * ldap_ufn_setfilter - set the filter config file used in ufn searching - */ - -LDAPFiltDesc * -LDAP_CALL -ldap_ufn_setfilter( LDAP *ld, char *fname ) -{ - if ( ld->ld_filtd != NULL ) - ldap_getfilter_free( ld->ld_filtd ); - - return( ld->ld_filtd = ldap_init_getfilter( fname ) ); -} - -void -LDAP_CALL -ldap_ufn_setprefix( LDAP *ld, char *prefix ) -{ - if ( ld->ld_ufnprefix != NULL ) - NSLDAPI_FREE( ld->ld_ufnprefix ); - - ld->ld_ufnprefix = nsldapi_strdup( prefix ); -} - -int -LDAP_C -ldap_ufn_timeout( void *tvparam ) -{ - struct timeval *tv; - - tv = (struct timeval *)tvparam; - - if ( tv->tv_sec != 0 ) { - tv->tv_usec = tv->tv_sec * 1000000; /* sec => micro sec */ - tv->tv_sec = 0; - } - tv->tv_usec -= 100000; /* 1/10 of a second */ - - return( tv->tv_usec <= 0 ? 1 : 0 ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/unbind.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/unbind.c deleted file mode 100644 index c9a2de58772..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/unbind.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * 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) 1990 Regents of the University of Michigan. - * All rights reserved. - */ - -/* - * unbind.c - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - -int -LDAP_CALL -ldap_unbind( LDAP *ld ) -{ - LDAPDebug( LDAP_DEBUG_TRACE, "ldap_unbind\n", 0, 0, 0 ); - - return( ldap_ld_free( ld, NULL, NULL, 1 ) ); -} - - -int -LDAP_CALL -ldap_unbind_s( LDAP *ld ) -{ - return( ldap_ld_free( ld, NULL, NULL, 1 )); -} - - -int -LDAP_CALL -ldap_unbind_ext( LDAP *ld, LDAPControl **serverctrls, - LDAPControl **clientctrls ) -{ - return( ldap_ld_free( ld, serverctrls, clientctrls, 1 )); -} - - -/* - * Dispose of the LDAP session ld, including all associated connections - * and resources. If close is non-zero, an unbind() request is sent as well. - */ -int -ldap_ld_free( LDAP *ld, LDAPControl **serverctrls, - LDAPControl **clientctrls, int close ) -{ - int i; - LDAPMessage *lm, *next; - int err = LDAP_SUCCESS; - LDAPRequest *lr, *nextlr; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - if ( ld->ld_sbp->sb_naddr == 0 ) { - LDAP_MUTEX_LOCK( ld, LDAP_REQ_LOCK ); - /* free LDAP structure and outstanding requests/responses */ - for ( lr = ld->ld_requests; lr != NULL; lr = nextlr ) { - nextlr = lr->lr_next; - nsldapi_free_request( ld, lr, 0 ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_REQ_LOCK ); - - /* free and unbind from all open connections */ - LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK ); - while ( ld->ld_conns != NULL ) { - nsldapi_free_connection( ld, ld->ld_conns, serverctrls, - clientctrls, 1, close ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK ); - - } else { - int i; - - for ( i = 0; i < ld->ld_sbp->sb_naddr; ++i ) { - NSLDAPI_FREE( ld->ld_sbp->sb_addrs[ i ] ); - } - NSLDAPI_FREE( ld->ld_sbp->sb_addrs ); - NSLDAPI_FREE( ld->ld_sbp->sb_fromaddr ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_RESP_LOCK ); - for ( lm = ld->ld_responses; lm != NULL; lm = next ) { - next = lm->lm_next; - ldap_msgfree( lm ); - } - LDAP_MUTEX_UNLOCK( ld, LDAP_RESP_LOCK ); - - /* call cache unbind function to allow it to clean up after itself */ - if ( ld->ld_cache_unbind != NULL ) { - LDAP_MUTEX_LOCK( ld, LDAP_CACHE_LOCK ); - (void)ld->ld_cache_unbind( ld, 0, 0 ); - LDAP_MUTEX_UNLOCK( ld, LDAP_CACHE_LOCK ); - } - - /* call the dispose handle I/O callback if one is defined */ - if ( ld->ld_extdisposehandle_fn != NULL ) { - /* - * We always pass the session extended I/O argument to - * the dispose handle callback. - */ - ld->ld_extdisposehandle_fn( ld, ld->ld_ext_session_arg ); - } - - if ( ld->ld_error != NULL ) - NSLDAPI_FREE( ld->ld_error ); - if ( ld->ld_matched != NULL ) - NSLDAPI_FREE( ld->ld_matched ); - if ( ld->ld_host != NULL ) - NSLDAPI_FREE( ld->ld_host ); - if ( ld->ld_ufnprefix != NULL ) - NSLDAPI_FREE( ld->ld_ufnprefix ); - if ( ld->ld_filtd != NULL ) - ldap_getfilter_free( ld->ld_filtd ); - if ( ld->ld_abandoned != NULL ) - NSLDAPI_FREE( ld->ld_abandoned ); - if ( ld->ld_sbp != NULL ) - ber_sockbuf_free( ld->ld_sbp ); - if ( ld->ld_defhost != NULL ) - NSLDAPI_FREE( ld->ld_defhost ); - if ( ld->ld_servercontrols != NULL ) - ldap_controls_free( ld->ld_servercontrols ); - if ( ld->ld_clientcontrols != NULL ) - ldap_controls_free( ld->ld_clientcontrols ); - if ( ld->ld_preferred_language != NULL ) - NSLDAPI_FREE( ld->ld_preferred_language ); - nsldapi_iostatus_free( ld ); - - /* - * XXXmcs: should use cache function pointers to hook in memcache - */ - if ( ld->ld_memcache != NULL ) { - ldap_memcache_set( ld, NULL ); - } - - for( i=0; ild_mutex[i] ); - } - - NSLDAPI_FREE( ld->ld_mutex ); - NSLDAPI_FREE( (char *) ld ); - - return( err ); -} - - - -int -nsldapi_send_unbind( LDAP *ld, Sockbuf *sb, LDAPControl **serverctrls, - LDAPControl **clientctrls ) -{ - BerElement *ber; - int err, msgid; - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_send_unbind\n", 0, 0, 0 ); - - /* create a message to send */ - if (( err = nsldapi_alloc_ber_with_options( ld, &ber )) - != LDAP_SUCCESS ) { - return( err ); - } - - /* fill it in */ - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - msgid = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - if ( ber_printf( ber, "{itn", msgid, LDAP_REQ_UNBIND ) == -1 ) { - ber_free( ber, 1 ); - err = LDAP_ENCODING_ERROR; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - - if (( err = nsldapi_put_controls( ld, serverctrls, 1, ber )) - != LDAP_SUCCESS ) { - ber_free( ber, 1 ); - return( err ); - } - - /* send the message */ - if ( nsldapi_ber_flush( ld, sb, ber, 1, 0 ) != 0 ) { - ber_free( ber, 1 ); - err = LDAP_SERVER_DOWN; - LDAP_SET_LDERRNO( ld, err, NULL, NULL ); - return( err ); - } - - return( LDAP_SUCCESS ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/unescape.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/unescape.c deleted file mode 100644 index aa6c92e5cc7..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/unescape.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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): - */ - -/* - * LIBLDAP unescape.c -- LDAP URL un-escape routines - * We also tolerate URLs that look like: and - */ - -#include "ldap-int.h" - - -static int unhex( char c ); - - -void -nsldapi_hex_unescape( char *s ) -{ -/* - * Remove URL hex escapes from s... done in place. The basic concept for - * this routine is borrowed from the WWW library HTUnEscape() routine. - */ - 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'; -} - - -static int -unhex( char c ) -{ - return( c >= '0' && c <= '9' ? c - '0' - : c >= 'A' && c <= 'F' ? c - 'A' + 10 - : c - 'a' + 10 ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/url.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/url.c deleted file mode 100644 index f8f6189f72c..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/url.c +++ /dev/null @@ -1,502 +0,0 @@ -/* - * 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 Regents of the University of Michigan. - * All rights reserved. - * - */ -/* LIBLDAP url.c -- LDAP URL related routines - * - * LDAP URLs look like this: - * l d a p : / / [ hostport ] [ / dn [ ? [ attributes ] [ ? [ scope ] - * [ ? [ filter ] [ ? extensions ] ] ] ] ] - * - * where: - * hostport is a host or a host:port list that can be space-separated. - * attributes is a comma separated list - * scope is one of these three strings: base one sub (default=base) - * filter is a string-represented filter as in RFC 2254 - * extensions is a comma-separated list of name=value pairs. - * - * e.g., ldap://ldap.itd.umich.edu/c=US?o,description?one?o=umich - * - * To accomodate IPv6 addresses, the host portion of a host that appears - * in hostport can be enclosed in square brackets, e.g - * - * e.g., ldap://[fe80::a00:20ff:fee5:c0b4]:3389/dc=siroe,dc=com - * - * We also tolerate URLs that look like: and - */ - -#if 0 -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1996 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif -#endif - -#include "ldap-int.h" - - -static int skip_url_prefix( const char **urlp, int *enclosedp, int *securep ); - - -int -LDAP_CALL -ldap_is_ldap_url( const char *url ) -{ - int enclosed, secure; - - return( url != NULL - && skip_url_prefix( &url, &enclosed, &secure )); -} - - -static int -skip_url_prefix( const char **urlp, int *enclosedp, int *securep ) -{ -/* - * return non-zero if this looks like a LDAP URL; zero if not - * if non-zero returned, *urlp will be moved past "ldap://" part of URL - * The data that *urlp points to is not changed by this function. - */ - if ( *urlp == NULL ) { - return( 0 ); - } - - /* skip leading '<' (if any) */ - if ( **urlp == '<' ) { - *enclosedp = 1; - ++*urlp; - } else { - *enclosedp = 0; - } - - /* skip leading "URL:" (if any) */ - if ( strlen( *urlp ) >= LDAP_URL_URLCOLON_LEN && strncasecmp( - *urlp, LDAP_URL_URLCOLON, LDAP_URL_URLCOLON_LEN ) == 0 ) { - *urlp += LDAP_URL_URLCOLON_LEN; - } - - /* check for an "ldap://" prefix */ - if ( strlen( *urlp ) >= LDAP_URL_PREFIX_LEN && strncasecmp( *urlp, - LDAP_URL_PREFIX, LDAP_URL_PREFIX_LEN ) == 0 ) { - /* skip over URL prefix and return success */ - *urlp += LDAP_URL_PREFIX_LEN; - *securep = 0; - return( 1 ); - } - - /* check for an "ldaps://" prefix */ - if ( strlen( *urlp ) >= LDAPS_URL_PREFIX_LEN && strncasecmp( *urlp, - LDAPS_URL_PREFIX, LDAPS_URL_PREFIX_LEN ) == 0 ) { - /* skip over URL prefix and return success */ - *urlp += LDAPS_URL_PREFIX_LEN; - *securep = 1; - return( 1 ); - } - - return( 0 ); /* not an LDAP URL */ -} - - - - -int -LDAP_CALL -ldap_url_parse( const char *url, LDAPURLDesc **ludpp ) -{ -/* - * Pick apart the pieces of an LDAP URL. - */ - int rc; - - if (( rc = nsldapi_url_parse( url, ludpp, 1 )) == 0 ) { - if ( (*ludpp)->lud_scope == -1 ) { - (*ludpp)->lud_scope = LDAP_SCOPE_BASE; - } - if ( (*ludpp)->lud_filter == NULL ) { - (*ludpp)->lud_filter = "(objectclass=*)"; - } - if ( *((*ludpp)->lud_dn) == '\0' ) { - (*ludpp)->lud_dn = NULL; - } - } else if ( rc == LDAP_URL_UNRECOGNIZED_CRITICAL_EXTENSION ) { - rc = LDAP_URL_ERR_PARAM; /* mapped for backwards compatibility */ - } - - return( rc ); -} - - -/* - * like ldap_url_parse() with a few exceptions: - * 1) if dn_required is zero, a missing DN does not generate an error - * (we just leave the lud_dn field NULL) - * 2) no defaults are set for lud_scope and lud_filter (they are set to -1 - * and NULL respectively if no SCOPE or FILTER are present in the URL). - * 3) when there is a zero-length DN in a URL we do not set lud_dn to NULL. - * - * note that LDAPv3 URL extensions are ignored unless they are marked - * critical, in which case an LDAP_URL_UNRECOGNIZED_CRITICAL_EXTENSION error - * is returned. - */ -int -nsldapi_url_parse( const char *url, LDAPURLDesc **ludpp, int dn_required ) -{ - - LDAPURLDesc *ludp; - char *urlcopy, *attrs, *scope, *extensions = NULL, *p, *q; - int enclosed, secure, i, nattrs, at_start; - - LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_url_parse(%s)\n", url, 0, 0 ); - - if ( url == NULL || ludpp == NULL ) { - return( LDAP_URL_ERR_PARAM ); - } - - *ludpp = NULL; /* pessimistic */ - - if ( !skip_url_prefix( &url, &enclosed, &secure )) { - return( LDAP_URL_ERR_NOTLDAP ); - } - - /* allocate return struct */ - if (( ludp = (LDAPURLDesc *)NSLDAPI_CALLOC( 1, sizeof( LDAPURLDesc ))) - == NULLLDAPURLDESC ) { - return( LDAP_URL_ERR_MEM ); - } - - if ( secure ) { - ludp->lud_options |= LDAP_URL_OPT_SECURE; - } - - /* make working copy of the remainder of the URL */ - if (( urlcopy = nsldapi_strdup( url )) == NULL ) { - ldap_free_urldesc( ludp ); - return( LDAP_URL_ERR_MEM ); - } - - if ( enclosed && *((p = urlcopy + strlen( urlcopy ) - 1)) == '>' ) { - *p = '\0'; - } - - /* initialize scope and filter */ - ludp->lud_scope = -1; - ludp->lud_filter = NULL; - - /* lud_string is the only malloc'd string space we use */ - ludp->lud_string = urlcopy; - - /* scan forward for '/' that marks end of hostport and begin. of dn */ - if (( ludp->lud_dn = strchr( urlcopy, '/' )) == NULL ) { - if ( dn_required ) { - ldap_free_urldesc( ludp ); - return( LDAP_URL_ERR_NODN ); - } - } else { - /* terminate hostport; point to start of dn */ - *ludp->lud_dn++ = '\0'; - } - - - if ( *urlcopy == '\0' ) { - ludp->lud_host = NULL; - } else { - ludp->lud_host = urlcopy; - nsldapi_hex_unescape( ludp->lud_host ); - - /* - * Locate and strip off optional port number (:#) in host - * portion of URL. - * - * If more than one space-separated host is listed, we only - * look for a port number within the right-most one since - * ldap_init() will handle host parameters that look like - * host:port anyway. - */ - if (( p = strrchr( ludp->lud_host, ' ' )) == NULL ) { - p = ludp->lud_host; - } else { - ++p; - } - if ( *p == '[' && ( q = strchr( p, ']' )) != NULL ) { - /* square brackets present -- skip past them */ - p = q++; - } - if (( p = strchr( p, ':' )) != NULL ) { - *p++ = '\0'; - ludp->lud_port = atoi( p ); - if ( *ludp->lud_host == '\0' ) { - ludp->lud_host = NULL; /* no hostname */ - } - } - } - - /* scan for '?' that marks end of dn and beginning of attributes */ - attrs = NULL; - if ( ludp->lud_dn != NULL && - ( attrs = strchr( ludp->lud_dn, '?' )) != NULL ) { - /* terminate dn; point to start of attrs. */ - *attrs++ = '\0'; - - /* scan for '?' that marks end of attrs and begin. of scope */ - if (( p = strchr( attrs, '?' )) != NULL ) { - /* - * terminate attrs; point to start of scope and scan for - * '?' that marks end of scope and begin. of filter - */ - *p++ = '\0'; - scope = p; - - if (( p = strchr( scope, '?' )) != NULL ) { - /* terminate scope; point to start of filter */ - *p++ = '\0'; - if ( *p != '\0' ) { - ludp->lud_filter = p; - /* - * scan for the '?' that marks the end - * of the filter and the start of any - * extensions - */ - if (( p = strchr( ludp->lud_filter, '?' )) - != NULL ) { - *p++ = '\0'; /* term. filter */ - extensions = p; - } - if ( *ludp->lud_filter == '\0' ) { - ludp->lud_filter = NULL; - } else { - nsldapi_hex_unescape( ludp->lud_filter ); - } - } - } - - if ( strcasecmp( scope, "one" ) == 0 ) { - ludp->lud_scope = LDAP_SCOPE_ONELEVEL; - } else if ( strcasecmp( scope, "base" ) == 0 ) { - ludp->lud_scope = LDAP_SCOPE_BASE; - } else if ( strcasecmp( scope, "sub" ) == 0 ) { - ludp->lud_scope = LDAP_SCOPE_SUBTREE; - } else if ( *scope != '\0' ) { - ldap_free_urldesc( ludp ); - return( LDAP_URL_ERR_BADSCOPE ); - } - } - } - - if ( ludp->lud_dn != NULL ) { - nsldapi_hex_unescape( ludp->lud_dn ); - } - - /* - * if attrs list was included, turn it into a null-terminated array - */ - if ( attrs != NULL && *attrs != '\0' ) { - nsldapi_hex_unescape( attrs ); - for ( nattrs = 1, p = attrs; *p != '\0'; ++p ) { - if ( *p == ',' ) { - ++nattrs; - } - } - - if (( ludp->lud_attrs = (char **)NSLDAPI_CALLOC( nattrs + 1, - sizeof( char * ))) == NULL ) { - ldap_free_urldesc( ludp ); - return( LDAP_URL_ERR_MEM ); - } - - for ( i = 0, p = attrs; i < nattrs; ++i ) { - ludp->lud_attrs[ i ] = p; - if (( p = strchr( p, ',' )) != NULL ) { - *p++ ='\0'; - } - nsldapi_hex_unescape( ludp->lud_attrs[ i ] ); - } - } - - /* if extensions list was included, check for critical ones */ - if ( extensions != NULL && *extensions != '\0' ) { - /* Note: at present, we do not recognize ANY extensions */ - at_start = 1; - for ( p = extensions; *p != '\0'; ++p ) { - if ( at_start ) { - if ( *p == '!' ) { /* critical extension */ - ldap_free_urldesc( ludp ); - return( LDAP_URL_UNRECOGNIZED_CRITICAL_EXTENSION ); - } - at_start = 0; - } else if ( *p == ',' ) { - at_start = 1; - } - } - } - - *ludpp = ludp; - - return( 0 ); -} - - -void -LDAP_CALL -ldap_free_urldesc( LDAPURLDesc *ludp ) -{ - if ( ludp != NULLLDAPURLDESC ) { - if ( ludp->lud_string != NULL ) { - NSLDAPI_FREE( ludp->lud_string ); - } - if ( ludp->lud_attrs != NULL ) { - NSLDAPI_FREE( ludp->lud_attrs ); - } - NSLDAPI_FREE( ludp ); - } -} - - -int -LDAP_CALL -ldap_url_search( LDAP *ld, const char *url, int attrsonly ) -{ - int err, msgid; - LDAPURLDesc *ludp; - BerElement *ber; - LDAPServer *srv; - char *host; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( -1 ); /* punt */ - } - - if ( ldap_url_parse( url, &ludp ) != 0 ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( -1 ); - } - - LDAP_MUTEX_LOCK( ld, LDAP_MSGID_LOCK ); - msgid = ++ld->ld_msgid; - LDAP_MUTEX_UNLOCK( ld, LDAP_MSGID_LOCK ); - - if ( nsldapi_build_search_req( ld, ludp->lud_dn, ludp->lud_scope, - ludp->lud_filter, ludp->lud_attrs, attrsonly, NULL, NULL, - -1, -1, msgid, &ber ) != LDAP_SUCCESS ) { - return( -1 ); - } - - err = 0; - - if ( ludp->lud_host == NULL ) { - host = ld->ld_defhost; - } else { - host = ludp->lud_host; - } - - if (( srv = (LDAPServer *)NSLDAPI_CALLOC( 1, sizeof( LDAPServer ))) - == NULL || ( host != NULL && - ( srv->lsrv_host = nsldapi_strdup( host )) == NULL )) { - if ( srv != NULL ) { - NSLDAPI_FREE( srv ); - } - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - err = -1; - } else { - if ( ludp->lud_port == 0 ) { - if (( ludp->lud_options & LDAP_URL_OPT_SECURE ) == 0 ) { - srv->lsrv_port = LDAP_PORT; - } else { - srv->lsrv_port = LDAPS_PORT; - } - } else { - srv->lsrv_port = ludp->lud_port; - } - } - - if (( ludp->lud_options & LDAP_URL_OPT_SECURE ) != 0 ) { - srv->lsrv_options |= LDAP_SRV_OPT_SECURE; - } - - if ( err != 0 ) { - ber_free( ber, 1 ); - } else { - err = nsldapi_send_server_request( ld, ber, msgid, NULL, srv, - NULL, NULL, 1 ); - } - - ldap_free_urldesc( ludp ); - return( err ); -} - - -int -LDAP_CALL -ldap_url_search_st( LDAP *ld, const char *url, int attrsonly, - struct timeval *timeout, LDAPMessage **res ) -{ - int msgid; - - /* - * It is an error to pass in a zero'd timeval. - */ - if ( timeout != NULL && timeout->tv_sec == 0 && - timeout->tv_usec == 0 ) { - if ( ld != NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - } - if ( res != NULL ) { - *res = NULL; - } - return( LDAP_PARAM_ERROR ); - } - - if (( msgid = ldap_url_search( ld, url, attrsonly )) == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - if ( ldap_result( ld, msgid, 1, timeout, res ) == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - if ( LDAP_GET_LDERRNO( ld, NULL, NULL ) == LDAP_TIMEOUT ) { - (void) ldap_abandon( ld, msgid ); - LDAP_SET_LDERRNO( ld, LDAP_TIMEOUT, NULL, NULL ); - return( LDAP_TIMEOUT ); - } - - return( ldap_result2error( ld, *res, 0 )); -} - - -int -LDAP_CALL -ldap_url_search_s( LDAP *ld, const char *url, int attrsonly, LDAPMessage **res ) -{ - int msgid; - - if (( msgid = ldap_url_search( ld, url, attrsonly )) == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - if ( ldap_result( ld, msgid, 1, (struct timeval *)NULL, res ) == -1 ) { - return( LDAP_GET_LDERRNO( ld, NULL, NULL ) ); - } - - return( ldap_result2error( ld, *res, 0 )); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/utf8.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/utf8.c deleted file mode 100644 index 2515debe7c1..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/utf8.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * 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): - */ - -/* uft8.c - misc. utf8 "string" functions. */ -#include "ldap-int.h" - -static char UTF8len[64] -= {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 6}; - -int -LDAP_CALL -ldap_utf8len (const char* s) - /* Return the number of char's in the character at *s. */ -{ - return ldap_utf8next((char*)s) - s; -} - -char* -LDAP_CALL -ldap_utf8next (char* s) - /* Return a pointer to the character immediately following *s. - Handle any valid UTF-8 character, including '\0' and ASCII. - Try to handle a misaligned pointer or a malformed character. - */ -{ - register unsigned char* next = (unsigned char*)s; - switch (UTF8len [(*next >> 2) & 0x3F]) { - case 0: /* erroneous: s points to the middle of a character. */ - case 6: if ((*++next & 0xC0) != 0x80) break; - case 5: if ((*++next & 0xC0) != 0x80) break; - case 4: if ((*++next & 0xC0) != 0x80) break; - case 3: if ((*++next & 0xC0) != 0x80) break; - case 2: if ((*++next & 0xC0) != 0x80) break; - case 1: ++next; - } - return (char*) next; -} - -char* -LDAP_CALL -ldap_utf8prev (char* s) - /* Return a pointer to the character immediately preceding *s. - Handle any valid UTF-8 character, including '\0' and ASCII. - Try to handle a misaligned pointer or a malformed character. - */ -{ - register unsigned char* prev = (unsigned char*)s; - unsigned char* limit = prev - 6; - while (((*--prev & 0xC0) == 0x80) && (prev != limit)) { - ; - } - return (char*) prev; -} - -int -LDAP_CALL -ldap_utf8copy (char* dst, const char* src) - /* Copy a character from src to dst; return the number of char's copied. - Handle any valid UTF-8 character, including '\0' and ASCII. - Try to handle a misaligned pointer or a malformed character. - */ -{ - register const unsigned char* s = (const unsigned char*)src; - switch (UTF8len [(*s >> 2) & 0x3F]) { - case 0: /* erroneous: s points to the middle of a character. */ - case 6: *dst++ = *s++; if ((*s & 0xC0) != 0x80) break; - case 5: *dst++ = *s++; if ((*s & 0xC0) != 0x80) break; - case 4: *dst++ = *s++; if ((*s & 0xC0) != 0x80) break; - case 3: *dst++ = *s++; if ((*s & 0xC0) != 0x80) break; - case 2: *dst++ = *s++; if ((*s & 0xC0) != 0x80) break; - case 1: *dst = *s++; - } - return s - (const unsigned char*)src; -} - -size_t -LDAP_CALL -ldap_utf8characters (const char* src) - /* Return the number of UTF-8 characters in the 0-terminated array s. */ -{ - register char* s = (char*)src; - size_t n; - for (n = 0; *s; LDAP_UTF8INC(s)) ++n; - return n; -} - -unsigned long LDAP_CALL -ldap_utf8getcc( const char** src ) -{ - register unsigned long c; - register const unsigned char* s = (const unsigned char*)*src; - switch (UTF8len [(*s >> 2) & 0x3F]) { - case 0: /* erroneous: s points to the middle of a character. */ - c = (*s++) & 0x3F; goto more5; - case 1: c = (*s++); break; - case 2: c = (*s++) & 0x1F; goto more1; - case 3: c = (*s++) & 0x0F; goto more2; - case 4: c = (*s++) & 0x07; goto more3; - case 5: c = (*s++) & 0x03; goto more4; - case 6: c = (*s++) & 0x01; goto more5; - more5: if ((*s & 0xC0) != 0x80) break; c = (c << 6) | ((*s++) & 0x3F); - more4: if ((*s & 0xC0) != 0x80) break; c = (c << 6) | ((*s++) & 0x3F); - more3: if ((*s & 0xC0) != 0x80) break; c = (c << 6) | ((*s++) & 0x3F); - more2: if ((*s & 0xC0) != 0x80) break; c = (c << 6) | ((*s++) & 0x3F); - more1: if ((*s & 0xC0) != 0x80) break; c = (c << 6) | ((*s++) & 0x3F); - break; - } - *src = (const char*)s; - return c; -} - -char* -LDAP_CALL -ldap_utf8strtok_r( char* sp, const char* brk, char** next) -{ - const char *bp; - unsigned long sc, bc; - char *tok; - - if (sp == NULL && (sp = *next) == NULL) - return NULL; - - /* Skip leading delimiters; roughly, sp += strspn(sp, brk) */ - cont: - sc = LDAP_UTF8GETC(sp); - for (bp = brk; (bc = LDAP_UTF8GETCC(bp)) != 0;) { - if (sc == bc) - goto cont; - } - - if (sc == 0) { /* no non-delimiter characters */ - *next = NULL; - return NULL; - } - tok = LDAP_UTF8PREV(sp); - - /* Scan token; roughly, sp += strcspn(sp, brk) - * Note that brk must be 0-terminated; we stop if we see that, too. - */ - while (1) { - sc = LDAP_UTF8GETC(sp); - bp = brk; - do { - if ((bc = LDAP_UTF8GETCC(bp)) == sc) { - if (sc == 0) { - *next = NULL; - } else { - *next = sp; - *(LDAP_UTF8PREV(sp)) = 0; - } - return tok; - } - } while (bc != 0); - } - /* NOTREACHED */ -} - -int -LDAP_CALL -ldap_utf8isalnum( char* s ) -{ - register unsigned char c = *(unsigned char*)s; - if (0x80 & c) return 0; - if (c >= 'A' && c <= 'Z') return 1; - if (c >= 'a' && c <= 'z') return 1; - if (c >= '0' && c <= '9') return 1; - return 0; -} - -int -LDAP_CALL -ldap_utf8isalpha( char* s ) -{ - register unsigned char c = *(unsigned char*)s; - if (0x80 & c) return 0; - if (c >= 'A' && c <= 'Z') return 1; - if (c >= 'a' && c <= 'z') return 1; - return 0; -} - -int -LDAP_CALL -ldap_utf8isdigit( char* s ) -{ - register unsigned char c = *(unsigned char*)s; - if (0x80 & c) return 0; - if (c >= '0' && c <= '9') return 1; - return 0; -} - -int -LDAP_CALL -ldap_utf8isxdigit( char* s ) -{ - register unsigned char c = *(unsigned char*)s; - if (0x80 & c) return 0; - if (c >= '0' && c <= '9') return 1; - if (c >= 'A' && c <= 'F') return 1; - if (c >= 'a' && c <= 'f') return 1; - return 0; -} - -int -LDAP_CALL -ldap_utf8isspace( char* s ) -{ - register unsigned char *c = (unsigned char*)s; - int len = ldap_utf8len(s); - - if (len == 0) { - return 0; - } else if (len == 1) { - switch (*c) { - case 0x09: - case 0x0A: - case 0x0B: - case 0x0C: - case 0x0D: - case 0x20: - return 1; - default: - return 0; - } - } else if (len == 2) { - if (*c == 0xc2) { - return *(c+1) == 0x80; - } - } else if (len == 3) { - if (*c == 0xE2) { - c++; - if (*c == 0x80) { - c++; - return (*c>=0x80 && *c<=0x8a); - } - } else if (*c == 0xE3) { - return (*(c+1)==0x80) && (*(c+2)==0x80); - } else if (*c==0xEF) { - return (*(c+1)==0xBB) && (*(c+2)==0xBF); - } - return 0; - } - - /* should never reach here */ - return 0; -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap/vlistctrl.c b/mozilla/directory/c-sdk/ldap/libraries/libldap/vlistctrl.c deleted file mode 100644 index 1ef2d6c7c92..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap/vlistctrl.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * 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): - */ - -/* vlistctrl.c - virtual list control implementation. */ -#include "ldap-int.h" - - - -/* - * function to create a VirtualListViewRequest control that can be passed - * to ldap_search_ext() or ldap_search_ext_s(). *ctrlp will be set to a - * freshly allocated LDAPControl structure. Returns an LDAP error code - * (LDAP_SUCCESS if all goes well). - * - * Parameters - * ld LDAP pointer to the desired connection - * - * ldvlistp the control structure. - * - * ctrlp the address of a place to put the constructed control - - The controlValue is an OCTET STRING - whose value is the BER-encoding of the following SEQUENCE: - - VirtualListViewRequest ::= SEQUENCE { - beforeCount INTEGER (0 .. maxInt), - afterCount INTEGER (0 .. maxInt), - CHOICE { - byIndex [0] SEQUENCE { - index INTEGER (0 .. maxInt), - contentCount INTEGER (0 .. maxInt) } - byValue [1] greaterThanOrEqual assertionValue } - - beforeCount indicates how many entries before the target entry the - client wants the server to send. afterCount indicates the number of - entries after the target entry the client wants the server to send. - index and contentCount identify the target entry - greaterThanOrEqual is an attribute assertion value defined in - [LDAPv3]. If present, the value supplied in greaterThanOrEqual is used - to determine the target entry by comparison with the values of the - attribute specified as the primary sort key. The first list entry who's - value is no less than the supplied value is the target entry. - - */ - -int -LDAP_CALL -ldap_create_virtuallist_control( - LDAP *ld, - LDAPVirtualList *ldvlistp, - LDAPControl **ctrlp -) -{ - BerElement *ber; - int rc; - - if (!NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - - if ( NULL == ctrlp || NULL == ldvlistp ) { - LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return ( LDAP_PARAM_ERROR ); - } - - /* create a ber package to hold the controlValue */ - if ( LDAP_SUCCESS != nsldapi_alloc_ber_with_options( ld, &ber ) ) - { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( LDAP_NO_MEMORY ); - } - - if ( LBER_ERROR == ber_printf( ber, - "{ii", - (int)ldvlistp->ldvlist_before_count, - (int)ldvlistp->ldvlist_after_count )) - /* XXX lossy casts */ - { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - - if (NULL == ldvlistp->ldvlist_attrvalue) - { - if ( LBER_ERROR == ber_printf( ber, - "t{ii}}", - LDAP_TAG_VLV_BY_INDEX, - (int)ldvlistp->ldvlist_index, - (int)ldvlistp->ldvlist_size ) ) - /* XXX lossy casts */ - { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - } - else - { - if ( LBER_ERROR == ber_printf( ber, - "to}", - LDAP_TAG_VLV_BY_VALUE, - ldvlistp->ldvlist_attrvalue, - (int)strlen( ldvlistp->ldvlist_attrvalue )) ) { - LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_ENCODING_ERROR ); - } - } - - - rc = nsldapi_build_control( LDAP_CONTROL_VLVREQUEST , - ber, - 1, - 1, - ctrlp ); - - LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); - return( rc ); - -} - - -/* - * function to find and parse a VirtualListViewResponse control contained in - * "ctrls" *target_posp, *list_sizep, and *errcodep are set based on its - * contents. Returns an LDAP error code that indicates whether the parsing - * itself was successful (LDAP_SUCCESS if all goes well). - - The controlValue is an OCTET STRING, whose value - is the BER encoding of a value of the following SEQUENCE: - - VirtualListViewResponse ::= SEQUENCE { - targetPosition INTEGER (0 .. maxInt), - contentCount INTEGER (0 .. maxInt), - virtualListViewResult ENUMERATED { - success (0), - operatonsError (1), - unwillingToPerform (53), - insufficientAccessRights (50), - busy (51), - timeLimitExceeded (3), - adminLimitExceeded (11), - sortControlMissing (60), - indexRangeError (61), - other (80) } } - - */ -int -LDAP_CALL -ldap_parse_virtuallist_control -( - LDAP *ld, - LDAPControl **ctrls, - unsigned long *target_posp, - unsigned long *list_sizep, - int *errcodep -) -{ - BerElement *ber; - int i, foundListControl, errcode; - LDAPControl *listCtrlp; - unsigned long target_pos, list_size; - - if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) { - return( LDAP_PARAM_ERROR ); - } - - /* only ldapv3 or higher can do virtual lists. */ - if ( NSLDAPI_LDAP_VERSION( ld ) < LDAP_VERSION3 ) { - LDAP_SET_LDERRNO( ld, LDAP_NOT_SUPPORTED, NULL, NULL ); - return( LDAP_NOT_SUPPORTED ); - } - - /* find the listControl in the list of controls if it exists */ - if ( ctrls == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_CONTROL_NOT_FOUND, NULL, NULL ); - return ( LDAP_CONTROL_NOT_FOUND ); - } - - foundListControl = 0; - for ( i = 0; (( ctrls[i] != NULL ) && ( !foundListControl )); i++ ) { - foundListControl = !strcmp( ctrls[i]->ldctl_oid, - LDAP_CONTROL_VLVRESPONSE ); - } - if ( !foundListControl ) { - LDAP_SET_LDERRNO( ld, LDAP_CONTROL_NOT_FOUND, NULL, NULL ); - return ( LDAP_CONTROL_NOT_FOUND ); - } else { - /* let local var point to the listControl */ - listCtrlp = ctrls[i-1]; - } - - /* allocate a Ber element with the contents of the list_control's struct berval */ - if ( ( ber = ber_init( &listCtrlp->ldctl_value ) ) == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( LDAP_NO_MEMORY ); - } - - /* decode the result from the Berelement */ - if ( LBER_ERROR == ber_scanf( ber, "{iie}", &target_pos, &list_size, - &errcode ) ) { - LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL ); - ber_free( ber, 1 ); - return( LDAP_DECODING_ERROR ); - } - - if ( target_posp != NULL ) { - *target_posp = target_pos; - } - if ( list_sizep != NULL ) { - *list_sizep = list_size; - } - if ( errcodep != NULL ) { - *errcodep = errcode; - } - - /* the ber encoding is no longer needed */ - ber_free(ber,1); - - return(LDAP_SUCCESS); - -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldap_ssl.ex b/mozilla/directory/c-sdk/ldap/libraries/libldap_ssl.ex deleted file mode 100644 index 7553972938b..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldap_ssl.ex +++ /dev/null @@ -1,12 +0,0 @@ -450 ldapssl_client_init -451 ldapssl_init -452 ldapssl_install_routines -453 ldapssl_clientauth_init -454 ldapssl_enable_clientauth -456 ldapssl_advclientauth_init -457 ldapssl_pkcs_init -458 ldapssl_err2string -# the last Windows ordinal number that has been reserved for SSL is 469. - -# Windows ordinals 1100-1150 are reserved for privately/non-published -# exported routines diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldif/Makefile b/mozilla/directory/c-sdk/ldap/libraries/libldif/Makefile deleted file mode 100755 index 18cb8989deb..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldif/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# GNU Makefile for libldif -# - -LDAP_SRC = ../.. -MCOM_ROOT = ../../../.. - -NOSTDCLEAN=true # don't let nsconfig.mk define target clean -NOSTDSTRIP=true # don't let nsconfig.mk define target strip -NSPR20=true # probably should be defined somewhere else (not sure where) - -OBJDEST = $(OBJDIR)/lib/libldif -LIBDIR = $(LDAP_LIBDIR) - -include $(MCOM_ROOT)/c-sdk/nsdefs.mk -include $(MCOM_ROOT)/c-sdk/nsconfig.mk -include $(LDAP_SRC)/nsldap.mk - -CFLAGS += $(SLCFLAGS) - -LIBLDIF_OBJS= line64.o - -OBJS = $(addprefix $(OBJDEST)/, $(LIBLDIF_OBJS)) - -LIBLDIF= $(addprefix $(LIBDIR)/, libldif.$(LIB_SUFFIX)) - -clientSDK: all - -all: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLDIF) - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBLDIF): $(OBJS) - $(LINK_LIB) - -veryclean: clean - -clean: - $(RM) $(OBJS) - $(RM) $(LIBLDIF) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldif/Makefile.client b/mozilla/directory/c-sdk/ldap/libraries/libldif/Makefile.client deleted file mode 100644 index a06e33d87a8..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldif/Makefile.client +++ /dev/null @@ -1,95 +0,0 @@ -# -# 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 = ../../../../.. -NS_DEPTH = ../../../.. -LDAP_SRC = ../.. -NSCP_DISTDIR = ../../../../../dist -NSPR_TREE = ../../.. -MOD_DEPTH = ../../.. - -include $(NSPR_TREE)/config/rules.mk -include ../../../build.mk - -SRCS = line64.c - -ifeq ($(OS_ARCH), WINNT) -REALOBJS = $(SRCS:.c=.obj) -else -REALOBJS = $(SRCS:.c=.o) -endif - -LDIFOBJDEST = $(OBJDIR_NAME) -OBJS = $(addprefix $(LDIFOBJDEST)/, $(REALOBJS)) - -HDIR = $(LDAP_SRC)/include - -ifeq ($(OS_ARCH), WINNT) -LIBLDIF = $(addprefix $(LDIFOBJDEST)/, $(LDIF_LIBNAME).$(LIB_SUFFIX)) -else -LIBLDIF = $(addprefix $(LDIFOBJDEST)/, lib$(LDIF_LIBNAME).$(LIB_SUFFIX)) -endif - -INSTALLDIR = $(DEPTH)/dist/$(OBJDIR_NAME) - -LOCAL_INCLUDES = -I$(PUBLIC)/nspr -INCLUDES += -I$(HDIR) -I$(INSTALLDIR)/include -I../../../../../dist/include -DEFINES += $(DEFS) - -PLATFORMCFLAGS = -DUSE_WAITPID -DNEEDPROTOS -PLATFORMLIBS = -THREADS = -THREADSLIB = - -########################################################################### - -versiont.c: Makefile.client Version.c - @$(RM) $@ - @(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \ - h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \ - -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ - -e "s|%VERSION%|$${v}|" \ - < Version.c > $@) - -all:: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLDIF) - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBLDIF): $(OBJS) $(LIBDIR) - @echo ======= making $(LIBLDIF) -ifdef SO_FILES_TO_REMOVE - -$(RM) $(SO_FILES_TO_REMOVE) -endif - $(LINK_LIB) - -veryclean:: clean - -clean:: - $(RM) $(OBJS) $(LIBLDIF) - $(RM) -r $(LDIFOBJDEST) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - -install:: $(LIBLDIF) - $(INSTALL) -m 444 $(LIBLDIF) $(INSTALLDIR)/lib diff --git a/mozilla/directory/c-sdk/ldap/libraries/libldif/line64.c b/mozilla/directory/c-sdk/ldap/libraries/libldif/line64.c deleted file mode 100755 index dd4e4c5481e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libldif/line64.c +++ /dev/null @@ -1,597 +0,0 @@ -/* - * 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): - */ - -/* line64.c - routines for dealing with the slapd line format */ - -#include -#include -#include -#include -#ifndef macintosh -#include -#endif -#ifdef _WIN32 -#include -#elif !defined( macintosh ) -#include -#endif -#include "ldaplog.h" -#include "ldif.h" - -#ifndef isascii -#define isascii( c ) (!((c) & ~0177)) -#endif - -#define RIGHT2 0x03 -#define RIGHT4 0x0f -#define CONTINUED_LINE_MARKER '\001' - -#define ISBLANK(c) (c == ' ' || c == '\t' || c == '\n') /* not "\r\v\f" */ - -#define LDIF_OPT_ISSET( value, opt ) (((value) & (opt)) != 0 ) - -static char nib2b64[0x40f] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -static unsigned char b642nib[0x80] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, - 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, - 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, - 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, - 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, - 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, - 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff -}; - -static int ldif_base64_encode_internal( unsigned char *src, char *dst, int srclen, - int lenused, int wraplen ); - -/* - * ldif_parse_line - takes a line of the form "type:[:] value" and splits it - * into components "type" and "value". if a double colon separates type from - * value, then value is encoded in base 64, and parse_line un-decodes it - * (in place) before returning. - */ - -int -ldif_parse_line( - char *line, - char **type, - char **value, - int *vlen -) -{ - char *p, *s, *d; - int b64; - - /* skip any leading space */ - while ( ISBLANK( *line ) ) { - line++; - } - *type = line; - - for ( s = line; *s && *s != ':'; s++ ) - ; /* NULL */ - if ( *s == '\0' ) { - - /* Comment-out while we address calling libldif from ns-back-ldbm - on NT. 1 of 3 */ -#if defined( _WIN32 ) - /* -#endif - LDAPDebug( LDAP_DEBUG_PARSE, "ldif_parse_line: missing ':' " - "on line \"%s\"\n", line, 0, 0 ); -#if defined( _WIN32 ) - */ -#endif - return( -1 ); - } - - /* trim any space between type and : */ - for ( p = s - 1; p > line && ISBLANK( *p ); p-- ) { - *p = '\0'; - } - *s++ = '\0'; - - /* check for double : - indicates base 64 encoded value */ - if ( *s == ':' ) { - s++; - b64 = 1; - - /* single : - normally encoded value */ - } else { - b64 = 0; - } - - /* skip space between : and value */ - while ( ISBLANK( *s ) ) { - s++; - } - - /* - * If no value is present, return a zero-length string for - * *value, with *vlen set to zero. - */ - if ( *s == '\0' ) { - *value = s; - *vlen = 0; - return( 0 ); - } - - /* check for continued line markers that should be deleted */ - for ( p = s, d = s; *p; p++ ) { - if ( *p != CONTINUED_LINE_MARKER ) - *d++ = *p; - } - *d = '\0'; - - *value = s; - if ( b64 ) { - if (( *vlen = ldif_base64_decode( s, (unsigned char *)s )) - < 0 ) { - /* Comment-out while we address calling libldif from ns-back-ldbm - on NT. 3 of 3 */ -#if defined( _WIN32 ) - /* -#endif - LDAPDebug( LDAP_DEBUG_ANY, - "ldif_parse_line: invalid base 64 char on line \"%s\"\n", - line, 0, 0 ); -#if defined( _WIN32 ) - */ -#endif - return( -1 ); - } - s[ *vlen ] = '\0'; - } else { - *vlen = (int) (d - s); - } - - return( 0 ); -} - - -/* - * ldif_base64_decode - take the BASE64-encoded characters in "src" - * (a zero-terminated string) and decode them into the the buffer "dst". - * "src" and "dst" can be the same if in-place decoding is desired. - * "dst" must be large enough to hold the decoded octets. No more than - * 3 * strlen( src ) / 4 bytes will be produced. - * "dst" may contain zero octets anywhere within it, but it is not - * zero-terminated by this function. - * - * The number of bytes copied to "dst" is returned if all goes well. - * -1 is returned if the BASE64 encoding in "src" is invalid. - */ - -int -ldif_base64_decode( char *src, unsigned char *dst ) -{ - char *p, *stop; - unsigned char nib, *byte; - int i, len; - - stop = strchr( src, '\0' ); - byte = dst; - for ( p = src, len = 0; p < stop; p += 4, len += 3 ) { - for ( i = 0; i < 4; i++ ) { - if ( p[i] != '=' && (p[i] & 0x80 || - b642nib[ p[i] & 0x7f ] > 0x3f) ) { - return( -1 ); - } - } - - /* first digit */ - nib = b642nib[ p[0] & 0x7f ]; - byte[0] = nib << 2; - - /* second digit */ - nib = b642nib[ p[1] & 0x7f ]; - byte[0] |= nib >> 4; - - /* third digit */ - if ( p[2] == '=' ) { - len += 1; - break; - } - byte[1] = (nib & RIGHT4) << 4; - nib = b642nib[ p[2] & 0x7f ]; - byte[1] |= nib >> 2; - - /* fourth digit */ - if ( p[3] == '=' ) { - len += 2; - break; - } - byte[2] = (nib & RIGHT2) << 6; - nib = b642nib[ p[3] & 0x7f ]; - byte[2] |= nib; - - byte += 3; - } - - return( len ); -} - -/* - * ldif_getline - return the next "line" (minus newline) of input from a - * string buffer of lines separated by newlines, terminated by \n\n - * or \0. this routine handles continued lines, bundling them into - * a single big line before returning. if a line begins with a white - * space character, it is a continuation of the previous line. the white - * space character (nb: only one char), and preceeding newline are changed - * into CONTINUED_LINE_MARKER chars, to be deleted later by the - * ldif_parse_line() routine above. - * - * it takes a pointer to a pointer to the buffer on the first call, - * which it updates and must be supplied on subsequent calls. - * - * XXX need to update this function to also support as EOL. - * XXX supports as of 07/29/1998 (richm) - */ - -char * -ldif_getline( char **next ) -{ - char *l; - char c; - char *p; - - if ( *next == NULL || **next == '\n' || **next == '\0' ) { - return( NULL ); - } - - while ( **next == '#' ) { /* skip comment lines */ - if (( *next = strchr( *next, '\n' )) == NULL ) { - return( NULL ); - } - (*next)++; - } - - l = *next; - while ( (*next = strchr( *next, '\n' )) != NULL ) { - p = *next - 1; /* pointer to character previous to the newline */ - c = *(*next + 1); /* character after the newline */ - if ( ISBLANK( c ) && c != '\n' ) { - /* DOS EOL is \r\n, so if the character before */ - /* the \n is \r, continue it too */ - if (*p == '\r') - *p = CONTINUED_LINE_MARKER; - **next = CONTINUED_LINE_MARKER; - *(*next+1) = CONTINUED_LINE_MARKER; - } else { - /* DOS EOL is \r\n, so if the character before */ - /* the \n is \r, null it too */ - if (*p == '\r') - *p = '\0'; - *(*next)++ = '\0'; - break; - } - (*next)++; - } - - return( l ); -} - - -#define LDIF_SAFE_CHAR( c ) ( (c) != '\r' && (c) != '\n' ) -#define LDIF_CONSERVATIVE_CHAR( c ) ( LDIF_SAFE_CHAR(c) && isascii((c)) \ - && ( isprint((c)) || (c) == '\t' )) -#define LDIF_SAFE_INITCHAR( c ) ( LDIF_SAFE_CHAR(c) && (c) != ':' \ - && (c) != ' ' && (c) != '<' ) -#define LDIF_CONSERVATIVE_INITCHAR( c ) ( LDIF_SAFE_INITCHAR( c ) && \ - ! ( isascii((c)) && isspace((c)))) -#define LDIF_CONSERVATIVE_FINALCHAR( c ) ( (c) != ' ' ) - - -void -ldif_put_type_and_value_with_options( char **out, char *t, char *val, - int vlen, unsigned long options ) -{ - unsigned char *p, *byte, *stop; - char *save; - int b64, len, savelen, wraplen; - len = 0; - - if ( LDIF_OPT_ISSET( options, LDIF_OPT_NOWRAP )) { - wraplen = -1; - } else { - wraplen = LDIF_MAX_LINE_WIDTH; - } - - /* put the type + ": " */ - for ( p = (unsigned char *) t; *p; p++, len++ ) { - *(*out)++ = *p; - } - *(*out)++ = ':'; - len++; - if ( LDIF_OPT_ISSET( options, LDIF_OPT_VALUE_IS_URL )) { - *(*out)++ = '<'; /* add '<' for URLs */ - len++; - } - save = *out; - savelen = len; - b64 = 0; - - stop = (unsigned char *)val; - if ( val && vlen > 0 ) { - *(*out)++ = ' '; - stop = (unsigned char *) (val + vlen); - if ( LDIF_OPT_ISSET( options, LDIF_OPT_MINIMAL_ENCODING )) { - if ( !LDIF_SAFE_INITCHAR( val[0] )) { - b64 = 1; - } - } else { - if ( !LDIF_CONSERVATIVE_INITCHAR( val[0] ) || - !LDIF_CONSERVATIVE_FINALCHAR( val[vlen-1] )) { - b64 = 1; - } - } - } - - if ( !b64 ) { - for ( byte = (unsigned char *) val; byte < stop; - byte++, len++ ) { - if ( LDIF_OPT_ISSET( options, - LDIF_OPT_MINIMAL_ENCODING )) { - if ( !LDIF_SAFE_CHAR( *byte )) { - b64 = 1; - break; - } - } else if ( !LDIF_CONSERVATIVE_CHAR( *byte )) { - b64 = 1; - break; - } - - if ( wraplen != -1 && len > wraplen ) { - *(*out)++ = '\n'; - *(*out)++ = ' '; - len = 1; - } - *(*out)++ = *byte; - } - } - - if ( b64 ) { - *out = save; - *(*out)++ = ':'; - *(*out)++ = ' '; - len = ldif_base64_encode_internal( (unsigned char *)val, *out, vlen, - savelen + 2, wraplen ); - *out += len; - } - - *(*out)++ = '\n'; -} - -void -ldif_put_type_and_value( char **out, char *t, char *val, int vlen ) -{ - ldif_put_type_and_value_with_options( out, t, val, vlen, 0 ); -} - -void -ldif_put_type_and_value_nowrap( char **out, char *t, char *val, int vlen ) -{ - ldif_put_type_and_value_with_options( out, t, val, vlen, LDIF_OPT_NOWRAP ); -} - -/* - * ldif_base64_encode_internal - encode "srclen" bytes in "src", place BASE64 - * encoded bytes in "dst" and return the length of the BASE64 - * encoded string. "dst" is also zero-terminated by this function. - * - * If "lenused" >= 0, newlines will be included in "dst" and "lenused" if - * appropriate. "lenused" should be a count of characters already used - * on the current line. The LDIF lines we create will contain at most - * "wraplen" characters on each line, unless "wraplen" is -1, in which - * case output line length is unlimited. - * - * If "lenused" < 0, no newlines will be included, and the LDIF_BASE64_LEN() - * macro can be used to determine how many bytes will be placed in "dst." - */ - -static int -ldif_base64_encode_internal( unsigned char *src, char *dst, int srclen, int lenused, int wraplen ) -{ - unsigned char *byte, *stop; - unsigned char buf[3]; - char *out; - unsigned long bits; - int i, pad, len; - - len = 0; - out = dst; - stop = src + srclen; - - /* convert to base 64 (3 bytes => 4 base 64 digits) */ - for ( byte = src; byte < stop - 2; byte += 3 ) { - bits = (byte[0] & 0xff) << 16; - bits |= (byte[1] & 0xff) << 8; - bits |= (byte[2] & 0xff); - - for ( i = 0; i < 4; i++, bits <<= 6 ) { - if ( wraplen != -1 && lenused >= 0 && lenused++ > wraplen ) { - *out++ = '\n'; - *out++ = ' '; - lenused = 2; - } - - /* get b64 digit from high order 6 bits */ - *out++ = nib2b64[ (bits & 0xfc0000L) >> 18 ]; - } - } - - /* add padding if necessary */ - if ( byte < stop ) { - for ( i = 0; byte + i < stop; i++ ) { - buf[i] = byte[i]; - } - for ( pad = 0; i < 3; i++, pad++ ) { - buf[i] = '\0'; - } - byte = buf; - bits = (byte[0] & 0xff) << 16; - bits |= (byte[1] & 0xff) << 8; - bits |= (byte[2] & 0xff); - - for ( i = 0; i < 4; i++, bits <<= 6 ) { - if ( wraplen != -1 && lenused >= 0 && lenused++ > wraplen ) { - *out++ = '\n'; - *out++ = ' '; - lenused = 2; - } - - if (( i == 3 && pad > 0 ) || ( i == 2 && pad == 2 )) { - /* Pad as appropriate */ - *out++ = '='; - } else { - /* get b64 digit from low order 6 bits */ - *out++ = nib2b64[ (bits & 0xfc0000L) >> 18 ]; - } - } - } - - *out = '\0'; - - return( out - dst ); -} - -int -ldif_base64_encode( unsigned char *src, char *dst, int srclen, int lenused ) -{ - return ldif_base64_encode_internal( src, dst, srclen, lenused, LDIF_MAX_LINE_WIDTH ); -} - -int -ldif_base64_encode_nowrap( unsigned char *src, char *dst, int srclen, int lenused ) -{ - return ldif_base64_encode_internal( src, dst, srclen, lenused, -1 ); -} - - -/* - * return malloc'd, zero-terminated LDIF line - */ -char * -ldif_type_and_value_with_options( char *type, char *val, int vlen, - unsigned long options ) -{ - char *buf, *p; - int tlen; - - tlen = strlen( type ); - if (( buf = (char *)malloc( LDIF_SIZE_NEEDED( tlen, vlen ) + 1 )) != - NULL ) { - p = buf; - ldif_put_type_and_value_with_options( &p, type, val, vlen, options ); - *p = '\0'; - } - - return( buf ); -} - -char * -ldif_type_and_value( char *type, char *val, int vlen ) -{ - return ldif_type_and_value_with_options( type, val, vlen, 0 ); -} - -char * -ldif_type_and_value_nowrap( char *type, char *val, int vlen ) -{ - return ldif_type_and_value_with_options( type, val, vlen, LDIF_OPT_NOWRAP ); -} - -/* - * ldif_get_entry - read the next ldif entry from the FILE referenced - * by fp. return a pointer to a malloc'd, null-terminated buffer. also - * returned is the last line number read, in *lineno. - */ -char * -ldif_get_entry( FILE *fp, int *lineno ) -{ - char line[BUFSIZ]; - char *buf; - int max, cur, len, gotsome; - - buf = NULL; - max = cur = gotsome = 0; - while ( fgets( line, sizeof(line), fp ) != NULL ) { - if ( lineno != NULL ) { - (*lineno)++; - } - /* ldif entries are terminated by a \n on a line by itself */ - if ( line[0] == '\0' || line[0] == '\n' -#if !defined( XP_WIN32 ) - || ( line[0] == '\r' && line[1] == '\n' ) /* DOS format */ -#endif - ) { - if ( gotsome ) { - break; - } else { - continue; - } - } else if ( line[0] == '#' ) { - continue; - } - gotsome = 1; - len = strlen( line ); -#if !defined( XP_WIN32 ) - /* DOS format */ - if ( len > 0 && line[len-1] == '\r' ) { - --len; - line[len] = '\0'; - } else if ( len > 1 && line[len-2] == '\r' && line[len-1] == '\n' ) { - --len; - line[len-1] = line[len]; - line[len] = '\0'; - } -#endif - while ( cur + (len + 1) > max ) { - if ( buf == NULL ) { - max += BUFSIZ; - buf = (char *) malloc( max ); - } else { - max *= 2; - buf = (char *) realloc( buf, max ); - } - if ( buf == NULL ) { - return( NULL ); - } - } - - memcpy( buf + cur, line, len + 1 ); - cur += len; - } - - return( buf ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c b/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c deleted file mode 100644 index bf118dc373c..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * 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): - */ - -/* - * Utilities for manageing the relationship between NSPR errors and - * OS (errno-style) errors. - * - * The overall strategy used is to map NSPR errors into OS errors. - */ - -#include "ldappr-int.h" - - -void -prldap_set_system_errno( int oserrno ) -{ - PR_SetError( PR_UNKNOWN_ERROR, oserrno ); -} - - -int -prldap_get_system_errno( void ) -{ - return( PR_GetOSError()); -} - -/* - * Retrieve the NSPR error number, convert to a system error code, and return - * the result. - */ -struct prldap_errormap_entry { - PRInt32 erm_nspr; /* NSPR error code */ - int erm_system; /* corresponding system error code */ -}; - -/* XXX: not sure if this extra mapping for Windows is good or correct */ -#ifdef _WINDOWS -#ifndef ENOTSUP -#define ENOTSUP -1 -#endif -#ifndef ETIMEDOUT -#define ETIMEDOUT WSAETIMEDOUT -#endif -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL WSAEADDRNOTAVAIL -#endif -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#endif -#ifndef EISCONN -#define EISCONN WSAEISCONN -#endif -#ifndef EADDRINUSE -#define EADDRINUSE WSAEADDRINUSE -#endif -#ifndef ECONNREFUSED -#define ECONNREFUSED WSAECONNREFUSED -#endif -#ifndef EHOSTUNREACH -#define EHOSTUNREACH WSAEHOSTUNREACH -#endif -#ifndef ENOTCONN -#define ENOTCONN WSAENOTCONN -#endif -#ifndef ENOTSOCK -#define ENOTSOCK WSAENOTSOCK -#endif -#ifndef EPROTOTYPE -#define EPROTOTYPE WSAEPROTOTYPE -#endif -#ifndef EOPNOTSUPP -#define EOPNOTSUPP WSAEOPNOTSUPP -#endif -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT WSAEPROTONOSUPPORT -#endif -#ifndef EOVERFLOW -#define EOVERFLOW -1 -#endif -#ifndef ECONNRESET -#define ECONNRESET WSAECONNRESET -#endif -#ifndef ELOOP -#define ELOOP WSAELOOP -#endif -#ifndef ENOTBLK -#define ENOTBLK -1 -#endif -#ifndef ETXTBSY -#define ETXTBSY -1 -#endif -#ifndef ENETDOWN -#define ENETDOWN WSAENETDOWN -#endif -#ifndef ESHUTDOWN -#define ESHUTDOWN WSAESHUTDOWN -#endif -#ifndef ECONNABORTED -#define ECONNABORTED WSAECONNABORTED -#endif -#endif /* _WINDOWS */ - -/* XXX: need to verify that the -1 entries are correct (no mapping) */ -static struct prldap_errormap_entry prldap_errormap[] = { - { PR_OUT_OF_MEMORY_ERROR, ENOMEM }, - { PR_BAD_DESCRIPTOR_ERROR, EBADF }, - { PR_WOULD_BLOCK_ERROR, EAGAIN }, - { PR_ACCESS_FAULT_ERROR, EFAULT }, - { PR_INVALID_METHOD_ERROR, EINVAL }, /* XXX: correct mapping ? */ - { PR_ILLEGAL_ACCESS_ERROR, EACCES }, /* XXX: correct mapping ? */ - { PR_UNKNOWN_ERROR, -1 }, - { PR_PENDING_INTERRUPT_ERROR, -1 }, - { PR_NOT_IMPLEMENTED_ERROR, ENOTSUP }, - { PR_IO_ERROR, EIO }, - { PR_IO_TIMEOUT_ERROR, ETIMEDOUT }, /* XXX: correct mapping ? */ - { PR_IO_PENDING_ERROR, -1 }, - { PR_DIRECTORY_OPEN_ERROR, ENOTDIR }, - { PR_INVALID_ARGUMENT_ERROR, EINVAL }, - { PR_ADDRESS_NOT_AVAILABLE_ERROR, EADDRNOTAVAIL }, - { PR_ADDRESS_NOT_SUPPORTED_ERROR, EAFNOSUPPORT }, - { PR_IS_CONNECTED_ERROR, EISCONN }, - { PR_BAD_ADDRESS_ERROR, EFAULT }, /* XXX: correct mapping ? */ - { PR_ADDRESS_IN_USE_ERROR, EADDRINUSE }, - { PR_CONNECT_REFUSED_ERROR, ECONNREFUSED }, - { PR_NETWORK_UNREACHABLE_ERROR, EHOSTUNREACH }, - { PR_CONNECT_TIMEOUT_ERROR, ETIMEDOUT }, - { PR_NOT_CONNECTED_ERROR, ENOTCONN }, - { PR_LOAD_LIBRARY_ERROR, -1 }, - { PR_UNLOAD_LIBRARY_ERROR, -1 }, - { PR_FIND_SYMBOL_ERROR, -1 }, - { PR_INSUFFICIENT_RESOURCES_ERROR, -1 }, - { PR_DIRECTORY_LOOKUP_ERROR, EHOSTUNREACH },/* an approximation */ - { PR_TPD_RANGE_ERROR, -1 }, - { PR_PROC_DESC_TABLE_FULL_ERROR, -1 }, - { PR_SYS_DESC_TABLE_FULL_ERROR, -1 }, - { PR_NOT_SOCKET_ERROR, ENOTSOCK }, - { PR_NOT_TCP_SOCKET_ERROR, EPROTOTYPE }, - { PR_SOCKET_ADDRESS_IS_BOUND_ERROR, -1 }, - { PR_NO_ACCESS_RIGHTS_ERROR, EACCES }, /* XXX: correct mapping ? */ - { PR_OPERATION_NOT_SUPPORTED_ERROR, EOPNOTSUPP }, - { PR_PROTOCOL_NOT_SUPPORTED_ERROR, EPROTONOSUPPORT }, - { PR_REMOTE_FILE_ERROR, -1 }, -#if defined(OSF1) - { PR_BUFFER_OVERFLOW_ERROR, -1 }, -#else - { PR_BUFFER_OVERFLOW_ERROR, EOVERFLOW }, -#endif /* OSF1 */ - { PR_CONNECT_RESET_ERROR, ECONNRESET }, - { PR_RANGE_ERROR, ERANGE }, - { PR_DEADLOCK_ERROR, EDEADLK }, -#if defined(HPUX11) || defined(AIX4_3) || defined(OSF1) - { PR_FILE_IS_LOCKED_ERROR, -1 }, /* XXX: correct mapping ? */ -#else - { PR_FILE_IS_LOCKED_ERROR, EDEADLOCK }, /* XXX: correct mapping ? */ -#endif /* HPUX11 */ - { PR_FILE_TOO_BIG_ERROR, EFBIG }, - { PR_NO_DEVICE_SPACE_ERROR, ENOSPC }, - { PR_PIPE_ERROR, EPIPE }, - { PR_NO_SEEK_DEVICE_ERROR, ESPIPE }, - { PR_IS_DIRECTORY_ERROR, EISDIR }, - { PR_LOOP_ERROR, ELOOP }, - { PR_NAME_TOO_LONG_ERROR, ENAMETOOLONG }, - { PR_FILE_NOT_FOUND_ERROR, ENOENT }, - { PR_NOT_DIRECTORY_ERROR, ENOTDIR }, - { PR_READ_ONLY_FILESYSTEM_ERROR, EROFS }, - { PR_DIRECTORY_NOT_EMPTY_ERROR, ENOTEMPTY }, - { PR_FILESYSTEM_MOUNTED_ERROR, EBUSY }, - { PR_NOT_SAME_DEVICE_ERROR, EXDEV }, - { PR_DIRECTORY_CORRUPTED_ERROR, -1 }, - { PR_FILE_EXISTS_ERROR, EEXIST }, - { PR_MAX_DIRECTORY_ENTRIES_ERROR, -1 }, - { PR_INVALID_DEVICE_STATE_ERROR, ENOTBLK }, /* XXX: correct mapping ? */ - { PR_DEVICE_IS_LOCKED_ERROR, -2 }, - { PR_NO_MORE_FILES_ERROR, ENFILE }, - { PR_END_OF_FILE_ERROR, -1 }, - { PR_FILE_SEEK_ERROR, ESPIPE }, /* XXX: correct mapping ? */ - { PR_FILE_IS_BUSY_ERROR, ETXTBSY }, - { PR_OPERATION_ABORTED_ERROR, -1 }, - { PR_IN_PROGRESS_ERROR, -1 }, - { PR_ALREADY_INITIATED_ERROR, -1 }, - { PR_GROUP_EMPTY_ERROR, -1 }, - { PR_INVALID_STATE_ERROR, -1 }, - { PR_NETWORK_DOWN_ERROR, ENETDOWN }, - { PR_SOCKET_SHUTDOWN_ERROR, ESHUTDOWN }, - { PR_CONNECT_ABORTED_ERROR, ECONNABORTED }, - { PR_HOST_UNREACHABLE_ERROR, EHOSTUNREACH }, - { PR_MAX_ERROR, -1 }, -}; - - -int -prldap_prerr2errno( void ) -{ - int oserr, i; - PRInt32 nsprerr; - - nsprerr = PR_GetError(); - - oserr = -1; /* unknown */ - for ( i = 0; prldap_errormap[i].erm_nspr != PR_MAX_ERROR; ++i ) { - if ( prldap_errormap[i].erm_nspr == nsprerr ) { - oserr = prldap_errormap[i].erm_system; - break; - } - } - - return( oserr ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-int.h b/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-int.h deleted file mode 100644 index 6e546a776d6..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-int.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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): - */ - -/* - * Internal header for libprldap -- glue NSPR (Netscape Portable Runtime) - * to libldap. - * - */ - -#include -#include -#include - -#include -#include - -/* - * Macros: - */ - -/* #define PRLDAP_DEBUG 1 */ /* uncomment to enable debugging printfs */ - -/* - * All of the sockets we use are IPv6 capable. - * Change the following #define to PR_AF_INET to support IPv4 only. - */ -#define PRLDAP_DEFAULT_ADDRESS_FAMILY PR_AF_INET6 - - -/* - * Data structures: - */ - -/* data structure that populates the I/O callback session arg. */ -typedef struct lextiof_session_private { - PRPollDesc *prsess_pollds; /* for poll callback */ - int prsess_pollds_count; /* # of elements in pollds */ - void *prsess_appdata; /* application specific data */ -} PRLDAPIOSessionArg; - -/* data structure that populates the I/O callback socket-specific arg. */ -typedef struct lextiof_socket_private { - PRFileDesc *prsock_prfd; /* associated NSPR file desc. */ - void *prsock_appdata; /* application specific data */ -} PRLDAPIOSocketArg; - - -/* - * Function prototypes: - */ - -/* - * From ldapprio.c: - */ -int prldap_install_io_functions( LDAP *ld, int shared ); -int prldap_session_arg_from_ld( LDAP *ld, PRLDAPIOSessionArg **sessargpp ); - - -/* - * From ldapprthreads.c: - */ -int prldap_install_thread_functions( LDAP *ld, int shared ); -int prldap_thread_new_handle( LDAP *ld, void *sessionarg ); -void prldap_thread_dispose_handle( LDAP *ld, void *sessionarg ); - - -/* - * From ldapprdns.c: - */ -int prldap_install_dns_functions( LDAP *ld ); - - -/* - * From ldapprerror.c: - */ -void prldap_set_system_errno( int e ); -int prldap_get_system_errno( void ); -int prldap_prerr2errno( void ); diff --git a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-io.c b/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-io.c deleted file mode 100644 index 9697ebe4127..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-io.c +++ /dev/null @@ -1,566 +0,0 @@ -/* - * 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): - */ - -/* - * Extended I/O callback functions for libldap that use - * NSPR (Netscape Portable Runtime) I/O. - * - * High level strategy: we use the socket-specific arg to hold our own data - * structure that includes the NSPR file handle (PRFileDesc *), among other - * useful information. We use the default argument to hold an LDAP session - * handle specific data structure. - */ - -#include "ldappr-int.h" - -#define PRLDAP_POLL_ARRAY_GROWTH 5 /* grow arrays 5 elements at a time */ - -/* - * Local function prototypes: - */ -static PRIntervalTime prldap_timeout2it( int ms_timeout ); -static int LDAP_CALLBACK prldap_read( int s, void *buf, int bufsize, - struct lextiof_socket_private *socketarg ); -static int LDAP_CALLBACK prldap_write( int s, const void *buf, int len, - struct lextiof_socket_private *socketarg ); -static int LDAP_CALLBACK prldap_poll( LDAP_X_PollFD fds[], int nfds, - int timeout, struct lextiof_session_private *sessionarg ); -static int LDAP_CALLBACK prldap_connect( const char *hostlist, int defport, - int timeout, unsigned long options, - struct lextiof_session_private *sessionarg, - struct lextiof_socket_private **socketargp ); -static int LDAP_CALLBACK prldap_close( int s, - struct lextiof_socket_private *socketarg ); -static int LDAP_CALLBACK prldap_newhandle( LDAP *ld, - struct lextiof_session_private *sessionarg ); -static void LDAP_CALLBACK prldap_disposehandle( LDAP *ld, - struct lextiof_session_private *sessionarg ); -static int LDAP_CALLBACK prldap_shared_newhandle( LDAP *ld, - struct lextiof_session_private *sessionarg ); -static void LDAP_CALLBACK prldap_shared_disposehandle( LDAP *ld, - struct lextiof_session_private *sessionarg ); -static PRLDAPIOSessionArg *prldap_session_arg_alloc( void ); -static void prldap_session_arg_free( PRLDAPIOSessionArg **prsesspp ); -static PRLDAPIOSocketArg *prldap_socket_arg_alloc( void ); -static void prldap_socket_arg_free( PRLDAPIOSocketArg **prsockpp ); -static void *prldap_safe_realloc( void *ptr, PRUint32 size ); - - - -/* - * Local macros: - */ -/* given a socket-specific arg, return the corresponding PRFileDesc * */ -#define PRLDAP_GET_PRFD( socketarg ) \ - (((PRLDAPIOSocketArg *)(socketarg))->prsock_prfd) - - -/* - * Install NSPR I/O functions into ld (if ld is NULL, they are installed - * as the default functions for new LDAP * handles). - * - * Returns 0 if all goes well and -1 if not. - */ -int -prldap_install_io_functions( LDAP *ld, int shared ) -{ - struct ldap_x_ext_io_fns iofns; - - memset( &iofns, 0, sizeof(iofns)); - iofns.lextiof_size = LDAP_X_EXTIO_FNS_SIZE; - iofns.lextiof_read = prldap_read; - iofns.lextiof_write = prldap_write; - iofns.lextiof_poll = prldap_poll; - iofns.lextiof_connect = prldap_connect; - iofns.lextiof_close = prldap_close; - if ( shared ) { - iofns.lextiof_newhandle = prldap_shared_newhandle; - iofns.lextiof_disposehandle = prldap_shared_disposehandle; - } else { - iofns.lextiof_newhandle = prldap_newhandle; - iofns.lextiof_disposehandle = prldap_disposehandle; - } - if ( NULL != ld ) { - /* - * If we are dealing with a real ld, we allocate the session specific - * data structure now. If not allocated here, it will be allocated - * inside prldap_newhandle() or prldap_shared_newhandle(). - */ - if ( NULL == - ( iofns.lextiof_session_arg = prldap_session_arg_alloc())) { - ldap_set_lderrno( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - } else { - iofns.lextiof_session_arg = NULL; - } - - if ( ldap_set_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, &iofns ) != 0 ) { - prldap_session_arg_free( - (PRLDAPIOSessionArg **) &iofns.lextiof_session_arg ); - return( -1 ); - } - - return( 0 ); -} - - -static PRIntervalTime -prldap_timeout2it( int ms_timeout ) -{ - PRIntervalTime prit; - - if ( LDAP_X_IO_TIMEOUT_NO_WAIT == ms_timeout ) { - prit = PR_INTERVAL_NO_WAIT; - } else if ( LDAP_X_IO_TIMEOUT_NO_TIMEOUT == ms_timeout ) { - prit = PR_INTERVAL_NO_TIMEOUT; - } else { - prit = PR_MillisecondsToInterval( ms_timeout ); - } - - return( prit ); -} - - -static int LDAP_CALLBACK -prldap_read( int s, void *buf, int bufsize, - struct lextiof_socket_private *socketarg ) -{ - return( PR_Read( PRLDAP_GET_PRFD(socketarg), buf, bufsize )); -} - - -static int LDAP_CALLBACK -prldap_write( int s, const void *buf, int len, - struct lextiof_socket_private *socketarg ) -{ - return( PR_Write( PRLDAP_GET_PRFD(socketarg), buf, len )); -} - - -struct prldap_eventmap_entry { - PRInt16 evm_nspr; /* corresponding NSPR PR_Poll() event */ - int evm_ldap; /* LDAP poll event */ -}; - -static struct prldap_eventmap_entry prldap_eventmap[] = { - { PR_POLL_READ, LDAP_X_POLLIN }, - { PR_POLL_EXCEPT, LDAP_X_POLLPRI }, - { PR_POLL_WRITE, LDAP_X_POLLOUT }, - { PR_POLL_ERR, LDAP_X_POLLERR }, - { PR_POLL_HUP, LDAP_X_POLLHUP }, - { PR_POLL_NVAL, LDAP_X_POLLNVAL }, -}; - -#define PRLDAP_EVENTMAP_ENTRIES \ - sizeof(prldap_eventmap)/sizeof(struct prldap_eventmap_entry ) - -static int LDAP_CALLBACK -prldap_poll( LDAP_X_PollFD fds[], int nfds, int timeout, - struct lextiof_session_private *sessionarg ) -{ - PRLDAPIOSessionArg *prsessp = sessionarg; - PRPollDesc *pds; - int i, j, rc; - - if ( NULL == prsessp ) { - prldap_set_system_errno( EINVAL ); - return( -1 ); - } - - /* allocate or resize NSPR poll descriptor array */ - if ( prsessp->prsess_pollds_count < nfds ) { - pds = prldap_safe_realloc( prsessp->prsess_pollds, - ( nfds + PRLDAP_POLL_ARRAY_GROWTH ) - * sizeof( PRPollDesc )); - if ( NULL == pds ) { - prldap_set_system_errno( prldap_prerr2errno()); - return( -1 ); - } - prsessp->prsess_pollds = pds; - prsessp->prsess_pollds_count = nfds + PRLDAP_POLL_ARRAY_GROWTH; - } else { - pds = prsessp->prsess_pollds; - } - - /* populate NSPR poll info. based on LDAP info. */ - for ( i = 0; i < nfds; ++i ) { - if ( NULL == fds[i].lpoll_socketarg ) { - pds[i].fd = NULL; - } else { - pds[i].fd = PRLDAP_GET_PRFD( fds[i].lpoll_socketarg ); - } - pds[i].in_flags = pds[i].out_flags = 0; - if ( fds[i].lpoll_fd >= 0 ) { - for ( j = 0; j < PRLDAP_EVENTMAP_ENTRIES; ++j ) { - if (( fds[i].lpoll_events & prldap_eventmap[j].evm_ldap ) - != 0 ) { - pds[i].in_flags |= prldap_eventmap[j].evm_nspr; - } - } - } - fds[i].lpoll_revents = 0; /* clear revents */ - } - - /* call PR_Poll() to do the real work */ - rc = PR_Poll( pds, nfds, prldap_timeout2it( timeout )); - - /* populate LDAP info. based on NSPR results */ - for ( i = 0; i < nfds; ++i ) { - if ( pds[i].fd != NULL ) { - for ( j = 0; j < PRLDAP_EVENTMAP_ENTRIES; ++j ) { - if (( pds[i].out_flags & prldap_eventmap[j].evm_nspr ) - != 0 ) { - fds[i].lpoll_revents |= prldap_eventmap[j].evm_ldap; - } - } - } - } - - return( rc ); -} - - -/* - * Utility function to try one TCP connect() - * Returns 1 if successful and -1 if not. Sets the NSPR fd inside prsockp. - */ -static int -prldap_try_one_address( struct lextiof_socket_private *prsockp, - PRNetAddr *addrp, int port, int timeout, unsigned long options ) -{ - /* - * Set up address and open a TCP socket: - */ - if ( PR_SUCCESS != PR_SetNetAddr( PR_IpAddrNull, /* don't touch IP addr. */ - PRLDAP_DEFAULT_ADDRESS_FAMILY, (PRUint16)port, addrp )) { - return( -1 ); - } - - if (( prsockp->prsock_prfd = PR_OpenTCPSocket( - PRLDAP_DEFAULT_ADDRESS_FAMILY )) == NULL ) { - return( -1 ); - } - - /* - * Set nonblocking option if requested: - */ - if ( 0 != ( options & LDAP_X_EXTIOF_OPT_NONBLOCKING )) { - PRSocketOptionData optdata; - - optdata.option = PR_SockOpt_Nonblocking; - optdata.value.non_blocking = PR_TRUE; - if ( PR_SetSocketOption( prsockp->prsock_prfd, &optdata ) - != PR_SUCCESS ) { - prldap_set_system_errno( prldap_prerr2errno()); - PR_Close( prsockp->prsock_prfd ); - return( -1 ); - } - } - -#ifdef PRLDAP_DEBUG - { - char buf[ 256 ], *p, *fmtstr; - - if ( PR_SUCCESS != PR_NetAddrToString( addrp, buf, sizeof(buf ))) { - strcpy( buf, "conversion failed!" ); - } - if ( strncmp( buf, "::ffff:", 7 ) == 0 ) { - /* IPv4 address mapped into IPv6 address space */ - p = buf + 7; - fmtstr = "prldap_try_one_address(): Trying %s:%d...\n"; - } else { - p = buf; - fmtstr = "prldap_try_one_address(): Trying [%s]:%d...\n"; - } - fprintf( stderr, fmtstr, p, PR_ntohs( addrp->ipv6.port )); - } -#endif /* PRLDAP_DEBUG */ - - /* - * Try to open the TCP connection itself: - */ - if ( PR_SUCCESS != PR_Connect( prsockp->prsock_prfd, addrp, - prldap_timeout2it( timeout ))) { - PR_Close( prsockp->prsock_prfd ); - prsockp->prsock_prfd = NULL; - return( -1 ); - } - -#ifdef PRLDAP_DEBUG - fputs( "prldap_try_one_address(): Connected.\n", stderr ); -#endif /* PRLDAP_DEBUG */ - - /* - * Success. Return a valid file descriptor (1 is always valid) - */ - return( 1 ); -} - - -/* - * XXXmcs: At present, this code ignores the timeout when doing DNS lookups. - */ -static int LDAP_CALLBACK -prldap_connect( const char *hostlist, int defport, int timeout, - unsigned long options, struct lextiof_session_private *sessionarg, - struct lextiof_socket_private **socketargp ) -{ - int rc, parse_err, port; - char *host, hbuf[ PR_NETDB_BUF_SIZE ]; - struct ldap_x_hostlist_status *status; - struct lextiof_socket_private *prsockp; - PRNetAddr addr; - PRHostEnt hent; - - if ( 0 != ( options & LDAP_X_EXTIOF_OPT_SECURE )) { - prldap_set_system_errno( EINVAL ); - return( -1 ); - } - - if ( NULL == ( prsockp = prldap_socket_arg_alloc())) { - prldap_set_system_errno( prldap_prerr2errno()); - return( -1 ); - } - - rc = -1; /* pessimistic */ - for ( parse_err = ldap_x_hostlist_first( hostlist, defport, &host, &port, - &status ); - rc < 0 && LDAP_SUCCESS == parse_err && NULL != host; - parse_err = ldap_x_hostlist_next( &host, &port, status )) { - - if ( PR_SUCCESS == PR_StringToNetAddr( host, &addr )) { - - if ( PRLDAP_DEFAULT_ADDRESS_FAMILY == PR_AF_INET6 && - PR_AF_INET == PR_NetAddrFamily( &addr )) { - PRUint32 ipv4ip = addr.inet.ip; - memset( &addr, 0, sizeof(addr)); - PR_ConvertIPv4AddrToIPv6( ipv4ip, &addr.ipv6.ip ); - addr.ipv6.family = PR_AF_INET6; - - } - rc = prldap_try_one_address( prsockp, &addr, port, - timeout, options ); - } else { - if ( PR_SUCCESS == PR_GetIPNodeByName( host, - PRLDAP_DEFAULT_ADDRESS_FAMILY, PR_AI_DEFAULT | PR_AI_ALL, hbuf, - sizeof( hbuf ), &hent )) { - PRIntn enumIndex = 0; - - while ( rc < 0 && ( enumIndex = PR_EnumerateHostEnt( - enumIndex, &hent, (PRUint16)port, &addr )) > 0 ) { - rc = prldap_try_one_address( prsockp, &addr, port, - timeout, options ); - } - } - } - - ldap_memfree( host ); - } - - ldap_x_hostlist_statusfree( status ); - - if ( rc < 0 ) { - prldap_set_system_errno( prldap_prerr2errno()); - prldap_socket_arg_free( &prsockp ); - } else { - *socketargp = prsockp; - } - - return( rc ); -} - - -static int LDAP_CALLBACK -prldap_close( int s, struct lextiof_socket_private *socketarg ) -{ - int rc; - - rc = 0; - if ( PR_Close( PRLDAP_GET_PRFD(socketarg)) != PR_SUCCESS ) { - rc = -1; - prldap_set_system_errno( prldap_prerr2errno()); - } - prldap_socket_arg_free( &socketarg ); - - return( rc ); -} - - -/* - * LDAP session handle creation callback. - * - * Allocate a session argument if not already done, and then call the - * thread's new handle function. - */ -static int LDAP_CALLBACK -prldap_newhandle( LDAP *ld, struct lextiof_session_private *sessionarg ) -{ - - if ( NULL == sessionarg ) { - struct ldap_x_ext_io_fns iofns; - - memset( &iofns, 0, sizeof(iofns)); - iofns.lextiof_size = LDAP_X_EXTIO_FNS_SIZE; - if ( ldap_get_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, - (void *)&iofns ) < 0 ) { - return( ldap_get_lderrno( ld, NULL, NULL )); - } - if ( NULL == - ( iofns.lextiof_session_arg = prldap_session_arg_alloc())) { - return( LDAP_NO_MEMORY ); - } - if ( ldap_set_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, - (void *)&iofns ) < 0 ) { - return( ldap_get_lderrno( ld, NULL, NULL )); - } - } - - return( LDAP_SUCCESS ); -} - - -/* only called/installed if shared is non-zero. */ -static int LDAP_CALLBACK -prldap_shared_newhandle( LDAP *ld, struct lextiof_session_private *sessionarg ) -{ - int rc; - - if (( rc = prldap_newhandle( ld, sessionarg )) == LDAP_SUCCESS ) { - rc = prldap_thread_new_handle( ld, sessionarg ); - } - - return( rc ); -} - - -static void LDAP_CALLBACK -prldap_disposehandle( LDAP *ld, struct lextiof_session_private *sessionarg ) -{ - prldap_session_arg_free( &sessionarg ); -} - - -/* only called/installed if shared is non-zero */ -static void LDAP_CALLBACK -prldap_shared_disposehandle( LDAP *ld, - struct lextiof_session_private *sessionarg ) -{ - prldap_thread_dispose_handle( ld, sessionarg ); - prldap_disposehandle( ld, sessionarg ); -} - - -/* - * Allocate a session argument. - */ -static PRLDAPIOSessionArg * -prldap_session_arg_alloc( void ) -{ - PRLDAPIOSessionArg *prsessp; - - prsessp = PR_Calloc( 1, sizeof( PRLDAPIOSessionArg )); - return( prsessp ); -} - - -static void -prldap_session_arg_free( PRLDAPIOSessionArg **prsesspp ) -{ - if ( NULL != prsesspp && NULL != *prsesspp ) { - if ( NULL != (*prsesspp)->prsess_pollds ) { - PR_Free( (*prsesspp)->prsess_pollds ); - (*prsesspp)->prsess_pollds = NULL; - } - PR_Free( *prsesspp ); - *prsesspp = NULL; - } -} - - -/* - * Given an LDAP session handle, retrieve a session argument. - * Returns an LDAP error code. - */ -int -prldap_session_arg_from_ld( LDAP *ld, PRLDAPIOSessionArg **sessargpp ) -{ - struct ldap_x_ext_io_fns iofns; - - if ( NULL == ld || NULL == sessargpp ) { - /* XXXmcs: NULL ld's are not supported */ - ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - - memset( &iofns, 0, sizeof(iofns)); - iofns.lextiof_size = LDAP_X_EXTIO_FNS_SIZE; - if ( ldap_get_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, (void *)&iofns ) < 0 ) { - return( ldap_get_lderrno( ld, NULL, NULL )); - } - - if ( NULL == iofns.lextiof_session_arg ) { - ldap_set_lderrno( ld, LDAP_LOCAL_ERROR, NULL, NULL ); - return( LDAP_LOCAL_ERROR ); - } - - *sessargpp = iofns.lextiof_session_arg; - return( LDAP_SUCCESS ); -} - - -/* - * Allocate a socket argument. - */ -static PRLDAPIOSocketArg * -prldap_socket_arg_alloc( void ) -{ - PRLDAPIOSocketArg *prsockp; - - prsockp = PR_Calloc( 1, sizeof( PRLDAPIOSocketArg )); - return( prsockp ); -} - - -static void -prldap_socket_arg_free( PRLDAPIOSocketArg **prsockpp ) -{ - if ( NULL != prsockpp && NULL != *prsockpp ) { - PR_Free( *prsockpp ); - *prsockpp = NULL; - } -} - - -static void * -prldap_safe_realloc( void *ptr, PRUint32 size ) -{ - void *p; - - if ( NULL == ptr ) { - p = PR_Malloc( size ); - } else { - p = PR_Realloc( ptr, size ); - } - - return( p ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-public.c b/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-public.c deleted file mode 100644 index 34b47946868..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-public.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * 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): - */ - -/* - * Public interface for libprldap -- use NSPR (Netscape Portable Runtime) - * I/O, threads, etc. with libldap. - * - */ - -#include "ldappr-int.h" - - -/* - * Function: prldap_init(). - * - * Create a new LDAP session handle, but with NSPR I/O, threading, and DNS - * functions installed. - * - * Pass a non-zero value for the 'shared' parameter if you plan to use - * this LDAP * handle from more than one thread. - * - * prldap_init() returns an LDAP session handle (or NULL if an error occurs). - */ -LDAP * LDAP_CALL -prldap_init( const char *defhost, int defport, int shared ) -{ - LDAP *ld; - - if (( ld = ldap_init( defhost, defport )) != NULL ) { - if ( prldap_install_routines( ld, shared ) != LDAP_SUCCESS ) { - prldap_set_system_errno( EINVAL ); /* XXXmcs: just a guess! */ - ldap_unbind( ld ); - ld = NULL; - } - } - - return( ld ); -} - - -/* - * Function: prldap_install_routines(). - * - * Install NSPR I/O, threading, and DNS functions so they will be used by - * 'ld'. - * - * If 'ld' is NULL, the functions are installed as the default functions - * for all new LDAP * handles). - * - * Pass a non-zero value for the 'shared' parameter if you plan to use - * this LDAP * handle from more than one thread. - * - * prldap_install_routines() returns an LDAP API error code (LDAP_SUCCESS - * if all goes well). - */ -int LDAP_CALL -prldap_install_routines( LDAP *ld, int shared ) -{ - - if ( prldap_install_io_functions( ld, shared ) != 0 - || prldap_install_thread_functions( ld, shared ) != 0 - || prldap_install_dns_functions( ld ) != 0 ) { - return( ldap_get_lderrno( ld, NULL, NULL )); - } - - return( LDAP_SUCCESS ); -} - - -/* - * Function: prldap_set_session_info(). - * - * Given an LDAP session handle, set some application-specific data. - * - * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). - */ -int LDAP_CALL -prldap_set_session_info( LDAP *ld, void *sessionarg, PRLDAPSessionInfo *seip ) -{ - int rc; - PRLDAPIOSessionArg *prsessp; - - if ( seip == NULL || PRLDAP_SESSIONINFO_SIZE != seip->seinfo_size ) { - ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - - if ( NULL != ld ) { - if ( LDAP_SUCCESS != - ( rc = prldap_session_arg_from_ld( ld, &prsessp ))) { - return( rc ); - } - } else if ( NULL != sessionarg ) { - prsessp = (PRLDAPIOSessionArg *)sessionarg; - } else { - ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - - prsessp->prsess_appdata = seip->seinfo_appdata; - return( LDAP_SUCCESS ); -} - - -/* - * Function: prldap_get_session_info(). - * - * Given an LDAP session handle, retrieve some application-specific data. - * - * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in - * which case the fields in the structure that seip points to are filled in). - */ -int LDAP_CALL -prldap_get_session_info( LDAP *ld, void *sessionarg, PRLDAPSessionInfo *seip ) -{ - int rc; - PRLDAPIOSessionArg *prsessp; - - if ( seip == NULL || PRLDAP_SESSIONINFO_SIZE != seip->seinfo_size ) { - ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - - if ( NULL != ld ) { - if ( LDAP_SUCCESS != - ( rc = prldap_session_arg_from_ld( ld, &prsessp ))) { - return( rc ); - } - } else if ( NULL != sessionarg ) { - prsessp = (PRLDAPIOSessionArg *)sessionarg; - } else { - ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( LDAP_PARAM_ERROR ); - } - - seip->seinfo_appdata = prsessp->prsess_appdata; - return( LDAP_SUCCESS ); -} - - -/* - * Function: prldap_set_socket_info(). - * - * Given an integer fd and a void * argument such as those passed to the - * extended I/O callback functions, set socket specific information. - * - * Returns an LDAP API error code (LDAP_SUCCESS if all goes well). - * - * Note: it is only safe to change soinfo_prfd from within the SOCKET - * extended I/O callback function. - */ -int LDAP_CALL -prldap_set_socket_info( int fd, void *socketarg, PRLDAPSocketInfo *soip ) -{ - PRLDAPIOSocketArg *prsockp; - - if ( NULL == socketarg || NULL == soip || - PRLDAP_SOCKETINFO_SIZE != soip->soinfo_size ) { - return( LDAP_PARAM_ERROR ); - } - - prsockp = (PRLDAPIOSocketArg *)socketarg; - prsockp->prsock_prfd = soip->soinfo_prfd; - prsockp->prsock_appdata = soip->soinfo_appdata; - - return( LDAP_SUCCESS ); -} - - -/* - * Function: prldap_get_socket_info(). - * - * Given an integer fd and a void * argument such as those passed to the - * extended I/O callback functions, retrieve socket specific information. - * - * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in - * which case the fields in the structure that soip points to are filled in). - */ -int LDAP_CALL -prldap_get_socket_info( int fd, void *socketarg, PRLDAPSocketInfo *soip ) -{ - PRLDAPIOSocketArg *prsockp; - - if ( NULL == socketarg || NULL == soip || - PRLDAP_SOCKETINFO_SIZE != soip->soinfo_size ) { - return( LDAP_PARAM_ERROR ); - } - - prsockp = (PRLDAPIOSocketArg *)socketarg; - soip->soinfo_prfd = prsockp->prsock_prfd; - soip->soinfo_appdata = prsockp->prsock_appdata; - - return( LDAP_SUCCESS ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-threads.c b/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-threads.c deleted file mode 100644 index 161112ede91..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-threads.c +++ /dev/null @@ -1,411 +0,0 @@ -/* - * 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): - */ - -/* - * Thread callback functions for libldap that use the NSPR (Netscape - * Portable Runtime) thread API. - * - */ - -#include "ldappr-int.h" - -/* - * Structures and types: - */ -/* - * Structure used by libldap thread callbacks to maintain error information. - */ -typedef struct prldap_errorinfo { - int plei_lderrno; - char *plei_matched; - char *plei_errmsg; -} PRLDAP_ErrorInfo; - - -/* - * Structure used by associate an NSPR thread-private-data index with an - * LDAP session handle. - */ -typedef struct prldap_tpd_map { - LDAP *prtm_ld; /* non-NULL if in use */ - PRUintn prtm_index; /* allocated by NSPR */ - struct prldap_tpd_map *prtm_next; -} PRLDAP_TPDMap; - - - -/* - * Static Variables: - */ -/* - * prldap_map_list points to all of the PRLDAP_TPDMap structures - * we have ever allocated. We recycle them as we open and close LDAP - * sessions. - */ -static PRLDAP_TPDMap *prldap_map_list = NULL; - - -/* - * The prldap_map_mutex is used to protect access to the prldap_map_list. - */ -static PRLock *prldap_map_mutex = NULL; - -/* - * The prldap_callonce_init_map_list structure is used by NSPR to ensure - * that prldap_init_map_list() is called at most once. - */ -static PRCallOnceType prldap_callonce_init_map_list = { 0, 0, 0 }; - - -/* - * Private function prototypes: - */ -static void prldap_set_ld_error( int err, char *matched, char *errmsg, - void *errorarg ); -static int prldap_get_ld_error( char **matchedp, char **errmsgp, - void *errorarg ); -static void *prldap_mutex_alloc( void ); -static void prldap_mutex_free( void *mutex ); -static int prldap_mutex_lock( void *mutex ); -static int prldap_mutex_unlock( void *mutex ); -static void *prldap_get_thread_id( void ); -static PRStatus prldap_init_map_list( void ); -static PRLDAP_TPDMap *prldap_allocate_map( LDAP *ld ); -static void prldap_return_map( PRLDAP_TPDMap *map ); - - -/* - * Install NSPR thread functions into ld (if ld is NULL, they are installed - * as the default functions for new LDAP * handles). - * - * Returns 0 if all goes well and -1 if not. - */ -int -prldap_install_thread_functions( LDAP *ld, int shared ) -{ - struct ldap_thread_fns tfns; - struct ldap_extra_thread_fns xtfns; - - if ( PR_CallOnce( &prldap_callonce_init_map_list, prldap_init_map_list ) - != PR_SUCCESS ) { - ldap_set_lderrno( ld, LDAP_LOCAL_ERROR, NULL, NULL ); - return( -1 ); - } - - /* set thread function pointers */ - memset( &tfns, '\0', sizeof(struct ldap_thread_fns) ); - tfns.ltf_get_errno = prldap_get_system_errno; - tfns.ltf_set_errno = prldap_set_system_errno; - if ( shared ) { - tfns.ltf_mutex_alloc = prldap_mutex_alloc; - tfns.ltf_mutex_free = prldap_mutex_free; - tfns.ltf_mutex_lock = prldap_mutex_lock; - tfns.ltf_mutex_unlock = prldap_mutex_unlock; - tfns.ltf_get_lderrno = prldap_get_ld_error; - tfns.ltf_set_lderrno = prldap_set_ld_error; - if ( ld != NULL ) { - /* - * If this is a real ld (i.e., we are not setting the global - * defaults) allocate thread private data for error information. - * If ld is NULL we do not do this here but it is done in - * prldap_thread_new_handle(). - */ - if (( tfns.ltf_lderrno_arg = (void *)prldap_allocate_map( ld )) - == NULL ) { - return( -1 ); - } - } - } - - if ( ldap_set_option( ld, LDAP_OPT_THREAD_FN_PTRS, - (void *)&tfns ) != 0 ) { - prldap_return_map( (PRLDAP_TPDMap *)tfns.ltf_lderrno_arg ); - return( -1 ); - } - - /* set extended thread function pointers */ - memset( &xtfns, '\0', sizeof(struct ldap_extra_thread_fns) ); - xtfns.ltf_threadid_fn = prldap_get_thread_id; - if ( ldap_set_option( ld, LDAP_OPT_EXTRA_THREAD_FN_PTRS, - (void *)&xtfns ) != 0 ) { - return( -1 ); - } - - return( 0 ); -} - - -static void * -prldap_mutex_alloc( void ) -{ - return( (void *)PR_NewLock()); -} - - -static void -prldap_mutex_free( void *mutex ) -{ - PR_DestroyLock( (PRLock *)mutex ); -} - - -static int -prldap_mutex_lock( void *mutex ) -{ - PR_Lock( (PRLock *)mutex ); - return( 0 ); -} - - -static int -prldap_mutex_unlock( void *mutex ) -{ - if ( PR_Unlock( (PRLock *)mutex ) == PR_FAILURE ) { - return( -1 ); - } - - return( 0 ); -} - - -static void * -prldap_get_thread_id( void ) -{ - return( (void *)PR_GetCurrentThread()); -} - - -static int -prldap_get_ld_error( char **matchedp, char **errmsgp, void *errorarg ) -{ - PRLDAP_TPDMap *map; - PRLDAP_ErrorInfo *eip; - - if (( map = (PRLDAP_TPDMap *)errorarg ) != NULL && ( eip = - (PRLDAP_ErrorInfo *)PR_GetThreadPrivate( - map->prtm_index )) != NULL ) { - if ( matchedp != NULL ) { - *matchedp = eip->plei_matched; - } - if ( errmsgp != NULL ) { - *errmsgp = eip->plei_errmsg; - } - return( eip->plei_lderrno ); - } else { - if ( matchedp != NULL ) { - *matchedp = NULL; - } - if ( errmsgp != NULL ) { - *errmsgp = NULL; - } - return( LDAP_LOCAL_ERROR ); /* punt */ - } -} - - -static void -prldap_set_ld_error( int err, char *matched, char *errmsg, void *errorarg ) -{ - PRLDAP_TPDMap *map; - PRLDAP_ErrorInfo *eip; - - if (( map = (PRLDAP_TPDMap *)errorarg ) != NULL ) { - if (( eip = (PRLDAP_ErrorInfo *)PR_GetThreadPrivate( - map->prtm_index )) == NULL ) { - /* - * error info. has not yet been allocated for this thread. - * do it now. Note that we free this memory only for the - * thread that calls prldap_thread_dispose_handle(), which - * should be the one that called ldap_unbind() -- see - * prldap_return_map(). Not freeing the memory used by - * other threads is deemed acceptable since it will be - * recycled and used by other LDAP sessions. - */ - eip = (PRLDAP_ErrorInfo *)PR_Calloc( 1, - sizeof( PRLDAP_ErrorInfo )); - if ( eip == NULL ) { - return; /* punt */ - } - (void)PR_SetThreadPrivate( map->prtm_index, eip ); - } - - eip->plei_lderrno = err; - if ( eip->plei_matched != NULL ) { - ldap_memfree( eip->plei_matched ); - } - eip->plei_matched = matched; - if ( eip->plei_errmsg != NULL ) { - ldap_memfree( eip->plei_errmsg ); - } - eip->plei_errmsg = errmsg; - } -} - - -/* - * Called when a new LDAP * session handle is allocated. - * Allocate thread-private data for error information, but only if - * it has not already been allocated and the get_ld_error callback has - * been installed. If ld is not NULL when prldap_install_thread_functions() - * is called, we will have already allocated the thread-private data there. - */ -int -prldap_thread_new_handle( LDAP *ld, void *sessionarg ) -{ - struct ldap_thread_fns tfns; - - if ( ldap_get_option( ld, LDAP_OPT_THREAD_FN_PTRS, (void *)&tfns ) != 0 ) { - return( LDAP_LOCAL_ERROR ); - } - - if ( tfns.ltf_lderrno_arg == NULL && tfns.ltf_get_lderrno != NULL ) { - if (( tfns.ltf_lderrno_arg = (void *)prldap_allocate_map( ld )) == NULL - || ldap_set_option( ld, LDAP_OPT_THREAD_FN_PTRS, - (void *)&tfns ) != 0 ) { - return( LDAP_LOCAL_ERROR ); - } - } - - return( LDAP_SUCCESS ); -} - - -/* - * Called when an LDAP * session handle is being destroyed. - * Clean up our thread private data map. - */ -void -prldap_thread_dispose_handle( LDAP *ld, void *sessionarg ) -{ - struct ldap_thread_fns tfns; - - if ( ldap_get_option( ld, LDAP_OPT_THREAD_FN_PTRS, - (void *)&tfns ) == 0 && - tfns.ltf_lderrno_arg != NULL ) { - prldap_return_map( (PRLDAP_TPDMap *)tfns.ltf_lderrno_arg ); - } -} - - -static PRStatus -prldap_init_map_list( void ) -{ - if (( prldap_map_mutex = PR_NewLock()) == NULL ) { - return( PR_FAILURE ); - } - - prldap_map_list = NULL; - - return( PR_SUCCESS ); -} - - -/* - * Function: prldap_allocate_map() - * Description: allocate a thread-private-data map to use for a new - * LDAP session handle. - * Returns: a pointer to the tsd map or NULL if none available. - */ -static PRLDAP_TPDMap * -prldap_allocate_map( LDAP *ld ) -{ - PRLDAP_TPDMap *map, *prevmap; - PRUintn tsdindex; - - PR_Lock( prldap_map_mutex ); - - /* - * first look for a map that is already allocated but free to be re-used - */ - prevmap = NULL; - for ( map = prldap_map_list; map != NULL; map = map->prtm_next ) { - if ( map->prtm_ld == NULL ) { - break; - } - prevmap = map; - } - - /* - * if none we found (map == NULL), try to allocate a new one and add it - * to the end of our global list. - */ - if ( map == NULL && PR_NewThreadPrivateIndex( &tsdindex, NULL ) - == PR_SUCCESS ) { - map = (PRLDAP_TPDMap *)PR_Malloc( sizeof( PRLDAP_TPDMap )); - if ( map != NULL ) { - map->prtm_index = tsdindex; - map->prtm_next = NULL; - if ( prevmap == NULL ) { - prldap_map_list = map; - } else { - prevmap->prtm_next = map; - } - } - } - - if ( map != NULL ) { - map->prtm_ld = ld; /* now marked as "in use" */ - /* since we are reusing...reset */ - /* to initial state */ - (void)PR_SetThreadPrivate( map->prtm_index, NULL ); - } - - PR_Unlock( prldap_map_mutex ); - - return( map ); -} - - -/* - * Function: prldap_return_map() - * Description: return a thread-private-data map to the pool of ones - * available for re-use. - */ -static void -prldap_return_map( PRLDAP_TPDMap *map ) -{ - PRLDAP_ErrorInfo *eip; - - PR_Lock( prldap_map_mutex ); - - /* - * Dispose of thread-private LDAP error information. Note that this - * only disposes of the memory consumed on THIS thread, but that is - * okay. See the comment in prldap_set_ld_error() for the reason why. - */ - if (( eip = (PRLDAP_ErrorInfo *)PR_GetThreadPrivate( map->prtm_index )) - != NULL ) { - if ( eip->plei_matched != NULL ) { - ldap_memfree( eip->plei_matched ); - } - if ( eip->plei_errmsg != NULL ) { - ldap_memfree( eip->plei_errmsg ); - } - - PR_Free( eip ); - } - - /* mark map as available for re-use */ - map->prtm_ld = NULL; - - PR_Unlock( prldap_map_mutex ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libprldap/libprldap.ex b/mozilla/directory/c-sdk/ldap/libraries/libprldap/libprldap.ex deleted file mode 100644 index fcb462ba308..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libprldap/libprldap.ex +++ /dev/null @@ -1,6 +0,0 @@ -2010 prldap_init -2011 prldap_install_routines -2012 prldap_set_session_info -2013 prldap_get_session_info -2014 prldap_set_socket_info -2015 prldap_get_socket_info diff --git a/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile b/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile deleted file mode 100644 index cd4ded2542c..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# GNU Makefile for libssldap -# - -LDAP_SRC = ../.. -MCOM_ROOT = ../../../.. - -NOSTDCLEAN=true # don't let nsconfig.mk define target clean -NOSTDSTRIP=true # don't let nsconfig.mk define target strip -NSPR20=true # probably should be defined somewhere else (not sure where) - -OBJDEST = $(OBJDIR)/lib/libssldap -LIBDIR = $(LDAP_LIBDIR) - -include $(MCOM_ROOT)/c-sdk/nsdefs.mk -include $(MCOM_ROOT)/c-sdk/nsconfig.mk -include $(LDAP_SRC)/nsldap.mk - -CFLAGS += $(SLCFLAGS) - -LIBSSLDAP_OBJS= clientinit.o ldapsinit.o errormap.o - -OBJS = $(addprefix $(OBJDEST)/, $(LIBSSLDAP_OBJS)) - -LIBSSLDAP= $(addprefix $(LIBDIR)/, $(LIBSSLDAP_LIB).$(LIB_SUFFIX)) - -clientSDK: all - -all: $(OBJDEST) $(LIBDIR) $(LIBSSLDAP) - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBSSLDAP): $(OBJS) - $(LINK_LIB) - -veryclean: clean - -clean: - $(RM) $(OBJS) - $(RM) $(LIBSSLDAP) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - diff --git a/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.client b/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.client deleted file mode 100644 index 685cae2cc23..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.client +++ /dev/null @@ -1,177 +0,0 @@ -# -# 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 = ../../../../.. -NS_DEPTH = ../../../.. -LDAP_SRC = ../.. -NSCP_DISTDIR = ../../../../../dist -NSPR_TREE = ../../.. -MOD_DEPTH = ../../.. - -include $(NSPR_TREE)/config/rules.mk -include ../../../build.mk - -SRCS = clientinit.c \ - ldapsinit.c \ - errormap.c - -ifeq ($(OS_ARCH), WINNT) -REALOBJS = $(SRCS:.c=.obj) -else -REALOBJS = $(SRCS:.c=.o) -endif - -SSLOBJDEST = $(OBJDIR_NAME) -OBJS = $(addprefix $(SSLOBJDEST)/, $(REALOBJS)) - -DISTHDIR = $(NSCP_DISTDIR)/public/ldap -HDIR = $(LDAP_SRC)/include - -ifeq ($(OS_ARCH), WINNT) -LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(SSLDAP_LIBNAME).$(DLL_SUFFIX)) -DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(SSLDAP_LIBNAME).$(LIB_SUFFIX)) -else -LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, \ - lib$(SSLDAP_LIBNAME).$(DLL_SUFFIX)) -endif - -INSTALLDIR = $(DEPTH)/dist/$(OBJDIR_NAME) - -LOCAL_INCLUDES = -I$(PUBLIC)/nspr -INCLUDES += -I$(DISTHDIR) -I$(HDIR) -I$(INSTALLDIR)/include \ - -I../../../../../dist/include \ - -I../../../../../dist/public/security \ - -I../../../../../dist/public/nss -DEFINES += $(DEFS) - -PLATFORMCFLAGS = -DUSE_WAITPID -DNEEDPROTOS -PLATFORMLIBS = -THREADS = -THREADSLIB = - -# -# shared library symbol export definitions -# -ifeq ($(USE_DLL_EXPORTS_FILE), 1) -ifeq ($(OS_ARCH), WINNT) -GENEXPORTS=cmd /c $(PERL) $(LDAP_SRC)/build/genexports.pl -else -GENEXPORTS=$(PERL) $(LDAP_SRC)/build/genexports.pl -endif - -# variable definitions for exported symbols -ifeq ($(OS_ARCH), WINNT) - SSLDAP_EXPORT_DEFS=../msdos/winsock/nsldapssl32.def -else - SSLDAP_EXPORT_DEFS= $(SSLOBJDEST)/libldap_ssl.exp -endif - -SSLDAP_EXPORT_FLAGS=$(addprefix $(DLLEXPORTS_PREFIX), $(SSLDAP_EXPORT_DEFS)) - -GENEXPARGS=$(BUILD_DEBUG) $(SSLDAPVERS_SUFFIX) $(SSLDAPVERS) -endif # USE_DLL_EXPORTS_FILE - -ifeq ($(OS_ARCH), SunOS) -EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LDAP_LIBNAME) \ - -L$(NSCP_DISTDIR)/lib -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/$(LDAP_LIBNAME).lib -EXTRA_LIBS += $(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib/$(PRLDAP_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/$(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$(NSCP_DISTDIR)/lib -EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib $(DYNAMICNSPR) -EXTRA_LIBS += -lcxx -lpthread -lrt -lmach -lexc -endif - -ifeq ($(OS_ARCH), AIX) -EXTRA_LIBS = -L$(NSCP_DISTDIR)/$(OBJDIR_NAME)/lib -l$(LDAP_LIBNAME) \ - -L$(NSCP_DISTDIR)/lib -EXTRA_LIBS += -L$(NSCP_DISTDIR)/lib $(DYNAMICNSPR) -l$(NSS_LIBNAME) -EXTRA_LIBS += -l$(SSL_LIBNAME) -l $(PRLDAP_LIBNAME) -EXTRA_LIBS += -ldl -brtl -lpthreads -lc_r -lm -endif - -OBJDEST = $(OBJDIR_NAME) - -########################################################################### - -ifeq ($(USE_DLL_EXPORTS_FILE), 1) -# recursive gmake rule to create exported symbols file -$(SSLDAP_EXPORT_DEFS):: ../libldap_ssl.ex -ifeq ($(OS_ARCH), WINNT) - $(GENEXPORTS) Win32 Standard $< $(GENEXPARGS) > $@ -else - $(GENEXPORTS) $(OS_ARCH) Standard $< $(GENEXPARGS) > $@ -endif -endif # USE_DLL_EXPORTS_FILE - -versiont.c: Makefile.client Version.c - @$(RM) $@ - @(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \ - h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \ - -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ - -e "s|%VERSION%|$${v}|" \ - < Version.c > $@) - -all:: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBSSLDAP) - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBSSLDAP): $(OBJS) $(LIBDIR) $(SSLDAP_EXPORT_DEFS) - @echo ======= making $(LIBSSLDAP) -ifdef SO_FILES_TO_REMOVE - -$(RM) $(SO_FILES_TO_REMOVE) -endif - $(LINK_DLL) $(DSO_LDOPTS) $(SSLDAP_EXPORT_FLAGS) $(EXTRA_LIBS) - -veryclean:: clean - -clean:: - $(RM) $(OBJS) $(LIBSSLDAP) - $(RM) -r $(SSLOBJDEST) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - -install:: $(LIBSSLDAP) -ifeq ($(OS_ARCH), WINNT) - $(INSTALL) -m 555 $(LIBSSLDAP) $(INSTALLDIR)/lib - $(INSTALL) -m 555 $(DLLSSLDAP) $(INSTALLDIR)/lib -endif -ifdef MKSHLIB - $(INSTALL) -m 555 $(LIBSSLDAP) $(INSTALLDIR)/lib -endif diff --git a/mozilla/directory/c-sdk/ldap/libraries/libssldap/clientinit.c b/mozilla/directory/c-sdk/ldap/libraries/libssldap/clientinit.c deleted file mode 100644 index 6960880e343..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libssldap/clientinit.c +++ /dev/null @@ -1,614 +0,0 @@ -/* - * 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): - */ - -/* - * clientinit.c - */ - -#if defined(NET_SSL) - - -#if defined( _WINDOWS ) -#include -#include "proto-ntutil.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* 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 */ - -#ifndef FILE_PATHSEP -#define FILE_PATHSEP '/' -#endif - - -static PRStatus local_SSLPLCY_Install(void); - -/* - * This little tricky guy keeps us from initializing twice - */ -static int inited = 0; -static int ssl_strength = LDAPSSL_AUTH_CERT; -static char tokDes[34] = "Internal (Software) Database "; -static char ptokDes[34] = "Internal (Software) Token "; - - -/* IN: */ -/* string: /u/mhein/.netscape/mykey3.db */ -/* OUT: */ -/* dir: /u/mhein/.netscape/ */ -/* prefix: my */ -/* key: key3.db */ - -static int -splitpath(char *string, char *dir, char *prefix, char *key) { - char *k; - char *s; - char *d = string; - char *l; - int len = 0; - - - if (string == NULL) - return (-1); - - /* goto the end of the string, and walk backwards until */ - /* you get to the first pathseparator */ - len = PL_strlen(string); - l = string + len - 1; - while (l != string && *l != '/' && *l != '\\') - l--; - /* search for the .db */ - if ((k = PL_strstr(l, ".db")) != NULL) { - /* now we are sitting on . of .db */ - - /* move backward to the first 'c' or 'k' */ - /* indicating cert or key */ - while (k != l && *k != 'c' && *k != 'k') - k--; - - /* move backwards to the first path separator */ - if (k != d && k > d) - s = k - 1; - while (s != d && *s != '/' && *s != '\\') - s--; - - /* if we are sitting on top of a path */ - /* separator there is no prefix */ - if (s + 1 == k) { - /* we know there is no prefix */ - prefix = '\0'; - PL_strcpy(key, k); - *k = '\0'; - PL_strcpy(dir, d); - } else { - /* grab the prefix */ - PL_strcpy(key, k); - *k = '\0'; - PL_strcpy(prefix, ++s); - *s = '\0'; - PL_strcpy(dir, d); - } - } else { - /* neither *key[0-9].db nor *cert[0=9].db found */ - return (-1); - } - - return (0); -} - - -static PRStatus local_SSLPLCY_Install(void) -{ - SECStatus s; - -#ifdef NS_DOMESTIC - s = NSS_SetDomesticPolicy(); -#elif NS_EXPORT - s = NSS_SetExportPolicy(); -#else - s = PR_FAILURE; -#endif - return s?PR_FAILURE:PR_SUCCESS; -} - - - -static void -ldapssl_basic_init( void ) -{ - /* PR_Init() must to be called before everything else... */ - PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); - - PR_SetConcurrency( 4 ); /* work around for NSPR 3.x I/O hangs */ -} - - - -/* - * Cover functions for malloc(), calloc(), strdup() and free() that are - * compatible with the NSS libraries (they seem to use the C runtime - * library malloc/free so these functions are quite simple right now). - */ -static void * -ldapssl_malloc( size_t size ) -{ - void *p; - - p = malloc( size ); - return p; -} - - -static void * -ldapssl_calloc( int nelem, size_t elsize ) -{ - void *p; - - p = calloc( nelem, elsize ); - return p; -} - - -static char * -ldapssl_strdup( const char *s ) -{ - char *scopy; - - if ( NULL == s ) { - scopy = NULL; - } else { - scopy = strdup( s ); - } - return scopy; -} - - -static void -ldapssl_free( void **pp ) -{ - if ( NULL != pp && NULL != *pp ) { - free( (void *)*pp ); - *pp = NULL; - } -} - - -static char * -buildDBName(const char *basename, const char *dbname) -{ - char *result; - PRUint32 len, pathlen, addslash; - - if (basename) - { - if (( len = PL_strlen( basename )) > 3 - && PL_strcasecmp( ".db", basename + len - 3 ) == 0 ) { - return (ldapssl_strdup(basename)); - } - - pathlen = len; - len = pathlen + PL_strlen(dbname) + 1; - addslash = ( pathlen > 0 && - (( *(basename + pathlen - 1) != FILE_PATHSEP ) || - ( *(basename + pathlen - 1) != '\\' ))); - - if ( addslash ) { - ++len; - } - if (( result = ldapssl_malloc( len )) != NULL ) { - PL_strcpy( result, basename ); - if ( addslash ) { - *(result+pathlen) = FILE_PATHSEP; /* replaces '\0' */ - ++pathlen; - } - PL_strcpy(result+pathlen, dbname); - } - - } - - - return result; -} - -char * -GetCertDBName(void *alias, int dbVersion) -{ - char *source; - char dbname[128]; - - source = (char *)alias; - - if (!source) - { - source = ""; - } - - sprintf(dbname, "cert%d.db",dbVersion); - return(buildDBName(source, dbname)); - - -} - -/* - * return database name by appending "dbname" to "path". - * this code doesn't need to be terribly efficient (not called often). - */ -/* XXXceb this is the old function. To be removed eventually */ -static char * -GetDBName(const char *dbname, const char *path) -{ - char *result; - PRUint32 len, pathlen; - int addslash; - - if ( dbname == NULL ) { - dbname = ""; - } - - if ((path == NULL) || (*path == 0)) { - result = ldapssl_strdup(dbname); - } else { - pathlen = PL_strlen(path); - len = pathlen + PL_strlen(dbname) + 1; - addslash = ( path[pathlen - 1] != '/' ); - if ( addslash ) { - ++len; - } - if (( result = ldapssl_malloc( len )) != NULL ) { - PL_strcpy( result, path ); - if ( addslash ) { - *(result+pathlen) = '/'; /* replaces '\0' */ - ++pathlen; - } - PL_strcpy(result+pathlen, dbname); - } - } - - return result; -} - -/* - * Initialize ns/security so it can be used for SSL client authentication. - * It is safe to call this more than once. - * - * If needkeydb == 0, no key database is opened and SSL server authentication - * is supported but not client authentication. - * - * If "certdbpath" is NULL or "", the default cert. db is used (typically - * ~/.netscape/cert7.db). - * - * If "certdbpath" ends with ".db" (case-insensitive compare), then - * it is assumed to be a full path to the cert. db file; otherwise, - * it is assumed to be a directory that contains a file called - * "cert7.db" or "cert.db". - * - * If certdbhandle is non-NULL, it is assumed to be a pointer to a - * SECCertDBHandle structure. It is fine to pass NULL since this - * routine will allocate one for you (CERT_GetDefaultDB() can be - * used to retrieve the cert db handle). - * - * If "keydbpath" is NULL or "", the default key db is used (typically - * ~/.netscape/key3.db). - * - * If "keydbpath" ends with ".db" (case-insensitive compare), then - * it is assumed to be a full path to the key db file; otherwise, - * it is assumed to be a directory that contains a file called - * "key3.db" - * - * If certdbhandle is non-NULL< it is assumed to be a pointed to a - * SECKEYKeyDBHandle structure. It is fine to pass NULL since this - * routine will allocate one for you (SECKEY_GetDefaultDB() can be - * used to retrieve the cert db handle). - */ -int -LDAP_CALL -ldapssl_clientauth_init( const char *certdbpath, void *certdbhandle, - const int needkeydb, const char *keydbpath, void *keydbhandle ) - -{ - - int rc; - - /* - * LDAPDebug(LDAP_DEBUG_TRACE, "ldapssl_clientauth_init\n",0 ,0 ,0); - */ - - if ( inited ) { - return( 0 ); - } - - ldapssl_basic_init(); - - - /* Open the certificate database */ - if ((rc = NSS_Init(certdbpath)) != SECSuccess) { - return (-1); - } - - if (SSL_OptionSetDefault(SSL_ENABLE_SSL2, PR_FALSE) - || SSL_OptionSetDefault(SSL_ENABLE_SSL3, PR_TRUE)) { - if (( rc = PR_GetError()) >= 0 ) { - rc = -1; - } - return( rc ); - } - - - -#if defined(NS_DOMESTIC) - if (local_SSLPLCY_Install() == PR_FAILURE) - return( -1 ); -#elif(NS_EXPORT) - if (local_SSLPLCY_Install() == PR_FAILURE) - return( -1 ); -#else - return( -1 ); -#endif - - inited = 1; - - return( 0 ); - -} - - -/* - * This is not the most elegant solution to SSL strength, but it - * works because ldapssl_advclientauth_init() is only called once. - */ - -int get_ssl_strength( void ) -{ - return ssl_strength; -} - -/* - * At some point we might want to consider protecting this - * with a mutex.. For now there is no need. - */ -int set_ssl_strength(int strength_val) -{ - - if (strength_val == LDAPSSL_AUTH_WEAK || - strength_val == LDAPSSL_AUTH_CERT || - strength_val == LDAPSSL_AUTH_CNCHECK ) { - ssl_strength = strength_val; - return LDAP_SUCCESS; - } - return LDAP_PARAM_ERROR; - -} - - - -/* - * Initialize ns/security so it can be used for SSL client authentication. - * It is safe to call this more than once. - * - * If needkeydb == 0, no key database is opened and SSL server authentication - * is supported but not client authentication. - * - * If "certdbpath" is NULL or "", the default cert. db is used (typically - * ~/.netscape/cert7.db). - * - * If "certdbpath" ends with ".db" (case-insensitive compare), then - * it is assumed to be a full path to the cert. db file; otherwise, - * it is assumed to be a directory that contains a file called - * "cert7.db" or "cert.db". - * - * If certdbhandle is non-NULL, it is assumed to be a pointer to a - * SECCertDBHandle structure. It is fine to pass NULL since this - * routine will allocate one for you (CERT_GetDefaultDB() can be - * used to retrieve the cert db handle). - * - * If "keydbpath" is NULL or "", the default key db is used (typically - * ~/.netscape/key3.db). - * - * If "keydbpath" ends with ".db" (case-insensitive compare), then - * it is assumed to be a full path to the key db file; otherwise, - * it is assumed to be a directory that contains a file called - * "key3.db" - * - * If certdbhandle is non-NULL< it is assumed to be a pointed to a - * SECKEYKeyDBHandle structure. It is fine to pass NULL since this - * routine will allocate one for you (SECKEY_GetDefaultDB() can be - * used to retrieve the cert db handle). */ -int -LDAP_CALL -ldapssl_advclientauth_init( - const char *certdbpath, void *certdbhandle, - const int needkeydb, const char *keydbpath, void *keydbhandle, - const int needsecmoddb, const char *secmoddbpath, - const int sslstrength ) -{ - int rc = 0; - - if ( inited ) { - return( 0 ); - } - - /* - * LDAPDebug(LDAP_DEBUG_TRACE, "ldapssl_advclientauth_init\n",0 ,0 ,0); - */ - - ldapssl_basic_init(); - - if ((rc = NSS_Init(certdbpath)) != SECSuccess) { - return (-1); - } - -#if defined(NS_DOMESTIC) - if (local_SSLPLCY_Install() == PR_FAILURE) - return( -1 ); -#elif(NS_EXPORT) - if (local_SSLPLCY_Install() == PR_FAILURE) - return( -1 ); -#else - return( -1 ); -#endif - - inited = 1; - - set_ssl_strength( sslstrength ); - - return( 0 ); - -} - - -/* - * Initialize ns/security so it can be used for SSL client authentication. - * It is safe to call this more than once. - */ - -/* - * XXXceb This is a hack until the new IO functions are done. - * this function lives in ldapsinit.c - */ -void set_using_pkcs_functions( int val ); - -int -LDAP_CALL -ldapssl_pkcs_init( const struct ldapssl_pkcs_fns *pfns ) -{ - - char *certdbName, *s, *keydbpath; - char *certdbPrefix, *keydbPrefix; - char *confDir, *keydbName; - static char *secmodname = "secmod.db"; - int rc; - - if ( inited ) { - return( 0 ); - } -/* - * XXXceb This is a hack until the new IO functions are done. - * this function MUST be called before ldap_enable_clienauth. - * - */ - set_using_pkcs_functions( 1 ); - - /* - * LDAPDebug(LDAP_DEBUG_TRACE, "ldapssl_pkcs_init\n",0 ,0 ,0); - */ - - - ldapssl_basic_init(); - - pfns->pkcs_getcertpath( NULL, &s); - confDir = ldapssl_strdup( s ); - certdbPrefix = ldapssl_strdup( s ); - certdbName = ldapssl_strdup( s ); - *certdbPrefix = 0; - splitpath(s, confDir, certdbPrefix, certdbName); - - pfns->pkcs_getkeypath( NULL, &s); - keydbpath = ldapssl_strdup( s ); - keydbPrefix = ldapssl_strdup( s ); - keydbName = ldapssl_strdup( s ); - *keydbPrefix = 0; - splitpath(s, keydbpath, keydbPrefix, keydbName); - - - /* verify confDir == keydbpath and adjust as necessary */ - ldapssl_free((void **)&certdbName); - ldapssl_free((void **)&keydbName); - ldapssl_free((void **)&keydbpath); - - if ((rc = NSS_Initialize(confDir,certdbPrefix,keydbPrefix, - secmodname, NSS_INIT_READONLY)) != SECSuccess) { - return (-1); - } - - ldapssl_free((void **)&certdbPrefix); - ldapssl_free((void **)&keydbPrefix); - ldapssl_free((void **)&confDir); - - - /* this is odd */ - PK11_ConfigurePKCS11(NULL, NULL, tokDes, ptokDes, NULL, NULL, NULL, NULL, 0, 0 ); - - if (SSL_OptionSetDefault(SSL_ENABLE_SSL2, PR_FALSE) - || SSL_OptionSetDefault(SSL_ENABLE_SSL3, PR_TRUE)) { - if (( rc = PR_GetError()) >= 0 ) { - rc = -1; - } - - return( rc ); - } - -#if defined(NS_DOMESTIC) - if (local_SSLPLCY_Install() == PR_FAILURE) - return( -1 ); -#elif(NS_EXPORT) - if (local_SSLPLCY_Install() == PR_FAILURE) - return( -1 ); -#else - return( -1 ); -#endif - - inited = 1; - - if ( certdbName != NULL ) { - ldapssl_free((void **) &certdbName ); - } - - /* - set_ssl_strength( sslstrength ); - */ - - set_ssl_strength( LDAPSSL_AUTH_CERT ); - return( 0 ); -} - - -/* - * ldapssl_client_init() is a server-authentication only version of - * ldapssl_clientauth_init(). - */ -int -LDAP_CALL -ldapssl_client_init(const char* certdbpath, void *certdbhandle ) -{ - return( ldapssl_clientauth_init( certdbpath, certdbhandle, - 0, NULL, NULL )); -} -#endif /* NET_SSL */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libssldap/errormap.c b/mozilla/directory/c-sdk/ldap/libraries/libssldap/errormap.c deleted file mode 100644 index d486e65b484..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libssldap/errormap.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * 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): - */ - -/* - * errormap.c - map NSPR and OS errors to strings - * - * CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF NETSCAPE COMMUNICATIONS - * CORPORATION - * - * Copyright (C) 1998-9 Netscape Communications Corporation. All Rights Reserved. - * - * Use of this Source Code is subject to the terms of the applicable license - * agreement from Netscape Communications Corporation. - * - * The copyright notice(s) in this Source Code does not indicate actual or - * intended publication of this Source Code. - */ - -/* XXX ceb - * This code was stolen from Directory server. - * ns/netsite/ldap/servers/slapd/errormap.c - * OS errors are not handled, so the os error has been removed. - */ - - -#if defined( _WINDOWS ) -#include -#include "proto-ntutil.h" -#endif - -#include -#include - -#include -#include - - -/* - * function protoypes - */ -static const char *SECU_Strerror(PRErrorCode errNum); - - - -/* - * return the string equivalent of an NSPR error - */ - -const char * -LDAP_CALL -ldapssl_err2string( const int prerrno ) -{ - const char *s; - - if (( s = SECU_Strerror( (PRErrorCode)prerrno )) == NULL ) { - s = "unknown"; - } - - return( s ); -} - -/* - **************************************************************************** - * The code below this point was provided by Nelson Bolyard of the - * Netscape Certificate Server team on 27-March-1998. - * Taken from the file ns/security/cmd/lib/secerror.c on NSS_1_BRANCH. - * Last updated from there: 24-July-1998 by Mark Smith - * Last updated from there: 14-July-1999 by chuck boatwright - * - * - * All of the Directory Server specific changes are enclosed inside - * #ifdef NS_DIRECTORY. - **************************************************************************** - */ -#include "nspr.h" - -/* - * XXXceb as a hack, we will locally define NS_DIRECTORY - */ -#define NS_DIRECTORY 1 - -struct tuple_str { - PRErrorCode errNum; - const char * errString; -}; - -typedef struct tuple_str tuple_str; - -#define ER2(a,b) {a, b}, -#define ER3(a,b,c) {a, c}, - -#include "secerr.h" -#include "sslerr.h" - -const tuple_str errStrings[] = { - -/* keep this list in asceding order of error numbers */ -#ifdef NS_DIRECTORY -#include "sslerrstrs.h" -#include "secerrstrs.h" -#include "prerrstrs.h" -/* - * XXXceb -- LDAPSDK won't care about disconnect -#include "disconnect_error_strings.h" - */ - -#else /* NS_DIRECTORY */ -#include "SSLerrs.h" -#include "SECerrs.h" -#include "NSPRerrs.h" -#endif /* NS_DIRECTORY */ - -}; - -const PRInt32 numStrings = sizeof(errStrings) / sizeof(tuple_str); - -/* Returns a UTF-8 encoded constant error string for "errNum". - * Returns NULL of errNum is unknown. - */ -#ifdef NS_DIRECTORY -static -#endif /* NS_DIRECTORY */ -const char * -SECU_Strerror(PRErrorCode errNum) { - PRInt32 low = 0; - PRInt32 high = numStrings - 1; - PRInt32 i; - PRErrorCode num; - static int initDone; - - /* make sure table is in ascending order. - * binary search depends on it. - */ - if (!initDone) { - PRErrorCode lastNum = 0x80000000; - for (i = low; i <= high; ++i) { - num = errStrings[i].errNum; - if (num <= lastNum) { - -/* - * XXXceb - * We aren't handling out of sequence errors. - */ - - -#if 0 -#ifdef NS_DIRECTORY - LDAPDebug( LDAP_DEBUG_ANY, - "sequence error in error strings at item %d\n" - "error %d (%s)\n", - i, lastNum, errStrings[i-1].errString ); - LDAPDebug( LDAP_DEBUG_ANY, - "should come after \n" - "error %d (%s)\n", - num, errStrings[i].errString, 0 ); -#else /* NS_DIRECTORY */ - fprintf(stderr, -"sequence error in error strings at item %d\n" -"error %d (%s)\n" -"should come after \n" -"error %d (%s)\n", - i, lastNum, errStrings[i-1].errString, - num, errStrings[i].errString); -#endif /* NS_DIRECTORY */ -#endif /* 0 */ - } - lastNum = num; - } - initDone = 1; - } - - /* Do binary search of table. */ - while (low + 1 < high) { - i = (low + high) / 2; - num = errStrings[i].errNum; - if (errNum == num) - return errStrings[i].errString; - if (errNum < num) - high = i; - else - low = i; - } - if (errNum == errStrings[low].errNum) - return errStrings[low].errString; - if (errNum == errStrings[high].errNum) - return errStrings[high].errString; - return NULL; -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/libssldap/ldapsinit.c b/mozilla/directory/c-sdk/ldap/libraries/libssldap/ldapsinit.c deleted file mode 100644 index be1c45ea327..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libssldap/ldapsinit.c +++ /dev/null @@ -1,736 +0,0 @@ -/* - * 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): - */ - -/* - * ldapsinit.c - */ - -#if defined(NET_SSL) - -#if defined( _WINDOWS ) -#include -#endif - -/* 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 -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/* - * Data structure to hold the standard NSPR I/O function pointers set by - * libprldap. We save them in our session data structure so we can call - * them from our own I/O functions (we add functionality to support SSL - * while using libprldap's functions as much as possible). - */ -typedef struct ldapssl_std_functions { - LDAP_X_EXTIOF_CLOSE_CALLBACK *lssf_close_fn; - LDAP_X_EXTIOF_CONNECT_CALLBACK *lssf_connect_fn; - LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *lssf_disposehdl_fn; -} LDAPSSLStdFunctions; - - - -/* - * LDAP session data structure. - */ -typedef struct ldapssl_session_info { - int lssei_using_pcks_fns; - char *lssei_certnickname; - char *lssei_keypasswd; - LDAPSSLStdFunctions lssei_std_functions; -} LDAPSSLSessionInfo; - - -/* - * LDAP socket data structure. - */ -typedef struct ldapssl_socket_info { - LDAPSSLSessionInfo *soi_sessioninfo; /* session info */ -} LDAPSSLSocketInfo; - - -/* - * XXXceb This is a hack until the new IO functions are done. - * this function MUST be called before ldap_enable_clienauth. - * right now, this function is called in ldapssl_pkcs_init(); - */ - -static int using_pkcs_functions = 0; - -void set_using_pkcs_functions( int val ) -{ - using_pkcs_functions = val; -} - - -/* - * External functions... this function currently lives in clientinit.c - */ -int get_ssl_strength( void ); - - -/* - * Utility functions: - */ -static void ldapssl_free_session_info( LDAPSSLSessionInfo **ssipp ); -static void ldapssl_free_socket_info( LDAPSSLSocketInfo **soipp ); - - -/* - * SSL Stuff - */ - -static int ldapssl_AuthCertificate(void *certdbarg, PRFileDesc *fd, - PRBool checkSig, PRBool isServer); - -/* - * client auth stuff - */ -static SECStatus get_clientauth_data( void *sessionarg, PRFileDesc *prfd, - CERTDistNames *caNames, CERTCertificate **pRetCert, - SECKEYPrivateKey **pRetKey ); -static SECStatus get_keyandcert( LDAPSSLSessionInfo *ssip, - CERTCertificate **pRetCert, SECKEYPrivateKey **pRetKey, - char **errmsgp ); -static SECStatus check_clientauth_nicknames_and_passwd( LDAP *ld, - LDAPSSLSessionInfo *ssip ); -static char *get_keypassword( PK11SlotInfo *slot, PRBool retry, - void *sessionarg ); - -/* - * Like ldap_init(), except also install I/O routines from libsec so we - * can support SSL. If defsecure is non-zero, SSL is enabled for the - * default connection as well. - */ -LDAP * -LDAP_CALL -ldapssl_init( const char *defhost, int defport, int defsecure ) -{ - LDAP *ld; - - - if (0 ==defport) - defport = LDAPS_PORT; - - if (( ld = ldap_init( defhost, defport )) == NULL ) { - return( NULL ); - } - - if ( ldapssl_install_routines( ld ) < 0 || ldap_set_option( ld, - LDAP_OPT_SSL, defsecure ? LDAP_OPT_ON : LDAP_OPT_OFF ) != 0 ) { - PR_SetError( PR_UNKNOWN_ERROR, EINVAL ); /* XXXmcs: just a guess! */ - ldap_unbind( ld ); - return( NULL ); - } - - return( ld ); -} - - -static int -ldapssl_close(int s, struct lextiof_socket_private *socketarg) -{ - PRLDAPSocketInfo soi; - LDAPSSLSocketInfo *ssoip; - LDAPSSLSessionInfo *sseip; - - memset( &soi, 0, sizeof(soi)); - soi.soinfo_size = PRLDAP_SOCKETINFO_SIZE; - if ( prldap_get_socket_info( s, socketarg, &soi ) != LDAP_SUCCESS ) { - return( -1 ); - } - - ssoip = (LDAPSSLSocketInfo *)soi.soinfo_appdata; - sseip = ssoip->soi_sessioninfo; - - ldapssl_free_socket_info( (LDAPSSLSocketInfo **)&soi.soinfo_appdata ); - - return( (*(sseip->lssei_std_functions.lssf_close_fn))( s, socketarg )); -} - - -static int -do_ldapssl_connect(const char *hostlist, int defport, int timeout, - unsigned long options, struct lextiof_session_private *sessionarg, - struct lextiof_socket_private **socketargp, int clientauth ) -{ - int intfd = -1; - PRBool secure; - PRLDAPSessionInfo sei; - PRLDAPSocketInfo soi; - LDAPSSLSocketInfo *ssoip = NULL; - LDAPSSLSessionInfo *sseip; - PRFileDesc *sslfd = NULL; - - /* - * Determine if secure option is set. Also, clear secure bit in options - * the we pass to the standard connect() function (since it doesn't know - * how to handle the secure option). - */ - if ( 0 != ( options & LDAP_X_EXTIOF_OPT_SECURE )) { - secure = PR_TRUE; - options &= ~LDAP_X_EXTIOF_OPT_SECURE; - } else { - secure = PR_FALSE; - } - - /* - * Retrieve session info. so we can store a pointer to our session info. - * in our socket info. later. - */ - memset( &sei, 0, sizeof(sei)); - sei.seinfo_size = PRLDAP_SESSIONINFO_SIZE; - if ( prldap_get_session_info( NULL, sessionarg, &sei ) != LDAP_SUCCESS ) { - return( -1 ); - } - sseip = (LDAPSSLSessionInfo *)sei.seinfo_appdata; - - /* - * Call the standard connect() callback to make the TCP connection. If it - * succeeds, *socketargp is set. - */ - intfd = (*(sseip->lssei_std_functions.lssf_connect_fn))( hostlist, defport, - timeout, options, sessionarg, socketargp ); - if ( intfd < 0 ) { - return( intfd ); - } - - /* - * Retrieve socket info. so we have the PRFileDesc. - */ - memset( &soi, 0, sizeof(soi)); - soi.soinfo_size = PRLDAP_SOCKETINFO_SIZE; - if ( prldap_get_socket_info( intfd, *socketargp, &soi ) != LDAP_SUCCESS ) { - goto close_socket_and_exit_with_error; - } - - /* - * Allocate a structure to hold our socket-specific data. - */ - if ( NULL == ( ssoip = PR_Calloc( 1, sizeof( LDAPSSLSocketInfo )))) { - goto close_socket_and_exit_with_error; - } - ssoip->soi_sessioninfo = sseip; - - /* - * Add SSL layer and let the standard NSPR to LDAP layer and enable SSL. - */ - if (( sslfd = SSL_ImportFD( NULL, soi.soinfo_prfd )) == NULL ) { - goto close_socket_and_exit_with_error; - } - - if ( SSL_OptionSet( sslfd, SSL_SECURITY, secure ) != SECSuccess || - SSL_OptionSet( sslfd, SSL_HANDSHAKE_AS_CLIENT, secure ) - != SECSuccess || ( secure && SSL_ResetHandshake( sslfd, - PR_FALSE ) != SECSuccess )) { - goto close_socket_and_exit_with_error; - } - - /* - * Let the standard NSPR to LDAP layer know about the new socket and - * our own socket-specific data. - */ - soi.soinfo_prfd = sslfd; - soi.soinfo_appdata = (void *)ssoip; - if ( prldap_set_socket_info( intfd, *socketargp, &soi ) != LDAP_SUCCESS ) { - goto close_socket_and_exit_with_error; - } - sslfd = NULL; /* so we don't close the socket twice upon error */ - - /* - * Install certificate hook function. - */ - SSL_AuthCertificateHook( soi.soinfo_prfd, - (SSLAuthCertificate)ldapssl_AuthCertificate, - (void *)CERT_GetDefaultCertDB()); - - /* - * XXXmcs: 28-April-2000 - * I deleted some code here that was #if 0'd out that mentioned "the Man - * In The Middle fix"... presumably that fix is now in NSS since the - * code here was not being compiled in? - */ - -#if 0 - if ( clientauth ) { - /* - * XXXmcs: what is the effect of calling - * SSL_AuthCertificateHook()? It looks like - * SSL_AuthCertificate() verifies certs. But what - * cert.? Leave this commented out until we find out.... - */ - - if (( certdbh = CERT_GetDefaultCertDB()) == NULL ) { - goto close_socket_and_exit_with_error; - } else if ( SSL_AuthCertificateHook( soi.soinfo_prfd, - SSL_AuthCertificate, - (void *)certdbh ) != 0 ) { - goto close_socket_and_exit_with_error; - } - } -#endif - - if ( SSL_GetClientAuthDataHook( soi.soinfo_prfd, - get_clientauth_data, clientauth ? sseip : NULL ) != 0 ) { - goto close_socket_and_exit_with_error; - } - - return( intfd ); /* success */ - -close_socket_and_exit_with_error: - if ( NULL != sslfd ) { - PR_Close( sslfd ); - } - if ( NULL != ssoip ) { - ldapssl_free_socket_info( &ssoip ); - } - if ( intfd >= 0 && NULL != *socketargp ) { - (*(sseip->lssei_std_functions.lssf_close_fn))( intfd, *socketargp ); - } - return( -1 ); -} - - -static int -ldapssl_connect(const char *hostlist, int defport, int timeout, - unsigned long options, struct lextiof_session_private *sessionarg, - struct lextiof_socket_private **socketargp ) -{ - return( do_ldapssl_connect( hostlist, defport, timeout, options, - sessionarg, socketargp, 0 )); -} - - -static int -ldapssl_clientauth_connect(const char *hostlist, int defport, int timeout, - unsigned long options, struct lextiof_session_private *sessionarg, - struct lextiof_socket_private **socketargp ) -{ - return( do_ldapssl_connect( hostlist, defport, timeout, options, - sessionarg, socketargp, 1 )); -} - - -static void -ldapssl_disposehandle(LDAP *ld, struct lextiof_session_private *sessionarg) -{ - PRLDAPSessionInfo sei; - LDAPSSLSessionInfo *sseip; - LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *disposehdl_fn; - - memset( &sei, 0, sizeof( sei )); - sei.seinfo_size = PRLDAP_SESSIONINFO_SIZE; - if ( prldap_get_session_info( ld, NULL, &sei ) == LDAP_SUCCESS ) { - sseip = (LDAPSSLSessionInfo *)sei.seinfo_appdata; - disposehdl_fn = sseip->lssei_std_functions.lssf_disposehdl_fn; - ldapssl_free_session_info( &sseip ); - (*disposehdl_fn)( ld, sessionarg ); - } -} - - -/* - * Install I/O routines from libsec and NSPR into libldap to allow libldap - * to do SSL. - * - * We rely on libprldap to provide most of the functions, and then we override - * a few of them to support SSL. - */ -int -LDAP_CALL -ldapssl_install_routines( LDAP *ld ) -{ - struct ldap_x_ext_io_fns iofns; - LDAPSSLSessionInfo *ssip; - PRLDAPSessionInfo sei; - - /* install standard NSPR functions */ - if ( prldap_install_routines( - ld, - 1 /* shared -- we have to assume it is */ ) - != LDAP_SUCCESS ) { - return( -1 ); - } - - /* - * Allocate our own session information. - */ - if ( NULL == ( ssip = (LDAPSSLSessionInfo *)PR_Calloc( 1, - sizeof( LDAPSSLSessionInfo )))) { - ldap_set_lderrno( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - ssip->lssei_using_pcks_fns = using_pkcs_functions; - - /* - * override a few functions, saving a pointer to the standard function - * in each case so we can call it from our SSL savvy functions. - */ - memset( &iofns, 0, sizeof(iofns)); - iofns.lextiof_size = LDAP_X_EXTIO_FNS_SIZE; - if ( ldap_get_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, (void *)&iofns ) < 0 ) { - ldapssl_free_session_info( &ssip ); - return( -1 ); - } - - /* override socket, connect, and ioctl */ - ssip->lssei_std_functions.lssf_connect_fn = iofns.lextiof_connect; - iofns.lextiof_connect = ldapssl_connect; - ssip->lssei_std_functions.lssf_close_fn = iofns.lextiof_close; - iofns.lextiof_close = ldapssl_close; - ssip->lssei_std_functions.lssf_disposehdl_fn = iofns.lextiof_disposehandle; - iofns.lextiof_disposehandle = ldapssl_disposehandle; - - if ( ldap_set_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, (void *)&iofns ) < 0 ) { - ldapssl_free_session_info( &ssip ); - return( -1 ); - } - - /* - * Store session info. for later retrieval. - */ - sei.seinfo_size = PRLDAP_SESSIONINFO_SIZE; - sei.seinfo_appdata = (void *)ssip; - if ( prldap_set_session_info( ld, NULL, &sei ) != LDAP_SUCCESS ) { - return( -1 ); - } - - return( 0 ); -} - - -int -LDAP_CALL -ldapssl_enable_clientauth( LDAP *ld, char *keynickname, - char *keypasswd, char *certnickname ) -{ - struct ldap_x_ext_io_fns iofns; - LDAPSSLSessionInfo *ssip; - PRLDAPSessionInfo sei; - - /* - * Check parameters - */ - if ( certnickname == NULL || keypasswd == NULL ) { - ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( -1 ); - } - - /* - * Update session info. data structure. - */ - sei.seinfo_size = PRLDAP_SESSIONINFO_SIZE; - if ( prldap_get_session_info( ld, NULL, &sei ) != LDAP_SUCCESS ) { - return( -1 ); - } - ssip = (LDAPSSLSessionInfo *)sei.seinfo_appdata; - if ( NULL == ssip ) { - ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( -1 ); - } - ssip->lssei_certnickname = PL_strdup( certnickname ); - ssip->lssei_keypasswd = PL_strdup( keypasswd ); - - if ( NULL == ssip->lssei_certnickname || NULL == ssip->lssei_keypasswd ) { - ldap_set_lderrno( ld, LDAP_NO_MEMORY, NULL, NULL ); - return( -1 ); - } - - if ( check_clientauth_nicknames_and_passwd( ld, ssip ) != SECSuccess ) { - return( -1 ); - } - - /* - * replace standard SSL CONNECT function with client auth aware one - */ - memset( &iofns, 0, sizeof(iofns)); - iofns.lextiof_size = LDAP_X_EXTIO_FNS_SIZE; - if ( ldap_get_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, (void *)&iofns ) - != 0 ) { - return( -1 ); - } - - if ( iofns.lextiof_connect != ldapssl_connect ) { - /* standard SSL setup has not done */ - ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, NULL ); - return( -1 ); - } - - iofns.lextiof_connect = ldapssl_clientauth_connect; - - if ( ldap_set_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, (void *)&iofns ) - != 0 ) { - return( -1 ); - } - - return( 0 ); -} - - -static void -ldapssl_free_session_info( LDAPSSLSessionInfo **ssipp ) -{ - if ( NULL != ssipp && NULL != *ssipp ) { - if ( NULL != (*ssipp)->lssei_certnickname ) { - PL_strfree( (*ssipp)->lssei_certnickname ); - (*ssipp)->lssei_certnickname = NULL; - } - if ( NULL != (*ssipp)->lssei_keypasswd ) { - PL_strfree( (*ssipp)->lssei_keypasswd ); - (*ssipp)->lssei_keypasswd = NULL; - } - PR_Free( *ssipp ); - *ssipp = NULL; - } -} - - -static void -ldapssl_free_socket_info( LDAPSSLSocketInfo **soipp ) -{ - if ( NULL != soipp && NULL != *soipp ) { - PR_Free( *soipp ); - *soipp = NULL; - } -} - - -/* this function provides cert authentication. This is called during - * the SSL_Handshake process. Once the cert has been retrieved from - * the server, the it is checked, using VerifyCertNow(), then - * the cn is checked against the host name, set with SSL_SetURL() - */ - -/* - * XXXceb NOTE, this needs to be fixed to check for the MITM hack 980623 - */ - -static int -ldapssl_AuthCertificate(void *certdbarg, PRFileDesc *fd, PRBool checkSig, - PRBool isServer) -{ - SECStatus rv = SECFailure; - CERTCertDBHandle * handle; - CERTCertificate * cert; - SECCertUsage certUsage; - char * hostname = (char *)0; - - if (!certdbarg || !socket) - return rv; - - if (LDAPSSL_AUTH_WEAK == get_ssl_strength() ) - return SECSuccess; - - handle = (CERTCertDBHandle *)certdbarg; - - if ( isServer ) { - certUsage = certUsageSSLClient; - } else { - certUsage = certUsageSSLServer; - } - cert = SSL_PeerCertificate( fd ); - - rv = CERT_VerifyCertNow(handle, cert, checkSig, certUsage, NULL); - - if ( rv != SECSuccess || isServer ) - return rv; - - if ( LDAPSSL_AUTH_CNCHECK == get_ssl_strength() ) - { - /* cert is OK. This is the client side of an SSL connection. - * Now check the name field in the cert against the desired hostname. - * NB: This is our only defense against Man-In-The-Middle (MITM) - * attacks! - */ - hostname = SSL_RevealURL( fd ); - - if (hostname && hostname[0]) - rv = CERT_VerifyCertName(cert, hostname); - else - rv = SECFailure; - if (rv != SECSuccess) - PORT_SetError(SSL_ERROR_BAD_CERT_DOMAIN); - } - - return((int)rv); -} - - -/* - * called during SSL client auth. when server wants our cert and key. - * returns: SECSuccess if we succeeded and set *pRetCert and *pRetKey, - * SECFailure otherwise. - * if SECFailure is returned SSL will proceed without sending a cert. - */ - -static SECStatus -get_clientauth_data( void *sessionarg, PRFileDesc *prfd, - CERTDistNames *caNames, CERTCertificate **pRetCert, - SECKEYPrivateKey **pRetKey ) - -{ - LDAPSSLSessionInfo *ssip; - - if (( ssip = (LDAPSSLSessionInfo *)sessionarg ) == NULL ) { - return( SECFailure ); /* client auth. not enabled */ - } - - return( get_keyandcert( ssip, pRetCert, pRetKey, NULL )); -} - -static SECStatus -get_keyandcert( LDAPSSLSessionInfo *ssip, - CERTCertificate **pRetCert, SECKEYPrivateKey **pRetKey, - char **errmsgp ) -{ - CERTCertificate *cert; - SECKEYPrivateKey *key; - - if (( cert = PK11_FindCertFromNickname( ssip->lssei_certnickname, NULL )) - == NULL ) { - if ( errmsgp != NULL ) { - *errmsgp = "unable to find certificate"; - } - return( SECFailure ); - } - - if (!ssip->lssei_using_pcks_fns) - { - PK11_SetPasswordFunc( get_keypassword ); - } - - - - if (( key = PK11_FindKeyByAnyCert( cert, (void *)ssip )) == NULL ) { - CERT_DestroyCertificate( cert ); - if ( errmsgp != NULL ) { - *errmsgp = "bad key or key password"; - } - return( SECFailure ); - } - - *pRetCert = cert; - *pRetKey = key; - return( SECSuccess ); -} - - -/* - * This function returns the password to NSS. - * This function is enable through PK11_SetPasswordFunc - * only if pkcs functions are not being used. - */ - -static char * -get_keypassword( PK11SlotInfo *slot, PRBool retry, void *sessionarg ) -{ - LDAPSSLSessionInfo *ssip; - - if ( retry) - return (NULL); - - ssip = (LDAPSSLSessionInfo *)sessionarg; - if ( NULL == ssip ) { - return( NULL ); - } - - return( ssip->lssei_keypasswd ); -} - - -/* - * performs some basic checks on clientauth cert and key/password - * - * XXXmcs: could perform additional checks... see servers/slapd/ssl.c - * 1) check expiration - * 2) check that public key in cert matches private key - * see ns/netsite/ldap/servers/slapd/ssl.c:slapd_ssl_init() for example code. - */ -static SECStatus -check_clientauth_nicknames_and_passwd( LDAP *ld, LDAPSSLSessionInfo *ssip ) -{ - char *errmsg = NULL; - CERTCertificate *cert = NULL; - SECKEYPrivateKey *key = NULL; - SECStatus rv; - - rv = get_keyandcert( ssip, &cert, &key, &errmsg ); - - if ( rv != SECSuccess ) { - if ( errmsg != NULL ) { - errmsg = strdup( errmsg ); - } - ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, errmsg ); - return( rv ); - } - - if ( cert != NULL ) { - CERT_DestroyCertificate( cert ); - } - if ( key != NULL ) { - SECKEY_DestroyPrivateKey( key ); - } - return( SECSuccess ); -} - - -/* there are patches and kludges. this is both. force some linkers to - * link this stuff in - */ -int stubs_o_stuff( void ) -{ - PRExplodedTime exploded; - PLArenaPool pool; - - const char *name ="t"; - PRUint32 size = 0, align = 0; - - PR_ImplodeTime( &exploded ); - PL_InitArenaPool( &pool, name, size, align); - PR_Cleanup(); - PR_fprintf((PRFileDesc*)stderr, "Bad IDEA!!"); - - return 0; - -} -#endif /* NET_SSL */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/libssldap/prerrstrs.h b/mozilla/directory/c-sdk/ldap/libraries/libssldap/prerrstrs.h deleted file mode 100644 index d449ce3d4a7..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libssldap/prerrstrs.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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): - */ - -/* - * pserrstrs.h - map NSPR errors to strings (used by errormap.c) - * - */ - -/* - **************************************************************************** - * The code below this point was provided by Nelson Bolyard of the - * Netscape Certificate Server team on 27-March-1998. - * Taken from the file ns/security/cmd/lib/NSPRerrs.h on NSS_1_BRANCH. - * Last updated from there: 24-July-1998 by Mark Smith - * - * All of the Directory Server specific changes are enclosed inside - * #ifdef NS_DIRECTORY. - **************************************************************************** - */ -/* General NSPR 2.0 errors */ -/* Caller must #include "prerror.h" */ - -ER2( PR_OUT_OF_MEMORY_ERROR, "Memory allocation attempt failed." ) -ER2( PR_BAD_DESCRIPTOR_ERROR, "Invalid file descriptor." ) -ER2( PR_WOULD_BLOCK_ERROR, "The operation would have blocked." ) -ER2( PR_ACCESS_FAULT_ERROR, "Invalid memory address argument." ) -ER2( PR_INVALID_METHOD_ERROR, "Invalid function for file type." ) -ER2( PR_ILLEGAL_ACCESS_ERROR, "Invalid memory address argument." ) -ER2( PR_UNKNOWN_ERROR, "Some unknown error has occurred." ) -ER2( PR_PENDING_INTERRUPT_ERROR,"Operation interrupted by another thread." ) -ER2( PR_NOT_IMPLEMENTED_ERROR, "function not implemented." ) -ER2( PR_IO_ERROR, "I/O function error." ) -ER2( PR_IO_TIMEOUT_ERROR, "I/O operation timed out." ) -ER2( PR_IO_PENDING_ERROR, "I/O operation on busy file descriptor." ) -ER2( PR_DIRECTORY_OPEN_ERROR, "The directory could not be opened." ) -ER2( PR_INVALID_ARGUMENT_ERROR, "Invalid function argument." ) -ER2( PR_ADDRESS_NOT_AVAILABLE_ERROR, "Network address not available (in use?)." ) -ER2( PR_ADDRESS_NOT_SUPPORTED_ERROR, "Network address type not supported." ) -ER2( PR_IS_CONNECTED_ERROR, "Already connected." ) -ER2( PR_BAD_ADDRESS_ERROR, "Network address is invalid." ) -ER2( PR_ADDRESS_IN_USE_ERROR, "Local Network address is in use." ) -ER2( PR_CONNECT_REFUSED_ERROR, "Connection refused by peer." ) -ER2( PR_NETWORK_UNREACHABLE_ERROR, "Network address is presently unreachable." ) -ER2( PR_CONNECT_TIMEOUT_ERROR, "Connection attempt timed out." ) -ER2( PR_NOT_CONNECTED_ERROR, "Network file descriptor is not connected." ) -ER2( PR_LOAD_LIBRARY_ERROR, "Failure to load dynamic library." ) -ER2( PR_UNLOAD_LIBRARY_ERROR, "Failure to unload dynamic library." ) -ER2( PR_FIND_SYMBOL_ERROR, -"Symbol not found in any of the loaded dynamic libraries." ) -ER2( PR_INSUFFICIENT_RESOURCES_ERROR, "Insufficient system resources." ) -ER2( PR_DIRECTORY_LOOKUP_ERROR, -"A directory lookup on a network address has failed." ) -ER2( PR_TPD_RANGE_ERROR, -"Attempt to access a TPD key that is out of range." ) -ER2( PR_PROC_DESC_TABLE_FULL_ERROR, "Process open FD table is full." ) -ER2( PR_SYS_DESC_TABLE_FULL_ERROR, "System open FD table is full." ) -ER2( PR_NOT_SOCKET_ERROR, -"Network operation attempted on non-network file descriptor." ) -ER2( PR_NOT_TCP_SOCKET_ERROR, -"TCP-specific function attempted on a non-TCP file descriptor." ) -ER2( PR_SOCKET_ADDRESS_IS_BOUND_ERROR, "TCP file descriptor is already bound." ) -ER2( PR_NO_ACCESS_RIGHTS_ERROR, "Access Denied." ) -ER2( PR_OPERATION_NOT_SUPPORTED_ERROR, -"The requested operation is not supported by the platform." ) -ER2( PR_PROTOCOL_NOT_SUPPORTED_ERROR, -"The host operating system does not support the protocol requested." ) -ER2( PR_REMOTE_FILE_ERROR, "Access to the remote file has been severed." ) -ER2( PR_BUFFER_OVERFLOW_ERROR, -"The value requested is too large to be stored in the data buffer provided." ) -ER2( PR_CONNECT_RESET_ERROR, "TCP connection reset by peer." ) -ER2( PR_RANGE_ERROR, "Unused." ) -ER2( PR_DEADLOCK_ERROR, "The operation would have deadlocked." ) -ER2( PR_FILE_IS_LOCKED_ERROR, "The file is already locked." ) -ER2( PR_FILE_TOO_BIG_ERROR, -"Write would result in file larger than the system allows." ) -ER2( PR_NO_DEVICE_SPACE_ERROR, "The device for storing the file is full." ) -ER2( PR_PIPE_ERROR, "Unused." ) -ER2( PR_NO_SEEK_DEVICE_ERROR, "Unused." ) -ER2( PR_IS_DIRECTORY_ERROR, -"Cannot perform a normal file operation on a directory." ) -ER2( PR_LOOP_ERROR, "Symbolic link loop." ) -ER2( PR_NAME_TOO_LONG_ERROR, "File name is too long." ) -ER2( PR_FILE_NOT_FOUND_ERROR, "File not found." ) -ER2( PR_NOT_DIRECTORY_ERROR, -"Cannot perform directory operation on a normal file." ) -ER2( PR_READ_ONLY_FILESYSTEM_ERROR, -"Cannot write to a read-only file system." ) -ER2( PR_DIRECTORY_NOT_EMPTY_ERROR, -"Cannot delete a directory that is not empty." ) -ER2( PR_FILESYSTEM_MOUNTED_ERROR, -"Cannot delete or rename a file object while the file system is busy." ) -ER2( PR_NOT_SAME_DEVICE_ERROR, -"Cannot rename a file to a file system on another device." ) -ER2( PR_DIRECTORY_CORRUPTED_ERROR, -"The directory object in the file system is corrupted." ) -ER2( PR_FILE_EXISTS_ERROR, -"Cannot create or rename a filename that already exists." ) -ER2( PR_MAX_DIRECTORY_ENTRIES_ERROR, -"Directory is full. No additional filenames may be added." ) -ER2( PR_INVALID_DEVICE_STATE_ERROR, -"The required device was in an invalid state." ) -ER2( PR_DEVICE_IS_LOCKED_ERROR, "The device is locked." ) -ER2( PR_NO_MORE_FILES_ERROR, "No more entries in the directory." ) -ER2( PR_END_OF_FILE_ERROR, "Encountered end of file." ) -ER2( PR_FILE_SEEK_ERROR, "Seek error." ) -ER2( PR_FILE_IS_BUSY_ERROR, "The file is busy." ) -ER2( PR_IN_PROGRESS_ERROR, -"Operation is still in progress (probably a non-blocking connect)." ) -ER2( PR_ALREADY_INITIATED_ERROR, -"Operation has already been initiated (probably a non-blocking connect)." ) - -#ifdef PR_GROUP_EMPTY_ERROR -ER2( PR_GROUP_EMPTY_ERROR, "The wait group is empty." ) -#endif - -#ifdef PR_INVALID_STATE_ERROR -ER2( PR_INVALID_STATE_ERROR, "Object state improper for request." ) -#endif - -ER2( PR_MAX_ERROR, "Placeholder for the end of the list" ) diff --git a/mozilla/directory/c-sdk/ldap/libraries/libssldap/secerrstrs.h b/mozilla/directory/c-sdk/ldap/libraries/libssldap/secerrstrs.h deleted file mode 100644 index 3a35ceeff21..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libssldap/secerrstrs.h +++ /dev/null @@ -1,392 +0,0 @@ -/* - * 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): - */ - -/* - * secerrstrs.h - map security errors to strings (used by errormap.c) - * - */ - -/* - **************************************************************************** - * The code below this point was provided by Nelson Bolyard of the - * Netscape Certificate Server team on 27-March-1998. - * Taken from the file ns/security/cmd/lib/SECerrs.h on NSS_1_BRANCH. - * Last updated from there: 24-July-1998 by Mark Smith - * - * All of the Directory Server specific changes are enclosed inside - * #ifdef NS_DIRECTORY. - **************************************************************************** - */ - -/* General security error codes */ -/* Caller must #include "secerr.h" */ - - -ER3(SEC_ERROR_IO, SEC_ERROR_BASE + 0, -"An I/O error occurred during security authorization.") - -ER3(SEC_ERROR_LIBRARY_FAILURE, SEC_ERROR_BASE + 1, -"security library failure.") - -ER3(SEC_ERROR_BAD_DATA, SEC_ERROR_BASE + 2, -"security library: received bad data.") - -ER3(SEC_ERROR_OUTPUT_LEN, SEC_ERROR_BASE + 3, -"security library: output length error.") - -ER3(SEC_ERROR_INPUT_LEN, SEC_ERROR_BASE + 4, -"security library has experienced an input length error.") - -ER3(SEC_ERROR_INVALID_ARGS, SEC_ERROR_BASE + 5, -"security library: invalid arguments.") - -ER3(SEC_ERROR_INVALID_ALGORITHM, SEC_ERROR_BASE + 6, -"security library: invalid algorithm.") - -ER3(SEC_ERROR_INVALID_AVA, SEC_ERROR_BASE + 7, -"security library: invalid AVA.") - -ER3(SEC_ERROR_INVALID_TIME, SEC_ERROR_BASE + 8, -"security library: invalid time.") - -ER3(SEC_ERROR_BAD_DER, SEC_ERROR_BASE + 9, -"security library: improperly formatted DER-encoded message.") - -ER3(SEC_ERROR_BAD_SIGNATURE, SEC_ERROR_BASE + 10, -"Peer's certificate has an invalid signature.") - -ER3(SEC_ERROR_EXPIRED_CERTIFICATE, SEC_ERROR_BASE + 11, -"Peer's Certificate has expired.") - -ER3(SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_BASE + 12, -"Peer's Certificate has been revoked.") - -ER3(SEC_ERROR_UNKNOWN_ISSUER, SEC_ERROR_BASE + 13, -"Peer's Certificate issuer is not recognized.") - -ER3(SEC_ERROR_BAD_KEY, SEC_ERROR_BASE + 14, -"Peer's public key is invalid.") - -ER3(SEC_ERROR_BAD_PASSWORD, SEC_ERROR_BASE + 15, -"The security password entered is incorrect.") - -ER3(SEC_ERROR_RETRY_PASSWORD, SEC_ERROR_BASE + 16, -"New password entered incorrectly. Please try again.") - -ER3(SEC_ERROR_NO_NODELOCK, SEC_ERROR_BASE + 17, -"security library: no nodelock.") - -ER3(SEC_ERROR_BAD_DATABASE, SEC_ERROR_BASE + 18, -"security library: bad database.") - -ER3(SEC_ERROR_NO_MEMORY, SEC_ERROR_BASE + 19, -"security library: memory allocation failure.") - -ER3(SEC_ERROR_UNTRUSTED_ISSUER, SEC_ERROR_BASE + 20, -"Peer's certificate issuer has been marked as not trusted by the user.") - -ER3(SEC_ERROR_UNTRUSTED_CERT, SEC_ERROR_BASE + 21, -"Peer's certificate has been marked as not trusted by the user.") - -ER3(SEC_ERROR_DUPLICATE_CERT, (SEC_ERROR_BASE + 22), -"Certificate already exists in your database.") - -ER3(SEC_ERROR_DUPLICATE_CERT_NAME, (SEC_ERROR_BASE + 23), -"Downloaded certificate's name duplicates one already in your database.") - -ER3(SEC_ERROR_ADDING_CERT, (SEC_ERROR_BASE + 24), -"Error adding certificate to database.") - -ER3(SEC_ERROR_FILING_KEY, (SEC_ERROR_BASE + 25), -"Error refiling the key for this certificate.") - -ER3(SEC_ERROR_NO_KEY, (SEC_ERROR_BASE + 26), -"The private key for this certificate cannot be found in key database") - -ER3(SEC_ERROR_CERT_VALID, (SEC_ERROR_BASE + 27), -"This certificate is valid.") - -ER3(SEC_ERROR_CERT_NOT_VALID, (SEC_ERROR_BASE + 28), -"This certificate is not valid.") - -ER3(SEC_ERROR_CERT_NO_RESPONSE, (SEC_ERROR_BASE + 29), -"Cert Library: No Response") - -ER3(SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE, (SEC_ERROR_BASE + 30), -"The certificate issuer's certificate has expired. Check your system date and time.") - -ER3(SEC_ERROR_CRL_EXPIRED, (SEC_ERROR_BASE + 31), -"The CRL for the certificate's issuer has expired. Update it or check your system data and time.") - -ER3(SEC_ERROR_CRL_BAD_SIGNATURE, (SEC_ERROR_BASE + 32), -"The CRL for the certificate's issuer has an invalid signature.") - -ER3(SEC_ERROR_CRL_INVALID, (SEC_ERROR_BASE + 33), -"New CRL has an invalid format.") - -ER3(SEC_ERROR_EXTENSION_VALUE_INVALID, (SEC_ERROR_BASE + 34), -"Certificate extension value is invalid.") - -ER3(SEC_ERROR_EXTENSION_NOT_FOUND, (SEC_ERROR_BASE + 35), -"Certificate extension not found.") - -ER3(SEC_ERROR_CA_CERT_INVALID, (SEC_ERROR_BASE + 36), -"Issuer certificate is invalid.") - -ER3(SEC_ERROR_PATH_LEN_CONSTRAINT_INVALID, (SEC_ERROR_BASE + 37), -"Certificate path length constraint is invalid.") - -ER3(SEC_ERROR_CERT_USAGES_INVALID, (SEC_ERROR_BASE + 38), -"Certificate usages field is invalid.") - -ER3(SEC_INTERNAL_ONLY, (SEC_ERROR_BASE + 39), -"**Internal ONLY module**") - -ER3(SEC_ERROR_INVALID_KEY, (SEC_ERROR_BASE + 40), -"The key does not support the requested operation.") - -ER3(SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION, (SEC_ERROR_BASE + 41), -"Certificate contains unknown critical extension.") - -ER3(SEC_ERROR_OLD_CRL, (SEC_ERROR_BASE + 42), -"New CRL is not later than the current one.") - -ER3(SEC_ERROR_NO_EMAIL_CERT, (SEC_ERROR_BASE + 43), -"Not encrypted or signed: you do not yet have an email certificate.") - -ER3(SEC_ERROR_NO_RECIPIENT_CERTS_QUERY, (SEC_ERROR_BASE + 44), -"Not encrypted: you do not have certificates for each of the recipients.") - -ER3(SEC_ERROR_NOT_A_RECIPIENT, (SEC_ERROR_BASE + 45), -"Cannot decrypt: you are not a recipient, or matching certificate and \ -private key not found.") - -ER3(SEC_ERROR_PKCS7_KEYALG_MISMATCH, (SEC_ERROR_BASE + 46), -"Cannot decrypt: key encryption algorithm does not match your certificate.") - -ER3(SEC_ERROR_PKCS7_BAD_SIGNATURE, (SEC_ERROR_BASE + 47), -"Signature verification failed: no signer found, too many signers found, \ -or improper or corrupted data.") - -ER3(SEC_ERROR_UNSUPPORTED_KEYALG, (SEC_ERROR_BASE + 48), -"Unsupported or unknown key algorithm.") - -ER3(SEC_ERROR_DECRYPTION_DISALLOWED, (SEC_ERROR_BASE + 49), -"Cannot decrypt: encrypted using a disallowed algorithm or key size.") - - -/* Fortezza Alerts */ -ER3(XP_SEC_FORTEZZA_BAD_CARD, (SEC_ERROR_BASE + 50), -"Fortezza card has not been properly initialized. \ -Please remove it and return it to your issuer.") - -ER3(XP_SEC_FORTEZZA_NO_CARD, (SEC_ERROR_BASE + 51), -"No Fortezza cards Found") - -ER3(XP_SEC_FORTEZZA_NONE_SELECTED, (SEC_ERROR_BASE + 52), -"No Fortezza card selected") - -ER3(XP_SEC_FORTEZZA_MORE_INFO, (SEC_ERROR_BASE + 53), -"Please select a personality to get more info on") - -ER3(XP_SEC_FORTEZZA_PERSON_NOT_FOUND, (SEC_ERROR_BASE + 54), -"Personality not found") - -ER3(XP_SEC_FORTEZZA_NO_MORE_INFO, (SEC_ERROR_BASE + 55), -"No more information on that Personality") - -ER3(XP_SEC_FORTEZZA_BAD_PIN, (SEC_ERROR_BASE + 56), -"Invalid Pin") - -ER3(XP_SEC_FORTEZZA_PERSON_ERROR, (SEC_ERROR_BASE + 57), -"Couldn't initialize Fortezza personalities.") -/* end fortezza alerts. */ - -ER3(SEC_ERROR_NO_KRL, (SEC_ERROR_BASE + 58), -"No KRL for this site's certificate has been found.") - -ER3(SEC_ERROR_KRL_EXPIRED, (SEC_ERROR_BASE + 59), -"The KRL for this site's certificate has expired.") - -ER3(SEC_ERROR_KRL_BAD_SIGNATURE, (SEC_ERROR_BASE + 60), -"The KRL for this site's certificate has an invalid signature.") - -ER3(SEC_ERROR_REVOKED_KEY, (SEC_ERROR_BASE + 61), -"The key for this site's certificate has been revoked.") - -ER3(SEC_ERROR_KRL_INVALID, (SEC_ERROR_BASE + 62), -"New KRL has an invalid format.") - -ER3(SEC_ERROR_NEED_RANDOM, (SEC_ERROR_BASE + 63), -"security library: need random data.") - -ER3(SEC_ERROR_NO_MODULE, (SEC_ERROR_BASE + 64), -"security library: no security module can perform the requested operation.") - -ER3(SEC_ERROR_NO_TOKEN, (SEC_ERROR_BASE + 65), -"The security card or token does not exist, needs to be initialized, or has been removed.") - -ER3(SEC_ERROR_READ_ONLY, (SEC_ERROR_BASE + 66), -"security library: read-only database.") - -ER3(SEC_ERROR_NO_SLOT_SELECTED, (SEC_ERROR_BASE + 67), -"No slot or token was selected.") - -ER3(SEC_ERROR_CERT_NICKNAME_COLLISION, (SEC_ERROR_BASE + 68), -"A certificate with the same nickname already exists.") - -ER3(SEC_ERROR_KEY_NICKNAME_COLLISION, (SEC_ERROR_BASE + 69), -"A key with the same nickname already exists.") - -ER3(SEC_ERROR_SAFE_NOT_CREATED, (SEC_ERROR_BASE + 70), -"error while creating safe object") - -ER3(SEC_ERROR_BAGGAGE_NOT_CREATED, (SEC_ERROR_BASE + 71), -"error while creating baggage object") - -ER3(XP_JAVA_REMOVE_PRINCIPAL_ERROR, (SEC_ERROR_BASE + 72), -"Couldn't remove the principal") - -ER3(XP_JAVA_DELETE_PRIVILEGE_ERROR, (SEC_ERROR_BASE + 73), -"Couldn't delete the privilege") - -ER3(XP_JAVA_CERT_NOT_EXISTS_ERROR, (SEC_ERROR_BASE + 74), -"This principal doesn't have a certificate") - -ER3(SEC_ERROR_BAD_EXPORT_ALGORITHM, (SEC_ERROR_BASE + 75), -"Required algorithm is not allowed.") - -ER3(SEC_ERROR_EXPORTING_CERTIFICATES, (SEC_ERROR_BASE + 76), -"Error attempting to export certificates.") - -ER3(SEC_ERROR_IMPORTING_CERTIFICATES, (SEC_ERROR_BASE + 77), -"Error attempting to import certificates.") - -ER3(SEC_ERROR_PKCS12_DECODING_PFX, (SEC_ERROR_BASE + 78), -"Unable to import. Decoding error. File not valid.") - -ER3(SEC_ERROR_PKCS12_INVALID_MAC, (SEC_ERROR_BASE + 79), -"Unable to import. Invalid MAC. Incorrect password or corrupt file.") - -ER3(SEC_ERROR_PKCS12_UNSUPPORTED_MAC_ALGORITHM, (SEC_ERROR_BASE + 80), -"Unable to import. MAC algorithm not supported.") - -ER3(SEC_ERROR_PKCS12_UNSUPPORTED_TRANSPORT_MODE,(SEC_ERROR_BASE + 81), -"Unable to import. Only password integrity and privacy modes supported.") - -ER3(SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE, (SEC_ERROR_BASE + 82), -"Unable to import. File structure is corrupt.") - -ER3(SEC_ERROR_PKCS12_UNSUPPORTED_PBE_ALGORITHM, (SEC_ERROR_BASE + 83), -"Unable to import. Encryption algorithm not supported.") - -ER3(SEC_ERROR_PKCS12_UNSUPPORTED_VERSION, (SEC_ERROR_BASE + 84), -"Unable to import. File version not supported.") - -ER3(SEC_ERROR_PKCS12_PRIVACY_PASSWORD_INCORRECT,(SEC_ERROR_BASE + 85), -"Unable to import. Incorrect privacy password.") - -ER3(SEC_ERROR_PKCS12_CERT_COLLISION, (SEC_ERROR_BASE + 86), -"Unable to import. Same nickname already exists in database.") - -ER3(SEC_ERROR_USER_CANCELLED, (SEC_ERROR_BASE + 87), -"The user pressed cancel.") - -ER3(SEC_ERROR_PKCS12_DUPLICATE_DATA, (SEC_ERROR_BASE + 88), -"Not imported, already in database.") - -ER3(SEC_ERROR_MESSAGE_SEND_ABORTED, (SEC_ERROR_BASE + 89), -"Message not sent.") - -ER3(SEC_ERROR_INADEQUATE_KEY_USAGE, (SEC_ERROR_BASE + 90), -"Certificate key usage inadequate for attempted operation.") - -ER3(SEC_ERROR_INADEQUATE_CERT_TYPE, (SEC_ERROR_BASE + 91), -"Certificate type not approved for application.") - -ER3(SEC_ERROR_CERT_ADDR_MISMATCH, (SEC_ERROR_BASE + 92), -"Address in signing certificate does not match address in message headers.") - -ER3(SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY, (SEC_ERROR_BASE + 93), -"Unable to import. Error attempting to import private key.") - -ER3(SEC_ERROR_PKCS12_IMPORTING_CERT_CHAIN, (SEC_ERROR_BASE + 94), -"Unable to import. Error attempting to import certificate chain.") - -ER3(SEC_ERROR_PKCS12_UNABLE_TO_LOCATE_OBJECT_BY_NAME, (SEC_ERROR_BASE + 95), -"Unable to export. Unable to locate certificate or key by nickname.") - -ER3(SEC_ERROR_PKCS12_UNABLE_TO_EXPORT_KEY, (SEC_ERROR_BASE + 96), -"Unable to export. Private Key could not be located and exported.") - -ER3(SEC_ERROR_PKCS12_UNABLE_TO_WRITE, (SEC_ERROR_BASE + 97), -"Unable to export. Unable to write the export file.") - -ER3(SEC_ERROR_PKCS12_UNABLE_TO_READ, (SEC_ERROR_BASE + 98), -"Unable to import. Unable to read the import file.") - -ER3(SEC_ERROR_PKCS12_KEY_DATABASE_NOT_INITIALIZED, (SEC_ERROR_BASE + 99), -"Unable to export. Key database corrupt or deleted.") - -ER3(SEC_ERROR_KEYGEN_FAIL, (SEC_ERROR_BASE + 100), -"Unable to generate public/private key pair.") - -ER3(SEC_ERROR_INVALID_PASSWORD, (SEC_ERROR_BASE + 101), -"Password entered is invalid. Please pick a different one.") - -ER3(SEC_ERROR_RETRY_OLD_PASSWORD, (SEC_ERROR_BASE + 102), -"Old password entered incorrectly. Please try again.") - -ER3(SEC_ERROR_BAD_NICKNAME, (SEC_ERROR_BASE + 103), -"Certificate nickname already in use.") - -ER3(SEC_ERROR_NOT_FORTEZZA_ISSUER, (SEC_ERROR_BASE + 104), -"Peer FORTEZZA chain has a non-FORTEZZA Certificate.") - -/* ER3(SEC_ERROR_UNKNOWN, (SEC_ERROR_BASE + 105), */ - -ER3(SEC_ERROR_JS_INVALID_MODULE_NAME, (SEC_ERROR_BASE + 106), -"Invalid module name.") - -ER3(SEC_ERROR_JS_INVALID_DLL, (SEC_ERROR_BASE + 107), -"Invalid module path/filename") - -ER3(SEC_ERROR_JS_ADD_MOD_FAILURE, (SEC_ERROR_BASE + 108), -"Unable to add module") - -ER3(SEC_ERROR_JS_DEL_MOD_FAILURE, (SEC_ERROR_BASE + 109), -"Unable to delete module") - -ER3(SEC_ERROR_OLD_KRL, (SEC_ERROR_BASE + 110), -"New KRL is not later than the current one.") - -ER3(SEC_ERROR_CKL_CONFLICT, (SEC_ERROR_BASE + 111), -"New CKL has different issuer than current CKL. Delete current CKL.") - -#if 0 /* This was defined AFTER HCL 1.5 was released. */ -ER3(SEC_ERROR_CERT_NOT_IN_NAME_SPACE, (SEC_ERROR_BASE + 112), -"The Certifying Authority for this certifcate is not permitted to issue a \ -certifcate with this name.") -#endif - - - diff --git a/mozilla/directory/c-sdk/ldap/libraries/libssldap/sslerrstrs.h b/mozilla/directory/c-sdk/ldap/libraries/libssldap/sslerrstrs.h deleted file mode 100644 index e9ad864c021..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libssldap/sslerrstrs.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - * 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): - */ -/* - * sslerrstrs.h - map SSL errors to strings (used by errormap.c) - * - */ - -/* - **************************************************************************** - * The code below this point was provided by Nelson Bolyard of the - * Netscape Certificate Server team on 27-March-1998. - * Taken from the file ns/security/cmd/lib/SSLerrs.h on NSS_1_BRANCH. - * Last updated from there: 24-July-1998 by Mark Smith - * - * All of the Directory Server specific changes are enclosed inside - * #ifdef NS_DIRECTORY. - **************************************************************************** - */ - -/* SSL-specific security error codes */ -/* caller must include "sslerr.h" */ - -ER3(SSL_ERROR_EXPORT_ONLY_SERVER, SSL_ERROR_BASE + 0, -"Unable to communicate securely. Peer does not support high-grade encryption.") - -ER3(SSL_ERROR_US_ONLY_SERVER, SSL_ERROR_BASE + 1, -"Unable to communicate securely. Peer requires high-grade encryption which is not supported.") - -ER3(SSL_ERROR_NO_CYPHER_OVERLAP, SSL_ERROR_BASE + 2, -"Cannot communicate securely with peer: no common encryption algorithm(s).") - -ER3(SSL_ERROR_NO_CERTIFICATE, SSL_ERROR_BASE + 3, -"Unable to find the certificate or key necessary for authentication.") - -ER3(SSL_ERROR_BAD_CERTIFICATE, SSL_ERROR_BASE + 4, -"Unable to communicate securely with peer: peers's certificate was rejected.") - -/* unused (SSL_ERROR_BASE + 5),*/ - -ER3(SSL_ERROR_BAD_CLIENT, SSL_ERROR_BASE + 6, -"The server has encountered bad data from the client.") - -ER3(SSL_ERROR_BAD_SERVER, SSL_ERROR_BASE + 7, -"The client has encountered bad data from the server.") - -ER3(SSL_ERROR_UNSUPPORTED_CERTIFICATE_TYPE, SSL_ERROR_BASE + 8, -"Unsupported certificate type.") - -ER3(SSL_ERROR_UNSUPPORTED_VERSION, SSL_ERROR_BASE + 9, -"Peer using unsupported version of security protocol.") - -/* unused (SSL_ERROR_BASE + 10),*/ - -ER3(SSL_ERROR_WRONG_CERTIFICATE, SSL_ERROR_BASE + 11, -"Client authentication failed: private key in key database does not match public key in certificate database.") - -ER3(SSL_ERROR_BAD_CERT_DOMAIN, SSL_ERROR_BASE + 12, -"Unable to communicate securely with peer: requested domain name does not match the server's certificate.") - -/* SSL_ERROR_POST_WARNING (SSL_ERROR_BASE + 13), - defined in sslerr.h -*/ - -ER3(SSL_ERROR_SSL2_DISABLED, (SSL_ERROR_BASE + 14), -"Peer only supports SSL version 2, which is locally disabled.") - - -ER3(SSL_ERROR_BAD_MAC_READ, (SSL_ERROR_BASE + 15), -"SSL received a record with an incorrect Message Authentication Code.") - -ER3(SSL_ERROR_BAD_MAC_ALERT, (SSL_ERROR_BASE + 16), -"SSL peer reports incorrect Message Authentication Code.") - -ER3(SSL_ERROR_BAD_CERT_ALERT, (SSL_ERROR_BASE + 17), -"SSL peer cannot verify your certificate.") - -ER3(SSL_ERROR_REVOKED_CERT_ALERT, (SSL_ERROR_BASE + 18), -"SSL peer rejected your certificate as revoked.") - -ER3(SSL_ERROR_EXPIRED_CERT_ALERT, (SSL_ERROR_BASE + 19), -"SSL peer rejected your certificate as expired.") - -ER3(SSL_ERROR_SSL_DISABLED, (SSL_ERROR_BASE + 20), -"Cannot connect: SSL is disabled.") - -ER3(SSL_ERROR_FORTEZZA_PQG, (SSL_ERROR_BASE + 21), -"Cannot connect: SSL peer is in another FORTEZZA domain.") - - -ER3(SSL_ERROR_UNKNOWN_CIPHER_SUITE , (SSL_ERROR_BASE + 22), -"An unknown SSL cipher suite has been requested.") - -ER3(SSL_ERROR_NO_CIPHERS_SUPPORTED , (SSL_ERROR_BASE + 23), -"No cipher suites are present and enabled in this program.") - -ER3(SSL_ERROR_BAD_BLOCK_PADDING , (SSL_ERROR_BASE + 24), -"SSL received a record with bad block padding.") - -ER3(SSL_ERROR_RX_RECORD_TOO_LONG , (SSL_ERROR_BASE + 25), -"SSL received a record that exceeded the maximum permissible length.") - -ER3(SSL_ERROR_TX_RECORD_TOO_LONG , (SSL_ERROR_BASE + 26), -"SSL attempted to send a record that exceeded the maximum permissible length.") - -/* - * Received a malformed (too long or short or invalid content) SSL handshake. - */ -ER3(SSL_ERROR_RX_MALFORMED_HELLO_REQUEST , (SSL_ERROR_BASE + 27), -"SSL received a malformed Hello Request handshake message.") - -ER3(SSL_ERROR_RX_MALFORMED_CLIENT_HELLO , (SSL_ERROR_BASE + 28), -"SSL received a malformed Client Hello handshake message.") - -ER3(SSL_ERROR_RX_MALFORMED_SERVER_HELLO , (SSL_ERROR_BASE + 29), -"SSL received a malformed Server Hello handshake message.") - -ER3(SSL_ERROR_RX_MALFORMED_CERTIFICATE , (SSL_ERROR_BASE + 30), -"SSL received a malformed Certificate handshake message.") - -ER3(SSL_ERROR_RX_MALFORMED_SERVER_KEY_EXCH , (SSL_ERROR_BASE + 31), -"SSL received a malformed Server Key Exchange handshake message.") - -ER3(SSL_ERROR_RX_MALFORMED_CERT_REQUEST , (SSL_ERROR_BASE + 32), -"SSL received a malformed Certificate Request handshake message.") - -ER3(SSL_ERROR_RX_MALFORMED_HELLO_DONE , (SSL_ERROR_BASE + 33), -"SSL received a malformed Server Hello Done handshake message.") - -ER3(SSL_ERROR_RX_MALFORMED_CERT_VERIFY , (SSL_ERROR_BASE + 34), -"SSL received a malformed Certificate Verify handshake message.") - -ER3(SSL_ERROR_RX_MALFORMED_CLIENT_KEY_EXCH , (SSL_ERROR_BASE + 35), -"SSL received a malformed Client Key Exchange handshake message.") - -ER3(SSL_ERROR_RX_MALFORMED_FINISHED , (SSL_ERROR_BASE + 36), -"SSL received a malformed Finished handshake message.") - -/* - * Received a malformed (too long or short) SSL record. - */ -ER3(SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER , (SSL_ERROR_BASE + 37), -"SSL received a malformed Change Cipher Spec record.") - -ER3(SSL_ERROR_RX_MALFORMED_ALERT , (SSL_ERROR_BASE + 38), -"SSL received a malformed Alert record.") - -ER3(SSL_ERROR_RX_MALFORMED_HANDSHAKE , (SSL_ERROR_BASE + 39), -"SSL received a malformed Handshake record.") - -ER3(SSL_ERROR_RX_MALFORMED_APPLICATION_DATA , (SSL_ERROR_BASE + 40), -"SSL received a malformed Application Data record.") - -/* - * Received an SSL handshake that was inappropriate for the state we're in. - * E.g. Server received message from server, or wrong state in state machine. - */ -ER3(SSL_ERROR_RX_UNEXPECTED_HELLO_REQUEST , (SSL_ERROR_BASE + 41), -"SSL received an unexpected Hello Request handshake message.") - -ER3(SSL_ERROR_RX_UNEXPECTED_CLIENT_HELLO , (SSL_ERROR_BASE + 42), -"SSL received an unexpected Client Hello handshake message.") - -ER3(SSL_ERROR_RX_UNEXPECTED_SERVER_HELLO , (SSL_ERROR_BASE + 43), -"SSL received an unexpected Server Hello handshake message.") - -ER3(SSL_ERROR_RX_UNEXPECTED_CERTIFICATE , (SSL_ERROR_BASE + 44), -"SSL received an unexpected Certificate handshake message.") - -ER3(SSL_ERROR_RX_UNEXPECTED_SERVER_KEY_EXCH , (SSL_ERROR_BASE + 45), -"SSL received an unexpected Server Key Exchange handshake message.") - -ER3(SSL_ERROR_RX_UNEXPECTED_CERT_REQUEST , (SSL_ERROR_BASE + 46), -"SSL received an unexpected Certificate Request handshake message.") - -ER3(SSL_ERROR_RX_UNEXPECTED_HELLO_DONE , (SSL_ERROR_BASE + 47), -"SSL received an unexpected Server Hello Done handshake message.") - -ER3(SSL_ERROR_RX_UNEXPECTED_CERT_VERIFY , (SSL_ERROR_BASE + 48), -"SSL received an unexpected Certificate Verify handshake message.") - -ER3(SSL_ERROR_RX_UNEXPECTED_CLIENT_KEY_EXCH , (SSL_ERROR_BASE + 49), -"SSL received an unexpected Cllient Key Exchange handshake message.") - -ER3(SSL_ERROR_RX_UNEXPECTED_FINISHED , (SSL_ERROR_BASE + 50), -"SSL received an unexpected Finished handshake message.") - -/* - * Received an SSL record that was inappropriate for the state we're in. - */ -ER3(SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER , (SSL_ERROR_BASE + 51), -"SSL received an unexpected Change Cipher Spec record.") - -ER3(SSL_ERROR_RX_UNEXPECTED_ALERT , (SSL_ERROR_BASE + 52), -"SSL received an unexpected Alert record.") - -ER3(SSL_ERROR_RX_UNEXPECTED_HANDSHAKE , (SSL_ERROR_BASE + 53), -"SSL received an unexpected Handshake record.") - -ER3(SSL_ERROR_RX_UNEXPECTED_APPLICATION_DATA, (SSL_ERROR_BASE + 54), -"SSL received an unexpected Application Data record.") - -/* - * Received record/message with unknown discriminant. - */ -ER3(SSL_ERROR_RX_UNKNOWN_RECORD_TYPE , (SSL_ERROR_BASE + 55), -"SSL received a record with an unknown content type.") - -ER3(SSL_ERROR_RX_UNKNOWN_HANDSHAKE , (SSL_ERROR_BASE + 56), -"SSL received a handshake message with an unknown message type.") - -ER3(SSL_ERROR_RX_UNKNOWN_ALERT , (SSL_ERROR_BASE + 57), -"SSL received an alert record with an unknown alert description.") - -/* - * Received an alert reporting what we did wrong. (more alerts above) - */ -ER3(SSL_ERROR_CLOSE_NOTIFY_ALERT , (SSL_ERROR_BASE + 58), -"SSL peer has closed this connection.") - -ER3(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT , (SSL_ERROR_BASE + 59), -"SSL peer was not expecting a handshake message it received.") - -ER3(SSL_ERROR_DECOMPRESSION_FAILURE_ALERT , (SSL_ERROR_BASE + 60), -"SSL peer was unable to succesfully decompress an SSL record it received.") - -ER3(SSL_ERROR_HANDSHAKE_FAILURE_ALERT , (SSL_ERROR_BASE + 61), -"SSL peer was unable to negotiate an acceptable set of security parameters.") - -ER3(SSL_ERROR_ILLEGAL_PARAMETER_ALERT , (SSL_ERROR_BASE + 62), -"SSL peer rejected a handshake message for unacceptable content.") - -ER3(SSL_ERROR_UNSUPPORTED_CERT_ALERT , (SSL_ERROR_BASE + 63), -"SSL peer does not support certificates of the type it received.") - -ER3(SSL_ERROR_CERTIFICATE_UNKNOWN_ALERT , (SSL_ERROR_BASE + 64), -"SSL peer had some unspecified issue with the certificate it received.") - - -ER3(SSL_ERROR_GENERATE_RANDOM_FAILURE , (SSL_ERROR_BASE + 65), -"SSL experienced a failure of its random number generator.") - -ER3(SSL_ERROR_SIGN_HASHES_FAILURE , (SSL_ERROR_BASE + 66), -"Unable to digitally sign data required to verify your certificate.") - -ER3(SSL_ERROR_EXTRACT_PUBLIC_KEY_FAILURE , (SSL_ERROR_BASE + 67), -"SSL was unable to extract the public key from the peer's certificate.") - -ER3(SSL_ERROR_SERVER_KEY_EXCHANGE_FAILURE , (SSL_ERROR_BASE + 68), -"Unspecified failure while processing SSL Server Key Exchange handshake.") - -ER3(SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE , (SSL_ERROR_BASE + 69), -"Unspecified failure while processing SSL Client Key Exchange handshake.") - -ER3(SSL_ERROR_ENCRYPTION_FAILURE , (SSL_ERROR_BASE + 70), -"Bulk data encryption algorithm failed in selected cipher suite.") - -ER3(SSL_ERROR_DECRYPTION_FAILURE , (SSL_ERROR_BASE + 71), -"Bulk data decryption algorithm failed in selected cipher suite.") - -ER3(SSL_ERROR_SOCKET_WRITE_FAILURE , (SSL_ERROR_BASE + 72), -"Attempt to write encrypted data to underlying socket failed.") - -ER3(SSL_ERROR_MD5_DIGEST_FAILURE , (SSL_ERROR_BASE + 73), -"MD5 digest function failed.") - -ER3(SSL_ERROR_SHA_DIGEST_FAILURE , (SSL_ERROR_BASE + 74), -"SHA-1 digest function failed.") - -ER3(SSL_ERROR_MAC_COMPUTATION_FAILURE , (SSL_ERROR_BASE + 75), -"MAC computation failed.") - -ER3(SSL_ERROR_SYM_KEY_CONTEXT_FAILURE , (SSL_ERROR_BASE + 76), -"Failure to create Symmetric Key context.") - -ER3(SSL_ERROR_SYM_KEY_UNWRAP_FAILURE , (SSL_ERROR_BASE + 77), -"Failure to unwrap the Symmetric key in Client Key Exchange message.") - -ER3(SSL_ERROR_PUB_KEY_SIZE_LIMIT_EXCEEDED , (SSL_ERROR_BASE + 78), -"SSL Server attempted to use domestic-grade public key with export cipher suite.") - -ER3(SSL_ERROR_IV_PARAM_FAILURE , (SSL_ERROR_BASE + 79), -"PKCS11 code failed to translate an IV into a param.") - -ER3(SSL_ERROR_INIT_CIPHER_SUITE_FAILURE , (SSL_ERROR_BASE + 80), -"Failed to initialize the selected cipher suite.") - -ER3(SSL_ERROR_SESSION_KEY_GEN_FAILURE , (SSL_ERROR_BASE + 81), -"Client failed to generate session keys for SSL session.") - -ER3(SSL_ERROR_NO_SERVER_KEY_FOR_ALG , (SSL_ERROR_BASE + 82), -"Server has no key for the attempted key exchange algorithm.") - -ER3(SSL_ERROR_TOKEN_INSERTION_REMOVAL , (SSL_ERROR_BASE + 83), -"PKCS#11 token was inserted or removed while operation was in progress.") - -ER3(SSL_ERROR_TOKEN_SLOT_NOT_FOUND , (SSL_ERROR_BASE + 84), -"No PKCS#11 token could be found to do a required operation.") - -ER3(SSL_ERROR_NO_COMPRESSION_OVERLAP , (SSL_ERROR_BASE + 85), -"Cannot communicate securely with peer: no common compression algorithm(s).") - -ER3(SSL_ERROR_HANDSHAKE_NOT_COMPLETED , (SSL_ERROR_BASE + 86), -"Cannot initiate another SSL handshake until current handshake is complete.") - -ER3(SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE , (SSL_ERROR_BASE + 87), -"Received incorrect handshakes hash values from peer.") - -ER3(SSL_ERROR_CERT_KEA_MISMATCH , (SSL_ERROR_BASE + 88), -"The certificate provided cannot be used with the selected key exchange algorithm.") diff --git a/mozilla/directory/c-sdk/ldap/libraries/libutil/Makefile b/mozilla/directory/c-sdk/ldap/libraries/libutil/Makefile deleted file mode 100755 index 9ae50a9f0d2..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libutil/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# -# GNU Makefile for libutil -# - -LDAP_SRC = ../.. -MCOM_ROOT = ../../../.. - -NOSTDCLEAN=true # don't let nsconfig.mk define target clean -NOSTDSTRIP=true # don't let nsconfig.mk define target strip -NSPR20=true # probably should be defined somewhere else (not sure where) - -OBJDEST = $(OBJDIR)/lib/libutil -LIBDIR = $(LDAP_LIBDIR) - -include $(MCOM_ROOT)/c-sdk/nsdefs.mk -include $(MCOM_ROOT)/c-sdk/nsconfig.mk -include $(LDAP_SRC)/nsldap.mk - -# -# crypt.c and crypt_util.c now come in the liblcache dll -# ntdebug.c currently not used -# -#if ServerBuild XXXmcs? how to switch on this? -#LIBUTIL_OBJS= getopt.o ntevent.o ntgetpassword.o \ -# ntreg.o ntstubs.o -#ifeq ($(ARCH), WINNT) -#LIBUTIL_OBJS += crypt.o crypt_util.o -#endif -# -#else -# SDK builds only need getopt! -LIBUTIL_OBJS= getopt.o -#endif - -OBJS = $(addprefix $(OBJDEST)/, $(LIBUTIL_OBJS)) - -LIBUTIL= $(addprefix $(LIBDIR)/, libutil.$(LIB_SUFFIX)) - -INCLUDES += -I$(LDAP_SRC)/servers/slapd -I$(OBJDIR)/include - -SLAPDMESSAGES_H=$(MCOM_ROOT)/c-sdk/ldap/include/ntslapdmessages.h - -ifeq ($(LDAP_NO_LIBLCACHE),1) -CFLAGS+=-DNO_LIBLCACHE -endif - -clientSDK: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBUTIL) - -all: $(OBJDEST) $(SLAPDMESSAGES_H) $(LIBDIR) $(OBJS) $(LIBUTIL) - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBUTIL): $(OBJS) - $(LINK_LIB) - -$(SLAPDMESSAGES_H): - @echo target: $@ - cd $(MCOM_ROOT)/c-sdk/ldap/servers/slapd/ntmsgdll; $(MAKE) $(MFLAGS) - -veryclean: clean - -cleanSDK: clean - -clean: - $(RM) $(OBJS) - $(RM) $(LIBUTIL) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - diff --git a/mozilla/directory/c-sdk/ldap/libraries/libutil/Makefile.client b/mozilla/directory/c-sdk/ldap/libraries/libutil/Makefile.client deleted file mode 100644 index dd69115a521..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libutil/Makefile.client +++ /dev/null @@ -1,96 +0,0 @@ -# -# 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 = ../../../../.. -NS_DEPTH = ../../../.. -LDAP_SRC = ../.. -NSCP_DISTDIR = ../../../../../dist -NSPR_TREE = ../../.. -MOD_DEPTH = ../../.. - -include $(NSPR_TREE)/config/rules.mk -include ../../../build.mk - -SRCS = getopt.c - -ifeq ($(OS_ARCH), WINNT) -REALOBJS = $(SRCS:.c=.obj) -else -REALOBJS = $(SRCS:.c=.o) -endif - -UTILOBJDEST = $(OBJDIR_NAME) -OBJS = $(addprefix $(UTILOBJDEST)/, $(REALOBJS)) - -HDIR = $(LDAP_SRC)/include - -ifeq ($(OS_ARCH), WINNT) -LIBUTIL = $(addprefix $(UTILOBJDEST)/, $(UTIL_LIBNAME).$(LIB_SUFFIX)) -else -LIBUTIL = $(addprefix $(UTILOBJDEST)/, \ - lib$(UTIL_LIBNAME).$(LIB_SUFFIX)) -endif - -INSTALLDIR = $(DEPTH)/dist/$(OBJDIR_NAME) - -LOCAL_INCLUDES = -I$(PUBLIC)/nspr -INCLUDES += -I$(HDIR) -I$(INSTALLDIR)/include -I../../../../../dist/include -DEFINES += $(DEFS) - -PLATFORMCFLAGS = -DUSE_WAITPID -DNEEDPROTOS -PLATFORMLIBS = -THREADS = -THREADSLIB = - -########################################################################### - -versiont.c: Makefile.client Version.c - @$(RM) $@ - @(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \ - h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \ - -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ - -e "s|%VERSION%|$${v}|" \ - < Version.c > $@) - -all:: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBUTIL) - -$(LIBDIR): - $(MKDIR) $(LIBDIR) - -$(LIBUTIL): $(OBJS) $(LIBDIR) - @echo ======= making $(LIBUTIL) -ifdef SO_FILES_TO_REMOVE - -$(RM) $(SO_FILES_TO_REMOVE) -endif - $(LINK_LIB) - -veryclean:: clean - -clean:: - $(RM) $(OBJS) $(LIBUTIL) - $(RM) -r $(UTILOBJDEST) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - -install:: $(LIBUTIL) - $(INSTALL) -m 444 $(LIBUTIL) $(INSTALLDIR)/lib diff --git a/mozilla/directory/c-sdk/ldap/libraries/libutil/getopt.c b/mozilla/directory/c-sdk/ldap/libraries/libutil/getopt.c deleted file mode 100755 index 6295918d8fb..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/libutil/getopt.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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) 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that: (1) source distributions retain this entire copyright - * notice and comment, and (2) distributions including binaries display - * the following acknowledgement: ``This product includes software - * developed by the University of California, Berkeley and its contributors'' - * in the documentation or other materials provided with the distribution - * and in all advertising materials mentioning features or use of this - * software. Neither the name of the University nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifdef _WINDOWS - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getopt.c 4.12 (Berkeley) 6/1/90"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include "lber.h" -#define index strchr -#define rindex strrchr - -/* - * get option letter from argument vector - */ -int opterr = 1, /* if error message should be printed */ - optind = 1, /* index into parent argv vector */ - optopt; /* character checked for validity */ -char *optarg; /* argument associated with option */ - -#define BADCH (int)'?' -#define EMSG "" - -int getopt(int nargc, char *const *nargv, const char *ostr) -{ - static char *place = EMSG; /* option letter processing */ - register char *oli; /* option letter list index */ - char *p; - - if (!*place) { /* update scanning pointer */ - if (optind >= nargc || *(place = nargv[optind]) != '-') { - place = EMSG; - return(EOF); - } - if (place[1] && *++place == '-') { /* found "--" */ - ++optind; - place = EMSG; - return(EOF); - } - } /* option letter okay? */ - if ((optopt = (int)*place++) == (int)':' || - !(oli = index(ostr, optopt))) { - /* - * if the user didn't specify '-' as an option, - * assume it means EOF. - */ - if (optopt == (int)'-') - return(EOF); - if (!*place) - ++optind; - if (opterr) { - if (!(p = rindex(*nargv, '/'))) - p = *nargv; - else - ++p; - (void)fprintf(stderr, "%s: illegal option -- %c\n", - p, optopt); - } - return(BADCH); - } - if (*++oli != ':') { /* don't need argument */ - optarg = NULL; - if (!*place) - ++optind; - } - else { /* need an argument */ - if (*place) /* no white space */ - optarg = place; - else if (nargc <= ++optind) { /* no arg */ - place = EMSG; - if (!(p = rindex(*nargv, '/'))) - p = *nargv; - else - ++p; - if (opterr) - (void)fprintf(stderr, - "%s: option requires an argument -- %c\n", - p, optopt); - return(BADCH); - } - else /* white space */ - optarg = nargv[optind]; - place = EMSG; - ++optind; - } - return(optopt); /* dump back option letter */ -} - -#endif diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClient.exp b/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClient.exp deleted file mode 100644 index fe3698ec814..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClient.exp +++ /dev/null @@ -1,264 +0,0 @@ -# -# exports list (generated by genexports.pl) -# -ldap_abandon -ldap_add -ldap_unbind - -# ldap_enable_cache -# ldap_disable_cache -# ldap_destroy_cache -# ldap_flush_cache -# ldap_uncache_entry - -ldap_compare -ldap_delete -ldap_result2error -ldap_err2string -ldap_modify -ldap_modrdn -ldap_open -ldap_first_entry -ldap_next_entry -ldap_get_dn -ldap_dn2ufn -ldap_first_attribute -ldap_next_attribute -ldap_get_values -ldap_get_values_len -ldap_count_entries -ldap_count_values -ldap_value_free -ldap_explode_dn -ldap_result -ldap_msgfree -ldap_search -ldap_add_s -ldap_bind_s -ldap_unbind_s -ldap_delete_s -ldap_modify_s -ldap_modrdn_s -ldap_search_s -ldap_search_st -ldap_compare_s -ldap_ufn_search_c -ldap_ufn_search_s -ldap_init_getfilter -ldap_getfilter_free -ldap_getfirstfilter -ldap_getnextfilter -ldap_simple_bind -ldap_simple_bind_s -ldap_bind -ldap_friendly_name -ldap_free_friendlymap -ldap_ufn_search_ct - -# ldap_set_cache_options -# ldap_uncache_request - -ldap_modrdn2 -ldap_modrdn2_s -ldap_ufn_setfilter -ldap_ufn_setprefix -ldap_ufn_timeout -ldap_init_getfilter_buf -ldap_setfilteraffixes -ldap_sort_entries -ldap_sort_values -ldap_sort_strcasecmp -ldap_count_values_len -ldap_name2template -ldap_value_free_len - -# manually comment and uncomment these five as necessary -# ldap_kerberos_bind1 -# ldap_kerberos_bind2 -# ldap_kerberos_bind_s -# ldap_kerberos_bind1_s -# ldap_kerberos_bind2_s - -ldap_init -ldap_is_dns_dn -ldap_explode_dns -ldap_mods_free - -ldap_is_ldap_url -ldap_free_urldesc -ldap_url_parse -ldap_url_search -ldap_url_search_s -ldap_url_search_st -ldap_set_rebind_proc -ber_skip_tag -ber_peek_tag -ber_get_int -ber_get_stringb -ber_get_stringa -ber_get_stringal -ber_get_bitstringa -ber_get_null -ber_get_boolean -ber_first_element -ber_next_element -ber_scanf -ber_bvfree -ber_bvecfree -ber_put_int -ber_put_ostring -ber_put_string -ber_put_bitstring -ber_put_null -ber_put_boolean -ber_start_seq -ber_start_set -ber_put_seq -ber_put_set -ber_printf -ber_read -ber_write -ber_free -ber_flush -ber_alloc -ber_dup -ber_get_next -ber_get_tag -ber_put_enum -der_alloc -ber_alloc_t -ber_bvdup -ber_init_w_nullchar -ber_reset -ber_get_option -ber_set_option -ber_sockbuf_alloc -ber_sockbuf_get_option -ber_sockbuf_set_option -ber_init -ber_flatten -ber_special_alloc -ber_special_free -ber_get_next_buffer -ber_err_print -ber_sockbuf_free - -ldap_memfree -ldap_ber_free - -ldap_init_searchprefs -ldap_init_searchprefs_buf -ldap_free_searchprefs -ldap_first_searchobj -ldap_next_searchobj -ldap_build_filter - -ldap_init_templates -ldap_init_templates_buf -ldap_free_templates -ldap_first_disptmpl -ldap_next_disptmpl -ldap_oc2template -ldap_tmplattrs -ldap_first_tmplrow -ldap_next_tmplrow -ldap_first_tmplcol -ldap_next_tmplcol -ldap_entry2text_search -ldap_entry2text -ldap_vals2text -ldap_entry2html -ldap_entry2html_search -ldap_vals2html -ldap_tmplerr2string -ldap_set_option -ldap_get_option -ldap_charray_merge -ldap_get_lderrno -ldap_set_lderrno -ldap_perror -ldap_set_filter_additions -ldap_create_filter -ldap_version -ldap_multisort_entries -ldap_msgid -ldap_explode_rdn -ldap_msgtype -ldap_cache_flush -ldap_str2charray -ldap_charray_add -ldap_charray_dup -ldap_charray_free - -# Windows ordinals 450-469 are reserved for SSL routines - -ldap_charray_inlist -ldap_charray_position -ldap_rename -ldap_rename_s -ldap_utf8len -ldap_utf8next -ldap_utf8prev -ldap_utf8copy -ldap_utf8characters -ldap_utf8strtok_r -ldap_utf8isalnum -ldap_utf8isalpha -ldap_utf8isdigit -ldap_utf8isxdigit -ldap_utf8isspace -ldap_control_free -ldap_controls_free -ldap_sasl_bind -ldap_sasl_bind_s -ldap_parse_sasl_bind_result -# LDAPv3 simple paging controls are not supported by Netscape at this time. -# 490 ldap_create_page_control -# 491 ldap_parse_page_control -ldap_create_sort_control -ldap_parse_sort_control -# an LDAPv3 language control was proposed but then retracted. -# 494 ldap_create_language_control -ldap_get_lang_values -ldap_get_lang_values_len -ldap_free_sort_keylist -ldap_create_sort_keylist -ldap_utf8getcc -ldap_get_entry_controls -ldap_create_persistentsearch_control -ldap_parse_entrychange_control -ldap_parse_result -ldap_parse_extended_result -ldap_parse_reference -ldap_abandon_ext -ldap_add_ext -ldap_add_ext_s -ldap_modify_ext -ldap_modify_ext_s -ldap_first_message -ldap_next_message -ldap_compare_ext -ldap_compare_ext_s -ldap_delete_ext -ldap_delete_ext_s -ldap_search_ext -ldap_search_ext_s -ldap_extended_operation -ldap_extended_operation_s -ldap_first_reference -ldap_next_reference -ldap_count_references -ldap_count_messages -ldap_create_virtuallist_control -ldap_parse_virtuallist_control -ldap_create_proxyauth_control -ldap_unbind_ext -ldap_memcache_init -ldap_memcache_set -ldap_memcache_get -ldap_memcache_flush -ldap_memcache_destroy -ldap_memcache_update -ldap_keysort_entries -# -# end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClient.mcp b/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClient.mcp deleted file mode 100644 index c0d7abf05a4..00000000000 Binary files a/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClient.mcp and /dev/null differ diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClientDebugDefs.h b/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClientDebugDefs.h deleted file mode 100644 index 500cdf5b92f..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClientDebugDefs.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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): - */ -#define NEEDPROTOS -#define NEEDGETOPT -#define FILTERFILE "ldapfilter.conf" -#define TEMPLATEFILE "ldaptemplates.conf" - -#define MOZILLA_CLIENT 1 -#define NET_SSL 1 - -#ifdef __powerc -#define SUPPORT_OPENTRANSPORT 1 -#define OTUNIXERRORS 1 -#endif - -#ifndef macintosh -#define macintosh -#endif - -#define XP_MAC -#define DEBUG 1 - -#include "IDE_Options.h" -// #define NO_USERINTERFACE -// #define LDAP_DEBUG diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClientDefs.h b/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClientDefs.h deleted file mode 100644 index 1e298f5dd4e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/LDAPClientDefs.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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): - */ -#define NEEDPROTOS -#define NEEDGETOPT -#define FILTERFILE "ldapfilter.conf" -#define TEMPLATEFILE "ldaptemplates.conf" - -#define MOZILLA_CLIENT 1 -#define NET_SSL 1 - -#ifdef __powerc -#define SUPPORT_OPENTRANSPORT 1 -#define OTUNIXERRORS 1 -#endif - -#ifndef macintosh -#define macintosh -#endif - -#define XP_MAC - -#include "IDE_Options.h" -// #define NO_USERINTERFACE -// #define LDAP_DEBUG diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/README b/mozilla/directory/c-sdk/ldap/libraries/macintosh/README deleted file mode 100644 index ac5ceb9cdb7..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/README +++ /dev/null @@ -1,67 +0,0 @@ -LDAP Macintosh README - -The lber and ldap client libraries have been ported to Macintosh. -Build testing was originally done with Think C 5.0.4 and MPW 3.2, both -running under System 7.1. Recently, it has been built using Metrowerks -CodeWarrior 8.0 and Symantec C++ 7.0.3. The libaries have been tested -under System 7.0, 7.1, and 7.5, and are believed to run under any -System later than 6.0. None of the LDAP clients included in the -distribution have been tested on the Mac. - -MAKING THE DISTRIBUTION -The instructions included here are for Symantec C 7.0.4, but the steps -are very similar for the other environments. - -To build the ldap and lber libraries (easiest to do as one project): - - 1) create a new project that contains the following files: - libraries/liblber/decode.c - libraries/liblber/encode.c - libraries/liblber/io.c - libraries/macintosh/tcp/dnr.c - libraries/macintosh/tcp/tcp.c - libraries/macintosh/macos-ip.c - libraries/macintosh/strings.c - plus all the .c files in libraries/libldap/, except test.c, - tmpltest.c, and os-ip.c. - - 2) put all of the .h files in include/, libraries/macintosh/, - libraries/libldap and libraries/macintosh/tcp somewhere - in the same folder where the project is located. - - 3) Add the MacTraps, MacTraps2, Unix, and ANSI-small libraries - (included with Symantec/ThinkC) to the project. - - 3) Bring up the Edit menu "Options..." dialog and set the following: - Language Settings: - Strict Prototype Enforcement/Require Prototypes - Prefix: - #define MACOS - #define NEEDPROTOS - #define NEEDGETOPT - #define NO_USERINTERFACE - #define FILTERFILE "ldapfilter.conf" - #define TEMPLATEFILE "ldaptemplates.conf" - - If you want to build a version of the library that does - not have any global variables (such as for inclusion in a - driver or other code module), add a "#define NO_GLOBALS" - to the Prefix. The only catch is that the tcp/dnr.c - file needs changes to remove the global variables. - - If you want support for referrals (optionally enabled - for each LDAP connection), add '#define LDAP_REFERRALS' - to the prefix list. This is recommended. - - 4) Compile the project (Bring Up To Date under the Project menu) - - 5) If you would like to use the libldap/test.c program to test the - library in an ugly console window, you will need to add the - test.c file itself and the full ANSI library (instead of - ANSI-small) to the project, and don't define NO_USERINTERFACE. - -BUG REPORTING - - Bug reports should be sent to bug-ldap@terminator.cc.umich.edu. - -README Last updated 11 April 1996 by Mark Smith diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/getopt.c b/mozilla/directory/c-sdk/ldap/libraries/macintosh/getopt.c deleted file mode 100644 index 4d7645cb7a0..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/getopt.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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) 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that: (1) source distributions retain this entire copyright - * notice and comment, and (2) distributions including binaries display - * the following acknowledgement: ``This product includes software - * developed by the University of California, Berkeley and its contributors'' - * in the documentation or other materials provided with the distribution - * and in all advertising materials mentioning features or use of this - * software. Neither the name of the University nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getopt.c 4.12 (Berkeley) 6/1/90"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include "ldap-macos.h" -#define index strchr -#define rindex strrchr - -/* - * get option letter from argument vector - */ -int opterr = 1, /* if error message should be printed */ - optind = 1, /* index into parent argv vector */ - optopt; /* character checked for validity */ -char *optarg; /* argument associated with option */ - -#define BADCH (int)'?' -#define EMSG "" - -getopt(int nargc, char **nargv, char *ostr) -{ - static char *place = EMSG; /* option letter processing */ - register char *oli; /* option letter list index */ - char *p; - - if (!*place) { /* update scanning pointer */ - if (optind >= nargc || *(place = nargv[optind]) != '-') { - place = EMSG; - return(EOF); - } - if (place[1] && *++place == '-') { /* found "--" */ - ++optind; - place = EMSG; - return(EOF); - } - } /* option letter okay? */ - if ((optopt = (int)*place++) == (int)':' || - !(oli = index(ostr, optopt))) { - /* - * if the user didn't specify '-' as an option, - * assume it means EOF. - */ - if (optopt == (int)'-') - return(EOF); - if (!*place) - ++optind; - if (opterr) { - if (!(p = rindex(*nargv, '/'))) - p = *nargv; - else - ++p; - (void)fprintf(stderr, "%s: illegal option -- %c\n", - p, optopt); - } - return(BADCH); - } - if (*++oli != ':') { /* don't need argument */ - optarg = NULL; - if (!*place) - ++optind; - } - else { /* need an argument */ - if (*place) /* no white space */ - optarg = place; - else if (nargc <= ++optind) { /* no arg */ - place = EMSG; - if (!(p = rindex(*nargv, '/'))) - p = *nargv; - else - ++p; - if (opterr) - (void)fprintf(stderr, - "%s: option requires an argument -- %c\n", - p, optopt); - return(BADCH); - } - else /* white space */ - optarg = nargv[optind]; - place = EMSG; - ++optind; - } - return(optopt); /* dump back option letter */ -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/kerberos-macos.c b/mozilla/directory/c-sdk/ldap/libraries/macintosh/kerberos-macos.c deleted file mode 100644 index 2a3a085d291..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/kerberos-macos.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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) 1992, 1994 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * kerberos-macos.c - */ - -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1994 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif - -#include "lber.h" -#include "ldap.h" - -#ifdef KERBEROS - -#include -#include -#include -#ifdef THINK_C -#include -#else /* THINK_C */ -#include -#endif /* THINK_C */ -#ifdef AUTHMAN -#include -#include -#include "authLibrary.h" -#include "ldap-int.h" - -/* - * get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap. - */ - -/* ARGSUSED */ -char * -get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len ) -{ - static short authman_refnum = 0; - char *cred, ticket[ MAX_KTXT_LEN ]; - short version, ticketlen, err; - Str255 svcps, instps; - - /* - * make sure RJC's Authentication Manager 2.0 or better is available - */ - if ( authman_refnum == 0 && (( err = openAuthMan( &authman_refnum, &version )) != noErr || version < 2 )) { - authman_refnum = 0; - ld->ld_errno = LDAP_AUTH_UNKNOWN; - return( NULL ); - } - - strcpy( (char *)svcps, service ); - CtoPstr( (char *)svcps ); - strcpy( (char *)instps, ld->ld_defconn->lconn_krbinstance ); - - CtoPstr( (char *)instps ); - if (( err = getV4Ticket( authman_refnum, &ticket, &ticketlen, &svcps, &instps, - NULL, INFINITE_LIFETIME, 1 )) != noErr ) { - ld->ld_errno = ( err == userCanceledErr ) ? - LDAP_USER_CANCELLED : LDAP_INVALID_CREDENTIALS; - return( NULL ); - } - - if (( cred = malloc( ticketlen )) == NULL ) { - ld->ld_errno = LDAP_NO_MEMORY; - return( NULL ); - } - - *len = ticketlen; - memcpy( cred, (char *)ticket, ticketlen ); - return( cred ); -} - -#endif -#endif diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/ldap-macos-defs.h b/mozilla/directory/c-sdk/ldap/libraries/macintosh/ldap-macos-defs.h deleted file mode 100644 index 4f27d5d64fb..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/ldap-macos-defs.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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): - */ -#define NEEDPROTOS -#define NEEDGETOPT -#define SUPPORT_OPENTRANSPORT 1 -#define OTUNIXERRORS 1 -#define NET_SSL 1 -// #define NO_USERINTERFACE -// #define LDAP_DEBUG diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/ldap-macos.h b/mozilla/directory/c-sdk/ldap/libraries/macintosh/ldap-macos.h deleted file mode 100644 index 8beed69bbad..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/ldap-macos.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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): - */ -/* - * macos.h: bridge unix and Mac for LBER/LDAP - */ -#ifndef __LDAP_MACOS_H__ -#define __LDAP_MACOS_H__ -#if 0 - /*------------------*/ - #define ntohl( l ) (l) - #define htonl( l ) (l) - #define ntohs( s ) (s) - #define htons( s ) (s) - /*------------------*/ -#endif - -#ifdef NO_GLOBALS - -#ifdef macintosh /* IUMagIDString declared in TextUtils.h under MPW */ -#include -#else /* macintosh */ /* IUMagIDString declared in Packages.h under ThinkC */ -#include -#endif /* macintosh */ - -#define strcasecmp( s1, s2 ) IUMagIDString( s1, s2, strlen( s1 ), \ - strlen( s2 )) -#else /* NO_GLOBALS */ -int strcasecmp( const char *s1, const char *s2 ); -int strncasecmp( const char *s1, const char *s2, const long n ); -#endif NO_GLOBALS - -#include /* to get BlockMove() */ - -char *strdup( const char *s ); - -#ifndef isascii -#define isascii(c) ((unsigned)(c)<=0177) /* for those who don't have this in ctype.h */ -#endif isascii - -/* - * if we aren't supporting OpenTransport, we need to define some standard "errno" values here - * the values should match those in OpenTransport.h - */ -#if !defined( SUPPORT_OPENTRANSPORT ) -#define EHOSTUNREACH 65 /* No route to host */ -#define EAGAIN 11 /* Resource temporarily unavailable */ -#define EWOULDBLOCK 35 /* ditto */ -#endif - -int getopt(int nargc, char **nargv, char *ostr); - -#include -#include - -#include "macsocket.h" -#include "tcp.h" -#if 0 - /*------------------*/ - #ifndef AF_INET - /* these next few things are defined only for use by the LDAP socket I/O function callbacks */ - #define AF_INET 2 - #define SOCK_STREAM 1 - struct in_addr { - unsigned long s_addr; - }; - struct sockaddr_in { - short sin_family; - unsigned short sin_port; - struct in_addr sin_addr; - char sin_zero[8]; - }; - #endif - /*------------------*/ -#endif - - -#endif /* __LDAP_MACOS_H__ */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/libldap-PPC.r b/mozilla/directory/c-sdk/ldap/libraries/macintosh/libldap-PPC.r deleted file mode 100644 index 55d79a2cd13..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/libldap-PPC.r +++ /dev/null @@ -1,10 +0,0 @@ -/* - * 'vers' resource for PPC LDAP shared library - */ - -data 'vers' (1) { - $"0300 6001 0000 0533 2E30 6231 2D76 332E" /* ..`....3.0b1-v3. */ - $"3062 3120 A520 A920 3139 3938 204E 6574" /* 0b1 ¥ © 1998 Net */ - $"7363 6170 6520 436F 6D6D 756E 6963 6174" /* scape Communicat */ - $"696F 6E73 2043 6F72 702E" /* ions Corp. */ -}; \ No newline at end of file diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/macos-ip.c b/mozilla/directory/c-sdk/ldap/libraries/macintosh/macos-ip.c deleted file mode 100644 index 83a421bebff..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/macos-ip.c +++ /dev/null @@ -1,508 +0,0 @@ -/* - * 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) 1995 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * macos-ip.c -- Macintosh platform-specific TCP & UDP related code - */ - -#ifndef lint -static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif - -#include -#include -#include -#include -#include "ldap-int.h" - - -int -nsldapi_connect_to_host( LDAP *ld, Sockbuf *sb, char *host, unsigned long address, - int port, int async, int secure ) -/* - * if host == NULL, connect using address - * "address" and "port" must be in network byte order - * zero is returned upon success, -1 if fatal error, -2 EINPROGRESS - * if -1 is returned, ld_errno is set - * async is only used ifndef NO_REFERRALS (non-0 means don't wait for connect) - * XXX async is not used yet! - */ -{ - void *tcps; - short i; - int err; -#ifdef SUPPORT_OPENTRANSPORT - InetHostInfo hi; -#else /* SUPPORT_OPENTRANSPORT */ - struct hostInfo hi; -#endif /* SUPPORT_OPENTRANSPORT */ - - LDAPDebug( LDAP_DEBUG_TRACE, "connect_to_host: %s:%d\n", - ( host == NULL ) ? "(by address)" : host, ntohs( port ), 0 ); - - /* Initialize OpenTransport, or find out from the host app whether it is installed */ - (void)tcp_init(); - - if ( host != NULL && gethostinfobyname( host, &hi ) != noErr ) { - LDAP_SET_LDERRNO( ld, LDAP_CONNECT_ERROR, NULL, NULL ); - return( -1 ); - } - - if ( ld->ld_socket_fn == NULL ) { - tcps = tcpopen( NULL, TCP_BUFSIZ ); - } else { - tcps = ld->ld_socket_fn( AF_INET, SOCK_STREAM, 0 ); - } - - if ( tcps == NULL ) { - LDAP_SET_LDERRNO( ld, LDAP_LOCAL_ERROR, NULL, NULL ); - return( -1 ); - } - - if ( secure && ld->ld_ssl_enable_fn( tcps ) < 0 ) { - if ( ld->ld_close_fn == NULL ) { - tcpclose( (tcpstream *)tcps ); - } else { - ld->ld_close_fn( tcps ); - } - LDAP_SET_LDERRNO( ld, LDAP_LOCAL_ERROR, NULL, NULL ); - return( -1 ); - } - -#ifdef SUPPORT_OPENTRANSPORT - for ( i = 0; host == NULL || hi.addrs[ i ] != 0; ++i ) { - if ( host != NULL ) { - SAFEMEMCPY( (char *)&address, (char *)&hi.addrs[ i ], sizeof( long )); - } -#else /* SUPPORT_OPENTRANSPORT */ - for ( i = 0; host == NULL || hi.addr[ i ] != 0; ++i ) { - if ( host != NULL ) { - SAFEMEMCPY( (char *)&address, (char *)&hi.addr[ i ], sizeof( long )); - } -#endif /* SUPPORT_OPENTRANSPORT */ - - - if ( ld->ld_connect_fn == NULL ) { - if ( tcpconnect( tcps, address, port ) == 0 ) { - err = -1; - } else { - err = 0; - } - } else { - struct sockaddr_in sin; - (void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in )); - sin.sin_family = AF_INET; - sin.sin_port = port; - sin.sin_addr.s_addr = address; - - err = ld->ld_connect_fn( tcps, (struct sockaddr *)&sin, - sizeof( struct sockaddr_in )); - } - - if ( err == 0 ) { - sb->sb_sd = (void *)tcps; - return( 0 ); - } - - if ( host == NULL ) { /* using single address -- not hi.addrs array */ - break; - } - } - - LDAPDebug( LDAP_DEBUG_TRACE, "tcpconnect failed\n", 0, 0, 0 ); - LDAP_SET_LDERRNO( ld, LDAP_CONNECT_ERROR, NULL, NULL ); - LDAP_SET_ERRNO( ld, EHOSTUNREACH ); /* close enough */ - - if ( ld->ld_close_fn == NULL ) { - tcpclose( (tcpstream *)tcps ); - } else { - ld->ld_close_fn( tcps ); - } - return( -1 ); -} - - -void -nsldapi_close_connection( LDAP *ld, Sockbuf *sb ) -{ - if ( ld->ld_close_fn == NULL ) { - tcpclose( (tcpstream *)sb->sb_sd ); - } else { - ld->ld_close_fn( sb->sb_sd ); - } -} - - -#ifdef KERBEROS -char * -host_connected_to( Sockbuf *sb ) -{ - ip_addr addr; - -#ifdef SUPPORT_OPENTRANSPORT - InetHostInfo hi; -#else /* SUPPORT_OPENTRANSPORT */ - struct hostInfo hi; -#endif /* SUPPORT_OPENTRANSPORT */ - - if ( tcpgetpeername( (tcpstream *)sb->sb_sd, &addr, NULL ) != noErr ) { - return( NULL ); - } - -#ifdef SUPPORT_OPENTRANSPORT - if ( gethostinfobyaddr( addr, &hi ) == noErr ) { - return( strdup( hi.name )); - } -#else /* SUPPORT_OPENTRANSPORT */ - if ( gethostinfobyaddr( addr, &hi ) == noErr ) { - return( strdup( hi.cname )); - } -#endif /* SUPPORT_OPENTRANSPORT */ - - return( NULL ); -} -#endif /* KERBEROS */ - - -struct tcpstreaminfo { - struct tcpstream *tcpsi_stream; - Boolean tcpsi_check_read; - Boolean tcpsi_is_read_ready; - Boolean tcpsi_check_write; - Boolean tcpsi_is_write_ready; -}; - -/* for BSD-compatible I/O functions */ -struct stdselectinfo { - fd_set ssi_readfds; - fd_set ssi_writefds; - fd_set ssi_use_readfds; - fd_set ssi_use_writefds; -}; - -struct selectinfo { - short si_count; - struct tcpstreaminfo *si_streaminfo; - struct stdselectinfo si_stdinfo; -}; - - -void -nsldapi_mark_select_write( LDAP *ld, Sockbuf *sb ) -{ - struct selectinfo *sip; - struct tcpstreaminfo *tcpsip; - short i; - - LDAPDebug( LDAP_DEBUG_TRACE, "mark_select_write: stream %x\n", - (tcpstream *)sb->sb_sd, 0, 0 ); - - if (( sip = (struct selectinfo *)ld->ld_selectinfo ) == NULL ) { - return; - } - - if ( ld->ld_select_fn != NULL ) { - if ( !FD_ISSET( (int)sb->sb_sd, &sip->si_stdinfo.ssi_writefds )) { - FD_SET( (int)sb->sb_sd, &sip->si_stdinfo.ssi_writefds ); - } - return; - } - - for ( i = 0; i < sip->si_count; ++i ) { /* make sure stream is not already in the list... */ - if ( sip->si_streaminfo[ i ].tcpsi_stream == (tcpstream *)sb->sb_sd) { - sip->si_streaminfo[ i ].tcpsi_check_write = true; - sip->si_streaminfo[ i ].tcpsi_is_write_ready = false; - return; - } - } - - /* add a new stream element to our array... */ - if ( sip->si_count <= 0 ) { - tcpsip = (struct tcpstreaminfo *)malloc( sizeof( struct tcpstreaminfo )); - } else { - tcpsip = (struct tcpstreaminfo *)realloc( sip->si_streaminfo, - ( sip->si_count + 1 ) * sizeof( struct tcpstreaminfo )); - } - - if ( tcpsip != NULL ) { - tcpsip[ sip->si_count ].tcpsi_stream = (tcpstream *)sb->sb_sd; - tcpsip[ sip->si_count ].tcpsi_check_write = true; - tcpsip[ sip->si_count ].tcpsi_is_write_ready = false; - sip->si_streaminfo = tcpsip; - ++sip->si_count; - } -} - - -void -nsldapi_mark_select_read( LDAP *ld, Sockbuf *sb ) -{ - struct selectinfo *sip; - struct tcpstreaminfo *tcpsip; - short i; - - LDAPDebug( LDAP_DEBUG_TRACE, "mark_select_read: stream %x\n", (tcpstream *)sb->sb_sd, 0, 0 ); - - if (( sip = (struct selectinfo *)ld->ld_selectinfo ) == NULL ) { - return; - } - - if ( ld->ld_select_fn != NULL ) { - if ( !FD_ISSET( (int)sb->sb_sd, &sip->si_stdinfo.ssi_readfds )) { - FD_SET( (int)sb->sb_sd, &sip->si_stdinfo.ssi_readfds ); - } - return; - } - - for ( i = 0; i < sip->si_count; ++i ) { /* make sure stream is not already in the list... */ - if ( sip->si_streaminfo[ i ].tcpsi_stream == (tcpstream *)sb->sb_sd ) { - sip->si_streaminfo[ i ].tcpsi_check_read = true; - sip->si_streaminfo[ i ].tcpsi_is_read_ready = false; - sip->si_streaminfo[ i ].tcpsi_check_write = true; - sip->si_streaminfo[ i ].tcpsi_is_write_ready = false; - return; - } - } - - /* add a new stream element to our array... */ - if ( sip->si_count <= 0 ) { - tcpsip = (struct tcpstreaminfo *)malloc( sizeof( struct tcpstreaminfo )); - } else { - tcpsip = (struct tcpstreaminfo *)realloc( sip->si_streaminfo, - ( sip->si_count + 1 ) * sizeof( struct tcpstreaminfo )); - } - - if ( tcpsip != NULL ) { - tcpsip[ sip->si_count ].tcpsi_stream = (tcpstream *)sb->sb_sd; - tcpsip[ sip->si_count ].tcpsi_check_read = true; - tcpsip[ sip->si_count ].tcpsi_is_read_ready = false; - tcpsip[ sip->si_count ].tcpsi_check_write = true; - tcpsip[ sip->si_count ].tcpsi_is_write_ready = false; - sip->si_streaminfo = tcpsip; - ++sip->si_count; - } -} - - -void -nsldapi_mark_select_clear( LDAP *ld, Sockbuf *sb ) -{ - struct selectinfo *sip; - short i; - - LDAPDebug( LDAP_DEBUG_TRACE, "mark_select_clear: stream %x\n", (tcpstream *)sb->sb_sd, 0, 0 ); - - if (( sip = (struct selectinfo *)ld->ld_selectinfo ) == NULL ) { - return; - } - - if ( ld->ld_select_fn != NULL ) { - FD_CLR( (int)sb->sb_sd, &sip->si_stdinfo.ssi_writefds ); - FD_CLR( (int)sb->sb_sd, &sip->si_stdinfo.ssi_readfds ); - - } else if ( sip->si_count > 0 && sip->si_streaminfo != NULL ) { - for ( i = 0; i < sip->si_count; ++i ) { - if ( sip->si_streaminfo[ i ].tcpsi_stream == (tcpstream *)sb->sb_sd ) { - break; - } - } - if ( i < sip->si_count ) { - --sip->si_count; - for ( ; i < sip->si_count; ++i ) { - sip->si_streaminfo[ i ] = sip->si_streaminfo[ i + 1 ]; - } - /* we don't bother to use realloc to make the si_streaminfo array smaller */ - } - } -} - - -int -nsldapi_is_write_ready( LDAP *ld, Sockbuf *sb ) -{ - struct selectinfo *sip; - short i; - - if (( sip = (struct selectinfo *)ld->ld_selectinfo ) == NULL ) { - return( 0 ); /* punt */ - } - - if ( ld->ld_select_fn != NULL ) { - return( FD_ISSET( (int)sb->sb_sd, &sip->si_stdinfo.ssi_use_writefds)); - } - - if ( sip->si_count > 0 && sip->si_streaminfo != NULL ) { - for ( i = 0; i < sip->si_count; ++i ) { - if ( sip->si_streaminfo[ i ].tcpsi_stream == (tcpstream *)sb->sb_sd ) { -#ifdef LDAP_DEBUG - if ( sip->si_streaminfo[ i ].tcpsi_is_write_ready ) { - LDAPDebug( LDAP_DEBUG_TRACE, "is_write_ready: stream %x READY\n", - (tcpstream *)sb->sb_sd, 0, 0 ); - } else { - LDAPDebug( LDAP_DEBUG_TRACE, "is_write_ready: stream %x Not Ready\n", - (tcpstream *)sb->sb_sd, 0, 0 ); - } -#endif /* LDAP_DEBUG */ - return( sip->si_streaminfo[ i ].tcpsi_is_write_ready ? 1 : 0 ); - } - } - } - - LDAPDebug( LDAP_DEBUG_TRACE, "is_write_ready: stream %x: NOT FOUND\n", (tcpstream *)sb->sb_sd, 0, 0 ); - return( 0 ); -} - - -int -nsldapi_is_read_ready( LDAP *ld, Sockbuf *sb ) -{ - struct selectinfo *sip; - short i; - - if (( sip = (struct selectinfo *)ld->ld_selectinfo ) == NULL ) { - return( 0 ); /* punt */ - } - - if ( ld->ld_select_fn != NULL ) { - return( FD_ISSET( (int)sb->sb_sd, &sip->si_stdinfo.ssi_use_readfds )); - } - - if ( sip->si_count > 0 && sip->si_streaminfo != NULL ) { - for ( i = 0; i < sip->si_count; ++i ) { - if ( sip->si_streaminfo[ i ].tcpsi_stream == (tcpstream *)sb->sb_sd ) { -#ifdef LDAP_DEBUG - if ( sip->si_streaminfo[ i ].tcpsi_is_read_ready ) { - LDAPDebug( LDAP_DEBUG_TRACE, "is_read_ready: stream %x READY\n", - (tcpstream *)sb->sb_sd, 0, 0 ); - } else { - LDAPDebug( LDAP_DEBUG_TRACE, "is_read_ready: stream %x Not Ready\n", - (tcpstream *)sb->sb_sd, 0, 0 ); - } -#endif /* LDAP_DEBUG */ - return( sip->si_streaminfo[ i ].tcpsi_is_read_ready ? 1 : 0 ); - } - } - } - - LDAPDebug( LDAP_DEBUG_TRACE, "is_read_ready: stream %x: NOT FOUND\n", (tcpstream *)sb->sb_sd, 0, 0 ); - return( 0 ); -} - - -void * -nsldapi_new_select_info() -{ - struct selectinfo *sip; - - if (( sip = (struct selectinfo *)calloc( 1, sizeof( struct selectinfo ))) != NULL ) { - FD_ZERO( &sip->si_stdinfo.ssi_readfds ); - FD_ZERO( &sip->si_stdinfo.ssi_writefds ); - } - - return( (void *)sip ); -} - - -void -nsldapi_free_select_info( void *sip ) -{ - if ( sip != NULL ) { - free( sip ); - } -} - - -int -nsldapi_do_ldap_select( LDAP *ld, struct timeval *timeout ) -{ - struct selectinfo *sip; - Boolean ready, gotselecterr; - unsigned long ticks, endticks; - short i, err; - static int tblsize = 0; - - LDAPDebug( LDAP_DEBUG_TRACE, "do_ldap_select\n", 0, 0, 0 ); - - if (( sip = (struct selectinfo *)ld->ld_selectinfo ) == NULL ) { - return( -1 ); - } - - if ( ld->ld_select_fn != NULL ) { - if ( tblsize == 0 ) { - tblsize = FD_SETSIZE - 1; - } - - sip->si_stdinfo.ssi_use_readfds = sip->si_stdinfo.ssi_readfds; - sip->si_stdinfo.ssi_use_writefds = sip->si_stdinfo.ssi_writefds; - - return( ld->ld_select_fn( tblsize, &sip->si_stdinfo.ssi_use_readfds, - &sip->si_stdinfo.ssi_use_writefds, NULL, timeout )); - } - - if ( sip->si_count == 0 ) { - return( 1 ); - } - - if ( timeout != NULL ) { - endticks = 60 * timeout->tv_sec + ( 60 * timeout->tv_usec ) / 1000000 + TickCount(); - } - - for ( i = 0; i < sip->si_count; ++i ) { - if ( sip->si_streaminfo[ i ].tcpsi_check_read ) { - sip->si_streaminfo[ i ].tcpsi_is_read_ready = false; - } - if ( sip->si_streaminfo[ i ].tcpsi_check_write ) { - sip->si_streaminfo[ i ].tcpsi_is_write_ready = false; - } - } - - ready = gotselecterr = false; - do { - for ( i = 0; i < sip->si_count; ++i ) { - if ( sip->si_streaminfo[ i ].tcpsi_check_read && !sip->si_streaminfo[ i ].tcpsi_is_read_ready ) { - if (( err = tcpreadready( sip->si_streaminfo[ i ].tcpsi_stream )) > 0 ) { - sip->si_streaminfo[ i ].tcpsi_is_read_ready = ready = true; - } else if ( err < 0 ) { - gotselecterr = true; - } - } - if ( sip->si_streaminfo[ i ].tcpsi_check_write && !sip->si_streaminfo[ i ].tcpsi_is_write_ready ) { - if (( err = tcpwriteready( sip->si_streaminfo[ i ].tcpsi_stream )) > 0 ) { - sip->si_streaminfo[ i ].tcpsi_is_write_ready = ready = true; - } else if ( err < 0 ) { - gotselecterr = true; - } - } - } - - if ( !ready && !gotselecterr ) { - Delay( 2L, &ticks ); - SystemTask(); - } - } while ( !ready && !gotselecterr && ( timeout == NULL || ticks < endticks )); - - LDAPDebug( LDAP_DEBUG_TRACE, "do_ldap_select returns %d\n", ready ? 1 : ( gotselecterr ? -1 : 0 ), 0, 0 ); - return( ready ? 1 : ( gotselecterr ? -1 : 0 )); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/strings.c b/mozilla/directory/c-sdk/ldap/libraries/macintosh/strings.c deleted file mode 100644 index c695523845e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/strings.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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) 1987 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ -/* - * This array is designed for mapping upper and lower case letter - * together for a case independent comparison. The mappings are - * based upon ascii character sequences. - */ -/* - * strings.c - */ -#include -#include -#include "ldap-macos.h" - - -#ifndef NO_GLOBALS -static char charmap[] = { - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', - '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', - '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', - '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', - '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', - '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', - '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', - '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', - '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', - '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', - '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', - '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', - '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', - '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', - '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337', - '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', -}; - -#ifndef MOZILLA_CLIENT -/* This is a duplicate of one we already have */ -int -strcasecmp(const char *s1, const char *s2) -{ - register char *cm = charmap; - - while (cm[*s1] == cm[*s2++]) - if (*s1++ == '\0') - return(0); - return cm[*s1] - cm[*--s2]; -} -#endif - -int -strncasecmp(const char *s1, const char *s2, const long n) -{ - register char *cm = charmap; - register long remain = n; - - while (--remain >= 0 && cm[*s1] == cm[*s2++]) - if (*s1++ == '\0') - return(0); - return remain < 0 ? 0 : cm[*s1] - cm[*--s2]; -} -#endif NO_GLOBALS - - -#ifndef MOZILLA_CLIENT -/* This is a duplicate of one we already have */ -char * -strdup( const char *p ) -{ - char *r; - - r = (char *) malloc( strlen( p ) + 1 ); - if ( r != NULL ) { - strcpy( r, p ); - } - - return( r ); -} -#endif diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/tcp-univhdrs/tcp.c b/mozilla/directory/c-sdk/ldap/libraries/macintosh/tcp-univhdrs/tcp.c deleted file mode 100644 index db374bb1daa..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/tcp-univhdrs/tcp.c +++ /dev/null @@ -1,1018 +0,0 @@ -/* - * 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) 1990-92 Regents of the University of Michigan. - * All rights reserved. - */ -/* - * tcp.c -- TCP communication related routines - */ -#include "lber.h" -#include "ldap.h" -#include "tcp.h" - -#include -#include /* to get SystemTask() */ -#include -#include -#include - -/* - * local prototypes - */ -#ifdef NEEDPROTOS -void bzero( char *buf, unsigned long count ); -pascal void setdoneflag( struct hostInfo *hip, char *donep ); -pascal void tcp_asynchnotify( StreamPtr tstream, unsigned short event, Ptr userdatap, - unsigned short term_reason, struct ICMPReport *icmpmsg ); -OSErr kick_mactcp( short *drefnump ); -#ifdef SUPPORT_OPENTRANSPORT -pascal void EventHandler(tcpstream *tsp, OTEventCode event, OTResult result, void * /* cookie */); -#endif /* SUPPORT_OPENTRANSPORT */ -#else /* NEEDPROTOS */ -void bzero(); -pascal void setdoneflag(); -pascal void tcp_asynchnotify(); -OSErr kick_mactcp(); -#ifdef SUPPORT_OPENTRANSPORT -pascal void EventHandler(); -#endif /* SUPPORT_OPENTRANSPORT */ -#endif /* NEEDPROTOS */ - -#ifdef SUPPORT_OPENTRANSPORT -static Boolean gHaveOT = false; -#endif /* SUPPORT_OPENTRANSPORT */ - - -#ifdef SUPPORT_OPENTRANSPORT -/* - * Initialize the tcp module. This mainly consists of seeing if we have - * Open Transport and initializing it and setting our global saying so. - */ -OSStatus -tcp_init( void ) -{ - static Boolean sInitialized = false; - Boolean hasOT; - long gestaltResult; - OSStatus otErr = kOTNoError; - OSErr err; - - if ( sInitialized ) { - return otErr; - } - - err = Gestalt(gestaltOpenTpt, &gestaltResult); - - hasOT = (err == noErr) && ((gestaltResult & gestaltOpenTptPresentMask) != 0); - hasOT = hasOT && ((gestaltResult & gestaltOpenTptTCPPresentMask) != 0); - - sInitialized = true; - - if ( hasOT ) { - gHaveOT = ( InitOpenTransport() == noErr ); - } - - return otErr; -} - - -Boolean -tcp_have_opentransport( void ) -{ - return( gHaveOT ); -} -#endif /* SUPPORT_OPENTRANSPORT */ - - -/* - * open and return an pointer to a TCP stream (return NULL if error) - * "buf" is a buffer for receives of length "buflen." - */ -tcpstream * -tcpopen( unsigned char * buf, long buflen ) { - TCPiopb pb; - OSStatus err; - tcpstream * tsp; - short drefnum; -#ifdef SUPPORT_OPENTRANSPORT - TEndpointInfo info; -#endif /* SUPPORT_OPENTRANSPORT */ - - if (nil == (tsp = (tcpstream *)NewPtrClear(sizeof(tcpstream)))) { - return( nil ); - } - -#ifdef SUPPORT_OPENTRANSPORT - if ( gHaveOT ) { - - // - // Now create a TCP - // - tsp->tcps_ep = OTOpenEndpoint( OTCreateConfiguration( kTCPName ), 0, &info, &err ); - if ( !tsp->tcps_ep ) { - if ( err == kOTNoError ) { - err = -1; - } - } - - if ( !err ) { - err = OTSetSynchronous( tsp->tcps_ep ); - } - - tsp->tcps_data = 0; - tsp->tcps_terminated = tsp->tcps_connected = false; - - // - // Install notifier we're going to use - // - if ( !err ) { - err = OTInstallNotifier( tsp->tcps_ep, (OTNotifyProcPtr) EventHandler, 0 ); - } - - if ( err != kOTNoError ) { - if ( tsp->tcps_ep ) { - OTCloseProvider( tsp->tcps_ep ); - } - DisposePtr( (Ptr)tsp ); - tsp = nil; - } - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - - if ( kick_mactcp( &drefnum ) != noErr ) { - return ( nil ); - } - - if (( tsp->tcps_notifyupp = NewTCPNotifyProc( tcp_asynchnotify )) == NULL ) { - DisposePtr( (Ptr)tsp ); - return( nil ); - } - - tsp->drefnum = drefnum; - - if ( buflen == 0 ) { - buflen = TCP_BUFSIZ; - } - - if ( buf == NULL && - (nil == ( buf = tsp->tcps_buffer = (unsigned char *)NewPtr( buflen )))) { - DisposeRoutineDescriptor( (UniversalProcPtr)tsp->tcps_notifyupp ); - DisposePtr( (Ptr)tsp ); - return( nil ); - } - bzero( (char *)&pb, sizeof( pb )); - pb.csCode = TCPCreate; - pb.ioCRefNum = tsp->drefnum; - pb.csParam.create.rcvBuff = (Ptr) buf; - pb.csParam.create.rcvBuffLen = buflen; - pb.csParam.create.notifyProc = tsp->tcps_notifyupp; - pb.csParam.create.userDataPtr = (Ptr)tsp; - - if (( err = PBControl( (ParmBlkPtr)&pb, 0 )) != noErr || pb.ioResult != noErr ) { - DisposeRoutineDescriptor( (UniversalProcPtr)tsp->tcps_notifyupp ); - DisposePtr( (Ptr)tsp->tcps_buffer ); - DisposePtr( (Ptr)tsp ); - return( nil ); - } - - tsp->tcps_data = 0; - tsp->tcps_terminated = tsp->tcps_connected = false; - tsp->tcps_sptr = pb.tcpStream; - -#ifdef SUPPORT_OPENTRANSPORT - } -#endif /* SUPPORT_OPENTRANSPORT */ - - return( tsp ); -} - -/* - * connect to remote host at IP address "addr", TCP port "port" - * return local port assigned, 0 if error - */ -#ifdef SUPPORT_OPENTRANSPORT -InetPort -tcpconnect( tcpstream * tsp, InetHost addr, InetPort port ) { -#else /* SUPPORT_OPENTRANSPORT */ -ip_port -tcpconnect( tcpstream * tsp, ip_addr addr, ip_port port ) { -#endif /* SUPPORT_OPENTRANSPORT */ - TCPiopb pb; - OSStatus err; -#ifdef SUPPORT_OPENTRANSPORT - struct InetAddress sndsin, rcvsin, retsin; - TCall sndcall, rcvcall; - TBind ret; -#endif /* SUPPORT_OPENTRANSPORT */ - -#ifdef SUPPORT_OPENTRANSPORT - if ( gHaveOT ) { - - if ( tsp->tcps_ep == NULL ) { - return( 0 ); - } - - bzero( (char *)&sndsin, sizeof( struct InetAddress )); - bzero( (char *)&rcvsin, sizeof( struct InetAddress )); - bzero( (char *)&retsin, sizeof( struct InetAddress )); - bzero( (char *)&sndcall, sizeof( TCall )); - bzero( (char *)&rcvcall, sizeof( TCall)); - bzero( (char *)&ret, sizeof( TBind )); - - // Bind TCP to an address and port. We don't care which one, so we pass null for - // the requested address. - ret.addr.maxlen = sizeof( struct InetAddress ); - ret.addr.buf = (unsigned char *)&retsin; - err = OTBind( tsp->tcps_ep, NULL, &ret ); - if ( err != kOTNoError ) { - return( 0 ); - } - - OTInitInetAddress( &sndsin, port, addr ); - sndcall.addr.len = sizeof( struct InetAddress ); - sndcall.addr.buf = (UInt8 *)&sndsin; - - rcvcall.addr.maxlen = sizeof( struct InetAddress ); - rcvcall.addr.buf = (unsigned char *)&rcvsin; - - err = OTConnect( tsp->tcps_ep, &sndcall, &rcvcall ); - if ( err != kOTNoError ) { - return 0; - } - - tsp->tcps_connected = true; - tsp->tcps_remoteport = rcvsin.fPort; - tsp->tcps_remoteaddr = rcvsin.fHost; - return( retsin.fPort ); - - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - - if ( tsp->tcps_sptr == (StreamPtr)NULL ) { - return( 0 ); - } - - bzero( (char *)&pb, sizeof( pb )); - pb.csCode = TCPActiveOpen; - pb.ioCRefNum = tsp->drefnum; - pb.tcpStream = tsp->tcps_sptr; - pb.csParam.open.remoteHost = addr; - pb.csParam.open.remotePort = port; - pb.csParam.open.ulpTimeoutValue = 15; - pb.csParam.open.validityFlags = timeoutValue; - - if (( err = PBControl( (ParmBlkPtr)&pb, 0 )) != noErr || pb.ioResult != noErr ) { - return( 0 ); - } - - tsp->tcps_connected = true; - return( pb.csParam.open.localPort ); - -#ifdef SUPPORT_OPENTRANSPORT - } -#endif /* SUPPORT_OPENTRANSPORT */ - -} - - -/* - * close and release a TCP stream - * returns 0 if no error, -1 if any error occurs - */ -short -tcpclose( tcpstream * tsp ) { - TCPiopb pb; - OSStatus rc; - -#ifdef SUPPORT_OPENTRANSPORT - if ( gHaveOT ) { - - - if ( tsp->tcps_ep == NULL ) { - return( -1 ); - } - -#ifdef notdef - /* - * if connected execute a close - */ - if ( tcp->tcps_connected ) { - Call OTSndOrderlyDisconnect and wait for the other end to respond. This requires - waiting for and reading any data that comes in in the meantime. This code was ifdefed - out in the MacTCP so it is here too. - } -#endif /* notdef */ - - rc = OTSndDisconnect( tsp->tcps_ep, NULL ); - - OTCloseProvider( tsp->tcps_ep ); - DisposePtr( (Ptr)tsp ); - - if ( rc != 0 ) { - rc = -1; - } - - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - - if ( tsp->tcps_sptr == (StreamPtr)NULL ) { - return( -1 ); - } - -#ifdef notdef - /* - * if connected execute a close - */ - if ( tcp->tcps_connected ) { - bzero( (char *)&pb, sizeof( pb )); - pb.csCode = TCPClose; - pb.ioCRefNum = tsp->drefnum; - pb.tcpStream = sp; - pb.csParam.close.validityFlags = 0; - PBControl( (ParmBlkPtr)&pb, 0 ); - } -#endif /* notdef */ - - bzero( (char *)&pb, sizeof( pb )); - pb.csCode = TCPRelease; - pb.ioCRefNum = tsp->drefnum; - pb.tcpStream = tsp->tcps_sptr; - pb.csParam.close.validityFlags = 0; - rc = 0; - - if ( PBControl( (ParmBlkPtr)&pb, 0 ) != noErr || pb.ioResult != noErr ) { - rc = -1; - } - - DisposeRoutineDescriptor( (UniversalProcPtr)tsp->tcps_notifyupp ); - DisposePtr( (Ptr)tsp->tcps_buffer ); - DisposePtr( (Ptr)tsp ); - -#ifdef SUPPORT_OPENTRANSPORT - } -#endif /* SUPPORT_OPENTRANSPORT */ - - return( rc ); -} - - -/* - * wait for new data to arrive - * - * if "timeout" is NULL, wait until data arrives or connection goes away - * if "timeout" is a pointer to a zero'ed struct, poll - * else wait for "timeout->tv_sec + timeout->tv_usec" seconds - */ -short -tcpselect( tcpstream * tsp, struct timeval * timeout ) -{ - unsigned long ticks, endticks; - short rc; - - if ( timeout != NULL ) { - endticks = 60 * timeout->tv_sec + ( 60 * timeout->tv_usec ) / 1000000 + TickCount(); - } - ticks = 0; - - while (( rc = tcpreadready( tsp )) == 0 && ( timeout == NULL || ticks < endticks )) { - Delay( 2L, &ticks ); - SystemTask(); - } - - return ( rc ); -} - - -short -tcpreadready( tcpstream *tsp ) -{ -#ifdef SUPPORT_OPENTRANSPORT - size_t dataAvail; - - if (gHaveOT) { - if ( tsp->tcps_ep == NULL ) { - return( -1 ); - } - - OTCountDataBytes( tsp->tcps_ep, &dataAvail ); - tsp->tcps_data = ( dataAvail != 0 ); - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - if ( tsp->tcps_sptr == (StreamPtr)NULL ) { - return( -1 ); - } - - /* tsp->tcps_data is set in async. notify proc, so nothing for us to do here */ -#ifdef SUPPORT_OPENTRANSPORT - } -#endif /* SUPPORT_OPENTRANSPORT */ - return ( tsp->tcps_terminated ? -1 : ( tsp->tcps_data < 1 ) ? 0 : 1 ); -} - - -short -tcpwriteready( tcpstream *tsp ) -{ -#ifdef SUPPORT_OPENTRANSPORT - if (gHaveOT) { - if ( tsp->tcps_ep == NULL ) { - return( -1 ); - } - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - if ( tsp->tcps_sptr == (StreamPtr)NULL ) { - return( -1 ); - } - - /* tsp->tcps_data is set in async. notify proc, so nothing for us to do here */ -#ifdef SUPPORT_OPENTRANSPORT - } -#endif /* SUPPORT_OPENTRANSPORT */ - return ( tsp->tcps_terminated ? -1 : 1 ); -} - - -/* - * read up to "rbuflen" bytes into "rbuf" from a connected TCP stream - * wait up to "timeout" seconds for data (if timeout == 0, wait "forever") - */ -long -tcpread( tcpstream * tsp, UInt8 timeout, unsigned char * rbuf, - unsigned short rbuflen, DialogPtr dlp ) { -#pragma unused (dlp) - TCPiopb pb; - unsigned long time, end_time; -#ifdef SUPPORT_OPENTRANSPORT - OTFlags flags; - OTResult result; - size_t dataAvail; -#endif /* SUPPORT_OPENTRANSPORT */ - -#ifdef SUPPORT_OPENTRANSPORT - if ( gHaveOT ) { - - if ( tsp->tcps_ep == NULL ) { - return( -1 ); - } - - // Try to read data. Since we're in non-blocking mode, this will fail with kOTNoDataErr - // if no data is available. - result = OTRcv( tsp->tcps_ep, rbuf, rbuflen, &flags ); - if ( result == kOTNoDataErr ) { - // Nothing available, wait for some. The ugly spin loop below is the way the old - // MacTCP code worked. I should fix it, but I don't have time right now. - tsp->tcps_data = 0; - GetDateTime( &time ); - end_time = time + timeout; - - while (( timeout <= 0 || end_time > time ) && tsp->tcps_data < 1 && !tsp->tcps_terminated ) { - OTCountDataBytes( tsp->tcps_ep, &dataAvail ); - if ( dataAvail > 0 ) { - tsp->tcps_data = 1; - } - GetDateTime( &time ); - SystemTask(); - } - - if ( tsp->tcps_data < 1 ) { - return( tsp->tcps_terminated ? -3 : -1 ); - } - - // Should have data available now, try again. - result = OTRcv( tsp->tcps_ep, rbuf, rbuflen, &flags ); - } - - if ( result < 0 ) { - return( -1 ); - } - - OTCountDataBytes( tsp->tcps_ep, &dataAvail ); - if ( dataAvail == 0 ) { - tsp->tcps_data = 0; - } - - return( result ); - - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - - if ( tsp->tcps_sptr == (StreamPtr)NULL ) { - return( -1 ); - } - - GetDateTime( &time ); - end_time = time + timeout; - - while(( timeout <= 0 || end_time > time ) && tsp->tcps_data < 1 && - !tsp->tcps_terminated ) { - GetDateTime( &time ); - SystemTask(); - } - - if ( tsp->tcps_data < 1 ) { - return( tsp->tcps_terminated ? -3 : -1 ); - } - - bzero( (char *)&pb, sizeof( pb )); - pb.csCode = TCPRcv; - pb.ioCRefNum = tsp->drefnum; - pb.tcpStream = tsp->tcps_sptr; - pb.csParam.receive.commandTimeoutValue = timeout; - pb.csParam.receive.rcvBuff = (char *)rbuf; - pb.csParam.receive.rcvBuffLen = rbuflen; - - if ( PBControl( (ParmBlkPtr)&pb, 0 ) != noErr || pb.ioResult != noErr ) { - return( -1 ); - } - - if ( --(tsp->tcps_data) < 0 ) { - tsp->tcps_data = 0; - } - - return( pb.csParam.receive.rcvBuffLen ); - -#ifdef SUPPORT_OPENTRANSPORT - } -#endif /* SUPPORT_OPENTRANSPORT */ -} - -/* - * send TCP data - * "sp" is the stream to write to - * "wbuf" is "wbuflen" bytes of data to send - * returns < 0 if error, number of bytes written if no error - */ -long -tcpwrite( tcpstream * tsp, unsigned char * wbuf, unsigned short wbuflen ) { - TCPiopb pb; - wdsEntry wds[ 2 ]; - OSErr err; -#ifdef SUPPORT_OPENTRANSPORT - OTResult result; -#endif /* SUPPORT_OPENTRANSPORT */ - -#ifdef SUPPORT_OPENTRANSPORT - if ( gHaveOT ) { - - if ( tsp->tcps_ep == NULL ) { - return( -1 ); - } - - OTSetBlocking( tsp->tcps_ep ); - result = OTSnd( tsp->tcps_ep, wbuf, wbuflen, 0 ); - OTSetNonBlocking( tsp->tcps_ep ); - return( result ); - - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - - if ( tsp->tcps_sptr == (StreamPtr)NULL ) { - return( -1 ); - } - - wds[ 0 ].length = wbuflen; - wds[ 0 ].ptr = (char *)wbuf; - wds[ 1 ].length = 0; - - bzero( (char *)&pb, sizeof( pb )); - pb.csCode = TCPSend; - pb.ioCRefNum = tsp->drefnum; - pb.tcpStream = tsp->tcps_sptr; - pb.csParam.send.wdsPtr = (Ptr)wds; - pb.csParam.send.validityFlags = 0; - - if (( err = PBControl( (ParmBlkPtr)&pb, 0 )) != noErr || pb.ioResult != noErr ) { - return( -1 ); - } - - return( (long) wbuflen ); - -#ifdef SUPPORT_OPENTRANSPORT - } -#endif /* SUPPORT_OPENTRANSPORT */ -} - -static pascal void -tcp_asynchnotify( - StreamPtr tstream, - unsigned short event, - Ptr userdatap, - unsigned short term_reason, - struct ICMPReport *icmpmsg -) -{ -#pragma unused (tstream, term_reason, icmpmsg) - tcpstream *tsp; - - tsp = (tcpstream *)userdatap; - switch( event ) { - case TCPDataArrival: - ++(tsp->tcps_data); - break; - case TCPClosing: - case TCPTerminate: - case TCPULPTimeout: - tsp->tcps_terminated = true; - break; - default: - break; - } -} - - -short -tcpgetpeername( tcpstream *tsp, ip_addr *addrp, tcp_port *portp ) { - TCPiopb pb; - OSErr err; - -#ifdef SUPPORT_OPENTRANSPORT - if ( gHaveOT ) { - - if ( tsp->tcps_ep == NULL ) { - return( -1 ); - } - - if ( addrp != NULL ) { - *addrp = tsp->tcps_remoteaddr; - } - - if ( portp != NULL ) { - *portp = tsp->tcps_remoteport; - } - - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - - if ( tsp->tcps_sptr == (StreamPtr)NULL ) { - return( -1 ); - } - - bzero( (char *)&pb, sizeof( pb )); - pb.csCode = TCPStatus; - pb.ioCRefNum = tsp->drefnum; - pb.tcpStream = tsp->tcps_sptr; - - if (( err = PBControl( (ParmBlkPtr)&pb, 0 )) != noErr || pb.ioResult != noErr ) { - return( err ); - } - - if ( addrp != NULL ) { - *addrp = pb.csParam.status.remoteHost; - } - - if ( portp != NULL ) { - *portp = pb.csParam.status.remotePort; - } - -#ifdef SUPPORT_OPENTRANSPORT - } - - return( kOTNoError ); -#else /* SUPPORT_OPENTRANSPORT */ - return( noErr ); -#endif /* SUPPORT_OPENTRANSPORT */ -} - - -/* - * bzero -- set "len" bytes starting at "p" to zero - */ -static void -bzero( char *p, unsigned long len ) -{ - unsigned long i; - - for ( i = 0; i < len; ++i ) { - *p++ = '\0'; - } -} - - -pascal void -setdoneflag( struct hostInfo *hip, char *donep ) -{ - ++(*donep); -#pragma unused (hip) -} - - -/* - * return a hostInfo structure for "host" (return != noErr if error) - */ -short -#ifdef SUPPORT_OPENTRANSPORT -gethostinfobyname( char *host, InetHostInfo *hip ) { -#else /* SUPPORT_OPENTRANSPORT */ -gethostinfobyname( char *host, struct hostInfo *hip ) { -#endif /* SUPPORT_OPENTRANSPORT */ - char done = 0; - OSStatus err; - unsigned long time; - ResultUPP rupp; -#ifdef notdef - struct dnr_struct dnr_global = {nil, 0}; -#endif /* notdef */ -#ifdef SUPPORT_OPENTRANSPORT - hostInfo hi; /* Old MacTCP version of hostinfo */ - InetSvcRef inetsvc; /* Internet services reference */ -#endif /* SUPPORT_OPENTRANSPORT */ - -#ifdef SUPPORT_OPENTRANSPORT - if ( gHaveOT ) { - - // Get an Internet Services reference - inetsvc = OTOpenInternetServices( kDefaultInternetServicesPath, 0, &err ); - if ( !inetsvc || err != kOTNoError ) { - if ( err == kOTNoError ) { - err = -1; - } - inetsvc = nil; - } - - if ( !err ) { - err = OTInetStringToAddress( inetsvc, host, hip ); - } - - if ( inetsvc ) { - OTCloseProvider(inetsvc); - } - - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - - kick_mactcp( NULL ); - - if (( err = OpenResolver( /* &dnr_global, */ NULL )) != noErr ) - return( err ); - - if (( rupp = NewResultProc( setdoneflag )) == NULL ) { - err = memFullErr; - } else { -#ifdef SUPPORT_OPENTRANSPORT - bzero( (char *)&hi, sizeof( hostInfo )); - if (( err = StrToAddr( /* &dnr_global, */ host, &hi, rupp, &done )) == cacheFault ) { -#else /* SUPPORT_OPENTRANSPORT */ - bzero((char *) hip, sizeof( hostInfo )); - if (( err = StrToAddr( /* &dnr_global, */ host, hip, rupp, &done )) == cacheFault ) { -#endif /* SUPPORT_OPENTRANSPORT */ - while( !done ) { - Delay( 2L, &time ); // querying DN servers; wait for reply - SystemTask(); - } -#ifdef SUPPORT_OPENTRANSPORT - err = hi.rtnCode; -#else /* SUPPORT_OPENTRANSPORT */ - err = hip->rtnCode; -#endif /* SUPPORT_OPENTRANSPORT */ - } - DisposeRoutineDescriptor( (UniversalProcPtr)rupp ); - } - -#if !defined(MOZILLA_CLIENT) - CloseResolver( /* &dnr_global */ ); -#endif - -#ifdef SUPPORT_OPENTRANSPORT - /* Copy the results to the InetHostInfo area passed in by caller */ - BlockMove(hi.cname, hip->name, kMaxHostNameLen); - BlockMove(hi.addr, hip->addrs, 4*NUM_ALT_ADDRS); - hip->addrs[NUM_ALT_ADDRS] = 0; - - /* Convert the return code to an OT style return code */ - if ( err == nameSyntaxErr ) { - err = kOTBadNameErr; - } else if ( err == noNameServer || err == authNameErr || err == noAnsErr ) { - err = kOTBadNameErr; - } else if (err != noErr) { - err = kOTSysErrorErr; - } - - } - - if (( err == kOTNoError ) && ( hip->addrs[ 0 ] == 0 )) { - err = kOTBadNameErr; - } - return( err ); - -#else /* SUPPORT_OPENTRANSPORT */ - if ( err != noErr || (( err == noErr ) && ( hip->addr[ 0 ] == 0 ))) { - return( err == noErr ? noAnsErr : err ); - } - return( noErr ); -#endif /* SUPPORT_OPENTRANSPORT */ -} - -/* - * return a hostInfo structure for "addr" (return != noErr if error) - */ -short -#ifdef SUPPORT_OPENTRANSPORT -gethostinfobyaddr( InetHost addr, InetHostInfo *hip ) -#else /* SUPPORT_OPENTRANSPORT */ -gethostinfobyaddr( ip_addr addr, struct hostInfo *hip ) -#endif /* SUPPORT_OPENTRANSPORT */ -{ - - char done = 0; - OSStatus err; - unsigned long time; - ResultUPP rupp; -#ifdef notdef - struct dnr_struct dnr_global = {nil, 0}; -#endif /* notdef */ -#ifdef SUPPORT_OPENTRANSPORT - hostInfo hi; /* Old MacTCP version of hostinfo */ - InetSvcRef inetsvc; /* Internet services reference */ -#endif /* SUPPORT_OPENTRANSPORT */ - -#ifdef SUPPORT_OPENTRANSPORT - if ( gHaveOT ) { - // Get an Internet Services reference - inetsvc = OTOpenInternetServices( kDefaultInternetServicesPath, 0, &err ); - if ( !inetsvc || err != kOTNoError ) { - if ( err == kOTNoError ) { - err = -1; - } - inetsvc = nil; - } - - if ( !err ) { - err = OTInetAddressToName( inetsvc, addr, hip->name ); - } - - if ( inetsvc ) { - OTCloseProvider( inetsvc ); - } - - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - - kick_mactcp( NULL ); - - if (( err = OpenResolver( /* &dnr_global, */ NULL )) != noErr ) - return( err ); - - if (( rupp = NewResultProc( setdoneflag )) == NULL ) { - err = memFullErr; - } else { -#ifdef SUPPORT_OPENTRANSPORT - bzero( (char *) &hi, sizeof( hostInfo )); - if (( err = AddrToName( /* &dnr_global, */ addr, &hi, rupp, &done )) == cacheFault ) { -#else /* SUPPORT_OPENTRANSPORT */ - bzero( (char *)hip, sizeof( hostInfo )); - if (( err = AddrToName( /* &dnr_global, */ addr, hip, rupp, &done )) == cacheFault ) { -#endif /* SUPPORT_OPENTRANSPORT */ - while( !done ) { - Delay( 2L, &time ); // querying DN servers; wait for reply - SystemTask(); - } -#ifdef SUPPORT_OPENTRANSPORT - err = hi.rtnCode; -#else /* SUPPORT_OPENTRANSPORT */ - err = hip->rtnCode; -#endif /* SUPPORT_OPENTRANSPORT */ - } - DisposeRoutineDescriptor( (UniversalProcPtr)rupp ); - } - -#if !defined(MOZILLA_CLIENT) - CloseResolver( /* &dnr_global */ ); -#endif - -#ifdef SUPPORT_OPENTRANSPORT - /* Copy the results to the InetHostInfo area passed in by caller */ - BlockMove(hi.cname, hip->name, kMaxHostNameLen); - BlockMove(hi.addr, hip->addrs, 4*NUM_ALT_ADDRS); - hip->addrs[NUM_ALT_ADDRS] = 0; - - /* Convert the return code to an OT style return code */ - if (err == nameSyntaxErr) { - err = kOTBadNameErr; - } else if (err == noNameServer || err == authNameErr || err == noAnsErr) { - err = kOTBadNameErr; - } else if (err != noErr) { - err = kOTSysErrorErr; - } - - } -#endif /* SUPPORT_OPENTRANSPORT */ - - return( err ); -} - -/* - * return a ASCII equivalent of ipaddr. addrstr must be at large enough to hold the - * result which is of the form "AAA.BBB.CCC.DDD" and can be a maximum of 16 bytes in size - */ -short -#ifdef SUPPORT_OPENTRANSPORT -ipaddr2str( InetHost ipaddr, char *addrstr ) -#else /* SUPPORT_OPENTRANSPORT */ -ipaddr2str( ip_addr ipaddr, char *addrstr ) -#endif /* SUPPORT_OPENTRANSPORT */ -{ - OSStatus err; -#ifdef notdef - struct dnr_struct dnr_global = {nil, 0}; -#endif /* notdef */ - -#ifdef SUPPORT_OPENTRANSPORT - if ( gHaveOT ) { - - OTInetHostToString( ipaddr, addrstr ); - err = kOTNoError; - - } else { -#endif /* SUPPORT_OPENTRANSPORT */ - - kick_mactcp( NULL ); - - if (( err = OpenResolver( /* &dnr_global, */ NULL )) != noErr ) - return( err ); - - err = AddrToStr( ipaddr, addrstr ); - -#if !defined(MOZILLA_CLIENT) - CloseResolver( /* &dnr_global */ ); -#endif - -#ifdef SUPPORT_OPENTRANSPORT - } -#endif /* SUPPORT_OPENTRANSPORT */ - - return( err ); -} - - -#ifdef SUPPORT_OPENTRANSPORT -/******************************************************************************* -** EventHandler -********************************************************************************/ -pascal void EventHandler(tcpstream *tsp, OTEventCode event, OTResult result, void * /* cookie */) -{ - - switch(event) - { - case T_ORDREL: - case T_DISCONNECT: - tsp->tcps_terminated = true; - break; - case T_DATA: - case T_EXDATA: - tsp->tcps_data += 1; - break; - default: - break; - } - return; -} -#endif /* SUPPORT_OPENTRANSPORT */ - - -static OSErr -kick_mactcp( short *drefnump ) -{ - short dref; - OSErr err; - struct GetAddrParamBlock gapb; - -/* - * we make sure the MacTCP driver is open and issue a "Get My Address" call - * so that adevs link MacPPP are initialized (MacTCP is dumb) - */ - if (( err = OpenDriver( "\p.IPP", &dref )) != noErr ) { - return( err ); - } - - if ( drefnump != NULL ) { - *drefnump = dref; - } - - bzero( (char *)&gapb, sizeof( gapb )); - gapb.csCode = ipctlGetAddr; - gapb.ioCRefNum = dref; - - err = PBControl( (ParmBlkPtr)&gapb, 0 ); - - return( noErr ); -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/macintosh/tcp-univhdrs/tcp.h b/mozilla/directory/c-sdk/ldap/libraries/macintosh/tcp-univhdrs/tcp.h deleted file mode 100644 index 0bc4e5eec5a..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/macintosh/tcp-univhdrs/tcp.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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): - */ -/* - * tcp.h interface to MCS's TCP routines - */ - -#include -#ifdef SUPPORT_OPENTRANSPORT -#include -#include -#endif /* SUPPORT_OPENTRANSPORT */ - -//#include "MacTCPCommonTypes.h" -#include "AddressXlation.h" -//#include "TCPPB.h" -//#include "GetMyIPAddr.h" -#include /* for the UNIX-y struct timeval */ - -#include - -#ifndef TCP_BUFSIZ -#define TCP_BUFSIZ 8192 -#endif /* TCP_BUFSIZ */ - -typedef struct tcpstream { - StreamPtr tcps_sptr; /* stream pointer for MacTCP TCP PB calls */ -#ifdef SUPPORT_OPENTRANSPORT - EndpointRef tcps_ep; /* OpenTransport end point */ -#endif /* SUPPORT_OPENTRANSPORT */ - short tcps_data; /* count of packets on read queue */ - short drefnum; /* driver ref num, for convenience */ - Boolean tcps_connected; /* true if connection was made */ - Boolean tcps_terminated; /* true if connection no longer exists */ -#ifdef SUPPORT_OPENTRANSPORT - InetHost tcps_remoteaddr; /* Address of our peer */ - InetPort tcps_remoteport; /* Port number of our peer */ -#endif /* SUPPORT_OPENTRANSPORT */ - unsigned char *tcps_buffer; /* buffer given over to system to use */ - struct tcpstream *tcps_next; /* next one in chain */ - TCPNotifyUPP tcps_notifyupp; /* universal proc pointer for notify routine */ -} tcpstream, *tcpstreamptr; - -#define TCP_IS_TERMINATED( tsp ) (tsp)->tcps_terminated - -/* - * function prototypes - */ -#ifdef SUPPORT_OPENTRANSPORT -OSStatus tcp_init(void); -Boolean tcp_have_opentransport( void ); -#endif /* SUPPORT_OPENTRANSPORT */ -tcpstream *tcpopen( unsigned char * buf, long buflen ); -tcp_port tcpconnect( tcpstream *s, ip_addr addr, tcp_port port ); -short tcpclose( tcpstream *s ); -long tcpread( tcpstream *s, UInt8 timeout, unsigned char * rbuf, - unsigned short rbuflen, DialogPtr dlp ); -long tcpwrite( tcpstream *s, unsigned char * wbuf, unsigned short wbuflen ); -short tcpselect( tcpstream *s, struct timeval * timeout ); -short tcpreadready( tcpstream *tsp ); -short tcpwriteready( tcpstream *tsp ); -short tcpgetpeername( tcpstream * tsp, ip_addr *addrp, tcp_port *portp ); - -#ifdef SUPPORT_OPENTRANSPORT -short gethostinfobyname( char *host, InetHostInfo *hip ); -short gethostinfobyaddr(InetHost addr, InetHostInfo *hip ); -short ipaddr2str( InetHost ipaddr, char *addrstr ); -#else /* SUPPORT_OPENTRANSPORT */ -short gethostinfobyname( char *host, struct hostInfo *hip ); -short gethostinfobyaddr( ip_addr addr, struct hostInfo *hip ); -short ipaddr2str( ip_addr ipaddr, char *addrstr ); -#endif /* SUPPORT_OPENTRANSPORT */ diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldap32.def b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldap32.def deleted file mode 100644 index 080ed07d998..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldap32.def +++ /dev/null @@ -1,282 +0,0 @@ -LIBRARY LDAP3250 -DESCRIPTION 'Lightweight Directory Access Protocol Client API for 32-bit Windows' -VERSION 5.0 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -; -; exports list (generated by genexports.pl) -; - ldap_abandon @10 - ldap_add @11 - ldap_unbind @13 - -; ldap_enable_cache @14 -; ldap_disable_cache @15 -; ldap_destroy_cache @16 -; ldap_flush_cache @17 -; ldap_uncache_entry @18 - - ldap_compare @19 - ldap_delete @20 - ldap_result2error @21 - ldap_err2string @22 - ldap_modify @23 - ldap_modrdn @24 - ldap_open @25 - ldap_first_entry @26 - ldap_next_entry @27 - ldap_get_dn @30 - ldap_dn2ufn @31 - ldap_first_attribute @32 - ldap_next_attribute @33 - ldap_get_values @34 - ldap_get_values_len @35 - ldap_count_entries @36 - ldap_count_values @37 - ldap_value_free @38 - ldap_explode_dn @39 - ldap_result @40 - ldap_msgfree @41 - ldap_search @43 - ldap_add_s @44 - ldap_bind_s @45 - ldap_unbind_s @46 - ldap_delete_s @47 - ldap_modify_s @48 - ldap_modrdn_s @49 - ldap_search_s @50 - ldap_search_st @51 - ldap_compare_s @52 - ldap_ufn_search_c @53 - ldap_ufn_search_s @54 - ldap_init_getfilter @55 - ldap_getfilter_free @56 - ldap_getfirstfilter @57 - ldap_getnextfilter @58 - ldap_simple_bind @59 - ldap_simple_bind_s @60 - ldap_bind @61 - ldap_friendly_name @62 - ldap_free_friendlymap @63 - ldap_ufn_search_ct @64 - -; ldap_set_cache_options @65 -; ldap_uncache_request @66 - - ldap_modrdn2 @67 - ldap_modrdn2_s @68 - ldap_ufn_setfilter @69 - ldap_ufn_setprefix @70 - ldap_ufn_timeout @71 - ldap_init_getfilter_buf @72 - ldap_setfilteraffixes @73 - ldap_sort_entries @74 - ldap_sort_values @75 - ldap_sort_strcasecmp @76 - ldap_count_values_len @77 - ldap_name2template @78 - ldap_value_free_len @79 - -; manually comment and uncomment these five as necessary -; ldap_kerberos_bind1 @80 -; ldap_kerberos_bind2 @81 -; ldap_kerberos_bind_s @82 -; ldap_kerberos_bind1_s @83 -; ldap_kerberos_bind2_s @84 - - ldap_init @85 - ldap_is_dns_dn @86 - ldap_explode_dns @87 - ldap_mods_free @88 - - ldap_is_ldap_url @89 - ldap_free_urldesc @90 - ldap_url_parse @91 - ldap_url_search @92 - ldap_url_search_s @93 - ldap_url_search_st @94 - ldap_set_rebind_proc @95 - ber_skip_tag @100 - ber_peek_tag @101 - ber_get_int @102 - ber_get_stringb @103 - ber_get_stringa @104 - ber_get_stringal @105 - ber_get_bitstringa @106 - ber_get_null @107 - ber_get_boolean @108 - ber_first_element @109 - ber_next_element @110 - ber_scanf @111 - ber_bvfree @112 - ber_bvecfree @113 - ber_put_int @114 - ber_put_ostring @115 - ber_put_string @116 - ber_put_bitstring @117 - ber_put_null @118 - ber_put_boolean @119 - ber_start_seq @120 - ber_start_set @121 - ber_put_seq @122 - ber_put_set @123 - ber_printf @124 - ber_read @125 - ber_write @126 - ber_free @127 - ber_flush @128 - ber_alloc @129 - ber_dup @130 - ber_get_next @131 - ber_get_tag @132 - ber_put_enum @133 - der_alloc @134 - ber_alloc_t @135 - ber_bvdup @136 - ber_init_w_nullchar @137 - ber_reset @138 - ber_get_option @139 - ber_set_option @140 - ber_sockbuf_alloc @141 - ber_sockbuf_get_option @142 - ber_sockbuf_set_option @143 - ber_init @144 - ber_flatten @145 - ber_special_alloc @146 - ber_special_free @147 - ber_get_next_buffer @148 - ber_err_print @149 - ber_sockbuf_free @150 - ber_get_next_buffer_ext @151 - ber_svecfree @152 - - ldap_memfree @200 - ldap_ber_free @201 - - ldap_init_searchprefs @300 - ldap_init_searchprefs_buf @301 - ldap_free_searchprefs @302 - ldap_first_searchobj @303 - ldap_next_searchobj @304 - ldap_build_filter @305 - - ldap_init_templates @400 - ldap_init_templates_buf @401 - ldap_free_templates @402 - ldap_first_disptmpl @403 - ldap_next_disptmpl @404 - ldap_oc2template @405 - ldap_tmplattrs @406 - ldap_first_tmplrow @407 - ldap_next_tmplrow @408 - ldap_first_tmplcol @409 - ldap_next_tmplcol @410 - ldap_entry2text_search @411 - ldap_entry2text @412 - ldap_vals2text @413 - ldap_entry2html @414 - ldap_entry2html_search @415 - ldap_vals2html @416 - ldap_tmplerr2string @417 - ldap_set_option @418 - ldap_get_option @419 - ldap_charray_merge @420 - ldap_get_lderrno @430 - ldap_set_lderrno @431 - ldap_perror @432 - ldap_set_filter_additions @433 - ldap_create_filter @434 - ldap_version @440 - ldap_multisort_entries @441 - ldap_msgid @442 - ldap_explode_rdn @443 - ldap_msgtype @444 - ldap_cache_flush @445 - ldap_str2charray @446 - ldap_charray_add @447 - ldap_charray_dup @448 - ldap_charray_free @449 - -; Windows ordinals 450-469 are reserved for SSL routines - - ldap_charray_inlist @470 - ldap_charray_position @471 - ldap_rename @472 - ldap_rename_s @473 - ldap_utf8len @474 - ldap_utf8next @475 - ldap_utf8prev @476 - ldap_utf8copy @477 - ldap_utf8characters @478 - ldap_utf8strtok_r @479 - ldap_utf8isalnum @480 - ldap_utf8isalpha @481 - ldap_utf8isdigit @482 - ldap_utf8isxdigit @483 - ldap_utf8isspace @484 - ldap_control_free @485 - ldap_controls_free @486 - ldap_sasl_bind @487 - ldap_sasl_bind_s @488 - ldap_parse_sasl_bind_result @489 -; LDAPv3 simple paging controls are not supported by Netscape at this time. -; 490 ldap_create_page_control -; 491 ldap_parse_page_control - ldap_create_sort_control @492 - ldap_parse_sort_control @493 -; an LDAPv3 language control was proposed but then retracted. -; 494 ldap_create_language_control - ldap_get_lang_values @495 - ldap_get_lang_values_len @496 - ldap_free_sort_keylist @497 - ldap_create_sort_keylist @498 - ldap_utf8getcc @499 - ldap_get_entry_controls @500 - ldap_create_persistentsearch_control @501 - ldap_parse_entrychange_control @502 - ldap_parse_result @503 - ldap_parse_extended_result @504 - ldap_parse_reference @505 - ldap_abandon_ext @506 - ldap_add_ext @507 - ldap_add_ext_s @508 - ldap_modify_ext @509 - ldap_modify_ext_s @510 - ldap_first_message @511 - ldap_next_message @512 - ldap_compare_ext @513 - ldap_compare_ext_s @514 - ldap_delete_ext @515 - ldap_delete_ext_s @516 - ldap_search_ext @517 - ldap_search_ext_s @518 - ldap_extended_operation @519 - ldap_extended_operation_s @520 - ldap_first_reference @521 - ldap_next_reference @522 - ldap_count_references @523 - ldap_count_messages @524 - ldap_create_virtuallist_control @525 - ldap_parse_virtuallist_control @526 - ldap_create_proxyauth_control @527 - ldap_unbind_ext @528 - ldap_x_hostlist_first @529 - ldap_x_hostlist_next @530 - ldap_x_hostlist_statusfree @531 - ldap_x_malloc @532 - ldap_x_calloc @533 - ldap_x_realloc @534 - ldap_x_free @535 - ldap_create_proxiedauth_control @536 - ldap_memcache_init @1000 - ldap_memcache_set @1001 - ldap_memcache_get @1002 - ldap_memcache_flush @1003 - ldap_memcache_destroy @1004 - ldap_memcache_update @1005 - ldap_keysort_entries @1006 -; -; end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldap32.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldap32.tdf deleted file mode 100644 index 3db07ab468c..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldap32.tdf +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY LDAP32$1 -DESCRIPTION 'Lightweight Directory Access Protocol Client API for 32-bit Windows' -VERSION $2 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -$EXPORTS diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldapssl.def b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldapssl.def deleted file mode 100644 index 33228e1db43..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldapssl.def +++ /dev/null @@ -1,19 +0,0 @@ -; These are additional exports from nsldap.dll when it includes SSL. -; Tack this to the end of nsldap.def. -; -; exports list (generated by genexports.pl) -; - ldapssl_client_init @450 - ldapssl_init @451 - ldapssl_install_routines @452 - ldapssl_clientauth_init @453 - ldapssl_enable_clientauth @454 - ldapssl_advclientauth_init @456 - ldapssl_pkcs_init @457 - ldapssl_err2string @458 -; the last Windows ordinal number that has been reserved for SSL is 469. - -; Windows ordinals 1100-1150 are reserved for privately/non-published -; exported routines -; -; end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldapssl.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldapssl.tdf deleted file mode 100644 index d43f0400364..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/ldapssl.tdf +++ /dev/null @@ -1,3 +0,0 @@ -; These are additional exports from nsldap.dll when it includes SSL. -; Tack this to the end of nsldap.def. -$EXPORTS diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/libldap.def b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/libldap.def deleted file mode 100644 index b1ce5f3b78e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/libldap.def +++ /dev/null @@ -1,285 +0,0 @@ -LIBRARY NSLDAP -DESCRIPTION 'Lightweight Directory Access Protocol Client API for 16-bit Windows' -EXETYPE WINDOWS -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE SINGLE - -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -; -; exports list (generated by genexports.pl) -; - _ldap_abandon=LDAP_ABANDON @10 - _ldap_add=LDAP_ADD @11 - _ldap_unbind=LDAP_UNBIND @13 - -; _ldap_enable_cache=LDAP_ENABLE_CACHE @14 -; _ldap_disable_cache=LDAP_DISABLE_CACHE @15 -; _ldap_destroy_cache=LDAP_DESTROY_CACHE @16 -; _ldap_flush_cache=LDAP_FLUSH_CACHE @17 -; _ldap_uncache_entry=LDAP_UNCACHE_ENTRY @18 - - _ldap_compare=LDAP_COMPARE @19 - _ldap_delete=LDAP_DELETE @20 - _ldap_result2error=LDAP_RESULT2ERROR @21 - _ldap_err2string=LDAP_ERR2STRING @22 - _ldap_modify=LDAP_MODIFY @23 - _ldap_modrdn=LDAP_MODRDN @24 - _ldap_open=LDAP_OPEN @25 - _ldap_first_entry=LDAP_FIRST_ENTRY @26 - _ldap_next_entry=LDAP_NEXT_ENTRY @27 - _ldap_get_dn=LDAP_GET_DN @30 - _ldap_dn2ufn=LDAP_DN2UFN @31 - _ldap_first_attribute=LDAP_FIRST_ATTRIBUTE @32 - _ldap_next_attribute=LDAP_NEXT_ATTRIBUTE @33 - _ldap_get_values=LDAP_GET_VALUES @34 - _ldap_get_values_len=LDAP_GET_VALUES_LEN @35 - _ldap_count_entries=LDAP_COUNT_ENTRIES @36 - _ldap_count_values=LDAP_COUNT_VALUES @37 - _ldap_value_free=LDAP_VALUE_FREE @38 - _ldap_explode_dn=LDAP_EXPLODE_DN @39 - _ldap_result=LDAP_RESULT @40 - _ldap_msgfree=LDAP_MSGFREE @41 - _ldap_search=LDAP_SEARCH @43 - _ldap_add_s=LDAP_ADD_S @44 - _ldap_bind_s=LDAP_BIND_S @45 - _ldap_unbind_s=LDAP_UNBIND_S @46 - _ldap_delete_s=LDAP_DELETE_S @47 - _ldap_modify_s=LDAP_MODIFY_S @48 - _ldap_modrdn_s=LDAP_MODRDN_S @49 - _ldap_search_s=LDAP_SEARCH_S @50 - _ldap_search_st=LDAP_SEARCH_ST @51 - _ldap_compare_s=LDAP_COMPARE_S @52 - _ldap_ufn_search_c=LDAP_UFN_SEARCH_C @53 - _ldap_ufn_search_s=LDAP_UFN_SEARCH_S @54 - _ldap_init_getfilter=LDAP_INIT_GETFILTER @55 - _ldap_getfilter_free=LDAP_GETFILTER_FREE @56 - _ldap_getfirstfilter=LDAP_GETFIRSTFILTER @57 - _ldap_getnextfilter=LDAP_GETNEXTFILTER @58 - _ldap_simple_bind=LDAP_SIMPLE_BIND @59 - _ldap_simple_bind_s=LDAP_SIMPLE_BIND_S @60 - _ldap_bind=LDAP_BIND @61 - _ldap_friendly_name=LDAP_FRIENDLY_NAME @62 - _ldap_free_friendlymap=LDAP_FREE_FRIENDLYMAP @63 - _ldap_ufn_search_ct=LDAP_UFN_SEARCH_CT @64 - -; _ldap_set_cache_options=LDAP_SET_CACHE_OPTIONS @65 -; _ldap_uncache_request=LDAP_UNCACHE_REQUEST @66 - - _ldap_modrdn2=LDAP_MODRDN2 @67 - _ldap_modrdn2_s=LDAP_MODRDN2_S @68 - _ldap_ufn_setfilter=LDAP_UFN_SETFILTER @69 - _ldap_ufn_setprefix=LDAP_UFN_SETPREFIX @70 - _ldap_ufn_timeout @71 - _ldap_init_getfilter_buf=LDAP_INIT_GETFILTER_BUF @72 - _ldap_setfilteraffixes=LDAP_SETFILTERAFFIXES @73 - _ldap_sort_entries=LDAP_SORT_ENTRIES @74 - _ldap_sort_values=LDAP_SORT_VALUES @75 - _ldap_sort_strcasecmp @76 - _ldap_count_values_len=LDAP_COUNT_VALUES_LEN @77 - _ldap_name2template=LDAP_NAME2TEMPLATE @78 - _ldap_value_free_len=LDAP_VALUE_FREE_LEN @79 - -; manually comment and uncomment these five as necessary -; _ldap_kerberos_bind1=LDAP_KERBEROS_BIND1 @80 -; _ldap_kerberos_bind2=LDAP_KERBEROS_BIND2 @81 -; _ldap_kerberos_bind_s=LDAP_KERBEROS_BIND_S @82 -; _ldap_kerberos_bind1_s=LDAP_KERBEROS_BIND1_S @83 -; _ldap_kerberos_bind2_s=LDAP_KERBEROS_BIND2_S @84 - - _ldap_init=LDAP_INIT @85 - _ldap_is_dns_dn=LDAP_IS_DNS_DN @86 - _ldap_explode_dns=LDAP_EXPLODE_DNS @87 - _ldap_mods_free=LDAP_MODS_FREE @88 - - _ldap_is_ldap_url=LDAP_IS_LDAP_URL @89 - _ldap_free_urldesc=LDAP_FREE_URLDESC @90 - _ldap_url_parse=LDAP_URL_PARSE @91 - _ldap_url_search=LDAP_URL_SEARCH @92 - _ldap_url_search_s=LDAP_URL_SEARCH_S @93 - _ldap_url_search_st=LDAP_URL_SEARCH_ST @94 - _ldap_set_rebind_proc=LDAP_SET_REBIND_PROC @95 - _ber_skip_tag=BER_SKIP_TAG @100 - _ber_peek_tag=BER_PEEK_TAG @101 - _ber_get_int=BER_GET_INT @102 - _ber_get_stringb=BER_GET_STRINGB @103 - _ber_get_stringa=BER_GET_STRINGA @104 - _ber_get_stringal=BER_GET_STRINGAL @105 - _ber_get_bitstringa=BER_GET_BITSTRINGA @106 - _ber_get_null=BER_GET_NULL @107 - _ber_get_boolean=BER_GET_BOOLEAN @108 - _ber_first_element=BER_FIRST_ELEMENT @109 - _ber_next_element=BER_NEXT_ELEMENT @110 - _ber_scanf @111 - _ber_bvfree=BER_BVFREE @112 - _ber_bvecfree=BER_BVECFREE @113 - _ber_put_int=BER_PUT_INT @114 - _ber_put_ostring=BER_PUT_OSTRING @115 - _ber_put_string=BER_PUT_STRING @116 - _ber_put_bitstring=BER_PUT_BITSTRING @117 - _ber_put_null=BER_PUT_NULL @118 - _ber_put_boolean=BER_PUT_BOOLEAN @119 - _ber_start_seq=BER_START_SEQ @120 - _ber_start_set=BER_START_SET @121 - _ber_put_seq=BER_PUT_SEQ @122 - _ber_put_set=BER_PUT_SET @123 - _ber_printf @124 - _ber_read=BER_READ @125 - _ber_write=BER_WRITE @126 - _ber_free=BER_FREE @127 - _ber_flush=BER_FLUSH @128 - _ber_alloc=BER_ALLOC @129 - _ber_dup=BER_DUP @130 - _ber_get_next=BER_GET_NEXT @131 - _ber_get_tag=BER_GET_TAG @132 - _ber_put_enum=BER_PUT_ENUM @133 - _der_alloc=DER_ALLOC @134 - _ber_alloc_t=BER_ALLOC_T @135 - _ber_bvdup=BER_BVDUP @136 - _ber_init_w_nullchar=BER_INIT_W_NULLCHAR @137 - _ber_reset=BER_RESET @138 - _ber_get_option=BER_GET_OPTION @139 - _ber_set_option=BER_SET_OPTION @140 - _ber_sockbuf_alloc=BER_SOCKBUF_ALLOC @141 - _ber_sockbuf_get_option=BER_SOCKBUF_GET_OPTION @142 - _ber_sockbuf_set_option=BER_SOCKBUF_SET_OPTION @143 - _ber_init=BER_INIT @144 - _ber_flatten=BER_FLATTEN @145 - _ber_special_alloc=BER_SPECIAL_ALLOC @146 - _ber_special_free=BER_SPECIAL_FREE @147 - _ber_get_next_buffer=BER_GET_NEXT_BUFFER @148 - _ber_err_print @149 - _ber_sockbuf_free=BER_SOCKBUF_FREE @150 - _ber_get_next_buffer_ext=BER_GET_NEXT_BUFFER_EXT @151 - _ber_svecfree=BER_SVECFREE @152 - - _ldap_memfree=LDAP_MEMFREE @200 - _ldap_ber_free=LDAP_BER_FREE @201 - - _ldap_init_searchprefs=LDAP_INIT_SEARCHPREFS @300 - _ldap_init_searchprefs_buf=LDAP_INIT_SEARCHPREFS_BUF @301 - _ldap_free_searchprefs=LDAP_FREE_SEARCHPREFS @302 - _ldap_first_searchobj=LDAP_FIRST_SEARCHOBJ @303 - _ldap_next_searchobj=LDAP_NEXT_SEARCHOBJ @304 - _ldap_build_filter=LDAP_BUILD_FILTER @305 - - _ldap_init_templates=LDAP_INIT_TEMPLATES @400 - _ldap_init_templates_buf=LDAP_INIT_TEMPLATES_BUF @401 - _ldap_free_templates=LDAP_FREE_TEMPLATES @402 - _ldap_first_disptmpl=LDAP_FIRST_DISPTMPL @403 - _ldap_next_disptmpl=LDAP_NEXT_DISPTMPL @404 - _ldap_oc2template=LDAP_OC2TEMPLATE @405 - _ldap_tmplattrs=LDAP_TMPLATTRS @406 - _ldap_first_tmplrow=LDAP_FIRST_TMPLROW @407 - _ldap_next_tmplrow=LDAP_NEXT_TMPLROW @408 - _ldap_first_tmplcol=LDAP_FIRST_TMPLCOL @409 - _ldap_next_tmplcol=LDAP_NEXT_TMPLCOL @410 - _ldap_entry2text_search=LDAP_ENTRY2TEXT_SEARCH @411 - _ldap_entry2text=LDAP_ENTRY2TEXT @412 - _ldap_vals2text=LDAP_VALS2TEXT @413 - _ldap_entry2html=LDAP_ENTRY2HTML @414 - _ldap_entry2html_search=LDAP_ENTRY2HTML_SEARCH @415 - _ldap_vals2html=LDAP_VALS2HTML @416 - _ldap_tmplerr2string=LDAP_TMPLERR2STRING @417 - _ldap_set_option=LDAP_SET_OPTION @418 - _ldap_get_option=LDAP_GET_OPTION @419 - _ldap_charray_merge=LDAP_CHARRAY_MERGE @420 - _ldap_get_lderrno=LDAP_GET_LDERRNO @430 - _ldap_set_lderrno=LDAP_SET_LDERRNO @431 - _ldap_perror=LDAP_PERROR @432 - _ldap_set_filter_additions=LDAP_SET_FILTER_ADDITIONS @433 - _ldap_create_filter=LDAP_CREATE_FILTER @434 - _ldap_version=LDAP_VERSION @440 - _ldap_multisort_entries=LDAP_MULTISORT_ENTRIES @441 - _ldap_msgid=LDAP_MSGID @442 - _ldap_explode_rdn=LDAP_EXPLODE_RDN @443 - _ldap_msgtype=LDAP_MSGTYPE @444 - _ldap_cache_flush=LDAP_CACHE_FLUSH @445 - _ldap_str2charray=LDAP_STR2CHARRAY @446 - _ldap_charray_add=LDAP_CHARRAY_ADD @447 - _ldap_charray_dup=LDAP_CHARRAY_DUP @448 - _ldap_charray_free=LDAP_CHARRAY_FREE @449 - -; Windows ordinals 450-469 are reserved for SSL routines - - _ldap_charray_inlist=LDAP_CHARRAY_INLIST @470 - _ldap_charray_position=LDAP_CHARRAY_POSITION @471 - _ldap_rename=LDAP_RENAME @472 - _ldap_rename_s=LDAP_RENAME_S @473 - _ldap_utf8len=LDAP_UTF8LEN @474 - _ldap_utf8next=LDAP_UTF8NEXT @475 - _ldap_utf8prev=LDAP_UTF8PREV @476 - _ldap_utf8copy=LDAP_UTF8COPY @477 - _ldap_utf8characters=LDAP_UTF8CHARACTERS @478 - _ldap_utf8strtok_r=LDAP_UTF8STRTOK_R @479 - _ldap_utf8isalnum=LDAP_UTF8ISALNUM @480 - _ldap_utf8isalpha=LDAP_UTF8ISALPHA @481 - _ldap_utf8isdigit=LDAP_UTF8ISDIGIT @482 - _ldap_utf8isxdigit=LDAP_UTF8ISXDIGIT @483 - _ldap_utf8isspace=LDAP_UTF8ISSPACE @484 - _ldap_control_free=LDAP_CONTROL_FREE @485 - _ldap_controls_free=LDAP_CONTROLS_FREE @486 - _ldap_sasl_bind=LDAP_SASL_BIND @487 - _ldap_sasl_bind_s=LDAP_SASL_BIND_S @488 - _ldap_parse_sasl_bind_result=LDAP_PARSE_SASL_BIND_RESULT @489 -; LDAPv3 simple paging controls are not supported by Netscape at this time. -; 490 ldap_create_page_control -; 491 ldap_parse_page_control - _ldap_create_sort_control=LDAP_CREATE_SORT_CONTROL @492 - _ldap_parse_sort_control=LDAP_PARSE_SORT_CONTROL @493 -; an LDAPv3 language control was proposed but then retracted. -; 494 ldap_create_language_control - _ldap_get_lang_values=LDAP_GET_LANG_VALUES @495 - _ldap_get_lang_values_len=LDAP_GET_LANG_VALUES_LEN @496 - _ldap_free_sort_keylist=LDAP_FREE_SORT_KEYLIST @497 - _ldap_create_sort_keylist=LDAP_CREATE_SORT_KEYLIST @498 - _ldap_utf8getcc=LDAP_UTF8GETCC @499 - _ldap_get_entry_controls=LDAP_GET_ENTRY_CONTROLS @500 - _ldap_create_persistentsearch_control=LDAP_CREATE_PERSISTENTSEARCH_CONTROL @501 - _ldap_parse_entrychange_control=LDAP_PARSE_ENTRYCHANGE_CONTROL @502 - _ldap_parse_result=LDAP_PARSE_RESULT @503 - _ldap_parse_extended_result=LDAP_PARSE_EXTENDED_RESULT @504 - _ldap_parse_reference=LDAP_PARSE_REFERENCE @505 - _ldap_abandon_ext=LDAP_ABANDON_EXT @506 - _ldap_add_ext=LDAP_ADD_EXT @507 - _ldap_add_ext_s=LDAP_ADD_EXT_S @508 - _ldap_modify_ext=LDAP_MODIFY_EXT @509 - _ldap_modify_ext_s=LDAP_MODIFY_EXT_S @510 - _ldap_first_message=LDAP_FIRST_MESSAGE @511 - _ldap_next_message=LDAP_NEXT_MESSAGE @512 - _ldap_compare_ext=LDAP_COMPARE_EXT @513 - _ldap_compare_ext_s=LDAP_COMPARE_EXT_S @514 - _ldap_delete_ext=LDAP_DELETE_EXT @515 - _ldap_delete_ext_s=LDAP_DELETE_EXT_S @516 - _ldap_search_ext=LDAP_SEARCH_EXT @517 - _ldap_search_ext_s=LDAP_SEARCH_EXT_S @518 - _ldap_extended_operation=LDAP_EXTENDED_OPERATION @519 - _ldap_extended_operation_s=LDAP_EXTENDED_OPERATION_S @520 - _ldap_first_reference=LDAP_FIRST_REFERENCE @521 - _ldap_next_reference=LDAP_NEXT_REFERENCE @522 - _ldap_count_references=LDAP_COUNT_REFERENCES @523 - _ldap_count_messages=LDAP_COUNT_MESSAGES @524 - _ldap_create_virtuallist_control=LDAP_CREATE_VIRTUALLIST_CONTROL @525 - _ldap_parse_virtuallist_control=LDAP_PARSE_VIRTUALLIST_CONTROL @526 - _ldap_create_proxyauth_control=LDAP_CREATE_PROXYAUTH_CONTROL @527 - _ldap_unbind_ext=LDAP_UNBIND_EXT @528 - _ldap_x_hostlist_first=LDAP_X_HOSTLIST_FIRST @529 - _ldap_x_hostlist_next=LDAP_X_HOSTLIST_NEXT @530 - _ldap_x_hostlist_statusfree=LDAP_X_HOSTLIST_STATUSFREE @531 - _ldap_x_malloc=LDAP_X_MALLOC @532 - _ldap_x_calloc=LDAP_X_CALLOC @533 - _ldap_x_realloc=LDAP_X_REALLOC @534 - _ldap_x_free=LDAP_X_FREE @535 - _ldap_create_proxiedauth_control=LDAP_CREATE_PROXIEDAUTH_CONTROL @536 - _ldap_memcache_init=LDAP_MEMCACHE_INIT @1000 - _ldap_memcache_set=LDAP_MEMCACHE_SET @1001 - _ldap_memcache_get=LDAP_MEMCACHE_GET @1002 - _ldap_memcache_flush=LDAP_MEMCACHE_FLUSH @1003 - _ldap_memcache_destroy=LDAP_MEMCACHE_DESTROY @1004 - _ldap_memcache_update=LDAP_MEMCACHE_UPDATE @1005 - _ldap_keysort_entries=LDAP_KEYSORT_ENTRIES @1006 -; -; end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/libldap.rc b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/libldap.rc deleted file mode 100644 index f01daf89df2..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/libldap.rc +++ /dev/null @@ -1,53 +0,0 @@ -#ifdef APSTUDIO_INVOKED - #error: this file is not editable by App Studio; use an editor -#endif //APSTUDIO_INVOKED - -#include "ver.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,0 // Client SDK 1.0 - PRODUCTVERSION 1,0,0,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS (VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE) -#else - FILEFLAGS VS_FF_PRERELEASE // beta version -// FILEFLAGS 0 // final version -#endif -#ifdef _WIN32 - FILEOS VOS__WINDOWS32 -#else - FILEOS VOS_DOS_WINDOWS16 -#endif - FILETYPE VFT_APP - FILESUBTYPE 0 -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" // lang=US English, Charset=Windows Multilingual - BEGIN - VALUE "CompanyName", "Netscape Communication Corp.\0" - VALUE "FileDescription", "Lightweight Directory Access Protocol DLL\0" - VALUE "FileVersion", "1.0\0" -#ifdef _WIN32 - VALUE "InternalName", "NSLDAP32\0" -#else - VALUE "InternalName", "NSLDAP\0" -#endif - VALUE "LegalCopyright", "Copyright (c) 1996 Netscape Communications Corp.\0" - VALUE "LegalTrademarks", "None\0" -#ifdef _WIN32 - VALUE "OriginalFileName", "NSLDAP32.DLL\0" - VALUE "ProductName", "NSLDAP32\0" -#else - VALUE "OriginalFileName", "NSLDAP.DLL\0" - VALUE "ProductName", "NSLDAP\0" -#endif - VALUE "ProductVersion", "1.0\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 // English + Windows ANSI codepage - END -END diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/libldap.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/libldap.tdf deleted file mode 100644 index 662d81b721d..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/libldap.tdf +++ /dev/null @@ -1,12 +0,0 @@ -LIBRARY NSLDAP -DESCRIPTION 'Lightweight Directory Access Protocol Client API for 16-bit Windows' -EXETYPE WINDOWS -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE SINGLE - -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -$EXPORTS diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/mozock.c b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/mozock.c deleted file mode 100644 index eb2b33d7cc0..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/mozock.c +++ /dev/null @@ -1,670 +0,0 @@ -/* - * 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 -#include -#include - -// Purpose of this file is to implement an intermediate layer to our network -// services, the winsock. -// This intermediate layer will be able to function with and without a working -// winsock being present. -// The attempt to activate the winsock happens as would normally be expected, -// through the calling application's entry point to us, WSAStartup. -// Name of the winsock we would like to load. -// Diffs between OSs, Win32s is out in the cold if running 32 bits unless -// they also have a winsock name wsock32.dll. -#ifndef _WIN32 -#define SZWINSOCK "winsock.dll" -#else -#define SZWINSOCK "wsock32.dll" -#endif - -// Here is the enumeration for the winsock functions we have currently -// overridden (needed to run). Add more when needed. -// We use these to access proc addresses, and to hold a table of strings -// to obtain the proc addresses. -enum SockProc { - sp_WSAAsyncGetHostByName = 0, - sp_WSAAsyncSelect, - sp_WSACleanup, - sp_WSAGetLastError, - sp_WSASetLastError, - sp_WSAStartup, - sp___WSAFDIsSet, - sp_accept, - sp_bind, - sp_closesocket, - sp_connect, - sp_gethostbyname, - sp_gethostbyaddr, - sp_gethostname, - sp_getpeername, - sp_getsockname, - sp_getsockopt, - sp_getprotobyname, - sp_htonl, - sp_htons, - sp_inet_addr, - sp_ioctlsocket, - sp_listen, - sp_ntohl, - sp_ntohs, - sp_recv, - sp_select, - sp_send, - sp_setsockopt, - sp_shutdown, - sp_socket, - sp_inet_ntoa, - - sp_MaxProcs // Total count. -}; - -// Array of function names used in GetProcAddress to fill in our -// proc array when needed. -// This array must match the enumerations exactly. -char *spName[(int)sp_MaxProcs] = { - "WSAAsyncGetHostByName", - "WSAAsyncSelect", - "WSACleanup", - "WSAGetLastError", - "WSASetLastError", - "WSAStartup", - "__WSAFDIsSet", - "accept", - "bind", - "closesocket", - "connect", - "gethostbyname", - "gethostbyaddr", - "gethostname", - "getpeername", - "getsockname", - "getsockopt", - "getprotobyname", - "htonl", - "htons", - "inet_addr", - "ioctlsocket", - "listen", - "ntohl", - "ntohs", - "recv", - "select", - "send", - "setsockopt", - "shutdown", - "socket", - "inet_ntoa" -}; - -// Array of proc addresses to the winsock functions. -// These can be NULL, indicating their absence (as in the case we couldn't -// load the winsock.dll or one of the functions wasn't loaded). -// The procs assigned in must corellate with the enumerations exactly. -FARPROC spArray[(int)sp_MaxProcs]; - -// Typedef all the different types of functions that we must cast the -// procs to in order to call without the compiler barfing. -// Prefix is always sp. -// Retval is next, spelled out. -// Parameters in their order are next, spelled out. -typedef int (PASCAL FAR *sp_int_WORD_LPWSADATA)(WORD, LPWSADATA); -typedef int (PASCAL FAR *sp_int_void)(void); -typedef HANDLE (PASCAL FAR *sp_HANDLE_HWND_uint_ccharFARp_charFARp_int)(HWND, unsigned int, const char FAR *, char FAR *, int); -typedef int (PASCAL FAR *sp_int_SOCKET_HWND_uint_long)(SOCKET, HWND, unsigned int, long); -typedef void (PASCAL FAR *sp_void_int)(int); -typedef int (PASCAL FAR *sp_int_SOCKET_fdsetFARp)(SOCKET, fd_set FAR *); -typedef SOCKET(PASCAL FAR *sp_SOCKET_SOCKET_sockaddrFARp_intFARp)(SOCKET, struct sockaddr FAR *, int FAR *); -typedef int (PASCAL FAR *sp_int_SOCKET_csockaddrFARp_int)(SOCKET, const struct sockaddr FAR *, int); -typedef int (PASCAL FAR *sp_int_SOCKET)(SOCKET); -typedef struct hostent FAR *(PASCAL FAR *sp_hostentFARp_ccharFARp)(const char FAR *); -typedef struct hostent FAR *(PASCAL FAR *sp_hostentFARp_ccharFARp_int_int)(const char FAR *, int, int); -typedef int (PASCAL FAR *sp_int_charFARp_int)(char FAR *, int); -typedef int (PASCAL FAR *sp_int_SOCKET_sockaddrFARp_intFARp)(SOCKET, struct sockaddr FAR *, int FAR *); -typedef int (PASCAL FAR *sp_int_SOCKET_int_int_charFARp_intFARp)(SOCKET, int, int, char FAR *, int FAR *); -typedef u_long (PASCAL FAR *sp_ulong_ulong)(u_long); -typedef u_short (PASCAL FAR *sp_ushort_ushort)(u_short); -typedef unsigned long (PASCAL FAR *sp_ulong_ccharFARp)(const char FAR *); -typedef int (PASCAL FAR *sp_int_SOCKET_long_ulongFARp)(SOCKET, long, u_long FAR *); -typedef int (PASCAL FAR *sp_int_SOCKET_int)(SOCKET, int); -typedef int (PASCAL FAR *sp_int_SOCKET_charFARp_int_int)(SOCKET, char FAR *, int, int); -typedef int (PASCAL FAR *sp_int_int_fdsetFARp_fdsetFARp_fdsetFARp_ctimevalFARp)(int,fd_set FAR *,fd_set FAR *,fd_set FAR *,const struct timeval FAR*); -typedef int (PASCAL FAR *sp_int_SOCKET_ccharFARp_int_int)(SOCKET, const char FAR *, int, int); -typedef int (PASCAL FAR *sp_int_SOCKET_int_int_ccharFARp_int)(SOCKET, int, int, const char FAR *, int); -typedef SOCKET (PASCAL FAR *sp_SOCKET_int_int_int)(int, int, int); -typedef char FAR * (PASCAL FAR *sp_charFARp_in_addr)(struct in_addr in); -typedef struct protoent FAR * (PASCAL FAR *sp_protoentFARcchar)(const char FAR *); - -// Handle to the winsock, if loaded. -HINSTANCE hWinsock = NULL; - -#ifndef _WIN32 -// Last error code for the winsock. -int ispError = 0; -#endif - - -BOOL IsWinsockLoaded (int sp) -{ - if (hWinsock == NULL) - { - WSADATA wsaData; - WSAStartup(0x0101, &wsaData); - } -// Quick macro to tell if the winsock has actually loaded for a particular -// function. -// Debug version is a little more strict to make sure you get the names right. -#ifdef DEBUG - return hWinsock != NULL && spArray[(int)(sp)] != NULL; -#else // A little faster - return hWinsock != NULL; -#endif -} - -// Here are the functions that we have taken over by not directly linking -// with the winsock import library or importing through the def file. - -/* In win16 we simulate blocking commands as follows. Prior to issuing the - * command we make the socket not-blocking (WSAAsyncSelect does that). - * We then issue the command and see if it would have blocked. If so, we - * yield the processor and go to sleep until an event occurs that unblocks - * us (WSAAsyncSelect allowed us to register what that condition is). We - * keep repeating until we do not get a would-block indication when issuing - * the command. At that time we unregister the notification condition and - * return the result of the command to the caller. - */ - -//#ifndef _WIN32 -#if 0 -#define NON_BLOCKING(command,condition,index,type) \ - type iret; \ - HWND hWndFrame = AfxGetApp()->m_pMainWnd->m_hWnd; \ - while (TRUE) { \ - if (WSAAsyncSelect(s, hWndFrame, msg_NetActivity, condition) \ - == SOCKET_ERROR) { \ - break; \ - } \ - if(IsWinsockLoaded(index)) { \ - iret=command; \ - if (!(iret==SOCKET_ERROR && WSAGetLastError()==WSAEWOULDBLOCK)) { \ - WSAAsyncSelect(s, hWndFrame, msg_NetActivity, 0); \ - return iret; \ - } \ - PR_Yield(); \ - } else { \ - break; \ - } \ - } -#else -#define NON_BLOCKING(command,condition,index,type) \ - if(IsWinsockLoaded(index)) { \ - return command; \ - } -#endif - -int PASCAL FAR WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) { - // Our default return value is failure, though we change this regardless. - int iRetval = WSAVERNOTSUPPORTED; - - // Before doing anything, clear out our proc array. - memset(spArray, 0, sizeof(spArray)); - - // attempt to load the real winsock. - hWinsock = LoadLibrary(SZWINSOCK); -#ifdef _WIN32 - if(hWinsock != NULL) { -#else - if(hWinsock > HINSTANCE_ERROR) { -#endif - // Winsock was loaded. - // Get the proc addresses for each needed function next. - int spTraverse; - for(spTraverse = 0; spTraverse < (int)sp_MaxProcs; spTraverse++) { - spArray[spTraverse] = GetProcAddress(hWinsock, spName[spTraverse]); - if ( NULL == spArray[spTraverse] ) - return iRetval;// Bad winsock? Bad function name? - } - - // AllRight, attempt to make our first proxied call. - if(IsWinsockLoaded(sp_WSAStartup)) { - iRetval = ((sp_int_WORD_LPWSADATA)spArray[sp_WSAStartup])(wVersionRequested, lpWSAData); - } - - // If the return value is still an error at this point, we unload the DLL, - // so that we can act as though nothing happened and the user - // gets no network access. - if(iRetval != 0) { - // Clear out our proc array. - memset(spArray, 0, sizeof(spArray)); - - // Free up the winsock. - FreeLibrary(hWinsock); - hWinsock = NULL; - } - } -#ifndef _WIN32 - else { - // Failed to load. - // Set this to NULL so it is clear. - hWinsock = NULL; - } -#endif - - // Check our return value, if it isn't success, then we need to fake - // our own winsock implementation. - if(iRetval != 0) { - // We always return success. - iRetval = 0; - - // Fill in the structure. - // Return the version requested as the version supported. - lpWSAData->wVersion = wVersionRequested; - lpWSAData->wHighVersion = wVersionRequested; - - // Fill in a discription. - strcpy(lpWSAData->szDescription, "Mozock DLL internal implementation."); - strcpy(lpWSAData->szSystemStatus, "Winsock running, allowing no network access."); - - // Report a nice round number for sockets and datagram sizes. - lpWSAData->iMaxSockets = 4096; - lpWSAData->iMaxUdpDg = 4096; - - // No vendor information. - lpWSAData->lpVendorInfo = NULL; - } - - return(iRetval); -} - -int PASCAL FAR WSACleanup(void) { - int iRetval = 0; - - // Handling normally or internally. - // When IsWinsockLoaded() is called and hWinsock is NULL, it winds up calling WSAStartup - // which wedges rpcrt4.dll on win95 with some winsock implementations. Bug: 81359. - if(hWinsock && IsWinsockLoaded(sp_WSACleanup)) { - // Call their cleanup routine. - // We could set the return value here, but it is meaning less. - // We always return success. - iRetval = ((sp_int_void)spArray[sp_WSACleanup])(); - //ASSERT(iRetval == 0); - iRetval = 0; - } - - // Wether or not it succeeded, we free off the library here. - // Clear out our proc table too. - memset(spArray, 0, sizeof(spArray)); - if(hWinsock != NULL) { - FreeLibrary(hWinsock); - hWinsock = NULL; - } - - return(iRetval); -} - -HANDLE PASCAL FAR WSAAsyncGetHostByName(HWND hWnd, unsigned int wMsg, const char FAR *name, char FAR *buf, int buflen) { - // Normal or shim. - if(IsWinsockLoaded(sp_WSAAsyncGetHostByName)) { - return(((sp_HANDLE_HWND_uint_ccharFARp_charFARp_int)spArray[sp_WSAAsyncGetHostByName])(hWnd, wMsg, name, buf, buflen)); - } - - // Must return error here. - // Set our last error value to be that the net is down. - WSASetLastError(WSAENETDOWN); - return(NULL); -} - -int PASCAL FAR WSAAsyncSelect(SOCKET s, HWND hWnd, unsigned int wMsg, long lEvent) { - // Normal or shim. - if(IsWinsockLoaded(sp_WSAAsyncSelect)) { - return(((sp_int_SOCKET_HWND_uint_long)spArray[sp_WSAAsyncSelect])(s, hWnd, wMsg, lEvent)); - } - - // Must return error here. - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR WSAGetLastError(void) { - // See if someone else can handle. - if(IsWinsockLoaded(sp_WSAGetLastError)) { - return(((sp_int_void)spArray[sp_WSAGetLastError])()); - } - -#ifndef _WIN32 - { - // Fake it. - int iRetval = ispError; - ispError = 0; - return(iRetval); - } -#else - // Use default OS handler. - return(GetLastError()); -#endif -} - -void PASCAL FAR WSASetLastError(int iError) { - // See if someone else can handle. - if(IsWinsockLoaded(sp_WSASetLastError)) { - ((sp_void_int)spArray[sp_WSASetLastError])(iError); - return; - } - -#ifndef _WIN32 - // Fake it. - ispError = iError; - return; -#else - // Use default OS handler. - SetLastError(iError); - return; -#endif -} - -int PASCAL FAR __WSAFDIsSet(SOCKET fd, fd_set FAR *set) { - int i; - - // See if someone else will handle. - if(IsWinsockLoaded(sp___WSAFDIsSet)) { - return(((sp_int_SOCKET_fdsetFARp)spArray[sp___WSAFDIsSet])(fd, set)); - } - - // Default implementation. - i = set->fd_count; - while (i--) { - if (set->fd_array[i] == fd) { - return 1; - } - } - return 0; -} - -SOCKET PASCAL FAR accept(SOCKET s, struct sockaddr FAR *addr, int FAR *addrlen) { - // Internally or shim - NON_BLOCKING( - (((sp_SOCKET_SOCKET_sockaddrFARp_intFARp)spArray[sp_accept])(s, addr, addrlen)), - FD_ACCEPT, sp_accept, SOCKET); - - // Fail. - WSASetLastError(WSAENETDOWN); - return(INVALID_SOCKET); -} - -int PASCAL FAR bind(SOCKET s, const struct sockaddr FAR *name, int namelen) { - // Internally or shim - if(IsWinsockLoaded(sp_bind)) { - return(((sp_int_SOCKET_csockaddrFARp_int)spArray[sp_bind])(s, name, namelen)); - } - - // Fail. - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR closesocket(SOCKET s) { - // Internally or shim. - NON_BLOCKING( - (((sp_int_SOCKET)spArray[sp_closesocket])(s)), - FD_CLOSE, sp_closesocket, int); - - // Error. - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR connect(SOCKET s, const struct sockaddr FAR *name, int namelen) { - // Internally or shim. - if(IsWinsockLoaded(sp_connect)) { - /* This could block and so it would seem that the NON_BLOCK - * macro should be used here. However it was causing a crash - * and so it was decided to allow blocking here instead - */ - return (((sp_int_SOCKET_csockaddrFARp_int)spArray[sp_connect])(s, name, namelen)); - } - - // Err. - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -struct hostent FAR * PASCAL FAR gethostbyname(const char FAR *name) { - if(IsWinsockLoaded(sp_gethostbyname)) { - return(((sp_hostentFARp_ccharFARp)spArray[sp_gethostbyname])(name)); - } - - WSASetLastError(WSAENETDOWN); - return(NULL); -} - -struct hostent FAR * PASCAL FAR gethostbyaddr(const char FAR *addr, int len, int type) { - if(IsWinsockLoaded(sp_gethostbyaddr)) { - return(((sp_hostentFARp_ccharFARp_int_int)spArray[sp_gethostbyaddr])(addr, len, type)); - } - - WSASetLastError(WSAENETDOWN); - return(NULL); -} - -int PASCAL FAR gethostname(char FAR *name, int namelen) { - if(IsWinsockLoaded(sp_gethostname)) { - return(((sp_int_charFARp_int)spArray[sp_gethostname])(name, namelen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR getpeername(SOCKET s, struct sockaddr FAR *name, int FAR *namelen) { - if(IsWinsockLoaded(sp_getpeername)) { - return(((sp_int_SOCKET_sockaddrFARp_intFARp)spArray[sp_getpeername])(s, name, namelen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR getsockname(SOCKET s, struct sockaddr FAR *name, int FAR *namelen) { - if(IsWinsockLoaded(sp_getsockname)) { - return(((sp_int_SOCKET_sockaddrFARp_intFARp)spArray[sp_getsockname])(s, name, namelen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR getsockopt(SOCKET s, int level, int optname, char FAR *optval, int FAR *optlen) { - if(IsWinsockLoaded(sp_getsockopt)) { - return(((sp_int_SOCKET_int_int_charFARp_intFARp)spArray[sp_getsockopt])(s, level, optname, optval, optlen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -struct protoent FAR * PASCAL getprotobyname(const char FAR * name) { - if(IsWinsockLoaded(sp_getprotobyname)) { - return(((sp_protoentFARcchar)spArray[sp_getprotobyname])(name)); - } - - WSASetLastError(WSAENETDOWN); - return NULL; -} - -u_long PASCAL FAR htonl(u_long hostlong) { - if(IsWinsockLoaded(sp_htonl)) { - return(((sp_ulong_ulong)spArray[sp_htonl])(hostlong)); - } - -#ifndef _WIN32 - return - (((hostlong&0xff)<<24) + ((hostlong&0xff00)<<8) + - ((hostlong&0xff0000)>>8) + ((hostlong&0xff000000)>>24)); - -#else - // Just return what was passed in. - return(hostlong); -#endif -} - -u_short PASCAL FAR htons(u_short hostshort) { - if(IsWinsockLoaded(sp_htons)) { - return(((sp_ushort_ushort)spArray[sp_htons])(hostshort)); - } - -#ifndef _WIN32 - return (((hostshort&0xff)<<8) + ((hostshort&0xff00)>>8)); - -#else - // Just return what was passed in. - return(hostshort); -#endif -} - -u_long PASCAL FAR ntohl(u_long hostlong) { - if(IsWinsockLoaded(sp_ntohl)) { - return(((sp_ulong_ulong)spArray[sp_ntohl])(hostlong)); - } - -#ifndef _WIN32 - return - (((hostlong&0xff)<<24) + ((hostlong&0xff00)<<8) + - ((hostlong&0xff0000)>>8) + ((hostlong&0xff000000)>>24)); - -#else - // Just return what was passed in. - return(hostlong); -#endif -} - -u_short PASCAL FAR ntohs(u_short hostshort) { - if(IsWinsockLoaded(sp_ntohs)) { - return(((sp_ushort_ushort)spArray[sp_ntohs])(hostshort)); - } - -#ifndef _WIN32 - return (((hostshort&0xff)<<8) + ((hostshort&0xff00)>>8)); - -#else - // Just return what was passed in. - return(hostshort); -#endif -} - -unsigned long PASCAL FAR inet_addr(const char FAR *cp) { - if(IsWinsockLoaded(sp_inet_addr)) { - return(((sp_ulong_ccharFARp)spArray[sp_inet_addr])(cp)); - } - - return(INADDR_NONE); -} - -int PASCAL FAR ioctlsocket(SOCKET s, long cmd, u_long FAR *argp) { - if(IsWinsockLoaded(sp_ioctlsocket)) { - return(((sp_int_SOCKET_long_ulongFARp)spArray[sp_ioctlsocket])(s, cmd, argp)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR listen(SOCKET s, int backlog) { - if(IsWinsockLoaded(sp_listen)) { - return(((sp_int_SOCKET_int)spArray[sp_listen])(s, backlog)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR recv(SOCKET s, char FAR *buf, int len, int flags) { - NON_BLOCKING( - (((sp_int_SOCKET_charFARp_int_int)spArray[sp_recv])(s, buf, len, flags)), - FD_READ, sp_recv, int); - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR select(int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout) { - // If there's nothing to do, stop now before we go off into dll land. - // Optimization, boyz. - if((readfds && readfds->fd_count) || (writefds && writefds->fd_count) || (exceptfds && exceptfds->fd_count)) { - if(IsWinsockLoaded(sp_select)) { - return(((sp_int_int_fdsetFARp_fdsetFARp_fdsetFARp_ctimevalFARp)spArray[sp_select])(nfds,readfds,writefds,exceptfds,timeout)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); - } - - // No need to go to the DLL, there is nothing to do. - return(0); -} - -int PASCAL FAR send(SOCKET s, const char FAR *buf, int len, int flags) { - NON_BLOCKING( - - (((sp_int_SOCKET_ccharFARp_int_int)spArray[sp_send])(s, buf, len, flags)), - FD_WRITE, sp_send, int); - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR setsockopt(SOCKET s, int level, int optname, const char FAR *optval, int optlen) { - if(IsWinsockLoaded(sp_setsockopt)) { - return(((sp_int_SOCKET_int_int_ccharFARp_int)spArray[sp_setsockopt])(s, level, optname, optval, optlen)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -int PASCAL FAR shutdown(SOCKET s, int how) { - if(IsWinsockLoaded(sp_shutdown)) { - return(((sp_int_SOCKET_int)spArray[sp_shutdown])(s, how)); - } - - WSASetLastError(WSAENETDOWN); - return(SOCKET_ERROR); -} - -SOCKET PASCAL FAR socket(int af, int type, int protocol) { - if(IsWinsockLoaded(sp_socket)) { - return(((sp_SOCKET_int_int_int)spArray[sp_socket])(af, type, protocol)); - } - - WSASetLastError(WSAENETDOWN); - return(INVALID_SOCKET); -} - -char FAR * PASCAL FAR inet_ntoa(struct in_addr in) { - if(IsWinsockLoaded(sp_inet_ntoa)) { - return ((sp_charFARp_in_addr)spArray[sp_inet_ntoa])(in); - } - - WSASetLastError(WSAENETDOWN); - return NULL; -} diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nslch32.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nslch32.tdf deleted file mode 100644 index 89fcb9f094a..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nslch32.tdf +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY NSLCH32V$1 -DESCRIPTION 'LDAP Local DB Client API for 32-bit Windows' -VERSION $2 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -$EXPORTS diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.def b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.def deleted file mode 100644 index 5dad01b8325..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.def +++ /dev/null @@ -1,285 +0,0 @@ -LIBRARY NSLDAP -DESCRIPTION 'Lightweight Directory Access Protocol Client API for 16-bit Windows' -EXETYPE WINDOWS -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE SINGLE - -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -; -; exports list (generated by genexports.pl) -; - LDAP_ABANDON=_ldap_abandon @10 - LDAP_ADD=_ldap_add @11 - LDAP_UNBIND=_ldap_unbind @13 - -; LDAP_ENABLE_CACHE=_ldap_enable_cache @14 -; LDAP_DISABLE_CACHE=_ldap_disable_cache @15 -; LDAP_DESTROY_CACHE=_ldap_destroy_cache @16 -; LDAP_FLUSH_CACHE=_ldap_flush_cache @17 -; LDAP_UNCACHE_ENTRY=_ldap_uncache_entry @18 - - LDAP_COMPARE=_ldap_compare @19 - LDAP_DELETE=_ldap_delete @20 - LDAP_RESULT2ERROR=_ldap_result2error @21 - LDAP_ERR2STRING=_ldap_err2string @22 - LDAP_MODIFY=_ldap_modify @23 - LDAP_MODRDN=_ldap_modrdn @24 - LDAP_OPEN=_ldap_open @25 - LDAP_FIRST_ENTRY=_ldap_first_entry @26 - LDAP_NEXT_ENTRY=_ldap_next_entry @27 - LDAP_GET_DN=_ldap_get_dn @30 - LDAP_DN2UFN=_ldap_dn2ufn @31 - LDAP_FIRST_ATTRIBUTE=_ldap_first_attribute @32 - LDAP_NEXT_ATTRIBUTE=_ldap_next_attribute @33 - LDAP_GET_VALUES=_ldap_get_values @34 - LDAP_GET_VALUES_LEN=_ldap_get_values_len @35 - LDAP_COUNT_ENTRIES=_ldap_count_entries @36 - LDAP_COUNT_VALUES=_ldap_count_values @37 - LDAP_VALUE_FREE=_ldap_value_free @38 - LDAP_EXPLODE_DN=_ldap_explode_dn @39 - LDAP_RESULT=_ldap_result @40 - LDAP_MSGFREE=_ldap_msgfree @41 - LDAP_SEARCH=_ldap_search @43 - LDAP_ADD_S=_ldap_add_s @44 - LDAP_BIND_S=_ldap_bind_s @45 - LDAP_UNBIND_S=_ldap_unbind_s @46 - LDAP_DELETE_S=_ldap_delete_s @47 - LDAP_MODIFY_S=_ldap_modify_s @48 - LDAP_MODRDN_S=_ldap_modrdn_s @49 - LDAP_SEARCH_S=_ldap_search_s @50 - LDAP_SEARCH_ST=_ldap_search_st @51 - LDAP_COMPARE_S=_ldap_compare_s @52 - LDAP_UFN_SEARCH_C=_ldap_ufn_search_c @53 - LDAP_UFN_SEARCH_S=_ldap_ufn_search_s @54 - LDAP_INIT_GETFILTER=_ldap_init_getfilter @55 - LDAP_GETFILTER_FREE=_ldap_getfilter_free @56 - LDAP_GETFIRSTFILTER=_ldap_getfirstfilter @57 - LDAP_GETNEXTFILTER=_ldap_getnextfilter @58 - LDAP_SIMPLE_BIND=_ldap_simple_bind @59 - LDAP_SIMPLE_BIND_S=_ldap_simple_bind_s @60 - LDAP_BIND=_ldap_bind @61 - LDAP_FRIENDLY_NAME=_ldap_friendly_name @62 - LDAP_FREE_FRIENDLYMAP=_ldap_free_friendlymap @63 - LDAP_UFN_SEARCH_CT=_ldap_ufn_search_ct @64 - -; LDAP_SET_CACHE_OPTIONS=_ldap_set_cache_options @65 -; LDAP_UNCACHE_REQUEST=_ldap_uncache_request @66 - - LDAP_MODRDN2=_ldap_modrdn2 @67 - LDAP_MODRDN2_S=_ldap_modrdn2_s @68 - LDAP_UFN_SETFILTER=_ldap_ufn_setfilter @69 - LDAP_UFN_SETPREFIX=_ldap_ufn_setprefix @70 - LDAP_UFN_TIMEOUT=_ldap_ufn_timeout @71 - LDAP_INIT_GETFILTER_BUF=_ldap_init_getfilter_buf @72 - LDAP_SETFILTERAFFIXES=_ldap_setfilteraffixes @73 - LDAP_SORT_ENTRIES=_ldap_sort_entries @74 - LDAP_SORT_VALUES=_ldap_sort_values @75 - LDAP_SORT_STRCASECMP=_ldap_sort_strcasecmp @76 - LDAP_COUNT_VALUES_LEN=_ldap_count_values_len @77 - LDAP_NAME2TEMPLATE=_ldap_name2template @78 - LDAP_VALUE_FREE_LEN=_ldap_value_free_len @79 - -; manually comment and uncomment these five as necessary -; LDAP_KERBEROS_BIND1=_ldap_kerberos_bind1 @80 -; LDAP_KERBEROS_BIND2=_ldap_kerberos_bind2 @81 -; LDAP_KERBEROS_BIND_S=_ldap_kerberos_bind_s @82 -; LDAP_KERBEROS_BIND1_S=_ldap_kerberos_bind1_s @83 -; LDAP_KERBEROS_BIND2_S=_ldap_kerberos_bind2_s @84 - - LDAP_INIT=_ldap_init @85 - LDAP_IS_DNS_DN=_ldap_is_dns_dn @86 - LDAP_EXPLODE_DNS=_ldap_explode_dns @87 - LDAP_MODS_FREE=_ldap_mods_free @88 - - LDAP_IS_LDAP_URL=_ldap_is_ldap_url @89 - LDAP_FREE_URLDESC=_ldap_free_urldesc @90 - LDAP_URL_PARSE=_ldap_url_parse @91 - LDAP_URL_SEARCH=_ldap_url_search @92 - LDAP_URL_SEARCH_S=_ldap_url_search_s @93 - LDAP_URL_SEARCH_ST=_ldap_url_search_st @94 - LDAP_SET_REBIND_PROC=_ldap_set_rebind_proc @95 - BER_SKIP_TAG=_ber_skip_tag @100 - BER_PEEK_TAG=_ber_peek_tag @101 - BER_GET_INT=_ber_get_int @102 - BER_GET_STRINGB=_ber_get_stringb @103 - BER_GET_STRINGA=_ber_get_stringa @104 - BER_GET_STRINGAL=_ber_get_stringal @105 - BER_GET_BITSTRINGA=_ber_get_bitstringa @106 - BER_GET_NULL=_ber_get_null @107 - BER_GET_BOOLEAN=_ber_get_boolean @108 - BER_FIRST_ELEMENT=_ber_first_element @109 - BER_NEXT_ELEMENT=_ber_next_element @110 - BER_SCANF=_ber_scanf @111 - BER_BVFREE=_ber_bvfree @112 - BER_BVECFREE=_ber_bvecfree @113 - BER_PUT_INT=_ber_put_int @114 - BER_PUT_OSTRING=_ber_put_ostring @115 - BER_PUT_STRING=_ber_put_string @116 - BER_PUT_BITSTRING=_ber_put_bitstring @117 - BER_PUT_NULL=_ber_put_null @118 - BER_PUT_BOOLEAN=_ber_put_boolean @119 - BER_START_SEQ=_ber_start_seq @120 - BER_START_SET=_ber_start_set @121 - BER_PUT_SEQ=_ber_put_seq @122 - BER_PUT_SET=_ber_put_set @123 - BER_PRINTF=_ber_printf @124 - BER_READ=_ber_read @125 - BER_WRITE=_ber_write @126 - BER_FREE=_ber_free @127 - BER_FLUSH=_ber_flush @128 - BER_ALLOC=_ber_alloc @129 - BER_DUP=_ber_dup @130 - BER_GET_NEXT=_ber_get_next @131 - BER_GET_TAG=_ber_get_tag @132 - BER_PUT_ENUM=_ber_put_enum @133 - DER_ALLOC=_der_alloc @134 - BER_ALLOC_T=_ber_alloc_t @135 - BER_BVDUP=_ber_bvdup @136 - BER_INIT_W_NULLCHAR=_ber_init_w_nullchar @137 - BER_RESET=_ber_reset @138 - BER_GET_OPTION=_ber_get_option @139 - BER_SET_OPTION=_ber_set_option @140 - BER_SOCKBUF_ALLOC=_ber_sockbuf_alloc @141 - BER_SOCKBUF_GET_OPTION=_ber_sockbuf_get_option @142 - BER_SOCKBUF_SET_OPTION=_ber_sockbuf_set_option @143 - BER_INIT=_ber_init @144 - BER_FLATTEN=_ber_flatten @145 - BER_SPECIAL_ALLOC=_ber_special_alloc @146 - BER_SPECIAL_FREE=_ber_special_free @147 - BER_GET_NEXT_BUFFER=_ber_get_next_buffer @148 - BER_ERR_PRINT=_ber_err_print @149 - BER_SOCKBUF_FREE=_ber_sockbuf_free @150 - BER_GET_NEXT_BUFFER_EXT=_ber_get_next_buffer_ext @151 - BER_SVECFREE=_ber_svecfree @152 - - LDAP_MEMFREE=_ldap_memfree @200 - LDAP_BER_FREE=_ldap_ber_free @201 - - LDAP_INIT_SEARCHPREFS=_ldap_init_searchprefs @300 - LDAP_INIT_SEARCHPREFS_BUF=_ldap_init_searchprefs_buf @301 - LDAP_FREE_SEARCHPREFS=_ldap_free_searchprefs @302 - LDAP_FIRST_SEARCHOBJ=_ldap_first_searchobj @303 - LDAP_NEXT_SEARCHOBJ=_ldap_next_searchobj @304 - LDAP_BUILD_FILTER=_ldap_build_filter @305 - - LDAP_INIT_TEMPLATES=_ldap_init_templates @400 - LDAP_INIT_TEMPLATES_BUF=_ldap_init_templates_buf @401 - LDAP_FREE_TEMPLATES=_ldap_free_templates @402 - LDAP_FIRST_DISPTMPL=_ldap_first_disptmpl @403 - LDAP_NEXT_DISPTMPL=_ldap_next_disptmpl @404 - LDAP_OC2TEMPLATE=_ldap_oc2template @405 - LDAP_TMPLATTRS=_ldap_tmplattrs @406 - LDAP_FIRST_TMPLROW=_ldap_first_tmplrow @407 - LDAP_NEXT_TMPLROW=_ldap_next_tmplrow @408 - LDAP_FIRST_TMPLCOL=_ldap_first_tmplcol @409 - LDAP_NEXT_TMPLCOL=_ldap_next_tmplcol @410 - LDAP_ENTRY2TEXT_SEARCH=_ldap_entry2text_search @411 - LDAP_ENTRY2TEXT=_ldap_entry2text @412 - LDAP_VALS2TEXT=_ldap_vals2text @413 - LDAP_ENTRY2HTML=_ldap_entry2html @414 - LDAP_ENTRY2HTML_SEARCH=_ldap_entry2html_search @415 - LDAP_VALS2HTML=_ldap_vals2html @416 - LDAP_TMPLERR2STRING=_ldap_tmplerr2string @417 - LDAP_SET_OPTION=_ldap_set_option @418 - LDAP_GET_OPTION=_ldap_get_option @419 - LDAP_CHARRAY_MERGE=_ldap_charray_merge @420 - LDAP_GET_LDERRNO=_ldap_get_lderrno @430 - LDAP_SET_LDERRNO=_ldap_set_lderrno @431 - LDAP_PERROR=_ldap_perror @432 - LDAP_SET_FILTER_ADDITIONS=_ldap_set_filter_additions @433 - LDAP_CREATE_FILTER=_ldap_create_filter @434 - LDAP_VERSION=_ldap_version @440 - LDAP_MULTISORT_ENTRIES=_ldap_multisort_entries @441 - LDAP_MSGID=_ldap_msgid @442 - LDAP_EXPLODE_RDN=_ldap_explode_rdn @443 - LDAP_MSGTYPE=_ldap_msgtype @444 - LDAP_CACHE_FLUSH=_ldap_cache_flush @445 - LDAP_STR2CHARRAY=_ldap_str2charray @446 - LDAP_CHARRAY_ADD=_ldap_charray_add @447 - LDAP_CHARRAY_DUP=_ldap_charray_dup @448 - LDAP_CHARRAY_FREE=_ldap_charray_free @449 - -; Windows ordinals 450-469 are reserved for SSL routines - - LDAP_CHARRAY_INLIST=_ldap_charray_inlist @470 - LDAP_CHARRAY_POSITION=_ldap_charray_position @471 - LDAP_RENAME=_ldap_rename @472 - LDAP_RENAME_S=_ldap_rename_s @473 - LDAP_UTF8LEN=_ldap_utf8len @474 - LDAP_UTF8NEXT=_ldap_utf8next @475 - LDAP_UTF8PREV=_ldap_utf8prev @476 - LDAP_UTF8COPY=_ldap_utf8copy @477 - LDAP_UTF8CHARACTERS=_ldap_utf8characters @478 - LDAP_UTF8STRTOK_R=_ldap_utf8strtok_r @479 - LDAP_UTF8ISALNUM=_ldap_utf8isalnum @480 - LDAP_UTF8ISALPHA=_ldap_utf8isalpha @481 - LDAP_UTF8ISDIGIT=_ldap_utf8isdigit @482 - LDAP_UTF8ISXDIGIT=_ldap_utf8isxdigit @483 - LDAP_UTF8ISSPACE=_ldap_utf8isspace @484 - LDAP_CONTROL_FREE=_ldap_control_free @485 - LDAP_CONTROLS_FREE=_ldap_controls_free @486 - LDAP_SASL_BIND=_ldap_sasl_bind @487 - LDAP_SASL_BIND_S=_ldap_sasl_bind_s @488 - LDAP_PARSE_SASL_BIND_RESULT=_ldap_parse_sasl_bind_result @489 -; LDAPv3 simple paging controls are not supported by Netscape at this time. -; 490 ldap_create_page_control -; 491 ldap_parse_page_control - LDAP_CREATE_SORT_CONTROL=_ldap_create_sort_control @492 - LDAP_PARSE_SORT_CONTROL=_ldap_parse_sort_control @493 -; an LDAPv3 language control was proposed but then retracted. -; 494 ldap_create_language_control - LDAP_GET_LANG_VALUES=_ldap_get_lang_values @495 - LDAP_GET_LANG_VALUES_LEN=_ldap_get_lang_values_len @496 - LDAP_FREE_SORT_KEYLIST=_ldap_free_sort_keylist @497 - LDAP_CREATE_SORT_KEYLIST=_ldap_create_sort_keylist @498 - LDAP_UTF8GETCC=_ldap_utf8getcc @499 - LDAP_GET_ENTRY_CONTROLS=_ldap_get_entry_controls @500 - LDAP_CREATE_PERSISTENTSEARCH_CONTROL=_ldap_create_persistentsearch_control @501 - LDAP_PARSE_ENTRYCHANGE_CONTROL=_ldap_parse_entrychange_control @502 - LDAP_PARSE_RESULT=_ldap_parse_result @503 - LDAP_PARSE_EXTENDED_RESULT=_ldap_parse_extended_result @504 - LDAP_PARSE_REFERENCE=_ldap_parse_reference @505 - LDAP_ABANDON_EXT=_ldap_abandon_ext @506 - LDAP_ADD_EXT=_ldap_add_ext @507 - LDAP_ADD_EXT_S=_ldap_add_ext_s @508 - LDAP_MODIFY_EXT=_ldap_modify_ext @509 - LDAP_MODIFY_EXT_S=_ldap_modify_ext_s @510 - LDAP_FIRST_MESSAGE=_ldap_first_message @511 - LDAP_NEXT_MESSAGE=_ldap_next_message @512 - LDAP_COMPARE_EXT=_ldap_compare_ext @513 - LDAP_COMPARE_EXT_S=_ldap_compare_ext_s @514 - LDAP_DELETE_EXT=_ldap_delete_ext @515 - LDAP_DELETE_EXT_S=_ldap_delete_ext_s @516 - LDAP_SEARCH_EXT=_ldap_search_ext @517 - LDAP_SEARCH_EXT_S=_ldap_search_ext_s @518 - LDAP_EXTENDED_OPERATION=_ldap_extended_operation @519 - LDAP_EXTENDED_OPERATION_S=_ldap_extended_operation_s @520 - LDAP_FIRST_REFERENCE=_ldap_first_reference @521 - LDAP_NEXT_REFERENCE=_ldap_next_reference @522 - LDAP_COUNT_REFERENCES=_ldap_count_references @523 - LDAP_COUNT_MESSAGES=_ldap_count_messages @524 - LDAP_CREATE_VIRTUALLIST_CONTROL=_ldap_create_virtuallist_control @525 - LDAP_PARSE_VIRTUALLIST_CONTROL=_ldap_parse_virtuallist_control @526 - LDAP_CREATE_PROXYAUTH_CONTROL=_ldap_create_proxyauth_control @527 - LDAP_UNBIND_EXT=_ldap_unbind_ext @528 - LDAP_X_HOSTLIST_FIRST=_ldap_x_hostlist_first @529 - LDAP_X_HOSTLIST_NEXT=_ldap_x_hostlist_next @530 - LDAP_X_HOSTLIST_STATUSFREE=_ldap_x_hostlist_statusfree @531 - LDAP_X_MALLOC=_ldap_x_malloc @532 - LDAP_X_CALLOC=_ldap_x_calloc @533 - LDAP_X_REALLOC=_ldap_x_realloc @534 - LDAP_X_FREE=_ldap_x_free @535 - LDAP_CREATE_PROXIEDAUTH_CONTROL=_ldap_create_proxiedauth_control @536 - LDAP_MEMCACHE_INIT=_ldap_memcache_init @1000 - LDAP_MEMCACHE_SET=_ldap_memcache_set @1001 - LDAP_MEMCACHE_GET=_ldap_memcache_get @1002 - LDAP_MEMCACHE_FLUSH=_ldap_memcache_flush @1003 - LDAP_MEMCACHE_DESTROY=_ldap_memcache_destroy @1004 - LDAP_MEMCACHE_UPDATE=_ldap_memcache_update @1005 - LDAP_KEYSORT_ENTRIES=_ldap_keysort_entries @1006 -; -; end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.mak b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.mak deleted file mode 100644 index adb4521d23c..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.mak +++ /dev/null @@ -1,981 +0,0 @@ -# -# Windows Makefile for LDAP Client SDK. -# -# This makefile produces: -# 16-bit 32-bit -# ------ ------ -# nsldap.dll nsldap32.dll LDAP DLL -# nsldap.lib nsldap32.lib LDAP import library -# nsldaps.lib nsldaps32.lib LDAP static library -# -# This makefile works the same way as MOZILLA.MAK -# -# Setting in your environment or the command line will determine what you -# build. -# -# MOZ_SRC place holding the ns tree. Default = 'y:' -# LDAP_OUT place you would like output to go. Default = '.\' -# MOZ_DEBUG if defined, you are building debug -# MOZ_BITS set to 16 to build Win16, defaults to Win32. -# MOZ_SEC set to DOMESTIC for 128 US, defaults to EXPORT. -# MOZ_TOOLS place holding the build tools (e.g. makedep.exe) -# LINK_SEC if defined and pointing to a directory containing libsec & -# friends, then link them in. Default not set. -# -# LDAP_SRC place holding the ldap tree. Default = -# '$(MOZ_SRC)\mozilla\directory\c-sdk -# MSVC2 if defined, you are using Visual C++ 2.x tools, -# else you are using Visual C++ 4.* tools -# ALPHA define to build for DEC Alpha -# NO_PDB define to place debug info in object files, rather than PDB. -# -# In order to build, you first have to build dependencies. Build dependencies -# by: -# -# nmake -f nsldap.mak DEPEND=1 MOZ_DEBUG=1 -# -# -# Once dependencies are built, you can build by: -# -# nmake -f nsldap.mak MOZ_DEBUG=1 -# -# Build a static library with -# -# nmake -f nsldap.mak STATIC=1 static - -.SUFFIXES: .cpp .c .rc - -!if !defined(MOZ_SRC) -MOZ_SRC=y: -!endif - -!if !defined(MOZ_BITS) -MOZ_BITS=32 -!endif - -!if !defined(MOZ_LDAP_VER) -MOZ_LDAP_VER=40 -!endif - -!if !defined(LDAP_SRC) -!if "$(MOZ_BITS)"=="32" -LDAP_SRC=$(MOZ_SRC)\mozilla\directory\c-sdk -!else -LDAP_SRC=l: -!endif -!endif - -!if "$(MOZ_BITS)"=="16" && !EXIST( $(LDAP_SRC)\ldap\Makefile ) -!error For Win16 you need to SUBST l: %MOZ_SRC%\mozilla\directory\c-sdk -!endif - -!if !defined(LDAP_OUT) -LDAP_OUT=. -!endif - -!if !defined(MOZ_INT) -MOZ_INT=$(LDAP_OUT) -!endif - -!if !defined(MOZ_SEC) -MOZ_SEC=EXPORT -!endif - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!if "$(MOZ_BITS)"=="32" -DLL_BITS=32 -!endif - -CPP=cl.exe /nologo -MTL=mktyplib.exe /nologo -LINK= \ -!if "$(MOZ_BITS)"=="32" - link.exe /nologo -!else - link -!endif -# optlinks /BYORDINAL /XNOI /DETAILEDMAP /XREF /WARNDUPS \ -#/NTHOST /IMPLIB:"$(OUTDIR)\nsldap$(DLL_BITS).lib" - -RSC= \ -!if "$(MOZ_BITS)"=="32" - rc.exe -!else - rc -!endif - -# -# Add different product values here, like dec alpha, mips etc, win16... -# -!if defined(ALPHA) -PROD=alpha -MACHINE=/machine:alpha -MOZ_BITS=32 -!else -!if "$(MOZ_BITS)"=="32" -PROD=x86 -MACHINE=/machine:i386 -!else -PROD=16x86 -!endif -!endif - -LIBLDAP=$(LDAP_SRC)\ldap\libraries\libldap -LIBLBER=$(LDAP_SRC)\ldap\libraries\liblber -LIBUTIL=$(LDAP_SRC)\ldap\libraries\libutil -BUILDDIR=$(LDAP_SRC)\ldap\libraries\msdos\winsock - -# Generated file containing version and build numbers -VERFILE=$(LDAP_SRC)\ldap\include\sdkver.h -VERSRC=$(LDAP_SRC)\ldap\build\dirver.c -VERPROG=$(LDAP_SRC)\ldap\build\dirver.exe -DIRSDK_VERSION=4.0 - -########## Security ####################### -!if defined (LINK_SEC) -!if defined(MOZ_DEBUG) -OPTNAME=dbg -!else -OPTNAME=opt -!endif -#SECDIR=$(MOZ_SRC)\ns\dist\winnt4.0_$(OPTNAME).obj\lib -SECDIR=$(LINK_SEC) - -!if "$(MOZ_BITS)"=="32" -# Used by libsec in Win32 -RPCLIB=rpcrt4.lib -!endif - -!if "$(MOZ_BITS)"=="32" -SECSUPPORT=$(SECDIR)\libsslio.lib $(SECDIR)\libxp.lib $(SECDIR)\libnspr20.lib $(SECDIR)\libdbm.lib $(SECDIR)\libares.lib -!else -SECSUPPORT1=$(SECDIR)\ssl16.lib \ - $(SECDIR)\secutl16.lib \ -!ifdef NSPR20 - $(SECDIR)\nspr20.lib \ -!else - $(SECDIR)\pr1640.lib \ -!endif - $(SECDIR)\secnav16.lib \ - $(SECDIR)\cert16.lib \ - $(SECDIR)\sp1640.lib -SECSUPPORT2=$(SECDIR)\key16.lib \ - $(SECDIR)\hash16.lib \ - $(SECDIR)\pkcs716.lib \ - $(SECDIR)\pkcs1216.lib \ - $(SECDIR)\crypto16.lib \ -!endif - -!if "$(MOZ_SEC)"=="EXPORT" -!if "$(MOZ_BITS)"=="32" -SECLIB=$(SECDIR)\libsec-export.lib $(SECSUPPORT) -!else -SECLIB=$(SECDIR)\secmod16.lib $(SECSUPPORT) -!endif -SSL_FLAG=/DNET_SSL -SECMODEL=\export -LINK_SSL_FLAG=/DLINK_SSL -!else -!if "$(MOZ_SEC)"=="DOMESTIC" -!if "$(MOZ_BITS)"=="32" -SECLIB=$(SECDIR)\libsec-us.lib $(SECSUPPORT) -!else -SECLIB=$(SECDIR)\secmod16.lib $(SECSUPPORT) -!endif -SSL_FLAG=/DNET_SSL -SECMODEL=\domestic -LINK_SSL_FLAG=/DLINK_SSL -!else -SECMODEL=\none -!endif -!endif -!endif -########## end Security ################### - - -# Dynamic library name -DYNAMICLIB="$(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll" - -# Static library name -STATICLIB=$(OUTDIR)\nsldaps$(DLL_BITS)v$(MOZ_LDAP_VER).lib - -# Get C runtime library version info right -# -!if defined(MSVC2) -# using Visual C++ 2.* -C_RUNTIME=msvcrt.lib -!else -!if defined(MOZ_DEBUG) -C_RUNTIME=msvcrtd.lib -!else -C_RUNTIME=msvcrt.lib -!endif -!endif - - -# Command to build a static library -LIBCMD= \ -!if "$(MOZ_BITS)"=="32" - link.exe -lib /nologo -!else - lib.exe /nologo -!endif - - -# -# Should reflect non debug settings always, -# regardless if CFLAGS_DEBUG is doing -# so also. -# This is so 16 bits can compile only portions desired -# as debug (and still link). -# -# Note: the 16-bit DLL does not work if compiled with /Ox -CFLAGS_RELEASE=/DNDEBUG \ -!IF "$(MOZ_BITS)"=="32" - /Ox /Gy \ -!if defined(NO_PDB) - /Z7 -!else - /Zi \ -!if !defined(MSVC2) - /Gm /Gi -!endif -!endif -!ENDIF - -RCFLAGS_RELEASE=/DNODEBUG - -LINKFLAGS_RELEASE= \ -!if "$(MOZ_BITS)"=="32" - $(C_RUNTIME) winmm.lib\ -!else - /NOLOGO /NOD /NOI /NOE /PACKC:61440 /ALIGN:16 /ONERROR:NOEXE -# /STACK:35000 /ALIGN:64 /PACKC:61440 /SEG:1024 /NOD /PACKD /NOI /ONERROR:NOEXE -!endif - -### - -# To produce a PDB, add /Zi /Gm /Gi and remove /Z7 from CFLAGS_DEBUG, -# also remove pdb:none from link. -# from link options. -!if defined(MOZ_DEBUG) -!if defined(NO_PDB) -CFLAGS_DEBUG=/Z7 /Od /D_DEBUG $(MOZ_USERDEBUG) -PDB=/pdb:none -!else -CFLAGS_DEBUG=/Zi /Od /D_DEBUG $(MOZ_USERDEBUG) \ -!if "$(MOZ_BITS)"=="32" -!if !defined(MSVC2) - /Gm /Gi \ -!endif - /Gy /DDEBUG -!endif -!endif -!endif - -RCFLAGS_DEBUG=/DDEBUG /D_DEBUG - -LINKFLAGS_DEBUG= \ -!if "$(MOZ_BITS)"=="32" - /debug /incremental:yes $(C_RUNTIME) winmm.lib\ -!else - /NOLOGO /NOD /NOI /NOE /PACKC:61440 /ALIGN:16 /ONERROR:NOEXE /CO /MAP:FULL -# /STACK:30000 /ALIGN:128 /PACKC:61440 /SEG:1024 /NOD /PACKD /NOI /CO /ONERROR:NOEXE /NTHOST\ -!endif - - -!IF "$(MOZ_BITS)"=="32" -!if defined(MOZ_DEBUG) -!if !defined(MSVC2) -DLLFLAGS=/MDd -!else -DLLFLAGS=/MD -!endif -!else -DLLFLAGS=/MD -!endif -!else -# 16-bit -!if defined(STATIC) -DLLFLAGS=/AL -!else -DLLFLAGS=/D_WINDLL /ALu -!endif -!endif - - -############### DEBUG ######################################### - -!if defined(MOZ_DEBUG) -VERSTR=Dbg -DISTBASE=WIN$(MOZ_BITS)_D.OBJ -CFLAGS=$(CFLAGS_DEBUG) -RCFLAGS=$(RCFLAGS_DEBUG) -LFLAGS=$(LINKFLAGS_DEBUG) - -############### RELEASE ######################################## - -!else -VERSTR=Rel -DISTBASE=WIN$(MOZ_BITS)_O.OBJ -CFLAGS=$(CFLAGS_RELEASE) -RCFLAGS=$(RCFLAGS_RELEASE) -LFLAGS=$(LINKFLAGS_RELEASE) -!endif - -############### END ########################################### - -DIST_XP = $(MOZ_SRC)\mozilla\dist -DIST=$(DIST_XP)\$(DISTBASE) -DIST_PUBLIC=$(DIST_XP)\include - -# -# Edit these in order to control 16 bit -# debug targets. -# -CFLAGS_LIBLDAP_C=\ -!if "$(MOZ_BITS)"=="32" - $(CFLAGS) -!else - $(CFLAGS) -!endif -CFLAGS_LIBLBER_C=\ -!if "$(MOZ_BITS)"=="32" - $(CFLAGS) -!else - $(CFLAGS) -!endif -CFLAGS_WINSOCK_C=\ -!if "$(MOZ_BITS)"=="32" - $(CFLAGS) -!else - $(CFLAGS) -!endif -CFLAGS_LIBUTIL_C=\ -!if "$(MOZ_BITS)"=="32" - $(CFLAGS) -!else - $(CFLAGS) -!endif - -OUTDIR=$(LDAP_OUT)$(SECMODEL)\$(PROD)$(VERSTR) - -LINK_FLAGS= \ -!if "$(MOZ_BITS)"=="32" - $(OUTDIR)\nsldap.res \ - $(LFLAGS) \ - $(SECLIB) $(RPCLIB) $(C_RUNTIME) WSOCK32.LIB oldnames.lib kernel32.lib user32.lib \ - /subsystem:windows $(PDB) $(MACHINE) \ - /dll /def:"$(BUILDDIR)\nsldap$(DLL_BITS)40.def" \ - /implib:"$(OUTDIR)/nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).lib" \ - /nodefaultlib /out:"$(OUTDIR)/nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll" -!else - $(LFLAGS) \ -!if defined(LINK_SEC) - /SEG:1024 -!endif -!endif - -CFLAGS_GENERAL=/c $(DLLFLAGS) /W3 /Fo"$(OUTDIR)/" /Fd"$(OUTDIR)/" \ -!if "$(MOZ_BITS)"=="32" - /GX -!else - /G2 -!endif - -RCFLAGS_GENERAL= \ -!if "$(MOZ_BITS)"=="32" - /l 0x409 -!else - /r -!endif - -CINCLUDES= \ -!if defined (LINK_SEC) && "$(SEC_MODEL)" != "none" - /I$(MOZ_SRC)\ns\include \ - /I$(MOZ_SRC)\ns\dist\public\nspr \ -!endif - /I$(LDAP_SRC)\ldap\include \ - /I$(LIBLDAP) \ - /I$(LIBLBER) \ - /I$(LDAP_SRC)\ldap\libraries\msdos - -RCINCLUDES=$(LDAP_SRC)\ldap\include - -CDEFINES= \ - /D_WINDOWS /DWINSOCK \ - /DTEMPLATEFILE=\"ldaptemplate.conf\" \ - /DFILTERFILE=\"ldapfilter.conf\" \ -!if defined(MOZ_DEBUG) - /DLDAP_DEBUG \ -!endif - /DNEEDPROTOS \ - /DLDBM_USE_DBBTREE \ -!if "$(MOZ_BITS)" == "32" - /D_WIN32 \ - /DWIN32_KERNEL_THREADS \ -!else - /DUSE_DEBUG_WIN \ -!endif - $(SSL_FLAG) \ - $(LINK_SSL_FLAG) \ - /DLDAP_REFERRALS \ - /DNO_USERINTERFACE - -LIB_FLAGS= \ -!if "$(MOZ_BITS)"=="32" - /out:"$(STATICLIB)" -!else - $(STATICLIB) -!endif - -RCDEFINES= - -CFILEFLAGS=$(CFLAGS_GENERAL) ^ - $(CDEFINES) ^ - $(CINCLUDES) ^ - -RCFILEFLAGS=$(RCFLAGS_GENERAL)\ - $(RCFLAGS_DEBUG)\ - $(RCDEFINES) - - -!ifdef DEPEND - -#============================================================================== -# -# Build dependencies step -# -#============================================================================== - -all: \ -!if "$(MOZ_BITS)"=="16" -win16suxrox \ -!endif -"$(OUTDIR)" $(OUTDIR)\nsldap.dep $(VERFILE) - -!if "$(MOZ_BITS)"=="16" -# Copy long-named files into 8.3 since NT 3.51 seems to require it. -# Win95 and NT 4.0 seem to tolerate the long names -win16suxrox : \ - $(LIBLDAP)\countval.c \ - $(LIBLDAP)\freevalu.c \ - $(LIBLDAP)\getdxbyn.c \ - $(LIBLDAP)\getfilte.c \ - $(LIBLDAP)\getoptio.c \ - $(LIBLDAP)\getvalue.c \ - $(LIBLDAP)\setoptio.c \ - $(LIBLDAP)\vlstctrl.c \ - $(LIBLDAP)\proxctrl.c \ - -$(LIBLDAP)\countval.c : $(LIBLDAP)\countvalues.c - copy $(LIBLDAP)\countvalues.c $(LIBLDAP)\countval.c - -$(LIBLDAP)\freevalu.c : $(LIBLDAP)\freevalues.c - copy $(LIBLDAP)\freevalues.c $(LIBLDAP)\freevalu.c - -$(LIBLDAP)\getdxbyn.c : - copy $(LIBLDAP)\getdxbyname.c $(LIBLDAP)\getdxbyn.c - -$(LIBLDAP)\getfilte.c : $(LIBLDAP)\getfilter.c - copy $(LIBLDAP)\getfilter.c $(LIBLDAP)\getfilte.c - -$(LIBLDAP)\getoptio.c : $(LIBLDAP)\getoption.c - copy $(LIBLDAP)\getoption.c $(LIBLDAP)\getoptio.c - -$(LIBLDAP)\getvalue.c : $(LIBLDAP)\getvalues.c - copy $(LIBLDAP)\getvalues.c $(LIBLDAP)\getvalue.c - -$(LIBLDAP)\setoptio.c : $(LIBLDAP)\setoption.c - copy $(LIBLDAP)\setoption.c $(LIBLDAP)\setoptio.c - -$(LIBLDAP)\vlstctrl.c : $(LIBLDAP)\vlistctrl.c - copy $(LIBLDAP)\vlistctrl.c $(LIBLDAP)\vlstctrl.c - -$(LIBLDAP)\proxyauthctrl.c : $(LIBLDAP)\proxyauthctrl.c - copy $(LIBLDAP)\proxyauthctrl.c $(LIBLDAP)\proxauth.c -!endif - -$(OUTDIR)\nsldap.dep: $(BUILDDIR)\\nsldap.mak - @rem <<$(PROD)$(VERSTR).dep - $(CINCLUDES) -O $(OUTDIR)\nsldap.dep -<< - $(MOZ_SRC)\mozilla\config\makedep @$(PROD)$(VERSTR).dep -F << - $(LIBLDAP)\abandon.c - $(LIBLDAP)\add.c - $(LIBLDAP)\bind.c - $(LIBLDAP)\cache.c - $(LIBLDAP)\charray.c - $(LIBLDAP)\charset.c - $(LIBLDAP)\compare.c - $(LIBLDAP)\control.c -!if "$(MOZ_BITS)"=="32" - $(LIBLDAP)\countvalues.c -!else - $(LIBLDAP)\countval.c -!endif - $(LIBLDAP)\delete.c - $(LIBLDAP)\disptmpl.c - $(LIBLDAP)\dllmain.c - $(LIBLDAP)\dsparse.c - $(LIBLDAP)\error.c - $(LIBLDAP)\extendop.c - $(LIBLDAP)\free.c -!if "$(MOZ_BITS)"=="32" - $(LIBLDAP)\freevalues.c -!else - $(LIBLDAP)\freevalu.c -!endif - $(LIBLDAP)\friendly.c - $(LIBLDAP)\getattr.c - $(LIBLDAP)\getdn.c -!if "$(MOZ_BITS)"=="32" - $(LIBLDAP)\getdxbyname.c -!else - $(LIBLDAP)\getdxbyn.c -!endif - $(LIBLDAP)\getentry.c -!if "$(MOZ_BITS)"=="32" - $(LIBLDAP)\getfilter.c - $(LIBLDAP)\getoption.c - $(LIBLDAP)\getvalues.c -!else - $(LIBLDAP)\getfilte.c - $(LIBLDAP)\getoptio.c - $(LIBLDAP)\getvalue.c -!endif - $(LIBLDAP)\memcache.c - $(LIBLDAP)\message.c - $(LIBLDAP)\modify.c - $(LIBLDAP)\mozock.c - $(LIBLDAP)\open.c - $(LIBLDAP)\os-ip.c - $(LIBLDAP)\psearch.c - $(LIBLDAP)\referral.c - $(LIBLDAP)\regex.c - $(LIBLDAP)\rename.c - $(LIBLDAP)\request.c - $(LIBLDAP)\reslist.c - $(LIBLDAP)\result.c - $(LIBLDAP)\saslbind.c - $(LIBLDAP)\sbind.c - $(LIBLDAP)\search.c -!if "$(MOZ_BITS)"=="32" - $(LIBLDAP)\setoption.c -!else - $(LIBLDAP)\setoptio.c -!endif - $(LIBLDAP)\sort.c - $(LIBLDAP)\sortctrl.c - $(LIBLDAP)\srchpref.c - $(LIBLDAP)\tmplout.c - $(LIBLDAP)\ufn.c - $(LIBLDAP)\unbind.c - $(LIBLDAP)\unescape.c - $(LIBLDAP)\url.c - $(LIBLDAP)\utf8.c -!if "$(MOZ_BITS)"=="32" - $(LIBLDAP)\vlistctrl.c - $(LIBLDAP)\proxyauthctrl.c -!else - $(LIBLDAP)\vlstctrl.ca - $(LIBLDAP)\proxauth.c -!endif - $(LIBLBER)\bprint.c - $(LIBLBER)\decode.c - $(LIBLBER)\encode.c - $(LIBLBER)\io.c - $(LIBLDAP)\dllmain.c - -!if defined(LINK_SEC) - $(BUILDDIR)\ssl16.c -!endif - -<< - -!endif - -!ifdef EXPORT - -#============================================================================== -# -# Export to DIST step -# -#============================================================================== - -all : $(DIST) $(DIST)\lib $(DIST)\bin $(DIST_PUBLIC) $(DIST_PUBLIC)\ldap install - -# Create all the directories we could possibly need - -$(DIST_XP) : - if not exist "$(DIST_XP)\$(NULL)" mkdir "$(DIST_XP)" - -$(DIST) : $(DIST_XP) - if not exist "$(DIST)\$(NULL)" mkdir "$(DIST)" - -$(DIST)\lib : - if not exist "$(DIST)\lib\$(NULL)" mkdir "$(DIST)\lib" - -$(DIST)\bin : - if not exist "$(DIST)\bin\$(NULL)" mkdir "$(DIST)\bin" - -$(DIST_PUBLIC) : - if not exist "$(DIST_PUBLIC)\$(NULL)" mkdir "$(DIST_PUBLIC)" - -$(DIST_PUBLIC)\ldap : - if not exist "$(DIST_PUBLIC)\ldap\$(NULL)" mkdir "$(DIST_PUBLIC)\ldap" - - -# Copy everything an LDAP client could need up to DIST - -install : \ - $(DIST)\bin\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll \ - $(DIST)\lib\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).lib \ -!if "$(MOZ_BITS)"=="32" -# makedep needs to generate syntax for 16-bit lib.exe - $(DIST)\lib\nsldaps$(DLL_BITS)v$(MOZ_LDAP_VER).lib \ -!endif -!if "$(MOZ_BITS)"=="32" - $(DIST_PUBLIC)\ldap\lber.h \ - $(DIST_PUBLIC)\ldap\ldap.h \ - $(DIST_PUBLIC)\ldap\disptmpl.h \ -!else - $(DIST_PUBLIC)\win16\lber.h \ - $(DIST_PUBLIC)\win16\ldap.h \ - $(DIST_PUBLIC)\win16\disptmpl.h \ -!endif - -$(DIST)\bin\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll : $(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll - copy $(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll $(DIST)\bin\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll - -$(DIST)\lib\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).lib : $(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).lib - copy $(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).lib $(DIST)\lib\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).lib - -!if "$(MOZ_BITS)"=="32" -# makedep needs to generate syntax for 16-bit lib.exe -$(DIST)\lib\nsldaps$(DLL_BITS)v$(MOZ_LDAP_VER).lib : $(OUTDIR)\nsldaps$(DLL_BITS)v$(MOZ_LDAP_VER).lib - copy $(OUTDIR)\nsldaps$(DLL_BITS)v$(MOZ_LDAP_VER).lib $(DIST)\lib\nsldaps$(DLL_BITS)v$(MOZ_LDAP_VER).lib -!endif - -!if "$(MOZ_BITS)"=="32" -$(DIST_PUBLIC)\ldap\lber.h : $(LDAP_SRC)\ldap\include\lber.h - copy $(LDAP_SRC)\ldap\include\lber.h $(DIST_PUBLIC)\ldap\lber.h - -$(DIST_PUBLIC)\ldap\ldap.h : $(LDAP_SRC)\ldap\include\ldap.h - copy $(LDAP_SRC)\ldap\include\ldap.h $(DIST_PUBLIC)\ldap\ldap.h - -$(DIST_PUBLIC)\ldap\disptmpl.h : $(LDAP_SRC)\ldap\include\disptmpl.h - copy $(LDAP_SRC)\ldap\include\disptmpl.h $(DIST_PUBLIC)\ldap\disptmpl.h -!else -$(DIST_PUBLIC)\win16\lber.h : $(LDAP_SRC)\ldap\include\lber.h - copy $(LDAP_SRC)\ldap\include\lber.h $(DIST_PUBLIC)\win16\lber.h - -$(DIST_PUBLIC)\win16\ldap.h : $(LDAP_SRC)\ldap\include\ldap.h - copy $(LDAP_SRC)\ldap\include\ldap.h $(DIST_PUBLIC)\win16\ldap.h - -$(DIST_PUBLIC)\win16\disptmpl.h : $(LDAP_SRC)\ldap\include\disptmpl.h - copy $(LDAP_SRC)\ldap\include\disptmpl.h $(DIST_PUBLIC)\win16\disptmpl.h -!endif - -!endif - -!if !defined(EXPORT) && !defined(DEPEND) - -#============================================================================== -# -# Normal build step -# -#============================================================================== - -all : $(OUTDIR)\nsldap.dep "$(OUTDIR)" $(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll \ -!if "$(MOZ_BITS)"=="32" -# makedep needs to generate syntax for 16-bit lib.exe -$(STATICLIB) -!endif - -# Allow makefile to work without dependencies generated. -!if exist("$(OUTDIR)\nsldap.dep") -!include "$(OUTDIR)\nsldap.dep" -!endif - -#nuke all the output directories -clobber_all: - -rd /s /q $(LDAP_OUT)\x86Dbg - -rd /s /q $(LDAP_OUT)\x86Rel - -rd /s /q $(LDAP_OUT)\16x86Dbg - -rd /s /q $(LDAP_OUT)\16x86Rel - -!endif - -$(OUTDIR) : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - - -# -# Build static library -# -static: $(STATICLIB) - -$(STATICLIB) : "$(OUTDIR)" $(OBJ_FILES) -!if "$(MOZ_BITS)"=="32" - @echo "+++ building static library" - $(LIBCMD) @<< - $(LIB_FLAGS) $(DEF_FLAGS) $(OBJ_FILES) -<< -!else - del $(STATICLIB) - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\ABANDON.obj \ - +$(OUTDIR)\ADD.obj \ - +$(OUTDIR)\BIND.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\CACHE.obj \ - +$(OUTDIR)\CHARRAY.obj \ - +$(OUTDIR)\CHARSET.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\COMPARE.obj \ - +$(OUTDIR)\COMPAT.obj \ - +$(OUTDIR)\CONTROL.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\COUNTVAL.obj \ - +$(OUTDIR)\DELETE.obj \ - +$(OUTDIR)\DISPTMPL.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\DSPARSE.obj \ - +$(OUTDIR)\ERROR.obj \ - +$(OUTDIR)\EXTENDOP.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\FREE.obj \ - +$(OUTDIR)\FREEVALU.obj \ - +$(OUTDIR)\FRIENDLY.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\GETATTR.obj \ - +$(OUTDIR)\GETDN.obj \ - +$(OUTDIR)\GETDXBYN.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\GETENTRY.obj \ - +$(OUTDIR)\GETFILTE.obj \ - +$(OUTDIR)\GETOPTIO.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\GETVALUE.obj \ - +$(OUTDIR)\MESSAGE.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\MODIFY.obj \ - +$(OUTDIR)\MOZOCK.obj,, - copy $(OUTDIR)\OS-IP.obj $(OUTDIR)\OSIP.obj - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\OPEN.obj \ - +$(OUTDIR)\OSIP.obj,, - del $(OUTDIR)\OSIP.obj - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\PSEARCH.obj \ - +$(OUTDIR)\REFERRAL.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\REGEX.obj \ - +$(OUTDIR)\RENAME.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\RESLIST.obj \ - +$(OUTDIR)\RESULT.obj \ - +$(OUTDIR)\SASLBIND.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\SBIND.obj \ - +$(OUTDIR)\SEARCH.obj \ - +$(OUTDIR)\SETOPTIO.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\SORT.obj \ - +$(OUTDIR)\SORTCTRL.obj \ - +$(OUTDIR)\SRCHPREF.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\TMPLOUT.obj \ - +$(OUTDIR)\UFN.obj \ - +$(OUTDIR)\UNBIND.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\UNESCAPE.obj \ - +$(OUTDIR)\URL.obj \ - +$(OUTDIR)\UTF8.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\VLSTCTRL.obj \ - +$(OUTDIR)\PROXAUTH.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\BPRINT.obj \ - +$(OUTDIR)\DECODE.obj,, - $(LIBCMD) $(STATICLIB) \ - +$(OUTDIR)\ENCODE.obj \ - +$(OUTDIR)\IO.obj \ - +$(OUTDIR)\WSA.obj,, -!endif - -# -dynamic: $(DYNAMICLIB) - -"$(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll" : "$(OUTDIR)" $(OBJ_FILES) $(OUTDIR)\nsldap.res - @rem <<$(PROD)$(VERSTR).lk -!if "$(MOZ_BITS)"=="32" - $(LINK_FLAGS) $(LINK_OBJS) -!else - $(LINK_FLAGS) + - $(OUTDIR)\ABANDON.obj + - $(OUTDIR)\ADD.obj + - $(OUTDIR)\BIND.obj + - $(OUTDIR)\CACHE.obj + - $(OUTDIR)\CHARRAY.obj + - $(OUTDIR)\CHARSET.obj + - $(OUTDIR)\COMPARE.obj + - $(OUTDIR)\COMPAT.obj + - $(OUTDIR)\CONTROL.obj + - $(OUTDIR)\COUNTVAL.obj + - $(OUTDIR)\DELETE.obj + - $(OUTDIR)\DISPTMPL.obj + - $(OUTDIR)\DSPARSE.obj + - $(OUTDIR)\ERROR.obj + - $(OUTDIR)\EXTENDOP.obj + - $(OUTDIR)\FREE.obj + - $(OUTDIR)\FREEVALU.obj + - $(OUTDIR)\FRIENDLY.obj + - $(OUTDIR)\GETATTR.obj + - $(OUTDIR)\GETDN.obj + - $(OUTDIR)\GETDXBYN.obj + - $(OUTDIR)\GETENTRY.obj + - $(OUTDIR)\GETFILTE.obj + - $(OUTDIR)\GETOPTIO.obj + - $(OUTDIR)\GETVALUE.obj + - $(OUTDIR)\MESSAGE.obj + - $(OUTDIR)\MODIFY.obj + - $(OUTDIR)\MOZOCK.obj + - $(OUTDIR)\OPEN.obj + - $(OUTDIR)\OS-IP.obj + - $(OUTDIR)\PSEARCH.obj + - $(OUTDIR)\REFERRAL.obj + - $(OUTDIR)\REGEX.obj + - $(OUTDIR)\RENAME.obj + - $(OUTDIR)\REQUEST.obj + - $(OUTDIR)\RESLIST.obj + - $(OUTDIR)\RESULT.obj + - $(OUTDIR)\SASLBIND.obj + - $(OUTDIR)\SBIND.obj + - $(OUTDIR)\SEARCH.obj + - $(OUTDIR)\SETOPTIO.obj + - $(OUTDIR)\SORT.obj + - $(OUTDIR)\SORTCTRL.obj + - $(OUTDIR)\SRCHPREF.obj + - $(OUTDIR)\TMPLOUT.obj + - $(OUTDIR)\UFN.obj + - $(OUTDIR)\UNBIND.obj + - $(OUTDIR)\UNESCAPE.obj + - $(OUTDIR)\URL.obj + - $(OUTDIR)\UTF8.obj + - $(OUTDIR)\VLSTCTRL.obj + - $(OUTDIR)\PROXAUTH.obj + - $(OUTDIR)\BPRINT.obj + - $(OUTDIR)\DECODE.obj + - $(OUTDIR)\ENCODE.obj + - $(OUTDIR)\IO.obj + -!if defined(LINK_SEC) - $(OUTDIR)\ssl16.obj + - $(SECDIR)\allxpstr.obj + - $(SECDIR)\db.obj + - $(SECDIR)\hash.obj + - $(SECDIR)\hash_buf.obj + - $(SECDIR)\hsearch.obj + - $(SECDIR)\h_bigkey.obj + - $(SECDIR)\h_func.obj + - $(SECDIR)\h_log2.obj + - $(SECDIR)\h_page.obj + - $(SECDIR)\memmove.obj + - $(SECDIR)\mktemp.obj + - $(SECDIR)\ndbm.obj + - $(SECDIR)\snprintf.obj + - $(SECDIR)\strerror.obj + - $(SECDIR)\nsres.obj + - $(SECDIR)\xp_error.obj + - $(SECDIR)\xpassert.obj + - $(SECDIR)\xp_reg.obj + - $(SECDIR)\xp_str.obj + - $(SECDIR)\xp_trace.obj + -!endif - $(OUTDIR)\WSA.obj - $(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll - $(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).map - c:\msvc\lib\ + -!if defined(LINK_SEC) - $(SECLIB) + - $(SECSUPPORT1) + - $(SECSUPPORT2) + -!endif - ..\nswsock.lib oldnames.lib libw.lib ldllcew.lib ver.lib - .\libldap.def; -!endif -<< - @echo "+++ building dynamic version" - $(LINK) @$(PROD)$(VERSTR).lk -!if "$(MOZ_BITS)"=="16" - $(RSC) /K $(OUTDIR)\nsldap.res $(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).dll -!if "$(LINK)"=="link" - implib /nowep /noi $(OUTDIR)\nsldap$(DLL_BITS)v$(MOZ_LDAP_VER).lib libldap.def -!endif -!endif - -# $(OUTDIR)\*.obj - -# -# Build rules -# - -{$(LIBLDAP)}.c{$(OUTDIR)}.obj: - @rem <<$(PROD)$(VERSTR).cl - $(CFILEFLAGS) - $(CFLAGS_LIBLDAP_C) -<< - $(CPP) @$(PROD)$(VERSTR).cl %s - -{$(LIBLBER)}.c{$(OUTDIR)}.obj: - @rem <<$(PROD)$(VERSTR).cl - $(CFILEFLAGS) - $(CFLAGS_LIBLBER_C) -<< - $(CPP) @$(PROD)$(VERSTR).cl %s - -{$(BUILDDIR)}.c{$(OUTDIR)}.obj: - @rem <<$(PROD)$(VERSTR).cl - $(CFILEFLAGS) - $(CFLAGS_WINSOCK_C) -<< - $(CPP) @$(PROD)$(VERSTR).cl %s - -{$(LIBUTIL)}.c{$(OUTDIR)}.obj: - @rem <<$(PROD)$(VERSTR).cl - $(CFILEFLAGS) - $(CFLAGS_LIBUTIL_C) -<< - $(CPP) @$(PROD)$(VERSTR).cl %s - - -RES_FILES = \ -!if "$(MOZ_BITS)"=="32" - $(BUILDDIR)\nsldap.rc -!else - .\nsldap.rc -!endif - -$(OUTDIR)\nsldap.res : $(RES_FILES) "$(OUTDIR)" - @SET SAVEINCLUDE=%%INCLUDE%% - @SET INCLUDE=$(RCINCLUDES);$(RCDISTINCLUDES);%%SAVEINCLUDE%% - $(RSC) /Fo$(PROD)$(VERSTR).res $(RCFILEFLAGS) $(RCFLAGS) $(RES_FILES) - @IF EXIST $(PROD)$(VERSTR).res copy $(PROD)$(VERSTR).res $(OUTDIR)\nsldap.res - @IF EXIST $(PROD)$(VERSTR).res del $(PROD)$(VERSTR).res - @SET INCLUDE=%%SAVEINCLUDE%% - @SET SAVEINCLUDE= - -!if "$(MOZ_BITS)"=="32" -$(VERFILE) : $(VERPROG) - $(VERPROG) $(DIRSDK_VERSION) UseSystemDate $@ - -$(VERPROG) : $(VERSRC) - cl $(VERSRC) -link -out:$@ -!endif - diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.rc b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.rc deleted file mode 100644 index 5c8ae74fedb..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.rc +++ /dev/null @@ -1,52 +0,0 @@ -#ifdef APSTUDIO_INVOKED - #error: this file is not editable by App Studio; use an editor -#endif //APSTUDIO_INVOKED - -#include "ver.h" -#include "sdkver.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION VI_FILEVERSION - PRODUCTVERSION VI_PRODUCTVERSION - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS (VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE) -#else - FILEFLAGS VS_FF_PRERELEASE // beta version -// FILEFLAGS 0 // final version -#endif -#ifdef _WIN32 - FILEOS VOS__WINDOWS32 -#else - FILEOS VOS_DOS_WINDOWS16 -#endif - FILETYPE VFT_APP - FILESUBTYPE 0 -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" // lang=US English, Charset=Windows Multilingual - BEGIN - VALUE "CompanyName", "Netscape Communications Corporation\0" - VALUE "FileDescription", "Lightweight Directory Access Protocol DLL\0" - VALUE "FileVersion", VI_FileVersion "\0" -#ifdef _WIN32 - VALUE "InternalName", "LDAP3240\0" -#else - VALUE "InternalName", "NSLDAP\0" -#endif - VALUE "LegalCopyright", "Copyright (c) 1997 Netscape Communications Corporation\0" -#ifdef _WIN32 - VALUE "OriginalFileName", "LDAP3240.DLL\0" -#else - VALUE "OriginalFileName", "NSLDAP.DLL\0" -#endif - VALUE "ProductName", "Lightweight Directory Access Protocol DLL\0" - VALUE "ProductVersion", PRODUCTTEXT - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 // English + Windows ANSI codepage - END -END diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.tdf deleted file mode 100644 index 662d81b721d..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap.tdf +++ /dev/null @@ -1,12 +0,0 @@ -LIBRARY NSLDAP -DESCRIPTION 'Lightweight Directory Access Protocol Client API for 16-bit Windows' -EXETYPE WINDOWS -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE SINGLE - -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -$EXPORTS diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap32.def b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap32.def deleted file mode 100644 index fad8e7b7256..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap32.def +++ /dev/null @@ -1,282 +0,0 @@ -LIBRARY NSLDAP32V50 -DESCRIPTION 'Lightweight Directory Access Protocol Client API for 32-bit Windows' -VERSION 5.0 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -; -; exports list (generated by genexports.pl) -; - ldap_abandon @10 - ldap_add @11 - ldap_unbind @13 - -; ldap_enable_cache @14 -; ldap_disable_cache @15 -; ldap_destroy_cache @16 -; ldap_flush_cache @17 -; ldap_uncache_entry @18 - - ldap_compare @19 - ldap_delete @20 - ldap_result2error @21 - ldap_err2string @22 - ldap_modify @23 - ldap_modrdn @24 - ldap_open @25 - ldap_first_entry @26 - ldap_next_entry @27 - ldap_get_dn @30 - ldap_dn2ufn @31 - ldap_first_attribute @32 - ldap_next_attribute @33 - ldap_get_values @34 - ldap_get_values_len @35 - ldap_count_entries @36 - ldap_count_values @37 - ldap_value_free @38 - ldap_explode_dn @39 - ldap_result @40 - ldap_msgfree @41 - ldap_search @43 - ldap_add_s @44 - ldap_bind_s @45 - ldap_unbind_s @46 - ldap_delete_s @47 - ldap_modify_s @48 - ldap_modrdn_s @49 - ldap_search_s @50 - ldap_search_st @51 - ldap_compare_s @52 - ldap_ufn_search_c @53 - ldap_ufn_search_s @54 - ldap_init_getfilter @55 - ldap_getfilter_free @56 - ldap_getfirstfilter @57 - ldap_getnextfilter @58 - ldap_simple_bind @59 - ldap_simple_bind_s @60 - ldap_bind @61 - ldap_friendly_name @62 - ldap_free_friendlymap @63 - ldap_ufn_search_ct @64 - -; ldap_set_cache_options @65 -; ldap_uncache_request @66 - - ldap_modrdn2 @67 - ldap_modrdn2_s @68 - ldap_ufn_setfilter @69 - ldap_ufn_setprefix @70 - ldap_ufn_timeout @71 - ldap_init_getfilter_buf @72 - ldap_setfilteraffixes @73 - ldap_sort_entries @74 - ldap_sort_values @75 - ldap_sort_strcasecmp @76 - ldap_count_values_len @77 - ldap_name2template @78 - ldap_value_free_len @79 - -; manually comment and uncomment these five as necessary -; ldap_kerberos_bind1 @80 -; ldap_kerberos_bind2 @81 -; ldap_kerberos_bind_s @82 -; ldap_kerberos_bind1_s @83 -; ldap_kerberos_bind2_s @84 - - ldap_init @85 - ldap_is_dns_dn @86 - ldap_explode_dns @87 - ldap_mods_free @88 - - ldap_is_ldap_url @89 - ldap_free_urldesc @90 - ldap_url_parse @91 - ldap_url_search @92 - ldap_url_search_s @93 - ldap_url_search_st @94 - ldap_set_rebind_proc @95 - ber_skip_tag @100 - ber_peek_tag @101 - ber_get_int @102 - ber_get_stringb @103 - ber_get_stringa @104 - ber_get_stringal @105 - ber_get_bitstringa @106 - ber_get_null @107 - ber_get_boolean @108 - ber_first_element @109 - ber_next_element @110 - ber_scanf @111 - ber_bvfree @112 - ber_bvecfree @113 - ber_put_int @114 - ber_put_ostring @115 - ber_put_string @116 - ber_put_bitstring @117 - ber_put_null @118 - ber_put_boolean @119 - ber_start_seq @120 - ber_start_set @121 - ber_put_seq @122 - ber_put_set @123 - ber_printf @124 - ber_read @125 - ber_write @126 - ber_free @127 - ber_flush @128 - ber_alloc @129 - ber_dup @130 - ber_get_next @131 - ber_get_tag @132 - ber_put_enum @133 - der_alloc @134 - ber_alloc_t @135 - ber_bvdup @136 - ber_init_w_nullchar @137 - ber_reset @138 - ber_get_option @139 - ber_set_option @140 - ber_sockbuf_alloc @141 - ber_sockbuf_get_option @142 - ber_sockbuf_set_option @143 - ber_init @144 - ber_flatten @145 - ber_special_alloc @146 - ber_special_free @147 - ber_get_next_buffer @148 - ber_err_print @149 - ber_sockbuf_free @150 - ber_get_next_buffer_ext @151 - ber_svecfree @152 - - ldap_memfree @200 - ldap_ber_free @201 - - ldap_init_searchprefs @300 - ldap_init_searchprefs_buf @301 - ldap_free_searchprefs @302 - ldap_first_searchobj @303 - ldap_next_searchobj @304 - ldap_build_filter @305 - - ldap_init_templates @400 - ldap_init_templates_buf @401 - ldap_free_templates @402 - ldap_first_disptmpl @403 - ldap_next_disptmpl @404 - ldap_oc2template @405 - ldap_tmplattrs @406 - ldap_first_tmplrow @407 - ldap_next_tmplrow @408 - ldap_first_tmplcol @409 - ldap_next_tmplcol @410 - ldap_entry2text_search @411 - ldap_entry2text @412 - ldap_vals2text @413 - ldap_entry2html @414 - ldap_entry2html_search @415 - ldap_vals2html @416 - ldap_tmplerr2string @417 - ldap_set_option @418 - ldap_get_option @419 - ldap_charray_merge @420 - ldap_get_lderrno @430 - ldap_set_lderrno @431 - ldap_perror @432 - ldap_set_filter_additions @433 - ldap_create_filter @434 - ldap_version @440 - ldap_multisort_entries @441 - ldap_msgid @442 - ldap_explode_rdn @443 - ldap_msgtype @444 - ldap_cache_flush @445 - ldap_str2charray @446 - ldap_charray_add @447 - ldap_charray_dup @448 - ldap_charray_free @449 - -; Windows ordinals 450-469 are reserved for SSL routines - - ldap_charray_inlist @470 - ldap_charray_position @471 - ldap_rename @472 - ldap_rename_s @473 - ldap_utf8len @474 - ldap_utf8next @475 - ldap_utf8prev @476 - ldap_utf8copy @477 - ldap_utf8characters @478 - ldap_utf8strtok_r @479 - ldap_utf8isalnum @480 - ldap_utf8isalpha @481 - ldap_utf8isdigit @482 - ldap_utf8isxdigit @483 - ldap_utf8isspace @484 - ldap_control_free @485 - ldap_controls_free @486 - ldap_sasl_bind @487 - ldap_sasl_bind_s @488 - ldap_parse_sasl_bind_result @489 -; LDAPv3 simple paging controls are not supported by Netscape at this time. -; 490 ldap_create_page_control -; 491 ldap_parse_page_control - ldap_create_sort_control @492 - ldap_parse_sort_control @493 -; an LDAPv3 language control was proposed but then retracted. -; 494 ldap_create_language_control - ldap_get_lang_values @495 - ldap_get_lang_values_len @496 - ldap_free_sort_keylist @497 - ldap_create_sort_keylist @498 - ldap_utf8getcc @499 - ldap_get_entry_controls @500 - ldap_create_persistentsearch_control @501 - ldap_parse_entrychange_control @502 - ldap_parse_result @503 - ldap_parse_extended_result @504 - ldap_parse_reference @505 - ldap_abandon_ext @506 - ldap_add_ext @507 - ldap_add_ext_s @508 - ldap_modify_ext @509 - ldap_modify_ext_s @510 - ldap_first_message @511 - ldap_next_message @512 - ldap_compare_ext @513 - ldap_compare_ext_s @514 - ldap_delete_ext @515 - ldap_delete_ext_s @516 - ldap_search_ext @517 - ldap_search_ext_s @518 - ldap_extended_operation @519 - ldap_extended_operation_s @520 - ldap_first_reference @521 - ldap_next_reference @522 - ldap_count_references @523 - ldap_count_messages @524 - ldap_create_virtuallist_control @525 - ldap_parse_virtuallist_control @526 - ldap_create_proxyauth_control @527 - ldap_unbind_ext @528 - ldap_x_hostlist_first @529 - ldap_x_hostlist_next @530 - ldap_x_hostlist_statusfree @531 - ldap_x_malloc @532 - ldap_x_calloc @533 - ldap_x_realloc @534 - ldap_x_free @535 - ldap_create_proxiedauth_control @536 - ldap_memcache_init @1000 - ldap_memcache_set @1001 - ldap_memcache_get @1002 - ldap_memcache_flush @1003 - ldap_memcache_destroy @1004 - ldap_memcache_update @1005 - ldap_keysort_entries @1006 -; -; end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap32.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap32.tdf deleted file mode 100644 index ad93f4221d2..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldap32.tdf +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY NSLDAP32V$1 -DESCRIPTION 'Lightweight Directory Access Protocol Client API for 32-bit Windows' -VERSION $2 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -$EXPORTS diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr-incl.def b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr-incl.def deleted file mode 100644 index 7df9cd62b06..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr-incl.def +++ /dev/null @@ -1,13 +0,0 @@ -; These are additional exports from nsldap.dll when it includes libprldap. -; Tack this to the end of nsldap.def. -; -; exports list (generated by genexports.pl) -; - prldap_init @2010 - prldap_install_routines @2011 - prldap_set_session_info @2012 - prldap_get_session_info @2013 - prldap_set_socket_info @2014 - prldap_get_socket_info @2015 -; -; end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr-incl.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr-incl.tdf deleted file mode 100755 index a6947a1bd41..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr-incl.tdf +++ /dev/null @@ -1,3 +0,0 @@ -; These are additional exports from nsldap.dll when it includes libprldap. -; Tack this to the end of nsldap.def. -$EXPORTS diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr32.def b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr32.def deleted file mode 100644 index 38c65b9aa17..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr32.def +++ /dev/null @@ -1,19 +0,0 @@ -LIBRARY NSLDAPPR32V50 -DESCRIPTION 'LDAP to NSPR glue library for 32-bit Windows' -VERSION 5.0 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -; -; exports list (generated by genexports.pl) -; - prldap_init @2010 - prldap_install_routines @2011 - prldap_set_session_info @2012 - prldap_get_session_info @2013 - prldap_set_socket_info @2014 - prldap_get_socket_info @2015 -; -; end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr32.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr32.tdf deleted file mode 100755 index 5db2ba5185e..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldappr32.tdf +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY NSLDAPPR32V$1 -DESCRIPTION 'LDAP to NSPR glue library for 32-bit Windows' -VERSION $2 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -$EXPORTS diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldapssl32.def b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldapssl32.def deleted file mode 100644 index a0743863ed1..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldapssl32.def +++ /dev/null @@ -1,25 +0,0 @@ -LIBRARY NSLDAPSSL32V50 -DESCRIPTION 'Lightweight Directory Access Protocol Client API with SSL for 32-bit Windows' -VERSION 5.0 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -; -; exports list (generated by genexports.pl) -; - ldapssl_client_init @450 - ldapssl_init @451 - ldapssl_install_routines @452 - ldapssl_clientauth_init @453 - ldapssl_enable_clientauth @454 - ldapssl_advclientauth_init @456 - ldapssl_pkcs_init @457 - ldapssl_err2string @458 -; the last Windows ordinal number that has been reserved for SSL is 469. - -; Windows ordinals 1100-1150 are reserved for privately/non-published -; exported routines -; -; end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldapssl32.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldapssl32.tdf deleted file mode 100644 index 78fd0d6f5b5..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nsldapssl32.tdf +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY NSLDAPSSL32V$1 -DESCRIPTION 'Lightweight Directory Access Protocol Client API with SSL for 32-bit Windows' -VERSION $2 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -$EXPORTS diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nssldap32.def b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nssldap32.def deleted file mode 100644 index 0b89add8311..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nssldap32.def +++ /dev/null @@ -1,25 +0,0 @@ -LIBRARY NSSLDAP32V50 -DESCRIPTION 'Lightweight Directory Access Protocol Client API with SSL for 32-bit Windows' -VERSION 5.0 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -; -; exports list (generated by genexports.pl) -; - ldapssl_client_init @450 - ldapssl_init @451 - ldapssl_install_routines @452 - ldapssl_clientauth_init @453 - ldapssl_enable_clientauth @454 - ldapssl_advclientauth_init @456 - ldapssl_pkcs_init @457 - ldapssl_err2string @458 -; the last Windows ordinal number that has been reserved for SSL is 469. - -; Windows ordinals 1100-1150 are reserved for privately/non-published -; exported routines -; -; end of generated exports list. diff --git a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nssldap32.tdf b/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nssldap32.tdf deleted file mode 100644 index 3a16c3f1562..00000000000 --- a/mozilla/directory/c-sdk/ldap/libraries/msdos/winsock/nssldap32.tdf +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY NSSLDAP32V$1 -DESCRIPTION 'Lightweight Directory Access Protocol Client API with SSL for 32-bit Windows' -VERSION $2 -HEAPSIZE 4096 - -EXPORTS -; we need to manually assign ordinal numbers so we can add new routines -; and not disturb the ordinals and thus not require callers to relink. -$EXPORTS diff --git a/mozilla/directory/c-sdk/makefile.win b/mozilla/directory/c-sdk/makefile.win deleted file mode 100644 index 34524795f49..00000000000 --- a/mozilla/directory/c-sdk/makefile.win +++ /dev/null @@ -1,119 +0,0 @@ -# -# 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.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -NMAKE=@nmake -nologo -$(MAKEFLAGS) - -default:: export libs install - -depend: - cd $(MOZ_SRC)\mozilla\directory\c-sdk\ldap\libraries\msdos\winsock - $(NMAKE) -f nsldap.mak DEPEND=1 - -export libs install: depend - cd $(MOZ_SRC)\mozilla\directory\c-sdk\ldap\libraries\msdos\winsock - $(NMAKE) -f nsldap.mak - $(NMAKE) -f nsldap.mak static - $(NMAKE) -f nsldap.mak dynamic - $(NMAKE) -f nsldap.mak EXPORT=1 - -# -# remove all source files from the tree and print a report of what was missed -# -clean clobber clobber_all: - cd $(MOZ_SRC)\mozilla\directory\c-sdk\ldap\libraries\msdos\winsock - $(NMAKE) -f nsldap.mak clobber_all - -#//------------------------------------------------------------------------ -#// Utility stuff... -#//------------------------------------------------------------------------ - -#//------------------------------------------------------------------------ -# Verify that MOZ_SRC is set correctly -#//------------------------------------------------------------------------ - -# Check to see if it is set at all -!if "$(MOZ_SRC)"!="" - -# -# create a temp file at the root and make sure it is visible from MOZ_SRC -# -!if [copy $(MAKEDIR)\makefile.win $(MAKEDIR)\xyzzy.tmp > NUL] == 0 -!endif - -!if !EXIST( $(MOZ_SRC)\mozilla\directory\c-sdk\xyzzy.tmp ) -ERR_MESSAGE=$(ERR_MESSAGE)^ -MOZ_SRC isn't set correctly: [$(MOZ_SRC)\mozilla\directory\c-sdk]!=[$(MAKEDIR)] -!endif - -!if [del $(MAKEDIR)\xyzzy.tmp] -!endif - -!else -# MOZ_SRC isn't set at all -ERR_MESSAGE=$(ERR_MESSAGE)^ -Environment variable MOZ_SRC isn't set. -!endif - -#//------------------------------------------------------------------------ -# Verify that MOZ_BITS is set -#//------------------------------------------------------------------------ -!if !defined(MOZ_BITS) -ERR_MESSAGE=$(ERR_MESSAGE)^ -Environment variable MOZ_BITS isn't set. -!endif - -!if !defined(MOZ_TOOLS) -ERR_MESSAGE=$(ERR_MESSAGE)^ -Environment variable MOZ_TOOLS isn't set. -!endif - - -#//------------------------------------------------------------------------ -#// Display error -#//------------------------------------------------------------------------ - - -!if "$(ERR_MESSAGE)" != "" -ERR_MESSAGE = ^ -ldapsdk.mak: ^ -$(ERR_MESSAGE) ^ -^ -ldapsdk.mak: usage^ -^ -nmake -f ldapsdk.mak [MOZ_BRANCH=] ^ - [MOZ_DATE=]^ - [pull_and_build_all]^ - [pull_all]^ - [build_all]^ - [build_ldap]^ - -^ -Environment variables:^ -^ -MOZ_BITS set to either 32 or 16 ^ -MOZ_SRC set to the directory above ns or "$(MAKEDIR)\.."^ -MOZ_TOOLS set to the directory containing the java compiler see ^ - http://warp/tools/nt^ -JAVA_HOME set to the same thing as MOZ_TOOLS^ - -!ERROR $(ERR_MESSAGE) - -!endif - diff --git a/mozilla/directory/c-sdk/package.mk b/mozilla/directory/c-sdk/package.mk deleted file mode 100644 index 980c9d242eb..00000000000 --- a/mozilla/directory/c-sdk/package.mk +++ /dev/null @@ -1,166 +0,0 @@ -# -# 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_TREE = . -MOD_DEPTH = . - -include $(NSPR_TREE)/config/rules.mk -include build.mk - -MMDD = $(shell date +%m.%d) -INSTDIR = ../../dist/$(MMDD)/$(OBJDIR_NAME) -LIBDIR = ../../dist/$(OBJDIR_NAME)/lib -INCDIR = ../../dist/public/ldap -PRIVATEINCDIR = ../../dist/public/ldap-private -BINDIR = ../../dist/$(OBJDIR_NAME)/bin -ETCDIR = ../../dist/$(OBJDIR_NAME)/etc -EXPDIR = ldap/examples -DOCDIR = ldap/docs - -# defaults -PKG_PRIVATE_HDRS=1 -PKG_PRIVATE_LIBS=1 -PKG_DEP_LIBS=1 - -all:: FORCE - $(NSINSTALL) -D $(INSTDIR) - - @echo "Installing libraries" - $(NSINSTALL) -D $(INSTDIR)/lib -# Windows -ifeq ($(OS_ARCH), WINNT) - $(NSINSTALL) $(LIBDIR)/$(LDAP_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(SSLDAP_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(PRLDAP_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(LBER_LIBNAME).lib $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(LDIF_LIBNAME).lib $(INSTDIR)/lib -ifeq ($(PKG_PRIVATE_LIBS),1) - $(NSINSTALL) $(LIBDIR)/$(IUTIL_LIBNAME).lib $(INSTDIR)/lib -endif - $(NSINSTALL) $(LIBDIR)/$(UTIL_LIBNAME).lib $(INSTDIR)/lib -ifeq ($(PKG_DEP_LIBS),1) - $(NSINSTALL) $(LIBDIR)/$(NSS_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(SSL_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(PLC_BASENAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(PLDS_BASENAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(NSPR_BASENAME).* $(INSTDIR)/lib -endif -# UNIX -else - $(NSINSTALL) $(LIBDIR)/lib$(LDAP_LIBNAME).$(DLL_SUFFIX) $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/lib$(SSLDAP_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/lib$(PRLDAP_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/lib$(LDAP_LIBNAME).$(LIB_SUFFIX) $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/lib$(LBER_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/lib$(LDIF_LIBNAME).* $(INSTDIR)/lib -ifeq ($(PKG_PRIVATE_LIBS),1) - $(NSINSTALL) $(LIBDIR)/lib$(IUTIL_LIBNAME).* $(INSTDIR)/lib -endif -ifeq ($(PKG_DEP_LIBS),1) - $(NSINSTALL) $(LIBDIR)/lib$(NSS_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/lib$(SSL_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(PLC_BASENAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(PLDS_BASENAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/$(NSPR_BASENAME).* $(INSTDIR)/lib -ifneq ($(USE_64), 1) -ifeq ($(OS_ARCH), SunOS) -ifneq ($(OS_TEST),i86pc) - $(NSINSTALL) $(LIBDIR)/lib$(HYBRID_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/lib$(PURE32_LIBNAME).* $(INSTDIR)/lib -endif -endif -ifeq ($(OS_ARCH), HP-UX) - $(NSINSTALL) $(LIBDIR)/lib$(HYBRID_LIBNAME).* $(INSTDIR)/lib - $(NSINSTALL) $(LIBDIR)/lib$(PURE32_LIBNAME).* $(INSTDIR)/lib -endif -endif -endif -endif - @echo "Installing tools" - $(NSINSTALL) -D $(INSTDIR)/tools - $(NSINSTALL) $(BINDIR)/ldapsearch$(EXE_SUFFIX) $(INSTDIR)/tools - $(NSINSTALL) $(BINDIR)/ldapdelete$(EXE_SUFFIX) $(INSTDIR)/tools - $(NSINSTALL) $(BINDIR)/ldapmodify$(EXE_SUFFIX) $(INSTDIR)/tools - $(NSINSTALL) $(BINDIR)/ldapcmp$(EXE_SUFFIX) $(INSTDIR)/tools - $(NSINSTALL) $(BINDIR)/ldapcompare$(EXE_SUFFIX) $(INSTDIR)/tools - - @echo "Installing includes" - $(NSINSTALL) -D $(INSTDIR)/include - $(NSINSTALL) $(INCDIR)/disptmpl.h $(INSTDIR)/include -ifeq ($(PKG_PRIVATE_LIBS),1) - $(NSINSTALL) $(INCDIR)/iutil.h $(INSTDIR)/include -endif - $(NSINSTALL) $(INCDIR)/lber.h $(INSTDIR)/include - $(NSINSTALL) $(INCDIR)/ldap.h $(INSTDIR)/include - $(NSINSTALL) $(INCDIR)/ldap-standard.h $(INSTDIR)/include - $(NSINSTALL) $(INCDIR)/ldap-platform.h $(INSTDIR)/include - $(NSINSTALL) $(INCDIR)/ldap-extension.h $(INSTDIR)/include - $(NSINSTALL) $(INCDIR)/ldap-deprecated.h $(INSTDIR)/include - $(NSINSTALL) $(INCDIR)/ldap-to-be-deprecated.h $(INSTDIR)/include - $(NSINSTALL) $(INCDIR)/ldap_ssl.h $(INSTDIR)/include - $(NSINSTALL) $(INCDIR)/srchpref.h $(INSTDIR)/include - -ifeq ($(PKG_PRIVATE_HDRS),1) - @echo "Installing private include files" - $(NSINSTALL) -D $(INSTDIR)/include-private - $(NSINSTALL) -D $(INSTDIR)/include-private/liblber - $(NSINSTALL) $(PRIVATEINCDIR)/lber-int.h $(INSTDIR)/include-private/liblber - $(NSINSTALL) $(PRIVATEINCDIR)/ldap-int.h $(INSTDIR)/include-private - $(NSINSTALL) $(PRIVATEINCDIR)/portable.h $(INSTDIR)/include-private - $(NSINSTALL) $(PRIVATEINCDIR)/ldaprot.h $(INSTDIR)/include-private - $(NSINSTALL) $(PRIVATEINCDIR)/ldaplog.h $(INSTDIR)/include-private -endif - - @echo "Installing etc files" - $(NSINSTALL) -D $(INSTDIR)/etc - $(NSINSTALL) $(ETCDIR)/ldapfilter.conf $(INSTDIR)/etc - $(NSINSTALL) $(ETCDIR)/ldapfriendly $(INSTDIR)/etc - $(NSINSTALL) $(ETCDIR)/ldapsearchprefs.conf $(INSTDIR)/etc - $(NSINSTALL) $(ETCDIR)/ldaptemplates.conf $(INSTDIR)/etc - - @echo "Installing example files" - $(NSINSTALL) -D $(INSTDIR)/examples - $(NSINSTALL) $(EXPDIR)/*.c $(INSTDIR)/examples - $(NSINSTALL) $(EXPDIR)/*.h $(INSTDIR)/examples - $(NSINSTALL) $(EXPDIR)/README $(INSTDIR)/examples - $(NSINSTALL) $(EXPDIR)/Makefile $(INSTDIR)/examples - $(NSINSTALL) $(EXPDIR)/xmplflt.conf $(INSTDIR)/examples - - @echo "Installing doc files" - $(NSINSTALL) -D $(INSTDIR)/docs - $(NSINSTALL) $(DOCDIR)/README $(INSTDIR) - $(NSINSTALL) $(DOCDIR)/redist.txt $(INSTDIR) - $(NSINSTALL) $(DOCDIR)/*.htm $(INSTDIR) - $(NSINSTALL) $(DOCDIR)/*.gif $(INSTDIR) - $(NSINSTALL) $(DOCDIR)/README $(INSTDIR)/docs - $(NSINSTALL) $(DOCDIR)/redist.txt $(INSTDIR)/docs - -ifdef BUILD_SHIP - @echo "Copying files to $(BUILD_SHIP) directory" - cp -r $(INSTDIR) $(BUILD_SHIP) -endif - -clean:: FORCE - @echo "Cleaning up old install" - $(RM) -rf $(INSTDIR) - -FORCE:: diff --git a/mozilla/directory/c-sdk/packageup.mk b/mozilla/directory/c-sdk/packageup.mk deleted file mode 100644 index 965cdd22c1d..00000000000 --- a/mozilla/directory/c-sdk/packageup.mk +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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): -# - -CSDKVERSION = 5.03 -FROMDIR = /share/builds/components/ldapsdk50/v$(CSDKVERSION) -TODIR = /u/svbld/mhein/ldapcsdk-$(CSDKVERSION) -BUILDDIRS = AIX4.3_DBG.OBJ AIX4.3_OPT.OBJ HP-UXB.11.00_64_DBG.OBJ \ - HP-UXB.11.00_64_OPT.OBJ HP-UXB.11.00_DBG.OBJ HP-UXB.11.00_OPT.OBJ \ - Linux2.2_x86_glibc_PTH_DBG.OBJ Linux2.2_x86_glibc_PTH_OPT.OBJ \ - OSF1V4.0D_DBG.OBJ OSF1V4.0D_OPT.OBJ SunOS5.6_DBG.OBJ \ - SunOS5.6_OPT.OBJ SunOS5.8_64_DBG.OBJ SunOS5.8_64_OPT.OBJ \ - SunOS5.8_DBG.OBJ SunOS5.8_OPT.OBJ SunOS5.8_i86pc_DBG.OBJ \ - SunOS5.8_i86pc_OPT.OBJ WIN954.0_DBG.OBJ WIN954.0_OPT.OBJ \ - WINNT4.0_DBG.OBJ WINNT4.0_OPT.OBJ - -all:: FORCE - @for i in $(BUILDDIRS); do \ - cd $(FROMDIR)/$$i ; \ - zip -r $(TODIR)/ldapcsdk$(CSDKVERSION)-$$i.zip * ; \ - zip -d $(TODIR)/ldapcsdk$(CSDKVERSION)-$$i.zip include-private/liblber/* ; \ - zip -d $(TODIR)/ldapcsdk$(CSDKVERSION)-$$i.zip include-private/* ; \ - zip -d $(TODIR)/ldapcsdk$(CSDKVERSION)-$$i.zip include-private ; \ - done - -clean:: FORCE - @echo "Cleaning up old package" - rm -rf $(TODIR)/* - -FORCE:: diff --git a/mozilla/directory/ldapsdk.mak b/mozilla/directory/ldapsdk.mak deleted file mode 100644 index 0df80a9fdb3..00000000000 --- a/mozilla/directory/ldapsdk.mak +++ /dev/null @@ -1,204 +0,0 @@ -# -# 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.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -!if !defined(MOZ_TOP) -#enable builds from changed top level directories -MOZ_TOP=mozilla -!endif - -#//------------------------------------------------------------------------ -#// Figure out how to do the pull. -#//------------------------------------------------------------------------ -!if "$(MOZ_BRANCH)" != "" -CVS_BRANCH=-r $(MOZ_BRANCH) -HAVE_BRANCH=1 -!else -HAVE_BRANCH=0 -!endif - -#// -#// Temporary hardcode (while we figure out how to do this) -#// to support the Core modularity efforts... -#// - - -LDAPSDK_BRANCH =-r LDAPSDK_40_BRANCH - -!if "$(MOZ_DATE)" != "" -CVS_BRANCH=-D "$(MOZ_DATE)" -HAVE_DATE=1 -!else -HAVE_DATE=0 -!endif - -!if $(HAVE_DATE) && $(HAVE_BRANCH) -ERR_MESSAGE=$(ERR_MESSAGE)^ -Cannot specify both MOZ_BRANCH and MOZ_DATE -!endif - -NMAKE=@nmake -nologo -$(MAKEFLAGS) - -#//------------------------------------------------------------------------ -#// -#// Stuff a do complete pull and build -#// -#//------------------------------------------------------------------------ - -default:: build_all - -pull_and_build_all:: pull_all \ - build_all - -#// Do this when you pull a new tree, or else you will often get bugs -#// when replaceing an old dist with a new dist. - -pull_clobber_build_all:: pull_all \ - clobber_all \ - build_all - -clobber_build_all:: clobber_all \ - build_all - -# In theory, we should use some symbol in ns/config/liteness.mak, -# but we haven't pulled the file yet. So, refer to MOZ_LITE and -# MOZ_MEDIUM explicitly . -pull_all:: - - -# -cvs co $(LDAPSDK_BRANCH) DirectorySDKSource - - - -#pull_client_source_product: -#x-CEB-x @echo +++ client.mak: checking out the client with "$(CVS_BRANCH)" -#x-CEB-x cd $(MOZ_SRC)\. -#x-CEB-x -cvs -d ":pserver:$(USERNAME)@cvsserver:/m/pub" co $(CVS_BRANCH) MozillaSourceWin -#x-CEB-x -cvs -d ":pserver:$(USERNAME)@cvsserver:/m/pub" co $(CVS_BRANCH) mozilla/lib/libnet - -build_all: build_ldap - - - -build_ldap: - @echo +++ ldapsdk.mak: building ldap - cd $(MOZ_SRC)\mozilla\directory\c-sdk\ldap\libraries\msdos\winsock - @echo +++ ldapsdk.mak: depend step - $(NMAKE) -f nsldap.mak DEPEND=1 - @echo +++ ldapsdk.mak: build step - $(NMAKE) -f nsldap.mak - @echo +++ ldapsdk.mak: library creation - $(NMAKE) -f nsldap.mak static - $(NMAKE) -f nsldap.mak dynamic - $(NMAKE) -f nsldap.mak EXPORT=1 - -# -# remove all source files from the tree and print a report of what was missed -# -clobber_all: - cd $(MOZ_SRC)\mozilla\directory\c-sdk\ldap\libraries\msdos\winsock - $(NMAKE) -f nsldap.mak clobber_all - -depend: - -del /s /q make.dep - $(NMAKE) -f makefile.win depend - -quick: - @cd $(MOZ_SRC)\. - @cvs co ns/quickup - @cd $(MOZ_SRC)\$(MOZ_TOP)\quickup - @$(MOZ_TOOLS)\perl5\perl doupdate.pl - -#//------------------------------------------------------------------------ -#// Utility stuff... -#//------------------------------------------------------------------------ - -#//------------------------------------------------------------------------ -# Verify that MOZ_SRC is set correctly -#//------------------------------------------------------------------------ - -# Check to see if it is set at all -!if "$(MOZ_SRC)"!="" - -# -# create a temp file at the root and make sure it is visible from MOZ_SRC -# -!if [copy $(MAKEDIR)\ldapsdk.mak $(MAKEDIR)\xyzzy.tmp > NUL] == 0 -!endif - -!if !EXIST( $(MOZ_SRC)\mozilla\directory\xyzzy.tmp ) -ERR_MESSAGE=$(ERR_MESSAGE)^ -MOZ_SRC isn't set correctly: [$(MOZ_SRC)\mozilla\directory]!=[$(MAKEDIR)] -!endif - -!if [del $(MAKEDIR)\xyzzy.tmp] -!endif - -!else -# MOZ_SRC isn't set at all -ERR_MESSAGE=$(ERR_MESSAGE)^ -Environment variable MOZ_SRC isn't set. -!endif - -#//------------------------------------------------------------------------ -# Verify that MOZ_BITS is set -#//------------------------------------------------------------------------ -!if !defined(MOZ_BITS) -ERR_MESSAGE=$(ERR_MESSAGE)^ -Environment variable MOZ_BITS isn't set. -!endif - -!if !defined(MOZ_TOOLS) -ERR_MESSAGE=$(ERR_MESSAGE)^ -Environment variable MOZ_TOOLS isn't set. -!endif - - -#//------------------------------------------------------------------------ -#// Display error -#//------------------------------------------------------------------------ - - -!if "$(ERR_MESSAGE)" != "" -ERR_MESSAGE = ^ -ldapsdk.mak: ^ -$(ERR_MESSAGE) ^ -^ -ldapsdk.mak: usage^ -^ -nmake -f ldapsdk.mak [MOZ_BRANCH=] ^ - [MOZ_DATE=]^ - [pull_and_build_all]^ - [pull_all]^ - [build_all]^ - [build_ldap]^ - -^ -Environment variables:^ -^ -MOZ_BITS set to either 32 or 16 ^ -MOZ_SRC set to the directory above ns or "$(MAKEDIR)\.."^ -MOZ_TOOLS set to the directory containing the java compiler see ^ - http://warp/tools/nt^ -JAVA_HOME set to the same thing as MOZ_TOOLS^ - -!ERROR $(ERR_MESSAGE) - -!endif - diff --git a/mozilla/directory/ldapsdk.mk b/mozilla/directory/ldapsdk.mk deleted file mode 100644 index c11f13edef3..00000000000 --- a/mozilla/directory/ldapsdk.mk +++ /dev/null @@ -1,70 +0,0 @@ -# -# 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.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -# -# Static macros. Can be overridden on the command-line. -# -ifndef CVSROOT -CVSROOT = /m/src -endif - -# Allow for cvs flags -ifndef CVS_FLAGS -CVS_FLAGS = -endif - -CVS_CMD = cvs $(CVS_FLAGS) -TARGETS = export libs install -LDAP_MODULE = DirectorySDKSource - - -# -# Environment variables. -# -ifdef MOZ_DATE -CVS_BRANCH = -D "$(MOZ_DATE)" -endif - -ifdef MOZ_BRANCH -CVS_BRANCH = -r $(MOZ_BRANCH) -endif - - -ifndef MOZ_LDAPVER -MOZ_LDAPVER = -r LDAPCSDK_40_BRANCH -endif - - -all: setup build - -.PHONY: all setup build - -setup: -ifdef LDAP_MODULE - $(CVS_CMD) -q co $(MOZ_LDAPVER) $(LDAP_MODULE) -endif - -build: - cd ../nsprpub/config; $(MAKE) - $(MAKE) $(TARGETS) - - -clean: - $(MAKE) clean