Move OPENLDAP_REL_ENG_2_MP forward.
--- /dev/null
+# $OpenLDAP$
+# Master Makefile for OpenLDAP
+##
+## Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms are permitted only
+## as authorized by the OpenLDAP Public License. A copy of this
+## license is available at http://www.OpenLDAP.org/license.html or
+## in file LICENSE in the top-level directory of the distribution.
+##
+
+SUBDIRS= include libraries clients servers tests doc
+CLEANDIRS= contrib
+INSTALLDIRS=
+
+makefiles: FORCE
+ ./config.status
+
+# force a make all before make install
+# only done at the top-level
+install-common: all FORCE
+
+clean-local: FORCE
+ $(RM) config.log
+
+veryclean-local: FORCE
+ $(RM) config.cache config.status libtool stamp-h stamp-h.in
+
+distclean: veryclean FORCE
--- /dev/null
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _LDAP_PORTABLE_H
+#define _LDAP_PORTABLE_H
+
+/* end of preamble */
+@TOP@
+
+/* define this if needed to get reentrant functions */
+#ifndef REENTRANT
+#undef REENTRANT
+#endif
+#ifndef _REENTRANT
+#undef _REENTRANT
+#endif
+
+/* define this if needed to get threadsafe functions */
+#ifndef THREADSAFE
+#undef THREADSAFE
+#endif
+#ifndef _THREADSAFE
+#undef _THREADSAFE
+#endif
+#ifndef THREAD_SAFE
+#undef THREAD_SAFE
+#endif
+#ifndef _THREAD_SAFE
+#undef _THREAD_SAFE
+#endif
+
+#ifndef _SGI_MP_SOURCE
+#undef _SGI_MP_SOURCE
+#endif
+
+/* define this if TIOCGWINSZ is defined in sys/ioctl.h */
+#undef GWINSZ_IN_SYS_IOCTL
+
+/* These are defined in ldap_features.h */
+/*
+ LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
+ LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
+ LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
+ LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
+*/
+
+/* These are defined in lber_types.h */
+/*
+ LBER_INT_T
+ LBER_LEN_T
+ LBER_SOCKET_T
+ LBER_TAG_T
+*/
+
+\f
+/* Leave that blank line there!! Autoheader needs it. */
+
+@BOTTOM@
+/* begin of postamble */
+
+#ifndef __NEED_PROTOTYPES
+/* force LDAP_P to always include prototypes */
+#define __NEED_PROTOTYPES 1
+#endif
+
+#ifdef HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+
+#if defined(LDAP_DEVEL) && !defined(LDAP_TEST)
+#define LDAP_TEST
+#endif
+#if defined(LDAP_TEST) && !defined(LDAP_DEBUG)
+#define LDAP_DEBUG
+#endif
+
+#include "ldap_cdefs.h"
+#include "ldap_features.h"
+
+#include "ac/assert.h"
+
+#endif /* _LDAP_PORTABLE_H */
--- /dev/null
+dnl $OpenLDAP$
+dnl
+dnl Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+dnl
+dnl OpenLDAP Autoconf Macros
+dnl
+builtin(include, build/openldap.m4)dnl
--- /dev/null
+dnl aclocal.m4 generated automatically by aclocal 1.4a
+
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl $OpenLDAP$
+dnl
+dnl Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+dnl
+dnl OpenLDAP Autoconf Macros
+dnl
+builtin(include, build/openldap.m4)dnl
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AC_PROG_INSTALL])
+dnl We require 2.13 because we rely on SHELL being computed by configure.
+AC_PREREQ([2.13])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+dnl Set install_sh for make dist
+install_sh="$missing_dir/install-sh"
+test -f "$install_sh" || install_sh="$missing_dir/install.sh"
+AC_SUBST(install_sh)
+dnl We check for tar when the user configures the end package.
+dnl This is sad, since we only need this for "dist". However,
+dnl there's no other good way to do it. We prefer GNU tar if
+dnl we can find it. If we can't find a tar, it doesn't really matter.
+AC_CHECK_PROGS(AMTAR, gnutar gtar tar)
+dnl We need awk for the "check" target. The system "awk" is bad on
+dnl some platforms.
+AC_REQUIRE([AC_PROG_AWK])
+AMTARFLAGS=
+if test -n "$AMTAR"; then
+ if $SHELL -c "$AMTAR --version" > /dev/null 2>&1; then
+ dnl We have GNU tar.
+ AMTARFLAGS=o
+ fi
+fi
+AC_SUBST(AMTARFLAGS)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+
+# serial 40 AC_PROG_LIBTOOL
+AC_DEFUN(AC_PROG_LIBTOOL,
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN(AC_LIBTOOL_SETUP,
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_RANLIB])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+dnl
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$host" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_SHARED, [dnl
+define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_STATIC, [dnl
+define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
+define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AC_PROG_LD,
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+changequote(,)dnl
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+changequote([,])dnl
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(ac_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_SUBST(LD)
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN(AC_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi])
+])
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AC_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+AC_SUBST(NM)
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN(AC_CHECK_LIBM,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case "$host" in
+*-*-beos* | *-*-cygwin*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library, adds --enable-ltdl-convenience to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case "$enable_ltdl_convenience" in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library, and adds --enable-ltdl-install to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+dnl old names
+AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
+AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
+AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
+
+# serial 1
+
+# @defmac AC_PROG_CC_STDC
+# @maindex PROG_CC_STDC
+# @ovindex CC
+# If the C compiler in not in ANSI C mode by default, try to add an option
+# to output variable @code{CC} to make it so. This macro tries various
+# options that select ANSI C on some system or another. It considers the
+# compiler to be in ANSI C mode if it handles function prototypes correctly.
+#
+# If you use this macro, you should check after calling it whether the C
+# compiler has been set to accept ANSI C; if not, the shell variable
+# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
+# code in ANSI C, you can make an un-ANSIfied copy of it by using the
+# program @code{ansi2knr}, which comes with Ghostscript.
+# @end defmac
+
+AC_DEFUN(AM_PROG_CC_STDC,
+[AC_REQUIRE([AC_PROG_CC])
+AC_BEFORE([$0], [AC_C_INLINE])
+AC_BEFORE([$0], [AC_C_CONST])
+dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
+dnl a magic option to avoid problems with ANSI preprocessor commands
+dnl like #elif.
+dnl FIXME: can't do this because then AC_AIX won't work due to a
+dnl circular dependency.
+dnl AC_BEFORE([$0], [AC_PROG_CPP])
+AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
+AC_CACHE_VAL(am_cv_prog_cc_stdc,
+[am_cv_prog_cc_stdc=no
+ac_save_CC="$CC"
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ AC_TRY_COMPILE(
+[#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+], [
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+],
+[am_cv_prog_cc_stdc="$ac_arg"; break])
+done
+CC="$ac_save_CC"
+])
+if test -z "$am_cv_prog_cc_stdc"; then
+ AC_MSG_RESULT([none needed])
+else
+ AC_MSG_RESULT($am_cv_prog_cc_stdc)
+fi
+case "x$am_cv_prog_cc_stdc" in
+ x|xno) ;;
+ *) CC="$CC $am_cv_prog_cc_stdc" ;;
+esac
+])
+
+dnl From Jim Meyering.
+
+# serial 1
+
+AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
+[AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
+ AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
+ am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
+ [am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
+
+ gwinsz_in_termios_h=no
+ if test $am_cv_sys_posix_termios = yes; then
+ AC_EGREP_CPP([yes],
+ [#include <sys/types.h>
+# include <termios.h>
+# ifdef TIOCGWINSZ
+ yes
+# endif
+ ], gwinsz_in_termios_h=yes)
+ fi
+
+ if test $gwinsz_in_termios_h = no; then
+ AC_EGREP_CPP([yes],
+ [#include <sys/types.h>
+# include <sys/ioctl.h>
+# ifdef TIOCGWINSZ
+ yes
+# endif
+ ], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
+ fi
+ ])
+ if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
+ AC_DEFINE(GWINSZ_IN_SYS_IOCTL,1,
+ [Define if TIOCGWINSZ requires sys/ioctl.h])
+ fi
+])
+
+dnl From Jim Meyering.
+
+# serial 1
+
+AC_DEFUN(AM_SYS_POSIX_TERMIOS,
+[AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
+ [AC_TRY_LINK([#include <sys/types.h>
+#include <unistd.h>
+#include <termios.h>],
+ [/* SunOS 4.0.3 has termios.h but not the library calls. */
+ tcgetattr(0, 0);],
+ am_cv_sys_posix_termios=yes,
+ am_cv_sys_posix_termios=no)])
+])
+
+# From Ulrich Drepper.
+
+# serial 1
+
+AC_DEFUN(AM_TYPE_PTRDIFF_T,
+ [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
+ [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
+ am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
+ if test $am_cv_type_ptrdiff_t = yes; then
+ AC_DEFINE(HAVE_PTRDIFF_T,1,[Define if system has ptrdiff_t type])
+ fi
+])
+
--- /dev/null
+Berkeley DB version 2.x and OpenLDAP running threads
+====================================================
+
+Special care has to be taken when building Berkeley DB 2.x
+for use with OpenLDAP as an slapd backend. If OpenLDAP is used
+with threads, so must Berkeley DB. If OpenLDAP is built without
+threads, so must Berkeley DB. In general, you should use
+the latest Sleepycat version.
+
+The configuration tool of Sleepycat's Berkeley DB will automatically
+set appropriate options on IRIX, OSF/1, and SUN Solaris platforms
+(version 2.3.16), as well as FreeBSD (version 2.7.5). The options
+must be manually defined on other plaforms, e.g. on LINUX.
+
+On PC-LINUX (kernel version 2.0.35, linux kernel threads as imple-
+mented by libpthreads.so.1.60.4) with gcc as the standard compiler
+the environment variable CPPFLAGS must define -D_REENTRANT, while
+building the Berkeley DB package.
+
+DO NOT USE THE -ansi CFLAG, SINCE THEN THE DB PACKAGE'S CONFIGURE
+CANNOT FIND THE X86/GCC SPINLOCKS, WHICH ARE NEEDED FOR THREAD-
+SUPPORT WITH THE BERKELEY DB.
+
+Please check carefully if your platform is not mentioned above.
+
+The OpenLDAP configure tool will most probably find the correct
+configuration itself. No special action has to be taken
+while building the OpenLDAP package.
+
+# $OpenLDAP$
## Copyright 1998,1999 The OpenLDAP Foundation
## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
## of this package for details.
--- /dev/null
+# $OpenLDAP$
+## Copyright 1998,1999 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
+## of this package for details.
+##---------------------------------------------------------------------------
+##
+## Makefile Template for Non-Source Directories
+##
+
+Makefile: $(top_srcdir)/build/info.mk
--- /dev/null
+#! /bin/sh
+# $OpenLDAP$
+## Copyright 1998,1999 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
+## of this package for details.
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=$mkdirprog
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+ '
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
--- /dev/null
+# $OpenLDAP$
+## Copyright 1998,1999 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
+## of this package for details.
+##---------------------------------------------------------------------------
+##
+## Makefile Template for Shared Libraries
+##
+
+COMPILE = $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c
+MKDEPFLAG = -l
+
+.SUFFIXES: .c .o .lo
+
+.c.lo:
+ $(COMPILE) $<
+
+$(LIBRARY): version.lo
+ $(LTLIBLINK) -rpath $(libdir) -o $@ $(OBJS) version.lo
+ $(RM) ../$@; \
+ (d=`$(PWD)` ; $(LN_S) `$(BASENAME) $$d`/$@ ../$@)
+ $(RM) ../`$(BASENAME) $@ .la`.a; \
+ (d=`$(PWD)`; t=`$(BASENAME) $@ .la`.a; $(LN_S) `$(BASENAME) $$d`/.libs/$$t ../$$t)
+
+Makefile: $(top_srcdir)/build/lib-shared.mk
--- /dev/null
+# $OpenLDAP$
+## Copyright 1998,1999 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
+## of this package for details.
+##---------------------------------------------------------------------------
+##
+## Makefile Template for Static Libraries
+##
+
+$(LIBRARY): version.o
+ $(AR) ru $@ $(OBJS) version.o
+ @$(RANLIB) $@; \
+ $(RM) ../$@; \
+ (d=`$(PWD)` ; $(LN_S) `$(BASENAME) $$d`/$@ ../$@)
+
+Makefile: $(top_srcdir)/build/lib-static.mk
--- /dev/null
+# $OpenLDAP$
+## Copyright 1998,1999 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
+## of this package for details.
+##---------------------------------------------------------------------------
+##
+## Makefile Template for Libraries
+##
+
+all-common: $(LIBRARY) $(PROGRAMS)
+
+version.c: $(OBJS)
+ $(RM) $@
+ $(MKVERSION) $(LIBRARY) > $@
+
+install-common: FORCE
+
+lint: lint-local FORCE
+ $(LINT) $(DEFS) $(DEFINES) $(SRCS)
+
+lint5: lint5-local FORCE
+ $(5LINT) $(DEFS) $(DEFINES) $(SRCS)
+
+clean-common: FORCE
+ $(RM) $(LIBRARY) ../$(LIBRARY) $(XLIBRARY) \
+ $(PROGRAMS) $(XPROGRAMS) $(XSRCS) $(XXSRCS) \
+ *.o *.lo a.out core version.c .libs/*
+
+depend-common: FORCE
+ $(MKDEP) $(DEFS) $(DEFINES) $(SRCS) $(XXSRCS)
+
+lint-local: FORCE
+lint5-local: FORCE
+
+Makefile: $(top_srcdir)/build/lib.mk
+# $OpenLDAP$
## Copyright 1998,1999 The OpenLDAP Foundation
## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
## of this package for details.
-#!/bin/sh -
+#! /bin/sh -
+# $OpenLDAP$
+## Copyright 1998,1999 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
+## of this package for details.
#
+# Portions
# Copyright (c) 1987 Regents of the University of California.
# All rights reserved.
#
MAKE=Makefile # default makefile name is "Makefile"
NOSLASH="no" # by default, / dependencies are included
-CC=cc # default compiler is cc
+SRCDIR=""
+SED=cat
+
+: ${CC=cc} # use cc by default
+
+# We generally set these via the command line options
+: ${MKDEP_CC=$CC} # select default compiler to generate dependencies
+: ${MKDEP_CFLAGS="-M"} # cc -M usually produces dependencies
while :
do case "$1" in
+ # the -s flag removes dependencies to files that begin with /
+ -s)
+ NOSLASH=yes;
+ shift ;;
+
# -f allows you to select a makefile name
-f)
MAKE=$2
shift; shift ;;
- # -c allows you to select a compiler to use (default is cc)
+ # -d allows you to select a VPATH directory
+ -d)
+ SRCDIR=$2
+ shift; shift ;;
+
+ # -c allows you to override the compiler used to generate dependencies
-c)
- CC=$2
+ MKDEP_CC=$2
+ shift; shift ;;
+
+ # -m allows you to override the compiler flags used to generate
+ # dependencies.
+ -m)
+ MKDEP_CFLAGS=$2
shift; shift ;;
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
- SED='s;\.o;;'
+ SED='sed -e s;\.o;;'
shift ;;
- # the -s flag removes dependencies to files that begin with /
- -s)
- NOSLASH=yes;
+ # the -l flag produces libtool compatible dependencies
+ -l)
+ SED='sed -e s;\.o:;.lo:;'
shift ;;
# -*) shift ;;
esac
done
-if [ $# = 0 ] ; then
- echo 'usage: mkdep [-p] [-f makefile] [flags] file ...'
+if test $# = 0 ; then
+ echo 'usage: mkdep [-p] [-s] [-c cc] [-m flags] [-f makefile] [-d srcdir] [cppflags] file ...'
exit 1
fi
-if [ ! -w $MAKE ]; then
+if test ! -w $MAKE ; then
echo "mkdep: no writeable file \"$MAKE\""
exit 1
fi
TMP=/tmp/mkdep$$
-trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
+trap 'rm -f $TMP.sed $TMP ; exit 1' 1 2 3 13 15
cp $MAKE ${MAKE}.bak
# egrep '^#include[ ]*".*"' /dev/null $* |
# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
-$CC -M $* |
-sed "
- s; \./; ;g
- $SED" |
+if test "x$SRCDIR" = "x" ; then
+ files=$*
+else
+ files=
+ for i in $* ; do
+ if test -f $i ; then
+ files="$files $i"
+ elif test -f $SRCDIR/$i ; then
+ files="$files $SRCDIR/$i"
+ else
+ files="$files $i"
+ fi
+ done
+
+ MKDEP_CFLAGS="$MKDEP_CFLAGS -I$SRCDIR"
+fi
+
+cat << _EOF_ >> $TMP
+
+#
+# files: $*
+# command: $MKDEP_CC $MKDEP_CFLAGS $files
+#
+
+_EOF_
+
+$MKDEP_CC $MKDEP_CFLAGS $files | \
+ sed -e 's; \./; ;g' | \
+ $SED > $TMP.sed
+# do not pipe to awk. SGI awk wants a filename as argument.
+# (or '-', but I do not know if all other awks support that.)
awk '
-$1 ~ /:/ {
+$1 ~ /:$/ {
filenm=$1
- dep=$2
+ dep=substr($0, length(filenm)+1)
}
-$1 !~ /:/ {
- dep=$1
+$1 !~ /:$/ {
+ dep=$0
}
/.*/ {
- if ( noslash = "yes" && dep ~ /^\// ) next
- if (filenm != prev) {
- if (rec != "")
- print rec;
- rec = filenm " " dep;
- prev = filenm;
+ if ( length(filenm) < 2 ) next
+ if ( filenm ~ /:.*:$/ ) next
+ split(dep, depends, " ")
+ for(d in depends) {
+ dfile = depends[d]
+ if ( length(dfile) < 2 ) continue
+ if ( dfile ~ /:/ ) continue
+ if (( noslash == "yes") && (dfile ~ /^\// )) continue
+ rec = filenm " " dfile
+ print rec
}
- else {
- if (length(rec dep) > 78) {
- print rec;
- rec = filenm " " dep;
- }
- else
- rec = rec " " dep
- }
- }
-END {
- print rec
-}' noslash="$NOSLASH" >> $TMP
+}
+' noslash="$NOSLASH" $TMP.sed >> $TMP
+
cat << _EOF_ >> $TMP
# copy to preserve permissions
cp $TMP $MAKE
-rm -f ${MAKE}.bak $TMP
+rm -f ${MAKE}.bak $TMP.sed $TMP
exit 0
#! /bin/sh
+# $OpenLDAP$
## Copyright 1998,1999 The OpenLDAP Foundation
## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
## of this package for details.
--- /dev/null
+#! /bin/sh
+# $OpenLDAP$
+## Copyright 1998,1999 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
+## of this package for details.
+#
+# Create a version.c file
+#
+PACKAGE=OpenLDAP
+VERSION=unknown
+SYMBOL=__Version
+static=static
+const=const
+while :
+ do case "$1" in
+ -p)
+ PACKAGE=$2
+ shift; shift ;;
+ -v)
+ VERSION=$2
+ shift; shift ;;
+
+ -c)
+ const=
+ shift ;;
+ -n)
+ SYMBOL=$2
+ shift; shift ;;
+ -s)
+ static=
+ shift ;;
+
+# -*) shift ;;
+ *)
+ break ;;
+ esac
+done
+
+if test $# != 1 ; then
+ echo 'usage: mkversion [-c] [-s] [-p package] [-v version] application'
+ exit 1
+fi
+
+APPLICATION=$1
+WHEN=`date`
+WHOWHERE="$USER@`uname -n`:`pwd`"
+
+cat << __EOF__
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation
+ * COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
+ * of this package for details.
+ */
+
+$static $const char $SYMBOL[] =
+"@(#) \$$PACKAGE: $APPLICATION $VERSION ($WHEN) \$\n\t$WHOWHERE\n";
+
+__EOF__
+# $OpenLDAP$
## Copyright 1998,1999 The OpenLDAP Foundation
## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
## of this package for details.
+dnl $OpenLDAP$
+dnl
dnl Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
dnl
])
dnl
dnl ====================================================================
+dnl Check GNU Pth pthread Header
+dnl
+dnl defines ol_cv_header linux_threads to 'yes' or 'no'
+dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
+dnl doesn't exists. Existance of pthread.h should separately
+dnl checked.
+dnl
+AC_DEFUN([OL_HEADER_GNU_PTH_PTHREAD_H], [
+ AC_CACHE_CHECK([for GNU Pth pthread.h],
+ [ol_cv_header_gnu_pth_pthread_h],
+ [AC_EGREP_CPP(__gnu_pth__,
+ [#include <pthread.h>
+#ifdef _POSIX_THREAD_IS_GNU_PTH
+ __gnu_pth__
+#endif
+],
+ [ol_cv_header_gnu_pth_pthread_h=yes],
+ [ol_cv_header_gnu_pth_pthread_h=no])
+ ])
+])dnl
+dnl ====================================================================
dnl Check LinuxThreads Header
dnl
dnl defines ol_cv_header linux_threads to 'yes' or 'no'
+# $OpenLDAP$
## Copyright 1998,1999 The OpenLDAP Foundation
## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
## of this package for details.
+# $OpenLDAP$
## Copyright 1998,1999 The OpenLDAP Foundation
## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
## of this package for details.
+# $OpenLDAP$
## Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
## All rights reserved.
##
-2.0-Engineering
+2.0-alpha3
--- /dev/null
+# $OpenLDAP$
+## Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+##
+## Clients Makefile.in for OpenLDAP
+
+SUBDIRS= tools ud finger gopher mail500 fax500 rcpt500
+# $OpenLDAP$
+
PROGRAMS= rp500 fax500 xrpcomp.tmp
SRCS= main.c faxtotpc.c rp500.c
--- /dev/null
+/* $OpenLDAP$ */
+#ifndef FAX500_H
+#define FAX500_H 1
+
+/* in faxtotpc.c */
+void strip_nonnum ( char *str );
+char *remove_parens( char *ibuf, char *obuf );
+char *munge_phone ( char *ibuf, char *obuf );
+char *faxtotpc ( char *phone, char *userinfo );
+
+#endif
+/* $OpenLDAP$ */
/*
* Copyright (c) 1993 Regents of the University of Michigan.
* All rights reserved.
* Routines for parsing the facsimileTelephoneNumber field out of
* an X.500 entry and converting it to a "tpc.int" domain name.
*
- * char *faxtotpc(str)
- * char *str;
+ * char *faxtotpc( char *str, char *userinfo)
*
* faxtotpc() returns a pointer to a string allocated with malloc(3).
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#ifdef ultrix
-extern char *strdup();
-#endif
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
+#include "fax500.h"
#define TPCDOMAIN "tpc.int"
/*
* Remove everything from 'str' which is not a digit
*/
-void strip_nonnum(str)
-char *str;
+void
+strip_nonnum( char *str )
{
char *p, *q;
p = q = str;
* Remove anything of the form (blah) where
* "blah" contains a non-numeric character.
*/
-char *remove_parens(ibuf, obuf)
-char *ibuf;
-char *obuf;
+char *
+remove_parens( char *ibuf, char *obuf )
{
char *p = ibuf;
char *q = obuf;
* 6 93
* 8 99
*/
-char *munge_phone(ibuf, obuf)
-char *ibuf;
-char *obuf;
+char *
+munge_phone( char *ibuf, char *obuf )
{
#define UMAREACODE "1313"
-
-
-
-
-
/*
* Convert string to "tpc.int" domain name.
*/
-char *faxtotpc(phone, userinfo)
-char *phone;
-char *userinfo;
+char *
+faxtotpc( char *phone, char *userinfo )
{
char *p;
char *q;
strcat(obuf, TPCDOMAIN); /* tack on domain name */
p = strdup(obuf);
return(p);
-
}
+/* $OpenLDAP$ */
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
static int isgroup(LDAPMessage *e);
static void add_error(Error **err, int *nerr, int code, char *addr, LDAPMessage *msg);
static void add_group(char *dn, Group **list, int *nlist);
-static void unbind_and_exit(int rc);
+static void unbind_and_exit(int rc) LDAP_GCCATTR((noreturn));
static int group_loop(char *dn);
static void send_group(Group *group, int ngroup);
static int has_attributes(LDAPMessage *e, char *attr1, char *attr2);
+/* $OpenLDAP$ */
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
+# $OpenLDAP$
+
SRCS= main.c
XSRCS= version.c
OBJS= main.o
+/* $OpenLDAP$ */
/*
* Copyright (c) 1990,1994 Regents of the University of Michigan.
* All rights reserved.
+# $OpenLDAP$
##
## Makefile for gopher clients
##
+/* $OpenLDAP$ */
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
char myhost[MAXHOSTNAMELEN];
int myport;
-static void usage ( char *name );
+static void usage ( char *name ) LDAP_GCCATTR((noreturn));
static int set_socket (int port);
static RETSIGTYPE wait4child(int sig);
-static void do_queries (int s);
+static void do_queries (int s) LDAP_GCCATTR((noreturn));
static void do_error (FILE *fp, char *s);
static void do_search (LDAP *ld, FILE *fp, char *buf);
static void do_read (LDAP *ld, FILE *fp, char *dn);
+/* $OpenLDAP$ */
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
char *friendlyfile = FRIENDLYFILE;
int rdncount = GO500GW_RDNCOUNT;
-static void usage ( char *name );
+static void usage ( char *name ) LDAP_GCCATTR((noreturn));
static int set_socket (int port);
static RETSIGTYPE wait4child(int sig);
-static void do_queries (int s);
+static void do_queries (int s) LDAP_GCCATTR((noreturn));
static char *pick_oc ( char **oclist );
static int isnonleaf ( LDAP *ld, char **oclist, char *dn );
static void do_menu (LDAP *ld, FILE *fp, char *dn);
+# $OpenLDAP$
+
PROGRAMS= mail500
SRCS= main.c
+/* $OpenLDAP$ */
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
static void add_single_to( char ***list, char *new );
static int isgroup( LDAPMessage *e );
static void add_error( Error **err, int *nerr, int code, char *addr, LDAPMessage *msg );
-static void unbind_and_exit( int rc );
+static void unbind_and_exit( int rc ) LDAP_GCCATTR((noreturn));
static void send_group( Group *group, int ngroup );
static int connect_to_x500( void );
exit( rc );
}
-
-
-
-
+# $OpenLDAP$
+
PROGRAMS= rcpt500
SRCS= main.c cmds.c help.c query.c
XSRCS= version.c
+/* $OpenLDAP$ */
/*
* cmds.c: command table for rcpt500 (X.500 email query responder)
*
* All Rights Reserved
*/
-#include <stdio.h>
+#include "portable.h"
+
+#include <ac/stdlib.h>
#include "rcpt500.h"
struct command cmds[] = {
+/* $OpenLDAP$ */
/*
* help.c: for rcpt500 (X.500 email query responder)
*
* All Rights Reserved
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <syslog.h>
-#include <string.h>
+
+#include <ac/syslog.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_FCNTL_H
#include <fcntl.h>
+#endif
-#include "portable.h"
-#include "ldapconfig.h"
+#include "ldap_defaults.h"
#include "rcpt500.h"
-extern int dosyslog;
-
int
-help_cmd( msgp, reply )
- struct msginfo *msgp;
- char *reply;
+help_cmd(struct msginfo *msgp, char *reply)
{
int fd, len;
+/* $OpenLDAP$ */
/*
* main.c: for rcpt500 (X.500 email query responder)
*
+/* $OpenLDAP$ */
/*
* query.c: for rcpt500 (X.500 email query responder)
*
+/* $OpenLDAP$ */
/*
* rcpt500.h: includes for rcpt500 (X.500 email query responder)
*
* All Rights Reserved
*/
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
+
struct msginfo {
char *msg_subject;
char *msg_replyto; /* actually could be from From: line */
};
struct command {
- char *cmd_text; /* text for command, e.g. "HELP" */
- int (*cmd_handler)(); /* pointer to handler function */
+ char *cmd_text; /* text for command, e.g. "HELP" */
+ /* pointer to handler function */
+ int (*cmd_handler) LDAP_P((struct msginfo *msgp, char *reply));
};
/*
* functions
*/
-int help_cmd();
-int query_cmd();
+int help_cmd LDAP_P((struct msginfo *msgp, char *reply));
+int query_cmd LDAP_P((struct msginfo *msgp, char *reply));
/*
* externs
*/
+
+/* cmds.c */
extern struct command cmds[];
+/* main.c */
+extern int dosyslog;
+#ifdef LDAP_CONNECTIONLESS
+extern int do_cldap;
+#endif
+extern int derefaliases;
+extern int sizelimit;
+extern int rdncount;
+extern int ldapport;
+extern char *ldaphost;
+extern char *searchbase;
+extern char *dapuser;
+extern char *filterfile;
+extern char *templatefile;
+
+LDAP_END_DECL
+# $OpenLDAP$
##
## Makefile for LDAP tools
##
/* ldapdelete.c - simple program to delete an entry using LDAP */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
static char *binddn = NULL;
static char *passwd = NULL;
-static char *base = NULL;
static char *ldaphost = NULL;
static int ldapport = 0;
static int not, verbose, contoper;
ldap_set_option( ld, LDAP_OPT_DEREF, &deref );
}
+ /* don't chase referrals */
+ ldap_set_option( ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF );
+
if (want_bindpw)
passwd = getpass("Enter LDAP Password: ");
}
}
+ rc = 0;
if ( fp == NULL ) {
for ( ; optind < argc; ++optind ) {
rc = dodelete( ld, argv[ optind ] );
}
} else {
- rc = 0;
while ((rc == 0 || contoper) && fgets(buf, sizeof(buf), fp) != NULL) {
buf[ strlen( buf ) - 1 ] = '\0'; /* remove trailing newline */
if ( *buf != '\0' ) {
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#define T_NEWSUPSTR "newsuperior"
-static void usage LDAP_P(( const char *prog ));
+static void usage LDAP_P(( const char *prog )) LDAP_GCCATTR((noreturn));
static int process_ldapmod_rec LDAP_P(( char *rbuf ));
static int process_ldif_rec LDAP_P(( char *rbuf, int count ));
static void addmodifyop LDAP_P(( LDAPMod ***pmodsp, int modop, char *attr,
int deref = LDAP_DEREF_NEVER;
ldap_set_option( ld, LDAP_OPT_DEREF, &deref);
}
+ /* don't chase referrals */
+ ldap_set_option( ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF );
if (want_bindpw)
passwd = getpass("Enter LDAP Password: ");
goto end_line;
} else if ( strcasecmp( type, T_MODOPREPLACESTR ) == 0 ) {
modop = LDAP_MOD_REPLACE;
+ addmodifyop( &pmods, modop, value, NULL, 0 );
goto end_line;
} else if ( strcasecmp( type, T_MODOPDELETESTR ) == 0 ) {
modop = LDAP_MOD_DELETE;
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
static char *binddn = NULL;
static char *passwd = NULL;
-static char *base = NULL;
static char *ldaphost = NULL;
static int ldapport = 0;
static int not, verbose, contoper;
int deref = LDAP_DEREF_NEVER;
ldap_set_option( ld, LDAP_OPT_DEREF, &deref);
}
+ /* don't chase referrals */
+ ldap_set_option( ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF );
+
if (want_bindpw)
passwd = getpass("Enter LDAP Password: ");
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
typedef struct hash_t
{
- char *name;
+ const char *name;
unsigned int namesz;
char *(*func) (const char *, Salt *);
unsigned char takes_salt;
* pw_encode() essentially base64 encodes a password and its salt
*/
-char *
+static char *
pw_encode (unsigned char *passwd, Salt * salt, unsigned int len)
{
int salted = salt && salt->salt && salt->len;
* if you'd like to write a better salt generator, please, be my guest.
*/
-void
+static void
make_salt (Salt * salt, unsigned int len)
{
* password generator
*/
-char *
+static char *
gen_pass (unsigned int len)
{
static const unsigned char autogen[] =
}
#ifdef SLAPD_CLEARTEXT
-char *
+static char *
hash_none (const char *pw_in, Salt * salt)
{
return (strdup (pw_in));
#endif
#ifdef SLAPD_CRYPT
-char *
+static char *
hash_crypt (const char *pw_in, Salt * salt)
{
static const unsigned char crypt64[] =
}
#endif
-char *
+static char *
hash_md5 (const char *pw_in, Salt * salt)
{
lutil_MD5_CTX MD5context;
return (pw_encode (MD5digest, salt, sizeof (MD5digest)));
}
-char *
+static char *
hash_sha1 (const char *pw_in, Salt * salt)
{
lutil_SHA1_CTX SHA1context;
return (pw_encode (SHA1digest, salt, sizeof (SHA1digest)));
}
-static Hash hashes[] =
+static const Hash hashes[] =
{
#ifdef SLAPD_CLEARTEXT
{"none", 4, hash_none, 0, HASHTYPE_NONE, HASHTYPE_NONE, 0},
{NULL, 0, NULL, 0, HASHTYPE_NONE, HASHTYPE_NONE, 0}
};
-int
+static int
modify_dn (LDAP * ld, char *targetdn, char *pwattr, char *oldpw,
char *newpw, HashTypes htype, Salt * salt)
{
return (ret);
}
-void
-usage (char *s)
+static void
+usage(const char *s)
{
fprintf (stderr, "Usage: %s [options] [filter]\n", s);
fprintf (stderr, " -a attrib\tpassword attribute (default: " LDAP_PASSWD_ATTRIB ")\n");
int deref = LDAP_DEREF_NEVER;
ldap_set_option( ld, LDAP_OPT_DEREF, &deref);
}
+ /* don't chase referrals */
+ ldap_set_option( ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF );
if (version != -1 &&
ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) != LDAP_OPT_SUCCESS )
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#define DEFSEP "="
static void
-usage( char *s )
+usage( const char *s )
{
fprintf( stderr,
"usage: %s [options] filter [attributes...]\nwhere:\n"
}
-void print_entry(
+static void
+print_entry(
LDAP *ld,
LDAPMessage *entry,
int attrsonly)
}
-int
+static int
write_ldif( int type, char *name, char *value, ber_len_t vallen )
{
char *ldif;
+# $OpenLDAP$
+
SRCS= main.c find.c mod.c print.c auth.c util.c help.c \
string_to_key.c group.c edit.c globals.c
XSRCS= version.c
+/* $OpenLDAP$ */
/*
* Copyright (c) 1991, 1992 Regents of the University of Michigan.
* All rights reserved.
#define FIVEMINS ( 5 * 60 )
#define TGT "krbtgt"
-static void
-str2upper( char *s )
-{
- char *p;
-
- for ( p = s; *p != '\0'; ++p ) {
- *p = TOUPPER( (unsigned char) *p );
- }
-}
-
-
static int
valid_tgt( char **names )
{
/*
* realm must be uppercase for krb_ routines
*/
- str2upper( realm );
+ ldap_pvt_str2upper( realm );
#endif /* HAVE_AFS_KERBEROS */
/*
/*
* realm must be uppercase for krb_ routines
*/
- str2upper( realm );
+ ldap_pvt_str2upper( realm );
#endif /* HAVE_AFS_KERBEROS */
rc = krb_get_in_tkt( name, inst, realm, TGT, realm,
+/* $OpenLDAP$ */
/*
* Copyright (c) 1994 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright (c) 1991, 1992, 1993
* Regents of the University of Michigan. All rights reserved.
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#ifndef __STDC__
-#include <memory.h>
-#endif
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include <lber.h>
#include <ldap.h>
+
#include "ud.h"
-extern char *search_base; /* search base */
-extern int verbose; /* verbose mode flag */
-extern LDAP *ld; /* our ldap descriptor */
-
static int num_picked = 0; /* used when user picks entry at More prompt */
-#ifdef DEBUG
-extern int debug; /* debug flag */
-#endif
-vrfy(dn)
-char *dn;
+int
+vrfy( char *dn )
{
LDAPMessage *results;
static char *attrs[2] = { "objectClass", NULL };
+ int ld_errno = 0;
#ifdef DEBUG
if (debug & D_TRACE)
/* verify that this DN exists in the directory */
(void) ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "objectClass=*", attrs, TRUE, &results);
(void) ldap_msgfree(results);
- if ((ld->ld_errno == LDAP_NO_SUCH_OBJECT) || (ld->ld_errno == LDAP_INVALID_DN_SYNTAX))
+
+ ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
+
+ if ((ld_errno == LDAP_NO_SUCH_OBJECT) || (ld_errno == LDAP_INVALID_DN_SYNTAX))
return(0);
- else if (ld->ld_errno == LDAP_SUCCESS)
+ else if (ld_errno == LDAP_SUCCESS)
return(1);
else {
ldap_perror(ld, "ldap_search");
}
-static LDAPMessage * disambiguate( result, matches, read_attrs, who )
-LDAPMessage *result;
-int matches;
-char **read_attrs;
-char *who;
+static LDAPMessage *
+disambiguate( LDAPMessage *result, int matches, char **read_attrs, char *who )
{
int choice; /* entry that user chooses */
int i;
char response[SMALL_BUF_SIZE]; /* results from user */
char *name = NULL; /* DN to lookup */
LDAPMessage *mp;
- extern void Free();
+ int ld_errno = 0;
#ifdef DEBUG
if (debug & D_TRACE)
printf("->disambiguate(%x, %d, %x, %s)\n", result, matches,
read_attrs, who);
#endif
+
+ ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
+
/*
* If we are here, it means that we got back multiple answers.
*/
- if ((ld->ld_errno == LDAP_TIMELIMIT_EXCEEDED)
- || (ld->ld_errno == LDAP_SIZELIMIT_EXCEEDED)) {
+ if ((ld_errno == LDAP_TIMELIMIT_EXCEEDED)
+ || (ld_errno == LDAP_SIZELIMIT_EXCEEDED)) {
if (verbose) {
printf(" Your query was too general and a limit was exceeded. The results listed\n");
printf(" are not complete. You may want to try again with a more refined query.\n\n");
}
}
-LDAPMessage * find(who, quiet)
-char *who;
-int quiet;
+LDAPMessage *
+find( char *who, int quiet )
{
register int i, j, k; /* general ints */
int matches; /* from ldap_count_entries() */
char response[SMALL_BUF_SIZE];
char *cp, *dn, **rdns;
LDAPFiltInfo *fi;
- extern LDAPFiltDesc *lfdp; /* LDAP filter descriptor */
- extern struct attribute attrlist[]; /* complete list of attrs */
- extern void Free();
#ifdef DEBUG
if (debug & D_TRACE)
* here. If we don't find it, treat it as NOT a UFN.
*/
if (strchr(who, ',') != NULL) {
- int savederef;
+ int savederef, deref;
#ifdef DEBUG
if (debug & D_FIND)
printf("\"%s\" appears to be a UFN\n", who);
#endif
- savederef = ld->ld_deref;
- ld->ld_deref = LDAP_DEREF_FINDING;
+ ldap_get_option(ld, LDAP_OPT_DEREF, &savederef);
+ deref = LDAP_DEREF_FINDING;
+ ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
+
if ((rc = ldap_ufn_search_s(ld, who, search_attrs, FALSE, &res)) !=
LDAP_SUCCESS && rc != LDAP_SIZELIMIT_EXCEEDED &&
rc != LDAP_TIMELIMIT_EXCEEDED) {
ldap_perror(ld, "ldap_ufn_search_s");
- ld->ld_deref = savederef;
+ ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
return(NULL);
}
if ((matches = ldap_count_entries(ld, res)) < 0) {
ldap_perror(ld, "ldap_count_entries");
- ld->ld_deref = savederef;
+ ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
return(NULL);
} else if (matches == 1) {
- if (ldap_search_s(ld, ldap_get_dn(ld, ldap_first_entry(ld, res)), LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res) != LDAP_SUCCESS) {
- if (ld->ld_errno == LDAP_UNAVAILABLE)
- printf(" Could not contact the X.500 server to find \"%s\".\n", who);
+ dn = ldap_get_dn(ld, ldap_first_entry(ld, res));
+ rc = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res);
+ ldap_memfree(dn);
+ if (rc != LDAP_SUCCESS) {
+ int ld_errno = 0;
+ ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
+ if (ld_errno == LDAP_UNAVAILABLE)
+ printf(" Could not contact the LDAP server to find \"%s\".\n", who);
else
ldap_perror(ld, "ldap_search_s");
return(NULL);
}
- ld->ld_deref = savederef;
+ ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
return(res);
} else if (matches > 1 ) {
- return( disambiguate( ld, res, matches, read_attrs,
- who ) );
+ return disambiguate( res, matches, read_attrs, who );
}
- ld->ld_deref = savederef;
+ ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
}
/*
fflush(stdout);
fetch_buffer(response, sizeof(response), stdin);
if ((response[0] == 'n') || (response[0] == 'N'))
+ {
+ ldap_memfree(dn);
return(NULL);
+ }
}
#ifdef DEBUG
if (debug & D_FIND) {
if (ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res) != LDAP_SUCCESS) {
ldap_perror(ld, "ldap_search_s");
ldap_msgfree(res);
- return(NULL);
+ res = NULL;
}
- Free(dn);
+ ldap_memfree(dn);
return(res);
}
else if (matches > 0) {
return(NULL);
}
-pick_one(i)
-int i;
+int
+pick_one( int i )
{
int n;
char user_pick[SMALL_BUF_SIZE];
/* NOTREACHED */
}
-print_list(list, names, matches)
-LDAPMessage *list;
-char *names[];
-int *matches;
+void
+print_list( LDAPMessage *list, char **names, int *matches )
{
char **rdns, **cpp;
- extern int lpp;
char resp[SMALL_BUF_SIZE];
register LDAPMessage *ep;
register int i = 1;
return;
}
-find_all_subscribers(sub, group)
-char *sub[];
-char *group;
+int
+find_all_subscribers( char **sub, char *group )
{
int count;
LDAPMessage *result;
sprintf(filter, "%s=%s", "memberOfGroup", group);
if (ldap_search_s(ld, search_base, LDAP_SCOPE_SUBTREE, filter, attributes, FALSE, &result) != LDAP_SUCCESS) {
- if (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
+ int ld_errno = 0;
+ ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
+ if (ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
return(0);
ldap_perror(ld, "ldap_search_s");
return(0);
return(count);
}
-char * fetch_boolean_value(who, attr)
-char *who;
-struct attribute attr;
+char *
+fetch_boolean_value( char *who, struct attribute attr )
{
LDAPMessage *result; /* from the search below */
register LDAPMessage *ep; /* entry pointer */
#endif
attributes[0] = attr.quipu_name;
if (ldap_search_s(ld, who, LDAP_SCOPE_BASE, "objectClass=*", attributes, FALSE, &result) != LDAP_SUCCESS) {
- if (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
+ int ld_errno = 0;
+ ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
+ if (ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
return("FALSE");
ldap_perror(ld, "ldap_search_s");
ldap_msgfree(result);
+/* $OpenLDAP$ */
/*
* Copyright (c) 1992, 1993, 1994 Regents of the University of Michigan.
* All rights reserved.
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
+#include <ac/time.h> /* portable.h+ldap.h needs time_t */
+#include <lber.h>
+#include <ldap.h>
#include "ud.h"
-extern void set_boolean(),
- change_field(),
-#ifdef UOFM
- set_updates(),
-#endif
- mod_addrDN();
-
struct attribute attrlist[] = {
/*
* Field 3 = function used to modify this field (if any)
* Field 4 = Flags specifying how this field is displayed
*/
- { "memberOfGroup", "Subscriptions", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DN },
- { "acl", "Access Control", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
+ { "memberOfGroup", "Subscriptions", 0, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DN },
+ { "acl", "Access Control", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
{ "cn", "Aliases", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_SEARCH | ATTR_FLAG_GROUP_MOD },
{ "title", "Title", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_SEARCH | ATTR_FLAG_PERSON_MOD },
{ "postalAddress", "Business address", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_GROUP_MOD | ATTR_FLAG_IS_MULTILINE },
{ "member", "Members", mod_addrDN, ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DN | ATTR_FLAG_GROUP_MOD },
{ "homePhone", "Home phone", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD },
{ "homePostalAddress", "Home address", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_IS_MULTILINE },
- { "objectClass", "Object class", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_SEARCH },
+ { "objectClass", "Object class", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_SEARCH },
#ifdef UOFM
{ "multiLineDescription", "Description", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_GROUP_MOD | ATTR_FLAG_IS_MULTILINE },
#endif
-#ifdef KERBEROS
- { "krbName", "Kerberos name", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_READ },
+#ifdef HAVE_KERBEROS
+ { "krbName", "Kerberos name", 0, ATTR_FLAG_PERSON | ATTR_FLAG_READ },
#endif
- { "description", "Brief description", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
+ { "description", "Brief description", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
{ "facsimileTelephoneNumber", "Fax number", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_GROUP_MOD },
{ "pager", "Pager number", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD },
- { "uid", "Uniqname", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
- { "userPassword", "Password", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
+ { "uid", "Uniqname", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
+ { "userPassword", "Password", 0, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
#ifdef UOFM
{ "noBatchUpdates", "No batch updates", set_updates, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD },
#endif
{ "onVacation", "On Vacation", set_boolean, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_IS_A_BOOL },
{ "vacationMessage", "Vacation Message", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_IS_MULTILINE },
{ "drink", "Favorite Beverage", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD },
- { "lastModifiedBy", "Last modified by", NULL, ATTR_FLAG_GROUP | ATTR_FLAG_PERSON | ATTR_FLAG_IS_A_DN | ATTR_FLAG_READ },
- { "lastModifiedTime", "Last modified at", NULL, ATTR_FLAG_GROUP | ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DATE },
- { NULL, NULL, NULL, ATTR_FLAG_NONE }
+ { "lastModifiedBy", "Last modified by", 0, ATTR_FLAG_GROUP | ATTR_FLAG_PERSON | ATTR_FLAG_IS_A_DN | ATTR_FLAG_READ },
+ { "lastModifiedTime", "Last modified at", 0, ATTR_FLAG_GROUP | ATTR_FLAG_PERSON | ATTR_FLAG_READ | ATTR_FLAG_IS_A_DATE },
+ { NULL, NULL, 0, ATTR_FLAG_NONE }
};
+/* $OpenLDAP$ */
/*
* Copyright (c) 1993, 1994 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright (c) 1992, 1993 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright (c) 1991,1993 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright (c) 1991, 1993
* Regents of the University of Michigan. All rights reserved.
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#ifndef __STDC__
-#include <memory.h>
-#endif
-#include <time.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include <lber.h>
#include <ldap.h>
-#include "ud.h"
-#ifdef DEBUG
-extern int debug;
-#endif
+#include "ud.h"
struct entry Entry;
-extern LDAP *ld;
-extern void * Malloc();
-extern void Free();
-extern char * my_ldap_dn2ufn();
+static char *time2text(char *ldtimestr, int dateonly);
+static long gtime(struct tm *tm);
/*
* When displaying entries, display only these attributes, and in this
NULL
};
-parse_answer(s)
-LDAPMessage *s;
+
+void
+parse_answer( LDAPMessage *s )
{
int idx;
char **rdns;
- BerElement *cookie;
register LDAPMessage *ep;
register char *ap;
- void clear_entry();
#ifdef DEBUG
if (debug & D_TRACE)
printf(" Done clearing entry\n");
#endif
for (ep = ldap_first_entry(ld, s); ep != NULL; ep = ldap_next_entry(ld, ep)) {
+ BerElement *cookie = NULL;
#ifdef DEBUG
if (debug & D_PARSE)
printf(" Determining DN and name\n");
}
add_value(&(Entry.attrs[idx]), ep, ap);
}
+
+ if( cookie != NULL ) {
+ ber_free( cookie, 0 );
+ }
}
#ifdef DEBUG
if (debug & D_PARSE)
#endif
}
-add_value(attr, ep, ap)
-struct attribute *attr;
-LDAPMessage *ep;
-char *ap;
+void
+add_value( struct attribute *attr, LDAPMessage *ep, char *ap )
{
register int i = 0;
char **vp, **tp, **avp;
ldap_value_free(vp);
}
-print_an_entry()
+void
+print_an_entry( void )
{
int n = 0, i, idx;
char is_a_group, **order;
char *sub_list[MAX_VALUES], buf[SMALL_BUF_SIZE];
- extern int col_size, isaurl(), isadn();
- static char *time2text();
#ifdef DEBUG
if (debug & D_TRACE)
#define OUT_LABEL_LEN 20
/* prints the values associated with an attribute */
-print_values(A)
-struct attribute A;
+void
+print_values( struct attribute A )
{
register int i, k;
register char *cp, **vp;
putchar('\n');
for (k = lead; k > 0; k--)
putchar(' ');
- while (isspace(*(cp + 1)))
+ while (isspace((unsigned char) cp[1]))
cp++;
}
else
}
/* prints the DN's associated with an attribute */
-print_DN(A)
-struct attribute A;
+void
+print_DN( struct attribute A )
{
int i, lead;
register char **vp;
char out_buf[MED_BUF_SIZE], *padding = NULL;
- extern int col_size;
#ifdef DEBUG
if (debug & D_TRACE)
return;
}
-void clear_entry()
+void
+clear_entry( void )
{
register int i;
- extern struct attribute attrlist[];
#ifdef DEBUG
if (debug & D_TRACE)
printf(" Clearing entry \"%s\"\n", Entry.name);
#endif
if (Entry.DN != NULL)
- Free(Entry.DN);
+ ldap_memfree(Entry.DN);
if (Entry.name != NULL)
Free(Entry.name);
Entry.may_join = FALSE;
}
}
-attr_to_index(s)
-char *s;
+int
+attr_to_index( char *s )
{
register int i;
- extern struct attribute attrlist[];
for (i = 0; attrlist[i].quipu_name != NULL; i++)
if (!strcasecmp(s, attrlist[i].quipu_name))
return(-1);
}
-void initialize_attribute_strings()
+void
+initialize_attribute_strings( void )
{
register int i;
- extern struct entry Entry;
- extern struct attribute attrlist[];
for (i = 0; attrlist[i].quipu_name != NULL; i++)
Entry.attrs[i].quipu_name = attrlist[i].quipu_name;
}
/* prints the URL/label pairs associated with an attribute */
-print_URL(A)
-struct attribute A;
+void
+print_URL( struct attribute A )
{
int i, lead;
register char **vp;
return;
}
-print_one_URL(s, label_lead, tag, url_lead)
-char *s;
-int label_lead;
-char *tag;
-int url_lead;
+void
+print_one_URL( char *s, int label_lead, char *tag, int url_lead )
{
register int i;
char c, *cp, *url;
- extern int col_size;
- extern void Free();
- for (cp = s; !isspace(*cp) && (*cp != '\0'); cp++)
+ for (cp = s; !isspace((unsigned char)*cp) && (*cp != '\0'); cp++)
;
c = *cp;
*cp = '\0';
url = strdup(s);
*cp = c;
if (*cp != '\0') {
- for (cp++; isspace(*cp); cp++)
+ for (cp++; isspace((unsigned char)*cp); cp++)
;
}
else
}
-#define GET2BYTENUM( p ) (( *p - '0' ) * 10 + ( *(p+1) - '0' ))
+#define GET2BYTENUM( p ) (( *(p) - '0' ) * 10 + ( *((p)+1) - '0' ))
static char *
time2text( char *ldtimestr, int dateonly )
struct tm t;
char *p, *timestr, zone, *fmterr = "badly formatted time";
time_t gmttime;
- static long gtime();
+ int ndigits;
- memset( (char *)&t, 0, sizeof( struct tm ));
- if ( strlen( ldtimestr ) < 13 ) {
- return( fmterr );
+ if (strlen( ldtimestr ) < 12 ) {
+ return( fmterr );
+ }
+
+ for ( ndigits=0; isdigit((unsigned char) ldtimestr[ndigits]); ndigits++) {
+ ; /* EMPTY */
}
- for ( p = ldtimestr; p - ldtimestr < 12; ++p ) {
- if ( !isdigit( *p )) {
+ if ( ndigits != 12 && ndigits != 14) {
return( fmterr );
}
- }
+
+ memset( (char *)&t, 0, sizeof( struct tm ));
p = ldtimestr;
+
+ if( ndigits == 14) {
+ /* came with a century */
+ /* POSIX says tm_year should be year - 1900 */
+ t.tm_year = 100 * GET2BYTENUM( p ) - 1900;
+ p += 2;
+ }
t.tm_year = GET2BYTENUM( p ); p += 2;
+
t.tm_mon = GET2BYTENUM( p ) - 1; p += 2;
t.tm_mday = GET2BYTENUM( p ); p += 2;
t.tm_hour = GET2BYTENUM( p ); p += 2;
timestr[ strlen( timestr ) - 1 ] = zone; /* replace trailing newline */
if ( dateonly ) {
- strcpy( timestr + 11, timestr + 20 );
+ SAFEMEMCPY( timestr + 11, timestr + 20, strlen( timestr + 20 ) + 1 );
}
- Free ( ldtimestr );
return( strdup( timestr ) );
}
/* gtime.c - inverse gmtime */
-#if !defined( MACOS ) && !defined( _WIN32 ) && !defined( DOS )
-#include <sys/time.h>
-#endif /* !MACOS */
+#include <ac/time.h>
/* gtime(): the inverse of localtime().
This routine was supplied by Mike Accetta at CMU many years ago.
#define dysize(y) \
(((y) % 4) ? 365 : (((y) % 100) ? 366 : (((y) % 400) ? 365 : 366)))
-#define YEAR(y) ((y) >= 100 ? (y) : (y) + 1900)
+/*
+ * Y2K YEAR
+ */
+ /* per STDC & POSIX tm_year *should* be offset by 1900 */
+#define YEAR_POSIX(y) ((y) + 1900)
+
+ /*
+ * year is < 1900, year is offset by 1900
+ */
+#define YEAR_CAREFUL(y) ((y) < 1900 ? (y) + 1900 : (y))
+
+#define YEAR(y) YEAR_CAREFUL(y)
+
/* \f */
-static long gtime ( struct tm *tm )
+static long
+gtime( struct tm *tm )
{
register int i,
sec,
+/* $OpenLDAP$ */
#include "portable.h"
#if defined(HAVE_KERBEROS) && !defined(openbsd)
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
/*
* Copyright (c) 1991, 1992, 1993
* Regents of the University of Michigan. All rights reserved.
* is provided ``as is'' without express or implied warranty.
*/
-#ifdef DOS
-#include "protoud.h"
-#define strncasecmp(a, b, n) strnicmp(a, b, n)
-#define strcasecmp(a, b) stricmp(a, b)
-#define MAX_VALUES 8
-#else
#define MAX_VALUES 1000
-#endif /* end of DOS ifdef */
/*****************************************************************************
**
* parsing names.
*/
#define MAX_NAME_COMPS 8
-#define isnamesepartor(x) (isspace(x))
+#define isnamesepartor(x) (isspace((unsigned char) (x)))
#define isignorechar(x) (((x) == '.') || ((x) == '_'))
/*
/*
* Authentication method we will be using.
*/
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
#define UD_AUTH_METHOD LDAP_AUTH_KRBV4
#else
#define UD_AUTH_METHOD LDAP_AUTH_SIMPLE
#define ATTR_FLAG_IS_A_BOOL 0x4000
#define ATTR_FLAG_IS_MULTILINE 0x8000
+LDAP_BEGIN_DECL
+
/*
* These are the structures we use when parsing an answer we get from the LDAP
* server.
struct attribute {
char *quipu_name;
char *output_string;
- void (*mod_func)();
+ void (*mod_func) LDAP_P(( char *who, int attr_idx ));
unsigned short flags;
int number_of_values;
char **values;
char *name;
struct attribute attrs[MAX_ATTRS];
};
+
+
+
+/*
+ * Variables
+ */
+
+/* in globals.c: */
+extern struct attribute attrlist[];/* complete list of attrs */
+/* in main.c: */
+extern char copyright[];
+extern char *default_bind_object;
+extern char *bound_dn;
+extern char *group_base;
+extern char *search_base; /* search base */
+extern int lpp;
+extern int verbose; /* verbose mode flag */
+extern int col_size;
+extern int bind_status;
+extern LDAP *ld; /* our ldap descriptor */
+extern LDAPFiltDesc *lfdp; /* LDAP filter descriptor */
+#ifdef DEBUG
+extern int debug; /* debug flag */
+#endif
+/* in print.c: */
+extern struct entry Entry;
+extern int dmsize[];
+/* in version.c: */
+extern char Version[];
+
+
+/*
+ * Functions
+ */
+
+/* in auth.c: */
+int auth LDAP_P(( char *who, int implicit ));
+#if defined(HAVE_KERBEROS) && defined(_AC_KRB_H)
+int krbgetpass LDAP_P(( char *u, char *in, char *re, char *pw, C_Block key ));
+void destroy_tickets LDAP_P(( void ));
+#endif
+
+/* in edit.c: */
+void edit LDAP_P(( char *who ));
+
+/* in find.c: */
+int vrfy LDAP_P(( char *dn ));
+LDAPMessage *find LDAP_P(( char *who, int quiet ));
+int pick_one LDAP_P(( int i ));
+void print_list LDAP_P(( LDAPMessage *list, char **names, int *matches ));
+int find_all_subscribers LDAP_P(( char **sub, char *group ));
+char *fetch_boolean_value LDAP_P(( char *who, struct attribute attr ));
+
+/* in globals.c: */
+
+/* in group.c: */
+void add_group LDAP_P(( char *name ));
+void remove_group LDAP_P(( char *name ));
+void x_group LDAP_P(( int action, char *name ));
+void bulk_load LDAP_P(( char *group ));
+void purge_group LDAP_P(( char *group ));
+void tidy_up LDAP_P(( void ));
+void mod_addrDN LDAP_P(( char *group, int offset ));
+int my_ldap_modify_s LDAP_P(( LDAP *ldap, char *group, LDAPMod **mods ));
+void list_groups LDAP_P(( char *who ));
+void list_memberships LDAP_P(( char *who ));
+
+/* in help.c: */
+void print_help LDAP_P(( char *s ));
+
+/* in main.c: */
+#ifdef DEBUG
+#endif
+
+void do_commands LDAP_P(( void )) LDAP_GCCATTR((noreturn));
+void status LDAP_P(( void ));
+void change_base LDAP_P(( int type, char **base, char *s ));
+void initialize_client LDAP_P(( void ));
+RETSIGTYPE attn LDAP_P(( int sig ));
+#if !defined(NO_TERMCAP) && defined(TIOCGWINSZ)
+RETSIGTYPE chwinsz LDAP_P(( int sig ));
+#endif
+
+/* in mod.c: */
+void modify LDAP_P(( char *who ));
+void change_field LDAP_P(( char *who, int attr_idx ));
+char *get_value LDAP_P(( char *id, char *prompt ));
+void set_boolean LDAP_P(( char *who, int attr_idx ));
+#ifdef UOFM
+void set_updates LDAP_P(( char *who, int dummy ));
+#endif
+void print_mod_list LDAP_P(( int group ));
+int perform_action LDAP_P(( char *choice, char *dn, int group ));
+void mod_perror LDAP_P(( LDAP *ld ));
+
+/* in print.c: */
+void parse_answer LDAP_P(( LDAPMessage *s ));
+void add_value LDAP_P(( struct attribute *attr, LDAPMessage *ep, char *ap ));
+void print_an_entry LDAP_P(( void ));
+void print_values LDAP_P(( struct attribute A ));
+void print_DN LDAP_P(( struct attribute A ));
+void clear_entry LDAP_P(( void ));
+int attr_to_index LDAP_P(( char *s ));
+void initialize_attribute_strings LDAP_P(( void ));
+void print_URL LDAP_P(( struct attribute A ));
+void print_one_URL LDAP_P(( char *s, int l_lead, char *tag, int u_lead ));
+
+/* in string_to_key.c: */
+#if defined(HAVE_KERBEROS) && !defined(openbsd) && defined(_AC_KRB_H)
+#if defined(HAVE_AFS_KERBEROS) || !defined(HAVE_KERBEROS_V)
+void des_string_to_key LDAP_P(( char *str, des_cblock *key ));
+#endif
+#if defined(HAVE_AFS_KERBEROS)
+void ka_StringToKey LDAP_P(( char *str, char *cell, des_cblock *key ));
+#endif
+#endif
+
+/* in util.c: */
+void printbase LDAP_P(( char *lead, char *s ));
+void fetch_buffer LDAP_P(( char *buffer, int length, FILE *where ));
+void fatal LDAP_P(( char *s )) LDAP_GCCATTR((noreturn));
+int isgroup LDAP_P(( void ));
+void format LDAP_P(( char *str, int width, int lead ));
+void format2 LDAP_P(( char *s, char *ft, char *t, int fi, int i, int w ));
+char *strip_ignore_chars LDAP_P(( char *cp ));
+char *code_to_str LDAP_P(( int i ));
+char *friendly_name LDAP_P(( char *s ));
+#ifdef UOFM
+int isauniqname LDAP_P(( char *s ));
+#endif
+int isadn LDAP_P(( char *s ));
+char *my_ldap_dn2ufn LDAP_P(( char *s ));
+int isaurl LDAP_P(( char *s ));
+int isadate LDAP_P(( char *s ));
+void *Malloc LDAP_P(( unsigned int size ));
+void Free LDAP_P(( void *ptr ));
+char *nextstr LDAP_P(( char *s ));
+void free_mod_struct LDAP_P(( LDAPMod *modp ));
+void StrFreeDup LDAP_P(( char **ptr, char *new_value ));
+int confirm_action LDAP_P(( char *msg ));
+
+LDAP_END_DECL
+/* $OpenLDAP$ */
/*
* Copyright (c) 1992, 1993 Regents of the University of Michigan.
* All rights reserved.
#! /bin/sh
+# $OpenLDAP$
+# from OpenLDAP: pkg/ldap/configure.in,v 1.256 1999/09/10 00:10:20 kdz Exp
+
+# Copyright 1998,1999 The OpenLDAP Foundation. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms are permitted only
+# as authorized by the OpenLDAP Public License. A copy of this
+# license is available at http://www.OpenLDAP.org/license.html or
+# in file LICENSE in the top-level directory of the distribution.
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13.1
ac_help="$ac_help
--enable-cache enable caching (yes)"
ac_help="$ac_help
- --enable-dns enable V2 DNS extension (no)"
+ --enable-dns enable V2 DX Referrals extension (no)"
ac_help="$ac_help
--enable-referrals enable V2 Referrals extension (yes)"
ac_help="$ac_help
ac_help="$ac_help
--enable-dmalloc enable debug malloc support (no)"
ac_help="$ac_help
- --with-cyrus-sasl with Cyrus SASL support (auto)"
+ --with-cyrus-sasl with Cyrus SASL support (auto)"
ac_help="$ac_help
- --with-fetch with fetch URL support (auto)"
+ --with-fetch with fetch URL support (auto)"
ac_help="$ac_help
--with-kerberos with Kerberos support (auto)"
ac_help="$ac_help
- --with-readline with readline support (auto)"
+ --with-readline with readline support (auto)"
ac_help="$ac_help
--with-threads use threads (auto)"
ac_help="$ac_help
- --with-tls with TLS/SSL support (auto)"
+ --with-tls with TLS/SSL support (auto)"
ac_help="$ac_help
--with-yielding-select with implicitly yielding select (auto)"
ac_help="$ac_help
-SLAPD Options:"
+SLAPD (Standalone LDAP Daemon) Options:"
ac_help="$ac_help
--enable-slapd enable building slapd (yes)"
ac_help="$ac_help
--enable-quipu build quipu migration tools (no)"
ac_help="$ac_help
--enable-rlookups enable reverse lookups (auto)"
+ac_help="$ac_help
+ --enable-aci enable per-object ACIs (no)"
+ac_help="$ac_help
+ --enable-discreteaci enable discrete rights in ACIs (no)"
ac_help="$ac_help
--enable-wrappers enable tcp wrapper support (no)"
ac_help="$ac_help
--with-ldap-module module type (static)"
ac_help="$ac_help
--enable-ldbm enable ldbm backend (yes)"
-ac_help="$ac_help
- --with-ldbm-module module type (static)"
ac_help="$ac_help
--with-ldbm-api use LDBM API (auto)"
+ac_help="$ac_help
+ --with-ldbm-module module type (static)"
ac_help="$ac_help
--with-ldbm-type use LDBM type (auto)"
ac_help="$ac_help
ac_help="$ac_help
--with-tcl-module module type (static)"
ac_help="$ac_help
-SLURPD Options:"
+SLURPD (Replication Daemon) Options:"
ac_help="$ac_help
--enable-slurpd enable building slurpd (auto)"
ac_help="$ac_help
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:646: checking host system type" >&5
+echo "configure:659: checking host system type" >&5
if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
# Make sure we can run config.sub.
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:687: checking target system type" >&5
+echo "configure:700: checking target system type" >&5
if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then
# Make sure we can run config.sub.
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:727: checking build system type" >&5
+echo "configure:740: checking build system type" >&5
if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
# Make sure we can run config.sub.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:804: checking for a BSD compatible install" >&5
+echo "configure:817: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"\${ac_cv_path_install+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:861: checking whether build environment is sane" >&5
+echo "configure:874: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:922: checking for $ac_word" >&5
+echo "configure:935: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
done
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:952: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:965: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:992: checking for working aclocal" >&5
+echo "configure:1005: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1005: checking for working autoconf" >&5
+echo "configure:1018: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1018: checking for working automake" >&5
+echo "configure:1031: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1031: checking for working autoheader" >&5
+echo "configure:1044: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1044: checking for working makeinfo" >&5
+echo "configure:1057: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1064: checking for $ac_word" >&5
+echo "configure:1077: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking configure arguments""... $ac_c" 1>&6
-echo "configure:1115: checking configure arguments" >&5
+echo "configure:1128: checking configure arguments" >&5
top_builddir=`pwd`
withval="$with_threads"
ol_arg=invalid
- for ol_val in auto posix mach lwp yes no manual ; do
+ for ol_val in auto posix mach pth lwp yes no manual ; do
if test "$withval" = "$ol_val" ; then
ol_arg="$ol_val"
fi
ol_enable_rlookups="auto"
fi
# end --enable-rlookups
+# OpenLDAP --enable-aci
+ # Check whether --enable-aci or --disable-aci was given.
+if test "${enable_aci+set}" = set; then
+ enableval="$enable_aci"
+
+ ol_arg=invalid
+ for ol_val in auto yes no ; do
+ if test "$enableval" = "$ol_val" ; then
+ ol_arg="$ol_val"
+ fi
+ done
+ if test "$ol_arg" = "invalid" ; then
+ { echo "configure: error: bad value $enableval for --enable-aci" 1>&2; exit 1; }
+ fi
+ ol_enable_aci="$ol_arg"
+
+else
+ ol_enable_aci="no"
+fi
+# end --enable-aci
+# OpenLDAP --enable-discreteaci
+ # Check whether --enable-discreteaci or --disable-discreteaci was given.
+if test "${enable_discreteaci+set}" = set; then
+ enableval="$enable_discreteaci"
+
+ ol_arg=invalid
+ for ol_val in auto yes no ; do
+ if test "$enableval" = "$ol_val" ; then
+ ol_arg="$ol_val"
+ fi
+ done
+ if test "$ol_arg" = "invalid" ; then
+ { echo "configure: error: bad value $enableval for --enable-discreteaci" 1>&2; exit 1; }
+ fi
+ ol_enable_discreteaci="$ol_arg"
+
+else
+ ol_enable_discreteaci="no"
+fi
+# end --enable-discreteaci
# OpenLDAP --enable-wrappers
# Check whether --enable-wrappers or --disable-wrappers was given.
if test "${enable_wrappers+set}" = set; then
ol_enable_ldbm="yes"
fi
# end --enable-ldbm
-# OpenLDAP --with-ldbm_module
- # Check whether --with-ldbm_module or --without-ldbm_module was given.
-if test "${with_ldbm_module+set}" = set; then
- withval="$with_ldbm_module"
+# OpenLDAP --with-ldbm_api
+ # Check whether --with-ldbm_api or --without-ldbm_api was given.
+if test "${with_ldbm_api+set}" = set; then
+ withval="$with_ldbm_api"
ol_arg=invalid
- for ol_val in static dynamic ; do
+ for ol_val in auto db2 db mdbm gdbm ndbm manual ; do
if test "$withval" = "$ol_val" ; then
ol_arg="$ol_val"
fi
done
if test "$ol_arg" = "invalid" ; then
- { echo "configure: error: bad value $withval for --with-ldbm_module" 1>&2; exit 1; }
+ { echo "configure: error: bad value $withval for --with-ldbm_api" 1>&2; exit 1; }
fi
- ol_with_ldbm_module="$ol_arg"
+ ol_with_ldbm_api="$ol_arg"
else
- ol_with_ldbm_module="static"
+ ol_with_ldbm_api="auto"
fi
-# end --with-ldbm_module
+# end --with-ldbm_api
-# OpenLDAP --with-ldbm_api
- # Check whether --with-ldbm_api or --without-ldbm_api was given.
-if test "${with_ldbm_api+set}" = set; then
- withval="$with_ldbm_api"
+# OpenLDAP --with-ldbm_module
+ # Check whether --with-ldbm_module or --without-ldbm_module was given.
+if test "${with_ldbm_module+set}" = set; then
+ withval="$with_ldbm_module"
ol_arg=invalid
- for ol_val in auto db2 db mdbm gdbm ndbm manual ; do
+ for ol_val in static dynamic ; do
if test "$withval" = "$ol_val" ; then
ol_arg="$ol_val"
fi
done
if test "$ol_arg" = "invalid" ; then
- { echo "configure: error: bad value $withval for --with-ldbm_api" 1>&2; exit 1; }
+ { echo "configure: error: bad value $withval for --with-ldbm_module" 1>&2; exit 1; }
fi
- ol_with_ldbm_api="$ol_arg"
+ ol_with_ldbm_module="$ol_arg"
else
- ol_with_ldbm_api="auto"
+ ol_with_ldbm_module="static"
fi
-# end --with-ldbm_api
+# end --with-ldbm_module
# OpenLDAP --with-ldbm_type
# Check whether --with-ldbm_type or --without-ldbm_type was given.
if test $ol_enable_rlookups = yes ; then
echo "configure: warning: slapd disabled, ignoring --enable-rlookups argument" 1>&2
fi
+ if test $ol_enable_aci = yes ; then
+ echo "configure: warning: slapd disabled, ignoring --enable-aci argument" 1>&2
+ fi
+ if test $ol_enable_discreteaci = yes ; then
+ echo "configure: warning: slapd disabled, ignoring --enable-discreteaci argument" 1>&2
+ fi
if test $ol_with_ldbm_api != auto ; then
echo "configure: warning: slapd disabled, ignoring --with-ldbm-api argument" 1>&2
fi
ol_enable_phonetic=no
ol_enable_quipu=no
ol_enable_rlookups=no
+ ol_enable_aci=no
+ ol_enable_discreteaci=no
ol_enable_wrappers=no
ol_with_ldbm_api=no
-
ol_aix_threads=no
case "$target" in
*-*-aix*) if test -z "$CC" ; then
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2325: checking for $ac_word" >&5
+echo "configure:2385: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2377: checking for $ac_word" >&5
+echo "configure:2437: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2436: checking for $ac_word" >&5
+echo "configure:2496: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2466: checking for $ac_word" >&5
+echo "configure:2526: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2496: checking for $ac_word" >&5
+echo "configure:2556: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2547: checking for $ac_word" >&5
+echo "configure:2607: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2579: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
+echo "configure:2639: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 2590 "configure"
+#line 2650 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2621: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2681: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:2626: checking whether we are using GNU C" >&5
+echo "configure:2686: checking whether we are using GNU C" >&5
if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2635: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2654: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2714: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:2697: checking for ld used by GCC" >&5
+echo "configure:2757: checking for ld used by GCC" >&5
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:2721: checking for GNU ld" >&5
+echo "configure:2781: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:2724: checking for non-GNU ld" >&5
+echo "configure:2784: checking for non-GNU ld" >&5
fi
if eval "test \"\${ac_cv_path_LD+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:2760: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:2820: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"\${ac_cv_prog_gnu_ld+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:2776: checking for BSD-compatible nm" >&5
+echo "configure:2836: checking for BSD-compatible nm" >&5
if eval "test \"\${ac_cv_path_NM+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:2813: checking whether ln -s works" >&5
+echo "configure:2873: checking whether ln -s works" >&5
if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
case "$host" in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2857 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 2917 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2879: checking whether the C compiler needs -belf" >&5
+echo "configure:2939: checking whether the C compiler needs -belf" >&5
if eval "test \"\${lt_cv_cc_needs_belf+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2884 "configure"
+#line 2944 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2945: checking for $ac_word" >&5
+echo "configure:3005: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# test for ln hardlink support
echo $ac_n "checking whether ln works""... $ac_c" 1>&6
-echo "configure:2976: checking whether ln works" >&5
+echo "configure:3036: checking whether ln works" >&5
if eval "test \"\${ol_cv_prog_LN_H+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:2999: checking whether ln -s works" >&5
+echo "configure:3059: checking whether ln -s works" >&5
if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "sendmail", so it can be a program name with args.
set dummy sendmail; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3027: checking for $ac_word" >&5
+echo "configure:3087: checking for $ac_word" >&5
if eval "test \"\${ac_cv_path_SENDMAIL+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "vi", so it can be a program name with args.
set dummy vi; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3063: checking for $ac_word" >&5
+echo "configure:3123: checking for $ac_word" >&5
if eval "test \"\${ac_cv_path_EDITOR+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "finger", so it can be a program name with args.
set dummy finger; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3099: checking for $ac_word" >&5
+echo "configure:3159: checking for $ac_word" >&5
if eval "test \"\${ac_cv_path_FINGER+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3138: checking for $ac_word" >&5
+echo "configure:3198: checking for $ac_word" >&5
if eval "test \"\${ac_cv_path_PERLBIN+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:3186: checking how to run the C preprocessor" >&5
+echo "configure:3246: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 3201 "configure"
+#line 3261 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3207: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 3218 "configure"
+#line 3278 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 3235 "configure"
+#line 3295 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3241: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
fi
echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:3279: checking for AIX" >&5
+echo "configure:3339: checking for AIX" >&5
cat > conftest.$ac_ext <<EOF
-#line 3281 "configure"
+#line 3341 "configure"
#include "confdefs.h"
#ifdef _AIX
yes
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:3303: checking for POSIXized ISC" >&5
+echo "configure:3363: checking for POSIXized ISC" >&5
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:3325: checking for minix/config.h" >&5
+echo "configure:3385: checking for minix/config.h" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3330 "configure"
+#line 3390 "configure"
#include "confdefs.h"
#include <minix/config.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:3374: checking for Cygwin environment" >&5
+echo "configure:3434: checking for Cygwin environment" >&5
if eval "test \"\${ac_cv_cygwin+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3379 "configure"
+#line 3439 "configure"
#include "confdefs.h"
int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:3390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3450: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:3406: checking for mingw32 environment" >&5
+echo "configure:3466: checking for mingw32 environment" >&5
if eval "test \"\${ac_cv_mingw32+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3411 "configure"
+#line 3471 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:3418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
MINGW32=
test "$ac_cv_mingw32" = yes && MINGW32=yes
echo $ac_n "checking for EMX OS/2 environment""... $ac_c" 1>&6
-echo "configure:3434: checking for EMX OS/2 environment" >&5
+echo "configure:3494: checking for EMX OS/2 environment" >&5
if eval "test \"\${ac_cv_emxos2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3439 "configure"
+#line 3499 "configure"
#include "confdefs.h"
int main() {
return __EMX__;
; return 0; }
EOF
-if { (eval echo configure:3446: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_emxos2=yes
else
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:3465: checking for executable suffix" >&5
+echo "configure:3525: checking for executable suffix" >&5
if eval "test \"\${ac_cv_exeext+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:3475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:3535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.C | *.o | *.obj | *.xcoff) ;;
ac_exeext=$EXEEXT
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:3496: checking for object suffix" >&5
+echo "configure:3556: checking for object suffix" >&5
if eval "test \"\${ac_cv_objext+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:3502: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
echo $ac_n "checking for be_app in -lbe""... $ac_c" 1>&6
-echo "configure:3526: checking for be_app in -lbe" >&5
+echo "configure:3586: checking for be_app in -lbe" >&5
ac_lib_var=`echo be'_'be_app | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lbe -lroot -lnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3534 "configure"
+#line 3594 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
be_app()
; return 0; }
EOF
-if { (eval echo configure:3545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:3571: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:3631: checking for ${CC-cc} option to accept ANSI C" >&5
if eval "test \"\${am_cv_prog_cc_stdc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
do
CC="$ac_save_CC $ac_arg"
cat > conftest.$ac_ext <<EOF
-#line 3588 "configure"
+#line 3648 "configure"
#include "confdefs.h"
#include <stdarg.h>
#include <stdio.h>
; return 0; }
EOF
-if { (eval echo configure:3625: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_prog_cc_stdc="$ac_arg"; break
else
OL_MKDEP="${CC-cc}"
if test -z "${MKDEP_FLAGS}"; then
echo $ac_n "checking for ${OL_MKDEP} depend flag""... $ac_c" 1>&6
-echo "configure:3659: checking for ${OL_MKDEP} depend flag" >&5
+echo "configure:3719: checking for ${OL_MKDEP} depend flag" >&5
if eval "test \"\${ol_cv_mkdep+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
noCode;
EOF
- if { ac_try='$OL_MKDEP $flag conftest.c'; { (eval echo configure:3669: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } \
+ if { ac_try='$OL_MKDEP $flag conftest.c'; { (eval echo configure:3729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } \
| egrep '^conftest\.'"${ac_objext}" >/dev/null 2>&1
then
if test ! -f conftest."${ac_object}" ; then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3707: checking for $ac_hdr" >&5
+echo "configure:3767: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3712 "configure"
+#line 3772 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
fi
echo $ac_n "checking for lt_dlinit in -lltdl""... $ac_c" 1>&6
-echo "configure:3750: checking for lt_dlinit in -lltdl" >&5
+echo "configure:3810: checking for lt_dlinit in -lltdl" >&5
ac_lib_var=`echo ltdl'_'lt_dlinit | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lltdl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3758 "configure"
+#line 3818 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
lt_dlinit()
; return 0; }
EOF
-if { (eval echo configure:3769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# test for EBCDIC
echo $ac_n "checking for EBCDIC""... $ac_c" 1>&6
-echo "configure:3812: checking for EBCDIC" >&5
+echo "configure:3872: checking for EBCDIC" >&5
if eval "test \"\${ol_cv_cpp_ebcdic+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3818 "configure"
+#line 3878 "configure"
#include "confdefs.h"
#if !('M' == 0xd4)
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3851: checking for ANSI C header files" >&5
+echo "configure:3911: checking for ANSI C header files" >&5
if eval "test \"\${ol_cv_header_stdc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3856 "configure"
+#line 3916 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ol_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 3881 "configure"
+#line 3941 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ol_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 3899 "configure"
+#line 3959 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 3920 "configure"
+#line 3980 "configure"
#include "confdefs.h"
#include <ctype.h>
#ifndef HAVE_EBCDIC
exit (0); }
EOF
-if { (eval echo configure:3938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:3972: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4032: checking for $ac_hdr that defines DIR" >&5
if eval "test \"\${ac_cv_header_dirent_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3977 "configure"
+#line 4037 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:3985: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:4010: checking for opendir in -ldir" >&5
+echo "configure:4070: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4018 "configure"
+#line 4078 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
opendir()
; return 0; }
EOF
-if { (eval echo configure:4029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4051: checking for opendir in -lx" >&5
+echo "configure:4111: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4059 "configure"
+#line 4119 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
opendir()
; return 0; }
EOF
-if { (eval echo configure:4070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:4093: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:4153: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"\${ac_cv_header_sys_wait_h+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4098 "configure"
+#line 4158 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:4114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
fi
echo $ac_n "checking POSIX termios""... $ac_c" 1>&6
-echo "configure:4135: checking POSIX termios" >&5
+echo "configure:4195: checking POSIX termios" >&5
if eval "test \"\${am_cv_sys_posix_termios+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4140 "configure"
+#line 4200 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <unistd.h>
tcgetattr(0, 0);
; return 0; }
EOF
-if { (eval echo configure:4150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_sys_posix_termios=yes
else
echo $ac_n "checking whether use of TIOCGWINSZ requires sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:4166: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5
+echo "configure:4226: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5
if eval "test \"\${am_cv_sys_tiocgwinsz_needs_sys_ioctl_h+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
gwinsz_in_termios_h=no
if test $am_cv_sys_posix_termios = yes; then
cat > conftest.$ac_ext <<EOF
-#line 4175 "configure"
+#line 4235 "configure"
#include "confdefs.h"
#include <sys/types.h>
# include <termios.h>
if test $gwinsz_in_termios_h = no; then
cat > conftest.$ac_ext <<EOF
-#line 4195 "configure"
+#line 4255 "configure"
#include "confdefs.h"
#include <sys/types.h>
# include <sys/ioctl.h>
resolv.h \
sgtty.h \
shadow.h \
- stdarg.h \
stddef.h \
string.h \
strings.h \
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4274: checking for $ac_hdr" >&5
+echo "configure:4333: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4279 "configure"
+#line 4338 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4343: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:4314: checking for socket" >&5
+echo "configure:4373: checking for socket" >&5
if eval "test \"\${ac_cv_func_socket+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4319 "configure"
+#line 4378 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char socket(); below. */
; return 0; }
EOF
-if { (eval echo configure:4343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_socket=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:4362: checking for main in -lsocket" >&5
+echo "configure:4421: checking for main in -lsocket" >&5
ac_lib_var=`echo socket'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4370 "configure"
+#line 4429 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for main in -lnet""... $ac_c" 1>&6
-echo "configure:4405: checking for main in -lnet" >&5
+echo "configure:4464: checking for main in -lnet" >&5
ac_lib_var=`echo net'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4413 "configure"
+#line 4472 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for socket in -lnet""... $ac_c" 1>&6
-echo "configure:4448: checking for socket in -lnet" >&5
+echo "configure:4507: checking for socket in -lnet" >&5
ac_lib_var=`echo net'_'socket | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4456 "configure"
+#line 4515 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
socket()
; return 0; }
EOF
-if { (eval echo configure:4467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for main in -lnsl_s""... $ac_c" 1>&6
-echo "configure:4495: checking for main in -lnsl_s" >&5
+echo "configure:4554: checking for main in -lnsl_s" >&5
ac_lib_var=`echo nsl_s'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnsl_s $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4503 "configure"
+#line 4562 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:4538: checking for main in -lnsl" >&5
+echo "configure:4597: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4546 "configure"
+#line 4605 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for socket in -linet""... $ac_c" 1>&6
-echo "configure:4581: checking for socket in -linet" >&5
+echo "configure:4640: checking for socket in -linet" >&5
ac_lib_var=`echo inet'_'socket | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-linet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4589 "configure"
+#line 4648 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
socket()
; return 0; }
EOF
-if { (eval echo configure:4600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for main in -lgen""... $ac_c" 1>&6
-echo "configure:4628: checking for main in -lgen" >&5
+echo "configure:4687: checking for main in -lgen" >&5
ac_lib_var=`echo gen'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lgen $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4636 "configure"
+#line 4695 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for select""... $ac_c" 1>&6
-echo "configure:4675: checking for select" >&5
+echo "configure:4734: checking for select" >&5
if eval "test \"\${ac_cv_func_select+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4680 "configure"
+#line 4739 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char select(); below. */
; return 0; }
EOF
-if { (eval echo configure:4704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_select=yes"
else
echo $ac_n "checking types of arguments for select()""... $ac_c" 1>&6
-echo "configure:4726: checking types of arguments for select()" >&5
+echo "configure:4785: checking types of arguments for select()" >&5
if eval "test \"\${ac_cv_func_select_arg234+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
cat > conftest.$ac_ext <<EOF
-#line 4740 "configure"
+#line 4799 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
; return 0; }
EOF
-if { (eval echo configure:4759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_not_found=no ; break 3
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4803: checking for $ac_hdr" >&5
+echo "configure:4862: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4808 "configure"
+#line 4867 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
{ echo "configure: error: POSIX regex.h required." 1>&2; exit 1; }
fi
echo $ac_n "checking for regfree""... $ac_c" 1>&6
-echo "configure:4843: checking for regfree" >&5
+echo "configure:4902: checking for regfree" >&5
if eval "test \"\${ac_cv_func_regfree+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4848 "configure"
+#line 4907 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char regfree(); below. */
; return 0; }
EOF
-if { (eval echo configure:4872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_regfree=yes"
else
echo $ac_n "checking for compatible POSIX regex""... $ac_c" 1>&6
-echo "configure:4895: checking for compatible POSIX regex" >&5
+echo "configure:4954: checking for compatible POSIX regex" >&5
if eval "test \"\${ol_cv_c_posix_regex+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_c_posix_regex=cross
else
cat > conftest.$ac_ext <<EOF
-#line 4904 "configure"
+#line 4963 "configure"
#include "confdefs.h"
#include <sys/types.h>
return rc;
}
EOF
-if { (eval echo configure:4930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_c_posix_regex=yes
else
{ echo "configure: error: broken POSIX regex!" 1>&2; exit 1; }
fi
-
echo $ac_n "checking for sigset in -lV3""... $ac_c" 1>&6
-echo "configure:4952: checking for sigset in -lV3" >&5
+echo "configure:5010: checking for sigset in -lV3" >&5
ac_lib_var=`echo V3'_'sigset | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lV3 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4960 "configure"
+#line 5018 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sigset()
; return 0; }
EOF
-if { (eval echo configure:4971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for res_search""... $ac_c" 1>&6
-echo "configure:5000: checking for res_search" >&5
+echo "configure:5058: checking for res_search" >&5
if eval "test \"\${ac_cv_func_res_search+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5005 "configure"
+#line 5063 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char res_search(); below. */
; return 0; }
EOF
-if { (eval echo configure:5029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_res_search=yes"
else
if test $ac_cv_func_res_search = no ; then
echo $ac_n "checking for res_search in -lbind""... $ac_c" 1>&6
-echo "configure:5050: checking for res_search in -lbind" >&5
+echo "configure:5108: checking for res_search in -lbind" >&5
ac_lib_var=`echo bind'_'res_search | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lbind $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5058 "configure"
+#line 5116 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
res_search()
; return 0; }
EOF
-if { (eval echo configure:5069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $ac_cv_func_res_search = no ; then
echo $ac_n "checking for __res_search in -lbind""... $ac_c" 1>&6
-echo "configure:5101: checking for __res_search in -lbind" >&5
+echo "configure:5159: checking for __res_search in -lbind" >&5
ac_lib_var=`echo bind'_'__res_search | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lbind $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5109 "configure"
+#line 5167 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
__res_search()
; return 0; }
EOF
-if { (eval echo configure:5120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $ac_cv_func_res_search = no ; then
echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
-echo "configure:5152: checking for res_search in -lresolv" >&5
+echo "configure:5210: checking for res_search in -lresolv" >&5
ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5160 "configure"
+#line 5218 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
res_search()
; return 0; }
EOF
-if { (eval echo configure:5171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5219: checking for $ac_hdr" >&5
+echo "configure:5277: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5224 "configure"
+#line 5282 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5287: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5272: checking for $ac_hdr" >&5
+echo "configure:5330: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5277 "configure"
+#line 5335 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5340: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_kerberosIV_krb_h = yes ; then
echo $ac_n "checking for main in -lkrb4""... $ac_c" 1>&6
-echo "configure:5311: checking for main in -lkrb4" >&5
+echo "configure:5369: checking for main in -lkrb4" >&5
ac_lib_var=`echo krb4'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkrb4 -lkrb5 -ldes425 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5319 "configure"
+#line 5377 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:5326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
LIBS="$KRB_LIBS $LIBS"
echo $ac_n "checking for des_debug in Kerberos libraries""... $ac_c" 1>&6
-echo "configure:5357: checking for des_debug in Kerberos libraries" >&5
+echo "configure:5415: checking for des_debug in Kerberos libraries" >&5
if eval "test \"\${ol_cv_var_des_debug+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
save_LIBS="$LIBS"
LIBS="$KRB_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5365 "configure"
+#line 5423 "configure"
#include "confdefs.h"
#include <kerberosIV/krb.h>
; return 0; }
EOF
-if { (eval echo configure:5378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_var_des_debug=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5411: checking for $ac_hdr" >&5
+echo "configure:5469: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5416 "configure"
+#line 5474 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5421: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_krb_h = yes ; then
echo $ac_n "checking for main in -lkrb""... $ac_c" 1>&6
-echo "configure:5450: checking for main in -lkrb" >&5
+echo "configure:5508: checking for main in -lkrb" >&5
ac_lib_var=`echo krb'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkrb -ldes $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5458 "configure"
+#line 5516 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:5465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5510: checking for $ac_hdr" >&5
+echo "configure:5568: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5515 "configure"
+#line 5573 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5520: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_openssl_ssl_h = yes -o $ac_cv_header_ssl_h = yes ; then
echo $ac_n "checking for SSLeay_add_ssl_algorithms in -lssl""... $ac_c" 1>&6
-echo "configure:5549: checking for SSLeay_add_ssl_algorithms in -lssl" >&5
+echo "configure:5607: checking for SSLeay_add_ssl_algorithms in -lssl" >&5
ac_lib_var=`echo ssl'_'SSLeay_add_ssl_algorithms | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lssl -lcrypto $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5557 "configure"
+#line 5615 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
SSLeay_add_ssl_algorithms()
; return 0; }
EOF
-if { (eval echo configure:5568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $have_ssleay = no ; then
echo $ac_n "checking for SSL_library_init in -lssl""... $ac_c" 1>&6
-echo "configure:5593: checking for SSL_library_init in -lssl" >&5
+echo "configure:5651: checking for SSL_library_init in -lssl" >&5
ac_lib_var=`echo ssl'_'SSL_library_init | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lssl -lcrypto $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5601 "configure"
+#line 5659 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
SSL_library_init()
; return 0; }
EOF
-if { (eval echo configure:5612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $have_ssleay = no ; then
echo $ac_n "checking for ssl3_accept in -lssl""... $ac_c" 1>&6
-echo "configure:5638: checking for ssl3_accept in -lssl" >&5
+echo "configure:5696: checking for ssl3_accept in -lssl" >&5
ac_lib_var=`echo ssl'_'ssl3_accept | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lssl -lcrypto -lRSAglue -lrsaref $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5646 "configure"
+#line 5704 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
ssl3_accept()
; return 0; }
EOF
-if { (eval echo configure:5657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5717: checking for $ac_func" >&5
+echo "configure:5775: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5722 "configure"
+#line 5780 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:5746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
ol_cv_func_ctime_r_nargs=0
else
echo $ac_n "checking number of arguments of ctime_r""... $ac_c" 1>&6
-echo "configure:5775: checking number of arguments of ctime_r" >&5
+echo "configure:5833: checking number of arguments of ctime_r" >&5
if eval "test \"\${ol_cv_func_ctime_r_nargs+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5780 "configure"
+#line 5838 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
time_t ti; char *buffer; ctime_r(&ti,buffer,32);
; return 0; }
EOF
-if { (eval echo configure:5787: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_ctime_r_nargs=3
else
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 5795 "configure"
+#line 5853 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
time_t ti; char *buffer; ctime_r(&ti,buffer);
; return 0; }
EOF
-if { (eval echo configure:5802: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_ctime_r_nargs=2
else
if test "$ac_cv_func_gethostbyname_r" = yes ; then
echo $ac_n "checking number of arguments of gethostbyname_r""... $ac_c" 1>&6
-echo "configure:5828: checking number of arguments of gethostbyname_r" >&5
+echo "configure:5886: checking number of arguments of gethostbyname_r" >&5
if eval "test \"\${ol_cv_func_gethostbyname_r_nargs+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5833 "configure"
+#line 5891 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
buffer, bufsize, &h_errno);
; return 0; }
EOF
-if { (eval echo configure:5847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_gethostbyname_r_nargs=5
else
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 5855 "configure"
+#line 5913 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
&rhent, &h_errno);
; return 0; }
EOF
-if { (eval echo configure:5870: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_gethostbyname_r_nargs=6
else
if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
echo $ac_n "checking number of arguments of gethostbyaddr_r""... $ac_c" 1>&6
-echo "configure:5898: checking number of arguments of gethostbyaddr_r" >&5
+echo "configure:5956: checking number of arguments of gethostbyaddr_r" >&5
if eval "test \"\${ol_cv_func_gethostbyaddr_r_nargs+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5903 "configure"
+#line 5961 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
alen, AF_INET, &hent, buffer, bufsize, &h_errno);
; return 0; }
EOF
-if { (eval echo configure:5919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_gethostbyaddr_r_nargs=7
else
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 5927 "configure"
+#line 5985 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
&rhent, &h_errno);
; return 0; }
EOF
-if { (eval echo configure:5945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_gethostbyaddr_r_nargs=8
else
if test $ol_with_threads = auto -o $ol_with_threads = yes \
-o $ol_with_threads = posix ; then
- for ac_hdr in pthread.h sched.h
+ for ac_hdr in pthread.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5996: checking for $ac_hdr" >&5
+echo "configure:6054: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6001 "configure"
+#line 6059 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6006: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6064: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_pthread_h = yes ; then
echo $ac_n "checking POSIX thread version""... $ac_c" 1>&6
-echo "configure:6035: checking POSIX thread version" >&5
+echo "configure:6093: checking POSIX thread version" >&5
if eval "test \"\${ol_cv_pthread_version+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6041 "configure"
+#line 6099 "configure"
#include "confdefs.h"
# include <pthread.h>
cat > conftest.$ac_ext <<EOF
-#line 6063 "configure"
+#line 6121 "configure"
#include "confdefs.h"
# include <pthread.h>
echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:6116: checking for LinuxThreads pthread.h" >&5
+echo "configure:6174: checking for LinuxThreads pthread.h" >&5
if eval "test \"\${ol_cv_header_linux_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6121 "configure"
+#line 6179 "configure"
#include "confdefs.h"
#include <pthread.h>
EOF
fi
+
+ echo $ac_n "checking for GNU Pth pthread.h""... $ac_c" 1>&6
+echo "configure:6206: checking for GNU Pth pthread.h" >&5
+if eval "test \"\${ol_cv_header_gnu_pth_pthread_h+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 6211 "configure"
+#include "confdefs.h"
+#include <pthread.h>
+#ifdef _POSIX_THREAD_IS_GNU_PTH
+ __gnu_pth__
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "__gnu_pth__" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ol_cv_header_gnu_pth_pthread_h=yes
+else
+ rm -rf conftest*
+ ol_cv_header_gnu_pth_pthread_h=no
+fi
+rm -f conftest*
+
+
+fi
+
+echo "$ac_t""$ol_cv_header_gnu_pth_pthread_h" 1>&6
+
+
+ if test $ol_cv_header_gnu_pth_pthread_h = no ; then
+ for ac_hdr in sched.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:6240: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 6245 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:6250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ fi
echo $ac_n "checking for pthread_create in default libraries""... $ac_c" 1>&6
-echo "configure:6149: checking for pthread_create in default libraries" >&5
+echo "configure:6280: checking for pthread_create in default libraries" >&5
if eval "test \"\${ol_cv_pthread_create+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 6156 "configure"
+#line 6287 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:6200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_create=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 6212 "configure"
+#line 6343 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:6261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_create=yes
else
if test "$ol_link_threads" = no ; then
# try -kthread
echo $ac_n "checking for pthread link with -kthread""... $ac_c" 1>&6
-echo "configure:6286: checking for pthread link with -kthread" >&5
+echo "configure:6417: checking for pthread link with -kthread" >&5
if eval "test \"\${ol_cv_pthread_kthread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 6297 "configure"
+#line 6428 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:6341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_kthread=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 6353 "configure"
+#line 6484 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:6402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_kthread=yes
else
if test "$ol_link_threads" = no ; then
# try -pthread
echo $ac_n "checking for pthread link with -pthread""... $ac_c" 1>&6
-echo "configure:6432: checking for pthread link with -pthread" >&5
+echo "configure:6563: checking for pthread link with -pthread" >&5
if eval "test \"\${ol_cv_pthread_pthread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 6443 "configure"
+#line 6574 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:6487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_pthread=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 6499 "configure"
+#line 6630 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:6548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_pthread=yes
else
if test "$ol_link_threads" = no ; then
# try -pthreads
echo $ac_n "checking for pthread link with -pthreads""... $ac_c" 1>&6
-echo "configure:6578: checking for pthread link with -pthreads" >&5
+echo "configure:6709: checking for pthread link with -pthreads" >&5
if eval "test \"\${ol_cv_pthread_pthreads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 6589 "configure"
+#line 6720 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:6633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_pthreads=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 6645 "configure"
+#line 6776 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:6694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_pthreads=yes
else
if test "$ol_link_threads" = no ; then
# try -mthreads
echo $ac_n "checking for pthread link with -mthreads""... $ac_c" 1>&6
-echo "configure:6724: checking for pthread link with -mthreads" >&5
+echo "configure:6855: checking for pthread link with -mthreads" >&5
if eval "test \"\${ol_cv_pthread_mthreads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 6735 "configure"
+#line 6866 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:6779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_mthreads=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 6791 "configure"
+#line 6922 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:6840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_mthreads=yes
else
if test "$ol_link_threads" = no ; then
# try -thread
echo $ac_n "checking for pthread link with -thread""... $ac_c" 1>&6
-echo "configure:6870: checking for pthread link with -thread" >&5
+echo "configure:7001: checking for pthread link with -thread" >&5
if eval "test \"\${ol_cv_pthread_thread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 6881 "configure"
+#line 7012 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:6925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_thread=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 6937 "configure"
+#line 7068 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:6986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_thread=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthread -lmach -lexc -lc_r
echo $ac_n "checking for pthread link with -lpthread -lmach -lexc -lc_r""... $ac_c" 1>&6
-echo "configure:7017: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
+echo "configure:7148: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
if eval "test \"\${ol_cv_pthread_lpthread_lmach_lexc_lc_r+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 7028 "configure"
+#line 7159 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:7072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 7084 "configure"
+#line 7215 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:7133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthread -lmach -lexc
echo $ac_n "checking for pthread link with -lpthread -lmach -lexc""... $ac_c" 1>&6
-echo "configure:7163: checking for pthread link with -lpthread -lmach -lexc" >&5
+echo "configure:7294: checking for pthread link with -lpthread -lmach -lexc" >&5
if eval "test \"\${ol_cv_pthread_lpthread_lmach_lexc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 7174 "configure"
+#line 7305 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:7218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthread_lmach_lexc=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 7230 "configure"
+#line 7361 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:7279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_lpthread_lmach_lexc=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthread -Wl,-woff,85
echo $ac_n "checking for pthread link with -lpthread -Wl,-woff,85""... $ac_c" 1>&6
-echo "configure:7310: checking for pthread link with -lpthread -Wl,-woff,85" >&5
+echo "configure:7441: checking for pthread link with -lpthread -Wl,-woff,85" >&5
if eval "test \"\${ol_cv_pthread_lib_lpthread_woff+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 7321 "configure"
+#line 7452 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:7365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lib_lpthread_woff=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 7377 "configure"
+#line 7508 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:7426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_lib_lpthread_woff=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthread
echo $ac_n "checking for pthread link with -lpthread""... $ac_c" 1>&6
-echo "configure:7457: checking for pthread link with -lpthread" >&5
+echo "configure:7588: checking for pthread link with -lpthread" >&5
if eval "test \"\${ol_cv_pthread_lpthread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 7468 "configure"
+#line 7599 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:7512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthread=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 7524 "configure"
+#line 7655 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:7573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_lpthread=yes
else
if test "$ol_link_threads" = no ; then
# try -lc_r
echo $ac_n "checking for pthread link with -lc_r""... $ac_c" 1>&6
-echo "configure:7603: checking for pthread link with -lc_r" >&5
+echo "configure:7734: checking for pthread link with -lc_r" >&5
if eval "test \"\${ol_cv_pthread_lc_r+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 7614 "configure"
+#line 7745 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:7658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lc_r=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 7670 "configure"
+#line 7801 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:7719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_lc_r=yes
else
if test "$ol_link_threads" = no ; then
# try -threads
echo $ac_n "checking for pthread link with -threads""... $ac_c" 1>&6
-echo "configure:7750: checking for pthread link with -threads" >&5
+echo "configure:7881: checking for pthread link with -threads" >&5
if eval "test \"\${ol_cv_pthread_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 7761 "configure"
+#line 7892 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:7805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_threads=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 7817 "configure"
+#line 7948 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:7866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_threads=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthreads -lmach -lexc -lc_r
echo $ac_n "checking for pthread link with -lpthreads -lmach -lexc -lc_r""... $ac_c" 1>&6
-echo "configure:7897: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
+echo "configure:8028: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
if eval "test \"\${ol_cv_pthread_lpthreads_lmach_lexc_lc_r+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 7908 "configure"
+#line 8039 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:7952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 7964 "configure"
+#line 8095 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:8013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthreads -lmach -lexc
echo $ac_n "checking for pthread link with -lpthreads -lmach -lexc""... $ac_c" 1>&6
-echo "configure:8043: checking for pthread link with -lpthreads -lmach -lexc" >&5
+echo "configure:8174: checking for pthread link with -lpthreads -lmach -lexc" >&5
if eval "test \"\${ol_cv_pthread_lpthreads_lmach_lexc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 8054 "configure"
+#line 8185 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:8098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthreads_lmach_lexc=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 8110 "configure"
+#line 8241 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:8159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_lpthreads_lmach_lexc=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthreads -lexc
echo $ac_n "checking for pthread link with -lpthreads -lexc""... $ac_c" 1>&6
-echo "configure:8189: checking for pthread link with -lpthreads -lexc" >&5
+echo "configure:8320: checking for pthread link with -lpthreads -lexc" >&5
if eval "test \"\${ol_cv_pthread_lpthreads_lexc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 8200 "configure"
+#line 8331 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:8244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthreads_lexc=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 8256 "configure"
+#line 8387 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:8305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_lpthreads_lexc=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthreads
echo $ac_n "checking for pthread link with -lpthreads""... $ac_c" 1>&6
-echo "configure:8336: checking for pthread link with -lpthreads" >&5
+echo "configure:8467: checking for pthread link with -lpthreads" >&5
if eval "test \"\${ol_cv_pthread_lib_lpthreads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 8347 "configure"
+#line 8478 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:8391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lib_lpthreads=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 8403 "configure"
+#line 8534 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:8452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_lib_lpthreads=yes
else
for ac_func in sched_yield pthread_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8494: checking for $ac_func" >&5
+echo "configure:8625: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8499 "configure"
+#line 8630 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:8523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
if test $ac_cv_func_sched_yield = no -a \
$ac_cv_func_pthread_yield = no ; then
echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:8551: checking for sched_yield in -lrt" >&5
+echo "configure:8682: checking for sched_yield in -lrt" >&5
ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lrt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8559 "configure"
+#line 8690 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:8570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in thr_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8602: checking for $ac_func" >&5
+echo "configure:8733: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8607 "configure"
+#line 8738 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:8631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in pthread_kill
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8665: checking for $ac_func" >&5
+echo "configure:8796: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8670 "configure"
+#line 8801 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:8694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "checking for pthread_detach with <pthread.h>""... $ac_c" 1>&6
-echo "configure:8720: checking for pthread_detach with <pthread.h>" >&5
+echo "configure:8851: checking for pthread_detach with <pthread.h>" >&5
if eval "test \"\${ol_cv_func_pthread_detach+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8726 "configure"
+#line 8857 "configure"
#include "confdefs.h"
#include <pthread.h>
pthread_detach(NULL);
; return 0; }
EOF
-if { (eval echo configure:8738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_func_pthread_detach=yes
else
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8770: checking for $ac_func" >&5
+echo "configure:8901: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8775 "configure"
+#line 8906 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:8799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "checking for pthread_kill_other_threads_np""... $ac_c" 1>&6
-echo "configure:8826: checking for pthread_kill_other_threads_np" >&5
+echo "configure:8957: checking for pthread_kill_other_threads_np" >&5
if eval "test \"\${ac_cv_func_pthread_kill_other_threads_np+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8831 "configure"
+#line 8962 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char pthread_kill_other_threads_np(); below. */
; return 0; }
EOF
-if { (eval echo configure:8855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_pthread_kill_other_threads_np=yes"
else
fi
echo $ac_n "checking for LinuxThreads implementation""... $ac_c" 1>&6
-echo "configure:8875: checking for LinuxThreads implementation" >&5
+echo "configure:9006: checking for LinuxThreads implementation" >&5
if eval "test \"\${ol_cv_sys_linux_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for LinuxThreads consistency""... $ac_c" 1>&6
-echo "configure:8888: checking for LinuxThreads consistency" >&5
+echo "configure:9019: checking for LinuxThreads consistency" >&5
if eval "test \"\${ol_cv_linux_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking if pthread_create() works""... $ac_c" 1>&6
-echo "configure:8913: checking if pthread_create() works" >&5
+echo "configure:9044: checking if pthread_create() works" >&5
if eval "test \"\${ol_cv_pthread_create_works+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_pthread_create_works=yes
else
cat > conftest.$ac_ext <<EOF
-#line 8922 "configure"
+#line 9053 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:8971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_create_works=yes
else
if test $ol_with_yielding_select = auto ; then
echo $ac_n "checking if select yields when using pthreads""... $ac_c" 1>&6
-echo "configure:8993: checking if select yields when using pthreads" >&5
+echo "configure:9124: checking if select yields when using pthreads" >&5
if eval "test \"\${ol_cv_pthread_select_yields+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_pthread_select_yields=cross
else
cat > conftest.$ac_ext <<EOF
-#line 9002 "configure"
+#line 9133 "configure"
#include "confdefs.h"
#include <sys/types.h>
exit(2);
}
EOF
-if { (eval echo configure:9078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_pthread_select_yields=no
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9122: checking for $ac_hdr" >&5
+echo "configure:9253: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9127 "configure"
+#line 9258 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9132: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
ol_with_threads=found
echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
-echo "configure:9162: checking for cthread_fork" >&5
+echo "configure:9293: checking for cthread_fork" >&5
if eval "test \"\${ac_cv_func_cthread_fork+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9167 "configure"
+#line 9298 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char cthread_fork(); below. */
; return 0; }
EOF
-if { (eval echo configure:9191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_cthread_fork=yes"
else
if test $ol_link_threads = no ; then
echo $ac_n "checking for cthread_fork with -all_load""... $ac_c" 1>&6
-echo "configure:9213: checking for cthread_fork with -all_load" >&5
+echo "configure:9344: checking for cthread_fork with -all_load" >&5
if eval "test \"\${ol_cv_cthread_all_load+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
save_LIBS="$LIBS"
LIBS="-all_load $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9221 "configure"
+#line 9352 "configure"
#include "confdefs.h"
#include <mach/cthreads.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:9230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_cthread_all_load=yes
else
fi
fi
+if test $ol_with_threads = auto -o $ol_with_threads = yes \
+ -o $ol_with_threads = pth ; then
+
+ for ac_hdr in pth.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:9406: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 9411 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:9416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+ if test $ac_cv_header_pth_h = yes ; then
+ echo $ac_n "checking for pth_version in -lpth""... $ac_c" 1>&6
+echo "configure:9445: checking for pth_version in -lpth" >&5
+ac_lib_var=`echo pth'_'pth_version | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lpth $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9453 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pth_version();
+
+int main() {
+pth_version()
+; return 0; }
+EOF
+if { (eval echo configure:9464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ have_pth=yes
+else
+ echo "$ac_t""no" 1>&6
+have_pth=no
+fi
+
+
+ if test $have_pth = yes ; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_GNU_PTH 1
+EOF
+
+ LTHREAD_LIBS="$LTHREAD_LIBS -lpth"
+ ol_link_threads=pth
+
+ if test $ol_with_yielding_select = auto ; then
+ ol_with_yielding_select=yes
+ fi
+ fi
+ fi
+fi
+
if test $ol_with_threads = auto -o $ol_with_threads = yes \
-o $ol_with_threads = lwp ; then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9275: checking for $ac_hdr" >&5
+echo "configure:9508: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9280 "configure"
+#line 9513 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6
-echo "configure:9313: checking for thr_create in -lthread" >&5
+echo "configure:9546: checking for thr_create in -lthread" >&5
ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9321 "configure"
+#line 9554 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
thr_create()
; return 0; }
EOF
-if { (eval echo configure:9332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9372: checking for $ac_func" >&5
+echo "configure:9605: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9377 "configure"
+#line 9610 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:9401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9432: checking for $ac_hdr" >&5
+echo "configure:9665: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9437 "configure"
+#line 9670 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9442: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9675: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_lwp_lwp_h = yes ; then
echo $ac_n "checking for lwp_create in -llwp""... $ac_c" 1>&6
-echo "configure:9470: checking for lwp_create in -llwp" >&5
+echo "configure:9703: checking for lwp_create in -llwp" >&5
ac_lib_var=`echo lwp'_'lwp_create | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-llwp $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9478 "configure"
+#line 9711 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
lwp_create()
; return 0; }
EOF
-if { (eval echo configure:9489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9542: checking for $ac_hdr" >&5
+echo "configure:9775: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9547 "configure"
+#line 9780 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9552: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
for ac_func in sched_yield pthread_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9581: checking for $ac_func" >&5
+echo "configure:9814: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9586 "configure"
+#line 9819 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:9610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:9636: checking for LinuxThreads pthread.h" >&5
+echo "configure:9869: checking for LinuxThreads pthread.h" >&5
if eval "test \"\${ol_cv_header_linux_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9641 "configure"
+#line 9874 "configure"
#include "confdefs.h"
#include <pthread.h>
EOF
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9671: checking for $ac_hdr" >&5
+echo "configure:9904: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9676 "configure"
+#line 9909 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9681: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9711: checking for $ac_hdr" >&5
+echo "configure:9944: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9716 "configure"
+#line 9949 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9721: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9954: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9751: checking for $ac_hdr" >&5
+echo "configure:9984: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9756 "configure"
+#line 9989 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9761: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for thread specific errno""... $ac_c" 1>&6
-echo "configure:9820: checking for thread specific errno" >&5
+echo "configure:10053: checking for thread specific errno" >&5
if eval "test \"\${ol_cv_errno_thread_specific+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9826 "configure"
+#line 10059 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
errno = 0;
; return 0; }
EOF
-if { (eval echo configure:9833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_errno_thread_specific=yes
else
echo "$ac_t""$ol_cv_errno_thread_specific" 1>&6
echo $ac_n "checking for thread specific h_errno""... $ac_c" 1>&6
-echo "configure:9849: checking for thread specific h_errno" >&5
+echo "configure:10082: checking for thread specific h_errno" >&5
if eval "test \"\${ol_cv_h_errno_thread_specific+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9855 "configure"
+#line 10088 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
h_errno = 0;
; return 0; }
EOF
-if { (eval echo configure:9862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_h_errno_thread_specific=yes
else
ol_link_ldbm=no
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then
echo $ac_n "checking for DB2 library""... $ac_c" 1>&6
-echo "configure:9913: checking for DB2 library" >&5
+echo "configure:10146: checking for DB2 library" >&5
if eval "test \"\${ol_cv_lib_db2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_LIBS="$LIBS"
echo $ac_n "checking for db_open in -ldb""... $ac_c" 1>&6
-echo "configure:9919: checking for db_open in -ldb" >&5
+echo "configure:10152: checking for db_open in -ldb" >&5
ac_lib_var=`echo db'_'db_open | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldb $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9927 "configure"
+#line 10160 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
db_open()
; return 0; }
EOF
-if { (eval echo configure:9938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9969: checking for $ac_hdr" >&5
+echo "configure:10202: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9974 "configure"
+#line 10207 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9979: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_db_h = yes ; then
echo $ac_n "checking if db.h is DB2""... $ac_c" 1>&6
-echo "configure:10007: checking if db.h is DB2" >&5
+echo "configure:10240: checking if db.h is DB2" >&5
if eval "test \"\${ol_cv_header_db2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10013 "configure"
+#line 10246 "configure"
#include "confdefs.h"
# include <db.h>
echo $ac_n "checking for Berkeley DB2""... $ac_c" 1>&6
-echo "configure:10045: checking for Berkeley DB2" >&5
+echo "configure:10278: checking for Berkeley DB2" >&5
if eval "test \"\${ol_cv_berkeley_db2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then
echo $ac_n "checking for Berkeley DB library""... $ac_c" 1>&6
-echo "configure:10096: checking for Berkeley DB library" >&5
+echo "configure:10329: checking for Berkeley DB library" >&5
if eval "test \"\${ol_cv_lib_db+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10105: checking for $ac_hdr" >&5
+echo "configure:10338: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10110 "configure"
+#line 10343 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10115: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
ol_LIBS="$LIBS"
echo $ac_n "checking for dbopen""... $ac_c" 1>&6
-echo "configure:10143: checking for dbopen" >&5
+echo "configure:10376: checking for dbopen" >&5
if eval "test \"\${ac_cv_func_dbopen+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10148 "configure"
+#line 10381 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dbopen(); below. */
; return 0; }
EOF
-if { (eval echo configure:10172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dbopen=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbopen in -ldb1""... $ac_c" 1>&6
-echo "configure:10191: checking for dbopen in -ldb1" >&5
+echo "configure:10424: checking for dbopen in -ldb1" >&5
ac_lib_var=`echo db1'_'dbopen | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldb1 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10199 "configure"
+#line 10432 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dbopen()
; return 0; }
EOF
-if { (eval echo configure:10210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
-echo "configure:10230: checking for dbopen in -ldb" >&5
+echo "configure:10463: checking for dbopen in -ldb" >&5
ac_lib_var=`echo db'_'dbopen | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldb $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10238 "configure"
+#line 10471 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dbopen()
; return 0; }
EOF
-if { (eval echo configure:10249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10287: checking for $ac_hdr" >&5
+echo "configure:10520: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10292 "configure"
+#line 10525 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10530: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for Berkeley DB""... $ac_c" 1>&6
-echo "configure:10333: checking for Berkeley DB" >&5
+echo "configure:10566: checking for Berkeley DB" >&5
if eval "test \"\${ol_cv_berkeley_db+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10386: checking for $ac_hdr" >&5
+echo "configure:10619: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10391 "configure"
+#line 10624 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10396: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10629: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = mdbm ; then
echo $ac_n "checking for MDBM library""... $ac_c" 1>&6
-echo "configure:10431: checking for MDBM library" >&5
+echo "configure:10664: checking for MDBM library" >&5
if eval "test \"\${ol_cv_lib_mdbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_LIBS="$LIBS"
echo $ac_n "checking for mdbm_set_chain""... $ac_c" 1>&6
-echo "configure:10437: checking for mdbm_set_chain" >&5
+echo "configure:10670: checking for mdbm_set_chain" >&5
if eval "test \"\${ac_cv_func_mdbm_set_chain+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10442 "configure"
+#line 10675 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char mdbm_set_chain(); below. */
; return 0; }
EOF
-if { (eval echo configure:10466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_mdbm_set_chain=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for mdbm_set_chain in -lmdbm""... $ac_c" 1>&6
-echo "configure:10485: checking for mdbm_set_chain in -lmdbm" >&5
+echo "configure:10718: checking for mdbm_set_chain in -lmdbm" >&5
ac_lib_var=`echo mdbm'_'mdbm_set_chain | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lmdbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10493 "configure"
+#line 10726 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
mdbm_set_chain()
; return 0; }
EOF
-if { (eval echo configure:10504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10539: checking for $ac_hdr" >&5
+echo "configure:10772: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10544 "configure"
+#line 10777 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10549: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10782: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:10576: checking for db" >&5
+echo "configure:10809: checking for db" >&5
if eval "test \"\${ol_cv_mdbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
echo $ac_n "checking for GDBM library""... $ac_c" 1>&6
-echo "configure:10609: checking for GDBM library" >&5
+echo "configure:10842: checking for GDBM library" >&5
if eval "test \"\${ol_cv_lib_gdbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_LIBS="$LIBS"
echo $ac_n "checking for gdbm_open""... $ac_c" 1>&6
-echo "configure:10615: checking for gdbm_open" >&5
+echo "configure:10848: checking for gdbm_open" >&5
if eval "test \"\${ac_cv_func_gdbm_open+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10620 "configure"
+#line 10853 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gdbm_open(); below. */
; return 0; }
EOF
-if { (eval echo configure:10644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gdbm_open=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:10663: checking for gdbm_open in -lgdbm" >&5
+echo "configure:10896: checking for gdbm_open in -lgdbm" >&5
ac_lib_var=`echo gdbm'_'gdbm_open | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lgdbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10671 "configure"
+#line 10904 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
gdbm_open()
; return 0; }
EOF
-if { (eval echo configure:10682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10717: checking for $ac_hdr" >&5
+echo "configure:10950: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10722 "configure"
+#line 10955 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10727: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:10754: checking for db" >&5
+echo "configure:10987: checking for db" >&5
if eval "test \"\${ol_cv_gdbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo "configure: warning: skipping automatic checking for NDBM, must be manually enabled." 1>&2
elif test $ol_with_ldbm_api = ndbm ; then
echo $ac_n "checking for NDBM library""... $ac_c" 1>&6
-echo "configure:10790: checking for NDBM library" >&5
+echo "configure:11023: checking for NDBM library" >&5
if eval "test \"\${ol_cv_lib_ndbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_LIBS="$LIBS"
echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:10796: checking for dbm_open" >&5
+echo "configure:11029: checking for dbm_open" >&5
if eval "test \"\${ac_cv_func_dbm_open+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10801 "configure"
+#line 11034 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dbm_open(); below. */
; return 0; }
EOF
-if { (eval echo configure:10825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dbm_open=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6
-echo "configure:10844: checking for dbm_open in -lndbm" >&5
+echo "configure:11077: checking for dbm_open in -lndbm" >&5
ac_lib_var=`echo ndbm'_'dbm_open | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lndbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10852 "configure"
+#line 11085 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dbm_open()
; return 0; }
EOF
-if { (eval echo configure:10863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:10883: checking for dbm_open in -ldbm" >&5
+echo "configure:11116: checking for dbm_open in -ldbm" >&5
ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10891 "configure"
+#line 11124 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dbm_open()
; return 0; }
EOF
-if { (eval echo configure:10902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10939: checking for $ac_hdr" >&5
+echo "configure:11172: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10944 "configure"
+#line 11177 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10949: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:10976: checking for db" >&5
+echo "configure:11209: checking for db" >&5
if eval "test \"\${ol_cv_ndbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11023: checking for $ac_hdr" >&5
+echo "configure:11256: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11028 "configure"
+#line 11261 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11266: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
have_wrappers=no
else
echo $ac_n "checking for main in -lwrap""... $ac_c" 1>&6
-echo "configure:11064: checking for main in -lwrap" >&5
+echo "configure:11297: checking for main in -lwrap" >&5
ac_lib_var=`echo wrap'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lwrap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11072 "configure"
+#line 11305 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:11079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
SLAPD_LIBS="$SLAPD_LIBS -lwrap"
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:11110: checking for main in -lnsl" >&5
+echo "configure:11343: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11118 "configure"
+#line 11351 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:11125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $ol_enable_syslog != no ; then
echo $ac_n "checking for openlog""... $ac_c" 1>&6
-echo "configure:11165: checking for openlog" >&5
+echo "configure:11398: checking for openlog" >&5
if eval "test \"\${ac_cv_func_openlog+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11170 "configure"
+#line 11403 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char openlog(); below. */
; return 0; }
EOF
-if { (eval echo configure:11194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_openlog=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11224: checking for $ac_hdr" >&5
+echo "configure:11457: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11229 "configure"
+#line 11462 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11467: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for dmalloc_shutdown in -ldmalloc""... $ac_c" 1>&6
-echo "configure:11261: checking for dmalloc_shutdown in -ldmalloc" >&5
+echo "configure:11494: checking for dmalloc_shutdown in -ldmalloc" >&5
ac_lib_var=`echo dmalloc'_'dmalloc_shutdown | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldmalloc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11269 "configure"
+#line 11502 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dmalloc_shutdown()
; return 0; }
EOF
-if { (eval echo configure:11280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11314: checking for $ac_hdr" >&5
+echo "configure:11547: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11319 "configure"
+#line 11552 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11557: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
have_tcl=no
else
echo $ac_n "checking for main in -ltcl""... $ac_c" 1>&6
-echo "configure:11355: checking for main in -ltcl" >&5
+echo "configure:11588: checking for main in -ltcl" >&5
ac_lib_var=`echo tcl'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ltcl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11363 "configure"
+#line 11596 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:11370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $have_tcl != yes; then
echo $ac_n "checking for main in -ltcl7.6""... $ac_c" 1>&6
-echo "configure:11394: checking for main in -ltcl7.6" >&5
+echo "configure:11627: checking for main in -ltcl7.6" >&5
ac_lib_var=`echo tcl7.6'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ltcl7.6 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11402 "configure"
+#line 11635 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:11409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $have_tcl != yes; then
echo $ac_n "checking for main in -ltcl8.0""... $ac_c" 1>&6
-echo "configure:11434: checking for main in -ltcl8.0" >&5
+echo "configure:11667: checking for main in -ltcl8.0" >&5
ac_lib_var=`echo tcl8.0'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ltcl8.0 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11442 "configure"
+#line 11675 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:11449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11489: checking for $ac_hdr" >&5
+echo "configure:11722: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11494 "configure"
+#line 11727 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ol_link_termcap = no ; then
echo $ac_n "checking for tputs in -ltermcap""... $ac_c" 1>&6
-echo "configure:11528: checking for tputs in -ltermcap" >&5
+echo "configure:11761: checking for tputs in -ltermcap" >&5
ac_lib_var=`echo termcap'_'tputs | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ltermcap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11536 "configure"
+#line 11769 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
tputs()
; return 0; }
EOF
-if { (eval echo configure:11547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $ol_link_termcap = no ; then
echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:11580: checking for initscr in -lncurses" >&5
+echo "configure:11813: checking for initscr in -lncurses" >&5
ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lncurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11588 "configure"
+#line 11821 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
initscr()
; return 0; }
EOF
-if { (eval echo configure:11599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $ol_with_cyrus_sasl != no ; then
ac_safe=`echo "sasl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sasl.h""... $ac_c" 1>&6
-echo "configure:11642: checking for sasl.h" >&5
+echo "configure:11875: checking for sasl.h" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11647 "configure"
+#line 11880 "configure"
#include "confdefs.h"
#include <sasl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11885: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_sasl_h = yes ; then
echo $ac_n "checking for sasl_client_init in -lsasl""... $ac_c" 1>&6
-echo "configure:11676: checking for sasl_client_init in -lsasl" >&5
+echo "configure:11909: checking for sasl_client_init in -lsasl" >&5
ac_lib_var=`echo sasl'_'sasl_client_init | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lsasl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11684 "configure"
+#line 11917 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sasl_client_init()
; return 0; }
EOF
-if { (eval echo configure:11695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ol=$LIBS
LIBS="-lfetch -lcom_err $LIBS"
echo $ac_n "checking fetch(3) library""... $ac_c" 1>&6
-echo "configure:11737: checking fetch(3) library" >&5
+echo "configure:11970: checking fetch(3) library" >&5
if eval "test \"\${ol_cv_lib_fetch+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11743 "configure"
+#line 11976 "configure"
#include "confdefs.h"
#include <sys/param.h>
struct url *u = fetchParseURL("file:///");
; return 0; }
EOF
-if { (eval echo configure:11753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_lib_fetch=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11791: checking for $ac_hdr" >&5
+echo "configure:12024: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11796 "configure"
+#line 12029 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:12034: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
save_LIBS="$LIBS"
LIBS="$TERMCAP_LIBS $LIBS"
echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:11832: checking for readline in -lreadline" >&5
+echo "configure:12065: checking for readline in -lreadline" >&5
ac_lib_var=`echo readline'_'readline | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lreadline $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11840 "configure"
+#line 12073 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
readline()
; return 0; }
EOF
-if { (eval echo configure:11851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# FreeBSD (and others) have crypt(3) in -lcrypt
if test $ol_enable_crypt != no ; then
echo $ac_n "checking for crypt""... $ac_c" 1>&6
-echo "configure:11894: checking for crypt" >&5
+echo "configure:12127: checking for crypt" >&5
if eval "test \"\${ac_cv_func_crypt+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11899 "configure"
+#line 12132 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char crypt(); below. */
; return 0; }
EOF
-if { (eval echo configure:11923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_crypt=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:11942: checking for crypt in -lcrypt" >&5
+echo "configure:12175: checking for crypt in -lcrypt" >&5
ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lcrypt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11950 "configure"
+#line 12183 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
crypt()
; return 0; }
EOF
-if { (eval echo configure:11961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# FreeBSD (and others) have setproctitle(3) in -lutil
if test $ol_enable_proctitle != no ; then
echo $ac_n "checking for setproctitle""... $ac_c" 1>&6
-echo "configure:12005: checking for setproctitle" >&5
+echo "configure:12238: checking for setproctitle" >&5
if eval "test \"\${ac_cv_func_setproctitle+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12010 "configure"
+#line 12243 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char setproctitle(); below. */
; return 0; }
EOF
-if { (eval echo configure:12034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_setproctitle=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for setproctitle in -lutil""... $ac_c" 1>&6
-echo "configure:12053: checking for setproctitle in -lutil" >&5
+echo "configure:12286: checking for setproctitle in -lutil" >&5
ac_lib_var=`echo util'_'setproctitle | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lutil $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 12061 "configure"
+#line 12294 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
setproctitle()
; return 0; }
EOF
-if { (eval echo configure:12072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:12107: checking for uid_t in sys/types.h" >&5
+echo "configure:12340: checking for uid_t in sys/types.h" >&5
if eval "test \"\${ac_cv_type_uid_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12112 "configure"
+#line 12345 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
fi
echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:12141: checking type of array argument to getgroups" >&5
+echo "configure:12374: checking type of array argument to getgroups" >&5
if eval "test \"\${ac_cv_type_getgroups+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_type_getgroups=cross
else
cat > conftest.$ac_ext <<EOF
-#line 12149 "configure"
+#line 12382 "configure"
#include "confdefs.h"
/* Thanks to Mike Rendell for this test. */
}
EOF
-if { (eval echo configure:12174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_type_getgroups=gid_t
else
if test $ac_cv_type_getgroups = cross; then
cat > conftest.$ac_ext <<EOF
-#line 12188 "configure"
+#line 12421 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
EOF
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:12211: checking for ANSI C header files" >&5
+echo "configure:12444: checking for ANSI C header files" >&5
if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12216 "configure"
+#line 12449 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:12224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:12457: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 12241 "configure"
+#line 12474 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 12259 "configure"
+#line 12492 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 12280 "configure"
+#line 12513 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
exit (0); }
EOF
-if { (eval echo configure:12291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
fi
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:12315: checking for mode_t" >&5
+echo "configure:12548: checking for mode_t" >&5
if eval "test \"\${ac_cv_type_mode_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12320 "configure"
+#line 12553 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:12350: checking for off_t" >&5
+echo "configure:12583: checking for off_t" >&5
if eval "test \"\${ac_cv_type_off_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12355 "configure"
+#line 12588 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:12385: checking for pid_t" >&5
+echo "configure:12618: checking for pid_t" >&5
if eval "test \"\${ac_cv_type_pid_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12390 "configure"
+#line 12623 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:12420: checking for ptrdiff_t" >&5
+echo "configure:12653: checking for ptrdiff_t" >&5
if eval "test \"\${am_cv_type_ptrdiff_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12425 "configure"
+#line 12658 "configure"
#include "confdefs.h"
#include <stddef.h>
int main() {
ptrdiff_t p
; return 0; }
EOF
-if { (eval echo configure:12432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_type_ptrdiff_t=yes
else
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:12453: checking return type of signal handlers" >&5
+echo "configure:12686: checking return type of signal handlers" >&5
if eval "test \"\${ac_cv_type_signal+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12458 "configure"
+#line 12691 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
int i;
; return 0; }
EOF
-if { (eval echo configure:12475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12708: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
echo $ac_n "checking for sig_atomic_t""... $ac_c" 1>&6
-echo "configure:12494: checking for sig_atomic_t" >&5
+echo "configure:12727: checking for sig_atomic_t" >&5
if eval "test \"\${ol_cv_type_sig_atomic_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12499 "configure"
+#line 12732 "configure"
#include "confdefs.h"
#include <signal.h>
int main() {
sig_atomic_t atomic;
; return 0; }
EOF
-if { (eval echo configure:12506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_type_sig_atomic_t=yes
else
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:12527: checking for size_t" >&5
+echo "configure:12760: checking for size_t" >&5
if eval "test \"\${ac_cv_type_size_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12532 "configure"
+#line 12765 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
-echo "configure:12562: checking for socklen_t" >&5
+echo "configure:12795: checking for socklen_t" >&5
if eval "test \"\${ol_cv_type_socklen_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12567 "configure"
+#line 12800 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
socklen_t len;
; return 0; }
EOF
-if { (eval echo configure:12581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_type_socklen_t=yes
else
fi
echo $ac_n "checking for member st_blksize in aggregate type struct stat""... $ac_c" 1>&6
-echo "configure:12602: checking for member st_blksize in aggregate type struct stat" >&5
+echo "configure:12835: checking for member st_blksize in aggregate type struct stat" >&5
if eval "test \"\${ac_cv_c_struct_member_st_blksize+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12607 "configure"
+#line 12840 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
struct stat foo; foo.st_blksize;
; return 0; }
EOF
-if { (eval echo configure:12615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_struct_member_st_blksize=yes
else
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:12637: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:12870: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"\${ac_cv_header_time+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12642 "configure"
+#line 12875 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:12651: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:12672: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:12905: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"\${ac_cv_struct_tm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12677 "configure"
+#line 12910 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:12685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
# test for pw_gecos in struct passwd
echo $ac_n "checking struct passwd for pw_gecos""... $ac_c" 1>&6
-echo "configure:12707: checking struct passwd for pw_gecos" >&5
+echo "configure:12940: checking struct passwd for pw_gecos" >&5
if eval "test \"\${ol_cv_struct_passwd_pw_gecos+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12713 "configure"
+#line 12946 "configure"
#include "confdefs.h"
#include <pwd.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:12723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_struct_passwd_pw_gecos=yes
else
# test for pw_passwd in struct passwd
echo $ac_n "checking struct passwd for pw_passwd""... $ac_c" 1>&6
-echo "configure:12745: checking struct passwd for pw_passwd" >&5
+echo "configure:12978: checking struct passwd for pw_passwd" >&5
if eval "test \"\${ol_cv_struct_passwd_pw_passwd+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12751 "configure"
+#line 12984 "configure"
#include "confdefs.h"
#include <pwd.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:12761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_struct_passwd_pw_passwd=yes
else
echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6
-echo "configure:12783: checking if toupper() requires islower()" >&5
+echo "configure:13016: checking if toupper() requires islower()" >&5
if eval "test \"\${ol_cv_c_upper_lower+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_c_upper_lower=safe
else
cat > conftest.$ac_ext <<EOF
-#line 12792 "configure"
+#line 13025 "configure"
#include "confdefs.h"
#include <ctype.h>
exit(1);
}
EOF
-if { (eval echo configure:12804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ol_cv_c_upper_lower=no
else
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:12827: checking for working const" >&5
+echo "configure:13060: checking for working const" >&5
if eval "test \"\${ac_cv_c_const+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12832 "configure"
+#line 13065 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:12881: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:13114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
fi
echo $ac_n "checking if compiler understands volatile""... $ac_c" 1>&6
-echo "configure:12902: checking if compiler understands volatile" >&5
+echo "configure:13135: checking if compiler understands volatile" >&5
if eval "test \"\${ol_cv_c_volatile+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12907 "configure"
+#line 13140 "configure"
#include "confdefs.h"
int x, y, z;
int main() {
*b = 0;
; return 0; }
EOF
-if { (eval echo configure:12916: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:13149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_c_volatile=yes
else
else
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:12960: checking whether byte ordering is bigendian" >&5
+echo "configure:13193: checking whether byte ordering is bigendian" >&5
if eval "test \"\${ac_cv_c_bigendian+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 12967 "configure"
+#line 13200 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
#endif
; return 0; }
EOF
-if { (eval echo configure:12978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:13211: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 12982 "configure"
+#line 13215 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
#endif
; return 0; }
EOF
-if { (eval echo configure:12993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:13226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 13013 "configure"
+#line 13246 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:13026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
fi
echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:13050: checking size of short" >&5
+echo "configure:13283: checking size of short" >&5
if eval "test \"\${ac_cv_sizeof_short+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 13058 "configure"
+#line 13291 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:13069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_short=`cat conftestval`
else
echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:13089: checking size of int" >&5
+echo "configure:13322: checking size of int" >&5
if eval "test \"\${ac_cv_sizeof_int+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 13097 "configure"
+#line 13330 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:13108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int=`cat conftestval`
else
echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:13128: checking size of long" >&5
+echo "configure:13361: checking size of long" >&5
if eval "test \"\${ac_cv_sizeof_long+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 13136 "configure"
+#line 13369 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:13147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long=`cat conftestval`
else
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:13204: checking for 8-bit clean memcmp" >&5
+echo "configure:13437: checking for 8-bit clean memcmp" >&5
if eval "test \"\${ac_cv_func_memcmp_clean+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
-#line 13212 "configure"
+#line 13445 "configure"
#include "confdefs.h"
main()
}
EOF
-if { (eval echo configure:13222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_memcmp_clean=yes
else
test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
echo $ac_n "checking for strftime""... $ac_c" 1>&6
-echo "configure:13240: checking for strftime" >&5
+echo "configure:13473: checking for strftime" >&5
if eval "test \"\${ac_cv_func_strftime+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13245 "configure"
+#line 13478 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char strftime(); below. */
; return 0; }
EOF
-if { (eval echo configure:13269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_strftime=yes"
else
echo "$ac_t""no" 1>&6
# strftime is in -lintl on SCO UNIX.
echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6
-echo "configure:13291: checking for strftime in -lintl" >&5
+echo "configure:13524: checking for strftime in -lintl" >&5
ac_lib_var=`echo intl'_'strftime | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13299 "configure"
+#line 13532 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
strftime()
; return 0; }
EOF
-if { (eval echo configure:13310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for inet_aton()""... $ac_c" 1>&6
-echo "configure:13338: checking for inet_aton()" >&5
+echo "configure:13571: checking for inet_aton()" >&5
if eval "test \"\${ol_cv_func_inet_aton+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13343 "configure"
+#line 13576 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
int rc = inet_aton( "255.255.255.255", &in );
; return 0; }
EOF
-if { (eval echo configure:13365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_func_inet_aton=yes
else
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:13387: checking for vprintf" >&5
+echo "configure:13620: checking for vprintf" >&5
if eval "test \"\${ac_cv_func_vprintf+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13392 "configure"
+#line 13625 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:13416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:13440: checking for _doprnt" >&5
+echo "configure:13673: checking for _doprnt" >&5
if eval "test \"\${ac_cv_func__doprnt+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13445 "configure"
+#line 13678 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
; return 0; }
EOF
-if { (eval echo configure:13469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
for ac_func in vsnprintf vsprintf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:13498: checking for $ac_func" >&5
+echo "configure:13731: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13503 "configure"
+#line 13736 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:13527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
memcpy \
memmove \
mkstemp \
+ pipe \
read \
recv \
recvfrom \
setsid \
setuid \
seteuid \
+ sigaction \
signal \
sigset \
snprintf \
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:13602: checking for $ac_func" >&5
+echo "configure:13837: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13607 "configure"
+#line 13842 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:13631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in getopt tempnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:13659: checking for $ac_func" >&5
+echo "configure:13894: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13664 "configure"
+#line 13899 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:13688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
# Check Configuration
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:13717: checking declaration of sys_errlist" >&5
+echo "configure:13952: checking declaration of sys_errlist" >&5
if eval "test \"\${ol_cv_dcl_sys_errlist+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13723 "configure"
+#line 13958 "configure"
#include "confdefs.h"
#include <stdio.h>
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:13733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:13968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_sys_errlist=yes
ol_cv_have_sys_errlist=yes
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:13756: checking existence of sys_errlist" >&5
+echo "configure:13991: checking existence of sys_errlist" >&5
if eval "test \"\${ol_cv_have_sys_errlist+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13762 "configure"
+#line 13997 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:13769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_have_sys_errlist=yes
else
#define SLAPD_RLOOKUPS 1
EOF
+fi
+if test "$ol_enable_aci" != no ; then
+ cat >> confdefs.h <<\EOF
+#define SLAPD_ACI_ENABLED 1
+EOF
+
+fi
+if test "$ol_enable_discreteaci" != no ; then
+ cat >> confdefs.h <<\EOF
+#define SLAPD_ACI_DISCRETE_RIGHTS 1
+EOF
+
fi
if test "$ol_link_modules" != no ; then
+dnl $OpenLDAP$
dnl
dnl Copyright 1998,1999 The OpenLDAP Foundation. All Rights Reserved.
dnl
dnl license is available at http://www.OpenLDAP.org/license.html or
dnl in file LICENSE in the top-level directory of the distribution.
dnl
+define([AC_INIT_BINSH],
+[[#! /bin/sh
+# $]OpenLDAP[$
+# from] translit([$OpenLDAP$], $")] [
+
+# Copyright 1998,1999 The OpenLDAP Foundation. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms are permitted only
+# as authorized by the OpenLDAP Public License. A copy of this
+# license is available at http://www.OpenLDAP.org/license.html or
+# in file LICENSE in the top-level directory of the distribution.
+])dnl
dnl Disable config.cache!
define([AC_CACHE_LOAD], )dnl
OL_ARG_ENABLE(syslog,[ --enable-syslog enable syslog support], auto)dnl
OL_ARG_ENABLE(proctitle,[ --enable-proctitle enable proctitle support], yes)dnl
OL_ARG_ENABLE(cache,[ --enable-cache enable caching], yes)dnl
-OL_ARG_ENABLE(dns,[ --enable-dns enable V2 DNS extension], no)dnl
+OL_ARG_ENABLE(dns,[ --enable-dns enable V2 DX Referrals extension], no)dnl
OL_ARG_ENABLE(referrals,[ --enable-referrals enable V2 Referrals extension], yes)dnl
OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling],
dnl General "with" options
OL_ARG_ENABLE(dmalloc,[ --enable-dmalloc enable debug malloc support], no)dnl
-OL_ARG_WITH(cyrus_sasl,[ --with-cyrus-sasl with Cyrus SASL support],
+OL_ARG_WITH(cyrus_sasl,[ --with-cyrus-sasl with Cyrus SASL support],
auto, [auto yes no] )
-OL_ARG_WITH(fetch,[ --with-fetch with fetch URL support],
+OL_ARG_WITH(fetch,[ --with-fetch with fetch URL support],
auto, [auto yes no] )
OL_ARG_WITH(kerberos,[ --with-kerberos with Kerberos support],
auto, [auto k5 k4 afs yes no])
-OL_ARG_WITH(readline,[ --with-readline with readline support],
+OL_ARG_WITH(readline,[ --with-readline with readline support],
auto, [auto yes no] )
OL_ARG_WITH(threads,[ --with-threads use threads],
- auto, [auto posix mach lwp yes no manual] )
-OL_ARG_WITH(tls,[ --with-tls with TLS/SSL support],
+ auto, [auto posix mach pth lwp yes no manual] )
+OL_ARG_WITH(tls,[ --with-tls with TLS/SSL support],
auto, [auto ssleay openssl yes no] )
OL_ARG_WITH(yielding_select,[ --with-yielding-select with implicitly yielding select],
auto, [auto yes no manual] )
dnl Server options
dnl SLAPD OPTIONS
-AC_ARG_WITH(xxslapdoptions,[SLAPD Options:])
+AC_ARG_WITH(xxslapdoptions,[SLAPD (Standalone LDAP Daemon) Options:])
OL_ARG_ENABLE(slapd,[ --enable-slapd enable building slapd], yes)dnl
OL_ARG_ENABLE(cleartext,[ --enable-cleartext enable cleartext passwords], yes)dnl
OL_ARG_ENABLE(crypt,[ --enable-crypt enable crypt(3) passwords], auto)dnl
OL_ARG_ENABLE(phonetic,[ --enable-phonetic enable phonetic/soundex], no)dnl
OL_ARG_ENABLE(quipu,[ --enable-quipu build quipu migration tools], no)dnl
OL_ARG_ENABLE(rlookups,[ --enable-rlookups enable reverse lookups], auto)dnl
+OL_ARG_ENABLE(aci,[ --enable-aci enable per-object ACIs], no)dnl
+OL_ARG_ENABLE(discreteaci,[ --enable-discreteaci enable discrete rights in ACIs], no)dnl
OL_ARG_ENABLE(wrappers,[ --enable-wrappers enable tcp wrapper support], no)dnl
dnl SLAPD Backend options
OL_ARG_WITH(ldap_module,[ --with-ldap-module module type], static,
[static dynamic])
OL_ARG_ENABLE(ldbm,[ --enable-ldbm enable ldbm backend], yes)dnl
-OL_ARG_WITH(ldbm_module,[ --with-ldbm-module module type], static,
- [static dynamic])
OL_ARG_WITH(ldbm_api,[ --with-ldbm-api use LDBM API], auto,
[auto db2 db mdbm gdbm ndbm manual])
+OL_ARG_WITH(ldbm_module,[ --with-ldbm-module module type], static,
+ [static dynamic])
OL_ARG_WITH(ldbm_type,[ --with-ldbm-type use LDBM type], auto,
[auto btree hash])
[static dynamic])
dnl SLURPD OPTIONS
-AC_ARG_WITH(xxslurpdoptions,[SLURPD Options:])
+AC_ARG_WITH(xxslurpdoptions,[SLURPD (Replication Daemon) Options:])
OL_ARG_ENABLE(slurpd,[ --enable-slurpd enable building slurpd], auto)dnl
AC_ARG_WITH(xxliboptions,[Library Generation & Linking Options])
if test $ol_enable_rlookups = yes ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-rlookups argument])
fi
+ if test $ol_enable_aci = yes ; then
+ AC_MSG_WARN([slapd disabled, ignoring --enable-aci argument])
+ fi
+ if test $ol_enable_discreteaci = yes ; then
+ AC_MSG_WARN([slapd disabled, ignoring --enable-discreteaci argument])
+ fi
if test $ol_with_ldbm_api != auto ; then
AC_MSG_WARN([slapd disabled, ignoring --with-ldbm-api argument])
fi
ol_enable_phonetic=no
ol_enable_quipu=no
ol_enable_rlookups=no
+ ol_enable_aci=no
+ ol_enable_discreteaci=no
ol_enable_wrappers=no
ol_with_ldbm_api=no
AC_DEFINE(HAVE_MKVERSION, 1, [define this if you have mkversion])
-
dnl
dnl Determine which C translator to use
dnl
resolv.h \
sgtty.h \
shadow.h \
- stdarg.h \
stddef.h \
string.h \
strings.h \
dnl -linet
AC_CHECK_FUNC(socket, :, [
-dnl
dnl hopefully we won't include too many libraries
-dnl
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(net, main)
AC_CHECK_LIB(net, socket)
AC_CHECK_LIB(gen, main)
])
+dnl require select
AC_CHECK_FUNC(select, :, AC_MSG_ERROR([select() required.]))
+dnl AC_CHECK_FUNCS(socketpair)
dnl Select arg types
dnl (if this detection becomes permenent, it and the select() detection
dnl should be done before the yielding select test)
AC_FUNC_SELECT_ARGTYPES
+dnl check to see if system call automatically restart
+dnl AC_SYS_RESTARTABLE_SYSCALLS
+dnl require POSIX regex
AC_CHECK_HEADERS( regex.h )
if test "$ac_cv_header_regex_h" != yes ; then
AC_MSG_ERROR([POSIX regex.h required.])
AC_MSG_ERROR([broken POSIX regex!])
fi
-
dnl HP-UX requires -lV3
AC_CHECK_LIB(V3, sigset)
if test $ol_with_threads = auto -o $ol_with_threads = yes \
-o $ol_with_threads = posix ; then
- AC_CHECK_HEADERS(pthread.h sched.h)
+ AC_CHECK_HEADERS(pthread.h)
if test $ac_cv_header_pthread_h = yes ; then
OL_POSIX_THREAD_VERSION
ol_with_threads=found
OL_HEADER_LINUX_THREADS
+ OL_HEADER_GNU_PTH_PTHREAD_H
+
+ if test $ol_cv_header_gnu_pth_pthread_h = no ; then
+ AC_CHECK_HEADERS(sched.h)
+ fi
dnl Now the hard part, how to link?
dnl
fi
fi
+if test $ol_with_threads = auto -o $ol_with_threads = yes \
+ -o $ol_with_threads = pth ; then
+
+ AC_CHECK_HEADERS(pth.h)
+
+ if test $ac_cv_header_pth_h = yes ; then
+ AC_CHECK_LIB(pth, pth_version, [have_pth=yes], [have_pth=no])
+
+ if test $have_pth = yes ; then
+ AC_DEFINE(HAVE_GNU_PTH,1,[if you have GNU Pth])
+ LTHREAD_LIBS="$LTHREAD_LIBS -lpth"
+ ol_link_threads=pth
+
+ if test $ol_with_yielding_select = auto ; then
+ ol_with_yielding_select=yes
+ fi
+ fi
+ fi
+fi
+
if test $ol_with_threads = auto -o $ol_with_threads = yes \
-o $ol_with_threads = lwp ; then
memcpy \
memmove \
mkstemp \
+ pipe \
read \
recv \
recvfrom \
setsid \
setuid \
seteuid \
+ sigaction \
signal \
sigset \
snprintf \
if test "$ol_enable_rlookups" != no ; then
AC_DEFINE(SLAPD_RLOOKUPS,1,[define to support reverse lookups])
fi
+if test "$ol_enable_aci" != no ; then
+ AC_DEFINE(SLAPD_ACI_ENABLED,1,[define to support per-object ACIs])
+fi
+if test "$ol_enable_discreteaci" != no ; then
+ AC_DEFINE(SLAPD_ACI_DISCRETE_RIGHTS,1,[define to support discrete rights in ACIs])
+fi
if test "$ol_link_modules" != no ; then
AC_DEFINE(SLAPD_MODULES,1,[define to support modules])
--- /dev/null
+# $OpenLDAP$
+## Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+##
+## doc Makefile.in for OpenLDAP
+
+SUBDIRS= man
--- /dev/null
+.TH LDAP.CONF 5 "29 November 1998" "OpenLDAP LDVERSION"
+.UC 6
+.SH NAME
+ldap.conf \- ldap configuration file
+.SH SYNOPSIS
+ETCDIR/ldap.conf
+.SH DESCRIPTION
+The
+.I ldap.conf
+configuration file is used to set system-wide defaults to be applied when
+running
+.I ldap
+clients. If the environment variable \fBLDAPNOINIT\fP is defined, all
+defaulting is disabled.
+.LP
+Each user may specify an optional configuration file,
+.IR .ldaprc ,
+in his/her home directory which will be used to override the system-wide
+defaults file.
+.LP
+Additional configuration files can be specified using
+the \fBLDAPCONF\fP and \fBLDAPRC\fP environment variables.
+\fBLDAPCONF\fP may be set the path of a configuration file. This
+path can be absolute or relative to current working directory.
+The \fBLDAPRC\fP, if defined, should be a basename of a file
+in the current working directory or in the user's home directory.
+.LP
+Environmental variables may also be used to augment the file based defaults.
+The name of the option is the as listed but with a prefix of \fBLDAP\fP.
+For example, to define \fBBASE\fP via the environment, define the variable
+\fBLDAPBASE\fP to desired value.
+.SH OPTIONS
+The different configuration options are:
+.TP 1i
+\fBBASE <base>\fP
+Used to specify the default base dn to use when performing ldap operations.
+The base must be specified as a Distinguished Name in LDAP format.
+.TP 1i
+\fBHOST <name[:port] ...>\fP
+Used to specify the name(s) of an LDAP server(s) to which
+.I ldap
+library should connect to. Each server's name can be specified as a
+domain-style name or an IP address and optionally followed a ':' and
+the port number the ldap server is listening on. A space separated
+listed of host may be provided.
+.TP 1i
+\fBPORT <port>\fP
+Used to specify the port used with connecting to LDAP servers(s).
+The port may be specified as a number.
+.TP 1i
+\fBSIZELIMIT <integer>\fP
+Used to specify a size limit to use when performing searches. The
+number should be an non-negative integer. \fISIZELIMIT\fP of zero (0)
+specifies unlimited search size.
+.TP 1i
+\fBTIMELIMIT <integer>\fP
+Used to specify a time limit to use when performing searches. The
+number should be an non-negative integer. \fITIMELIMIT\fP of zero (0)
+specifies unlimited search time to be used.
+.TP 1i
+\fBDEREF <never|searching|finding|always>\fP
+Specify how aliases dereferencing is done. \fIDEREF\fP should
+be set to one of
+.B never,
+.B always,
+.B search,
+or
+.B find
+to specify that aliases are never dereferenced, always dereferenced,
+dereferenced when searching, or dereferenced only when locating the
+base object for the search. The default is to never dereference aliases.
+.SH FILES
+.I ETCDIR/ldap.conf
+.LP
+.I $HOME/.ldaprc
+.LP
+.I $CWD/.ldaprc
+.SH "SEE ALSO"
+ldap(3)
+.SH AUTHOR
+Kurt Zeilenga, The OpenLDAP Project
+.SH ACKNOWLEDGEMENTS
+.B OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.
-.TH SLAPD 8C "6 November 1995" "U-M LDAP LDVERSION"
+.TH SLAPD 8C "3 April 1999" "OpenLDAP LDVERSION"
.SH NAME
slapd \- Stand-alone LDAP Daemon
.SH SYNOPSIS
-.B ETCDIR/slapd [\-d debug\-level]
-.B [\-f slapd\-config\-file] [\-p port\-number]
-.B [\-s syslog\-level] [\-i]
+.B LIBEXECDIR/slapd
+.B [\-f slapd\-config\-file]
+.B [\-h URLs]
+.B [\-d debug\-level]
+.B [\-p port\-number]
+.B [\-P tls\-port\-number]
+.B [\-s syslog\-level] [\-l syslog\-local\-user]
+.B [\-u user] [\-g group]
.B
.SH DESCRIPTION
.LP
.B Slapd
is the stand-alone LDAP daemon. It listens for LDAP connections on
-port 389, responding
+any number of ports (default 389), responding
to the LDAP operations it receives over these connections.
.B slapd
is typically invoked at boot time, usually out of
Upon startup,
.B slapd
normally forks and disassociates itself from the invoking tty.
+If configured in
+.BR ETCDIR/slapd.conf ,
+the
+.B slapd
+process will print its process ID ( see
+.BR getpid (2)
+) to a
+.B .pid
+file, as well as the command line options during invocation to an
+.B .args
+file ( see
+.BR slapd.conf (5)
+).
If the
.B \-d
-flag is given and debugging is set to some non-zero
-value,
+flag is given, even with a zero argument,
.B slapd
will not fork and disassociate from the invoking tty.
.LP
.BI \-d " debug\-level"
Turn on debugging as defined by
.I debug\-level.
-If this option is specified,
+If this option is specified, even with a zero argument,
.B slapd
will not fork or disassociate from the invoking terminal. Some general
operation and status messages are printed for any value of \fIdebug\-level\fP.
.BR syslog (8)
facility.
.TP
+.BI \-l " syslog\-local\-user"
+Selects the local user of the
+.BR syslog (8)
+facility. Values can be
+.BR LOCAL0 ,
+.BR LOCAL1 ,
+and so on, up to
+.BR LOCAL7 .
+The default is
+.BR LOCAL4 .
+However, this option is only permitted on systems that support
+local users with the
+.BR syslog (8)
+facility.
+.TP
.BI \-f " slapd\-config\-file"
Specifies the slapd configuration file. The default is
.BR ETCDIR/slapd.conf .
.TP
+.BI \-h " URLlist"
+.B slapd
+will serve
+.B ldap:///
+(LDAP over TCP on all interfaces on default LDAP port). As such,
+it will bind to INADDR_ANY, port 389.
+The
+.B \-h
+option may be used to specify LDAP (and LDAPS) URLs to serve.
+For example, if slapd is given
+.B \-h " ldap://127.0.0.1:9009/ ldaps:///",
+It will bind 127.0.0.1:9009 for LDAP and INADDR_ANY:636 for LDAP over TLS.
+A space separated list of URLs is expected. The URLS should be of
+LDAP (ldap://) or, if supported, LDAP over TLS (ldaps://) type without
+a DN or other optional parameters. Hosts may be specified in either
+Internet '.' format (preferred) or by name. Ports, if specfied,
+must be numeric.
+.TP
.BI \-p " port\-number"
.B slapd
-will listen on the default LDAP port (389) unless this option is given
-to override the default.
+will use on the default port (389) for LDAP URLs unless this
+option is given to override the default.
+A numeric port number is expected.
.TP
-.B \-i
-This option tells
+.BI \-P " tls\-port\-number"
.B slapd
-that it is being run from
-.BR inetd(8) ,
-the Internet protocol daemon.
+will use on the default port (636) for LDAPS (LDAP over TLS) URLs
+unless this option is given to override the default. A numeric port
+number is expected.
+.TP
+.BI \-P " port\-number"
+Changes the port where
+.B slapd
+will expect LDAP over raw TLS connections. If this option is not given,
+the default port for this purpose (636) will be used. A numeric port
+number is expected.
+.TP
+.BI \-u " user"
+.B slapd
+will run slapd with the specified user name or id, and that user's
+supplementary group access list as set with initgroups(3). The group ID
+is also changed to this user's gid, unless the -g option is used to
+override.
+.TP
+.BI \-g " group"
+.B slapd
+will run with the specified group name or id.
+.LP
+Note that on some systems, running as a non-privileged user will prevent
+passwd back-ends from accessing the encrypted passwords. Note also that
+any shell back-ends will run as the specified non-privileged user.
.SH EXAMPLES
To start
.I slapd
.LP
.nf
.ft tt
- ETCDIR/slapd
+ LIBEXECDIR/slapd
.ft
.fi
.LP
.LP
.nf
.ft tt
- ETCDIR/slapd -f /usr/local/slapd/slapd.conf -d 255
+ LIBEXECDIR/slapd -f ETCDIR/slapd.conf -d 255
.ft
.fi
.LP
.SH BUGS
When using the LDBM database backend, the Modify RDN operation does not
update the attribute values in the entry that are affected by the change.
+.SH ACKNOWLEDGEMENTS
+.B OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.
-.TH SLURPD 8C "6 November 1995" "U-M LDAP LDVERSION"
+.TH SLURPD 8C "22 September 1998" "OpenLDAP LDVERSION"
.SH NAME
slurpd \- Standalone LDAP Update Replication Daemon
.SH SYNOPSIS
-.B ETCDIR/slurpd [\-d debug\-level]
+.B LIBEXECDIR/slurpd [\-d debug\-level]
.B [\-f slapd\-config\-file] [\-r slapd\-replog\-file]
.B [\-t temp\-dir] [\-o] [\-k srvtab\-file]
.B
.BI \-d " debug\-level"
Turn on debugging as defined by
.I debug\-level.
-If this option is specified,
+If this option is specified, even with a zero argument,
.B slurpd
will not fork or disassociate from the invoking terminal. Some general
operation and status messages are printed for any value of \fIdebug\-level\fP.
.LP
.nf
.ft tt
- ETCDIR/slurpd
+ LIBEXECDIR/slurpd
.ft
.fi
.LP
.LP
.nf
.ft tt
- ETCDIR/slurpd -f /usr/local/etc/slapd.conf -d 255
+ LIBEXECDIR/slurpd -f ETCDIR/slapd.conf -d 255
.ft
.fi
.LP
.BR slapd (8)
.LP
"The SLAPD and SLURPD Administrator's Guide"
+.SH ACKNOWLEDGEMENTS
+.B OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.
+# $OpenLDAP$
## Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
##
--- /dev/null
+/* Generic alloca.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_ALLOCA_H
+#define _AC_ALLOCA_H
+
+#error "alloca() not supported, use malloc()"
+
+/* AIX requires this to be the first thing in the file. */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+#pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+extern char *(alloca)();
+# endif
+# endif
+# endif
+#endif
+
+
+#endif /* _AC_ALLOCA_H */
/* Generic assert.h */
+/* $OpenLDAP$ */
/*
* Copyright 1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
--- /dev/null
+/* Generic bytes.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_BYTES_H
+#define _AC_BYTES_H
+
+/* cross compilers should define both AC_INT{2,4}_TYPE in CPPFLAGS */
+
+#if !defined( AC_INT4_TYPE ) || !defined( AC_INT2_TYPE )
+ /* use autoconf defines to provide sized typedefs */
+# if SIZEOF_LONG == 4
+# define AC_INT4_TYPE long
+# elif SIZEOF_INT == 4
+# define AC_INT4_TYPE int
+# else
+# error "AC_INT4_TYPE?"
+# endif
+
+# if SIZEOF_SHORT == 2
+# define AC_INT2_TYPE short
+# elif SIZEOF_INT == 2
+# define AC_INT2_TYPE int
+# else
+# error "AC_INT2_TYPE?"
+# endif
+#endif
+
+typedef AC_INT4_TYPE ac_int4;
+typedef signed AC_INT4_TYPE ac_sint4;
+typedef unsigned AC_INT4_TYPE ac_uint4;
+
+typedef AC_INT2_TYPE ac_int2;
+typedef signed AC_INT2_TYPE ac_sint2;
+typedef unsigned AC_INT2_TYPE ac_uint2;
+
+#ifndef BYTE_ORDER
+/* cross compilers should define BYTE_ORDER in CPPFLAGS */
+
+/*
+ * Definitions for byte order, according to byte significance from low
+ * address to high.
+ */
+#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
+#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
+#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
+
+/* assume autoconf's AC_C_BIGENDIAN has been ran */
+/* if it hasn't, we assume (maybe falsely) the order is LITTLE ENDIAN */
+# ifdef WORDS_BIGENDIAN
+# define BYTE_ORDER BIG_ENDIAN
+# else
+# define BYTE_ORDER LITTLE_ENDIAN
+# endif
+
+#endif /* BYTE_ORDER */
+
+#endif /* _AC_BYTES_H */
--- /dev/null
+/* Generic ctype.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_CTYPE_H
+#define _AC_CTYPE_H
+
+#include <ctype.h>
+
+#undef TOUPPER
+#undef TOLOWER
+
+#ifdef C_UPPER_LOWER
+# define TOUPPER(c) (islower(c) ? toupper(c) : (c))
+# define TOLOWER(c) (isupper(c) ? tolower(c) : (c))
+#else
+# define TOUPPER(c) toupper(c)
+# define TOLOWER(c) tolower(c)
+#endif
+
+#endif /* _AC_CTYPE_H */
--- /dev/null
+/* Generic dirent.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_DIRENT_H
+#define _AC_DIRENT_H
+
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+
+#endif /* _AC_DIRENT_H */
--- /dev/null
+/* Generic errno.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_ERRNO_H
+#define _AC_ERRNO_H
+
+#if defined( HAVE_ERRNO_H )
+# include <errno.h>
+#elif defined( HAVE_SYS_ERRNO_H )
+# include <sys/errno.h>
+#endif
+
+#ifndef HAVE_SYS_ERRLIST
+ /* no sys_errlist */
+# define sys_nerr 0
+# define sys_errlist ((char **)0)
+#elif DECL_SYS_ERRLIST
+ /* have sys_errlist but need declaration */
+ extern int sys_nerr;
+ extern char *sys_errlist[];
+#endif
+
+#ifdef HAVE_STRERROR
+#define STRERROR(err) strerror(err)
+#else
+#define STRERROR(err) \
+ ((err) > -1 && (err) < sys_nerr ? sys_errlist[(err)] : "unknown")
+#endif
+
+extern char* strerror_r();
+
+#endif /* _AC_ERRNO_H */
--- /dev/null
+/* Generic krb.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_KRB_H
+#define _AC_KRB_H
+
+#if defined( HAVE_KERBEROS )
+
+#if defined( HAVE_KERBEROSIV_KRB_H )
+#include <kerberosIV/krb.h>
+#elif defined( HAVE_KRB_H )
+#include <krb.h>
+#endif
+
+#if defined( HAVE_KERBEROSIV_DES_H )
+#include <kerberosIV/des.h>
+#elif defined( HAVE_DES_H )
+#include <des.h>
+#endif
+
+#endif /* HAVE_KERBEROS */
+#endif /* _AC_KRB_H */
--- /dev/null
+/* Generic Regex */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+#ifndef _AC_REGEX_H_
+#define _AC_REGEX_H_
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifndef HAVE_REGEX_H
+/* NO POSIX REGEX!!
+ you'll need to install a POSIX compatible REGEX library.
+ Either Henry Spencer's or GNU regex will do.
+
+ For NT: http://people.delphi.com/gjc/hs_regex.html
+*/
+#error "No POSIX REGEX available."
+
+#elif HAVE_GNUREGEX_H
+ /* system has GNU gnuregex.h */
+# include <gnuregex.h>
+#else
+ /* have regex.h, assume it's POSIX compliant */
+# include <regex.h>
+#endif /* regex.h */
+
+#endif /* _AC_REGEX_H_ */
--- /dev/null
+/* Generic setproctitle.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_SETPROCTITLE_H
+#define _AC_SETPROCTITLE_H
+
+#ifdef LDAP_PROCTITLE
+
+#if defined( HAVE_LIBUTIL_H )
+# include <libutil.h>
+#else
+ /* use lutil version */
+ LDAP_F(void) (setproctitle) LDAP_P((const char *fmt, ...)) \
+ LDAP_GCCATTR((format(printf, 1, 2)));
+ LDAP_F(int) Argc;
+ LDAP_F(char) **Argv;
+#endif
+
+#endif /* LDAP_PROCTITLE */
+#endif /* _AC_SETPROCTITLE_H */
--- /dev/null
+/* Generic signal.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_SIGNAL_H
+#define _AC_SIGNAL_H
+
+#include <signal.h>
+
+#undef SIGNAL
+#ifdef HAVE_SIGSET
+#define SIGNAL sigset
+#else
+#define SIGNAL signal
+#endif
+
+#if !defined( LDAP_SIGUSR1 ) || !defined( LDAP_SIGUSR2 )
+#undef LDAP_SIGUSR1
+#undef LDAP_SIGUSR2
+
+# ifndef HAVE_LINUX_THREADS
+# define LDAP_SIGUSR1 SIGUSR1
+# define LDAP_SIGUSR2 SIGUSR2
+
+# else
+ /*
+ LinuxThreads implemented unfortunately uses the only
+ two signals reserved for user applications. This forces
+ OpenLDAP to use, hopefullly unused, signals reserved
+ for other uses.
+ */
+
+# if defined( SIGSTKFLT )
+# define LDAP_SIGUSR1 SIGSTKFLT
+# elif defined ( SIGSYS )
+# define LDAP_SIGUSR1 SIGSYS
+# endif
+
+# if defined( SIGUNUSED )
+# define LDAP_SIGUSR2 SIGUNUSED
+# elif defined ( SIGINFO )
+# define LDAP_SIGUSR2 SIGINFO
+# elif defined ( SIGEMT )
+# define LDAP_SIGUSR2 SIGEMT
+# endif
+# endif
+#endif
+
+#ifndef LDAP_SIGCHLD
+#ifdef SIGCHLD
+#define LDAP_SIGCHLD SIGCHLD
+#elif SIGCLD
+#define LDAP_SIGCHLD SIGCLD
+#endif
+#endif
+
+#endif /* _AC_SIGNAL_H */
-/*
- * Generic socket.h
- */
+/* Generic socket.h */
+/* $OpenLDAP$ */
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
#define MAXHOSTNAMELEN 64
#endif
+#undef sock_errno
+#undef sock_errstr
+#define sock_errno() errno
+#define sock_errstr(e) STRERROR(e)
+
#ifdef HAVE_WINSOCK
-# define tcp_close( s ) closesocket( s );
+# define tcp_close( s ) closesocket( s )
+# define tcp_read( s, buf, len ) recv( s, buf, len, 0 )
+# define tcp_write( s, buf, len ) send( s, buf, len, 0 )
# define ioctl( s, c, a ) ioctlsocket( (s), (c), (a) )
# define ioctl_t u_long
# define AC_SOCKET_INVALID ((unsigned int) ~0)
#define EINPROGRESS WSAEINPROGRESS
#define ETIMEDOUT WSAETIMEDOUT
+#undef sock_errno
+#undef sock_errstr
+#define sock_errno() WSAGetLastError()
+#define sock_errstr(e) WSAGetErrorString(e)
+
+extern char* WSAGetErrorString LDAP_P((int));
+
#elif MACOS
# define tcp_close( s ) tcpclose( s )
+# define tcp_read( s, buf, len ) tcpread( s, buf, len )
+# define tcp_write( s, buf, len ) tcpwrite( s, buf, len )
#elif DOS
# ifdef PCNFS
# define tcp_close( s ) close( s )
+# define tcp_read( s, buf, len ) recv( s, buf, len, 0 )
+# define tcp_write( s, buf, len ) send( s, buf, len, 0 )
# endif /* PCNFS */
# ifdef NCSA
# define tcp_close( s ) do { netclose( s ); netshut() } while(0)
+# define tcp_read( s, buf, len ) nread( s, buf, len )
+# define tcp_write( s, buf, len ) netwrite( s, buf, len )
# endif /* NCSA */
#elif HAVE_CLOSESOCKET
#else
# define tcp_close( s ) close( s )
+# define tcp_read( s, buf, len) read( s, buf, len )
+# define tcp_write( s, buf, len) write( s, buf, len )
+
+#ifdef HAVE_PIPE
+/*
+ * Only use pipe() on systems where file and socket descriptors
+ * are interchangable
+ */
+#define USE_PIPE HAVE_PIPE
+#endif
+
#endif /* MACOS */
#ifndef ioctl_t
#ifndef AC_SOCKET_INVALID
# define AC_SOCKET_INVALID (-1)
#endif
+#ifndef AC_SOCKET_ERROR
+# define AC_SOCKET_ERROR (-1)
+#endif
#if !defined( HAVE_INET_ATON ) && !defined( inet_aton )
#define inet_aton ldap_pvt_inet_aton
--- /dev/null
+/* Generic stdarg.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_STDARG_H
+#define _AC_STDARG_H 1
+
+/* require STDC variable argument support */
+
+#include <stdarg.h>
+
+#ifndef HAVE_STDARG
+# define HAVE_STDARG 1
+#endif
+
+#endif /* _AC_STDARG_H */
/* Generic stdlib.h */
+/* $OpenLDAP$ */
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
--- /dev/null
+/* Generic string.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_STRING_H
+#define _AC_STRING_H
+
+#ifdef STDC_HEADERS
+# include <string.h>
+
+#else
+# ifdef HAVE_STRING_H
+# include <string.h>
+# elif HAVE_STRINGS_H
+# include <strings.h>
+# endif
+
+# ifdef HAVE_MEMORY_H
+# include <memory.h>
+# endif
+
+# ifndef HAVE_STRRCHR
+# undef strchr
+# define strchr index
+# undef strrchr
+# define strrchr rindex
+# endif
+
+# ifndef HAVE_MEMCPY
+# undef memcpy
+# define memcpy(d, s, n) ((void) bcopy ((s), (d), (n)))
+# undef memmove
+# define memmove(d, s, n) ((void) bcopy ((s), (d), (n)))
+# endif
+#endif
+
+/* use ldap_pvt_strtok instead of strtok or strtok_r! */
+LDAP_F(char *) ldap_pvt_strtok LDAP_P((
+ char *str, const char *delim, char **pos ));
+
+LDAP_F(char *) ldap_pvt_strdup LDAP_P((
+ const char * s ));
+
+#ifndef HAVE_STRDUP
+ /* strdup() is missing, declare our own version */
+# undef strdup
+# define strdup(s) ldap_pvt_strdup(s)
+#else
+ /* some systems fail to declare strdup */
+ extern char *(strdup)();
+#endif
+
+/*
+ * some systems fail to declare strcasecmp() and strncasecmp()
+ * we need them declared so we can obtain pointers to them
+ */
+extern int (strcasecmp)();
+extern int (strncasecmp)();
+
+#ifndef SAFEMEMCPY
+# if defined( HAVE_MEMMOVE )
+# define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n))
+# elif defined( HAVE_BCOPY )
+# define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
+# else
+ /* nothing left but memcpy() */
+# define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n))
+# endif
+#endif
+
+#endif /* _AC_STRING_H */
--- /dev/null
+/* Generic sysexits */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+#ifndef _AC_SYSEXITS_H_
+#define _AC_SYSEXITS_H_
+
+#ifdef HAVE_SYSEXITS_H
+# include <sysexits.h>
+#else
+# include <sysexits-compat.h>
+#endif
+
+#endif /* _AC_SYSEXITS_H_ */
--- /dev/null
+/* Generic syslog.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+#ifndef _AC_SYSLOG_H_
+#define _AC_SYSLOG_H_
+
+#if defined( HAVE_SYSLOG_H )
+#include <syslog.h>
+#elif defined ( HAVE_SYS_SYSLOG_H )
+#include <sys/syslog.h>
+#endif
+
+#if defined( LOG_NDELAY ) && defined( LOG_NOWAIT )
+# define OPENLOG_OPTIONS ( LOG_PID | LOG_NDELAY | LOG_NOWAIT )
+#elif defined( LOG_NDELAY )
+# define OPENLOG_OPTIONS ( LOG_PID | LOG_NDELAY )
+#elif defined( LOG_NOWAIT )
+# define OPENLOG_OPTIONS ( LOG_PID | LOG_NOWAIT )
+#elif defined( LOG_PID )
+# define OPENLOG_OPTIONS ( LOG_PID )
+#else
+# define OPENLOG_OPTIONS ( 0 )
+#endif
+
+#endif /* _AC_SYSLOG_H_ */
--- /dev/null
+/* Generic termios.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_TERMIOS_H
+#define _AC_TERMIOS_H
+
+#ifdef HAVE_POSIX_TERMIOS
+#include <termios.h>
+
+#ifdef GCWINSZ_IN_SYS_IOCTL
+#include <sys/ioctl.h>
+#endif
+
+#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))
+
+#elif defined( HAVE_SGTTY_H )
+#include <sgtty.h>
+
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#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))
+
+#endif /* HAVE_SGTTY_H */
+
+#endif /* _AC_TERMIOS_H */
--- /dev/null
+/* Generic time.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_TIME_H
+#define _AC_TIME_H
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#elif HAVE_SYS_TIME_H
+# include <sys/time.h>
+# ifdef HAVE_SYS_TIMEB_H
+# include <sys/timeb.h>
+# endif
+#else
+# include <time.h>
+#endif
+
+#endif /* _AC_TIME_H */
--- /dev/null
+/* Generic unistd.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_UNISTD_H
+#define _AC_UNISTD_H
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+/* crypt() may be defined in a separate include file */
+#if HAVE_CRYPT_H
+# include <crypt.h>
+#else
+ extern char *(crypt)();
+#endif
+
+#ifndef HAVE_GETPASS
+LDAP_F(char*)(getpass) LDAP_P((const char *getpass));
+#else
+LDAP_F(char*)(getpass)();
+#endif
+
+/* getopt() defines may be in separate include file */
+#if HAVE_GETOPT_H
+# include <getopt.h>
+
+#elif !defined(HAVE_GETOPT)
+ /* no getopt, assume we need getopt-compat.h */
+# include <getopt-compat.h>
+
+#else
+ /* assume we need to declare these externs */
+ extern char *optarg;
+ extern int optind, opterr, optopt;
+#endif
+
+#ifndef HAVE_TEMPNAM
+ LDAP_F(char *)(tempnam) LDAP_P((
+ const char *tmpdir,
+ const char *prefix));
+#endif
+#ifndef HAVE_MKTEMP
+ LDAP_F(char *)(mktemp) LDAP_P((char *));
+#endif
+
+/* use lutil file locking */
+#define ldap_lockf(x) lutil_lockf(x)
+#define ldap_unlockf(x) lutil_unlockf(x)
+#include <lutil_lockf.h>
+
+#endif /* _AC_UNISTD_H */
--- /dev/null
+/* Generic wait.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_WAIT_H
+#define _AC_WAIT_H
+
+#include <sys/types.h>
+
+#if HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+
+#define LDAP_HI(s) (((s) >> 8) & 0377)
+#define LDAP_LO(s) ((s) & 0377)
+
+/* These should work on non-POSIX UNIX platforms,
+ all bets on off on non-POSIX non-UNIX platforms... */
+#ifndef WIFEXITED
+# define WIFEXITED(s) (LDAP_LO(s) == 0)
+#endif
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(s) LDAP_HI(s)
+#endif
+#ifndef WIFSIGNALED
+# define WIFSIGNALED(s) (LDAP_LO(s) > 0 && LDAP_HI(s) == 0)
+#endif
+#ifndef WTERMSIG
+# define WTERMSIG(s) (LDAP_LO(s) & 0177)
+#endif
+#ifndef WIFSTOPPED
+# define WIFSTOPPED(s) (LDAP_LO(s) == 0177 && LDAP_HI(s) != 0)
+#endif
+#ifndef WSTOPSIG
+# define WSTOPSIG(s) LDAP_HI(s)
+#endif
+
+#ifdef WCONTINUED
+# define WAIT_FLAGS ( WNOHANG | WUNTRACED | WCONTINUED )
+#else
+# define WAIT_FLAGS ( WNOHANG | WUNTRACED )
+#endif
+
+#endif /* _AC_WAIT_H */
-/* avl.h - avl tree definitions */
+/* $OpenLDAP$ */
/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/* Portions
* Copyright (c) 1993 Regents of the University of Michigan.
* All rights reserved.
*
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
+/* avl.h - avl tree definitions */
#ifndef _AVL
#define _AVL
+#include <ldap_cdefs.h>
+
/*
* this structure represents a generic avl tree node.
*/
-typedef struct avlnode {
- caddr_t avl_data;
- char avl_bf;
+LDAP_BEGIN_DECL
+
+typedef struct avlnode Avlnode;
+
+#ifdef AVL_INTERNAL
+struct avlnode {
+ void* avl_data;
+ signed int avl_bf;
struct avlnode *avl_left;
struct avlnode *avl_right;
-} Avlnode;
+};
#define NULLAVL ((Avlnode *) NULL)
/* balance factor values */
-#define LH -1
+#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();
+#define avl_getone(x) ((x) == 0 ? 0 : (x)->avl_data)
+#define avl_onenode(x) ((x) == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
+
+#endif /* AVL_INTERNALS */
+
+typedef int (*AVL_APPLY) LDAP_P((void *, void*));
+typedef int (*AVL_CMP) LDAP_P((const void*, const void*));
+typedef int (*AVL_DUP) LDAP_P((void*, void*));
+typedef void (*AVL_FREE) LDAP_P((void*));
+
+LDAP_F( int )
+avl_free LDAP_P(( Avlnode *root, AVL_FREE dfree ));
+
+LDAP_F( int )
+avl_insert LDAP_P((Avlnode **, void*, AVL_CMP, AVL_DUP));
+
+LDAP_F( void* )
+avl_delete LDAP_P((Avlnode **, void*, AVL_CMP));
+
+LDAP_F( void* )
+avl_find LDAP_P((Avlnode *, const void*, AVL_CMP));
+
+LDAP_F( void* )
+avl_find_lin LDAP_P((Avlnode *, const void*, AVL_CMP));
+
+#ifdef AVL_NONREENTRANT
+LDAP_F( void* )
+avl_getfirst LDAP_P((Avlnode *));
+
+LDAP_F( void* )
+avl_getnext LDAP_P((void));
+#endif
+
+LDAP_F( int )
+avl_dup_error LDAP_P((void*, void*));
+
+LDAP_F( int )
+avl_dup_ok LDAP_P((void*, void*));
+
+LDAP_F( int )
+avl_apply LDAP_P((Avlnode *, AVL_APPLY, void*, int, int));
+
+LDAP_F( int )
+avl_prefixapply LDAP_P((Avlnode *, void*, AVL_CMP, void*, AVL_CMP, void*, int));
/* 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
+#define AVL_NOMORE (-6)
-typedef int (*IFP)();
+LDAP_END_DECL
#endif /* _AVL */
+/* $OpenLDAP$ */
/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/* Portions
* Copyright (c) 1993, 1994 Regents of the University of Michigan.
* All rights reserved.
*
#ifndef _DISPTMPL_H
#define _DISPTMPL_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <ldap_cdefs.h>
+LDAP_BEGIN_DECL
#define LDAP_TEMPLATE_VERSION 1
};
-#define NULLTMPLITEM ((struct ldap_tmplitem *)0)
-
#define LDAP_SET_TMPLITEM_APPDATA( ti, datap ) \
- (ti)->ti_appdata = (void *)(datap)
+ ( (ti)->ti_appdata = (void *)(datap) )
#define LDAP_GET_TMPLITEM_APPDATA( ti, type ) \
- (type)((ti)->ti_appdata)
+ ( (type)((ti)->ti_appdata) )
#define LDAP_IS_TMPLITEM_OPTION_SET( ti, option ) \
- (((ti)->ti_options & option ) != 0 )
+ ( ((ti)->ti_options & (option) ) != 0 )
/*
struct ldap_oclist *oc_next;
};
-#define NULLOCLIST ((struct ldap_oclist *)0)
-
/*
* add defaults list
struct ldap_adddeflist *ad_next;
};
-#define NULLADLIST ((struct ldap_adddeflist *)0)
-
/*
* display template global options
struct ldap_disptmpl *dt_next;
};
-#define NULLDISPTMPL ((struct ldap_disptmpl *)0)
-
#define LDAP_SET_DISPTMPL_APPDATA( dt, datap ) \
- (dt)->dt_appdata = (void *)(datap)
+ ( (dt)->dt_appdata = (void *)(datap) )
#define LDAP_GET_DISPTMPL_APPDATA( dt, type ) \
- (type)((dt)->dt_appdata)
+ ( (type)((dt)->dt_appdata) )
#define LDAP_IS_DISPTMPL_OPTION_SET( dt, option ) \
- (((dt)->dt_options & option ) != 0 )
+ ( ((dt)->dt_options & (option) ) != 0 )
#define LDAP_TMPL_ERR_VERSION 1
#define LDAP_TMPL_ERR_MEM 2
#define LDAP_DTMPL_BUFSIZ 8192
-#ifndef NEEDPROTOS
-
-typedef int (*writeptype)();
+typedef int (*ldap_writeptype) LDAP_P((
+ void *writeparm, char *p, ber_len_t len ));
-int ldap_init_templates();
-int ldap_init_templates_buf();
-void ldap_free_templates();
-struct ldap_disptmpl *ldap_first_disptmpl();
-struct ldap_disptmpl *ldap_next_disptmpl();
-struct ldap_disptmpl *ldap_name2template();
-struct ldap_disptmpl *ldap_oc2template();
-char **ldap_tmplattrs();
-struct ldap_tmplitem *ldap_first_tmplrow();
-struct ldap_tmplitem *ldap_next_tmplrow();
-struct ldap_tmplitem *ldap_first_tmplcol();
-struct ldap_tmplitem *ldap_next_tmplcol();
-int ldap_entry2text_search();
-int ldap_entry2text();
-int ldap_vals2text();
-int ldap_entry2html_search();
-int ldap_entry2html();
-int ldap_vals2html();
+LDAP_F( int )
+ldap_init_templates LDAP_P(( char *file, struct ldap_disptmpl **tmpllistp ));
-#else /* !NEEDPROTOS */
+LDAP_F( int )
+ldap_init_templates_buf LDAP_P(( char *buf,
+ ber_len_t buflen,
+ struct ldap_disptmpl **tmpllistp ));
-typedef int (*writeptype)( void *writeparm, char *p, int len );
+LDAP_F( void )
+ldap_free_templates LDAP_P(( struct ldap_disptmpl *tmpllist ));
-LDAPFUNCDECL int
-ldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp );
+LDAP_F( struct ldap_disptmpl * )
+ldap_first_disptmpl LDAP_P(( struct ldap_disptmpl *tmpllist ));
-LDAPFUNCDECL int
-ldap_init_templates_buf( char *buf, long buflen,
- struct ldap_disptmpl **tmpllistp );
+LDAP_F( struct ldap_disptmpl * )
+ldap_next_disptmpl LDAP_P(( struct ldap_disptmpl *tmpllist,
+ struct ldap_disptmpl *tmpl ));
-LDAPFUNCDECL void
-ldap_free_templates( struct ldap_disptmpl *tmpllist );
+LDAP_F( struct ldap_disptmpl * )
+ldap_name2template LDAP_P(( char *name,
+ struct ldap_disptmpl *tmpllist ));
-LDAPFUNCDECL struct ldap_disptmpl *
-ldap_first_disptmpl( struct ldap_disptmpl *tmpllist );
+LDAP_F( struct ldap_disptmpl * )
+ldap_oc2template LDAP_P(( char **oclist,
+ struct ldap_disptmpl *tmpllist ));
-LDAPFUNCDECL struct ldap_disptmpl *
-ldap_next_disptmpl( struct ldap_disptmpl *tmpllist,
- struct ldap_disptmpl *tmpl );
+LDAP_F( char ** )
+ldap_tmplattrs LDAP_P(( struct ldap_disptmpl *tmpl,
+ char **includeattrs,
+ int exclude,
+ unsigned long syntaxmask ));
-LDAPFUNCDECL struct ldap_disptmpl *
-ldap_name2template( char *name, struct ldap_disptmpl *tmpllist );
+LDAP_F( struct ldap_tmplitem * )
+ldap_first_tmplrow LDAP_P(( struct ldap_disptmpl *tmpl ));
-LDAPFUNCDECL struct ldap_disptmpl *
-ldap_oc2template( char **oclist, struct ldap_disptmpl *tmpllist );
+LDAP_F( struct ldap_tmplitem * )
+ldap_next_tmplrow LDAP_P(( struct ldap_disptmpl *tmpl,
+ struct ldap_tmplitem *row ));
-LDAPFUNCDECL char **
-ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, int exclude,
- unsigned long syntaxmask );
+LDAP_F( struct ldap_tmplitem * )
+ldap_first_tmplcol LDAP_P(( struct ldap_disptmpl *tmpl,
+ struct ldap_tmplitem *row ));
-LDAPFUNCDECL struct ldap_tmplitem *
-ldap_first_tmplrow( struct ldap_disptmpl *tmpl );
+LDAP_F( struct ldap_tmplitem * )
+ldap_next_tmplcol LDAP_P(( struct ldap_disptmpl *tmpl,
+ struct ldap_tmplitem *row,
+ struct ldap_tmplitem *col ));
-LDAPFUNCDECL struct ldap_tmplitem *
-ldap_next_tmplrow( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row );
-
-LDAPFUNCDECL struct ldap_tmplitem *
-ldap_first_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row );
-
-LDAPFUNCDECL struct ldap_tmplitem *
-ldap_next_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row,
- struct ldap_tmplitem *col );
-
-LDAPFUNCDECL int
-ldap_entry2text( LDAP *ld, char *buf, LDAPMessage *entry,
+LDAP_F( int )
+ldap_entry2text LDAP_P(( 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 );
-
-LDAPFUNCDECL int
-ldap_vals2text( LDAP *ld, char *buf, char **vals, char *label, int labelwidth,
- unsigned long syntaxid, writeptype writeproc, void *writeparm,
- char *eol, int rdncount );
-
-LDAPFUNCDECL int
-ldap_entry2text_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry,
+ ldap_writeptype writeproc, void *writeparm, char *eol, int rdncount,
+ unsigned long opts ));
+
+LDAP_F( int )
+ldap_vals2text LDAP_P(( LDAP *ld,
+ char *buf, char **vals, char *label, int labelwidth,
+ unsigned long syntaxid, ldap_writeptype writeproc, void *writeparm,
+ char *eol, int rdncount ));
+
+LDAP_F( int )
+ldap_entry2text_search LDAP_P(( 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_writeptype writeproc, void *writeparm, char *eol, int rdncount,
+ unsigned long opts ));
-LDAPFUNCDECL int
-ldap_entry2html( LDAP *ld, char *buf, LDAPMessage *entry,
+LDAP_F( int )
+ldap_entry2html LDAP_P(( 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 );
-
-LDAPFUNCDECL int
-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 );
-
-LDAPFUNCDECL int
-ldap_entry2html_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry,
+ ldap_writeptype writeproc, void *writeparm, char *eol, int rdncount,
+ unsigned long opts, char *urlprefix, char *base ));
+
+LDAP_F( int )
+ldap_vals2html LDAP_P(( LDAP *ld,
+ char *buf, char **vals, char *label, int labelwidth,
+ unsigned long syntaxid, ldap_writeptype writeproc, void *writeparm,
+ char *eol, int rdncount, char *urlprefix ));
+
+LDAP_F( int )
+ldap_entry2html_search LDAP_P(( 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 );
-#endif /* !NEEDPROTOS */
-
+ ldap_writeptype writeproc, void *writeparm, char *eol, int rdncount,
+ unsigned long opts, char *urlprefix ));
-#ifdef __cplusplus
-}
-#endif
+LDAP_END_DECL
#endif /* _DISPTMPL_H */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/*
+ * getopt(3) declarations
+ */
+#ifndef _GETOPT_COMPAT_H
+#define _GETOPT_COMPAT_H
+
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
+
+extern char *optarg;
+extern int optind, opterr, optopt;
+
+LDAP_F( int )
+getopt LDAP_P((
+ int,
+ char * const [],
+ const char *));
+
+LDAP_END_DECL
+
+#endif /* _GETOPT_COMPAT_H */
+/* $OpenLDAP$ */
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/*
+ * lber_pvt.h - Header for ber_pvt_ functions. These are meant to be used
+ * by the OpenLDAP distribution only.
+ */
+
+#ifndef _LBER_PVT_H
+#define _LBER_PVT_H 1
+
+#include <lber.h>
+
+LDAP_BEGIN_DECL
+
+/*
+ * bprint.c
+ */
+LDAP_F( BER_LOG_PRINT_FN ) ber_pvt_log_print;
+
+LDAP_F( int )
+ber_pvt_log_printf LDAP_P((
+ int errlvl,
+ int loglvl,
+ const char *fmt,
+ ... )) LDAP_GCCATTR((format(printf, 3, 4)));
+
+LDAP_END_DECL
+
+#endif
+
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/*
+ * LBER types
+ */
+
+#ifndef _LBER_TYPES_H
+#define _LBER_TYPES_H
+
+/* LBER boolean, enum, integers - 32 bits or larger*/
+#undef LBER_INT_T
+
+/* LBER tags - 32 bits or larger */
+#undef LBER_TAG_T
+
+/* LBER socket descriptor */
+#undef LBER_SOCKET_T
+
+/* LBER lengths - 32 bits or larger*/
+#undef LBER_LEN_T
+
+#endif /* _LBER_TYPES_H */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/*
+ * LBER types for Windows NT
+ */
+
+#ifndef _LBER_TYPES_H_NT
+#define _LBER_TYPES_H_NT
+
+/*
+ * NT types:
+ *
+ * bitsof(short) == 2
+ * bitsof(int) == 4
+ * bitsof(long) == 4
+ *
+ * typedef unsigned int size_t;
+ * typedef unsigned int SOCKET;
+ *
+ * we use native C types to avoid sucking in system headers
+ */
+
+/* LBER boolean, enum, integers - 32 bits or larger*/
+#define LBER_INT_T int
+
+/* LBER tags - 32 bits or larger */
+#define LBER_TAG_T long
+
+/* LBER socket descriptor */
+#define LBER_SOCKET_T unsigned int
+
+/* LBER lengths - 32 bits or larger*/
+#define LBER_LEN_T int
+
+#endif /* _LBER_TYPES_H_NT */
+/* $OpenLDAP$ */
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
#define LDAP_CHASE_SUBORDINATE_REFERRALS 0x0020
#define LDAP_CHASE_EXTERNAL_REFERRALS 0x0040
-#define LDAP_CONTROL_MANAGEDSAIT "2.16.16.840.1.113730.3.4.2"
+#define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.2.6"
/* LDAP Unsolicited Notifications */
#define LDAP_NOTICE_DISCONNECT "1.3.6.1.4.1.1466.20036"
* in modrdn.c:
*/
LDAP_F( int )
+ldap_rename LDAP_P((
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *newrdn,
+ int deleteoldrdn,
+ LDAP_CONST char *newSuperior,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ int *msgidp ));
+
+LDAP_F( int )
+ldap_rename_s LDAP_P((
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *newrdn,
+ int deleteoldrdn,
+ LDAP_CONST char *newSuperior,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls ));
+
+LDAP_F( int )
ldap_rename_ext LDAP_P((
LDAP *ld,
LDAP_CONST char *dn,
/*
* in getdn.c
*/
-LDAP_F( char *)
+LDAP_F( char * )
ldap_get_dn LDAP_P((
LDAP *ld,
LDAPMessage *entry ));
-LDAP_F( char *)
+LDAP_F( char * )
ldap_dn2ufn LDAP_P((
LDAP_CONST char *dn ));
-LDAP_F( char **)
+LDAP_F( char ** )
ldap_explode_dn LDAP_P((
LDAP_CONST char *dn,
int notypes ));
-LDAP_F( char **)
+LDAP_F( char ** )
ldap_explode_rdn LDAP_P((
LDAP_CONST char *rdn,
int notypes ));
-LDAP_F( char *)
-ldap_parent_dn LDAP_P(( /* new (from slapd) */
+LDAP_F( char * )
+ldap_parent_dn LDAP_P((
LDAP_CONST char *dn ));
-LDAP_F( char *)
-ldap_relative_dn LDAP_P(( /* new (from slapd) */
+LDAP_F( char * )
+ldap_relative_dn LDAP_P((
LDAP_CONST char *dn ));
-LDAP_F( char *)
-ldap_normalize_dn LDAP_P(( /* new (from slapd) */
+LDAP_F( char * )
+ldap_normalize_dn LDAP_P((
LDAP_CONST char *dn ));
-LDAP_F( char **)
+LDAP_F( char ** )
ldap_explode_dns LDAP_P(( /* deprecated */
LDAP_CONST char *dn ));
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/* LDAP C Defines */
+
+#ifndef _LDAP_CDEFS_H
+#define _LDAP_CDEFS_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+# define LDAP_BEGIN_DECL extern "C" {
+# define LDAP_END_DECL }
+#else
+# define LDAP_BEGIN_DECL /* begin declarations */
+# define LDAP_END_DECL /* end declarations */
+#endif
+
+#if !defined(__NO_PROTOTYPES) && ( defined(__NEED_PROTOTYPES) || \
+ defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) )
+
+ /* ANSI C or C++ */
+# define LDAP_P(protos) protos
+# define LDAP_CONCAT1(x,y) x ## y
+# define LDAP_CONCAT(x,y) LDAP_CONCAT1(x,y)
+# define LDAP_STRING(x) #x /* stringify without expanding x */
+# define LDAP_XSTRING(x) LDAP_STRING(x) /* expand x, then stringify */
+
+#ifndef LDAP_CONST
+# define LDAP_CONST const
+#endif
+
+#else /* no prototypes */
+
+ /* traditional C */
+# define LDAP_P(protos) ()
+# define LDAP_CONCAT(x,y) x/**/y
+# define LDAP_STRING(x) "x"
+
+#ifndef LDAP_CONST
+# define LDAP_CONST /* no const */
+#endif
+
+#endif /* no prototypes */
+
+#if _WIN32 && _DLL
+# define LDAP_F_IMPORT extern __declspec( dllimport )
+# define LDAP_F_EXPORT extern __declspec( dllexport )
+#else
+# define LDAP_F_IMPORT extern
+# define LDAP_F_EXPORT extern
+#endif
+
+#if (__GNUC__) * 1000 + (__GNUC_MINOR__) >= 2006
+# define LDAP_GCCATTR(attrs) __attribute__(attrs)
+#else
+# define LDAP_GCCATTR(attrs)
+#endif
+
+
+#endif /* _LDAP_CDEFS_H */
+
+/* purposely allow these to be redefined */
+#ifndef LDAP_F_PRE
+# define LDAP_F_PRE LDAP_F_IMPORT
+#endif
+#ifndef LDAP_F_POST
+# define LDAP_F_POST /* no post */
+#endif
+#ifndef LDAP_F
+#define LDAP_F(type) LDAP_F_PRE type LDAP_F_POST
+#endif
+
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/*
+ * This file works in confunction with OpenLDAP configure system.
+ * If you do no like the values below, adjust your configure options.
+ */
+
+#ifndef _LDAP_CONFIG_H
+#define _LDAP_CONFIG_H
+
+/* directory separator */
+#ifndef LDAP_DIRSEP
+#define LDAP_DIRSEP "/"
+#endif
+
+/* directories */
+#ifndef LDAP_BINDIR
+#define LDAP_BINDIR "%BINDIR%"
+#endif
+#ifndef LDAP_SBINDIR
+#define LDAP_SBINDIR "%SBINDIR%"
+#endif
+#ifndef LDAP_DATADIR
+#define LDAP_DATADIR "%DATADIR%"
+#endif
+#ifndef LDAP_SYSCONFDIR
+#define LDAP_SYSCONFDIR "%SYSCONFDIR%"
+#endif
+#ifndef LDAP_LIBEXECDIR
+#define LDAP_LIBEXECDIR "%LIBEXECDIR%"
+#endif
+#ifndef LDAP_RUNDIR
+#define LDAP_RUNDIR "%RUNDIR%"
+#endif
+
+/* command locations */
+#ifndef LDAP_EDITOR
+#define LDAP_EDITOR "%EDITOR%"
+#endif
+#ifndef LDAP_FINGER
+#define LDAP_FINGER "%FINGER%"
+#endif
+#ifndef LDAP_SENDMAIL
+#define LDAP_SENDMAIL "%SENDMAIL%"
+#endif
+
+#endif /* _LDAP_CONFIG_H */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/*
+ * This file works in confunction with OpenLDAP configure system.
+ * If you do no like the values below, adjust your configure options.
+ */
+
+#ifndef _LDAP_CONFIG_H
+#define _LDAP_CONFIG_H
+
+/* directory separator */
+#ifndef LDAP_DIRSEP
+#define LDAP_DIRSEP "\\"
+#endif
+
+/* directories */
+#ifndef LDAP_PREFIX
+#define LDAP_PREFIX "C:\\OpenLDAP"
+#endif
+#ifndef LDAP_BINDIR
+#define LDAP_BINDIR LDAP_PREFIX "\\bin"
+#endif
+#ifndef LDAP_SBINDIR
+#define LDAP_SBINDIR LDAP_PREFIX "\\sbin"
+#endif
+#ifndef LDAP_DATADIR
+#define LDAP_DATADIR LDAP_PREFIX "\\share"
+#endif
+#ifndef LDAP_SYSCONFDIR
+#define LDAP_SYSCONFDIR LDAP_PREFIX "\\sysconf"
+#endif
+#ifndef LDAP_LIBEXECDIR
+#define LDAP_LIBEXECDIR LDAP_PREFIX "\\libexec"
+#endif
+#ifndef LDAP_RUNDIR
+#define LDAP_RUNDIR LDAP_PREFIX "\\run"
+#endif
+
+/* command locations */
+#ifndef LDAP_EDITOR
+#define LDAP_EDITOR "%EDITOR%"
+#endif
+#ifndef LDAP_FINGER
+#define LDAP_FINGER "%FINGER%"
+#endif
+#ifndef LDAP_SENDMAIL
+#define LDAP_SENDMAIL "%SENDMAIL%"
+#endif
+
+#endif /* _LDAP_CONFIG_H */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/* Portions
+ * 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.
+ */
+
+/*
+ * This file controls defaults for OpenLDAP package.
+ * You should not change any of these settings.
+ */
+
+#ifndef _LDAP_DEFAULTS_H
+#define _LDAP_DEFAULTS_H
+
+
+#include <ldap_config.h>
+
+#define LDAP_CONF_FILE LDAP_SYSCONFDIR LDAP_DIRSEP "ldap.conf"
+#define LDAP_USERRC_FILE "ldaprc"
+#define LDAP_ENV_PREFIX "LDAP"
+
+
+/*********************************************************************
+ * *
+ * You probably do not need to edit anything below this point *
+ * *
+ *********************************************************************/
+
+/*
+ * SHARED DEFINITIONS - other things you can change
+ */
+ /* default attribute to use when sorting entries, NULL => sort by DN */
+#define SORT_ATTR NULL
+ /* default count of DN components to show in entry displays */
+#define DEFAULT_RDNCOUNT 2
+ /* default config file locations */
+#define FILTERFILE LDAP_SYSCONFDIR LDAP_DIRSEP "ldapfilter.conf"
+#define TEMPLATEFILE LDAP_SYSCONFDIR LDAP_DIRSEP "ldaptemplates.conf"
+#define SEARCHFILE LDAP_SYSCONFDIR LDAP_DIRSEP "ldapsearchprefs.conf"
+#define FRIENDLYFILE LDAP_DATADIR LDAP_DIRSEP "ldapfriendly"
+
+/*
+ * FINGER DEFINITIONS
+ */
+ /* banner to print */
+#define FINGER_BANNER "OpenLDAP Finger Service...\r\n"
+ /* who to report errors to */
+#define FINGER_ERRORS "System Administrator"
+ /* what to say if no matches are found */
+#define FINGER_NOMATCH "Search failed to find anything.\r\n"
+ /* what to say if the service may be unavailable */
+#define FINGER_UNAVAILABLE \
+"The directory service may be temporarily unavailable.\r\n\
+Please try again later.\r\n"
+ /* printed if a match has no email address - for disptmp default */
+#define FINGER_NOEMAIL1 "None registered in this service."
+#define FINGER_NOEMAIL2 NULL
+#define FINGER_NOEMAIL { FINGER_NOEMAIL1, FINGER_NOEMAIL2, NULL }
+ /* maximum number of matches returned */
+#define FINGER_SIZELIMIT 50
+ /* max number of hits displayed in full before a list is presented */
+#define FINGER_LISTLIMIT 1
+ /* what to exec for "finger @host" */
+#define FINGER_CMD LDAP_FINGER
+ /* how to treat aliases when searching */
+#define FINGER_DEREF LDAP_DEREF_FINDING
+ /* attribute to use when sorting results */
+#define FINGER_SORT_ATTR SORT_ATTR
+ /* enable ufn support */
+#define FINGER_UFN
+ /* timeout for searches */
+#define FINGER_TIMEOUT 60
+ /* number of DN components to show in entry displays */
+#define FINGER_RDNCOUNT DEFAULT_RDNCOUNT
+
+/*
+ * GO500 GOPHER GATEWAY DEFINITIONS
+ */
+ /* port on which to listen */
+#define GO500_PORT 5555
+ /* how to handle aliases */
+#define GO500_DEREF LDAP_DEREF_FINDING
+ /* attribute to use when sorting results */
+#define GO500_SORT_ATTR SORT_ATTR
+ /* timeout for searches */
+#define GO500_TIMEOUT 180
+ /* enable ufn support */
+#define GO500_UFN
+ /*
+ * only set and uncomment this if your hostname() does not return
+ * a fully qualified hostname
+ */
+/* #define GO500_HOSTNAME "fully.qualified.hostname.here" */
+ /* number of DN components to show in entry displays */
+#define GO500_RDNCOUNT DEFAULT_RDNCOUNT
+
+/*
+ * GO500GW GOPHER GATEWAY DEFINITIONS
+ */
+ /* where the helpfile lives */
+#define GO500GW_HELPFILE LDAP_DATADIR LDAP_DIRSEP "go500gw.help"
+ /* port on which to listen */
+#define GO500GW_PORT 7777
+ /* timeout on all searches */
+#define GO500GW_TIMEOUT 180
+ /* enable ufn support */
+#define GO500GW_UFN
+ /* attribute to use when sorting results */
+#define GO500GW_SORT_ATTR SORT_ATTR
+ /*
+ * only set and uncomment this if your hostname() does not return
+ * a fully qualified hostname
+ */
+/* #define GO500GW_HOSTNAME "fully.qualified.hostname.here" */
+ /* number of DN components to show in entry displays */
+#define GO500GW_RDNCOUNT DEFAULT_RDNCOUNT
+
+/*
+ * RCPT500 MAIL RESPONDER GATEWAY DEFINITIONS
+ */
+ /* where the helpfile lives */
+#define RCPT500_HELPFILE LDAP_DATADIR LDAP_DIRSEP "rcpt500.help"
+ /* maximum number of matches returned */
+#define RCPT500_SIZELIMIT 50
+ /* address replies will appear to come from */
+#define RCPT500_FROM "\"Directory Query Program\" <Dir-Query>"
+ /* command that will accept an RFC822 message text on standard
+ input, and send it. sendmail -t does this nicely. */
+#define RCPT500_PIPEMAILCMD LDAP_SENDMAIL " -t"
+ /* attribute to use when sorting results */
+#define RCPT500_SORT_ATTR SORT_ATTR
+ /* max number of hits displayed in full before a list is presented */
+#define RCPT500_LISTLIMIT 1
+ /* enable ufn support */
+#define RCPT500_UFN
+ /* number of DN components to show in entry displays */
+#define RCPT500_RDNCOUNT DEFAULT_RDNCOUNT
+
+/*
+ * MAIL500 MAILER DEFINITIONS
+ */
+ /* max number of ambiguous matches reported */
+#define MAIL500_MAXAMBIGUOUS 10
+ /* max subscribers allowed (size limit when searching for them ) */
+#define MAIL500_MAXGROUPMEMBERS LDAP_NO_LIMIT
+ /* timeout for all searches */
+#define MAIL500_TIMEOUT 180
+ /* sendmail location - mail500 needs to exec this */
+#define MAIL500_SENDMAIL LDAP_SENDMAIL
+
+/*
+ * UD DEFINITIONS
+ */
+ /* ud configuration file */
+#define UD_CONFIG_FILE LDAP_SYSCONFDIR LDAP_DIRSEP "ud.conf"
+ /* default editor */
+#define UD_DEFAULT_EDITOR LDAP_EDITOR
+ /* default bbasename of user config file */
+#define UD_USER_CONFIG_FILE ".udrc"
+ /* default base where groups are created */
+#define UD_WHERE_GROUPS_ARE_CREATED ""
+ /* default base below which all groups live */
+#define UD_WHERE_ALL_GROUPS_LIVE ""
+
+/*
+ * FAX500 DEFINITIONS
+ */
+ /* how long to wait for searches */
+#define FAX_TIMEOUT 180
+ /* maximum number of ambiguous matches reported */
+#define FAX_MAXAMBIGUOUS 10
+ /* maximum number of members allowed */
+#define FAX_MAXMEMBERS LDAP_NO_LIMIT
+ /* program to send mail */
+#define FAX_SENDMAIL LDAP_SENDMAIL
+
+/*
+ * RP500 DEFINITIONS
+ */
+ /* prefix to add to non-fully-qualified numbers */
+#define RP_PHONEPREFIX ""
+
+/*
+ * SLAPD DEFINITIONS
+ */
+ /* location of the default slapd config file */
+#define SLAPD_DEFAULT_CONFIGFILE LDAP_SYSCONFDIR LDAP_DIRSEP "slapd.conf"
+ /* default max deref depth for aliases */
+#define SLAPD_DEFAULT_MAXDEREFDEPTH 15
+ /* default sizelimit on number of entries from a search */
+#define SLAPD_DEFAULT_SIZELIMIT 500
+ /* default timelimit to spend on a search */
+#define SLAPD_DEFAULT_TIMELIMIT 3600
+ /* minimum max ids that a single index entry can map to in ldbm */
+#define SLAPD_LDBM_MIN_MAXIDS 4000
+
+/* the following DNs must be normalized and in uppercase! */
+ /* dn of the special "monitor" entry */
+#define SLAPD_MONITOR_DN "CN=MONITOR"
+ /* dn of the special "config" entry */
+#define SLAPD_CONFIG_DN "CN=CONFIG"
+ /* dn of the special "schema" entry */
+#define SLAPD_SCHEMA_DN "CN=SCHEMA"
+
+#endif /* _LDAP_CONFIG_H */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/*
+ * LDAP Features
+ */
+#ifndef _LDAP_FEATURES_H
+#define _LDAP_FEATURES_H 1
+
+/*
+** OpenLDAP reentrancy/thread-safeness should be dynamically
+** checked using ldap_get_option().
+**
+** The -lldap implementation may or may not be:
+** LDAP_API_FEATURE_THREAD_SAFE
+**
+** The preprocessor flag LDAP_API_FEATURE_X_OPENLDAP_REENTRANT can
+** be used to determine if -lldap is LDAP_API_FEATURE_THREAD_SAFE at
+** compile time.
+**
+** The -lldap_r implementation is always THREAD_SAFE but
+** may also be:
+** LDAP_API_FEATURE_SESSION_THREAD_SAFE
+** LDAP_API_FEATURE_OPERATION_THREAD_SAFE
+**
+** The preprocessor flag LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
+** can be used to determine if -lldap_r is available at compile
+** time. You must define LDAP_THREAD_SAFE if and only if you
+** link with -lldap_r.
+**
+** If you fail to define LDAP_THREAD_SAFE when linking with
+** -lldap_r or define LDAP_THREAD_SAFE when linking with -lldap,
+** provided header definations and declarations may be incorrect.
+**
+*/
+
+/* is -lldap reentrant or not */
+#undef LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
+
+/* is threadsafe version of -lldap (ie: -lldap_r) *available* or not */
+#undef LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
+
+/* LDAP v2 DNS */
+#undef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
+
+/* LDAP v2 Referrals */
+#undef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
+
+#endif /* LDAP_FEATURES */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/*
+ * LDAP Features
+ */
+#ifndef _LDAP_FEATURES_H
+#define _LDAP_FEATURES_H 1
+
+/*
+** OpenLDAP reentrancy/thread-safeness should be dynamically
+** checked using ldap_get_option().
+**
+** The -lldap implementation may or may not be:
+** LDAP_API_FEATURE_THREAD_SAFE
+**
+** The preprocessor flag LDAP_API_FEATURE_X_OPENLDAP_REENTRANT can
+** be used to determine if -lldap is LDAP_API_FEATURE_THREAD_SAFE at
+** compile time.
+**
+** The -lldap_r implementation is always THREAD_SAFE but
+** may also be:
+** LDAP_API_FEATURE_SESSION_THREAD_SAFE
+** LDAP_API_FEATURE_OPERATION_THREAD_SAFE
+**
+** The preprocessor flag LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
+** can be used to determine if -lldap_r is availalbe at compile
+** time. You must define LDAP_THREAD_SAFE if and only if you
+** link with -lldap_r.
+**
+** If you fail to define LDAP_THREAD_SAFE when linking with
+** -lldap_r or define LDAP_THREAD_SAFE when linking with -lldap,
+** provided header definations and declarations may be incorrect.
+**
+*/
+
+/* is -lldap reentrant or not */
+/* #undef LDAP_API_FEATURE_X_OPENLDAP_REENTRANT */
+
+/* is threadsafe version of -lldap (ie: -lldap_r) *available* or not */
+#define LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE LDAP_VENDOR_VERSION
+
+/* LDAP v2 DNS */
+/* #undef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
+
+/* LDAP v2 Referrals */
+#define LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS LDAP_VENDOR_VERSION
+
+#endif /* LDAP_FEATURES */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/* Portions
+ * 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.
+ */
+
+#ifndef _LDAP_LOG_H
+#define _LDAP_LOG_H
+
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
+
+#define LDAP_DEBUG_TRACE 0x0001
+#define LDAP_DEBUG_PACKETS 0x0002
+#define LDAP_DEBUG_ARGS 0x0004
+#define LDAP_DEBUG_CONNS 0x0008
+#define LDAP_DEBUG_BER 0x0010
+#define LDAP_DEBUG_FILTER 0x0020
+#define LDAP_DEBUG_CONFIG 0x0040
+#define LDAP_DEBUG_ACL 0x0080
+#define LDAP_DEBUG_STATS 0x0100
+#define LDAP_DEBUG_STATS2 0x0200
+#define LDAP_DEBUG_SHELL 0x0400
+#define LDAP_DEBUG_PARSE 0x0800
+
+#define LDAP_DEBUG_DEPRECATED 0x1000
+#define LDAP_DEBUG_NONE 0x8000
+#define LDAP_DEBUG_ANY -1
+
+/* debugging stuff */
+#ifdef LDAP_DEBUG
+
+#ifndef ldap_debug
+extern int ldap_debug;
+#endif /* !ldap_debug */
+
+#ifdef LDAP_SYSLOG
+extern int ldap_syslog;
+extern int ldap_syslog_level;
+#endif /* LDAP_SYSLOG */
+
+/* this doesn't below as part of ldap.h */
+#ifdef LDAP_SYSLOG
+#define Debug( level, fmt, arg1, arg2, arg3 ) \
+ do { \
+ lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3) ); \
+ if ( ldap_syslog & (level) ) \
+ syslog( ldap_syslog_level, (fmt), (arg1), (arg2), (arg3) ); \
+ } while ( 0 )
+
+#else
+#define Debug( level, fmt, arg1, arg2, arg3 ) \
+ lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3) )
+#endif
+
+#else /* LDAP_DEBUG */
+#define Debug( level, fmt, arg1, arg2, arg3 )
+#endif /* LDAP_DEBUG */
+
+LDAP_F(void) lutil_debug LDAP_P((
+ int debug, int level,
+ const char* fmt, ... )) LDAP_GCCATTR((format(printf, 3, 4)));
+
+LDAP_END_DECL
+
+#endif /* _LDAP_LOG_H */
+/* $OpenLDAP$ */
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
#define _LDAP_PVT_H 1
#include <ldap_cdefs.h>
+#include <lber.h> /* get ber_slen_t */
LDAP_BEGIN_DECL
void ldap_pvt_hex_unescape LDAP_P(( char *s ));
int ldap_pvt_unhex( int c );
+/* these macros assume 'x' is an ASCII x */
+#define LDAP_DNSEPARATOR(c) ((c) == ',' || (c) == ';')
+#define LDAP_SEPARATOR(c) ((c) == ',' || (c) == ';' || (c) == '+')
+#define LDAP_SPACE(c) ((c) == ' ' || (c) == '\n')
+
+#define LDAP_LOWER(c) ( (c) >= 'a' && (c) <= 'z' )
+#define LDAP_UPPER(c) ( (c) >= 'A' && (c) <= 'Z' )
+#define LDAP_ALPHA(c) ( LDAP_LOWER(c) || LDAP_UPPER(c) )
+#define LDAP_DIGIT(c) ( (c) >= '0' && (c) <= '9' )
+#define LDAP_ALNUM(c) ( LDAP_ALPHA(c) || LDAP_DIGIT(c) )
+
+#define LDAP_LEADKEYCHAR(c) ( LDAP_ALPHA(c) )
+#define LDAP_KEYCHAR(c) ( LDAP_ALNUM(c) || (c) == '-' )
+#define LDAP_LEADOIDCHAR(c) ( LDAP_DIGIT(c) )
+#define LDAP_OIDCHAR(c) ( LDAP_DIGIT(c) || (c) == '.' )
+
+#define LDAP_LEADATTRCHAR(c) ( LDAP_LEADKEYCHAR(c) || LDAP_LEADOIDCHAR(c) )
+#define LDAP_ATTRCHAR(c) ( LDAP_KEYCHAR((c)) || (c) == '.' )
+
+#define LDAP_NEEDSESCAPE(c) ((c) == '\\' || (c) == '"')
+
+/* search.c */
+LDAP_F( char * )
+ldap_pvt_find_wildcard LDAP_P(( char *s ));
+
+LDAP_F( ber_slen_t )
+ldap_pvt_filter_value_unescape LDAP_P(( char *filter ));
+
+/* string.c */
+LDAP_F( char * )
+ldap_pvt_str2upper LDAP_P(( char *str ));
+
+LDAP_F( char * )
+ldap_pvt_str2lower LDAP_P(( char *str ));
+
LDAP_END_DECL
#endif
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/* ldap_pvt_thread.h - ldap threads header file NG */
+
+#ifndef _LDAP_PVT_THREAD_H
+#define _LDAP_PVT_THREAD_H
+
+#include "ldap_cdefs.h"
+
+#if defined( HAVE_PTHREADS )
+/**********************************
+ * *
+ * definitions for POSIX Threads *
+ * *
+ **********************************/
+
+#include <pthread.h>
+#ifdef HAVE_SCHED_H
+#include <sched.h>
+#endif
+
+LDAP_BEGIN_DECL
+
+typedef pthread_t ldap_pvt_thread_t;
+typedef pthread_mutex_t ldap_pvt_thread_mutex_t;
+typedef pthread_cond_t ldap_pvt_thread_cond_t;
+
+#if defined( _POSIX_REENTRANT_FUNCTIONS ) || \
+ defined( _POSIX_THREAD_SAFE_FUNCTIONS ) || \
+ defined( _POSIX_THREADSAFE_FUNCTIONS )
+#define HAVE_REENTRANT_FUNCTIONS 1
+#endif
+
+#if defined( HAVE_PTHREAD_GETCONCURRENCY ) || \
+ defined( HAVE_THR_GETCONCURRENCY )
+#define HAVE_GETCONCURRENCY 1
+#endif
+
+#if defined( HAVE_PTHREAD_SETCONCURRENCY ) || \
+ defined( HAVE_THR_SETCONCURRENCY )
+#define HAVE_SETCONCURRENCY 1
+#endif
+
+LDAP_END_DECL
+
+#elif defined ( HAVE_MACH_CTHREADS )
+/**********************************
+ * *
+ * definitions for Mach CThreads *
+ * *
+ **********************************/
+
+#include <mach/cthreads.h>
+
+LDAP_BEGIN_DECL
+
+typedef cthread_t ldap_pvt_thread_t;
+typedef struct mutex ldap_pvt_thread_mutex_t;
+typedef struct condition ldap_pvt_thread_cond_t;
+
+LDAP_END_DECL
+
+#elif defined( HAVE_GNU_PTH )
+/***********************************
+ * *
+ * thread definitions for GNU Pth *
+ * *
+ ***********************************/
+
+#include <pth.h>
+
+LDAP_BEGIN_DECL
+
+typedef pth_t ldap_pvt_thread_t;
+typedef pth_mutex_t ldap_pvt_thread_mutex_t;
+typedef pth_cond_t ldap_pvt_thread_cond_t;
+
+LDAP_END_DECL
+
+
+#elif defined( HAVE_THR )
+/********************************************
+ * *
+ * thread definitions for Solaris LWP (THR) *
+ * *
+ ********************************************/
+
+#include <thread.h>
+#include <synch.h>
+
+LDAP_BEGIN_DECL
+
+typedef thread_t ldap_pvt_thread_t;
+typedef mutex_t ldap_pvt_thread_mutex_t;
+typedef cond_t ldap_pvt_thread_cond_t;
+
+#define HAVE_REENTRANT_FUNCTIONS 1
+
+#ifdef HAVE_THR_GETCONCURRENCY
+#define HAVE_GETCONCURRENCY 1
+#endif
+#ifdef HAVE_THR_SETCONCURRENCY
+#define HAVE_SETCONCURRENCY 1
+#endif
+
+LDAP_END_DECL
+
+#elif defined( HAVE_LWP )
+/*************************************
+ * *
+ * thread definitions for SunOS LWP *
+ * *
+ *************************************/
+
+#include <lwp/lwp.h>
+#include <lwp/stackdep.h>
+
+LDAP_BEGIN_DECL
+
+typedef thread_t ldap_pvt_thread_t;
+typedef mon_t ldap_pvt_thread_mutex_t;
+struct ldap_pvt_thread_lwp_cv {
+ int lcv_created;
+ cv_t lcv_cv;
+};
+typedef struct ldap_pvt_thread_lwp_cv ldap_pvt_thread_cond_t;
+
+#define HAVE_REENTRANT_FUNCTIONS 1
+
+LDAP_END_DECL
+
+#elif HAVE_NT_THREADS
+
+LDAP_BEGIN_DECL
+
+#define WIN32_LEAN_AND_MEAN
+#include <process.h>
+#include <windows.h>
+
+typedef unsigned long ldap_pvt_thread_t;
+typedef HANDLE ldap_pvt_thread_mutex_t;
+typedef HANDLE ldap_pvt_thread_cond_t;
+
+LDAP_END_DECL
+
+#else
+
+/***********************************
+ * *
+ * thread definitions for no *
+ * underlying library support *
+ * *
+ ***********************************/
+
+LDAP_BEGIN_DECL
+
+#ifndef NO_THREADS
+#define NO_THREADS 1
+#endif
+
+typedef int ldap_pvt_thread_t;
+typedef int ldap_pvt_thread_mutex_t;
+typedef int ldap_pvt_thread_cond_t;
+
+LDAP_END_DECL
+
+#endif /* no threads support */
+
+LDAP_BEGIN_DECL
+
+LDAP_F( int )
+ldap_pvt_thread_initialize LDAP_P(( void ));
+
+LDAP_F( int )
+ldap_pvt_thread_destroy LDAP_P(( void ));
+
+LDAP_F( unsigned int )
+ldap_pvt_thread_sleep LDAP_P(( unsigned int s ));
+
+#ifdef HAVE_GETCONCURRENCY
+LDAP_F( int )
+ldap_pvt_thread_get_concurrency LDAP_P(( void ));
+#endif
+
+#ifdef HAVE_SETCONCURRENCY
+# ifndef LDAP_THREAD_CONCURRENCY
+ /* three concurrent threads should be enough */
+# define LDAP_THREAD_CONCURRENCY 3
+# endif
+LDAP_F( int )
+ldap_pvt_thread_set_concurrency LDAP_P(( int ));
+#endif
+
+#define LDAP_PVT_THREAD_CREATE_JOINABLE 0
+#define LDAP_PVT_THREAD_CREATE_DETACHED 1
+
+LDAP_F( int )
+ldap_pvt_thread_create LDAP_P((
+ ldap_pvt_thread_t * thread,
+ int detach,
+ void *(*start_routine)( void * ),
+ void *arg));
+
+LDAP_F( void )
+ldap_pvt_thread_exit LDAP_P(( void *retval ));
+
+LDAP_F( int )
+ldap_pvt_thread_join LDAP_P(( ldap_pvt_thread_t thread, void **status ));
+
+LDAP_F( int )
+ldap_pvt_thread_kill LDAP_P(( ldap_pvt_thread_t thread, int signo ));
+
+LDAP_F( int )
+ldap_pvt_thread_yield LDAP_P(( void ));
+
+LDAP_F( int )
+ldap_pvt_thread_cond_init LDAP_P(( ldap_pvt_thread_cond_t *cond ));
+
+LDAP_F( int )
+ldap_pvt_thread_cond_destroy LDAP_P(( ldap_pvt_thread_cond_t *cond ));
+
+LDAP_F( int )
+ldap_pvt_thread_cond_signal LDAP_P(( ldap_pvt_thread_cond_t *cond ));
+
+LDAP_F( int )
+ldap_pvt_thread_cond_broadcast LDAP_P(( ldap_pvt_thread_cond_t *cond ));
+
+LDAP_F( int )
+ldap_pvt_thread_cond_wait LDAP_P((
+ ldap_pvt_thread_cond_t *cond,
+ ldap_pvt_thread_mutex_t *mutex ));
+
+LDAP_F( int )
+ldap_pvt_thread_mutex_init LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
+
+LDAP_F( int )
+ldap_pvt_thread_mutex_destroy LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
+
+LDAP_F( int )
+ldap_pvt_thread_mutex_lock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
+
+LDAP_F( int )
+ldap_pvt_thread_mutex_trylock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
+
+LDAP_F( int )
+ldap_pvt_thread_mutex_unlock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
+
+typedef struct ldap_pvt_thread_rdwr_var {
+ ldap_pvt_thread_mutex_t ltrw_mutex;
+ ldap_pvt_thread_cond_t ltrw_read; /* wait for read */
+ ldap_pvt_thread_cond_t ltrw_write; /* wait for write */
+ int ltrw_valid;
+#define LDAP_PVT_THREAD_RDWR_VALID 0x0bad
+ int ltrw_r_active;
+ int ltrw_w_active;
+ int ltrw_r_wait;
+ int ltrw_w_wait;
+} ldap_pvt_thread_rdwr_t;
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_init LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_destroy LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_rlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_rtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_runlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_wlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_wtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_wunlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+#ifdef LDAP_DEBUG
+LDAP_F( int )
+ldap_pvt_thread_rdwr_readers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_writers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+
+LDAP_F( int )
+ldap_pvt_thread_rdwr_active LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
+#endif /* LDAP_DEBUG */
+
+#define LDAP_PVT_THREAD_EINVAL EINVAL
+#define LDAP_PVT_THREAD_EBUSY EINVAL
+
+LDAP_END_DECL
+
+#endif /* _LDAP_THREAD_H */
+/* $OpenLDAP$ */
/*
* Copyright 1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
LDAP_F( char *)
ldap_scherr2str LDAP_P((
- int code ));
+ int code )) LDAP_GCCATTR((const));
LDAP_END_DECL
+/* $OpenLDAP$ */
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
* license is available at http://www.OpenLDAP.org/license.html or
* in file LICENSE in the top-level directory of the distribution.
*/
-
/* Portions
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
#define _LUTIL_H 1
#include <ldap_cdefs.h>
+#include <lber_types.h>
+
/*
* Include file for LDAP utility routine
*/
int argc,
char *argv[] ));
+/* sockpair.c */
+LDAP_F( int )
+lutil_pair( LBER_SOCKET_T sd[2] );
LDAP_END_DECL
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/* File locking methods
+ *
+ * lutil_lockf() will block until an exclusive lock is acquired.
+ */
+
+#ifndef _LUTIL_LOCKF_H_
+#define _LUTIL_LOCKF_H_
+
+LDAP_BEGIN_DECL
+
+LDAP_F( int )
+lutil_lockf LDAP_P(( int fd ));
+
+LDAP_F( int )
+lutil_unlockf LDAP_P(( int fd ));
+
+LDAP_END_DECL
+
+#endif /* _LUTIL_LOCKF_H_ */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/* See md5.c for explanation and copyright information. */
+
+#ifndef _LUTIL_MD5_H_
+#define _LUTIL_MD5_H_
+
+#include <ldap_cdefs.h>
+#include <ac/bytes.h>
+
+LDAP_BEGIN_DECL
+
+/* Unlike previous versions of this code, uint32 need not be exactly
+ 32 bits, merely 32 bits or more. Choosing a data type which is 32
+ bits instead of 64 is not important; speed is considerably more
+ important. ANSI guarantees that "unsigned long" will be big enough,
+ and always using it seems to have few disadvantages. */
+
+#ifndef LDAP_UINT32
+#define LDAP_UINT32 1
+typedef ac_uint4 uint32;
+#endif
+
+struct lutil_MD5Context {
+ uint32 buf[4];
+ uint32 bits[2];
+ unsigned char in[64];
+};
+
+LDAP_F( void )
+lutil_MD5Init LDAP_P((
+ struct lutil_MD5Context *context));
+
+LDAP_F( void )
+lutil_MD5Update LDAP_P((
+ struct lutil_MD5Context *context,
+ unsigned char const *buf,
+ unsigned len));
+
+LDAP_F( void )
+lutil_MD5Final LDAP_P((
+ unsigned char digest[16],
+ struct lutil_MD5Context *context));
+
+LDAP_F( void )
+lutil_MD5Transform LDAP_P((
+ uint32 buf[4],
+ const unsigned char in[64]));
+
+/*
+ * This is needed to make RSAREF happy on some MS-DOS compilers.
+ */
+typedef struct lutil_MD5Context lutil_MD5_CTX;
+
+LDAP_END_DECL
+
+#endif /* _LUTIL_MD5_H_ */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/* This version is based on:
+ * $OpenBSD: sha1.h,v 1.8 1997/07/15 01:54:23 millert Exp $ */
+
+#ifndef _LUTIL_SHA1_H_
+#define _LUTIL_SHA1_H_
+
+#include <ldap_cdefs.h>
+#include <ac/bytes.h>
+
+LDAP_BEGIN_DECL
+
+/*
+ * SHA-1 in C
+ * By Steve Reid <steve@edmweb.com>
+ */
+
+#ifndef LDAP_UINT32
+#define LDAP_UINT32 1
+typedef ac_uint4 uint32;
+#endif
+
+typedef struct {
+ uint32 state[5];
+ uint32 count[2];
+ unsigned char buffer[64];
+} lutil_SHA1_CTX;
+
+LDAP_F( void )
+lutil_SHA1Transform
+ LDAP_P((uint32 state[5], const unsigned char buffer[64]));
+
+LDAP_F( void )
+lutil_SHA1Init
+ LDAP_P((lutil_SHA1_CTX *context));
+
+LDAP_F( void )
+lutil_SHA1Update
+ LDAP_P((lutil_SHA1_CTX *context, const unsigned char *data, uint32 len));
+
+LDAP_F( void )
+lutil_SHA1Final
+ LDAP_P((unsigned char digest[20], lutil_SHA1_CTX *context));
+
+LDAP_F( char * )
+lutil_SHA1End
+ LDAP_P((lutil_SHA1_CTX *, char *));
+
+LDAP_F( char * )
+lutil_SHA1File
+ LDAP_P((char *, char *));
+
+LDAP_F( char * )
+lutil_SHA1Data
+ LDAP_P((const unsigned char *, size_t, char *));
+
+LDAP_END_DECL
+
+#endif /* _LUTIL_SHA1_H_ */
/* Define if you have the mkstemp function. */
#undef HAVE_MKSTEMP
+/* Define if you have the pipe function. */
+#undef HAVE_PIPE
+
/* Define if you have the pthread_getconcurrency function. */
#undef HAVE_PTHREAD_GETCONCURRENCY
/* Define if you have the setuid function. */
#undef HAVE_SETUID
+/* Define if you have the sigaction function. */
+#undef HAVE_SIGACTION
+
/* Define if you have the signal function. */
#undef HAVE_SIGNAL
/* Define if you have the <psap.h> header file. */
#undef HAVE_PSAP_H
+/* Define if you have the <pth.h> header file. */
+#undef HAVE_PTH_H
+
/* Define if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define if you have the <ssl.h> header file. */
#undef HAVE_SSL_H
-/* Define if you have the <stdarg.h> header file. */
-#undef HAVE_STDARG_H
-
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* define if you have Mach Cthreads */
#undef HAVE_MACH_CTHREADS
+/* if you have GNU Pth */
+#undef HAVE_GNU_PTH
+
/* if you have Solaris LWP (thr) package */
#undef HAVE_THR
/* define to support reverse lookups */
#undef SLAPD_RLOOKUPS
+/* define to support per-object ACIs */
+#undef SLAPD_ACI_ENABLED
+
+/* define to support discrete rights in ACIs */
+#undef SLAPD_ACI_DISCRETE_RIGHTS
+
/* define to support modules */
#undef SLAPD_MODULES
/* begin of postamble */
+#ifndef __NEED_PROTOTYPES
+/* force LDAP_P to always include prototypes */
+#define __NEED_PROTOTYPES 1
+#endif
+
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
--- /dev/null
+/* $OpenLDAP$ */
+/* include/portable.h.nt -- manually updated of MS NT (MS VC5) */
+/* synced with portable.h.in 1.24 */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _LDAP_PORTABLE_H
+#define _LDAP_PORTABLE_H
+
+/* end of preamble */
+
+/* --------------------------------------------------- */
+/* begin of MSVC5 specific entries */
+
+#define OPENLDAP_PACKAGE "OpenLDAP"
+#define OPENLDAP_VERSION "-devel"
+#define EXEEXT ".exe"
+#define LDAP_DIRSEP "\\"
+
+/* don't suck in all of the win32 api */
+#define WIN32_LEAN_AND_MEAN
+
+#ifdef _WINNT
+/* WindowsNT specific features */
+#define HAVE_NT_SERVICE_MANAGER 1
+#define HAVE_NT_EVENT_LOG 1
+
+#elif _WIN95
+/* Windows95 specific features */
+#endif
+
+#if defined( _DEBUG ) && !defined( LDAP_DEBUG )
+/* #define LDAP_MEMORY_DEBUG 1 */
+#define LDAP_DEBUG 1
+#endif
+
+/* we installed Henry Spencer's REGEX */
+#define HAVE_REGEX_H 1
+
+/* win32 specific stuff */
+#define sleep _sleep
+
+#define strcasecmp stricmp
+#define strncasecmp strnicmp
+#define strdup _strdup
+
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+/* #define vsprintf _vsprintf */
+
+/* define type for caddr_t */
+typedef char * caddr_t;
+
+#define ssize_t signed int
+
+#define LOG_DEBUG 0
+#define openlog( a, b )
+#define closelog()
+
+#define FD_SETSIZE 1024
+
+/* we have NT threads */
+#ifdef _MT
+#define HAVE_NT_THREADS 1
+#else
+#define NO_THREADS 1
+#endif
+
+/* we have spawnlp instead of fork/execlp */
+#define HAVE_SPAWNLP 1
+
+/* we have winsock2 */
+#define HAVE_WINSOCK2 1
+
+/* we have winsock */
+#define HAVE_WINSOCK 1
+
+/* we have <conio.h> */
+#define HAVE_CONIO_H 1
+
+/* we have <direct.h> */
+#define HAVE_DIRECT_H 1
+
+/* we have <io.h> */
+#define HAVE_IO_H 1
+
+/* we have <process.h> */
+#define HAVE_PROCESS_H 1
+
+#define LDAP_SIGUSR1 SIGILL
+#define LDAP_SIGUSR2 SIGTERM
+
+#define MAXPATHLEN _MAX_PATH
+
+/* end of MSVC5 specific entries */
+/* --------------------------------------------------- */
+
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+/* #undef _ALL_SOURCE */
+#endif
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define to the type of elements in the array set by `getgroups'.
+ Usually this is either `int' or `gid_t'. */
+/* #undef GETGROUPS_T */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#define gid_t long
+
+/* Define if you don't have vprintf but do have _doprnt. */
+/* #undef HAVE_DOPRNT */
+
+/* Define if your struct stat has st_blksize. */
+/* #undef HAVE_ST_BLKSIZE */
+
+/* Define if you have the strftime function. */
+#define HAVE_STRFTIME 1
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
+/* #undef HAVE_SYS_WAIT_H */
+
+/* Define if you have the vprintf function. */
+#define HAVE_VPRINTF 1
+
+/* Define if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#define mode_t int
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#define pid_t int
+
+/* Define if the system does not provide POSIX.1 features except
+ with this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define if you need to in order for stat and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define as the return type of signal handlers (int or void). */
+#define RETSIGTYPE void
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+/* #undef TIME_WITH_SYS_TIME */
+
+/* Define if your <sys/time.h> declares struct tm. */
+/* #undef TM_IN_SYS_TIME */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#define uid_t long
+
+/* Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* define this if needed to get reentrant functions */
+#ifndef REENTRANT
+/* #undef REENTRANT */
+#endif
+#ifndef _REENTRANT
+/* #undef _REENTRANT */
+#endif
+
+/* define this if needed to get threadsafe functions */
+#ifndef THREADSAFE
+/* #undef THREADSAFE */
+#endif
+#ifndef _THREADSAFE
+/* #undef _THREADSAFE */
+#endif
+#ifndef THREAD_SAFE
+/* #undef THREAD_SAFE */
+#endif
+#ifndef _THREAD_SAFE
+/* #undef _THREAD_SAFE */
+#endif
+
+/* define this if toupper() requires tolower() */
+#define C_UPPER_LOWER 1
+
+/* define this to the number of arguments ctime_r() expects */
+/* #undef CTIME_R_NARGS */
+
+/* define this if sys_errlist is not defined in stdio.h or errno.h */
+/* #undef DECL_SYS_ERRLIST */
+
+/* define this if sys_errlist is available */
+#define HAVE_SYS_ERRLIST 1
+
+/* define if you have berkeley db */
+/* #undef HAVE_BERKELEY_DB */
+
+/* define if you have berkeley db2 */
+#define HAVE_BERKELEY_DB2 1
+
+/* define if you have crypt */
+/* #undef HAVE_CRYPT */
+
+/* define if you have GDBM */
+/* #undef HAVE_GDBM */
+
+/* define if you have NDBM */
+/* #undef HAVE_NDBM */
+
+/* define if you have res_search() */
+#ifdef __notdef__
+/* see second res_search define */
+/* #undef HAVE_RES_SEARCH */
+#endif
+
+/* define if you have sched_yield() */
+#ifdef __notdef__
+/* see second sched_yield define */
+/* #undef HAVE_SCHED_YIELD */
+#endif
+
+/* define if you have setproctitle() */
+/* #undef HAVE_SETPROCTITLE */
+
+/* define this for connectionless LDAP support */
+/* #undef LDAP_CONNECTIONLESS */
+
+/* define this to add debugging code */
+/* #undef LDAP_DEBUG */
+
+/* define this to remove -lldap cache support */
+/* #undef LDAP_NOCACHE */
+
+/* define this for LDAP process title support */
+/* #undef LDAP_PROCTITLE */
+
+/* define this for LDAP User Interface support */
+/* #undef LDAP_LIBUI */
+
+/* define this to add syslog code */
+/* #undef LDAP_SYSLOG */
+
+/* define this to use DBBTREE w/ LDBM backend */
+#define LDBM_USE_DBBTREE 1
+
+/* define this to use DBHASH w/ LDBM backend */
+/* #undef LDBM_USE_DBHASH */
+
+/* define this for ACL Group support */
+#define SLAPD_ACLGROUPS 1
+
+/* define this to use SLAPD Berkeley DB2 backend */
+/* #define SLAPD_BDB2 1 */
+
+/* define this for ClearText password support */
+#define SLAPD_CLEARTEXT 1
+
+/* define this for crypt(3) password support */
+/* #undef SLAPD_CRYPT */
+
+/* define this to use SLAPD LDAP backend */
+/* #undef SLAPD_LDAP */
+
+/* define this to use SLAPD LDBM backend */
+#define SLAPD_LDBM 1
+
+/* define this to use SLAPD passwd backend */
+/* #undef SLAPD_PASSWD */
+
+/* define this to use SLAPD perl backend */
+/* #undef SLAPD_PERL */
+
+/* define this for phonetic support */
+/* #undef SLAPD_PHONETIC */
+
+/* define this for Reverse Lookup support */
+#define SLAPD_RLOOKUPS 1
+
+/* define this for per-object ACIs */
+/* #undef SLAPD_ACI_ENABLED */
+
+/* define this for discrete rights in ACIs */
+/* #undef SLAPD_ACI_DISCRETE_RIGHTS */
+
+/* define this to use SLAPD shell backend */
+/* #undef SLAPD_SHELL */
+
+/* define this to be empty if your compiler doesn't support volatile */
+/* #undef volatile */
+
+/* define this if sig_atomic_t isn't defined in signal.h */
+/* #undef sig_atomic_t */
+
+/* define this if socklen_t isn't defined in sys/types.h or sys/socket.h */
+#define socklen_t int
+
+/* These are defined in ldap_features.h */
+/*
+ LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
+ LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
+ LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
+ LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
+*/
+
+/* The number of bytes in a int. */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 4
+
+/* The number of bytes in a short. */
+#define SIZEOF_SHORT 2
+
+/* Define if you have the bcopy function. */
+/* #undef HAVE_BCOPY */
+
+/* Define if you have the ctime_r function. */
+/* #undef HAVE_CTIME_R */
+
+/* Define if you have the flock function. */
+/* #undef HAVE_FLOCK */
+
+/* Define if you have the getdtablesize function. */
+/* #undef HAVE_GETDTABLESIZE */
+
+/* Define if you have the gethostbyaddr_r function. */
+/* #undef HAVE_GETHOSTBYADDR_R */
+
+/* Define if you have the gethostbyname_r function. */
+/* #undef HAVE_GETHOSTBYNAME_R */
+
+/* Define if you have the gethostname function. */
+#define HAVE_GETHOSTNAME 1
+
+/* define if you have the getopt function */
+/* #undef HAVE_GETOPT */
+
+/* Define if you have the getpwuid function. */
+/* #undef HAVE_GETPWUID */
+
+/* Define if you have the gettimeofday function. */
+/* #undef HAVE_GETTIMEOFDAY */
+
+/* Define if you have the lockf function. */
+/* #undef HAVE_LOCKF */
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY 1
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the mkstemp function. */
+/* #undef HAVE_MKSTEMP */
+
+/* Define if you have the pthread_getconcurrency function. */
+/* #undef HAVE_PTHREAD_GETCONCURRENCY */
+
+/* Define if you have the pthread_kill function. */
+/* #undef HAVE_PTHREAD_KILL */
+
+/* Define if you have the pthread_setconcurrency function. */
+/* #undef HAVE_PTHREAD_SETCONCURRENCY */
+
+/* Define if you have the pthread_yield function. */
+/* #undef HAVE_PTHREAD_YIELD */
+
+/* Define if you have the res_search function. */
+/* #undef HAVE_RES_SEARCH */
+
+/* Define if you have the sched_yield function. */
+/* #undef HAVE_SCHED_YIELD */
+
+/* Define if you have the select function. */
+#define HAVE_SELECT 1
+
+/* Define if you have the setpwfile function. */
+/* #undef HAVE_SETPWFILE */
+
+/* Define if you have the setsid function. */
+/* #undef HAVE_SETSID */
+
+/* Define if you have the signal function. */
+#define HAVE_SIGNAL 1
+
+/* Define if you have the sigset function. */
+/* #undef HAVE_SIGSET */
+
+/* Define if you have the snprintf function. */
+/* #undef HAVE_SNPRINTF */
+
+/* Define if you have the socket function. */
+#define HAVE_SOCKET 1
+
+/* Define if you have the strdup function. */
+#define HAVE_STRDUP 1
+
+/* Define if you have the strerror function. */
+#define HAVE_STRERROR 1
+
+/* Define if you have the strpbrk function. */
+#define HAVE_STRPBRK 1
+
+/* Define if you have the strrchr function. */
+#define HAVE_STRRCHR 1
+
+/* Define if you have the strsep function. */
+/* #undef HAVE_STRSEP */
+
+/* Define if you have the strspn function. */
+#define HAVE_STRSPN 1
+
+/* Define if you have the strstr function. */
+#define HAVE_STRSTR 1
+
+/* Define if you have the strtok function. */
+#define HAVE_STRTOK 1
+
+/* Define if you have the strtok_r function. */
+/* #undef HAVE_STRTOK_R */
+
+/* Define if you have the strtol function. */
+#define HAVE_STRTOL 1
+
+/* Define if you have the strtoul function. */
+#define HAVE_STRTOUL 1
+
+/* Define if you have the sysconf function. */
+/* #undef HAVE_SYSCONF */
+
+/* Define if you have the tempnam function. */
+/* #undef HAVE_TEMPNAM */
+
+/* Define if you have the thr_getconcurrency function. */
+/* #undef HAVE_THR_GETCONCURRENCY */
+
+/* Define if you have the thr_setconcurrency function. */
+/* #undef HAVE_THR_SETCONCURRENCY */
+
+/* Define if you have the thr_yield function. */
+/* #undef HAVE_THR_YIELD */
+
+/* Define if you have the vsnprintf function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define if you have the vsprintf function. */
+#define HAVE_VSPRINTF 1
+
+/* Define if you have the waitpid function. */
+/* #undef HAVE_WAITPID 1 */
+
+/* Define if you have the <arpa/nameser.h> header file. */
+/* #undef HAVE_ARPA_NAMESER_H */
+
+/* Define if you have the <crypt.h> header file. */
+/* #undef HAVE_CRYPT_H */
+
+/* Define if you have the <db.h> header file. */
+#define HAVE_DB_H 1
+
+/* Define if you have the <db_185.h> header file. */
+/* #undef HAVE_DB_185_H */
+
+/* Define if you have the <des.h> header file. */
+/* #undef HAVE_DES_H */
+
+/* Define if you have the <dirent.h> header file. */
+/* #undef HAVE_DIRENT_H */
+
+/* Define if you have the <dmalloc.h> header file. */
+/* #undef HAVE_DMALLOC_H */
+
+/* Define if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <filio.h> header file. */
+/* #undef HAVE_FILIO_H */
+
+/* Define if you have the <gdbm.h> header file. */
+/* #undef HAVE_GDBM_H */
+
+/* Define if you have the <getopt.h> header file. */
+/* #undef HAVE_GETOPT_H */
+
+/* Define if you have the <kerberosIV/des.h> header file. */
+/* #undef HAVE_KERBEROSIV_DES_H */
+
+/* Define if you have the <kerberosIV/krb.h> header file. */
+/* #undef HAVE_KERBEROSIV_KRB_H */
+
+/* Define if you have the <krb.h> header file. */
+/* #undef HAVE_KRB_H */
+
+/* Define if you have the <libutil.h> header file. */
+/* #undef HAVE_LIBUTIL_H */
+
+/* Define if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <lwp/lwp.h> header file. */
+/* #undef HAVE_LWP_LWP_H */
+
+/* Define if you have the <mach/cthreads.h> header file. */
+/* #undef HAVE_MACH_CTHREADS_H */
+
+/* Define if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define if you have the <memory.h> header file. */
+/* #define HAVE_MEMORY_H */
+
+/* Define if you have the <ncurses.h> header file. */
+/* #undef HAVE_NCURSES_H */
+
+/* Define if you have the <ndbm.h> header file. */
+/* #undef HAVE_NDBM_H */
+
+/* Define if you have the <ndir.h> header file. */
+/* #undef HAVE_NDIR_H */
+
+/* Define if you have the <psap.h> header file. */
+/* #undef HAVE_PSAP_H */
+
+/* Define if you have the <pthread.h> header file. */
+/* #undef HAVE_PTHREAD_H */
+
+/* Define if you have the <pwd.h> header file. */
+/* #undef HAVE_PWD_H */
+
+/* Define if you have the <regex.h> header file. */
+/* #undef HAVE_REGEX_H */
+
+/* Define if you have the <resolv.h> header file. */
+/* #undef HAVE_RESOLV_H */
+
+/* Define if you have the <sched.h> header file. */
+/* #undef HAVE_SCHED_H */
+
+/* Define if you have the <sgtty.h> header file. */
+/* #undef HAVE_SGTTY_H */
+
+/* Define if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define if you have the <synch.h> header file. */
+/* #undef HAVE_SYNCH_H */
+
+/* Define if you have the <sys/dir.h> header file. */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define if you have the <sys/errno.h> header file. */
+/* #undef HAVE_SYS_ERRNO_H */
+
+/* Define if you have the <sys/file.h> header file. */
+/* #undef HAVE_SYS_FILE_H */
+
+/* Define if you have the <sys/filio.h> header file. */
+/* #undef HAVE_SYS_FILIO_H */
+
+/* Define if you have the <sys/ioctl.h> header file. */
+/* #undef HAVE_SYS_IOCTL_H */
+
+/* Define if you have the <sys/ndir.h> header file. */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define if you have the <sys/param.h> header file. */
+/* #undef HAVE_SYS_PARAM_H */
+
+/* Define if you have the <sys/resource.h> header file. */
+/* #undef HAVE_SYS_RESOURCE_H */
+
+/* Define if you have the <sys/socket.h> header file. */
+/* #undef HAVE_SYS_SOCKET_H */
+
+/* Define if you have the <sys/syslog.h> header file. */
+/* #undef HAVE_SYS_SYSLOG_H */
+
+/* Define if you have the <sys/time.h> header file. */
+/* #undef HAVE_SYS_TIME_H */
+
+/* Define if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define if you have the <sysexits.h> header file. */
+/* #undef HAVE_SYSEXITS_H */
+
+/* Define if you have the <syslog.h> header file. */
+/* #undef HAVE_SYSLOG_H */
+
+/* Define if you have the <tcpd.h> header file. */
+/* #undef HAVE_TCPD_H */
+
+/* Define if you have the <termcap.h> header file. */
+/* #undef HAVE_TERMCAP_H */
+
+/* Define if you have the <termios.h> header file. */
+/* #undef HAVE_TERMIOS_H */
+
+/* Define if you have the <thread.h> header file. */
+/* #undef HAVE_THREAD_H */
+
+/* Define if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Define if you have the V3 library (-lV3). */
+/* #undef HAVE_LIBV3 */
+
+/* Define if you have the bind library (-lbind). */
+/* #undef HAVE_LIBBIND */
+
+/* Define if you have the dmalloc library (-ldmalloc). */
+/* #undef HAVE_LIBDMALLOC */
+
+/* Define if you have the gen library (-lgen). */
+/* #undef HAVE_LIBGEN */
+
+/* Define if you have the inet library (-linet). */
+/* #undef HAVE_LIBINET */
+
+/* Define if you have the net library (-lnet). */
+/* #undef HAVE_LIBNET */
+
+/* Define if you have the nsl library (-lnsl). */
+/* #undef HAVE_LIBNSL */
+
+/* Define if you have the nsl_s library (-lnsl_s). */
+/* #undef HAVE_LIBNSL_S */
+
+/* Define if you have the resolv library (-lresolv). */
+/* #undef HAVE_LIBRESOLV */
+
+/* Define if you have the socket library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+/* define if you have -lxtpp */
+/* #undef HAVE_XTPP */
+
+/* define if you have -ldsap */
+/* #undef HAVE_DSAP */
+
+/* define if you have -lisode */
+/* #undef HAVE_ISODE */
+
+/* define if you have -lpp */
+/* #undef HAVE_PP */
+
+/* define if you have Kerberos des_debug */
+/* #undef HAVE_DES_DEBUG */
+
+/* define if you have Kerberos */
+/* #undef HAVE_KERBEROS */
+
+/* define if pthreads API compatible with final spec */
+/* #undef HAVE_PTHREADS_FINAL */
+
+/* define if pthreads API compatible with draft4 spec */
+/* #undef HAVE_PTHREADS_D4 */
+
+/* define if you have LinuxThreads */
+/* #undef HAVE_LINUX_THREADS */
+
+/* define if you have POSIX Threads */
+/* #undef HAVE_PTHREADS */
+
+/* define if you have pthread_detach function */
+/* #undef HAVE_PTHREAD_DETACH */
+
+/* define if you have Mach Cthreads */
+/* #undef HAVE_MACH_CTHREADS */
+
+/* if you have Solaris LWP (thr) package */
+/* #undef HAVE_THR */
+
+/* if you have SunOS LWP package */
+/* #undef HAVE_LWP */
+
+/* define if select implicitly yields */
+#define HAVE_YIELDING_SELECT 1
+
+/* define if you have (or want) no threads */
+/* #undef NO_THREADS */
+
+/* define if you have -lwrap */
+/* #undef HAVE_TCPD */
+
+/* define if you have -ltermcap */
+/* #undef HAVE_TERMCAP */
+
+/* define if you have -lncurses */
+/* #undef HAVE_NCURSES */
+
+/* define if you have no termcap support */
+#define NO_TERMCAP 1
+
+/* Define if TIOCGWINSZ requires sys/ioctl.h */
+/* #undef GWINSZ_IN_SYS_IOCTL */
+
+/* define if you have POSIX termios */
+/* #undef HAVE_POSIX_TERMIOS */
+
+/* Define if system has ptrdiff_t type */
+#define HAVE_PTRDIFF_T 1
+
+/* define if cross compiling */
+/* #undef CROSS_COMPILING */
+
+/* begin of postamble */
+
+#ifndef __NEED_PROTOTYPES
+/* force LDAP_P to always include prototypes */
+#define __NEED_PROTOTYPES 1
+#endif
+
+#ifdef HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+
+#if defined(LDAP_DEVEL) && !defined(LDAP_TEST)
+#define LDAP_TEST
+#endif
+#if defined(LDAP_TEST) && !defined(LDAP_DEBUG)
+#define LDAP_DEBUG
+#endif
+
+#include "ldap_cdefs.h"
+#include "ldap_features.h"
+
+#include <ac/assert.h>
+
+#endif /* _LDAP_PORTABLE_H */
--- /dev/null
+# Microsoft Developer Studio Project File - Name="setup" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=setup - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "setup.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "setup.mak" CFG="setup - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "setup - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "setup - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "setup - Win32 Release"
+
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f setup.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "setup.txt"
+# PROP BASE Bsc_Name "setup.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "NMAKE /f setup.mak"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "setup.txt"
+# PROP Bsc_Name "setup.bsc"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "setup - Win32 Debug"
+
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f setup.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "setup.txt"
+# PROP BASE Bsc_Name "setup.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "NMAKE /f setup.mak"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "setup.txt"
+# PROP Bsc_Name "setup.bsc"
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "setup - Win32 Release"
+# Name "setup - Win32 Debug"
+
+!IF "$(CFG)" == "setup - Win32 Release"
+
+!ELSEIF "$(CFG)" == "setup - Win32 Debug"
+
+!ENDIF
+
+# Begin Source File
+
+SOURCE=.\lber_types.nt
+# End Source File
+# Begin Source File
+
+SOURCE=.\ldap_config.nt
+# End Source File
+# Begin Source File
+
+SOURCE=.\ldap_features.nt
+# End Source File
+# Begin Source File
+
+SOURCE=.\portable.nt
+# End Source File
+# Begin Source File
+
+SOURCE=.\setup.mak
+# End Source File
+# End Target
+# End Project
+# $OpenLDAP$
#
# Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#
-all: setup.txt
-
-setup.txt: lber_types.h ldap_config.h ldap_features.h portable.h
- copy setup.mak setup.txt
+.SUFFIXES: .nt
-lber_types.h: lber_types.h.nt
- copy lber_types.h.nt lber_types.h
+.nt.h:
+ copy $*.nt $*.h
-ldap_config.h: ldap_config.h.nt
- copy ldap_config.h.nt ldap_config.h
+all: setup.txt
-ldap_features.h: ldap_features.h.nt
- copy ldap_features.h.nt ldap_features.h
+setup.txt: lber_types.h ldap_config.h ldap_features.h portable.h setup.mak
+ copy setup.mak setup.txt
-portable.h: portable.h.nt
- copy portable.h.nt portable.h
+lber_types.h: lber_types.nt
+ldap_config.h: ldap_config.nt
+ldap_features.h: ldap_features.nt
+portable.h: portable.nt
+/* $OpenLDAP$ */
/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/* Portions
* Copyright (c) 1993, 1994 Regents of the University of Michigan.
* All rights reserved.
*
#ifndef _SRCHPREF_H
#define _SRCHPREF_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <ldap_cdefs.h>
+LDAP_BEGIN_DECL
struct ldap_searchattr {
char *sa_attrlabel;
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 )
+ (((so)->so_options & (option) ) != 0 )
#define LDAP_SEARCHPREF_VERSION_ZERO 0
#define LDAP_SEARCHPREF_VERSION 1
#define LDAP_SEARCHPREF_ERR_FILE 4
-#ifndef NEEDPROTOS
-int ldap_init_searchprefs();
-int ldap_init_searchprefs_buf();
-void ldap_free_searchprefs();
-struct ldap_searchobj *ldap_first_searchobj();
-struct ldap_searchobj *ldap_next_searchobj();
-
-#else /* !NEEDPROTOS */
-
-LDAPFUNCDECL int
-ldap_init_searchprefs( char *file, struct ldap_searchobj **solistp );
+LDAP_F( int )
+ldap_init_searchprefs LDAP_P(( char *file,
+ struct ldap_searchobj **solistp ));
-LDAPFUNCDECL int
-ldap_init_searchprefs_buf( char *buf, long buflen,
- struct ldap_searchobj **solistp );
+LDAP_F( int )
+ldap_init_searchprefs_buf LDAP_P(( char *buf,
+ ber_len_t buflen,
+ struct ldap_searchobj **solistp ));
-LDAPFUNCDECL void
-ldap_free_searchprefs( struct ldap_searchobj *solist );
+LDAP_F( void )
+ldap_free_searchprefs LDAP_P(( struct ldap_searchobj *solist ));
-LDAPFUNCDECL struct ldap_searchobj *
-ldap_first_searchobj( struct ldap_searchobj *solist );
+LDAP_F( struct ldap_searchobj * )
+ldap_first_searchobj LDAP_P(( struct ldap_searchobj *solist ));
-LDAPFUNCDECL struct ldap_searchobj *
-ldap_next_searchobj( struct ldap_searchobj *sollist,
- struct ldap_searchobj *so );
+LDAP_F( struct ldap_searchobj * )
+ldap_next_searchobj LDAP_P(( struct ldap_searchobj *sollist,
+ struct ldap_searchobj *so ));
-#endif /* !NEEDPROTOS */
+LDAP_END_DECL
-#ifdef __cplusplus
-}
-#endif
#endif /* _SRCHPREF_H */
+/* $OpenLDAP$ */
/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+/* Portions
* Copyright (c) 1987 Regents of the University of California.
* All rights reserved.
*
--- /dev/null
+# $OpenLDAP$
+## Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+##
+## Libraries Makefile for OpenLDAP
+
+SUBDIRS= liblutil libldif liblber libldap libavl libldbm libldap_r
+
--- /dev/null
+# $OpenLDAP$
+##
+## LIBAVL
+##
+
+SRCS = avl.c testavl.c
+XSRCS = version.c
+OBJS = avl.o
+
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+LIBRARY = libavl.a
+PROGRAMS = testavl
+XLIBS = -lavl
+
+testavl: $(LIBRARY) testavl.o
+ $(LTLINK) $(LDFLAGS) -o $@ testavl.o $(LIBS)
/* avl.c - routines to implement an avl tree */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* testavl.c - Test Tim Howes AVL code */
+/* $OpenLDAP$ */
#include "portable.h"
--- /dev/null
+# $OpenLDAP$
+## Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+##
+## LIBLBER
+##
+
+LIBRARY = liblber.la
+XLIBRARY = ../liblber.a
+
+SRCS= assert.c decode.c encode.c io.c bprint.c \
+ memory.c options.c sockbuf.c
+OBJS= assert.lo decode.lo encode.lo io.lo bprint.lo \
+ memory.lo options.lo sockbuf.lo
+XSRCS= version.c
+
+PROGRAMS= dtest etest idtest
+
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+XLIBS = -llber
+XXLIBS =
+
+dtest: $(LIBRARY) dtest.o
+ $(LTLINK) $(LDFLAGS) -o $@ dtest.o $(LIBS)
+etest: $(LIBRARY) etest.o
+ $(LTLINK) $(LDFLAGS) -o $@ etest.o $(LIBS)
+idtest: $(LIBRARY) idtest.o
+ $(LTLINK) $(LDFLAGS) -o $@ idtest.o $(LIBS)
+
+install-local: FORCE
+ -$(MKDIR) $(libdir)
+ $(LTINSTALL) $(INSTALLFLAGS) -m 644 $(LIBRARY) $(libdir)
+
+/* $OpenLDAP$ */
/*
* Copyright 1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include "lber.h"
+
+#include <ac/ctype.h>
+#include <ac/stdarg.h>
+#include <ac/string.h>
+
+#undef LDAP_F_PRE
+#define LDAP_F_PRE LDAP_F_EXPORT
+
+#include "lber-int.h"
+
+/*
+ * Print stuff
+ */
+static void
+ber_error_print( char *data )
+{
+ assert( data != NULL );
+
+ fputs( data, stderr );
+ fflush( stderr );
+}
+
+BER_LOG_PRINT_FN ber_pvt_log_print = ber_error_print;
+
+/*
+ * lber log
+ */
+
+static int ber_log_check( int errlvl, int loglvl )
+{
+ return errlvl & loglvl ? 1 : 0;
+}
+
+int ber_pvt_log_printf( int errlvl, int loglvl, const char *fmt, ... )
+{
+ char buf[ 1024 ];
+ va_list ap;
+
+ assert( fmt != NULL );
+
+ if ( !ber_log_check( errlvl, loglvl )) {
+ return 0;
+ }
+
+ va_start( ap, fmt );
+
+#ifdef HAVE_VSNPRINTF
+ buf[sizeof(buf) - 1] = '\0';
+ vsnprintf( buf, sizeof(buf)-1, fmt, ap );
+#elif HAVE_VSPRINTF
+ vsprintf( buf, fmt, ap ); /* hope it's not too long */
+#else
+ /* use doprnt() */
+#error "vsprintf() required."
+#endif
+
+ va_end(ap);
+
+ (*ber_pvt_log_print)( buf );
+ return 1;
+}
+
+static int ber_log_puts(int errlvl, int loglvl, char *buf)
+{
+ assert( buf != NULL );
+
+ if ( !ber_log_check( errlvl, loglvl )) {
+ return 0;
+ }
+
+ (*ber_pvt_log_print)( buf );
+ return 1;
+}
/*
* Print arbitrary stuff, for debugging.
*/
-#ifdef LDAP_DEBUG
+int
+ber_log_bprint(int errlvl,
+ int loglvl,
+ const char *data,
+ ber_len_t len )
+{
+ assert( data != NULL );
-#ifndef NO_USERINTERFACE
-#define BPLEN 48
+ if ( !ber_log_check( errlvl, loglvl )) {
+ return 0;
+ }
+
+ ber_bprint(data, len);
+ return 1;
+}
void
-lber_bprint( char *data, int len )
+ber_bprint(
+ LDAP_CONST char *data,
+ ber_len_t len )
{
- static char hexdig[] = "0123456789abcdef";
+ static const char hexdig[] = "0123456789abcdef";
+#define BPLEN 48
char out[ BPLEN ];
+ char buf[ BPLEN + sizeof("\t%s\n") ];
int i = 0;
+ assert( data != NULL );
+
memset( out, 0, BPLEN );
for ( ;; ) {
if ( len < 1 ) {
- fprintf( stderr, "\t%s\n", ( i == 0 ) ? "(end)" : out );
+ sprintf( buf, "\t%s\n", ( i == 0 ) ? "(end)" : out );
+ (*ber_pvt_log_print)( buf );
break;
}
-#ifndef HEX
+#ifndef LDAP_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
+ out[ i ] = hexdig[ ( *data & 0xf0U ) >> 4 ];
+ out[ i+1 ] = hexdig[ *data & 0x0fU ];
+#ifndef LDAP_HEX
}
#endif
i += 2;
data++;
if ( i > BPLEN - 2 ) {
- fprintf( stderr, "\t%s\n", out );
+ char data[128 + BPLEN];
+ sprintf( data, "\t%s\n", out );
+ (*ber_pvt_log_print)(data);
memset( out, 0, BPLEN );
i = 0;
continue;
out[ i++ ] = ' ';
}
}
-#else /* NO_USERINTERFACE */
+
+int
+ber_log_dump(
+ int errlvl,
+ int loglvl,
+ const BerElement *ber,
+ int inout )
+{
+ assert( ber != NULL );
+ assert( BER_VALID( ber ) );
+
+ if ( !ber_log_check( errlvl, loglvl )) {
+ return 0;
+ }
+
+ ber_dump(ber, inout);
+ return 1;
+}
+
void
-lber_bprint( char *data, int len )
+ber_dump(
+ LDAP_CONST BerElement *ber,
+ int inout )
+{
+ char buf[132];
+
+ assert( ber != NULL );
+ assert( BER_VALID( ber ) );
+
+ sprintf( buf, "ber_dump: buf 0x%lx, ptr 0x%lx, end 0x%lx\n",
+ (long) ber->ber_buf,
+ (long) ber->ber_ptr,
+ (long) ber->ber_end );
+
+ (*ber_pvt_log_print)( buf );
+
+ if ( inout == 1 ) {
+ sprintf( buf, " current len %ld, contents:\n",
+ (long) (ber->ber_end - ber->ber_ptr) );
+ ber_bprint( ber->ber_ptr, ber->ber_end - ber->ber_ptr );
+
+ } else {
+ sprintf( buf, " current len %ld, contents:\n",
+ (long) (ber->ber_ptr - ber->ber_buf) );
+
+ ber_bprint( ber->ber_buf, ber->ber_ptr - ber->ber_buf );
+ }
+}
+
+int
+ber_log_sos_dump(
+ int errlvl,
+ int loglvl,
+ const Seqorset *sos )
{
+ assert( sos != NULL );
+
+ if ( !ber_log_check( errlvl, loglvl )) {
+ return 0;
+ }
+
+ ber_sos_dump( sos );
+ return 1;
}
-#endif /* NO_USERINTERFACE */
-#endif
+void
+ber_sos_dump(
+ LDAP_CONST Seqorset *sos )
+{
+ char buf[132];
+
+ assert( sos != NULL );
+
+ (*ber_pvt_log_print)( "*** sos dump ***\n" );
+
+ while ( sos != NULL ) {
+ sprintf( buf, "ber_sos_dump: clen %ld first 0x%lx ptr 0x%lx\n",
+ (long) sos->sos_clen,
+ (long) sos->sos_first,
+ (long) sos->sos_ptr );
+ (*ber_pvt_log_print)( buf );
+
+ sprintf( buf, " current len %ld contents:\n",
+ (long) (sos->sos_ptr - sos->sos_first) );
+ (*ber_pvt_log_print)( buf );
+
+ ber_bprint( sos->sos_first, sos->sos_ptr - sos->sos_first );
+
+ sos = sos->sos_next;
+ }
+
+ (*ber_pvt_log_print)( "*** end dump ***\n" );
+}
/* decode.c - ber input decoding routines */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* VARARGS */
ber_tag_t
-ber_scanf
-#if HAVE_STDARG
- ( BerElement *ber,
+ber_scanf ( BerElement *ber,
LDAP_CONST char *fmt,
... )
-#else
- ( va_alist )
-va_dcl
-#endif
{
va_list ap;
-#ifndef HAVE_STDARG
- BerElement *ber;
- char *fmt;
-#endif
LDAP_CONST char *fmt_reset;
char *last;
char *s, **ss, ***sss;
ber_tag_t rc, tag;
ber_len_t len;
-#ifdef HAVE_STDARG
va_start( ap, fmt );
-#else
- va_start( ap );
- ber = va_arg( ap, BerElement * );
- fmt = va_arg( ap, char * );
-#endif
assert( ber != NULL );
assert( fmt != NULL );
* Error. Reclaim malloced memory that was given to the caller.
* Set allocated pointers to NULL, "data length" outvalues to 0.
*/
-#ifdef HAVE_STDARG
va_start( ap, fmt );
-#else
- va_start( ap );
- (void) va_arg( ap, BerElement * );
- (void) va_arg( ap, char * );
-#endif
for ( ; fmt_reset < fmt; fmt_reset++ ) {
switch ( *fmt_reset ) {
/* dtest.c - lber decoding test program */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* encode.c - ber output encoding routines */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* VARARGS */
int
-ber_printf
-#ifdef HAVE_STDARG
- ( BerElement *ber,
- LDAP_CONST char *fmt,
- ... )
-#else
- ( va_alist )
-va_dcl
-#endif
+ber_printf( BerElement *ber, LDAP_CONST char *fmt, ... )
{
va_list ap;
-#ifndef HAVE_STDARG
- BerElement *ber;
- char *fmt;
-#endif
char *s, **ss;
struct berval *bv, **bvp;
int rc;
ber_int_t i;
ber_len_t len;
-#ifdef HAVE_STDARG
- va_start( ap, fmt );
-#else
- va_start( ap );
- ber = va_arg( ap, BerElement * );
- fmt = va_arg( ap, char * );
-#endif
-
assert( ber != NULL );
assert( fmt != NULL );
assert( BER_VALID( ber ) );
+ va_start( ap, fmt );
+
for ( rc = 0; *fmt && rc != -1; fmt++ ) {
switch ( *fmt ) {
case '!': { /* hook */
/* test.c - lber encoding test program */
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include <unix.h>
-#include <fcntl.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_CONSOLE_H
#include <console.h>
-#else /* MACOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* MACOS */
+#endif /* HAVE_CONSOLE_H */
+
#include "lber.h"
-static usage( char *name )
+static void usage( char *name )
{
fprintf( stderr, "usage: %s fmtstring\n", name );
}
+static char* getbuf() {
+ char *p;
+ static char buf[128];
+
+ if ( fgets( buf, sizeof(buf), stdin ) == NULL )
+ return NULL;
+
+ if ( (p = strchr( buf, '\n' )) != NULL )
+ *p = '\0';
+
+ return buf;
+}
+
+int
main( int argc, char **argv )
{
- int i, num, len;
- char *s, *p;
- Seqorset *sos = NULLSEQORSET;
+ char *s;
+
+ int fd, rc;
BerElement *ber;
- Sockbuf sb;
- extern char *optarg;
+ Sockbuf *sb;
+
+ /* enable debugging */
+ int ival = -1;
+ ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &ival );
if ( argc < 2 ) {
usage( argv[0] );
- exit( 1 );
+ return( EXIT_FAILURE );
}
- bzero( &sb, sizeof(sb) );
- sb.sb_sd = 1;
- sb.sb_ber.ber_buf = NULL;
-
-#ifdef MACOS
+#ifdef HAVE_CONSOLE_H
ccommand( &argv );
cshow( stdout );
- if (( sb.sb_sd = open( "lber-test", O_WRONLY|O_CREAT|O_TRUNC|O_BINARY ))
+ if (( fd = open( "lber-test", O_WRONLY|O_CREAT|O_TRUNC|O_BINARY ))
< 0 ) {
perror( "open" );
- exit( 1 );
+ return( EXIT_FAILURE );
}
-#endif /* MACOS */
- if ( (ber = ber_alloc()) == NULLBER ) {
- perror( "ber_alloc" );
- exit( 1 );
+#else
+ fd = fileno(stdout);
+#endif
+
+ sb = ber_sockbuf_alloc_fd( fd );
+
+ if( sb == NULL ) {
+ perror( "ber_sockbuf_alloc_fd" );
+ return( EXIT_FAILURE );
}
- num = 7;
- if ( ber_printf( ber, "{ti}", 0x1f44, num ) == -1 ) {
- fprintf( stderr, "ber_printf returns -1" );
- exit( 1 );
+ if ( (ber = ber_alloc_t( LBER_USE_DER )) == NULL ) {
+ perror( "ber_alloc" );
+ return( EXIT_FAILURE );
}
- if ( ber_flush( &sb, ber, 1 ) == -1 ) {
- perror( "ber_flush" );
- exit( 1 );
+ fprintf(stderr, "encode: start\n" );
+ if( ber_printf( ber, "{" /*}*/ ) ) {
+ perror( "ber_printf {" /*}*/ );
+ return( EXIT_FAILURE );
}
-#ifdef notdef
+
for ( s = argv[1]; *s; s++ ) {
- if ( fgets( buf, sizeof(buf), stdin ) == NULL )
- break;
- if ( (p = strchr( buf, '\n' )) != NULL )
- *p = '\0';
+ char *buf;
+ char fmt[2];
+ fmt[0] = *s;
+ fmt[1] = '\0';
+
+ fprintf(stderr, "encode: %s\n", fmt );
switch ( *s ) {
case 'i': /* int */
case 'b': /* boolean */
- i = atoi( buf );
- if ( ber_printf( ber, "i", i ) == -1 ) {
- fprintf( stderr, "ber_printf i\n" );
- exit( 1 );
- }
- break;
-
case 'e': /* enumeration */
- i = va_arg( ap, int );
- rc = ber_put_enum( ber, i, (char)ber->ber_tag );
+ buf = getbuf();
+ rc = ber_printf( ber, fmt, atoi(buf) );
break;
case 'n': /* null */
- rc = ber_put_null( ber, (char)ber->ber_tag );
+ case '{': /* begin sequence */
+ case '}': /* end sequence */
+ case '[': /* begin set */
+ case ']': /* end set */
+ rc = ber_printf( ber, fmt );
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, (char)ber->ber_tag );
- break;
-
- case 's': /* string */
- s = va_arg( ap, char * );
- rc = ber_put_string( ber, s, (char)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, (char)ber->ber_tag );
+ buf = getbuf();
+ rc = ber_printf( ber, fmt, buf, strlen(buf) );
break;
+ case 's': /* string */
case 't': /* tag for the next element */
- ber->ber_tag = va_arg( ap, int );
- 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],
- (char)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, (char)ber->ber_tag )) == -1 )
- break;
- }
- break;
-
- case '{': /* begin sequence */
- rc = ber_start_seq( ber, (char)ber->ber_tag );
- break;
-
- case '}': /* end sequence */
- rc = ber_put_seqorset( ber );
- break;
-
- case '[': /* begin set */
- rc = ber_start_set( ber, (char)ber->ber_tag );
- break;
-
- case ']': /* end set */
- rc = ber_put_seqorset( ber );
+ buf = getbuf();
+ rc = ber_printf( ber, fmt, buf );
break;
default:
-#ifndef NO_USERINTERFACE
- fprintf( stderr, "unknown fmt %c\n", *fmt );
-#endif /* NO_USERINTERFACE */
+ fprintf( stderr, "encode: unknown fmt %c\n", *fmt );
rc = -1;
break;
}
+
+ if( rc == -1 ) {
+ perror( "ber_printf" );
+ return( EXIT_FAILURE );
}
}
-#endif
+ fprintf(stderr, "encode: end\n" );
+ if( ber_printf( ber, /*{*/ "}" ) == -1 ) {
+ perror( /*{*/ "ber_printf }" );
+ return( EXIT_FAILURE );
+ }
+
+ if ( ber_flush( sb, ber, 1 ) == -1 ) {
+ perror( "ber_flush" );
+ return( EXIT_FAILURE );
+ }
- return( 0 );
+ ber_sockbuf_free( sb );
+ return( EXIT_SUCCESS );
}
/* idtest.c - ber decoding test program using isode libraries */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* io.c - ber general i/o routines */
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
-
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS || _WIN32 */
-
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined(NeXT) || defined(VMS)
-#include <stdlib.h>
-#else /* next || vms */
-#include <malloc.h>
-#endif /* next || vms */
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#ifdef PCNFS
-#include <tklib.h>
-#endif /* PCNFS */
-#endif /* MACOS */
-
-#ifndef VMS
-#include <memory.h>
-#endif
-#include <string.h>
-#include "lber.h"
-#ifdef _WIN32
-#include <winsock.h>
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_IO_H
#include <io.h>
-#endif /* _WIN32 */
-
-#ifdef NEEDPROTOS
-static int ber_realloc( BerElement *ber, unsigned long len );
-static int ber_filbuf( Sockbuf *sb, long len );
-static long BerRead( Sockbuf *sb, char *buf, long len );
-#ifdef PCNFS
-static int BerWrite( Sockbuf *sb, char *buf, long len );
-#endif /* PCNFS */
-#else
-int ber_filbuf();
-long BerRead();
-static int ber_realloc();
-#endif /* NEEDPROTOS */
-
-#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 MACOS
-/*
- * 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), (l<MAX_WRITE)? l : MAX_WRITE )
-#else /* MACOS */
-#ifdef DOS
-#ifdef PCNFS
-/*
- * PCNFS (under DOS)
- */
-#define read( s, b, l ) recv( s, b, l, 0 )
-#define BerWrite( s, b, l ) send( s->sb_sd, b, (int) l, 0 )
-#endif /* PCNFS */
-#ifdef NCSA
-/*
- * NCSA Telnet TCP/IP stack (under DOS)
- */
-#define read( s, b, l ) nread( s, b, l )
-#define BerWrite( s, b, l ) netwrite( s->sb_sd, b, l )
-#endif /* NCSA */
-#ifdef WINSOCK
-/*
- * Windows Socket API (under DOS/Windows 3.x)
- */
-#define read( s, b, l ) recv( s, b, l, 0 )
-#define BerWrite( s, b, l ) send( s->sb_sd, b, l, 0 )
-#endif /* WINSOCK */
-#else /* DOS */
-#ifdef _WIN32
-/*
- * 32-bit Windows Socket API (under Windows NT or Windows 95)
- */
-#define read( s, b, l ) recv( s, b, l, 0 )
-#define BerWrite( s, b, l ) send( s->sb_sd, b, l, 0 )
-#else /* _WIN32 */
-#ifdef VMS
-/*
- * VMS -- each write must be 64K or smaller
- */
-#define MAX_WRITE 65535
-#define BerWrite( sb, b, l ) write( sb->sb_sd, b, (l<MAX_WRITE)? l : MAX_WRITE)
-#else /* VMS */
-/*
- * everything else (Unix/BSD 4.3 socket API)
- */
-#define BerWrite( sb, b, l ) write( sb->sb_sd, b, l )
-#endif /* VMS */
-#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 /* DOS */
-#endif /* MACOS */
-
-#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 */
+#endif
-#define EXBUFSIZ 1024
+#undef LDAP_F_PRE
+#define LDAP_F_PRE LDAP_F_EXPORT
-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 *) malloc( READBUFSIZ )) ==
- NULL )
- return( -1 );
- sb->sb_ber.ber_ptr = sb->sb_ber.ber_buf;
- sb->sb_ber.ber_end = sb->sb_ber.ber_buf;
- }
+#include "lber-int.h"
- if ( sb->sb_naddr > 0 ) {
-#ifdef CLDAP
- rc = udp_read(sb, sb->sb_ber.ber_buf, READBUFSIZ, addrlen );
-#ifdef LDAP_DEBUG
- if ( lber_debug ) {
- fprintf( stderr, "ber_filbuf udp_read %d bytes\n",
- rc );
- if ( lber_debug > 1 && rc > 0 )
- lber_bprint( sb->sb_ber.ber_buf, rc );
- }
-#endif /* LDAP_DEBUG */
-#else /* CLDAP */
- rc = -1;
-#endif /* CLDAP */
- } else {
- rc = read( sb->sb_sd, sb->sb_ber.ber_buf,
- ((sb->sb_options & LBER_NO_READ_AHEAD) &&
- (len < READBUFSIZ)) ?
- len : READBUFSIZ );
- }
+static ber_slen_t BerRead LDAP_P((
+ Sockbuf *sb,
+ char *buf,
+ ber_len_t len ));
- 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 );
- }
+static int ber_realloc LDAP_P((
+ BerElement *ber,
+ ber_len_t len ));
- return( -1 );
-}
+#define EXBUFSIZ 1024
+/* probably far too large... */
+#define MAX_BERBUFSIZE (128*1024)
-long
-BerRead( Sockbuf *sb, char *buf, long len )
+#if defined( DOS ) && !defined( _WIN32 ) && (MAX_BERBUFSIZE > 65535)
+# undef MAX_BERBUFSIZE
+# define MAX_BERBUFSIZE 65535
+#endif
+
+static ber_slen_t
+BerRead(
+ Sockbuf *sb,
+ char *buf,
+ ber_len_t len )
{
- int c;
- long nread = 0;
+ ber_slen_t c;
+ ber_slen_t nread = 0;
+
+ assert( sb != NULL );
+ assert( buf != NULL );
+
+ assert( SOCKBUF_VALID( sb ) );
while ( len > 0 ) {
- if ( (c = bergetc( sb, len )) < 0 ) {
+ if ( (c = ber_pvt_sb_read( sb, buf, len )) <= 0 ) {
if ( nread > 0 )
break;
return( c );
}
- *buf++ = c;
- nread++;
- len--;
+ buf+= c;
+ nread+=c;
+ len-=c;
}
return( nread );
}
-
-long
-ber_read( BerElement *ber, char *buf, unsigned long len )
+ber_slen_t
+ber_read(
+ BerElement *ber,
+ char *buf,
+ ber_len_t len )
{
- unsigned long actuallen, nleft;
+ ber_len_t actuallen, nleft;
+
+ assert( ber != NULL );
+ assert( buf != NULL );
+
+ assert( BER_VALID( ber ) );
nleft = ber->ber_end - ber->ber_ptr;
actuallen = nleft < len ? nleft : len;
- SAFEMEMCPY( buf, ber->ber_ptr, (size_t)actuallen );
+ SAFEMEMCPY( buf, ber->ber_ptr, actuallen );
ber->ber_ptr += actuallen;
- return( (long)actuallen );
+ return( (ber_slen_t) actuallen );
}
-long
-ber_write( BerElement *ber, char *buf, unsigned long len, int nosos )
+ber_slen_t
+ber_write(
+ BerElement *ber,
+ LDAP_CONST char *buf,
+ ber_len_t len,
+ int nosos )
{
+ assert( ber != NULL );
+ assert( buf != NULL );
+
+ assert( BER_VALID( ber ) );
+
if ( nosos || ber->ber_sos == NULL ) {
if ( ber->ber_ptr + len > ber->ber_end ) {
if ( ber_realloc( ber, len ) != 0 )
}
SAFEMEMCPY( ber->ber_ptr, buf, (size_t)len );
ber->ber_ptr += len;
- return( len );
+ return( (ber_slen_t) len );
+
} else {
if ( ber->ber_sos->sos_ptr + len > ber->ber_end ) {
if ( ber_realloc( ber, len ) != 0 )
SAFEMEMCPY( ber->ber_sos->sos_ptr, buf, (size_t)len );
ber->ber_sos->sos_ptr += len;
ber->ber_sos->sos_clen += len;
- return( len );
+ return( (ber_slen_t) len );
}
}
static int
-ber_realloc( BerElement *ber, unsigned long len )
+ber_realloc( BerElement *ber, ber_len_t len )
{
- unsigned long need, have, total;
+ ber_len_t need, have, total;
Seqorset *s;
long off;
char *oldbuf;
+ assert( ber != NULL );
+ assert( len > 0 );
+
+ assert( BER_VALID( ber ) );
+
have = (ber->ber_end - ber->ber_buf) / EXBUFSIZ;
need = (len < EXBUFSIZ ? 1 : (len + (EXBUFSIZ - 1)) / EXBUFSIZ);
total = have * EXBUFSIZ + need * EXBUFSIZ;
oldbuf = ber->ber_buf;
+ ber->ber_buf = (char *) LBER_REALLOC( ber->ber_buf, total );
+
if ( ber->ber_buf == NULL ) {
- if ( (ber->ber_buf = (char *) malloc( (size_t)total )) == NULL )
- return( -1 );
- } else if ( (ber->ber_buf = (char *) realloc( ber->ber_buf,
- (size_t)total )) == NULL )
+ ber->ber_buf = oldbuf;
return( -1 );
+ }
ber->ber_end = ber->ber_buf + total;
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 ) {
+ for ( s = ber->ber_sos; s != NULL; s = s->sos_next ) {
off = s->sos_first - oldbuf;
s->sos_first = ber->ber_buf + off;
void
ber_free( BerElement *ber, int freebuf )
{
+#ifdef LDAP_MEMORY_DEBUG
+ assert( ber != NULL );
+#endif
+
+ if( ber == NULL ) {
+ return;
+ }
+
+ assert( BER_VALID( ber ) );
+
if ( freebuf && ber->ber_buf != NULL )
- free( ber->ber_buf );
- free( (char *) ber );
+ LBER_FREE( ber->ber_buf );
+
+ ber->ber_buf = NULL;
+ ber->ber_valid = LBER_UNINITIALIZED;
+
+ LBER_FREE( (char *) ber );
}
int
ber_flush( Sockbuf *sb, BerElement *ber, int freeit )
{
- long nwritten, towrite, rc;
+ ber_len_t nwritten, towrite;
+ ber_slen_t rc;
+
+ assert( sb != NULL );
+ assert( ber != NULL );
+
+ assert( SOCKBUF_VALID( ber ) );
+ assert( BER_VALID( ber ) );
if ( ber->ber_rwptr == NULL ) {
ber->ber_rwptr = ber->ber_buf;
}
towrite = ber->ber_ptr - ber->ber_rwptr;
-#ifdef LDAP_DEBUG
- if ( lber_debug ) {
- fprintf( stderr, "ber_flush: %ld bytes to sd %ld%s\n", towrite,
- sb->sb_sd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)"
+ if ( sb->sb_debug ) {
+ ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug,
+ "ber_flush: %ld bytes to sd %ld%s\n", towrite,
+ (long) sb->sb_sd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)"
: "" );
- if ( lber_debug > 1 )
- lber_bprint( ber->ber_rwptr, towrite );
+ ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
+ ber->ber_rwptr, towrite );
}
-#endif
-#if !defined(MACOS) && !defined(DOS)
+
+#if HAVE_WRITE
if ( sb->sb_options & (LBER_TO_FILE | LBER_TO_FILE_ONLY) ) {
- rc = write( sb->sb_fd, ber->ber_buf, towrite );
+ rc = write( sb->sb_fd, ber->ber_rwptr, towrite );
if ( sb->sb_options & LBER_TO_FILE_ONLY ) {
+ if ( freeit )
+ ber_free( ber, 1 );
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( MACOS ) && !defined( DOS )
- errno = EMSGSIZE;
-#endif
- return( -1 );
- }
- } else {
- if ( (rc = BerWrite( sb, ber->ber_rwptr,
- (size_t) towrite )) <= 0 ) {
- return( -1 );
- }
+ rc = ber_pvt_sb_write( sb, ber->ber_rwptr, towrite );
+ if (rc<=0) {
+ return -1;
}
towrite -= rc;
nwritten += rc;
{
BerElement *ber;
- if ( (ber = (BerElement *) calloc( 1, sizeof(BerElement) )) == NULLBER )
- return( NULLBER );
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ ber = (BerElement *) LBER_CALLOC( 1, sizeof(BerElement) );
+
+ if ( ber == NULL )
+ return( NULL );
+
+ ber->ber_valid = LBER_VALID_BERELEMENT;
ber->ber_tag = LBER_DEFAULT;
ber->ber_options = options;
+ ber->ber_debug = ber_int_debug;
+ assert( BER_VALID( ber ) );
return( ber );
}
BerElement *
-ber_alloc()
+ber_alloc( void ) /* deprecated */
{
return( ber_alloc_t( 0 ) );
}
BerElement *
-der_alloc()
+der_alloc( void ) /* deprecated */
{
return( ber_alloc_t( LBER_USE_DER ) );
}
BerElement *
-ber_dup( BerElement *ber )
+ber_dup( LDAP_CONST BerElement *ber )
{
BerElement *new;
- if ( (new = ber_alloc()) == NULLBER )
- return( NULLBER );
+ assert( ber != NULL );
+ assert( BER_VALID( ber ) );
+
+ if ( (new = ber_alloc_t( ber->ber_options )) == NULL ) {
+ return( NULL );
+ }
*new = *ber;
+ assert( BER_VALID( new ) );
return( new );
}
+/* OLD U-Mich ber_init() */
void
-ber_init( BerElement *ber, int options )
+ber_init_w_nullc( BerElement *ber, int options )
{
+ assert( ber != NULL );
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
(void) memset( (char *)ber, '\0', sizeof( BerElement ));
+ ber->ber_valid = LBER_VALID_BERELEMENT;
ber->ber_tag = LBER_DEFAULT;
- ber->ber_options = options;
-}
+ ber->ber_options = (char) options;
+ ber->ber_debug = ber_int_debug;
+ assert( BER_VALID( ber ) );
+}
-void
-ber_reset( BerElement *ber, int was_writing )
+/* New C-API ber_init() */
+/* This function constructs a BerElement containing a copy
+** of the data in the bv argument.
+*/
+BerElement *
+ber_init( struct berval *bv )
{
- if ( was_writing ) {
- ber->ber_end = ber->ber_ptr;
- ber->ber_ptr = ber->ber_buf;
- } else {
- ber->ber_ptr = ber->ber_end;
+ BerElement *ber;
+
+ assert( bv != NULL );
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if ( bv == NULL ) {
+ return NULL;
}
- ber->ber_rwptr = NULL;
-}
+ ber = ber_alloc_t( 0 );
+ if( ber == NULL ) {
+ /* allocation failed */
+ return ( NULL );
+ }
-#ifdef LDAP_DEBUG
+ /* copy the data */
+ if ( ( (ber_len_t) ber_write ( ber, bv->bv_val, bv->bv_len, 0 )) != bv->bv_len ) {
+ /* write failed, so free and return NULL */
+ ber_free( ber, 1 );
+ return( NULL );
+ }
-void
-ber_dump( BerElement *ber, int inout )
+ ber_reset( ber, 1 ); /* reset the pointer to the start of the buffer */
+
+ return ( ber );
+}
+
+/* New C-API ber_flatten routine */
+/* This routine allocates a struct berval whose contents are a BER
+** encoding taken from the ber argument. The bvPtr pointer pointers to
+** the returned berval.
+*/
+int ber_flatten(
+ LDAP_CONST BerElement *ber,
+ struct berval **bvPtr)
{
- fprintf( stderr, "ber_dump: buf 0x%lx, ptr 0x%lx, end 0x%lx\n",
- ber->ber_buf, ber->ber_ptr, ber->ber_end );
- if ( inout == 1 ) {
- fprintf( stderr, " current len %ld, contents:\n",
- ber->ber_end - ber->ber_ptr );
- lber_bprint( ber->ber_ptr, ber->ber_end - ber->ber_ptr );
+ struct berval *bv;
+
+ assert( bvPtr != NULL );
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if(bvPtr == NULL) {
+ return( -1 );
+ }
+
+ if ( (bv = LBER_MALLOC( sizeof(struct berval))) == NULL ) {
+ return( -1 );
+ }
+
+ if ( ber == NULL ) {
+ /* ber is null, create an empty berval */
+ bv->bv_val = NULL;
+ bv->bv_len = 0;
+
} else {
- fprintf( stderr, " current len %ld, contents:\n",
- ber->ber_ptr - ber->ber_buf );
- lber_bprint( ber->ber_buf, ber->ber_ptr - ber->ber_buf );
+ /* copy the berval */
+ ber_len_t len = ber->ber_ptr - ber->ber_buf;
+
+ if ( (bv->bv_val = (char *) LBER_MALLOC( len + 1 )) == NULL ) {
+ ber_bvfree( bv );
+ return( -1 );
+ }
+
+ SAFEMEMCPY( bv->bv_val, ber->ber_buf, len );
+ bv->bv_val[len] = '\0';
+ bv->bv_len = len;
}
+
+ *bvPtr = bv;
+ return( 0 );
}
void
-ber_sos_dump( Seqorset *sos )
+ber_reset( BerElement *ber, int was_writing )
{
- fprintf( stderr, "*** sos dump ***\n" );
- while ( sos != NULLSEQORSET ) {
- fprintf( stderr, "ber_sos_dump: clen %ld first 0x%lx ptr 0x%lx\n",
- sos->sos_clen, sos->sos_first, sos->sos_ptr );
- fprintf( stderr, " current len %ld contents:\n",
- sos->sos_ptr - sos->sos_first );
- lber_bprint( sos->sos_first, sos->sos_ptr - sos->sos_first );
-
- sos = sos->sos_next;
+ assert( ber != NULL );
+ assert( BER_VALID( ber ) );
+
+ if ( was_writing ) {
+ ber->ber_end = ber->ber_ptr;
+ ber->ber_ptr = ber->ber_buf;
+ } else {
+ ber->ber_ptr = ber->ber_end;
}
- fprintf( stderr, "*** end dump ***\n" );
-}
-#endif
+ ber->ber_rwptr = NULL;
+}
+#if 0
/* return the tag - LBER_DEFAULT returned means trouble */
-static unsigned long
+static ber_tag_t
get_tag( Sockbuf *sb )
{
unsigned char xbyte;
- unsigned long tag;
+ ber_tag_t tag;
char *tagp;
- int i;
+ unsigned int i;
+
+ assert( sb != NULL );
+ assert( SOCKBUF_VALID( sb ) );
- if ( BerRead( sb, (char *) &xbyte, 1 ) != 1 )
+ if ( ber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 )
return( LBER_DEFAULT );
if ( (xbyte & LBER_BIG_TAG_MASK) != LBER_BIG_TAG_MASK )
- return( (unsigned long) xbyte );
+ return( (ber_tag_t) xbyte );
tagp = (char *) &tag;
tagp[0] = xbyte;
- for ( i = 1; i < sizeof(long); i++ ) {
- if ( BerRead( sb, (char *) &xbyte, 1 ) != 1 )
+ for ( i = 1; i < sizeof(ber_tag_t); i++ ) {
+ if ( ber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 )
return( LBER_DEFAULT );
tagp[i] = xbyte;
}
/* tag too big! */
- if ( i == sizeof(long) )
+ if ( i == sizeof(ber_tag_t) )
return( LBER_DEFAULT );
/* want leading, not trailing 0's */
- return( tag >> (sizeof(long) - i - 1) );
+ return( tag >> (sizeof(ber_tag_t) - i - 1) );
}
+#endif
-unsigned long
-ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
+/*
+ * A rewrite of ber_get_next that can safely be called multiple times
+ * for the same packet. It will simply continue were it stopped until
+ * a full packet is read.
+ */
+
+ber_tag_t
+ber_get_next(
+ Sockbuf *sb,
+ ber_len_t *len,
+ BerElement *ber )
{
- unsigned long tag, netlen, toread;
- unsigned char lc;
- long rc;
- int noctets, diff;
-
-#ifdef LDAP_DEBUG
- if ( lber_debug )
- fprintf( stderr, "ber_get_next\n" );
-#endif
+ assert( sb != NULL );
+ assert( len != NULL );
+ assert( ber != NULL );
+
+ assert( SOCKBUF_VALID( sb ) );
+ assert( BER_VALID( ber ) );
+
+ ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
+ "ber_get_next\n" );
/*
* Any ber element looks like this: tag length contents.
* 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
- */
-
- if ( ber->ber_rwptr == NULL ) {
- /*
- * First, we read the tag.
- */
-
- if ( (tag = get_tag( sb )) == LBER_DEFAULT ) {
- return( LBER_DEFAULT );
- }
- ber->ber_tag = tag;
-
- /*
- * 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 (ber->ber_rwptr == NULL) {
+ /* XXYYZ
+ * dtest does like this assert.
*/
+ /* assert( ber->ber_buf == NULL ); */
+ ber->ber_rwptr = (char *) &ber->ber_tag;
+ ber->ber_tag = 0;
+ }
- *len = netlen = 0;
- if ( BerRead( sb, (char *) &lc, 1 ) != 1 ) {
- return( LBER_DEFAULT );
+#define PTR_IN_VAR( ptr, var )\
+(((ptr)>=(char *) &(var)) && ((ptr)< (char *) &(var)+sizeof(var)))
+
+ if (PTR_IN_VAR(ber->ber_rwptr, ber->ber_tag)) {
+ if (ber->ber_rwptr == (char *) &ber->ber_tag) {
+ if (ber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0)
+ return LBER_DEFAULT;
+ if ((ber->ber_rwptr[0] & LBER_BIG_TAG_MASK)
+ != LBER_BIG_TAG_MASK) {
+ ber->ber_tag = ber->ber_rwptr[0];
+ ber->ber_rwptr = (char *) &ber->ber_usertag;
+ goto get_lenbyte;
+ }
+ ber->ber_rwptr++;
}
- if ( lc & 0x80 ) {
- noctets = (lc & 0x7f);
- if ( noctets > sizeof(unsigned long) )
- return( LBER_DEFAULT );
- diff = sizeof(unsigned long) - noctets;
- if ( BerRead( sb, (char *) &netlen + diff, noctets ) !=
- noctets ) {
- return( LBER_DEFAULT );
+ do {
+ /* reading the tag... */
+ if (ber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0)
+ return LBER_DEFAULT;
+ if (! (ber->ber_rwptr[0] & LBER_MORE_TAG_MASK) ) {
+ ber->ber_tag>>=sizeof(ber->ber_tag) -
+ ((char *) &ber->ber_tag - ber->ber_rwptr);
+ ber->ber_rwptr = (char *) &ber->ber_usertag;
+ goto get_lenbyte;
+ }
+ } while (PTR_IN_VAR(ber->ber_rwptr,ber->ber_tag));
+ errno = ERANGE; /* this is a serious error. */
+ return LBER_DEFAULT;
+ }
+get_lenbyte:
+ if (ber->ber_rwptr==(char *) &ber->ber_usertag) {
+ unsigned char c;
+ if (ber_pvt_sb_read( sb, (char *) &c, 1)<=0)
+ return LBER_DEFAULT;
+ if (c & 0x80U) {
+ int len = c & 0x7fU;
+ if ( (len==0) || ( len>sizeof( ber->ber_len ) ) ) {
+ errno = ERANGE;
+ return LBER_DEFAULT;
}
- *len = LBER_NTOHL( netlen );
+ ber->ber_rwptr = (char *) &ber->ber_len +
+ sizeof(ber->ber_len) - len;
+ ber->ber_len = 0;
} 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 */
- return( LBER_DEFAULT );
+ ber->ber_len = c;
+ goto fill_buffer;
}
-#endif /* DOS && !_WIN32 */
-
- if ( ( sb->sb_options & LBER_MAX_INCOMING_SIZE ) &&
- *len > sb->sb_max_incoming ) {
- return( LBER_DEFAULT );
+ }
+ if (PTR_IN_VAR(ber->ber_rwptr, ber->ber_len)) {
+ ber_slen_t res;
+ ber_slen_t to_go;
+ to_go = (char *) &ber->ber_len + sizeof( ber->ber_len ) -
+ ber->ber_rwptr;
+ assert( to_go > 0 );
+ res = ber_pvt_sb_read( sb, ber->ber_rwptr, to_go );
+ if (res <=0)
+ return LBER_DEFAULT;
+ ber->ber_rwptr += res;
+ if (res==to_go) {
+ /* convert length. */
+ ber->ber_len = LBER_LEN_NTOH( ber->ber_len );
+ goto fill_buffer;
+ } else {
+#if defined( EWOULDBLOCK )
+ errno = EWOULDBLOCK;
+#elif defined( EAGAIN )
+ errno = EAGAIN;
+#endif
+ return LBER_DEFAULT;
}
-
- if ( (ber->ber_buf = (char *) malloc( (size_t)*len )) == NULL ) {
- return( LBER_DEFAULT );
+ }
+fill_buffer:
+ /* now fill the buffer. */
+ if (ber->ber_buf==NULL) {
+ if (ber->ber_len > MAX_BERBUFSIZE) {
+ errno = ERANGE;
+ return LBER_DEFAULT;
}
- ber->ber_ptr = ber->ber_buf;
- ber->ber_end = ber->ber_buf + *len;
+ ber->ber_buf = (char *) LBER_MALLOC( ber->ber_len );
+ if (ber->ber_buf==NULL)
+ return LBER_DEFAULT;
ber->ber_rwptr = ber->ber_buf;
+ ber->ber_ptr = ber->ber_buf;
+ ber->ber_end = ber->ber_buf + ber->ber_len;
}
-
- 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 );
+ if ((ber->ber_rwptr>=ber->ber_buf) && (ber->ber_rwptr<ber->ber_end)) {
+ ber_slen_t res;
+ ber_slen_t to_go;
+
+ to_go = ber->ber_end - ber->ber_rwptr;
+ assert( to_go > 0 );
+
+ res = ber_pvt_sb_read( sb, ber->ber_rwptr, to_go );
+ if (res<=0)
+ return LBER_DEFAULT;
+ ber->ber_rwptr+=res;
+
+ if (res<to_go) {
+#if defined( EWOULDBLOCK )
+ errno = EWOULDBLOCK;
+#elif defined( EAGAIN )
+ errno = EAGAIN;
+#endif
+ return LBER_DEFAULT;
}
-
- toread -= rc;
- ber->ber_rwptr += rc;
- } while ( toread > 0 );
-
-#ifdef LDAP_DEBUG
- if ( lber_debug ) {
- fprintf( stderr, "ber_get_next: tag 0x%lx len %ld contents:\n",
- tag, ber->ber_len );
- if ( lber_debug > 1 )
- ber_dump( ber, 1 );
+
+ ber->ber_rwptr = NULL;
+ *len = ber->ber_len;
+ if ( ber->ber_debug ) {
+ ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
+ "ber_get_next: tag 0x%lx len %ld contents:\n",
+ ber->ber_tag, ber->ber_len );
+ ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
+ }
+ return (ber->ber_tag);
}
-#endif
-
- *len = ber->ber_len;
- ber->ber_rwptr = NULL;
- return( ber->ber_tag );
+ assert( 0 ); /* ber structure is messed up ?*/
+ return LBER_DEFAULT;
}
+/* $OpenLDAP$ */
/*
* Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+#include "portable.h"
+
+#include <ac/stdlib.h>
+#include <ac/string.h>
+
+#undef LDAP_F_PRE
+#define LDAP_F_PRE LDAP_F_EXPORT
+
+#include "lber-int.h"
+
+#if LDAP_MEMORY_DEBUG
+struct ber_mem_hdr {
+ union bmu_align_u {
+ ber_len_t bmu_len_t;
+ ber_tag_t bmu_tag_t;
+ ber_int_t bmu_int_t;
+
+ size_t bmu_size_t;
+ void * bmu_voidp;
+ double bmu_double;
+ long bmu_long;
+ long (*bmu_funcp)( double );
+ char bmu_char[4];
+ } ber_align;
+#define bm_junk ber_align.bmu_len_t
+#define bm_data ber_align.bmu_char[1]
+};
+#define BER_MEM_JUNK 0xddeeddeeU
+static const struct ber_mem_hdr ber_int_mem_hdr = { BER_MEM_JUNK };
+#define BER_MEM_BADADDR ((void *) &ber_int_mem_hdr.bm_data)
+#define BER_MEM_VALID(p) do { \
+ assert( (p) != BER_MEM_BADADDR ); \
+ assert( (p) != (void *) &ber_int_mem_hdr ); \
+ } while(0)
+#else
+#define BER_MEM_VALID(p) /* no-op */
+#endif
+
+BerMemoryFunctions *ber_int_memory_fns = NULL;
+
+#if 0 && defined( LDAP_MEMORY_DEBUG )
+void
+ber_int_memfree( void **p )
+{
+ assert( p != NULL );
+ BER_MEM_VALID( *p );
+
+ ber_memfree( p );
+
+ *p = BER_MEM_BADADDR;
+}
+#endif
+
+void
+ber_memfree( void *p )
+{
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if( p == NULL ) {
+ return;
+ }
+
+ BER_MEM_VALID( p );
+
+ if( ber_int_memory_fns == NULL ) {
+#ifdef LDAP_MEMORY_DEBUG
+ struct ber_mem_hdr *mh = (struct ber_mem_hdr *)
+ ((char *)p - sizeof(struct ber_mem_hdr));
+
+ assert( mh->bm_junk == BER_MEM_JUNK );
+ mh->bm_junk = ~BER_MEM_JUNK;
+ free( mh );
+#else
+ free( p );
+#endif
+ return;
+ }
+
+ assert( ber_int_memory_fns->bmf_free );
+
+
+ (*ber_int_memory_fns->bmf_free)( p );
+}
+
+
+void
+ber_memvfree( void **vec )
+{
+ int i;
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if( vec == NULL ) {
+ return;
+ }
+
+ BER_MEM_VALID( vec );
+
+ for ( i = 0; vec[i] != NULL; i++ ) {
+ LBER_FREE( vec[i] );
+ }
+
+ LBER_FREE( vec );
+}
+
+
+void *
+ber_memalloc( ber_len_t s )
+{
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+#ifdef LDAP_MEMORY_DEBUG
+ assert( s != 0 );
+#endif
+
+ if( s == 0 ) {
+ return NULL;
+ }
+
+ if( ber_int_memory_fns == NULL ) {
+#ifdef LDAP_MEMORY_DEBUG
+ struct ber_mem_hdr *mh = malloc(s + sizeof(struct ber_mem_hdr));
+
+ if( mh == NULL ) return NULL;
+
+ mh->bm_junk = BER_MEM_JUNK;
+
+ BER_MEM_VALID( &mh[1] );
+ return &mh[1];
+#else
+ return malloc( s );
+#endif
+ }
+
+ assert( ber_int_memory_fns->bmf_malloc );
+
+ return (*ber_int_memory_fns->bmf_malloc)( s );
+}
+
+
+void *
+ber_memcalloc( ber_len_t n, ber_len_t s )
+{
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+#ifdef LDAP_MEMORY_DEBUG
+ assert( n != 0 && s != 0);
+#endif
+
+ if( n == 0 || s == 0 ) {
+ return NULL;
+ }
+
+ if( ber_int_memory_fns == NULL ) {
+#ifdef LDAP_MEMORY_DEBUG
+ struct ber_mem_hdr *mh = calloc(1,
+ (n * s) + sizeof(struct ber_mem_hdr) );
+
+ mh->bm_junk = BER_MEM_JUNK;
+
+ BER_MEM_VALID( &mh[1] );
+ return &mh[1];
+#else
+ return calloc( n, s );
+#endif
+ }
+
+ assert( ber_int_memory_fns->bmf_calloc );
+
+ return (*ber_int_memory_fns->bmf_calloc)( n, s );
+}
+
+
+void *
+ber_memrealloc( void* p, ber_len_t s )
+{
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ /* realloc(NULL,s) -> malloc(s) */
+ if( p == NULL ) {
+ return ber_memalloc( s );
+ }
+
+ /* realloc(p,0) -> free(p) */
+ if( s == 0 ) {
+ ber_memfree( p );
+ return NULL;
+ }
+
+ BER_MEM_VALID( p );
+
+ if( ber_int_memory_fns == NULL ) {
+#ifdef LDAP_MEMORY_DEBUG
+ struct ber_mem_hdr *mh = (struct ber_mem_hdr *)
+ ((char *)p - sizeof(struct ber_mem_hdr));
+ assert( mh->bm_junk == BER_MEM_JUNK );
+
+ p = realloc( mh, s + sizeof(struct ber_mem_hdr) );
+
+ if( p == NULL ) return NULL;
+
+ mh = p;
+
+ assert( mh->bm_junk == BER_MEM_JUNK );
+
+ BER_MEM_VALID( &mh[1] );
+ return &mh[1];
+#else
+ return realloc( p, s );
+#endif
+ }
+
+ assert( ber_int_memory_fns->bmf_realloc );
+
+ return (*ber_int_memory_fns->bmf_realloc)( p, s );
+}
+
+
+void
+ber_bvfree( struct berval *bv )
+{
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if( bv == NULL ) {
+ return;
+ }
+
+ BER_MEM_VALID( bv );
+
+ if ( bv->bv_val != NULL )
+ LBER_FREE( bv->bv_val );
+
+ LBER_FREE( (char *) bv );
+}
+
+
+void
+ber_bvecfree( struct berval **bv )
+{
+ int i;
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if( bv == NULL ) {
+ return;
+ }
+
+ BER_MEM_VALID( bv );
+
+ for ( i = 0; bv[i] != NULL; i++ )
+ ber_bvfree( bv[i] );
+
+ LBER_FREE( (char *) bv );
+}
+
+
+struct berval *
+ber_bvdup(
+ LDAP_CONST struct berval *bv )
+{
+ struct berval *new;
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if( bv == NULL ) {
+ return NULL;
+ }
+
+ if(( new = LBER_MALLOC( sizeof(struct berval) )) == NULL ) {
+ return NULL;
+ }
+
+ if ( bv->bv_val == NULL ) {
+ new->bv_val = NULL;
+ new->bv_len = 0;
+ return new;
+ }
+
+ if(( new->bv_val = LBER_MALLOC( bv->bv_len + 1 )) == NULL ) {
+ LBER_FREE( new );
+ return NULL;
+ }
+
+ SAFEMEMCPY( new->bv_val, bv->bv_val, bv->bv_len );
+ new->bv_val[bv->bv_len] = '\0';
+ new->bv_len = bv->bv_len;
+
+ return( new );
+}
+
+char *
+ber_strdup( LDAP_CONST char *s )
+{
+ char *p;
+ size_t len;
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+#ifdef LDAP_MEMORY_DEBUG
+ assert(s != NULL); /* bv damn better point to something */
+#endif
+
+ if( s == NULL ) {
+ return( NULL );
+ }
+
+ len = strlen( s ) + 1;
+
+ if ( (p = LBER_MALLOC( len )) == NULL ) {
+ return( NULL );
+ }
+
+ SAFEMEMCPY( p, s, len );
+ return( p );
+}
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+#include "portable.h"
+
+#include <ac/stdlib.h>
+#include <ac/string.h>
+
+#undef LDAP_F_PRE
+#define LDAP_F_PRE LDAP_F_EXPORT
+
+#include "lber-int.h"
+
+struct lber_options ber_int_options = {
+ LBER_UNINITIALIZED, 0, 0 };
+
+int
+ber_get_option(
+ LDAP_CONST void *item,
+ int option,
+ void *outvalue)
+{
+ LDAP_CONST BerElement *ber;
+ LDAP_CONST Sockbuf *sb;
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if(outvalue == NULL) {
+ /* no place to get to */
+ return LBER_OPT_ERROR;
+ }
+
+ if(item == NULL) {
+ if(option == LBER_OPT_BER_DEBUG) {
+ * (int *) outvalue = ber_int_debug;
+ return LBER_OPT_SUCCESS;
+ }
+
+ return LBER_OPT_ERROR;
+ }
+
+ ber = item;
+ sb = item;
+
+ switch(option) {
+ case LBER_OPT_BER_OPTIONS:
+ assert( BER_VALID( ber ) );
+ * (int *) outvalue = ber->ber_options;
+ return LBER_OPT_SUCCESS;
+
+ case LBER_OPT_BER_DEBUG:
+ assert( BER_VALID( ber ) );
+ * (int *) outvalue = ber->ber_debug;
+ return LBER_OPT_SUCCESS;
+
+ default:
+ /* bad param */
+ break;
+ }
+
+ return LBER_OPT_ERROR;
+}
+
+int
+ber_set_option(
+ void *item,
+ int option,
+ LDAP_CONST void *invalue)
+{
+ BerElement *ber;
+ Sockbuf *sb;
+
+ if( (ber_int_options.lbo_valid == LBER_UNINITIALIZED)
+ && ( ber_int_memory_fns == NULL )
+ && ( option == LBER_OPT_MEMORY_FNS )
+ && ( invalue != NULL ))
+ {
+ const BerMemoryFunctions *f =
+ (const BerMemoryFunctions *) invalue;
+
+ /* make sure all functions are provided */
+ if(!( f->bmf_malloc && f->bmf_calloc
+ && f->bmf_realloc && f->bmf_free ))
+ {
+ return LBER_OPT_ERROR;
+ }
+
+ ber_int_memory_fns = (BerMemoryFunctions *)
+ (*(f->bmf_malloc))(sizeof(BerMemoryFunctions));
+
+ if ( ber_int_memory_fns == NULL ) {
+ return LBER_OPT_ERROR;
+ }
+
+ memcpy(ber_int_memory_fns, f, sizeof(BerMemoryFunctions));
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+ return LBER_OPT_SUCCESS;
+ }
+
+ ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+ if(invalue == NULL) {
+ /* no place to set from */
+ return LBER_OPT_ERROR;
+ }
+
+ if(item == NULL) {
+ if(option == LBER_OPT_BER_DEBUG) {
+ ber_int_debug = * (const int *) invalue;
+ return LBER_OPT_SUCCESS;
+
+ } else if(option == LBER_OPT_LOG_PRINT_FN) {
+ ber_pvt_log_print = (BER_LOG_PRINT_FN) invalue;
+ return LBER_OPT_SUCCESS;
+ }
+
+ return LBER_OPT_ERROR;
+ }
+
+ ber = item;
+ sb = item;
+
+ switch(option) {
+ case LBER_OPT_BER_OPTIONS:
+ assert( BER_VALID( ber ) );
+ ber->ber_options = * (const int *) invalue;
+ return LBER_OPT_SUCCESS;
+
+ case LBER_OPT_BER_DEBUG:
+ assert( BER_VALID( ber ) );
+ ber->ber_debug = * (const int *) invalue;
+ return LBER_OPT_SUCCESS;
+
+ default:
+ /* bad param */
+ break;
+ }
+
+ return LBER_OPT_ERROR;
+}
/* sockbuf.c - i/o routines with support for adding i/o layers. */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#ifdef USE_SASL
static ber_len_t
-packet_length( char *buf )
+packet_length( Sockbuf *sb, const char *buf )
{
ber_len_t size;
(((ber_len_t)buf[2])<<8)|
(((ber_len_t)buf[3]));
- if ((size<0) || (size>MAX_BUF_SIZE)) {
+ if ( size > MAX_BUF_SIZE ) {
/* somebody is trying to mess me up. */
- lber_log_printf( LDAP_DEBUG_SASL, sb->sb_debug,
- "SASL: received packet length of %d bytes\n",
- size );
+ ber_log_printf( LDAP_DEBUG_SASL, sb->sb_debug,
+ "SASL: received packet length of %lu bytes\n",
+ (unsigned long) size );
size = 16; /* this should lead to an error. */
}
ptr+=size;
if (ptr+4<=end)
- size = packet_length( ptr );
+ size = packet_length( sb, ptr );
/* size is always at least 4, so the loop condition is always OK !!*/
assert( size>=4 );
}
/* calculate the packet length. */
sb->sb_sec_buf_in.buf_end =
- packet_length(sb->sb_sec_buf_in.buf_base );
+ packet_length(sb, sb->sb_sec_buf_in.buf_base );
if ((sb->sb_sec_buf_in.buf_end > sb->sb_sec_buf_in.buf_size) &&
(grow_buffer( &(sb->sb_sec_buf_in), sb->sb_sec_buf_in.buf_end)<0)) {
/* buffer has to be to big. exit with error. */
ret = -1;
goto do_return;
}
- if (sb->sb_sec_buf_in.buf_ptr >= sb_sec_buf_in.buf_end) {
+ if (sb->sb_sec_buf_in.buf_ptr >= sb->sb_sec_buf_in.buf_end) {
/* finished packet. decode it. */
goto decode_packet;
}
long sockbuf_do_write( Sockbuf *sb )
{
long to_go;
+ ber_slen_t ret;
assert( sb != NULL );
assert( SOCKBUF_VALID( sb ) );
memcpy( sb->sb_sec_buf_in.buf_base,
sb->sb_buf.buf_base + sb->sb_buf.buf_ptr, len );
sb->sb_sec_buf_in.buf_ptr = len;
- sb->sb_sec_buf_in.buf_end = (len>4) ? packet_length( sb->sb_sec_buf_in ) : 0;
+ sb->sb_sec_buf_in.buf_end = (len>4) ? packet_length( sb, sb->sb_sec_buf_in ) : 0;
sb->sb_buf.buf_ptr = sb->sb_buf.buf_end = 0;
}
- update_status();
+ update_status( sb );
return 0;
}
if ( sb->sb_debug ) {
ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug,
- "dgram_read udp_read %d bytes\n",
- rc );
+ "dgram_read udp_read %ld bytes\n",
+ (long) rc );
if ( rc > 0 )
ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
buf, rc );
+# $OpenLDAP$
## Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
##
getdn.c getentry.c getattr.c getvalues.c addentry.c \
request.c getdxbyname.c os-ip.c url.c charset.c \
init.c options.c print.c string.c util-int.c schema.c \
- charray.c digest.c tls.c
+ charray.c digest.c tls.c dn.c
OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \
controls.lo messages.lo references.lo extended.lo \
modify.lo add.lo modrdn.lo delete.lo abandon.lo ufn.lo cache.lo \
getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
request.lo getdxbyname.lo os-ip.lo url.lo charset.lo \
init.lo options.lo print.lo string.lo util-int.lo schema.lo \
- charray.lo digest.lo tls.lo
+ charray.lo digest.lo tls.lo dn.lo
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* abandon.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+/*
+ * An abandon request looks like this:
+ * AbandonRequest ::= MessageID
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS */
+#include <ac/stdlib.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
-#include "lber.h"
-#include "ldap.h"
#include "ldap-int.h"
-#ifdef NEEDPROTOS
-static int do_abandon( LDAP *ld, int origid, int msgid );
-#else /* NEEDPROTOS */
-static int do_abandon();
-#endif /* NEEDPROTOS */
+static int do_abandon LDAP_P((
+ LDAP *ld,
+ ber_int_t origid,
+ ber_int_t msgid,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls));
+
/*
- * ldap_abandon - perform an ldap (and X.500) abandon operation. Parameters:
+ * ldap_abandon_ext - perform an ldap extended abandon operation.
+ *
+ * Parameters:
+ * ld LDAP descriptor
+ * msgid The message id of the operation to abandon
+ * scntrls Server Controls
+ * ccntrls Client Controls
+ *
+ * ldap_abandon_ext returns a LDAP error code.
+ * (LDAP_SUCCESS if everything went ok)
+ *
+ * Example:
+ * ldap_abandon_ext( ld, msgid, scntrls, ccntrls );
+ */
+int
+ldap_abandon_ext(
+ LDAP *ld,
+ int msgid,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls )
+{
+ Debug( LDAP_DEBUG_TRACE, "ldap_abandon_ext %d\n", msgid, 0, 0 );
+
+ return do_abandon( ld, msgid, msgid, sctrls, cctrls );
+}
+
+
+/*
+ * ldap_abandon - perform an ldap abandon operation. Parameters:
*
* ld LDAP descriptor
* msgid The message id of the operation to abandon
ldap_abandon( LDAP *ld, int msgid )
{
Debug( LDAP_DEBUG_TRACE, "ldap_abandon %d\n", msgid, 0, 0 );
- return( do_abandon( ld, msgid, msgid ));
+ return do_abandon( ld, msgid, msgid, NULL, NULL ) == LDAP_SUCCESS
+ ? 0 : -1;
}
static int
-do_abandon( LDAP *ld, int origid, int msgid )
+do_abandon(
+ LDAP *ld,
+ ber_int_t origid,
+ ber_int_t msgid,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls)
{
BerElement *ber;
int i, err, sendabandon;
+ ber_int_t *old_abandon;
Sockbuf *sb;
-#ifdef LDAP_REFERRALS
LDAPRequest *lr;
-#endif /* LDAP_REFERRALS */
-
- /*
- * An abandon request looks like this:
- * AbandonRequest ::= MessageID
- */
Debug( LDAP_DEBUG_TRACE, "do_abandon origid %d, msgid %d\n",
origid, msgid, 0 );
sendabandon = 1;
-#ifdef LDAP_REFERRALS
/* 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 */
- do_abandon( ld, msgid, lr->lr_msgid );
+ if ( lr->lr_origid == msgid ) {/* child: abandon it */
+ (void) do_abandon( ld,
+ msgid, lr->lr_msgid, sctrls, cctrls );
}
}
if ( origid == msgid && lr->lr_parent != NULL ) {
/* don't let caller abandon child requests! */
ld->ld_errno = LDAP_PARAM_ERROR;
- return( -1 );
+ return( LDAP_PARAM_ERROR );
}
if ( lr->lr_status != LDAP_REQST_INPROGRESS ) {
/* no need to send abandon message */
sendabandon = 0;
}
}
-#endif /* LDAP_REFERRALS */
if ( ldap_msgdelete( ld, msgid ) == 0 ) {
ld->ld_errno = LDAP_SUCCESS;
- return( 0 );
+ return LDAP_SUCCESS;
}
err = 0;
if ( sendabandon ) {
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
err = -1;
ld->ld_errno = LDAP_NO_MEMORY;
+
} else {
-#ifdef CLDAP
- if ( ld->ld_sb.sb_naddr > 0 ) {
- err = ber_printf( ber, "{isti}",
+#ifdef LDAP_CONNECTIONLESS
+ if ( ld->ld_cldapnaddr > 0 ) {
+ err = ber_printf( ber, "{isti", /* '}' */
++ld->ld_msgid, ld->ld_cldapdn,
LDAP_REQ_ABANDON, msgid );
- } else {
-#endif /* CLDAP */
- err = ber_printf( ber, "{iti}", ++ld->ld_msgid,
+ } else
+#endif /* LDAP_CONNECTIONLESS */
+ {
+ err = ber_printf( ber, "{iti", /* '}' */
+ ++ld->ld_msgid,
LDAP_REQ_ABANDON, msgid );
-#ifdef CLDAP
}
-#endif /* CLDAP */
- if ( err == -1 ) {
+ if( err == -1 ) {
+ /* encoding error */
ld->ld_errno = LDAP_ENCODING_ERROR;
+
+ } else {
+ /* Put Server Controls */
+ if ( ldap_int_put_controls( ld, sctrls, ber )
+ != LDAP_SUCCESS )
+ {
+ err = -1;
+
+ } else {
+ /* close '{' */
+ err = ber_printf( ber, /*{*/ "}" );
+
+ if( err == -1 ) {
+ /* encoding error */
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ }
+ }
+ }
+
+ if ( err == -1 ) {
ber_free( ber, 1 );
+
} else {
/* send the message */
-#ifdef LDAP_REFERRALS
if ( lr != NULL ) {
sb = lr->lr_conn->lconn_sb;
} else {
sb = &ld->ld_sb;
}
-#else /* LDAP_REFERRALS */
- sb = &ld->ld_sb;
-#endif /* LDAP_REFERRALS */
+
if ( ber_flush( sb, ber, 1 ) != 0 ) {
ld->ld_errno = LDAP_SERVER_DOWN;
err = -1;
}
}
-#ifdef LDAP_REFERRALS
if ( lr != NULL ) {
if ( sendabandon ) {
- free_connection( ld, lr->lr_conn, 0, 1 );
+ ldap_free_connection( ld, lr->lr_conn, 0, 1 );
}
if ( origid == msgid ) {
- free_request( ld, lr );
+ ldap_free_request( ld, lr );
}
}
-#endif /* LDAP_REFERRALS */
+ i = 0;
+ if ( ld->ld_abandoned != NULL ) {
+ for ( ; ld->ld_abandoned[i] != -1; i++ )
+ ; /* NULL */
+ }
+
+ old_abandon = ld->ld_abandoned;
+ ld->ld_abandoned = (ber_int_t *) LDAP_REALLOC( (char *)
+ ld->ld_abandoned, (i + 2) * sizeof(ber_int_t) );
+
if ( ld->ld_abandoned == NULL ) {
- if ( (ld->ld_abandoned = (int *) malloc( 2 * sizeof(int) ))
- == NULL ) {
- ld->ld_errno = LDAP_NO_MEMORY;
- return( -1 );
- }
- i = 0;
- } else {
- for ( i = 0; ld->ld_abandoned[i] != -1; i++ )
- ; /* NULL */
- if ( (ld->ld_abandoned = (int *) realloc( (char *)
- ld->ld_abandoned, (i + 2) * sizeof(int) )) == NULL ) {
- ld->ld_errno = LDAP_NO_MEMORY;
- return( -1 );
- }
+ ld->ld_abandoned = old_abandon;
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return( ld->ld_errno );
}
+
ld->ld_abandoned[i] = msgid;
ld->ld_abandoned[i + 1] = -1;
if ( err != -1 ) {
ld->ld_errno = LDAP_SUCCESS;
}
- return( err );
+
+ return( ld->ld_errno );
}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* add.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
-#include <stdio.h>
-#include <string.h>
+/*
+ * An add request looks like this:
+ * AddRequest ::= SEQUENCE {
+ * entry DistinguishedName,
+ * attrs SEQUENCE OF SEQUENCE {
+ * type AttributeType,
+ * values SET OF AttributeValue
+ * }
+ * }
+ */
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
+#include "portable.h"
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS */
+#include <stdio.h>
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* !MACOS && !DOS */
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
-#include "lber.h"
-#include "ldap.h"
#include "ldap-int.h"
/*
- * ldap_add - initiate an ldap (and X.500) add operation. Parameters:
+ * ldap_add - initiate an ldap add operation. Parameters:
*
* ld LDAP descriptor
* dn DN of the entry to add
* msgid = ldap_add( ld, dn, attrs );
*/
int
-ldap_add( LDAP *ld, char *dn, LDAPMod **attrs )
+ldap_add( LDAP *ld, LDAP_CONST char *dn, LDAPMod **attrs )
+{
+ int rc;
+ int msgid;
+
+ rc = ldap_add_ext( ld, dn, attrs, NULL, NULL, &msgid );
+
+ if ( rc != LDAP_SUCCESS )
+ return -1;
+
+ return msgid;
+}
+
+
+/*
+ * ldap_add_ext - initiate an ldap extended 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.
+ * sctrl Server Controls
+ * cctrl Client Controls
+ * msgidp Message ID pointer
+ *
+ * Example:
+ * LDAPMod *attrs[] = {
+ * { 0, "cn", { "babs jensen", "babs", 0 } },
+ * { 0, "sn", { "jensen", 0 } },
+ * { 0, "objectClass", { "person", 0 } },
+ * 0
+ * }
+ * rc = ldap_add_ext( ld, dn, attrs, NULL, NULL, &msgid );
+ */
+int
+ldap_add_ext(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAPMod **attrs,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ int *msgidp )
{
BerElement *ber;
int i, rc;
- /*
- * An add request looks like this:
- * AddRequest ::= SEQUENCE {
- * entry DistinguishedName,
- * attrs SEQUENCE OF SEQUENCE {
- * type AttributeType,
- * values SET OF AttributeValue
- * }
- * }
- */
-
Debug( LDAP_DEBUG_TRACE, "ldap_add\n", 0, 0, 0 );
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( dn != NULL );
+ assert( msgidp != NULL );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
- return( -1 );
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return ld->ld_errno;
}
- if ( ber_printf( ber, "{it{s{", ++ld->ld_msgid, LDAP_REQ_ADD, dn )
- == -1 ) {
+ rc = ber_printf( ber, "{it{s{", /* '}}}' */
+ ++ld->ld_msgid, LDAP_REQ_ADD, dn );
+
+ if ( rc == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
- return( -1 );
+ return ld->ld_errno;
}
/* for each attribute in the entry... */
if ( rc == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
- return( -1 );
+ return ld->ld_errno;
}
}
- if ( ber_printf( ber, "}}}" ) == -1 ) {
+ if ( ber_printf( ber, /*{{*/ "}}" ) == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free( ber, 1 );
+ return ld->ld_errno;
+ }
+
+ /* Put Server Controls */
+ if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
+ ber_free( ber, 1 );
+ return ld->ld_errno;
+ }
+
+ if ( ber_printf( ber, /*{*/ "}" ) == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
- return( -1 );
+ return ld->ld_errno;
}
/* send the message */
- return( send_initial_request( ld, LDAP_REQ_ADD, dn, ber ));
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_ADD, dn, ber );
+
+ if(*msgidp < 0)
+ return ld->ld_errno;
+
+ return LDAP_SUCCESS;
}
int
-ldap_add_s( LDAP *ld, char *dn, LDAPMod **attrs )
+ldap_add_ext_s(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAPMod **attrs,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls )
{
- int msgid;
+ int msgid, rc;
LDAPMessage *res;
- if ( (msgid = ldap_add( ld, dn, attrs )) == -1 )
- return( ld->ld_errno );
+ rc = ldap_add_ext( ld, dn, attrs, sctrls, cctrls, &msgid );
+
+ if ( rc != LDAP_SUCCESS )
+ return( rc );
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
return( ld->ld_errno );
return( ldap_result2error( ld, res, 1 ) );
}
+int
+ldap_add_s( LDAP *ld, LDAP_CONST char *dn, LDAPMod **attrs )
+{
+ return ldap_add_ext_s( ld, dn, attrs, NULL, NULL );
+}
+
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* addentry.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
LDAPMessage *
ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e )
{
LDAPMessage *tmp, *prev = NULL;
+ assert( list != NULL );
+ assert( e != NULL );
+
for ( tmp = *list; tmp != NULL && tmp != e; tmp = tmp->lm_chain )
prev = tmp;
void
ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e )
{
+ assert( list != NULL );
+ assert( e != NULL );
+
e->lm_chain = *list;
*list = e;
}
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* bind.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
+/*
+ * BindRequest ::= SEQUENCE {
+ * version INTEGER,
+ * name DistinguishedName, -- who
+ * authentication CHOICE {
+ * simple [0] OCTET STRING -- passwd
+#ifdef HAVE_KERBEROS
+ * krbv42ldap [1] OCTET STRING
+ * krbv42dsa [2] OCTET STRING
#endif
+ * sasl [3] SaslCredentials -- LDAPv3
+ * }
+ * }
+ *
+ * BindResponse ::= SEQUENCE {
+ * COMPONENTS OF LDAPResult,
+ * serverSaslCreds OCTET STRING OPTIONAL -- LDAPv3
+ * }
+ *
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include "msdos.h"
-#ifdef NCSA
-#include "externs.h"
-#endif /* NCSA */
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+
+#include <ac/stdlib.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
/*
*/
int
-ldap_bind( LDAP *ld, char *dn, char *passwd, int authmethod )
+ldap_bind( LDAP *ld, LDAP_CONST char *dn, LDAP_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
-#ifdef KERBEROS
- * krbv42ldap [1] OCTET STRING
- * krbv42dsa [2] OCTET STRING
-#endif
- * }
- * }
- * all wrapped up in an LDAPMessage sequence.
- */
-
Debug( LDAP_DEBUG_TRACE, "ldap_bind\n", 0, 0, 0 );
switch ( authmethod ) {
case LDAP_AUTH_SIMPLE:
return( ldap_simple_bind( ld, dn, passwd ) );
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
case LDAP_AUTH_KRBV41:
return( ldap_kerberos_bind1( ld, dn ) );
return( ldap_kerberos_bind2( ld, dn ) );
#endif
+ case LDAP_AUTH_SASL:
+ /* user must use ldap_sasl_bind */
+ /* FALL-THRU */
+
default:
ld->ld_errno = LDAP_AUTH_UNKNOWN;
return( -1 );
* NULL, LDAP_AUTH_KRBV4 )
*/
int
-ldap_bind_s( LDAP *ld, char *dn, char *passwd, int authmethod )
+ldap_bind_s(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *passwd,
+ int authmethod )
{
Debug( LDAP_DEBUG_TRACE, "ldap_bind_s\n", 0, 0, 0 );
case LDAP_AUTH_SIMPLE:
return( ldap_simple_bind_s( ld, dn, passwd ) );
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
case LDAP_AUTH_KRBV4:
return( ldap_kerberos_bind_s( ld, dn ) );
return( ldap_kerberos_bind2_s( ld, dn ) );
#endif
+ case LDAP_AUTH_SASL:
+ /* user must use ldap_sasl_bind */
+ /* FALL-THRU */
+
default:
return( ld->ld_errno = LDAP_AUTH_UNKNOWN );
}
}
-#ifdef LDAP_REFERRALS
void
ldap_set_rebind_proc( LDAP *ld, int (*rebindproc)( LDAP *ld, char **dnp,
char **passwdp, int *authmethodp, int freeit ))
{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
ld->ld_rebindproc = rebindproc;
}
-#endif /* LDAP_REFERRALS */
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1993 The Regents of the University of Michigan.
* All rights reserved.
*
* cache.c - local caching support for LDAP
*/
-#ifndef NO_CACHE
-
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1993 The Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include <time.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#ifdef NCSA
-#include "externs.h"
-#endif /* NCSA */
-#ifdef WINSOCK
-#include <time.h>
-#endif /* WINSOCK */
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
-#include "lber.h"
-#include "ldap.h"
+
+#include <ac/stdlib.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include "ldap-int.h"
-#ifdef NEEDPROTOS
-static int cache_hash( BerElement *ber );
-static LDAPMessage *msg_dup( LDAPMessage *msg );
-static int request_cmp( BerElement *req1, BerElement *req2 );
-static int chain_contains_dn( LDAPMessage *msg, char *dn );
-static long msg_size( LDAPMessage *msg );
-static void check_cache_memused( LDAPCache *lc );
-static void uncache_entry_or_req( LDAP *ld, char *dn, int msgid );
-#else /* NEEDPROTOS */
-static int cache_hash();
-static LDAPMessage *msg_dup();
-static int request_cmp();
-static int chain_contains_dn();
-static long msg_size();
-static void check_cache_memused();
-static void uncache_entry_or_req();
-#endif /* NEEDPROTOS */
+#ifndef LDAP_NOCACHE
+static int cache_hash LDAP_P(( BerElement *ber ));
+static LDAPMessage *msg_dup LDAP_P(( LDAPMessage *msg ));
+static int request_cmp LDAP_P(( BerElement *req1, BerElement *req2 ));
+static int chain_contains_dn LDAP_P(( LDAPMessage *msg, LDAP_CONST char *dn ));
+static ber_len_t msg_size LDAP_P(( LDAPMessage *msg ));
+static void check_cache_memused LDAP_P(( LDAPCache *lc ));
+static void uncache_entry_or_req LDAP_P(( LDAP *ld, LDAP_CONST char *dn, ber_int_t msgid ));
+
+#endif
int
-ldap_enable_cache( LDAP *ld, long timeout, long maxmem )
+ldap_enable_cache( LDAP *ld, long timeout, ber_len_t maxmem )
{
- if ( ld->ld_cache == NULLLDCACHE ) {
- if (( ld->ld_cache = (LDAPCache *)malloc( sizeof( LDAPCache )))
- == NULLLDCACHE ) {
+#ifndef LDAP_NOCACHE
+ if ( ld->ld_cache == NULL ) {
+ if (( ld->ld_cache = (LDAPCache *)LDAP_MALLOC( sizeof( LDAPCache )))
+ == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( -1 );
}
check_cache_memused( ld->ld_cache );
ld->ld_cache->lc_enabled = 1;
return( 0 );
+#else
+ return( -1 );
+#endif
}
void
ldap_disable_cache( LDAP *ld )
{
- if ( ld->ld_cache != NULLLDCACHE ) {
+#ifndef LDAP_NOCACHE
+ if ( ld->ld_cache != NULL ) {
ld->ld_cache->lc_enabled = 0;
}
+#endif
}
void
ldap_set_cache_options( LDAP *ld, unsigned long opts )
{
- if ( ld->ld_cache != NULLLDCACHE ) {
+#ifndef LDAP_NOCACHE
+ if ( ld->ld_cache != NULL ) {
ld->ld_cache->lc_options = opts;
}
+#endif
}
void
ldap_destroy_cache( LDAP *ld )
{
- if ( ld->ld_cache != NULLLDCACHE ) {
+#ifndef LDAP_NOCACHE
+ if ( ld->ld_cache != NULL ) {
ldap_flush_cache( ld );
- free( (char *)ld->ld_cache );
- ld->ld_cache = NULLLDCACHE;
+ LDAP_FREE( (char *)ld->ld_cache );
+ ld->ld_cache = NULL;
}
+#endif
}
void
ldap_flush_cache( LDAP *ld )
{
+#ifndef LDAP_NOCACHE
int i;
LDAPMessage *m, *next;
Debug( LDAP_DEBUG_TRACE, "ldap_flush_cache\n", 0, 0, 0 );
- if ( ld->ld_cache != NULLLDCACHE ) {
+ if ( ld->ld_cache != NULL ) {
/* delete all requests in the queue */
- for ( m = ld->ld_cache->lc_requests; m != NULLMSG; m = next ) {
+ for ( m = ld->ld_cache->lc_requests; m != NULL; m = next ) {
next = m->lm_next;
ldap_msgfree( m );
}
- ld->ld_cache->lc_requests = NULLMSG;
+ ld->ld_cache->lc_requests = NULL;
/* delete all messages in the cache */
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
for ( m = ld->ld_cache->lc_buckets[ i ];
- m != NULLMSG; m = next ) {
+ m != NULL; m = next ) {
next = m->lm_next;
ldap_msgfree( m );
}
- ld->ld_cache->lc_buckets[ i ] = NULLMSG;
+ ld->ld_cache->lc_buckets[ i ] = NULL;
}
ld->ld_cache->lc_memused = sizeof( LDAPCache );
}
+#endif
}
void
ldap_uncache_request( LDAP *ld, int msgid )
{
- Debug( LDAP_DEBUG_TRACE, "ldap_uncache_request %d ld_cache %x\n",
- msgid, ld->ld_cache, 0 );
+#ifndef LDAP_NOCACHE
+ Debug( LDAP_DEBUG_TRACE, "ldap_uncache_request %d ld_cache %lx\n",
+ msgid, (long) ld->ld_cache, 0 );
uncache_entry_or_req( ld, NULL, msgid );
+#endif
}
void
-ldap_uncache_entry( LDAP *ld, char *dn )
+ldap_uncache_entry( LDAP *ld, LDAP_CONST char *dn )
{
- Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %x\n",
- dn, ld->ld_cache, 0 );
+#ifndef LDAP_NOCACHE
+ Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %lx\n",
+ dn, (long) ld->ld_cache, 0 );
uncache_entry_or_req( ld, dn, 0 );
+#endif
}
+#ifndef LDAP_NOCACHE
+
static void
uncache_entry_or_req( LDAP *ld,
- char *dn, /* if non-NULL, uncache entry */
- int msgid ) /* request to uncache (if dn == NULL) */
+ const char *dn, /* if non-NULL, uncache entry */
+ ber_int_t msgid ) /* request to uncache (if dn == NULL) */
{
int i;
LDAPMessage *m, *prev, *next;
Debug( LDAP_DEBUG_TRACE,
- "ldap_uncache_entry_or_req dn %s msgid %d ld_cache %x\n",
- dn, msgid, ld->ld_cache );
+ "ldap_uncache_entry_or_req dn %s msgid %ld ld_cache %lx\n",
+ dn, (long) msgid, (long) ld->ld_cache );
- if ( ld->ld_cache == NULLLDCACHE ) {
+ if ( ld->ld_cache == NULL ) {
return;
}
/* first check the request queue */
- prev = NULLMSG;
- for ( m = ld->ld_cache->lc_requests; m != NULLMSG; m = next ) {
+ prev = NULL;
+ for ( m = ld->ld_cache->lc_requests; m != NULL; m = next ) {
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
- if ( prev == NULLMSG ) {
+ if ( prev == NULL ) {
ld->ld_cache->lc_requests = next;
} else {
prev->lm_next = next;
/* now check the rest of the cache */
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
- prev = NULLMSG;
- for ( m = ld->ld_cache->lc_buckets[ i ]; m != NULLMSG;
+ prev = NULL;
+ for ( m = ld->ld_cache->lc_buckets[ i ]; m != NULL;
m = next ) {
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
- if ( prev == NULLMSG ) {
+ if ( prev == NULL ) {
ld->ld_cache->lc_buckets[ i ] = next;
} else {
prev->lm_next = next;
}
}
+#endif
void
-add_request_to_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
+ldap_add_request_to_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
{
+#ifndef LDAP_NOCACHE
LDAPMessage *new;
- long len;
+ ber_len_t len;
- Debug( LDAP_DEBUG_TRACE, "add_request_to_cache\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_add_request_to_cache\n", 0, 0, 0 );
ld->ld_errno = LDAP_SUCCESS;
- if ( ld->ld_cache == NULLLDCACHE ||
+ if ( ld->ld_cache == NULL ||
( ld->ld_cache->lc_enabled == 0 )) {
return;
}
- if (( new = (LDAPMessage *) calloc( 1, sizeof(LDAPMessage) ))
+ if (( new = (LDAPMessage *) LDAP_CALLOC( 1, sizeof(LDAPMessage) ))
!= NULL ) {
- if (( new->lm_ber = alloc_ber_with_options( ld )) == NULLBER ) {
- free( (char *)new );
+ if (( new->lm_ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ LDAP_FREE( (char *)new );
return;
}
len = request->ber_ptr - request->ber_buf;
- if (( new->lm_ber->ber_buf = (char *) malloc( (size_t)len ))
+ if (( new->lm_ber->ber_buf = (char *) ber_memalloc( (size_t)len ))
== NULL ) {
ber_free( new->lm_ber, 0 );
- free( (char *)new );
+ LDAP_FREE( (char *)new );
ld->ld_errno = LDAP_NO_MEMORY;
return;
}
} else {
ld->ld_errno = LDAP_NO_MEMORY;
}
+#endif
}
void
-add_result_to_cache( LDAP *ld, LDAPMessage *result )
+ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
{
+#ifndef LDAP_NOCACHE
LDAPMessage *m, **mp, *req, *new, *prev;
int err, keep;
- Debug( LDAP_DEBUG_TRACE, "add_result_to_cache: id %d, type %d\n",
- result->lm_msgid, result->lm_msgtype, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %ld, type %ld\n",
+ (long) result->lm_msgid, (long) result->lm_msgtype, 0 );
- if ( ld->ld_cache == NULLLDCACHE ||
+ if ( ld->ld_cache == NULL ||
( ld->ld_cache->lc_enabled == 0 )) {
Debug( LDAP_DEBUG_TRACE, "artc: cache disabled\n", 0, 0, 0 );
return;
}
if ( result->lm_msgtype != LDAP_RES_SEARCH_ENTRY &&
+ result->lm_msgtype != LDAP_RES_SEARCH_REFERENCE &&
result->lm_msgtype != LDAP_RES_SEARCH_RESULT &&
result->lm_msgtype != LDAP_RES_COMPARE ) {
/*
* result to it. if this result completes the results for the
* request, add the request/result chain to the cache proper.
*/
- prev = NULLMSG;
+ prev = NULL;
for ( m = ld->ld_cache->lc_requests; m != NULL; m = m->lm_next ) {
if ( m->lm_msgid == result->lm_msgid ) {
break;
prev = m;
}
- if ( m != NULLMSG ) { /* found request; add to end of chain */
+ if ( m != NULL ) { /* found request; add to end of chain */
req = m;
- for ( ; m->lm_chain != NULLMSG; m = m->lm_chain )
+ for ( ; m->lm_chain != NULL; m = m->lm_chain )
;
- if (( new = msg_dup( result )) != NULLMSG ) {
- new->lm_chain = NULLMSG;
+ if (( new = msg_dup( result )) != NULL ) {
+ new->lm_chain = NULL;
m->lm_chain = new;
Debug( LDAP_DEBUG_TRACE,
"artc: result added to cache request chain\n",
keep = 1;
}
- if ( prev == NULLMSG ) {
+ if ( prev == NULL ) {
ld->ld_cache->lc_requests = req->lm_next;
} else {
prev->lm_next = req->lm_next;
Debug( LDAP_DEBUG_TRACE, "artc: msgid not in request list\n",
0, 0, 0 );
}
+#endif
}
* will find them.
*/
int
-check_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
+ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
{
+#ifndef LDAP_NOCACHE
LDAPMessage *m, *new, *prev, *next;
BerElement reqber;
int first, hash;
- unsigned long validtime;
+ time_t c_time;
- Debug( LDAP_DEBUG_TRACE, "check_cache\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_check_cache\n", 0, 0, 0 );
- if ( ld->ld_cache == NULLLDCACHE ||
+ if ( ld->ld_cache == NULL ||
( ld->ld_cache->lc_enabled == 0 )) {
return( -1 );
}
reqber.ber_buf = reqber.ber_ptr = request->ber_buf;
reqber.ber_end = request->ber_ptr;
- validtime = (long)time( NULL ) - ld->ld_cache->lc_timeout;
+ c_time = time( NULL );
- prev = NULLMSG;
+ prev = NULL;
hash = cache_hash( &reqber );
- for ( m = ld->ld_cache->lc_buckets[ hash ]; m != NULLMSG; m = next ) {
- Debug( LDAP_DEBUG_TRACE,"cc: examining id %d,type %d\n",
- m->lm_msgid, m->lm_msgtype, 0 );
- if ( m->lm_time < validtime ) {
+ for ( m = ld->ld_cache->lc_buckets[ hash ]; m != NULL; m = next ) {
+ Debug( LDAP_DEBUG_TRACE,"cc: examining id %ld,type %ld\n",
+ (long) m->lm_msgid, (long) m->lm_msgtype, 0 );
+ if ( difftime(c_time, m->lm_time) > ld->ld_cache->lc_timeout ) {
/* delete expired message */
next = m->lm_next;
if ( prev == NULL ) {
}
}
- if ( m == NULLMSG ) {
+ if ( m == NULL ) {
return( -1 );
}
* add duplicates of responses to incoming queue
*/
first = 1;
- for ( m = m->lm_chain; m != NULLMSG; m = m->lm_chain ) {
- if (( new = msg_dup( m )) == NULLMSG ) {
+ for ( m = m->lm_chain; m != NULL; m = m->lm_chain ) {
+ if (( new = msg_dup( m )) == NULL ) {
return( -1 );
}
new->lm_msgid = ld->ld_msgid;
- new->lm_chain = NULLMSG;
+ new->lm_chain = NULL;
if ( first ) {
new->lm_next = ld->ld_responses;
ld->ld_responses = new;
prev->lm_chain = new;
}
prev = new;
- Debug( LDAP_DEBUG_TRACE, "cc: added type %d\n",
- new->lm_msgtype, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "cc: added type %ld\n",
+ (long) new->lm_msgtype, 0, 0 );
}
Debug( LDAP_DEBUG_TRACE, "cc: result returned from cache\n", 0, 0, 0 );
return( 0 );
+#else
+ return( -1 );
+#endif
}
+#ifndef LDAP_NOCACHE
static int
cache_hash( BerElement *ber )
{
BerElement bercpy;
- unsigned long len;
+ ber_len_t len;
/*
* just take the length of the packet and mod with # of buckets
msg_dup( LDAPMessage *msg )
{
LDAPMessage *new;
- long len;
+ ber_len_t len;
- if (( new = (LDAPMessage *)malloc( sizeof(LDAPMessage))) != NULL ) {
+ if (( new = (LDAPMessage *)LDAP_MALLOC( sizeof(LDAPMessage))) != NULL ) {
*new = *msg; /* struct copy */
- if (( new->lm_ber = ber_dup( msg->lm_ber )) == NULLBER ) {
- free( (char *)new );
- return( NULLMSG );
+ if (( new->lm_ber = ber_dup( msg->lm_ber )) == NULL ) {
+ LDAP_FREE( (char *)new );
+ return( NULL );
}
len = msg->lm_ber->ber_end - msg->lm_ber->ber_buf;
- if (( new->lm_ber->ber_buf = (char *) malloc(
+ if (( new->lm_ber->ber_buf = (char *) ber_memalloc(
(size_t)len )) == NULL ) {
ber_free( new->lm_ber, 0 );
- free( (char *)new );
- return( NULLMSG );
+ LDAP_FREE( (char *)new );
+ return( NULL );
}
SAFEMEMCPY( new->lm_ber->ber_buf, msg->lm_ber->ber_buf,
(size_t)len );
static int
request_cmp( BerElement *req1, BerElement *req2 )
{
- unsigned long len;
+ ber_len_t len;
BerElement r1, r2;
r1 = *req1; /* struct copies */
/*
* check remaining length and bytes if necessary
*/
- if (( len = r1.ber_end - r1.ber_ptr ) != r2.ber_end - r2.ber_ptr ) {
+ if (( len = r1.ber_end - r1.ber_ptr ) !=
+ (ber_len_t) (r2.ber_end - r2.ber_ptr) )
+ {
return( -1 ); /* different lengths */
}
return( memcmp( r1.ber_ptr, r2.ber_ptr, (size_t)len ));
static int
-chain_contains_dn( LDAPMessage *msg, char *dn )
+chain_contains_dn( LDAPMessage *msg, const char *dn )
{
LDAPMessage *m;
BerElement ber;
- long msgid;
+ ber_int_t msgid;
char *s;
int rc;
* first check the base or dn of the request
*/
ber = *msg->lm_ber; /* struct copy */
- if ( ber_scanf( &ber, "{i{a", &msgid, &s ) != LBER_ERROR ) {
+ if ( ber_scanf( &ber, "{i{a" /*}}*/, &msgid, &s ) != LBER_ERROR ) {
rc = ( strcasecmp( dn, s ) == 0 ) ? 1 : 0;
- free( s );
+ LDAP_FREE( s );
if ( rc != 0 ) {
return( rc );
}
* now check the dn of each search result
*/
rc = 0;
- for ( m = msg->lm_chain; m != NULLMSG && rc == 0 ; m = m->lm_chain ) {
+ for ( m = msg->lm_chain; m != NULL && rc == 0 ; m = m->lm_chain ) {
if ( m->lm_msgtype != LDAP_RES_SEARCH_ENTRY ) {
continue;
}
ber = *m->lm_ber; /* struct copy */
- if ( ber_scanf( &ber, "{a", &s ) != LBER_ERROR ) {
+ if ( ber_scanf( &ber, "{a" /*}*/, &s ) != LBER_ERROR ) {
rc = ( strcasecmp( dn, s ) == 0 ) ? 1 : 0;
- free( s );
+ LDAP_FREE( s );
}
}
}
-static long
+static ber_len_t
msg_size( LDAPMessage *msg )
{
LDAPMessage *m;
- long size;
+ ber_len_t size;
size = 0;
- for ( m = msg; m != NULLMSG; m = m->lm_chain ) {
+ for ( m = msg; m != NULL; m = m->lm_chain ) {
size += ( sizeof( LDAPMessage ) + m->lm_ber->ber_end -
m->lm_ber->ber_buf );
}
* } while ( cache size is > SIZE_FACTOR * lc_maxmem )
*/
int i;
- unsigned long remove_threshold, validtime;
+ unsigned long remove_threshold;
+ time_t c_time;
LDAPMessage *m, *prev, *next;
Debug( LDAP_DEBUG_TRACE, "check_cache_memused: %ld bytes in use (%ld max)\n",
lc->lc_memused, lc->lc_maxmem, 0 );
- if ( lc->lc_maxmem <= sizeof( LDAPCache )
+ if ( (unsigned) lc->lc_maxmem <= sizeof( LDAPCache )
|| lc->lc_memused <= lc->lc_maxmem * SIZE_FACTOR ) {
return;
}
remove_threshold = lc->lc_timeout;
while ( lc->lc_memused > lc->lc_maxmem * SIZE_FACTOR ) {
- validtime = (long)time( NULL ) - remove_threshold;
+ c_time = time( NULL );
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
- prev = NULLMSG;
- for ( m = lc->lc_buckets[ i ]; m != NULLMSG;
+ prev = NULL;
+ for ( m = lc->lc_buckets[ i ]; m != NULL;
m = next ) {
next = m->lm_next;
- if ( m->lm_time < validtime ) {
- if ( prev == NULLMSG ) {
+ if ( difftime(c_time, m->lm_time) > remove_threshold) {
+ if ( prev == NULL ) {
lc->lc_buckets[ i ] = next;
} else {
prev->lm_next = next;
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* charray.c - routines for dealing with char * arrays */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "ldap-int.h"
+
+int
+ldap_charray_add(
+ char ***a,
+ char *s
+)
+{
+ int n;
+
+ if ( *a == NULL ) {
+ *a = (char **) LDAP_MALLOC( 2 * sizeof(char *) );
+ n = 0;
+
+ if( *a == NULL ) {
+ return -1;
+ }
+
+ } else {
+ char **new;
+
+ for ( n = 0; *a != NULL && (*a)[n] != NULL; n++ ) {
+ ; /* NULL */
+ }
+
+ new = (char **) LDAP_REALLOC( (char *) *a,
+ (n + 2) * sizeof(char *) );
+
+ if( new == NULL ) {
+ /* caller is required to call ldap_charray_free(*a) */
+ return -1;
+ }
+
+ *a = new;
+ }
+
+ (*a)[n] = LDAP_STRDUP(s);
+
+ if( (*a)[n] == NULL ) {
+ return 1;
+ }
+
+ (*a)[++n] = NULL;
+
+ return 0;
+}
+
+int
+ldap_charray_merge(
+ char ***a,
+ char **s
+)
+{
+ int i, n, nn;
+ char **aa;
+
+ for ( n = 0; *a != NULL && (*a)[n] != NULL; n++ ) {
+ ; /* NULL */
+ }
+ for ( nn = 0; s[nn] != NULL; nn++ ) {
+ ; /* NULL */
+ }
+
+ aa = (char **) LDAP_REALLOC( (char *) *a, (n + nn + 1) * sizeof(char *) );
+
+ if( aa == NULL )
+ return -1;
+
+ *a = aa;
+
+ for ( i = 0; i < nn; i++ ) {
+ (*a)[n + i] = LDAP_STRDUP(s[i]);
+
+ if( (*a)[n + i] == NULL ) {
+ for( --i ; i >= 0 ; i-- ) {
+ LDAP_FREE( (*a)[n + i] );
+ (*a)[n + i] = NULL;
+ }
+ return -1;
+ }
+ }
+
+ (*a)[n + nn] = NULL;
+ return 0;
+}
+
+void
+ldap_charray_free( char **a )
+{
+ char **p;
+
+ if ( a == NULL ) {
+ return;
+ }
+
+ for ( p = a; *p != NULL; p++ ) {
+ if ( *p != NULL ) {
+ LDAP_FREE( *p );
+ }
+ }
+
+ LDAP_FREE( (char *) a );
+}
+
+int
+ldap_charray_inlist(
+ char **a,
+ char *s
+)
+{
+ int i;
+
+ for ( i = 0; a[i] != NULL; i++ ) {
+ if ( strcasecmp( s, a[i] ) == 0 ) {
+ return( 1 );
+ }
+ }
+
+ return( 0 );
+}
+
+char **
+ldap_charray_dup( char **a )
+{
+ int i;
+ char **new;
+
+ for ( i = 0; a[i] != NULL; i++ )
+ ; /* NULL */
+
+ new = (char **) LDAP_MALLOC( (i + 1) * sizeof(char *) );
+
+ if( new == NULL ) {
+ return NULL;
+ }
+
+ for ( i = 0; a[i] != NULL; i++ ) {
+ new[i] = LDAP_STRDUP( a[i] );
+
+ if( new[i] == NULL ) {
+ for( --i ; i >= 0 ; i-- ) {
+ LDAP_FREE( new[i] );
+ }
+ LDAP_FREE( new );
+ return NULL;
+ }
+ }
+ new[i] = NULL;
+
+ return( new );
+}
+
+char **
+ldap_str2charray( char *str, char *brkstr )
+{
+ char **res;
+ char *s;
+ char *lasts;
+ int i;
+
+ /* protect the input string from strtok */
+ str = LDAP_STRDUP( str );
+ if( str == NULL ) {
+ return NULL;
+ }
+
+ i = 1;
+ for ( s = str; *s; s++ ) {
+ if ( strchr( brkstr, *s ) != NULL ) {
+ i++;
+ }
+ }
+
+ res = (char **) LDAP_MALLOC( (i + 1) * sizeof(char *) );
+
+ if( res == NULL ) {
+ LDAP_FREE( str );
+ return NULL;
+ }
+
+ i = 0;
+
+ for ( s = ldap_pvt_strtok( str, brkstr, &lasts );
+ s != NULL;
+ s = ldap_pvt_strtok( NULL, brkstr, &lasts ) )
+ {
+ res[i] = LDAP_STRDUP( s );
+
+ if(res[i] == NULL) {
+ for( --i ; i >= 0 ; i-- ) {
+ LDAP_FREE( res[i] );
+ }
+ LDAP_FREE( res );
+ LDAP_FREE( str );
+ return NULL;
+ }
+
+ i++;
+ }
+
+ res[i] = NULL;
+
+ LDAP_FREE( str );
+ return( res );
+}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
*
* charset.c
*/
-#if defined( DOS ) || defined( _WIN32 )
-/*
- * This MUST precede "#ifdef STR_TRANSLATION"
- * because STR_TRANSLATION and friends are defined in msdos.h.
- */
-#include "msdos.h"
-#endif /* DOS */
+#include "portable.h"
#ifdef STR_TRANSLATION
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
+#include <ac/stdlib.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
-#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 ) && !defined(VMS)
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#include "lber.h"
-#include "ldap.h"
+
#include "ldap-int.h"
void
ldap_enable_translation( LDAP *ld, LDAPMessage *entry, int enable )
{
- char *optionsp;
+ unsigned short *optionsp;
- optionsp = ( entry == NULLMSG ) ? &ld->ld_lberoptions :
+ optionsp = ( entry == NULL ) ? &ld->ld_lberoptions :
&entry->lm_ber->ber_options;
if ( enable ) {
int
-ldap_translate_from_t61( LDAP *ld, char **bufp, unsigned long *lenp,
+ldap_translate_from_t61( LDAP *ld, char **bufp, ber_len_t *lenp,
int free_input )
{
- if ( ld->ld_lber_decode_translate_proc == NULL ) {
+ if ( ld->ld_lber_decode_translate_proc == 0 ) {
return( LDAP_SUCCESS );
}
int
-ldap_translate_to_t61( LDAP *ld, char **bufp, unsigned long *lenp,
+ldap_translate_to_t61( LDAP *ld, char **bufp, ber_len_t *lenp,
int free_input )
{
- if ( ld->ld_lber_encode_translate_proc == NULL ) {
+ if ( ld->ld_lber_encode_translate_proc == 0 ) {
return( LDAP_SUCCESS );
}
#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <ac/stdlib.h>
+#include <ac/string.h>
/* Character set used: ISO 8859-1, ISO 8859-2, ISO 8859-3, ... */
/* #define ISO_8859 1 */
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 */
+/* Prototypes without LDAP_P():
+ * 'Byte' in definition incompatible with unprototyped declaration. */
+static Byte *c_to_hh ( Byte *o, Byte c );
+static Byte *c_to_cc ( Byte *o, const Couple *cc, Byte c );
+static int hh_to_c ( const Byte *h );
+static Byte *cc_to_t61 ( Byte *o, const Byte *s );
/*
Character choosed as base in diacritics alone: NO-BREAK SPACE.
*/
#define ALONE 0xA0
-static Couple diacritic[16] = {
+static const Couple diacritic[16] = {
#if (ISO_8859 == 1) || (ISO_8859 == 9)
{0,0}, {'`',0}, {0xb4,0}, {'^',0},
{'~',0}, {0xaf,0}, {'(',ALONE}, {'.',ALONE},
L, N, O, R, S, T, U, W, Y, Z.
-----------------------------------------------------------------------
*/
-static int letter_w_diacritic[16][38] = {
+static const 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,
/*
--- T.61 characters [0xA0 .. 0xBF] -----------------
*/
-static Couple trans_t61a_iso8859[32] = {
+static const 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},
/*
--- T.61 characters [0xE0 .. 0xFF] -----------------
*/
-static Couple trans_t61b_iso8859[48] = {
+static const Couple trans_t61b_iso8859[48] = {
#if (ISO_8859 == 1)
{'-','M'}, {0xb9,0}, {0xae,0}, {0xa9,0},
{'T','M'}, {'M','8'}, {0xac,0}, {0xa6,0},
--- ISO 8859-n characters <0xA0 .. 0xFF> -------------------
*/
#if (ISO_8859 == 1)
-static Couple trans_iso8859_t61[96] = {
+static const 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},
{0xc8,'u'}, {0xc2,'y'}, {0xfc,0}, {0xc8,'y'}
};
#elif (ISO_8859 == 2)
-static Couple trans_iso8859_t61[96] = {
+static const 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'},
{0xc8,'u'}, {0xc2,'y'}, {0xcb,'t'}, {0xc7,ALONE}
};
#elif (ISO_8859 == 3)
-static Couple trans_iso8859_t61[96] = {
+static const 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'},
{0xc8,'u'}, {0xc6,'u'}, {0xc3,'s'}, {0xc7,ALONE}
};
#elif (ISO_8859 == 4)
-static Couple trans_iso8859_t61[96] = {
+static const 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'},
{0xc8,'u'}, {0xc4,'u'}, {0xc5,'u'}, {0xc7,ALONE}
};
#elif (ISO_8859 == 9)
-static Couple trans_iso8859_t61[96] = {
+static const 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},
{0xc8,'u'}, {0xf5,0}, {0xcb,'s'}, {0xc8,'y'}
};
#elif (ISO_8859 == 10)
-static Couple trans_iso8859_t61[96] = {
+static const 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},
static Byte *
-c_to_cc( Byte *o, Couple *cc, Byte c )
+c_to_cc( Byte *o, const Couple *cc, Byte c )
{
if ( (*cc).a != 0 ) {
if ( (*cc).b == 0 )
/* --- routine to convert from T.61 to ISO 8859-n --- */
int
-ldap_t61_to_8859( char **bufp, unsigned long *buflenp, int free_input )
+ldap_t61_to_8859( char **bufp, ber_len_t *buflenp, int free_input )
{
Byte *s, *oo, *o;
unsigned int n;
int c;
- unsigned long len;
- Couple *cc;
+ ber_len_t len;
Debug( LDAP_DEBUG_TRACE, "ldap_t61_to_8859 input length: %ld\n",
*buflenp, 0, 0 );
len = *buflenp;
s = (Byte *) *bufp;
- if ( (o = oo = (Byte *)malloc( 2 * len + 64 )) == NULL ) {
+ if ( (o = oo = (Byte *)LDAP_MALLOC( 2 * len + 64 )) == NULL ) {
return( 1 );
}
len = o - oo;
o = oo;
- if ( (oo = (Byte *)realloc( o, len )) == NULL ) {
- free( o );
+ if ( (oo = (Byte *)LDAP_REALLOC( o, len )) == NULL ) {
+ LDAP_FREE( o );
return( 1 );
}
if ( free_input ) {
- free( *bufp );
+ LDAP_FREE( *bufp );
}
*bufp = (char *) oo;
*buflenp = len;
static int
-hh_to_c( Byte *h )
+hh_to_c( const Byte *h )
{
Byte c;
static Byte *
-cc_to_t61( Byte *o, Byte *s )
+cc_to_t61( Byte *o, const Byte *s )
{
int n, c = 0;
/* --- routine to convert from ISO 8859-n to T.61 --- */
int
-ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input )
+ldap_8859_to_t61( char **bufp, ber_len_t *buflenp, int free_input )
{
Byte *s, *oo, *o, *aux;
int c;
- unsigned long len;
- Couple *cc;
+ ber_len_t len;
+ const Couple *cc;
Debug( LDAP_DEBUG_TRACE, "ldap_8859_to_t61 input length: %ld\n",
*buflenp, 0, 0 );
len = *buflenp;
s = (Byte *) *bufp;
- if ( (o = oo = (Byte *)malloc( 2 * len + 64 )) == NULL ) {
+ if ( (o = oo = (Byte *)LDAP_MALLOC( 2 * len + 64 )) == NULL ) {
return( 1 );
}
len = o - oo;
o = oo;
- if ( (oo = (Byte *)realloc( o, len )) == NULL ) {
- free( o );
+ if ( (oo = (Byte *)LDAP_REALLOC( o, len )) == NULL ) {
+ LDAP_FREE( o );
return( 1 );
}
if ( free_input ) {
- free( *bufp );
+ LDAP_FREE( *bufp );
}
*bufp = (char *) oo;
*buflenp = len;
while ( *s ) {
if ( *s == '\\' ) {
- if ( (c = hh_to_c( ++s )) != -1 ) {
+ if ( (c = hh_to_c( (Byte *) ++s )) != -1 ) {
*o++ = c;
s += 2;
} else
/* --- routine to convert 8bits characters to the "escaped" (\hh) form --- */
char *convert_8bit_to_escaped( s )
-Byte *s;
+const Byte *s;
{
Byte *o, *oo;
Byte n;
- if ( (o = oo = (Byte *)malloc( 2 * strlen( s ) + 64 )) == NULL ) {
+ if ( (o = oo = (Byte *)LDAP_MALLOC( 2 * strlen( s ) + 64 )) == NULL ) {
return( NULL );
}
o = oo;
- if ( (oo = (Byte *)realloc( o, strlen( o ) + 1 )) == NULL ) {
- free( o );
+ if ( (oo = (Byte *)LDAP_REALLOC( o, strlen( o ) + 1 )) == NULL ) {
+ LDAP_FREE( o );
return( NULL );
}
that conversion is language dependent.
*/
-static Couple last_t61_printabled[32] = {
+static const 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},
{
Byte *o, *oo;
Byte n;
- Couple *cc;
+ const Couple *cc;
- if ( (o = oo = (Byte *)malloc( 2 * strlen( s ) + 64 )) == NULL ) {
+ if ( (o = oo = (Byte *)LDAP_MALLOC( 2 * strlen( s ) + 64 )) == NULL ) {
return( NULL );
}
o = oo;
- if ( (oo = (Byte *)realloc( o, strlen( o ) + 1 )) == NULL ) {
- free( o );
+ if ( (oo = (Byte *)LDAP_REALLOC( o, strlen( o ) + 1 )) == NULL ) {
+ LDAP_FREE( o );
return( NULL );
}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990, 1994 Regents of the University of Michigan.
* All rights reserved.
*
* cldap.c - synchronous, retrying interface to the cldap protocol
*/
+#include "portable.h"
-#ifdef CLDAP
-
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990, 1994 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#ifdef LDAP_CONNECTIONLESS
#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include "msdos.h"
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+
+#include <ac/stdlib.h>
+
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
#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;
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 */
+static int add_addr LDAP_P((
+ LDAP *ld, struct sockaddr *sap ));
+static int cldap_result LDAP_P((
+ LDAP *ld, int msgid, LDAPMessage **res,
+ struct cldap_retinfo *crip, const char *base ));
+static int cldap_parsemsg LDAP_P((
+ LDAP *ld, int msgid, BerElement *ber,
+ LDAPMessage **res, const char *base ));
/*
* cldap_open - initialize and connect to an ldap server. A magic cookie to
*/
LDAP *
-cldap_open( char *host, int port )
+cldap_open( LDAP_CONST char *host, int port )
{
int s;
unsigned long address;
char *p;
int i;
- Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 );
+ /* buffers for ldap_pvt_gethostbyname_a ... */
+ struct hostent he_buf;
+ int local_h_errno;
+ char *ha_buf=NULL;
- if ( port == 0 ) {
- port = LDAP_PORT;
- }
+#define DO_RETURN(x) if (ha_buf) LDAP_FREE(ha_buf); return (x);
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 );
if ( (s = socket( AF_INET, SOCK_DGRAM, 0 )) < 0 ) {
return( NULL );
sock.sin_family = AF_INET;
sock.sin_port = 0;
if ( bind(s, (struct sockaddr *) &sock, sizeof(sock)) < 0) {
- close( s );
+ tcp_close( s );
return( NULL );
}
-
if (( ld = ldap_init( host, port )) == NULL ) {
- close( s );
+ tcp_close( s );
return( NULL );
}
- if ( (ld->ld_sb.sb_fromaddr = (void *) calloc( 1,
- sizeof( struct sockaddr ))) == NULL ) {
- free( ld );
- close( s );
- return( NULL );
- }
- ld->ld_sb.sb_sd = s;
- ld->ld_sb.sb_naddr = 0;
- ld->ld_version = LDAP_VERSION;
+
+ ld->ld_cldapnaddr = 0;
+ ld->ld_cldapaddrs = NULL;
+
+ if (ber_pvt_sb_set_io( &(ld->ld_sb), &ber_pvt_sb_io_udp, NULL )<0) {
+ ldap_ld_free(ld, 1, NULL, NULL );
+ return NULL;
+ }
+
+ ld->ld_version = LDAP_VERSION2;
sock.sin_family = AF_INET;
sock.sin_port = htons( port );
* 'host' may be a space-separated list.
*/
if ( host != NULL ) {
+ char *host_dup = LDAP_STRDUP( host );
+ host = host_dup;
for ( ; host != NULL; host = p ) {
if (( p = strchr( host, ' ' )) != NULL ) {
for (*p++ = '\0'; *p == ' '; p++) {
}
}
- if ( (address = inet_addr( host )) == -1 ) {
- if ( (hp = gethostbyname( host )) == NULL ) {
- errno = EHOSTUNREACH;
- continue;
+ address = inet_addr( host );
+ /* This was just a test for -1 until OSF1 let inet_addr return
+ unsigned int, which is narrower than 'unsigned long address' */
+ if ( address == 0xffffffff || address == (unsigned long) -1 ) {
+ if ((ldap_pvt_gethostbyname_a( host, &he_buf, &ha_buf,
+ &hp,&local_h_errno)<0) ||
+ (hp==NULL)) {
+ errno = EHOSTUNREACH;
+ continue;
}
for ( i = 0; hp->h_addr_list[ i ] != 0; ++i ) {
(char *)hp->h_addr_list[ i ],
sizeof(sock.sin_addr.s_addr));
if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) {
- close( s );
- free( ld );
- return( NULL );
+ ldap_ld_free( ld, 1, NULL, NULL );
+ LDAP_FREE( host_dup );
+ DO_RETURN( NULL );
}
}
} else {
sock.sin_addr.s_addr = address;
if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) {
- close( s );
- free( ld );
- return( NULL );
+ ldap_ld_free( ld, 1, NULL, NULL );
+ LDAP_FREE( host_dup );
+ DO_RETURN( NULL );
}
}
if ( ld->ld_host == NULL ) {
- ld->ld_host = strdup( host );
+ ld->ld_host = LDAP_STRDUP( host );
}
}
-
+ LDAP_FREE( host_dup );
} else {
- address = INADDR_LOOPBACK;
- sock.sin_addr.s_addr = htonl( address );
+ sock.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) {
- close( s );
- free( ld );
- return( NULL );
+ ldap_ld_free( ld, 1, NULL, NULL );
+ DO_RETURN( NULL );
}
}
- if ( ld->ld_sb.sb_addrs == NULL
-#ifdef LDAP_REFERRALS
- || ( ld->ld_defconn = new_connection( ld, NULL, 1,0,0 )) == NULL
-#endif /* LDAP_REFERRALS */
+ if ( ld->ld_cldapaddrs == NULL
+ || ( ld->ld_defconn = ldap_new_connection( ld, NULL, 1,0,0 )) == NULL
) {
- free( ld );
- return( NULL );
+ ldap_ld_free( ld, 0, NULL, NULL );
+ DO_RETURN( NULL );
}
- ld->ld_sb.sb_useaddr = ld->ld_sb.sb_addrs[ 0 ];
+ ber_pvt_sb_udp_set_dst( &ld->ld_sb, ld->ld_cldapaddrs[0] );
+
cldap_setretryinfo( ld, 0, 0 );
#ifdef LDAP_DEBUG
putchar( '\n' );
- for ( i = 0; i < ld->ld_sb.sb_naddr; ++i ) {
+ for ( i = 0; i < ld->ld_cldapnaddr; ++i ) {
Debug( LDAP_DEBUG_TRACE, "end of cldap_open address %d is %s\n",
i, inet_ntoa( ((struct sockaddr_in *)
- ld->ld_sb.sb_addrs[ i ])->sin_addr ), 0 );
+ ld->ld_cldapaddrs[ i ])->sin_addr ), 0 );
}
#endif
- return( ld );
+ DO_RETURN( ld );
}
-
+#undef DO_RETURN
void
cldap_close( LDAP *ld )
{
- ldap_ld_free( ld, 0 );
+ ldap_ld_free( ld, 0, NULL, NULL );
}
int
-cldap_search_s( LDAP *ld, char *base, int scope, char *filter, char **attrs,
- int attrsonly, LDAPMessage **res, char *logdn )
+cldap_search_s( LDAP *ld,
+ LDAP_CONST char *base,
+ int scope,
+ LDAP_CONST char *filter,
+ char **attrs,
+ int attrsonly,
+ LDAPMessage **res,
+ char *logdn )
{
int ret, msgid;
struct cldap_retinfo cri;
- *res = NULLMSG;
+ *res = NULL;
(void) memset( &cri, 0, sizeof( cri ));
if ( cri.cri_try != 0 ) {
--ld->ld_msgid; /* use same id as before */
}
- ld->ld_sb.sb_useaddr = ld->ld_sb.sb_addrs[ cri.cri_useaddr ];
+
+ ber_pvt_sb_udp_set_dst( &(ld->ld_sb),
+ ld->ld_cldapaddrs[ cri.cri_useaddr ] );
Debug( LDAP_DEBUG_TRACE, "cldap_search_s try %d (to %s)\n",
cri.cri_try, inet_ntoa( ((struct sockaddr_in *)
- ld->ld_sb.sb_useaddr)->sin_addr ), 0 );
+ ld->ld_cldapaddrs[ cri.cri_useaddr ])->sin_addr), 0 );
if ( (msgid = ldap_search( ld, base, scope, filter, attrs,
attrsonly )) == -1 ) {
return( ld->ld_errno );
}
-#ifndef NO_CACHE
+#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL && ld->ld_responses != NULL ) {
Debug( LDAP_DEBUG_TRACE, "cldap_search_s res from cache\n",
0, 0, 0 );
ld->ld_responses = ld->ld_responses->lm_next;
return( ldap_result2error( ld, *res, 0 ));
}
-#endif /* NO_CACHE */
+#endif /* LDAP_NOCACHE */
ret = cldap_result( ld, msgid, res, &cri, base );
} while (ret == -1);
{
struct sockaddr *newsap, **addrs;
- if (( newsap = (struct sockaddr *)malloc( sizeof( struct sockaddr )))
+ if (( newsap = (struct sockaddr *)LDAP_MALLOC( sizeof( struct sockaddr )))
== NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( -1 );
}
-
- if ( ld->ld_sb.sb_naddr == 0 ) {
- addrs = (struct sockaddr **)malloc( sizeof(struct sockaddr *));
- } else {
- addrs = (struct sockaddr **)realloc( ld->ld_sb.sb_addrs,
- ( ld->ld_sb.sb_naddr + 1 ) * sizeof(struct sockaddr *));
- }
+
+ addrs = (struct sockaddr **)LDAP_REALLOC( ld->ld_cldapaddrs,
+ ( ld->ld_cldapnaddr + 1 ) * sizeof(struct sockaddr *));
if ( addrs == NULL ) {
- free( newsap );
+ LDAP_FREE( newsap );
ld->ld_errno = LDAP_NO_MEMORY;
return( -1 );
}
SAFEMEMCPY( (char *)newsap, (char *)sap, sizeof( struct sockaddr ));
- addrs[ ld->ld_sb.sb_naddr++ ] = newsap;
- ld->ld_sb.sb_addrs = (void **)addrs;
+ addrs[ ld->ld_cldapnaddr++ ] = newsap;
+ ld->ld_cldapaddrs = (void **)addrs;
return( 0 );
}
static int
cldap_result( LDAP *ld, int msgid, LDAPMessage **res,
- struct cldap_retinfo *crip, char *base )
+ struct cldap_retinfo *crip, const char *base )
{
Sockbuf *sb = &ld->ld_sb;
BerElement ber;
char *logdn;
- int ret, id, fromaddr, i;
+ int ret, fromaddr, i;
+ ber_int_t id;
struct timeval tv;
fromaddr = -1;
if ( crip->cri_try == 0 ) {
- crip->cri_maxtries = ld->ld_cldaptries * sb->sb_naddr;
+ crip->cri_maxtries = ld->ld_cldaptries * ld->ld_cldapnaddr;
crip->cri_timeout = ld->ld_cldaptimeout;
crip->cri_useaddr = 0;
Debug( 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 ) {
+ if ((tv.tv_sec = crip->cri_timeout / ld->ld_cldapnaddr) < 1 ) {
tv.tv_sec = 1;
}
tv.tv_usec = 0;
Debug( LDAP_DEBUG_TRACE,
- "cldap_result waiting up to %d seconds for a response\n",
- tv.tv_sec, 0, 0 );
- ber_init( &ber, 0 );
- set_ber_options( ld, &ber );
+ "cldap_result waiting up to %ld seconds for a response\n",
+ (long) tv.tv_sec, 0, 0 );
+ ber_init_w_nullc( &ber, 0 );
+ ldap_set_ber_options( ld, &ber );
if ( cldap_getmsg( ld, &tv, &ber ) == -1 ) {
ret = ld->ld_errno;
ret = LDAP_TIMEOUT;
--crip->cri_try;
} else {
- if ( ++crip->cri_useaddr >= sb->sb_naddr ) {
+ if ( ++crip->cri_useaddr >= ld->ld_cldapnaddr ) {
/*
* new round: reset address to first one and
* double the timeout
logdn = NULL;
if ( ber_scanf( &ber, "ia", &id, &logdn ) == LBER_ERROR ) {
- free( ber.ber_buf ); /* gack! */
+ LDAP_FREE( ber.ber_buf ); /* gack! */
ret = LDAP_DECODING_ERROR;
Debug( LDAP_DEBUG_TRACE,
"cldap_result: ber_scanf returned LBER_ERROR (%d)\n",
ret, 0, 0 );
} else if ( id != msgid ) {
- free( ber.ber_buf ); /* gack! */
+ LDAP_FREE( ber.ber_buf ); /* gack! */
Debug( LDAP_DEBUG_TRACE,
"cldap_result: looking for msgid %d; got %d\n",
msgid, id, 0 );
ret = -1; /* ignore and keep looking */
} else {
+ struct sockaddr_in * src;
/*
* got a result: determine which server it came from
* decode into ldap message chain
*/
- for ( fromaddr = 0; fromaddr < sb->sb_naddr; ++fromaddr ) {
+ src = (struct sockaddr_in *) ber_pvt_sb_udp_get_src( sb );
+
+ for ( fromaddr = 0; fromaddr < ld->ld_cldapnaddr; ++fromaddr ) {
if ( memcmp( &((struct sockaddr_in *)
- sb->sb_addrs[ fromaddr ])->sin_addr,
- &((struct sockaddr_in *)sb->sb_fromaddr)->sin_addr,
+ ld->ld_cldapaddrs[ fromaddr ])->sin_addr,
+ &(src->sin_addr),
sizeof( struct in_addr )) == 0 ) {
break;
}
}
ret = cldap_parsemsg( ld, msgid, &ber, res, base );
- free( ber.ber_buf ); /* gack! */
+ LDAP_FREE( ber.ber_buf ); /* gack! */
Debug( LDAP_DEBUG_TRACE,
"cldap_result got result (%d)\n", ret, 0, 0 );
}
if ( logdn != NULL ) {
- free( logdn );
+ LDAP_FREE( logdn );
}
}
*/
if ( ret != -1 ) {
i = crip->cri_try;
- if ( i >= sb->sb_naddr ) {
- i = sb->sb_naddr - 1;
+ if ( i >= ld->ld_cldapnaddr ) {
+ i = ld->ld_cldapnaddr - 1;
}
for ( ; i >= 0; --i ) {
if ( i == fromaddr ) {
continue;
}
- sb->sb_useaddr = sb->sb_addrs[ i ];
+ ber_pvt_sb_udp_set_dst( sb, ld->ld_cldapaddrs[i] );
+
Debug( LDAP_DEBUG_TRACE, "cldap_result abandoning id %d (to %s)\n",
msgid, inet_ntoa( ((struct sockaddr_in *)
- sb->sb_useaddr)->sin_addr ), 0 );
+ ld->ld_cldapaddrs[i])->sin_addr ), 0 );
(void) ldap_abandon( ld, msgid );
}
}
static int
cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
- LDAPMessage **res, char *base )
+ LDAPMessage **res, const char *base )
{
- unsigned long tag, len;
- int baselen, slen, rc;
+ ber_tag_t tag;
+ ber_len_t len;
+ int baselen, slen;
+ ber_tag_t rc;
char *dn, *p, *cookie;
LDAPMessage *chain, *prev, *ldm;
struct berval *bv;
rc = LDAP_DECODING_ERROR; /* pessimistic */
- ldm = chain = prev = NULLMSG;
+ ldm = chain = prev = NULL;
baselen = ( base == NULL ) ? 0 : strlen( base );
bv = NULL;
for ( tag = ber_first_element( ber, &len, &cookie );
tag != LBER_DEFAULT && rc != LDAP_SUCCESS;
tag = ber_next_element( ber, &len, cookie )) {
- if (( ldm = (LDAPMessage *)calloc( 1, sizeof(LDAPMessage)))
- == NULL || ( ldm->lm_ber = alloc_ber_with_options( ld ))
- == NULLBER ) {
+ if (( ldm = (LDAPMessage *)LDAP_CALLOC( 1, sizeof(LDAPMessage)))
+ == NULL || ( ldm->lm_ber = ldap_alloc_ber_with_options( ld ))
+ == NULL ) {
rc = LDAP_NO_MEMORY;
break; /* return w/error*/
}
break; /* return w/error */
}
- if ( ber_printf( ldm->lm_ber, "to", tag, bv->bv_val,
- bv->bv_len ) == -1 ) {
+ if ( ber_printf( ldm->lm_ber, "tO", tag, bv ) == -1 ) {
break; /* return w/error */
}
ber_bvfree( bv );
rc = LDAP_SUCCESS;
} else if ( tag == LDAP_RES_SEARCH_ENTRY ) {
- if ( ber_scanf( ber, "{aO", &dn, &bv ) == LBER_ERROR ) {
+ if ( ber_scanf( ber, "{aO" /*}*/, &dn, &bv ) == LBER_ERROR ) {
break; /* return w/error */
}
Debug( LDAP_DEBUG_TRACE, "cldap_parsemsg entry %s\n", dn, 0, 0 );
/*
* substitute original searchbase for trailing '*'
*/
- if (( p = (char *)malloc( slen + baselen )) == NULL ) {
+ if (( p = (char *)LDAP_MALLOC( slen + baselen )) == NULL ) {
rc = LDAP_NO_MEMORY;
- free( dn );
+ LDAP_FREE( dn );
break; /* return w/error */
}
strcpy( p, dn );
strcpy( p + slen - 1, base );
- free( dn );
+ LDAP_FREE( dn );
dn = p;
}
bv->bv_len ) == -1 ) {
break; /* return w/error */
}
- free( dn );
+ LDAP_FREE( dn );
ber_bvfree( bv );
bv = NULL;
+#ifdef notyet
+ } else if ( tag == LDAP_RES_SEARCH_REFERENCE ) {
+#endif
} else {
- Debug( LDAP_DEBUG_TRACE, "cldap_parsemsg got unknown tag %d\n",
+ Debug( LDAP_DEBUG_TRACE, "cldap_parsemsg got unknown tag %lu\n",
tag, 0, 0 );
- rc = LDAP_PROTOCOL_ERROR;
+ rc = LDAP_DECODING_ERROR;
break; /* return w/error */
}
#ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
- fprintf( stderr, "cldap_parsemsg add message id %d type %d:\n",
- ldm->lm_msgid, ldm->lm_msgtype );
- ber_dump( ldm->lm_ber, 1 );
+ fprintf( stderr, "cldap_parsemsg add message id %ld type %ld:\n",
+ (long) ldm->lm_msgid, (long) ldm->lm_msgtype );
+ ber_log_dump( LDAP_DEBUG_BER, ldap_debug, ldm->lm_ber, 1 );
}
#endif /* LDAP_DEBUG */
-#ifndef NO_CACHE
+#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL ) {
- add_result_to_cache( ld, ldm );
+ ldap_add_result_to_cache( ld, ldm );
}
-#endif /* NO_CACHE */
+#endif /* LDAP_NOCACHE */
if ( chain == NULL ) {
chain = ldm;
/* dispose of any leftovers */
if ( ldm != NULL ) {
- if ( ldm->lm_ber != NULLBER ) {
+ if ( ldm->lm_ber != NULL ) {
ber_free( ldm->lm_ber, 1 );
}
- free( ldm );
+ LDAP_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 ));
+ return(( *res == NULL ) ? rc : ldap_result2error( ld, *res, 0 ));
}
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* compare.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+/* The compare request looks like this:
+ * CompareRequest ::= SEQUENCE {
+ * entry DistinguishedName,
+ * ava SEQUENCE {
+ * type AttributeType,
+ * value AttributeValue
+ * }
+ * }
+ */
-#include <stdio.h>
-#include <string.h>
+#include "portable.h"
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
+#include <stdio.h>
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
-#include "lber.h"
-#include "ldap.h"
#include "ldap-int.h"
/*
- * ldap_compare - perform an ldap (and X.500) compare operation. The dn
+ * ldap_compare_ext - perform an ldap extended 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" )
+ * struct berval bvalue = { "secret", strlen("secret") };
+ * rc = ldap_compare( ld, "c=us@cn=bob",
+ * "userPassword", &bvalue,
+ * sctrl, cctrl, &msgid )
*/
int
-ldap_compare( LDAP *ld, char *dn, char *attr, char *value )
+ldap_compare_ext(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *attr,
+ struct berval *bvalue,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ int *msgidp )
{
BerElement *ber;
- /* The compare request looks like this:
- * CompareRequest ::= SEQUENCE {
- * entry DistinguishedName,
- * ava SEQUENCE {
- * type AttributeType,
- * value AttributeValue
- * }
- * }
- * and must be wrapped in an LDAPMessage.
- */
-
Debug( LDAP_DEBUG_TRACE, "ldap_compare\n", 0, 0, 0 );
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( dn != NULL );
+ assert( attr != NULL );
+ assert( msgidp != NULL );
+
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
- return( -1 );
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ return( LDAP_NO_MEMORY );
+ }
+
+ if ( ber_printf( ber, "{it{s{sO}}", /* '}' */
+ ++ld->ld_msgid,
+ LDAP_REQ_COMPARE, dn, attr, &bvalue ) == -1 )
+ {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free( ber, 1 );
+ return( ld->ld_errno );
+ }
+
+ /* Put Server Controls */
+ if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
+ ber_free( ber, 1 );
+ return ld->ld_errno;
}
- if ( ber_printf( ber, "{it{s{ss}}}", ++ld->ld_msgid, LDAP_REQ_COMPARE,
- dn, attr, value ) == -1 ) {
+ if( ber_printf( ber, /*{*/ "}" ) == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
- return( -1 );
+ return( ld->ld_errno );
}
-#ifndef NO_CACHE
+#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL ) {
- if ( check_cache( ld, LDAP_REQ_COMPARE, ber ) == 0 ) {
+ if ( ldap_check_cache( ld, LDAP_REQ_COMPARE, ber ) == 0 ) {
ber_free( ber, 1 );
ld->ld_errno = LDAP_SUCCESS;
- return( ld->ld_msgid );
+ *msgidp = ld->ld_msgid;
+ return( ld->ld_errno );
}
- add_request_to_cache( ld, LDAP_REQ_COMPARE, ber );
+ ldap_add_request_to_cache( ld, LDAP_REQ_COMPARE, ber );
}
-#endif /* NO_CACHE */
+#endif /* LDAP_NOCACHE */
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber ));
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber );
+ return ( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS );
+}
+
+/*
+ * ldap_compare_ext - perform an ldap extended 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:
+ * msgid = ldap_compare( ld, "c=us@cn=bob", "userPassword", "secret" )
+ */
+int
+ldap_compare(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *attr,
+ LDAP_CONST char *value )
+{
+ int msgid;
+ struct berval bvalue;
+
+ bvalue.bv_val = (char *) value;
+ bvalue.bv_len = (value == NULL) ? 0 : strlen( value );
+
+ return ldap_compare_ext( ld, dn, attr, &bvalue, NULL, NULL, &msgid ) == LDAP_SUCCESS
+ ? msgid : -1;
}
int
-ldap_compare_s( LDAP *ld, char *dn, char *attr, char *value )
+ldap_compare_ext_s(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *attr,
+ struct berval *bvalue,
+ LDAPControl **sctrl,
+ LDAPControl **cctrl )
{
+ int rc;
int msgid;
LDAPMessage *res;
- if ( (msgid = ldap_compare( ld, dn, attr, value )) == -1 )
- return( ld->ld_errno );
+ rc = ldap_compare_ext( ld, dn, attr, bvalue, sctrl, cctrl, &msgid );
+
+ if ( rc != LDAP_SUCCESS )
+ return( rc );
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
return( ld->ld_errno );
return( ldap_result2error( ld, res, 1 ) );
}
+
+int
+ldap_compare_s(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *attr,
+ LDAP_CONST char *value )
+{
+ struct berval bvalue;
+
+ bvalue.bv_val = (char *) value;
+ bvalue.bv_len = (value == NULL) ? 0 : strlen( value );
+
+ return ldap_compare_ext_s( ld, dn, attr, &bvalue, NULL, NULL );
+}
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+/* LDAPv3 Controls (RFC2251)
+ *
+ * Controls ::= SEQUENCE OF Control
+ *
+ * Control ::= SEQUENCE {
+ * controlType LDAPOID,
+ * criticality BOOLEAN DEFAULT FALSE,
+ * controlValue OCTET STRING OPTIONAL
+ * }
+ */
+
+#include "portable.h"
+
+#include <ac/stdlib.h>
+
+#include <ac/time.h>
+#include <ac/string.h>
+
+#include "ldap-int.h"
+
+
+/*
+ * ldap_int_put_controls
+ */
+
+int
+ldap_int_put_controls(
+ LDAP *ld,
+ LDAPControl *const *ctrls,
+ BerElement *ber )
+{
+ LDAPControl *const *c;
+
+ assert( ld != NULL );
+ assert( ber != NULL );
+
+ if( ctrls == NULL ) {
+ /* use default server controls */
+ ctrls = ld->ld_sctrls;
+ }
+
+ if( ctrls == NULL || *ctrls == NULL ) {
+ return LDAP_SUCCESS;
+ }
+
+ if ( ld->ld_version < LDAP_VERSION3 ) {
+ /* LDAPv2 doesn't support controls,
+ * error if any control is critical
+ */
+ for( c = ctrls ; *c != NULL; c++ ) {
+ if( (*c)->ldctl_iscritical ) {
+ ld->ld_errno = LDAP_NOT_SUPPORTED;
+ return ld->ld_errno;
+ }
+ }
+
+ return LDAP_SUCCESS;
+ }
+
+ /* Controls are encoded as a sequence of sequences */
+ if( ber_printf( ber, "t{"/*}*/, LDAP_TAG_CONTROLS ) == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ return ld->ld_errno;
+ }
+
+ for( c = ctrls ; *c != NULL; c++ ) {
+ if ( ber_printf( ber, "{s" /*}*/,
+ (*c)->ldctl_oid ) == -1 )
+ {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ return ld->ld_errno;
+ }
+
+ if( (*c)->ldctl_iscritical /* only if true */
+ && ( ber_printf( ber, "b",
+ (ber_int_t) (*c)->ldctl_iscritical ) == -1 ) )
+ {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ return ld->ld_errno;
+ }
+
+ if( (*c)->ldctl_value.bv_val != NULL /* only if we have a value */
+ && ( ber_printf( ber, "O",
+ &((*c)->ldctl_value) ) == -1 ) )
+ {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ return ld->ld_errno;
+ }
+
+
+ if( ber_printf( ber, /*{*/"}" ) == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ return ld->ld_errno;
+ }
+ }
+
+
+ if( ber_printf( ber, /*{*/"}" ) == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ return ld->ld_errno;
+ }
+
+ return LDAP_SUCCESS;
+}
+
+int ldap_int_get_controls(
+ BerElement *ber,
+ LDAPControl ***ctrls )
+{
+ int nctrls;
+ ber_tag_t tag;
+ ber_len_t len;
+ char *opaque;
+
+ assert( ber != NULL );
+
+ if( ctrls == NULL ) {
+ return LDAP_SUCCESS;
+ }
+ *ctrls = NULL;
+
+ len = ber_pvt_ber_remaining(ber);
+
+ if( len == 0) {
+ /* no controls */
+ return LDAP_SUCCESS;
+ }
+
+
+ if(( tag = ber_peek_tag( ber, &len )) != LDAP_TAG_CONTROLS ) {
+ if( tag == LBER_ERROR ) {
+ /* decoding error */
+ return LDAP_DECODING_ERROR;
+ }
+
+ /* ignore unexpected input */
+ return LDAP_SUCCESS;
+ }
+
+ /* set through each element */
+ nctrls = 0;
+ *ctrls = LDAP_MALLOC( 1 * sizeof(LDAPControl *) );
+
+ if( *ctrls == NULL ) {
+ return LDAP_NO_MEMORY;
+ }
+
+ ctrls[nctrls] = NULL;
+
+ for( tag = ber_first_element( ber, &len, &opaque );
+ tag != LBER_ERROR;
+ tag = ber_next_element( ber, &len, opaque ) )
+ {
+ LDAPControl *tctrl;
+ LDAPControl **tctrls;
+
+ tctrl = LDAP_CALLOC( 1, sizeof(LDAPControl) );
+
+ /* allocate pointer space for current controls (nctrls)
+ * + this control + extra NULL
+ */
+ tctrls = (tctrl == NULL) ? NULL :
+ LDAP_REALLOC(*ctrls, (nctrls+2) * sizeof(LDAPControl *));
+
+ if( tctrls == NULL ) {
+ /* one of the above allocation failed */
+
+ if( tctrl != NULL ) {
+ LDAP_FREE( tctrl );
+ }
+
+ ldap_controls_free(*ctrls);
+ *ctrls = NULL;
+
+ return LDAP_NO_MEMORY;
+ }
+
+
+ tctrls[nctrls++] = tctrl;
+ tctrls[nctrls] = NULL;
+
+ tag = ber_scanf( ber, "{a" /*}*/, &tctrl->ldctl_oid );
+
+ if( tag != LBER_ERROR ) {
+ tag = ber_peek_tag( ber, &len );
+ }
+
+ if( tag == LBER_BOOLEAN ) {
+ ber_int_t crit;
+ tag = ber_scanf( ber, "b", &crit );
+ tctrl->ldctl_iscritical = crit ? (char) 0 : (char) ~0;
+ }
+
+ if( tag != LBER_ERROR ) {
+ tag = ber_peek_tag( ber, &len );
+ }
+
+ if( tag == LBER_OCTETSTRING ) {
+ tag = ber_scanf( ber, "o", &tctrl->ldctl_value );
+
+ } else {
+ tctrl->ldctl_value.bv_val = NULL;
+ }
+
+ if( tag == LBER_ERROR ) {
+ *ctrls = NULL;
+ ldap_controls_free( tctrls );
+ return LDAP_DECODING_ERROR;
+ }
+
+ *ctrls = tctrls;
+ }
+
+ return LDAP_SUCCESS;
+}
+
+/*
+ * Free a LDAPControl
+ */
+void
+ldap_control_free( LDAPControl *c )
+{
+ assert( c != NULL );
+
+ if ( c != NULL ) {
+ if( c->ldctl_oid != NULL) {
+ LDAP_FREE( c->ldctl_oid );
+ }
+
+ if( c->ldctl_value.bv_val != NULL ) {
+ LDAP_FREE( c->ldctl_value.bv_val );
+ }
+
+ LDAP_FREE( c );
+ }
+}
+
+/*
+ * Free an array of LDAPControl's
+ */
+void
+ldap_controls_free( LDAPControl **controls )
+{
+ assert( controls != NULL );
+
+ if ( controls != NULL ) {
+ int i;
+
+ for( i=0; controls[i] != NULL; i++) {
+ ldap_control_free( controls[i] );
+ }
+
+ LDAP_FREE( controls );
+ }
+}
+
+/*
+ * Duplicate an array of LDAPControl
+ */
+LDAPControl **
+ldap_controls_dup( LDAPControl *const *controls )
+{
+ LDAPControl **new;
+ int i;
+
+ if ( controls == NULL ) {
+ return NULL;
+ }
+
+ /* count the controls */
+ for(i=0; controls[i] != NULL; i++) /* empty */ ;
+
+ if( i < 1 ) {
+ /* no controls to duplicate */
+ return NULL;
+ }
+
+ new = (LDAPControl **) LDAP_MALLOC( i * sizeof(LDAPControl *) );
+
+ if( new == NULL ) {
+ /* memory allocation failure */
+ return NULL;
+ }
+
+ /* duplicate the controls */
+ for(i=0; controls[i] != NULL; i++) {
+ new[i] = ldap_control_dup( controls[i] );
+
+ if( new[i] == NULL ) {
+ ldap_controls_free( new );
+ return NULL;
+ }
+ }
+
+ new[i] = NULL;
+
+ return new;
+}
+
+/*
+ * Duplicate a LDAPControl
+ */
+LDAPControl *
+ldap_control_dup( const LDAPControl *c )
+{
+ LDAPControl *new;
+
+ if ( c == NULL ) {
+ return NULL;
+ }
+
+ new = (LDAPControl *) LDAP_MALLOC( sizeof(LDAPControl) );
+
+ if( new == NULL ) {
+ return NULL;
+ }
+
+ if( c->ldctl_oid != NULL ) {
+ new->ldctl_oid = LDAP_STRDUP( c->ldctl_oid );
+
+ if(new->ldctl_oid == NULL) {
+ LDAP_FREE( new );
+ return NULL;
+ }
+
+ } else {
+ new->ldctl_oid = NULL;
+ }
+
+ if( c->ldctl_value.bv_len > 0 ) {
+ new->ldctl_value.bv_val = (char *) LDAP_MALLOC( c->ldctl_value.bv_len );
+
+ if(new->ldctl_value.bv_val == NULL) {
+ if(new->ldctl_oid != NULL) {
+ LDAP_FREE( new->ldctl_oid );
+ }
+ LDAP_FREE( new );
+ return NULL;
+ }
+
+ SAFEMEMCPY( new->ldctl_value.bv_val, c->ldctl_value.bv_val,
+ c->ldctl_value.bv_len );
+
+ new->ldctl_value.bv_len = c->ldctl_value.bv_len;
+
+ } else {
+ new->ldctl_value.bv_len = 0;
+ new->ldctl_value.bv_val = NULL;
+ }
+
+ new->ldctl_iscritical = c->ldctl_iscritical;
+ return new;
+}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* delete.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
-#include <stdio.h>
-#include <string.h>
+/*
+ * A delete request looks like this:
+ * DelRequet ::= DistinguishedName,
+ */
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
+#include "portable.h"
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS */
+#include <stdio.h>
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
-#include "lber.h"
-#include "ldap.h"
#include "ldap-int.h"
/*
- * ldap_delete - initiate an ldap (and X.500) delete operation. Parameters:
+ * ldap_delete_ext - initiate an ldap extended delete operation. Parameters:
*
* ld LDAP descriptor
* dn DN of the object to delete
+ * sctrls Server Controls
+ * cctrls Client Controls
+ * msgidp Message Id Pointer
*
* Example:
- * msgid = ldap_delete( ld, dn );
+ * rc = ldap_delete( ld, dn, sctrls, cctrls, msgidp );
*/
int
-ldap_delete( LDAP *ld, char *dn )
+ldap_delete_ext(
+ LDAP *ld,
+ LDAP_CONST char* dn,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ int *msgidp )
{
BerElement *ber;
- /*
- * A delete request looks like this:
- * DelRequet ::= DistinguishedName,
- */
-
Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( dn != NULL );
+ assert( msgidp != NULL );
+
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
- return( -1 );
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return( ld->ld_errno );
}
- if ( ber_printf( ber, "{its}", ++ld->ld_msgid, LDAP_REQ_DELETE, dn )
- == -1 ) {
+ if ( ber_printf( ber, "{its", /* '}' */
+ ++ld->ld_msgid, LDAP_REQ_DELETE, dn ) == -1 )
+ {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
- return( -1 );
+ return( ld->ld_errno );
+ }
+
+ /* Put Server Controls */
+ if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
+ ber_free( ber, 1 );
+ return ld->ld_errno;
+ }
+
+ if ( ber_printf( ber, /*{*/ "}" ) == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free( ber, 1 );
+ return( ld->ld_errno );
}
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
-}
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber );
+
+ if(*msgidp < 0)
+ return ld->ld_errno;
+ return LDAP_SUCCESS;
+}
int
-ldap_delete_s( LDAP *ld, char *dn )
+ldap_delete_ext_s(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls )
{
- int msgid;
+ int msgid;
+ int rc;
LDAPMessage *res;
- if ( (msgid = ldap_delete( ld, dn )) == -1 )
+ rc = ldap_delete_ext( ld, dn, sctrls, cctrls, &msgid );
+
+ if( rc != LDAP_SUCCESS )
return( ld->ld_errno );
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
return( ldap_result2error( ld, res, 1 ) );
}
+/*
+ * ldap_delete - initiate an ldap (and X.500) delete operation. Parameters:
+ *
+ * ld LDAP descriptor
+ * dn DN of the object to delete
+ *
+ * Example:
+ * msgid = ldap_delete( ld, dn );
+ */
+int
+ldap_delete( LDAP *ld, LDAP_CONST char *dn )
+{
+ int msgid;
+
+ /*
+ * A delete request looks like this:
+ * DelRequet ::= DistinguishedName,
+ */
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
+
+ return ldap_delete_ext( ld, dn, NULL, NULL, &msgid ) == LDAP_SUCCESS
+ ? msgid : -1 ;
+}
+
+
+int
+ldap_delete_s( LDAP *ld, LDAP_CONST char *dn )
+{
+ return ldap_delete_ext_s( ld, dn, NULL, NULL );
+}
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1993, 1994 Regents of the University of Michigan.
* All rights reserved.
*
* 7 March 1994 by Mark C Smith
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
-#ifndef VMS
-#include <unistd.h>
-#endif /* VMS */
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+#endif
+
+#include "ldap-int.h"
#include "disptmpl.h"
-#ifndef NEEDPROTOS
-static void free_disptmpl();
-static int read_next_tmpl();
-int next_line_tokens();
-void free_strarray();
-#else /* !NEEDPROTOS */
-static void free_disptmpl( struct ldap_disptmpl *tmpl );
-static int read_next_tmpl( char **bufp, long *blenp,
- struct ldap_disptmpl **tmplp, int dtversion );
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-#endif /* !NEEDPROTOS */
-
-static char *tmploptions[] = {
+static void free_disptmpl LDAP_P(( struct ldap_disptmpl *tmpl ));
+static int read_next_tmpl LDAP_P(( char **bufp, ber_len_t *blenp,
+ struct ldap_disptmpl **tmplp, int dtversion ));
+
+static const char *const tmploptions[] = {
"addable", "modrdn",
"altview",
NULL
};
-static unsigned long tmploptvals[] = {
+static const unsigned long tmploptvals[] = {
LDAP_DTMPL_OPT_ADDABLE, LDAP_DTMPL_OPT_ALLOWMODRDN,
LDAP_DTMPL_OPT_ALTVIEW,
};
-static char *itemtypes[] = {
+static const char *const itemtypes[] = {
"cis", "mls", "dn",
"bool", "jpeg", "jpegbtn",
"fax", "faxbtn", "audiobtn",
NULL
};
-static unsigned long itemsynids[] = {
+static const 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,
};
-static char *itemoptions[] = {
+static const char *const itemoptions[] = {
"ro", "sort",
"1val", "hide",
"required", "hideiffalse",
};
-static unsigned long itemoptvals[] = {
+static const 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,
long rlen, len;
int rc, eof;
- *tmpllistp = NULLDISPTMPL;
+ *tmpllistp = NULL;
if (( fp = fopen( file, "r" )) == NULL ) {
return( LDAP_TMPL_ERR_FILE );
return( LDAP_TMPL_ERR_FILE );
}
- if (( buf = malloc( (size_t)len )) == NULL ) {
+ if (( buf = LDAP_MALLOC( (size_t)len )) == NULL ) {
fclose( fp );
return( LDAP_TMPL_ERR_MEM );
}
fclose( fp );
if ( rlen != len && !eof ) { /* error: didn't get the whole file */
- free( buf );
+ LDAP_FREE( buf );
return( LDAP_TMPL_ERR_FILE );
}
rc = ldap_init_templates_buf( buf, rlen, tmpllistp );
- free( buf );
+ LDAP_FREE( buf );
return( rc );
}
int
-ldap_init_templates_buf( char *buf, long buflen,
+ldap_init_templates_buf( char *buf, ber_len_t buflen,
struct ldap_disptmpl **tmpllistp )
{
- int rc, version;
+ int rc=-1, version;
char **toks;
struct ldap_disptmpl *prevtmpl, *tmpl;
- *tmpllistp = prevtmpl = NULLDISPTMPL;
+ *tmpllistp = prevtmpl = NULL;
if ( next_line_tokens( &buf, &buflen, &toks ) != 2 ||
strcasecmp( toks[ 0 ], "version" ) != 0 ) {
}
while ( buflen > 0 && ( rc = read_next_tmpl( &buf, &buflen, &tmpl,
- version )) == 0 && tmpl != NULLDISPTMPL ) {
- if ( prevtmpl == NULLDISPTMPL ) {
+ version )) == 0 && tmpl != NULL ) {
+ if ( prevtmpl == NULL ) {
*tmpllistp = tmpl;
} else {
prevtmpl->dt_next = tmpl;
{
if ( tmpl != NULL ) {
if ( tmpl->dt_name != NULL ) {
- free( tmpl->dt_name );
+ LDAP_FREE( tmpl->dt_name );
}
if ( tmpl->dt_pluralname != NULL ) {
- free( tmpl->dt_pluralname );
+ LDAP_FREE( tmpl->dt_pluralname );
}
if ( tmpl->dt_iconname != NULL ) {
- free( tmpl->dt_iconname );
+ LDAP_FREE( tmpl->dt_iconname );
}
if ( tmpl->dt_authattrname != NULL ) {
- free( tmpl->dt_authattrname );
+ LDAP_FREE( tmpl->dt_authattrname );
}
if ( tmpl->dt_defrdnattrname != NULL ) {
- free( tmpl->dt_defrdnattrname );
+ LDAP_FREE( tmpl->dt_defrdnattrname );
}
if ( tmpl->dt_defaddlocation != NULL ) {
- free( tmpl->dt_defaddlocation );
+ LDAP_FREE( tmpl->dt_defaddlocation );
}
if ( tmpl->dt_oclist != NULL ) {
for ( ocp = tmpl->dt_oclist; ocp != NULL; ocp = nextocp ) {
nextocp = ocp->oc_next;
free_strarray( ocp->oc_objclasses );
- free( ocp );
+ LDAP_FREE( ocp );
}
}
for ( adp = tmpl->dt_adddeflist; adp != NULL; adp = nextadp ) {
nextadp = adp->ad_next;
if( adp->ad_attrname != NULL ) {
- free( adp->ad_attrname );
+ LDAP_FREE( adp->ad_attrname );
}
if( adp->ad_value != NULL ) {
- free( adp->ad_value );
+ LDAP_FREE( adp->ad_value );
}
- free( adp );
+ LDAP_FREE( adp );
}
}
for ( colp = rowp; colp != NULL; colp = nextcolp ) {
nextcolp = colp->ti_next_in_row;
if ( colp->ti_attrname != NULL ) {
- free( colp->ti_attrname );
+ LDAP_FREE( colp->ti_attrname );
}
if ( colp->ti_label != NULL ) {
- free( colp->ti_label );
+ LDAP_FREE( colp->ti_label );
}
if ( colp->ti_args != NULL ) {
free_strarray( colp->ti_args );
}
- free( colp );
+ LDAP_FREE( colp );
}
}
}
- free( tmpl );
+ LDAP_FREE( tmpl );
}
}
ldap_next_disptmpl( struct ldap_disptmpl *tmpllist,
struct ldap_disptmpl *tmpl )
{
- return( tmpl == NULLDISPTMPL ? tmpl : tmpl->dt_next );
+ return( tmpl == NULL ? tmpl : tmpl->dt_next );
}
{
struct ldap_disptmpl *dtp;
- for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULLDISPTMPL;
+ for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULL;
dtp = ldap_next_disptmpl( tmpllist, dtp )) {
if ( strcasecmp( name, dtp->dt_name ) == 0 ) {
return( dtp );
}
}
- return( NULLDISPTMPL );
+ return( NULL );
}
int i, j, needcnt, matchcnt;
if ( tmpllist == NULL || oclist == NULL || oclist[ 0 ] == NULL ) {
- return( NULLDISPTMPL );
+ return( NULL );
}
- for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULLDISPTMPL;
+ for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULL;
dtp = ldap_next_disptmpl( tmpllist, dtp )) {
- for ( oclp = dtp->dt_oclist; oclp != NULLOCLIST;
+ for ( oclp = dtp->dt_oclist; oclp != NULL;
oclp = oclp->oc_next ) {
needcnt = matchcnt = 0;
for ( i = 0; oclp->oc_objclasses[ i ] != NULL; ++i ) {
}
}
- return( NULLDISPTMPL );
+ return( NULL );
}
struct ldap_tmplitem *
ldap_next_tmplrow( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row )
{
- return( row == NULLTMPLITEM ? row : row->ti_next_in_col );
+ return( row == NULL ? row : row->ti_next_in_col );
}
ldap_next_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row,
struct ldap_tmplitem *col )
{
- return( col == NULLTMPLITEM ? col : col->ti_next_in_row );
+ return( col == NULL ? col : col->ti_next_in_row );
}
attrcnt = 0;
memerr = 0;
- if (( attrs = (char **)malloc( sizeof( char * ))) == NULL ) {
+ if (( attrs = (char **)LDAP_MALLOC( sizeof( char * ))) == NULL ) {
return( NULL );
}
if ( includeattrs != NULL ) {
for ( i = 0; !memerr && includeattrs[ i ] != NULL; ++i ) {
- if (( attrs = (char **)realloc( attrs, ( attrcnt + 2 ) *
+ if (( attrs = (char **)LDAP_REALLOC( attrs, ( attrcnt + 2 ) *
sizeof( char * ))) == NULL || ( attrs[ attrcnt++ ] =
- strdup( includeattrs[ i ] )) == NULL ) {
+ LDAP_STRDUP( includeattrs[ i ] )) == NULL ) {
memerr = 1;
} else {
attrs[ attrcnt ] = NULL;
}
for ( tirowp = ldap_first_tmplrow( tmpl );
- !memerr && tirowp != NULLTMPLITEM;
+ !memerr && tirowp != NULL;
tirowp = ldap_next_tmplrow( tmpl, tirowp )) {
for ( ticolp = ldap_first_tmplcol( tmpl, tirowp );
- ticolp != NULLTMPLITEM;
+ ticolp != NULL;
ticolp = ldap_next_tmplcol( tmpl, tirowp, ticolp )) {
if ( syntaxmask != 0 ) {
}
if ( ticolp->ti_attrname != NULL ) {
- if (( attrs = (char **)realloc( attrs, ( attrcnt + 2 ) *
+ if (( attrs = (char **)LDAP_REALLOC( attrs, ( attrcnt + 2 ) *
sizeof( char * ))) == NULL || ( attrs[ attrcnt++ ] =
- strdup( ticolp->ti_attrname )) == NULL ) {
+ LDAP_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 ) {
- free( attrs[ i ] );
+ LDAP_FREE( attrs[ i ] );
}
}
- free( (char *)attrs );
+ LDAP_FREE( (char *)attrs );
return( NULL );
}
static int
-read_next_tmpl( char **bufp, long *blenp, struct ldap_disptmpl **tmplp,
+read_next_tmpl( char **bufp, ber_len_t *blenp, struct ldap_disptmpl **tmplp,
int dtversion )
{
int i, j, tokcnt, samerow, adsource;
char **toks, *itemopts;
struct ldap_disptmpl *tmpl;
- struct ldap_oclist *ocp, *prevocp;
- struct ldap_adddeflist *adp, *prevadp;
- struct ldap_tmplitem *rowp, *ip, *previp;
+ struct ldap_oclist *ocp, *prevocp = NULL;
+ struct ldap_adddeflist *adp, *prevadp = NULL;
+ struct ldap_tmplitem *rowp = NULL, *ip, *previp = NULL;
*tmplp = NULL;
return( tokcnt == 0 ? 0 : LDAP_TMPL_ERR_SYNTAX );
}
- if (( tmpl = (struct ldap_disptmpl *)calloc( 1,
+ if (( tmpl = (struct ldap_disptmpl *)LDAP_CALLOC( 1,
sizeof( struct ldap_disptmpl ))) == NULL ) {
free_strarray( toks );
return( LDAP_TMPL_ERR_MEM );
}
tmpl->dt_name = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* template plural name comes next
return( LDAP_TMPL_ERR_SYNTAX );
}
tmpl->dt_pluralname = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* template icon name is next
return( LDAP_TMPL_ERR_SYNTAX );
}
tmpl->dt_iconname = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* template options come next
* object class list is next
*/
while (( tokcnt = next_line_tokens( bufp, blenp, &toks )) > 0 ) {
- if (( ocp = (struct ldap_oclist *)calloc( 1,
+ if (( ocp = (struct ldap_oclist *)LDAP_CALLOC( 1,
sizeof( struct ldap_oclist ))) == NULL ) {
free_strarray( toks );
free_disptmpl( tmpl );
if ( toks[ 0 ][ 0 ] != '\0' ) {
tmpl->dt_authattrname = toks[ 0 ];
} else {
- free( toks[ 0 ] );
+ LDAP_FREE( toks[ 0 ] );
}
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* read default attribute to use for RDN
return( LDAP_TMPL_ERR_SYNTAX );
}
tmpl->dt_defrdnattrname = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* read default location for new entries
if ( toks[ 0 ][ 0 ] != '\0' ) {
tmpl->dt_defaddlocation = toks[ 0 ];
} else {
- free( toks[ 0 ] );
+ LDAP_FREE( toks[ 0 ] );
}
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* read list of rules used to define default values for new entries
return( LDAP_TMPL_ERR_SYNTAX );
}
- if (( adp = (struct ldap_adddeflist *)calloc( 1,
+ if (( adp = (struct ldap_adddeflist *)LDAP_CALLOC( 1,
sizeof( struct ldap_adddeflist ))) == NULL ) {
free_strarray( toks );
free_disptmpl( tmpl );
if ( adsource == LDAP_ADSRC_CONSTANTVALUE ) {
adp->ad_value = toks[ 2 ];
}
- free( toks[ 0 ] );
- free( (char *)toks );
+ LDAP_FREE( toks[ 0 ] );
+ LDAP_FREE( (char *)toks );
if ( tmpl->dt_adddeflist == NULL ) {
tmpl->dt_adddeflist = adp;
return( LDAP_TMPL_ERR_SYNTAX );
}
- if (( ip = (struct ldap_tmplitem *)calloc( 1,
+ if (( ip = (struct ldap_tmplitem *)LDAP_CALLOC( 1,
sizeof( struct ldap_tmplitem ))) == NULL ) {
free_strarray( toks );
free_disptmpl( tmpl );
return( LDAP_TMPL_ERR_SYNTAX );
}
- free( toks[ 0 ] );
- free( toks[ 1 ] );
+ LDAP_FREE( toks[ 0 ] );
+ LDAP_FREE( toks[ 1 ] );
ip->ti_syntaxid = itemsynids[ i ];
ip->ti_label = toks[ 2 ];
if ( toks[ 3 ][ 0 ] == '\0' ) {
ip->ti_attrname = NULL;
- free( toks[ 3 ] );
+ LDAP_FREE( toks[ 3 ] );
} else {
ip->ti_attrname = toks[ 3 ];
}
for ( i = 0; toks[ i + 4 ] != NULL; ++i ) {
;
}
- if (( ip->ti_args = (char **) calloc( i + 1, sizeof( char * )))
+ if (( ip->ti_args = (char **) LDAP_CALLOC( i + 1, sizeof( char * )))
== NULL ) {
free_disptmpl( tmpl );
return( LDAP_TMPL_ERR_MEM );
ip->ti_args[ i ] = toks[ i + 4 ];
}
}
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
if ( tmpl->dt_items == NULL ) {
tmpl->dt_items = rowp = ip;
--- /dev/null
+/* dn.c - routines for dealing with distinguished names */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+#if 0
+/* this should wait for UTF-8 routines */
+
+#define B4LEADTYPE 0
+#define B4TYPE 1
+#define INOIDTYPE 2
+#define INKEYTYPE 3
+#define B4EQUAL 4
+#define B4VALUE 5
+#define INVALUE 6
+#define INQUOTEDVALUE 7
+#define B4SEPARATOR 8
+
+/*
+ * ldap_dn_normalize - put dn into a canonical format
+ * and return it.
+ */
+
+char *
+ldap_dn_normalize( const char *dn )
+{
+ char *d, *s;
+ int state, gotesc;
+ char *ndn;
+
+ if( dn == NULL ) {
+ return NULL;
+ }
+
+ ndn = LDAP_STRDUP( dn );
+
+ if( ndn == NULL ) {
+ return NULL;
+ }
+
+ gotesc = 0;
+ state = B4LEADTYPE;
+ for ( d = s = ndn; *s; s++ ) {
+ switch ( state ) {
+ case B4LEADTYPE:
+ case B4TYPE:
+ if ( LDAP_LEADOIDCHAR(*s) ) {
+ state = INOIDTYPE;
+ *d++ = *s;
+ } else if ( LDAP_LEADKEYCHAR(*s) ) {
+ state = INKEYTYPE;
+ *d++ = *s;
+ } else if ( ! LDAP_SPACE( *s ) ) {
+ dn = NULL;
+ state = INKEYTYPE;
+ *d++ = *s;
+ }
+ break;
+
+ case INOIDTYPE:
+ if ( LDAP_OIDCHAR(*s) ) {
+ *d++ = *s;
+ } else if ( *s == '=' ) {
+ state = B4VALUE;
+ *d++ = *s;
+ } else if ( LDAP_SPACE( *s ) ) {
+ state = B4EQUAL;
+ } else {
+ dn = NULL;
+ *d++ = *s;
+ }
+ break;
+
+ case INKEYTYPE:
+ if ( LDAP_KEYCHAR(*s) ) {
+ *d++ = *s;
+ } else if ( *s == '=' ) {
+ state = B4VALUE;
+ *d++ = *s;
+ } else if ( LDAP_SPACE( *s ) ) {
+ state = B4EQUAL;
+ } else {
+ dn = NULL;
+ *d++ = *s;
+ }
+ break;
+
+ case B4EQUAL:
+ if ( *s == '=' ) {
+ state = B4VALUE;
+ *d++ = *s;
+ } else if ( ! LDAP_SPACE( *s ) ) {
+ /* not a valid dn - but what can we do here? */
+ *d++ = *s;
+ dn = NULL;
+ }
+ break;
+
+ case B4VALUE:
+ if ( *s == '"' ) {
+ state = INQUOTEDVALUE;
+ *d++ = *s;
+ } else if ( ! LDAP_SPACE( *s ) ) {
+ state = INVALUE;
+ *d++ = *s;
+ }
+ break;
+
+ case INVALUE:
+ if ( !gotesc && LDAP_SEPARATOR( *s ) ) {
+ while ( LDAP_SPACE( *(d - 1) ) )
+ d--;
+ state = B4TYPE;
+ if ( *s == '+' ) {
+ *d++ = *s;
+ } else {
+ *d++ = ',';
+ }
+ } else if ( gotesc && !LDAP_NEEDSESCAPE( *s ) &&
+ !LDAP_SEPARATOR( *s ) ) {
+ *--d = *s;
+ d++;
+ } else {
+ *d++ = *s;
+ }
+ break;
+
+ case INQUOTEDVALUE:
+ if ( !gotesc && *s == '"' ) {
+ state = B4SEPARATOR;
+ *d++ = *s;
+ } else if ( gotesc && !LDAP_NEEDSESCAPE( *s ) ) {
+ *--d = *s;
+ d++;
+ } else {
+ *d++ = *s;
+ }
+ break;
+ case B4SEPARATOR:
+ if ( LDAP_SEPARATOR( *s ) ) {
+ state = B4TYPE;
+ *d++ = *s;
+ }
+ break;
+ default:
+ dn = NULL;
+ Debug( LDAP_DEBUG_ANY,
+ "dn_normalize - unknown state %d\n", state, 0, 0 );
+ break;
+ }
+ if ( *s == '\\' ) {
+ gotesc = 1;
+ } else {
+ gotesc = 0;
+ }
+ }
+ *d = '\0';
+
+ if( gotesc ) {
+ /* shouldn't be left in escape */
+ dn = NULL;
+ }
+
+ /* check end state */
+ switch( state ) {
+ case B4LEADTYPE: /* looking for first type */
+ case B4SEPARATOR: /* looking for separator */
+ case INVALUE: /* inside value */
+ break;
+ default:
+ dn = NULL;
+ }
+
+ if( dn == NULL ) {
+ return( ndn );
+ ndn = NULL;
+ }
+
+ return( ndn );
+}
+
+/*
+ * ldap_dn_parent - return a copy of the dn of dn's parent
+ */
+
+char *
+ldap_dn_parent(
+ const char *dn
+)
+{
+ const char *s;
+ int inquote;
+
+ if( dn == NULL ) {
+ return NULL;
+ }
+
+ while(*dn && LDAP_SPACE(*dn)) {
+ dn++;
+ }
+
+ if( *dn == '\0' ) {
+ return( NULL );
+ }
+
+ /*
+ * no =, assume it is a dns name, like blah@some.domain.name
+ * if the blah@ part is there, return some.domain.name. if
+ * it's just some.domain.name, return domain.name.
+ */
+ if ( strchr( dn, '=' ) == NULL ) {
+ if ( (s = strchr( dn, '@' )) == NULL ) {
+ if ( (s = strchr( dn, '.' )) == NULL ) {
+ return( NULL );
+ }
+ }
+ if ( *(s + 1) == '\0' ) {
+ return( NULL );
+ } else {
+ return( LDAP_STRDUP( &s[1] ) );
+ }
+ }
+
+ /*
+ * else assume it is an X.500-style name, which looks like
+ * foo=bar,sha=baz,...
+ */
+
+ inquote = 0;
+ for ( s = dn; *s; s++ ) {
+ if ( *s == '\\' ) {
+ if ( *(s + 1) ) {
+ s++;
+ }
+ continue;
+ }
+ if ( inquote ) {
+ if ( *s == '"' ) {
+ inquote = 0;
+ }
+ } else {
+ if ( *s == '"' ) {
+ inquote = 1;
+ } else if ( LDAP_DNSEPARATOR( *s ) ) {
+ return( LDAP_STRDUP( &s[1] ) );
+ }
+ }
+ }
+
+ return( LDAP_STRDUP( "" ) );
+}
+
+char * ldap_dn_rdn(
+ const char *dn )
+{
+ char *s;
+ char *rdn;
+ int inquote;
+
+ if( dn == NULL ) {
+ return NULL;
+ }
+
+ while(*dn && LDAP_SPACE(*dn)) {
+ dn++;
+ }
+
+ if( *dn == '\0' ) {
+ return( NULL );
+ }
+
+ rdn = LDAP_STRDUP( dn );
+
+ if( rdn == NULL ) {
+ return NULL;
+ }
+
+#ifdef DNS_DN
+ /*
+ * no =, assume it is a dns name, like blah@some.domain.name
+ * if the blah@ part is there, return some.domain.name. if
+ * it's just some.domain.name, return domain.name.
+ */
+ if ( strchr( rdn, '=' ) == NULL ) {
+ if ( (s = strchr( rdn, '@' )) == NULL ) {
+ if ( (s = strchr( rdn, '.' )) == NULL ) {
+ return( rdn );
+ }
+ }
+ *s = '\0';
+ return( rdn );
+ }
+#endif
+
+ /*
+ * else assume it is an X.500-style name, which looks like
+ * foo=bar,sha=baz,...
+ */
+
+ inquote = 0;
+
+ for ( s = rdn; *s; s++ ) {
+ if ( *s == '\\' ) {
+ if ( *(s + 1) ) {
+ s++;
+ }
+ continue;
+ }
+ if ( inquote ) {
+ if ( *s == '"' ) {
+ inquote = 0;
+ }
+ } else {
+ if ( *s == '"' ) {
+ inquote = 1;
+ } else if ( LDAP_DNSEPARATOR( *s ) ) {
+ *s = '\0';
+ return( rdn );
+ }
+ }
+ }
+
+ return( rdn );
+}
+
+#endif
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1993, 1994 Regents of the University of Michigan.
* All rights reserved.
*
* 7 March 1994 by Mark C Smith
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
-#include <stdlib.h>
-#endif /* DOS */
-#endif /* MACOS */
+#endif
-#include "lber.h"
-#include "ldap.h"
+#include "ldap-int.h"
-#ifndef NEEDPROTOS
-int next_line_tokens();
-void free_strarray();
-static int next_line();
-static char *next_token();
-#else /* !NEEDPROTOS */
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-static int next_line( char **bufp, long *blenp, char **linep );
-static char *next_token( char ** sp );
-#endif /* !NEEDPROTOS */
+static int next_line LDAP_P(( char **bufp, ber_len_t *blenp, char **linep ));
+static char *next_token LDAP_P(( char ** sp ));
int
-next_line_tokens( char **bufp, long *blenp, char ***toksp )
+next_line_tokens( char **bufp, ber_len_t *blenp, char ***toksp )
{
char *p, *line, *token, **toks;
int rc, tokcnt;
return( rc );
}
- if (( toks = (char **)calloc( 1, sizeof( char * ))) == NULL ) {
- free( line );
+ if (( toks = (char **)LDAP_CALLOC( 1, sizeof( char * ))) == NULL ) {
+ LBER_FREE( line );
return( -1 );
}
tokcnt = 0;
p = line;
while (( token = next_token( &p )) != NULL ) {
- if (( toks = (char **)realloc( toks, ( tokcnt + 2 ) *
+ if (( toks = (char **)LDAP_REALLOC( toks, ( tokcnt + 2 ) *
sizeof( char * ))) == NULL ) {
- free( (char *)toks );
- free( line );
+ LBER_FREE( (char *)toks );
+ LBER_FREE( line );
return( -1 );
}
toks[ tokcnt ] = token;
toks = NULL;
}
- free( line );
+ LBER_FREE( line );
if ( tokcnt == 0 ) {
if ( toks != NULL ) {
- free( (char *)toks );
+ LBER_FREE( (char *)toks );
}
} else {
*toksp = toks;
static int
-next_line( char **bufp, long *blenp, char **linep )
+next_line( char **bufp, ber_len_t *blenp, char **linep )
{
char *linestart, *line, *p;
- long plen;
+ ber_slen_t plen;
linestart = *bufp;
p = *bufp;
return( 0 ); /* end of file */
}
- if (( line = malloc( p - linestart )) == NULL ) {
+ if (( line = LDAP_MALLOC( p - linestart )) == NULL ) {
*linep = NULL;
return( -1 ); /* fatal error */
}
p = *sp;
- while ( isspace( *p )) { /* skip leading white space */
+ while ( isspace( (unsigned char) *p )) { /* skip leading white space */
++p;
}
t = tokstart = p;
for ( ;; ) {
- if ( *p == '\0' || ( isspace( *p ) && !in_quote )) {
+ if ( *p == '\0' || ( isspace( (unsigned char) *p ) && !in_quote )) {
if ( *p != '\0' ) {
++p;
}
return( NULL );
}
- return( strdup( tokstart ));
+ return( LDAP_STRDUP( tokstart ));
}
if ( sap != NULL ) {
for ( i = 0; sap[ i ] != NULL; ++i ) {
- free( sap[ i ] );
+ LBER_FREE( sap[ i ] );
}
- free( (char *)sap );
+ LBER_FREE( (char *)sap );
}
}
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+/*
+ * LDAPv3 Extended Operation Request
+ * ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
+ * requestName [0] LDAPOID,
+ * requestValue [1] OCTET STRING OPTIONAL
+ * }
+ *
+ * LDAPv3 Extended Operation Response
+ * ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ * COMPONENTS OF LDAPResult,
+ * responseName [10] LDAPOID OPTIONAL,
+ * response [11] OCTET STRING OPTIONAL
+ * }
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+#include <ac/stdlib.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+int
+ldap_extended_operation(
+ LDAP *ld,
+ LDAP_CONST char *reqoid,
+ struct berval *reqdata,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ int *msgidp )
+{
+ BerElement *ber;
+ int rc;
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_extended_operation\n", 0, 0, 0 );
+
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( reqoid != NULL || *reqoid == '\0' );
+ assert( msgidp != NULL );
+
+ /* must be version 3 (or greater) */
+ if ( ld->ld_version < LDAP_VERSION3 ) {
+ ld->ld_errno = LDAP_NOT_SUPPORTED;
+ return( ld->ld_errno );
+ }
+
+ if( reqoid == NULL || *reqoid == '\0' || msgidp == NULL ) {
+ ld->ld_errno = LDAP_PARAM_ERROR;
+ return( ld->ld_errno );
+ }
+
+ /* create a message to send */
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return( ld->ld_errno );
+ }
+
+ if ( reqdata != NULL ) {
+ rc = ber_printf( ber, "{it{tstO}", /* '}' */
+ ++ld->ld_msgid, LDAP_REQ_EXTENDED,
+ LDAP_TAG_EXOP_REQ_OID, reqoid,
+ LDAP_TAG_EXOP_REQ_VALUE, reqdata );
+
+ } else {
+ rc = ber_printf( ber, "{it{ts}", /* '}' */
+ ++ld->ld_msgid, LDAP_REQ_EXTENDED,
+ LDAP_TAG_EXOP_REQ_OID, reqoid );
+ }
+
+ if( rc == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free( ber, 1 );
+ return( ld->ld_errno );
+ }
+
+ /* Put Server Controls */
+ if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
+ ber_free( ber, 1 );
+ return ld->ld_errno;
+ }
+
+ if ( ber_printf( ber, /*{*/ "}" ) == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free( ber, 1 );
+ return( ld->ld_errno );
+ }
+
+ /* send the message */
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_EXTENDED, NULL, ber );
+
+ return( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS );
+}
+
+int
+ldap_extended_operation_s(
+ LDAP *ld,
+ LDAP_CONST char *reqoid,
+ struct berval *reqdata,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ char **retoidp,
+ struct berval **retdatap )
+{
+ int rc;
+ int msgid;
+ LDAPMessage *res;
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_extended_operation_s\n", 0, 0, 0 );
+
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( reqoid != NULL || *reqoid == '\0' );
+ assert( retoidp != NULL || retdatap != NULL );
+
+ if( retoidp == NULL || retdatap == NULL ) {
+ ld->ld_errno = LDAP_PARAM_ERROR;
+ return( ld->ld_errno );
+ }
+
+ rc = ldap_extended_operation( ld, reqoid, reqdata,
+ sctrls, cctrls, &msgid );
+
+ if ( rc != LDAP_SUCCESS ) {
+ return( rc );
+ }
+
+ if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) {
+ return( ld->ld_errno );
+ }
+
+ *retoidp = NULL;
+ *retdatap = NULL;
+
+ rc = ldap_parse_extended_result( ld, res, retoidp, retdatap, 0 );
+
+ if( rc != LDAP_SUCCESS ) {
+ ldap_msgfree( res );
+ return rc;
+ }
+
+ return( ldap_result2error( ld, res, 1 ) );
+}
+
+/* Parse an extended result */
+int
+ldap_parse_extended_result (
+ LDAP *ld,
+ LDAPMessage *res,
+ char **retoidp,
+ struct berval **retdatap,
+ int freeit )
+{
+ BerElement *ber;
+ ber_tag_t rc;
+ ber_tag_t tag;
+ ber_len_t len;
+ struct berval *resdata;
+ ber_int_t errcode;
+ char *resoid;
+
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( res != NULL );
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_parse_extended_result\n", 0, 0, 0 );
+
+ if( ld->ld_version < LDAP_VERSION3 ) {
+ ld->ld_errno = LDAP_NOT_SUPPORTED;
+ return ld->ld_errno;
+ }
+
+ if( res->lm_msgtype == LDAP_RES_EXTENDED ) {
+ ld->ld_errno = LDAP_PARAM_ERROR;
+ return ld->ld_errno;
+ }
+
+ if( retoidp != NULL ) *retoidp = NULL;
+ if( retdatap != NULL ) *retdatap = NULL;
+
+ ber = ber_dup( res->lm_ber );
+
+ if ( ld->ld_error ) {
+ LDAP_FREE( ld->ld_error );
+ ld->ld_error = NULL;
+ }
+
+ if ( ld->ld_matched ) {
+ LDAP_FREE( ld->ld_matched );
+ ld->ld_matched = NULL;
+ }
+
+ rc = ber_scanf( ber, "{iaa" /*}*/, &errcode,
+ &ld->ld_matched, &ld->ld_matched );
+
+ if( rc == LBER_ERROR ) {
+ ld->ld_errno = LDAP_DECODING_ERROR;
+ ber_free( ber, 0 );
+ return ld->ld_errno;
+ }
+
+ resoid = NULL;
+ resdata = NULL;
+
+ tag = ber_peek_tag( ber, &len );
+
+ if( tag == LDAP_TAG_REFERRAL ) {
+ /* skip over referral */
+ tag = ber_scanf( ber, "x" );
+
+ if( tag != LBER_ERROR ) {
+ tag = ber_peek_tag( ber, &len );
+ }
+ }
+
+ if( tag == LDAP_TAG_EXOP_RES_OID ) {
+ /* we have a resoid */
+ if( ber_scanf( ber, "a", &resoid ) == LBER_ERROR ) {
+ ld->ld_errno = LDAP_DECODING_ERROR;
+ ber_free( ber, 0 );
+ return ld->ld_errno;
+ }
+
+ tag = ber_peek_tag( ber, &len );
+ }
+
+ if( tag == LDAP_TAG_EXOP_RES_VALUE ) {
+ /* we have a resdata */
+ if( ber_scanf( ber, "O", &resoid ) == LBER_ERROR ) {
+ ld->ld_errno = LDAP_DECODING_ERROR;
+ ber_free( ber, 0 );
+ if( resoid != NULL ) LDAP_FREE( resoid );
+ return ld->ld_errno;
+ }
+ }
+
+ if( retoidp != NULL ) {
+ *retoidp = resoid;
+ } else {
+ LDAP_FREE( resoid );
+ }
+
+ if( retdatap != NULL ) {
+ *retdatap = resdata;
+ } else {
+ ber_bvfree( resdata );
+ }
+
+ ld->ld_errno = errcode;
+
+ if( freeit ) {
+ ldap_msgfree( res );
+ }
+
+ return LDAP_SUCCESS;
+}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1994 The Regents of the University of Michigan.
* All rights reserved.
*
* link in lots of extra code when not using certain features
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1994 The Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <stdlib.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+/*
+ * C-API deallocator
+ */
+void
+ldap_memfree( void *p )
+{
+ LDAP_FREE( p );
+}
+
+void
+ldap_memvfree( void **v )
+{
+ LDAP_VFREE( v );
+}
+
+void *
+ldap_memalloc( ber_len_t s )
+{
+ return LDAP_MALLOC( s );
+}
+
+void *
+ldap_memcalloc( ber_len_t n, ber_len_t s )
+{
+ return LDAP_CALLOC( n, s );
+}
+
+void *
+ldap_memrealloc( void* p, ber_len_t s )
+{
+ return LDAP_REALLOC( p, s );
+}
+
+char *
+ldap_strdup( LDAP_CONST char *p )
+{
+ return LDAP_STRDUP( p );
+}
void
ldap_getfilter_free( LDAPFiltDesc *lfdp )
for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = nextflp ) {
for ( fip = flp->lfl_ilist; fip != NULL; fip = nextfip ) {
nextfip = fip->lfi_next;
- free( fip->lfi_filter );
- free( fip->lfi_desc );
- free( fip );
+ LDAP_FREE( fip->lfi_filter );
+ LDAP_FREE( fip->lfi_desc );
+ LDAP_FREE( fip );
}
nextflp = flp->lfl_next;
- free( flp->lfl_pattern );
- free( flp->lfl_delims );
- free( flp->lfl_tag );
- free( flp );
+ LDAP_FREE( flp->lfl_pattern );
+ LDAP_FREE( flp->lfl_delims );
+ LDAP_FREE( flp->lfl_tag );
+ LDAP_FREE( flp );
}
if ( lfdp->lfd_curvalcopy != NULL ) {
- free( lfdp->lfd_curvalcopy );
+ LDAP_FREE( lfdp->lfd_curvalcopy );
}
if ( lfdp->lfd_curvalwords != NULL ) {
- free( lfdp->lfd_curvalwords );
+ LDAP_FREE( lfdp->lfd_curvalwords );
}
if ( lfdp->lfd_filtprefix != NULL ) {
- free( lfdp->lfd_filtprefix );
+ LDAP_FREE( lfdp->lfd_filtprefix );
}
if ( lfdp->lfd_filtsuffix != NULL ) {
- free( lfdp->lfd_filtsuffix );
+ LDAP_FREE( lfdp->lfd_filtsuffix );
}
- free( lfdp );
+ LDAP_FREE( lfdp );
}
/*
for ( i = 0; mods[i] != NULL; i++ ) {
if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) {
- ber_bvecfree( mods[i]->mod_bvalues );
- } else {
- ldap_value_free( mods[i]->mod_values );
+ if( mods[i]->mod_bvalues != NULL )
+ ber_bvecfree( mods[i]->mod_bvalues );
+
+ } else if( mods[i]->mod_values != NULL ) {
+ LDAP_VFREE( mods[i]->mod_values );
}
- free( (char *) mods[i] );
+
+ if ( mods[i]->mod_type != NULL ) {
+ LDAP_FREE( mods[i]->mod_type );
+ }
+
+ LDAP_FREE( (char *) mods[i] );
}
- if ( freemods )
- free( (char *) mods );
+ if ( freemods ) {
+ LDAP_FREE( (char *) mods );
+ }
}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* friendly.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
-
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS */
-
-#if !defined( MACOS ) && !defined( DOS )
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
-
-#include "lber.h"
-#include "ldap.h"
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
char *
-ldap_friendly_name( char *filename, char *uname, FriendlyMap **map )
+ldap_friendly_name(
+ LDAP_CONST char *filename,
+ /* LDAP_CONST */ char *uname,
+ LDAPFriendlyMap **map )
{
int i, entries;
FILE *fp;
char buf[BUFSIZ];
if ( map == NULL ) {
-#if !defined( MACOS ) && !defined( DOS )
errno = EINVAL;
-#endif
return( uname );
}
}
rewind( fp );
- if ( (*map = (FriendlyMap *) malloc( (entries + 1) *
- sizeof(FriendlyMap) )) == NULL ) {
+ if ( (*map = (LDAPFriendlyMap *) LDAP_MALLOC( (entries + 1) *
+ sizeof(LDAPFriendlyMap) )) == NULL ) {
fclose( fp );
return( uname );
}
}
}
- (*map)[i].f_unfriendly = strdup( buf );
- (*map)[i].f_friendly = strdup( s );
+ (*map)[i].lf_unfriendly = LDAP_STRDUP( buf );
+ (*map)[i].lf_friendly = LDAP_STRDUP( s );
i++;
}
fclose( fp );
- (*map)[i].f_unfriendly = NULL;
+ (*map)[i].lf_unfriendly = NULL;
}
- for ( i = 0; (*map)[i].f_unfriendly != NULL; i++ ) {
- if ( strcasecmp( uname, (*map)[i].f_unfriendly ) == 0 )
- return( (*map)[i].f_friendly );
+ for ( i = 0; (*map)[i].lf_unfriendly != NULL; i++ ) {
+ if ( strcasecmp( uname, (*map)[i].lf_unfriendly ) == 0 )
+ return( (*map)[i].lf_friendly );
}
return( uname );
}
void
-ldap_free_friendlymap( FriendlyMap **map )
+ldap_free_friendlymap( LDAPFriendlyMap **map )
{
- struct friendly* pF = *map;
+ LDAPFriendlyMap* pF = *map;
if ( pF == NULL )
return;
- while ( pF->f_unfriendly )
+ while ( pF->lf_unfriendly )
{
- free( pF->f_unfriendly );
- free( pF->f_friendly );
+ LDAP_FREE( pF->lf_unfriendly );
+ LDAP_FREE( pF->lf_friendly );
pF++;
}
- free( *map );
+ LDAP_FREE( *map );
*map = NULL;
}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* getattr.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include "ldap-int.h"
char *
ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber )
{
- long len;
+ char *attr;
Debug( LDAP_DEBUG_TRACE, "ldap_first_attribute\n", 0, 0, 0 );
- if ( (*ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( entry != NULL );
+ assert( ber != NULL );
+
+ if ( (*ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ *ber = NULL;
return( NULL );
}
* positioned right before the next attribute type/value sequence.
*/
- len = LDAP_MAX_ATTR_LEN;
- if ( ber_scanf( *ber, "{x{{sx}", ld->ld_attrbuffer, &len )
+ if ( ber_scanf( *ber, "{x{{ax}" /*}}*/, &attr )
== LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
ber_free( *ber, 0 );
+ *ber = NULL;
return( NULL );
}
- return( ld->ld_attrbuffer );
+ return( attr );
}
/* ARGSUSED */
char *
ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber )
{
- long len;
+ char *attr;
Debug( LDAP_DEBUG_TRACE, "ldap_next_attribute\n", 0, 0, 0 );
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( entry != NULL );
+ assert( ber != NULL );
+
/* skip sequence, snarf attribute type, skip values */
- len = LDAP_MAX_ATTR_LEN;
- if ( ber_scanf( ber, "{sx}", ld->ld_attrbuffer, &len )
+ if ( ber_scanf( ber, "{ax}", &attr )
== LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
- ber_free( ber, 0 );
return( NULL );
}
- return( ld->ld_attrbuffer );
+ return( attr );
}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1994 Regents of the University of Michigan.
* All rights reserved.
*
* getdn.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+static char **explode_name( const char *name, int notypes, int is_dn );
char *
ldap_get_dn( LDAP *ld, LDAPMessage *entry )
}
tmp = *entry->lm_ber; /* struct copy */
- if ( ber_scanf( &tmp, "{a", &dn ) == LBER_ERROR ) {
+ if ( ber_scanf( &tmp, "{a" /*}*/, &dn ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
}
char *
-ldap_dn2ufn( char *dn )
+ldap_dn2ufn( LDAP_CONST char *dn )
{
char *p, *ufn, *r;
int state;
Debug( LDAP_DEBUG_TRACE, "ldap_dn2ufn\n", 0, 0, 0 );
- if ( ldap_is_dns_dn( dn ) || ( p = strchr( dn, '=' )) == NULL )
- return( strdup( dn ));
+ if( dn == NULL ) {
+ return NULL;
+ }
+
+ if ( ldap_is_dns_dn( dn ) ||
+ ( p = strchr( dn, '=' ) ) == NULL )
+ {
+ return( LDAP_STRDUP( dn ) );
+ }
+
- ufn = strdup( ++p );
+ ufn = LDAP_STRDUP( ++p );
#define INQUOTE 1
#define OUTQUOTE 2
char *rsave = r;
*r-- = '\0';
- while ( !isspace( *r ) && *r != ';'
- && *r != ',' && r > ufn )
+ while ( !isspace( (unsigned char) *r )
+ && *r != ';' && *r != ',' && r > ufn )
r--;
r++;
}
char **
-ldap_explode_dns( char *dn )
+ldap_explode_dns( LDAP_CONST char *dn_in )
{
- int ncomps, maxcomps;
char *s;
char **rdns;
+ char *tok_r;
+ char *dn;
- if ( (rdns = (char **) malloc( 8 * sizeof(char *) )) == NULL ) {
+ int ncomps;
+ int maxcomps = 8;
+
+ if ( (dn = LDAP_STRDUP( dn_in )) == NULL ) {
+ return( NULL );
+ }
+
+ if ( (rdns = (char **) LDAP_MALLOC( maxcomps * sizeof(char *) )) == NULL ) {
+ LDAP_FREE( dn );
return( NULL );
}
- maxcomps = 8;
ncomps = 0;
- for ( s = strtok( dn, "@." ); s != NULL; s = strtok( NULL, "@." ) ) {
+ for ( s = ldap_pvt_strtok( dn, "@.", &tok_r ); s != NULL;
+ s = ldap_pvt_strtok( NULL, "@.", &tok_r ) )
+ {
if ( ncomps == maxcomps ) {
maxcomps *= 2;
- if ( (rdns = (char **) realloc( rdns, maxcomps *
- sizeof(char *) )) == NULL ) {
- return( NULL );
+ if ( (rdns = (char **) LDAP_REALLOC( rdns, maxcomps *
+ sizeof(char *) )) == NULL )
+ {
+ LDAP_FREE( dn );
+ return NULL;
}
}
- rdns[ncomps++] = strdup( s );
+ rdns[ncomps++] = LDAP_STRDUP( s );
}
+ LDAP_FREE(dn);
+
rdns[ncomps] = NULL;
+ /* trim rdns */
+ rdns = (char **) LDAP_REALLOC( rdns, (ncomps+1) * sizeof(char*) );
return( rdns );
}
char **
-ldap_explode_dn( char *dn, int notypes )
+ldap_explode_dn( LDAP_CONST char *dn, int notypes )
{
- char *p, *q, *rdnstart, **rdns = NULL;
- int state, count = 0, endquote, len;
-
Debug( LDAP_DEBUG_TRACE, "ldap_explode_dn\n", 0, 0, 0 );
if ( ldap_is_dns_dn( dn ) ) {
return( ldap_explode_dns( dn ) );
}
+ return explode_name( dn, notypes, 1 );
+}
- rdnstart = dn;
- p = dn-1;
+char **
+ldap_explode_rdn( LDAP_CONST char *rdn, int notypes )
+{
+ Debug( LDAP_DEBUG_TRACE, "ldap_explode_rdn\n", 0, 0, 0 );
+ return explode_name( rdn, notypes, 0 );
+}
+
+static char **
+explode_name( const char *name, int notypes, int is_dn )
+{
+ const char *p, *q;
+ char **parts = NULL;
+ int state, count = 0, endquote, len;
+
+ p = name-1;
state = OUTQUOTE;
do {
else
state = INQUOTE;
break;
+ case '+':
+ if (!is_dn)
+ goto end_part;
+ break;
case ';':
case ',':
+ if (!is_dn)
+ break;
+ goto end_part;
case '\0':
+ end_part:
if ( state == OUTQUOTE ) {
++count;
- if ( rdns == NULL ) {
- if (( rdns = (char **)malloc( 8
+ if ( parts == NULL ) {
+ if (( parts = (char **)LDAP_MALLOC( 8
* sizeof( char *))) == NULL )
return( NULL );
} else if ( count >= 8 ) {
- if (( rdns = (char **)realloc( rdns,
+ if (( parts = (char **)LDAP_REALLOC( parts,
(count+1) * sizeof( char *)))
== NULL )
return( NULL );
}
- rdns[ count ] = NULL;
+ parts[ count ] = NULL;
endquote = 0;
if ( notypes ) {
- for ( q = rdnstart;
+ for ( q = name;
q < p && *q != '='; ++q ) {
;
}
if ( q < p ) {
- rdnstart = ++q;
+ name = ++q;
}
- if ( *rdnstart == '"' ) {
- ++rdnstart;
+ if ( *name == '"' ) {
+ ++name;
}
if ( *(p-1) == '"' ) {
}
}
- len = p - rdnstart;
- if (( rdns[ count-1 ] = (char *)calloc( 1,
+ len = p - name;
+ if (( parts[ count-1 ] = (char *)LDAP_CALLOC( 1,
len + 1 )) != NULL ) {
- SAFEMEMCPY( rdns[ count-1 ], rdnstart,
+ SAFEMEMCPY( parts[ count-1 ], name,
len );
- rdns[ count-1 ][ len ] = '\0';
+ parts[ count-1 ][ len ] = '\0';
}
/*
if ( endquote == 1 )
p++;
- rdnstart = *p ? p + 1 : p;
- while ( isspace( *rdnstart ))
- ++rdnstart;
+ name = *p ? p + 1 : p;
+ while ( isascii( *name ) && isspace( *name ) )
+ ++name;
}
break;
}
} while ( *p );
- return( rdns );
+ return( parts );
}
int
-ldap_is_dns_dn( char *dn )
+ldap_is_dns_dn( LDAP_CONST char *dn )
{
- return( dn[ 0 ] != '\0' && strchr( dn, '=' ) == NULL &&
- strchr( dn, ',' ) == NULL );
-}
-
-
-#if defined( ultrix ) || defined( NeXT )
-
-char *strdup( char *s )
-{
- char *p;
-
- if ( (p = (char *) malloc( strlen( s ) + 1 )) == NULL )
- return( NULL );
-
- strcpy( p, s );
-
- return( p );
+ return( dn[ 0 ] != '\0'
+ && strchr( dn, '=' ) == NULL
+ && strchr( dn, ',' ) == NULL
+ && strchr( dn, ';' ) == NULL );
}
-#endif /* ultrix */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
rr_len = _getshort( p );
p += INT16SZ;
if ( class == C_IN && type == T_TXT ) {
- int i, n, pref, txt_len;
+ int pref, txt_len;
char *q, *r;
q = (char *)p;
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* getentry.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
/* ARGSUSED */
LDAPMessage *
ldap_first_entry( LDAP *ld, LDAPMessage *chain )
{
- return( chain == NULLMSG || chain->lm_msgtype == LDAP_RES_SEARCH_RESULT
- ? NULLMSG : chain );
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( chain != NULL );
+
+ if( ld == NULL || chain == NULL ) {
+ return NULL;
+ }
+
+ return chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY
+ ? chain
+ : ldap_next_entry( ld, chain );
}
-/* ARGSUSED */
-LDAPMessage *ldap_next_entry( LDAP *ld, LDAPMessage *entry )
+LDAPMessage *
+ldap_next_entry( LDAP *ld, LDAPMessage *entry )
{
- if ( entry == NULLMSG || entry->lm_chain == NULLMSG
- || entry->lm_chain->lm_msgtype == LDAP_RES_SEARCH_RESULT )
- return( NULLMSG );
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( entry != NULL );
- return( entry->lm_chain );
+ if ( ld == NULL || entry == NULL ) {
+ return NULL;
+ }
+
+ for (
+ entry = entry->lm_chain;
+ entry != NULL;
+ entry = entry->lm_chain )
+ {
+ if( entry->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) {
+ return( entry );
+ }
+ }
+
+ return( NULL );
}
-/* ARGSUSED */
int
ldap_count_entries( LDAP *ld, LDAPMessage *chain )
{
int i;
- for ( i = 0; chain != NULL && chain->lm_msgtype
- != LDAP_RES_SEARCH_RESULT; chain = chain->lm_chain )
- i++;
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
+ if ( ld == NULL ) {
+ return -1;
+ }
+
+ for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
+ if( chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) {
+ i++;
+ }
+ }
return( i );
}
+
+int
+ldap_get_entry_controls(
+ LDAP *ld,
+ LDAPMessage *entry,
+ LDAPControl ***sctrls )
+{
+ int rc;
+ BerElement be;
+
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( entry != NULL );
+ assert( sctrls != NULL );
+
+ if ( ld == NULL || sctrls == NULL ||
+ entry == NULL || entry->lm_msgtype == LDAP_RES_SEARCH_ENTRY )
+ {
+ return LDAP_PARAM_ERROR;
+ }
+
+ /* make a local copy of the BerElement */
+ SAFEMEMCPY(&be, entry->lm_ber, sizeof(be));
+
+ if ( ber_scanf( &be, "{xx" /*}*/ ) == LBER_ERROR ) {
+ rc = LDAP_DECODING_ERROR;
+ goto cleanup_and_return;
+ }
+
+ rc = ldap_int_get_controls( &be, sctrls );
+
+cleanup_and_return:
+ if( rc != LDAP_SUCCESS ) {
+ ld->ld_errno = rc;
+
+ if( ld->ld_matched != NULL ) {
+ LDAP_FREE( ld->ld_matched );
+ ld->ld_matched = NULL;
+ }
+
+ if( ld->ld_error != NULL ) {
+ LDAP_FREE( ld->ld_error );
+ ld->ld_error = NULL;
+ }
+ }
+
+ return rc;
+}
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = flp->lfl_next ) {
/* compile tagpat, continue if we fail */
- if (regcomp(&re, tagpat, 0) != 0)
+ if (regcomp(&re, tagpat, REG_EXTENDED|REG_NOSUB) != 0)
continue;
- /* match tagpatern and tag, continue if we fail */
+ /* match tagpattern and tag, continue if we fail */
rc = regexec(&re, flp->lfl_tag, 0, NULL, 0);
regfree(&re);
if (rc != 0)
continue;
/* compile flp->ifl_pattern, continue if we fail */
- if (regcomp(&re, flp->lfl_pattern, 0) != 0)
+ if (regcomp(&re, flp->lfl_pattern, REG_EXTENDED|REG_NOSUB) != 0)
continue;
/* match ifl_pattern and lfd_curval, continue if we fail */
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* getvalues.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
char **
-ldap_get_values( LDAP *ld, LDAPMessage *entry, char *target )
+ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
{
BerElement ber;
- char attr[LDAP_MAX_ATTR_LEN];
+ char *attr;
int found = 0;
- long len;
char **vals;
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( entry != NULL );
+ assert( target != NULL );
+
Debug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 );
ber = *entry->lm_ber;
/* skip sequence, dn, sequence of, and snag the first attr */
- len = sizeof(attr);
- if ( ber_scanf( &ber, "{x{{s", attr, &len ) == LBER_ERROR ) {
+ if ( ber_scanf( &ber, "{x{{a" /*}}}*/, &attr ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
/* break out on success, return out on error */
while ( ! found ) {
- len = sizeof(attr);
- if ( ber_scanf( &ber, "x}{s", attr, &len ) == LBER_ERROR ) {
+ LDAP_FREE(attr);
+ attr = NULL;
+
+ if ( ber_scanf( &ber, /*{*/ "x}{a" /*}*/, &attr ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
if ( strcasecmp( target, attr ) == 0 )
break;
+
}
+ LDAP_FREE(attr);
+ attr = NULL;
+
/*
* if we get this far, we've found the attribute and are sitting
* just before the set of values.
}
struct berval **
-ldap_get_values_len( LDAP *ld, LDAPMessage *entry, char *target )
+ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
{
BerElement ber;
- char attr[LDAP_MAX_ATTR_LEN];
+ char *attr;
int found = 0;
- long len;
struct berval **vals;
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( entry != NULL );
+ assert( target != NULL );
+
Debug( LDAP_DEBUG_TRACE, "ldap_get_values_len\n", 0, 0, 0 );
ber = *entry->lm_ber;
/* skip sequence, dn, sequence of, and snag the first attr */
- len = sizeof(attr);
- if ( ber_scanf( &ber, "{x{{s", attr, &len ) == LBER_ERROR ) {
+ if ( ber_scanf( &ber, "{x{{a" /* }}} */, &attr ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
/* break out on success, return out on error */
while ( ! found ) {
- len = sizeof(attr);
- if ( ber_scanf( &ber, "x}{s", attr, &len ) == LBER_ERROR ) {
+ LDAP_FREE( attr );
+ attr = NULL;
+
+ if ( ber_scanf( &ber, /*{*/ "x}{a" /*}*/, &attr ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
break;
}
+ LDAP_FREE( attr );
+ attr = NULL;
+
/*
* if we get this far, we've found the attribute and are sitting
* just before the set of values.
void
ldap_value_free( char **vals )
{
- int i;
-
- if ( vals == NULL )
- return;
- for ( i = 0; vals[i] != NULL; i++ )
- free( vals[i] );
- free( (char *) vals );
+ LDAP_VFREE( vals );
}
void
ldap_value_free_len( struct berval **vals )
{
- int i;
-
- if ( vals == NULL )
- return;
- for ( i = 0; vals[i] != NULL; i++ ) {
- free( vals[i]->bv_val );
- free( vals[i] );
- }
- free( (char *) vals );
+ ber_bvecfree( vals );
}
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1993 Regents of the University of Michigan.
* All rights reserved.
*
* kbind.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
+/*
+ * BindRequest ::= SEQUENCE {
+ * version INTEGER,
+ * name DistinguishedName, -- who
+ * authentication CHOICE {
+ * simple [0] OCTET STRING -- passwd
+#ifdef HAVE_KERBEROS
+ * krbv42ldap [1] OCTET STRING
+ * krbv42dsa [2] OCTET STRING
#endif
+ * sasl [3] SaslCredentials -- LDAPv3
+ * }
+ * }
+ *
+ * BindResponse ::= SEQUENCE {
+ * COMPONENTS OF LDAPResult,
+ * serverSaslCreds OCTET STRING OPTIONAL -- LDAPv3
+ * }
+ *
+ */
-#ifdef KERBEROS
+#include "portable.h"
+
+#ifdef HAVE_KERBEROS
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include "msdos.h"
-#endif /* DOS */
-#include <krb.h>
-#include <stdlib.h>
-#if !defined(DOS) && !defined( _WIN32 )
-#include <sys/types.h>
-#endif /* !DOS && !_WIN32 */
-#include <sys/time.h>
-#include <sys/socket.h>
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
-#include "ldap-int.h"
+#include <ac/stdlib.h>
+#include <ac/krb.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
/*
* ldap_kerberos_bind1( ld, "cn=manager, o=university of michigan, c=us" )
*/
int
-ldap_kerberos_bind1( LDAP *ld, char *dn )
+ldap_kerberos_bind1( LDAP *ld, LDAP_CONST char *dn )
{
BerElement *ber;
char *cred;
- int rc, credlen;
- char *get_kerberosv4_credentials();
+ int rc;
+ ber_len_t credlen;
#ifdef STR_TRANSLATION
int str_translation_on;
#endif /* STR_TRANSLATION */
- /*
- * The bind request looks like this:
- * BindRequest ::= SEQUENCE {
- * version INTEGER,
- * name DistinguishedName,
- * authentication CHOICE {
- * krbv42ldap [1] OCTET STRING
- * krbv42dsa [2] OCTET STRING
- * }
- * }
- * all wrapped up in an LDAPMessage sequence.
- */
-
Debug( LDAP_DEBUG_TRACE, "ldap_kerberos_bind1\n", 0, 0, 0 );
if ( dn == NULL )
dn = "";
- if ( (cred = get_kerberosv4_credentials( ld, dn, "ldapserver",
+ if ( (cred = ldap_get_kerberosv4_credentials( ld, dn, "ldapserver",
&credlen )) == NULL ) {
return( -1 ); /* ld_errno should already be set */
}
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
- free( cred );
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ LDAP_FREE( cred );
return( -1 );
}
#endif /* STR_TRANSLATION */
if ( rc == -1 ) {
- free( cred );
+ LDAP_FREE( cred );
ber_free( ber, 1 );
ld->ld_errno = LDAP_ENCODING_ERROR;
return( -1 );
}
- free( cred );
+ LDAP_FREE( cred );
-#ifndef NO_CACHE
+#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL ) {
ldap_flush_cache( ld );
}
-#endif /* !NO_CACHE */
+#endif /* !LDAP_NOCACHE */
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
}
int
-ldap_kerberos_bind1_s( LDAP *ld, char *dn )
+ldap_kerberos_bind1_s( LDAP *ld, LDAP_CONST char *dn )
{
int msgid;
LDAPMessage *res;
* ldap_kerberos_bind2( ld, "cn=manager, o=university of michigan, c=us" )
*/
int
-ldap_kerberos_bind2( LDAP *ld, char *dn )
+ldap_kerberos_bind2( LDAP *ld, LDAP_CONST char *dn )
{
BerElement *ber;
char *cred;
- int rc, credlen;
- char *get_kerberosv4_credentials();
+ int rc;
+ ber_len_t credlen;
#ifdef STR_TRANSLATION
int str_translation_on;
#endif /* STR_TRANSLATION */
if ( dn == NULL )
dn = "";
- if ( (cred = get_kerberosv4_credentials( ld, dn, "x500dsa", &credlen ))
+ if ( (cred = ldap_get_kerberosv4_credentials( ld, dn, "x500dsa", &credlen ))
== NULL ) {
return( -1 ); /* ld_errno should already be set */
}
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
- free( cred );
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ LDAP_FREE( cred );
return( -1 );
}
}
#endif /* STR_TRANSLATION */
- free( cred );
+ LDAP_FREE( cred );
if ( rc == -1 ) {
ber_free( ber, 1 );
}
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
}
/* synchronous bind to DSA using kerberos */
int
-ldap_kerberos_bind2_s( LDAP *ld, char *dn )
+ldap_kerberos_bind2_s( LDAP *ld, LDAP_CONST char *dn )
{
int msgid;
LDAPMessage *res;
/* synchronous bind to ldap and DSA using kerberos */
int
-ldap_kerberos_bind_s( LDAP *ld, char *dn )
+ldap_kerberos_bind_s( LDAP *ld, LDAP_CONST char *dn )
{
int err;
#ifndef AUTHMAN
/*
- * get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
+ * ldap_get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
* The dn of the entry to which to bind is supplied. It's assumed the
* user already has a tgt.
*/
char *
-get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
+ldap_get_kerberosv4_credentials(
+ LDAP *ld,
+ LDAP_CONST char *who,
+ LDAP_CONST char *service,
+ ber_len_t *len )
{
KTEXT_ST ktxt;
int err;
char realm[REALM_SZ], *cred, *krbinstance;
- Debug( LDAP_DEBUG_TRACE, "get_kerberosv4_credentials\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_get_kerberosv4_credentials\n", 0, 0, 0 );
if ( (err = krb_get_tf_realm( tkt_string(), realm )) != KSUCCESS ) {
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
fprintf( stderr, "krb_get_tf_realm failed (%s)\n",
krb_err_txt[err] );
-#endif /* NO_USERINTERFACE */
+#endif /* LDAP_LIBUI */
ld->ld_errno = LDAP_INVALID_CREDENTIALS;
return( NULL );
}
-#ifdef LDAP_REFERRALS
krbinstance = ld->ld_defconn->lconn_krbinstance;
-#else /* LDAP_REFERRALS */
- krbinstance = ld->ld_host;
-#endif /* LDAP_REFERRALS */
if ( (err = krb_mk_req( &ktxt, service, krbinstance, realm, 0 ))
!= KSUCCESS ) {
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
fprintf( stderr, "krb_mk_req failed (%s)\n", krb_err_txt[err] );
-#endif /* NO_USERINTERFACE */
+#endif /* LDAP_LIBUI */
ld->ld_errno = LDAP_INVALID_CREDENTIALS;
return( NULL );
}
- if ( ( cred = malloc( ktxt.length )) == NULL ) {
+ if ( ( cred = LDAP_MALLOC( ktxt.length )) == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( NULL );
}
}
#endif /* !AUTHMAN */
-#endif /* KERBEROS */
+#endif /* HAVE_KERBEROS */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/*
* in print.c
*/
-int ldap_log_printf LDAP_P((LDAP *ld, int level, const char *fmt, ...));
+int ldap_log_printf LDAP_P((LDAP *ld, int level, const char *fmt, ...))
+ LDAP_GCCATTR((format(printf, 3, 4)));
/*
* in cache.c
--- /dev/null
+# $OpenLDAP$
+#
+# LDAP Defaults
+#
+
+# See ldap.conf(5) for details
+# This file should be world readable.
+
+#BASE dc=OpenLDAP, dc=Org
+#HOST ldap.openldap.org
+
+#HOST ldap.openldap.org ldap-master.openldap.org:666
+#PORT 389
+
+#SIZELIMIT 12
+#TIMELIMIT 15
+#DEREF never
+# $OpenLDAP$
+#
# ldap filter file
#
# lines like this that start with # or empty lines are ignored
#
"finger and ud and go500 and go500gw subtree and web500gw subtree and rp500 and rcpt500 and ufn last"
+ "^$" "" "(objectclass=*)" "default filter"
"=" " " "%v" "arbitrary filter"
- "^[0-9][0-9-]*$" " " "(telephoneNumber=*%v)" "phone number"
+ "^[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* %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"
+ ".*" ". " "(|(cn=%v1)(sn=%v1)(ou=%v1))" "exact"
+ "(|(cn~=%v1)(sn~=%v1)(ou~=%v1))" "approximate"
"go500gw onelevel and web500gw onelevel and ufn first and ufn intermediate"
+ "^$" "" "(!(objectclass=dSA))" "default filter"
"=" " " "%v" "arbitrary filter"
- "^..$" " " "(|(o=%v)(c=%v)(l=%v)(co=%v))" "exact"
- "(|(o~=%v)(c~=%v)(l~=%v)(co~=%v))" "approximate"
+ "^..$" " " "(|(o=%v)(c=%v)(l=%v)(co=%v))" "exact2"
+ "(|(o~=%v)(c~=%v)(l~=%v)(co~=%v))" "approximate2"
" " " " "(|(o=%v)(l=%v)(co=%v)(ou=%v))" "exact"
"(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))" "approximate"
- "\." " " "(associatedDomain=%v)" "exact"
+ "\." " " "(associatedDomain=%v)" "exact"
".*" " " "(|(o=%v)(l=%v)(co=%v)(ou=%v))" "exact"
"(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))" "approximate"
+# $OpenLDAP$
# Version should be 1 now
Version 1
#
+# $OpenLDAP$
##########################################################################
# LDAP display templates
##########################################################################
--- /dev/null
+# Microsoft Developer Studio Project File - Name="libldap" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libldap - Win32 Single Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libldap.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libldap.mak" CFG="libldap - Win32 Single Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libldap - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libldap - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "libldap - Win32 Single Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "libldap - Win32 Single Release" (based on\
+ "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF "$(CFG)" == "libldap - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release"
+# PROP Intermediate_Dir "Release\libldap"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\Release\oldap32.lib"
+
+!ELSEIF "$(CFG)" == "libldap - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\Debug"
+# PROP Intermediate_Dir "Debug\libldap"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\Debug\oldap32.lib"
+
+!ELSEIF "$(CFG)" == "libldap - Win32 Single Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "libldap_"
+# PROP BASE Intermediate_Dir "libldap_"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\SDebug"
+# PROP Intermediate_Dir "SDebug\libldap"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo /out:"..\Debug\oldap32.lib"
+# ADD LIB32 /nologo /out:"..\SDebug\oldap32.lib"
+
+!ELSEIF "$(CFG)" == "libldap - Win32 Single Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "libldap0"
+# PROP BASE Intermediate_Dir "libldap0"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\SRelease"
+# PROP Intermediate_Dir "SRelease\libldap"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo /out:"..\Release\oldap32.lib"
+# ADD LIB32 /nologo /out:"..\SRelease\oldap32.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "libldap - Win32 Release"
+# Name "libldap - Win32 Debug"
+# Name "libldap - Win32 Single Debug"
+# Name "libldap - Win32 Single Release"
+# Begin Source File
+
+SOURCE=.\abandon.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\add.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\addentry.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\bind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cache.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\charray.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\charset.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cldap.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\compare.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\controls.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\delete.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\digest.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\disptmpl.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\disptmpl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\dn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\dsparse.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\error.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\extended.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\free.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\friendly.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getattr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getdn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getdxbyname.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getentry.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getfilter.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getvalues.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\init.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\kbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\ldap-int.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_cdefs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_config.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_defaults.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_features.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_log.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_pvt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_schema.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\messages.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\modify.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\modrdn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\open.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\options.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\os-ip.c"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portable.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\print.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\references.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\request.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\result.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sasl.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\schema.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\search.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sort.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\srchpref.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\srchpref.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\string.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ufn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\unbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\url.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\util-int.c"
+# End Source File
+# End Target
+# End Project
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * messages.c
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+LDAPMessage *
+ldap_first_message( LDAP *ld, LDAPMessage *chain )
+{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
+ if ( ld == NULL || chain == NULL ) {
+ return NULL;
+ }
+
+ return chain;
+}
+
+LDAPMessage *
+ldap_next_message( LDAP *ld, LDAPMessage *msg )
+{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
+ if ( ld == NULL || msg == NULL || msg->lm_chain == NULL ) {
+ return NULL;
+ }
+
+ return( msg->lm_chain );
+}
+
+int
+ldap_count_messages( LDAP *ld, LDAPMessage *chain )
+{
+ int i;
+
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
+ if ( ld == NULL ) {
+ return -1;
+ }
+
+ for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
+ i++;
+ }
+
+ return( i );
+}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* modify.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
-#include "lber.h"
-#include "ldap.h"
#include "ldap-int.h"
/*
- * ldap_modify - initiate an ldap (and X.500) modify operation. Parameters:
+ * ldap_modify_ext - initiate an ldap extended 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.
+ * sctrls Server Controls
+ * cctrls Client Controls
+ * msgidp Message ID pointer
*
* Example:
* LDAPMod *mods[] = {
* { LDAP_MOD_REPLACE, "sn", { "jensen", 0 } },
* 0
* }
- * msgid = ldap_modify( ld, dn, mods );
+ * rc= ldap_modify_ext( ld, dn, mods, sctrls, cctrls, &msgid );
*/
int
-ldap_modify( LDAP *ld, char *dn, LDAPMod **mods )
+ldap_modify_ext( LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAPMod **mods,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ int *msgidp )
{
BerElement *ber;
int i, rc;
* }
*/
- Debug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_modify_ext\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
- return( -1 );
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ return( LDAP_NO_MEMORY );
}
- if ( ber_printf( ber, "{it{s{", ++ld->ld_msgid, LDAP_REQ_MODIFY, dn )
+ if ( ber_printf( ber, "{it{s{" /*}}}*/, ++ld->ld_msgid, LDAP_REQ_MODIFY, dn )
== -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
- return( -1 );
+ return( ld->ld_errno );
}
/* 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,
+ (ber_int_t) ( 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,
+ rc = ber_printf( ber, "{e{s[v]}}",
+ (ber_int_t) mods[i]->mod_op,
mods[i]->mod_type, mods[i]->mod_values );
}
if ( rc == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
- return( -1 );
+ return( ld->ld_errno );
}
}
- if ( ber_printf( ber, "}}}" ) == -1 ) {
+ if ( ber_printf( ber, /*{{*/ "}}" ) == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free( ber, 1 );
+ return( ld->ld_errno );
+ }
+
+ /* Put Server Controls */
+ if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
+ ber_free( ber, 1 );
+ return ld->ld_errno;
+ }
+
+ if ( ber_printf( ber, /*{*/ "}" ) == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
- return( -1 );
+ return( ld->ld_errno );
}
/* send the message */
- return( send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber ));
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber );
+ return( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS );
}
+/*
+ * 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_modify_s( LDAP *ld, char *dn, LDAPMod **mods )
+ldap_modify( LDAP *ld, LDAP_CONST char *dn, LDAPMod **mods )
{
+ int rc, msgid;
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 );
+
+ rc = ldap_modify_ext( ld, dn, mods, NULL, NULL, &msgid );
+
+ if ( rc != LDAP_SUCCESS )
+ return -1;
+
+ return msgid;
+}
+
+int
+ldap_modify_ext_s( LDAP *ld, LDAP_CONST char *dn,
+ LDAPMod **mods, LDAPControl **sctrl, LDAPControl **cctrl )
+{
+ int rc;
int msgid;
LDAPMessage *res;
- if ( (msgid = ldap_modify( ld, dn, mods )) == -1 )
- return( ld->ld_errno );
+ rc = ldap_modify_ext( ld, dn, mods, sctrl, cctrl, &msgid );
+
+ if ( rc != LDAP_SUCCESS )
+ return( rc );
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
return( ld->ld_errno );
return( ldap_result2error( ld, res, 1 ) );
}
+int
+ldap_modify_s( LDAP *ld, LDAP_CONST char *dn, LDAPMod **mods )
+{
+ return ldap_modify_ext_s( ld, dn, mods, NULL, NULL );
+}
+
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* modrdn.c
*/
+/*
+ * Support for MODIFYDN REQUEST V3 (newSuperior) by:
+ *
+ * Copyright 1999, Juan C. Gomez, All rights reserved.
+ * This software is not subject to any license of Silicon Graphics
+ * Inc. or Purdue University.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * without restriction or fee of any kind as long as this notice
+ * is preserved.
+ */
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+/*
+ * A modify rdn request looks like this:
+ * ModifyRDNRequest ::= SEQUENCE {
+ * entry DistinguishedName,
+ * newrdn RelativeDistinguishedName,
+ * deleteoldrdn BOOLEAN
+ * newSuperior [0] DistinguishedName [v3 only]
+ * }
+ */
-#include <stdio.h>
-#include <string.h>
+#include "portable.h"
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
+#include <stdio.h>
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
-#include "lber.h"
-#include "ldap.h"
#include "ldap-int.h"
/*
- * ldap_modrdn2 - initiate an ldap (and X.500) modifyRDN operation. Parameters:
+ * ldap_rename - initiate an ldap extended modifyDN operation.
*
- * ld LDAP descriptor
- * dn DN of the object to modify
- * newrdn RDN to give the object
+ * Parameters:
+ * ld LDAP descriptor
+ * dn DN of the object to modify
+ * newrdn RDN to give the object
* deleteoldrdn nonzero means to delete old rdn values from the entry
+ * newSuperior DN of the new parent if applicable
*
- * Example:
- * msgid = ldap_modrdn( ld, dn, newrdn );
+ * Returns the LDAP error code.
*/
+
int
-ldap_modrdn2( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn )
+ldap_rename(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *newrdn,
+ int deleteoldrdn,
+ LDAP_CONST char *newSuperior,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ int *msgidp )
{
BerElement *ber;
+ int rc;
- /*
- * A modify rdn request looks like this:
- * ModifyRDNRequest ::= SEQUENCE {
- * entry DistinguishedName,
- * newrdn RelativeDistinguishedName,
- * deleteoldrdn BOOLEAN
- * }
- */
-
- Debug( LDAP_DEBUG_TRACE, "ldap_modrdn\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_rename\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
- return( -1 );
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ return( LDAP_NO_MEMORY );
+ }
+
+ if( newSuperior != NULL ) {
+ /* must be version 3 (or greater) */
+ if ( ld->ld_version < LDAP_VERSION3 ) {
+ ld->ld_errno = LDAP_NOT_SUPPORTED;
+ ber_free( ber, 1 );
+ return( ld->ld_errno );
+ }
+
+ rc = ber_printf( ber, "{it{ssbts}", /* '}' */
+ ++ld->ld_msgid, LDAP_REQ_MODDN,
+ dn, newrdn, (ber_int_t) deleteoldrdn,
+ LDAP_TAG_NEWSUPERIOR, newSuperior );
+
+ } else {
+ rc = ber_printf( ber, "{it{ssb}", /* '}' */
+ ++ld->ld_msgid, LDAP_REQ_MODDN,
+ dn, newrdn, (ber_int_t) deleteoldrdn );
}
- if ( ber_printf( ber, "{it{ssb}}", ++ld->ld_msgid, LDAP_REQ_MODRDN, dn,
- newrdn, deleteoldrdn ) == -1 ) {
+ if ( rc < 0 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
- return( -1 );
+ return( ld->ld_errno );
+ }
+
+ /* Put Server Controls */
+ if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
+ ber_free( ber, 1 );
+ return ld->ld_errno;
+ }
+
+ rc = ber_printf( ber, /*{*/ "}" );
+ if ( rc < 0 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free( ber, 1 );
+ return( ld->ld_errno );
}
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber ));
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber );
+
+ if( *msgidp < 0 ) {
+ return( ld->ld_errno );
+ }
+
+ return LDAP_SUCCESS;
}
+
+/*
+ * ldap_rename2 - initiate an ldap (and X.500) modifyDN operation. Parameters:
+ * (LDAP V3 MODIFYDN REQUEST)
+ * ld LDAP descriptor
+ * dn DN of the object to modify
+ * newrdn RDN to give the object
+ * deleteoldrdn nonzero means to delete old rdn values from the entry
+ * newSuperior DN of the new parent if applicable
+ *
+ * ldap_rename2 uses a U-Mich Style API. It returns the msgid.
+ */
+
int
-ldap_modrdn( LDAP *ld, char *dn, char *newrdn )
+ldap_rename2(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *newrdn,
+ int deleteoldrdn,
+ LDAP_CONST char *newSuperior )
{
- return( ldap_modrdn2( ld, dn, newrdn, 1 ) );
+ int msgid;
+ int rc;
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_rename2\n", 0, 0, 0 );
+
+ rc = ldap_rename( ld, dn, newrdn, deleteoldrdn, newSuperior,
+ NULL, NULL, &msgid );
+
+ return rc == LDAP_SUCCESS ? msgid : -1;
}
+
+/*
+ * ldap_modrdn2 - initiate an ldap modifyRDN operation. Parameters:
+ *
+ * ld LDAP descriptor
+ * dn DN of the object to modify
+ * newrdn RDN to give the object
+ * deleteoldrdn nonzero means to delete old rdn values from the entry
+ *
+ * Example:
+ * msgid = ldap_modrdn( ld, dn, newrdn );
+ */
int
-ldap_modrdn2_s( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn )
+ldap_modrdn2( LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *newrdn,
+ int deleteoldrdn )
{
- int msgid;
- LDAPMessage *res;
+ return ldap_rename2( ld, dn, newrdn, deleteoldrdn, NULL );
+}
- if ( (msgid = ldap_modrdn2( ld, dn, newrdn, deleteoldrdn )) == -1 )
- return( ld->ld_errno );
+int
+ldap_modrdn( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn )
+{
+ return( ldap_rename2( ld, dn, newrdn, 1, NULL ) );
+}
- if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
- return( ld->ld_errno );
- return( ldap_result2error( ld, res, 1 ) );
+int
+ldap_rename_s(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *newrdn,
+ int deleteoldrdn,
+ LDAP_CONST char *newSuperior,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls )
+{
+ int rc;
+ int msgid;
+ LDAPMessage *res;
+
+ rc = ldap_rename( ld, dn, newrdn, deleteoldrdn,
+ newSuperior, sctrls, cctrls, &msgid );
+
+ if( rc != LDAP_SUCCESS ) {
+ return rc;
+ }
+
+ rc = ldap_result( ld, msgid, 1, NULL, &res );
+
+ if( rc == -1 ) {
+ return ld->ld_errno;
+ }
+
+ return ldap_result2error( ld, res, 1 );
}
int
-ldap_modrdn_s( LDAP *ld, char *dn, char *newrdn )
+ldap_rename2_s(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *newrdn,
+ int deleteoldrdn,
+ LDAP_CONST char *newSuperior )
{
- return( ldap_modrdn2_s( ld, dn, newrdn, 1 ) );
+ return ldap_rename_s( ld, dn, newrdn, deleteoldrdn, newSuperior, NULL, NULL );
}
+
+int
+ldap_modrdn2_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, int deleteoldrdn )
+{
+ return ldap_rename_s( ld, dn, newrdn, deleteoldrdn, NULL, NULL, NULL );
+}
+
+int
+ldap_modrdn_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn )
+{
+ return ldap_rename_s( ld, dn, newrdn, 1, NULL, NULL, NULL );
+}
+
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
tv.tv_sec = opt_tv->tv_sec;
}
- osip_debug(ld, "ldap_connect_timeout: fd: %d tm: %d async: %d\n",
- s, opt_tv ? tv.tv_sec : -1, async);
+ osip_debug(ld, "ldap_connect_timeout: fd: %d tm: %ld async: %d\n",
+ s, opt_tv ? tv.tv_sec : -1L, async);
if ( ldap_pvt_ndelay_on(ld, s) == -1 )
return ( -1 );
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/ctype.h>
+#include <ac/stdarg.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+/*
+ * ldap log
+ */
+
+static int ldap_log_check( LDAP *ld, int loglvl )
+{
+ int errlvl;
+
+ if(ld == NULL) {
+ errlvl = ldap_debug;
+ } else {
+ errlvl = ld->ld_errno;
+ }
+
+ return errlvl & loglvl ? 1 : 0;
+}
+
+int ldap_log_printf( LDAP *ld, int loglvl, const char *fmt, ... )
+{
+ char buf[ 1024 ];
+ va_list ap;
+
+ if ( !ldap_log_check( ld, loglvl )) {
+ return 0;
+ }
+
+ va_start( ap, fmt );
+
+#ifdef HAVE_VSNPRINTF
+ buf[sizeof(buf) - 1] = '\0';
+ vsnprintf( buf, sizeof(buf)-1, fmt, ap );
+#elif HAVE_VSPRINTF
+ vsprintf( buf, fmt, ap ); /* hope it's not too long */
+#else
+ /* use doprnt() */
+ chokeme = "choke me! I don't have a doprnt manual handy!";
+#endif
+
+ va_end(ap);
+
+ (*ber_pvt_log_print)( buf );
+ return 1;
+}
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * references.c
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+LDAPMessage *
+ldap_first_reference( LDAP *ld, LDAPMessage *chain )
+{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( chain != NULL );
+
+ if ( ld == NULL || chain == NULL ) {
+ return NULL;
+ }
+
+ return chain->lm_msgtype == LDAP_RES_SEARCH_REFERENCE
+ ? chain
+ : ldap_next_reference( ld, chain );
+}
+
+LDAPMessage *
+ldap_next_reference( LDAP *ld, LDAPMessage *ref )
+{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( ref != NULL );
+
+ if ( ld == NULL || ref == NULL ) {
+ return NULL;
+ }
+
+ for (
+ ref = ref->lm_chain;
+ ref != NULL;
+ ref = ref->lm_chain )
+ {
+ if( ref->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ) {
+ return( ref );
+ }
+ }
+
+ return( NULL );
+}
+
+int
+ldap_count_references( LDAP *ld, LDAPMessage *chain )
+{
+ int i;
+
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( chain != NULL );
+
+ if ( ld == NULL ) {
+ return -1;
+ }
+
+
+ for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
+ if( chain->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ) {
+ i++;
+ }
+ }
+
+ return( i );
+}
+
+int
+ldap_parse_reference(
+ LDAP *ld,
+ LDAPMessage *ref,
+ char ***referralsp,
+ LDAPControl ***serverctrls,
+ int freeit)
+{
+ BerElement be;
+ char **refs = NULL;
+ int rc;
+
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( ref != NULL );
+
+ if( ld == NULL || ref == NULL ||
+ ref->lm_msgtype != LDAP_RES_SEARCH_REFERENCE )
+ {
+ return LDAP_PARAM_ERROR;
+ }
+
+ /* make a private copy of BerElement */
+ SAFEMEMCPY(&be, ref->lm_ber, sizeof(be));
+
+ if ( ber_scanf( &be, "{v" /*}*/, &refs ) == LBER_ERROR ) {
+ rc = LDAP_DECODING_ERROR;
+ goto free_and_return;
+ }
+
+ if ( serverctrls == NULL ) {
+ rc = LDAP_SUCCESS;
+ goto free_and_return;
+ }
+
+ if ( ber_scanf( &be, /*{*/ "}" ) == LBER_ERROR ) {
+ rc = LDAP_DECODING_ERROR;
+ goto free_and_return;
+ }
+
+ rc = ldap_int_get_controls( &be, serverctrls );
+
+free_and_return:
+
+ if( referralsp != NULL ) {
+ /* provide references regradless of return code */
+ *referralsp = refs;
+
+ } else {
+ ldap_value_free( refs );
+ }
+
+ if( freeit ) {
+ ldap_msgfree( ref );
+ }
+
+ if( rc != LDAP_SUCCESS ) {
+ ld->ld_errno = rc;
+
+ if( ld->ld_matched != NULL ) {
+ LDAP_FREE( ld->ld_matched );
+ ld->ld_matched = NULL;
+ }
+
+ if( ld->ld_error != NULL ) {
+ LDAP_FREE( ld->ld_error );
+ ld->ld_error = NULL;
+ }
+ }
+
+ return rc;
+}
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* result.c - wait for an ldap result
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+/*
+ * LDAPv3 (RFC2251)
+ * LDAPResult ::= SEQUENCE {
+ * resultCode ENUMERATED { ... },
+ * matchedDN LDAPDN,
+ * errorMessage LDAPString,
+ * referral Referral OPTIONAL
+ * }
+ * Referral ::= SEQUENCE OF LDAPURL (one or more)
+ * LDAPURL ::= LDAPString (limited to URL chars)
+ */
-#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include <time.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <time.h>
-#include "msdos.h"
-#ifdef PCNFS
-#include <tklib.h>
-#include <tk_errno.h>
-#include <bios.h>
-#endif /* PCNFS */
-#ifdef NCSA
-#include "externs.h"
-#endif /* NCSA */
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#ifdef _AIX
-#include <sys/select.h>
-#endif /* _AIX */
#include "portable.h"
-#endif /* DOS */
-#endif /* MACOS */
-#ifdef VMS
-#include "ucx_select.h"
-#endif
-#include "lber.h"
-#include "ldap.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
#include "ldap-int.h"
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
-
-#ifdef NEEDPROTOS
-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, struct timeval *timeout,
- LDAPMessage **result );
-#ifdef LDAP_REFERRALS
-static int read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc,
- LDAPMessage **result );
-static int build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr );
-static void merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr );
-#else /* LDAP_REFERRALS */
-static int read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
- LDAPMessage **result );
-#endif /* LDAP_REFERRALS */
-#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
-static int ldap_select1( LDAP *ld, struct timeval *timeout );
-#endif
-#else /* NEEDPROTOS */
-static int ldap_abandoned();
-static int ldap_mark_abandoned();
-static int wait4msg();
-static int read1msg();
-#ifdef LDAP_REFERRALS
-static int build_result_ber();
-static void merge_error_info();
-#endif /* LDAP_REFERRALS */
-#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
-static int ldap_select1();
-#endif
-#endif /* NEEDPROTOS */
-#if !defined( MACOS ) && !defined( DOS )
-extern int errno;
-#endif
+static int ldap_abandoned LDAP_P(( LDAP *ld, ber_int_t msgid ));
+static int ldap_mark_abandoned LDAP_P(( LDAP *ld, ber_int_t msgid ));
+static int wait4msg LDAP_P(( LDAP *ld, ber_int_t msgid, int all, struct timeval *timeout,
+ LDAPMessage **result ));
+static ber_tag_t try_read1msg LDAP_P(( LDAP *ld, ber_int_t msgid,
+ int all, Sockbuf *sb, LDAPConn *lc, LDAPMessage **result ));
+static ber_tag_t build_result_ber LDAP_P(( LDAP *ld, BerElement **bp, LDAPRequest *lr ));
+static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));
/*
* ldap_result( s, msgid, all, timeout, result )
*/
int
-ldap_result( LDAP *ld, int msgid, int all, struct timeval *timeout,
+ldap_result(
+ LDAP *ld,
+ int msgid,
+ int all,
+ struct timeval *timeout,
LDAPMessage **result )
{
LDAPMessage *lm, *lastlm, *nextlm;
+ assert( ld != NULL );
+ assert( result != NULL );
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_result\n", 0, 0, 0 );
+
+ if( ld == NULL ) {
+ return -1;
+ }
+
+ if( result == NULL ) {
+ ld->ld_errno = LDAP_PARAM_ERROR;
+ return -1;
+ }
+
/*
* First, look through the list of responses we have received on
* this association and see if the response we're interested in
* wait until it arrives or timeout occurs.
*/
- Debug( LDAP_DEBUG_TRACE, "ldap_result\n", 0, 0, 0 );
-
- *result = NULLMSG;
- lastlm = NULLMSG;
- for ( lm = ld->ld_responses; lm != NULLMSG; lm = nextlm ) {
+ *result = NULL;
+ lastlm = NULL;
+ for ( lm = ld->ld_responses; lm != NULL; lm = nextlm ) {
nextlm = lm->lm_next;
if ( ldap_abandoned( ld, lm->lm_msgid ) ) {
ldap_mark_abandoned( ld, lm->lm_msgid );
- if ( lastlm == NULLMSG ) {
+ if ( lastlm == NULL ) {
ld->ld_responses = lm->lm_next;
} else {
lastlm->lm_next = nextlm;
if ( all == 0
|| (lm->lm_msgtype != LDAP_RES_SEARCH_RESULT
+ && lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE /* LDAPv3 */
&& lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY) )
break;
- for ( tmp = lm; tmp != NULLMSG; tmp = tmp->lm_chain ) {
+ for ( tmp = lm; tmp != NULL; tmp = tmp->lm_chain ) {
if ( tmp->lm_msgtype == LDAP_RES_SEARCH_RESULT )
break;
}
- if ( tmp == NULLMSG ) {
- return( wait4msg( ld, msgid, all, timeout,
- result ) );
+ if ( tmp == NULL ) {
+ lm = NULL;
}
break;
}
lastlm = lm;
}
- if ( lm == NULLMSG ) {
+ if ( lm == NULL ) {
return( wait4msg( ld, msgid, all, timeout, result ) );
}
- if ( lastlm == NULLMSG ) {
- ld->ld_responses = (all == 0 && lm->lm_chain != NULLMSG
+ if ( lastlm == NULL ) {
+ ld->ld_responses = (all == 0 && lm->lm_chain != NULL
? lm->lm_chain : lm->lm_next);
} else {
- lastlm->lm_next = (all == 0 && lm->lm_chain != NULLMSG
+ lastlm->lm_next = (all == 0 && lm->lm_chain != NULL
? lm->lm_chain : lm->lm_next);
}
if ( all == 0 )
- lm->lm_chain = NULLMSG;
- lm->lm_next = NULLMSG;
+ lm->lm_chain = NULL;
+ lm->lm_next = NULL;
*result = lm;
ld->ld_errno = LDAP_SUCCESS;
}
static int
-wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
+wait4msg(
+ LDAP *ld,
+ ber_int_t msgid,
+ int all,
+ struct timeval *timeout,
LDAPMessage **result )
{
int rc;
struct timeval tv, *tvp;
- long start_time, tmp_time;
-#ifdef LDAP_REFERRALS
+ time_t start_time = 0;
+ time_t tmp_time;
LDAPConn *lc, *nextlc;
-#endif /* LDAP_REFERRALS */
+
+ assert( ld != NULL );
+ assert( result != NULL );
#ifdef LDAP_DEBUG
if ( timeout == NULL ) {
0, 0, 0 );
} else {
Debug( LDAP_DEBUG_TRACE, "wait4msg (timeout %ld sec, %ld usec)\n",
- timeout->tv_sec, timeout->tv_usec, 0 );
+ (long) timeout->tv_sec, (long) timeout->tv_usec, 0 );
}
#endif /* LDAP_DEBUG */
} else {
tv = *timeout;
tvp = &tv;
- start_time = (long)time( NULL );
+ start_time = time( NULL );
}
rc = -2;
while ( rc == -2 ) {
-#ifndef LDAP_REFERRALS
- /* hack attack */
- if ( ld->ld_sb.sb_ber.ber_ptr >= ld->ld_sb.sb_ber.ber_end ) {
- rc = ldap_select1( ld, tvp );
-
-#if !defined( MACOS ) && !defined( DOS )
- if ( rc == 0 || ( rc == -1 && (( ld->ld_options &
- LDAP_OPT_RESTART ) == 0 || errno != EINTR ))) {
-#else
- if ( rc == -1 || rc == 0 ) {
-#endif
- ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
- LDAP_TIMEOUT);
- return( rc );
- }
-
- }
- if ( rc == -1 ) {
- rc = -2; /* select interrupted: loop */
- } else {
- rc = read1msg( ld, msgid, all, &ld->ld_sb, result );
- }
-#else /* !LDAP_REFERRALS */
#ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_TRACE ) {
- dump_connection( ld, ld->ld_conns, 1 );
- dump_requests_and_responses( ld );
+ ldap_dump_connection( ld, ld->ld_conns, 1 );
+ ldap_dump_requests_and_responses( ld );
}
#endif /* LDAP_DEBUG */
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,
+ if ( ber_pvt_sb_data_ready(lc->lconn_sb) ) {
+ rc = try_read1msg( ld, msgid, all, lc->lconn_sb,
lc, result );
break;
}
rc = do_ldap_select( ld, tvp );
-#if defined( LDAP_DEBUG ) && !defined( MACOS ) && !defined( DOS )
+#ifdef LDAP_DEBUG
if ( rc == -1 ) {
Debug( LDAP_DEBUG_TRACE,
"do_ldap_select returned -1: errno %d\n",
}
#endif
-#if !defined( MACOS ) && !defined( DOS )
- if ( rc == 0 || ( rc == -1 && (( ld->ld_options &
- LDAP_OPT_RESTART ) == 0 || errno != EINTR ))) {
-#else
- if ( rc == -1 || rc == 0 ) {
-#endif
+ if ( rc == 0 || ( rc == -1 && (
+ !LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART)
+ || errno != EINTR )))
+ {
ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
LDAP_TIMEOUT);
return( rc );
nextlc = lc->lconn_next;
if ( lc->lconn_status ==
LDAP_CONNST_CONNECTED &&
- is_read_ready( ld,
+ ldap_is_read_ready( ld,
lc->lconn_sb )) {
- rc = read1msg( ld, msgid, all,
+ rc = try_read1msg( ld, msgid, all,
lc->lconn_sb, lc, result );
}
}
}
}
-#endif /* !LDAP_REFERRALS */
if ( rc == -2 && tvp != NULL ) {
- tmp_time = (long)time( NULL );
+ tmp_time = time( NULL );
if (( tv.tv_sec -= ( tmp_time - start_time )) <= 0 ) {
rc = 0; /* timed out */
ld->ld_errno = LDAP_TIMEOUT;
}
Debug( LDAP_DEBUG_TRACE, "wait4msg: %ld secs to go\n",
- tv.tv_sec, 0, 0 );
+ (long) tv.tv_sec, 0, 0 );
start_time = tmp_time;
}
}
}
-static int
-read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
-#ifdef LDAP_REFERRALS
+static ber_tag_t
+try_read1msg(
+ LDAP *ld,
+ ber_int_t msgid,
+ int all,
+ Sockbuf *sb,
LDAPConn *lc,
-#endif /* LDAP_REFERRALS */
- LDAPMessage **result )
+ LDAPMessage **result )
{
- BerElement ber;
+ BerElement *ber;
LDAPMessage *new, *l, *prev, *tmp;
- long id;
- unsigned long tag, len;
+ ber_int_t id;
+ ber_tag_t tag;
+ ber_len_t len;
int foundit = 0;
-#ifdef LDAP_REFERRALS
LDAPRequest *lr;
BerElement tmpber;
int rc, refer_cnt, hadref, simple_request;
- unsigned long lderr;
-#endif /* LDAP_REFERRALS */
+ ber_int_t lderr;
+ assert( ld != NULL );
+ assert( lc != NULL );
+
Debug( LDAP_DEBUG_TRACE, "read1msg\n", 0, 0, 0 );
- ber_init( &ber, 0 );
- set_ber_options( ld, &ber );
+ if ( lc->lconn_ber == NULL ) {
+ lc->lconn_ber = ldap_alloc_ber_with_options(ld);
+
+ if( lc->lconn_ber == NULL ) {
+ return -1;
+ }
+ }
+
+ ber = lc->lconn_ber;
+ assert( BER_VALID (ber) );
/* get the next message */
- if ( (tag = ber_get_next( sb, &len, &ber ))
+ errno = 0;
+ if ( (tag = ber_get_next( sb, &len, ber ))
!= LDAP_TAG_MESSAGE ) {
- ld->ld_errno = (tag == LBER_DEFAULT ? LDAP_SERVER_DOWN :
- LDAP_LOCAL_ERROR);
- return( -1 );
+ if ( tag == LBER_DEFAULT) {
+#ifdef LDAP_DEBUG
+ Debug( LDAP_DEBUG_CONNS,
+ "ber_get_next failed.\n", 0, 0, 0 );
+#endif
+#ifdef EWOULDBLOCK
+ if (errno==EWOULDBLOCK) return -2;
+#endif
+#ifdef EAGAIN
+ if (errno == EAGAIN) return -2;
+#endif
+ ld->ld_errno = LDAP_SERVER_DOWN;
+ return -1;
+ }
+ ld->ld_errno = LDAP_LOCAL_ERROR;
+ return -1;
}
+ /*
+ * We read a complete message.
+ * The connection should no longer need this ber.
+ */
+ lc->lconn_ber = NULL;
+
/* message id */
- if ( ber_get_int( &ber, &id ) == LBER_ERROR ) {
+ if ( ber_get_int( ber, &id ) == LBER_ERROR ) {
+ ber_free( ber, 1 );
ld->ld_errno = LDAP_DECODING_ERROR;
return( -1 );
}
/* if it's been abandoned, toss it */
- if ( ldap_abandoned( ld, (int)id ) ) {
- free( ber.ber_buf ); /* gack! */
+ if ( ldap_abandoned( ld, id ) ) {
+ ber_free( ber, 1 );
return( -2 ); /* continue looking */
}
-#ifdef LDAP_REFERRALS
- if (( lr = find_request_by_msgid( ld, id )) == NULL ) {
+ if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
Debug( LDAP_DEBUG_ANY,
"no request for response with msgid %ld (tossing)\n",
- id, 0, 0 );
- free( ber.ber_buf ); /* gack! */
+ (long) id, 0, 0 );
+ ber_free( ber, 1 );
return( -2 ); /* continue looking */
}
- Debug( LDAP_DEBUG_TRACE, "got %s msgid %ld, original id %d\n",
- ( tag == LDAP_RES_SEARCH_ENTRY ) ? "entry" : "result", id,
- lr->lr_origid );
- id = lr->lr_origid;
-#endif /* LDAP_REFERRALS */
/* the message type */
- if ( (tag = ber_peek_tag( &ber, &len )) == LBER_ERROR ) {
+ if ( (tag = ber_peek_tag( ber, &len )) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
+ ber_free( ber, 1 );
return( -1 );
}
-#ifdef LDAP_REFERRALS
+ Debug( LDAP_DEBUG_TRACE, "ldap_read: %s msgid %ld, original id %ld\n",
+ ( tag == LDAP_RES_SEARCH_ENTRY ) ? "entry" :
+ ( tag == LDAP_RES_SEARCH_REFERENCE ) ? "reference" : "result",
+ (long) id, (long) lr->lr_origid );
+
+ id = lr->lr_origid;
refer_cnt = 0;
hadref = simple_request = 0;
rc = -2; /* default is to keep looking (no response found) */
if ( tag != LDAP_RES_SEARCH_ENTRY ) {
if ( ld->ld_version >= LDAP_VERSION2 &&
- ( lr->lr_parent != NULL ||
- ( ld->ld_options & LDAP_OPT_REFERRALS ) != 0 )) {
- tmpber = ber; /* struct copy */
+ ( lr->lr_parent != NULL ||
+ LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) ) )
+ {
+ tmpber = *ber; /* struct copy */
if ( ber_scanf( &tmpber, "{iaa}", &lderr,
&lr->lr_res_matched, &lr->lr_res_error )
!= LBER_ERROR ) {
if ( lderr != LDAP_SUCCESS ) {
/* referrals are in error string */
- refer_cnt = chase_referrals( ld, lr,
+ refer_cnt = ldap_chase_referrals( ld, lr,
&lr->lr_res_error, &hadref );
}
"read1msg: %d new referrals\n", refer_cnt, 0, 0 );
if ( refer_cnt != 0 ) { /* chasing referrals */
- free( ber.ber_buf ); /* gack! */
- ber.ber_buf = NULL;
+ ber_free( ber, 1 );
+ ber = NULL;
if ( refer_cnt < 0 ) {
return( -1 ); /* fatal error */
}
simple_request = ( hadref ? 0 : 1 );
} else {
/* request with referrals or child request */
- free( ber.ber_buf ); /* gack! */
- ber.ber_buf = NULL;
+ ber_free( ber, 1 );
+ ber = NULL;
}
while ( lr->lr_parent != NULL ) {
id = lr->lr_msgid;
tag = lr->lr_res_msgtype;
Debug( LDAP_DEBUG_ANY, "request %ld done\n",
- id, 0, 0 );
+ (long) id, 0, 0 );
Debug( 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.ber_buf != NULL ) {
- free( ber.ber_buf ); /* gack! */
- ber.ber_buf = NULL;
- }
+ ber_free( ber, 1 );
+ ber = NULL;
if ( build_result_ber( ld, &ber, lr )
== LBER_ERROR ) {
- ld->ld_errno = LDAP_NO_MEMORY;
rc = -1; /* fatal error */
}
}
- free_request( ld, lr );
+ ldap_free_request( ld, lr );
}
if ( lc != NULL ) {
- free_connection( ld, lc, 0, 1 );
+ ldap_free_connection( ld, lc, 0, 1 );
}
}
}
- if ( ber.ber_buf == NULL ) {
+ if ( ber == NULL ) {
return( rc );
}
-#endif /* LDAP_REFERRALS */
/* make a new ldap message */
- if ( (new = (LDAPMessage *) calloc( 1, sizeof(LDAPMessage) ))
+ if ( (new = (LDAPMessage *) LDAP_CALLOC( 1, sizeof(LDAPMessage) ))
== NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( -1 );
}
new->lm_msgid = (int)id;
new->lm_msgtype = tag;
- new->lm_ber = ber_dup( &ber );
+ new->lm_ber = ber;
-#ifndef NO_CACHE
+#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL ) {
- add_result_to_cache( ld, new );
+ ldap_add_result_to_cache( ld, new );
}
-#endif /* NO_CACHE */
+#endif /* LDAP_NOCACHE */
/* is this the one we're looking for? */
if ( msgid == LDAP_RES_ANY || id == msgid ) {
* search response.
*/
- prev = NULLMSG;
- for ( l = ld->ld_responses; l != NULLMSG; l = l->lm_next ) {
+ prev = NULL;
+ 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 == NULLMSG ) {
+ if ( l == NULL ) {
if ( foundit ) {
*result = new;
ld->ld_errno = LDAP_SUCCESS;
return( -2 ); /* continue looking */
}
- Debug( LDAP_DEBUG_TRACE, "adding response id %d type %d:\n",
- new->lm_msgid, new->lm_msgtype, 0 );
+ Debug( LDAP_DEBUG_TRACE, "adding response id %ld type %ld:\n",
+ (long) new->lm_msgid, (long) new->lm_msgtype, 0 );
/* part of a search response - add to end of list of entries */
- for ( tmp = l; tmp->lm_chain != NULLMSG &&
+ for ( tmp = l; tmp->lm_chain != NULL &&
tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY;
tmp = tmp->lm_chain )
; /* NULL */
/* return the whole chain if that's what we were looking for */
if ( foundit ) {
- if ( prev == NULLMSG )
+ if ( prev == NULL )
ld->ld_responses = l->lm_next;
else
prev->lm_next = l->lm_next;
*result = l;
ld->ld_errno = LDAP_SUCCESS;
+#ifdef LDAP_WORLD_P16
+ /*
+ * XXX questionable fix; see text for [P16] on
+ * http://www.critical-angle.com/ldapworld/patch/
+ *
+ * inclusion of this patch causes searchs to hang on
+ * multiple platforms
+ */
+ return( l->lm_msgtype );
+#else /* LDAP_WORLD_P16 */
return( tag );
+#endif /* !LDAP_WORLD_P16 */
}
return( -2 ); /* continue looking */
}
-#ifdef LDAP_REFERRALS
-static int
-build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr )
+static ber_tag_t
+build_result_ber( LDAP *ld, BerElement **bp, LDAPRequest *lr )
{
- unsigned long len;
- long along;
+ ber_len_t len;
+ ber_int_t tag;
+ ber_int_t along;
+ BerElement *ber;
+
+ *bp = NULL;
+ ber = ldap_alloc_ber_with_options( ld );
+
+ if( ber == NULL ) {
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return LBER_ERROR;
+ }
- ber_init( ber, 0 );
- set_ber_options( ld, ber );
if ( ber_printf( ber, "{it{ess}}", lr->lr_msgid,
- (long)lr->lr_res_msgtype, lr->lr_res_errno,
+ lr->lr_res_msgtype, lr->lr_res_errno,
lr->lr_res_matched ? lr->lr_res_matched : "",
- lr->lr_res_error ? lr->lr_res_error : "" ) == LBER_ERROR ) {
+ lr->lr_res_error ? lr->lr_res_error : "" ) == -1 ) {
+
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free(ber, 1);
return( LBER_ERROR );
}
ber_reset( ber, 1 );
+
if ( ber_skip_tag( ber, &len ) == LBER_ERROR ) {
+ ld->ld_errno = LDAP_DECODING_ERROR;
+ ber_free(ber, 1);
return( LBER_ERROR );
}
if ( ber_get_int( ber, &along ) == LBER_ERROR ) {
+ ld->ld_errno = LDAP_DECODING_ERROR;
+ ber_free(ber, 1);
return( LBER_ERROR );
}
- return( ber_peek_tag( ber, &len ));
+ tag = ber_peek_tag( ber, &len );
+
+ if ( tag == LBER_ERROR ) {
+ ld->ld_errno = LDAP_DECODING_ERROR;
+ ber_free(ber, 1);
+ return( LBER_ERROR );
+ }
+
+ *bp = ber;
+ return tag;
}
if ( lr->lr_res_errno == LDAP_PARTIAL_RESULTS ) {
parentr->lr_res_errno = lr->lr_res_errno;
if ( lr->lr_res_error != NULL ) {
- (void)append_referral( ld, &parentr->lr_res_error,
+ (void)ldap_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 ) {
- free( parentr->lr_res_error );
+ LDAP_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 ( LDAP_NAME_ERROR( lr->lr_res_errno )) {
if ( parentr->lr_res_matched != NULL ) {
- free( parentr->lr_res_matched );
+ LDAP_FREE( parentr->lr_res_matched );
}
parentr->lr_res_matched = lr->lr_res_matched;
lr->lr_res_matched = NULL;
parentr->lr_res_error : "", parentr->lr_res_matched ?
parentr->lr_res_matched : "" );
}
-#endif /* LDAP_REFERRALS */
-
-#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
-#if !defined( MACOS ) && !defined( DOS ) && !defined( _WIN32 )
-static int
-ldap_select1( LDAP *ld, struct timeval *timeout )
-{
- fd_set readfds;
- static int tblsize;
-
- if ( tblsize == 0 ) {
-#ifdef USE_SYSCONF
- tblsize = sysconf( _SC_OPEN_MAX );
-#else /* USE_SYSCONF */
- tblsize = getdtablesize();
-#endif /* USE_SYSCONF */
- }
-
- FD_ZERO( &readfds );
- FD_SET( ld->ld_sb.sb_sd, &readfds );
-
- return( select( tblsize, &readfds, 0, 0, timeout ) );
-}
-#endif /* !MACOS */
-
-#ifdef MACOS
-static int
-ldap_select1( LDAP *ld, struct timeval *timeout )
-{
- return( tcpselect( ld->ld_sb.sb_sd, timeout ));
-}
-#endif /* MACOS */
-
-
-#if ( defined( DOS ) && defined( WINSOCK )) || defined( _WIN32 )
-static int
-ldap_select1( LDAP *ld, struct timeval *timeout )
+int
+ldap_msgtype( LDAPMessage *lm )
{
- fd_set readfds;
- int rc;
-
- FD_ZERO( &readfds );
- FD_SET( ld->ld_sb.sb_sd, &readfds );
-
- rc = select( 1, &readfds, 0, 0, timeout );
- return( rc == SOCKET_ERROR ? -1 : rc );
+ assert( lm != NULL );
+ return ( lm == NULL ) ? lm->lm_msgtype : -1;
}
-#endif /* WINSOCK || _WIN32 */
-
-#ifdef DOS
-#ifdef PCNFS
-static int
-ldap_select1( LDAP *ld, struct timeval *timeout )
-{
- fd_set readfds;
- int res;
-
- FD_ZERO( &readfds );
- FD_SET( ld->ld_sb.sb_sd, &readfds );
-
- res = select( FD_SETSIZE, &readfds, NULL, NULL, timeout );
- if ( res == -1 && errno == EINTR) {
- /* We've been CTRL-C'ed at this point. It'd be nice to
- carry on but PC-NFS currently won't let us! */
- printf("\n*** CTRL-C ***\n");
- exit(-1);
- }
- return( res );
-}
-#endif /* PCNFS */
-#ifdef NCSA
-static int
-ldap_select1( LDAP *ld, struct timeval *timeout )
+int
+ldap_msgid( LDAPMessage *lm )
{
- int rc;
- clock_t endtime;
-
- if ( timeout != NULL ) {
- endtime = timeout->tv_sec * CLK_TCK +
- timeout->tv_usec * CLK_TCK / 1000000 + clock();
- }
-
- do {
- Stask();
- rc = netqlen( ld->ld_sb.sb_sd );
- } while ( rc <= 0 && ( timeout == NULL || clock() < endtime ));
+ assert( lm != NULL );
- return( rc > 0 ? 1 : 0 );
+ return ( lm == NULL ) ? lm->lm_msgid : -1;
}
-#endif /* NCSA */
-#endif /* DOS */
-#endif /* !LDAP_REFERRALS */
int
LDAPMessage *next;
int type = 0;
+ assert( lm != NULL );
+
Debug( LDAP_DEBUG_TRACE, "ldap_msgfree\n", 0, 0, 0 );
- for ( ; lm != NULLMSG; lm = next ) {
+ for ( ; lm != NULL; lm = next ) {
next = lm->lm_chain;
type = lm->lm_msgtype;
ber_free( lm->lm_ber, 1 );
- free( (char *) lm );
+ LDAP_FREE( (char *) lm );
}
return( type );
{
LDAPMessage *lm, *prev;
+ assert( ld != NULL );
+
Debug( LDAP_DEBUG_TRACE, "ldap_msgdelete\n", 0, 0, 0 );
- prev = NULLMSG;
- for ( lm = ld->ld_responses; lm != NULLMSG; lm = lm->lm_next ) {
+ prev = NULL;
+ for ( lm = ld->ld_responses; lm != NULL; lm = lm->lm_next ) {
if ( lm->lm_msgid == msgid )
break;
prev = lm;
}
- if ( lm == NULLMSG )
+ if ( lm == NULL )
return( -1 );
- if ( prev == NULLMSG )
+ if ( prev == NULL )
ld->ld_responses = lm->lm_next;
else
prev->lm_next = lm->lm_next;
* return 1 if message msgid is waiting to be abandoned, 0 otherwise
*/
static int
-ldap_abandoned( LDAP *ld, int msgid )
+ldap_abandoned( LDAP *ld, ber_int_t msgid )
{
int i;
static int
-ldap_mark_abandoned( LDAP *ld, int msgid )
+ldap_mark_abandoned( LDAP *ld, ber_int_t msgid )
{
int i;
}
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
int
cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber )
{
- int rc;
- unsigned long tag, len;
+ int rc;
+ ber_tag_t tag;
+ ber_len_t len;
+
+ if ( ! ber_pvt_sb_data_ready(&ld->ld_sb) ) {
+ /* restored from ldap_select1() in result.c version 1.24 */
+ fd_set readfds;
+ if ( ldap_int_tblsize == 0 )
+ ldap_int_ip_init();
+ FD_ZERO( &readfds );
+ FD_SET( ber_pvt_sb_get_desc(&ld->ld_sb), &readfds );
+ rc = select( ldap_int_tblsize, &readfds, 0, 0, timeout );
- if ( ld->ld_sb.sb_ber.ber_ptr >= ld->ld_sb.sb_ber.ber_end ) {
- rc = ldap_select1( ld, timeout );
if ( rc == -1 || rc == 0 ) {
ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
LDAP_TIMEOUT);
return( -1 );
}
- return( tag );
+ return( 0 );
}
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+/*
+ * BindRequest ::= SEQUENCE {
+ * version INTEGER,
+ * name DistinguishedName, -- who
+ * authentication CHOICE {
+ * simple [0] OCTET STRING -- passwd
+#ifdef HAVE_KERBEROS
+ * krbv42ldap [1] OCTET STRING
+ * krbv42dsa [2] OCTET STRING
+#endif
+ * sasl [3] SaslCredentials -- LDAPv3
+ * }
+ * }
+ *
+ * BindResponse ::= SEQUENCE {
+ * COMPONENTS OF LDAPResult,
+ * serverSaslCreds OCTET STRING OPTIONAL -- LDAPv3
+ * }
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+
+/*
+ * ldap_sasl_bind - bind to the ldap server (and X.500). The dn, mechanism, and
+ * credentials of the entry to which to bind are supplied. The message id
+ * of the request initiated is provided upon successful (LDAP_SUCCESS) return.
+ *
+ * Example:
+ * ldap_sasl_bind( ld, "cn=manager, o=university of michigan, c=us",
+ * "mechanism", "secret", NULL, NULL, &msgid )
+ */
+
+int
+ldap_sasl_bind(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *mechanism,
+ struct berval *cred,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ int *msgidp )
+{
+ BerElement *ber;
+ int rc;
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_sasl_bind\n", 0, 0, 0 );
+
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( msgidp != NULL );
+
+ if( msgidp == NULL ) {
+ ld->ld_errno = LDAP_PARAM_ERROR;
+ return ld->ld_errno;
+ }
+
+ if( mechanism != LDAP_SASL_SIMPLE
+ && ld->ld_version < LDAP_VERSION3)
+ {
+ ld->ld_errno = LDAP_NOT_SUPPORTED;
+ return ld->ld_errno;
+ }
+
+ if ( dn == NULL )
+ dn = "";
+
+ /* create a message to send */
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return ld->ld_errno;
+ }
+
+ assert( BER_VALID( ber ) );
+
+ if( mechanism == LDAP_SASL_SIMPLE ) {
+ /* simple bind */
+ rc = ber_printf( ber, "{it{istO}" /*}*/,
+ ++ld->ld_msgid, LDAP_REQ_BIND,
+ ld->ld_version, dn, LDAP_AUTH_SIMPLE,
+ cred );
+
+ } else if ( cred == NULL ) {
+ /* SASL bind w/o creditials */
+ rc = ber_printf( ber, "{it{ist{s}}" /*}*/,
+ ++ld->ld_msgid, LDAP_REQ_BIND,
+ ld->ld_version, dn, LDAP_AUTH_SASL,
+ mechanism );
+
+ } else {
+ /* SASL bind w/ creditials */
+ rc = ber_printf( ber, "{it{ist{sO}}" /*}*/,
+ ++ld->ld_msgid, LDAP_REQ_BIND,
+ ld->ld_version, dn, LDAP_AUTH_SASL,
+ mechanism, cred );
+ }
+
+ if( rc == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free( ber, 1 );
+ return( -1 );
+ }
+
+ /* Put Server Controls */
+ if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
+ ber_free( ber, 1 );
+ return ld->ld_errno;
+ }
+
+ if ( ber_printf( ber, /*{*/ "}" ) == -1 ) {
+ ld->ld_errno = LDAP_ENCODING_ERROR;
+ ber_free( ber, 1 );
+ return ld->ld_errno;
+ }
+
+#ifndef LDAP_NOCACHE
+ if ( ld->ld_cache != NULL ) {
+ ldap_flush_cache( ld );
+ }
+#endif /* !LDAP_NOCACHE */
+
+ /* send the message */
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber );
+
+ if(*msgidp < 0)
+ return ld->ld_errno;
+
+ return LDAP_SUCCESS;
+}
+
+/*
+ * ldap_sasl_bind_s - bind to the ldap server (and X.500) 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_sasl_bind_s( ld, "cn=manager, o=university of michigan, c=us",
+ * "mechanism", "secret", NULL, NULL, &servercred )
+ */
+
+int
+ldap_sasl_bind_s(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *mechanism,
+ struct berval *cred,
+ LDAPControl **sctrls,
+ LDAPControl **cctrls,
+ struct berval **servercredp )
+{
+ int rc, msgid;
+ LDAPMessage *result;
+ struct berval *scredp = NULL;
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_sasl_bind_s\n", 0, 0, 0 );
+
+ /* do a quick !LDAPv3 check... ldap_sasl_bind will do the rest. */
+ if( servercredp != NULL ) {
+ if (ld->ld_version < LDAP_VERSION3) {
+ ld->ld_errno = LDAP_NOT_SUPPORTED;
+ return ld->ld_errno;
+ }
+ *servercredp = NULL;
+ }
+
+ rc = ldap_sasl_bind( ld, dn, mechanism, cred, sctrls, cctrls, &msgid );
+
+ if ( rc != LDAP_SUCCESS ) {
+ return( rc );
+ }
+
+ if ( ldap_result( ld, msgid, 1, NULL, &result ) == -1 ) {
+ return( ld->ld_errno ); /* ldap_result sets ld_errno */
+ }
+
+ /* parse the results */
+ scredp = NULL;
+ if( servercredp != NULL ) {
+ rc = ldap_parse_sasl_bind_result( ld, result, &scredp, 0 );
+ }
+
+ if( rc != LDAP_SUCCESS ) {
+ ldap_msgfree( result );
+ return( rc );
+ }
+
+ rc = ldap_result2error( ld, result, 1 );
+
+ if( rc == LDAP_SUCCESS ) {
+ if( servercredp != NULL ) {
+ *servercredp = scredp;
+ }
+
+ } else if (scredp != NULL ) {
+ ber_bvfree(scredp);
+ }
+
+ return rc;
+}
+
+
+/*
+ * Parse BindResponse:
+ *
+ * BindResponse ::= [APPLICATION 1] SEQUENCE {
+ * COMPONENTS OF LDAPResult,
+ * serverSaslCreds [7] OCTET STRING OPTIONAL }
+ *
+ * LDAPResult ::= SEQUENCE {
+ * resultCode ENUMERATED,
+ * matchedDN LDAPDN,
+ * errorMessage LDAPString,
+ * referral [3] Referral OPTIONAL }
+ */
+
+int
+ldap_parse_sasl_bind_result(
+ LDAP *ld,
+ LDAPMessage *res,
+ struct berval **servercredp,
+ int freeit )
+{
+ ber_int_t errcode;
+ struct berval* scred;
+
+ ber_tag_t tag;
+ BerElement *ber;
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_parse_sasl_bind_result\n", 0, 0, 0 );
+
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( res != NULL );
+
+ if ( ld == NULL || res == NULL ) {
+ return LDAP_PARAM_ERROR;
+ }
+
+ if(servercredp != NULL) {
+ if( ld->ld_version < LDAP_VERSION2 ) {
+ return LDAP_NOT_SUPPORTED;
+ }
+ *servercredp = NULL;
+ }
+
+ if( res->lm_msgtype == LDAP_RES_BIND ) {
+ ld->ld_errno = LDAP_PARAM_ERROR;
+ return ld->ld_errno;
+ }
+
+ errcode = LDAP_SUCCESS;
+ scred = NULL;
+
+ if ( ld->ld_error ) {
+ LDAP_FREE( ld->ld_error );
+ ld->ld_error = NULL;
+ }
+ if ( ld->ld_matched ) {
+ LDAP_FREE( ld->ld_matched );
+ ld->ld_matched = NULL;
+ }
+
+ /* parse results */
+
+ ber = ber_dup( res->lm_ber );
+
+ if ( ld->ld_version < LDAP_VERSION2 ) {
+ tag = ber_scanf( ber, "{ia}",
+ &errcode, &ld->ld_error );
+
+ } else {
+ ber_len_t len;
+
+ tag = ber_scanf( ber, "{iaa" /*}*/,
+ &errcode, &ld->ld_matched, &ld->ld_error );
+
+ if( tag != LBER_ERROR ) {
+ tag = ber_peek_tag(ber, &len);
+ }
+
+ if( tag == LDAP_TAG_REFERRAL ) {
+ /* skip 'em */
+ tag = ber_scanf( ber, "x" );
+
+ if( tag != LBER_ERROR ) {
+ tag = ber_peek_tag(ber, &len);
+ }
+ }
+
+ /* need to clean out misc items */
+ if( tag == LDAP_TAG_SASL_RES_CREDS ) {
+ tag = ber_scanf( ber, "O", &scred );
+ }
+ }
+
+ if ( tag == LBER_ERROR ) {
+ errcode = LDAP_DECODING_ERROR;
+ }
+
+ if( ber != NULL ) {
+ ber_free( ber, 0 );
+ }
+
+ /* return */
+ if ( errcode == LDAP_SUCCESS && servercredp != NULL ) {
+ *servercredp = scred;
+
+ } else if ( scred != NULL ) {
+ ber_bvfree( scred );
+ }
+
+ if ( freeit ) {
+ ldap_msgfree( res );
+ }
+
+ ld->ld_errno = errcode;
+ return( ld->ld_errno );
+}
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1993 Regents of the University of Michigan.
* All rights reserved.
*
* sbind.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
+/*
+ * BindRequest ::= SEQUENCE {
+ * version INTEGER,
+ * name DistinguishedName, -- who
+ * authentication CHOICE {
+ * simple [0] OCTET STRING -- passwd
+#ifdef HAVE_KERBEROS
+ * krbv42ldap [1] OCTET STRING
+ * krbv42dsa [2] OCTET STRING
#endif
+ * sasl [3] SaslCredentials -- LDAPv3
+ * }
+ * }
+ *
+ * BindResponse ::= SEQUENCE {
+ * COMPONENTS OF LDAPResult,
+ * serverSaslCreds OCTET STRING OPTIONAL -- LDAPv3
+ * }
+ *
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
-
-#include "lber.h"
-#include "ldap.h"
#include "ldap-int.h"
*/
int
-ldap_simple_bind( LDAP *ld, char *dn, char *passwd )
+ldap_simple_bind(
+ LDAP *ld,
+ LDAP_CONST char *dn,
+ LDAP_CONST char *passwd )
{
- BerElement *ber;
-
- /*
- * 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.
- */
+ int rc;
+ int msgid;
+ struct berval cred;
Debug( LDAP_DEBUG_TRACE, "ldap_simple_bind\n", 0, 0, 0 );
- if ( dn == NULL )
- dn = "";
- if ( passwd == NULL )
- passwd = "";
-
- /* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
- return( -1 );
- }
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
- /* fill it in */
- if ( ber_printf( ber, "{it{ists}}", ++ld->ld_msgid, LDAP_REQ_BIND,
- ld->ld_version, dn, LDAP_AUTH_SIMPLE, passwd ) == -1 ) {
- ld->ld_errno = LDAP_ENCODING_ERROR;
- ber_free( ber, 1 );
- return( -1 );
+ if ( passwd != NULL ) {
+ cred.bv_val = (char *) passwd;
+ cred.bv_len = strlen( passwd );
+ } else {
+ cred.bv_val = "";
+ cred.bv_len = 0;
}
-#ifndef NO_CACHE
- if ( ld->ld_cache != NULL ) {
- ldap_flush_cache( ld );
- }
-#endif /* !NO_CACHE */
+ rc = ldap_sasl_bind( ld, dn, LDAP_SASL_SIMPLE, &cred,
+ NULL, NULL, &msgid );
- /* send the message */
- return( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return rc == LDAP_SUCCESS ? msgid : -1;
}
/*
*/
int
-ldap_simple_bind_s( LDAP *ld, char *dn, char *passwd )
+ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd )
{
- int msgid;
- LDAPMessage *result;
+ struct berval cred;
Debug( LDAP_DEBUG_TRACE, "ldap_simple_bind_s\n", 0, 0, 0 );
- if ( (msgid = ldap_simple_bind( ld, dn, passwd )) == -1 )
- return( ld->ld_errno );
-
- if ( ldap_result( ld, msgid, 1, (struct timeval *) 0, &result ) == -1 )
- return( ld->ld_errno ); /* ldap_result sets ld_errno */
+ if ( passwd != NULL ) {
+ cred.bv_val = (char *) passwd;
+ cred.bv_len = strlen( passwd );
+ } else {
+ cred.bv_val = "";
+ cred.bv_len = 0;
+ }
- return( ldap_result2error( ld, result, 1 ) );
+ return ldap_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, &cred,
+ NULL, NULL, NULL );
}
+/* $OpenLDAP$ */
/*
* Copyright 1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
int seen_substr = 0;
int seen_syntax = 0;
int seen_usage = 0;
- int seen_kind = 0;
- int seen_must = 0;
- int seen_may = 0;
LDAP_ATTRIBUTE_TYPE * at;
char ** ssdummy;
const char * savepos;
}
}
-static char *err2text[] = {
+static char *const err2text[] = {
"",
"Out of memory",
"Unexpected token",
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
static int hex2value LDAP_P((
int c ));
-static ber_slen_t filter_value_unescape LDAP_P((
- char *filter ));
-
static char *find_right_paren LDAP_P((
char *s ));
-static char *find_wildcard LDAP_P((
- char *s ));
-
static char *put_complex_filter LDAP_P((
BerElement *ber,
char *str,
BerElement *
ldap_build_search_req(
LDAP *ld,
- LDAP_CONST char *base_in,
+ LDAP_CONST char *base,
ber_int_t scope,
LDAP_CONST char *filter_in,
char **attrs,
{
BerElement *ber;
int err;
- char *base;
char *filter;
/*
return( NULL );
}
- if ( base_in == NULL ) {
+ if ( base == NULL ) {
/* no base provided, use session default base */
base = ld->ld_options.ldo_defbase;
- } else {
- base = (char *) base_in;
- }
- if ( base == NULL ) {
- /* no session default base, use top */
- base = "";
+ if ( base == NULL ) {
+ /* no session default base, use top */
+ base = "";
+ }
}
#ifdef LDAP_CONNECTIONLESS
return( ber );
}
-static int ldap_is_attr_oid LDAP_P(( const char *attr ))
+static int ldap_is_attr_oid ( const char *attr )
{
int i, c, digit=0;
- for( i=0 ; c = attr[i] ; i++ ) {
+ for( i = 0; (c = attr[i]) != 0; i++ ) {
if( c >= '0' && c <= '9' ) {
digit=1;
}
-static int ldap_is_attr_desc LDAP_P(( const char *attr ))
+static int ldap_is_attr_desc ( const char *attr )
{
/* cheap attribute description check */
int i, c;
- for( i=0; c = attr[i]; i++ ) {
+ for( i = 0; (c = attr[i]) != 0; i++ ) {
if (( c >= '0' && c <= '9' )
|| ( c >= 'A' && c <= 'Z' )
|| ( c >= 'a' && c <= 'z' )
return -1;
}
-static char *
-find_wildcard( char *s )
+char *
+ldap_pvt_find_wildcard( char *s )
{
for( ; *s != '\0' ; s++ ) {
switch( *s ) {
case '\\':
s++; /* skip over escape */
- if( hex2value( s[0] ) >= 0 && hex2value( s[1] ) >= 0 ) {
- /* skip over lead digit of two hex digit code */
- s++;
- }
+ if ( *s == '\0' )
+ return NULL; /* escape at end of string */
}
}
/* unescape filter value */
/* support both LDAP v2 and v3 escapes */
/* output can include nul characters */
-static ber_slen_t
-filter_value_unescape( char *fval )
+ber_slen_t
+ldap_pvt_filter_value_unescape( char *fval )
{
ber_slen_t r, v;
int v1, v2;
/* escape at end of string */
return -1;
- } else if (( v1 = hex2value( fval[v] )) < 0 ) {
+ }
+
+ if (( v1 = hex2value( fval[v] )) >= 0 ) {
/* LDAPv3 escape */
if (( v2 = hex2value( fval[v+1] )) < 0 ) {
}
if( rc != -1 ) {
- ber_slen_t len = filter_value_unescape( value );
+ ber_slen_t len = ldap_pvt_filter_value_unescape( value );
if( len >= 0 ) {
rc = ber_printf( ber, "totb}",
break;
default:
- if ( find_wildcard( value ) == NULL ) {
+ if ( ldap_pvt_find_wildcard( value ) == NULL ) {
ftype = LDAP_FILTER_EQUALITY;
} else if ( strcmp( value, "*" ) == 0 ) {
ftype = LDAP_FILTER_PRESENT;
rc = ber_printf( ber, "ts", ftype, str );
} else {
- ber_slen_t len = filter_value_unescape( value );
+ ber_slen_t len = ldap_pvt_filter_value_unescape( value );
if( len >= 0 ) {
rc = ber_printf( ber, "t{so}",
return( -1 );
for( ; val != NULL; val=nextstar ) {
- if ( (nextstar = find_wildcard( val )) != NULL )
+ if ( (nextstar = ldap_pvt_find_wildcard( val )) != NULL )
*nextstar++ = '\0';
if ( gotstar == 0 ) {
}
if ( *val != '\0' ) {
- ber_slen_t len = filter_value_unescape( val );
+ ber_slen_t len = ldap_pvt_filter_value_unescape( val );
if ( len < 0 ) {
return -1;
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1994 Regents of the University of Michigan.
* All rights reserved.
*
* sort.c: LDAP library entry and value sort routines
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+
+#include "ldap-int.h"
struct entrything {
char **et_vals;
LDAPMessage *et_msg;
+ int (*et_cmp_fn) LDAP_P((const char *a, const char *b));
};
-#ifndef NEEDPROTOS
-static int (*et_cmp_fn)();
-static int et_cmp();
-#else /* !NEEDPROTOS */
-static int (*et_cmp_fn)( char *a, char *b );
-static int et_cmp( void *aa, void *bb);
-#endif /* !NEEDPROTOS */
+static int et_cmp LDAP_P(( const void *aa, const void *bb));
+
int
ldap_sort_strcasecmp(
- char **a,
- char **b
+ const void *a,
+ const void *b
)
{
- return( strcasecmp( *a, *b ) );
+ return( strcasecmp( *(char *const *)a, *(char *const *)b ) );
}
static int
et_cmp(
- void *aa,
- void *bb
+ const void *aa,
+ const void *bb
)
{
int i, rc;
- struct entrything *a = (struct entrything *)aa;
- struct entrything *b = (struct entrything *)bb;
+ const struct entrything *a = (const struct entrything *)aa;
+ const struct entrything *b = (const struct entrything *)bb;
if ( a->et_vals == NULL && b->et_vals == NULL )
return( 0 );
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 ) {
+ if ( (rc = a->et_cmp_fn( a->et_vals[i], b->et_vals[i] )) != 0 ) {
return( rc );
}
}
ldap_sort_entries(
LDAP *ld,
LDAPMessage **chain,
- char *attr, /* NULL => sort by DN */
- int (*cmp)()
+ LDAP_CONST char *attr, /* NULL => sort by DN */
+ int (*cmp) (LDAP_CONST char *, LDAP_CONST char *)
)
{
int i, count;
count = ldap_count_entries( ld, *chain );
- if ( (et = (struct entrything *) malloc( count *
+
+ if ( count < 0 ) {
+ if( ld != NULL ) {
+ ld->ld_errno = LDAP_PARAM_ERROR;
+ }
+ return -1;
+
+ } else if ( count < 2 ) {
+ /* zero or one entries -- already sorted! */
+ return 0;
+ }
+
+ if ( (et = (struct entrything *) LDAP_MALLOC( count *
sizeof(struct entrything) )) == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( -1 );
e = *chain;
for ( i = 0; i < count; i++ ) {
+ et[i].et_cmp_fn = cmp;
et[i].et_msg = e;
if ( attr == NULL ) {
char *dn;
dn = ldap_get_dn( ld, e );
et[i].et_vals = ldap_explode_dn( dn, 1 );
- free( dn );
+ LDAP_FREE( dn );
} else {
et[i].et_vals = ldap_get_values( ld, e, attr );
}
}
last = e;
- et_cmp_fn = cmp;
- qsort( et, count, sizeof(struct entrything), (void *) et_cmp );
+ qsort( et, count, sizeof(struct entrything), et_cmp );
ep = chain;
for ( i = 0; i < count; i++ ) {
ldap_value_free( et[i].et_vals );
}
*ep = last;
- free( (char *) et );
+ LDAP_FREE( (char *) et );
return( 0 );
}
ldap_sort_values(
LDAP *ld,
char **vals,
- int (*cmp)()
+ int (*cmp) (const void *, const void *)
)
{
int nel;
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1993, 1994 Regents of the University of Michigan.
* All rights reserved.
*
* 17 May 1994 by Gordon Good
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
-#ifndef VMS
-#include <unistd.h>
-#endif /* VMS */
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+#endif
+
+#include "ldap-int.h"
#include "srchpref.h"
-#ifndef NEEDPROTOS
-int next_line_tokens();
-void free_strarray();
-static void free_searchobj();
-static int read_next_searchobj();
-#else /* !NEEDPROTOS */
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void 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 );
-#endif /* !NEEDPROTOS */
-
-
-static char *sobjoptions[] = {
+#include "ldap-int.h"
+
+static void free_searchobj LDAP_P(( struct ldap_searchobj *so ));
+static int read_next_searchobj LDAP_P(( char **bufp, ber_len_t *blenp,
+ struct ldap_searchobj **sop, int soversion ));
+
+
+static const char *const sobjoptions[] = {
"internal",
NULL
};
-static unsigned long sobjoptvals[] = {
+static const unsigned long sobjoptvals[] = {
LDAP_SEARCHOBJ_OPT_INTERNAL,
};
return( LDAP_SEARCHPREF_ERR_FILE );
}
- if (( buf = malloc( (size_t)len )) == NULL ) {
+ if (( buf = LDAP_MALLOC( (size_t)len )) == NULL ) {
fclose( fp );
return( LDAP_SEARCHPREF_ERR_MEM );
}
fclose( fp );
if ( rlen != len && !eof ) { /* error: didn't get the whole file */
- free( buf );
+ LDAP_FREE( buf );
return( LDAP_SEARCHPREF_ERR_FILE );
}
rc = ldap_init_searchprefs_buf( buf, rlen, solistp );
- free( buf );
+ LDAP_FREE( buf );
return( rc );
}
int
-ldap_init_searchprefs_buf( char *buf, long buflen,
+ldap_init_searchprefs_buf(
+ char *buf,
+ ber_len_t buflen,
struct ldap_searchobj **solistp )
{
- int rc, version;
+ int rc = -1, version;
char **toks;
struct ldap_searchobj *prevso, *so;
- *solistp = prevso = NULLSEARCHOBJ;
+ *solistp = prevso = NULL;
if ( next_line_tokens( &buf, &buflen, &toks ) != 2 ||
strcasecmp( toks[ 0 ], "version" ) != 0 ) {
}
while ( buflen > 0 && ( rc = read_next_searchobj( &buf, &buflen, &so,
- version )) == 0 && so != NULLSEARCHOBJ ) {
- if ( prevso == NULLSEARCHOBJ ) {
+ version )) == 0 && so != NULL ) {
+ if ( prevso == NULL ) {
*solistp = so;
} else {
prevso->so_next = so;
{
if ( so != NULL ) {
if ( so->so_objtypeprompt != NULL ) {
- free( so->so_objtypeprompt );
+ LDAP_FREE( so->so_objtypeprompt );
}
if ( so->so_prompt != NULL ) {
- free( so->so_prompt );
+ LDAP_FREE( so->so_prompt );
}
if ( so->so_filterprefix != NULL ) {
- free( so->so_filterprefix );
+ LDAP_FREE( so->so_filterprefix );
}
if ( so->so_filtertag != NULL ) {
- free( so->so_filtertag );
+ LDAP_FREE( so->so_filtertag );
}
if ( so->so_defaultselectattr != NULL ) {
- free( so->so_defaultselectattr );
+ LDAP_FREE( so->so_defaultselectattr );
}
if ( so->so_defaultselecttext != NULL ) {
- free( so->so_defaultselecttext );
+ LDAP_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 ) {
- free( sa->sa_attrlabel );
+ LDAP_FREE( sa->sa_attrlabel );
}
if ( sa->sa_attr != NULL ) {
- free( sa->sa_attr );
+ LDAP_FREE( sa->sa_attr );
}
if ( sa->sa_selectattr != NULL ) {
- free( sa->sa_selectattr );
+ LDAP_FREE( sa->sa_selectattr );
}
if ( sa->sa_selecttext != NULL ) {
- free( sa->sa_selecttext );
+ LDAP_FREE( sa->sa_selecttext );
}
- free( sa );
+ LDAP_FREE( sa );
}
}
if ( so->so_smlist != NULL ) {
for ( sm = so->so_smlist; sm != NULL; sm = nextsm ) {
nextsm = sm->sm_next;
if ( sm->sm_matchprompt != NULL ) {
- free( sm->sm_matchprompt );
+ LDAP_FREE( sm->sm_matchprompt );
}
if ( sm->sm_filter != NULL ) {
- free( sm->sm_filter );
+ LDAP_FREE( sm->sm_filter );
}
- free( sm );
+ LDAP_FREE( sm );
}
}
- free( so );
+ LDAP_FREE( so );
}
}
struct ldap_searchobj *
ldap_next_searchobj( struct ldap_searchobj *solist, struct ldap_searchobj *so )
{
- return( so == NULLSEARCHOBJ ? so : so->so_next );
+ return( so == NULL ? so : so->so_next );
}
static int
-read_next_searchobj( char **bufp, long *blenp, struct ldap_searchobj **sop,
+read_next_searchobj(
+ char **bufp,
+ ber_len_t *blenp,
+ struct ldap_searchobj **sop,
int soversion )
{
int i, j, tokcnt;
return( tokcnt == 0 ? 0 : LDAP_SEARCHPREF_ERR_SYNTAX );
}
- if (( so = (struct ldap_searchobj *)calloc( 1,
+ if (( so = (struct ldap_searchobj *)LDAP_CALLOC( 1,
sizeof( struct ldap_searchobj ))) == NULL ) {
free_strarray( toks );
return( LDAP_SEARCHPREF_ERR_MEM );
}
so->so_objtypeprompt = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* if this is post-version zero, options come next
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
so->so_prompt = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* Filter prefix for "More Choices" searching is next
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
so->so_filterprefix = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* "Fewer Choices" filter tag comes next
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
so->so_filtertag = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* Selection (disambiguation) attribute comes next
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
so->so_defaultselectattr = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* Label for selection (disambiguation) attribute
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
so->so_defaultselecttext = toks[ 0 ];
- free( (char *)toks );
+ LDAP_FREE( (char *)toks );
/*
* Search scope is next
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
- if (( *sa = ( struct ldap_searchattr * ) calloc( 1,
+ if (( *sa = ( struct ldap_searchattr * ) LDAP_CALLOC( 1,
sizeof( struct ldap_searchattr ))) == NULL ) {
free_strarray( toks );
ldap_free_searchprefs( so );
( *sa )->sa_matchtypebitmap |= (1 << j);
}
}
- free( toks[ 2 ] );
- free( ( char * ) toks );
+ LDAP_FREE( toks[ 2 ] );
+ LDAP_FREE( ( char * ) toks );
sa = &(( *sa )->sa_next);
}
*sa = NULL;
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
- if (( *sm = ( struct ldap_searchmatch * ) calloc( 1,
+ if (( *sm = ( struct ldap_searchmatch * ) LDAP_CALLOC( 1,
sizeof( struct ldap_searchmatch ))) == NULL ) {
free_strarray( toks );
ldap_free_searchprefs( so );
}
( *sm )->sm_matchprompt = toks[ 0 ];
( *sm )->sm_filter = toks[ 1 ];
- free( ( char * ) toks );
+ LDAP_FREE( ( char * ) toks );
sm = &(( *sm )->sm_next );
}
*sm = NULL;
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <ac/stdlib.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/ctype.h>
+
+#include "ldap-int.h"
+
+
+#if defined ( HAVE_STRSPN )
+#define int_strspn strspn
+#else
+static int int_strspn( const char *str, const char *delim )
+{
+ int pos;
+ const char *p=delim;
+
+ for( pos=0; (*str) ; pos++,str++) {
+ if (*str!=*p) {
+ for( p=delim; (*p) ; p++ ) {
+ if (*str==*p) {
+ break;
+ }
+ }
+ }
+
+ if (*p=='\0') {
+ return pos;
+ }
+ }
+ return pos;
+}
+#endif
+
+#if defined( HAVE_STRPBRK )
+#define int_strpbrk strpbrk
+#else
+static char *(int_strpbrk)( const char *str, const char *accept )
+{
+ const char *p;
+
+ for( ; (*str) ; str++ ) {
+ for( p=accept; (*p) ; p++) {
+ if (*str==*p) {
+ return str;
+ }
+ }
+ }
+
+ return NULL;
+}
+#endif
+
+char *(ldap_pvt_strtok)( char *str, const char *delim, char **pos )
+{
+ char *p;
+
+ if (pos==NULL) {
+ return NULL;
+ }
+
+ if (str==NULL) {
+ if (*pos==NULL) {
+ return NULL;
+ }
+
+ str=*pos;
+ }
+
+ /* skip any initial delimiters */
+ str += int_strspn( str, delim );
+ if (*str == '\0') {
+ return NULL;
+ }
+
+ p = int_strpbrk( str, delim );
+ if (p==NULL) {
+ *pos = NULL;
+
+ } else {
+ *p ='\0';
+ *pos = p+1;
+ }
+
+ return str;
+}
+
+char *
+(ldap_pvt_strdup)( const char *s )
+{
+ char *p;
+ size_t len = strlen( s ) + 1;
+
+ if ( (p = (char *) malloc( len )) == NULL ) {
+ return( NULL );
+ }
+
+ memcpy( p, s, len );
+ return( p );
+}
+
+char *
+ldap_pvt_str2upper( char *str )
+{
+ char *s;
+
+ /* to upper */
+ for ( s = str; *s; s++ ) {
+ *s = TOUPPER( (unsigned char) *s );
+ }
+
+ return( str );
+}
+
+char *
+ldap_pvt_str2lower( char *str )
+{
+ char *s;
+
+ /* to lower */
+ for ( s = str; *s; s++ ) {
+ *s = TOLOWER( (unsigned char) *s );
+ }
+
+ return( str );
+}
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
break;
case LDAP_OPT_X_TLS_CACERTFILE:
*(char **)arg = tls_opt_cacertfile ?
- strdup( tls_opt_cacertfile ) : NULL;
+ LDAP_STRDUP( tls_opt_cacertfile ) : NULL;
break;
case LDAP_OPT_X_TLS_CACERTDIR:
*(char **)arg = tls_opt_cacertdir ?
- strdup( tls_opt_cacertdir ) : NULL;
+ LDAP_STRDUP( tls_opt_cacertdir ) : NULL;
break;
case LDAP_OPT_X_TLS_CERTFILE:
*(char **)arg = tls_opt_certfile ?
- strdup( tls_opt_certfile ) : NULL;
+ LDAP_STRDUP( tls_opt_certfile ) : NULL;
break;
case LDAP_OPT_X_TLS_KEYFILE:
*(char **)arg = tls_opt_keyfile ?
- strdup( tls_opt_keyfile ) : NULL;
+ LDAP_STRDUP( tls_opt_keyfile ) : NULL;
break;
case LDAP_OPT_X_TLS_REQUIRE_CERT:
*(int *)arg = tls_opt_require_cert;
switch( option ) {
case LDAP_OPT_X_TLS_CACERTFILE:
if ( tls_opt_cacertfile ) free( tls_opt_cacertfile );
- tls_opt_cacertfile = arg ? strdup( (char *) arg ) : NULL;
+ tls_opt_cacertfile = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
break;
case LDAP_OPT_X_TLS_CACERTDIR:
if ( tls_opt_cacertdir ) free( tls_opt_cacertdir );
- tls_opt_cacertdir = arg ? strdup( (char *) arg ) : NULL;
+ tls_opt_cacertdir = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
break;
case LDAP_OPT_X_TLS_CERTFILE:
if ( tls_opt_certfile ) free( tls_opt_certfile );
- tls_opt_certfile = arg ? strdup( (char *) arg ) : NULL;
+ tls_opt_certfile = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
break;
case LDAP_OPT_X_TLS_KEYFILE:
if ( tls_opt_keyfile ) free( tls_opt_keyfile );
- tls_opt_keyfile = arg ? strdup( (char *) arg ) : NULL;
+ tls_opt_keyfile = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
break;
case LDAP_OPT_X_TLS_REQUIRE_CERT:
tls_opt_require_cert = * (int *) arg;
break;
case LDAP_OPT_X_TLS_CIPHER_SUITE:
if ( tls_opt_ciphersuite ) free( tls_opt_ciphersuite );
- tls_opt_ciphersuite = arg ? strdup( (char *) arg ) : NULL;
+ tls_opt_ciphersuite = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
break;
default:
return -1;
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* Portions
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* ufn.c
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
-
-#ifdef NEEDPROTOS
-typedef int (*cancelptype)( void *cancelparm );
-#else /* NEEDPROTOS */
-typedef int (*cancelptype)();
-#endif /* NEEDPROTOS */
-
-#ifdef NEEDPROTOS
-static int ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp,
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+#include "ldap_defaults.h"
+
+typedef int (*cancelptype) LDAP_P(( void *cancelparm ));
+
+/* local functions */
+static int ldap_ufn_search_ctx LDAP_P(( LDAP *ld, char **ufncomp, int ncomp,
char *prefix, char **attrs, int attrsonly, LDAPMessage **res,
cancelptype 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, cancelptype cancelproc,
+ char *tag3 ));
+static LDAPMessage *ldap_msg_merge LDAP_P(( LDAP *ld, LDAPMessage *a, LDAPMessage *b ));
+static LDAPMessage *ldap_ufn_expand LDAP_P(( LDAP *ld, cancelptype cancelproc,
void *cancelparm, char **dns, char *filter, int scope,
- char **attrs, int aonly, int *err );
-LDAPFiltDesc *ldap_ufn_setfilter( LDAP *ld, char *fname );
-#else /* NEEDPROTOS */
-static LDAPMessage *ldap_msg_merge();
-static LDAPMessage *ldap_ufn_expand();
-LDAPFiltDesc *ldap_ufn_setfilter();
-#endif /* NEEDPROTOS */
+ char **attrs, int aonly, int *err ));
/*
* ldap_ufn_search_ctx - do user friendly searching; provide cancel feature;
* 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.
+ * cancelled. This can be a null function pointer. If
+ * it is not 0, 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
char **attrs, int attrsonly, LDAPMessage **res, cancelptype cancelproc,
void *cancelparm, char *tag1, char *tag2, char *tag3 )
{
- char *dn, *ftag;
- char **dns;
- int max, i, err, scope, phase, tries;
+ char *dn, *ftag = NULL;
+ char **dns = NULL;
+ int max, i, err, scope = 0, phase, tries;
LDAPFiltInfo *fi;
LDAPMessage *tmpcand;
LDAPMessage *candidates;
- LDAPMessage *ldap_msg_merge(), *ldap_ufn_expand();
static char *objattrs[] = { "objectClass", NULL };
/*
if ( (quote = strrchr( ufncomp[ncomp], '"' )) != NULL )
*quote = '\0';
- strcpy( ufncomp[ncomp], ufncomp[ncomp] + 1 );
+ SAFEMEMCPY( ufncomp[ncomp], ufncomp[ncomp] + 1,
+ strlen( ufncomp[ncomp] + 1 ) + 1 );
}
if ( ncomp == 0 )
phase = 3;
if ( candidates == NULL ) {
if ( prefix != NULL ) {
- if ( (dns = (char **) malloc( sizeof(char *)
+ if ( (dns = (char **) LDAP_MALLOC( sizeof(char *)
* 2 )) == NULL ) {
return( ld->ld_errno = LDAP_NO_MEMORY );
}
- dns[0] = strdup( prefix );
+ dns[0] = LDAP_STRDUP( prefix );
dns[1] = NULL;
} else {
dns = NULL;
continue;
if ( dns == NULL ) {
- if ( (dns = (char **) malloc(
+ if ( (dns = (char **) LDAP_MALLOC(
sizeof(char *) * 8 )) == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( LDAP_NO_MEMORY );
}
max = 8;
} else if ( i >= max ) {
- if ( (dns = (char **) realloc( dns,
+ if ( (dns = (char **) LDAP_REALLOC( dns,
sizeof(char *) * 2 * max ))
== NULL )
{
}
int
-ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, int attrsonly,
+ldap_ufn_search_ct(
+ LDAP *ld, LDAP_CONST char *ufn, char **attrs, int attrsonly,
LDAPMessage **res, cancelptype cancelproc, void *cancelparm,
char *tag1, char *tag2, char *tag3 )
{
char **ufncomp, **prefixcomp;
char *pbuf;
- int ncomp, pcomp, i, err;
+ int ncomp, pcomp, i, err = 0;
/* initialize the getfilter stuff if it's not already */
if ( ld->ld_filtd == NULL && ldap_ufn_setfilter( ld, FILTERFILE )
}
for ( pcomp = 0; prefixcomp[pcomp] != NULL; pcomp++ )
; /* NULL */
- if ( (pbuf = (char *) malloc( strlen( ld->ld_ufnprefix ) + 1 ))
+ if ( (pbuf = (char *) LDAP_MALLOC( strlen( ld->ld_ufnprefix ) + 1 ))
== NULL ) {
ldap_value_free( ufncomp );
ldap_value_free( prefixcomp );
ldap_value_free( ufncomp );
ldap_value_free( prefixcomp );
- free( pbuf );
+ LDAP_FREE( pbuf );
return( err );
}
* ldapfilter.conf tags.
*/
int
-ldap_ufn_search_c( LDAP *ld, char *ufn, char **attrs, int attrsonly,
+ldap_ufn_search_c(
+ LDAP *ld, LDAP_CONST char *ufn, char **attrs, int attrsonly,
LDAPMessage **res, cancelptype cancelproc, void *cancelparm )
{
return( ldap_ufn_search_ct( ld, ufn, attrs, attrsonly, res, cancelproc,
* same as ldap_ufn_search_c without the cancel function
*/
int
-ldap_ufn_search_s( LDAP *ld, char *ufn, char **attrs, int attrsonly,
+ldap_ufn_search_s(
+ LDAP *ld, LDAP_CONST char *ufn, char **attrs, int attrsonly,
LDAPMessage **res )
{
struct timeval tv;
do {
*err = ldap_result( ld, msgid, 1, &tv, &tmpres );
- if ( *err == 0 && cancelproc != NULL &&
+ if ( *err == 0 && cancelproc != 0 &&
(*cancelproc)( cancelparm ) != 0 ) {
ldap_abandon( ld, msgid );
*err = LDAP_USER_CANCELLED;
*/
LDAPFiltDesc *
-ldap_ufn_setfilter( LDAP *ld, char *fname )
+ldap_ufn_setfilter( LDAP *ld, LDAP_CONST char *fname )
{
if ( ld->ld_filtd != NULL )
ldap_getfilter_free( ld->ld_filtd );
}
void
-ldap_ufn_setprefix( LDAP *ld, char *prefix )
+ldap_ufn_setprefix( LDAP *ld, LDAP_CONST char *prefix )
{
if ( ld->ld_ufnprefix != NULL )
- free( ld->ld_ufnprefix );
+ LDAP_FREE( ld->ld_ufnprefix );
- ld->ld_ufnprefix = strdup( prefix );
+ ld->ld_ufnprefix = LDAP_STRDUP( prefix );
}
int
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * util-int.c Various functions to replace missing threadsafe ones.
+ * Without the real *_r funcs, things will
+ * work, but might not be threadsafe.
+ *
+ * Written by Bart Hartgers.
+ *
+ * Copyright 1998, A. Hartgers, All rights reserved.
+ * This software is not subject to any license of Eindhoven University of
+ * Technology, since it was written in my spare time.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+
+#include "portable.h"
+
+#include <ac/stdlib.h>
+
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+#if defined( LDAP_R_COMPILE )
+# include <ldap_pvt_thread.h>
+#else
+# undef HAVE_REENTRANT_FUNCTIONS
+#endif
+
+#if (defined( HAVE_CTIME_R ) || defined( HAVE_REENTRANT_FUNCTIONS)) \
+ && defined( CTIME_R_NARGS )
+# define USE_CTIME_R
+#endif
+
+#if defined(HAVE_GETHOSTBYNAME_R) && \
+ (GETHOSTBYNAME_R_NARGS > 6 || GETHOSTBYNAME_R_NARGS < 5)
+ /* Don't know how to handle this version, pretend it's not there */
+# undef HAVE_GETHOSTBYNAME_R
+#endif
+#if defined(HAVE_GETHOSTBYADDR_R) && \
+ (GETHOSTBYADDR_R_NARGS > 8 || GETHOSTBYADDR_R_NARGS < 7)
+ /* Don't know how to handle this version, pretend it's not there */
+# undef HAVE_GETHOSTBYADDR_R
+#endif
+
+#ifdef LDAP_R_COMPILE
+# ifndef USE_CTIME_R
+ static ldap_pvt_thread_mutex_t ldap_int_ctime_mutex;
+# endif
+# ifndef HAVE_GETHOSTBYNAME_R
+ static ldap_pvt_thread_mutex_t ldap_int_gethostbyname_mutex;
+# endif
+# ifndef HAVE_GETHOSTBYADDR_R
+ static ldap_pvt_thread_mutex_t ldap_int_gethostbyaddr_mutex;
+# endif
+#endif /* LDAP_R_COMPILE */
+
+char *ldap_pvt_ctime( const time_t *tp, char *buf )
+{
+#ifdef USE_CTIME_R
+# if (CTIME_R_NARGS > 3) || (CTIME_R_NARGS < 2)
+# error "CTIME_R_NARGS should be 2 or 3"
+# elif CTIME_R_NARGS > 2 && defined(CTIME_R_RETURNS_INT)
+ return( ctime_r(tp,buf,26) < 0 ? 0 : buf );
+# elif CTIME_R_NARGS > 2
+ return ctime_r(tp,buf,26);
+# else
+ return ctime_r(tp,buf);
+# endif
+
+#else
+# ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ldap_int_ctime_mutex );
+# endif
+ memcpy( buf, ctime(tp), 26 );
+# ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ldap_int_ctime_mutex );
+# endif
+ return buf;
+#endif
+}
+
+#define BUFSTART 1024
+#define BUFMAX (32*1024)
+
+static char *safe_realloc( char **buf, int len );
+static int copy_hostent( struct hostent *res, char **buf, struct hostent * src );
+
+int ldap_pvt_gethostbyname_a(
+ const char *name,
+ struct hostent *resbuf,
+ char **buf,
+ struct hostent **result,
+ int *herrno_ptr )
+{
+#if defined( HAVE_GETHOSTBYNAME_R )
+
+# define NEED_SAFE_REALLOC 1
+ int r=-1;
+ int buflen=BUFSTART;
+ *buf = NULL;
+ for(;buflen<BUFMAX;) {
+ if (safe_realloc( buf, buflen )==NULL)
+ return r;
+
+#if (GETHOSTBYNAME_R_NARGS < 6)
+ r = ((*result=gethostbyname_r( name, resbuf, *buf,
+ buflen, herrno_ptr ))== NULL) ?
+ -1 : 0;
+#else
+ r = gethostbyname_r( name, resbuf, *buf,
+ buflen, result, herrno_ptr );
+#endif
+
+ Debug( LDAP_DEBUG_TRACE, "ldap_pvt_gethostbyname_a: host=%s, r=%d\n",
+ name, r, 0 );
+
+#ifdef NETDB_INTERNAL
+ if ((r<0) &&
+ (*herrno_ptr==NETDB_INTERNAL) &&
+ (errno==ERANGE))
+ {
+ buflen*=2;
+ continue;
+ }
+#endif
+ return r;
+ }
+ return -1;
+#elif defined( LDAP_R_COMPILE )
+# define NEED_COPY_HOSTENT
+ struct hostent *he;
+ int retval;
+
+ ldap_pvt_thread_mutex_lock( &ldap_int_gethostbyname_mutex );
+
+ he = gethostbyname( name );
+
+ if (he==NULL) {
+ *herrno_ptr = h_errno;
+ retval = -1;
+ } else if (copy_hostent( resbuf, buf, he )<0) {
+ *herrno_ptr = -1;
+ retval = -1;
+ } else {
+ *result = resbuf;
+ retval = 0;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &ldap_int_gethostbyname_mutex );
+
+ return retval;
+#else
+ *result = gethostbyname( name );
+
+ if (*result!=NULL) {
+ return 0;
+ }
+
+ *herrno_ptr = h_errno;
+
+ return -1;
+#endif
+}
+
+int ldap_pvt_gethostbyaddr_a(
+ const char *addr,
+ int len,
+ int type,
+ struct hostent *resbuf,
+ char **buf,
+ struct hostent **result,
+ int *herrno_ptr )
+{
+#if defined( HAVE_GETHOSTBYADDR_R )
+
+# undef NEED_SAFE_REALLOC
+# define NEED_SAFE_REALLOC
+ int r=-1;
+ int buflen=BUFSTART;
+ *buf = NULL;
+ for(;buflen<BUFMAX;) {
+ if (safe_realloc( buf, buflen )==NULL)
+ return r;
+#if (GETHOSTBYADDR_R_NARGS < 8)
+ r = ((*result=gethostbyaddr_r( addr, len, type,
+ resbuf, *buf, buflen,
+ herrno_ptr )) == NULL) ?
+ -1 : 0;
+#else
+ r = gethostbyaddr_r( addr, len, type,
+ resbuf, *buf, buflen,
+ result, herrno_ptr );
+#endif
+
+#ifdef NETDB_INTERNAL
+ if ((r<0) &&
+ (*herrno_ptr==NETDB_INTERNAL) &&
+ (errno==ERANGE))
+ {
+ buflen*=2;
+ continue;
+ }
+#endif
+ return r;
+ }
+ return -1;
+#elif defined( LDAP_R_COMPILE )
+# undef NEED_COPY_HOSTENT
+# define NEED_COPY_HOSTENT
+ struct hostent *he;
+ int retval;
+
+ ldap_pvt_thread_mutex_lock( &ldap_int_gethostbyaddr_mutex );
+
+ he = gethostbyaddr( addr, len, type );
+
+ if (he==NULL) {
+ *herrno_ptr = h_errno;
+ retval = -1;
+ } else if (copy_hostent( resbuf, buf, he )<0) {
+ *herrno_ptr = -1;
+ retval = -1;
+ } else {
+ *result = resbuf;
+ retval = 0;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &ldap_int_gethostbyaddr_mutex );
+
+ return retval;
+#else /* gethostbyaddr() */
+ *result = gethostbyaddr( addr, len, type );
+
+ if (*result!=NULL) {
+ return 0;
+ }
+ return -1;
+#endif
+}
+/*
+ * ldap_int_utils_init() should be called before any other function.
+ */
+
+void ldap_int_utils_init( void )
+{
+ static int done=0;
+ if (done)
+ return;
+ done=1;
+
+#ifdef LDAP_R_COMPILE
+
+#if !defined( USE_CTIME_R ) && !defined( HAVE_REENTRANT_FUNCTIONS )
+ ldap_pvt_thread_mutex_init( &ldap_int_ctime_mutex );
+#endif
+
+#if !defined( HAVE_GETHOSTBYNAME_R )
+ ldap_pvt_thread_mutex_init( &ldap_int_gethostbyname_mutex );
+#endif
+
+#if !defined( HAVE_GETHOSTBYADDR_R )
+ ldap_pvt_thread_mutex_init( &ldap_int_gethostbyaddr_mutex );
+#endif
+
+ /* call other module init functions here... */
+#endif
+}
+
+#if defined( NEED_COPY_HOSTENT )
+# undef NEED_SAFE_REALLOC
+#define NEED_SAFE_REALLOC
+
+static char *cpy_aliases( char ***tgtio, char *buf, char **src )
+{
+ int len;
+ char **tgt=*tgtio;
+ for( ; (*src) ; src++ ) {
+ len = strlen( *src ) + 1;
+ memcpy( buf, *src, len );
+ *tgt++=buf;
+ buf+=len;
+ }
+ *tgtio=tgt;
+ return buf;
+}
+
+static char *cpy_addresses( char ***tgtio, char *buf, char **src, int len )
+{
+ char **tgt=*tgtio;
+ for( ; (*src) ; src++ ) {
+ memcpy( buf, *src, len );
+ *tgt++=buf;
+ buf+=len;
+ }
+ *tgtio=tgt;
+ return buf;
+}
+
+static int copy_hostent( struct hostent *res, char **buf, struct hostent * src )
+{
+ char **p;
+ char **tp;
+ char *tbuf;
+ int name_len;
+ int n_alias;
+ int total_alias_len;
+ int n_addr;
+ int total_addr_len;
+ int total_len;
+
+ /* calculate the size needed for the buffer */
+ name_len = strlen( src->h_name ) + 1;
+
+ for( n_alias=total_alias_len=0, p=src->h_aliases; (*p) ; p++ ) {
+ total_alias_len += strlen( *p ) + 1;
+ n_alias++;
+ }
+
+ for( n_addr=0, p=src->h_addr_list; (*p) ; p++ ) {
+ n_addr++;
+ }
+ total_addr_len = n_addr * src->h_length;
+
+ total_len = (n_alias + n_addr + 2) * sizeof( char * ) +
+ total_addr_len + total_alias_len + name_len;
+
+ if (safe_realloc( buf, total_len )) {
+ tp = (char **) *buf;
+ tbuf = *buf + (n_alias + n_addr + 2) * sizeof( char * );
+ memcpy( res, src, sizeof( struct hostent ) );
+ /* first the name... */
+ memcpy( tbuf, src->h_name, name_len );
+ res->h_name = tbuf; tbuf+=name_len;
+ /* now the aliases */
+ res->h_aliases = tp;
+ tbuf = cpy_aliases( &tp, tbuf, src->h_aliases );
+ *tp++=NULL;
+ /* finally the addresses */
+ res->h_addr_list = tp;
+ tbuf = cpy_addresses( &tp, tbuf, src->h_addr_list, src->h_length );
+ *tp++=NULL;
+ return 0;
+ }
+ return -1;
+}
+#endif
+
+#if defined( NEED_SAFE_REALLOC )
+static char *safe_realloc( char **buf, int len )
+{
+ char *tmpbuf;
+ tmpbuf = LDAP_REALLOC( *buf, len );
+ if (tmpbuf) {
+ *buf=tmpbuf;
+ }
+ return tmpbuf;
+}
+#endif
+
+
+# $OpenLDAP$
##
## Makefile.in for LDAP -lldap
##
getdn.c getentry.c getattr.c getvalues.c addentry.c \
request.c getdxbyname.c os-ip.c url.c charset.c \
init.c options.c print.c string.c util-int.c schema.c \
- charray.c digest.c tls.c
+ charray.c digest.c tls.c dn.c
SRCS = thr_posix.c thr_cthreads.c thr_thr.c thr_lwp.c thr_nt.c \
- thr_sleep.c thr_stub.c rdwr.c
+ thr_pth.c thr_sleep.c thr_stub.c rdwr.c
OBJS = extended.lo \
bind.lo controls.lo open.lo result.lo error.lo compare.lo search.lo \
modify.lo add.lo modrdn.lo delete.lo abandon.lo ufn.lo cache.lo \
request.lo getdxbyname.lo os-ip.lo url.lo charset.lo \
init.lo options.lo print.lo string.lo util-int.lo schema.lo \
thr_posix.lo thr_cthreads.lo thr_thr.lo thr_lwp.lo thr_nt.lo \
- thr_sleep.lo thr_stub.lo rdwr.lo \
- charray.lo digest.lo tls.lo
+ thr_pth.lo thr_sleep.lo thr_stub.lo rdwr.lo \
+ charray.lo digest.lo tls.lo dn.lo
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
--- /dev/null
+/* $OpenLDAP$ */
+/*
+** This is an improved implementation of Reader/Writer locks does
+** not protect writers from starvation. That is, if a writer is
+** currently waiting on a reader, any new reader will get
+** the lock before the writer.
+**
+** Does not support cancellation nor does any status checking.
+*/
+
+/********************************************************
+ * Adapted from:
+ * "Programming with Posix Threads"
+ * by David R Butenhof
+ * Addison-Wesley
+ ********************************************************
+ */
+
+#include "portable.h"
+
+#include <ac/stdlib.h>
+
+#include <ac/errno.h>
+#include <ac/string.h>
+
+#include "ldap_pvt_thread.h"
+
+int
+ldap_pvt_thread_rdwr_init( ldap_pvt_thread_rdwr_t *rw )
+{
+ assert( rw != NULL );
+
+ memset( rw, 0, sizeof(ldap_pvt_thread_rdwr_t) );
+
+ /* we should check return results */
+ ldap_pvt_thread_mutex_init( &rw->ltrw_mutex );
+ ldap_pvt_thread_cond_init( &rw->ltrw_read );
+ ldap_pvt_thread_cond_init( &rw->ltrw_write );
+
+ rw->ltrw_valid = LDAP_PVT_THREAD_RDWR_VALID;
+ return 0;
+}
+
+int
+ldap_pvt_thread_rdwr_destroy( ldap_pvt_thread_rdwr_t *rw )
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
+ return LDAP_PVT_THREAD_EINVAL;
+
+ ldap_pvt_thread_mutex_lock( &rw->ltrw_mutex );
+
+ /* active threads? */
+ if( rw->ltrw_r_active > 0 || rw->ltrw_w_active > 1) {
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+ return LDAP_PVT_THREAD_EBUSY;
+ }
+
+ /* waiting threads? */
+ if( rw->ltrw_r_wait > 0 || rw->ltrw_w_wait > 0) {
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+ return LDAP_PVT_THREAD_EBUSY;
+ }
+
+ rw->ltrw_valid = 0;
+
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+
+ ldap_pvt_thread_mutex_destroy( &rw->ltrw_mutex );
+ ldap_pvt_thread_cond_destroy( &rw->ltrw_read );
+ ldap_pvt_thread_cond_destroy( &rw->ltrw_write );
+
+ return 0;
+}
+
+int ldap_pvt_thread_rdwr_rlock( ldap_pvt_thread_rdwr_t *rw )
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
+ return LDAP_PVT_THREAD_EINVAL;
+
+ ldap_pvt_thread_mutex_lock( &rw->ltrw_mutex );
+
+ if( rw->ltrw_w_active > 1 ) {
+ /* writer is active */
+
+ rw->ltrw_r_wait++;
+
+ do {
+ ldap_pvt_thread_cond_wait(
+ &rw->ltrw_read, &rw->ltrw_mutex );
+ } while( rw->ltrw_w_active > 1 );
+
+ rw->ltrw_r_wait--;
+ }
+
+ rw->ltrw_r_active++;
+
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+
+ return 0;
+}
+
+int ldap_pvt_thread_rdwr_rtrylock( ldap_pvt_thread_rdwr_t *rw )
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
+ return LDAP_PVT_THREAD_EINVAL;
+
+ ldap_pvt_thread_mutex_lock( &rw->ltrw_mutex );
+
+ if( rw->ltrw_w_active > 1) {
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+ return LDAP_PVT_THREAD_EBUSY;
+ }
+
+ rw->ltrw_r_active++;
+
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+
+ return 0;
+}
+
+int ldap_pvt_thread_rdwr_runlock( ldap_pvt_thread_rdwr_t *rw )
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
+ return LDAP_PVT_THREAD_EINVAL;
+
+ ldap_pvt_thread_mutex_lock( &rw->ltrw_mutex );
+
+ rw->ltrw_r_active--;
+
+ if (rw->ltrw_r_active == 0 && rw->ltrw_w_wait > 0 ) {
+ ldap_pvt_thread_cond_signal( &rw->ltrw_write );
+ }
+
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+
+ return 0;
+}
+
+int ldap_pvt_thread_rdwr_wlock( ldap_pvt_thread_rdwr_t *rw )
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
+ return LDAP_PVT_THREAD_EINVAL;
+
+ ldap_pvt_thread_mutex_lock( &rw->ltrw_mutex );
+
+ if ( rw->ltrw_w_active > 0 || rw->ltrw_r_active > 0 ) {
+ rw->ltrw_w_wait++;
+
+ do {
+ ldap_pvt_thread_cond_wait(
+ &rw->ltrw_write, &rw->ltrw_mutex );
+ } while ( rw->ltrw_w_active > 0 || rw->ltrw_r_active > 0 );
+
+ rw->ltrw_w_wait--;
+ }
+
+ rw->ltrw_w_active++;
+
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+
+ return 0;
+}
+
+int ldap_pvt_thread_rdwr_wtrylock( ldap_pvt_thread_rdwr_t *rw )
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
+ return LDAP_PVT_THREAD_EINVAL;
+
+ ldap_pvt_thread_mutex_lock( &rw->ltrw_mutex );
+
+ if ( rw->ltrw_w_active > 0 || rw->ltrw_r_active > 0 ) {
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+ return LDAP_PVT_THREAD_EBUSY;
+ }
+
+ rw->ltrw_w_active++;
+
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+
+ return 0;
+}
+
+int ldap_pvt_thread_rdwr_wunlock( ldap_pvt_thread_rdwr_t *rw )
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
+ return LDAP_PVT_THREAD_EINVAL;
+
+ ldap_pvt_thread_mutex_lock( &rw->ltrw_mutex );
+
+ rw->ltrw_w_active--;
+
+ if (rw->ltrw_r_wait > 0) {
+ ldap_pvt_thread_cond_broadcast( &rw->ltrw_read );
+
+ } else if (rw->ltrw_w_wait > 0) {
+ ldap_pvt_thread_cond_signal( &rw->ltrw_write );
+ }
+
+ ldap_pvt_thread_mutex_unlock( &rw->ltrw_mutex );
+
+ return 0;
+}
+
+#ifdef LDAP_DEBUG
+
+/* just for testing,
+ * return 0 if false, suitable for assert(ldap_pvt_thread_rdwr_Xchk(rdwr))
+ *
+ * Currently they don't check if the calling thread is the one
+ * that has the lock, just that there is a reader or writer.
+ *
+ * Basically sufficent for testing that places that should have
+ * a lock are caught.
+ */
+
+int ldap_pvt_thread_rdwr_readers(ldap_pvt_thread_rdwr_t *rw)
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ return( rw->ltrw_r_active );
+}
+
+int ldap_pvt_thread_rdwr_writers(ldap_pvt_thread_rdwr_t *rw)
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ return( rw->ltrw_w_active );
+}
+
+int ldap_pvt_thread_rdwr_active(ldap_pvt_thread_rdwr_t *rw)
+{
+ assert( rw != NULL );
+ assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
+
+ return(ldap_pvt_thread_rdwr_readers(rw) +
+ ldap_pvt_thread_rdwr_writers(rw));
+}
+
+#endif /* LDAP_DEBUG */
+/* $OpenLDAP$ */
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/* thr_lwp.c - wrappers around SunOS LWP threads */
+
+/* BUGS:
+ * - slurpd calls the get_stack/free_stack functions. Should be fixed, so
+ * they can become static.
+ */
+
+#include "portable.h"
+
+#if defined( HAVE_LWP )
+
+/*************
+ * *
+ * SunOS LWP *
+ * *
+ *************/
+
+/* This implementation NEEDS WORK. It currently does not compile */
+
+#include <stdio.h>
+
+#include <ac/time.h>
+#include <ac/socket.h>
+
+#include "ldap-int.h"
+
+#include "ldap_pvt_thread.h"
+
+#include <lwp/lwp.h>
+#include <lwp/stackdep.h>
+
+#define MAX_STACK 51200
+#define MAX_THREADS 20
+
+/*
+ * Initialize LWP by spinning of a schedular
+ */
+int
+ldap_pvt_thread_initialize( void )
+{
+ thread_t tid;
+ stkalign_t *stack;
+ int stackno;
+
+ if (( stack = get_stack( &stackno )) == NULL ) {
+ return -1;
+ }
+
+ lwp_create( &tid, lwp_scheduler, MINPRIO, 0, stack, 1, stackno );
+ return 0;
+}
+
+int
+ldap_pvt_thread_destroy( void )
+{
+ /* need to destory lwp_scheduler thread and clean up private
+ variables */
+ return 0;
+}
+
+struct stackinfo {
+ int stk_inuse;
+ stkalign_t *stk_stack;
+};
+
+static struct stackinfo *stacks;
+
+static stkalign_t * ldap_pvt_thread_get_stack( int *stacknop )
+{
+ int i;
+
+ if ( stacks == NULL ) {
+ stacks = (struct stackinfo *) LDAP_CALLOC( 1, MAX_THREADS *
+ sizeof(struct stackinfo) );
+
+ if( stacks == NULL ) {
+ Debug( LDAP_DEBUG_ANY, "stacks allocation failed",
+ 0, 0, 0 );
+ return NULL;
+ }
+ }
+
+ for ( i = 0; i < MAX_THREADS; i++ ) {
+ if ( stacks[i].stk_inuse == 0 ) {
+ break;
+ }
+ }
+
+ if ( i == MAX_THREADS ) {
+ Debug( LDAP_DEBUG_ANY,
+ "no more stacks (max %d) - increase MAX_THREADS for more",
+ MAX_THREADS, 0, 0 );
+ return( NULL );
+ }
+
+ if ( stacks[i].stk_stack == NULL ) {
+ stacks[i].stk_stack = (stkalign_t *) LDAP_MALLOC(
+ (MAX_STACK / sizeof(stkalign_t) + 1 )
+ * sizeof(stkalign_t) );
+
+ if( stacks[i].stk_stack == NULL ) {
+ Debug( LDAP_DEBUG_ANY, "stack allocation failed",
+ 0, 0, 0 );
+ return( NULL );
+ }
+ }
+
+ *stacknop = i;
+ stacks[i].stk_inuse = 1;
+ return( stacks[i].stk_stack + MAX_STACK / sizeof(stkalign_t) );
+}
+
+static void
+ldap_pvt_thread_free_stack( int stackno )
+{
+ if ( stackno < 0 || stackno > MAX_THREADS ) {
+ Debug( LDAP_DEBUG_ANY, "free_stack of bogus stack %d\n",
+ stackno, 0, 0 );
+ }
+
+ stacks[stackno].stk_inuse = 0;
+}
+
+static void
+lwp_create_stack( void *(*func)(), void *arg, int stackno )
+{
+ (*func)( arg );
+
+ ldap_pvt_thread_free_stack( stackno );
+}
+
+int
+ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
+ int detach,
+ void *(*start_routine)( void *),
+ void *arg)
+{
+ stkalign_t *stack;
+ int stackno;
+
+ if ( (stack = ldap_pvt_thread_get_stack( &stackno )) == NULL ) {
+ return( -1 );
+ }
+ return( lwp_create( thread, lwp_create_stack, MINPRIO, 0,
+ stack, 3, start_routine, arg, stackno ) );
+}
+
+void
+ldap_pvt_thread_exit( void *retval )
+{
+ lwp_destroy( SELF );
+}
+
+unsigned int
+ldap_pvt_thread_sleep(
+ unsigned int interval
+)
+{
+ thread_t mylwp;
+ tl_t *t, *nt;
+ time_t now;
+
+
+ if ( lwp_self( &mylwp ) < 0 ) {
+ return -1;
+ }
+
+ time( &now );
+
+ mon_enter( &sglob->tsl_mon );
+
+ if ( sglob->tsl_list != NULL ) {
+ for ( t = sglob->tsl_list; t != NULL; t = t->tl_next ) {
+ if ( SAMETHREAD( t->tl_tid, mylwp )) {
+ /* We're already sleeping? */
+ t->tl_wake = now + interval;
+ mon_exit( &sglob->tsl_mon );
+ lwp_suspend( mylwp );
+ return 0;
+ }
+ }
+ }
+
+ nt = (tl_t *) LDAP_MALLOC( sizeof( tl_t ));
+
+ if( nt == NULL ) return -1;
+
+ nt->tl_next = sglob->tsl_list;
+ nt->tl_wake = now + interval;
+ nt->tl_tid = mylwp;
+ sglob->tsl_list = nt;
+
+ mon_exit( &sglob->tsl_mon );
+
+ lwp_suspend( mylwp );
+ return 0;
+}
+
+/*
+ * The lwp_scheduler thread periodically checks to see if any threads
+ * are due to be resumed. If there are, it resumes them. Otherwise,
+ * it computes the lesser of ( 1 second ) or ( the minimum time until
+ * a thread need to be resumed ) and puts itself to sleep for that amount
+ * of time.
+ */
+static void
+lwp_scheduler(
+ int stackno
+)
+{
+ time_t now, min;
+ struct timeval interval;
+ tl_t *t;
+
+ while ( !sglob->slurpd_shutdown ) {
+ mon_enter( &sglob->tsl_mon );
+
+ time( &now );
+ min = 0L;
+ if ( sglob->tsl_list != NULL ) {
+ for ( t = sglob->tsl_list; t != NULL; t = t->tl_next ) {
+ if (( t->tl_wake > 0L ) && ( t->tl_wake < now )) {
+ lwp_resume( t->tl_tid );
+ t->tl_wake = 0L;
+ }
+
+ if (( t->tl_wake > now ) && ( t->tl_wake < min )) {
+ min = t->tl_wake;
+ }
+ }
+ }
+
+ mon_exit( &sglob->tsl_mon );
+
+ interval.tv_usec = 0L;
+ if ( min == 0L ) {
+ interval.tv_sec = 1L;
+ } else {
+ interval.tv_sec = min;
+ }
+
+ lwp_sleep( &interval );
+ }
+
+ mon_enter( &sglob->tsl_mon );
+
+ for ( t = sglob->tsl_list; t != NULL; t = t->tl_next ) {
+ lwp_resume( t->tl_tid );
+ }
+
+ mon_exit( &sglob->tsl_mon );
+
+ free_stack( stackno );
+}
+
+int
+ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
+{
+ lwp_join( thread );
+ return 0;
+}
+
+int
+ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_yield( void )
+{
+ lwp_yield( SELF );
+ return 0;
+}
+
+int
+ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
+{
+ /*
+ * lwp cv_create requires the monitor id be passed in
+ * when the cv is created, pthreads passes it when the
+ * condition is waited for. so, we fake the creation
+ * here and actually do it when the cv is waited for
+ * later.
+ */
+
+ cond->lcv_created = 0;
+
+ return( 0 );
+}
+
+int
+ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
+{
+ return( cond->lcv_created ? cv_notify( cv->lcv_cv ) : 0 );
+}
+
+int
+ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
+ ldap_pvt_thread_mutex_t *mutex )
+{
+ if ( ! cond->lcv_created ) {
+ cv_create( &cond->lcv_cv, *mutex );
+ cond->lcv_created = 1;
+ }
+
+ return( cv_wait( cond->lcv_cv ) );
+}
+
+int
+ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( mon_create( mutex ) );
+}
+
+int
+ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( mon_destroy( *mutex ) );
+}
+
+int
+ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( mon_enter( *mutex ) );
+}
+
+int
+ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( mon_exit( *mutex ) );
+}
+
+int
+ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp )
+{
+ return( mon_cond_enter( *mp ) );
+}
+
+int
+ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cv )
+{
+ return( cv->lcv_created ? cv_destroy( cv->lcv_cv ) : 0 );
+}
+
+int
+ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cv )
+{
+ return( cv->lcv_created ? cv_broadcast( cv->lcv_cv ) : 0 );
+}
+
+#endif /* HAVE_LWP */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/* thr_nt.c - wrapper around NT threads */
+
+#include "portable.h"
+
+#if defined( HAVE_NT_THREADS )
+
+#include "ldap_pvt_thread.h"
+
+int
+ldap_pvt_thread_initialize( void )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_destroy( void )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
+ int detach,
+ void *(*start_routine)( void *),
+ void *arg)
+{
+ *thread = (ldap_pvt_thread_t)_beginthread( (void *) start_routine,
+ 0, arg );
+ return ( (unsigned long)*thread == -1 ? -1 : 0 );
+}
+
+void
+ldap_pvt_thread_exit( void *retval )
+{
+ _endthread( );
+}
+
+int
+ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
+{
+ DWORD status;
+ status = WaitForSingleObject( (HANDLE) thread, INFINITE );
+ if (status == WAIT_FAILED) {
+ return -1;
+ }
+ return 0;
+}
+
+int
+ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_yield( void )
+{
+ Sleep( 0 );
+ return 0;
+}
+
+int
+ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
+{
+ *cond = CreateEvent( NULL, FALSE, FALSE, NULL );
+ return( 0 );
+}
+
+int
+ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cv )
+{
+ CloseHandle( *cv );
+ return( 0 );
+}
+
+int
+ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
+{
+ SetEvent( *cond );
+ return( 0 );
+}
+
+int
+ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
+ ldap_pvt_thread_mutex_t *mutex )
+{
+ ReleaseMutex( *mutex );
+ WaitForSingleObject( *cond, INFINITE );
+ WaitForSingleObject( *mutex, INFINITE );
+ return( 0 );
+}
+
+int
+ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cv )
+{
+ SetEvent( *cv );
+ return( 0 );
+}
+
+int
+ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
+{
+ *mutex = CreateMutex( NULL, 0, NULL );
+ return ( 0 );
+}
+
+int
+ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
+{
+ CloseHandle( *mutex );
+ return ( 0 );
+}
+
+int
+ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
+{
+ WaitForSingleObject( *mutex, INFINITE );
+ return ( 0 );
+}
+
+int
+ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
+{
+ ReleaseMutex( *mutex );
+ return ( 0 );
+}
+
+int
+ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp )
+{
+ DWORD status;
+
+ status = WaitForSingleObject( *mp, 0 );
+ if ( (status == WAIT_FAILED) || (status == WAIT_TIMEOUT) )
+ return 0;
+ else
+ return 1;
+}
+
+#endif
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/* thr_posix.c - wrapper around posix and posixish thread implementations.
+ */
+
+#include "portable.h"
+
+#if defined( HAVE_PTHREADS )
+
+#include <ac/errno.h>
+
+#include "ldap_pvt_thread.h"
+
+
+#if HAVE_PTHREADS_D4
+# define LDAP_PVT_THREAD_ATTR_DEFAULT pthread_attr_default
+# define LDAP_PVT_THREAD_CONDATTR_DEFAULT pthread_condattr_default
+# define LDAP_PVT_THREAD_MUTEXATTR_DEFAULT pthread_mutexattr_default
+#else
+# define LDAP_PVT_THREAD_ATTR_DEFAULT NULL
+# define LDAP_PVT_THREAD_CONDATTR_DEFAULT NULL
+# define LDAP_PVT_THREAD_MUTEXATTR_DEFAULT NULL
+#endif
+
+
+int
+ldap_pvt_thread_initialize( void )
+{
+#if defined( LDAP_THREAD_CONCURRENCY ) && HAVE_PTHREAD_SETCONCURRENCY
+ ldap_pvt_thread_set_concurrency( LDAP_THREAD_CONCURRENCY );
+#endif
+ return 0;
+}
+
+int
+ldap_pvt_thread_destroy( void )
+{
+ return 0;
+}
+
+#ifdef HAVE_PTHREAD_SETCONCURRENCY
+int
+ldap_pvt_thread_set_concurrency(int n)
+{
+#ifdef HAVE_PTHREAD_SETCONCURRENCY
+ return pthread_setconcurrency( n );
+#elif HAVE_THR_SETCONCURRENCY
+ return pthread_setconcurrency( n );
+#else
+ return 0;
+#endif
+}
+#endif
+
+#ifdef HAVE_PTHREAD_GETCONCURRENCY
+int
+ldap_pvt_thread_get_concurrency(void)
+{
+#ifdef HAVE_PTHREAD_GETCONCURRENCY
+ return pthread_getconcurrency();
+#elif HAVE_THR_GETCONCURRENCY
+ return pthread_getconcurrency();
+#else
+ return 0;
+#endif
+}
+#endif
+
+int
+ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
+ int detach,
+ void *(*start_routine)( void * ),
+ void *arg)
+{
+ int rtn = pthread_create( thread, LDAP_PVT_THREAD_ATTR_DEFAULT,
+ start_routine, arg );
+
+ if( detach ) {
+#ifdef HAVE_PTHREADS_FINAL
+ pthread_detach( *thread );
+#else
+ pthread_detach( thread );
+#endif
+ }
+ return rtn;
+}
+
+void
+ldap_pvt_thread_exit( void *retval )
+{
+ pthread_exit( retval );
+}
+
+int
+ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
+{
+#if !defined( HAVE_PTHREADS_FINAL )
+ void *dummy;
+ if (thread_return==NULL)
+ thread_return=&dummy;
+#endif
+ return pthread_join( thread, thread_return );
+}
+
+int
+ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
+{
+#ifdef HAVE_PTHREAD_KILL
+ return pthread_kill( thread, signo );
+#else
+ /* pthread package with DCE */
+ if (kill( getpid(), signo )<0)
+ return errno;
+ return 0;
+#endif
+}
+
+int
+ldap_pvt_thread_yield( void )
+{
+#ifdef _POSIX_THREAD_IS_GNU_PTH
+ sched_yield();
+ return 0;
+
+#elif HAVE_SCHED_YIELD
+ return sched_yield();
+
+#elif HAVE_PTHREAD_YIELD
+ pthread_yield();
+ return 0;
+
+#elif HAVE_THR_YIELD
+ return thr_yield();
+
+#else
+ return 0;
+#endif
+}
+
+int
+ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
+{
+ return pthread_cond_init( cond, LDAP_PVT_THREAD_CONDATTR_DEFAULT );
+}
+
+int
+ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cond )
+{
+ return pthread_cond_destroy( cond );
+}
+
+int
+ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
+{
+ return pthread_cond_signal( cond );
+}
+
+int
+ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cond )
+{
+ return pthread_cond_broadcast( cond );
+}
+
+int
+ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
+ ldap_pvt_thread_mutex_t *mutex )
+{
+ return pthread_cond_wait( cond, mutex );
+}
+
+int
+ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
+{
+ return pthread_mutex_init( mutex, LDAP_PVT_THREAD_MUTEXATTR_DEFAULT );
+}
+
+int
+ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
+{
+ return pthread_mutex_destroy( mutex );
+}
+
+int
+ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return pthread_mutex_lock( mutex );
+}
+
+int
+ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return pthread_mutex_unlock( mutex );
+}
+
+#endif /* HAVE_PTHREADS */
+
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/* thr_thr.c - wrappers around solaris threads */
+
+#include "portable.h"
+
+#if defined( HAVE_GNU_PTH )
+
+#include "ldap_pvt_thread.h"
+
+/*******************
+ * *
+ * GNU Pth Threads *
+ * *
+ *******************/
+
+static pth_attr_t detach_attr;
+
+int
+ldap_pvt_thread_initialize( void )
+{
+ detach_attr = pth_attr_new();
+ pth_attr_set( detach_attr, PTH_ATTR_JOINABLE, FALSE );
+ return pth_init();
+}
+
+int
+ldap_pvt_thread_destroy( void )
+{
+ pth_attr_destroy(detach_attr);
+ pth_kill();
+ return 0;
+}
+
+int
+ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
+ int detach,
+ void *(*start_routine)( void *),
+ void *arg)
+{
+ *thread = pth_spawn( detach ? detach_attr : PTH_ATTR_DEFAULT,
+ start_routine, arg );
+
+ return *thread == NULL;
+}
+
+void
+ldap_pvt_thread_exit( void *retval )
+{
+ pth_exit( retval );
+}
+
+int ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
+{
+ pth_join( thread, thread_return );
+ return 0;
+}
+
+int
+ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
+{
+ pth_raise( thread, signo );
+ return 0;
+}
+
+int
+ldap_pvt_thread_yield( void )
+{
+ pth_yield(NULL);
+ return 0;
+}
+
+int
+ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
+{
+ return( pth_cond_init( cond ) );
+}
+
+int
+ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
+{
+ return( pth_cond_notify( cond, 0 ) );
+}
+
+int
+ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cond )
+{
+ return( pth_cond_notify( cond, 1 ) );
+}
+
+int
+ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
+ ldap_pvt_thread_mutex_t *mutex )
+{
+ return( pth_cond_await( cond, mutex, NULL ) );
+}
+
+int
+ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cv )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( pth_mutex_init( mutex ) );
+}
+
+int
+ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( pth_mutex_acquire( mutex, 0, NULL ) );
+}
+
+int
+ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( pth_mutex_release( mutex ) );
+}
+
+int
+ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( pth_mutex_acquire( mutex, 1, NULL ) );
+}
+
+#endif /* HAVE_GNU_PTH */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * 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.
+ */
+
+/*
+ * ldap_pvt_thread_sleep.c - allow a thread to sleep without putting
+ * the whole process (e.g. pod under lwp) to sleep.
+ *
+ * Contains platform-specific code to allow this:
+ *
+ * Under non-preemptive threads packages like SunOS lwp, tsleep() adds
+ * the thread to a list of sleepers. The lwp_scheduler process takes
+ * care of resuming suspended threads.
+ *
+ * Under a fully-preemptive threads package, like Solaris threads,
+ * tsleep just calls sleep(), and there is no scheduler thread. Life
+ * is so much simpler...
+ */
+
+#include "portable.h"
+
+#if !defined( HAVE_LWP )
+
+#include <stdio.h>
+#include <ac/stdlib.h>
+#include <ac/unistd.h> /* get sleep() */
+
+#include "ldap_pvt_thread.h"
+
+
+/*
+ * Here we assume we have fully preemptive threads and that sleep()
+ * does the right thing.
+ */
+unsigned int
+ldap_pvt_thread_sleep(
+ unsigned int interval
+)
+{
+ sleep( interval );
+ return 0;
+}
+
+#else
+
+/* LWP implementation of sleep can be found in thr_lwp.c */
+
+#endif /* HAVE_LWP */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/* thr_stub.c - stubs for the threads */
+
+#include "portable.h"
+
+#if defined( NO_THREADS )
+
+#include "ldap_pvt_thread.h"
+
+/***********************************************************************
+ * *
+ * no threads package defined for this system - fake ok returns from *
+ * all threads routines (making it single-threaded). *
+ * *
+ ***********************************************************************/
+
+int
+ldap_pvt_thread_initialize( void )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_destroy( void )
+{
+ return 0;
+}
+
+static void* ldap_int_status = NULL;
+
+int
+ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
+ int detach,
+ void *(*start_routine)(void *),
+ void *arg)
+{
+ if( ! detach ) ldap_int_status = NULL;
+ start_routine( arg );
+ return 0;
+}
+
+void
+ldap_pvt_thread_exit( void *retval )
+{
+ if( retval != NULL ) {
+ ldap_int_status = retval;
+ }
+ return;
+}
+
+int
+ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **status )
+{
+ if(status != NULL) *status = ldap_int_status;
+ return 0;
+}
+
+int
+ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_yield( void )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cond )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cond )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
+ ldap_pvt_thread_mutex_t *mutex )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return 0;
+}
+
+#endif /* NO_THREADS */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/* thr_thr.c - wrappers around solaris threads */
+
+#include "portable.h"
+
+#if defined( HAVE_THR )
+
+#include "ldap_pvt_thread.h"
+
+/*******************
+ * *
+ * Solaris Threads *
+ * *
+ *******************/
+
+int
+ldap_pvt_thread_initialize( void )
+{
+#ifdef LDAP_THREAD_CONCURRENCY
+ thr_setconcurrency( LDAP_THREAD_CONCURRENCY );
+#endif
+ return 0;
+}
+
+int
+ldap_pvt_thread_destroy( void )
+{
+ return 0;
+}
+
+int
+ldap_pvt_thread_set_concurrency(int n)
+{
+ return thr_setconcurrency( n );
+}
+
+int
+ldap_pvt_thread_get_concurrency(void)
+{
+ return thr_getconcurrency();
+}
+
+int
+ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
+ int detach,
+ void *(*start_routine)( void *),
+ void *arg)
+{
+ return( thr_create( NULL, 0, start_routine, arg,
+ detach ? THR_DETACHED : 0,
+ thread ) );
+}
+
+void
+ldap_pvt_thread_exit( void *retval )
+{
+ thr_exit( NULL );
+}
+
+int ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
+{
+ thr_join( thread, NULL, thread_return );
+ return 0;
+}
+
+int
+ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
+{
+ thr_kill( thread, signo );
+ return 0;
+}
+
+int
+ldap_pvt_thread_yield( void )
+{
+ thr_yield();
+ return 0;
+}
+
+int
+ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
+{
+ return( cond_init( cond, USYNC_THREAD, NULL ) );
+}
+
+int
+ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
+{
+ return( cond_signal( cond ) );
+}
+
+int
+ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cv )
+{
+ return( cond_broadcast( cv ) );
+}
+
+int
+ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
+ ldap_pvt_thread_mutex_t *mutex )
+{
+ return( cond_wait( cond, mutex ) );
+}
+
+int
+ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cv )
+{
+ return( cond_destroy( cv ) );
+}
+
+int
+ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( mutex_init( mutex, USYNC_THREAD, NULL ) );
+}
+
+int
+ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( mutex_destroy( mutex ) );
+}
+
+int
+ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( mutex_lock( mutex ) );
+}
+
+int
+ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
+{
+ return( mutex_unlock( mutex ) );
+}
+
+int
+ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp )
+{
+ return( mutex_trylock( mp ) );
+}
+
+#endif /* HAVE_THR */
--- /dev/null
+# $OpenLDAP$
+##
+## Makefile for -lldbm
+##
+
+LIBRARY = libldbm.a
+XPROGRAMS = testldbm
+SRCS = ldbm.c
+OBJS = ldbm.o
+
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+XLIBS = -lldbm -lavl
+XXLIBS = $(LDBM_LIBS)
+
+testldbm: libldbm.a testldbm.o
+ $(CC) $(LDFLAGS) -o $@ testldbm.o $(LIBS)
/* ldbm.c - ldap dbm compatibility routines */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
int ldbm_initialize( void )
{
int err;
- int envFlags;
+ u_int32_t envFlags;
if(ldbm_initialized++) return 1;
#ifdef HAVE_ST_BLKSIZE
if ( dbcachesize > 0 && stat( name, &st ) == 0 ) {
- dbcachesize = (dbcachesize / st.st_blksize);
+ dbcachesize /= st.st_blksize;
+ if( dbcachesize == 0 ) dbcachesize = 1;
gdbm_setopt( db, GDBM_CACHESIZE, &dbcachesize, sizeof(int) );
}
#else
- dbcachesize = (dbcachesize / 4096);
- gdbm_setopt( db, GDBM_CACHESIZE, &dbcachesize, sizeof(int) );
+ if ( dbcachesize > 0 ) {
+ dbcachesize /= 4096;
+ if( dbcachesize == 0 ) dbcachesize = 1;
+ gdbm_setopt( db, GDBM_CACHESIZE, &dbcachesize, sizeof(int) );
+ }
#endif
LDBM_UNLOCK;
+# $OpenLDAP$
##
## Makefile for -lldif
##
/* line64.c - routines for dealing with the slapd line format */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
total = 0;
- while( bytes = fread( buffer, 1, sizeof(buffer), url ) ) {
+ while( (bytes = fread( buffer, 1, sizeof(buffer), url )) != 0 ) {
char *newp = ber_memrealloc( p, total + bytes );
if( newp == NULL ) {
ber_memfree( p );
return 0;
}
-
/* line64.c - routines for dealing with the slapd line format */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
}
*s++ = '\0';
+ url = 0;
+ b64 = 0;
+
if ( *s == '\0' ) {
/* no value */
value = NULL;
goto done;
}
- url = 0;
- b64 = 0;
-
if ( *s == '<' ) {
s++;
url = 1;
len++;
}
+ }
#ifdef LDAP_DEBUG
- } else {
+ else {
assert( type == LDIF_PUT_COMMENT );
-#endif
}
+#endif
switch( type ) {
case LDIF_PUT_NOVALUE:
char **bufp, /* ptr to malloced output buffer */
int *buflenp ) /* ptr to length of *bufp */
{
- char linebuf[BUFSIZ], *line;
+ char linebuf[BUFSIZ], *line, *nbufp;
ber_len_t lcur = 0, len, linesize;
int last_ch = '\n', found_entry = 0, stop;
}
if ( *buflenp - lcur <= len ) {
- char *nbufp = ber_memrealloc( *bufp, *buflenp += len + BUFSIZ );
+ *buflenp += len + BUFSIZ;
+ nbufp = ber_memrealloc( *bufp, *buflenp );
if( nbufp == NULL ) {
return 0;
}
+# $OpenLDAP$
##
## Makefile for -lutil
##
LIBRARY = liblutil.a
SRCS = base64.c debug.c detach.c \
- md5.c passwd.c sha1.c getpass.c lockf.c utils.c
+ md5.c passwd.c sha1.c getpass.c lockf.c utils.c sockpair.c
OBJS = base64.o debug.o detach.o \
- md5.o passwd.o sha1.o getpass.o lockf.o utils.o \
+ md5.o passwd.o sha1.o getpass.o lockf.o utils.o sockpair.o \
@LIBOBJS@
LDAP_INCDIR= ../../include
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
int lutil_debug_file( FILE *file )
{
- log_file = log_file;
+ log_file = file;
return 0;
}
+/* $OpenLDAP$ */
/*
* Copyright (c) 1990, 1994 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
# End Source File
# Begin Source File
+SOURCE=.\sockpair.c
+# End Source File
+# Begin Source File
+
SOURCE=.\utils.c
# End Source File
# End Target
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/*
+ * File Locking Routines
+ *
+ * Implementations (in order of preference)
+ * - lockf
+ * - fcntl
+ * - flock
+ *
+ * Other implementations will be added as needed.
+ *
+ * NOTE: lutil_lockf() MUST block until an exclusive lock is acquired.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+#include <ac/unistd.h>
+
+#undef LOCK_API
+
+#if HAVE_LOCKF && defined(F_LOCK)
+# define USE_LOCKF 1
+# define LOCK_API "lockf"
+#endif
+
+#if !defined(LOCK_API) && HAVE_FCNTL
+# ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+# endif
+# ifdef F_WRLCK
+# define USE_FCNTL 1
+# define LOCK_API "fcntl"
+# endif
+#endif
+
+#if !defined(LOCK_API) && HAVE_FLOCK
+# if HAVE_SYS_FILE_H
+# include <sys/file.h>
+# endif
+# define USE_FLOCK 1
+# define LOCK_API "flock"
+#endif
+
+#if !defined(USE_LOCKF) && !defined(USE_FCNTL) && !defined(USE_FLOCK)
+int lutil_lockf ( int fd ) {
+ fd = fd;
+ return 0;
+}
+
+int lutil_unlockf ( int fd ) {
+ fd = fd;
+ return 0;
+}
+#endif
+
+#ifdef USE_LOCKF
+int lutil_lockf ( int fd ) {
+ /* use F_LOCK instead of F_TLOCK, ie: block */
+ return lockf( fd, F_LOCK, 0 );
+}
+
+int lutil_unlockf ( int fd ) {
+ return lockf( fd, F_ULOCK, 0 );
+}
+#endif
+
+#ifdef USE_FCNTL
+int lutil_lockf ( int fd ) {
+ struct flock file_lock;
+
+ memset( &file_lock, 0, sizeof( file_lock ) );
+ file_lock.l_type = F_WRLCK;
+ file_lock.l_whence = SEEK_SET;
+ file_lock.l_start = 0;
+ file_lock.l_len = 0;
+
+ /* use F_SETLKW instead of F_SETLK, ie: block */
+ return( fcntl( fd, F_SETLKW, &file_lock ) );
+}
+
+int lutil_unlockf ( int fd ) {
+ struct flock file_lock;
+
+ memset( &file_lock, 0, sizeof( file_lock ) );
+ file_lock.l_type = F_UNLCK;
+ file_lock.l_whence = SEEK_SET;
+ file_lock.l_start = 0;
+ file_lock.l_len = 0;
+
+ return( fcntl ( fd, F_SETLKW, &file_lock ) );
+}
+#endif
+
+#ifdef USE_FLOCK
+int lutil_lockf ( int fd ) {
+ /* use LOCK_EX instead of LOCK_EX|LOCK_NB, ie: block */
+ return flock( fd, LOCK_EX );
+}
+
+int lutil_unlockf ( int fd ) {
+ return flock( fd, LOCK_UN );
+}
+#endif
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
--- /dev/null
+/* $OpenLDAP$ */
+#include "portable.h"
+
+#include <ac/string.h>
+
+/*
+ * Memory Compare
+ */
+int
+(memcmp)(const void *v1, const void *v2, int n)
+{
+ if (n != 0) {
+ const unsigned char *s1=v1, *s2=v2;
+ do {
+ if (*s1++ != *s2++)
+ return (*--s1 - *--s2);
+ } while (--n != 0);
+ }
+ return (0);
+}
--- /dev/null
+/* $OpenLDAP$ */
+#include "portable.h"
+
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+
+#define __RETSTR( x ) case x: return #x;
+
+char *WSAGetErrorString( int err )
+{
+ switch( err )
+ {
+ __RETSTR( WSAEINTR )
+ __RETSTR( WSAEBADF )
+ __RETSTR( WSAEACCES )
+ __RETSTR( WSAEFAULT )
+ __RETSTR( WSAEINVAL )
+ __RETSTR( WSAEMFILE )
+ __RETSTR( WSAEWOULDBLOCK )
+ __RETSTR( WSAEINPROGRESS )
+ __RETSTR( WSAEALREADY )
+ __RETSTR( WSAENOTSOCK )
+ __RETSTR( WSAEDESTADDRREQ )
+ __RETSTR( WSAEMSGSIZE )
+ __RETSTR( WSAEPROTOTYPE )
+ __RETSTR( WSAENOPROTOOPT )
+ __RETSTR( WSAEPROTONOSUPPORT )
+ __RETSTR( WSAESOCKTNOSUPPORT )
+ __RETSTR( WSAEOPNOTSUPP )
+ __RETSTR( WSAEPFNOSUPPORT )
+ __RETSTR( WSAEAFNOSUPPORT )
+ __RETSTR( WSAEADDRINUSE )
+ __RETSTR( WSAEADDRNOTAVAIL )
+ __RETSTR( WSAENETDOWN )
+ __RETSTR( WSAENETUNREACH )
+ __RETSTR( WSAENETRESET )
+ __RETSTR( WSAECONNABORTED )
+ __RETSTR( WSAECONNRESET )
+ __RETSTR( WSAENOBUFS )
+ __RETSTR( WSAEISCONN )
+ __RETSTR( WSAENOTCONN )
+ __RETSTR( WSAESHUTDOWN )
+ __RETSTR( WSAETOOMANYREFS )
+ __RETSTR( WSAETIMEDOUT )
+ __RETSTR( WSAECONNREFUSED )
+ __RETSTR( WSAELOOP )
+ __RETSTR( WSAENAMETOOLONG )
+ __RETSTR( WSAEHOSTDOWN )
+ __RETSTR( WSAEHOSTUNREACH )
+ __RETSTR( WSAENOTEMPTY )
+ __RETSTR( WSAEPROCLIM )
+ __RETSTR( WSAEUSERS )
+ __RETSTR( WSAEDQUOT )
+ __RETSTR( WSAESTALE )
+ __RETSTR( WSAEREMOTE )
+ __RETSTR( WSASYSNOTREADY )
+ __RETSTR( WSAVERNOTSUPPORTED )
+ __RETSTR( WSANOTINITIALISED )
+ __RETSTR( WSAEDISCON )
+ __RETSTR( WSAENOMORE )
+ __RETSTR( WSAECANCELLED )
+ __RETSTR( WSAEINVALIDPROCTABLE )
+ __RETSTR( WSAEINVALIDPROVIDER )
+ __RETSTR( WSASYSCALLFAILURE )
+ __RETSTR( WSASERVICE_NOT_FOUND )
+ __RETSTR( WSATYPE_NOT_FOUND )
+ __RETSTR( WSA_E_NO_MORE )
+ __RETSTR( WSA_E_CANCELLED )
+ __RETSTR( WSAEREFUSED )
+
+ __RETSTR( WSAHOST_NOT_FOUND )
+ __RETSTR( WSATRY_AGAIN )
+ __RETSTR( WSANO_RECOVERY )
+ __RETSTR( WSANO_DATA )
+ }
+ return "unknown";
+}
+
+char *WSAGetLastErrorString( void )
+{
+ return WSAGetErrorString( WSAGetLastError() );
+}
+
+#undef __RETSTR
+
+#endif /* HAVE_WINSOCK2 */
+
+
+char *GetErrorString( int err )
+{
+ static char msgBuf[1024];
+
+ FormatMessage(
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ msgBuf, 1024, NULL );
+
+ return msgBuf;
+}
+
+char *GetLastErrorString( void )
+{
+ return GetErrorString( GetLastError() );
+}
+
+
+
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
--- /dev/null
+/* $OpenLDAP$ */
+#include "portable.h"
+
+#ifndef HAVE_SETPROCTITLE
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/setproctitle.h>
+#include <ac/string.h>
+#include <ac/stdarg.h>
+
+/*
+ * Copyright (c) 1990,1991 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.
+ */
+
+char **Argv; /* pointer to original (main's) argv */
+int Argc; /* original argc */
+
+/*
+ * takes a printf-style format string (fmt) and up to three parameters (a,b,c)
+ * this clobbers the original argv...
+ */
+
+/* VARARGS */
+void setproctitle( const char *fmt, ... )
+{
+ static char *endargv = (char *)0;
+ char *s;
+ int i;
+ char buf[ 1024 ];
+ va_list ap;
+
+ va_start(ap, fmt);
+
+#ifdef HAVE_VSNPRINTF
+ buf[sizeof(buf) - 1] = '\0';
+ vsnprintf( buf, sizeof(buf)-1, fmt, ap );
+#elif HAVE_VPRINTF
+ vsprintf( buf, fmt, ap ); /* hope it's not too long */
+#else
+ /* use doprnt() */
+ chokeme = "choke me! I don't have a doprnt() manual handy";
+#endif
+
+ va_end(ap);
+
+ if ( endargv == (char *)0 ) {
+ /* set pointer to end of original argv */
+ endargv = Argv[ Argc-1 ] + strlen( Argv[ Argc-1 ] );
+ }
+ /* make ps print "([prog name])" */
+ s = Argv[0];
+ *s++ = '-';
+ i = strlen( buf );
+ if ( i > endargv - s - 2 ) {
+ i = endargv - s - 2;
+ buf[ i ] = '\0';
+ }
+ strcpy( s, buf );
+ s += i;
+ while ( s < endargv ) *s++ = ' ';
+}
+#endif /* NOSETPROCTITLE */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+#include <ac/socket.h>
+#include <ac/unistd.h>
+
+#include <lutil.h>
+
+/* Return a pair of socket descriptors that are connected to each other.
+ * The returned descriptors are suitable for use with select(). The two
+ * descriptors may or may not be identical; the function may return
+ * the same descriptor number in both slots. It is guaranteed that
+ * data written on sds[1] will be readable on sds[0]. The returned
+ * descriptors may be datagram oriented, so data should be written
+ * in reasonably small pieces and read all at once. On Unix systems
+ * this function is best implemented using a single pipe() call.
+ */
+
+int lutil_pair( LBER_SOCKET_T sds[2] )
+{
+#ifdef USE_PIPE
+ return pipe( sds );
+#else
+ struct sockaddr_in si;
+ int rc, len = sizeof(si);
+ LBER_SOCKET_T sd;
+
+ sd = socket( AF_INET, SOCK_DGRAM, 0 );
+ if ( sd == AC_SOCKET_INVALID )
+ return sd;
+
+ (void) memset( (void*) &si, 0, len );
+ si.sin_family = AF_INET;
+ si.sin_port = 0;
+ si.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
+
+ rc = bind( sd, (struct sockaddr *)&si, len );
+ if ( rc == AC_SOCKET_ERROR ) {
+ tcp_close(sd);
+ return rc;
+ }
+
+ rc = getsockname( sd, (struct sockaddr *)&si, &len );
+ if ( rc == AC_SOCKET_ERROR ) {
+ tcp_close(sd);
+ return rc;
+ }
+
+ rc = connect( sd, (struct sockaddr *)&si, len );
+ if ( rc == AC_SOCKET_ERROR ) {
+ tcp_close(sd);
+ return rc;
+ }
+
+ sds[0] = sds[1] = sd;
+ return 0;
+#endif
+}
--- /dev/null
+/* $OpenLDAP$ */
+#include "portable.h"
+
+#ifndef HAVE_TEMPNAM
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
+
+#include "lutil.h"
+
+char *
+(tempnam)( const char *dir, const char *pfx )
+{
+ char *s;
+
+ if ( dir == NULL ) {
+ dir = "/tmp";
+ }
+
+/*
+ * allocate space for dir + '/' + pfx (up to 5 chars) + 6 trailing 'X's + 0 byte
+ */
+ if (( s = (char *)malloc( strlen( dir ) + 14 )) == NULL ) {
+ return( NULL );
+ }
+
+ strcpy( s, dir );
+ strcat( s, "/" );
+ if ( pfx != NULL ) {
+ strcat( s, pfx );
+ }
+ strcat( s, "XXXXXX" );
+ mktemp( s );
+
+ if ( *s == '\0' ) {
+ free( s );
+ s = NULL;
+ }
+
+ return( s );
+}
+
+#endif /* TEMPNAM */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+# $OpenLDAP$
## Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
##
+# $OpenLDAP$
##
## Makefile.in for slapd
##
/* abandon.c - decode and handle an ldap abandon operation */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
Debug( LDAP_DEBUG_TRACE, "do_abandon: op=%ld %sfound\n",
- id, notfound ? "not " : "", 0 );
+ (long) id, notfound ? "not " : "", 0 );
return LDAP_SUCCESS;
}
/* acl.c - routines to parse and check acl's */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include "slap.h"
+#ifdef SLAPD_ACI_ENABLED
+int aci_access_allowed (struct berval *aci, char *attr, Backend *be, Entry *e,
+ Operation *op, int access, char *edn, regmatch_t *matches);
+#endif
+
static int regex_matches(char *pat, char *str, char *buf, regmatch_t *matches);
static void string_expand(char *newbuf, int bufsiz, char *pattern,
char *match, regmatch_t *matches);
}
}
- rc = acl_access_allowed( a, be, conn, e, val, op, access, edn, matches );
+ rc = acl_access_allowed( a, attr, be, conn, e, val, op, access, edn, matches );
Debug( LDAP_DEBUG_ACL, "\n=> access_allowed: exit (%s) attr (%s)\n",
e->e_dn, attr, 0);
int
acl_access_allowed(
AccessControl *a,
+ char *attr,
Backend *be,
Connection *conn,
Entry *e,
}
}
+#ifdef SLAPD_ACI_ENABLED
+ if ( b->a_aci_at != NULL ) {
+ Attribute *at;
+
+ /* this case works different from the others above.
+ * since aci's themselves give permissions, we need
+ * to first check b->a_access, the ACL's access level.
+ */
+
+ if( op->o_ndn == NULL || op->o_ndn[0] == '\0' ) {
+ continue;
+ }
+
+ if ( e->e_dn == NULL ) {
+ continue;
+ }
+
+ /* first check if the right being requested is
+ * higher than allowed by the ACL clause.
+ */
+ if ( ! ACL_GRANT( b->a_access, access ) ) {
+ continue;
+ }
+
+ /* get the aci attribute */
+ at = attr_find( e->e_attrs, b->a_aci_at );
+ if ( at == NULL ) {
+ continue;
+ }
+
+ /* the aci is an multi-valued attribute. The
+ * rights are determined by OR'ing the individual
+ * rights given by the acis.
+ */
+ for ( i = 0; at->a_vals[i] != NULL; i++ ) {
+ if ( aci_access_allowed( at->a_vals[i], attr, be, e, op, access, edn, matches ) ) {
+ Debug( LDAP_DEBUG_ACL,
+ "<= acl_access_allowed: matched by clause #%d access granted\n",
+ i, 0, 0 );
+ return(1);
+ }
+ }
+ continue;
+ }
+#endif
+
Debug( LDAP_DEBUG_ACL,
"<= acl_access_allowed: matched by clause #%d access %s\n",
i,
break;
}
for ( i = 0; mlist->ml_bvalues[i] != NULL; i++ ) {
- if ( ! acl_access_allowed( a, be, conn, e, mlist->ml_bvalues[i],
+ if ( ! acl_access_allowed( a, mlist->ml_type, be, conn, e, mlist->ml_bvalues[i],
op, ACL_WRITE, edn, matches) )
{
return( LDAP_INSUFFICIENT_ACCESS );
case LDAP_MOD_DELETE:
if ( mlist->ml_bvalues == NULL ) {
- if ( ! acl_access_allowed( a, be, conn, e,
+ if ( ! acl_access_allowed( a, mlist->ml_type, be, conn, e,
NULL, op, ACL_WRITE, edn, matches) )
{
return( LDAP_INSUFFICIENT_ACCESS );
break;
}
for ( i = 0; mlist->ml_bvalues[i] != NULL; i++ ) {
- if ( ! acl_access_allowed( a, be, conn, e, mlist->ml_bvalues[i],
+ if ( ! acl_access_allowed( a, mlist->ml_type, be, conn, e, mlist->ml_bvalues[i],
op, ACL_WRITE, edn, matches) )
{
return( LDAP_INSUFFICIENT_ACCESS );
return( LDAP_SUCCESS );
}
+#ifdef SLAPD_ACI_ENABLED
+static char *
+aci_bvstrdup (struct berval *bv)
+{
+ char *s;
+
+ s = (char *)ch_malloc(bv->bv_len + 1);
+ if (s != NULL) {
+ memcpy(s, bv->bv_val, bv->bv_len);
+ s[bv->bv_len] = 0;
+ }
+ return(s);
+}
+
+static int
+aci_strbvcmp (char *s, struct berval *bv)
+{
+ int res, len;
+
+ res = strncasecmp( s, bv->bv_val, bv->bv_len );
+ if (res)
+ return(res);
+ len = strlen(s);
+ if (len > bv->bv_len)
+ return(1);
+ if (len < bv->bv_len)
+ return(-1);
+ return(0);
+}
+
+static int
+aci_get_part (struct berval *list, int ix, char sep, struct berval *bv)
+{
+ int len;
+ char *p;
+
+ if (bv) {
+ bv->bv_len = 0;
+ bv->bv_val = NULL;
+ }
+ len = list->bv_len;
+ p = list->bv_val;
+ while (len >= 0 && --ix >= 0) {
+ while (--len >= 0 && *p++ != sep) ;
+ }
+ while (len >= 0 && *p == ' ') {
+ len--;
+ p++;
+ }
+ if (len < 0)
+ return(-1);
+
+ if (!bv)
+ return(0);
+
+ bv->bv_val = p;
+ while (--len >= 0 && *p != sep) {
+ bv->bv_len++;
+ p++;
+ }
+ while (bv->bv_len > 0 && *--p == ' ')
+ bv->bv_len--;
+ return(bv->bv_len);
+}
+
+static int
+aci_list_has_right (struct berval *list, int access, int action)
+{
+ struct berval bv;
+ int i, right;
+
+ for (i = 0; aci_get_part(list, i, ',', &bv) >= 0; i++) {
+ if (bv.bv_len <= 0)
+ continue;
+ switch (*bv.bv_val) {
+ case 'c':
+ right = ACL_COMPARE;
+ break;
+ case 's':
+ /* **** NOTE: draft-ietf-ldapext-aci-model-0.3.txt defines
+ * the right 's' to mean "set", but in the examples states
+ * that the right 's' means "search". The latter definition
+ * is used here.
+ */
+ right = ACL_SEARCH;
+ break;
+ case 'r':
+ right = ACL_READ;
+ break;
+ case 'w':
+ right = ACL_WRITE;
+ break;
+ case 'x':
+ /* **** NOTE: draft-ietf-ldapext-aci-model-0.3.txt does not
+ * define any equivalent to the AUTH right, so I've just used
+ * 'x' for now.
+ */
+ right = ACL_AUTH;
+ break;
+ default:
+ right = 0;
+ break;
+ }
+#ifdef SLAPD_ACI_DISCRETE_RIGHTS
+ if (right & access) {
+ return(action);
+ }
+ }
+ return(!action);
+#else
+ if (action != 0) {
+ /* check granted */
+ if (ACL_GRANT(right, access))
+ return(1);
+ } else {
+ /* check denied */
+ if (right <= access)
+ return(1);
+ }
+ }
+ return(0);
+#endif
+}
+
+static int
+aci_list_has_attr (struct berval *list, char *attr)
+{
+ struct berval bv;
+ int i;
+
+ for (i = 0; aci_get_part(list, i, ',', &bv) >= 0; i++) {
+ if (aci_strbvcmp(attr, &bv) == 0) {
+ return(1);
+ }
+ }
+ return(0);
+}
+
+static int
+aci_list_has_attr_right (struct berval *list, char *attr, int access, int action)
+{
+ struct berval bv;
+ int i, found;
+
+ /* loop through each rights/attr pair, skip first part (action) */
+ found = -1;
+ for (i = 1; aci_get_part(list, i + 1, ';', &bv) >= 0; i += 2) {
+ if (aci_list_has_attr(&bv, attr) == 0)
+ continue;
+ found = 0;
+ if (aci_get_part(list, i, ';', &bv) < 0)
+ continue;
+ if (aci_list_has_right(&bv, access, action) != 0)
+ return(1);
+ }
+ return(found);
+}
+
+static int
+aci_list_has_permission (struct berval *list, char *attr, int access)
+{
+ struct berval perm, actn;
+ int i, action, specific, general;
+
+ if (attr == NULL || *attr == 0 || strcasecmp(attr, "entry") == 0) {
+ attr = "[entry]";
+ }
+
+ /* loop through each permissions clause */
+ for (i = 0; aci_get_part(list, i, '$', &perm) >= 0; i++) {
+ if (aci_get_part(&perm, 0, ';', &actn) < 0)
+ continue;
+ if (aci_strbvcmp( "grant", &actn ) == 0) {
+ action = 1;
+ } else if (aci_strbvcmp( "deny", &actn ) == 0) {
+ action = 0;
+ } else {
+ continue;
+ }
+
+ specific = aci_list_has_attr_right(&perm, attr, access, action);
+ if (specific >= 0)
+ return(specific);
+
+ general = aci_list_has_attr_right(&perm, "[all]", access, action);
+ if (general >= 0)
+ return(general);
+ }
+ return(0);
+}
+
+static int
+aci_group_member (
+ struct berval *subj,
+ char *grpoc,
+ char *grpat,
+ Backend *be,
+ Entry *e,
+ Operation *op,
+ char *edn,
+ regmatch_t *matches
+)
+{
+ struct berval bv;
+ char *subjdn, *grpdn;
+ int rc = 0;
+
+ /* format of string is "group/objectClassValue/groupAttrName" */
+ if (aci_get_part(subj, 0, '/', &bv) < 0)
+ return(0);
+ subjdn = aci_bvstrdup(&bv);
+ if (subjdn == NULL)
+ return(0);
+
+ if (aci_get_part(subj, 1, '/', &bv) < 0)
+ grpoc = ch_strdup(grpoc);
+ else
+ grpoc = aci_bvstrdup(&bv);
+
+ if (aci_get_part(subj, 2, '/', &bv) < 0)
+ grpat = ch_strdup(grpat);
+ else
+ grpat = aci_bvstrdup(&bv);
+
+ grpdn = (char *)ch_malloc(1024);
+ if (grpoc != NULL && grpat != NULL && grpdn != NULL) {
+ string_expand(grpdn, 1024, subjdn, edn, matches);
+ if ( dn_normalize_case(grpdn) != NULL ) {
+ rc = (backend_group(be, e, grpdn, op->o_ndn, grpoc, grpat) == 0);
+ }
+ ch_free(grpdn);
+ }
+ if (grpat != NULL)
+ ch_free(grpat);
+ if (grpoc != NULL)
+ ch_free(grpoc);
+ ch_free(subjdn);
+ return(rc);
+}
+
+int
+aci_access_allowed (
+ struct berval *aci,
+ char *attr,
+ Backend *be,
+ Entry *e,
+ Operation *op,
+ int access,
+ char *edn,
+ regmatch_t *matches
+)
+{
+ struct berval bv, perms, sdn;
+ char *subjdn;
+ int rc;
+
+ Debug( LDAP_DEBUG_ACL,
+ "\n=> aci_access_allowed: %s access to entry \"%s\"\n",
+ access2str( access ), e->e_dn, 0 );
+
+ Debug( LDAP_DEBUG_ACL,
+ "\n=> aci_access_allowed: %s access to attribute \"%s\" by \"%s\"\n",
+ access2str( access ),
+ attr,
+ op->o_ndn ? op->o_ndn : "" );
+
+ /* parse an aci of the form:
+ oid#scope#action;rights;attr;rights;attr$action;rights;attr;rights;attr#dnType#subjectDN
+
+ See draft-ietf-ldapext-aci-model-0.3.txt section 9.1 for
+ a full description of the format for this attribute.
+
+ For now, this routine only supports scope=entry.
+ */
+
+ /* check that the aci has all 5 components */
+ if (aci_get_part(aci, 4, '#', NULL) < 0)
+ return(0);
+
+ /* check that the scope is "entry" */
+ if (aci_get_part(aci, 1, '#', &bv) < 0
+ || aci_strbvcmp( "entry", &bv ) != 0)
+ {
+ return(0);
+ }
+
+ /* get the list of permissions clauses, bail if empty */
+ if (aci_get_part(aci, 2, '#', &perms) <= 0)
+ return(0);
+
+ /* check if any permissions allow desired access */
+ if (aci_list_has_permission(&perms, attr, access) == 0)
+ return(0);
+
+ /* see if we have a DN match */
+ if (aci_get_part(aci, 3, '#', &bv) < 0)
+ return(0);
+
+ if (aci_get_part(aci, 4, '#', &sdn) < 0)
+ return(0);
+ if (aci_strbvcmp( "access-id", &bv ) == 0) {
+ subjdn = aci_bvstrdup(&sdn);
+ if (subjdn == NULL)
+ return(0);
+ rc = 0;
+ if (dn_normalize_case(subjdn) != NULL)
+ rc = (strcasecmp(op->o_ndn, subjdn) == 0);
+ ch_free(subjdn);
+ return(rc);
+ }
+
+ if (aci_strbvcmp( "self", &bv ) == 0) {
+ return(strcasecmp(op->o_ndn, edn) == 0);
+ }
+
+ if (aci_strbvcmp( "group", &bv ) == 0) {
+ return(aci_group_member(&sdn, "groupOfNames", "member", be, e, op, edn, matches));
+ }
+
+ if (aci_strbvcmp( "role", &bv ) == 0) {
+ return(aci_group_member(&sdn, "organizationalRole", "roleOccupant", be, e, op, edn, matches));
+ }
+
+ return(0);
+}
+#endif /* SLAPD_ACI_ENABLED */
+
static void
string_expand(
char *newbuf,
/* acl.c - routines to parse and check acl's */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
static void split(char *line, int splitchar, char **left, char **right);
static void acl_append(AccessControl **l, AccessControl *a);
static void access_append(Access **l, Access *a);
-static void acl_usage(void);
+static void acl_usage(void) LDAP_GCCATTR((noreturn));
#ifdef LDAP_DEBUG
static void print_acl(AccessControl *a);
static void print_access(Access *b);
#endif
static int
-regtest(char *fname, int lineno, char *pat) {
+regtest(const char *fname, int lineno, char *pat) {
int e;
regex_t re;
if ( size >= (sizeof(buf)-1) ) {
fprintf( stderr,
"%s: line %d: regular expression \"%s\" too large\n",
- fname, lineno, pat, 0 );
+ fname, lineno, pat );
acl_usage();
}
void
parse_acl(
Backend *be,
- char *fname,
+ const char *fname,
int lineno,
int argc,
char **argv
acl_usage();
}
a = (AccessControl *) ch_calloc( 1, sizeof(AccessControl) );
+ a->acl_filter = NULL;
+ a->acl_dn_pat = NULL;
+ a->acl_attrs = NULL;
+ a->acl_access = NULL;
+ a->acl_next = NULL;
for ( ++i; i < argc; i++ ) {
if ( strcasecmp( argv[i], "by" ) == 0 ) {
i--;
}
} else if ( strcasecmp( left, "dn" ) == 0 ) {
- int e;
-
- if ((e = regcomp(&a->acl_dn_re, right,
- REG_EXTENDED|REG_ICASE))) {
- char buf[512];
- regerror(e, &a->acl_dn_re, buf, sizeof(buf));
- fprintf( stderr,
- "%s: line %d: regular expression \"%s\" bad because of %s\n",
- fname, lineno, right, buf );
- acl_usage();
-
- } else {
a->acl_dn_pat = ch_strdup( right );
- }
} else if ( strncasecmp( left, "attr", 4 ) == 0 ) {
char **alist;
}
}
+ if ( a->acl_dn_pat != NULL ) {
+ int e = regcomp( &a->acl_dn_re, a->acl_dn_pat,
+ REG_EXTENDED | REG_ICASE );
+ if ( e ) {
+ char buf[512];
+ regerror( e, &a->acl_dn_re, buf, sizeof(buf) );
+ fprintf( stderr,
+ "%s: line %d: regular expression \"%s\" bad because of %s\n",
+ fname, lineno, right, buf );
+ acl_usage();
+ }
+ }
+
/* by clause - select who has what access to entries */
} else if ( strcasecmp( argv[i], "by" ) == 0 ) {
if ( a == NULL ) {
continue;
}
+#ifdef SLAPD_ACI_ENABLED
+ if ( strcasecmp( left, "aci" ) == 0 ) {
+ if( b->a_aci_at != NULL ) {
+ fprintf( stderr,
+ "%s: line %d: aci attribute already specified.\n",
+ fname, lineno );
+ acl_usage();
+ }
+
+ if ( right != NULL && *right != '\0' )
+ b->a_aci_at = ch_strdup( right );
+ else
+ b->a_aci_at = ch_strdup( SLAPD_ACI_DEFAULT_ATTR );
+ continue;
+ }
+#endif
+
/* get <access> */
if ( ACL_IS_INVALID(ACL_SET(b->a_access, str2access( left ))) ) {
fprintf( stderr,
"\t[group[/<objectclass>[/<attrname>]]=<regex>]\n"
"\t[peername=<regex>] [sockname=<regex>]\n"
"\t[domain=<regex>] [sockurl=<regex>]\n"
+#ifdef SLAPD_ACI_ENABLED
+ "\t[aci=<attrname>]\n"
+#endif
"<access> ::= [self]{none|auth|compare|search|read|write}\n"
);
exit( EXIT_FAILURE );
fprintf( stderr, " sockurl=%s", b->a_sockurl_pat );
}
+#ifdef SLAPD_ACI_ENABLED
+ if ( b->a_aci_at != NULL ) {
+ fprintf( stderr, " aci=%s", b->a_aci_at );
+ }
+#endif
+
fprintf( stderr, "\n" );
}
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
return rc;
}
+ if ( global_readonly || be->be_readonly ) {
+ Debug( LDAP_DEBUG_ANY, "do_add: database is read-only\n",
+ 0, 0, 0 );
+ entry_free( e );
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, "database is read-only", NULL, NULL );
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
+
/*
* do the add if 1 && (2 || 3)
* 1) there is an add function implemented in this backend;
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <sys/param.h>
#endif
-#include "ldap_defaults.h"
+#include "ldap_pvt.h"
#include "slap.h"
#ifdef LDAP_DEBUG
for( i=0; a->a_vals[i] != NULL; i++ ) {
tmp->a_vals[i] = ber_bvdup( a->a_vals[i] );
+
+ if( tmp->a_vals[i] == NULL ) break;
}
tmp->a_vals[i] = NULL;
{
assert( s != NULL );
- return( str2lower( s ) );
+ return( ldap_pvt_str2lower( s ) );
}
/*
Attribute *
attr_find(
Attribute *a,
- char *type
+ const char *type
)
{
for ( ; a != NULL; a = a->a_next ) {
int
attr_delete(
Attribute **attrs,
- char *type
+ const char *type
)
{
Attribute **a;
void
attr_syntax_config(
- char *fname,
+ const char *fname,
int lineno,
int argc,
char **argv
val.bv_val = ldap_attributetype2str( &at->sat_atype );
if ( val.bv_val ) {
val.bv_len = strlen( val.bv_val );
- Debug( LDAP_DEBUG_TRACE, "Merging at [%d] %s\n",
- val.bv_len, val.bv_val, 0 );
+ Debug( LDAP_DEBUG_TRACE, "Merging at [%ld] %s\n",
+ (long) val.bv_len, val.bv_val, 0 );
attr_merge( e, "attributeTypes", vals );
ldap_memfree( val.bv_val );
} else {
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+# $OpenLDAP$
+
SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c entry.c id2entry.c \
index.c id2children.c nextid.c abandon.c compare.c group.c \
modify.c modrdn.c delete.c init.c config.c bind.c attr.c \
--- /dev/null
+/* abandon.c - ldbm backend abandon routine */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+
+
+/*ARGSUSED*/
+static int
+bdb2i_back_abandon_internal(
+ BackendDB *be,
+ Connection *c,
+ Operation *o,
+ int msgid )
+{
+ return 0;
+}
+
+
+int
+bdb2_back_abandon(
+ BackendDB *be,
+ Connection *conn,
+ Operation *op,
+ int msgid )
+{
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( be->bd_info, &time1 );
+
+ ret = bdb2i_back_abandon_internal( be, conn, op, msgid );
+
+ bdb2i_stop_timing( be->bd_info, time1, "ABND", conn, op );
+
+ return( ret );
+}
+
+
/* add.c - ldap bdb2 back-end add routine */
+/* $OpenLDAP$ */
#include "portable.h"
if ( bdb2i_id2entry_add( be, e ) != 0 ) {
Debug( LDAP_DEBUG_TRACE, "bdb2i_id2entry_add failed\n", 0,
0, 0 );
- (void) bdb2i_dn2id_delete( be, e->e_ndn );
+ (void) bdb2i_dn2id_delete( be, e->e_ndn, e->e_id );
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
NULL, NULL, NULL, NULL );
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+#include <ac/string.h>
+#include <ac/socket.h>
+#include "slap.h"
+#include "back-bdb2.h"
+#include "proto-back-bdb2.h"
+
+static char* get_alias_dn(
+ Entry *e,
+ int *err,
+ char **errmsg );
+
+static char* new_superior(
+ char *dn,
+ char *oldSup,
+ char *newSup );
+
+static int dnlist_subordinate(
+ char** dnlist,
+ char *dn );
+
+Entry *bdb2i_deref_r(
+ Backend* be,
+ Entry* alias,
+ char* dn,
+ int* err,
+ Entry** matched,
+ char** text )
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ Entry *entry;
+ Entry *sup;
+ unsigned depth;
+ char **dnlist;
+
+ assert( ( alias != NULL && dn == NULL ) || ( alias == NULL && dn != NULL ) );
+
+ *matched = NULL;
+ *err = LDAP_SUCCESS;
+ *text = NULL;
+
+ if( alias == NULL ) {
+ dn = ch_strdup( dn );
+ entry = bdb2i_dn2entry_r( be, dn, &sup );
+
+ } else {
+ dn = ch_strdup( alias->e_ndn );
+ entry = alias;
+ sup = NULL;
+ }
+
+ dnlist = NULL;
+ charray_add( &dnlist, dn );
+
+ for( depth=0 ; ; depth++ ) {
+ if( entry != NULL ) {
+ Entry *newe;
+ char *aliasDN;
+
+ /* have entry, may be an alias */
+
+ if( !is_entry_alias( entry ) ) {
+ /* entry is not an alias */
+ break;
+ }
+
+ /* entry is alias */
+ if( depth > be->be_max_deref_depth ) {
+ *matched = entry;
+ entry = NULL;
+ *err = LDAP_ALIAS_DEREF_PROBLEM;
+ *text = "maximum deref depth exceeded";
+ break;
+ }
+
+ /* deref entry */
+ aliasDN = get_alias_dn( entry, err, text );
+
+ if( aliasDN == NULL ) {
+ *matched = entry;
+ entry = NULL;
+ break;
+ }
+
+ /* check if aliasDN is a subordinate of any DN in our list */
+ if( dnlist_subordinate( dnlist, aliasDN ) ) {
+ *matched = entry;
+ entry = NULL;
+ *err = LDAP_ALIAS_PROBLEM;
+ *text = "circular alias";
+ break;
+ }
+
+ /* attempt to dereference alias */
+
+ newe = bdb2i_dn2entry_r( be, aliasDN, &sup );
+
+ if( newe != NULL ) {
+ free( dn );
+ bdb2i_cache_return_entry_r(&li->li_cache, entry );
+ entry = newe;
+ dn = ch_strdup( entry->e_ndn );
+ charray_add( &dnlist, dn );
+ continue;
+
+ }
+
+ if ( sup != NULL ) {
+ bdb2i_cache_return_entry_r(&li->li_cache, entry );
+ entry = NULL;
+ continue;
+ }
+
+ /* no newe and no superior, we're done */
+ break;
+
+ } else if( sup != NULL ) {
+ /* have superior, may be an alias */
+ Entry *newe;
+ Entry *newSup;
+ char *supDN;
+ char *aliasDN;
+
+ if( !is_entry_alias( sup ) ) {
+ /* entry is not an alias */
+ *matched = sup;
+ sup = NULL;
+ break;
+ }
+
+ /* entry is alias */
+ if( depth > be->be_max_deref_depth ) {
+ *matched = sup;
+ entry = NULL;
+ *err = LDAP_ALIAS_DEREF_PROBLEM;
+ *text = "maximum deref depth exceeded";
+ break;
+ }
+
+ /* deref entry */
+ supDN = get_alias_dn( sup, err, text );
+
+ if( supDN == NULL ) {
+ *matched = sup;
+ break;
+ }
+
+ aliasDN = new_superior( dn, sup->e_ndn, supDN );
+
+ if( aliasDN == NULL ) {
+ free(aliasDN);
+ *matched = sup;
+ *err = LDAP_ALIAS_PROBLEM;
+ *text = "superior alias problem";
+ break;
+ }
+
+ /* check if aliasDN is a subordinate of any DN in our list */
+ if( dnlist_subordinate( dnlist, aliasDN ) ) {
+ free(aliasDN);
+ *matched = entry;
+ entry = NULL;
+ *err = LDAP_ALIAS_PROBLEM;
+ *text = "subordinate circular alias";
+ break;
+ }
+
+ /* attempt to dereference alias */
+ newe = bdb2i_dn2entry_r( be, aliasDN, &newSup );
+
+ if( newe != NULL ) {
+ free(aliasDN);
+ free( dn );
+ bdb2i_cache_return_entry_r(&li->li_cache, sup );
+ entry = newe;
+ dn = ch_strdup( entry->e_ndn );
+ charray_add( &dnlist, dn );
+ continue;
+
+ }
+
+ if ( newSup != NULL ) {
+ free( dn );
+ bdb2i_cache_return_entry_r(&li->li_cache, sup );
+ sup = newSup;
+ dn = aliasDN;
+ continue;
+ }
+
+ break;
+
+ } else {
+ /* no newe and no superior, we're done */
+ break;
+ }
+ }
+
+ free( dn );
+ return entry;
+}
+
+
+static char* get_alias_dn(
+ Entry *e,
+ int *err,
+ char **errmsg )
+{
+ Attribute *a = attr_find( e->e_attrs, "aliasedobjectname" );
+
+ if( a == NULL ) {
+ /*
+ * there was an aliasedobjectname defined but no data.
+ */
+ *err = LDAP_ALIAS_PROBLEM;
+ *errmsg = "alias missing aliasedObjectName attribute";
+ return NULL;
+ }
+
+ /*
+ * aliasedObjectName should be SINGLE-VALUED with a single value.
+ */
+ if ( a->a_vals[0] == NULL || a->a_vals[0]->bv_val == NULL ) {
+ /*
+ * there was an aliasedobjectname defined but no data.
+ */
+ *err = LDAP_ALIAS_PROBLEM;
+ *errmsg = "alias missing aliasedObjectName value";
+ return NULL;
+ }
+
+ if( a->a_vals[1] != NULL ) {
+ *err = LDAP_ALIAS_PROBLEM;
+ *errmsg = "alias has multivalued aliasedObjectName";
+ return NULL;
+ }
+
+ return a->a_vals[0]->bv_val;
+}
+
+static char* new_superior(
+ char *dn,
+ char *oldSup,
+ char *newSup )
+{
+ char *newDN;
+ size_t dnlen, olen, nlen;
+ assert( dn && oldSup && newSup );
+
+ dnlen = strlen( dn );
+ olen = strlen( oldSup );
+ nlen = strlen( newSup );
+
+ newDN = ch_malloc( dnlen - olen + nlen + 1 );
+
+ memcpy( newDN, dn, dnlen - olen );
+ memcpy( &newDN[dnlen - olen], newSup, nlen );
+ newDN[dnlen - olen + nlen] = '\0';
+
+ return newDN;
+}
+
+static int dnlist_subordinate(
+ char** dnlist,
+ char *dn )
+{
+ int i;
+ assert( dnlist );
+
+ for( i = 0; dnlist[i] != NULL; i++ ) {
+ if( dn_issuffix( dnlist[i], dn ) ) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
--- /dev/null
+/* attr.c - backend routines for dealing with attributes */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+
+static int
+ainfo_type_cmp(
+ char *type,
+ struct attrinfo *a
+)
+{
+ return( strcasecmp( type, a->ai_type ) );
+}
+
+static int
+ainfo_cmp(
+ struct attrinfo *a,
+ struct attrinfo *b
+)
+{
+ return( strcasecmp( a->ai_type, b->ai_type ) );
+}
+
+/*
+ * Called when a duplicate "index" line is encountered.
+ *
+ * returns 1 => original from init code, indexmask updated
+ * 2 => original not from init code, warn the user
+ */
+
+static int
+ainfo_dup(
+ struct attrinfo *a,
+ struct attrinfo *b
+)
+{
+ /*
+ * if the duplicate definition is because we initialized the attr,
+ * just add what came from the config file. otherwise, complain.
+ */
+ if ( a->ai_indexmask & INDEX_FROMINIT ) {
+ a->ai_indexmask |= b->ai_indexmask;
+
+ return( 1 );
+ }
+
+ return( 2 );
+}
+
+void
+bdb2i_attr_masks(
+ struct ldbminfo *li,
+ char *type,
+ int *indexmask,
+ int *syntaxmask
+)
+{
+ struct attrinfo *a;
+
+ *indexmask = 0;
+ *syntaxmask = 0;
+ if ( (a = (struct attrinfo *) avl_find( li->li_attrs, type,
+ (AVL_CMP) ainfo_type_cmp )) == NULL ) {
+ if ( (a = (struct attrinfo *) avl_find( li->li_attrs, "default",
+ (AVL_CMP) ainfo_type_cmp )) == NULL ) {
+ return;
+ }
+ }
+ *indexmask = a->ai_indexmask;
+ if ( strcasecmp( a->ai_type, "default" ) == 0 ) {
+ *syntaxmask = attr_syntax( type );
+ } else {
+ *syntaxmask = a->ai_syntaxmask;
+ }
+}
+
+
+/* BDB2 changed */
+void
+bdb2i_attr_index_config(
+ struct ldbminfo *li,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv,
+ int init
+)
+{
+ int i, j;
+ char **attrs, **indexes;
+ struct attrinfo *a;
+
+ attrs = str2charray( argv[0], "," );
+ if ( argc > 1 ) {
+ indexes = str2charray( argv[1], "," );
+ }
+ for ( i = 0; attrs[i] != NULL; i++ ) {
+ a = (struct attrinfo *) ch_malloc( sizeof(struct attrinfo) );
+ a->ai_type = ch_strdup( attrs[i] );
+ a->ai_syntaxmask = attr_syntax( a->ai_type );
+ if ( argc == 1 ) {
+ a->ai_indexmask = (INDEX_PRESENCE | INDEX_EQUALITY |
+ INDEX_APPROX | INDEX_SUB);
+ } else {
+ a->ai_indexmask = 0;
+ for ( j = 0; indexes[j] != NULL; j++ ) {
+ if ( strncasecmp( indexes[j], "pres", 4 )
+ == 0 ) {
+ a->ai_indexmask |= INDEX_PRESENCE;
+ } else if ( strncasecmp( indexes[j], "eq", 2 )
+ == 0 ) {
+ a->ai_indexmask |= INDEX_EQUALITY;
+ } else if ( strncasecmp( indexes[j], "approx",
+ 6 ) == 0 ) {
+ a->ai_indexmask |= INDEX_APPROX;
+ } else if ( strncasecmp( indexes[j], "sub", 3 )
+ == 0 ) {
+ a->ai_indexmask |= INDEX_SUB;
+ } else if ( strncasecmp( indexes[j], "none", 4 )
+ == 0 ) {
+ if ( a->ai_indexmask != 0 ) {
+ fprintf( stderr,
+"%s: line %d: index type \"none\" cannot be combined with other types\n",
+ fname, lineno );
+ }
+ a->ai_indexmask = 0;
+ } else {
+ fprintf( stderr,
+ "%s: line %d: unknown index type \"%s\" (ignored)\n",
+ fname, lineno, indexes[j] );
+ fprintf( stderr,
+ "valid index types are \"pres\", \"eq\", \"approx\", or \"sub\"\n" );
+ }
+ }
+ }
+ if ( init ) {
+ a->ai_indexmask |= INDEX_FROMINIT;
+ } else {
+ if ( a->ai_indexmask )
+ bdb2i_txn_attr_config( li, a->ai_type, 0 );
+ }
+
+ switch (avl_insert( &li->li_attrs, (caddr_t) a,
+ (AVL_CMP) ainfo_cmp, (AVL_DUP) ainfo_dup ))
+ {
+ case 1: /* duplicate - updating init version */
+ free( a->ai_type );
+ free( (char *) a );
+ break;
+
+ case 2: /* user duplicate - ignore and warn */
+ fprintf( stderr,
+ "%s: line %d: duplicate index definition for attr \"%s\" (ignored)\n",
+ fname, lineno, a->ai_type );
+ free( a->ai_type );
+ free( (char *) a );
+ break;
+
+ default:; /* inserted ok */
+ /* FALL */
+ }
+ }
+ charray_free( attrs );
+ if ( argc > 1 )
+ charray_free( indexes );
+}
/* back-bdb2.h - ldap bdb2 back-end header file */
+/* $OpenLDAP$ */
#ifndef _BACK_BDB2_H_
#define _BACK_BDB2_H_
--- /dev/null
+/* bind.c - bdb2 backend bind and unbind routines */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/krb.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+#include "proto-back-bdb2.h"
+
+#include <lutil.h>
+
+#ifdef HAVE_KERBEROS
+extern int bdb2i_krbv4_ldap_auth();
+#endif
+
+static int
+crypted_value_find(
+ struct berval **vals,
+ struct berval *v,
+ int syntax,
+ int normalize,
+ struct berval *cred
+)
+{
+ int i;
+ for ( i = 0; vals[i] != NULL; i++ ) {
+ if ( syntax != SYNTAX_BIN ) {
+ int result;
+
+#ifdef SLAPD_CRYPT
+ ldap_pvt_thread_mutex_lock( &crypt_mutex );
+#endif
+
+ result = lutil_passwd(
+ (char*) cred->bv_val,
+ (char*) vals[i]->bv_val,
+ NULL );
+
+#ifdef SLAPD_CRYPT
+ ldap_pvt_thread_mutex_unlock( &crypt_mutex );
+#endif
+
+ return result;
+
+ } else {
+ if ( value_cmp( vals[i], v, syntax, normalize ) == 0 ) {
+ return( 0 );
+ }
+ }
+ }
+
+ return( 1 );
+}
+
+static int
+bdb2i_back_bind_internal(
+ BackendDB *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ int method,
+ char *mech,
+ struct berval *cred,
+ char** edn
+)
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ Entry *e;
+ Attribute *a;
+ int rc;
+ Entry *matched;
+#ifdef HAVE_KERBEROS
+ char krbname[MAX_K_NAME_SZ + 1];
+ AUTH_DAT ad;
+#endif
+
+ Debug(LDAP_DEBUG_ARGS, "==> bdb2_back_bind: dn: %s\n", dn, 0, 0);
+
+ *edn = NULL;
+
+ /* get entry with reader lock */
+ if ( (e = bdb2i_dn2entry_r( be, dn, &matched )) == NULL ) {
+ char *matched_dn = NULL;
+ struct berval **refs = NULL;
+
+ if ( matched != NULL ) {
+ matched_dn = ch_strdup( matched->e_dn );
+ refs = is_entry_referral( matched )
+ ? get_entry_referrals( be, conn, op, matched )
+ : NULL;
+ bdb2i_cache_return_entry_r( &li->li_cache, matched );
+ } else {
+ refs = default_referral;
+ }
+
+ /* allow noauth binds */
+ rc = 1;
+ if ( method == LDAP_AUTH_SIMPLE ) {
+ if( cred->bv_len == 0 ) {
+ /* SUCCESS */
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+
+ } else if ( be_isroot_pw( be, dn, cred ) ) {
+ /* front end will send result */
+ *edn = ch_strdup( be_root_dn( be ) );
+ rc = 0;
+
+ } else {
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+ }
+
+ } else if ( method == LDAP_AUTH_SASL ) {
+ if( mech != NULL && strcasecmp(mech,"DIGEST-MD5") == 0 ) {
+ /* insert DIGEST calls here */
+ send_ldap_result( conn, op, LDAP_AUTH_METHOD_NOT_SUPPORTED,
+ NULL, NULL, NULL, NULL );
+
+ } else {
+ send_ldap_result( conn, op, LDAP_AUTH_METHOD_NOT_SUPPORTED,
+ NULL, NULL, NULL, NULL );
+ }
+
+ } else {
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+ rc = 1;
+ }
+
+ if ( matched != NULL ) {
+ ber_bvecfree( refs );
+ free( matched_dn );
+ }
+ return( rc );
+ }
+
+ *edn = ch_strdup( e->e_dn );
+
+ /* check for deleted */
+
+ if ( ! access_allowed( be, conn, op, e,
+ "entry", NULL, ACL_AUTH ) )
+ {
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ rc = 1;
+ goto return_results;
+ }
+
+ if ( is_entry_alias( e ) ) {
+ /* entry is a alias, don't allow bind */
+ Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
+ 0, 0 );
+
+ send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM,
+ NULL, NULL, NULL, NULL );
+
+ rc = 1;
+ goto return_results;
+ }
+
+
+ if ( is_entry_referral( e ) ) {
+ /* entry is a referral, don't allow bind */
+ struct berval **refs = get_entry_referrals( be,
+ conn, op, e );
+
+ Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
+ 0, 0 );
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ e->e_dn, NULL, refs, NULL );
+
+ ber_bvecfree( refs );
+
+ rc = 1;
+ goto return_results;
+ }
+
+ switch ( method ) {
+ case LDAP_AUTH_SIMPLE:
+ if ( cred->bv_len == 0 ) {
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+
+ /* stop front end from sending result */
+ rc = 1;
+ goto return_results;
+ }
+
+ /* check for root dn/passwd */
+ if ( be_isroot_pw( be, dn, cred ) ) {
+ /* front end will send result */
+ if( *edn != NULL ) free( *edn );
+ *edn = ch_strdup( be_root_dn( be ) );
+ rc = 0;
+ goto return_results;
+ }
+
+ if ( ! access_allowed( be, conn, op, e,
+ "userpassword", NULL, ACL_AUTH ) )
+ {
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL);
+ rc = 1;
+ goto return_results;
+ }
+
+ if ( (a = attr_find( e->e_attrs, "userpassword" )) == NULL ) {
+ send_ldap_result( conn, op, LDAP_INAPPROPRIATE_AUTH,
+ NULL, NULL, NULL, NULL);
+
+ /* stop front end from sending result */
+ rc = 1;
+ goto return_results;
+ }
+
+ if ( crypted_value_find( a->a_vals, cred, a->a_syntax, 0, cred ) != 0 )
+ {
+ send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS,
+ NULL, NULL, NULL, NULL);
+ /* stop front end from sending result */
+ rc = 1;
+ goto return_results;
+ }
+ rc = 0;
+ break;
+
+#ifdef HAVE_KERBEROS
+ case LDAP_AUTH_KRBV41:
+ if ( bdb2i_krbv4_ldap_auth( be, cred, &ad ) != LDAP_SUCCESS ) {
+ send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS,
+ NULL, NULL, NULL, NULL);
+ rc = 1;
+ goto return_results;
+ }
+
+ if ( ! access_allowed( be, conn, op, e,
+ "krbname", NULL, ACL_AUTH ) )
+ {
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL);
+ rc = 1;
+ goto return_results;
+ }
+
+ sprintf( krbname, "%s%s%s@%s", ad.pname, *ad.pinst ? "."
+ : "", ad.pinst, ad.prealm );
+
+ if ( (a = attr_find( e->e_attrs, "krbname" )) == NULL ) {
+ /*
+ * no krbName values present: check against DN
+ */
+ if ( strcasecmp( dn, krbname ) == 0 ) {
+ rc = 0; /* XXX wild ass guess */
+ break;
+ }
+ send_ldap_result( conn, op, LDAP_INAPPROPRIATE_AUTH,
+ NULL, NULL, NULL, NULL);
+ rc = 1;
+ goto return_results;
+ } else { /* look for krbName match */
+ struct berval krbval;
+
+ krbval.bv_val = krbname;
+ krbval.bv_len = strlen( krbname );
+
+ if ( value_find( a->a_vals, &krbval, a->a_syntax, 3 ) != 0 ) {
+ send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS,
+ NULL, NULL, NULL, NULL);
+ rc = 1;
+ goto return_results;
+ }
+ }
+ rc = 0;
+ break;
+
+ case LDAP_AUTH_KRBV42:
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+ /* stop front end from sending result */
+ rc = 1;
+ goto return_results;
+#endif
+
+ case LDAP_AUTH_SASL:
+ /* insert sasl code here */
+
+ default:
+ send_ldap_result( conn, op, LDAP_STRONG_AUTH_NOT_SUPPORTED,
+ NULL, "auth method not supported", NULL, NULL );
+ rc = 1;
+ goto return_results;
+ }
+
+return_results:;
+ /* free entry and reader lock */
+ bdb2i_cache_return_entry_r( &li->li_cache, e );
+
+ /* front end with send result on success (rc==0) */
+ return( rc );
+}
+
+
+int
+bdb2_back_bind(
+ BackendDB *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ int method,
+ char *mech,
+ struct berval *cred,
+ char** edn
+)
+{
+ DB_LOCK lock;
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( be->bd_info, &time1 );
+
+ if ( bdb2i_enter_backend_r( &lock ) != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return( 1 );
+ }
+
+ ret = bdb2i_back_bind_internal( be, conn, op, dn, method, mech, cred, edn );
+
+ (void) bdb2i_leave_backend_r( lock );
+
+ bdb2i_stop_timing( be->bd_info, time1, "BIND", conn, op );
+
+ return( ret );
+}
+
+
--- /dev/null
+/* cache.c - routines to maintain an in-core cache of entries */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/errno.h>
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+
+#include "back-bdb2.h"
+
+/* LDBM backend specific entry info -- visible only to the cache */
+struct ldbm_entry_info {
+ /*
+ * These items are specific to the LDBM backend and should
+ * be hidden.
+ */
+ int lei_state; /* for the cache */
+#define CACHE_ENTRY_UNDEFINED 0
+#define CACHE_ENTRY_CREATING 1
+#define CACHE_ENTRY_READY 2
+#define CACHE_ENTRY_DELETED 3
+
+ int lei_refcnt; /* # threads ref'ing this entry */
+ Entry *lei_lrunext; /* for cache lru list */
+ Entry *lei_lruprev;
+};
+#define LEI(e) ((struct ldbm_entry_info *) ((e)->e_private))
+
+static int cache_delete_entry_internal(struct cache *cache, Entry *e);
+#ifdef LDAP_DEBUG
+static void lru_print(struct cache *cache);
+#endif
+
+static int
+cache_entry_private_init( Entry*e )
+{
+ assert( e->e_private == NULL );
+
+ if( e->e_private != NULL ) {
+ /* this should never happen */
+ return 1;
+ }
+
+ e->e_private = ch_calloc(1, sizeof(struct ldbm_entry_info));
+
+ return 0;
+}
+
+static int
+cache_entry_private_destroy( Entry*e )
+{
+ assert( e->e_private );
+
+ free( e->e_private );
+ e->e_private = NULL;
+ return 0;
+}
+
+void
+bdb2i_cache_return_entry_rw( struct cache *cache, Entry *e, int rw )
+{
+ /* set cache mutex */
+ ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
+ assert( e->e_private );
+
+ LEI(e)->lei_refcnt--;
+
+ if ( LEI(e)->lei_state == CACHE_ENTRY_CREATING ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_return_entry_%s( %ld ): created (%d)\n",
+ rw ? "w" : "r", e->e_id, LEI(e)->lei_refcnt );
+
+ LEI(e)->lei_state = CACHE_ENTRY_READY;
+
+ } else if ( LEI(e)->lei_state == CACHE_ENTRY_DELETED ) {
+ if( LEI(e)->lei_refcnt > 0 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_return_entry_%s( %ld ): delete pending (%d)\n",
+ rw ? "w" : "r", e->e_id, LEI(e)->lei_refcnt );
+
+ } else {
+ Debug( LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_return_entry_%s( %ld ): deleted (%d)\n",
+ rw ? "w" : "r", e->e_id, LEI(e)->lei_refcnt );
+
+ cache_entry_private_destroy( e );
+ entry_free( e );
+ }
+
+ } else {
+ Debug( LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_return_entry_%s( %ld ): returned (%d)\n",
+ rw ? "w" : "r", e->e_id, LEI(e)->lei_refcnt);
+ }
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+}
+
+#define LRU_DELETE( cache, e ) { \
+ if ( LEI(e)->lei_lruprev != NULL ) { \
+ LEI(LEI(e)->lei_lruprev)->lei_lrunext = LEI(e)->lei_lrunext; \
+ } else { \
+ (cache)->c_lruhead = LEI(e)->lei_lrunext; \
+ } \
+ if ( LEI(e)->lei_lrunext != NULL ) { \
+ LEI(LEI(e)->lei_lrunext)->lei_lruprev = LEI(e)->lei_lruprev; \
+ } else { \
+ (cache)->c_lrutail = LEI(e)->lei_lruprev; \
+ } \
+}
+
+#define LRU_ADD( cache, e ) { \
+ LEI(e)->lei_lrunext = (cache)->c_lruhead; \
+ if ( LEI(e)->lei_lrunext != NULL ) { \
+ LEI(LEI(e)->lei_lrunext)->lei_lruprev = (e); \
+ } \
+ (cache)->c_lruhead = (e); \
+ LEI(e)->lei_lruprev = NULL; \
+ if ( (cache)->c_lrutail == NULL ) { \
+ (cache)->c_lrutail = (e); \
+ } \
+}
+
+/*
+ * bdb2i_cache_add_entry_rw - create and lock an entry in the cache
+ * returns: 0 entry has been created and locked
+ * 1 entry already existed
+ * -1 something bad happened
+ */
+int
+bdb2i_cache_add_entry_rw(
+ struct cache *cache,
+ Entry *e,
+ int rw
+)
+{
+ int i;
+ Entry *ee;
+
+ /* set cache mutex */
+ ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
+ assert( e->e_private == NULL );
+
+ if( cache_entry_private_init(e) != 0 ) {
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
+ Debug( LDAP_DEBUG_ANY,
+ "====> bdb2i_cache_add_entry( %ld ): \"%s\": private init failed!\n",
+ e->e_id, e->e_dn, 0 );
+
+ return( -1 );
+ }
+
+ if ( avl_insert( &cache->c_dntree, (caddr_t) e,
+ (AVL_CMP) entry_dn_cmp, avl_dup_error ) != 0 )
+ {
+ Debug( LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_add_entry( %ld ): \"%s\": already in dn cache\n",
+ e->e_id, e->e_dn, 0 );
+
+ cache_entry_private_destroy(e);
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ return( 1 );
+ }
+
+ /* id tree */
+ if ( avl_insert( &cache->c_idtree, (caddr_t) e,
+ (AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 )
+ {
+ Debug( LDAP_DEBUG_ANY,
+ "====> bdb2i_cache_add_entry( %ld ): \"%s\": already in id cache\n",
+ e->e_id, e->e_dn, 0 );
+
+ /* delete from dn tree inserted above */
+ if ( avl_delete( &cache->c_dntree, (caddr_t) e,
+ (AVL_CMP) entry_dn_cmp ) == NULL )
+ {
+ Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n",
+ 0, 0, 0 );
+ }
+
+ cache_entry_private_destroy(e);
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ return( -1 );
+ }
+
+ /* put the entry into 'CREATING' state */
+ /* will be marked after when entry is returned */
+ LEI(e)->lei_state = CACHE_ENTRY_CREATING;
+ LEI(e)->lei_refcnt = 1;
+
+ /* lru */
+ LRU_ADD( cache, e );
+ if ( ++cache->c_cursize > cache->c_maxsize ) {
+ /*
+ * find the lru entry not currently in use and delete it.
+ * in case a lot of entries are in use, only look at the
+ * first 10 on the tail of the list.
+ */
+ i = 0;
+ while ( cache->c_lrutail != NULL &&
+ LEI(cache->c_lrutail)->lei_refcnt != 0 &&
+ i < 10 )
+ {
+ /* move this in-use entry to the front of the q */
+ ee = cache->c_lrutail;
+ LRU_DELETE( cache, ee );
+ LRU_ADD( cache, ee );
+ i++;
+ }
+
+ /*
+ * found at least one to delete - try to get back under
+ * the max cache size.
+ */
+ while ( cache->c_lrutail != NULL &&
+ LEI(cache->c_lrutail)->lei_refcnt == 0 &&
+ cache->c_cursize > cache->c_maxsize )
+ {
+ e = cache->c_lrutail;
+
+ /* delete from cache and lru q */
+ cache_delete_entry_internal( cache, e );
+ cache_entry_private_destroy( e );
+ entry_free( e );
+ }
+ }
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ return( 0 );
+}
+
+/*
+ * cache_update_entry - update a LOCKED entry which has been deleted.
+ * returns: 0 entry has been created and locked
+ * 1 entry already existed
+ * -1 something bad happened
+ */
+int
+bdb2i_cache_update_entry(
+ struct cache *cache,
+ Entry *e
+)
+{
+ int i;
+ Entry *ee;
+
+ /* set cache mutex */
+ ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
+ assert( e->e_private );
+
+ if ( avl_insert( &cache->c_dntree, (caddr_t) e,
+ (AVL_CMP) entry_dn_cmp, avl_dup_error ) != 0 )
+ {
+ Debug( LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_add_entry( %ld ): \"%s\": already in dn cache\n",
+ e->e_id, e->e_dn, 0 );
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ return( 1 );
+ }
+
+ /* id tree */
+ if ( avl_insert( &cache->c_idtree, (caddr_t) e,
+ (AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 )
+ {
+ Debug( LDAP_DEBUG_ANY,
+ "====> bdb2i_cache_update_entry( %ld ): \"%s\": already in id cache\n",
+ e->e_id, e->e_dn, 0 );
+
+ /* delete from dn tree inserted above */
+ if ( avl_delete( &cache->c_dntree, (caddr_t) e,
+ (AVL_CMP) entry_dn_cmp ) == NULL )
+ {
+ Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n",
+ 0, 0, 0 );
+ }
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ return( -1 );
+ }
+
+ /* put the entry into 'CREATING' state */
+ /* will be marked after when entry is returned */
+ LEI(e)->lei_state = CACHE_ENTRY_CREATING;
+
+ /* lru */
+ LRU_ADD( cache, e );
+ if ( ++cache->c_cursize > cache->c_maxsize ) {
+ /*
+ * find the lru entry not currently in use and delete it.
+ * in case a lot of entries are in use, only look at the
+ * first 10 on the tail of the list.
+ */
+ i = 0;
+ while ( cache->c_lrutail != NULL &&
+ LEI(cache->c_lrutail)->lei_refcnt != 0 &&
+ i < 10 )
+ {
+ /* move this in-use entry to the front of the q */
+ ee = cache->c_lrutail;
+ LRU_DELETE( cache, ee );
+ LRU_ADD( cache, ee );
+ i++;
+ }
+
+ /*
+ * found at least one to delete - try to get back under
+ * the max cache size.
+ */
+ while ( cache->c_lrutail != NULL &&
+ LEI(cache->c_lrutail)->lei_refcnt == 0 &&
+ cache->c_cursize > cache->c_maxsize )
+ {
+ e = cache->c_lrutail;
+
+ /* delete from cache and lru q */
+ cache_delete_entry_internal( cache, e );
+ cache_entry_private_destroy( e );
+ entry_free( e );
+ }
+ }
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ return( 0 );
+}
+
+/*
+ * bdb2i_cache_find_entry_dn2id - find an entry in the cache, given dn
+ */
+
+ID
+bdb2i_cache_find_entry_dn2id(
+ BackendDB *be,
+ struct cache *cache,
+ const char *dn
+)
+{
+ Entry e, *ep;
+ ID id;
+ int count = 0;
+
+ e.e_dn = (char *) dn;
+ e.e_ndn = ch_strdup( dn );
+ (void) dn_normalize_case( e.e_ndn );
+
+try_again:
+ /* set cache mutex */
+ ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
+ if ( (ep = (Entry *) avl_find( cache->c_dntree, (caddr_t) &e,
+ (AVL_CMP) entry_dn_cmp )) != NULL )
+ {
+ int state;
+ count++;
+
+ /*
+ * ep now points to an unlocked entry
+ * we do not need to lock the entry if we only
+ * check the state, refcnt, LRU, and id.
+ */
+
+ assert( ep->e_private );
+
+ /* save id */
+ id = ep->e_id;
+ state = LEI(ep)->lei_state;
+
+ /*
+ * entry is deleted or not fully created yet
+ */
+ if ( state != CACHE_ENTRY_READY ) {
+ assert(state != CACHE_ENTRY_UNDEFINED);
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
+ Debug(LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_find_entry_dn2id(\"%s\"): %ld (not ready) %d\n",
+ dn, id, state);
+
+ ldap_pvt_thread_yield();
+ goto try_again;
+ }
+
+ /* lru */
+ LRU_DELETE( cache, ep );
+ LRU_ADD( cache, ep );
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
+ Debug(LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_find_entry_dn2id(\"%s\"): %ld (%d tries)\n",
+ dn, id, count);
+
+ } else {
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
+ id = NOID;
+ }
+
+ free(e.e_ndn);
+
+ return( id );
+}
+
+/*
+ * cache_find_entry_id - find an entry in the cache, given id
+ */
+
+Entry *
+bdb2i_cache_find_entry_id(
+ struct cache *cache,
+ ID id,
+ int rw
+)
+{
+ Entry e;
+ Entry *ep;
+ int count=0;
+
+ e.e_id = id;
+
+try_again:
+ /* set cache mutex */
+ ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
+ if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e,
+ (AVL_CMP) entry_id_cmp )) != NULL )
+ {
+ int state;
+
+ assert( ep->e_private );
+
+ state = LEI(ep)->lei_state;
+
+ /*
+ * entry is deleted or not fully created yet
+ */
+ if ( state != CACHE_ENTRY_READY ) {
+ ID ep_id = ep->e_id;
+
+ assert(state != CACHE_ENTRY_UNDEFINED);
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
+ Debug(LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_find_entry_id( %ld ): %ld (not ready) %d\n",
+ id, ep_id, state);
+
+ ldap_pvt_thread_yield();
+ goto try_again;
+ }
+
+ /* lru */
+ LRU_DELETE( cache, ep );
+ LRU_ADD( cache, ep );
+
+ LEI(ep)->lei_refcnt++;
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
+ Debug(LDAP_DEBUG_TRACE,
+ "====> bdb2i_cache_find_entry_id( %ld ) \"%s\" (found) (%d tries)\n",
+ id, ep->e_dn, count);
+
+ return( ep );
+ }
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+
+ return( NULL );
+}
+
+/*
+ * cache_delete_entry - delete the entry e from the cache. the caller
+ * should have obtained e (increasing its ref count) via a call to one
+ * of the cache_find_* routines. the caller should *not* call the
+ * cache_return_entry() routine prior to calling cache_delete_entry().
+ * it performs this function.
+ *
+ * returns: 0 e was deleted ok
+ * 1 e was not in the cache
+ * -1 something bad happened
+ */
+int
+bdb2i_cache_delete_entry(
+ struct cache *cache,
+ Entry *e
+)
+{
+ int rc;
+
+ /* set cache mutex */
+ ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+
+ assert( e->e_private );
+
+ Debug( LDAP_DEBUG_TRACE, "====> bdb2i_cache_delete_entry( %ld )\n",
+ e->e_id, 0, 0 );
+
+ rc = cache_delete_entry_internal( cache, e );
+
+ /* free cache mutex */
+ ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ return( rc );
+}
+
+static int
+cache_delete_entry_internal(
+ struct cache *cache,
+ Entry *e
+)
+{
+ int rc = 0; /* return code */
+
+ /* dn tree */
+ if ( avl_delete( &cache->c_dntree, (caddr_t) e, (AVL_CMP) entry_dn_cmp )
+ == NULL )
+ {
+ rc = -1;
+ }
+
+ /* id tree */
+ if ( avl_delete( &cache->c_idtree, (caddr_t) e, (AVL_CMP) entry_id_cmp )
+ == NULL )
+ {
+ rc = -1;
+ }
+
+ if (rc != 0) {
+ return rc;
+ }
+
+ /* lru */
+ LRU_DELETE( cache, e );
+ cache->c_cursize--;
+
+ /*
+ * flag entry to be freed later by a call to cache_return_entry()
+ */
+ LEI(e)->lei_state = CACHE_ENTRY_DELETED;
+
+ return( 0 );
+}
+
+#ifdef LDAP_DEBUG
+
+static void
+lru_print( struct cache *cache )
+{
+ Entry *e;
+
+ fprintf( stderr, "LRU queue (head to tail):\n" );
+ for ( e = cache->c_lruhead; e != NULL; e = LEI(e)->lei_lrunext ) {
+ fprintf( stderr, "\tdn \"%20s\" id %ld refcnt %d\n",
+ e->e_dn, e->e_id, LEI(e)->lei_refcnt );
+ }
+ fprintf( stderr, "LRU queue (tail to head):\n" );
+ for ( e = cache->c_lrutail; e != NULL; e = LEI(e)->lei_lruprev ) {
+ fprintf( stderr, "\tdn \"%20s\" id %ld refcnt %d\n",
+ e->e_dn, e->e_id, LEI(e)->lei_refcnt );
+ }
+}
+
+#endif
+
/* close.c - close bdb2 backend database */
+/* $OpenLDAP$ */
#include "portable.h"
--- /dev/null
+/* compare.c - bdb2 backend compare routine */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+#include "proto-back-bdb2.h"
+
+static int
+bdb2i_back_compare_internal(
+ BackendDB *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ Ava *ava
+)
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ Entry *matched;
+ Entry *e;
+ Attribute *a;
+ int rc;
+ int manageDSAit = get_manageDSAit( op );
+
+ /* get entry with reader lock */
+ if ( (e = bdb2i_dn2entry_r( be, dn, &matched )) == NULL ) {
+ char *matched_dn = NULL;
+ struct berval **refs = NULL;
+
+ if ( matched != NULL ) {
+ matched_dn = ch_strdup( matched->e_dn );
+ refs = is_entry_referral( matched )
+ ? get_entry_referrals( be, conn, op, matched )
+ : NULL;
+ bdb2i_cache_return_entry_r( &li->li_cache, matched );
+ } else {
+ refs = default_referral;
+ }
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+
+ if( matched != NULL ) {
+ ber_bvecfree( refs );
+ free( matched_dn );
+ }
+
+ return( 1 );
+ }
+
+ if (!manageDSAit && is_entry_referral( e ) ) {
+ /* entry is a referral, don't allow add */
+ struct berval **refs = get_entry_referrals( be,
+ conn, op, e );
+
+ Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
+ 0, 0 );
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ e->e_dn, NULL, refs, NULL );
+
+ ber_bvecfree( refs );
+
+ rc = 1;
+ goto return_results;
+ }
+
+ if ( ! access_allowed( be, conn, op, e,
+ ava->ava_type, &ava->ava_value, ACL_COMPARE ) )
+ {
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ rc = 1;
+ goto return_results;
+ }
+
+ if ( (a = attr_find( e->e_attrs, ava->ava_type )) == NULL ) {
+ send_ldap_result( conn, op, LDAP_NO_SUCH_ATTRIBUTE,
+ NULL, NULL, NULL, NULL );
+ rc = 1;
+ goto return_results;
+ }
+
+ if ( value_find( a->a_vals, &ava->ava_value, a->a_syntax, 1 ) == 0 )
+ send_ldap_result( conn, op, LDAP_COMPARE_TRUE,
+ NULL, NULL, NULL, NULL );
+ else
+ send_ldap_result( conn, op, LDAP_COMPARE_FALSE,
+ NULL, NULL, NULL, NULL );
+
+ rc = 0;
+
+return_results:;
+ bdb2i_cache_return_entry_r( &li->li_cache, e );
+ return( rc );
+}
+
+
+int
+bdb2_back_compare(
+ BackendDB *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ Ava *ava
+)
+{
+ DB_LOCK lock;
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( be->bd_info, &time1 );
+
+ if ( bdb2i_enter_backend_r( &lock ) != 0 ) {
+
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return( 1 );
+
+ }
+
+ ret = bdb2i_back_compare_internal( be, conn, op, dn, ava );
+ (void) bdb2i_leave_backend_r( lock );
+ bdb2i_stop_timing( be->bd_info, time1, "CMP", conn, op );
+
+ return( ret );
+}
+
+
--- /dev/null
+/* config.c - bdb2 backend configuration file routine */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+
+static int
+bdb2i_back_config_internal(
+ BackendInfo *bi,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv
+)
+{
+ struct ldbtype *lty = (struct ldbtype *) bi->bi_private;
+
+ if ( lty == NULL ) {
+ fprintf( stderr, "%s: line %d: ldbm backend type info is null!\n",
+ fname, lineno );
+ return( 1 );
+ }
+
+ /* directory where DB control files live */
+ if ( strcasecmp( argv[0], "home" ) == 0 ) {
+ if ( argc < 2 ) {
+ fprintf( stderr,
+ "%s: line %d: missing dir in \"home <dir>\" line\n",
+ fname, lineno );
+ return( 1 );
+ }
+ lty->lty_dbhome = ch_strdup( argv[1] );
+
+ /* size of the DB memory pool */
+ } else if ( strcasecmp( argv[0], "mpoolsize" ) == 0 ) {
+ if ( argc < 2 ) {
+ fprintf( stderr,
+ "%s: line %d: missing size in \"mpoolsize <size>\" line\n",
+ fname, lineno );
+ return( 1 );
+ }
+ lty->lty_mpsize = (size_t) atoi( argv[1] );
+ /* we should at least have the suggested 128k */
+ if ( lty->lty_mpsize < DEFAULT_DBCACHE_SIZE )
+ lty->lty_mpsize = DEFAULT_DBCACHE_SIZE;
+
+ /* anything else */
+ } else {
+ fprintf( stderr,
+"%s: line %d: unknown directive \"%s\" in ldbm backend definition (ignored)\n",
+ fname, lineno, argv[0] );
+ }
+
+ return 0;
+}
+
+
+int
+bdb2_back_config(
+ BackendInfo *bi,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv
+)
+{
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( bi, &time1 );
+
+ ret = bdb2i_back_config_internal( bi, fname, lineno, argc, argv );
+ bdb2i_stop_timing( bi, time1, "BE-CONFIG", NULL, NULL );
+
+ return( ret );
+}
+
+
+static int
+bdb2i_back_db_config_internal(
+ BackendDB *be,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv
+)
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+
+ if ( li == NULL ) {
+ fprintf( stderr, "%s: line %d: ldbm database info is null!\n",
+ fname, lineno );
+ return( 1 );
+ }
+
+ /* directory where database files live */
+ if ( strcasecmp( argv[0], "directory" ) == 0 ) {
+ if ( argc < 2 ) {
+ fprintf( stderr,
+ "%s: line %d: missing dir in \"directory <dir>\" line\n",
+ fname, lineno );
+ return( 1 );
+ }
+ li->li_directory = ch_strdup( argv[1] );
+
+ li->li_nextid_file =
+ ch_malloc( strlen(li->li_directory) + sizeof("/NEXTID") + 1 );
+
+ strcpy(li->li_nextid_file, li->li_directory);
+ strcat(li->li_nextid_file, "/NEXTID");
+
+ /* mode with which to create new database files */
+ } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
+ if ( argc < 2 ) {
+ fprintf( stderr,
+ "%s: line %d: missing mode in \"mode <mode>\" line\n",
+ fname, lineno );
+ return( 1 );
+ }
+ li->li_mode = strtol( argv[1], NULL, 0 );
+
+ /* attribute to index */
+ } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
+ if ( argc < 2 ) {
+ fprintf( stderr,
+"%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
+ fname, lineno );
+ return( 1 );
+ } else if ( argc > 3 ) {
+ fprintf( stderr,
+"%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line (ignored)\n",
+ fname, lineno );
+ }
+ bdb2i_attr_index_config( li, fname, lineno, argc - 1, &argv[1], 0 );
+
+ /* size of the cache in entries */
+ } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
+ if ( argc < 2 ) {
+ fprintf( stderr,
+ "%s: line %d: missing size in \"cachesize <size>\" line\n",
+ fname, lineno );
+ return( 1 );
+ }
+ li->li_cache.c_maxsize = atoi( argv[1] );
+
+ /* size of each dbcache in bytes */
+ } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
+ if ( argc < 2 ) {
+ fprintf( stderr,
+ "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
+ fname, lineno );
+ return( 1 );
+ }
+ li->li_dbcachesize = atoi( argv[1] );
+ /* we should at least have the suggested 128k */
+ if ( li->li_dbcachesize < DEFAULT_DBCACHE_SIZE )
+ li->li_dbcachesize = DEFAULT_DBCACHE_SIZE;
+
+ /* no write sync */
+ } else if ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) {
+ li->li_dbcachewsync = 0;
+
+ /* anything else */
+ } else {
+ fprintf( stderr,
+"%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
+ fname, lineno, argv[0] );
+ }
+
+ return 0;
+}
+
+
+int
+bdb2_back_db_config(
+ BackendDB *be,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv
+)
+{
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( be->bd_info, &time1 );
+
+ ret = bdb2i_back_db_config_internal( be, fname, lineno, argc, argv );
+
+ bdb2i_stop_timing( be->bd_info, time1, "DB-CONFIG", NULL, NULL );
+
+ return( ret );
+}
+
+
/* ldbmcache.c - maintain a cache of open bdb2 files */
+/* $OpenLDAP$ */
#include "portable.h"
#include <sys/param.h>
#endif
-#include "ldap_defaults.h"
#include "slap.h"
#include "back-bdb2.h"
/* delete.c - bdb2 backend delete routine */
+/* $OpenLDAP$ */
#include "portable.h"
}
/* delete from dn2id mapping */
- if ( bdb2i_dn2id_delete( be, e->e_ndn ) != 0 ) {
+ if ( bdb2i_dn2id_delete( be, e->e_ndn, e->e_id ) != 0 ) {
Debug(LDAP_DEBUG_ARGS,
"<=- bdb2i_back_delete: operations error %s\n",
dn, 0, 0);
/* dn2id.c - routines to deal with the dn2id index */
+/* $OpenLDAP$ */
#include "portable.h"
int
bdb2i_dn2id_add(
BackendDB *be,
- char *dn,
+ const char *dn,
ID id
)
{
ID
bdb2i_dn2id(
BackendDB *be,
- char *dn
+ const char *dn
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID_BLOCK *
bdb2i_dn2idl(
BackendDB *be,
- char *dn,
+ const char *dn,
int prefix )
{
struct dbcache *db;
int
bdb2i_dn2id_delete(
BackendDB *be,
- char *dn
+ const char *dn,
+ ID id
)
{
struct dbcache *db;
Datum key;
int rc;
- Debug( LDAP_DEBUG_TRACE, "=> bdb2i_dn2id_delete( \"%s\" )\n", dn, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "=> bdb2i_dn2id_delete( \"%s\", %ld )\n",
+ dn, id, 0 );
if ( (db = bdb2i_cache_open( be, "dn2id", BDB2_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
return( -1 );
}
+ {
+ char *pdn = dn_parent( NULL, dn );
+
+ if( pdn != NULL ) {
+ ldbm_datum_init( key );
+ key.dsize = strlen( pdn ) + 2;
+ key.dptr = ch_malloc( key.dsize );
+ sprintf( key.dptr, "%c%s", DN_ONE_PREFIX, pdn );
+ (void) bdb2i_idl_delete_key( be, db, key, id );
+ free( key.dptr );
+ free( pdn );
+ }
+ }
+
+ {
+ char **subtree = dn_subtree( NULL, dn );
+
+ if( subtree != NULL ) {
+ int i;
+ for( i=0; subtree[i] != NULL; i++ ) {
+ ldbm_datum_init( key );
+ key.dsize = strlen( subtree[i] ) + 2;
+ key.dptr = ch_malloc( key.dsize );
+ sprintf( key.dptr, "%c%s", DN_SUBTREE_PREFIX, subtree[i] );
+
+ (void) bdb2i_idl_delete_key( be, db, key, id );
+
+ free( key.dptr );
+ }
+
+ charray_free( subtree );
+ }
+ }
+
ldbm_datum_init( key );
key.dsize = strlen( dn ) + 2;
Entry *
bdb2i_dn2entry_rw(
BackendDB *be,
- char *dn,
+ const char *dn,
Entry **matched,
int rw
)
--- /dev/null
+/* entry.c - ldbm backend entry_release routine */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+#include "proto-back-bdb2.h"
+
+
+int
+bdb2_back_entry_release_rw(
+ BackendDB *be,
+ Entry *e,
+ int rw
+)
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+
+ /* free entry and reader or writer lock */
+ bdb2i_cache_return_entry_rw( &li->li_cache, e, rw );
+ bdb2i_release_add_lock();
+
+ return 0;
+}
+/* $OpenLDAP$ */
#ifndef _BDB2_EXTERNAL_H
#define _BDB2_EXTERNAL_H
extern int bdb2_back_destroy LDAP_P(( BackendInfo *bi ));
extern int bdb2_back_config LDAP_P(( BackendInfo *bt,
- char *fname, int lineno, int argc, char **argv ));
+ const char *fname, int lineno, int argc, char **argv ));
extern int bdb2_back_db_init LDAP_P(( BackendDB *bd ));
extern int bdb2_back_db_open LDAP_P(( BackendDB *bd ));
extern int bdb2_back_db_destroy LDAP_P(( BackendDB *bd ));
extern int bdb2_back_db_config LDAP_P(( BackendDB *bd,
- char *fname, int lineno, int argc, char **argv ));
+ const char *fname, int lineno, int argc, char **argv ));
extern int bdb2_back_bind LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
Connection *conn, Operation *op, int msgid ));
extern int bdb2_back_group LDAP_P(( BackendDB *bd,
- Entry *target, char* gr_ndn, char* op_ndn,
- char* objectclassValue, char* groupattrName));
+ Entry *target, const char* gr_ndn, const char* op_ndn,
+ const char* objectclassValue, const char* groupattrName));
/* hooks for slap tools */
extern int bdb2_tool_entry_open LDAP_P(( BackendDB *be, int mode ));
/* filterindex.c - generate the list of candidate entries from a filter */
+/* $OpenLDAP$ */
#include "portable.h"
--- /dev/null
+/* group.c - bdb2 backend acl group routine */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+#include "proto-back-bdb2.h"
+
+
+/* return 0 IFF op_dn is a value in member attribute
+ * of entry with gr_dn AND that entry has an objectClass
+ * value of groupOfNames
+ */
+static int
+bdb2i_back_group_internal(
+ BackendDB *be,
+ Entry *target,
+ const char *gr_ndn,
+ const char *op_ndn,
+ const char *objectclassValue,
+ const char *groupattrName
+)
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ Entry *e;
+ int rc = 1;
+ Attribute *attr;
+ struct berval bv;
+
+ Debug( LDAP_DEBUG_ARGS,
+ "=> bdb2i_back_group: gr dn: \"%s\"\n",
+ gr_ndn, 0, 0 );
+ Debug( LDAP_DEBUG_ARGS,
+ "=> bdb2i_back_group: op dn: \"%s\"\n",
+ op_ndn, 0, 0 );
+ Debug( LDAP_DEBUG_ARGS,
+ "=> bdb2i_back_group: objectClass: \"%s\" attrName: \"%s\"\n",
+ objectclassValue, groupattrName, 0 );
+
+ Debug( LDAP_DEBUG_ARGS,
+ "=> bdb2i_back_group: tr dn: \"%s\"\n",
+ target->e_ndn, 0, 0 );
+
+ if (strcmp(target->e_ndn, gr_ndn) == 0) {
+ /* we already have a LOCKED copy of the entry */
+ e = target;
+ Debug( LDAP_DEBUG_ARGS,
+ "=> bdb2i_back_group: target is group: \"%s\"\n",
+ gr_ndn, 0, 0 );
+
+ } else {
+ /* can we find group entry with reader lock */
+ if ((e = bdb2i_dn2entry_r(be, gr_ndn, NULL )) == NULL) {
+ Debug( LDAP_DEBUG_ACL,
+ "=> bdb2i_back_group: cannot find group: \"%s\"\n",
+ gr_ndn, 0, 0 );
+ return( 1 );
+ }
+
+ Debug( LDAP_DEBUG_ACL,
+ "=> bdb2i_back_group: found group: \"%s\"\n",
+ gr_ndn, 0, 0 );
+ }
+
+ /* find it's objectClass and member attribute values
+ * make sure this is a group entry
+ * finally test if we can find op_dn in the member attribute value list
+ */
+
+ rc = 1;
+
+ if ((attr = attr_find(e->e_attrs, "objectclass")) == NULL) {
+ Debug( LDAP_DEBUG_ACL,
+ "<= bdb2i_back_group: failed to find objectClass\n", 0, 0, 0 );
+ goto return_results;
+ }
+
+ bv.bv_val = "ALIAS";
+ bv.bv_len = sizeof("ALIAS")-1;
+
+ if (value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) {
+ Debug( LDAP_DEBUG_ACL,
+ "<= bdb2i_back_group: group is an alias\n", 0, 0, 0 );
+ goto return_results;
+ }
+
+ bv.bv_val = "REFERRAL";
+ bv.bv_len = sizeof("REFERRAL")-1;
+
+ if (value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) {
+ Debug( LDAP_DEBUG_ACL,
+ "<= bdb2i_back_group: group is a referral\n", 0, 0, 0 );
+ goto return_results;
+ }
+
+ bv.bv_val = (char *) objectclassValue;
+ bv.bv_len = strlen( bv.bv_val );
+
+ if (value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) {
+ Debug( LDAP_DEBUG_ACL,
+ "<= bdb2i_back_group: failed to find %s in objectClass\n",
+ objectclassValue, 0, 0 );
+ goto return_results;
+ }
+
+ if ((attr = attr_find(e->e_attrs, groupattrName)) == NULL) {
+ Debug( LDAP_DEBUG_ACL,
+ "<= bdb2i_back_group: failed to find %s\n",
+ groupattrName, 0, 0 );
+ goto return_results;
+ }
+
+ Debug( LDAP_DEBUG_ACL,
+ "<= bdb2i_back_group: found objectClass %s and %s\n",
+ objectclassValue, groupattrName, 0 );
+
+
+ bv.bv_val = (char *) op_ndn;
+ bv.bv_len = strlen( op_ndn );
+
+ if (value_find( attr->a_vals, &bv, attr->a_syntax, 1) != 0 ) {
+ Debug( LDAP_DEBUG_ACL,
+ "<= bdb2i_back_group: \"%s\" not in \"%s\": %s\n",
+ op_ndn, gr_ndn, groupattrName );
+ goto return_results;
+ }
+
+ Debug( LDAP_DEBUG_ACL,
+ "<= bdb2i_back_group: \"%s\" is in \"%s\": %s\n",
+ op_ndn, gr_ndn, groupattrName );
+ rc = 0;
+
+return_results:
+ if( target != e ) {
+ /* free entry and reader lock */
+ bdb2i_cache_return_entry_r( &li->li_cache, e );
+ }
+
+ Debug( LDAP_DEBUG_ARGS, "bdb2i_back_group: rc: %d\n", rc, 0, 0 );
+ return(rc);
+}
+
+
+int
+bdb2_back_group(
+ BackendDB *be,
+ Entry *target,
+ const char *gr_ndn,
+ const char *op_ndn,
+ const char *objectclassValue,
+ const char *groupattrName
+)
+{
+ DB_LOCK lock;
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( be->bd_info, &time1 );
+
+ if ( bdb2i_enter_backend_r( &lock ) != 0 ) {
+
+ return( 1 );
+
+ }
+
+ ret = bdb2i_back_group_internal( be, target, gr_ndn, op_ndn,
+ objectclassValue, groupattrName );
+
+ (void) bdb2i_leave_backend_r( lock );
+ bdb2i_stop_timing( be->bd_info, time1, "GRP", NULL, NULL );
+
+ return( ret );
+}
+
+
/* id2children.c - routines to deal with the id2children index */
+/* $OpenLDAP$ */
#include "portable.h"
/* id2entry.c - routines to deal with the id2entry index */
+/* $OpenLDAP$ */
#include "portable.h"
/* idl.c - ldap id list handling routines */
+/* $OpenLDAP$ */
#include "portable.h"
#include <ac/string.h>
#include <ac/socket.h>
-#include "ldap_defaults.h"
#include "slap.h"
#include "back-bdb2.h"
rc = idl_change_first( be, db, key, idl, i, k2, tmp );
break;
- case 2: /* id not inserted - already there */
+ case 2: /* id not inserted - already there, do nothing */
+ rc = 0;
break;
case 3: /* id not inserted - block is full */
Debug( LDAP_DEBUG_ANY,
"idl_fetch_one (%s) returns NULL\n",
k2.dptr, 0, 0 );
- break;
+ /* split the original block */
+ goto split;
}
switch ( (rc = bdb2i_idl_insert( &tmp2, id,
case 3: /* split the original block */
break;
}
+
bdb2i_idl_free( tmp2 );
}
+split:
/*
* must split the block, write both new blocks + update
* and write the indirect header block.
*/
+ rc = 0; /* optimistic */
+
+
/* count how many indirect blocks *//* XXX linear count XXX */
for ( j = 0; !ID_BLOCK_NOID(idl, j); j++ )
; /* NULL */
int
bdb2i_idl_insert( ID_BLOCK **idl, ID id, unsigned int maxids )
{
- unsigned int i, j;
+ unsigned int i;
if ( ID_BLOCK_ALLIDS( *idl ) ) {
return( 2 ); /* already there */
}
/* make a slot for the new id */
- SAFEMEMCPY( &ID_BLOCK_ID(*idl, i), &ID_BLOCK_ID(*idl, i+1),
- ID_BLOCK_NIDS(*idl) - i );
+ SAFEMEMCPY( &ID_BLOCK_ID(*idl, i+1), &ID_BLOCK_ID(*idl, i),
+ (ID_BLOCK_NIDS(*idl) - i) * sizeof(ID) );
ID_BLOCK_ID(*idl, i) = id;
ID_BLOCK_NIDS(*idl)++;
/* index.c - routines for dealing with attribute indexes */
+/* $OpenLDAP$ */
#include "portable.h"
/* init.c - initialize bdb2 backend */
+/* $OpenLDAP$ */
#include "portable.h"
--- /dev/null
+/* kerberos.c - bdb2 backend kerberos bind routines */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#ifdef HAVE_KERBEROS
+
+#include <stdio.h>
+
+#include <ac/krb.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+
+#define LDAP_KRB_PRINCIPAL "ldapserver"
+
+extern char *ldap_srvtab;
+extern Attribute *attr_find();
+
+bdb2i_krbv4_ldap_auth(
+ BackendDB *be,
+ struct berval *cred,
+ AUTH_DAT *ad
+)
+{
+ KTEXT_ST k;
+ KTEXT ktxt = &k;
+ char instance[INST_SZ];
+ int err;
+
+ Debug( LDAP_DEBUG_TRACE, "=> kerberosv4_ldap_auth\n", 0, 0, 0 );
+
+ SAFEMEMCPY( ktxt->dat, cred->bv_val, cred->bv_len );
+ ktxt->length = cred->bv_len;
+
+ strcpy( instance, "*" );
+ if ( (err = krb_rd_req( ktxt, LDAP_KRB_PRINCIPAL, instance, 0L, ad,
+ ldap_srvtab )) != KSUCCESS ) {
+ Debug( LDAP_DEBUG_ANY, "krb_rd_req failed (%s)\n",
+ krb_err_txt[err], 0, 0 );
+ return( LDAP_INVALID_CREDENTIALS );
+ }
+
+ return( LDAP_SUCCESS );
+}
+
+#endif /* kerberos */
/* modify.c - bdb2 backend modify routine */
+/* $OpenLDAP$ */
#include "portable.h"
--- /dev/null
+/* modrdn.c - bdb2 backend modrdn routine */
+/* $OpenLDAP$ */
+
+/*
+ * LDAP v3 newSuperior support.
+ *
+ * Copyright 1999, Juan C. Gomez, All rights reserved.
+ * This software is not subject to any license of Silicon Graphics
+ * Inc. or Purdue University.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * without restriction or fee of any kind as long as this notice
+ * is preserved.
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+#include "proto-back-bdb2.h"
+
+static int
+bdb2i_back_modrdn_internal(
+ BackendDB *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ char *newrdn,
+ int deleteoldrdn,
+ char *newSuperior
+)
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ Entry *matched = NULL;
+ char *p_dn = NULL, *p_ndn = NULL;
+ char *new_dn = NULL, *new_ndn = NULL;
+ char sep[2];
+ Entry *e, *p = NULL;
+ int rc = -1, manageDSAit;
+ /* Added to support LDAP v2 correctly (deleteoldrdn thing) */
+ char *new_rdn_val = NULL; /* Val of new rdn */
+ char *new_rdn_type = NULL; /* Type of new rdn */
+ char *old_rdn = NULL; /* Old rdn's attr type & val */
+ char *old_rdn_type = NULL; /* Type of old rdn attr. */
+ char *old_rdn_val = NULL; /* Old rdn attribute value */
+ struct berval add_bv; /* Stores new rdn att */
+ struct berval *add_bvals[2]; /* Stores new rdn att */
+ struct berval del_bv; /* Stores old rdn att */
+ struct berval *del_bvals[2]; /* Stores old rdn att */
+ LDAPModList mod[2]; /* Used to delete old rdn */
+ /* Added to support newSuperior */
+ Entry *np = NULL; /* newSuperior Entry */
+ char *np_dn = NULL; /* newSuperior dn */
+ char *np_ndn = NULL; /* newSuperior ndn */
+ char *new_parent_dn = NULL; /* np_dn, p_dn, or NULL */
+
+ Debug( LDAP_DEBUG_TRACE, "==>ldbm_back_modrdn(newSuperior=%s)\n",
+ (newSuperior ? newSuperior : "NULL"),
+ 0, 0 );
+
+ /* get entry with writer lock */
+ if ( (e = bdb2i_dn2entry_w( be, dn, &matched )) == NULL ) {
+ char *matched_dn = NULL;
+ struct berval **refs = NULL;
+
+ if ( matched != NULL ) {
+ matched_dn = ch_strdup( matched->e_dn );
+ refs = is_entry_referral( matched )
+ ? get_entry_referrals( be, conn, op, matched )
+ : NULL;
+ bdb2i_cache_return_entry_r( &li->li_cache, matched );
+ } else {
+ refs = default_referral;
+ }
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ matched_dn, NULL, refs, NULL );
+
+ if( matched != NULL ) {
+ ber_bvecfree( refs );
+ free( matched_dn );
+ }
+
+ return( -1 );
+ }
+
+ if (!manageDSAit && is_entry_referral( e ) ) {
+ /* entry is a referral, don't allow add */
+ struct berval **refs = get_entry_referrals( be,
+ conn, op, e );
+
+ Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
+ 0, 0 );
+
+ send_ldap_result( conn, op, LDAP_REFERRAL,
+ e->e_dn, NULL, refs, NULL );
+
+ ber_bvecfree( refs );
+
+ goto return_results;
+ }
+
+#ifdef SLAPD_CHILD_MODIFICATION_WITH_ENTRY_ACL
+ /* check parent for "children" acl */
+ if ( ! access_allowed( be, conn, op, e,
+ "entry", NULL, ACL_WRITE ) )
+ {
+ Debug( LDAP_DEBUG_TRACE, "no access to entry\n", 0,
+ 0, 0 );
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+#endif
+
+ if ( (p_ndn = dn_parent( be, e->e_ndn )) != NULL ) {
+ /* parent + rdn + separator(s) + null */
+ if( (p = bdb2i_dn2entry_w( be, p_ndn, &matched )) == NULL) {
+ Debug( LDAP_DEBUG_TRACE, "parent does not exist\n",
+ 0, 0, 0);
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ /* check parent for "children" acl */
+ if ( ! access_allowed( be, conn, op, p,
+ "children", NULL, ACL_WRITE ) )
+ {
+ Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,
+ 0, 0 );
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ p_dn = dn_parent( be, e->e_dn );
+
+ Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: parent dn=%s\n",
+ p_dn, 0, 0 );
+
+
+ } else {
+ /* no parent, modrdn entry directly under root */
+ if( ! be_isroot( be, op->o_ndn ) ) {
+ Debug( LDAP_DEBUG_TRACE, "no parent & not root\n",
+ 0, 0, 0);
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: no parent!, working on root\n",
+ 0, 0, 0 );
+
+ }
+
+ new_parent_dn = p_dn; /* New Parent unless newSuperior given */
+
+ if ( (np_dn = newSuperior) != NULL) {
+
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: new parent requested...\n",
+ 0, 0, 0 );
+
+ np_ndn = ch_strdup( np_dn );
+ (void) dn_normalize_case( np_ndn );
+
+ /* newSuperior == oldParent?, if so ==> ERROR */
+
+ /* newSuperior == entry being moved?, if so ==> ERROR */
+
+ /* Get Entry with dn=newSuperior. Does newSuperior exist? */
+
+ if( (np = bdb2i_dn2entry_w( be, np_ndn, &matched )) == NULL) {
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: newSup(ndn=%s) not here!\n",
+ np_ndn, 0, 0);
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: wr to new parent OK np=%p, id=%d\n",
+ np, np->e_id, 0 );
+
+ /* check newSuperior for "children" acl */
+ if ( !access_allowed( be, conn, op, np, "children", NULL,
+ ACL_WRITE ) )
+ {
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: no wr to newSup children\n",
+ 0, 0, 0 );
+ send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: wr to new parent's children OK\n",
+ 0, 0 , 0 );
+
+
+ new_parent_dn = np_dn;
+
+ }
+
+ /* Build target dn and make sure target entry doesn't exist already. */
+
+ build_new_dn( &new_dn, e->e_dn, new_parent_dn, newrdn );
+
+
+ new_ndn = ch_strdup( new_dn );
+ (void) dn_normalize_case( new_ndn );
+
+ Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n",
+ new_ndn, 0, 0 );
+
+ /* check for abandon */
+ ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
+ if ( op->o_abandon ) {
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+ goto return_results;
+ }
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+
+ if ( (bdb2i_dn2id ( be, new_ndn ) ) != NOID ) {
+ send_ldap_result( conn, op, LDAP_ALREADY_EXISTS,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ /* Get attribute type and attribute value of our new rdn, we will
+ * need to add that to our new entry
+ */
+
+ if ( (new_rdn_type = rdn_attr_type( newrdn )) == NULL ) {
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: can't figure out type of newrdn\n",
+ 0, 0, 0 );
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+
+ }
+
+ if ( (new_rdn_val = rdn_attr_value( newrdn )) == NULL ) {
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: can't figure out val of newrdn\n",
+ 0, 0, 0 );
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+
+ }
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: new_rdn_val=%s, new_rdn_type=%s\n",
+ new_rdn_val, new_rdn_type, 0 );
+
+ /* Retrieve the old rdn from the entry's dn */
+
+ if ( (old_rdn = dn_rdn( be, dn )) == NULL ) {
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: can't figure out old_rdn from dn\n",
+ 0, 0, 0 );
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+
+ }
+
+ if ( (old_rdn_type = rdn_attr_type( old_rdn )) == NULL ) {
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: can't figure out the old_rdn type\n",
+ 0, 0, 0 );
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+
+ }
+
+ if ( strcasecmp( old_rdn_type, new_rdn_type ) != 0 ) {
+
+ /* Not a big deal but we may say something */
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: old_rdn_type=%s, new_rdn_type=%s!\n",
+ old_rdn_type, new_rdn_type, 0 );
+
+ }
+
+#ifdef DNS_DN
+ if ( dn_type( old_rdn ) == DN_X500 ) {
+#endif
+
+ Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: DN_X500\n",
+ 0, 0, 0 );
+
+ /* Add new attribute value to the entry.
+ */
+
+ add_bvals[0] = &add_bv; /* Array of bervals */
+ add_bvals[1] = NULL;
+
+ add_bv.bv_val = new_rdn_val;
+ add_bv.bv_len = strlen(new_rdn_val);
+
+ mod[0].ml_type = new_rdn_type;
+ mod[0].ml_bvalues = add_bvals;
+ mod[0].ml_op = LDAP_MOD_SOFTADD;
+ mod[0].ml_next = NULL;
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: adding new rdn attr val =%s\n",
+ new_rdn_val, 0, 0 );
+
+ /* Remove old rdn value if required */
+
+ if (deleteoldrdn) {
+
+ del_bvals[0] = &del_bv; /* Array of bervals */
+ del_bvals[1] = NULL;
+ /* Get value of old rdn */
+
+ if ((old_rdn_val = rdn_attr_value( old_rdn ))
+ == NULL) {
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: can't figure out old_rdn_val from old_rdn\n",
+ 0, 0, 0 );
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+
+
+ }
+
+ /* Remove old value of rdn as an attribute. */
+
+ del_bv.bv_val = old_rdn_val;
+ del_bv.bv_len = strlen(old_rdn_val);
+
+ mod[0].ml_next = &mod[1];
+ mod[1].ml_type = old_rdn_type;
+ mod[1].ml_bvalues = del_bvals;
+ mod[1].ml_op = LDAP_MOD_DELETE;
+ mod[1].ml_next = NULL;
+
+
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: removing old_rdn_val=%s\n",
+ old_rdn_val, 0, 0 );
+
+ }/* if (deleteoldrdn) */
+
+#ifdef DNS_DN
+ } else {
+
+
+ Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: DNS DN\n",
+ 0, 0, 0 );
+ /* XXXV3: not sure of what to do here */
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: not fully implemented...\n",
+ 0, 0, 0 );
+
+ }
+#endif
+
+ /* check for abandon */
+ ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
+ if ( op->o_abandon ) {
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+ goto return_results;
+ }
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+
+ /* delete old one */
+ if ( bdb2i_dn2id_delete( be, e->e_ndn, e->e_id ) != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ (void) bdb2i_cache_delete_entry( &li->li_cache, e );
+
+ free( e->e_dn );
+ free( e->e_ndn );
+ e->e_dn = new_dn;
+ e->e_ndn = new_ndn;
+ new_dn = NULL;
+ new_ndn = NULL;
+
+ /* add new one */
+ if ( bdb2i_dn2id_add( be, e->e_ndn, e->e_id ) != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ /* modify memory copy of entry */
+ if ( bdb2i_back_modify_internal( be, conn, op, dn, &mod[0], e )
+ != 0 ) {
+
+ goto return_results;
+
+ }
+
+ (void) bdb2i_cache_update_entry( &li->li_cache, e );
+
+ /* NOTE: after this you must not free new_dn or new_ndn!
+ * They are used by cache.
+ */
+
+ /* id2entry index */
+ if ( bdb2i_id2entry_add( be, e ) != 0 ) {
+ entry_free( e );
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+ rc = 0;
+
+return_results:
+ if( new_dn != NULL ) free( new_dn );
+ if( new_ndn != NULL ) free( new_ndn );
+
+ /* NOTE:
+ * new_dn and new_ndn are not deallocated because they are used by
+ * the cache entry.
+ */
+ if( p_dn != NULL ) free( p_dn );
+ if( p_ndn != NULL ) free( p_ndn );
+
+ /* LDAP v2 supporting correct attribute handling. */
+ if( new_rdn_type != NULL ) free(new_rdn_type);
+ if( new_rdn_val != NULL ) free(new_rdn_val);
+ if( old_rdn != NULL ) free(old_rdn);
+ if( old_rdn_type != NULL ) free(old_rdn_type);
+ if( old_rdn_val != NULL ) free(old_rdn_val);
+
+ /* LDAP v3 Support */
+ if ( np_dn != NULL ) free( np_dn );
+ if ( np_ndn != NULL ) free( np_ndn );
+
+ if( p != NULL ) {
+ /* free parent and writer lock */
+ bdb2i_cache_return_entry_w( &li->li_cache, p );
+
+ }
+
+ /* free entry and writer lock */
+ bdb2i_cache_return_entry_w( &li->li_cache, e );
+ return( rc );
+}
+
+
+int
+bdb2_back_modrdn(
+ BackendDB *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ char *newrdn,
+ int deleteoldrdn,
+ char *newSuperior
+)
+{
+ DB_LOCK lock;
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( be->bd_info, &time1 );
+
+ if ( bdb2i_enter_backend_w( &lock ) != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ return( -1 );
+
+ }
+
+ ret = bdb2i_back_modrdn_internal( be, conn, op, dn,
+ newrdn, deleteoldrdn,
+ newSuperior );
+
+ (void) bdb2i_leave_backend_w( lock );
+ bdb2i_stop_timing( be->bd_info, time1, "MODRDN", conn, op );
+
+ return( ret );
+}
+
+
/* id.c - keep track of the next id to be given out */
+/* $OpenLDAP$ */
#include "portable.h"
/* porter.c - port functions of the bdb2 backend */
+/* $OpenLDAP$ */
#include "portable.h"
+/* $OpenLDAP$ */
#ifndef _PROTO_BACK_BDB2
#define _PROTO_BACK_BDB2
void bdb2i_attr_masks LDAP_P(( struct ldbminfo *li, char *type, int *indexmask,
int *syntaxmask ));
-void bdb2i_attr_index_config LDAP_P(( struct ldbminfo *li, char *fname,
+void bdb2i_attr_index_config LDAP_P(( struct ldbminfo *li,
+ const char *fname,
int lineno, int argc, char **argv, int init ));
/*
#define bdb2i_cache_return_entry_w(c, e) bdb2i_cache_return_entry_rw((c), (e), 1)
ID bdb2i_cache_find_entry_dn2id LDAP_P(( BackendDB *be, struct cache *cache,
- char *dn ));
+ const char *dn ));
Entry * bdb2i_cache_find_entry_id LDAP_P(( struct cache *cache, ID id, int rw ));
int bdb2i_cache_delete_entry LDAP_P(( struct cache *cache, Entry *e ));
* dn2id.c
*/
-int bdb2i_dn2id_add LDAP_P(( BackendDB *be, char *dn, ID id ));
-ID bdb2i_dn2id LDAP_P(( BackendDB *be, char *dn ));
-int bdb2i_dn2id_delete LDAP_P(( BackendDB *be, char *dn ));
+int bdb2i_dn2id_add LDAP_P(( BackendDB *be, const char *dn, ID id ));
+ID bdb2i_dn2id LDAP_P(( BackendDB *be, const char *dn ));
+int bdb2i_dn2id_delete LDAP_P(( BackendDB *be, const char *dn, ID id ));
ID_BLOCK *
bdb2i_dn2idl LDAP_P((
BackendDB *be,
- char *dn,
+ const char *dn,
int prefix ));
Entry * bdb2i_dn2entry_rw LDAP_P((
BackendDB *be,
- char *dn,
+ const char *dn,
Entry **matched,
int rw ));
/* search.c - bdb2 backend search function */
+/* $OpenLDAP$ */
#include "portable.h"
--- /dev/null
+/* startup.c - startup/shutdown bdb2 backend */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_DIRECT_H
+#include <direct.h>
+#endif
+
+#include "slap.h"
+#include "back-bdb2.h"
+
+#include "db.h"
+
+static void remove_old_locks( char *home );
+
+
+static void
+bdb2i_db_errcall( const char *prefix, char *message )
+{
+ Debug( LDAP_DEBUG_ANY, "bdb2_db_errcall(): %s %s", prefix, message, 0 );
+}
+
+
+/* startup/shutdown per backend type */
+
+static int
+bdb2i_back_startup_internal(
+ BackendInfo *bi
+)
+{
+ struct ldbtype *lty = (struct ldbtype *) bi->bi_private;
+ u_int32_t envFlags;
+ int err = 0;
+ char *home;
+
+ /* set the flags for a full-feldged transaction schema */
+ envFlags = ( DB_CREATE | DB_THREAD | DB_INIT_TXN | DB_INIT_LOG |
+ DB_INIT_LOCK | DB_INIT_MPOOL );
+
+ /* make sure, dbhome is an absolute path */
+ if ( *lty->lty_dbhome != *LDAP_DIRSEP ) {
+ char cwd[MAXPATHLEN];
+
+ (void) getcwd( cwd, MAXPATHLEN );
+ sprintf( cwd, "%s" LDAP_DIRSEP "%s",
+ cwd, lty->lty_dbhome );
+ free( lty->lty_dbhome );
+ lty->lty_dbhome = ch_strdup( cwd );
+
+ }
+ home = lty->lty_dbhome;
+
+ /* general initialization of the environment */
+ memset( &bdb2i_dbEnv, 0, sizeof( DB_ENV ));
+ bdb2i_dbEnv.db_errcall = bdb2i_db_errcall;
+ bdb2i_dbEnv.db_errpfx = "==>";
+
+ /* initialize the lock subsystem */
+ bdb2i_dbEnv.lk_max = 0;
+
+ /* remove old locking tables */
+ remove_old_locks( home );
+
+ /* initialize the mpool subsystem */
+ bdb2i_dbEnv.mp_size = lty->lty_mpsize;
+
+ /* now do the db_appinit */
+ if ( ( err = db_appinit( home, NULL, &bdb2i_dbEnv, envFlags )) ) {
+ char error[BUFSIZ];
+
+ if ( err < 0 ) sprintf( error, "%ld\n", (long) err );
+ else sprintf( error, "%s\n", strerror( err ));
+
+ Debug( LDAP_DEBUG_ANY,
+ "bdb2i_back_startup(): FATAL error in db_appinit() : %s\n",
+ error, 0, 0 );
+ return( 1 );
+
+ }
+
+ return 0;
+}
+
+
+static int
+bdb2i_back_shutdown_internal(
+ BackendInfo *bi
+)
+{
+ struct ldbtype *lty = (struct ldbtype *) bi->bi_private;
+ int err;
+
+ /* remove old locking tables */
+ bdb2i_dbEnv.db_errpfx = "bdb2i_back_shutdown(): lock_unlink:";
+ if ( ( err = lock_unlink( NULL, 1, &bdb2i_dbEnv )) != 0 )
+ Debug( LDAP_DEBUG_ANY, "bdb2i_back_shutdown(): lock_unlink: %s\n",
+ strerror( err ), 0, 0);
+
+ /* remove old memory pool */
+ bdb2i_dbEnv.db_errpfx = "bdb2i_back_shutdown(): memp_unlink:";
+ if ( ( err = memp_unlink( NULL, 1, &bdb2i_dbEnv )) != 0 )
+ Debug( LDAP_DEBUG_ANY, "bdb2i_back_shutdown(): memp_unlink: %s\n",
+ strerror( err ), 0, 0);
+
+ (void) db_appexit( &bdb2i_dbEnv );
+
+ return( 0 );
+}
+
+
+int
+bdb2i_back_startup(
+ BackendInfo *bi
+)
+{
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( bi, &time1 );
+
+ ret = bdb2i_back_startup_internal( bi );
+ bdb2i_stop_timing( bi, time1, "BE-START", NULL, NULL );
+
+ return( ret );
+}
+
+
+int
+bdb2i_back_shutdown(
+ BackendInfo *bi
+)
+{
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( bi, &time1 );
+
+ ret = bdb2i_back_shutdown_internal( bi );
+ bdb2i_stop_timing( bi, time1, "BE-SHUTDOWN", NULL, NULL );
+
+ return( ret );
+}
+
+
+/* startup/shutdown per backend database */
+
+static int
+bdb2i_back_db_startup_internal(
+ BackendDB *be
+)
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+
+ /* if the data directory is not an absolute path, have it relative
+ to the current working directory (which should not be configured !) */
+ if ( *li->li_directory != *LDAP_DIRSEP ) {
+ char cwd[MAXPATHLEN];
+
+ (void) getcwd( cwd, MAXPATHLEN );
+ sprintf( cwd, "%s" LDAP_DIRSEP "%s",
+ cwd, li->li_directory );
+
+ free( li->li_directory );
+ li->li_directory = ch_strdup( cwd );
+
+ }
+
+ /* if there are more index files, add them to the DB file list */
+ if ( bdb2i_check_additional_attr_index( li ) != 0 )
+ return 1;
+
+ /* now open all DB files */
+ if ( bdb2i_txn_open_files( be ) != 0 )
+ return 1;
+
+ return 0;
+}
+
+
+static int
+bdb2i_back_db_shutdown_internal(
+ BackendDB *be
+)
+{
+ return 0;
+}
+
+
+int
+bdb2_back_db_startup(
+ BackendDB *be
+)
+{
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( be->bd_info, &time1 );
+
+ ret = bdb2i_back_db_startup_internal( be );
+ bdb2i_stop_timing( be->bd_info, time1, "DB-START", NULL, NULL );
+
+ return( ret );
+}
+
+
+int
+bdb2_back_db_shutdown(
+ BackendDB *be
+)
+{
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( be->bd_info, &time1 );
+
+ ret = bdb2i_back_db_shutdown_internal( be );
+ bdb2i_stop_timing( be->bd_info, time1, "DB-SHUTDOWN", NULL, NULL );
+
+ return( ret );
+}
+
+
+static void
+remove_old_locks( char *home )
+{
+ DB_ENV dbEnv;
+ int err;
+
+ memset( &dbEnv, 0, sizeof( DB_ENV ));
+ dbEnv.db_errcall = bdb2i_db_errcall;
+ dbEnv.db_errpfx = "remove_old_locks(): db_appinit:";
+ dbEnv.lk_max = 0;
+
+ if ( ( err = db_appinit( home, NULL, &dbEnv, 0 )) != 0 )
+ Debug( LDAP_DEBUG_ANY, "remove_old_locks(): db_appinit: %s\n",
+ strerror( err ), 0, 0);
+
+ dbEnv.db_errpfx = "remove_old_locks(): lock_unlink:";
+ if ( ( err = lock_unlink( NULL, 1, &dbEnv )) != 0 )
+ Debug( LDAP_DEBUG_ANY, "remove_old_locks(): lock_unlink: %s\n",
+ strerror( err ), 0, 0);
+
+ dbEnv.db_errpfx = "remove_old_locks(): db_appexit:";
+ if ( ( err = db_appexit( &dbEnv )) != 0 )
+ Debug( LDAP_DEBUG_ANY, "remove_old_locks(): db_appexit: %s\n",
+ strerror( err ), 0, 0);
+
+}
+
+
--- /dev/null
+/* timing.c - timing bdb2 backend */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+
+
+static char *
+bdb2i_elapsed( struct timeval firsttime, struct timeval secondtime )
+{
+ long int elapsedmicrosec, elapsedsec;
+ char elapsed_string[BUFSIZ];
+
+ elapsedsec = secondtime.tv_sec - firsttime.tv_sec;
+ elapsedmicrosec = secondtime.tv_usec - firsttime.tv_usec;
+ if(elapsedmicrosec < 0) {
+ elapsedmicrosec += 1000000;
+ elapsedsec -= 1;
+ }
+
+ sprintf( elapsed_string, "%ld.%.6ld", elapsedsec, elapsedmicrosec );
+ return( ch_strdup( elapsed_string ));
+}
+
+
+void
+bdb2i_uncond_start_timing(
+ struct timeval *time1
+)
+{
+ gettimeofday( time1, NULL );
+}
+
+
+void
+bdb2i_uncond_stop_timing(
+ struct timeval time1,
+ char *func,
+ Connection *conn,
+ Operation *op,
+ int level
+)
+{
+ struct timeval time2;
+ char *elapsed_time;
+ char buf[BUFSIZ];
+
+ *buf = '\0';
+
+ gettimeofday( &time2, NULL);
+ elapsed_time = bdb2i_elapsed( time1, time2 );
+
+ if ( conn != NULL ) sprintf( buf, "conn=%d ", conn->c_connid );
+ if ( op != NULL ) sprintf( buf, "%sop=%d ", buf, op->o_opid );
+
+ Debug( level, "%s%s elapsed=%s\n", buf, func, elapsed_time );
+
+ free( elapsed_time );
+
+}
+
+
/* tools.c - tools for slap tools */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
rc = bdb2i_cache_store( id2entry, key, data, LDBM_REPLACE );
if( rc != 0 ) {
- (void) bdb2i_dn2id_delete( be, e->e_ndn );
+ (void) bdb2i_dn2id_delete( be, e->e_ndn, e->e_id );
return NOID;
}
/* txn.c - TP support functions of the bdb2 backend */
+/* $OpenLDAP$ */
#include "portable.h"
/* txn.h - Header for TP support functions of the bdb2 backend */
+/* $OpenLDAP$ */
#ifndef _BDB2_TXN_H_
#define _BDB2_TXN_H_
#include <ac/time.h>
#include <ac/unistd.h>
-#include "ldap_defaults.h"
#include "slap.h"
#include "back-bdb2.h"
--- /dev/null
+/* unbind.c - handle an ldap unbind operation */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-bdb2.h"
+
+static int
+bdb2i_back_unbind_internal(
+ BackendDB *be,
+ Connection *conn,
+ Operation *op
+)
+{
+ return( 0 );
+}
+
+
+int
+bdb2_back_unbind(
+ BackendDB *be,
+ Connection *conn,
+ Operation *op
+)
+{
+ struct timeval time1;
+ int ret;
+
+ bdb2i_start_timing( be->bd_info, &time1 );
+
+ ret = bdb2i_back_unbind_internal( be, conn, op );
+ bdb2i_stop_timing( be->bd_info, time1, "UNBIND", conn, op );
+
+ return( ret );
+}
+# $OpenLDAP$
+
SRCS = init.c config.c search.c bind.c unbind.c add.c compare.c \
delete.c modify.c modrdn.c
OBJS = init.lo config.lo search.lo bind.lo unbind.lo add.lo compare.lo \
--- /dev/null
+/* add.c - ldap backend add function */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_add(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ Entry *e
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+ int i;
+ Attribute *a;
+ LDAPMod **attrs;
+
+ lc = ldap_back_getconn(li, conn, op);
+ if (!lc)
+ return( -1 );
+
+ if (!lc->bound) {
+ ldap_back_dobind(lc, op);
+ if (!lc->bound)
+ return( -1 );
+ }
+
+ /* Count number of attributes in entry */
+ for (i=1, a=e->e_attrs; a; i++, a=a->a_next)
+ ;
+
+ /* Create array of LDAPMods for ldap_add() */
+ attrs = (LDAPMod **)ch_malloc(sizeof(LDAPMod *)*i);
+ attrs[i-1] = 0;
+
+ for (i=0, a=e->e_attrs; a; i++, a=a->a_next) {
+ attrs[i] = (LDAPMod *)ch_malloc(sizeof(LDAPMod));
+ attrs[i]->mod_op = LDAP_MOD_BVALUES;
+ attrs[i]->mod_type = a->a_type;
+ attrs[i]->mod_vals.modv_bvals = a->a_vals;
+ }
+
+ ldap_add_s(lc->ld, e->e_dn, attrs);
+ for (--i; i>= 0; --i)
+ free(attrs[i]);
+ free(attrs);
+ return( ldap_back_op_result( lc, op ));
+}
--- /dev/null
+/* back-ldap.h - ldap backend header file */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#ifndef SLAPD_LDAP_H
+#define SLAPD_LDAP_H
+
+#include "external.h"
+
+LDAP_BEGIN_DECL
+
+struct slap_conn;
+struct slap_op;
+
+struct ldapconn {
+ struct ldapconn *next;
+ struct slap_conn *conn;
+ LDAP *ld;
+ int bound;
+};
+
+struct ldapinfo {
+ char *host;
+ int port;
+ char *suffix;
+ ldap_pvt_thread_mutex_t conn_mutex;
+ struct ldapconn *lcs;
+};
+
+struct ldapconn *ldap_back_getconn(struct ldapinfo *li, struct slap_conn *conn,
+ struct slap_op *op);
+void ldap_back_dobind(struct ldapconn *lc, Operation *op);
+int ldap_back_op_result(struct ldapconn *lc, Operation *op);
+int back_ldap_LTX_init_module(int argc, char *argv[]);
+
+LDAP_END_DECL
+
+#endif
--- /dev/null
+/* bind.c - ldap backend bind function */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_bind(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ int method,
+ char *mech,
+ struct berval *cred,
+ char **edn
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+
+ *edn = NULL;
+
+ lc = ldap_back_getconn(li, conn, op);
+ if (!lc)
+ return( -1 );
+
+ if (ldap_bind_s(lc->ld, dn, cred->bv_val, method) != LDAP_SUCCESS)
+ return( ldap_back_op_result(lc, op) );
+
+ lc->bound = 1;
+ return( 0 );
+}
+
+struct ldapconn *
+ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
+{
+ struct ldapconn *lc;
+ LDAP *ld;
+
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
+ for (lc = li->lcs; lc; lc=lc->next)
+ if (lc->conn == conn)
+ break;
+ ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
+
+ /* Looks like we didn't get a bind. Open a new session... */
+ if (!lc) {
+ ld = ldap_init(li->host, li->port);
+ if (!ld) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, "ldap_init failed", NULL, NULL );
+ return( NULL );
+ }
+ lc = (struct ldapconn *)ch_malloc(sizeof(struct ldapconn));
+ lc->conn = conn;
+ lc->ld = ld;
+ lc->bound = 0;
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
+ lc->next = li->lcs;
+ li->lcs = lc;
+ ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
+ }
+ return( lc );
+}
+
+void
+ldap_back_dobind(struct ldapconn *lc, Operation *op)
+{
+ if (lc->bound)
+ return;
+
+ if (ldap_bind_s(lc->ld, lc->conn->c_cdn, NULL, LDAP_AUTH_SIMPLE) !=
+ LDAP_SUCCESS)
+ ldap_back_op_result(lc, op);
+ else
+ lc->bound = 1;
+}
+
+int
+ldap_back_op_result(struct ldapconn *lc, Operation *op)
+{
+ int err;
+ char *msg;
+ char *match;
+
+ ldap_get_option(lc->ld, LDAP_OPT_ERROR_NUMBER, &err);
+ ldap_get_option(lc->ld, LDAP_OPT_ERROR_STRING, &msg);
+ ldap_get_option(lc->ld, LDAP_OPT_MATCHED_DN, &match);
+ send_ldap_result( lc->conn, op, err, match, msg, NULL, NULL );
+ free(match);
+ free(msg);
+ return( (err==LDAP_SUCCESS) ? 0 : -1 );
+}
--- /dev/null
+/* compare.c - ldap backend compare function */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_compare(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ Ava *ava
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+
+ lc = ldap_back_getconn(li, conn, op);
+ if (!lc)
+ return( -1 );
+
+ if (!lc->bound) {
+ ldap_back_dobind(lc, op);
+ if (!lc->bound)
+ return( -1 );
+ }
+
+ ldap_compare_s( lc->ld, dn, ava->ava_type, ava->ava_value.bv_val );
+ return( ldap_back_op_result( lc, op ) );
+}
--- /dev/null
+/* config.c - ldap backend configuration file routine */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_db_config(
+ BackendDB *be,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ char *port;
+
+ if ( li == NULL ) {
+ fprintf( stderr, "%s: line %d: ldap backend info is null!\n",
+ fname, lineno );
+ return( 1 );
+ }
+
+ /* server address to query */
+ if ( strcasecmp( argv[0], "server" ) == 0 ) {
+ if (argc != 2) {
+ fprintf( stderr,
+ "%s: line %d: missing address in \"server <address>\" line\n",
+ fname, lineno );
+ return( 1 );
+ }
+ port=strchr(argv[1],':');
+ if (port) {
+ *port++ = '\0';
+ li->port = atoi(port);
+ }
+ li->host = ch_strdup(argv[1]);
+ /* anything else */
+ } else {
+ fprintf( stderr,
+"%s: line %d: unknown directive \"%s\" in ldap database definition (ignored)\n",
+ fname, lineno, argv[0] );
+ }
+ return 0;
+}
--- /dev/null
+/* delete.c - ldap backend delete function */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_delete(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+
+ lc = ldap_back_getconn( li, conn, op );
+ if (!lc)
+ return( -1 );
+
+ if (!lc->bound) {
+ ldap_back_dobind(lc, op);
+ if (!lc->bound)
+ return( -1 );
+ }
+
+ ldap_delete_s( lc->ld, dn );
+ return( ldap_back_op_result( lc, op ) );
+}
--- /dev/null
+/* $OpenLDAP$ */
+#ifndef _LDAP_EXTERNAL_H
+#define _LDAP_EXTERNAL_H
+
+LDAP_BEGIN_DECL
+
+extern int ldap_back_initialize LDAP_P(( BackendInfo *bi ));
+extern int ldap_back_open LDAP_P(( BackendInfo *bi ));
+extern int ldap_back_close LDAP_P(( BackendInfo *bi ));
+extern int ldap_back_destroy LDAP_P(( BackendInfo *bi ));
+
+extern int ldap_back_db_init LDAP_P(( BackendDB *bd ));
+extern int ldap_back_db_destroy LDAP_P(( BackendDB *bd ));
+
+extern int ldap_back_db_config LDAP_P(( BackendDB *bd,
+ const char *fname, int lineno, int argc, char **argv ));
+
+extern int ldap_back_bind LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, int method, char* mech,
+ struct berval *cred, char** edn ));
+
+extern int ldap_back_conn_destroy LDAP_P(( BackendDB *bd,
+ Connection *conn ));
+
+extern int ldap_back_search LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *base, int scope, int deref, int sizelimit, int timelimit,
+ Filter *filter, char *filterstr, char **attrs, int attrsonly ));
+
+extern int ldap_back_compare LDAP_P((BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, Ava *ava ));
+
+extern int ldap_back_modify LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, LDAPModList *ml ));
+
+extern int ldap_back_modrdn LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, char*newrdn, int deleteoldrdn,
+ char *newSuperior ));
+
+extern int ldap_back_add LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op, Entry *e ));
+
+extern int ldap_back_delete LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op, char *dn ));
+
+extern int ldap_back_abandon LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op, int msgid ));
+
+LDAP_END_DECL
+
+#endif /* _LDAP_EXTERNAL_H */
+
/* init.c - initialize ldap backend */
+/* $OpenLDAP$ */
/*
* Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
--- /dev/null
+/* modify.c - ldap backend modify function */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_modify(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ LDAPModList *ml
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+ LDAPMod **mods;
+ LDAPModList *m;
+ int i;
+
+ lc = ldap_back_getconn(li, conn, op);
+ if (!lc)
+ return( -1 );
+
+ if (!lc->bound) {
+ ldap_back_dobind(lc, op);
+ if (!lc->bound)
+ return( -1 );
+ }
+
+ for (i=1, m=ml->ml_next; m; i++,m=m->ml_next)
+ ;
+ mods = (LDAPMod **)ch_malloc((i+1)*sizeof(LDAPMod *));
+ mods[i] = 0;
+
+ for (i=0, m=ml; m; i++, m=m->ml_next)
+ mods[i] = &m->ml_mod;
+
+ ldap_modify_s( lc->ld, dn, mods );
+ free(mods);
+ return( ldap_back_op_result( lc, op ));
+}
--- /dev/null
+/* modrdn.c - ldap backend modrdn function */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_modrdn(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ char *newrdn,
+ int deleteoldrdn,
+ char *newSuperior
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+
+ lc = ldap_back_getconn( li, conn, op );
+ if (!lc)
+ return( -1 );
+
+ if (newSuperior) {
+ int version = LDAP_VERSION3;
+ ldap_set_option( lc->ld, LDAP_OPT_PROTOCOL_VERSION, &version);
+ }
+
+ if (!lc->bound) {
+ ldap_back_dobind(lc, op);
+ if (!lc->bound)
+ return( -1 );
+ }
+
+ ldap_rename2_s( lc->ld, dn, newrdn, deleteoldrdn, newSuperior );
+ return( ldap_back_op_result( lc, op ) );
+}
--- /dev/null
+/* search.c - ldap backend search function */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+static void ldap_send_entry( Backend *be, Operation *op, struct ldapconn *lc,
+ LDAPMessage *e, char **attrs, int attrsonly );
+
+int
+ldap_back_search(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *base,
+ int scope,
+ int deref,
+ int size,
+ int time,
+ Filter *filter,
+ char *filterstr,
+ char **attrs,
+ int attrsonly
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc;
+ struct timeval tv;
+ LDAPMessage *res, *e;
+ int i, rc, msgid, sres = LDAP_SUCCESS;
+ char *match = NULL, *err = NULL;
+
+ lc = ldap_back_getconn(li, conn, op);
+ if (!lc)
+ return( -1 );
+
+ if (deref != -1)
+ ldap_set_option( lc->ld, LDAP_OPT_DEREF, (void *)&deref);
+ if (time != -1)
+ ldap_set_option( lc->ld, LDAP_OPT_TIMELIMIT, (void *)&time);
+ if (size != -1)
+ ldap_set_option( lc->ld, LDAP_OPT_SIZELIMIT, (void *)&size);
+ if (!lc->bound) {
+ ldap_back_dobind(lc, op);
+ if (!lc->bound)
+ return( -1 );
+ }
+
+ if ((msgid = ldap_search(lc->ld, base, scope, filterstr, attrs,
+ attrsonly)) == -1)
+fail: return( ldap_back_op_result(lc, op) );
+
+ /* We pull apart the ber result, stuff it into a slapd entry, and
+ * let send_search_entry stuff it back into ber format. Slow & ugly,
+ * but this is necessary for version matching, and for ACL processing.
+ */
+
+ for (i=0, rc=0; rc != -1;
+ rc = ldap_result(lc->ld, LDAP_RES_ANY, 0, &tv, &res)) {
+ int ab;
+
+ /* check for abandon */
+ ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
+ ab = op->o_abandon;
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+
+ if (ab) {
+ ldap_abandon(lc->ld, msgid);
+ } else if (rc == 0) {
+ tv.tv_sec = 0;
+ tv.tv_usec = 100000;
+ ldap_pvt_thread_yield();
+ continue;
+ } else if (rc == LDAP_RES_SEARCH_ENTRY) {
+ e = ldap_first_entry(lc->ld,res);
+ ldap_send_entry(be, op, lc, e, attrs, attrsonly);
+ i++;
+ ldap_msgfree(res);
+ } else {
+ sres = ldap_result2error(lc->ld, res, 1);
+ ldap_get_option(lc->ld, LDAP_OPT_ERROR_STRING, &err);
+ ldap_get_option(lc->ld, LDAP_OPT_MATCHED_DN, &match);
+ rc = 0;
+ }
+ if (ab)
+ return (0);
+ else if (rc == 0)
+ break;
+ }
+
+ if (rc == -1)
+ goto fail;
+
+ send_search_result( conn, op, sres,
+ match, err, NULL, NULL, i );
+ if (match)
+ free(match);
+ if (err)
+ free(err);
+ return( 0 );
+}
+
+static void
+ldap_send_entry(
+ Backend *be,
+ Operation *op,
+ struct ldapconn *lc,
+ LDAPMessage *e,
+ char **attrs,
+ int attrsonly
+)
+{
+ char *a;
+ Entry ent;
+ BerElement *ber = NULL;
+ Attribute *attr, **attrp;
+ struct berval *dummy = NULL;
+
+ ent.e_dn = ldap_get_dn(lc->ld, e);
+ ent.e_ndn = ch_strdup( ent.e_dn);
+ (void) dn_normalize_case( ent.e_ndn );
+ ent.e_id = 0;
+ ent.e_attrs = 0;
+ ent.e_private = 0;
+ attrp = &ent.e_attrs;
+
+ for (a = ldap_first_attribute(lc->ld, e, &ber); a;
+ a = ldap_next_attribute(lc->ld, e, ber)) {
+ attr = (Attribute *)ch_malloc( sizeof(Attribute) );
+ attr->a_next = 0;
+ attr->a_type = ch_strdup(a);
+ attr->a_syntax = attr_syntax(a);
+ attr->a_vals = ldap_get_values_len(lc->ld, e, a);
+ if (!attr->a_vals)
+ attr->a_vals = &dummy;
+ *attrp = attr;
+ attrp = &attr->a_next;
+ }
+ send_search_entry( be, lc->conn, op, &ent, attrs, attrsonly, NULL );
+ for (;ent.e_attrs;) {
+ attr=ent.e_attrs;
+ ent.e_attrs = attr->a_next;
+ free(attr->a_type);
+ if (attr->a_vals != &dummy)
+ ber_bvecfree(attr->a_vals);
+ free(attr);
+ }
+ if (ber)
+ ber_free(ber,0);
+}
--- /dev/null
+/* unbind.c - ldap backend unbind function */
+/* $OpenLDAP$ */
+
+/*
+ * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
+ *
+ * Permission is granted to anyone to use this software for any purpose
+ * on any computer system, and to alter it and redistribute it, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ * software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ * explicit claim or by omission. Since few users ever read sources,
+ * credits should appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software. Since few users
+ * ever read sources, credits should appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-ldap.h"
+
+int
+ldap_back_conn_destroy(
+ Backend *be,
+ Connection *conn
+)
+{
+ struct ldapinfo *li = (struct ldapinfo *) be->be_private;
+ struct ldapconn *lc, *lp;
+
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
+ for (lc = li->lcs, lp = (struct ldapconn *)&li->lcs; lc;
+ lp=lc, lc=lc->next)
+ if (lc->conn == conn) {
+ lp->next = lc->next;
+ break;
+ }
+ ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
+
+ if (lc) {
+ if (lc->bound)
+ ldap_unbind(lc->ld);
+ free(lc);
+ }
+
+ /* no response to unbind */
+
+ return 0;
+}
+# $OpenLDAP$
+
SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c entry.c id2entry.c \
index.c id2children.c nextid.c abandon.c compare.c group.c \
modify.c modrdn.c delete.c init.c config.c bind.c attr.c \
/* abandon.c - ldbm backend abandon routine */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* add.c - ldap ldbm back-end add routine */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
if ( id2entry_add( be, e ) != 0 ) {
Debug( LDAP_DEBUG_TRACE, "id2entry_add failed\n", 0,
0, 0 );
- (void) dn2id_delete( be, e->e_ndn );
+ (void) dn2id_delete( be, e->e_ndn, e->e_id );
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
NULL, NULL, NULL, NULL );
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+#include <ac/string.h>
+#include <ac/socket.h>
+#include "slap.h"
+#include "back-ldbm.h"
+#include "proto-back-ldbm.h"
+
+
+static char* get_alias_dn(
+ Entry *e,
+ int *err,
+ char **errmsg );
+
+static char* new_superior(
+ char *dn,
+ char *oldSup,
+ char *newSup );
+
+static int dnlist_subordinate(
+ char** dnlist,
+ char *dn );
+
+Entry *deref_internal_r(
+ Backend* be,
+ Entry* alias,
+ char* dn,
+ int* err,
+ Entry** matched,
+ char** text )
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ Entry *entry;
+ Entry *sup;
+ unsigned depth;
+ char **dnlist;
+
+ assert( ( alias != NULL && dn == NULL ) || ( alias == NULL && dn != NULL ) );
+
+ *matched = NULL;
+ *err = LDAP_SUCCESS;
+ *text = NULL;
+
+ if( alias == NULL ) {
+ dn = ch_strdup( dn );
+ entry = dn2entry_r( be, dn, &sup );
+
+ } else {
+ dn = ch_strdup( alias->e_ndn );
+ entry = alias;
+ sup = NULL;
+ }
+
+ dnlist = NULL;
+ charray_add( &dnlist, dn );
+
+ for( depth=0 ; ; depth++ ) {
+ if( entry != NULL ) {
+ Entry *newe;
+ char *aliasDN;
+
+ /* have entry, may be an alias */
+
+ if( !is_entry_alias( entry ) ) {
+ /* entry is not an alias */
+ break;
+ }
+
+ /* entry is alias */
+ if( depth > be->be_max_deref_depth ) {
+ *matched = entry;
+ entry = NULL;
+ *err = LDAP_ALIAS_DEREF_PROBLEM;
+ *text = "maximum deref depth exceeded";
+ break;
+ }
+
+ /* deref entry */
+ aliasDN = get_alias_dn( entry, err, text );
+
+ if( aliasDN == NULL ) {
+ *matched = entry;
+ entry = NULL;
+ break;
+ }
+
+ /* check if aliasDN is a subordinate of any DN in our list */
+ if( dnlist_subordinate( dnlist, aliasDN ) ) {
+ *matched = entry;
+ entry = NULL;
+ *err = LDAP_ALIAS_PROBLEM;
+ *text = "circular alias";
+ break;
+ }
+
+ /* attempt to dereference alias */
+
+ newe = dn2entry_r( be, aliasDN, &sup );
+
+ if( newe != NULL ) {
+ free( dn );
+ cache_return_entry_r(&li->li_cache, entry );
+ entry = newe;
+ dn = ch_strdup( entry->e_ndn );
+ charray_add( &dnlist, dn );
+ continue;
+
+ }
+
+ if ( sup != NULL ) {
+ cache_return_entry_r(&li->li_cache, entry );
+ entry = NULL;
+ continue;
+ }
+
+ /* no newe and no superior, we're done */
+ break;
+
+ } else if( sup != NULL ) {
+ /* have superior, may be an alias */
+ Entry *newe;
+ Entry *newSup;
+ char *supDN;
+ char *aliasDN;
+
+ if( !is_entry_alias( sup ) ) {
+ /* entry is not an alias */
+ *matched = sup;
+ sup = NULL;
+ break;
+ }
+
+ /* entry is alias */
+ if( depth > be->be_max_deref_depth ) {
+ *matched = sup;
+ entry = NULL;
+ *err = LDAP_ALIAS_DEREF_PROBLEM;
+ *text = "maximum deref depth exceeded";
+ break;
+ }
+
+ /* deref entry */
+ supDN = get_alias_dn( sup, err, text );
+
+ if( supDN == NULL ) {
+ *matched = sup;
+ break;
+ }
+
+ aliasDN = new_superior( dn, sup->e_ndn, supDN );
+
+ if( aliasDN == NULL ) {
+ free(aliasDN);
+ *matched = sup;
+ *err = LDAP_ALIAS_PROBLEM;
+ *text = "superior alias problem";
+ break;
+ }
+
+ /* check if aliasDN is a subordinate of any DN in our list */
+ if( dnlist_subordinate( dnlist, aliasDN ) ) {
+ free(aliasDN);
+ *matched = entry;
+ entry = NULL;
+ *err = LDAP_ALIAS_PROBLEM;
+ *text = "subordinate circular alias";
+ break;
+ }
+
+ /* attempt to dereference alias */
+ newe = dn2entry_r( be, aliasDN, &newSup );
+
+ if( newe != NULL ) {
+ free(aliasDN);
+ free( dn );
+ cache_return_entry_r(&li->li_cache, sup );
+ entry = newe;
+ dn = ch_strdup( entry->e_ndn );
+ charray_add( &dnlist, dn );
+ continue;
+
+ }
+
+ if ( newSup != NULL ) {
+ free( dn );
+ cache_return_entry_r(&li->li_cache, sup );
+ sup = newSup;
+ dn = aliasDN;
+ continue;
+ }
+
+ break;
+
+ } else {
+ /* no newe and no superior, we're done */
+ break;
+ }
+ }
+
+ free( dn );
+ return entry;
+}
+
+
+static char* get_alias_dn(
+ Entry *e,
+ int *err,
+ char **errmsg )
+{
+ Attribute *a = attr_find( e->e_attrs, "aliasedobjectname" );
+
+ if( a == NULL ) {
+ /*
+ * there was an aliasedobjectname defined but no data.
+ */
+ *err = LDAP_ALIAS_PROBLEM;
+ *errmsg = "alias missing aliasedObjectName attribute";
+ return NULL;
+ }
+
+ /*
+ * aliasedObjectName should be SINGLE-VALUED with a single value.
+ */
+ if ( a->a_vals[0] == NULL || a->a_vals[0]->bv_val == NULL ) {
+ /*
+ * there was an aliasedobjectname defined but no data.
+ */
+ *err = LDAP_ALIAS_PROBLEM;
+ *errmsg = "alias missing aliasedObjectName value";
+ return NULL;
+ }
+
+ if( a->a_vals[1] != NULL ) {
+ *err = LDAP_ALIAS_PROBLEM;
+ *errmsg = "alias has multivalued aliasedObjectName";
+ return NULL;
+ }
+
+ return a->a_vals[0]->bv_val;
+}
+
+char* new_superior(
+ char *dn,
+ char *oldSup,
+ char *newSup )
+{
+ char *newDN;
+ size_t dnlen, olen, nlen;
+ assert( dn && oldSup && newSup );
+
+ dnlen = strlen( dn );
+ olen = strlen( oldSup );
+ nlen = strlen( newSup );
+
+ newDN = ch_malloc( dnlen - olen + nlen + 1 );
+
+ memcpy( newDN, dn, dnlen - olen );
+ memcpy( &newDN[dnlen - olen], newSup, nlen );
+ newDN[dnlen - olen + nlen] = '\0';
+
+ return newDN;
+}
+
+static int dnlist_subordinate(
+ char** dnlist,
+ char *dn )
+{
+ int i;
+ assert( dnlist );
+
+ for( i = 0; dnlist[i] != NULL; i++ ) {
+ if( dn_issuffix( dnlist[i], dn ) ) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
/* attr.c - backend routines for dealing with attributes */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
void
attr_index_config(
struct ldbminfo *li,
- char *fname,
+ const char *fname,
int lineno,
int argc,
char **argv,
/* back-ldbm.h - ldap ldbm back-end header file */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* bind.c - ldbm backend bind and unbind routines */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* cache.c - routines to maintain an in-core cache of entries */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
cache_find_entry_dn2id(
Backend *be,
Cache *cache,
- char *dn
+ const char *dn
)
{
Entry e, *ep;
ID id;
int count = 0;
- e.e_dn = dn;
+ e.e_dn = (char *) dn;
e.e_ndn = ch_strdup( dn );
(void) dn_normalize_case( e.e_ndn );
/* close.c - close ldbm backend */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* compare.c - ldbm backend compare routine */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* config.c - ldbm backend configuration file routine */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
int
ldbm_back_db_config(
Backend *be,
- char *fname,
+ const char *fname,
int lineno,
int argc,
char **argv
/* ldbmcache.c - maintain a cache of open ldbm files */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <sys/param.h>
#endif
-#include "ldap_defaults.h"
#include "slap.h"
#include "back-ldbm.h"
/* delete.c - ldbm backend delete routine */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- Entry *matched = NULL;
+ Entry *matched;
char *pdn = NULL;
Entry *e, *p = NULL;
int rootlock = 0;
/* delete from parent's id2children entry */
if( (pdn = dn_parent( be, e->e_ndn )) != NULL ) {
- if( (p = dn2entry_w( be, pdn, &matched )) == NULL) {
+ if( (p = dn2entry_w( be, pdn, NULL )) == NULL) {
Debug( LDAP_DEBUG_TRACE,
"<=- ldbm_back_delete: parent does not exist\n",
0, 0, 0);
}
/* delete from dn2id mapping */
- if ( dn2id_delete( be, e->e_ndn ) != 0 ) {
+ if ( dn2id_delete( be, e->e_ndn, e->e_id ) != 0 ) {
Debug(LDAP_DEBUG_ARGS,
"<=- ldbm_back_delete: operations error %s\n",
dn, 0, 0);
/* free entry and writer lock */
cache_return_entry_w( &li->li_cache, e );
- if ( matched != NULL ) free(matched);
-
return rc;
}
/* dn2id.c - routines to deal with the dn2id index */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
int
dn2id_add(
Backend *be,
- char *dn,
+ const char *dn,
ID id
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
Debug( LDAP_DEBUG_TRACE, "=> dn2id_add( \"%s\", %ld )\n", dn, id, 0 );
+ assert( id != NOID );
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
charray_free( subtree );
}
-
}
ldbm_cache_close( be, db );
ID
dn2id(
Backend *be,
- char *dn
+ const char *dn
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
(void) memcpy( (char *) &id, data.dptr, sizeof(ID) );
+ assert( id != NOID );
+
ldbm_datum_free( db->dbc_db, data );
Debug( LDAP_DEBUG_TRACE, "<= dn2id %ld\n", id, 0, 0 );
ID_BLOCK *
dn2idl(
Backend *be,
- char *dn,
+ const char *dn,
int prefix
)
{
int
dn2id_delete(
Backend *be,
- char *dn
+ const char *dn,
+ ID id
)
{
DBCache *db;
Datum key;
int rc;
- Debug( LDAP_DEBUG_TRACE, "=> dn2id_delete( \"%s\" )\n", dn, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "=> dn2id_delete( \"%s\", %ld )\n", dn, id, 0 );
+
+ assert( id != NOID );
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
return( -1 );
}
+
+ {
+ char *pdn = dn_parent( NULL, dn );
+
+ if( pdn != NULL ) {
+ ldbm_datum_init( key );
+ key.dsize = strlen( pdn ) + 2;
+ key.dptr = ch_malloc( key.dsize );
+ sprintf( key.dptr, "%c%s", DN_ONE_PREFIX, pdn );
+
+ (void) idl_delete_key( be, db, key, id );
+
+ free( key.dptr );
+ free( pdn );
+ }
+ }
+
+ {
+ char **subtree = dn_subtree( NULL, dn );
+
+ if( subtree != NULL ) {
+ int i;
+ for( i=0; subtree[i] != NULL; i++ ) {
+ ldbm_datum_init( key );
+ key.dsize = strlen( subtree[i] ) + 2;
+ key.dptr = ch_malloc( key.dsize );
+ sprintf( key.dptr, "%c%s",
+ DN_SUBTREE_PREFIX, subtree[i] );
+
+ (void) idl_delete_key( be, db, key, id );
+
+ free( key.dptr );
+ }
+
+ charray_free( subtree );
+ }
+ }
+
ldbm_datum_init( key );
key.dsize = strlen( dn ) + 2;
Entry *
dn2entry_rw(
Backend *be,
- char *dn,
+ const char *dn,
Entry **matched,
int rw
)
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id;
Entry *e = NULL;
char *pdn;
/* entry.c - ldbm backend entry_release routine */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
extern int ldbm_back_db_destroy LDAP_P(( BackendDB *bd ));
extern int ldbm_back_db_config LDAP_P(( BackendDB *bd,
- char *fname, int lineno, int argc, char **argv ));
+ const char *fname, int lineno, int argc, char **argv ));
extern int ldbm_back_bind LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
Connection *conn, Operation *op, ber_int_t msgid ));
extern int ldbm_back_group LDAP_P(( BackendDB *bd,
- Entry *target, char* gr_ndn, char* op_ndn,
- char* objectclassValue, char* groupattrName));
+ Entry *target, const char* gr_ndn, const char* op_ndn,
+ const char* objectclassValue, const char* groupattrName));
/* hooks for slap tools */
/* filterindex.c - generate the list of candidate entries from a filter */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* group.c - ldbm backend acl group routine */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
ldbm_back_group(
Backend *be,
Entry *target,
- char *gr_ndn,
- char *op_ndn,
- char *objectclassValue,
- char *groupattrName
+ const char *gr_ndn,
+ const char *op_ndn,
+ const char *objectclassValue,
+ const char *groupattrName
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
goto return_results;
}
- bv.bv_val = objectclassValue;
+ bv.bv_val = (char *) objectclassValue;
bv.bv_len = strlen( bv.bv_val );
if (value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) {
"<= ldbm_back_group: found objectClass %s and %s\n",
objectclassValue, groupattrName, 0 );
- bv.bv_val = op_ndn;
+ bv.bv_val = (char *) op_ndn;
bv.bv_len = strlen( op_ndn );
if( value_find( attr->a_vals, &bv, attr->a_syntax, 1) != 0 )
/* id2children.c - routines to deal with the id2children index */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* id2entry.c - routines to deal with the id2entry index */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* idl.c - ldap id list handling routines */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/string.h>
#include <ac/socket.h>
-#include "ldap_defaults.h"
#include "slap.h"
#include "back-ldbm.h"
return NULL;
}
- idl = idl_dup( (ID_BLOCK *) data.dptr);
+ idl = idl_dup((ID_BLOCK *) data.dptr);
+
ldbm_datum_free( db->dbc_db, data );
- return( idl );
+ return idl;
}
rc = idl_change_first( be, db, key, idl, i, k2, tmp );
break;
- case 2: /* id not inserted - already there */
+ case 2: /* id not inserted - already there, do nothing */
+ rc = 0;
break;
case 3: /* id not inserted - block is full */
Debug( LDAP_DEBUG_ANY,
"idl_fetch_one (%s) returns NULL\n",
k2.dptr, 0, 0 );
- break;
+ /* split the original block */
+ goto split;
}
switch ( (rc = idl_insert( &tmp2, id,
case 3: /* split the original block */
break;
}
+
idl_free( tmp2 );
}
+split:
/*
* must split the block, write both new blocks + update
* and write the indirect header block.
*/
+ rc = 0; /* optimistic */
+
+
/* count how many indirect blocks *//* XXX linear count XXX */
for ( j = 0; !ID_BLOCK_NOID(idl, j); j++ )
; /* NULL */
}
/* make a slot for the new id */
- SAFEMEMCPY( &ID_BLOCK_ID(*idl, i), &ID_BLOCK_ID(*idl, i+1),
- ID_BLOCK_NIDS(*idl) - i );
+ SAFEMEMCPY( &ID_BLOCK_ID(*idl, i+1), &ID_BLOCK_ID(*idl, i),
+ (ID_BLOCK_NIDS(*idl) - i) * sizeof(ID) );
ID_BLOCK_ID(*idl, i) = id;
ID_BLOCK_NIDS(*idl)++;
)
{
Datum data;
- ID_BLOCK *idl, *tmp;
+ ID_BLOCK *idl;
unsigned i;
int j, nids;
char *kstr;
for ( j = 0; !ID_BLOCK_NOID(idl, j); j++ )
{
+ ID_BLOCK *tmp;
ldbm_datum_init( data );
sprintf( kstr, "%c%ld%s", CONT_PREFIX,
ID_BLOCK_ID(idl, j), key.dptr );
/* index.c - routines for dealing with attribute indexes */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* init.c - initialize ldbm backend */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* kerberos.c - ldbm backend kerberos bind routines */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* modify.c - ldbm backend modify routine */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* modrdn.c - ldbm backend modrdn routine */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
char *p_dn = NULL, *p_ndn = NULL;
char *new_dn = NULL, *new_ndn = NULL;
Entry *e, *p = NULL;
- Entry *matched = NULL;
+ Entry *matched;
int rootlock = 0;
int rc = -1;
/* Added to support LDAP v2 correctly (deleteoldrdn thing) */
char *new_rdn_val = NULL; /* Val of new rdn */
char *new_rdn_type = NULL; /* Type of new rdn */
- char *old_rdn; /* Old rdn's attr type & val */
+ char *old_rdn = NULL; /* Old rdn's attr type & val */
char *old_rdn_type = NULL; /* Type of old rdn attr. */
char *old_rdn_val = NULL; /* Old rdn attribute value */
/* Added to support newSuperior */
* children.
*/
- if( (p = dn2entry_w( be, p_ndn, &matched )) == NULL) {
+ if( (p = dn2entry_w( be, p_ndn, NULL )) == NULL) {
Debug( LDAP_DEBUG_TRACE, "parent does not exist\n",
0, 0, 0);
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
/* newSuperior == entry being moved?, if so ==> ERROR */
/* Get Entry with dn=newSuperior. Does newSuperior exist? */
- if( (np = dn2entry_w( be, np_ndn, &matched )) == NULL) {
+ if( (np = dn2entry_w( be, np_ndn, NULL )) == NULL) {
Debug( LDAP_DEBUG_TRACE,
"ldbm_back_modrdn: newSup(ndn=%s) not here!\n",
np_ndn, 0, 0);
}
Debug( LDAP_DEBUG_TRACE,
- "ldbm_back_modrdn: wr to new parent OK np=%p, id=%d\n",
+ "ldbm_back_modrdn: wr to new parent OK np=%p, id=%ld\n",
np, np->e_id, 0 );
/* check newSuperior for "children" acl */
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n",
new_ndn, 0, 0 );
- if (dn2id ( be, new_ndn ) != NOID) {
- send_ldap_result( conn, op, LDAP_ALREADY_EXISTS,
- NULL, NULL, NULL, NULL );
- goto return_results;
- }
-
- Debug( LDAP_DEBUG_TRACE,
- "ldbm_back_modrdn: new ndn=%s does not exist\n",
- new_ndn, 0, 0 );
-
/* check for abandon */
ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
if ( op->o_abandon ) {
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
goto return_results;
}
- ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
-
- /* delete old one */
- if ( dn2id_delete( be, e->e_ndn ) != 0 ) {
- send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
- NULL, NULL, NULL, NULL );
- goto return_results;
- }
- (void) cache_delete_entry( &li->li_cache, e );
- free( e->e_dn );
- free( e->e_ndn );
- e->e_dn = new_dn;
- e->e_ndn = new_ndn;
-
- /* add new one */
- if ( dn2id_add( be, e->e_ndn, e->e_id ) != 0 ) {
- send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+ if (dn2id ( be, new_ndn ) != NOID) {
+ send_ldap_result( conn, op, LDAP_ALREADY_EXISTS,
NULL, NULL, NULL, NULL );
goto return_results;
}
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm_back_modrdn: new ndn=%s does not exist\n",
+ new_ndn, 0, 0 );
/* Get attribute type and attribute value of our new rdn, we will
* need to add that to our new entry
}
#endif
+ /* check for abandon */
+ ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
+ if ( op->o_abandon ) {
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+ goto return_results;
+ }
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+
+ /* delete old one */
+ if ( dn2id_delete( be, e->e_ndn, e->e_id ) != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
+ (void) cache_delete_entry( &li->li_cache, e );
+
+ /* XXX: there is no going back! */
+
+ free( e->e_dn );
+ free( e->e_ndn );
+ e->e_dn = new_dn;
+ e->e_ndn = new_ndn;
+ new_dn = NULL;
+ new_ndn = NULL;
+
+ /* add new one */
+ if ( dn2id_add( be, e->e_ndn, e->e_id ) != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+ goto return_results;
+ }
+
/* modify memory copy of entry */
if ( ldbm_modify_internal( be, conn, op, dn, &mod[0], e )
!= 0 ) {
goto return_results;
-
}
(void) cache_update_entry( &li->li_cache, e );
entry_free( e );
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
NULL, NULL, NULL, NULL );
- goto return_results_after;
+ goto return_results;
}
send_ldap_result( conn, op, LDAP_SUCCESS,
NULL, NULL, NULL, NULL );
rc = 0;
- goto return_results_after;
return_results:
if( new_dn != NULL ) free( new_dn );
if( new_ndn != NULL ) free( new_ndn );
-return_results_after:
- /* NOTE:
- * new_dn and new_ndn are not deallocated because they are used by
- * the cache entry.
- */
if( p_dn != NULL ) free( p_dn );
if( p_ndn != NULL ) free( p_ndn );
- if( matched != NULL ) free( matched );
-
/* LDAP v2 supporting correct attribute handling. */
if( new_rdn_type != NULL ) free(new_rdn_type);
if( new_rdn_val != NULL ) free(new_rdn_val);
/* nextid.c - keep track of the next id to be given out */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
static ID
next_id_read( Backend *be )
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id = NOID;
Datum key, data;
DBCache *db;
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
void attr_masks LDAP_P(( struct ldbminfo *li, char *type, int *indexmask,
int *syntaxmask ));
-void attr_index_config LDAP_P(( struct ldbminfo *li, char *fname, int lineno,
- int argc, char **argv, int init ));
+void attr_index_config LDAP_P(( struct ldbminfo *li,
+ const char *fname, int lineno,
+ int argc, char **argv, int init ));
void attr_index_destroy LDAP_P(( Avlnode *tree ));
/*
#define cache_return_entry_r(c, e) cache_return_entry_rw((c), (e), 0)
#define cache_return_entry_w(c, e) cache_return_entry_rw((c), (e), 1)
-ID cache_find_entry_dn2id LDAP_P(( Backend *be, Cache *cache, char *dn ));
+ID cache_find_entry_dn2id LDAP_P(( Backend *be, Cache *cache, const char *dn ));
Entry * cache_find_entry_id LDAP_P(( Cache *cache, ID id, int rw ));
int cache_delete_entry LDAP_P(( Cache *cache, Entry *e ));
void cache_release_all LDAP_P(( Cache *cache ));
* dn2id.c
*/
-int dn2id_add LDAP_P(( Backend *be, char *dn, ID id ));
-ID dn2id LDAP_P(( Backend *be, char *dn ));
-ID_BLOCK *dn2idl LDAP_P(( Backend *be, char *dn, int prefix ));
-int dn2id_delete LDAP_P(( Backend *be, char *dn ));
+int dn2id_add LDAP_P(( Backend *be, const char *dn, ID id ));
+ID dn2id LDAP_P(( Backend *be, const char *dn ));
+ID_BLOCK *dn2idl LDAP_P(( Backend *be, const char *dn, int prefix ));
+int dn2id_delete LDAP_P(( Backend *be, const char *dn, ID id ));
-Entry * dn2entry_rw LDAP_P(( Backend *be, char *dn, Entry **matched, int rw ));
+Entry * dn2entry_rw LDAP_P(( Backend *be, const char *dn, Entry **matched, int rw ));
#define dn2entry_r(be, dn, m) dn2entry_rw((be), (dn), (m), 0)
#define dn2entry_w(be, dn, m) dn2entry_rw((be), (dn), (m), 1)
/* search.c - ldbm backend search function */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
rc = 0;
done:
- idl_free( candidates );
+ if( candidates != NULL )
+ idl_free( candidates );
ber_bvecfree( v2refs );
if( realbase ) free( realbase );
int manageDSAit
)
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID_BLOCK *candidates;
Filter *f, *rf, *af, *lf;
/* startup.c - startup ldbm backend */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/string.h>
#include <ac/socket.h>
-#include "ldap_defaults.h"
#include "slap.h"
#include "back-ldbm.h"
#else
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
DB_ENV *dbEnv = &li->li_db_env;
- int envFlags = DB_CREATE | DB_THREAD;
+ u_int32_t envFlags = DB_CREATE | DB_THREAD;
int err = 0;
char *home;
/* tools.c - tools for slap tools */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
rc = ldbm_cache_store( id2entry, key, data, LDBM_REPLACE );
if( rc != 0 ) {
- (void) dn2id_delete( be, e->e_ndn );
+ (void) dn2id_delete( be, e->e_ndn, e->e_id );
return NOID;
}
/* unbind.c - handle an ldap unbind operation */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+# $OpenLDAP$
+
SRCS = search.c config.c init.c
OBJS = search.lo config.lo init.lo
/* config.c - passwd backend configuration file routine */
+/* $OpenLDAP$ */
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include "slap.h"
+#include "external.h"
-passwd_back_config(
- Backend *be,
- char *fname,
+int
+passwd_back_db_config(
+ BackendDB *be,
+ const char *fname,
int lineno,
int argc,
char **argv
fprintf( stderr,
"%s: line %d: missing filename in \"file <filename>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
- be->be_private = strdup( argv[1] );
+ be->be_private = ch_strdup( argv[1] );
#else /* HAVE_SETPWFILE */
fprintf( stderr,
"%s: line %d: ignoring \"file\" option (not supported on this platform)\n",
"%s: line %d: unknown directive \"%s\" in passwd database definition (ignored)\n",
fname, lineno, argv[0] );
}
+
+ return( 0 );
}
--- /dev/null
+/* $OpenLDAP$ */
+#ifndef _PASSWD_EXTERNAL_H
+#define _PASSWD_EXTERNAL_H
+
+LDAP_BEGIN_DECL
+
+extern int passwd_back_initialize LDAP_P(( BackendInfo *bi ));
+
+extern int passwd_back_search LDAP_P(( BackendDB *be,
+ Connection *c, Operation *o,
+ char *base, int scope, int deref, int slimit, int tlimit,
+ Filter *f, char *filterstr, char **attrs, int attrsonly));
+
+extern int passwd_back_db_config LDAP_P((BackendDB *bd,
+ const char *fname, int lineno, int argc, char **argv ));
+
+LDAP_END_DECL
+
+#endif /* _PASSWD_EXTERNAL_H */
+
/* init.c - initialize passwd backend */
+/* $OpenLDAP$ */
#include "portable.h"
/* search.c - /etc/passwd backend search function */
+/* $OpenLDAP$ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include <pwd.h>
-#include "portable.h"
-#include "slap.h"
-extern time_t currenttime;
-extern pthread_mutex_t currenttime_mutex;
+#include "slap.h"
+#include "external.h"
+#include <ldap_pvt.h>
-static Entry *pw2entry();
+static Entry *pw2entry(
+ Backend *be,
+ struct passwd *pw,
+ char *rdn);
int
passwd_back_search(
char *s;
time_t stoptime;
+ int sent = 0;
+ int err = LDAP_SUCCESS;
+
+ char *rdn = NULL;
+ char *parent = NULL;
+ char *matched = NULL;
+ char *user = NULL;
+
tlimit = (tlimit > be->be_timelimit || tlimit < 1) ? be->be_timelimit
: tlimit;
stoptime = op->o_time + tlimit;
slimit = (slimit > be->be_sizelimit || slimit < 1) ? be->be_sizelimit
: slimit;
+ endpwent();
+
#ifdef HAVE_SETPWFILE
if ( be->be_private != NULL ) {
- endpwent();
(void) setpwfile( (char *) be->be_private );
}
#endif /* HAVE_SETPWFILE */
- if ( scope == LDAP_SCOPE_BASE ) {
- if ( (s = strchr( base, '@' )) != NULL ) {
- *s = '\0';
- }
+ /* Handle a query for the base of this backend */
+ if ( be_issuffix( be, base ) ) {
+ struct berval val, *vals[2];
- if ( (pw = getpwnam( base )) == NULL ) {
- send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
- s != NULL ? s + 1 : NULL, NULL );
- return( -1 );
- }
+ vals[0] = &val;
+ vals[1] = NULL;
- e = pw2entry( be, pw );
- if ( test_filter( be, conn, op, e, filter ) == 0 ) {
- send_search_entry( be, conn, op, e, attrs, attrsonly );
+ matched = ch_strdup( base );
+
+ if( scope != LDAP_SCOPE_ONELEVEL ) {
+ /* Create an entry corresponding to the base DN */
+ e = (Entry *) ch_calloc(1, sizeof(Entry));
+ e->e_attrs = NULL;
+ e->e_dn = ch_strdup( base );
+
+ /* Use the first attribute of the DN
+ * as an attribute within the entry itself.
+ */
+ rdn = dn_rdn(NULL, base);
+
+ if( rdn == NULL || (s = strchr(rdn, '=')) == NULL ) {
+ err = LDAP_INVALID_DN_SYNTAX;
+ goto done;
+ }
+
+ val.bv_val = rdn_attr_value(rdn);
+ val.bv_len = strlen( val.bv_val );
+ attr_merge( e, rdn_attr_type(rdn), vals );
+
+ free(rdn);
+ rdn = NULL;
+
+ /* Every entry needs an objectclass. We don't really
+ * know if our hardcoded choice here agrees with the
+ * DN that was configured for this backend, but it's
+ * better than nothing.
+ *
+ * should be a configuratable item
+ */
+ val.bv_val = "organizationalUnit";
+ val.bv_len = strlen( val.bv_val );
+ attr_merge( e, "objectClass", vals );
+
+ if ( test_filter( be, conn, op, e, filter ) == 0 ) {
+ send_search_entry( be, conn, op,
+ e, attrs, attrsonly, NULL );
+ sent++;
+ }
}
- entry_free( e );
- send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );
+ if ( scope != LDAP_SCOPE_BASE ) {
+ /* check all our "children" */
- return( 0 );
- }
+ for ( pw = getpwent(); pw != NULL; pw = getpwent() ) {
+ /* check for abandon */
+ ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
+ if ( op->o_abandon ) {
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+ endpwent();
+ return( -1 );
+ }
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+
+ /* check time limit */
+ if ( slap_get_time() > stoptime ) {
+ send_ldap_result( conn, op, LDAP_TIMELIMIT_EXCEEDED,
+ NULL, NULL, NULL, NULL );
+ endpwent();
+ return( 0 );
+ }
+
+ e = pw2entry( be, pw, NULL );
+
+ if ( test_filter( be, conn, op, e, filter ) == 0 ) {
+ /* check size limit */
+ if ( --slimit == -1 ) {
+ send_ldap_result( conn, op, LDAP_SIZELIMIT_EXCEEDED,
+ NULL, NULL, NULL, NULL );
+ endpwent();
+ return( 0 );
+ }
- for ( pw = getpwent(); pw != NULL; pw = getpwent() ) {
- /* check for abandon */
- pthread_mutex_lock( &op->o_abandonmutex );
- if ( op->o_abandon ) {
- pthread_mutex_unlock( &op->o_abandonmutex );
+ send_search_entry( be, conn, op,
+ e, attrs, attrsonly, NULL );
+ sent++;
+ }
+
+ entry_free( e );
+ }
endpwent();
- return( -1 );
}
- pthread_mutex_unlock( &op->o_abandonmutex );
- /* check size limit */
- if ( --slimit == -1 ) {
- send_ldap_result( conn, op, LDAP_SIZELIMIT_EXCEEDED,
- NULL, NULL );
- endpwent();
- return( 0 );
+ } else {
+ parent = dn_parent( be, base );
+
+ /* This backend is only one layer deep. Don't answer requests for
+ * anything deeper than that.
+ */
+ if( !be_issuffix( be, parent ) ) {
+ int i;
+ for( i=0; be->be_suffix[i] != NULL; i++ ) {
+ if( dn_issuffix( base, be->be_suffix[i] ) ) {
+ matched = ch_strdup( be->be_suffix[i] );
+ break;
+ }
+ }
+ err = LDAP_NO_SUCH_OBJECT;
+ goto done;
}
- /* check time limit */
- pthread_mutex_lock( ¤ttime_mutex );
- time( ¤ttime );
- if ( currenttime > stoptime ) {
- pthread_mutex_unlock( ¤ttime_mutex );
- send_ldap_result( conn, op, LDAP_TIMELIMIT_EXCEEDED,
- NULL, NULL );
- endpwent();
- return( 0 );
+ if( scope == LDAP_SCOPE_ONELEVEL ) {
+ goto done;
+ }
+
+ rdn = dn_rdn( NULL, base );
+
+ if ( (user = rdn_attr_value(rdn)) == NULL) {
+ err = LDAP_OPERATIONS_ERROR;
+ goto done;
}
- pthread_mutex_unlock( ¤ttime_mutex );
- e = pw2entry( be, pw );
+ user = ldap_pvt_str2lower( user );
+
+ if ( (pw = getpwnam( user )) == NULL ) {
+ matched = parent;
+ parent = NULL;
+ err = LDAP_NO_SUCH_OBJECT;
+ goto done;
+ }
+
+ e = pw2entry( be, pw, rdn );
if ( test_filter( be, conn, op, e, filter ) == 0 ) {
- send_search_entry( be, conn, op, e, attrs, attrsonly );
+ send_search_entry( be, conn, op,
+ e, attrs, attrsonly, NULL );
+ sent++;
}
entry_free( e );
}
- endpwent();
- send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );
+
+done:
+ send_ldap_result( conn, op,
+ err, err == LDAP_NO_SUCH_OBJECT ? matched : NULL, NULL,
+ NULL, NULL );
+
+ if( matched != NULL ) free( matched );
+ if( parent != NULL ) free( parent );
+ if( rdn != NULL ) free( rdn );
+ if( user != NULL ) free( user );
return( 0 );
}
static Entry *
-pw2entry( Backend *be, struct passwd *pw )
+pw2entry( Backend *be, struct passwd *pw, char *rdn )
{
Entry *e;
char buf[256];
vals[1] = NULL;
/*
- * from pw we get pw_name and make it uid and cn and sn and
- * we get pw_gecos and make it cn and we give it an objectclass
- * of person.
+ * from pw we get pw_name and make it cn
+ * give it an objectclass of person.
*/
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
e->e_attrs = NULL;
- sprintf( buf, "%s@%s", pw->pw_name, be->be_suffix[0] );
- e->e_dn = strdup( buf );
+ /* rdn attribute type should be a configuratable item */
+ sprintf( buf, "uid=%s,%s", pw->pw_name, be->be_suffix[0] );
+ e->e_dn = ch_strdup( buf );
+ e->e_ndn = ch_strdup( buf );
+ (void) dn_normalize_case( e->e_ndn );
val.bv_val = pw->pw_name;
val.bv_len = strlen( pw->pw_name );
- attr_merge( e, "cn", vals );
- attr_merge( e, "sn", vals );
- attr_merge( e, "uid", vals );
- val.bv_val = pw->pw_gecos;
- val.bv_len = strlen( pw->pw_gecos );
- attr_merge( e, "cn", vals );
+ attr_merge( e, "uid", vals ); /* required by uidObject */
+ attr_merge( e, "cn", vals ); /* required by person */
+ attr_merge( e, "sn", vals ); /* required by person */
+
+#ifdef HAVE_PW_GECOS
+ /*
+ * if gecos is present, add it as a cn. first process it
+ * according to standard BSD usage. If the processed cn has
+ * a space, use the tail as the surname.
+ */
+ if (pw->pw_gecos[0]) {
+ char *s;
+
+ val.bv_val = pw->pw_gecos;
+ val.bv_len = strlen(val.bv_val);
+ attr_merge(e, "description", vals);
+
+ s = strchr(val.bv_val, ',');
+ if (s)
+ *s = '\0';
+ s = strchr(val.bv_val, '&');
+ if (s) {
+ int i = s - val.bv_val;
+ strncpy(buf, val.bv_val, i);
+ s = buf+i;
+ strcpy(s, pw->pw_name);
+ *s = TOUPPER(*s);
+ strcat(s, val.bv_val+i+1);
+ val.bv_val = buf;
+ }
+ val.bv_len = strlen(val.bv_val);
+ if ( strcmp( val.bv_val, pw->pw_name ))
+ attr_merge( e, "cn", vals );
+ if ( (s=strrchr(val.bv_val, ' '))) {
+ val.bv_val = s + 1;
+ val.bv_len = strlen(val.bv_val);
+ attr_merge(e, "sn", vals);
+ }
+ }
+#endif
+
+ /* objectclasses should be configuratable items */
val.bv_val = "person";
val.bv_len = strlen( val.bv_val );
attr_merge( e, "objectclass", vals );
+ val.bv_val = "uidObject";
+ val.bv_len = strlen( val.bv_val );
+ attr_merge( e, "objectclass", vals );
return( e );
}
+# $OpenLDAP$
###########################################################################
#
# Copyright 1999, John C. Quillan, All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright 1999, John C. Quillan, All rights reserved.
*
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999, John C. Quillan, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+/* init.c - initialize shell backend */
+
+#include <stdio.h>
+/* #include <ac/types.h>
+ #include <ac/socket.h>
+*/
+
+#include <EXTERN.h>
+#include <perl.h>
+
+#include "slap.h"
+#include "perl_back.h"
+
+
+/**********************************************************
+ *
+ * Bind
+ *
+ **********************************************************/
+int
+perl_back_bind(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ int method,
+ char *mech,
+ struct berval *cred,
+ char** edn
+)
+{
+ int return_code;
+ int count;
+
+ PerlBackend *perl_back = (PerlBackend *) be->be_private;
+
+ *edn = NULL;
+
+ ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
+
+ {
+ dSP; ENTER; SAVETMPS;
+
+ PUSHMARK(sp);
+ XPUSHs( perl_back->pb_obj_ref );
+ XPUSHs(sv_2mortal(newSVpv( dn , 0)));
+ XPUSHs(sv_2mortal(newSVpv( cred->bv_val , cred->bv_len)));
+ PUTBACK;
+
+ count = perl_call_method("bind", G_SCALAR);
+
+ SPAGAIN;
+
+ if (count != 1) {
+ croak("Big trouble in back_search\n");
+ }
+
+ return_code = POPi;
+
+
+ PUTBACK; FREETMPS; LEAVE;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
+
+ Debug( LDAP_DEBUG_ANY, "Perl BIND\n", 0, 0, 0 );
+
+ return ( return_code );
+}
+
+
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999, John C. Quillan, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+/* init.c - initialize shell backend */
+
+#include <stdio.h>
+/* #include <ac/types.h>
+ #include <ac/socket.h>
+*/
+
+#include <EXTERN.h>
+#include <perl.h>
+
+#include "slap.h"
+#include "perl_back.h"
+
+/**********************************************************
+ *
+ * Close
+ *
+ **********************************************************/
+
+int
+perl_back_close(
+ BackendInfo *bd
+)
+{
+ ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
+
+ perl_destruct(perl_interpreter);
+
+ ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
+
+ return 0;
+}
+
+int
+perl_back_destroy(
+ BackendInfo *bd
+)
+{
+ perl_free(perl_interpreter);
+ perl_interpreter = NULL;
+
+ ldap_pvt_thread_mutex_destroy( &perl_interpreter_mutex );
+
+ return 0;
+}
+
+int
+perl_back_db_destroy(
+ BackendDB *be
+)
+{
+ free( be->be_private );
+ be->be_private = NULL;
+}
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999, John C. Quillan, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+/* #include <ac/types.h>
+ #include <ac/socket.h>
+*/
+
+#include <EXTERN.h>
+#include <perl.h>
+
+#include "slap.h"
+#include "perl_back.h"
+
+/**********************************************************
+ *
+ * Compare
+ *
+ **********************************************************/
+
+perl_back_compare(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ Ava *ava
+)
+{
+ int return_code;
+ int count;
+
+ PerlBackend *perl_back = (PerlBackend *)be->be_private;
+
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, "not yet implemented", NULL, NULL );
+
+#ifdef notdef
+ ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
+
+ {
+ dSP; ENTER; SAVETMPS;
+
+ PUSHMARK(sp);
+ XPUSHs( perl_back->pb_obj_ref );
+ XPUSHs(sv_2mortal(newSVpv( dn , 0)));
+ /* XPUSHs(sv_2mortal(newSVpv( cred->bv_val , cred->bv_len))); */
+ PUTBACK;
+
+ count = perl_call_method("bind", G_SCALAR);
+
+ SPAGAIN;
+
+ if (count != 1) {
+ croak("Big trouble in back_search\n");
+ }
+
+ return_code = POPi;
+
+ PUTBACK; FREETMPS; LEAVE;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
+
+ if( return_code != 0 ) {
+ send_ldap_result( conn, op, LDAP_COMPARE_TRUE, NULL, NULL );
+
+ } else {
+ send_ldap_result( conn, op, LDAP_COMPARE_FALSE, NULL, NULL );
+ }
+#endif
+
+ Debug( LDAP_DEBUG_ANY, "Here BIND\n", 0, 0, 0 );
+
+ return (0);
+}
+
+/* $OpenLDAP$ */
/*
* Copyright 1999, John C. Quillan, All rights reserved.
*
int
perl_back_db_config(
BackendDB *be,
- char *fname,
+ const char *fname,
int lineno,
int argc,
char **argv
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999, John C. Quillan, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+/* #include <ac/types.h>
+#include <ac/socket.h>
+*/
+
+#include <EXTERN.h>
+#include <perl.h>
+
+#include "slap.h"
+#include "perl_back.h"
+
+perl_back_delete(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn
+)
+{
+ int len;
+ int count;
+ int return_code;
+
+ PerlBackend *perl_back = (PerlBackend *) be->be_private;
+
+ ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
+
+ {
+ dSP; ENTER; SAVETMPS;
+
+ PUSHMARK(sp);
+ XPUSHs( perl_back->pb_obj_ref );
+ XPUSHs(sv_2mortal(newSVpv( dn , 0 )));
+
+ PUTBACK;
+
+ count = perl_call_method("delete", G_SCALAR);
+
+ SPAGAIN;
+
+ if (count != 1) {
+ croak("Big trouble in perl-back_delete\n");
+ }
+
+ return_code = POPi;
+
+ PUTBACK; FREETMPS; LEAVE;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
+
+ if( return_code != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+
+ } else {
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+ }
+
+ Debug( LDAP_DEBUG_ANY, "Here DELETE\n", 0, 0, 0 );
+ return( 0 );
+}
--- /dev/null
+/* $OpenLDAP$ */
+#ifndef _PERL_EXTERNAL_H
+#define _PERL_EXTERNAL_H
+
+LDAP_BEGIN_DECL
+
+extern int perl_back_initialize LDAP_P(( BackendInfo *bi ));
+extern int perl_back_open LDAP_P(( BackendInfo *bi ));
+extern int perl_back_close LDAP_P(( BackendInfo *bi ));
+extern int perl_back_destroy LDAP_P(( BackendInfo *bi ));
+
+extern int perl_back_db_init LDAP_P(( BackendDB *bd ));
+extern int perl_back_db_destroy LDAP_P(( BackendDB *bd ));
+
+extern int perl_back_db_config LDAP_P(( BackendDB *bd,
+ const char *fname, int lineno, int argc, char **argv ));
+
+extern int perl_back_bind LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, int method, char* mech,
+ struct berval *cred, char** edn ));
+
+extern int perl_back_unbind LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op ));
+
+extern int perl_back_search LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *base, int scope, int deref, int sizelimit, int timelimit,
+ Filter *filter, char *filterstr, char **attrs, int attrsonly ));
+
+extern int perl_back_compare LDAP_P((BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, Ava *ava ));
+
+extern int perl_back_modify LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, LDAPModList *ml ));
+
+extern int perl_back_modrdn LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, char*newrdn, int deleteoldrdn,
+ char *newSuperior ));
+
+extern int perl_back_add LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op, Entry *e ));
+
+extern int perl_back_delete LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op, char *dn ));
+
+LDAP_END_DECL
+
+#endif /* _PERL_EXTERNAL_H */
+
+/* $OpenLDAP$ */
/*
* Copyright 1999, John C. Quillan, All rights reserved.
*
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999, John C. Quillan, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+/* #include <ac/types.h>
+ #include <ac/socket.h>
+*/
+
+#include <EXTERN.h>
+#include <perl.h>
+
+#include "slap.h"
+#include "perl_back.h"
+
+int
+perl_back_modify(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ LDAPModList *modlist
+)
+{
+ char test[500];
+ int return_code;
+ int count;
+ int i;
+ int err = 0;
+ char *matched = NULL, *info = NULL;
+
+ PerlBackend *perl_back = (PerlBackend *)be->be_private;
+
+ ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
+
+ {
+ dSP; ENTER; SAVETMPS;
+
+ PUSHMARK(sp);
+ XPUSHs( perl_back->pb_obj_ref );
+ XPUSHs(sv_2mortal(newSVpv( dn , 0)));
+
+ for (; modlist != NULL; modlist = modlist->ml_next ) {
+ LDAPMod *mods = &modlist->ml_mod;
+
+ switch ( mods->mod_op & ~LDAP_MOD_BVALUES ) {
+ case LDAP_MOD_ADD:
+ XPUSHs(sv_2mortal(newSVpv("ADD", 0 )));
+ break;
+
+ case LDAP_MOD_DELETE:
+ XPUSHs(sv_2mortal(newSVpv("DELETE", 0 )));
+ break;
+
+ case LDAP_MOD_REPLACE:
+ XPUSHs(sv_2mortal(newSVpv("REPLACE", 0 )));
+ break;
+ }
+
+
+ XPUSHs(sv_2mortal(newSVpv( mods->mod_type, 0 )));
+
+ for ( i = 0;
+ mods->mod_bvalues != NULL && mods->mod_bvalues[i] != NULL;
+ i++ )
+ {
+ XPUSHs(sv_2mortal(newSVpv( mods->mod_bvalues[i]->bv_val, 0 )));
+ }
+ }
+
+ PUTBACK;
+
+ count = perl_call_method("modify", G_SCALAR);
+
+ SPAGAIN;
+
+ if (count != 1) {
+ croak("Big trouble in back_search\n");
+ }
+
+ return_code = POPi;
+
+ PUTBACK; FREETMPS; LEAVE;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
+
+ if( return_code != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+
+ } else {
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+ }
+
+ Debug( LDAP_DEBUG_ANY, "Perl MODIFY\n", 0, 0, 0 );
+ return( 0 );
+}
+
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999, John C. Quillan, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/*
+ * LDAP v3 newSuperior support.
+ *
+ * Copyright 1999, Juan C. Gomez, All rights reserved.
+ * This software is not subject to any license of Silicon Graphics
+ * Inc. or Purdue University.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * without restriction or fee of any kind as long as this notice
+ * is preserved.
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+/* #include <ac/types.h>
+ #include <ac/socket.h>
+*/
+
+#include <EXTERN.h>
+#include <perl.h>
+
+#include "slap.h"
+#include "perl_back.h"
+
+int
+perl_back_modrdn(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *dn,
+ char *newrdn,
+ int deleteoldrdn,
+ char *newSuperior
+)
+{
+ int len;
+ int count;
+ int return_code;
+
+ PerlBackend *perl_back = (PerlBackend *) be->be_private;
+
+ ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
+
+ {
+ dSP; ENTER; SAVETMPS;
+
+ PUSHMARK(sp) ;
+ XPUSHs( perl_back->pb_obj_ref );
+ XPUSHs(sv_2mortal(newSVpv( dn , 0 )));
+ XPUSHs(sv_2mortal(newSVpv( newrdn , 0 )));
+ XPUSHs(sv_2mortal(newSViv( deleteoldrdn )));
+ if ( newSuperior != NULL ) {
+ XPUSHs(sv_2mortal(newSVpv( newSuperior , 0 )));
+ }
+ PUTBACK ;
+
+ count = perl_call_method("modrdn", G_SCALAR);
+
+ SPAGAIN ;
+
+ if (count != 1) {
+ croak("Big trouble in back_search\n") ;
+ }
+
+ return_code = POPi;
+
+ PUTBACK; FREETMPS; LEAVE ;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
+
+ if( return_code != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+
+ } else {
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+ }
+
+ Debug( LDAP_DEBUG_ANY, "Perl MODRDN\n", 0, 0, 0 );
+ return( 0 );
+}
+
+
--- /dev/null
+/* $OpenLDAP$ */
+#ifndef PERL_BACK_H
+#define PERL_BACK_H 1
+
+LDAP_BEGIN_DECL
+
+/*
+ */
+#define EVAL_BUF_SIZE 500
+
+extern PerlInterpreter *perl_interpreter;
+extern ldap_pvt_thread_mutex_t perl_interpreter_mutex;
+
+typedef struct perl_backend_instance {
+ char *pb_module_name;
+ SV *pb_obj_ref;
+} PerlBackend;
+
+LDAP_END_DECL
+
+#include "external.h"
+
+#endif
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999, John C. Quillan, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+/* #include <ac/types.h>
+ #include <ac/socket.h>
+*/
+
+#include <EXTERN.h>
+#include <perl.h>
+
+#include "slap.h"
+#include "perl_back.h"
+
+/**********************************************************
+ *
+ * Search
+ *
+ **********************************************************/
+int
+perl_back_search(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ char *base,
+ int scope,
+ int deref,
+ int sizelimit,
+ int timelimit,
+ Filter *filter,
+ char *filterstr,
+ char **attrs,
+ int attrsonly
+ )
+{
+ char test[500];
+ int count ;
+ int err = 0;
+ char *matched = NULL, *info = NULL;
+ PerlBackend *perl_back = (PerlBackend *)be->be_private;
+ Entry *e;
+ char *buf;
+ int i;
+ int return_code;
+
+ ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
+
+ {
+ dSP; ENTER; SAVETMPS;
+
+ PUSHMARK(sp) ;
+ XPUSHs( perl_back->pb_obj_ref );
+ XPUSHs(sv_2mortal(newSVpv( filterstr , 0)));
+ XPUSHs(sv_2mortal(newSViv( sizelimit )));
+ XPUSHs(sv_2mortal(newSViv( timelimit )));
+ XPUSHs(sv_2mortal(newSViv( attrsonly )));
+
+ for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
+ XPUSHs(sv_2mortal(newSVpv( attrs[i] , 0)));
+ }
+ PUTBACK;
+
+ count = perl_call_method("search", G_ARRAY );
+
+ SPAGAIN;
+
+ if (count < 1) {
+ croak("Big trouble in back_search\n") ;
+ }
+
+ if ( count > 1 ) {
+
+ for ( i = 1; i < count; i++ ) {
+
+ buf = POPp;
+
+ if ( (e = str2entry( buf )) == NULL ) {
+ Debug( LDAP_DEBUG_ANY, "str2entry(%s) failed\n", buf, 0, 0 );
+
+ } else {
+ send_search_entry( be, conn, op,
+ e, attrs, attrsonly, NULL );
+
+ entry_free( e );
+ }
+ }
+ }
+
+ /*
+ * We grab the return code last because the stack comes
+ * from perl in reverse order.
+ *
+ * ex perl: return ( 0, $res_1, $res_2 );
+ *
+ * ex stack: <$res_2> <$res_1> <0>
+ */
+
+ return_code = POPi;
+
+
+
+ PUTBACK; FREETMPS; LEAVE;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
+
+ if( return_code != 0 ) {
+ send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+ NULL, NULL, NULL, NULL );
+
+ } else {
+ send_ldap_result( conn, op, LDAP_SUCCESS,
+ NULL, NULL, NULL, NULL );
+ }
+}
+
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999, John C. Quillan, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+ /* init.c - initialize shell backend */
+
+#include <stdio.h>
+/* #include <ac/types.h>
+ #include <ac/socket.h>
+*/
+
+#include <EXTERN.h>
+#include <perl.h>
+
+#include "slap.h"
+#include "perl_back.h"
+
+
+/**********************************************************
+ *
+ * UnBind
+ *
+ **********************************************************/
+int
+perl_back_unbind(
+ Backend *be,
+ Connection *conn,
+ Operation *op
+)
+{
+ Debug( LDAP_DEBUG_TRACE, "Perl UNBIND\n", 0, 0, 0 );
+ return 0;
+}
+
+# $OpenLDAP$
+
SRCS = init.c config.c fork.c search.c bind.c unbind.c add.c delete.c \
modify.c modrdn.c compare.c abandon.c result.c
OBJS = init.lo config.lo fork.lo search.lo bind.lo unbind.lo add.lo delete.lo \
/* abandon.c - shell backend abandon function */
+/* $OpenLDAP$ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <signal.h>
+
+#include <ac/signal.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "slap.h"
#include "shell.h"
-void
+int
shell_back_abandon(
Backend *be,
Connection *conn,
{
struct shellinfo *si = (struct shellinfo *) be->be_private;
FILE *rfp, *wfp;
- int pid;
+ pid_t pid;
Operation *o;
/* no abandon command defined - just kill the process handling it */
if ( si->si_abandon == NULL ) {
- pthread_mutex_lock( &conn->c_opsmutex );
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
pid = -1;
for ( o = conn->c_ops; o != NULL; o = o->o_next ) {
if ( o->o_msgid == msgid ) {
- pid = o->o_private;
+ pid = (pid_t) o->o_private;
break;
}
}
- pthread_mutex_unlock( &conn->c_opsmutex );
+ if( pid == -1 ) {
+ for ( o = conn->c_pending_ops; o != NULL; o = o->o_next ) {
+ if ( o->o_msgid == msgid ) {
+ pid = (pid_t) o->o_private;
+ break;
+ }
+ }
+ }
+ ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
if ( pid != -1 ) {
- Debug( LDAP_DEBUG_ARGS, "shell killing pid %d\n", pid,
- 0, 0 );
+ Debug( LDAP_DEBUG_ARGS, "shell killing pid %d\n",
+ (int) pid, 0, 0 );
kill( pid, SIGTERM );
} else {
Debug( LDAP_DEBUG_ARGS, "shell could not find op %d\n",
msgid, 0, 0 );
}
- return;
+ return 0;
}
if ( forkandexec( si->si_abandon, &rfp, &wfp ) == -1 ) {
- return;
+ return 0;
}
/* write out the request to the abandon process */
/* no result from abandon */
fclose( rfp );
+
+ return 0;
}
/* add.c - shell backend add function */
+/* $OpenLDAP$ */
#include "portable.h"
/* write out the request to the add process */
fprintf( wfp, "ADD\n" );
- fprintf( wfp, "msgid: %ld\n", op->o_msgid );
+ fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
ldap_pvt_thread_mutex_lock( &entry2str_mutex );
fprintf( wfp, "%s", entry2str( e, &len ) );
/* bind.c - shell backend bind function */
+/* $OpenLDAP$ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "slap.h"
#include "shell.h"
Operation *op,
char *dn,
int method,
- struct berval *cred
+ char *mech,
+ struct berval *cred,
+ char **edn
)
{
struct shellinfo *si = (struct shellinfo *) be->be_private;
FILE *rfp, *wfp;
int rc;
+ *edn = NULL;
+
if ( si->si_bind == NULL ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
- "bind not implemented" );
- return;
+ "bind not implemented", NULL, NULL );
+ return( -1 );
}
- if ( (op->o_private = forkandexec( si->si_bind, &rfp, &wfp ))
- == -1 ) {
+ if ( (op->o_private = (void *) forkandexec( si->si_bind, &rfp, &wfp ))
+ == (void *) -1 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
- "could not fork/exec" );
- return;
+ "could not fork/exec", NULL, NULL );
+ return( -1 );
}
/* write out the request to the bind process */
fprintf( wfp, "BIND\n" );
- fprintf( wfp, "msgid: %d\n", op->o_msgid );
+ fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
fprintf( wfp, "dn: %s\n", dn );
fprintf( wfp, "method: %d\n", method );
- fprintf( wfp, "credlen: %d\n", cred->bv_len );
+ fprintf( wfp, "credlen: %lu\n", cred->bv_len );
fprintf( wfp, "cred: %s\n", cred->bv_val ); /* XXX */
fclose( wfp );
/* compare.c - shell backend compare function */
+/* $OpenLDAP$ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "slap.h"
#include "shell.h"
-void
+int
shell_back_compare(
Backend *be,
Connection *conn,
if ( si->si_compare == NULL ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
- "compare not implemented" );
- return;
+ "compare not implemented", NULL, NULL );
+ return( -1 );
}
- if ( (op->o_private = forkandexec( si->si_compare, &rfp, &wfp ))
- == -1 ) {
+ if ( (op->o_private = (void *) forkandexec( si->si_compare, &rfp, &wfp ))
+ == (void *) -1 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
- "could not fork/exec" );
- return;
+ "could not fork/exec", NULL, NULL );
+ return( -1 );
}
/* write out the request to the compare process */
fprintf( wfp, "COMPARE\n" );
- fprintf( wfp, "msgid: %d\n", op->o_msgid );
+ fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
fprintf( wfp, "dn: %s\n", dn );
fprintf( wfp, "%s: %s\n", ava->ava_type, ava->ava_value.bv_val );
read_and_send_results( be, conn, op, rfp, NULL, 0 );
fclose( rfp );
+ return( 0 );
}
/* config.c - shell backend configuration file routine */
+/* $OpenLDAP$ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "slap.h"
#include "shell.h"
-extern char **charray_dup();
-
-shell_back_config(
- Backend *be,
- char *fname,
+int
+shell_back_db_config(
+ BackendDB *be,
+ const char *fname,
int lineno,
int argc,
char **argv
if ( si == NULL ) {
fprintf( stderr, "%s: line %d: shell backend info is null!\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
/* command + args to exec for binds */
fprintf( stderr,
"%s: line %d: missing executable in \"bind <executable>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
si->si_bind = charray_dup( &argv[1] );
fprintf( stderr,
"%s: line %d: missing executable in \"unbind <executable>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
si->si_unbind = charray_dup( &argv[1] );
fprintf( stderr,
"%s: line %d: missing executable in \"search <executable>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
si->si_search = charray_dup( &argv[1] );
fprintf( stderr,
"%s: line %d: missing executable in \"compare <executable>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
si->si_compare = charray_dup( &argv[1] );
fprintf( stderr,
"%s: line %d: missing executable in \"modify <executable>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
si->si_modify = charray_dup( &argv[1] );
fprintf( stderr,
"%s: line %d: missing executable in \"modrdn <executable>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
si->si_modrdn = charray_dup( &argv[1] );
fprintf( stderr,
"%s: line %d: missing executable in \"add <executable>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
si->si_add = charray_dup( &argv[1] );
fprintf( stderr,
"%s: line %d: missing executable in \"delete <executable>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
si->si_delete = charray_dup( &argv[1] );
fprintf( stderr,
"%s: line %d: missing executable in \"abandon <executable>\" line\n",
fname, lineno );
- exit( 1 );
+ return( 1 );
}
si->si_abandon = charray_dup( &argv[1] );
"%s: line %d: unknown directive \"%s\" in shell database definition (ignored)\n",
fname, lineno, argv[0] );
}
+
+ return 0;
}
/* delete.c - shell backend delete function */
+/* $OpenLDAP$ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "slap.h"
#include "shell.h"
-void
+int
shell_back_delete(
Backend *be,
Connection *conn,
if ( si->si_delete == NULL ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
- "delete not implemented" );
- return;
+ "delete not implemented", NULL, NULL );
+ return( -1 );
}
- if ( (op->o_private = forkandexec( si->si_delete, &rfp, &wfp ))
- == -1 ) {
+ if ( (op->o_private = (void *) forkandexec( si->si_delete, &rfp, &wfp ))
+ == (void *) -1 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
- "could not fork/exec" );
- return;
+ "could not fork/exec", NULL, NULL );
+ return( -1 );
}
/* write out the request to the delete process */
fprintf( wfp, "DELETE\n" );
- fprintf( wfp, "msgid: %d\n", op->o_msgid );
+ fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
fprintf( wfp, "dn: %s\n", dn );
fclose( wfp );
/* read in the results and send them along */
read_and_send_results( be, conn, op, rfp, NULL, 0 );
fclose( rfp );
+ return( 0 );
}
--- /dev/null
+/* $OpenLDAP$ */
+#ifndef _SHELL_EXTERNAL_H
+#define _SHELL_EXTERNAL_H
+
+LDAP_BEGIN_DECL
+
+extern int shell_back_initialize LDAP_P(( BackendInfo *bi ));
+extern int shell_back_open LDAP_P(( BackendInfo *bi ));
+extern int shell_back_close LDAP_P(( BackendInfo *bi ));
+extern int shell_back_destroy LDAP_P(( BackendInfo *bi ));
+
+extern int shell_back_db_init LDAP_P(( BackendDB *bd ));
+extern int shell_back_db_destroy LDAP_P(( BackendDB *bd ));
+
+extern int shell_back_db_config LDAP_P(( BackendDB *bd,
+ const char *fname, int lineno, int argc, char **argv ));
+
+extern int shell_back_bind LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, int method, char* mech,
+ struct berval *cred, char** edn ));
+
+extern int shell_back_unbind LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op ));
+
+extern int shell_back_search LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *base, int scope, int deref, int sizelimit, int timelimit,
+ Filter *filter, char *filterstr, char **attrs, int attrsonly ));
+
+extern int shell_back_compare LDAP_P((BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, Ava *ava ));
+
+extern int shell_back_modify LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, LDAPModList *ml ));
+
+extern int shell_back_modrdn LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op,
+ char *dn, char*newrdn, int deleteoldrdn,
+ char *newSuperior ));
+
+extern int shell_back_add LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op, Entry *e ));
+
+extern int shell_back_delete LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op, char *dn ));
+
+extern int shell_back_abandon LDAP_P(( BackendDB *bd,
+ Connection *conn, Operation *op, int msgid ));
+
+LDAP_END_DECL
+
+#endif /* _SHELL_EXTERNAL_H */
+
/* fork.c - fork and exec a process, connecting stdin/out w/pipes */
+/* $OpenLDAP$ */
#include "portable.h"
/* init.c - initialize shell backend */
+/* $OpenLDAP$ */
#include "portable.h"
/* modify.c - shell backend modify function */
+/* $OpenLDAP$ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "slap.h"
#include "shell.h"
-void
+int
shell_back_modify(
Backend *be,
Connection *conn,
Operation *op,
char *dn,
- LDAPMod *mods
+ LDAPModList *ml
)
{
struct shellinfo *si = (struct shellinfo *) be->be_private;
if ( si->si_modify == NULL ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
- "modify not implemented" );
- return;
+ "modify not implemented", NULL, NULL );
+ return( -1 );
}
- if ( (op->o_private = forkandexec( si->si_modify, &rfp, &wfp ))
- == -1 ) {
+ if ( (op->o_private = (void *) forkandexec( si->si_modify, &rfp, &wfp ))
+ == (void *) -1 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
- "could not fork/exec" );
- return;
+ "could not fork/exec", NULL, NULL );
+ return( -1 );
}
/* write out the request to the modify process */
fprintf( wfp, "MODIFY\n" );
- fprintf( wfp, "msgid: %d\n", op->o_msgid );
+ fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
fprintf( wfp, "dn: %s\n", dn );
- for ( ; mods != NULL; mods = mods->mod_next ) {
- switch ( mods->mod_op & ~LDAP_MOD_BVALUES ) {
+ for ( ; ml != NULL; ml = ml->ml_next ) {
+ switch ( ml->ml_op & ~LDAP_MOD_BVALUES ) {
case LDAP_MOD_ADD:
- fprintf( wfp, "add: %s", mods->mod_type );
+ fprintf( wfp, "add: %s\n", ml->ml_type );
break;
case LDAP_MOD_DELETE:
- fprintf( wfp, "delete: %s", mods->mod_type );
+ fprintf( wfp, "delete: %s\n", ml->ml_type );
break;
case LDAP_MOD_REPLACE:
- fprintf( wfp, "replace: %s", mods->mod_type );
+ fprintf( wfp, "replace: %s\n", ml->ml_type );
break;
}
- for ( i = 0; mods->mod_bvalues != NULL && mods->mod_bvalues[i]
+ for ( i = 0; ml->ml_bvalues != NULL && ml->ml_bvalues[i]
!= NULL; i++ ) {
- fprintf( wfp, "%s: %s\n", mods->mod_type,
- mods->mod_bvalues[i]->bv_val );
+ fprintf( wfp, "%s: %s\n", ml->ml_type,
+ ml->ml_bvalues[i]->bv_val );
}
}
fclose( wfp );
/* read in the results and send them along */
read_and_send_results( be, conn, op, rfp, NULL, 0 );
fclose( rfp );
+ return( 0 );
+
}
/* modrdn.c - shell backend modrdn function */
+/* $OpenLDAP$ */
+
+/*
+ * LDAP v3 newSuperior support.
+ *
+ * Copyright 1999, Juan C. Gomez, All rights reserved.
+ * This software is not subject to any license of Silicon Graphics
+ * Inc. or Purdue University.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * without restriction or fee of any kind as long as this notice
+ * is preserved.
+ *
+ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "slap.h"
#include "shell.h"
-void
+int
shell_back_modrdn(
Backend *be,
Connection *conn,
Operation *op,
char *dn,
char *newrdn,
- int deleteoldrdn
+ int deleteoldrdn,
+ char *newSuperior
)
{
struct shellinfo *si = (struct shellinfo *) be->be_private;
if ( si->si_modrdn == NULL ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
- "modrdn not implemented" );
- return;
+ "modrdn not implemented", NULL, NULL );
+ return( -1 );
}
- if ( (op->o_private = forkandexec( si->si_modrdn, &rfp, &wfp ))
- == -1 ) {
+ if ( (op->o_private = (void *) forkandexec( si->si_modrdn, &rfp, &wfp ))
+ == (void *) -1 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
- "could not fork/exec" );
- return;
+ "could not fork/exec", NULL, NULL );
+ return( -1 );
}
/* write out the request to the modrdn process */
fprintf( wfp, "MODRDN\n" );
- fprintf( wfp, "msgid: %d\n", op->o_msgid );
+ fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
fprintf( wfp, "dn: %s\n", dn );
fprintf( wfp, "newrdn: %s\n", newrdn );
fprintf( wfp, "deleteoldrdn: %d\n", deleteoldrdn ? 1 : 0 );
+ if (newSuperior != NULL) {
+ fprintf( wfp, "newSuperior: %s\n", newSuperior );
+ }
fclose( wfp );
/* read in the results and send them along */
read_and_send_results( be, conn, op, rfp, NULL, 0 );
fclose( rfp );
+ return( 0 );
}
/* result.c - shell backend result reading function */
+/* $OpenLDAP$ */
#include "portable.h"
/* search.c - shell backend search function */
+/* $OpenLDAP$ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "slap.h"
#include "shell.h"
-extern Entry *str2entry();
-
-void
+int
shell_back_search(
Backend *be,
Connection *conn,
)
{
struct shellinfo *si = (struct shellinfo *) be->be_private;
- int i, rc, bsize, len;
- int err;
- char *matched, *info;
+ int i;
FILE *rfp, *wfp;
if ( si->si_search == NULL ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
- "search not implemented" );
- return;
+ "search not implemented", NULL, NULL );
+ return( -1 );
}
- if ( (op->o_private = forkandexec( si->si_search, &rfp, &wfp ))
- == -1 ) {
+ if ( (op->o_private = (void *) forkandexec( si->si_search, &rfp, &wfp ))
+ == (void *) -1 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
- "could not fork/exec" );
- return;
+ "could not fork/exec", NULL, NULL );
+ return( -1 );
}
/* write out the request to the search process */
fprintf( wfp, "SEARCH\n" );
- fprintf( wfp, "msgid: %d\n", op->o_msgid );
+ fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
fprintf( wfp, "base: %s\n", base );
fprintf( wfp, "scope: %d\n", scope );
read_and_send_results( be, conn, op, rfp, attrs, attrsonly );
fclose( rfp );
+ return( 0 );
}
/* shell.h - shell backend header file */
+/* $OpenLDAP$ */
+
+#ifndef SLAPD_SHELL_H
+#define SLAPD_SHELL_H
+
+#include "external.h"
+
+LDAP_BEGIN_DECL
struct shellinfo {
char **si_bind; /* cmd + args to exec for bind */
char **si_delete; /* cmd + args to exec for delete */
char **si_abandon; /* cmd + args to exec for abandon */
};
+
+struct slap_backend_db;
+struct slap_conn;
+struct slap_op;
+
+extern pid_t forkandexec LDAP_P((
+ char **args,
+ FILE **rfp,
+ FILE **wfp));
+
+extern void print_suffixes LDAP_P((
+ FILE *fp,
+ struct slap_backend_db *bd));
+
+extern int read_and_send_results LDAP_P((
+ struct slap_backend_db *bd,
+ struct slap_conn *conn,
+ struct slap_op *op,
+ FILE *fp,
+ char **attrs,
+ int attrsonly));
+
+LDAP_END_DECL
+
+#endif
/* unbind.c - shell backend unbind function */
+/* $OpenLDAP$ */
+
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "slap.h"
#include "shell.h"
-void
+int
shell_back_unbind(
Backend *be,
Connection *conn,
- Operation *op,
- char *dn,
- int method,
- struct berval *cred
+ Operation *op
)
{
struct shellinfo *si = (struct shellinfo *) be->be_private;
if ( si->si_unbind == NULL ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
- "unbind not implemented" );
- return;
+ "unbind not implemented", NULL, NULL );
+ return 0;
}
- if ( (op->o_private = forkandexec( si->si_unbind, &rfp, &wfp ))
- == -1 ) {
+ if ( (op->o_private = (void *) forkandexec( si->si_unbind, &rfp, &wfp ))
+ == (void *) -1 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
- "could not fork/exec" );
- return;
+ "could not fork/exec", NULL, NULL );
+ return 0;
}
/* write out the request to the unbind process */
fprintf( wfp, "UNBIND\n" );
- fprintf( wfp, "msgid: %d\n", op->o_msgid );
+ fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
- fprintf( wfp, "dn: %s\n", dn );
+ fprintf( wfp, "dn: %s\n", (conn->c_dn ? conn->c_dn : "") );
fclose( wfp );
/* no response to unbind */
fclose( rfp );
+
+ return 0;
}
+# $OpenLDAP$
###########################################################################
#
# Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
--- /dev/null
+/* $OpenLDAP$ */
+
+#ifndef _TCL_EXTERNAL_H
+#define _TCL_EXTERNAL_H
+
+LDAP_BEGIN_DECL
+
+extern int tcl_back_initialize LDAP_P ((BackendInfo * bi));
+extern int tcl_back_open LDAP_P ((BackendInfo * bi));
+extern int tcl_back_close LDAP_P ((BackendInfo * bi));
+extern int tcl_back_destroy LDAP_P ((BackendInfo * bi));
+
+extern int tcl_back_db_init LDAP_P ((BackendDB * bd));
+extern int tcl_back_db_open LDAP_P ((BackendDB * bd));
+extern int tcl_back_db_close LDAP_P ((BackendDB * bd));
+extern int tcl_back_db_destroy LDAP_P ((BackendDB * bd));
+
+extern int tcl_back_db_config LDAP_P ((BackendDB * bd,
+ const char *fname, int lineno, int argc, char **argv));
+
+extern int tcl_back_bind LDAP_P ((BackendDB * bd,
+ Connection * conn, Operation * op,
+ char *dn, int method, char *mech,
+ struct berval * cred, char **edn));
+
+extern int tcl_back_unbind LDAP_P ((BackendDB * bd,
+ Connection * conn, Operation * op));
+
+extern int tcl_back_search LDAP_P ((BackendDB * bd,
+ Connection * conn, Operation * op,
+ char *base, int scope, int deref, int sizelimit, int timelimit,
+ Filter * filter, char *filterstr, char **attrs, int attrsonly));
+
+extern int tcl_back_compare LDAP_P ((BackendDB * bd,
+ Connection * conn, Operation * op,
+ char *dn, Ava * ava));
+
+extern int tcl_back_modify LDAP_P ((BackendDB * bd,
+ Connection * conn, Operation * op,
+ char *dn, LDAPModList * ml));
+
+extern int tcl_back_modrdn LDAP_P ((BackendDB * bd,
+ Connection * conn, Operation * op,
+ char *dn, char *newrdn, int deleteoldrdn,
+ char *newSuperior));
+
+extern int tcl_back_add LDAP_P ((BackendDB * bd,
+ Connection * conn, Operation * op, Entry * e));
+
+extern int tcl_back_delete LDAP_P ((BackendDB * bd,
+ Connection * conn, Operation * op, char *dn));
+
+extern int tcl_back_abandon LDAP_P ((BackendDB * bd,
+ Connection * conn, Operation * op, int msgid));
+
+LDAP_END_DECL
+
+#endif /* _TCL_EXTERNAL_H */
--- /dev/null
+/* $OpenLDAP$ */
+/* abandon.c - tcl abandon routine
+ *
+ * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include "slap.h"
+#include "tcl_back.h"
+
+int
+tcl_back_abandon (
+ Backend * be,
+ Connection * conn,
+ Operation * op,
+ int msgid
+)
+{
+ char *suf_tcl, *results, *command;
+ int i, code, err = 0;
+ struct tclinfo *ti = (struct tclinfo *) be->be_private;
+
+ if (ti->ti_abandon == NULL) {
+ return (-1);
+ }
+
+ for (i = 0; be->be_suffix[i] != NULL; i++);
+ suf_tcl = Tcl_Merge (i, be->be_suffix);
+
+ command = (char *) ch_malloc (strlen (ti->ti_abandon) + strlen (suf_tcl)
+ + 20);
+ sprintf (command, "%s ABANDON {%ld} {%s}",
+ ti->ti_abandon, op->o_msgid, suf_tcl);
+ Tcl_Free (suf_tcl);
+
+ ldap_pvt_thread_mutex_lock (&tcl_interpreter_mutex);
+ code = Tcl_GlobalEval (ti->ti_ii->interp, command);
+ results = (char *) ch_strdup (ti->ti_ii->interp->result);
+ ldap_pvt_thread_mutex_unlock (&tcl_interpreter_mutex);
+ free (command);
+
+ if (code != TCL_OK) {
+ err = LDAP_OPERATIONS_ERROR;
+ Debug (LDAP_DEBUG_SHELL, "tcl_abandon_error: %s\n", results,
+ 0, 0);
+ }
+
+ free (results);
+ return (err);
+}
+/* $OpenLDAP$ */
/* add.c - tcl add routine
- *
- * $Id: tcl_add.c,v 1.7 1999/08/02 23:38:43 hallvard Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
--- /dev/null
+/* $OpenLDAP$ */
+/* tcl_back.h - tcl backend header (structs, functions)
+ *
+ * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include <tcl.h>
+
+#ifndef SLAPD_TCL_H
+#define SLAPD_TCL_H
+
+#include <ldap_cdefs.h>
+#include "external.h"
+
+extern ldap_pvt_thread_mutex_t tcl_interpreter_mutex;
+
+struct i_info {
+ Tcl_Interp *interp;
+ char *name;
+ struct i_info *next;
+ int count;
+};
+
+extern struct i_info *global_i;
+
+struct tclinfo {
+ char *script_path;
+ struct i_info *ti_ii;
+ char *ti_bind;
+ char *ti_unbind;
+ char *ti_search;
+ char *ti_compare;
+ char *ti_modify;
+ char *ti_modrdn;
+ char *ti_add;
+ char *ti_delete;
+ char *ti_abandon;
+};
+
+void readtclscript (char *script, Tcl_Interp * my_tcl);
+char *tcl_clean_entry (Entry * e);
+
+int tcl_ldap_debug (
+ ClientData clientData,
+ Tcl_Interp * interp,
+ int argc,
+ char *argv[]
+);
+
+int interp_send_results (
+ Backend * be,
+ Connection * conn,
+ Operation * op,
+ char *result,
+ char **attrs,
+ int attrsonly
+);
+
+#endif
+/* $OpenLDAP$ */
/* bind.c - tcl bind routines
- *
- * $Id: tcl_bind.c,v 1.8 1999/08/02 23:38:43 hallvard Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
--- /dev/null
+/* $OpenLDAP$ */
+/* close.c - tcl close routines
+ *
+ * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include "slap.h"
+#include "tcl_back.h"
+
+int
+tcl_back_close (
+ BackendInfo * bi
+)
+{
+ Tcl_DeleteInterp (global_i->interp);
+
+ return (0);
+}
+
+int
+tcl_back_destroy (
+ BackendInfo * bi
+)
+{
+ free (global_i->interp);
+ free (global_i);
+ ldap_pvt_thread_mutex_destroy (&tcl_interpreter_mutex);
+
+ return (0);
+}
+
+int
+tcl_back_db_close (
+ BackendDB * bd
+)
+{
+ struct tclinfo *ti = (struct tclinfo *) bd->be_private;
+ struct i_info *ti_tmp;
+
+ /* Disable the interp and associated struct */
+ ti->ti_ii->count--;
+ if (!ti->ti_ii->count && strcasecmp ("default", ti->ti_ii->name)) {
+ /* no more db's using this and it's not the default */
+ for (ti_tmp = global_i; ti_tmp->next != ti->ti_ii; ti_tmp
+ = ti_tmp->next);
+ /* This bypasses this interp struct in the global hash */
+ ti_tmp->next = ti->ti_ii->next;
+ Tcl_DeleteInterp (ti->ti_ii->interp);
+ }
+ return (0);
+}
+
+int
+tcl_back_db_destroy (
+ BackendDB * bd
+)
+{
+ struct tclinfo *ti = (struct tclinfo *) bd->be_private;
+
+ /*
+ * Now free up the allocated memory used
+ */
+ ti->ti_ii->count--;
+ if (!ti->ti_ii->count && strcasecmp ("default", ti->ti_ii->name)) {
+ free (ti->ti_ii->interp);
+ free (ti->ti_ii);
+ free (ti);
+ }
+ free (bd->be_private);
+ bd->be_private = NULL;
+
+ return (0);
+}
+/* $OpenLDAP$ */
/* compare.c - tcl compare routines
- *
- * $Id: tcl_compare.c,v 1.7 1999/08/02 23:38:43 hallvard Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
--- /dev/null
+/* $OpenLDAP$ */
+/* config.c - tcl backend configuration file routine
+ *
+ * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include "slap.h"
+#include "tcl_back.h"
+
+struct i_info *global_i;
+
+int
+tcl_back_db_config (
+ BackendDB * bd,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv
+)
+{
+ struct tclinfo *ti = (struct tclinfo *) bd->be_private;
+ int script_loaded = 0;
+
+ if (ti == NULL) {
+ fprintf (stderr,
+ "%s: line %d: tcl backend info is null!\n", fname,
+ lineno);
+ return (1);
+ }
+ if (ti->ti_ii == NULL) {
+ ti->ti_ii = global_i;
+ }
+
+ /* Script to load */
+ if (strcasecmp (argv[0], "scriptpath") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing script in \"scriptpath <script>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->script_path = (char *) ch_strdup (argv[1]);
+
+ /* use local interpreter */
+ } else if (strcasecmp (argv[0], "tclrealm") == 0) {
+ struct i_info *ii;
+
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing script in \"tclrealm <name>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_ii = NULL;
+
+ ii = global_i;
+ /* Try to see if it already exists */
+ do {
+ if (ii != NULL && !strcasecmp (ii->name, argv[1]))
+ ti->ti_ii = ii;
+ if (ii->next != NULL)
+ ii = ii->next;
+ } while (ii->next != NULL);
+
+ if (ti->ti_ii == NULL) { /* we need to make a new one */
+ ii->next = (struct i_info *) ch_malloc
+ (sizeof (struct i_info));
+
+ ii->next->count = 0;
+ ii->next->name = (char *) ch_strdup (argv[1]);
+ ii->next->interp = NULL;
+ ii->next->next = NULL;
+ ti->ti_ii = ii->next;
+ }
+
+ /* proc for binds */
+ } else if (strcasecmp (argv[0], "bind") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing proc in \"bind <proc>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_bind = (char *) ch_strdup (argv[1]);
+
+ /* proc for unbinds */
+ } else if (strcasecmp (argv[0], "unbind") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing proc in \"unbind <proc>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_unbind = (char *) ch_strdup (argv[1]);
+
+ /* proc for search */
+ } else if (strcasecmp (argv[0], "search") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing proc in \"search <proc>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_search = (char *) ch_strdup (argv[1]);
+
+ /* proc for compares */
+ } else if (strcasecmp (argv[0], "compare") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing proc in \"compare <proc>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_compare = (char *) ch_strdup (argv[1]);
+
+ /* proc for modify */
+ } else if (strcasecmp (argv[0], "modify") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing proc in \"modify <proc>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_modify = (char *) ch_strdup (argv[1]);
+
+ /* proc for modrdn */
+ } else if (strcasecmp (argv[0], "modrdn") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing proc in \"modrdn <proc>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_modrdn = (char *) ch_strdup (argv[1]);
+
+ /* proc for add */
+ } else if (strcasecmp (argv[0], "add") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing proc in \"add <proc>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_add = (char *) ch_strdup (argv[1]);
+
+ /* proc for delete */
+ } else if (strcasecmp (argv[0], "delete") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing proc in \"delete <proc>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_delete = (char *) ch_strdup (argv[1]);
+
+ /* proc for abandon */
+ } else if (strcasecmp (argv[0], "abandon") == 0) {
+ if (argc < 2) {
+ Debug (LDAP_DEBUG_CONFIG,
+ "%s: line %d: missing proc in \"abandon <proc>\" line\n",
+ fname, lineno, 0);
+ return (1);
+ }
+ ti->ti_search = (char *) ch_strdup (argv[1]);
+
+ } else {
+ Debug (LDAP_DEBUG_CONFIG,
+ "Unknown tcl backend config: %s\n", argv[0], 0, 0);
+ return (1);
+ }
+
+ return 0;
+}
+/* $OpenLDAP$ */
/* delete.c - tcl delete routines
- *
- * $Id: tcl_delete.c,v 1.7 1999/08/02 23:38:43 hallvard Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
+/* $OpenLDAP$ */
/* tcl_init.c - tcl backend initialization
- *
- * $Id: tcl_init.c,v 1.11 1999/08/07 09:37:45 hyc Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
+/* $OpenLDAP$ */
/* modify.c - tcl modify routines
- *
- * $Id: tcl_modify.c,v 1.7 1999/08/02 23:38:43 hallvard Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
+/* $OpenLDAP$ */
/* modrdn.c - tcl modify rdn routines
- *
- * $Id: tcl_modrdn.c,v 1.9 1999/08/02 23:38:43 hallvard Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
+/* $OpenLDAP$ */
/* search.c - tcl search routines
- *
- * $Id: tcl_search.c,v 1.7 1999/08/02 23:38:43 hallvard Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
--- /dev/null
+/* $OpenLDAP$ */
+/* unbind.c - tcl unbind routines
+ *
+ * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include "slap.h"
+#include "tcl_back.h"
+
+int
+tcl_back_unbind (
+ Backend * be,
+ Connection * conn,
+ Operation * op
+)
+{
+ char *command, *suf_tcl, *results;
+ int i, code, err = 0;
+ struct tclinfo *ti = (struct tclinfo *) be->be_private;
+
+ if (ti->ti_unbind == NULL) {
+ return (-1);
+ }
+
+ for (i = 0; be->be_suffix[i] != NULL; i++);
+ suf_tcl = Tcl_Merge (i, be->be_suffix);
+
+ command = (char *) ch_malloc (strlen (ti->ti_unbind) + strlen (suf_tcl)
+ + strlen (conn->c_dn ? conn->c_dn : "") + 64);
+ sprintf (command, "%s UNBIND {%ld} {%s} {%s}",
+ ti->ti_unbind, op->o_msgid, suf_tcl, conn->c_dn ?
+ conn->c_dn : "");
+ Tcl_Free (suf_tcl);
+
+ ldap_pvt_thread_mutex_lock (&tcl_interpreter_mutex);
+ code = Tcl_GlobalEval (ti->ti_ii->interp, command);
+ results = (char *) ch_strdup (ti->ti_ii->interp->result);
+ ldap_pvt_thread_mutex_unlock (&tcl_interpreter_mutex);
+ free (command);
+
+ if (code != TCL_OK) {
+ Debug (LDAP_DEBUG_SHELL, "tcl_unbind_error: %s\n", results,
+ 0, 0);
+ }
+
+ free (results);
+ return (err);
+}
+/* $OpenLDAP$ */
/* result.c - tcl backend utility functions
- *
- * $Id: tcl_util.c,v 1.9 1999/08/17 17:01:02 kdz Exp $
*
* Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
*
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include "slap.h"
#include "lutil.h"
-#include "ldap_defaults.h"
-
#ifdef SLAPD_LDAP
#include "back-ldap/external.h"
#endif
/* close each backend database */
for( i = 0; i < nBackendDB; i++ ) {
- BackendInfo *bi;
-
if ( backendDB[i].bd_info->bi_db_close ) {
backendDB[i].bd_info->bi_db_close(
&backendDB[i] );
if(rc != 0) {
Debug( LDAP_DEBUG_ANY,
"backend_close: bi_close %s failed!\n",
- bi->bi_type, 0, 0 );
+ backendDB[i].be_type, 0, 0 );
}
}
return 0;
}
-BackendInfo* backend_info(char *type)
+BackendInfo* backend_info(const char *type)
{
int i;
BackendDB *
backend_db_init(
- char *type
+ const char *type
)
{
Backend *be;
be->be_sizelimit = defsize;
be->be_timelimit = deftime;
+ /* assign a default depth limit for alias deref */
+ be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH;
+
be->be_realm = global_realm != NULL
? ch_strdup( global_realm ) : NULL;
}
Backend *
-select_backend( char * dn )
+select_backend( const char * dn )
{
int i, j, len, dnlen;
int
be_issuffix(
Backend *be,
- char *suffix
+ const char *suffix
)
{
int i;
}
int
-be_isroot( Backend *be, char *ndn )
+be_isroot( Backend *be, const char *ndn )
{
int rc;
}
int
-be_isroot_pw( Backend *be, char *ndn, struct berval *cred )
+be_isroot_pw( Backend *be, const char *ndn, struct berval *cred )
{
int result;
backend_group(
Backend *be,
Entry *target,
- char *gr_ndn,
- char *op_ndn,
- char *objectclassValue,
- char *groupattrName
+ const char *gr_ndn,
+ const char *op_ndn,
+ const char *objectclassValue,
+ const char *groupattrName
)
{
if (be->be_group)
/* bind.c - decode an ldap bind operation and pass it to a backend db */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
ber_int_t version;
ber_tag_t method;
char *mech;
- char *dn, *ndn;
+ char *dn;
+ char *ndn;
ber_tag_t tag;
int rc = LDAP_SUCCESS;
struct berval cred;
/* ch_malloc.c - malloc routines that test returns from malloc and friends */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* charray.c - routines for dealing with char * arrays */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
void
charray_add(
char ***a,
- char *s
+ const char *s
)
{
int n;
int
charray_inlist(
char **a,
- char *s
+ const char *s
)
{
int i;
char **
-str2charray( char *str, char *brkstr )
+str2charray( const char *str_in, const char *brkstr )
{
+ char *str;
char **res;
char *s;
char *lasts;
int i;
/* protect the input string from strtok */
- str = ch_strdup( str );
+ str = ch_strdup( str_in );
i = 1;
for ( s = str; *s; s++ ) {
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* config.c - configuration file handling routines */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/ctype.h>
#include <ac/socket.h>
-#include "ldap_defaults.h"
+#include "ldap_pvt.h"
#include "slap.h"
#define MAXARGS 100
int deftime = SLAPD_DEFAULT_TIMELIMIT;
AccessControl *global_acl = NULL;
int global_default_access = ACL_READ;
+int global_readonly = 0;
char *replogfile;
int global_lastmod = ON;
int global_idletimeout = 0;
static char *strtok_quote(char *line, char *sep);
int
-read_config( char *fname )
+read_config( const char *fname )
{
FILE *fp;
char *line, *savefname, *saveline;
bi = NULL;
be = backend_db_init( cargv[1] );
- /* assign a default depth limit for alias deref */
- be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH;
-
/* get pid file name */
} else if ( strcasecmp( cargv[0], "pidfile" ) == 0 ) {
if ( cargc < 2 ) {
char *dn = ch_strdup( cargv[1] );
(void) dn_normalize( dn );
charray_add( &be->be_suffix, dn );
- (void) str2upper( dn );
+ (void) ldap_pvt_str2upper( dn );
charray_add( &be->be_nsuffix, dn );
free( dn );
}
return( 1 );
}
if ( be == NULL ) {
- Debug( LDAP_DEBUG_ANY,
-"%s: line %d: readonly line must appear inside a database definition (ignored)\n",
- fname, lineno, 0 );
+ global_readonly = (strcasecmp( cargv[1], "on" ) == 0);
} else {
if ( strcasecmp( cargv[1], "on" ) == 0 ) {
be->be_readonly = 1;
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/string.h>
#include <ac/socket.h>
-#include "ldap_defaults.h"
#include "slap.h"
#if defined( SLAPD_CONFIG_DN )
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#define SLAP_C_BINDING 0x03 /* binding */
#define SLAP_C_CLOSING 0x04 /* closing */
-char* connection_state2str( int state ) {
+const char *
+connection_state2str( int state )
+{
switch( state ) {
case SLAP_C_INVALID: return "!";
case SLAP_C_INACTIVE: return "|";
#endif
assert( c != NULL );
- assert( c->c_struct_state != SLAP_C_USED );
- assert( c->c_conn_state == SLAP_C_INVALID );
if( c->c_struct_state == SLAP_C_UNINITIALIZED ) {
c->c_dn = NULL;
#endif
c->c_sb = ber_sockbuf_alloc( );
+ c->c_currentber = NULL;
/* should check status of thread calls */
ldap_pvt_thread_mutex_init( &c->c_mutex );
#ifdef HAVE_CYRUS_SASL
assert( c->c_sasl_context == NULL );
#endif
+ assert( c->c_currentber == NULL );
c->c_listener_url = ch_strdup( url );
c->c_peer_domain = ch_strdup( dnsname );
}
#endif
+ if ( c->c_currentber != NULL ) {
+ ber_free( c->c_currentber, 1 );
+ c->c_currentber = NULL;
+ }
+
if ( ber_pvt_sb_in_use(c->c_sb) ) {
int sd = ber_pvt_sb_get_desc(c->c_sb);
Debug( LDAP_DEBUG_TRACE,
"ber_get_next on fd %d failed errno=%d (%s)\n",
- ber_pvt_sb_get_desc( conn->c_sb ), err,
- err > -1 && err < sys_nerr ? sys_errlist[err] : "unknown" );
+ ber_pvt_sb_get_desc( conn->c_sb ), err, STRERROR(err) );
Debug( LDAP_DEBUG_TRACE,
"\t*** got %ld of %lu so far\n",
(long)(conn->c_currentber->ber_rwptr - conn->c_currentber->ber_buf),
+/* $OpenLDAP$ */
/*
* Copyright 1999 The OpenLDAP Foundation.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/time.h>
#include <ac/unistd.h>
-#include "ldap_defaults.h"
+#include "ldap_pvt.h"
+#include "lutil.h"
#include "slap.h"
#ifdef HAVE_TCPD
Listener **slap_listeners = NULL;
+static ber_socket_t wake_sds[2];
+
+#define WAKE_LISTENER(w) \
+do { if (w) tcp_write( wake_sds[1], "0", 1 ); } while(0)
+
#ifdef HAVE_WINSOCK2
/* in nt_main.c */
extern ldap_pvt_thread_cond_t started_event;
-
-/* forward reference */
-static void hit_socket(void);
-/* In wsa_err.c */
-char *WSAGetLastErrorString();
-static ldap_pvt_thread_t hit_tid;
-
-#define WAKE_LISTENER(w) \
-do {\
- if( w ) {\
- ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );\
- hit_socket(); \
- }\
-} while(0)
-#else
-#define WAKE_LISTENER(w) \
-do {\
- if( w ) {\
- ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );\
- }\
-} while(0)
#endif
#ifndef HAVE_WINSOCK
volatile sig_atomic_t slapd_shutdown = 0;
static ldap_pvt_thread_t listener_tid;
-static volatile sig_atomic_t slapd_listener = 0;
static struct slap_daemon {
ldap_pvt_thread_mutex_t sd_mutex;
*/
void slapd_remove(ber_socket_t s, int wake) {
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
- WAKE_LISTENER(wake);
Debug( LDAP_DEBUG_CONNS, "daemon: removing %ld%s%s\n",
(long) s,
FD_CLR( s, &slap_daemon.sd_writers );
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
+ WAKE_LISTENER(wake);
}
void slapd_clr_write(ber_socket_t s, int wake) {
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
- WAKE_LISTENER(wake);
assert( FD_ISSET( s, &slap_daemon.sd_actives) );
FD_CLR( s, &slap_daemon.sd_writers );
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
-
- if( wake ) {
- ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
- }
+ WAKE_LISTENER(wake);
}
void slapd_set_write(ber_socket_t s, int wake) {
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
- WAKE_LISTENER(wake);
assert( FD_ISSET( s, &slap_daemon.sd_actives) );
FD_SET( (unsigned) s, &slap_daemon.sd_writers );
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
-
- if( wake ) {
- ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
- }
+ WAKE_LISTENER(wake);
}
void slapd_clr_read(ber_socket_t s, int wake) {
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
- WAKE_LISTENER(wake);
assert( FD_ISSET( s, &slap_daemon.sd_actives) );
FD_CLR( s, &slap_daemon.sd_readers );
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
-
- if( wake ) {
- ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
- }
+ WAKE_LISTENER(wake);
}
void slapd_set_read(ber_socket_t s, int wake) {
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
- WAKE_LISTENER(wake);
assert( FD_ISSET( s, &slap_daemon.sd_actives) );
FD_SET( s, &slap_daemon.sd_readers );
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
-
- if( wake ) {
- ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
- }
+ WAKE_LISTENER(wake);
}
static void slapd_close(ber_socket_t s) {
}
-Listener *
+static Listener *
open_listener(
const char* url,
int port,
if ( (l.sl_sd = socket( AF_INET, SOCK_STREAM, 0 )) == AC_SOCKET_INVALID ) {
-#ifndef HAVE_WINSOCK
- int err = errno;
+ int err = sock_errno();
Debug( LDAP_DEBUG_ANY,
"daemon: socket() failed errno=%d (%s)\n", err,
- err > -1 && err < sys_nerr ? sys_errlist[err] :
- "unknown", 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "daemon: socket() failed errno=%d (%s)\n",
- WSAGetLastError(),
- WSAGetLastErrorString(), 0 );
-#endif
+ sock_errstr(err), 0 );
return NULL;
}
#ifdef SO_REUSEADDR
/* enable address reuse */
tmp = 1;
- if ( setsockopt( l.sl_sd, SOL_SOCKET, SO_REUSEADDR,
- (char *) &tmp, sizeof(tmp) ) == -1 )
- {
- int err = errno;
+ rc = setsockopt( l.sl_sd, SOL_SOCKET, SO_REUSEADDR,
+ (char *) &tmp, sizeof(tmp) );
+ if ( rc == AC_SOCKET_ERROR ) {
+ int err = sock_errno();
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(SO_REUSEADDR) failed errno=%d (%s)\n",
- (long) l.sl_sd, err,
- err > -1 && err < sys_nerr
- ? sys_errlist[err] : "unknown" );
+ (long) l.sl_sd, err, sock_errstr(err) );
}
#endif
#ifdef SO_KEEPALIVE
/* enable keep alives */
tmp = 1;
- if ( setsockopt( l.sl_sd, SOL_SOCKET, SO_KEEPALIVE,
- (char *) &tmp, sizeof(tmp) ) == -1 )
- {
- int err = errno;
+ rc = setsockopt( l.sl_sd, SOL_SOCKET, SO_KEEPALIVE,
+ (char *) &tmp, sizeof(tmp) );
+ if ( rc == AC_SOCKET_ERROR ) {
+ int err = sock_errno();
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(SO_KEEPALIVE) failed errno=%d (%s)\n",
- (long) l.sl_sd, err,
- err > -1 && err < sys_nerr
- ? sys_errlist[err] : "unknown" );
+ (long) l.sl_sd, err, sock_errstr(err) );
}
#endif
#ifdef TCP_NODELAY
/* enable no delay */
tmp = 1;
- if ( setsockopt( l.sl_sd, IPPROTO_TCP, TCP_NODELAY,
- (char *)&tmp, sizeof(tmp) ) )
- {
- int err = errno;
+ rc = setsockopt( l.sl_sd, IPPROTO_TCP, TCP_NODELAY,
+ (char *)&tmp, sizeof(tmp) );
+ if ( rc == AC_SOCKET_ERROR ) {
+ int err = sock_errno();
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(TCP_NODELAY) failed errno=%d (%s)\n",
- (long) l.sl_sd, err,
- err > -1 && err < sys_nerr
- ? sys_errlist[err] : "unknown" );
+ (long) l.sl_sd, err, sock_errstr(err) );
}
#endif
- if ( bind( l.sl_sd, (struct sockaddr *) &l.sl_addr, sizeof(l.sl_addr) ) == -1 ) {
- int err = errno;
+ rc = bind( l.sl_sd, (struct sockaddr *) &l.sl_addr, sizeof(l.sl_addr) );
+ if ( rc == AC_SOCKET_ERROR ) {
+ int err = sock_errno();
Debug( LDAP_DEBUG_ANY, "daemon: bind(%ld) failed errno=%d (%s)\n",
- (long) l.sl_sd, err,
- err > -1 && err < sys_nerr
- ? sys_errlist[err] : "unknown" );
+ (long) l.sl_sd, err, sock_errstr(err) );
tcp_close( l.sl_sd );
return NULL;
}
Debug( LDAP_DEBUG_ARGS, "daemon_init: %s (%d/%d)\n",
urls ? urls : "<null>", port, tls_port );
- if( rc = sockinit() ) {
+ if( (rc = sockinit()) != 0 ) {
return rc;
}
}
#endif /* !FD_SETSIZE */
+ /* open a pipe (or something equivalent connected to itself).
+ * we write a byte on this fd whenever we catch a signal. The main
+ * loop will be select'ing on this socket, and will wake up when
+ * this byte arrives.
+ */
+ if( (rc = lutil_pair( wake_sds )) < 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "daemon: lutil_pair() failed rc=%d\n", rc, 0, 0 );
+ return rc;
+ }
+
FD_ZERO( &slap_daemon.sd_readers );
FD_ZERO( &slap_daemon.sd_writers );
slapd_daemon_destroy(void)
{
connections_destroy();
+ tcp_close( wake_sds[1] );
+ tcp_close( wake_sds[0] );
sockdestroy();
return 0;
}
)
{
int l;
-
+ time_t last_idle_check = slap_get_time();
time( &starttime );
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
continue;
if ( listen( slap_listeners[l]->sl_sd, 5 ) == -1 ) {
- int err = errno;
+ int err = sock_errno();
Debug( LDAP_DEBUG_ANY,
"daemon: listen(%s, 5) failed errno=%d (%s)\n",
- (long) slap_listeners[l]->sl_url, err,
- err > -1 && err < sys_nerr
- ? sys_errlist[err] : "unknown" );
-
+ slap_listeners[l]->sl_url, err,
+ sock_errstr(err) );
return( (void*)-1 );
}
int ebadf = 0;
#define SLAPD_IDLE_CHECK_LIMIT 4
- time_t last_idle_check = slap_get_time();
- time_t now;
+ time_t now = slap_get_time();
fd_set readfds;
#ifdef FD_SET_MANUAL_COPY
for( s = 0; s < nfds; s++ ) {
- if(FD_ISSET( &slap_sd_writers, s )) {
- FD_SET( &writefds, s );
+ if(FD_ISSET( &slap_sd_readers, s )) {
+ FD_SET( s, &readfds );
}
if(FD_ISSET( &slap_sd_writers, s )) {
- FD_SET( &writefds, s );
+ FD_SET( s, &writefds );
}
}
#else
memcpy( &readfds, &slap_daemon.sd_readers, sizeof(fd_set) );
memcpy( &writefds, &slap_daemon.sd_writers, sizeof(fd_set) );
#endif
+ FD_SET( wake_sds[0], &readfds );
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
if ( slap_listeners[l]->sl_sd == AC_SOCKET_INVALID )
NULL, tvp ))
{
case -1: { /* failure - try again */
-#ifdef HAVE_WINSOCK
- int err = WSAGetLastError();
-#else
- int err = errno;
-#endif
+ int err = sock_errno();
if( err == EBADF && ++ebadf < SLAPD_EBADF_LIMIT) {
continue;
if( err != EINTR ) {
Debug( LDAP_DEBUG_CONNS,
"daemon: select failed (%d): %s\n",
- err,
- err >= 0 && err < sys_nerr
- ? sys_errlist[err] : "unknown",
- 0 );
+ err, sock_errstr(err), 0 );
-
- slapd_shutdown = -1;
+ slapd_shutdown = -1;
}
}
continue;
/* FALL THRU */
}
+ if( FD_ISSET( wake_sds[0], &readfds ) ) {
+ char c;
+ tcp_read( wake_sds[0], &c, 1 );
+ continue;
+ }
+
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
ber_int_t s;
socklen_t len = sizeof(from);
if ( (s = accept( slap_listeners[l]->sl_sd,
(struct sockaddr *) &from, &len )) == AC_SOCKET_INVALID )
{
- int err = errno;
+ int err = sock_errno();
Debug( LDAP_DEBUG_ANY,
- "daemon: accept(%ld) failed errno=%d (%s)\n", err,
- (long) slap_listeners[l]->sl_sd,
- err >= 0 && err < sys_nerr ?
- sys_errlist[err] : "unknown");
+ "daemon: accept(%ld) failed errno=%d (%s)\n",
+ (long) slap_listeners[l]->sl_sd, err,
+ sock_errstr(err) );
continue;
}
len = sizeof(from);
if ( getpeername( s, (struct sockaddr *) &from, &len ) != 0 ) {
- int err = errno;
+ int err = sock_errno();
Debug( LDAP_DEBUG_ANY,
"daemon: getpeername( %ld ) failed: errno=%d (%s)\n",
- (long) s, err,
- err >= 0 && err < sys_nerr ?
- sys_errlist[err] : "unknown" );
+ (long) s, err, sock_errstr(err) );
slapd_close(s);
continue;
}
sizeof(from.sin_addr.s_addr), AF_INET );
if(hp) {
- dnsname = str2lower( hp->h_name );
+ dnsname = ldap_pvt_str2lower( hp->h_name );
} else {
dnsname = NULL;
}
#else
for ( i = 0; i < nfds; i++ ) {
- int a, r, w;
+ int r, w;
int is_listener = 0;
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
return 0;
}
-void hit_socket(void)
-{
- ber_socket_t s;
- int on = 1;
- extern struct sockaddr_in bind_addr;
-
- /* throw something at the socket to terminate the select() in the daemon thread. */
- if (( s = socket( AF_INET, SOCK_STREAM, 0 )) == AC_SOCKET_INVALID )
- Debug( LDAP_DEBUG_ANY,
- "slap_set_shutdown: socket failed\n\tWSAGetLastError=%d (%s)\n",
- WSAGetLastError(), WSAGetLastErrorString(), 0 );
-
- if ( ioctlsocket( s, FIONBIO, &on ) == -1 )
- Debug( LDAP_DEBUG_ANY,
- "slap_set_shutdown:FIONBIO ioctl on %d faled\n\tWSAGetLastError=%d (%s)\n",
- s, WSAGetLastError(), WSAGetLastError() );
-
- bind_addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
-
- if ( connect( s, (struct sockaddr *)&bind_addr, sizeof( struct sockaddr_in )) == SOCKET_ERROR ) {
- Debug( LDAP_DEBUG_ANY,
- "hit_socket: error on connect: %d\n",
- WSAGetLastError(), 0, 0 );
- /* we can probably expect some error to occur here, mostly WSAEWOULDBLOCK */
- }
-
- tcp_close(s);
-}
-
#elif HAVE_WINSOCK
static int sockinit(void)
-{ WSADATA wsaData;
+{
+ WSADATA wsaData;
if ( WSAStartup( 0x0101, &wsaData ) != 0 ) {
return -1;
}
}
#endif
-void
-slap_set_shutdown( int sig )
+RETSIGTYPE
+slap_sig_shutdown( int sig )
{
- int l;
slapd_shutdown = sig;
-#ifndef HAVE_WINSOCK
- if(slapd_listener) {
- ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
- }
-#else
- /* trying to "hit" the socket seems to always get a */
- /* EWOULDBLOCK error, so just close the listen socket to */
- /* break out of the select since we're shutting down anyway */
- for ( l = 0; slap_listeners[l] != NULL; l++ ) {
- if ( slap_listeners[l]->sl_sd >= 0 ) {
- tcp_close( slap_listeners[l]->sl_sd );
- }
- }
-#endif
+ WAKE_LISTENER(1);
+
/* reinstall self */
- (void) SIGNAL( sig, slap_set_shutdown );
+ (void) SIGNAL( sig, slap_sig_shutdown );
}
-void
-slap_do_nothing( int sig )
+RETSIGTYPE
+slap_sig_wake( int sig )
{
+ WAKE_LISTENER(1);
+
/* reinstall self */
- (void) SIGNAL( sig, slap_do_nothing );
+ (void) SIGNAL( sig, slap_sig_wake );
}
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
return rc;
}
+ if ( global_readonly || be->be_readonly ) {
+ Debug( LDAP_DEBUG_ANY, "do_delete: database is read-only\n",
+ 0, 0, 0 );
+ free( ndn );
+ send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
+ NULL, "database is read-only", NULL, NULL );
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
+
/* deref suffix alias if appropriate */
ndn = suffix_alias( be, ndn );
/* dn.c - routines for dealing with distinguished names */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/string.h>
#include <ac/time.h>
+#include "ldap_pvt.h"
+
#include "slap.h"
#define B4LEADTYPE 0
char *
dn_normalize_case( char *dn )
{
- str2upper( dn );
+ ldap_pvt_str2upper( dn );
/* normalize format */
dn = dn_normalize( dn );
char *
dn_parent(
Backend *be,
- char *dn
+ const char *dn
)
{
- char *s;
+ const char *s;
int inquote;
if( dn == NULL ) {
return( NULL );
}
+#ifdef DNS_DN
/*
* no =, assume it is a dns name, like blah@some.domain.name
* if the blah@ part is there, return some.domain.name. if
return( ch_strdup( &s[1] ) );
}
}
+#endif
/*
* else assume it is an X.500-style name, which looks like
*/
char **dn_subtree(
Backend *be,
- char *dn )
+ const char *dn )
{
char *child, *parent;
char **subtree = NULL;
- child = dn;
+ child = ch_strdup( dn );
do {
charray_add( &subtree, child );
parent = dn_parent( be, child );
- if( child != dn ) {
- free( child );
- }
+ free( child );
child = parent;
} while ( child != NULL );
}
#endif
-char *
-str2upper( char *str )
-{
- char *s;
-
- /* normalize case */
- for ( s = str; *s; s++ ) {
- *s = TOUPPER( (unsigned char) *s );
- }
-
- return( str );
-}
-
-char *
-str2lower( char *str )
-{
- char *s;
-
- /* normalize case */
- for ( s = str; *s; s++ ) {
- *s = TOLOWER( (unsigned char) *s );
- }
-
- return( str );
-}
-
-
/*
* get_next_substring(), rdn_attr_type(), rdn_attr_value(), and
* build_new_dn().
*/
void
-build_new_dn( char ** new_dn, char *e_dn, char * p_dn, char * newrdn )
+build_new_dn( char ** new_dn,
+ const char *e_dn,
+ const char * p_dn,
+ const char * newrdn )
{
if ( p_dn == NULL ) {
/* entry.c - routines for dealing with entries */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+/*
+ * LDAPv3 Extended Operation Request
+ * ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
+ * requestName [0] LDAPOID,
+ * requestValue [1] OCTET STRING OPTIONAL
+ * }
+ *
+ * LDAPv3 Extended Operation Response
+ * ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ * COMPONENTS OF LDAPResult,
+ * responseName [10] LDAPOID OPTIONAL,
+ * response [11] OCTET STRING OPTIONAL
+ * }
+ *
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+
+char *supportedExtensions[] = {
+ NULL
+};
+
+
+int
+do_extended(
+ Connection *conn,
+ Operation *op
+)
+{
+ int rc = LDAP_SUCCESS;
+ char* reqoid ;
+ struct berval reqdata;
+ ber_tag_t tag;
+ ber_len_t len;
+
+ Debug( LDAP_DEBUG_TRACE, "do_extended\n", 0, 0, 0 );
+
+ reqoid = NULL;
+ reqdata.bv_val = NULL;
+
+ if( op->o_protocol < LDAP_VERSION3 ) {
+ Debug( LDAP_DEBUG_ANY, "do_extended: protocol version (%d) too low\n",
+ op->o_protocol, 0 ,0 );
+ send_ldap_disconnect( conn, op,
+ LDAP_PROTOCOL_ERROR, "requires LDAPv3" );
+ rc = -1;
+ goto done;
+ }
+
+ if ( ber_scanf( op->o_ber, "a", &reqoid ) == LBER_ERROR ) {
+ Debug( LDAP_DEBUG_ANY, "do_extended: ber_scanf failed\n", 0, 0 ,0 );
+ send_ldap_disconnect( conn, op,
+ LDAP_PROTOCOL_ERROR, "decoding error" );
+ rc = -1;
+ goto done;
+ }
+
+ if( !charray_inlist( supportedExtensions, reqoid ) ) {
+ Debug( LDAP_DEBUG_ANY, "do_extended: unsupported operation \"%s\"\n",
+ reqoid, 0 ,0 );
+ send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
+ NULL, "unsuppored extended operation", NULL, NULL );
+ goto done;
+ }
+
+ tag = ber_peek_tag( op->o_ber, &len );
+
+ if( ber_peek_tag( op->o_ber, &len ) == LDAP_TAG_EXOP_REQ_VALUE ) {
+ if( ber_scanf( op->o_ber, "o", &reqdata ) != LBER_ERROR ) {
+ Debug( LDAP_DEBUG_ANY, "do_extended: ber_scanf failed\n", 0, 0 ,0 );
+ send_ldap_disconnect( conn, op,
+ LDAP_PROTOCOL_ERROR, "decoding error" );
+ rc = -1;
+ goto done;
+ }
+ }
+
+ if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+ Debug( LDAP_DEBUG_ANY, "do_extended: get_ctrls failed\n", 0, 0 ,0 );
+ return rc;
+ }
+
+ Debug( LDAP_DEBUG_ARGS, "do_extended: oid \"%s\"\n", reqoid, 0 ,0 );
+
+ send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
+ NULL, "unsupported extended operation", NULL, NULL );
+
+done:
+ if ( reqoid != NULL ) {
+ free( reqoid );
+ }
+ if ( reqdata.bv_val != NULL ) {
+ free( reqdata.bv_val );
+ }
+
+ return rc;
+}
/* filter.c - routines for parsing and dealing with filters */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* filterentry.c - apply a filter to an entry */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
}
static void
-strcpy_special( char *d, char *s )
+strcpy_regex( char *d, char *s )
{
for ( ; *s; s++ ) {
switch ( *s ) {
+ case '^':
case '.':
- case '\\':
case '[':
- case ']':
+ case ']': /* ? */
+ case '$':
+ case '(':
+ case ')': /* ? */
+ case '|':
case '*':
case '+':
- case '^':
- case '$':
+ case '?':
+ case '{':
+ case '}': /* ? */
+ case '\\':
*d++ = '\\';
/* FALL */
default:
0, 0, 0 );
return( -1 );
}
- strcpy_special( p, f->f_sub_initial );
+ strcpy_regex( p, f->f_sub_initial );
p = strchr( p, '\0' );
}
if ( f->f_sub_any != NULL ) {
}
strcpy( p, ".*" );
p = strchr( p, '\0' );
- strcpy_special( p, f->f_sub_any[i] );
+ strcpy_regex( p, f->f_sub_any[i] );
p = strchr( p, '\0' );
}
}
}
strcpy( p, ".*" );
p = strchr( p, '\0' );
- strcpy_special( p, f->f_sub_final );
+ strcpy_regex( p, f->f_sub_final );
p = strchr( p, '\0' );
strcpy( p, "$" );
}
/* compile the regex */
Debug( LDAP_DEBUG_FILTER, "test_substring_filter: regcomp pat: %s\n",
pat, 0, 0 );
- if ((rc = regcomp(&re, pat, 0))) {
+ if ((rc = regcomp(&re, pat, REG_EXTENDED|REG_NOSUB))) {
char error[512];
regerror(rc, &re, error, sizeof(error));
/* init.c - initialize various things */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* lock.c - routines to open and apply an advisory lock to a file */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include "slap.h"
FILE *
-lock_fopen( char *fname, char *type, FILE **lfp )
+lock_fopen( const char *fname, const char *type, FILE **lfp )
{
FILE *fp;
char buf[MAXPATHLEN];
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/signal.h>
#include <ac/errno.h>
-#include "ldap_defaults.h"
#include "slap.h"
#include "lutil.h"
/* table to compute syslog-options to integer */
static STRDISP syslog_types[] = {
- { "LOCAL0", 6, LOG_LOCAL0 },
- { "LOCAL1", 6, LOG_LOCAL1 },
- { "LOCAL2", 6, LOG_LOCAL2 },
- { "LOCAL3", 6, LOG_LOCAL3 },
- { "LOCAL4", 6, LOG_LOCAL4 },
- { "LOCAL5", 6, LOG_LOCAL5 },
- { "LOCAL6", 6, LOG_LOCAL6 },
- { "LOCAL7", 6, LOG_LOCAL7 },
- { NULL }
+ { "LOCAL0", sizeof("LOCAL0"), LOG_LOCAL0 },
+ { "LOCAL1", sizeof("LOCAL1"), LOG_LOCAL1 },
+ { "LOCAL2", sizeof("LOCAL2"), LOG_LOCAL2 },
+ { "LOCAL3", sizeof("LOCAL3"), LOG_LOCAL3 },
+ { "LOCAL4", sizeof("LOCAL4"), LOG_LOCAL4 },
+ { "LOCAL5", sizeof("LOCAL5"), LOG_LOCAL5 },
+ { "LOCAL6", sizeof("LOCAL6"), LOG_LOCAL6 },
+ { "LOCAL7", sizeof("LOCAL7"), LOG_LOCAL7 },
+ { NULL }
};
static int cnvt_str2int( char *, STRDISP_P, int );
int main( int argc, char **argv )
#endif
{
- int i;
+ int i, no_detach = 0;
int rc;
char *urls = NULL;
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
{
int *i;
char *newConfigFile;
- if ( is_NT_Service ) CommenceStartupProcessing( NTservice, slap_set_shutdown );
+
+ if ( is_NT_Service ) {
+ CommenceStartupProcessing( NTservice, slap_sig_shutdown );
+ }
+
i = (int*)getRegParam( NULL, "Port" );
if ( i != NULL )
{
)) != EOF ) {
switch ( i ) {
case 'h': /* listen URLs */
+ if ( urls != NULL ) free( urls );
urls = ch_strdup( optarg );
break;
+ case 'd': /* set debug level and 'do not detach' flag */
+ no_detach = 1;
#ifdef LDAP_DEBUG
- case 'd': /* turn on debugging */
slap_debug |= atoi( optarg );
- break;
#else
- case 'd': /* turn on debugging */
- fprintf( stderr,
- "must compile with LDAP_DEBUG for debugging\n" );
- break;
+ if ( atoi( optarg ) != 0 )
+ fputs( "must compile with LDAP_DEBUG for debugging\n",
+ stderr );
#endif
+ break;
case 'f': /* read config file */
configfile = ch_strdup( optarg );
ldap_pvt_tls_init_def_ctx();
#endif
- (void) SIGNAL( LDAP_SIGUSR1, slap_do_nothing );
- (void) SIGNAL( LDAP_SIGUSR2, slap_set_shutdown );
+ (void) SIGNAL( LDAP_SIGUSR1, slap_sig_wake );
+ (void) SIGNAL( LDAP_SIGUSR2, slap_sig_shutdown );
+
#ifdef SIGPIPE
(void) SIGNAL( SIGPIPE, SIG_IGN );
#endif
#ifdef SIGHUP
- (void) SIGNAL( SIGHUP, slap_set_shutdown );
+ (void) SIGNAL( SIGHUP, slap_sig_shutdown );
#endif
- (void) SIGNAL( SIGINT, slap_set_shutdown );
- (void) SIGNAL( SIGTERM, slap_set_shutdown );
+ (void) SIGNAL( SIGINT, slap_sig_shutdown );
+ (void) SIGNAL( SIGTERM, slap_sig_shutdown );
#ifdef LDAP_SIGCHLD
(void) SIGNAL( LDAP_SIGCHLD, wait4child );
#endif
#ifdef SIGBREAK
/* SIGBREAK is generated when Ctrl-Break is pressed. */
- (void) SIGNAL( SIGBREAK, slap_set_shutdown );
+ (void) SIGNAL( SIGBREAK, slap_sig_shutdown );
#endif
#ifndef HAVE_WINSOCK
-#ifdef LDAP_DEBUG
- lutil_detach( ldap_debug, 0 );
-#else
- lutil_detach( 0, 0 );
-#endif
+ lutil_detach( no_detach, 0 );
#endif /* HAVE_WINSOCK */
#ifdef CSRIMALLOC
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
(*modtail)->ml_op != LDAP_MOD_DELETE &&
(*modtail)->ml_op != LDAP_MOD_REPLACE )
{
+ Debug( LDAP_DEBUG_ANY,
+ "do_modify: invalid modify operation (%ld)\n",
+ (long) (*modtail)->ml_op, 0, 0 );
send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR,
NULL, "unrecognized modify operation", NULL, NULL );
free( ndn );
return LDAP_PROTOCOL_ERROR;
}
- if ( (*modtail)->ml_bvalues == NULL
- && (*modtail)->ml_op != LDAP_MOD_DELETE )
+ if ( (*modtail)->ml_bvalues == NULL && (
+ (*modtail)->ml_op != LDAP_MOD_REPLACE &&
+ (*modtail)->ml_op != LDAP_MOD_DELETE ) )
{
+ Debug( LDAP_DEBUG_ANY,
+ "do_modify: invalid modify operation (%ld) without values\n",
+ (long) (*modtail)->ml_op, 0, 0 );
send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR,
- NULL, "unrecognized modify operation", NULL, NULL );
+ NULL, "unrecognized modify operation without values",
+ NULL, NULL );
free( ndn );
modlist_free( modlist );
return LDAP_PROTOCOL_ERROR;
return rc;
}
+ if ( global_readonly || be->be_readonly ) {
+ Debug( LDAP_DEBUG_ANY, "do_modify: database is read-only\n",
+ 0, 0, 0 );
+ send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+ NULL, "database is read-only", NULL, NULL );
+ goto done;
+ }
+
/* deref suffix alias if appropriate */
ndn = suffix_alias( be, ndn );
NULL, "Function not implemented", NULL, NULL );
}
+done:
free( ndn );
modlist_free( modlist );
return rc;
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
0, 0, 0 );
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "newSuperior requires LDAPv3" );
+ free( ndn );
+ free( newrdn );
return -1;
}
if ( ber_scanf( op->o_ber, "a", &newSuperior )
== LBER_ERROR ) {
- Debug( LDAP_DEBUG_ANY, "ber_scanf(\"a\"}) failed\n",
+ Debug( LDAP_DEBUG_ANY, "ber_scanf(\"a\") failed\n",
0, 0, 0 );
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
+ free( ndn );
+ free( newrdn );
return -1;
}
newSuperior, 0, 0 );
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid (new superior) DN", NULL, NULL );
- free( ndn );
- free( newrdn );
- return rc;
+ goto done;
}
}
}
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
- free( ndn );
- free( newrdn );
- free( newSuperior );
Debug( LDAP_DEBUG_ANY, "do_modrdn: get_ctrls failed\n", 0, 0, 0 );
- return rc;
+ /* get_ctrls has sent results. Now clean up. */
+ goto done;
}
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MODRDN dn=\"%s\"\n",
return rc;
}
+ if ( global_readonly || be->be_readonly ) {
+ Debug( LDAP_DEBUG_ANY, "do_modrdn: database is read-only\n",
+ 0, 0, 0 );
+ send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+ NULL, "database is read-only", NULL, NULL );
+ goto done;
+ }
+
/* Make sure that the entry being changed and the newSuperior are in
* the same backend, otherwise we return an error.
*/
NULL, "Function not implemented", NULL, NULL );
}
+done:
free( ndn );
free( newrdn );
free( newSuperior );
+/* $OpenLDAP$ */
#include "portable.h"
#include <stdio.h>
#include "slap.h"
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/string.h>
#include <ac/time.h>
-#include "ldap_defaults.h"
#include "slap.h"
#if defined( SLAPD_MONITOR_DN )
--- /dev/null
+/* $OpenLDAP$ */
+// nt_main.c
+#include "portable.h"
+#include <stdio.h>
+
+#include <ac/string.h>
+
+#include "slap.h"
+
+ldap_pvt_thread_cond_t started_event, stopped_event;
+ldap_pvt_thread_t start_status_tid, stop_status_tid;
+
+
+/* in main.c */
+void WINAPI ServiceMain( DWORD argc, LPTSTR *argv );
+
+/* in ntservice.c */
+int srv_install( char* service, char* filename );
+int srv_remove ( char* service, char* filename );
+
+int main( DWORD argc, LPTSTR *argv )
+{
+ int length;
+ char filename[MAX_PATH], *fname_start;
+ extern int is_NT_Service;
+
+ SERVICE_TABLE_ENTRY DispatchTable[] = {
+ { SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION) ServiceMain },
+ { NULL, NULL }
+ };
+
+ /*
+ // set the service's current directory to being the installation directory for the service.
+ // this way we don't have to write absolute paths in the configuration files
+ */
+ GetModuleFileName( NULL, filename, sizeof( filename ) );
+ fname_start = strrchr( filename, *LDAP_DIRSEP );
+ *fname_start = '\0';
+ SetCurrentDirectory( filename );
+
+ if ( argc > 1 ) {
+ if ( _stricmp( "install", argv[1] ) == 0 )
+ {
+ char *svcName = SERVICE_NAME;
+ if ( (argc > 2) && (argv[2] != NULL) )
+ svcName = argv[2];
+ if ( (length = GetModuleFileName(NULL, filename, sizeof( filename ))) == 0 )
+ {
+ fputs( "unable to retrieve file name for the service.\n", stderr );
+ return EXIT_FAILURE;
+ }
+ if ( !srv_install(svcName, filename) )
+ {
+ fputs( "service failed installation ...\n", stderr );
+ return EXIT_FAILURE;
+ }
+ fputs( "service has been installed ...\n", stderr );
+ return EXIT_SUCCESS;
+ }
+
+ if ( _stricmp( "remove", argv[1] ) == 0 )
+ {
+ char *svcName = SERVICE_NAME;
+ if ( (argc > 2) && (argv[2] != NULL) )
+ svcName = argv[2];
+ if ( (length = GetModuleFileName(NULL, filename, sizeof( filename ))) == 0 )
+ {
+ fputs( "unable to retrieve file name for the service.\n", stderr );
+ return EXIT_FAILURE;
+ }
+ if ( !srv_remove(svcName, filename) )
+ {
+ fputs( "failed to remove the service ...\n", stderr );
+ return EXIT_FAILURE;
+ }
+ fputs( "service has been removed ...\n", stderr );
+ return EXIT_SUCCESS;
+ }
+ }
+
+ puts( "starting slapd..." );
+ if ( !StartServiceCtrlDispatcher(DispatchTable) )
+ {
+ is_NT_Service = 0;
+ ServiceMain( argc, argv );
+ }
+
+ return EXIT_SUCCESS;
+}
/* operation.c - routines to deal with pending ldap operations */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
if ( *tmp == NULL ) {
Debug( LDAP_DEBUG_ANY, "op_delete: can't find op %ld\n",
- op->o_msgid, 0, 0 );
+ (long) op->o_msgid, 0, 0 );
return -1;
}
/* phonetic.c - routines to do phonetic matching */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
char *attr, int nmatches, regmatch_t *matches ));
int acl_access_allowed LDAP_P((
- AccessControl *a, Backend *be, Connection *conn, Entry *e,
+ AccessControl *a, char *attr, Backend *be, Connection *conn, Entry *e,
struct berval *val, Operation *op, int access, char *edn,
regmatch_t *matches ));
* aclparse.c
*/
-void parse_acl LDAP_P(( Backend *be, char *fname, int lineno, int argc, char **argv ));
+void parse_acl LDAP_P(( Backend *be,
+ const char *fname,
+ int lineno,
+ int argc, char **argv ));
char * access2str LDAP_P(( int access ));
int str2access LDAP_P(( char *str ));
int attr_merge_fast LDAP_P(( Entry *e, char *type, struct berval **vals, int nvals,
int naddvals, int *maxvals, Attribute ***a ));
int attr_merge LDAP_P(( Entry *e, char *type, struct berval **vals ));
-Attribute * attr_find LDAP_P(( Attribute *a, char *type ));
-int attr_delete LDAP_P(( Attribute **attrs, char *type ));
+Attribute * attr_find LDAP_P(( Attribute *a, const char *type ));
+int attr_delete LDAP_P(( Attribute **attrs, const char *type ));
int attr_syntax LDAP_P(( char *type ));
-void attr_syntax_config LDAP_P(( char *fname, int lineno, int argc, char **argv ));
+void attr_syntax_config LDAP_P(( const char *fname, int lineno, int argc, char **argv ));
AttributeType * at_find LDAP_P(( const char *name ));
int at_find_in_list LDAP_P(( AttributeType *sat, AttributeType **list ));
int at_append_to_list LDAP_P(( AttributeType *sat, AttributeType ***listp ));
int backend_shutdown LDAP_P((Backend *be));
int backend_destroy LDAP_P((void));
-BackendInfo * backend_info LDAP_P(( char *type ));
-BackendDB * backend_db_init LDAP_P(( char *type ));
+BackendInfo * backend_info LDAP_P(( const char *type ));
+BackendDB * backend_db_init LDAP_P(( const char *type ));
-BackendDB * select_backend LDAP_P(( char * dn ));
+BackendDB * select_backend LDAP_P(( const char * dn ));
-int be_issuffix LDAP_P(( Backend *be, char *suffix ));
-int be_isroot LDAP_P(( Backend *be, char *ndn ));
-int be_isroot_pw LDAP_P(( Backend *be, char *ndn, struct berval *cred ));
+int be_issuffix LDAP_P(( Backend *be, const char *suffix ));
+int be_isroot LDAP_P(( Backend *be, const char *ndn ));
+int be_isroot_pw LDAP_P(( Backend *be, const char *ndn, struct berval *cred ));
char* be_root_dn LDAP_P(( Backend *be ));
int be_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw ));
#define be_entry_release_r( be, e ) be_entry_release_rw( be, e, 0 )
extern int backend_group LDAP_P((Backend *be,
Entry *target,
- char *gr_ndn, char *op_ndn,
- char *objectclassValue, char *groupattrName));
+ const char *gr_ndn,
+ const char *op_ndn,
+ const char *objectclassValue,
+ const char *groupattrName));
#ifdef SLAPD_SCHEMA_DN
/* temporary extern for temporary routine*/
* charray.c
*/
-void charray_add LDAP_P(( char ***a, char *s ));
+void charray_add LDAP_P(( char ***a, const char *s ));
void charray_merge LDAP_P(( char ***a, char **s ));
void charray_free LDAP_P(( char **array ));
-int charray_inlist LDAP_P(( char **a, char *s ));
+int charray_inlist LDAP_P(( char **a, const char *s ));
char ** charray_dup LDAP_P(( char **a ));
-char ** str2charray LDAP_P(( char *str, char *brkstr ));
+char ** str2charray LDAP_P(( const char *str, const char *brkstr ));
char * charray2str LDAP_P(( char **a ));
/*
* config.c
*/
-int read_config LDAP_P(( char *fname ));
+int read_config LDAP_P(( const char *fname ));
/*
* connection.c
void connection_closing LDAP_P(( Connection *c ));
int connection_state_closing LDAP_P(( Connection *c ));
-char *connection_state2str LDAP_P(( int state ));
+const char *connection_state2str LDAP_P(( int state )) LDAP_GCCATTR((const));
int connection_write LDAP_P((ber_socket_t s));
int connection_read LDAP_P((ber_socket_t s));
char * dn_normalize LDAP_P(( char *dn ));
char * dn_normalize_case LDAP_P(( char *dn ));
-char * dn_parent LDAP_P(( Backend *be, char *dn ));
-char ** dn_subtree LDAP_P(( Backend *be, char *dn ));
+char * dn_parent LDAP_P(( Backend *be, const char *dn ));
+char ** dn_subtree LDAP_P(( Backend *be, const char *dn ));
char * dn_rdn LDAP_P(( Backend *be, char *dn ));
int dn_issuffix LDAP_P(( char *dn, char *suffix ));
#ifdef DNS_DN
int dn_type LDAP_P(( char *dn ));
#endif
-char * str2upper LDAP_P(( char *str ));
-char * str2lower LDAP_P(( char *str ));
int rdn_validate LDAP_P(( const char* str ));
char * rdn_attr_value LDAP_P(( char * rdn ));
char * rdn_attr_type LDAP_P(( char * rdn ));
-void build_new_dn LDAP_P(( char ** new_dn, char *e_dn, char * p_dn,
- char * newrdn ));
+
+void build_new_dn LDAP_P(( char ** new_dn,
+ const char *e_dn,
+ const char * p_dn,
+ const char * newrdn ));
/*
* entry.c
*/
* lock.c
*/
-FILE * lock_fopen LDAP_P(( char *fname, char *type, FILE **lfp ));
+FILE * lock_fopen LDAP_P(( const char *fname, const char *type, FILE **lfp ));
int lock_fclose LDAP_P(( FILE *fp, FILE *lfp ));
/*
void send_ldap_result LDAP_P((
Connection *conn, Operation *op,
- int err, char *matched, char *text,
+ int err, const char *matched, const char *text,
struct berval **refs,
LDAPControl **ctrls ));
void send_ldap_disconnect LDAP_P((
Connection *conn, Operation *op,
- int err, char *text ));
+ int err, const char *text ));
void send_search_result LDAP_P((
Connection *conn, Operation *op,
- int err, char *matched, char *text,
+ int err, const char *matched, const char *text,
struct berval **refs,
LDAPControl **ctrls,
int nentries ));
*/
int oc_schema_check LDAP_P(( Entry *e ));
-int oc_check_operational_attr LDAP_P(( char *type ));
-int oc_check_usermod_attr LDAP_P(( char *type ));
-int oc_check_no_usermod_attr LDAP_P(( char *type ));
+int oc_check_operational_attr LDAP_P(( const char *type ));
+int oc_check_usermod_attr LDAP_P(( const char *type ));
+int oc_check_no_usermod_attr LDAP_P(( const char *type ));
ObjectClass *oc_find LDAP_P((const char *ocname));
int oc_add LDAP_P((LDAP_OBJECT_CLASS *oc, const char **err));
Syntax *syn_find LDAP_P((const char *synname));
int syn_add LDAP_P((LDAP_SYNTAX *syn, slap_syntax_check_func *check, const char **err));
MatchingRule *mr_find LDAP_P((const char *mrname));
int mr_add LDAP_P((LDAP_MATCHING_RULE *mr, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare, const char **err));
+int case_ignore_normalize LDAP_P((struct berval *val, struct berval **normalized));
+int register_syntax LDAP_P((char *desc, slap_syntax_check_func *check ));
+int register_matching_rule LDAP_P((char * desc, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare));
void schema_info LDAP_P((Connection *conn, Operation *op, char **attrs, int attrsonly));
int schema_init LDAP_P((void));
-int is_entry_objectclass LDAP_P(( Entry *, char* objectclass ));
+int is_entry_objectclass LDAP_P(( Entry *, const char* objectclass ));
#define is_entry_alias(e) is_entry_objectclass((e), "ALIAS")
#define is_entry_referral(e) is_entry_objectclass((e), "REFERRAL")
* schemaparse.c
*/
-void parse_oc_old LDAP_P(( Backend *be, char *fname, int lineno, int argc, char **argv ));
-void parse_oc LDAP_P(( char *fname, int lineno, char *line, char **argv ));
-void parse_at LDAP_P(( char *fname, int lineno, char *line, char **argv ));
-void parse_oidm LDAP_P(( char *fname, int lineno, int argc, char **argv ));
-char *scherr2str LDAP_P((int code));
-int dscompare LDAP_P(( char *s1, char *s2del, char delim ));
+void parse_oc_old LDAP_P(( Backend *be, const char *fname, int lineno, int argc, char **argv ));
+void parse_oc LDAP_P(( const char *fname, int lineno, char *line, char **argv ));
+void parse_at LDAP_P(( const char *fname, int lineno, char *line, char **argv ));
+void parse_oidm LDAP_P(( const char *fname, int lineno, int argc, char **argv ));
+char *scherr2str LDAP_P((int code)) LDAP_GCCATTR((const));
+int dscompare LDAP_P(( const char *s1, const char *s2del, char delim ));
/*
* str2filter.c
*/
extern int deftime;
extern int g_argc;
extern int global_default_access;
+extern int global_readonly;
extern int global_lastmod;
extern int global_idletimeout;
extern int global_schemacheck;
extern void slapd_remove LDAP_P((ber_socket_t s, int wake));
-extern void slap_set_shutdown LDAP_P((int sig));
-extern void slap_do_nothing LDAP_P((int sig));
+extern RETSIGTYPE slap_sig_shutdown LDAP_P((int sig));
+extern RETSIGTYPE slap_sig_wake LDAP_P((int sig));
extern void config_info LDAP_P((
Connection *conn,
/* repl.c - log modifications for replication purposes */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* result.c - routines to send ldap results, errors, and referrals */
+/* $OpenLDAP$ */
#include "portable.h"
#include <ac/time.h>
#include <ac/unistd.h>
-#include "ldap_defaults.h"
#include "slap.h"
/* we need LBER internals */
if( refs == NULL ) return;
for( i=0; refs[i] != NULL; i++ ) {
- if( refs[i]->bv_len > sizeof("ldap://") &&
+ if( refs[i]->bv_len > sizeof("ldap://")-1 &&
strncasecmp( refs[i]->bv_val, "ldap://",
sizeof("ldap://")-1 ) == 0 )
{
unsigned j;
- for( j=sizeof("ldap://"); j<refs[i]->bv_len ; j++ ) {
- if( refs[i]->bv_val[j] = '/' ) {
+ for( j=sizeof("ldap://")-1; j<refs[i]->bv_len ; j++ ) {
+ if( refs[i]->bv_val[j] == '/' ) {
refs[i]->bv_val[j] = '\0';
refs[i]->bv_len = j;
break;
if ( connection_state_closing( conn ) ) {
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
ldap_pvt_thread_mutex_unlock( &conn->c_write_mutex );
+
return 0;
}
- if ( ber_flush( conn->c_sb, ber, 1 ) == 0 ) {
+ if ( ber_flush( conn->c_sb, ber, 0 ) == 0 ) {
break;
}
*/
Debug( LDAP_DEBUG_CONNS, "ber_flush failed errno=%d reason=\"%s\"\n",
- err, err > -1 && err < sys_nerr ? sys_errlist[err]
- : "unknown", 0 );
+ err, STRERROR(err), 0 );
if ( err != EWOULDBLOCK && err != EAGAIN ) {
connection_closing( conn );
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
ldap_pvt_thread_mutex_unlock( &conn->c_write_mutex );
+
return( -1 );
}
ber_tag_t tag,
ber_int_t msgid,
ber_int_t err,
- char *matched,
- char *text,
+ const char *matched,
+ const char *text,
struct berval **ref,
- char *resoid,
+ const char *resoid,
struct berval *resdata,
LDAPControl **ctrls
)
if ( rc == -1 ) {
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+ ber_free( ber, 1 );
return;
}
/* send BER */
bytes = send_ldap_ber( conn, ber );
+ ber_free( ber, 1 );
if ( bytes < 0 ) {
Debug( LDAP_DEBUG_ANY,
Connection *conn,
Operation *op,
ber_int_t err,
- char *text
+ const char *text
)
{
ber_tag_t tag;
Connection *conn,
Operation *op,
ber_int_t err,
- char *matched,
- char *text,
+ const char *matched,
+ const char *text,
struct berval **ref,
LDAPControl **ctrls
)
err = LDAP_NO_SUCH_OBJECT;
} else if ( op->o_protocol < LDAP_VERSION3 ) {
err = LDAP_PARTIAL_RESULTS;
- tmp = text = v2ref( ref );
+ tmp = v2ref( ref );
+ text = tmp;
ref = NULL;
}
}
Connection *conn,
Operation *op,
ber_int_t err,
- char *matched,
- char *text,
+ const char *matched,
+ const char *text,
struct berval **refs,
LDAPControl **ctrls,
int nentries
err = LDAP_PARTIAL_RESULTS;
}
- tmp = text = v2ref( refs );
+ tmp = v2ref( refs );
+ text = tmp;
refs = NULL;
} else {
#ifdef LDAP_CONNECTIONLESS
if ( op->o_cldap ) {
- ber_pvt_sb_udp_set_dst( &conn->c_sb, &op->o_clientaddr );
+ ber_pvt_sb_udp_set_dst( conn->c_sb, &op->o_clientaddr );
Debug( LDAP_DEBUG_TRACE, "UDP response to %s port %d\n",
inet_ntoa(((struct sockaddr_in *)
&op->o_clientaddr)->sin_addr ),
acl = acl_get_applicable( be, op, e, a->a_type,
MAXREMATCHES, matches );
- if ( ! acl_access_allowed( acl, be, conn, e,
+ if ( ! acl_access_allowed( acl, a->a_type, be, conn, e,
NULL, op, ACL_READ, edn, matches ) )
{
continue;
if ( ! attrsonly ) {
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
if ( a->a_syntax & SYNTAX_DN &&
- ! acl_access_allowed( acl, be, conn, e, a->a_vals[i], op,
+ ! acl_access_allowed( acl, a->a_type, be, conn, e, a->a_vals[i], op,
ACL_READ, edn, matches) )
{
continue;
acl = acl_get_applicable( be, op, e, a->a_type,
MAXREMATCHES, matches );
- if ( ! acl_access_allowed( acl, be, conn, e,
+ if ( ! acl_access_allowed( acl, a->a_type, be, conn, e,
NULL, op, ACL_READ, edn, matches ) )
{
continue;
if ( ! attrsonly ) {
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
if ( a->a_syntax & SYNTAX_DN &&
- ! acl_access_allowed( acl, be, conn, e, a->a_vals[i], op,
+ ! acl_access_allowed( acl, a->a_type, be, conn, e, a->a_vals[i], op,
ACL_READ, edn, matches) )
{
continue;
}
bytes = send_ldap_ber( conn, ber );
+ ber_free( ber, 1 );
if ( bytes < 0 ) {
Debug( LDAP_DEBUG_ANY,
}
bytes = send_ldap_ber( conn, ber );
+ ber_free( ber, 1 );
ldap_pvt_thread_mutex_lock( &num_sent_mutex );
num_bytes_sent += bytes;
+/* $OpenLDAP$ */
/* root_dse.c - Provides the ROOT DSA-Specific Entry
*
* Copyright 1999 The OpenLDAP Foundation.
#include <ac/string.h>
-#include "ldap_defaults.h"
#include "slap.h"
void
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
/* schema.c - routines to enforce schema definitions */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/string.h>
#include <ac/socket.h>
-#include "ldap_defaults.h"
#include "slap.h"
static char * oc_check_required(Entry *e, char *ocname);
oc_schema_check( Entry *e )
{
Attribute *a, *aoc;
+ ObjectClass *oc;
int i;
int ret = 0;
+
/* find the object class attribute - could error out here */
if ( (aoc = attr_find( e->e_attrs, "objectclass" )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "No object class for entry (%s)\n",
/* check that the entry has required attrs for each oc */
for ( i = 0; aoc->a_vals[i] != NULL; i++ ) {
- char *s = oc_check_required( e, aoc->a_vals[i]->bv_val );
-
- if (s != NULL) {
+ if ( (oc = oc_find( aoc->a_vals[i]->bv_val )) == NULL ) {
Debug( LDAP_DEBUG_ANY,
- "Entry (%s), oc \"%s\" requires attr \"%s\"\n",
- e->e_dn, aoc->a_vals[i]->bv_val, s );
- ret = 1;
+ "Objectclass \"%s\" not defined",
+ aoc->a_vals[i]->bv_val, 0, 0 );
+ }
+ else
+ {
+ char *s = oc_check_required( e, aoc->a_vals[i]->bv_val );
+
+ if (s != NULL) {
+ Debug( LDAP_DEBUG_ANY,
+ "Entry (%s), oc \"%s\" requires attr \"%s\"\n",
+ e->e_dn, aoc->a_vals[i]->bv_val, s );
+ ret = 1;
+ }
}
}
* check to see if attribute is 'operational' or not.
*/
int
-oc_check_operational_attr( char *type )
+oc_check_operational_attr( const char *type )
{
return charray_inlist( oc_operational_attrs, type )
|| charray_inlist( oc_usermod_attrs, type )
* check to see if attribute can be user modified or not.
*/
int
-oc_check_usermod_attr( char *type )
+oc_check_usermod_attr( const char *type )
{
return charray_inlist( oc_usermod_attrs, type );
}
* check to see if attribute is 'no user modification' or not.
*/
int
-oc_check_no_usermod_attr( char *type )
+oc_check_no_usermod_attr( const char *type )
{
return charray_inlist( oc_no_usermod_attrs, type );
}
code = oc_add_sups(soc,soc1->soc_sup_oids, err);
if ( code )
return code;
-
- if ( code = oc_create_required(soc,
- soc1->soc_at_oids_must,err) )
+
+ code = oc_create_required(soc,soc1->soc_at_oids_must,err);
+ if ( code )
return code;
- if ( code = oc_create_allowed(soc,
- soc1->soc_at_oids_may,err) )
+ code = oc_create_allowed(soc,soc1->soc_at_oids_may,err);
+ if ( code )
return code;
+
nsups++;
sups1++;
}
soc = (ObjectClass *) ch_calloc( 1, sizeof(ObjectClass) );
memcpy( &soc->soc_oclass, oc, sizeof(LDAP_OBJECT_CLASS));
- if ( code = oc_add_sups(soc,soc->soc_sup_oids,err) )
+ if ( (code = oc_add_sups(soc,soc->soc_sup_oids,err)) != 0 )
return code;
- if ( code = oc_create_required(soc,soc->soc_at_oids_must,err) )
+ if ( (code = oc_create_required(soc,soc->soc_at_oids_must,err)) != 0 )
return code;
- if ( code = oc_create_allowed(soc,soc->soc_at_oids_may,err) )
+ if ( (code = oc_create_allowed(soc,soc->soc_at_oids_may,err)) != 0 )
return code;
code = oc_insert(soc,err);
return code;
Syntax *synp;
for (synp = syn_list; synp; synp = synp->ssyn_next)
- if ((*len = dscompare( synp->ssyn_syn.syn_desc, (char *)syndesc, '{')))
+ if ((*len = dscompare( synp->ssyn_syn.syn_desc, syndesc, '{')))
return synp;
return( NULL );
}
val.bv_val = ldap_syntax2str( &syn->ssyn_syn );
if ( val.bv_val ) {
val.bv_len = strlen( val.bv_val );
- Debug( LDAP_DEBUG_TRACE, "Merging syn [%d] %s\n",
- val.bv_len, val.bv_val, 0 );
+ Debug( LDAP_DEBUG_TRACE, "Merging syn [%ld] %s\n",
+ (long) val.bv_len, val.bv_val, 0 );
attr_merge( e, "ldapSyntaxes", vals );
ldap_memfree( val.bv_val );
} else {
val.bv_val = ldap_matchingrule2str( &mr->smr_mrule );
if ( val.bv_val ) {
val.bv_len = strlen( val.bv_val );
- Debug( LDAP_DEBUG_TRACE, "Merging mr [%d] %s\n",
- val.bv_len, val.bv_val, 0 );
+ Debug( LDAP_DEBUG_TRACE, "Merging mr [%ld] %s\n",
+ (long) val.bv_len, val.bv_val, 0 );
attr_merge( e, "matchingRules", vals );
ldap_memfree( val.bv_val );
} else {
val.bv_val = ldap_objectclass2str( &oc->soc_oclass );
if ( val.bv_val ) {
val.bv_len = strlen( val.bv_val );
- Debug( LDAP_DEBUG_TRACE, "Merging oc [%d] %s\n",
- val.bv_len, val.bv_val, 0 );
+ Debug( LDAP_DEBUG_TRACE, "Merging oc [%ld] %s\n",
+ (long) val.bv_len, val.bv_val, 0 );
attr_merge( e, "objectClasses", vals );
ldap_memfree( val.bv_val );
} else {
int is_entry_objectclass(
Entry* e,
- char* oc)
+ const char* oc)
{
Attribute *attr;
struct berval bv;
return 0;
}
- bv.bv_val = oc;
+ bv.bv_val = (char *) oc;
bv.bv_len = strlen( bv.bv_val );
if( value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) {
+# $OpenLDAP$
+#
# OpenLDAP Core schema
#
# Includes "standard" schema items from:
--- /dev/null
+# $OpenLDAP$
+#
+# By: Juan C. Gomez / gomez@engr.sgi.com
+# Date: May/1999
+# Source: draft-lachman-ldap-mail-routing-03.txt
+# ---------------------------------------------------------
+#
+# Written by Juan C. Gomez and placed into the public domain.
+# This file is not subject to any license of SGI.
+#
+# ---------------------------------------------------------
+#
+# Attribute specifications for using LDAP as a back-end
+# for mail routing. As specified in:
+#
+# *********************************************************
+# draft-lachman-ldap-mail-routing-03.txt
+# By : H. Lachman @ Netscape Communications Corp.
+# Date : October 1998
+# "LDAP Schema Definitions for Intranet Mail Routing -
+# The mailRecipient Object Class"
+# *********************************************************
+#
+
+
+
+
+#
+# This is here because, perhaps in the future, we will have
+# richer schema support in OpenLDAP.
+#
+# ----------------------FORMAL DESCRIPTION-----------------
+#
+# OID 0.9.2342.19200300.100.1.3
+# NAME 'mail'
+# DESC 'RFC 822 email address of this recipient'
+# EQUALITY caseIgnoreIA5Match
+# SYNTAX '1.3.6.1.4.1.1466.115.121.1.26{256}' SINGLE-VALUE
+#
+#
+# OID 2.16.840.1.113730.3.1.13
+# NAME 'mailAlternateAddress'
+# DESC 'alternate RFC 822 email address of this recipient'
+# EQUALITY caseIgnoreIA5Match
+# SYNTAX '1.3.6.1.4.1.1466.115.121.1.26{256}'
+#
+#
+# OID 2.16.840.1.113730.3.1.18
+# NAME 'mailHost'
+# DESC 'fully qualified hostname of the SMTP MTA that
+# handles messages for this recipient'
+# EQUALITY caseIgnoreIA5Match
+# SYNTAX '1.3.6.1.4.1.1466.115.121.1.26{256}' SINGLE-VALUE
+#
+#
+# OID 2.16.840.1.113730.3.1.47
+# NAME 'mailRoutingAddress'
+# DESC 'RFC 822 address to use when routing messages to
+# the SMTP MTA of this recipient'
+# EQUALITY caseIgnoreIA5Match
+# SYNTAX '1.3.6.1.4.1.1466.115.121.1.26{256}' SINGLE-VALUE
+#
+# ----------------------END FORMAL DESCRIPTION-----------------
+
+
+
+
+attribute mail cis
+attribute mailAlternateAddress cis
+attribute mailHost cis
+attribute mailRoutingAddress cis
--- /dev/null
+# $OpenLDAP$
+#
+# By: Juan C. Gomez / gomez@engr.sgi.com
+# Date: May/1999
+# Source: draft-lachman-ldap-mail-routing-03.txt
+# ---------------------------------------------------------
+#
+# Written by Juan C. Gomez and placed into the public domain.
+# This file is not subject to any license of SGI.
+#
+# ---------------------------------------------------------
+#
+# Object class specifications for using LDAP as a back-end
+# for mail routing. As specified in:
+#
+# *********************************************************
+# draft-lachman-ldap-mail-routing-03.txt
+# By : H. Lachman @ Netscape Communications Corp.
+# Date : October 1998
+# "LDAP Schema Definitions for Intranet Mail Routing -
+# The mailRecipient Object Class"
+# *********************************************************
+#
+
+
+
+
+#
+# This is here because, perhaps in the future, we will have
+# richer schema support in OpenLDAP.
+#
+# ----------------------FORMAL DESCRIPTION-----------------
+#
+#
+# OID 2.16.840.1.113730.3.2.3
+# NAME 'mailRecipient' SUP top AUXILIARY
+# MAY ( cn $ mail $ mailAlternateAddress $ mailHost $
+# mailRoutingAddress )
+#
+# ----------------------END FORMAL DESCRIPTION-------------
+
+objectclass mailRecipient
+ requires
+ objectClass
+ allows
+ cn,
+ mail,
+ mailAlternateAddress,
+ mailHost,
+ mailRoutingAddress
# Assorted definitions from several sources
+# $OpenLDAP$
#
# RFC2247
--- /dev/null
+# $OpenLDAP$
+
+# These are definitions from the North American Directory Forum
+# They were taken from ftp://ftp.gte.com/pub/nadf/nadf-docs/sd-04.ps
+# Our thanks to Harald T. Alvestrand that provided the pointer.
+
+# Some attribute types and object classes defined in the spec
+# and that we did not have are not included in this file.
+
+# This is a preliminary version and is likely to be incorrect in
+# a number of areas
+
+# The root for OIDs is joint-iso-ccitt mhs-motis(6) group(6) grimstad(5)
+# nadf(2). In othor words, barring any error, 2.6.6.5.2. Then,
+# nadfOink ::= 2.6.6.5.2.0
+# nadfModule ::= 2.6.6.5.2.1
+# nadfAttributeType ::= 2.6.6.5.2.4
+# nadfObjectClass ::= 2.6.6.5.2.6
+
+# Attribute Type Definition
+
+# The spec says "leading zero is significant". Is this really a
+# numeric string?
+
+attribute ( 2.6.6.5.2.4.1 NAME 'fipsStateNumericCode'
+ EQUALITY numericStringMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.36{2} )
+
+# It is probably inconvenient to give this attribute that syntax
+# (Printable String) instead of Directory String.
+
+attribute ( 2.6.6.5.2.4.2 NAME 'fipsStateAlphaCode'
+ EQUALITY caseIgnoreMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.44{2} )
+
+# The spec says "leading zeros are significant". Is this really a
+# numeric string?
+
+attribute ( 2.6.6.5.2.4.3 NAME 'fipsCountyNumericCode'
+ EQUALITY numericStringMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.36{5} )
+
+# It seems that fips55 is fipsPlaceNumericCode, is this so?
+
+# The spec says "leading zeros are significant". Is this really a
+# numeric string?
+
+attribute ( 2.6.6.5.2.4.4 NAME ( 'fipsPlaceNumericCode' 'fips55' )
+ EQUALITY numericStringMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.36{5} )
+
+attribute ( 2.6.6.5.2.4.5 NAME 'ansiOrgNumericCode'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
+
+# Apparently, 'ad' is an alias for 'addmdName'
+
+attribute ( 2.6.6.5.2.4.6 NAME ( 'addmdName' 'ad' )
+ EQUALITY caseIgnoreMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
+
+# I don't know what syntax to give this. I will use binary for the
+# time being.
+
+attribute ( 2.6.6.5.2.4.7 NAME 'nadfSearchGuide'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 )
+
+attribute ( 2.6.6.5.2.4.8 NAME 'supplementaryInformation'
+ EQUALITY caseIgnoreMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{76} )
+
+attribute ( 2.6.6.5.2.4.9 NAME 'namingLink'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
+
+attribute ( 2.6.6.5.2.4.10 NAME 'reciprocalNamingLink'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
+ SINGLE-VALUE )
+
+# Numbers 11 to 14 are obsolete
+
+# Next one is unused. BTW, this attribute is supposed to be
+# case-exact match, but we cannot make that match unless we
+# define the string with IA5 syntax and we don't have a
+# clear base for this.
+
+attribute ( 2.6.6.5.2.4.15 NAME 'logicalDSAReference'
+ EQUALITY caseIgnoreMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
+
+attribute ( 2.6.6.5.2.4.16 NAME 'multiMediaInformation'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 )
+
+# Number 17, 18 and 19 are EDI-related attributes for the nadfEDIUser
+# class that we did not have and has been left out below.
+
+# Object classes
+
+# According to the intended use described in section 3.3.1 in the spec,
+# this can only be AUXILIARY.
+# We had lastModifiedTime as 'allows', but sd-04 has it as MUST.
+# We did not have multiMediaInformation neither on this class nor
+# on any of its derived classes.
+
+objectclass ( 2.6.6.5.2.6.7 NAME 'nadfObject' SUP top AUXILIARY
+ MUST lastModifiedTime
+ MAY ( multiMediaInformation $ nadfSearchGuide $
+ supplementaryInformation ) )
+
+# I think all classes derived from locality should be considered
+# STRUCTURAL, since locality is.
+
+objectclass ( 2.6.6.5.2.6.1 NAME 'usStateOrEquivalent'
+ SUP ( locality $ nadfObject ) STRUCTURAL
+ MUST ( l $ fipsStateNumericCode $ fipsStateAlphaCode $ st ) )
+
+objectclass ( 2.6.6.5.2.6.2 NAME 'usPlace'
+ SUP ( locality $ nadfObject ) STRUCTURAL
+ MUST ( l $ fipsPlaceNumericCode ) )
+
+objectclass ( 2.6.6.5.2.6.3 NAME 'usCountyOrEquivalent' SUP usPlace STRUCTURAL
+ MUST fipsCountyNumericCode )
+
+# applicationEntity is STRUCTURAL, so we will declare this one the same
+
+objectclass ( 2.6.6.5.2.6.5 NAME 'nadfApplicationEntity'
+ SUP applicationEntity STRUCTURAL
+ MUST supportedApplicationContext )
+
+# Following our heuristic, this one will be STRUCTURAL since organization
+# is too. We did not have 'o' as 'requires', but if this is really a
+# subclass of organization, then 'o' becomes MUST by inheritance
+
+objectclass ( 2.6.6.5.2.6.6 NAME 'nadfADDMD'
+ SUP ( organization $ nadfObject ) STRUCTURAL
+ MUST addmdName )
+
+# Number 7 is nadfObject described above.
+
+# This one quacks like an AUXILIARY object class
+
+objectclass ( 2.6.6.5.2.6.8 NAME 'publicObject' SUP top AUXILIARY
+ MUST namingLink )
+
+# And so does this one
+
+objectclass ( 2.6.6.5.2.6.9 NAME 'providerObject' SUP top AUXILIARY
+ MUST reciprocalNamingLink )
+
+# The spec says number 10 is obsolete
+
+# This one also strongly smells like AUXILIARY
+
+objectclass ( 2.6.6.5.2.6.11 NAME 'fips55Object' SUP top AUXILIARY
+ MUST fipsPlaceNumericCode
+ MAY st )
+
+# The spec says numbers 12 to 18 are obsolete
+
+# Another obviously AUXILIARY class
+
+objectclass ( 2.6.6.5.2.6.19 NAME 'nationalObject' SUP top AUXILIARY
+ MUST c )
+
+# So is this one
+
+objectclass ( 2.6.6.5.2.6.20 NAME 'ansiOrgObject' SUP top AUXILIARY
+ MUST ansiOrgNumericCode )
+
+# We did not have the next one, but it is innocuous
+
+objectclass ( 2.6.6.5.2.6.21 NAME 'caProvinceOrTerritory'
+ SUP ( locality $ nadfObject ) STRUCTURAL
+ MUST st )
+
+# According to the spec, numbers 22, 23 and 24 are obsolete
+
+# Number 25 was nadfEDIuser as a subclass of edi-user. Sorry we cannot
+# deal with this one and we did not have it anyway.
--- /dev/null
+# $OpenLDAP$
+#
+# By: Juan C. Gomez / gomez@engr.sgi.com
+# Date: May/1999
+# Source: RFC-2307
+# ---------------------------------------------------------
+#
+# Written by Juan C. Gomez and placed into the public domain.
+# This file is not subject to any license of SGI.
+#
+# ---------------------------------------------------------
+#
+# Attribute definitions for using LDAP as a back-end for
+# Network Information Services (NIS) with OpenLDAP server.
+#
+# I am adding the whole description here because, perhaps,
+# we will move towards better schema support in the future
+# and will have all the keywords to express the attribute
+# description more accurately.
+#
+# nisSchema OID = 1.3.6.1.1.1
+# iso.org.dod.internet.directory.nisSchema
+#
+# NOTES:
+#
+# 1.- Two attributes have as a super-type the name attribute
+# described in RFC-2256. The 'name' attribute has the
+# following description: (see X.520 for further details)
+#
+# OID 2.5.4.41
+# NAME name
+# SUBSTRINGS caseIgnoreSubstringsMatch
+# SYNTAX DirectoryString{32768}
+#
+# DirectoryString Syntax (OID=1.3.6.1.4.1.1466.115.121.1.15)
+# is described in RFC-2252, basically a UTF-8 (Unicode
+# Superset) encoded string.
+#
+# 2.- The syntax for nisNetgroupTriple is 'nisNetgroupTripleSyntax',
+# defined as:
+#
+# OID nisSchema.0.0
+# NAME 'nisNetgroupTripleSyntax'
+# DESC 'NIS netgroup triple'
+#
+# Where values in this syntax can be described as:
+#
+# nisNetgroupTripleSyntax ::= SEQUENCE {
+# hostname [0] IA5String OPTIONAL,
+# username [1] IA5String OPTIONAL,
+# domainname [2] IA5String OPTIONAL
+# }
+#
+# (These values are encoded as strings in LDAP servers)
+#
+# 3.- The syntax for bootParameter is 'bootParameterSyntax',
+# defined as :
+#
+# OID nisSchema.0.1
+# NAME 'bootParameterSyntax'
+# DESC 'Boot Parameter'
+#
+# Where values in this syntax can be described as:
+#
+# bootParameterSyntax ::= SEQUENCE {
+# key IA5String,
+# server IA5String,
+# path IA5String
+# }
+#
+# (These values are encoded as strings in LDAP servers)
+#
+
+
+# ----------------------FORMAL DESCRIPTION--------------------
+# OID nisSchema.1.0
+# NAME uidNumber
+# DESC 'An integer uniquely identifying a user in an
+# administrative domain'
+# EQUALITY integerMatch
+# SYNTAX 'INTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.1
+# NAME gidNumber
+# DESC 'An integer uniquely identifying a group in an
+# administrative domain'
+# EQUALITY integerMatch
+# SYNTAX 'INTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.2
+# NAME gecos
+# DESC 'The GECOS field; the common name'
+# EQUALITY caseIgnoreIA5Match
+# SUBSTRINGS caseIgnoreIA5SubstringsMatch
+# SYNTAX 'IA5String' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.3
+# NAME homeDirectory
+# DESC 'The absolute path to the home directory'
+# EQUALITY caseExactIA5Match
+# SYNTAX 'IA5String' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.4
+# NAME loginShell
+# DESC 'The path to the login shell'
+# EQUALITY caseExactIA5Match
+# SYNTAX 'IA5String' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.5
+# NAME shadowLastChange
+# DESC ''
+# EQUALITY integerMatch
+# SYNTAX 'INTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.6
+# NAME shadowMin
+# DESC ''
+# EQUALITY integerMatch
+# SYNTAX 'INTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.7
+# NAME shadowMax
+# DESC ''
+# EQUALITY integerMatch
+# SYNTAX 'INTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.8
+# NAME shadowWarning
+# DESC ''
+# EQUALITY integerMatch
+# SYNTAX 'INTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.9
+# NAME shadowInactive
+# DESC ''
+# EQUALITY integerMatch
+# SYNTAX 'INTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.10
+# NAME shadowExpire
+# DESC ''
+# EQUALITY integerMatch
+# SYNTAX 'INTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.11
+# NAME shadowFlag
+# DESC ''
+# EQUALITY integerMatch
+# SYNTAX 'INTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.12
+# NAME memberUid
+# DESC ''
+# EQUALITY caseExactIA5Match
+# SUBSTRINGS caseExactIA5SubstringsMatch
+# SYNTAX 'IA5String'
+#
+#
+# OID nisSchema.1.13
+# NAME memberNisNetgroup
+# DESC ''
+# EQUALITY caseExactIA5Match
+# SUBSTRINGS caseExactIA5SubstringsMatch
+# SYNTAX 'IA5String'
+#
+#
+# OID nisSchema.1.14
+# NAME memberNisNetgroup
+# DESC 'Netgroup triple'
+# SYNTAX 'nisNetgroupTripleSyntax'
+#
+#
+# OID nisSchema.1.15
+# NAME ipServicePort
+# DESC ''
+# EQUALITY integerMatch
+# SYNTAX 'INSTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.16
+# NAME ipServiceProtocol
+# SUP name
+#
+#
+# OID nisSchema.1.17
+# NAME ipServiceNUmber
+# EQUALITY integerMatch
+# SYNTAX 'INSTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.18
+# NAME oncRpcNumber
+# EQUALITY integerMatch
+# SYNTAX 'INSTEGER' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.19
+# NAME ipHostNumber
+# DESC 'IP address as a dotted decimal, eg. 192.168.1.1
+# omitting leading zeros'
+# EQUALITY caseIgnoreIA5Match
+# SYNTAX 'IA5String{128}'
+#
+#
+# OID nisSchema.1.20
+# NAME ipNetworkNumber
+# DESC 'IP network as a dotted decimal, eg. 192.168,
+# omitting leading zeros'
+# EQUALITY caseIgnoreIA5Match
+# SYNTAX 'IA5String{128}' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.21
+# NAME ipNetmaskNumber
+# DESC 'IP netmask as a dotted decimal, eg. 255.255.255.0,
+# omitting leading zeros'
+# EQUALITY caseIgnoreIA5Match
+# SYNTAX 'IA5String{128}' SINGLE-VALUE
+#
+#
+# OID nisSchema.1.22
+# NAME macAddress
+# DESC 'MAC address in maximal, colon separated hex notation,
+# eg. 00:00:92:90:ee:e2'
+# EQUALITY caseIgnoreIA5Match
+# SYNTAX 'IA5String{128}'
+#
+#
+# OID nisSchema.1.23
+# NAME bootParameter
+# DESC 'rpc.bootparamd parameter'
+# SYNTAX 'bootParameterSyntax'
+#
+#
+# OID nisSchema.1.24
+# NAME bootFile
+# DESC 'Boot image name'
+# EQUALITY caseExactIA5Match
+# SYNTAX 'IA5String'
+#
+#
+# OID nisSchema.1.26
+# NAME nisMapName
+# DESC ''
+# SUP name
+#
+#
+# OID nisSchema.1.27
+# NAME nisMapEntry
+# DESC ''
+# EQUALITY caseExactIA5Match
+# SUBSTRINGS caseExactIA5SubstringMatch
+# SYNTAX 'IA5String{1024}' SINGLE-VALUE
+#
+# ----------------------END FORMAL DESCRIPTION-------------
+
+
+
+attribute uidNumber ces
+attribute gidNumber ces
+attribute gecos cis
+attribute homeDirectory ces
+attribute loginShell ces
+attribute shadowLastChange ces
+attribute shadowMin ces
+attribute shadowMax ces
+attribute shadowWarning ces
+attribute shadowInactive ces
+attribute shadowExpire ces
+attribute shadowFlag ces
+attribute memberUid ces
+attribute memberNisNetgroup ces
+attribute nisNetgroupTriple ces
+attribute ipServicePort ces
+attribute ipServiceProtocol cis
+attribute ipProtocolNumber ces
+attribute oncRpcNumber ces
+attribute ipHostNumber cis
+attribute ipNetworkNumber cis
+attribute ipNetmaskNumber cis
+attribute macAddress cis
+attribute bootParameter ces
+attribute bootFile ces
+attribute nisMapName cis
+attribute nisMapEntry ces
--- /dev/null
+# $OpenLDAP$
+#
+# By: Juan C. Gomez / gomez@engr.sgi.com
+# Date: May/1999
+# Source: RFC-2307
+# ---------------------------------------------------------
+#
+# Written by Juan C. Gomez and placed into the public domain.
+# This file is not subject to any license of SGI.
+#
+# ---------------------------------------------------------
+#
+# Object Classes for using LDAP as a backend for Network
+# Information Services (NIS).
+# (As Proposed in RFC-2307)
+#
+
+
+
+
+# ----------------------FORMAL DESCRIPTION--------------------
+# OID nisSchema.2.0
+# NAME 'posixAccount' SUP top AUXILIARY
+# DESC 'Abstraction of an account with POSIX attributes'
+# MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory )
+# MAY ( userPassword $ loginShell $ gecos $ description ) )
+#
+#
+# OID nisSchema.2.1
+# NAME 'shadowAccount' SUP top AUXILIARY
+# DESC 'Additional attributes for shadow passwords'
+# MUST uid
+# MAY ( userPassword $ shadowLastChange $ shadowMin
+# shadowMax $ shadowWarning $ shadowInactive $
+# shadowExpire $ shadowFlag $ description )
+#
+#
+# OID nisSchema.2.2 NAME 'posixGroup' SUP top STRUCTURAL
+# DESC 'Abstraction of a group of accounts'
+# MUST ( cn $ gidNumber )
+# MAY ( userPassword $ memberUid $ description ) )
+#
+#
+# OID nisSchema.2.3 NAME 'ipService' SUP top STRUCTURAL
+# DESC 'Abstraction an Internet Protocol service.
+# Maps an IP port and protocol (such as tcp or udp)
+# to one or more names; the distinguished value of
+# the cn attribute denotes the service's canonical
+# name'
+# MUST ( cn $ ipServicePort $ ipServiceProtocol )
+# MAY ( description )
+#
+#
+# OID nisSchema.2.4 NAME 'ipProtocol' SUP top STRUCTURAL
+# DESC 'Abstraction of an IP protocol. Maps a protocol number
+# to one or more names. The distinguished value of the cn
+# attribute denotes the protocol's canonical name'
+# MUST ( cn $ ipProtocolNumber $ description )
+# MAY description
+#
+#
+# OID nisSchema.2.5 NAME 'oncRpc' SUP top STRUCTURAL
+# DESC 'Abstraction of an Open Network Computing (ONC)
+# [RFC1057] Remote Procedure Call (RPC) binding.
+# This class maps an ONC RPC number to a name.
+# The distinguished value of the cn attribute denotes
+# the RPC service's canonical name'
+# MUST ( cn $ oncRpcNumber $ description )
+# MAY description
+#
+#
+# OID nisSchema.2.6 NAME 'ipHost' SUP top AUXILIARY
+# DESC 'Abstraction of a host, an IP device. The distinguished
+# value of the cn attribute denotes the host's canonical
+# name. Device SHOULD be used as a structural class'
+# MUST ( cn $ ipHostNumber )
+# MAY ( l $ description $ manager ) )
+#
+#
+# OID nisSchema.2.7 NAME 'ipNetwork' SUP top STRUCTURAL
+# DESC 'Abstraction of a network. The distinguished value of
+# the cn attribute denotes the network's canonical name'
+# MUST ( cn $ ipNetworkNumber )
+# MAY ( ipNetmaskNumber $ l $ description $ manager ) )
+#
+#
+# OID nisSchema.2.8 NAME 'nisNetgroup' SUP top STRUCTURAL
+# DESC 'Abstraction of a netgroup. May refer to other netgroups'
+# MUST cn
+# MAY ( nisNetgroupTriple $ memberNisNetgroup $ description )
+#
+#
+# OID nisSchema.2.09 NAME 'nisMap' SUP top STRUCTURAL
+# DESC 'A generic abstraction of a NIS map'
+# MUST nisMapName
+# MAY description
+#
+#
+# OID nisSchema.2.10 NAME 'nisObject' SUP top STRUCTURAL
+# DESC 'An entry in a NIS map'
+# MUST ( cn $ nisMapEntry $ nisMapName )
+# MAY description
+#
+#
+# OID nisSchema.2.11 NAME 'ieee802Device' SUP top AUXILIARY
+# DESC 'A device with a MAC address; device SHOULD be
+# used as a structural class'
+# MAY macAddress
+#
+#
+# OID nisSchema.2.12 NAME 'bootableDevice' SUP top AUXILIARY
+# DESC 'A device with boot parameters; device SHOULD be
+# used as a structural class'
+# MAY ( bootFile $ bootParameter )
+#
+# ----------------------END FORMAL DESCRIPTION-------------
+
+
+
+
+objectclass posixAccount
+ requires
+ objectClass,
+ cn,
+ uid,
+ uidNumber,
+ gidNumber,
+ homeDirectory
+ allows
+ userPassword,
+ loginShell,
+ gecos,
+ description
+
+objectclass shadowAccount
+ requires
+ objectClass,
+ uid
+ allows
+ userPassword,
+ shadowLastChange,
+ shadowMin,
+ shadowMax,
+ shadowWarning,
+ shadowInactive,
+ shadowExpire,
+ shadowFlag,
+ description
+
+objectclass posixGroup
+ requires
+ objectClass,
+ cn,
+ gidNumber
+ allows
+ userPassword,
+ memberUid,
+ description
+
+objectclass ipService
+ requires
+ objectClass,
+ cn,
+ ipServicePort,
+ ipServiceProtocol
+ allows
+ description
+
+objectclass ipProtocol
+ requires
+ objectClass,
+ cn,
+ ipProtocolNumber,
+ description
+ allows
+ description
+
+objectclass oncRpc
+ requires
+ objectClass,
+ cn,
+ oncRpcNumber,
+ description
+ allows
+ description
+
+objectclass ipHost
+ requires
+ objectClass,
+ cn,
+ ipHostNumber
+ allows
+ l,
+ description,
+ manager
+
+objectclass ipNetwork
+ requires
+ objectClass,
+ cn,
+ ipNetworkNumber
+ allows
+ ipNetmaskNumber,
+ l,
+ description,
+ manager
+
+objectclass nisNetgroup
+ requires
+ objectClass,
+ cn
+ allows
+ nisNetgroupTriple,
+ memberNisNetgroup,
+ description
+
+objectclass nisMap
+ requires
+ objectClass,
+ nisMapName
+ allows
+ description
+
+objectclass nisObject
+ requires
+ objectClass,
+ cn,
+ nisMapEntry,
+ nisMapName
+ allows
+ description
+
+objectclass ieee802Device
+ requires
+ objectClass
+ allows
+ macAddress
+
+objectclass bootableDevice
+ requires
+ objectClass
+ allows
+ bootFile,
+ bootParameter
--- /dev/null
+# $OpenLDAP$
+# Definitions from RFC2307
+
+# Note: The definitions in RFC2307 are given in syntaxes closely related
+# to those in RFC2252, however, some liberties are taken that are not
+# supported by RFC2252. This file has been written following RFC2252
+# strictly.
+
+# OID Base is iso(1) org(3) dod(6) internet(1) directory(1) nisSchema(1).
+# i.e. nisSchema in RFC2307 is 1.3.6.1.1.1
+#
+# Syntaxes are under 1.3.6.1.1.1.0 (two new syntaxes are defined)
+# Attribute types are under 1.3.6.1.1.1.1
+# Object classes are under 1.3.6.1.1.1.2
+
+# Attribute Type Definitions
+
+attribute ( 1.3.6.1.1.1.1.0 NAME 'uidNumber'
+ DESC 'An integer uniquely identifying a user in an administrative domain'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.1 NAME 'gidNumber'
+ DESC 'An integer uniquely identifying a group in an administrative domain'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+# TBC: caseIgnoreIA5SubstringsMatch is not defined
+
+attribute ( 1.3.6.1.1.1.1.2 NAME 'gecos'
+ DESC 'The GECOS field; the common name'
+ EQUALITY caseIgnoreIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.3 NAME 'homeDirectory'
+ DESC 'The absolute path to the home directory'
+ EQUALITY caseExactIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.4 NAME 'loginShell'
+ DESC 'The path to the login shell'
+ EQUALITY caseExactIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.5 NAME 'shadowLastChange'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.6 NAME 'shadowMin'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.7 NAME 'shadowMax'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.8 NAME 'shadowWarning'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.9 NAME 'shadowInactive'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.10 NAME 'shadowExpire'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.11 NAME 'shadowFlag'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+# TBC: caseIgnoreIA5SubstringsMatch is not defined
+
+attribute ( 1.3.6.1.1.1.1.12 NAME 'memberUid'
+ EQUALITY caseExactIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+# TBC: caseIgnoreIA5SubstringsMatch is not defined
+
+attribute ( 1.3.6.1.1.1.1.13 NAME 'memberNisNetgroup'
+ EQUALITY caseExactIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attribute ( 1.3.6.1.1.1.1.14 NAME 'nisNetgroupTriple'
+ DESC 'Netgroup triple'
+ SYNTAX 1.3.6.1.1.1.0.0 )
+
+attribute ( 1.3.6.1.1.1.1.15 NAME 'ipServicePort'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.16 NAME 'ipServiceProtocol'
+ SUP name )
+
+attribute ( 1.3.6.1.1.1.1.17 NAME 'ipProtocolNumber'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.18 NAME 'oncRpcNumber'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.19 NAME 'ipHostNumber'
+ DESC 'IP address as a dotted decimal, eg. 192.168.1.1, omitting leading zeros'
+ EQUALITY caseIgnoreIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128} )
+
+attribute ( 1.3.6.1.1.1.1.20 NAME 'ipNetworkNumber'
+ DESC 'IP network as a dotted decimal, eg. 192.168, omitting leading zeros'
+ EQUALITY caseIgnoreIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128} SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.21 NAME 'ipNetmaskNumber'
+ DESC 'IP netmask as a dotted decimal, eg. 255.255.255.0, omitting leading zeros'
+ EQUALITY caseIgnoreIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128} SINGLE-VALUE )
+
+attribute ( 1.3.6.1.1.1.1.22 NAME 'macAddress'
+ DESC 'MAC address in maximal, colon separated hex notation, eg. 00:00:92:90:ee:e2'
+ EQUALITY caseIgnoreIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128} )
+
+attribute ( 1.3.6.1.1.1.1.23 NAME 'bootParameter'
+ DESC 'rpc.bootparamd parameter'
+ SYNTAX 1.3.6.1.1.1.0.1 )
+
+attribute ( 1.3.6.1.1.1.1.24 NAME 'bootFile'
+ DESC 'Boot image name'
+ EQUALITY caseExactIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attribute ( 1.3.6.1.1.1.1.26 NAME 'nisMapName'
+ SUP name )
+
+# TBC: caseIgnoreIA5SubstringsMatch is not defined
+
+attribute ( 1.3.6.1.1.1.1.27 NAME 'nisMapEntry'
+ EQUALITY caseExactIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{1024} SINGLE-VALUE )
+
+# Object Class Definitions
+
+objectclass ( 1.3.6.1.1.1.2.0 NAME 'posixAccount' SUP top AUXILIARY
+ DESC 'Abstraction of an account with POSIX attributes'
+ MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory )
+ MAY ( userPassword $ loginShell $ gecos $ description ) )
+
+objectclass ( 1.3.6.1.1.1.2.1 NAME 'shadowAccount' SUP top AUXILIARY
+ DESC 'Additional attributes for shadow passwords'
+ MUST uid
+ MAY ( userPassword $ shadowLastChange $ shadowMin $
+ shadowMax $ shadowWarning $ shadowInactive $
+ shadowExpire $ shadowFlag $ description ) )
+
+objectclass ( 1.3.6.1.1.1.2.2 NAME 'posixGroup' SUP top STRUCTURAL
+ DESC 'Abstraction of a group of accounts'
+ MUST ( cn $ gidNumber )
+ MAY ( userPassword $ memberUid $ description ) )
+
+# TBC: quotes in quoted strings
+
+objectclass ( 1.3.6.1.1.1.2.3 NAME 'ipService' SUP top STRUCTURAL
+ DESC 'Abstraction an Internet Protocol service.
+ Maps an IP port and protocol (such as tcp or udp)
+ to one or more names; the distinguished value of
+ the cn attribute denotes the service"s canonical
+ name'
+ MUST ( cn $ ipServicePort $ ipServiceProtocol )
+ MAY ( description ) )
+
+# TBC: quotes in quoted strings
+
+objectclass ( 1.3.6.1.1.1.2.4 NAME 'ipProtocol' SUP top STRUCTURAL
+ DESC 'Abstraction of an IP protocol. Maps a protocol number
+ to one or more names. The distinguished value of the cn
+ attribute denotes the protocol"s canonical name'
+ MUST ( cn $ ipProtocolNumber $ description )
+ MAY description )
+
+# TBC: quotes in quoted strings
+
+objectclass ( 1.3.6.1.1.1.2.5 NAME 'oncRpc' SUP top STRUCTURAL
+ DESC 'Abstraction of an Open Network Computing (ONC)
+ [RFC1057] Remote Procedure Call (RPC) binding.
+ This class maps an ONC RPC number to a name.
+ The distinguished value of the cn attribute denotes
+ the RPC service"s canonical name'
+ MUST ( cn $ oncRpcNumber $ description )
+ MAY description )
+
+# TBC: quotes in quoted strings
+
+objectclass ( 1.3.6.1.1.1.2.6 NAME 'ipHost' SUP top AUXILIARY
+ DESC 'Abstraction of a host, an IP device. The distinguished
+ value of the cn attribute denotes the host"s canonical
+ name. Device SHOULD be used as a structural class'
+ MUST ( cn $ ipHostNumber )
+ MAY ( l $ description $ manager ) )
+
+# TBC: quotes in quoted strings
+
+objectclass ( 1.3.6.1.1.1.2.7 NAME 'ipNetwork' SUP top STRUCTURAL
+ DESC 'Abstraction of a network. The distinguished value of
+ the cn attribute denotes the network"s canonical name'
+ MUST ( cn $ ipNetworkNumber )
+ MAY ( ipNetmaskNumber $ l $ description $ manager ) )
+
+objectclass ( 1.3.6.1.1.1.2.8 NAME 'nisNetgroup' SUP top STRUCTURAL
+ DESC 'Abstraction of a netgroup. May refer to other netgroups'
+ MUST cn
+ MAY ( nisNetgroupTriple $ memberNisNetgroup $ description ) )
+
+objectclass ( 1.3.6.1.1.1.2.9 NAME 'nisMap' SUP top STRUCTURAL
+ DESC 'A generic abstraction of a NIS map'
+ MUST nisMapName
+ MAY description )
+
+objectclass ( 1.3.6.1.1.1.2.10 NAME 'nisObject' SUP top STRUCTURAL
+ DESC 'An entry in a NIS map'
+ MUST ( cn $ nisMapEntry $ nisMapName )
+ MAY description )
+
+objectclass ( 1.3.6.1.1.1.2.11 NAME 'ieee802Device' SUP top AUXILIARY
+ DESC 'A device with a MAC address; device SHOULD be
+ used as a structural class'
+ MAY macAddress )
+
+objectclass ( 1.3.6.1.1.1.2.12 NAME 'bootableDevice' SUP top AUXILIARY
+ DESC 'A device with boot parameters; device SHOULD be
+ used as a structural class'
+ MAY ( bootFile $ bootParameter ) )
--- /dev/null
+# $OpenLDAP$
+#
+# By: Juan C. Gomez / gomez@engr.sgi.com
+# Date: May/1999
+# Source: RFC-2307
+# ------------------------------------------------------------
+# Attribute definitions for using LDAP as a back-end for Network
+# Information Services (NIS) with an OpenLDAP server.
+# This file holds the definitions of those attributes used in
+# RFC-2307, which are defined in other RFCs or X500 standards.
+# You may not need to include this file if you already have
+# these definitions in your default configuration files (i.e.
+# slapd.at.conf).
+#
+
+
+
+#
+# ----------------------FORMAL DESCRIPTION--------------------
+#
+# RFC-2256 ( 2.5.4.23 NAME 'facsimileTelephoneNumber'
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.22 )
+# RFC-1274 facsimileTelephoneNumber ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX FacsimileTelephoneNumber
+# ::= {attributeType 23}
+#
+#
+# RFC-2256 ( 2.5.4.14 NAME 'searchGuide'
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.25 )
+# RFC-1274 searchGuide ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX Guide
+# ::= {attributeType 14}
+#
+#
+# RFC-2256 ( 2.5.4.15 NAME 'businessCategory' EQUALITY caseIgnoreMatch
+# SUBSTR caseIgnoreSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
+# RFC-1274 businessCategory ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax
+# (SIZE (1..ub-business-category))
+# ::= {attributeType 15}
+#
+#
+# RFC-2256 ( 2.5.4.24 NAME 'x121Address' EQUALITY numericStringMatch
+# SUBSTR numericStringSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.36{15} )
+# RFC-1274 x121Address ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX NumericString
+# (SIZE (1..ub-x121-address))
+# ::= {attributeType 24}
+#
+#
+# RFC-2256 ( 2.5.4.26 NAME 'registeredAddress' SUP postalAddress
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
+# RFC-1274 registeredAddress ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX PostalAddress
+# ::= {attributeType 26}
+#
+#
+# RFC-2256 ( 2.5.4.27 NAME 'destinationIndicator' EQUALITY caseIgnoreMatch
+# SUBSTR caseIgnoreSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.44{128} )
+# RFC-1274 destinationIndicator ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX PrintableString
+# (SIZE (1..ub-destination-indicator))
+# MATCHES FOR EQUALITY SUBSTRINGS
+# ::= {attributeType 27}
+#
+#
+# RFC-2256 ( 2.5.4.28 NAME 'preferredDeliveryMethod'
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.14
+# SINGLE-VALUE )
+# RFC-1274 preferredDeliveryMethod ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX deliveryMethod
+# ::= {attributeType 28}
+#
+#
+# RFC-2256 ( 2.5.4.21 NAME 'telexNumber'
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.52 )
+# RFC-1274 telexNumber ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX TelexNumber
+# (SIZE (1..ub-telex))
+# ::= {attributeType 21}
+#
+#
+# RFC-2256 ( 2.5.4.22 NAME 'teletexTerminalIdentifier'
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.51 )
+# RFC-1274 teletexTerminalIdentifier ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX TeletexTerminalIdentifier
+# (SIZE (1..ub-teletex-terminal-id))
+# ::= {attributeType 22}
+#
+#
+# RFC-2256 ( 2.5.4.20 NAME 'telephoneNumber' EQUALITY telephoneNumberMatch
+# SUBSTR telephoneNumberSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.50{32} )
+# RFC-1274 telephoneNumber ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX telephoneNumberSyntax
+# (SIZE (1..ub-telephone-number))
+#
+#
+# RFC-2256 ( 2.5.4.25 NAME 'internationaliSDNNumber'
+# EQUALITY numericStringMatch
+# SUBSTR numericStringSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.36{16} )
+# RFC-1274 internationaliSDNNumber ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX NumericString
+# (SIZE (1..ub-isdn-address))
+# ::= {attributeType 2
+#
+#
+# RFC-2256 ( 2.5.4.9 NAME 'street' EQUALITY caseIgnoreMatch
+# SUBSTR caseIgnoreSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
+# RFC-1274 streetAddress ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax
+# (SIZE (1..ub-street-address))
+# ::= {attributeType 9}
+#
+#
+# RFC-2256 ( 2.5.4.18 NAME 'postOfficeBox' EQUALITY caseIgnoreMatch
+# SUBSTR caseIgnoreSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{40} )
+# RFC-1274 postOfficeBox ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax
+# (SIZE (1..ub-post-office-box))
+# ::= {attributeType 18}
+#
+#
+# RFC-2256 ( 2.5.4.17 NAME 'postalCode' EQUALITY caseIgnoreMatch
+# SUBSTR caseIgnoreSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{40} )
+# RFC-1274 postalCode ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax
+# (SIZE (1..ub-postal-code))
+# ::= {attributeType 17}
+#
+#
+# RFC-2256 ( 2.5.4.16 NAME 'postalAddress' EQUALITY caseIgnoreListMatch
+# SUBSTR caseIgnoreListSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
+# RFC-1274 postalAddress ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX PostalAddress
+# MATCHES FOR EQUALITY
+# ::= {attributeType 16}
+#
+#
+# RFC-2256 ( 2.5.4.19 NAME 'physicalDeliveryOfficeName'
+# EQUALITY caseIgnoreMatch
+# SUBSTR caseIgnoreSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
+# RFC-1274 physicalDeliveryOfficeName ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax
+# (SIZE (1..ub-physical-office-name))
+# ::= {attributeType 19}
+#
+#
+# RFC-2256 ( 2.5.4.8 NAME 'st' SUP name )
+# RFC-1274 stateOrProvinceName ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax
+# (SIZE (1..ub-state-name))
+# ::= {attributeType 8}
+#
+#
+# RFC-2256 ( 2.5.4.0 NAME 'objectClass' EQUALITY objectIdentifierMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
+# RFC-1274 objectClass ObjectClass
+# ::= {attributeType 0}
+#
+#
+# RFC-2256 ( 2.5.4.3 NAME 'cn' SUP name )
+# RFC-1274 commonName ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax
+# (SIZE (1..ub-common-name))
+# ::= {attributeType 3}
+#
+#
+# RFC-1274 userid ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX
+# caseIgnoreStringSyntax
+# (SIZE (1 .. ub-user-identifier))
+# ::= {pilotAttributeType 1}
+#
+#
+# RFC-2256 ( 2.5.4.35 NAME 'userPassword' EQUALITY octetStringMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )
+# RFC-1274 userPassword ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX Userpassword
+# ::= {attributeType 35}
+#
+#
+# RFC-2256 ( 2.5.4.13 NAME 'description' EQUALITY caseIgnoreMatch
+# SUBSTR caseIgnoreSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )
+#
+#
+# RFC-2256 ( 2.5.4.7 NAME 'l' SUP name )
+#
+#
+# RFC-1274 manager ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX
+# distinguishedNameSyntax
+# ::= {pilotAttributeType 10}
+#
+#
+# RFC-2256 ( 2.5.4.5 NAME 'serialNumber' EQUALITY caseIgnoreMatch
+# SUBSTR caseIgnoreSubstringsMatch
+# SYNTAX 1.3.6.1.4.1.1466.115.121.1.44{64} )
+# RFC-1274 serialNumber ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX printableStringSyntax
+# (SIZE (1..ub-serial-number))
+# ::= {attributeType 5}
+#
+#
+# RFC-2256 ( 2.5.4.10 NAME 'o' SUP name )
+#
+#
+# RFC-2256 ( 2.5.4.11 NAME 'ou' SUP name )
+#
+#
+# RFC-2256 ( 2.5.4.6 NAME 'c' SUP name SINGLE-VALUE )
+# RFC-1274 countryName ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX PrintableString
+# (SIZE (1..ub-country-code))
+# SINGLE VALUE
+# ::= {attributeType 6}
+#
+#
+# RFC-2256 ( 2.5.4.34 NAME 'seeAlso' SUP distinguishedName )
+# RFC-1274 seeAlso ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX distinguishedNameSyntax
+# ::= {attributeType 34}
+#
+#
+# RFC-1274 host ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX
+# caseIgnoreStringSyntax
+# (SIZE (1 .. ub-host))
+# ::= {pilotAttributeType 9}
+#
+#
+# RFC-2256 ( 2.5.4.32 NAME 'owner' SUP distinguishedName )
+# RFC-1274 owner ATTRIBUTE
+# WITH ATTRIBUTE-SYNTAX distinguishedNameSyntax
+# ::= {attributeType 32}
+#
+# ----------------------END FORMAL DESCRIPTION-------------
+#
+
+
+
+
+attribute facsimileTelephoneNumber fax tel
+attribute searchGuide cis
+attribute businessCategory cis
+attribute x121Address cis
+attribute registeredAddress cis
+attribute destinationIndicator cis
+attribute preferredDeliveryMethod cis
+attribute telexNumber cis
+attribute teletexTerminalIdentifier cis
+attribute telephoneNumber tel
+attribute internationaliSDNNumber ces
+attribute street cis
+attribute postOfficeBox cis
+attribute postalCode cis
+attribute postalAddress cis
+attribute physicalDeliveryOfficeName cis
+attribute st cis
+attribute objectClass cis
+attribute cn commonName cis
+attribute uid userid cis
+attribute userPassword ces
+attribute description cis
+attribute l localityName cis
+attribute manager dn
+attribute serialNumber cis
+attribute o organizationName cis
+attribute ou organizationalUnitName cis
+attribute c countryName cis
+attribute seeAlso dn
+attribute host cis
+attribute owner dn
--- /dev/null
+# $OpenLDAP$
+#
+# By: Juan C. Gomez
+# Date: 05/04/1999
+# Source: RFC-2307
+# ------------------------------------------------------------
+# Object class definitions for using LDAP as a back-end for Network
+# Information Services (NIS) with an OpenLDAP server.
+# This file holds the definitions of those attributes used in
+# RFC-2307, which are defined in other RFCs or X500 standards.
+# You may not need to include this file if you already have these
+# definitions in your default configuration files (i.e.
+# slapd.oc.conf).
+#
+
+
+
+
+#
+# ----------------------FORMAL DESCRIPTION--------------------
+#
+# RFC-2256 ( 2.5.6.0 NAME 'top' ABSTRACT MUST objectClass )
+# RFC-1274 top OBJECT-CLASS
+# MUST CONTAIN {
+# objectClass}
+# ::= {objectClass 0}
+#
+#
+# RFC-2256 ( 2.5.6.4 NAME 'organization' SUP top STRUCTURAL MUST o
+# MAY ( userPassword $ searchGuide $ seeAlso $ businessCategory $
+# x121Address $ registeredAddress $ destinationIndicator $
+# preferredDeliveryMethod $ telexNumber $
+# teletexTerminalIdentifier $ telephoneNumber $
+# internationaliSDNNumber $ facsimileTelephoneNumber $
+# street $ postOfficeBox $ postalCode $ postalAddress $
+# physicalDeliveryOfficeName $ st $ l $ description ) )
+# RFC-1274 organization OBJECT-CLASS
+# SUBCLASS OF top
+# MUST CONTAIN {
+# organizationName}
+# MAY CONTAIN {
+# organizationalAttributeSet}
+# ::= {objectClass 4}
+#
+#
+# RFC-1274 account OBJECT-CLASS
+# SUBCLASS OF top
+# MUST CONTAIN {
+# userid}
+# MAY CONTAIN {
+# description,
+# seeAlso,
+# localityName,
+# organizationName,
+# organizationalUnitName,
+# host}
+# ::= {pilotObjectClass 5}
+#
+#
+# RFC-2256 ( 2.5.6.14 NAME 'device' SUP top STRUCTURAL MUST cn
+# MAY ( serialNumber $ seeAlso $ owner $ ou $ o $ l $
+# description ) )
+# RFC-1274 device OBJECT-CLASS
+# SUBCLASS OF top
+# MUST CONTAIN {
+# commonName}
+# MAY CONTAIN {
+# description,
+# localityName,
+# organizationName,
+# organizationalUnitName,
+# owner,
+# seeAlso,
+# serialNumber}
+# ::= {objectClass 14}
+#
+# ----------------------END FORMAL DESCRIPTION-------------
+#
+
+
+
+
+objectclass top
+ requires
+ objectClass
+
+objectclass organization
+ requires
+ objectClass,
+ o
+ allows
+ userPassword,
+ searchGuide,
+ seeAlso,
+ businessCategory,
+ x121Address,
+ registeredAddress,
+ destinationIndicator,
+ preferredDeliveryMethod,
+ telexNumber,
+ teletexTerminalIdentifier,
+ telephoneNumber,
+ internationaliSDNNumber,
+ facsimileTelephoneNumber,
+ street,
+ postOfficeBox,
+ postalCode,
+ postalAddress,
+ physicalDeliveryOfficeName,
+ st,
+ l,
+ description
+
+objectclass account
+ requires
+ objectClass,
+ uid
+ allows
+ description,
+ seeAlso,
+ l,
+ o,
+ ou,
+ host
+
+objectclass device
+ requires
+ objectClass,
+ cn
+ allows
+ description,
+ l,
+ o,
+ ou,
+ owner,
+ seeAlso,
+ serialNumber
+# $OpenLDAP$
+
# These come from RFC1274 and are in ASN.1 syntax. They have been
# translated with some imagination. Only attributes and classes we
# already had are here. In general, the matching rules in the
/* schemaparse.c - routines to parse config file objectclass definitions */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include "slap.h"
#include "ldap_schema.h"
-static Avlnode *object_classes = NULL;
-
int global_schemacheck = 1; /* schemacheck on is default */
-static void oc_usage_old(void);
-static void oc_usage(void);
+static void oc_usage_old(void) LDAP_GCCATTR((noreturn));
+static void oc_usage(void) LDAP_GCCATTR((noreturn));
+static void at_usage(void) LDAP_GCCATTR((noreturn));
-static char *err2text[] = {
+static char *const err2text[] = {
"",
"Out of memory",
"Objectclass not found",
void
parse_oc_old(
Backend *be,
- char *fname,
+ const char *fname,
int lineno,
int argc,
char **argv
* matched, otherwise return length matched.
*/
int
-dscompare(char *s1, char *s2, char delim)
+dscompare(const char *s1, const char *s2, char delim)
{
- char *orig = s1;
+ const char *orig = s1;
while (*s1++ == *s2++)
if (!s1[-1]) break;
--s1;
void
parse_oidm(
- char *fname,
+ const char *fname,
int lineno,
int argc,
char **argv
void
parse_oc(
- char *fname,
+ const char *fname,
int lineno,
char *line,
char **argv
void
parse_at(
- char *fname,
+ const char *fname,
int lineno,
char *line,
char **argv
+/* $OpenLDAP$ */
/*
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
#include <ac/string.h>
#include <ac/socket.h>
-#include "ldap_defaults.h"
#include "slap.h"
send_ldap_result( conn, op, err,
NULL, "Bad search filter", NULL, NULL );
}
+ rc = -1;
goto return_results;
}
--- /dev/null
+# $OpenLDAP$
+
+PROGRAMS = passwd-shell
+
+SRCS = passwd-shell.c shellutil.c
+XSRCS = pwd-version.c
+OBJS = passwd-shell.o shellutil.o
+
+LDAP_INCDIR= ../../../include
+LDAP_LIBDIR= ../../../libraries
+
+BUILD_OPT = "--enable-shell"
+BUILD_SRV = @BUILD_SHELL@
+
+all-local-srv: $(PROGRAMS)
+
+passwd-shell: pwd-version.o
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) pwd-version.o $(LIBS)
+
+pwd-version.c: $(OBJS) $(LDAP_LIBDEPEND)
+ @-$(RM) $@
+ $(MKVERSION) passwd-shell > $@
+/* $OpenLDAP$ */
/*
passwd-shell.c - /etc/passwd shell-based backend for standalone ldap server
+/* $OpenLDAP$ */
/*
passwd-shell.h
+/* $OpenLDAP$ */
/*
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
shellutil.c - common routines useful when building shell-based backends
for the standalone ldap server
/* VARARGS */
void
-debug_printf
-#if HAVE_STDARG
- ( char *fmt, ... )
-#else
- ( va_alist )
- va_dcl
-#endif
+debug_printf( const char *fmt, ... )
{
va_list ap;
-#if !HAVE_STDARG
- char *fmt;
-#endif
if ( debugflg ) {
-#if HAVE_STDARG
va_start( ap, fmt );
-#else
- va_start( ap );
- fmt = va_arg( ap, char * );
-#endif
fprintf( stderr, "%s: ", progname );
vfprintf( stderr, fmt, ap );
va_end( ap );
+/* $OpenLDAP$ */
/*
shellutil.h
is provided ``as is'' without express or implied warranty.
*/
+#ifndef SHELLUTIL_H
+#define SHELLUTIL_H
+
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
#define MAXLINELEN 512
#define LDOP_SEARCH 0x01
char **ldop_suffixes;
char *ldop_dn;
- union {
+ union ldapop_params_u {
struct ldsrchparms LDsrchparams;
} ldop_params;
#define ldop_srch ldop_params.LDsrchparams
#ifdef LDAP_DEBUG
-void debug_printf();
+void debug_printf(const char *, ...) LDAP_GCCATTR((format(printf, 1, 2)));
#else /* LDAP_DEBUG */
-#define debug_printf()
+#define debug_printf (void) /* Ignore "arguments" */
#endif /* LDAP_DEBUG */
/*
char *ecalloc( unsigned nelem, unsigned elsize );
void *erealloc( void *s, unsigned size );
char *estrdup( char *s );
+extern void dump_ldop (struct ldop *op);
+
/*
* global variables
*/
extern int debugflg;
extern char *progname;
+
+LDAP_END_DECL
+#endif
/* slap.h - stand alone ldap server include file */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#ifndef _SLDAPD_H_
#define _SLDAPD_H_
+#include "ldap_defaults.h"
+
#include <ac/stdlib.h>
#include <sys/types.h>
#define SLAP_SCHERR_SYN_NOT_FOUND 11
#define SLAP_SCHERR_MR_INCOMPLETE 12
+#define SLAPD_ACI_DEFAULT_ATTR "aci"
+
extern int slap_debug;
struct slap_op;
char *a_domain_pat;
char *a_sockurl_pat;
+#ifdef SLAPD_ACI_ENABLED
+ char *a_aci_at;
+#endif
+
/* ACL Groups */
char *a_group_pat;
char *a_group_oc;
*/
int (*bi_init) LDAP_P((BackendInfo *bi));
int (*bi_config) LDAP_P((BackendInfo *bi,
- char *fname, int lineno, int argc, char **argv ));
+ const char *fname, int lineno, int argc, char **argv ));
int (*bi_open) LDAP_P((BackendInfo *bi));
int (*bi_close) LDAP_P((BackendInfo *bi));
int (*bi_destroy) LDAP_P((BackendInfo *bi));
*/
int (*bi_db_init) LDAP_P((Backend *bd));
int (*bi_db_config) LDAP_P((Backend *bd,
- char *fname, int lineno, int argc, char **argv ));
+ const char *fname, int lineno, int argc, char **argv ));
int (*bi_db_open) LDAP_P((Backend *bd));
int (*bi_db_close) LDAP_P((Backend *bd));
int (*bi_db_destroy) LDAP_P((Backend *db));
int (*bi_entry_release_rw) LDAP_P((BackendDB *bd, Entry *e, int rw));
int (*bi_acl_group) LDAP_P((Backend *bd,
- Entry *e, char *bdn, char *edn,
- char *objectclassValue, char *groupattrName ));
+ Entry *e, const char *bdn, const char *edn,
+ const char *objectclassValue, const char *groupattrName ));
int (*bi_connection_init) LDAP_P((BackendDB *bd,
struct slap_conn *c));
+# $OpenLDAP$
attribute photo bin
attribute personalsignature bin
attribute jpegphoto bin
attribute audio bin
attribute labeledurl ces
+attribute ref ces
attribute userpassword ces
attribute telephonenumber tel
attribute facsimiletelephonenumber fax tel
-include %ETCDIR%/slapd.at.conf
-include %ETCDIR%/slapd.oc.conf
+# $OpenLDAP$
+#
+# See slapd.conf(5) for details on configuration options.
+# This file should NOT be world readable.
+#
+include %SYSCONFDIR%/slapd.at.conf
+include %SYSCONFDIR%/slapd.oc.conf
schemacheck off
-referral ldap://ldap.itd.umich.edu
+
+#referral ldap://root.openldap.org
+
+pidfile %LOCALSTATEDIR%/slapd.pid
+argsfile %LOCALSTATEDIR%/slapd.args
#######################################################################
# ldbm database definitions
#######################################################################
database ldbm
-suffix "o=Your Organization Name, c=US"
+suffix "dc=your-domain, dc=com"
+#suffix "o=Your Organization Name, c=US"
directory /usr/tmp
-rootdn "cn=root, o=Your Organization Name, c=US"
+rootdn "cn=root, dc=your-domain, dc=com"
+#rootdn "cn=root, o=Your Organization Name, c=US"
rootpw secret
+# cleartext passwords, especially for the rootdn, should
+# be avoid. See slapd.conf(5) for details.
+
+
+# $OpenLDAP$
+
objectclass top
requires
objectClass
/* str2filter.c - parse an rfc 1588 string filter */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <ac/socket.h>
#include "slap.h"
+#include <ldap_pvt.h>
static char *find_matching_paren(char *s);
static Filter *str2list(char *str, long unsigned int ftype);
str2filter( char *str )
{
Filter *f = NULL;
- char *end;
+ char *end, *freeme;
Debug( LDAP_DEBUG_FILTER, "str2filter \"%s\"\n", str, 0, 0 );
return( NULL );
}
+ str = freeme = ch_strdup( str );
+
switch ( *str ) {
case '(':
if ( (end = find_matching_paren( str )) == NULL ) {
filter_free( f );
+ free( freeme );
return( NULL );
}
*end = '\0';
break;
}
+ free( freeme );
return( f );
}
*s = '\0';
break;
default:
- if ( strchr( value, '*' ) == NULL ) {
+ if ( ldap_pvt_find_wildcard( value ) == NULL ) {
f->f_choice = LDAP_FILTER_EQUALITY;
} else if ( strcmp( value, "*" ) == 0 ) {
f->f_choice = LDAP_FILTER_PRESENT;
} else {
f->f_avtype = ch_strdup( str );
f->f_avvalue.bv_val = ch_strdup( value );
+ ldap_pvt_filter_value_unescape( f->f_avvalue.bv_val );
f->f_avvalue.bv_len = strlen( value );
}
static int
str2subvals( char *val, Filter *f )
{
- char *nextstar;
+ char *nextstar, *freeme;
int gotstar;
Debug( LDAP_DEBUG_FILTER, "str2subvals \"%s\"\n", val, 0, 0 );
+ val = freeme = ch_strdup( val );
gotstar = 0;
while ( val != NULL && *val ) {
- if ( (nextstar = strchr( val, '*' )) != NULL )
+ if ( (nextstar = ldap_pvt_find_wildcard( val )) != NULL )
*nextstar++ = '\0';
+ ldap_pvt_filter_value_unescape( val );
if ( gotstar == 0 ) {
f->f_sub_initial = ch_strdup( val );
} else if ( nextstar == NULL ) {
f->f_sub_final = ch_strdup( val );
} else {
- charray_add( &f->f_sub_any, ch_strdup( val ) );
+ charray_add( &f->f_sub_any, val );
}
gotstar = 1;
- if ( nextstar != NULL )
- *(nextstar-1) = '*';
val = nextstar;
}
+ free( freeme );
return( 0 );
}
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999 The OpenLDAP Foundation, All Rights Reserved.
+ *
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file in the top level
+ * directory of this package.
+ */
+/* Portions
+ * Copyright (c) 1998 Will Ballantyne, ITSD, Government of BC
+ * 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 ITSD, Government of BC. The name of ITSD
+ * 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 "portable.h"
+
+#include <stdio.h>
+#include <ac/string.h>
+#include <ac/socket.h>
+#include "slap.h"
+
+/*
+ * given a normalized uppercased dn (or root part),
+ * return an aliased dn if any of the alias suffixes match
+ */
+char *suffix_alias(
+ Backend *be,
+ char *dn )
+{
+ int i, dnLength;
+
+ if(dn == NULL) return NULL;
+ if(be == NULL) return dn;
+
+ dnLength = strlen ( dn );
+
+ for ( i = 0;
+ be->be_suffixAlias != NULL && be->be_suffixAlias[i] != NULL;
+ i += 2 )
+ {
+ int aliasLength = strlen (be->be_suffixAlias[i]);
+ int diff = dnLength - aliasLength;
+
+ if ( diff < 0 ) {
+ /* alias is longer than dn */
+ continue;
+ } else if ( diff > 0 ) {
+ if ( ! DNSEPARATOR(dn[diff-1]) ) {
+ /* boundary is not at a DN separator */
+ continue;
+ }
+ /* At a DN Separator */
+ /* XXX or an escaped separator... oh well */
+ }
+
+ if (!strcmp(be->be_suffixAlias[i], &dn[diff])) {
+ char *oldDN = dn;
+ dn = ch_malloc( diff + strlen(be->be_suffixAlias[i+1]) + 1 );
+ strncpy( dn, oldDN, diff );
+ strcpy( &dn[diff], be->be_suffixAlias[i+1] );
+ Debug( LDAP_DEBUG_ARGS,
+ "suffix_alias: converted \"%s\" to \"%s\"\n",
+ oldDN, dn, 0);
+ free (oldDN);
+ break;
+ }
+ }
+
+ return dn;
+}
+# $OpenLDAP$
#-----------------------------------------------------------------------------
# Copyright (c) 1995 Regents of the University of Michigan.
# All rights reserved.
/* centipede.c - generate and install indexing information (view w/tabstop=4) */
+/* $OpenLDAP$ */
#include "portable.h"
int nentries
)
{
+#ifdef LDBM_ORDERED
Datum okey, nkey;
Datum olast, nlast;
+#endif
Datum lastkey, key;
Datum data;
LDAPMod **mods;
fflush( stdout );
}
- ldbm_datum_init( okey );
- ldbm_datum_init( nkey );
- ldbm_datum_init( olast );
- ldbm_datum_init( nlast );
ldbm_datum_init( lastkey );
ldbm_datum_init( key );
ldbm_datum_init( data );
* dual traversal, yielding O(N) performance.
*/
+ ldbm_datum_init( okey );
+ ldbm_datum_init( nkey );
+ ldbm_datum_init( olast );
+ ldbm_datum_init( nlast );
+
olast.dptr = NULL;
nlast.dptr = NULL;
+/* $OpenLDAP$ */
/*
* Copyright (c) 1990, 1995 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
* is provided ``as is'' without express or implied warranty.
*/
+#ifndef LDAPSYNTAX_H
+#define LDAPSYNTAX_H 1
+
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
/* XXX: the "master" LINE_WIDTH #define is in ../slap.h */
#define LINE_WIDTH 76 /* for lines in string rep of an entry */
-#ifdef NEEDPROTOS
/*
* function prototypes
*/
-int init_syntaxes( void );
-int av2ldif( FILE *outfp, AV_Sequence av, DN dn, short syntax,
- char *attrname, PS str_ps );
+int init_syntaxes LDAP_P(( void ));
+int av2ldif LDAP_P(( FILE *outfp, AV_Sequence av, DN dn, short syntax,
+ char *attrname, PS str_ps ));
-#endif /* NEEDPROTOS */
+LDAP_END_DECL
+#endif
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include <io.h>
#endif
-#include "ldap_defaults.h"
#include "../slap.h"
#include "../back-ldbm/back-ldbm.h"
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
if ( argc == 3 ) {
if ( strcmp( argv[1], "-b" ) != 0 ) {
usage( argv[0] );
- } else {
- binary = 1;
- type = argv[2];
}
+ binary = 1;
+ type = argv[2];
} else {
if ( strcmp( argv[1], "-b" ) == 0 ) {
usage( argv[0] );
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
Connection *conn,
Operation *op,
ber_int_t err,
- char *text
+ const char *text
)
{
assert(0);
Connection *conn,
Operation *op,
int err,
- char *matched,
- char *text,
+ const char *matched,
+ const char *text,
struct berval **refs,
LDAPControl **ctrls
)
Connection *conn,
Operation *op,
int err,
- char *matched,
- char *text,
+ const char *matched,
+ const char *text,
struct berval **refs,
LDAPControl **ctrls,
int nentries
+/* $OpenLDAP$ */
#include "portable.h"
#include <stdio.h>
scount = 0; ssize = 0;
if ( (bvals = ldap_get_values_len( ld, e, attrs[i] )) != NULL ) {
for ( j = 0; bvals[j] != NULL; j++ ) {
- Datum key, data;
char *w;
- ldbm_datum_init( key );
- ldbm_datum_init( data );
-
/* update value count */
vcount++;
vsize += bvals[j]->bv_len;
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
buf = NULL;
lmax = 0;
+ lineno = 0;
if( be->be_entry_open( be, 1 ) != 0 ) {
fprintf( stderr, "%s: could not open database.\n",
/* check schema */
if ( global_schemacheck && oc_schema_check( e ) != 0 ) {
- fprintf( stderr, "%s: entry dn=\"%s\" violates schema violation (line=%d)\n",
+ fprintf( stderr, "%s: schema violation in entry dn=\"%s\" (line=%d)\n",
progname, e->e_dn, lineno );
rc = EXIT_FAILURE;
entry_free( e );
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#define SLAPCOMMON_H_ 1
#define SLAPD_TOOLS 1
-#include "ldap_defaults.h"
#include "../slap.h"
enum slaptool {
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
id != NOID;
id = be->be_entry_next( be ) )
{
- Attribute *attr;
struct berval **values;
Entry* e = be->be_entry_get( be, id );
struct berval bv;
}
if( strcasecmp( type, "dn" ) == 0 ) {
- attr = attr_find( e->e_attrs, type );
+ bv.bv_val = e->e_ndn;
+ bv.bv_len = strlen( bv.bv_val );
+ bvals[0] = &bv;
+ bvals[1] = NULL;
+
+ values = bvals;
+
+ } else {
+ Attribute *attr = attr_find( e->e_attrs, type );
if( attr == NULL ) {
entry_free( e );
}
values = attr->a_vals;
-
- } else {
- bv.bv_val = e->e_ndn;
- bv.bv_len = strlen( bv.bv_val );
- bvals[0] = &bv;
- bvals[1] = NULL;
-
- values = bvals;
}
if ( be->be_index_change( be,
- type, attr->a_vals, id, SLAP_INDEX_ADD_OP ) )
+ type, values, id, SLAP_INDEX_ADD_OP ) )
{
rc = EXIT_FAILURE;
/* unbind.c - decode an ldap unbind operation and pass it to a backend db */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
if ( got_gid ) {
if ( setgid( gid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set real group id to %d\n",
- gid, 0, 0 );
+ (int) gid, 0, 0 );
exit( EXIT_FAILURE );
}
#ifdef HAVE_SETEGID
if ( setegid( gid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set effective group id to %d\n",
- gid, 0, 0 );
+ (int) gid, 0, 0 );
exit( EXIT_FAILURE );
}
#endif
if ( got_uid ) {
if ( setuid( uid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set real user id to %d\n",
- uid, 0, 0 );
+ (int) uid, 0, 0 );
exit( EXIT_FAILURE );
}
#ifdef HAVE_SETEUID
if ( seteuid( uid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set effective user id to %d\n",
- uid, 0, 0 );
+ (int) uid, 0, 0 );
exit( EXIT_FAILURE );
}
#endif
/* value.c - routines for dealing with values */
+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
for ( i = 0, j = 0; i < naddvals; i++, j++ ) {
if ( addvals[i]->bv_len > 0 ) {
(*vals)[nvals + j] = ber_bvdup( addvals[i] );
+ if( (*vals)[nvals + j] == NULL ) break;
}
}
(*vals)[nvals + j] = NULL;
for ( i = 0, j = 0; i < nn; i++ ) {
if ( addvals[i]->bv_len > 0 ) {
- (*vals)[n + j++] = ber_bvdup( addvals[i] );
+ (*vals)[n + j] = ber_bvdup( addvals[i] );
+ if( (*vals)[n + j++] == NULL ) break;
}
}
(*vals)[n + j] = NULL;
rc = strcmp( v1->bv_val, v2->bv_val );
break;
+ default: /* Unknown syntax */
case SYNTAX_BIN:
rc = (v1->bv_len == v2->bv_len
? memcmp( v1->bv_val, v2->bv_val, v1->bv_len )
+# $OpenLDAP$
##
## Makefile.in for slurpd
##
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* reconfiguration of slurpd.
*/
+#include "portable.h"
#include <stdio.h>
-#include <signal.h>
+
+#include <ac/signal.h>
#include "slurp.h"
#include "globals.h"
* slurpd receives a USR2 signal, it will dump its replication
* queue to the disk file given by SLURPD_DUMPFILE.
*/
-void
-do_admin()
+RETSIGTYPE
+do_admin( int sig )
{
sglob->rq->rq_dump( sglob->rq );
- (void) SIGNAL( SIGUSR2, (void *) do_admin );
+ (void) SIGNAL( sig, do_admin );
}
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* args.c - process command-line arguments, and set appropriate globals.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
+
+#include <ac/stdlib.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
#include <lber.h>
#include <ldap.h>
#include "globals.h"
-static int
+static void
usage( char *name )
{
fprintf( stderr, "usage: %s\t[-d debug-level] [-s syslog-level]\n", name );
fprintf( stderr, "\t\t[-f slapd-config-file] [-r replication-log-file]\n" );
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
fprintf( stderr, "\t\t[-t tmp-dir] [-o] [-k srvtab-file]\n" );
-#else /* KERBEROS */
+#else /* HAVE_KERBEROS */
fprintf( stderr, "\t\t[-t tmp-dir] [-o]\n" );
-#endif /* KERBEROS */
+#endif /* HAVE_KERBEROS */
}
)
{
int i;
- extern char *optarg;
int rflag = 0;
if ( (g->myname = strrchr( argv[0], '/' )) == NULL ) {
while ( (i = getopt( argc, argv, "hd:f:r:t:k:o" )) != EOF ) {
switch ( i ) {
-#ifdef LDAP_DEBUG
- case 'd': /* turn on debugging */
+ case 'd': /* set debug level and 'do not detach' flag */
+ g->no_detach = 1;
if ( optarg[0] == '?' ) {
+#ifdef LDAP_DEBUG
printf( "Debug levels:\n" );
printf( "\tLDAP_DEBUG_TRACE\t%d\n",
LDAP_DEBUG_TRACE );
LDAP_DEBUG_ACL );
printf( "\tLDAP_DEBUG_ANY\t\t%d\n",
LDAP_DEBUG_ANY );
+ puts( "\tThe -d flag also prevents slurpd from detaching." );
+#endif /* LDAP_DEBUG */
+ puts( "\tDebugging is disabled. -d 0 prevents slurpd from detaching." );
return( -1 );
- } else {
- ldap_debug = atoi( optarg );
}
- break;
-#else /* LDAP_DEBUG */
- case 'd': /* can't enable debugging - not built with debug code */
- fprintf( stderr, "must compile with LDAP_DEBUG for debugging\n" );
- break;
+#ifdef LDAP_DEBUG
+ ldap_debug |= atoi( optarg );
+#else /* !LDAP_DEBUG */
+ if ( atoi( optarg ) != 0 )
+ /* can't enable debugging - not built with debug code */
+ fputs( "must compile with LDAP_DEBUG for debugging\n",
+ stderr );
#endif /* LDAP_DEBUG */
+ break;
case 'f': /* slapd config file */
g->slapd_configfile = strdup( optarg );
break;
g->slurpd_rdir = strdup( optarg );
break;
case 'k': /* name of kerberos srvtab file */
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
g->default_srvtab = strdup( optarg );
-#else /* KERBEROS */
+#else /* HAVE_KERBEROS */
fprintf( stderr, "must compile with KERBEROS to use -k option\n" );
-#endif /* KERBEROS */
+#endif /* HAVE_KERBEROS */
break;
case 'h':
usage( g->myname );
sprintf( g->slurpd_status_file, "%s/%s", g->slurpd_rdir,
DEFAULT_SLURPD_STATUS_FILE );
+ ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldap_debug);
+ ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldap_debug);
+ ldif_debug = ldap_debug;
+
#ifdef LOG_LOCAL4
openlog( g->myname, OPENLOG_OPTIONS, LOG_LOCAL4 );
#else
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* fm.c - file management routines.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <signal.h>
+
+#include <ac/stdlib.h>
+#include <ac/string.h>
+#include <ac/signal.h>
#include "slurp.h"
#include "globals.h"
-extern void do_admin();
-
-static void set_shutdown();
-void do_nothing();
-
-/*
- * Externs
- */
-#ifdef NEEDPROTOS
-extern int file_nonempty( char * );
-extern int acquire_lock(char *, FILE **, FILE ** );
-extern int relinquish_lock(char *, FILE *, FILE * );
-#else /* NEEDPROTOS */
-extern int file_nonempty();
-extern int acquire_lock();
-extern int relinquish_lock();
-#endif /* NEEDPROTOS */
/*
* Forward references
*/
-#ifdef NEEDPROTOS
-static char *get_record( FILE * );
-static void populate_queue( char *f );
-static void set_shutdown();
-void do_nothing();
-#else /* NEEDPROTOS */
-static char *get_record();
-static void populate_queue();
-static void set_shutdown();
-void do_nothing();
-#endif /* NEEDPROTOS */
-
-#ifndef SYSERRLIST_IN_STDIO
-extern char *sys_errlist[];
-#endif /* SYSERRLIST_IN_STDIO */
-
+static char *get_record LDAP_P(( FILE * ));
+static void populate_queue LDAP_P(( char *f ));
+static RETSIGTYPE set_shutdown LDAP_P((int));
/*
* - adds items to the internal queue of replication work to do
* - signals the replication threads to let them know new work has arrived.
*/
-void
+void *
fm(
void *arg
)
/* Set up our signal handlers:
* SIG{TERM,INT,HUP} causes a shutdown
- * SIGUSR1 - does nothing, used to wake up sleeping threads.
- * SIGUSR2 - causes slurpd to read its administrative interface file.
- * (not yet implemented).
+ * LDAP_SIGUSR1 - does nothing, used to wake up sleeping threads.
+ * LDAP_SIGUSR2 - causes a shutdown
*/
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
- (void) SIGNAL( SIGUSR2, (void *) do_admin );
- (void) SIGNAL( SIGTERM, (void *) set_shutdown );
- (void) SIGNAL( SIGINT, (void *) set_shutdown );
- (void) SIGNAL( SIGHUP, (void *) set_shutdown );
+ (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
+ (void) SIGNAL( LDAP_SIGUSR2, set_shutdown );
+ (void) SIGNAL( SIGTERM, set_shutdown );
+ (void) SIGNAL( SIGINT, set_shutdown );
+#ifdef SIGHUP
+ (void) SIGNAL( SIGHUP, set_shutdown );
+#endif
if ( sglob->one_shot_mode ) {
if ( file_nonempty( sglob->slapd_replogfile )) {
sglob->rq->rq_getcount( sglob->rq, RQ_COUNT_ALL ));
printf( "%d replication records to process.\n",
sglob->rq->rq_getcount( sglob->rq, RQ_COUNT_NZRC ));
- return;
+ return NULL;
}
/*
* There may be some leftover replication records in our own
}
}
} else {
- tsleep( sglob->no_work_interval );
+ ldap_pvt_thread_sleep( sglob->no_work_interval );
}
/* Garbage-collect queue */
}
}
Debug( LDAP_DEBUG_ARGS, "fm: exiting\n", 0, 0, 0 );
+ return NULL;
}
/*
* Set a global flag which signals that we're shutting down.
*/
-static void
-set_shutdown()
+static RETSIGTYPE
+set_shutdown(int sig)
{
int i;
sglob->slurpd_shutdown = 1; /* set flag */
- pthread_kill( sglob->fm_tid, SIGUSR1 ); /* wake up file mgr */
+ ldap_pvt_thread_kill( sglob->fm_tid, LDAP_SIGUSR1 ); /* wake up file mgr */
sglob->rq->rq_lock( sglob->rq ); /* lock queue */
- pthread_cond_broadcast( &(sglob->rq->rq_more) ); /* wake repl threads */
+ ldap_pvt_thread_cond_broadcast( &(sglob->rq->rq_more) ); /* wake repl threads */
for ( i = 0; i < sglob->num_replicas; i++ ) {
(sglob->replicas[ i ])->ri_wake( sglob->replicas[ i ]);
}
sglob->rq->rq_unlock( sglob->rq ); /* unlock queue */
- (void) SIGNAL( SIGTERM, (void *) set_shutdown ); /* reinstall handlers */
- (void) SIGNAL( SIGINT, (void *) set_shutdown );
- (void) SIGNAL( SIGHUP, (void *) set_shutdown );
+ (void) SIGNAL( sig, set_shutdown ); /* reinstall handlers */
}
/*
* A do-nothing signal handler.
*/
-void
-do_nothing()
+RETSIGTYPE
+do_nothing(int sig)
{
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
+ (void) SIGNAL( sig, do_nothing );
}
)
{
FILE *fp, *lfp;
- Rq *rq = sglob->rq;
char *p;
if ( acquire_lock( f, &fp, &lfp ) < 0 ) {
Debug( LDAP_DEBUG_ANY,
"error: can't seek to offset %ld in file \"%s\"\n",
sglob->srpos, f, 0 );
- return;
- }
+ } else {
while (( p = get_record( fp )) != NULL ) {
if ( sglob->rq->rq_add( sglob->rq, p ) < 0 ) {
char *t;
p, 0, 0 );
}
free( p );
- pthread_yield();
+ ldap_pvt_thread_yield();
}
sglob->srpos = ftell( fp );
+ }
(void) relinquish_lock( f, fp, lfp );
}
while (( fgets( line, sizeof(line), fp ) != NULL ) &&
(( len = strlen( line )) > 1 )) {
- while ( lcur + len + 1 > lmax ) {
- lmax += BUFSIZ;
- buf = (char *) ch_realloc( buf, lmax );
- }
- strcpy( buf + lcur, line );
- lcur += len;
+
+ while ( lcur + len + 1 > lmax ) {
+ lmax += BUFSIZ;
+ buf = (char *) ch_realloc( buf, lmax );
+ }
+ strcpy( buf + lcur, line );
+ lcur += len;
}
return( buf );
}
-
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
g->slurpd_replogfile[ 0 ] = '\0';
g->slurpd_status_file[ 0 ] = '\0';
g->one_shot_mode = 0;
+ g->no_detach = 0;
g->myname = NULL;
g->srpos = 0L;
if ( St_init( &(g->st)) < 0 ) {
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* is provided ``as is'' without express or implied warranty.
*/
+#ifndef SLURPD_GLOBALS_H
+#define SLURPD_GLOBALS_H 1
/*
* globals.h - definition of structure holding global data.
#include "slurp.h"
+LDAP_BEGIN_DECL
+
typedef struct globals {
/* Thread ID for file manager thread */
- pthread_t fm_tid;
+ ldap_pvt_thread_t fm_tid;
/* The name of the slapd config file (which is also our config file) */
char *slapd_configfile;
/* How long the master slurpd sleeps when there's no work to do */
int no_work_interval;
/* We keep running until slurpd_shutdown is nonzero. HUP signal set this */
- int slurpd_shutdown;
+ sig_atomic_t slurpd_shutdown;
/* Number of replicas we're servicing */
int num_replicas;
/* Array of pointers to replica info */
char slurpd_replogfile[ MAXPATHLEN ];
/* Non-zero if we were given a replog file to process on command-line */
int one_shot_mode;
+ /* Non-zero if we should not detach the process */
+ int no_detach;
/* Name of program */
char *myname;
/* Current offset into slurpd replica logfile */
off_t srpos;
/* mutex to serialize access to reject file */
- pthread_mutex_t rej_mutex;
+ ldap_pvt_thread_mutex_t rej_mutex;
/* pointer to status struct */
St *st;
/* Pointer to replication queue */
Rq *rq;
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
/* Default name of kerberos srvtab file */
char *default_srvtab;
-#endif /* KERBEROS */
-#if defined( THREAD_SUNOS4_LWP )
- tl_t *tsl_list;
- mon_t tsl_mon;
-#endif /* THREAD_SUNOS4_LWP */
+#endif /* HAVE_KERBEROS */
} Globals;
extern Globals *sglob;
+
+LDAP_END_DECL
+
+#endif /* SLURPD_GLOBALS_H */
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
static int getmodtype LDAP_P(( char * ));
static void dump_ldm_array LDAP_P(( LDAPMod ** ));
static char **read_krbnames LDAP_P(( Ri * ));
+#ifdef HAVE_KERBEROS
static void upcase LDAP_P(( char * ));
+#endif
static int do_bind LDAP_P(( Ri *, int * ));
static int do_unbind LDAP_P(( Ri * ));
}
+#ifdef HAVE_KERBEROS
/*
* upcase a string
*p = TOUPPER( (unsigned char) *p );
}
}
+
+#endif /* HAVE_KERBEROS */
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* lock.c - routines to open and apply an advisory lock to a file
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <sys/time.h>
-#include <sys/types.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
-#include <sys/socket.h>
-#include "portable.h"
-#ifdef USE_LOCKF
-#include <unistd.h>
#endif
-#include "../slapd/slap.h"
+#include "slurp.h"
FILE *
lock_fopen(
- char *fname,
- char *type,
+ const char *fname,
+ const char *type,
FILE **lfp
)
{
}
/* acquire the lock */
-#ifdef USE_LOCKF
- while ( lockf( fileno( *lfp ), F_LOCK, 0 ) != 0 ) {
-#else
- while ( flock( fileno( *lfp ), LOCK_EX ) != 0 ) {
-#endif
- ; /* NULL */
- }
+ ldap_lockf( fileno(*lfp) );
/* open the log file */
if ( (fp = fopen( fname, type )) == NULL ) {
Debug( LDAP_DEBUG_ANY,
"Error: could not open \"%s\"\n", fname, 0, 0 );
-#ifdef USE_LOCKF
- lockf( fileno( *lfp ), F_ULOCK, 0 );
-#else
- flock( fileno( *lfp ), LOCK_UN );
-#endif
+ ldap_unlockf( fileno(*lfp) );
+ fclose( *lfp );
+ *lfp = NULL;
return( NULL );
}
)
{
/* unlock */
-#ifdef USE_LOCKF
- lockf( fileno( lfp ), F_ULOCK, 0 );
-#else
- flock( fileno( lfp ), LOCK_UN );
-#endif
+ ldap_unlockf( fileno(lfp) );
fclose( lfp );
return( fclose( fp ) );
*/
int
acquire_lock(
- char *file,
+ const char *file,
FILE **rfp,
FILE **lfp
)
{
if (( *rfp = lock_fopen( file, "r+", lfp )) == NULL ) {
Debug( LDAP_DEBUG_ANY,
- "Error: acquire_lock(%d): Could not acquire lock on \"%s\"\n",
- getpid(), file, 0);
+ "Error: acquire_lock(%ld): Could not acquire lock on \"%s\"\n",
+ (long) getpid(), file, 0);
return( -1 );
}
return( 0 );
*/
int
relinquish_lock(
- char *file,
+ const char *file,
FILE *rfp,
FILE *lfp
)
{
if ( lock_fclose( rfp, lfp ) == EOF ) {
Debug( LDAP_DEBUG_ANY,
- "Error: relinquish_lock (%d): Error closing \"%s\"\n",
- getpid(), file, 0 );
+ "Error: relinquish_lock (%ld): Error closing \"%s\"\n",
+ (long) getpid(), file, 0 );
return( -1 );
}
return( 0 );
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
}
/*
- * Detach from the controlling terminal, if debug level = 0,
- * and if not in one-shot mode.
+ * Detach from the controlling terminal
+ * unless the -d flag is given or in one-shot mode.
*/
-#ifdef LDAP_DEBUG
- if (( ldap_debug == 0 ) && !sglob->one_shot_mode )
-#else /* LDAP_DEBUG */
- if ( !sglob->one_shot_mode )
-#endif /* LDAP_DEBUG */
+ if ( ! (sglob->no_detach || sglob->one_shot_mode) )
lutil_detach( 0, 0 );
/*
+/* $OpenLDAP$ */
#ifndef _PROTO_SLURP
#define _PROTO_SLURP
int do_ldap LDAP_P((Ri *ri, Re *re, char **errmsg));
/* lock.c */
-FILE *lock_fopen LDAP_P((char *fname, char *type, FILE **lfp));
+FILE *lock_fopen LDAP_P((const char *fname, const char *type, FILE **lfp));
int lock_fclose LDAP_P((FILE *fp, FILE *lfp));
-int acquire_lock LDAP_P((char *file, FILE **rfp, FILE **lfp));
-int relinquish_lock LDAP_P((char *file, FILE *rfp, FILE *lfp));
+int acquire_lock LDAP_P((const char *file, FILE **rfp, FILE **lfp));
+int relinquish_lock LDAP_P((const char *file, FILE *rfp, FILE *lfp));
/* reject.c */
void write_reject LDAP_P((Ri *ri, Re *re, int lderr, char *errmsg));
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
Debug( LDAP_DEBUG_ANY,
"Error: Re_parse: bad type <%s>\n",
type, 0, 0 );
+ free( type );
+ if ( value != NULL )
+ free( value );
return -1;
}
}
+ free( type );
+ if ( value != NULL )
+ free( value );
}
if ( state != GOT_ALL ) {
}
for (;;) {
+ char *const dash = "-";
+
if (( buf = ldif_getline( &rp )) == NULL ) {
break;
}
buflen = strlen( buf );
if (( buflen == 1 ) && ( buf[ 0 ] == '-' )) {
- type = "-";
+ type = dash;
value = NULL;
} else {
if ( ldif_parse_line( buf, &type, &value, &len ) < 0 ) {
re->re_mods[ nml + 1 ].mi_type = NULL;
re->re_mods[ nml + 1 ].mi_val = NULL;
nml++;
+
+ if ( type != dash )
+ free( type );
+ if ( value != NULL )
+ free( value );
}
return 0;
}
char **r_rp
)
{
- char buf[ LDIF_LINE_WIDTH + 1 ];
char *type, *value, *line, *p;
Rh *rh = NULL;
int nreplicas;
break;
}
}
+ free( type );
if ( !repl_ok ) {
warn_unknown_replica( value, port );
+ if ( value != NULL )
+ free( value );
continue;
}
rh[ nreplicas ].rh_hostname = strdup( value );
rh[ nreplicas ].rh_port = port;
nreplicas++;
+
+ if ( value != NULL )
+ free( value );
}
if ( nreplicas == 0 ) {
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* to a replica LDAP server.
*/
+#include "portable.h"
#include <stdio.h>
-#include <sys/types.h>
+
+#include <ac/errno.h>
+#include <ac/unistd.h>
+
#include <sys/stat.h>
#include <fcntl.h>
-#include <unistd.h>
#include "slurp.h"
#include "globals.h"
-#ifndef SYSERRLIST_IN_STDIO
-extern char *sys_errlist[];
-#endif /* SYSERRLIST_IN_STDIO */
-
-
/*
* Write a replication record to a reject file. The reject file has the
* same name as the replica's private copy of the file but with ".rej"
FILE *rfp, *lfp;
int rc;
- pthread_mutex_lock( &sglob->rej_mutex );
+ ldap_pvt_thread_mutex_lock( &sglob->rej_mutex );
sprintf( rejfile, "%s/%s:%d.rej", sglob->slurpd_rdir,
ri->ri_hostname, ri->ri_port );
Debug( LDAP_DEBUG_ANY,
"Error: write_reject: Cannot create \"%s\": %s\n",
rejfile, sys_errlist[ errno ], 0 );
- pthread_mutex_unlock( &sglob->rej_mutex );
+ ldap_pvt_thread_mutex_unlock( &sglob->rej_mutex );
return;
} else {
close( rjfd );
"Error: ldap operation failed, data written to \"%s\"\n",
rejfile, 0, 0 );
}
- pthread_mutex_unlock( &sglob->rej_mutex );
+ ldap_pvt_thread_mutex_unlock( &sglob->rej_mutex );
return;
}
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* replica.c - code to start up replica threads.
*/
+#include "portable.h"
#include <stdio.h>
* Just invoke the Ri's process() member function, and log the start and
* finish.
*/
-void
+static void *
replicate(
- Ri *ri
+ void *ri_arg
)
{
- int i;
- unsigned long seq;
+ Ri *ri = (Ri *) ri_arg;
Debug( LDAP_DEBUG_ARGS, "begin replication thread for %s:%d\n",
- ri->ri_hostname, ri->ri_port, 0 );
+ ((Ri *)ri)->ri_hostname, ((Ri *)ri)->ri_port, 0 );
ri->ri_process( ri );
Debug( LDAP_DEBUG_ARGS, "end replication thread for %s:%d\n",
ri->ri_hostname, ri->ri_port, 0 );
- return;
+ return NULL;
}
Ri *ri
)
{
- pthread_attr_t attr;
-
- pthread_attr_init( &attr );
- pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
-
- if ( pthread_create( &(ri->ri_tid), attr, (void *) replicate,
+ /* POSIX_THREADS or compatible */
+ if ( ldap_pvt_thread_create( &(ri->ri_tid), 0, replicate,
(void *) ri ) != 0 ) {
- Debug( LDAP_DEBUG_ANY, "replica \"%s:%d\" pthread_create failed\n",
+ Debug( LDAP_DEBUG_ANY, "replica \"%s:%d\" ldap_pvt_thread_create failed\n",
ri->ri_hostname, ri->ri_port, 0 );
- pthread_attr_destroy( &attr );
return -1;
}
- pthread_attr_destroy( &attr );
+
return 0;
}
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* replog.c - routines which read and write replication log files.
*/
-
-#include <errno.h>
-#include <stdio.h>
-#include <syslog.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-
#include "portable.h"
-#include "slurp.h"
-#include "globals.h"
-/*
- * Externs
- */
-#ifdef NEEDPROTOS
-extern FILE *lock_fopen( char *, char *, FILE ** );
-extern char *ch_malloc( unsigned long );
-#else /* NEEDPROTOS */
-extern FILE *lock_fopen();
-extern char *ch_malloc();
-#endif /* NEEDPROTOS */
+#include <stdio.h>
-/*
- * Forward declarations
- */
-#ifdef NEEDPROTOS
-int file_nonempty( char * );
-#else /* NEEDPROTOS */
-int file_nonempty();
-#endif /* NEEDPROTOS */
+#include <ac/errno.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+#include <sys/stat.h>
-#ifndef SYSERRLIST_IN_STDIO
-extern char *sys_errlist[];
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
#endif
-/*
- * Forward declarations
- */
-static int duplicate_replog( char *, char * );
-
-
+#include <fcntl.h>
+#include "slurp.h"
+#include "globals.h"
/*
* Copy the replication log. Returns 0 on success, 1 if a temporary
}
if ( access( buf, W_OK ) < 0 ) {
Debug( LDAP_DEBUG_ANY,
- "Error: copy_replog (%d): Directory %s is not writable\n",
- getpid(), buf, 0 );
+ "Error: copy_replog (%ld): Directory %s is not writable\n",
+ (long) getpid(), buf, 0 );
return( -1 );
}
strcpy( buf, dst );
}
if ( access( buf, W_OK ) < 0 ) {
Debug( LDAP_DEBUG_ANY,
- "Error: copy_replog (%d): Directory %s is not writable\n",
- getpid(), buf, 0 );
+ "Error: copy_replog (%ld): Directory %s is not writable\n",
+ (long) getpid(), buf, 0 );
return( -1 );
}
Debug( LDAP_DEBUG_ANY,
"Error: copy_replog: Can't lock replog \"%s\" for write: %s\n",
src, sys_errlist[ errno ], 0 );
- lock_fclose( rfp );
+ lock_fclose( rfp, lfp );
return( 1 );
}
truncate( src, (off_t) 0 );
}
- if ( lock_fclose( rfp, lfp ) == EOF ) {
+ if ( lock_fclose( dfp, dlfp ) == EOF ) {
Debug( LDAP_DEBUG_ANY,
"Error: copy_replog: Error closing \"%s\"\n",
src, 0, 0 );
}
- if ( lock_fclose( dfp, dlfp ) == EOF ) {
+ if ( lock_fclose( rfp, lfp ) == EOF ) {
Debug( LDAP_DEBUG_ANY,
"Error: copy_replog: Error closing \"%s\"\n",
src, 0, 0 );
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
*/
+#include "portable.h"
#include <stdio.h>
-#include <signal.h>
+
+#include <ac/stdlib.h>
+#include <ac/string.h>
+#include <ac/signal.h>
#include "slurp.h"
#include "globals.h"
-/* External references */
-#ifdef NEEDPROTOS
-extern void write_reject( Ri *, Re *, int, char * );
-extern void do_nothing();
-#else /* NEEDPROTOS */
-extern void write_reject();
-extern void do_nothing();
-#endif /* NEEDPROTOS */
-
/* Forward references */
-#ifdef NEEDPROTOS
-static int ismine( Ri *, Re * );
-static int isnew( Ri *, Re * );
-void tsleep( time_t );
-#else /* NEEDPROTOS */
-static int ismine();
-static int isnew();
-void tsleep();
-#endif /* NEEDPROTOS */
+static int ismine LDAP_P(( Ri *, Re * ));
+static int isnew LDAP_P(( Ri *, Re * ));
/*
{
Rq *rq = sglob->rq;
Re *re, *new_re;
- int i;
int rc ;
char *errmsg;
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
+ (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
(void) SIGNAL( SIGPIPE, SIG_IGN );
if ( ri == NULL ) {
Debug( LDAP_DEBUG_ANY, "Error: Ri_process: ri == NULL!\n", 0, 0, 0 );
while ( !sglob->slurpd_shutdown &&
(( re = rq->rq_gethead( rq )) == NULL )) {
/* No work - wait on condition variable */
- pthread_cond_wait( &rq->rq_more, &rq->rq_mutex );
+ ldap_pvt_thread_cond_wait( &rq->rq_more, &rq->rq_mutex );
}
/*
rc = do_ldap( ri, re, &errmsg );
switch ( rc ) {
case DO_LDAP_ERR_RETRYABLE:
- tsleep( RETRY_SLEEP_TIME );
+ ldap_pvt_thread_sleep( RETRY_SLEEP_TIME );
Debug( LDAP_DEBUG_ANY,
"Retrying operation for DN %s on replica %s:%d\n",
re->re_dn, ri->ri_hostname, ri->ri_port );
continue;
break;
- case DO_LDAP_ERR_FATAL:
+ case DO_LDAP_ERR_FATAL: {
/* Non-retryable error. Write rejection log. */
- write_reject( ri, re, ri->ri_ldp->ld_errno, errmsg );
+ int ld_errno = 0;
+ ldap_get_option(ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &ld_errno);
+ write_reject( ri, re, ld_errno, errmsg );
/* Update status ... */
(void) sglob->st->st_update( sglob->st, ri->ri_stel, re );
/* ... and write to disk */
(void) sglob->st->st_write( sglob->st );
- break;
+ } break;
default:
/* LDAP op completed ok - update status... */
(void) sglob->st->st_update( sglob->st, ri->ri_stel, re );
while ( !sglob->slurpd_shutdown &&
((new_re = re->re_getnext( re )) == NULL )) {
if ( sglob->one_shot_mode ) {
+ rq->rq_unlock( rq );
return 0;
}
/* No work - wait on condition variable */
- pthread_cond_wait( &rq->rq_more, &rq->rq_mutex );
+ ldap_pvt_thread_cond_wait( &rq->rq_more, &rq->rq_mutex );
}
re->re_decrefcnt( re );
re = new_re;
/*
- * Wake a replication thread which may be sleeping. Send it a SIGUSR1.
+ * Wake a replication thread which may be sleeping.
+ * Send it a LDAP_SIGUSR1.
*/
static void
Ri_wake(
if ( ri == NULL ) {
return;
}
- pthread_kill( ri->ri_tid, SIGUSR1 );
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
+ ldap_pvt_thread_kill( ri->ri_tid, LDAP_SIGUSR1 );
}
sglob->st->st_unlock( sglob->st );
return ret;
}
-
-
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
*
*/
+#include "portable.h"
+
#include <stdio.h>
+#include <ac/stdlib.h>
+#include <ac/string.h>
+#include <ac/unistd.h> /* get ftruncate() */
+
#include "slurp.h"
#include "globals.h"
-/* externs */
-#ifdef NEEDPROTOS
-extern void Re_dump( Re *re );
-#else /* NEEDPROTOS */
-extern void Re_dump();
-#endif /* NEEDPROTOS */
-
-
-extern char *sys_errlist[];
-
-
/*
* Lock the replication queue.
*/
Rq *rq
)
{
- return( pthread_mutex_lock( &rq->rq_mutex ));
+ return( ldap_pvt_thread_mutex_lock( &rq->rq_mutex ));
}
-
-
-
/*
* Unlock the replication queue.
*/
Rq *rq
)
{
- return( pthread_mutex_unlock( &rq->rq_mutex ));
+ return( ldap_pvt_thread_mutex_unlock( &rq->rq_mutex ));
}
}
-
-
/*
* Return the next item in the queue. Callers should lock the queue before
* calling this routine.
}
-
-
/*
* Delete the item at the head of the list. The queue should be locked
* by the caller before calling this routine.
}
-
-
/*
* Add an entry to the tail of the replication queue. Locking is handled
* internally. When items are added to the queue, this routine wakes
/* Increment count of items in queue */
rq->rq_nre++;
/* wake up any threads waiting for more work */
- pthread_cond_broadcast( &rq->rq_more );
+ ldap_pvt_thread_cond_broadcast( &rq->rq_more );
/* ... and unlock the queue */
rq->rq_unlock( rq );
}
-
-
/*
* Garbage-collect the replication queue. Locking is handled internally.
*/
}
-
/*
* For debugging: dump the contents of the replication queue to a file.
* Locking is handled internally.
}
-
/*
* Write the contents of a replication queue to a file. Returns zero if
* successful, -1 if not. Handles queue locking internally. Callers should
}
-
-
/*
* Check to see if the private slurpd replication log needs trimming.
* The current criteria are:
)
{
int rc = 0;
- Re *re;
- int nzrc = 0; /* nzrc is count of entries with refcnt == 0 */
time_t now;
if ( rq == NULL ) {
}
-
-
/*
* Allocate and initialize an Rq object.
*/
(*rq)->rq_getcount = Rq_getcount;
/* Initialize private data */
- pthread_mutex_init( &((*rq)->rq_mutex), pthread_mutexattr_default );
- pthread_cond_init( &((*rq)->rq_more), pthread_condattr_default );
+ ldap_pvt_thread_mutex_init( &((*rq)->rq_mutex) );
+ ldap_pvt_thread_cond_init( &((*rq)->rq_more) );
(*rq)->rq_head = NULL;
(*rq)->rq_tail = NULL;
(*rq)->rq_nre = 0;
return 0;
}
-
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* feedback to the users.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
+
+#include <ac/unistd.h>
+#include <ac/string.h>
#include "slurp.h"
#include "globals.h"
-#include "portable.h"
#define FC_DIRBAD 1
#define FC_DIRUNREAD 2
/*
* Forward declarations
*/
-#ifdef NEEDPROTOS
-static unsigned int filecheck( char * );
-#else /* NEEDPROTOS */
-static unsigned int filecheck();
-#endif /* NEEDPROTOS */
+static unsigned int filecheck LDAP_P(( char * ));
*/
int
-sanity()
+sanity( void )
{
int err = 0;
int rc;
return ret;
}
-
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
+/* $OpenLDAP$ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
* writing status information to disk.
*/
-
+#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
+
+#include <ac/stdlib.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
#include "slurp.h"
#include "globals.h"
-#ifndef SYSERRLIST_IN_STDIO
-extern char *sys_errlist[];
-#endif /* SYSERRLIST_IN_STDIO */
-
/*
* Add information about replica host specified by Ri to list
* of hosts.
}
/* Serialize access to the St struct */
- pthread_mutex_lock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_lock( &(st->st_mutex ));
st->st_nreplicas++;
ind = st->st_nreplicas - 1;
st->st_data = ( Stel ** ) ch_realloc( st->st_data,
( st->st_nreplicas * sizeof( Stel * )));
if ( st->st_data == NULL ) {
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return NULL;
}
- st->st_data[ ind ] = ( Stel * ) ch_malloc( st->st_data,
- sizeof( Stel ));
+ st->st_data[ ind ] = ( Stel * ) ch_malloc( sizeof( Stel ) );
if ( st->st_data[ ind ] == NULL ) {
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return NULL;
}
memset( st->st_data[ ind ]->last, 0, sizeof( st->st_data[ ind ]->last ));
st->st_data[ ind ]->seq = 0;
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return st->st_data[ ind ];
}
if ( st == NULL ) {
return -1;
}
- pthread_mutex_lock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_lock( &(st->st_mutex ));
if ( st->st_fp == NULL ) {
/* Open file */
if (( rc = acquire_lock( sglob->slurpd_status_file, &(st->st_fp),
"Error: cannot open status file \"%s\": %s\n",
sglob->slurpd_status_file, sys_errlist[ errno ], 0 );
st->st_err_logged = 1;
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return -1;
}
} else {
}
fflush( st->st_fp );
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return 0;
}
return -1;
}
- pthread_mutex_lock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_lock( &(st->st_mutex ));
strcpy( stel->last, re->re_timestamp );
stel->seq = re->re_seq;
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return 0;
}
if ( st == NULL ) {
return -1;
}
- pthread_mutex_lock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_lock( &(st->st_mutex ));
if ( access( sglob->slurpd_status_file, F_OK ) < 0 ) {
/*
* File doesn't exist, so create it and return.
if (( fp = fopen( sglob->slurpd_status_file, "w" )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "Error: cannot create status file \"%s\"\n",
sglob->slurpd_status_file, 0, 0 );
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return -1;
}
(void) fclose( fp );
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
Debug( LDAP_DEBUG_ARGS, "No status file found, defaulting values\n",
0, 0, 0 );
return 0;
}
if (( rc = acquire_lock( sglob->slurpd_status_file, &fp, &lfp)) < 0 ) {
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return 0;
}
while ( fgets( buf, sizeof( buf ), fp ) != NULL ) {
}
}
(void) relinquish_lock( sglob->slurpd_status_file, fp, lfp);
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return 0;
bad:
(void) relinquish_lock( sglob->slurpd_status_file, fp, lfp);
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return -1;
}
St *st
)
{
- return( pthread_mutex_lock( &st->st_mutex ));
+ return( ldap_pvt_thread_mutex_lock( &st->st_mutex ));
}
St *st
)
{
- return( pthread_mutex_unlock( &st->st_mutex ));
+ return( ldap_pvt_thread_mutex_unlock( &st->st_mutex ));
}
return -1;
}
- pthread_mutex_init( &((*st)->st_mutex), pthread_mutexattr_default );
+ ldap_pvt_thread_mutex_init( &((*st)->st_mutex) );
(*st)->st_data = NULL;
(*st)->st_fp = NULL;
(*st)->st_lfp = NULL;
+# $OpenLDAP$
## Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
##
dn: ou=Alumni Association, ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Alumni Association
dn: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=Univer
dn: ou=Groups, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Groups
dn: ou=Information Technology Division, ou=People, o=University of Michigan, c
=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Information Technology Divisio
dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
dn: cn=Manager, o=University of Michigan, c=US
objectclass: top
objectclass: person
-objectclass: quipuObject
objectclass: kerberosSecurityObject
cn: Manager
cn: Directory Manager
dn: ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: People
dn: o=University of Michigan, c=US
objectclass: top
objectclass: organization
objectclass: domainRelatedObject
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
l: Ann Arbor, Michigan
st: Michigan
streetaddress: 535 West William St.
dn: ou=Alumni Association, ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Alumni Association
dn: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=Univer
dn: ou=Groups, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Groups
dn: ou=Information Technology Division, ou=People, o=University of Michigan, c
=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Information Technology Divisio
dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
dn: cn=Manager, o=University of Michigan, c=US
objectclass: top
objectclass: person
-objectclass: quipuObject
objectclass: kerberosSecurityObject
cn: Manager
cn: Directory Manager
dn: ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: People
dn: o=University of Michigan, c=US
objectclass: top
objectclass: organization
objectclass: domainRelatedObject
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
l: Ann Arbor, Michigan
st: Michigan
streetaddress: 535 West William St.
dn: ou=Alumni Association, ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Alumni Association
dn: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=Univer
dn: ou=Groups, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Groups
dn: ou=Information Technology Division, ou=People, o=University of Michigan, c
=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Information Technology Divisio
dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
dn: cn=Manager, o=University of Michigan, c=US
objectclass: top
objectclass: person
-objectclass: quipuObject
objectclass: kerberosSecurityObject
cn: Manager
cn: Directory Manager
dn: ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: People
dn: o=University of Michigan, c=US
objectclass: top
objectclass: organization
objectclass: domainRelatedObject
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
l: Ann Arbor, Michigan
st: Michigan
streetaddress: 535 West William St.
dn: ou=Alumni Association, ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Alumni Association
dn: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=Univer
dn: ou=Groups, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Groups
dn: ou=Information Technology Division, ou=People, o=University of Michigan, c
=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Information Technology Divisio
dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
dn: cn=Manager, o=University of Michigan, c=US
objectclass: top
objectclass: person
-objectclass: quipuObject
objectclass: kerberosSecurityObject
cn: Manager
cn: Directory Manager
dn: ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: People
dn: o=University of Michigan, c=US
objectclass: top
objectclass: organization
objectclass: domainRelatedObject
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
l: Ann Arbor, Michigan
st: Michigan
streetaddress: 535 West William St.
dn: ou=Alumni Association, ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Alumni Association
dn: ou=Groups, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Groups
dn: ou=Information Technology Division, ou=People, o=University of Michigan, c
=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Information Technology Divisio
dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
dn: ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: People
dn: o=University of Michigan, c=US
objectclass: top
objectclass: organization
objectclass: domainRelatedObject
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
l: Ann Arbor, Michigan
st: Michigan
streetaddress: 535 West William St.
+# $OpenLDAP$
#
# master slapd config -- for testing
#
include ./data/slapd.at.conf
include ./data/slapd.oc.conf
schemacheck off
+pidfile ./test-db/slapd.pid
+argsfile ./test-db/slapd.args
#######################################################################
# ldbm database definitions
#######################################################################
database ldbm
+cachesize 0
suffix "o=University of Michigan, c=US"
directory ./test-db
rootdn "cn=Manager, o=University of Michigan, c=US"
index default none
lastmod on
defaultaccess none
+
+#
+# normal installations should protect root dse,
+# cn=monitor, cn=schema, and cn=config
+#
+
access to attr=objectclass
by * read
-access to attr=userpassword
+
+access to filter="objectclass=person" attr=userpassword
by self write
- by * compare
-access to dn=".*,ou=Alumni Association,ou=People,o=University of Michigan,c=US"
- by dn=".*,o=University of Michigan,c=US"
- read
+ by anonymous auth
by * none
+
+access to dn="^.*,ou=Alumni Association,ou=People,o=University of Michigan,c=US$"
+ by dn="^.*,o=University of Michigan,c=US$" read
+ by anonymous auth
+ by * none
+
access to attr=member
by dnattr=member selfwrite
by * read
+
access to filter="objectclass=rfc822mailgroup"
by dn="Bjorn Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US" write
by * read
+
access to * by * read
--- /dev/null
+# $OpenLDAP$
+#
+# master slapd config -- for testing
+#
+include ./data/slapd.at.conf
+include ./data/slapd.oc.conf
+schemacheck off
+pidfile ./test-db/slapd.pid
+argsfile ./test-db/slapd.args
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+backend bdb2
+home ./test-db
+
+database bdb2
+cachesize 0
+suffix "o=University of Michigan, c=US"
+directory ./test-db
+rootdn "cn=Manager, o=University of Michigan, c=US"
+rootpw secret
+index cn,sn,uid pres,eq,approx
+index default none
+lastmod on
+defaultaccess none
+
+access to attr=objectclass
+ by * read
+
+access to filter="objectclass=person" attr=userpassword
+ by self write
+ by anonymous auth
+ by * none
+
+access to dn=".*,ou=Alumni Association,ou=People,o=University of Michigan,c=US"
+ by dn=".*,o=University of Michigan,c=US" read
+ by anonymous auth
+ by * none
+
+access to attr=member
+ by dnattr=member selfwrite
+ by * read
+
+access to filter="objectclass=rfc822mailgroup"
+ by dn="Bjorn Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US" write
+ by * read
+
+access to * by * read
--- /dev/null
+# $OpenLDAP$
+#
+# master slapd config -- for testing
+#
+include ./data/slapd.at.conf
+include ./data/slapd.oc.conf
+schemacheck on
+pidfile ./test-db/slapd.pid
+argsfile ./test-db/slapd.args
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+backend bdb2
+home ./test-db
+mpoolsize 21000000
+
+database bdb2
+suffix "o=University of Michigan, c=US"
+directory ./test-db
+rootdn "cn=Manager, o=University of Michigan, c=US"
+rootpw secret
+index cn,sn,uid pres,eq,approx
+index default none
+lastmod on
--- /dev/null
+# $OpenLDAP$
+#
+# master slapd config -- for testing
+#
+include ../servers/slapd/schema/others_nis.at.conf
+include ../servers/slapd/schema/others_nis.oc.conf
+include ../servers/slapd/schema/nis.at.conf
+include ../servers/slapd/schema/nis.oc.conf
+include ../servers/slapd/schema/internet_mail.at.conf
+include ../servers/slapd/schema/internet_mail.oc.conf
+schemacheck on
+pidfile ./test-db/slapd.pid
+argsfile ./test-db/slapd.args
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+backend bdb2
+home ./test-db
+mpoolsize 21000000
+
+database bdb2
+cachesize 4
+suffix "o=SGI, c=US"
+directory ./test-db
+rootdn "cn=Manager, o=SGI, c=US"
+rootpw secret
+index uid pres,eq,approx
+index gidNumber pres,eq,approx
+index uidNumber pres,eq,approx
+index cn pres,eq,approx
+index memberUid pres,eq,approx
+index macAddress pres,eq,approx
+index ipServiceProtocol pres,eq,approx
+index ipServicePort pres,eq,approx
+index oncRpcNumber pres,eq,approx
+index ipHostNumber pres,eq,approx
+index ipNetworkNumber pres,eq,approx
+index ipProtocolNumber pres,eq,approx
+index default none
+lastmod on
--- /dev/null
+# $OpenLDAP$
+#
+# slave slapd config -- for default referral testing
+#
+include ./data/slapd.at.conf
+include ./data/slapd.oc.conf
+schemacheck off
+pidfile ./test-repl/slapd.pid
+argsfile ./test-repl/slapd.args
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+referral "ldap://localhost:9009/"
+
+backend bdb2
+home ./test-db
+
+database bdb2
+cachesize 0
+suffix "o=University of Mich, c=US"
+directory ./test-repl
+rootdn "cn=Manager, o=University of Mich, c=US"
+rootpw secret
+index cn,sn,uid pres,eq,approx
+index default none
+# index default pres,eq,approx
+lastmod on
--- /dev/null
+# $OpenLDAP$
+#
+# master slapd config -- for testing of replication
+#
+include ./data/slapd.at.conf
+include ./data/slapd.oc.conf
+schemacheck off
+pidfile ./test-db/slapd.pid
+argsfile ./test-db/slapd.args
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+backend bdb2
+home ./test-db
+
+database bdb2
+cachesize 0
+suffix "o=University of Michigan, c=US"
+directory ./test-db
+rootdn "cn=Manager, o=University of Michigan, c=US"
+rootpw secret
+index cn,sn,uid pres,eq,approx
+index default none
+# index default pres,eq,approx
+lastmod on
+
+replogfile ./test-db/slapd.replog
+
+replica host=localhost:9010
+ binddn="cn=Replica, o=University of Michigan, c=US"
+ bindmethod=simple
+ credentials=secret
--- /dev/null
+# $OpenLDAP$
+#
+# master slapd config -- for testing of replication
+#
+include ./data/slapd.at.conf
+include ./data/slapd.oc.conf
+schemacheck off
+pidfile ./test-repl/slapd.pid
+argsfile ./test-repl/slapd.args
+
+referral "ldap://localhost:9009/"
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+backend bdb2
+home ./test-repl
+
+database bdb2
+cachesize 0
+suffix "o=University of Michigan, c=US"
+directory ./test-repl
+rootdn "cn=Replica, o=University of Michigan, c=US"
+rootpw secret
+updatedn "cn=Replica, o=University of Michigan, c=US"
+updateref "ldap://localhost:9009/o=University%20of%20Michigan,c=US"
+index cn,sn,uid pres,eq,approx
+index default none
+# index default pres,eq,approx
+lastmod on
+dbcachenowsync
+# $OpenLDAP$
#
# master slapd config -- for testing
#
include ./data/slapd.at.conf
include ./data/slapd.oc.conf
-schemacheck off
+schemacheck on
+pidfile ./test-db/slapd.pid
+argsfile ./test-db/slapd.args
#######################################################################
# ldbm database definitions
index cn,sn,uid pres,eq,approx
index default none
lastmod on
+dbcachenowsync
--- /dev/null
+# $OpenLDAP$
+#
+# master slapd config -- for testing
+#
+include ../servers/slapd/schema/others_nis.at.conf
+include ../servers/slapd/schema/others_nis.oc.conf
+include ../servers/slapd/schema/nis.at.conf
+include ../servers/slapd/schema/nis.oc.conf
+include ../servers/slapd/schema/internet_mail.at.conf
+include ../servers/slapd/schema/internet_mail.oc.conf
+schemacheck on
+pidfile ./test-db/slapd.pid
+argsfile ./test-db/slapd.args
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+database ldbm
+cachesize 4
+suffix "o=SGI, c=US"
+directory ./test-db
+rootdn "cn=Manager, o=SGI, c=US"
+rootpw secret
+index uid pres,eq,approx
+index gidNumber pres,eq,approx
+index uidNumber pres,eq,approx
+index cn pres,eq,approx
+index memberUid pres,eq,approx
+index macAddress pres,eq,approx
+index ipServiceProtocol pres,eq,approx
+index ipServicePort pres,eq,approx
+index oncRpcNumber pres,eq,approx
+index ipHostNumber pres,eq,approx
+index ipNetworkNumber pres,eq,approx
+index ipProtocolNumber pres,eq,approx
+index default none
+lastmod on
--- /dev/null
+# $OpenLDAP$
+#
+# master slapd config -- for testing
+#
+include ./data/slapd.at.conf
+include ./data/slapd.oc.conf
+schemacheck on
+pidfile ./test-db/slapd.pid
+argsfile ./test-db/slapd.args
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+database passwd
+suffix "o=University of Michigan, c=US"
+rootdn "cn=Manager, o=University of Michigan, c=US"
+rootpw secret
+#file ./data/passwd
--- /dev/null
+# $OpenLDAP$
+#
+# slave slapd config -- for default referral testing
+#
+include ./data/slapd.at.conf
+include ./data/slapd.oc.conf
+schemacheck off
+pidfile ./test-repl/slapd.pid
+argsfile ./test-repl/slapd.args
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+referral "ldap://localhost:9009/"
+
+database ldbm
+cachesize 0
+suffix "o=University of Mich, c=US"
+directory ./test-repl
+rootdn "cn=Manager, o=University of Mich, c=US"
+rootpw secret
+index cn,sn,uid pres,eq,approx
+index default none
+# index default pres,eq,approx
+lastmod on
+# $OpenLDAP$
#
# master slapd config -- for testing of replication
#
include ./data/slapd.at.conf
include ./data/slapd.oc.conf
schemacheck off
+pidfile ./test-db/slapd.pid
+argsfile ./test-db/slapd.args
#######################################################################
# ldbm database definitions
#######################################################################
database ldbm
+cachesize 0
suffix "o=University of Michigan, c=US"
directory ./test-db
rootdn "cn=Manager, o=University of Michigan, c=US"
rootpw secret
index cn,sn,uid pres,eq,approx
index default none
+# index default pres,eq,approx
lastmod on
replogfile ./test-db/slapd.replog
replica host=localhost:9010
- binddn="cn=Manager, o=University of Michigan, c=US"
+ binddn="cn=Replica, o=University of Michigan, c=US"
bindmethod=simple
credentials=secret
+# $OpenLDAP$
#
# master slapd config -- for testing of replication
#
include ./data/slapd.at.conf
include ./data/slapd.oc.conf
schemacheck off
+pidfile ./test-repl/slapd.pid
+argsfile ./test-repl/slapd.args
+
+referral "ldap://localhost:9009/"
#######################################################################
# ldbm database definitions
#######################################################################
database ldbm
+cachesize 0
suffix "o=University of Michigan, c=US"
directory ./test-repl
-rootdn "cn=Manager, o=University of Michigan, c=US"
+rootdn "cn=Replica, o=University of Michigan, c=US"
rootpw secret
-updatedn "cn=Manager, o=University of Michigan, c=US"
+updatedn "cn=Replica, o=University of Michigan, c=US"
+updateref "ldap://localhost:9009/o=University%20of%20Michigan,c=US"
index cn,sn,uid pres,eq,approx
index default none
+# index default pres,eq,approx
lastmod on
+# $OpenLDAP$
attribute photo bin
attribute personalsignature bin
attribute jpegphoto bin
attribute audio bin
attribute labeledurl ces
+attribute ref ces
attribute userpassword ces
attribute telephonenumber tel
attribute facsimiletelephonenumber fax tel
+# $OpenLDAP$
+
objectclass top
requires
objectClass
aliasedObjectName,
objectClass
+objectclass referral
+ requires
+ ref,
+ objectClass
+
objectclass country
requires
objectClass,
objectclass person
requires
objectClass,
- sn,
cn
allows
description,
seeAlso,
+ sn,
telephoneNumber,
userPassword
objectclass organizationalPerson
requires
objectClass,
- sn,
cn
allows
description,
preferredDeliveryMethod,
registeredAddress,
seeAlso,
+ sn,
st,
streetAddress,
telephoneNumber,
objectclass residentialPerson
requires
objectClass,
- sn,
cn,
l
allows
preferredDeliveryMethod,
registeredAddress,
seeAlso,
+ sn,
st,
streetAddress,
telephoneNumber,
objectclass newPilotPerson
requires
objectClass,
- sn,
cn
allows
businessCategory,
homePhone,
homePostalAddress,
janetMailbox,
+ lastModifiedBy,
+ lastModifiedTime,
mail,
mailPreferenceOption,
mobile,
roomNumber,
secretary,
seeAlso,
+ sn,
telephoneNumber,
textEncodedORaddress,
uid,
objectclass umichPerson
requires
objectClass,
- sn,
- cn,
- universityID
+ cn
allows
affiliationCode,
audio,
roomNumber,
secretary,
seeAlso,
+ sn,
st,
streetAddress,
telephoneNumber,
textEncodedORaddress,
title,
uid,
+ universityID,
updateSource,
userCertificate,
userClass,
objectclass: top
objectclass: organization
objectclass: domainRelatedObject
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
l: Ann Arbor, Michigan
st: Michigan
streetaddress: 535 West William St.
dn: ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: People
dn: ou=Groups, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Groups
dn: ou=Alumni Association, ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Alumni Association
dn: ou=Information Technology Division, ou=People, o=University of Michigan, c
=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Information Technology Divisio
dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
dn: cn=Manager, o=University of Michigan, c=US
objectclass: top
objectclass: person
-objectclass: quipuObject
objectclass: kerberosSecurityObject
cn: Manager
cn: Directory Manager
dn: ou=Alumni Association, ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Alumni Association
dn: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=Univer
dn: ou=Groups, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Groups
dn: ou=Information Technology Division, ou=People, o=University of Michigan, c
=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: Information Technology Divisio
dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
dn: cn=Manager, o=University of Michigan, c=US
objectclass: top
objectclass: person
-objectclass: quipuObject
objectclass: kerberosSecurityObject
cn: Manager
cn: Directory Manager
dn: ou=People, o=University of Michigan, c=US
objectclass: top
objectclass: organizationalUnit
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
ou: People
dn: o=University of Michigan, c=US
objectclass: top
objectclass: organization
objectclass: domainRelatedObject
-objectclass: quipuObject
-objectclass: quipuNonLeafObject
l: Ann Arbor, Michigan
st: Michigan
streetaddress: 535 West William St.
-## Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
+# $OpenLDAP$
+## Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
##
## tests Makefile.in for OpenLDAP
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
#include "portable.h"
#include <stdio.h>
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
#include "portable.h"
#include <stdio.h>
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
#include "portable.h"
#include <stdio.h>
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
#include "portable.h"
#include <stdio.h>
--- /dev/null
+#! /bin/sh
+# $OpenLDAP$
+#
+# Strip operational attributes
+#
+egrep -iv '^modifiersname:|^modifytimestamp:|^creatorsname:|^createtimestamp'
#! /bin/sh
+# $OpenLDAP$
# disable LDAP initialization
LDAPNOINIT=true; export LDAPNOINIT
+#! /bin/sh
+# $OpenLDAP$
DATADIR=$SRCDIR/data
PROGDIR=./progs
MASTEROUT=$DBDIR/master.out
SLAVEOUT=$DBDIR/slave.out
TESTOUT=$DBDIR/test.out
+INITOUT=$DBDIR/init.out
SEARCHOUTMASTER=$DATADIR/search.out.master
MODIFYOUTMASTER=$DATADIR/modify.out.master
ADDDELOUTMASTER=$DATADIR/adddel.out.master
#! /bin/sh
+# $OpenLDAP$
. scripts/defines.sh
rm -f $DBDIR/[!C]*
-echo "Running ldif2ldbm to build slapd database..."
-$LDIF2LDBM -f $CONF -l $LDIF
+echo "Running slapadd to build slapd database..."
+$slapadd -f $CONF -l $LDIF
RC=$?
if test $RC != 0 ; then
- echo "ldif2ldbm failed!"
+ echo "slapadd failed!"
exit $RC
fi
--- /dev/null
+#! /bin/sh
+# $OpenLDAP$
+
+if test $# -eq 0 ; then
+ SRCDIR="."
+else
+ SRCDIR=$1; shift
+fi
+if test $# -eq 1 ; then
+ BACKEND=$1; shift
+fi
+
+echo "running defines.sh $SRCDIR $BACKEND"
+. $SRCDIR/scripts/defines.sh
+
+echo "Cleaning up in $DBDIR..."
+
+rm -f $DBDIR/[!C]*
+
+echo "Starting slapd on TCP/IP port $PORT..."
+$SLAPD -f $PASSWDCONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
+PID=$!
+
+echo "Testing slapd searching..."
+for i in 0 1 2 3 4 5; do
+ $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $PORT \
+ 'objectclass=*' > /dev/null 2>&1
+ RC=$?
+ if test $RC = 1 ; then
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+ fi
+done
+
+if test $RC != 0 ; then
+ echo "ldapsearch failed!"
+ kill -HUP $PID
+ exit $RC
+fi
+
+cat /dev/null > $TESTOUT
+
+echo "Testing base suffix searching..."
+$LDAPSEARCH -L -S "" -b "$BASEDN" -s base -h localhost -p $PORT \
+ '(objectclass=*)' >> $TESTOUT 2>&1
+if test $RC != 0 ; then
+ echo "ldapsearch failed!"
+ kill -HUP $PID
+ exit $RC
+fi
+
+echo " ------------ " >> $TESTOUT
+
+echo "Testing user searching..."
+$LDAPSEARCH -L -S "" -b "uid=root,$BASEDN" -s base -h localhost -p $PORT \
+ '(objectclass=*)' >> $TESTOUT 2>&1
+if test $RC != 0 ; then
+ echo "ldapsearch failed!"
+ kill -HUP $PID
+ exit $RC
+fi
+
+echo " ------------ " >> $TESTOUT
+
+echo "Testing exact searching..."
+$LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
+ '(uid=root)' >> $TESTOUT 2>&1
+if test $RC != 0 ; then
+ echo "ldapsearch failed!"
+ kill -HUP $PID
+ exit $RC
+fi
+
+echo " ------------ " >> $TESTOUT
+
+echo "Testing OR searching..."
+$LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
+ '(|(objectclass=person)(cn=root))' >> $TESTOUT 2>&1
+if test $RC != 0 ; then
+ echo "ldapsearch failed!"
+ kill -HUP $PID
+ exit $RC
+fi
+
+echo " ------------ " >> $TESTOUT
+
+echo "Testing AND searching..."
+$LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
+ '(&(objectclass=person)(cn=root))' >> $TESTOUT 2>&1
+if test $RC != 0 ; then
+ echo "ldapsearch failed!"
+ kill -HUP $PID
+ exit $RC
+fi
+
+kill -HUP $PID
+
+echo "Assuming everything is fine."
+#echo "Comparing results"
+#cmp $TESTOUT $SEARCHOUTMASTER
+#if test $? != 0 ; then
+# echo "Comparison failed"
+# exit 1
+#fi
+
+echo ">>>>> Test succeeded"
+
+
+exit 0
-#!/bin/sh
-
+#! /bin/sh
+# $OpenLDAP$
if [ $# -eq 0 ]; then
SRCDIR="."
rm -f $DBDIR/[!C]*
-echo "Running ldif2ldbm to build slapd database..."
+echo "Running slapadd to build slapd database..."
$LDIF2LDBM -f $NIS_CONF -l $NIS_LDIF
RC=$?
if [ $RC != 0 ]; then
- echo "ldif2ldbm failed!"
+ echo "slapadd failed!"
exit $RC
fi
+++ /dev/null
-#! /bin/sh
-
-if test $# -eq 0 ; then
- SRCDIR="."
-else
- SRCDIR=$1; shift
-fi
-if test $# -eq 1 ; then
- BACKEND=$1; shift
-fi
-
-echo "running defines.sh $SRCDIR $BACKEND"
-
-. $SRCDIR/scripts/defines.sh
-
-echo "Datadir is $DATADIR"
-
-echo "Cleaning up in $DBDIR..."
-
-rm -f $DBDIR/[!C]*
-
-echo "Running ldif2ldbm to build slapd database..."
-$LDIF2LDBM -f $CONF -l $LDIF
-RC=$?
-if test $RC != 0 ; then
- echo "ldif2ldbm failed!"
- exit $RC
-fi
-
-echo "Starting slapd on TCP/IP port $PORT..."
-$SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
-PID=$!
-
-echo "Using ldapsearch to retrieve all the entries..."
-for i in 0 1 2 3 4 5; do
- $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
- 'objectClass=*' > $SEARCHOUT 2>&1
- RC=$?
- if test $RC = 1 ; then
- echo "Waiting 5 seconds for slapd to start..."
- sleep 5
- fi
-done
-
-kill -HUP $PID
-
-if test $RC != 0 ; then
- echo "ldapsearch failed!"
- exit $RC
-fi
-
-echo "Filtering ldapsearch results..."
-. $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
-echo "Filtering original ldif used to create database..."
-. $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
-echo "Comparing filter output..."
-cmp $SEARCHFLT $LDIFFLT
-
-if test $? != 0 ; then
- echo "comparison failed - database was not created correctly"
- exit 1
-fi
-
-echo ">>>>> Test succeeded"
-
-
-exit 0
#! /bin/sh
+# $OpenLDAP$
if test $# -eq 0 ; then
SRCDIR="."
#! /bin/sh
+# $OpenLDAP$
if test $# -eq 0 ; then
SRCDIR="."
rm -f $DBDIR/[!C]*
-echo "Running ldif2ldbm to build slapd database..."
+echo "Running slapadd to build slapd database..."
$LDIF2LDBM -f $CONF -l $LDIF
RC=$?
if test $RC != 0 ; then
- echo "ldif2ldbm failed!"
+ echo "slapadd failed!"
exit $RC
fi
#! /bin/sh
+# $OpenLDAP$
if test $# -eq 0 ; then
SRCDIR="."
rm -f $DBDIR/[!C]*
-echo "Running ldif2ldbm to build slapd database..."
+echo "Running slapadd to build slapd database..."
$LDIF2LDBM -f $CONF -l $LDIF
RC=$?
if test $RC != 0 ; then
- echo "ldif2ldbm failed!"
+ echo "slapadd failed!"
exit $RC
fi
#! /bin/sh
+# $OpenLDAP$
if test $# -eq 0 ; then
SRCDIR="."
rm -f $DBDIR/[!C]*
-echo "Running ldif2ldbm to build slapd database..."
+echo "Running slapadd to build slapd database..."
$LDIF2LDBM -f $CONF -l $LDIF
RC=$?
if test $RC != 0 ; then
- echo "ldif2ldbm failed!"
+ echo "slapadd failed!"
exit $RC
fi
# Make sure we can search the database
for i in 0 1 2 3 4 5; do
- $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
- 'objectclass=*' > /dev/null 2>&1
+ $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
+ 'objectClass=*' > $INITOUT 2>&1
RC=$?
if test $RC = 1 ; then
echo "Waiting 5 seconds for slapd to start..."
echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones III)..."
$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
- 'cn=James A Jones III' | egrep -iv '^createtimestamp:|^modifytimestamp:' \
- > $SEARCHOUT 2>&1
+ 'cn=James A Jones III' > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed!"
echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones II)..."
$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
- 'cn=James A Jones II' | egrep -iv '^createtimestamp:|^modifytimestamp:' \
- > $SEARCHOUT 2>&1
+ 'cn=James A Jones II' > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed!"
echo "Using ldapsearch to retrieve entries using removed rdn (cn=James A Jones 2)..."
$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
- 'cn=James A Jones 2' | egrep -iv '^createtimestamp:|^modifytimestamp:' \
- > /dev/null 2>&1
+ 'cn=James A Jones 2' > $SEARCHOUT 2>&1
RC=$?
-if test $RC = 0 ; then
- echo "failure: ldapsearch found attribute that was to be removed!"
+if test $RC != 0 ; then
kill -HUP $PID
+ echo "ldapsearch failed!"
exit $RC
fi
+cmp $SEARCHOUT /dev/null
+if test $? != 0 ; then
+ echo "failure: ldapsearch found attribute that was to be removed!"
+ kill -HUP $PID
+ exit 1
+fi
echo "Using ldapsearch to retrieve all the entries..."
$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones 1)..."
$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
- 'cn=James A Jones 1' | egrep -iv '^createtimestamp:|^modifytimestamp:' \
- > $SEARCHOUT 2>&1
+ 'cn=James A Jones 1' > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed!"
#! /bin/sh
+# $OpenLDAP$
if test $# -eq 0 ; then
SRCDIR="."
rm -f $DBDIR/[!C]*
-echo "Running ldif2ldbm to build slapd database..."
+echo "Running slapadd to build slapd database..."
$LDIF2LDBM -f $CONF -l $LDIF
RC=$?
if test $RC != 0 ; then
- echo "ldif2ldbm failed!"
+ echo "slapadd failed!"
exit $RC
fi
#! /bin/sh
+# $OpenLDAP$
#
# Test replication:
#! /bin/sh
+# $OpenLDAP$
if test $# -eq 0 ; then
SRCDIR="."
rm -f $DBDIR/[!C]*
-echo "Running ldif2ldbm to build slapd database..."
+echo "Running slapadd to build slapd database..."
$LDIF2LDBM -f $CONF -l $LDIF
RC=$?
if test $RC != 0 ; then
- echo "ldif2ldbm failed!"
+ echo "slapadd failed!"
exit $RC
fi
-echo "Waiting 5 seconds for ldif2ldbm to build slapd database..."
+echo "Waiting 5 seconds for slapadd to build slapd database..."
sleep 5
echo "Starting slapd on TCP/IP port $PORT..."
#! /bin/sh
+# $OpenLDAP$
#
# Test default referral
rm -f $DBDIR/[!C]*
rm -f $REPLDIR/[!C]*
-echo "Running ldif2ldbm to build slapd database..."
+echo "Running slapadd to build slapd database..."
$LDIF2LDBM -f $CONF -l $LDIF
RC=$?
if test $RC != 0 ; then
- echo "ldif2ldbm failed!"
+ echo "slapadd failed!"
exit $RC
fi