]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Happy (belated) new year
authorKurt Zeilenga <kurt@openldap.org>
Mon, 3 Mar 2003 18:10:01 +0000 (18:10 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 3 Mar 2003 18:10:01 +0000 (18:10 +0000)
356 files changed:
Makefile.in [new file with mode: 0644]
acconfig.h
acinclude.m4 [new file with mode: 0644]
aclocal.m4
build/build.mak [new file with mode: 0644]
build/dir.mk [new file with mode: 0644]
build/info.mk [new file with mode: 0644]
build/lib-shared.mk [new file with mode: 0644]
build/lib-static.mk [new file with mode: 0644]
build/lib.mk [new file with mode: 0644]
build/man.mk
build/mkdep
build/mkrelease
build/mod.mk [new file with mode: 0644]
build/rules.mk [new file with mode: 0644]
build/srv.mk [new file with mode: 0644]
clients/Makefile.in
contrib/ldapc++/COPYRIGHT [new file with mode: 0644]
contrib/ldapc++/src/ac/time.h [new file with mode: 0644]
doc/Makefile.in [new file with mode: 0644]
doc/man/Makefile.in [new file with mode: 0644]
doc/man/man1/Makefile.in [new file with mode: 0644]
doc/man/man1/ldapcompare.1
doc/man/man1/ldapdelete.1
doc/man/man1/ldapmodify.1
doc/man/man1/ldapmodrdn.1
doc/man/man1/ldappasswd.1
doc/man/man1/ldapsearch.1
doc/man/man1/ldapwhoami.1
doc/man/man3/Makefile.in [new file with mode: 0644]
doc/man/man3/lber-decode.3
doc/man/man3/lber-encode.3
doc/man/man3/lber-memory.3
doc/man/man3/lber-types.3
doc/man/man3/ldap.3
doc/man/man3/ldap_abandon.3
doc/man/man3/ldap_add.3
doc/man/man3/ldap_bind.3
doc/man/man3/ldap_cache.3
doc/man/man3/ldap_compare.3
doc/man/man3/ldap_delete.3
doc/man/man3/ldap_error.3
doc/man/man3/ldap_first_attribute.3
doc/man/man3/ldap_first_entry.3
doc/man/man3/ldap_first_message.3
doc/man/man3/ldap_first_reference.3
doc/man/man3/ldap_get_dn.3
doc/man/man3/ldap_get_values.3
doc/man/man3/ldap_modify.3
doc/man/man3/ldap_modrdn.3
doc/man/man3/ldap_open.3
doc/man/man3/ldap_parse_reference.3
doc/man/man3/ldap_parse_result.3
doc/man/man3/ldap_result.3
doc/man/man3/ldap_schema.3
doc/man/man3/ldap_search.3
doc/man/man3/ldap_sort.3
doc/man/man3/ldap_url.3
doc/man/man5/Makefile.in [new file with mode: 0644]
doc/man/man5/ldap.conf.5
doc/man/man5/ldif.5
doc/man/man5/slapd-bdb.5
doc/man/man5/slapd-dnssrv.5
doc/man/man5/slapd-ldap.5
doc/man/man5/slapd-ldbm.5
doc/man/man5/slapd-meta.5
doc/man/man5/slapd-passwd.5
doc/man/man5/slapd-shell.5
doc/man/man5/slapd.access.5
doc/man/man5/slapd.conf.5
doc/man/man5/slapd.replog.5
doc/man/man8/Makefile.in [new file with mode: 0644]
doc/man/man8/slapadd.8
doc/man/man8/slapcat.8
doc/man/man8/slapd.8
doc/man/man8/slapindex.8
doc/man/man8/slappasswd.8
doc/man/man8/slurpd.8
include/ac/alloca.h [new file with mode: 0644]
include/ac/crypt.h [new file with mode: 0644]
include/ac/ctype.h [new file with mode: 0644]
include/ac/dirent.h [new file with mode: 0644]
include/ac/errno.h [new file with mode: 0644]
include/ac/krb.h [new file with mode: 0644]
include/ac/krb5.h [new file with mode: 0644]
include/ac/param.h [new file with mode: 0644]
include/ac/regex.h [new file with mode: 0644]
include/ac/setproctitle.h [new file with mode: 0644]
include/ac/signal.h [new file with mode: 0644]
include/ac/stdarg.h [new file with mode: 0644]
include/ac/stdlib.h
include/ac/string.h
include/ac/sysexits.h [new file with mode: 0644]
include/ac/syslog.h [new file with mode: 0644]
include/ac/termios.h [new file with mode: 0644]
include/ac/time.h [new file with mode: 0644]
include/ac/unistd.h [new file with mode: 0644]
include/ac/wait.h [new file with mode: 0644]
include/avl.h
include/getopt-compat.h [new file with mode: 0644]
include/lber_pvt.h
include/lber_types.h.in [new file with mode: 0644]
include/lber_types.nt [new file with mode: 0644]
include/ldap_cdefs.h [new file with mode: 0644]
include/ldap_defaults.h
include/ldap_int_thread.h [new file with mode: 0644]
include/ldap_log.h
include/ldap_pvt.h
include/ldap_pvt_uc.h
include/ldap_queue.h
include/ldap_schema.h
include/ldap_utf8.h [new file with mode: 0644]
include/ldbm.h
include/ldif.h
include/lutil.h
include/lutil_hash.h [new file with mode: 0644]
include/lutil_ldap.h [new file with mode: 0644]
include/lutil_lockf.h [new file with mode: 0644]
include/lutil_md5.h [new file with mode: 0644]
include/lutil_sha1.h [new file with mode: 0644]
include/portable.h.in
include/setup.mak [new file with mode: 0644]
include/sysexits-compat.h
libraries/Makefile.in
libraries/liblber/Makefile.in
libraries/liblber/assert.c [new file with mode: 0644]
libraries/liblber/bprint.c
libraries/liblber/debug.c
libraries/liblber/decode.c
libraries/liblber/dtest.c
libraries/liblber/encode.c
libraries/liblber/etest.c
libraries/liblber/idtest.c
libraries/liblber/lber-int.h
libraries/liblber/memory.c
libraries/liblber/nt_err.c [new file with mode: 0644]
libraries/liblber/options.c [new file with mode: 0644]
libraries/liblber/sockbuf.c
libraries/liblber/stdio.c
libraries/libldap/abandon.c
libraries/libldap/add.c
libraries/libldap/addentry.c
libraries/libldap/apitest.c [new file with mode: 0644]
libraries/libldap/bind.c
libraries/libldap/charray.c
libraries/libldap/cyrus.c
libraries/libldap/delete.c
libraries/libldap/dnssrv.c
libraries/libldap/dntest.c
libraries/libldap/extended.c
libraries/libldap/filter.c
libraries/libldap/free.c
libraries/libldap/getattr.c
libraries/libldap/getdn.c
libraries/libldap/getentry.c
libraries/libldap/getvalues.c
libraries/libldap/init.c
libraries/libldap/ldap-int.h
libraries/libldap/messages.c
libraries/libldap/modify.c
libraries/libldap/modrdn.c
libraries/libldap/options.c
libraries/libldap/os-ip.c
libraries/libldap/print.c
libraries/libldap/references.c
libraries/libldap/request.c
libraries/libldap/sbind.c
libraries/libldap/schema.c
libraries/libldap/sort.c
libraries/libldap/sortctrl.c
libraries/libldap/string.c
libraries/libldap/t61.c [new file with mode: 0644]
libraries/libldap/url.c
libraries/libldap/utf-8-conv.c
libraries/libldap/utf-8.c
libraries/libldap/util-int.c
libraries/libldap/vlvctrl.c
libraries/libldap_r/thr_cthreads.c
libraries/libldap_r/thr_lwp.c
libraries/libldap_r/thr_nt.c
libraries/libldap_r/thr_posix.c
libraries/libldap_r/thr_pth.c
libraries/libldap_r/thr_stub.c
libraries/libldap_r/thr_thr.c
libraries/libldap_r/threads.c [new file with mode: 0644]
libraries/libldap_r/tpool.c
libraries/libldbm/Makefile.in [new file with mode: 0644]
libraries/libldbm/ldbm.c
libraries/libldif/Makefile.in [new file with mode: 0644]
libraries/libldif/fetch.c
libraries/libldif/line64.c
libraries/liblutil/Makefile.in
libraries/liblutil/base64.c [new file with mode: 0644]
libraries/liblutil/csn.c
libraries/liblutil/entropy.c
libraries/liblutil/getopt.c
libraries/liblutil/getpass.c [new file with mode: 0644]
libraries/liblutil/lockf.c [new file with mode: 0644]
libraries/liblutil/md5.c [new file with mode: 0644]
libraries/liblutil/ntservice.c
libraries/liblutil/passfile.c
libraries/liblutil/passwd.c
libraries/liblutil/ptest.c [new file with mode: 0644]
libraries/liblutil/sasl.c
libraries/liblutil/sha1.c
libraries/liblutil/signal.c [new file with mode: 0644]
libraries/liblutil/sockpair.c [new file with mode: 0644]
libraries/liblutil/utils.c
libraries/liblutil/uuid.c
libraries/librewrite/Makefile.in [new file with mode: 0644]
servers/Makefile.in [new file with mode: 0644]
servers/slapd/attr.c
servers/slapd/ava.c
servers/slapd/back-bdb/compare.c
servers/slapd/back-bdb/config.c
servers/slapd/back-bdb/dbcache.c
servers/slapd/back-bdb/dn2entry.c
servers/slapd/back-bdb/error.c
servers/slapd/back-bdb/extended.c
servers/slapd/back-bdb/idl.h
servers/slapd/back-bdb/key.c
servers/slapd/back-bdb/nextid.c
servers/slapd/back-bdb/referral.c
servers/slapd/back-bdb/tools.c
servers/slapd/back-dnssrv/bind.c
servers/slapd/back-dnssrv/compare.c [new file with mode: 0644]
servers/slapd/back-dnssrv/config.c
servers/slapd/back-dnssrv/init.c
servers/slapd/back-dnssrv/referral.c
servers/slapd/back-dnssrv/search.c
servers/slapd/back-ldap/Copyright [new file with mode: 0644]
servers/slapd/back-ldap/bind.c
servers/slapd/back-ldap/delete.c
servers/slapd/back-ldap/external.h [new file with mode: 0644]
servers/slapd/back-ldap/modrdn.c
servers/slapd/back-ldbm/add.c
servers/slapd/back-ldbm/alias.c [new file with mode: 0644]
servers/slapd/back-ldbm/attribute.c
servers/slapd/back-ldbm/back-ldbm.h
servers/slapd/back-ldbm/close.c
servers/slapd/back-ldbm/compare.c
servers/slapd/back-ldbm/config.c
servers/slapd/back-ldbm/delete.c
servers/slapd/back-ldbm/dn2id.c
servers/slapd/back-ldbm/entry.c [new file with mode: 0644]
servers/slapd/back-ldbm/extended.c
servers/slapd/back-ldbm/group.c
servers/slapd/back-ldbm/id2children.c
servers/slapd/back-ldbm/id2entry.c
servers/slapd/back-ldbm/key.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-ldbm/nextid.c
servers/slapd/back-ldbm/operational.c
servers/slapd/back-ldbm/passwd.c
servers/slapd/back-ldbm/referral.c
servers/slapd/back-ldbm/sasl.c [new file with mode: 0644]
servers/slapd/back-ldbm/tools.c
servers/slapd/back-meta/Copyright [new file with mode: 0644]
servers/slapd/back-meta/candidates.c
servers/slapd/back-meta/delete.c
servers/slapd/back-meta/dncache.c
servers/slapd/back-meta/external.h [new file with mode: 0644]
servers/slapd/back-meta/modrdn.c
servers/slapd/back-meta/unbind.c
servers/slapd/back-monitor/Copyright [new file with mode: 0644]
servers/slapd/back-monitor/back-monitor.h
servers/slapd/back-monitor/backend.c
servers/slapd/back-monitor/bind.c
servers/slapd/back-monitor/cache.c
servers/slapd/back-monitor/compare.c [new file with mode: 0644]
servers/slapd/back-monitor/conn.c
servers/slapd/back-monitor/entry.c [new file with mode: 0644]
servers/slapd/back-monitor/external.h
servers/slapd/back-monitor/init.c
servers/slapd/back-monitor/listener.c
servers/slapd/back-monitor/log.c
servers/slapd/back-monitor/modify.c
servers/slapd/back-monitor/operation.c
servers/slapd/back-monitor/operational.c [new file with mode: 0644]
servers/slapd/back-monitor/proto-back-monitor.h [new file with mode: 0644]
servers/slapd/back-monitor/rww.c [new file with mode: 0644]
servers/slapd/back-monitor/search.c
servers/slapd/back-monitor/sent.c
servers/slapd/back-monitor/thread.c
servers/slapd/back-monitor/time.c
servers/slapd/back-null/external.h
servers/slapd/back-null/null.c
servers/slapd/back-shell/Makefile.in
servers/slapd/back-shell/abandon.c
servers/slapd/back-shell/add.c
servers/slapd/back-shell/bind.c
servers/slapd/back-shell/compare.c
servers/slapd/back-shell/config.c
servers/slapd/back-shell/delete.c
servers/slapd/back-shell/external.h [new file with mode: 0644]
servers/slapd/back-shell/fork.c
servers/slapd/back-shell/init.c
servers/slapd/back-shell/modify.c
servers/slapd/back-shell/modrdn.c
servers/slapd/back-shell/result.c
servers/slapd/back-shell/search.c
servers/slapd/back-shell/searchexample.conf
servers/slapd/back-shell/searchexample.sh
servers/slapd/back-shell/shell.h
servers/slapd/back-shell/unbind.c
servers/slapd/cancel.c
servers/slapd/ch_malloc.c
servers/slapd/dn.c
servers/slapd/kerberos.c [new file with mode: 0644]
servers/slapd/lock.c
servers/slapd/mra.c
servers/slapd/nt_svc.c
servers/slapd/operational.c
servers/slapd/passwd.c
servers/slapd/phonetic.c
servers/slapd/referral.c
servers/slapd/repl.c
servers/slapd/schema.c
servers/slapd/schemaparse.c
servers/slapd/sets.c
servers/slapd/shell-backends/Makefile.in [new file with mode: 0644]
servers/slapd/starttls.c
servers/slapd/str2filter.c
servers/slapd/tools/slapadd.c
servers/slapd/tools/slapcat.c [new file with mode: 0644]
servers/slapd/tools/slapcommon.h [new file with mode: 0644]
servers/slapd/tools/slapindex.c [new file with mode: 0644]
servers/slapd/tools/slappasswd.c [new file with mode: 0644]
servers/slapd/unbind.c
servers/slapd/user.c
servers/slapd/value.c
servers/slurpd/admin.c
servers/slurpd/args.c
servers/slurpd/ch_malloc.c
servers/slurpd/config.c
servers/slurpd/fm.c
servers/slurpd/globals.c
servers/slurpd/globals.h
servers/slurpd/ldap_op.c
servers/slurpd/lock.c
servers/slurpd/main.c
servers/slurpd/proto-slurp.h
servers/slurpd/re.c
servers/slurpd/reject.c
servers/slurpd/replica.c
servers/slurpd/replog.c
servers/slurpd/ri.c
servers/slurpd/rq.c
servers/slurpd/sanity.c
servers/slurpd/slurp.h
servers/slurpd/st.c
tests/Makefile.in
tests/progs/slapd-addel.c
tests/progs/slapd-read.c
tests/progs/slapd-search.c
tests/progs/slapd-tester.c

diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..934c1be
--- /dev/null
@@ -0,0 +1,34 @@
+# $OpenLDAP$
+# Master Makefile for OpenLDAP
+##
+## Copyright 1998-2003 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=
+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
+
+check: test
+test: FORCE
+       cd tests; make test
index dd00c4506dde06bb01317bc643cf003f940ee824..a076b059c752155302b0c6b4094b34311651773c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..3a29222
--- /dev/null
@@ -0,0 +1,14 @@
+dnl
+dnl Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+dnl All rights reserved.
+dnl 
+dnl Redistribution and use in source and binary forms, with or without
+dnl modification, are permitted only as authorized by the OpenLDAP
+dnl Public License.  A copy of this license is available at
+dnl http://www.OpenLDAP.org/license.html or in file LICENSE in the
+dnl top-level directory of the distribution.
+dnl
+dnl OpenLDAP Autoconf Macros
+dnl
+divert(-1)
+builtin(include, build/openldap.m4)dnl
index 218c5c785338da0311f5d0782ef5ade28282e6bf..a0d401d96c895d20233730d003952ede622050c4 100644 (file)
@@ -11,7 +11,7 @@ dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 dnl PARTICULAR PURPOSE.
 
 dnl
-dnl Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+dnl Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
 dnl All rights reserved.
 dnl 
 dnl Redistribution and use in source and binary forms, with or without
diff --git a/build/build.mak b/build/build.mak
new file mode 100644 (file)
index 0000000..28101bb
--- /dev/null
@@ -0,0 +1,10 @@
+# $OpenLDAP$
+#
+# Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+#
+
+all: build.txt
+
+build.txt: version
+       copy version build.txt
diff --git a/build/dir.mk b/build/dir.mk
new file mode 100644 (file)
index 0000000..b392ebc
--- /dev/null
@@ -0,0 +1,56 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
+## of this package for details.
+##---------------------------------------------------------------------------
+##
+## Makes subdirectories
+##
+
+
+all-common: FORCE
+       @echo "Making all in `$(PWD)`"
+       @for i in $(SUBDIRS) $(ALLDIRS); do             \
+               echo "  Entering subdirectory $$i";             \
+               ( cd $$i; $(MAKE) $(MFLAGS) all );              \
+               if test $$? != 0 ; then exit 1; fi ;    \
+               echo " ";                                                               \
+       done
+
+install-common: FORCE
+       @echo "Making install in `$(PWD)`"
+       @for i in $(SUBDIRS) $(INSTALLDIRS); do         \
+               echo "  Entering subdirectory $$i";             \
+               ( cd $$i; $(MAKE) $(MFLAGS) install );  \
+               if test $$? != 0 ; then exit 1; fi ;    \
+               echo " ";                                                               \
+       done
+
+clean-common: FORCE
+       @echo "Making clean in `$(PWD)`"
+       @for i in $(SUBDIRS) $(CLEANDIRS); do           \
+               echo "  Entering subdirectory $$i";             \
+               ( cd $$i; $(MAKE) $(MFLAGS) clean );    \
+               if test $$? != 0 ; then exit 1; fi ;    \
+               echo " ";                                                               \
+       done
+
+veryclean-common: FORCE
+       @echo "Making veryclean in `$(PWD)`"
+       @for i in $(SUBDIRS) $(CLEANDIRS); do           \
+               echo "  Entering subdirectory $$i";             \
+               ( cd $$i; $(MAKE) $(MFLAGS) veryclean );        \
+               if test $$? != 0 ; then exit 1; fi ;    \
+               echo " ";                                                               \
+       done
+
+depend-common: FORCE
+       @echo "Making depend in `$(PWD)`"
+       @for i in $(SUBDIRS) $(DEPENDDIRS); do          \
+               echo "  Entering subdirectory $$i";             \
+               ( cd $$i; $(MAKE) $(MFLAGS) depend );   \
+               if test $$? != 0 ; then exit 1; fi ;    \
+               echo " ";                                                               \
+       done
+
+Makefile: $(top_srcdir)/build/dir.mk
diff --git a/build/info.mk b/build/info.mk
new file mode 100644 (file)
index 0000000..c6eb245
--- /dev/null
@@ -0,0 +1,10 @@
+# $OpenLDAP$
+## Copyright 1998-2003 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
diff --git a/build/lib-shared.mk b/build/lib-shared.mk
new file mode 100644 (file)
index 0000000..02409a9
--- /dev/null
@@ -0,0 +1,21 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
+## of this package for details.
+##---------------------------------------------------------------------------
+##
+## Makefile Template for Shared Libraries
+##
+
+MKDEPFLAG = -l
+
+.SUFFIXES: .c .o .lo
+
+.c.lo:
+       $(LTCOMPILE_LIB) $<
+
+$(LIBRARY): version.lo
+       $(LTLINK_LIB) -o $@ $(OBJS) version.lo $(LINK_LIBS)
+
+Makefile: $(top_srcdir)/build/lib-shared.mk
+
diff --git a/build/lib-static.mk b/build/lib-static.mk
new file mode 100644 (file)
index 0000000..6b79999
--- /dev/null
@@ -0,0 +1,14 @@
+# $OpenLDAP$
+## Copyright 1998-2003 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) $@
+
+Makefile: $(top_srcdir)/build/lib-static.mk
diff --git a/build/lib.mk b/build/lib.mk
new file mode 100644 (file)
index 0000000..6a4527c
--- /dev/null
@@ -0,0 +1,43 @@
+# $OpenLDAP$
+## Copyright 1998-2003 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)
+
+#
+# In the mingw/cygwin environment, the so and dll files must be
+# deleted separately, instead of using the {.so*,*.dll} construct
+# that was previously used. It just didn't work.
+#
+clean-common:  FORCE
+       $(RM) $(LIBRARY) ../$(LIBRARY) $(XLIBRARY) \
+               $(PROGRAMS) $(XPROGRAMS) $(XSRCS) $(XXSRCS) \
+               *.o *.lo a.out *.exe core version.c .libs/* \
+               ../`$(BASENAME) $(LIBRARY) .la`.so* \
+               ../`$(BASENAME) $(LIBRARY) .la`*.dll
+
+depend-common: FORCE
+       $(MKDEP) $(DEFS) $(DEFINES) $(SRCS) $(XXSRCS)
+
+lint-local: FORCE
+lint5-local: FORCE
+
+Makefile: $(top_srcdir)/build/lib.mk
+
index 5c09377e7faba28e47fd0f8c18427ff7d62bdb37..af4c60aa577e266db35c8fb4c89cf2d08d5c3dc8 100644 (file)
@@ -1,5 +1,5 @@
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation
+## Copyright 1998-2003 The OpenLDAP Foundation
 ## COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
 ## of this package for details.
 ##---------------------------------------------------------------------------
index 4384b2853f57e1abf2dd3d052d98305c7e8a7fd7..506126e3a71799117dcf94c34b85b75f4bff92b2 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh -
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation
+## Copyright 1998-2003 The OpenLDAP Foundation
 ## COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
 ## of this package for details.
 #
index f0e7a1f5d70d1ad5a99cbb16671cbe8ddb94dfb8..906a78ab8920145741974d4e3138be2a5fb069f0 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation
+## Copyright 1998-2003 The OpenLDAP Foundation
 ## COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
 ## of this package for details.
 #
diff --git a/build/mod.mk b/build/mod.mk
new file mode 100644 (file)
index 0000000..f877817
--- /dev/null
@@ -0,0 +1,81 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
+## of this package for details.
+##---------------------------------------------------------------------------
+##
+## Makefile Template for Server Modules
+##
+
+LIBRARY = $(LIBBASE).la
+LIBSTAT = lib$(LIBBASE).a
+
+MKDEPFLAG = -l
+
+.SUFFIXES: .c .o .lo
+
+.c.lo:
+       $(LTCOMPILE_MOD) $<
+
+all-no lint-no 5lint-no depend-no install-no: FORCE
+       @echo "run configure with $(BUILD_OPT) to make $(LIBBASE)"
+
+all-common: all-$(BUILD_MOD)
+
+version.c: $(OBJS)
+       $(RM) $@
+       $(MKVERSION) $(LIBBASE) > $@
+
+$(LIBRARY): version.lo
+       $(LTLINK_MOD) -module -o $@ $(OBJS) version.lo $(LINK_LIBS)
+
+$(LIBSTAT): version.lo
+       $(AR) ruv $@ `echo $(OBJS) | sed 's/\.lo/.o/g'` version.o
+       @$(RANLIB) $@
+
+clean-common: clean-lib FORCE
+veryclean-common: veryclean-lib FORCE
+
+
+lint-common: lint-$(BUILD_MOD)
+
+5lint-common: 5lint-$(BUILD_MOD)
+
+depend-common: depend-$(BUILD_MOD)
+
+install-common: install-$(BUILD_MOD)
+
+all-local-mod:
+all-mod: $(LIBRARY) all-local-mod FORCE
+
+all-local-lib:
+all-yes: $(LIBSTAT) all-local-lib FORCE
+
+install-mod: $(LIBRARY)
+       @-$(MKDIR) $(DESTDIR)$(moduledir)
+       $(LTINSTALL) $(INSTALLFLAGS) -m 755 $(LIBRARY) $(DESTDIR)$(moduledir)
+
+install-local-lib:
+install-yes: install-local-lib FORCE
+
+lint-local-lib:
+lint-yes lint-mod: lint-local-lib FORCE
+       $(LINT) $(DEFS) $(DEFINES) $(SRCS)
+
+5lint-local-lib:
+5lint-yes 5lint-mod: 5lint-local-lib FORCE
+       $(5LINT) $(DEFS) $(DEFINES) $(SRCS)
+
+clean-local-lib:
+clean-lib:     clean-local-lib FORCE
+       $(RM) $(LIBRARY) $(LIBSTAT) version.c *.o *.lo a.out core .libs/*
+
+depend-local-lib:
+depend-yes depend-mod: depend-local-lib FORCE
+       $(MKDEP) $(DEFS) $(DEFINES) $(SRCS)
+
+veryclean-local-lib:
+veryclean-lib:         clean-lib veryclean-local-lib
+
+Makefile: $(top_srcdir)/build/mod.mk
+
diff --git a/build/rules.mk b/build/rules.mk
new file mode 100644 (file)
index 0000000..bef349c
--- /dev/null
@@ -0,0 +1,26 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
+## of this package for details.
+##---------------------------------------------------------------------------
+##
+## Makefile Template for Programs
+##
+
+all-common: $(PROGRAMS) FORCE
+
+clean-common:  FORCE
+       $(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) *.o *.lo a.out core *.core \
+                   .libs/* *.exe
+
+depend-common: FORCE
+       $(MKDEP) $(DEFS) $(DEFINES) $(SRCS)
+
+lint: FORCE
+       $(LINT) $(DEFS) $(DEFINES) $(SRCS)
+
+lint5: FORCE
+       $(5LINT) $(DEFS) $(DEFINES) $(SRCS)
+
+Makefile: $(top_srcdir)/build/rules.mk
+
diff --git a/build/srv.mk b/build/srv.mk
new file mode 100644 (file)
index 0000000..f0e0fb7
--- /dev/null
@@ -0,0 +1,50 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation
+## COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
+## of this package for details.
+##---------------------------------------------------------------------------
+##
+## Makefile Template for Servers
+##
+
+all-common: all-$(BUILD_SRV)
+all-no lint-no 5lint-no depend-no install-no:
+       @echo "run configure with $(BUILD_OPT) to make $(PROGRAMS)"
+
+clean-common: clean-srv FORCE
+veryclean-common: veryclean-srv FORCE
+
+lint-common: lint-$(BUILD_SRV)
+
+5lint-common: 5lint-$(BUILD_SRV)
+
+depend-common: depend-$(BUILD_SRV)
+
+install-common: install-$(BUILD_SRV)
+
+all-local-srv:
+all-yes: all-local-srv FORCE
+
+install-local-srv:
+install-yes: install-local-srv FORCE
+
+lint-local-srv:
+lint-yes: lint-local-srv FORCE
+       $(LINT) $(DEFS) $(DEFINES) $(SRCS)
+
+5lint-local-srv:
+5lint-yes: 5lint-local-srv FORCE
+       $(5LINT) $(DEFS) $(DEFINES) $(SRCS)
+
+clean-local-srv:
+clean-srv:     clean-local-srv FORCE
+       $(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) *.o a.out core .libs/* *.exe
+
+depend-local-srv:
+depend-yes: depend-local-srv FORCE
+       $(MKDEP) $(DEFS) $(DEFINES) $(SRCS)
+
+veryclean-local-srv:
+veryclean-srv:         clean-srv veryclean-local-srv
+
+Makefile: $(top_srcdir)/build/srv.mk
index e9deeb06e7eeaf2c2c701445ac5339525990c7ce..3cd0d85d419becad9dd1c261a339d2b2f48f6ba1 100644 (file)
@@ -1,5 +1,5 @@
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
 ## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
 ##
 ## Clients Makefile.in for OpenLDAP
diff --git a/contrib/ldapc++/COPYRIGHT b/contrib/ldapc++/COPYRIGHT
new file mode 100644 (file)
index 0000000..6f2755c
--- /dev/null
@@ -0,0 +1,37 @@
+Copyright 1998-2003 The OpenLDAP Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, 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.
+
+OpenLDAP is a registered trademark of the OpenLDAP Foundation.
+
+Individual files and/or contributed packages may be copyright by
+other parties and subject to additional restrictions.
+
+This work is derived from the University of Michigan LDAP v3.3
+distribution.  Information concerning this software is available
+at: http://www.umich.edu/~dirsvcs/ldap/
+
+This work also contains materials derived from public sources.
+
+Additional Information about OpenLDAP can be obtained at:
+    http://www.openldap.org/
+
+or by sending e-mail to:
+    info@OpenLDAP.org
+
+---
+
+Portions Copyright (c) 1992-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.
diff --git a/contrib/ldapc++/src/ac/time.h b/contrib/ldapc++/src/ac/time.h
new file mode 100644 (file)
index 0000000..57b4111
--- /dev/null
@@ -0,0 +1,28 @@
+/* Generic time.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 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 */
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644 (file)
index 0000000..9b05a9c
--- /dev/null
@@ -0,0 +1,7 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+##
+## doc Makefile.in for OpenLDAP
+
+SUBDIRS= man
diff --git a/doc/man/Makefile.in b/doc/man/Makefile.in
new file mode 100644 (file)
index 0000000..aaf6637
--- /dev/null
@@ -0,0 +1,7 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+##
+## man Makefile.in for OpenLDAP
+
+SUBDIRS= man1 man3 man5 man8
diff --git a/doc/man/man1/Makefile.in b/doc/man/man1/Makefile.in
new file mode 100644 (file)
index 0000000..829fe6c
--- /dev/null
@@ -0,0 +1,7 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+##
+## man1 Makefile.in for OpenLDAP
+
+MANSECT=1
index dd955a7a16ec859384fc619c0226416b52695f95..6bb8541389fc7d70dda0fb6cdf0366d5f0d335b3 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAPCOMPARE 1 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldapcompare \- LDAP compare tool
index bb5d2dbc8dd3d511de9db50d11548edf2b66049d..137cb63ff6bd759d2dd65f08f2b0f73c3777ca2a 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAPDELETE 1 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldapdelete \- LDAP delete entry tool
index ebc7faaaf16b8b472abf4a3e18ad96ddaec241d6..007458340cd164abc67a6a772c3ee8e40ddf9526 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAPMODIFY 1 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldapmodify, ldapadd \- LDAP modify entry and LDAP add entry tools
index 66c803693c304abda0895b34ab2c7e9c03df9077..a0fbe3bc2feba3ce90c8898412c62ec2120e1529 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAPMODRDN 1 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldapmodrdn \- LDAP rename entry tool
index a7f30f0b0bee1c18422c6b7579ef7bed31a15f61..3e03a03f4859092e396d350110dda9fee22e2c01 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAPPASSWD 1 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldappasswd \- change the password of an LDAP entry
index cd5bdd7e1db66339abefd3a6736a5b943e61e10f..79accc266bcfd0f37582b5757b7acd593006e3a3 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAPSEARCH 1 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldapsearch \- LDAP search tool
index 9d2038e595f319edf435cae812db7707c00eb8eb..519f581860262b84dcaf6cf07ee52fc8be02322b 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAPWHOAMI 1 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldapwhoami \- LDAP who am i? tool
diff --git a/doc/man/man3/Makefile.in b/doc/man/man3/Makefile.in
new file mode 100644 (file)
index 0000000..2d84de3
--- /dev/null
@@ -0,0 +1,7 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+##
+## man3 Makefile.in for OpenLDAP
+
+MANSECT=3
index a8194cc970749f6925458af960f7ea53f76e3de0..0494010a43e142963d1313505fd43e48e3e3a11e 100644 (file)
@@ -1,6 +1,6 @@
 .TH LBER_DECODE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ber_get_next, ber_skip_tag, ber_peek_tag, ber_scanf, ber_get_int,
index 3598bdec04c644c68e218e7c3fc5e9dcdd35268d..c9a11150748a606926be585de2232fbc6c6724df 100644 (file)
@@ -1,6 +1,6 @@
 .TH LBER_ENCODE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ber_alloc_t, ber_flush, ber_printf, ber_put_int, ber_put_enum, ber_put_ostring, ber_put_string, ber_put_null, ber_put_boolean, ber_put_bitstring, ber_start_seq, ber_start_set, ber_put_seq, ber_put_set \- LBER simplified Basic Encoding Rules library routines for encoding
index a1e0c4a777bae2db15537863e1222269d3efeca5..62aeccc92579a243aa30c40630e574a40a2aedd5 100644 (file)
@@ -1,6 +1,6 @@
 .TH LBER_MEMORY 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ber_memalloc, ber_memcalloc, ber_memrealloc, ber_memfree, ber_memvfree \- LBER memory allocators
index e5e4abbec2e9ccf08bbb671dd86ed316a76299e4..4b6b8a7aa340ab666b35de072f18ec51df5d4c34 100644 (file)
@@ -1,6 +1,6 @@
 .TH LBER_TYPES 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ber_int_t, ber_uint_t, ber_len_t, ber_slen_t, ber_tag_t \- LBER types
index e9954b7ba41a9908f2324da8ed495a69d69b71e6..b1a9c5a0c68e14846655321d1e5346f38960556c 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap - OpenLDAP Lightweight Directory Access Protocol API
index aeeb3e6c169acdb288f47f6dbd2404294da970c1..879db11aee32cda7809f0eda3fbea7a3ea8300b0 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_ABANDON 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_abandon, ldap_abandon_ext \- Abandon an LDAP operation in progress
index e993a9c87b51b0887b6e5f3784af7067b15d6aed..f65bd5e8a21454c086d91daa4699a258a774fca4 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_ADD 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_add, ldap_add_s, ldap_add_ext, ldap_add_ext_s \- Perform an LDAP add operation
index ca8247f634ad74072cd96fff34871f31cbb20677..5714b04303cb2d3039375ec1c1964497de5729e7 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_BIND 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_bind, ldap_bind_s, ldap_simple_bind, ldap_simple_bind_s, ldap_kerberos_bind_s, ldap_kerberos_bind1, ldap_kerberos_bind1_s, ldap_kerberos_bind2, ldap_kerberos_bind2_s, ldap_sasl_bind, ldap_sasl_bind_s, ldap_sasl_interactive_bind_s, ldap_parse_sasl_bind_result, ldap_unbind, ldap_unbind_s \- LDAP bind routines
index 1b35e5b9161b65001fa4de284b4fe002cd1b952f..20e1c794db2fcc7555a0702d6bae07ae88cd8d31 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_CACHE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_enable_cache, ldap_disable_cache, ldap_destroy_cache, ldap_flush_cache, ldap_uncache_entry, ldap_uncache_request, ldap_set_cache_options \- LDAP client caching routines
index 145e44626f56dcc1b05ff8218f9457e7255898e7..0f0363be8c92ba809a43ac1602a35d0355ae48a6 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_COMPARE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_compare, ldap_compare_s \- Perform an LDAP compare operation
index 0657138f234afea814745d2c7a74741e5bd6c81a..737507871205132c22bee14a129608e60dd40321 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_DELETE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_delete, ldap_delete_s \- Perform an LDAP delete operation
index 227f32a408c368a7f3362286163f90cc51e6ce86..b86af8422fea1b61fd9f88609a9dd666bc64c543 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_ERROR 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_perror, ld_errno, ldap_result2error, ldap_errlist, ldap_err2string \- LDAP protocol error handling routines
index 75bd21d84f8d3636eb662611b0f336c9a35a75ee..cdc18dbf2a4b5809523680779e2a321c9a8ab59d 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_FIRST_ATTRIBUTE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_first_attribute, ldap_next_attribute \- step through LDAP entry attributes
index 0c98662ce274006052e07d35d201fe0c70e5d433..884c98d878a897da1052c5bc99336272566cd3d2 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_FIRST_ENTRY 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_first_entry, ldap_next_entry, ldap_count_entries \- LDAP result entry parsing and counting routines
index 0abe91e44f829ff1948006b8c54beb88caae1d72..87e2411a200334da9f2dc80c754be2b83a871380 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_FIRST_MESSAGE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_first_message, ldap_next_message, ldap_count_messages \- Stepping
index ecd8d87d84bccb6c165b68a1414a928bcab93ce1..f7401391e65fc9e33dcc8a489ab51865ae3f86ef 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_FIRST_REFERENCE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_first_reference, ldap_next_reference, ldap_count_references \- Stepping
index 9b78de50837a9d65e8d28694a08dcd56b7aeea94..1b51a6bb286e0492941a14b16dc4c0996e3d0321 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_GET_DN 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_get_dn, ldap_explode_dn, ldap_explode_rdn, ldap_dn2ufn \- LDAP DN handling routines
index 845499e1e949d3a350c75951bdb26bfa4392004a..9aa28fb401ff19a6298d51679953985625ef7bbe 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_GET_VALUES 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_get_values, ldap_get_values_len, ldap_count_values \- LDAP attribute value handling routines
index 856a81c02c5902fd1bb61fb038d73f2633bbe240..d71a93fdc62be07bf563789118af0d8874c5781b 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_MODIFY 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_modify, ldap_modify_s \- Perform an LDAP modify operation
index 19f9e7088699fc74252dc9680cecf2687fb7d72b..3036dd20769e74bfe5cf7be0098d5eb0597a87cc 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_MODRDN 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_modrdn, ldap_modrdn_s, ldap_modrdn2, ldap_modrdn2_s \- Perform an LDAP modify RDN operation
index af934ea13fa151d8eec9db0ef62d162948eb9eb8..01278035cecbb3912220ff16a6f5a4122a0b150e 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_OPEN 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_init, ldap_open \- Initialize the LDAP library and open a connection to an LDAP server
index 61b83433ef16ec56166a85871caf59db21e736e1..e38d1519e616410819aa9c8d9362edbc13e8fef3 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_PARSE_REFERENCE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_parse_reference \- Extract referrals and controls from a reference message
index 6ec4d1ab1ac9a72a95271715c55937d24841dd2f..471f2f755a4040c3c78252ba36803416b5978052 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_PARSE_RESULT 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_parse_result \- Parsing results
index 624a32a3c57b08a952b07a5eddd9a37d791276dd..128d79a551ff24a5f84b9b328afbbaa3f02f43a2 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_RESULT 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_result \- Wait for the result of an LDAP operation
index 4ba1c495b1359c28acd5d3ff501506dc8e59b3e2..ffa50beb5b02974d037b3eb7171e52315afbb0f3 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_SCHEMA 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 2000-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 2000-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_str2syntax, ldap_syntax2str, ldap_syntax2name, ldap_syntax_free,
index a78fb09842e46d2d9ff1778c54a20fb705d8cb8b..3530b25b6ac4c78c5cd0e9989d24e16bd16a3753 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_SEARCH 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_search, ldap_search_s, ldap_search_st \- Perform an LDAP search operation
index 90a5f3f94badaa2380441c77047dce79e31ef3ef..8ef18ed1259f972d5bdb4c1d62c9ac0fcee79d0c 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_SORT 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_sort_entries, ldap_sort_values, ldap_sort_strcasecmp \- LDAP sorting routines
index eeb60a474423db418657274e4cf9fbdd0cea7fed..0cc3f3774ff1c33415686e07ffc4b613302bb0c0 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP_URL 3 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldap_is_ldap_url,
diff --git a/doc/man/man5/Makefile.in b/doc/man/man5/Makefile.in
new file mode 100644 (file)
index 0000000..58de520
--- /dev/null
@@ -0,0 +1,7 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+##
+## man5 Makefile.in for OpenLDAP
+
+MANSECT=5
index 4d406dd2b953c9dfff29a5cf2c7e1d690a40da82..20f07f291af59bb9a4b70c9b0d2f711e0894698c 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDAP.CONF 5 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .UC 6
 .SH NAME
index eec8fdfa4c091bb7ccdca2ef9ccb0a8707a25294..5b0c9e07df0da2b349045f8faaef08b588a4d46a 100644 (file)
@@ -1,6 +1,6 @@
 .TH LDIF 5 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 ldif \- LDAP Data Interchange Format
index c76dbdb4bce97854da90dfbeca7104d9bf55bef7..a642aeb58297a8545b9cc1f9501b95c68edfc4be 100644 (file)
@@ -1,5 +1,5 @@
 .TH SLAPD-BDB 5 "RELEASEDATE" "OpenLDAP LDVERSION"
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .\" $OpenLDAP$
 .SH NAME
index 674d524707424383afe360097117098f23ca0e2f..9e9be5ca55d86075bd5e9f91e3f4cf31243def8a 100644 (file)
@@ -1,5 +1,5 @@
 .TH SLAPD-DNSSRV 5 "RELEASEDATE" "OpenLDAP LDVERSION"
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .\" $OpenLDAP$
 .SH NAME
index 800508ce7959a7560588382fb7497fd30ed6f3ab..398ef24b278bca72fce3a412a3b33f9b1c2b8108 100644 (file)
@@ -1,5 +1,5 @@
 .TH SLAPD-LDAP 5 "RELEASEDATE" "OpenLDAP LDVERSION"
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .\" $OpenLDAP$
 .SH NAME
index 8faa44e7da1d4827db5bad589b1ace2a3ef4cc0b..70b46055d1b9cde7ee1e7f86b1b6a3d0d3df826c 100644 (file)
@@ -1,5 +1,5 @@
 .TH SLAPD-LDBM 5 "RELEASEDATE" "OpenLDAP LDVERSION"
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .\" $OpenLDAP$
 .SH NAME
index ed3fa7bba42c50a24ebd8f6d9072c6be87c45eae..11d5cbfd8862ae96fc52b64cc9bfc9a576755de3 100644 (file)
@@ -1,5 +1,5 @@
 .TH SLAPD-META 5 "RELEASEDATE" "OpenLDAP LDVERSION"
-.\" Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
 .\" Copying restrictions apply.  See the COPYRIGHT file.
 .\" Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
 .\" $OpenLDAP$
index dfb7ca5bc877ae31ecce588a16627eb9ff1ae3ab..0222f69e71527aac2929a6ce119921bd5f831895 100644 (file)
@@ -1,5 +1,5 @@
 .TH SLAPD-PASSWD 5 "RELEASEDATE" "OpenLDAP LDVERSION"
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .\" $OpenLDAP$
 .SH NAME
index b84d6201ccca09750647460889ee5bd27d5ec12d..70f479d1d0a0c0b0550e29f09c82f97f12e85cb7 100644 (file)
@@ -1,5 +1,5 @@
 .TH SLAPD-SHELL 5 "RELEASEDATE" "OpenLDAP LDVERSION"
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .\" $OpenLDAP$
 .SH NAME
index 7eefc54cc5cdc512fdd32bb52ed3766c65a7e827..fa6b945214c45c14de5540f0599c7301784d10cb 100644 (file)
@@ -1,5 +1,5 @@
 .TH SLAPD.ACCESS 5 "RELEASEDATE" "OpenLDAP LDVERSION"
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 slapd.access \- access configuration for slapd, the stand-alone LDAP daemon
index 6538c3bdeec6c245b8ff98ee2ab7924dca42027e..7d7a5ca0eb19489e22c44b68da85930099852664 100644 (file)
@@ -1,5 +1,5 @@
 .TH SLAPD.CONF 5 "RELEASEDATE" "OpenLDAP LDVERSION"
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .\" $OpenLDAP$
 .SH NAME
index 4ad60bbc201d55366a230d1cc9da8d1471d138a5..668132afae0d411209d1e1980dfb201613acabed 100644 (file)
@@ -1,6 +1,6 @@
 .TH SLAPD.REPLOG 5 "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 slapd.replog \- slapd replication log format
diff --git a/doc/man/man8/Makefile.in b/doc/man/man8/Makefile.in
new file mode 100644 (file)
index 0000000..ff6958d
--- /dev/null
@@ -0,0 +1,7 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
+##
+## man8 Makefile.in for OpenLDAP
+
+MANSECT=8
index e003feca3a54b4525ed4d359115764477270cb89..df4ed7bed8363acd748bf6fe470e6dd21f24e414 100644 (file)
@@ -1,6 +1,6 @@
 .TH SLAPADD 8C "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 slapadd \- Add entries to a SLAPD database
index f0d1129ea217a5fac238f8ece1c63152cc41ea52..33ba59290e6d957adf9a8f92f935b7e92b197090 100644 (file)
@@ -1,6 +1,6 @@
 .TH SLAPCAT 8C "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 slapcat \- SLAPD database to LDIF utility
index e8f7dc4832b4d7adfc00b2584e4e7220a795630e..63b457e4961cebfe7e3fa6a9e7d2d90df117b5a4 100644 (file)
@@ -1,5 +1,5 @@
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .TH SLAPD 8C "RELEASEDATE" "OpenLDAP LDVERSION"
 .SH NAME
index 5b77e152cebf2abb192ffb5c9d89df7c67b402fe..1434391e340d5238c830efc1e7ed72d184205b93 100644 (file)
@@ -1,6 +1,6 @@
 .TH SLAPINDEX 8C "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 slapindex \- SLAPD index to LDIF utility
index cfbc2b6573bf409a6f3067ec50d05b48a4dc6624..41fd51e277a8c4f744cfc9135b744af29a959df1 100644 (file)
@@ -1,6 +1,6 @@
 .TH SLAPPASSWD 8C "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 slappasswd \- OpenLDAP password utility
index 097e30bda61d8089fba76bb49c0ffebdb236e69b..8d855155247e8574a2a78c0ae4e7c59e835516b0 100644 (file)
@@ -1,6 +1,6 @@
 .TH SLURPD 8C "RELEASEDATE" "OpenLDAP LDVERSION"
 .\" $OpenLDAP$
-.\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
+.\" Copyright 1998-2003 The OpenLDAP Foundation All Rights Reserved.
 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
 .SH NAME
 slurpd \- Standalone LDAP Update Replication Daemon
diff --git a/include/ac/alloca.h b/include/ac/alloca.h
new file mode 100644 (file)
index 0000000..88b419a
--- /dev/null
@@ -0,0 +1,40 @@
+/* Generic alloca.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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
+
+/*
+ * use of alloca is disallowed as it is machine dependent
+ */
+#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 */
diff --git a/include/ac/crypt.h b/include/ac/crypt.h
new file mode 100644 (file)
index 0000000..3f71af5
--- /dev/null
@@ -0,0 +1,26 @@
+/* Generic crypt.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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_CRYPT_H
+#define _AC_CRYPT_H
+
+#include <ac/unistd.h>
+
+/* crypt() may be defined in a separate include file */
+#if HAVE_CRYPT_H
+#      include <crypt.h>
+#else
+       extern char *(crypt)();
+#endif
+
+#endif /* _AC_CRYPT_H */
diff --git a/include/ac/ctype.h b/include/ac/ctype.h
new file mode 100644 (file)
index 0000000..9c59f69
--- /dev/null
@@ -0,0 +1,30 @@
+/* Generic ctype.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 */
diff --git a/include/ac/dirent.h b/include/ac/dirent.h
new file mode 100644 (file)
index 0000000..8d2da0d
--- /dev/null
@@ -0,0 +1,34 @@
+/* Generic dirent.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 */
diff --git a/include/ac/errno.h b/include/ac/errno.h
new file mode 100644 (file)
index 0000000..29cedf4
--- /dev/null
@@ -0,0 +1,52 @@
+/* Generic errno.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 */
+       LDAP_LIBC_V(int)      sys_nerr;
+       LDAP_LIBC_V(char)    *sys_errlist[];
+#endif
+
+#undef _AC_ERRNO_UNKNOWN
+#define _AC_ERRNO_UNKNOWN "unknown error"
+
+#ifdef HAVE_SYS_ERRLIST
+       /* this is thread safe */
+#      define  STRERROR(e) ( (e) > -1 && (e) < sys_nerr \
+                       ? sys_errlist[(e)] : _AC_ERRNO_UNKNOWN )
+
+#elif defined( HAVE_STRERROR )
+       /* this may not be thread safe */
+       /* and, yes, some implementations of strerror may return NULL */
+#      define  STRERROR(e) ( strerror(e) \
+               ? strerror(e) : _AC_ERRNO_UNKNOWN )
+
+#else
+       /* this is thread safe */
+#      define  STRERROR(e) ( _AC_ERRNO_UNKNOWN )
+#endif
+
+#endif /* _AC_ERRNO_H */
diff --git a/include/ac/krb.h b/include/ac/krb.h
new file mode 100644 (file)
index 0000000..9ebbb74
--- /dev/null
@@ -0,0 +1,34 @@
+/* Generic krb.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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.
+ */
+
+/* Kerberos IV */
+
+#ifndef _AC_KRB_H
+#define _AC_KRB_H
+
+#if defined( HAVE_KRB4 )
+
+#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_KRB4 */
+#endif /* _AC_KRB_H */
diff --git a/include/ac/krb5.h b/include/ac/krb5.h
new file mode 100644 (file)
index 0000000..1f4dc18
--- /dev/null
@@ -0,0 +1,23 @@
+/* Generic krb.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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.
+ */
+
+/* Kerberos V */
+
+#ifndef _AC_KRB5_H
+#define _AC_KRB5_H
+
+#if defined( HAVE_KRB5 )
+#include <krb5.h>
+#endif /* HAVE_KRB5 */
+
+#endif /* _AC_KRB5_H */
diff --git a/include/ac/param.h b/include/ac/param.h
new file mode 100644 (file)
index 0000000..4f67a10
--- /dev/null
@@ -0,0 +1,33 @@
+/* Generic param.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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_PARAM_H
+#define _AC_PARAM_H
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#ifndef MAXPATHLEN
+#      if defined(PATH_MAX)
+#              define MAXPATHLEN       PATH_MAX
+
+#      elif defined(_MAX_PATH)
+#              define MAXPATHLEN       _MAX_PATH
+
+#      else
+#              define MAXPATHLEN       4096
+#      endif
+#endif
+
+#endif /* _AC_PARAM_H */
diff --git a/include/ac/regex.h b/include/ac/regex.h
new file mode 100644 (file)
index 0000000..e63c03c
--- /dev/null
@@ -0,0 +1,38 @@
+/* Generic Regex */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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_ */
diff --git a/include/ac/setproctitle.h b/include/ac/setproctitle.h
new file mode 100644 (file)
index 0000000..13002cd
--- /dev/null
@@ -0,0 +1,30 @@
+/* Generic setproctitle.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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_LUTIL_F (void) (setproctitle) LDAP_P((const char *fmt, ...)) \
+               LDAP_GCCATTR((format(printf, 1, 2)));
+       LDAP_LUTIL_V (int) Argc;
+       LDAP_LUTIL_V (char) **Argv;
+#endif
+
+#endif /* LDAP_PROCTITLE */
+#endif /* _AC_SETPROCTITLE_H */
diff --git a/include/ac/signal.h b/include/ac/signal.h
new file mode 100644 (file)
index 0000000..8c45a6c
--- /dev/null
@@ -0,0 +1,77 @@
+/* Generic signal.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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
+
+#if defined( HAVE_SIGACTION )
+#define SIGNAL lutil_sigaction
+typedef void (*lutil_sig_t)(int);
+LDAP_LUTIL_F(lutil_sig_t) lutil_sigaction( int sig, lutil_sig_t func );
+#define SIGNAL_REINSTALL(sig,act)      (void)0
+#elif defined( HAVE_SIGSET )
+#define SIGNAL sigset
+#define SIGNAL_REINSTALL sigset
+#else
+#define SIGNAL signal
+#define SIGNAL_REINSTALL signal
+#endif
+
+#if !defined( LDAP_SIGUSR1 ) || !defined( LDAP_SIGUSR2 )
+#undef LDAP_SIGUSR1
+#undef LDAP_SIGUSR2
+
+#      if defined(WINNT) || defined(_WINNT) || defined(_WIN32)
+#              define LDAP_SIGUSR1     SIGILL
+#              define LDAP_SIGUSR2     SIGTERM
+
+#      elif !defined(HAVE_LINUX_THREADS)
+#              define LDAP_SIGUSR1     SIGUSR1
+#              define LDAP_SIGUSR2     SIGUSR2
+
+#      else
+               /*
+                * Some versions of LinuxThreads unfortunately uses the only
+                * two signals reserved for user applications.  This forces
+                * OpenLDAP to use other 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 */
diff --git a/include/ac/stdarg.h b/include/ac/stdarg.h
new file mode 100644 (file)
index 0000000..16bedb1
--- /dev/null
@@ -0,0 +1,25 @@
+/* Generic stdarg.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 */
index 2e3eb5502d44f794fd30516aec2ba905c552261e..94be31c5178458de369c3d315b5a8027dc35231a 100644 (file)
@@ -1,7 +1,7 @@
 /* Generic stdlib.h */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 930e757c7c561975ef6e52b4cdd59b4b205771f9..1d71d793329bc9b0404f981d972fe0ff7702d7a7 100644 (file)
@@ -1,7 +1,7 @@
 /* Generic string.h */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/ac/sysexits.h b/include/ac/sysexits.h
new file mode 100644 (file)
index 0000000..c953845
--- /dev/null
@@ -0,0 +1,23 @@
+/* Generic sysexits */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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_ */
diff --git a/include/ac/syslog.h b/include/ac/syslog.h
new file mode 100644 (file)
index 0000000..f4eed26
--- /dev/null
@@ -0,0 +1,35 @@
+/* Generic syslog.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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_ */
diff --git a/include/ac/termios.h b/include/ac/termios.h
new file mode 100644 (file)
index 0000000..61109e2
--- /dev/null
@@ -0,0 +1,47 @@
+/* Generic termios.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 */
diff --git a/include/ac/time.h b/include/ac/time.h
new file mode 100644 (file)
index 0000000..01b9111
--- /dev/null
@@ -0,0 +1,29 @@
+/* Generic time.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 */
diff --git a/include/ac/unistd.h b/include/ac/unistd.h
new file mode 100644 (file)
index 0000000..70c6197
--- /dev/null
@@ -0,0 +1,74 @@
+/* Generic unistd.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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
+
+#if HAVE_PROCESS_H
+#      include <process.h>
+#endif
+
+/* note: callers of crypt(3) should include <ac/crypt.h> */
+
+#if defined(HAVE_GETPASSPHRASE)
+LDAP_LIBC_F(char*)(getpassphrase)();
+
+#elif defined(HAVE_GETPASS)
+#define getpassphrase(p) getpass(p)
+LDAP_LIBC_F(char*)(getpass)();
+
+#else
+#define NEED_GETPASSPHRASE 1
+#define getpassphrase(p) lutil_getpass(p)
+LDAP_LUTIL_F(char*)(lutil_getpass) LDAP_P((const 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 */
+       LDAP_LIBC_V (char *) optarg;
+       LDAP_LIBC_V (int) optind, opterr, optopt;
+#endif
+
+/* use lutil file locking */
+#define ldap_lockf(x)  lutil_lockf(x)
+#define ldap_unlockf(x)        lutil_unlockf(x)
+#include <lutil_lockf.h>
+
+/*
+ * Windows: although sleep() will be resolved by both MSVC and Mingw GCC
+ * linkers, the function is not declared in header files. This is
+ * because Windows' version of the function is called _sleep(), and it
+ * is declared in stdlib.h
+ */
+
+#ifdef _WIN32
+#define sleep _sleep
+#endif
+
+#endif /* _AC_UNISTD_H */
diff --git a/include/ac/wait.h b/include/ac/wait.h
new file mode 100644 (file)
index 0000000..667b36d
--- /dev/null
@@ -0,0 +1,53 @@
+/* Generic wait.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 */
index 745cc17d61ee4cfd1f55a40d6cb9c2630fba3253..3d8a619dc9e5b499091d56b5fc9e60f543b205ad 100644 (file)
@@ -1,5 +1,15 @@
-/* avl.h - avl tree definitions */
+/* $OpenLDAP$ */
 /*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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_AVL_F( int )
+avl_free LDAP_P(( Avlnode *root, AVL_FREE dfree ));
+
+LDAP_AVL_F( int )
+avl_insert LDAP_P((Avlnode **, void*, AVL_CMP, AVL_DUP));
+
+LDAP_AVL_F( void* )
+avl_delete LDAP_P((Avlnode **, void*, AVL_CMP));
+
+LDAP_AVL_F( void* )
+avl_find LDAP_P((Avlnode *, const void*, AVL_CMP));
+
+LDAP_AVL_F( void* )
+avl_find_lin LDAP_P((Avlnode *, const void*, AVL_CMP));
+
+#ifdef AVL_NONREENTRANT
+LDAP_AVL_F( void* )
+avl_getfirst LDAP_P((Avlnode *));
+
+LDAP_AVL_F( void* )
+avl_getnext LDAP_P((void));
+#endif
+
+LDAP_AVL_F( int )
+avl_dup_error LDAP_P((void*, void*));
+
+LDAP_AVL_F( int )
+avl_dup_ok LDAP_P((void*, void*));
+
+LDAP_AVL_F( int )
+avl_apply LDAP_P((Avlnode *, AVL_APPLY, void*, int, int));
+
+LDAP_AVL_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 */
diff --git a/include/getopt-compat.h b/include/getopt-compat.h
new file mode 100644 (file)
index 0000000..27fde32
--- /dev/null
@@ -0,0 +1,35 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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
+
+/* change symbols to avoid clashing */
+#define optarg lutil_optarg
+#define optind lutil_optind
+#define opterr lutil_opterr
+#define optopt lutil_optopt
+#define getopt lutil_getopt
+
+LDAP_LUTIL_V (char *) optarg;
+LDAP_LUTIL_V (int) optind, opterr, optopt;
+LDAP_LUTIL_F (int) getopt LDAP_P(( int, char * const [], const char *));
+
+LDAP_END_DECL
+
+#endif /* _GETOPT_COMPAT_H */
index ba77229bb757acb9e13a344d06307cbbe8c0c9c6..7f5a141e1fbcdb23a3656a896b7462cd12604b37 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/lber_types.h.in b/include/lber_types.h.in
new file mode 100644 (file)
index 0000000..ed1b3e9
--- /dev/null
@@ -0,0 +1,59 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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
+
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
+
+/* 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
+
+/* ------------------------------------------------------------ */
+
+/* booleans, enumerations, and integers */
+typedef LBER_INT_T ber_int_t;
+
+/* signed and unsigned versions */
+typedef signed LBER_INT_T ber_sint_t;
+typedef unsigned LBER_INT_T ber_uint_t;
+
+/* tags */
+typedef unsigned LBER_TAG_T ber_tag_t;
+
+/* "socket" descriptors */
+typedef LBER_SOCKET_T ber_socket_t;
+
+/* lengths */
+typedef unsigned LBER_LEN_T ber_len_t;
+
+/* signed lengths */
+typedef signed LBER_LEN_T ber_slen_t;
+
+LDAP_END_DECL
+
+#endif /* _LBER_TYPES_H */
diff --git a/include/lber_types.nt b/include/lber_types.nt
new file mode 100644 (file)
index 0000000..5e1bc8f
--- /dev/null
@@ -0,0 +1,72 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 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 (and Win32)
+ * copied by setup.mak to lber_types.h (when confingure is not used).
+ */
+
+#ifndef _LBER_TYPES_H
+#define _LBER_TYPES_H
+
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
+
+/*
+ * NT types:
+ *
+ *     bitsof(short) == 2
+ *     bitsof(int)     == 4
+ *     bitsof(long) == 4       (or larger)
+ *
+ *  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             long
+
+/* ------------------------------------------------------------ */
+
+/* booleans, enumerations, and integers */
+typedef LBER_INT_T ber_int_t;
+
+/* signed and unsigned versions */
+typedef signed LBER_INT_T ber_sint_t;
+typedef unsigned LBER_INT_T ber_uint_t;
+
+/* tags */
+typedef unsigned LBER_TAG_T ber_tag_t;
+
+/* "socket" descriptors */
+typedef LBER_SOCKET_T ber_socket_t;
+
+/* lengths */
+typedef unsigned LBER_LEN_T ber_len_t;
+
+/* signed lengths */
+typedef signed LBER_LEN_T ber_slen_t;
+
+LDAP_END_DECL
+
+#endif /* _LBER_TYPES_H */
diff --git a/include/ldap_cdefs.h b/include/ldap_cdefs.h
new file mode 100644 (file)
index 0000000..9b6bab2
--- /dev/null
@@ -0,0 +1,236 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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(LDAP_NO_PROTOTYPES) && ( defined(LDAP_NEEDS_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 (__GNUC__) * 1000 + (__GNUC_MINOR__) >= 2006
+#      define LDAP_GCCATTR(attrs)      __attribute__(attrs)
+#else
+#      define LDAP_GCCATTR(attrs)
+#endif
+
+/*
+ * Support for Windows DLLs.
+ *
+ * When external source code includes header files for dynamic libraries,
+ * the external source code is "importing" DLL symbols into its resulting
+ * object code. On Windows, symbols imported from DLLs must be explicitly
+ * indicated in header files with the __declspec(dllimport) directive.
+ * This is not totally necessary for functions because the compiler
+ * (gcc or MSVC) will generate stubs when this directive is absent.
+ * However, this is required for imported variables.
+ *
+ * The LDAP libraries, i.e. liblber and libldap, can be built as
+ * static or shared, based on configuration. Just about all other source
+ * code in OpenLDAP use these libraries. If the LDAP libraries
+ * are configured as shared, 'configure' defines the LDAP_LIBS_DYNAMIC
+ * macro. When other source files include LDAP library headers, the
+ * LDAP library symbols will automatically be marked as imported. When
+ * the actual LDAP libraries are being built, the symbols will not
+ * be marked as imported because the LBER_LIBRARY or LDAP_LIBRARY macros
+ * will be respectively defined.
+ *
+ * Any project outside of OpenLDAP with source code wanting to use
+ * LDAP dynamic libraries should explicitly define LDAP_LIBS_DYNAMIC.
+ * This will ensure that external source code appropriately marks symbols
+ * that will be imported.
+ *
+ * The slapd executable, itself, can be used as a dynamic library.
+ * For example, if a backend module is compiled as shared, it will
+ * import symbols from slapd. When this happens, the slapd symbols
+ * must be marked as imported in header files that the backend module
+ * includes. Remember that slapd links with various static libraries.
+ * If the LDAP libraries were configured as static, their object
+ * code is also part of the monolithic slapd executable. Thus, when
+ * a backend module imports symbols from slapd, it imports symbols from
+ * all of the static libraries in slapd as well. Thus, the SLAP_IMPORT
+ * macro, when defined, will appropriately mark symbols as imported.
+ * This macro should be used by shared backend modules as well as any
+ * other external source code that imports symbols from the slapd
+ * executable as if it were a DLL.
+ *
+ * Note that we don't actually have to worry about using the
+ * __declspec(dllexport) directive anywhere. This is because both
+ * MSVC and Mingw provide alternate (more effective) methods for exporting
+ * symbols out of binaries, i.e. the use of a DEF file.
+ *
+ * NOTE ABOUT BACKENDS: Backends can be configured as static or dynamic.
+ * When a backend is configured as dynamic, slapd will load the backend
+ * explicitly and populate function pointer structures by calling
+ * the backend's well-known initialization function. Because of this
+ * procedure, slapd never implicitly imports symbols from dynamic backends.
+ * This makes it unnecessary to tag various backend functions with the
+ * __declspec(dllimport) directive. This is because neither slapd nor
+ * any other external binary should ever be implicitly loading a backend
+ * dynamic module.
+ *
+ * Backends are supposed to be self-contained. However, it appears that
+ * back-meta DOES implicitly import symbols from back-ldap. This means
+ * that the __declspec(dllimport) directive should be marked on back-ldap
+ * functions (in its header files) if and only if we're compiling for
+ * windows AND back-ldap has been configured as dynamic AND back-meta
+ * is the client of back-ldap. When client is slapd, there is no effect
+ * since slapd does not implicitly import symbols.
+ *
+ * TODO(?): Currently, back-meta nor back-ldap is supported for Mingw32.
+ * Thus, there's no need to worry about this right now. This is something that
+ * may or may not have to be addressed in the future.
+ */
+
+/* LBER library */
+#if defined(_WIN32) && \
+    ((defined(LDAP_LIBS_DYNAMIC) && !defined(LBER_LIBRARY)) || \
+     (!defined(LDAP_LIBS_DYNAMIC) && defined(SLAPD_IMPORT)))
+#      define LBER_F(type)             extern __declspec(dllimport) type
+#      define LBER_V(type)             extern __declspec(dllimport) type
+#else
+#      define LBER_F(type)             extern type
+#      define LBER_V(type)             extern type
+#endif
+
+/* LDAP library */
+#if defined(_WIN32) && \
+    ((defined(LDAP_LIBS_DYNAMIC) && !defined(LDAP_LIBRARY)) || \
+     (!defined(LDAP_LIBS_DYNAMIC) && defined(SLAPD_IMPORT)))
+#      define LDAP_F(type)             extern __declspec(dllimport) type
+#      define LDAP_V(type)             extern __declspec(dllimport) type
+#else
+#      define LDAP_F(type)             extern type
+#      define LDAP_V(type)             extern type
+#endif
+
+/* AVL library */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+#      define LDAP_AVL_F(type)         extern __declspec(dllimport) type
+#      define LDAP_AVL_V(type)         extern __declspec(dllimport) type
+#else
+#      define LDAP_AVL_F(type)         extern type
+#      define LDAP_AVL_V(type)         extern type
+#endif
+
+/* LDBM library */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+#      define LDAP_LDBM_F(type)        extern __declspec(dllimport) type
+#      define LDAP_LDBM_V(type)        extern __declspec(dllimport) type
+#else
+#      define LDAP_LDBM_F(type)        extern type
+#      define LDAP_LDBM_V(type)        extern type
+#endif
+
+/* LDIF library */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+#      define LDAP_LDIF_F(type)        extern __declspec(dllimport) type
+#      define LDAP_LDIF_V(type)        extern __declspec(dllimport) type
+#else
+#      define LDAP_LDIF_F(type)        extern type
+#      define LDAP_LDIF_V(type)        extern type
+#endif
+
+/* LUNICODE library */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+#      define LDAP_LUNICODE_F(type)    extern __declspec(dllimport) type
+#      define LDAP_LUNICODE_V(type)    extern __declspec(dllimport) type
+#else
+#      define LDAP_LUNICODE_F(type)    extern type
+#      define LDAP_LUNICODE_V(type)    extern type
+#endif
+
+/* LUTIL library */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+#      define LDAP_LUTIL_F(type)       extern __declspec(dllimport) type
+#      define LDAP_LUTIL_V(type)       extern __declspec(dllimport) type
+#else
+#      define LDAP_LUTIL_F(type)       extern type
+#      define LDAP_LUTIL_V(type)       extern type
+#endif
+
+/* REWRITE library */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+#      define LDAP_REWRITE_F(type)     extern __declspec(dllimport) type
+#      define LDAP_REWRITE_V(type)     extern __declspec(dllimport) type
+#else
+#      define LDAP_REWRITE_F(type)     extern type
+#      define LDAP_REWRITE_V(type)     extern type
+#endif
+
+/* SLAPD (as a dynamic library exporting symbols) */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+#      define LDAP_SLAPD_F(type)       extern __declspec(dllimport) type
+#      define LDAP_SLAPD_V(type)       extern __declspec(dllimport) type
+#else
+#      define LDAP_SLAPD_F(type)       extern type
+#      define LDAP_SLAPD_V(type)       extern type
+#endif
+
+/*
+ * C library. Mingw32 links with the dynamic C run-time library by default,
+ * so the explicit definition of CSTATIC will keep dllimport from
+ * being defined, if desired.
+ *
+ * MSVC defines the _DLL macro when the compiler is invoked with /MD or /MDd,
+ * which means the resulting object code will be linked with the dynamic
+ * C run-time library.
+ *
+ * Technically, it shouldn't be necessary to redefine any functions that
+ * the headers for the C library should already contain. Nevertheless, this
+ * is here as a safe-guard.
+ *
+ * TODO: Determine if these macros ever get expanded for Windows. If not,
+ * the declspec expansion can probably be removed.
+ */
+#if (defined(__MINGW32__) && !defined(CSTATIC)) || \
+    (defined(_MSC_VER) && defined(_DLL))
+#      define LDAP_LIBC_F(type)        extern __declspec(dllimport) type
+#      define LDAP_LIBC_V(type)        extern __declspec(dllimport) type
+#else
+#      define LDAP_LIBC_F(type)        extern type
+#      define LDAP_LIBC_V(type)        extern type
+#endif
+
+#endif /* _LDAP_CDEFS_H */
index 5c2570ed6225a561d4ae4bc19048ee579027bcba..f7d1d9d944d4b85d75808d37bc271efbc21eab0c 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/ldap_int_thread.h b/include/ldap_int_thread.h
new file mode 100644 (file)
index 0000000..eb2d39c
--- /dev/null
@@ -0,0 +1,206 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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_int_thread.h - ldap internal thread wrappers header file */
+
+#ifndef _LDAP_INT_THREAD_H
+#define _LDAP_INT_THREAD_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_int_thread_t;
+typedef pthread_mutex_t                ldap_int_thread_mutex_t;
+typedef pthread_cond_t         ldap_int_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 LDAP_THREAD_HAVE_GETCONCURRENCY 1
+#endif
+
+#if defined( HAVE_PTHREAD_SETCONCURRENCY ) || \
+       defined( HAVE_THR_SETCONCURRENCY )
+#define LDAP_THREAD_HAVE_SETCONCURRENCY 1
+#endif
+
+#if 0 && defined( HAVE_PTHREAD_RWLOCK_DESTROY )
+#define LDAP_THREAD_HAVE_RDWR 1
+typedef pthread_rwlock_t ldap_pvt_thread_rdwr_t;
+#endif
+
+LDAP_END_DECL
+
+#elif defined ( HAVE_MACH_CTHREADS )
+/**********************************
+ *                                *
+ * definitions for Mach CThreads  *
+ *                                *
+ **********************************/
+
+#if defined( HAVE_MACH_CTHREADS_H )
+#      include <mach/cthreads.h>
+#elif defined( HAVE_CTHREAD_H
+#      include <cthreads.h>
+#endif
+
+LDAP_BEGIN_DECL
+
+typedef cthread_t              ldap_int_thread_t;
+typedef struct mutex           ldap_int_thread_mutex_t;
+typedef struct condition       ldap_int_thread_cond_t;
+
+LDAP_END_DECL
+
+#elif defined( HAVE_GNU_PTH )
+/***********************************
+ *                                 *
+ * thread definitions for GNU Pth  *
+ *                                 *
+ ***********************************/
+
+#define PTH_SYSCALL_SOFT 1
+#include <pth.h>
+
+LDAP_BEGIN_DECL
+
+typedef pth_t          ldap_int_thread_t;
+typedef pth_mutex_t    ldap_int_thread_mutex_t;
+typedef pth_cond_t     ldap_int_thread_cond_t;
+
+#if 0
+#define LDAP_THREAD_HAVE_RDWR 1
+typedef pth_rwlock_t ldap_pvt_thread_rdwr_t;
+#endif
+
+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_int_thread_t;
+typedef mutex_t                        ldap_int_thread_mutex_t;
+typedef cond_t                 ldap_int_thread_cond_t;
+
+#define HAVE_REENTRANT_FUNCTIONS 1
+
+#ifdef HAVE_THR_GETCONCURRENCY
+#define LDAP_THREAD_HAVE_GETCONCURRENCY 1
+#endif
+#ifdef HAVE_THR_SETCONCURRENCY
+#define LDAP_THREAD_HAVE_SETCONCURRENCY 1
+#endif
+
+LDAP_END_DECL
+
+#elif defined( HAVE_LWP )
+/*************************************
+ *                                   *
+ * thread definitions for SunOS LWP  *
+ *                                   *
+ *************************************/
+
+#include <lwp/lwp.h>
+#include <lwp/stackdep.h>
+#define LDAP_THREAD_HAVE_SLEEP 1
+
+LDAP_BEGIN_DECL
+
+typedef thread_t               ldap_int_thread_t;
+typedef mon_t                  ldap_int_thread_mutex_t;
+struct ldap_int_thread_lwp_cv {
+       int             lcv_created;
+       cv_t            lcv_cv;
+};
+typedef struct ldap_int_thread_lwp_cv ldap_int_thread_cond_t;
+
+#define HAVE_REENTRANT_FUNCTIONS 1
+
+LDAP_END_DECL
+
+#elif defined(HAVE_NT_THREADS)
+
+#include <process.h>
+#include <windows.h>
+
+LDAP_BEGIN_DECL
+
+typedef unsigned long  ldap_int_thread_t;
+typedef HANDLE ldap_int_thread_mutex_t;
+typedef HANDLE ldap_int_thread_cond_t;
+
+LDAP_END_DECL
+
+#else
+
+/***********************************
+ *                                 *
+ * thread definitions for no       *
+ * underlying library support      *
+ *                                 *
+ ***********************************/
+
+#ifndef NO_THREADS
+#define NO_THREADS 1
+#endif
+
+LDAP_BEGIN_DECL
+
+typedef int                    ldap_int_thread_t;
+typedef int                    ldap_int_thread_mutex_t;
+typedef int                    ldap_int_thread_cond_t;
+
+#define LDAP_THREAD_HAVE_TPOOL 1
+typedef int                    ldap_int_thread_pool_t;
+
+LDAP_END_DECL
+
+#endif /* no threads support */
+
+LDAP_BEGIN_DECL
+
+LDAP_F(int) ldap_int_thread_initialize LDAP_P(( void ));
+LDAP_F(int) ldap_int_thread_destroy LDAP_P(( void ));
+LDAP_F(int) ldap_int_thread_pool_startup ( void );
+LDAP_F(int) ldap_int_thread_pool_shutdown ( void );
+
+#ifndef LDAP_THREAD_HAVE_TPOOL
+typedef struct ldap_int_thread_pool_s * ldap_int_thread_pool_t;
+#endif
+
+LDAP_END_DECL
+
+#endif /* _LDAP_INT_THREAD_H */
index 1490fa87449f178ffb36bca35cb0eea810b0e6dd..4e38b45ab5edeb772b10312c37f636391b12ea4b 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 4150e417003d6170bf7e829e560658bec28bc5c9..6988c16c411a229ddfec4b77c330b10bb4b3817f 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 14e8c84524eb82a4353170bd07cb6c266c7f161a..cffebaa47c85da3fd212253d46784cd9e0d0b13c 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 78852f427aa275a9c93f925193c9e7b9161e7583..c7230470af7ec003a444cda01e85b3ee110bb130 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 2001-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 49078d832ce23aebcbd4ab5a64a0d398b9ee2837..fea70201845f7a083f7ecae4828756475ad97e02 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/ldap_utf8.h b/include/ldap_utf8.h
new file mode 100644 (file)
index 0000000..68d9560
--- /dev/null
@@ -0,0 +1,101 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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.
+ */
+/* $Novell: /ldap/src/cldap/include/ldap_utf8.h,v 1.3 2000/12/04 20:23:20 dsteck Exp $ */
+/******************************************************************************
+ * This notice applies to changes, created by or for Novell, Inc.,
+ * to preexisting works for which notices appear elsewhere in this file.
+ *
+ * Copyright (C) 2000 Novell, Inc. All Rights Reserved.
+ *
+ * THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
+ * USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO VERSION
+ * 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS AVAILABLE AT
+ * HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE" IN THE
+ * TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION OF THIS
+ * WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP PUBLIC
+ * LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT THE
+ * PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
+ ******************************************************************************/
+
+#ifndef _LDAP_UTF8_H
+#define _LDAP_UTF8_H
+
+#include <lber_types.h>        /* get ber_*_t */
+
+/*
+ * UTF-8 Utility Routines
+ */
+
+LDAP_BEGIN_DECL
+
+#define LDAP_UCS4_INVALID (0x80000000U)
+typedef ber_int_t ldap_ucs4_t;
+
+
+/* LDAP_MAX_UTF8_LEN is 3 or 6 depending on size of wchar_t */
+#define LDAP_MAX_UTF8_LEN  ( sizeof(wchar_t) * 3/2 )
+
+/* Unicode conversion routines  */
+LDAP_F( ldap_ucs4_t ) ldap_x_utf8_to_ucs4( LDAP_CONST char * p );
+LDAP_F( int ) ldap_x_ucs4_to_utf8( ldap_ucs4_t c, char *buf );
+
+
+/*
+ * Wide Char / UTF-8 Conversion Routines
+ */
+
+/* UTF-8 character to Wide Char */
+LDAP_F(int) ldap_x_utf8_to_wc LDAP_P((
+       wchar_t *wchar, LDAP_CONST char *utf8char ));
+
+/* UTF-8 string to Wide Char string */
+LDAP_F(int) ldap_x_utf8s_to_wcs LDAP_P((
+       wchar_t *wcstr, LDAP_CONST char *utf8str, size_t count ));
+
+/* Wide Char to UTF-8 character */
+LDAP_F(int) ldap_x_wc_to_utf8 LDAP_P((
+       char *utf8char, wchar_t wchar, size_t count ));
+
+/* Wide Char string to UTF-8 string */
+LDAP_F(int) ldap_x_wcs_to_utf8s LDAP_P((
+       char *utf8str, LDAP_CONST wchar_t *wcstr, size_t count ));
+
+/*
+ * MultiByte Char / UTF-8 Conversion Routines
+ */
+
+/* UTF-8 character to MultiByte character */
+LDAP_F(int) ldap_x_utf8_to_mb LDAP_P((
+       char *mbchar, LDAP_CONST char *utf8char,
+       int (*ldap_f_wctomb)( char *mbchar, wchar_t wchar )));
+
+/* UTF-8 string to MultiByte string */
+LDAP_F(int) ldap_x_utf8s_to_mbs LDAP_P((
+       char *mbstr, LDAP_CONST char *utf8str, size_t count,
+       size_t (*ldap_f_wcstombs)( char *mbstr,
+               LDAP_CONST wchar_t *wcstr, size_t count) ));
+
+/* MultiByte character to UTF-8 character */
+LDAP_F(int) ldap_x_mb_to_utf8 LDAP_P((
+       char *utf8char, LDAP_CONST char *mbchar, size_t mbsize,
+       int (*ldap_f_mbtowc)( wchar_t *wchar,
+               LDAP_CONST char *mbchar, size_t count) ));
+
+/* MultiByte string to UTF-8 string */
+LDAP_F(int) ldap_x_mbs_to_utf8s LDAP_P((
+       char *utf8str, LDAP_CONST char *mbstr, size_t count,
+       size_t (*ldap_f_mbstowcs)( wchar_t *wcstr,
+               LDAP_CONST char *mbstr, size_t count) ));
+
+LDAP_END_DECL
+
+#endif /* _LDAP_UTF8_H */
index 95bd55ffa7ca277a137e4bbc4e40792ab8ac46a0..9c92ac6e9679a23b6b37ff8270af2430f8cb8083 100644 (file)
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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.
+ */
 /* ldbm.h - ldap dbm compatibility routine header file */
 
 #ifndef _LDBM_H_
 #define _LDBM_H_
 
-#ifdef LDBM_USE_GDBM
+#include <ldap_cdefs.h>
+
+/* dummy DB_ENV for non Berkeley DB */
+#if !defined( LDBM_USE_DBBTREE ) && !defined( LDBM_USE_DBHASH )
+#  define DB_ENV void
+#endif
+
+#if defined( LDBM_USE_DBBTREE ) || defined( LDBM_USE_DBHASH )
 
 /*****************************************************************
  *                                                               *
- * use gdbm if possible                                          *
+ * use berkeley db btree or hash package                         *
  *                                                               *
  *****************************************************************/
+#include <sys/types.h>
+#include <limits.h>
+#include <fcntl.h>
 
-#include <gdbm.h>
+#ifdef HAVE_DB_185_H
+#      include <db_185.h>
+#else
+#      ifdef HAVE_DB1_DB_H
+#              include <db1/db.h>
+#      else
+#              include <db.h>
+#      endif
+#endif
 
-typedef datum          Datum;
+#ifndef DB_VERSION_MAJOR
+#  define DB_VERSION_MAJOR 1
+#endif
+#ifndef DB_VERSION_MINOR
+#  define DB_VERSION_MINOR 85
+#endif
+
+#if DB_VERSION_MAJOR >= 2
+#      define R_NOOVERWRITE DB_NOOVERWRITE
+#      ifndef DEFAULT_DB_PAGE_SIZE
+#              define DEFAULT_DB_PAGE_SIZE 4096
+#      endif
+#else
+#  define DB_ENV void
+#endif
 
-typedef GDBM_FILE      LDBM;
 
-extern gdbm_error      gdbm_errno;
+LDAP_BEGIN_DECL
+
+typedef DBT    Datum;
+#define dsize  size
+#define dptr   data
+
+typedef DB     *LDBM;
+
 
 /* for ldbm_open */
-#define LDBM_READER    GDBM_READER
-#define LDBM_WRITER    GDBM_WRITER
-#define LDBM_WRCREAT   GDBM_WRCREAT
-#define LDBM_NEWDB     GDBM_NEWDB
-#define LDBM_FAST      GDBM_FAST
+#if DB_VERSION_MAJOR >= 2
+typedef DBC    LDBMCursor;
+
+#      define LDBM_READER      DB_RDONLY
+#      define LDBM_WRITER      0x00000      /* hopefully */
+# if defined( HAVE_BERKELEY_DB_THREAD )
+#      define LDBM_WRCREAT     (DB_NOMMAP|DB_CREATE|DB_THREAD)
+#      define LDBM_NEWDB       (DB_TRUNCATE|DB_CREATE|DB_THREAD)
+# else
+#      define LDBM_WRCREAT     (DB_NOMMAP|DB_CREATE)
+#      define LDBM_NEWDB       (DB_TRUNCATE|DB_CREATE)
+# endif
+
+#else
+typedef void LDBMCursor;
+#      define LDBM_READER      O_RDONLY
+#      define LDBM_WRITER      O_RDWR
+#      define LDBM_WRCREAT     (O_RDWR|O_CREAT)
+#      define LDBM_NEWDB       (O_RDWR|O_TRUNC|O_CREAT)
+#endif
 
-#define LDBM_SUFFIX    ".gdbm"
+LDAP_END_DECL
+
+/* for ldbm_open */
+#define LDBM_NOSYNC    0
+#define LDBM_SYNC      0
+#define LDBM_LOCKING   0
+#define LDBM_NOLOCKING 0
 
 /* for ldbm_insert */
-#define LDBM_INSERT    GDBM_INSERT
-#define LDBM_REPLACE   GDBM_REPLACE
-#define LDBM_SYNC      0x80000000
+#define LDBM_INSERT    R_NOOVERWRITE
+#define LDBM_REPLACE   0
 
-#else /* end of gdbm */
+#ifdef LDBM_USE_DBBTREE
+#      define LDBM_ORDERED     1
+#      define LDBM_SUFFIX      ".dbb"
+#      define DB_TYPE          DB_BTREE
+#else
+#      define LDBM_SUFFIX      ".dbh"
+#      define DB_TYPE          DB_HASH
+#endif
 
-#ifdef LDBM_USE_DBHASH
+#elif defined( HAVE_GDBM )
 
 /*****************************************************************
  *                                                               *
- * use berkeley db hash package                                  *
+ * use gdbm if possible                                          *
  *                                                               *
  *****************************************************************/
 
-#include <sys/types.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <db.h>
+#include <gdbm.h>
 
-typedef DBT    Datum;
-#define dsize  size
-#define dptr   data
+LDAP_BEGIN_DECL
 
-typedef DB     *LDBM;
+typedef datum          Datum;
+typedef Datum LDBMCursor;
+typedef GDBM_FILE      LDBM;
 
-#define DB_TYPE                DB_HASH
+LDAP_END_DECL
 
 /* for ldbm_open */
-#define LDBM_READER    O_RDONLY
-#define LDBM_WRITER    O_RDWR
-#define LDBM_WRCREAT   (O_RDWR|O_CREAT)
-#define LDBM_NEWDB     (O_RDWR|O_TRUNC|O_CREAT)
-#define LDBM_FAST      0
+#define LDBM_READER    GDBM_READER
+#define LDBM_WRITER    GDBM_WRITER
+#define LDBM_WRCREAT   GDBM_WRCREAT
+#define LDBM_NEWDB     GDBM_NEWDB
 
-#define LDBM_SUFFIX    ".dbh"
+#ifdef GDBM_FAST
+#define LDBM_NOSYNC    GDBM_FAST
+#else
+#define LDBM_NOSYNC    0
+#endif
 
-/* for ldbm_insert */
-#define LDBM_INSERT    R_NOOVERWRITE
-#define LDBM_REPLACE   0
-#define LDBM_SYNC      0x80000000
+#ifdef GDBM_SYNC
+#define LDBM_SYNC      GDBM_SYNC
+#else
+#define LDBM_SYNC      0
+#endif
+
+#define LDBM_LOCKING   0
+#ifdef GDBM_NOLOCK
+#define LDBM_NOLOCKING GDBM_NOLOCK
+#else
+#define LDBM_NOLOCKING 0
+#endif
 
-extern int     errno;
+#define LDBM_SUFFIX    ".gdbm"
 
-#else /* end of db hash */
+/* for ldbm_insert */
+#define LDBM_INSERT    GDBM_INSERT
+#define LDBM_REPLACE   GDBM_REPLACE
 
-#ifdef LDBM_USE_DBBTREE
+#elif defined( HAVE_MDBM )
 
 /*****************************************************************
  *                                                               *
- * use berkeley db btree package                                 *
+ * use mdbm if possible                                          *
  *                                                               *
  *****************************************************************/
 
-#include <sys/types.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <db.h>
+#include <mdbm.h>
 
-typedef DBT    Datum;
-#define dsize  size
-#define dptr   data
+LDAP_BEGIN_DECL
 
-typedef DB     *LDBM;
+typedef datum          Datum;
+typedef int LDBMCursor;
+typedef MDBM           *LDBM;
 
-#define DB_TYPE                DB_BTREE
+LDAP_END_DECL
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
 /* for ldbm_open */
 #define LDBM_READER    O_RDONLY
 #define LDBM_WRITER    O_RDWR
 #define LDBM_WRCREAT   (O_RDWR|O_CREAT)
 #define LDBM_NEWDB     (O_RDWR|O_TRUNC|O_CREAT)
-#define LDBM_FAST      0
-
-#define LDBM_SUFFIX    ".dbb"
-#define LDBM_ORDERED   1
 
-/* for ldbm_insert */
-#define LDBM_INSERT    R_NOOVERWRITE
-#define LDBM_REPLACE   0
-#define LDBM_SYNC      0x80000000
+#define LDBM_SYNC      0
+#define LDBM_NOSYNC    0
+#define LDBM_LOCKING   0
+#define LDBM_NOLOCKING 0
 
-extern int     errno;
+#define LDBM_SUFFIX    ".mdbm"
 
-#else /* end of db btree */
+/* for ldbm_insert */
+#define LDBM_INSERT    MDBM_INSERT
+#define LDBM_REPLACE   MDBM_REPLACE
 
-#ifdef LDBM_USE_NDBM
+#elif defined( HAVE_NDBM )
 
 /*****************************************************************
  *                                                               *
@@ -123,43 +208,67 @@ extern int        errno;
  *****************************************************************/
 
 #include <ndbm.h>
-#ifndef O_RDONLY
+
+#ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
 
-typedef datum  Datum;
+LDAP_BEGIN_DECL
 
+typedef datum  Datum;
+typedef int LDBMCursor;
 typedef DBM    *LDBM;
 
+LDAP_END_DECL
+
 /* for ldbm_open */
 #define LDBM_READER    O_RDONLY
 #define LDBM_WRITER    O_WRONLY
 #define LDBM_WRCREAT   (O_RDWR|O_CREAT)
 #define LDBM_NEWDB     (O_RDWR|O_TRUNC|O_CREAT)
-#define LDBM_FAST      0
+
+#define LDBM_NOSYNC    0
+#define LDBM_SYNC      0
+#define LDBM_NOLOCK    0
+#define LDBM_SYNC      0
 
 #define LDBM_SUFFIX    ".ndbm"
 
 /* for ldbm_insert */
 #define LDBM_INSERT    DBM_INSERT
 #define LDBM_REPLACE   DBM_REPLACE
-#define LDBM_SYNC      0
 
-#endif /* ndbm */
-#endif /* db hash */
-#endif /* db btree */
-#endif /* gdbm */
-
-LDBM   ldbm_open( char *name, int rw, int mode, int dbcachesize );
-void   ldbm_close( LDBM ldbm );
-void   ldbm_sync( LDBM ldbm );
-void   ldbm_datum_free( LDBM ldbm, Datum data );
-Datum  ldbm_datum_dup( LDBM ldbm, Datum data );
-Datum  ldbm_fetch( LDBM ldbm, Datum key );
-int    ldbm_store( LDBM ldbm, Datum key, Datum data, int flags );
-int    ldbm_delete( LDBM ldbm, Datum key );
-Datum  ldbm_firstkey( LDBM ldbm );
-Datum  ldbm_nextkey( LDBM ldbm, Datum key );
-int    ldbm_errno( LDBM ldbm );
+#endif
+
+LDAP_BEGIN_DECL
+
+LDAP_LDBM_F (int) ldbm_initialize( const char * );
+LDAP_LDBM_F (int) ldbm_shutdown( void );
+
+LDAP_LDBM_F (DB_ENV*) ldbm_initialize_env(const char *, int dbcachesize, int *envdirok);
+LDAP_LDBM_F (void) ldbm_shutdown_env(DB_ENV *);
+
+LDAP_LDBM_F (int) ldbm_errno( LDBM ldbm );
+LDAP_LDBM_F (LDBM) ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize );
+LDAP_LDBM_F (void) ldbm_close( LDBM ldbm );
+LDAP_LDBM_F (void) ldbm_sync( LDBM ldbm );
+LDAP_LDBM_F (void) ldbm_datum_free( LDBM ldbm, Datum data );
+LDAP_LDBM_F (Datum) ldbm_datum_dup( LDBM ldbm, Datum data );
+LDAP_LDBM_F (Datum) ldbm_fetch( LDBM ldbm, Datum key );
+LDAP_LDBM_F (int) ldbm_store( LDBM ldbm, Datum key, Datum data, int flags );
+LDAP_LDBM_F (int) ldbm_delete( LDBM ldbm, Datum key );
+
+LDAP_LDBM_F (Datum) ldbm_firstkey( LDBM ldbm, LDBMCursor **cursor );
+LDAP_LDBM_F (Datum) ldbm_nextkey( LDBM ldbm, Datum key, LDBMCursor *cursor );
+
+/* initialization of Datum structures */
+#if defined( HAVE_BERKELEY_DB ) && (DB_VERSION_MAJOR >= 2)
+       LDAP_LDBM_F (void *) ldbm_malloc( size_t size );
+#   define ldbm_datum_init(d) ((void)memset(&(d), '\0', sizeof(Datum)))
+#else
+#   define ldbm_datum_init(d) ((void)0)
+#endif  /* HAVE_BERKELEY_DB */
+
+LDAP_END_DECL
 
 #endif /* _ldbm_h_ */
index dd2b339193ec723426f90939b17008dd723ae97c..799bfd1b0bb3d77c5924217166ebc06aac1a0d67 100644 (file)
@@ -1,4 +1,15 @@
+/* $OpenLDAP$ */
 /*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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) 1996 Regents of the University of Michigan.
  * All rights reserved.
  *
 #ifndef _LDIF_H
 #define _LDIF_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
 
-#define LINE_WIDTH      76      /* maximum length of LDIF lines */
+/* This is NOT a bogus extern declaration (unlike ldap_debug) */
+LDAP_LDIF_V (int) ldif_debug;
+
+#define LDIF_LINE_WIDTH      76      /* maximum length of LDIF lines */
 
 /*
  * Macro to calculate maximum number of bytes that the base64 equivalent
- * of an item that is "vlen" bytes long will take up.  Base64 encoding
+ * of an item that is "len" bytes long will take up.  Base64 encoding
  * uses one byte for every six bits in the value plus up to two pad bytes.
  */
-#define LDIF_BASE64_LEN(vlen)  (((vlen) * 4 / 3 ) + 3)
+#define LDIF_BASE64_LEN(len)   (((len) * 4 / 3 ) + 3)
 
 /*
  * Macro to calculate maximum size that an LDIF-encoded type (length
@@ -32,25 +46,64 @@ extern "C" {
  * first newline + base64 value + continued lines.  Each continued line
  * needs room for a newline and a leading space character.
  */
-#define LDIF_SIZE_NEEDED(tlen,vlen) \
-    ((tlen) + 4 + LDIF_BASE64_LEN(vlen) \
-    + ((LDIF_BASE64_LEN(vlen) + tlen + 3) / LINE_WIDTH * 2 ))
-
-
-#ifdef NEEDPROTOS
-int str_parse_line( char *line, char **type, char **value, int *vlen);
-char * str_getline( char **next );
-void put_type_and_value( char **out, char *t, char *val, int vlen );
-char *ldif_type_and_value( char *type, char *val, int vlen );
-#else /* NEEDPROTOS */
-int str_parse_line();
-char * str_getline();
-void put_type_and_value();
-char *ldif_type_and_value();
-#endif /* NEEDPROTOS */
-
-#ifdef __cplusplus
-}
-#endif
+#define LDIF_SIZE_NEEDED(nlen,vlen) \
+    ((nlen) + 4 + LDIF_BASE64_LEN(vlen) \
+    + ((LDIF_BASE64_LEN(vlen) + (nlen) + 3) / LDIF_LINE_WIDTH * 2 ))
+
+LDAP_LDIF_F( int )
+ldif_parse_line LDAP_P((
+       LDAP_CONST char *line,
+       char **name,
+       char **value,
+       ber_len_t *vlen ));
+
+LDAP_LDIF_F( int )
+ldif_fetch_url LDAP_P((
+       LDAP_CONST char *line,
+       char **value,
+       ber_len_t *vlen ));
+
+LDAP_LDIF_F( char * )
+ldif_getline LDAP_P(( char **next ));
+
+LDAP_LDIF_F( int )
+ldif_read_record LDAP_P((
+       FILE *fp,
+       int *lineno,
+       char **bufp,
+       int *buflen ));
+
+
+#define LDIF_PUT_NOVALUE       0x0000  /* no value */
+#define LDIF_PUT_VALUE         0x0001  /* value w/ auto detection */
+#define LDIF_PUT_TEXT          0x0002  /* assume text */
+#define        LDIF_PUT_BINARY         0x0004  /* assume binary (convert to base64) */
+#define LDIF_PUT_B64           0x0008  /* pre-converted base64 value */
+
+#define LDIF_PUT_COMMENT       0x0010  /* comment */
+#define LDIF_PUT_URL           0x0020  /* url */
+#define LDIF_PUT_SEP           0x0040  /* separator */
+
+LDAP_LDIF_F( void )
+ldif_sput LDAP_P((
+       char **out,
+       int type,
+       LDAP_CONST char *name,
+       LDAP_CONST char *val,
+       ber_len_t vlen ));
+
+LDAP_LDIF_F( char * )
+ldif_put LDAP_P((
+       int type,
+       LDAP_CONST char *name,
+       LDAP_CONST char *val,
+       ber_len_t vlen ));
+
+LDAP_LDIF_F( int )
+ldif_is_not_printable LDAP_P((
+       LDAP_CONST char *val,
+       ber_len_t vlen ));
+
+LDAP_END_DECL
 
 #endif /* _LDIF_H */
index d5f334f433ba309a9f295260c2c29dc6b96378a3..ae629eb1a62b5d4987623ded6dbb09b384f09a3f 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/lutil_hash.h b/include/lutil_hash.h
new file mode 100644 (file)
index 0000000..b17d577
--- /dev/null
@@ -0,0 +1,47 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 hash.c for explanation and copyright information.  */
+
+#ifndef _LUTIL_HASH_H_
+#define _LUTIL_HASH_H_
+
+#include <lber_types.h>
+
+LDAP_BEGIN_DECL
+
+#define LUTIL_HASH_BYTES 4
+
+struct lutil_HASHContext {
+       ber_uint_t hash;
+};
+
+LDAP_LUTIL_F( void )
+lutil_HASHInit LDAP_P((
+       struct lutil_HASHContext *context));
+
+LDAP_LUTIL_F( void )
+lutil_HASHUpdate LDAP_P((
+       struct lutil_HASHContext *context,
+       unsigned char const *buf,
+       ber_len_t len));
+
+LDAP_LUTIL_F( void )
+lutil_HASHFinal LDAP_P((
+       unsigned char digest[LUTIL_HASH_BYTES],
+       struct lutil_HASHContext *context));
+
+typedef struct lutil_HASHContext lutil_HASH_CTX;
+
+LDAP_END_DECL
+
+#endif /* _LUTIL_HASH_H_ */
diff --git a/include/lutil_ldap.h b/include/lutil_ldap.h
new file mode 100644 (file)
index 0000000..a2ade22
--- /dev/null
@@ -0,0 +1,40 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 _LUTIL_LDAP_H
+#define _LUTIL_LDAP_H 1
+
+#include <ldap_cdefs.h>
+#include <lber_types.h>
+
+/*
+ * Include file for lutil LDAP routines
+ */
+
+LDAP_BEGIN_DECL
+
+LDAP_LUTIL_F( void * )
+lutil_sasl_defaults LDAP_P((
+       LDAP *ld,
+       char *mech,
+       char *realm,
+       char *authcid,
+       char *passwd,
+       char *authzid ));
+
+LDAP_LUTIL_F( int )
+lutil_sasl_interact LDAP_P((
+       LDAP *ld, unsigned flags, void *defaults, void *p ));
+
+LDAP_END_DECL
+
+#endif /* _LUTIL_LDAP_H */
diff --git a/include/lutil_lockf.h b/include/lutil_lockf.h
new file mode 100644 (file)
index 0000000..e033026
--- /dev/null
@@ -0,0 +1,31 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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_LUTIL_F( int )
+lutil_lockf LDAP_P(( int fd ));
+
+LDAP_LUTIL_F( int )
+lutil_unlockf LDAP_P(( int fd ));
+
+LDAP_END_DECL
+
+#endif /* _LUTIL_LOCKF_H_ */
diff --git a/include/lutil_md5.h b/include/lutil_md5.h
new file mode 100644 (file)
index 0000000..bb20389
--- /dev/null
@@ -0,0 +1,63 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 <lber_types.h>
+
+LDAP_BEGIN_DECL
+
+/* Unlike previous versions of this code, ber_int_t 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.  */
+
+#define LUTIL_MD5_BYTES 16
+
+struct lutil_MD5Context {
+       ber_uint_t buf[4];
+       ber_uint_t bits[2];
+       unsigned char in[64];
+};
+
+LDAP_LUTIL_F( void )
+lutil_MD5Init LDAP_P((
+       struct lutil_MD5Context *context));
+
+LDAP_LUTIL_F( void )
+lutil_MD5Update LDAP_P((
+       struct lutil_MD5Context *context,
+       unsigned char const *buf,
+       ber_len_t len));
+
+LDAP_LUTIL_F( void )
+lutil_MD5Final LDAP_P((
+       unsigned char digest[16],
+       struct lutil_MD5Context *context));
+
+LDAP_LUTIL_F( void )
+lutil_MD5Transform LDAP_P((
+       ber_uint_t 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_ */
diff --git a/include/lutil_sha1.h b/include/lutil_sha1.h
new file mode 100644 (file)
index 0000000..a766756
--- /dev/null
@@ -0,0 +1,74 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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>
+
+#ifdef AC_INT4_TYPE
+
+LDAP_BEGIN_DECL
+
+
+/*
+ * SHA-1 in C
+ * By Steve Reid <steve@edmweb.com>
+ */
+#define LUTIL_SHA1_BYTES 20
+
+/* This code assumes char are 8-bits and uint32 are 32-bits */
+typedef ac_uint4 uint32;
+
+typedef struct {
+    uint32 state[5];
+    uint32 count[2];
+    unsigned char buffer[64];
+} lutil_SHA1_CTX;
+
+LDAP_LUTIL_F( void )
+lutil_SHA1Transform
+       LDAP_P((uint32 state[5], const unsigned char buffer[64]));
+
+LDAP_LUTIL_F( void  )
+lutil_SHA1Init
+       LDAP_P((lutil_SHA1_CTX *context));
+
+LDAP_LUTIL_F( void  )
+lutil_SHA1Update
+       LDAP_P((lutil_SHA1_CTX *context, const unsigned char *data, uint32 len));
+
+LDAP_LUTIL_F( void  )
+lutil_SHA1Final
+       LDAP_P((unsigned char digest[20], lutil_SHA1_CTX *context));
+
+LDAP_LUTIL_F( char * )
+lutil_SHA1End
+       LDAP_P((lutil_SHA1_CTX *, char *));
+
+LDAP_LUTIL_F( char * )
+lutil_SHA1File
+       LDAP_P((char *, char *));
+
+LDAP_LUTIL_F( char * )
+lutil_SHA1Data
+       LDAP_P((const unsigned char *, size_t, char *));
+
+LDAP_END_DECL
+
+#endif /* AC_INT4_TYPE */
+
+#endif /* _LUTIL_SHA1_H_ */
index de12f095bbcaead6cc53ddbb1f7604ceb0cd5e5f..83d03f3ab8cd2c3d39833173edd502404cdd1985 100644 (file)
@@ -1,6 +1,6 @@
 /* include/portable.h.in.  Generated automatically from configure.in by autoheader.  */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/setup.mak b/include/setup.mak
new file mode 100644 (file)
index 0000000..1a4c8de
--- /dev/null
@@ -0,0 +1,20 @@
+# $OpenLDAP$
+#
+# Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+#
+
+.SUFFIXES: .nt
+
+.nt.h:
+       copy $*.nt $*.h
+
+all: setup.txt
+
+setup.txt: lber_types.h ldap_config.h ldap_features.h portable.h setup.mak
+       copy setup.mak setup.txt
+
+lber_types.h: lber_types.nt
+ldap_config.h: ldap_config.nt
+ldap_features.h: ldap_features.nt
+portable.h: portable.nt
index 9be67fa417304543997abb77282a833fcd71a857..98c4a4b811b37e32c9928b7dff82456204b6f93f 100644 (file)
@@ -1,4 +1,15 @@
+/* $OpenLDAP$ */
 /*
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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.
  *
index 28ab9116e21f5ab9caf0f1bdf3ed45228fcc60aa..b344a6b7b708423db096228e0a6e3c24e5f50e0e 100644 (file)
@@ -1,5 +1,5 @@
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
 ## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 ##
 ## Libraries Makefile for OpenLDAP
index e29ed051ae7e2d02bdfc689746c0c2887321c3b9..440c37095379ae36ea2aa880920f75af7e0d1421 100644 (file)
@@ -1,5 +1,5 @@
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
 ## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 ##
 ## LIBLBER
diff --git a/libraries/liblber/assert.c b/libraries/liblber/assert.c
new file mode 100644 (file)
index 0000000..0f420ac
--- /dev/null
@@ -0,0 +1,36 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1999-2003 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.
+ */
+
+#include "portable.h"
+
+#ifdef LDAP_NEED_ASSERT
+
+#include <stdio.h>
+
+/*
+ * helper for our private assert() macro
+ *
+ * note: if assert() doesn't exist, like abort() or raise() won't either.
+ * could use kill() but that might be problematic.  I'll just ignore this
+ * issue for now.
+ */
+
+void
+ber_pvt_assert( const char *file, int line, const char *test )
+{
+       fprintf(stderr,
+               "Assertion failed: %s, file %s, line %d\n",
+                       test, file, line);
+
+       abort();
+}
+
+#endif
index 0535603b0c39df3cb37cb59e2a7c38b526e5c7ae..5ba264ae6f559cde2f95714fc4b22648643e9eb6 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 4d354513c33cd3ac01b420718b4f2077763deb28..02f439d87d090f807a3273c80617f97016884c40 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index d1afb510a818e9c760dcadeb38ad084a6033d1ce..33f33b4c6d5efb2ad252ef1fe949fb714b15efa7 100644 (file)
@@ -1,7 +1,7 @@
 /* decode.c - ber input decoding routines */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Portions
index 6847e1539c590ff4ced5a382b6b987df60a289b6..387bf6dcc18f40e9f2eaf123c60733434a2c6727 100644 (file)
@@ -1,7 +1,7 @@
 /* dtest.c - lber decoding test program */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Portions
index fefad6d3ecc6061850a2a800153b940e22118032..8c11027c4740d2f8b2b7384896f731843b88be8f 100644 (file)
@@ -1,7 +1,7 @@
 /* Encode.c - ber output encoding routines */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Portions
index 21d13d4a2519035e8e0fbf3a29103f2d24ef28c6..25db4cdc5d66aa100c47d2201ad94ca15967ed39 100644 (file)
@@ -1,7 +1,7 @@
 /* test.c - lber encoding test program */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Portions
index 1ad58fae79ef25bf346cdef75a69a5f45c2040c4..8dedefbb56b07ce89c2523262c4b366c29bb1b37 100644 (file)
@@ -1,5 +1,10 @@
 /* idtest.c - ber decoding test program using isode libraries */
+/* $OpenLDAP$ */
 /*
+ * Copyright 1998-2003 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 <ac/stdlib.h>
+
+#ifdef HAVE_PSAP_H
 #include <psap.h>
 #include <quipu/attr.h>
+#endif
 
-static usage( char *name )
-{
-       fprintf( stderr, "usage: %s\n", name );
-}
-
+int
 main( int argc, char **argv )
 {
+#ifdef HAVE_PSAP_H
        PE      pe;
        PS      psin, psout, pserr;
 
        /* read the pe from standard in */
        if ( (psin = ps_alloc( std_open )) == NULLPS ) {
                perror( "ps_alloc" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
        if ( std_setup( psin, stdin ) == NOTOK ) {
                perror( "std_setup" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
        /* write the pe to standard out */
        if ( (psout = ps_alloc( std_open )) == NULLPS ) {
                perror( "ps_alloc" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
        if ( std_setup( psout, stdout ) == NOTOK ) {
                perror( "std_setup" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
        /* pretty print it to standard error */
        if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
                perror( "ps_alloc" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
        if ( std_setup( pserr, stderr ) == NOTOK ) {
                perror( "std_setup" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
 
        while ( (pe = ps2pe( psin )) != NULLPE ) {
@@ -58,5 +67,9 @@ main( int argc, char **argv )
                pe2ps( psout, pe );
        }
 
-       exit( 0 );
+       exit( EXIT_SUCCESS );
+#else
+       fprintf(stderr, "requires ISODE X.500 distribution.\n");
+       return( EXIT_FAILURE );
+#endif
 }
index 1d6ad83ba3a2bb841539d4910cd1f5c9b08a2ecb..9f7409544a3929ba4369ccb73d5e2293fade1f51 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Portions
index 077f7e32820340fe83bf91b6ad4bbca371da1e9a..5b90650868ba19b1f64f7813d2f3e7144b38c6f8 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #include "portable.h"
diff --git a/libraries/liblber/nt_err.c b/libraries/liblber/nt_err.c
new file mode 100644 (file)
index 0000000..7ae2f4f
--- /dev/null
@@ -0,0 +1,87 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+#include "portable.h"
+
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#elif HAVE_WINSOCK
+#include <winsock.h>
+#endif /* HAVE_WINSOCK(2) */
+
+#define LBER_RETSTR( x ) case x: return #x;
+
+char *ber_pvt_wsa_err2string( int err )
+{
+       switch( err )
+       {
+               LBER_RETSTR( WSAEINTR )
+               LBER_RETSTR( WSAEBADF )
+               LBER_RETSTR( WSAEACCES )
+               LBER_RETSTR( WSAEFAULT )
+               LBER_RETSTR( WSAEINVAL )
+               LBER_RETSTR( WSAEMFILE )
+               LBER_RETSTR( WSAEWOULDBLOCK )
+               LBER_RETSTR( WSAEINPROGRESS )
+               LBER_RETSTR( WSAEALREADY )
+               LBER_RETSTR( WSAENOTSOCK )
+               LBER_RETSTR( WSAEDESTADDRREQ )
+               LBER_RETSTR( WSAEMSGSIZE )
+               LBER_RETSTR( WSAEPROTOTYPE )
+               LBER_RETSTR( WSAENOPROTOOPT )
+               LBER_RETSTR( WSAEPROTONOSUPPORT )
+               LBER_RETSTR( WSAESOCKTNOSUPPORT )
+               LBER_RETSTR( WSAEOPNOTSUPP )
+               LBER_RETSTR( WSAEPFNOSUPPORT )
+               LBER_RETSTR( WSAEAFNOSUPPORT )
+               LBER_RETSTR( WSAEADDRINUSE )
+               LBER_RETSTR( WSAEADDRNOTAVAIL )
+               LBER_RETSTR( WSAENETDOWN )
+               LBER_RETSTR( WSAENETUNREACH )
+               LBER_RETSTR( WSAENETRESET )
+               LBER_RETSTR( WSAECONNABORTED )
+               LBER_RETSTR( WSAECONNRESET )
+               LBER_RETSTR( WSAENOBUFS )
+               LBER_RETSTR( WSAEISCONN )
+               LBER_RETSTR( WSAENOTCONN )
+               LBER_RETSTR( WSAESHUTDOWN )
+               LBER_RETSTR( WSAETOOMANYREFS )
+               LBER_RETSTR( WSAETIMEDOUT )
+               LBER_RETSTR( WSAECONNREFUSED )
+               LBER_RETSTR( WSAELOOP )
+               LBER_RETSTR( WSAENAMETOOLONG )
+               LBER_RETSTR( WSAEHOSTDOWN )
+               LBER_RETSTR( WSAEHOSTUNREACH )
+               LBER_RETSTR( WSAENOTEMPTY )
+               LBER_RETSTR( WSAEPROCLIM )
+               LBER_RETSTR( WSAEUSERS )
+               LBER_RETSTR( WSAEDQUOT )
+               LBER_RETSTR( WSAESTALE )
+               LBER_RETSTR( WSAEREMOTE )
+               LBER_RETSTR( WSASYSNOTREADY )
+               LBER_RETSTR( WSAVERNOTSUPPORTED )
+               LBER_RETSTR( WSANOTINITIALISED )
+               LBER_RETSTR( WSAEDISCON )
+
+#ifdef HAVE_WINSOCK2
+               LBER_RETSTR( WSAENOMORE )
+               LBER_RETSTR( WSAECANCELLED )
+               LBER_RETSTR( WSAEINVALIDPROCTABLE )
+               LBER_RETSTR( WSAEINVALIDPROVIDER )
+               LBER_RETSTR( WSASYSCALLFAILURE )
+               LBER_RETSTR( WSASERVICE_NOT_FOUND )
+               LBER_RETSTR( WSATYPE_NOT_FOUND )
+               LBER_RETSTR( WSA_E_NO_MORE )
+               LBER_RETSTR( WSA_E_CANCELLED )
+               LBER_RETSTR( WSAEREFUSED )
+#endif /* HAVE_WINSOCK2        */
+
+               LBER_RETSTR( WSAHOST_NOT_FOUND )
+               LBER_RETSTR( WSATRY_AGAIN )
+               LBER_RETSTR( WSANO_RECOVERY )
+               LBER_RETSTR( WSANO_DATA )
+       }
+       return "unknown WSA error";
+}
\ No newline at end of file
diff --git a/libraries/liblber/options.c b/libraries/liblber/options.c
new file mode 100644 (file)
index 0000000..4ecee64
--- /dev/null
@@ -0,0 +1,214 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 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/stdarg.h>
+#include "lber-int.h"
+
+struct lber_options ber_int_options = {
+       LBER_UNINITIALIZED, 0, 0 };
+
+int
+ber_get_option(
+       void    *item,
+       int             option,
+       void    *outvalue)
+{
+       const BerElement *ber;
+       const Sockbuf *sb;
+
+       ber_int_options.lbo_valid = LBER_INITIALIZED;
+
+       if(outvalue == NULL) {
+               /* no place to get to */
+               ber_errno = LBER_ERROR_PARAM;
+               return LBER_OPT_ERROR;
+       }
+
+       if(item == NULL) {
+               if(option == LBER_OPT_BER_DEBUG) {
+                       * (int *) outvalue = ber_int_debug;
+                       return LBER_OPT_SUCCESS;
+               } else if(option == LBER_OPT_MEMORY_INUSE) {
+                       /* The memory inuse is a global variable on kernal implementations.
+                        * This means that memory debug is shared by all LDAP processes
+                        * so for this variable to have much meaning, only one LDAP process
+                        * should be running and memory inuse should be initialized to zero
+                        * using the lber_set_option() function during startup.
+                        * The counter is not accurate for multithreaded ldap applications.
+                        */
+#ifdef LDAP_MEMORY_DEBUG
+                       * (int *) outvalue = ber_int_options.lbo_meminuse;
+                       return LBER_OPT_SUCCESS;
+#else
+                       return LBER_OPT_ERROR;
+#endif
+               } else if(option == LBER_OPT_LOG_PRINT_FILE) {
+                       *((FILE**)outvalue) = (FILE*)ber_pvt_err_file;
+                       return LBER_OPT_SUCCESS;
+               }
+
+               ber_errno = LBER_ERROR_PARAM;
+               return LBER_OPT_ERROR;
+       }
+
+       ber = item;
+       sb = item;
+
+       switch(option) {
+       case LBER_OPT_BER_OPTIONS:
+               assert( LBER_VALID( ber ) );
+               * (int *) outvalue = ber->ber_options;
+               return LBER_OPT_SUCCESS;
+
+       case LBER_OPT_BER_DEBUG:
+               assert( LBER_VALID( ber ) );
+               * (int *) outvalue = ber->ber_debug;
+               return LBER_OPT_SUCCESS;
+
+       case LBER_OPT_BER_REMAINING_BYTES:
+               assert( LBER_VALID( ber ) );
+               *((ber_len_t *) outvalue) = ber_pvt_ber_remaining(ber);
+               return LBER_OPT_SUCCESS;
+
+       case LBER_OPT_BER_TOTAL_BYTES:
+               assert( LBER_VALID( ber ) );
+               *((ber_len_t *) outvalue) = ber_pvt_ber_total(ber);
+               return LBER_OPT_SUCCESS;
+
+       case LBER_OPT_BER_BYTES_TO_WRITE:
+               assert( LBER_VALID( ber ) );
+               *((ber_len_t *) outvalue) = ber_pvt_ber_write(ber);
+               return LBER_OPT_SUCCESS;
+
+       default:
+               /* bad param */
+               ber_errno = LBER_ERROR_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 ))
+               {
+                       ber_errno = LBER_ERROR_PARAM;
+                       return LBER_OPT_ERROR;
+               }
+
+               ber_int_memory_fns = (BerMemoryFunctions *)
+                       (*(f->bmf_malloc))(sizeof(BerMemoryFunctions));
+
+               if ( ber_int_memory_fns == NULL ) {
+                       ber_errno = LBER_ERROR_MEMORY;
+                       return LBER_OPT_ERROR;
+               }
+
+               AC_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 */
+               ber_errno = LBER_ERROR_PARAM;
+               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;
+               } else if(option == LBER_OPT_LOG_PRINT_FILE) {
+                       ber_pvt_err_file = (void *) invalue;
+                       return LBER_OPT_SUCCESS;
+               } else if(option == LBER_OPT_MEMORY_INUSE) {
+                       /* The memory inuse is a global variable on kernal implementations.
+                        * This means that memory debug is shared by all LDAP processes
+                        * so for this variable to have much meaning, only one LDAP process
+                        * should be running and memory inuse should be initialized to zero
+                        * using the lber_set_option() function during startup.
+                        * The counter is not accurate for multithreaded applications.
+                        */
+#ifdef LDAP_MEMORY_DEBUG
+                       ber_int_options.lbo_meminuse = * (int *) invalue;
+                       return LBER_OPT_SUCCESS;
+#else
+                       return LBER_OPT_ERROR;
+#endif
+               } else if(option == LBER_OPT_LOG_PROC) {
+                       ber_int_log_proc = (BER_LOG_FN)invalue;
+               }
+
+               ber_errno = LBER_ERROR_PARAM;
+               return LBER_OPT_ERROR;
+       }
+
+       ber = item;
+       sb = item;
+
+       switch(option) {
+       case LBER_OPT_BER_OPTIONS:
+               assert( LBER_VALID( ber ) );
+               ber->ber_options = * (const int *) invalue;
+               return LBER_OPT_SUCCESS;
+
+       case LBER_OPT_BER_DEBUG:
+               assert( LBER_VALID( ber ) );
+               ber->ber_debug = * (const int *) invalue;
+               return LBER_OPT_SUCCESS;
+
+       case LBER_OPT_BER_REMAINING_BYTES:
+               assert( LBER_VALID( ber ) );
+               ber->ber_end = &ber->ber_ptr[* (const ber_len_t *) invalue];
+               return LBER_OPT_SUCCESS;
+
+       case LBER_OPT_BER_TOTAL_BYTES:
+               assert( LBER_VALID( ber ) );
+               ber->ber_end = &ber->ber_buf[* (const ber_len_t *) invalue];
+               return LBER_OPT_SUCCESS;
+
+       case LBER_OPT_BER_BYTES_TO_WRITE:
+               assert( LBER_VALID( ber ) );
+               ber->ber_ptr = &ber->ber_buf[* (const ber_len_t *) invalue];
+               return LBER_OPT_SUCCESS;
+
+       default:
+               /* bad param */
+               ber_errno = LBER_ERROR_PARAM;
+               break;
+       }
+
+       return LBER_OPT_ERROR;
+}
index 7fa6e85321340b19feb8a4601328e050dc1c52b7..62af5e3690fa7e86a3eb6ccce3015e3d88df150b 100644 (file)
@@ -1,7 +1,7 @@
 /* sockbuf.c - i/o routines with support for adding i/o layers. */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 4dd47535b6cbce6f0fae43e2230d498a59ce21f0..99e0da4e11fbd0f22e7fd3f427a3b83b47f4c5ca 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2002-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 04397a275edb9f28d8e04a68c288ca75adfc5024..aa3f9d5885da9373cc8a7a03e148de61f0ef43ef 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 20a987e97734bb7d3725a3f8332721be894f051a..7ce74dd97a27a259c7ba58eb3c4b43fce40c16ba 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index a0fc4174e6cb133d41399606c6835db21a1fa5d6..b5fafc593862ae316b984c62797f44ff81aaab93 100644 (file)
@@ -1,38 +1,35 @@
+/* $OpenLDAP$ */
 /*
+ * Copyright 1998-2003 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/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;
 
@@ -51,6 +48,9 @@ ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e )
 void
 ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e )
 {
+       assert( list != NULL );
+       assert( e != NULL );
+
        e->lm_chain = *list;
        *list = e;
 }
diff --git a/libraries/libldap/apitest.c b/libraries/libldap/apitest.c
new file mode 100644 (file)
index 0000000..ca41a78
--- /dev/null
@@ -0,0 +1,234 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * OpenLDAP API Test
+ *     Written by: Kurt Zeilenga
+ *
+ * This program is designed to test API features of implementations
+ * of the IETF draft specifications.
+ *
+ */
+#include "portable.h"
+
+#include <ac/stdlib.h>
+
+#include <stdio.h>
+
+#include <ldap.h>
+
+int
+main(int argc, char **argv)
+{
+       LDAPAPIInfo api;
+       int ival;
+       char *sval;
+
+       printf("Compile time API Information\n");
+
+#ifdef LDAP_API_INFO_VERSION
+       api.ldapai_info_version = LDAP_API_INFO_VERSION;
+       printf("  API Info version:  %d\n", (int) api.ldapai_info_version);
+#else
+       api.ldapai_info_version = 1;
+       printf("  API Info version:  unknown\n");
+#endif
+
+#ifdef LDAP_FEATURE_INFO_VERSION
+       printf("  Feature Info version:  %d\n", (int) LDAP_FEATURE_INFO_VERSION);
+#else
+       printf("  Feature Info version:  unknown\n");
+       api.ldapai_info_version = 1;
+#endif
+
+#ifdef LDAP_API_VERSION
+       printf("  API version:       %d\n", (int) LDAP_API_VERSION);
+#else
+       printf("  API version:       unknown\n");
+#endif
+
+#ifdef LDAP_VERSION
+       printf("  Protocol Version:  %d\n", (int) LDAP_VERSION);
+#else
+       printf("  Protocol Version:  unknown\n");
+#endif
+#ifdef LDAP_VERSION_MIN
+       printf("  Protocol Min:      %d\n", (int) LDAP_VERSION_MIN);
+#else
+       printf("  Protocol Min:      unknown\n");
+#endif
+#ifdef LDAP_VERSION_MAX
+       printf("  Protocol Max:      %d\n", (int) LDAP_VERSION_MAX);
+#else
+       printf("  Protocol Max:      unknown\n");
+#endif
+#ifdef LDAP_VENDOR_NAME
+       printf("  Vendor Name:       %s\n", LDAP_VENDOR_NAME);
+#else
+       printf("  Vendor Name:       unknown\n");
+#endif
+#ifdef LDAP_VENDOR_VERSION
+       printf("  Vendor Version:    %d\n", (int) LDAP_VENDOR_VERSION);
+#else
+       printf("  Vendor Version:    unknown\n");
+#endif
+
+       if(ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) != LDAP_SUCCESS) {
+               fprintf(stderr, "%s: ldap_get_option(API_INFO) failed\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+
+       printf("\nExecution time API Information\n");
+       printf("  API Info version:  %d\n", api.ldapai_info_version);
+
+       if (api.ldapai_info_version != LDAP_API_INFO_VERSION) {
+               printf(" API INFO version mismatch: got %d, expected %d\n",
+                       api.ldapai_info_version, LDAP_API_INFO_VERSION);
+               return EXIT_FAILURE;
+       }
+
+       printf("  API Version:       %d\n", api.ldapai_api_version);
+       printf("  Protocol Max:      %d\n", api.ldapai_protocol_version);
+
+       if(api.ldapai_extensions == NULL) {
+               printf("  Extensions:        none\n");
+
+       } else {
+               int i;
+               for(i=0; api.ldapai_extensions[i] != NULL; i++) /* empty */;
+               printf("  Extensions:        %d\n", i);
+               for(i=0; api.ldapai_extensions[i] != NULL; i++) {
+#ifdef LDAP_OPT_API_FEATURE_INFO
+                       LDAPAPIFeatureInfo fi;
+                       fi.ldapaif_info_version = LDAP_FEATURE_INFO_VERSION;
+                       fi.ldapaif_name = api.ldapai_extensions[i];
+                       fi.ldapaif_version = 0;
+
+                       if( ldap_get_option(NULL, LDAP_OPT_API_FEATURE_INFO, &fi) == LDAP_SUCCESS ) {
+                               if(fi.ldapaif_info_version != LDAP_FEATURE_INFO_VERSION) {
+                                       printf("                     %s feature info mismatch: got %d, expected %d\n",
+                                               api.ldapai_extensions[i],
+                                               LDAP_FEATURE_INFO_VERSION,
+                                               fi.ldapaif_info_version);
+
+                               } else {
+                                       printf("                     %s: version %d\n",
+                                               fi.ldapaif_name,
+                                               fi.ldapaif_version);
+                               }
+
+                       } else {
+                               printf("                     %s (NO FEATURE INFO)\n",
+                                       api.ldapai_extensions[i]);
+                       }
+
+#else
+                       printf("                     %s\n",
+                               api.ldapai_extensions[i]);
+#endif
+
+                       ldap_memfree(api.ldapai_extensions[i]);
+               }
+               ldap_memfree(api.ldapai_extensions);
+       }
+
+       printf("  Vendor Name:       %s\n", api.ldapai_vendor_name);
+       ldap_memfree(api.ldapai_vendor_name);
+
+       printf("  Vendor Version:    %d\n", api.ldapai_vendor_version);
+
+       printf("\nExecution time Default Options\n");
+
+       if(ldap_get_option(NULL, LDAP_OPT_DEREF, &ival) != LDAP_SUCCESS) {
+               fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+       printf("  DEREF:             %d\n", ival);
+
+       if(ldap_get_option(NULL, LDAP_OPT_SIZELIMIT, &ival) != LDAP_SUCCESS) {
+               fprintf(stderr, "%s: ldap_get_option(sizelimit) failed\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+       printf("  SIZELIMIT:         %d\n", ival);
+
+       if(ldap_get_option(NULL, LDAP_OPT_TIMELIMIT, &ival) != LDAP_SUCCESS) {
+               fprintf(stderr, "%s: ldap_get_option(timelimit) failed\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+       printf("  TIMELIMIT:         %d\n", ival);
+
+       if(ldap_get_option(NULL, LDAP_OPT_REFERRALS, &ival) != LDAP_SUCCESS) {
+               fprintf(stderr, "%s: ldap_get_option(referrals) failed\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+       printf("  REFERRALS:         %s\n", ival ? "on" : "off");
+
+       if(ldap_get_option(NULL, LDAP_OPT_RESTART, &ival) != LDAP_SUCCESS) {
+               fprintf(stderr, "%s: ldap_get_option(restart) failed\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+       printf("  RESTART:           %s\n", ival ? "on" : "off");
+
+       if(ldap_get_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ival) != LDAP_SUCCESS) {
+               fprintf(stderr, "%s: ldap_get_option(protocol version) failed\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+       printf("  PROTOCOL VERSION:  %d\n", ival);
+
+       if(ldap_get_option(NULL, LDAP_OPT_HOST_NAME, &sval) != LDAP_SUCCESS) {
+               fprintf(stderr, "%s: ldap_get_option(host name) failed\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+       if( sval != NULL ) {
+               printf("  HOST NAME:         %s\n", sval);
+               ldap_memfree(sval);
+       } else {
+               puts("  HOST NAME:         <not set>");
+       }
+
+#if 0
+       /* API tests */
+       {       /* bindless unbind */
+               LDAP *ld;
+               int rc;
+
+               ld = ldap_init( "localhost", 389 );
+               if( ld == NULL ) {
+                       perror("ldap_init");
+                       return EXIT_FAILURE;
+               }
+
+               rc = ldap_unbind( ld );
+               if( rc != LDAP_SUCCESS ) {
+                       perror("ldap_unbind");
+                       return EXIT_FAILURE;
+               }
+       }
+       {       /* bindless unbind */
+               LDAP *ld;
+               int rc;
+
+               ld = ldap_init( "localhost", 389 );
+               if( ld == NULL ) {
+                       perror("ldap_init");
+                       return EXIT_FAILURE;
+               }
+
+               rc = ldap_abandon_ext( ld, 0, NULL, NULL );
+               if( rc != LDAP_SERVER_DOWN ) {
+                       ldap_perror( ld, "ldap_abandon");
+                       return EXIT_FAILURE;
+               }
+
+               rc = ldap_unbind( ld );
+               if( rc != LDAP_SUCCESS ) {
+                       perror("ldap_unbind");
+                       return EXIT_FAILURE;
+               }
+       }
+#endif
+
+       return EXIT_SUCCESS;
+}
index 4040da1804eb28f9263f31a9d2b68bff17eb3e4e..04ba176d28e64813351a1bc04b8bc7c6adfacb38 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index d29c5d58428f7ad3f5ff1423ac5a980c00e7e65b..ad5c4c8b3b90faf8be080e30e429eef9fddc5e73 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* charray.c - routines for dealing with char * arrays */
index 48d2845a5ea7cc4f0b7da32c7098a69127860d5c..b984f133055db6be50b0dd6ff377e0c3ce2b975a 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1999-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1999-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index e930fc579bae1557744c44f064ab3f167e2d567e..0dd046569f5c5d68b55dd70066de993539d91ab6 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 5c0a2cfe73064c15eca8c22cabf44822b5276e17..c76b1c07e213aaa8c5e4b343b3ccad55f9af5f16 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index e99b48b2ed752648fa1da0adef5c99b46468fd87..31342a5bae65ccc82db194efe31272117c5266a4 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 64463e59d8de6ed76999c47c792dd9bb7ad21586..c9c27be37d2a1542975ef86269bce669924599e1 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 45eebb9483418f0a6eb116bdcfd3fafdbc2a3d1c..912bf20c28f9710f3440348fb0c2a8de32f6cc87 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index b208b2f88fe1f8fd379bd798834248e8918a5357..bbb411950c9bec931c9588e66223b05ecc33cd2d 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 90b969aeb5dd2a34ebf2d766de67ec9f64a6a378..6e67e71c681434bf499c012023e3d0288727252e 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 761fc416f440f7b511f87cde269e6c9df3103544..ceb199427d542d0bcc6fed4d35f02519cdc9aa29 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 4fb23eff6cb69bc0993f0daec9c65963daf39231..1f8ebea02275a961d2718e3d84b0090f202c97bb 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 43e159f1903818d61e64e1ff964ca461b6405947..82e36299baa20f6932f86e1bb42eb6033264f0bd 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 4c992ac53f3a18911e181ee3e924df18a4f79b51..093cedf32f4f47bbeb537e9a352bb0bcfc981c68 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #include "portable.h"
index e7ce4396740974f921edf5bf8d1590c0b2970ac9..a769f287af49bc586b475b2ef6f57db525b1b842 100644 (file)
@@ -1,7 +1,7 @@
 /*  ldap-int.h - defines & prototypes internal to the LDAP library */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index bcb13a7f1461d4697705cdfe67387a07c183eec0..808a39509bf3ddb63d901c9c95f7962101d7c599 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index f3460643704ea6914ee027f7df69b287ce643f7a..bba2a25de754f0dbe0c40d859dd4383050450d1d 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 6907a2299859d5f5fd532d656c905485577bd145..a0383892775bfd91ac76b9e5417738061223f809 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 45ec0e5f75e2480a9aa086a63b685c9676ed8ffa..3b129036b8391f0afe095fc83187a80e9281b138 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 96755c76dc5e4cb3ada542e5b3cac6f76416505c..fc705e9f3320c52d345d2eecd6f7aecabd1daf8a 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 7ea14d63a3d18a585b7aaeeaec23353a5a3f7be7..f71f3689c99552f7dd1858c70f4f32b323aef844 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index ff9b63fc0c7902403a6716bee1cf279004311cd6..0e0730f6c896876246b34a9063e0386c6634844d 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 66c5b675241d3f6ef378f11a688c0c4c2cab03da..dedb1ee2868f081471ef717238f1c0251d29b22a 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 1d016bbf9233d18a75ac78abb94c7e8317c5559c..cec3af36d7a838a8ba2f1dc3571f65909172aa40 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index 894b09de4a856304d072640cd1160c1e03300b96..0ac55075bf3aeb1562a01947085d920338699d5a 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1999-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1999-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 84557eb33a8d248d0ddbbdf884da9494c14c3d1d..3f8484c8ea326e6d9ed140f73d3128c0bea7d27f 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Portions
index 37bf38f2e90b0250efd8463c6201ca13c62962ba..8079b0549fb709661d86bde8383d76a8348d4216 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Adapted for inclusion into OpenLDAP by Kurt D. Zeilenga */
index dbedf5741f09900f5dae6798c571d12cabdb1a58..21330d4ae574a4920bd3bde41206205f59fa0e3a 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/libraries/libldap/t61.c b/libraries/libldap/t61.c
new file mode 100644 (file)
index 0000000..4450e2d
--- /dev/null
@@ -0,0 +1,677 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 2002-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+/*
+ * Basic T.61 <-> UTF-8 conversion
+ *
+ * These routines will perform a lossless translation from T.61 to UTF-8
+ * and a lossy translation from UTF-8 to T.61.
+ */
+
+#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"
+#include "ldap_utf8.h"
+
+#include "ldap_defaults.h"
+
+/*
+ * T.61 is somewhat braindead; even in the 7-bit space it is not
+ * completely equivalent to 7-bit US-ASCII. Our definition of the
+ * character set comes from RFC 1345 with a slightly more readable
+ * rendition at http://std.dkuug.dk/i18n/charmaps/T.61-8BIT.
+ *
+ * Even though '#' and '$' are present in the 7-bit US-ASCII space,
+ * (x23 and x24, resp.) in T.61 they are mapped to 8-bit characters
+ * xA6 and xA4. 
+ *
+ * Also T.61 lacks
+ *     backslash       \       (x5C)
+ *     caret           ^       (x5E)
+ *     backquote       `       (x60)
+ *     left brace      {       (x7B)
+ *     right brace     }       (x7D)
+ *     tilde           ~       (x7E)
+ *
+ * In T.61, the codes xC1 to xCF (excluding xC9, unused) are non-spacing
+ * accents of some form or another. There are predefined combinations
+ * for certain characters, but they can also be used arbitrarily. The
+ * table at dkuug.dk maps these accents to the E000 "private use" range
+ * of the Unicode space, but I believe they more properly belong in the
+ * 0300 range (non-spacing accents). The transformation is complicated
+ * slightly because Unicode wants the non-spacing character to follow
+ * the base character, while T.61 has the non-spacing character leading.
+ * Also, T.61 specifically recognizes certain combined pairs as "characters"
+ * but doesn't specify how to treat unrecognized pairs. This code will
+ * always attempt to combine pairs when a known Unicode composite exists.
+ */
+
+static const wchar_t t61_tab[] = {
+       0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007,
+       0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f,
+       0x010, 0x011, 0x012, 0x013, 0x014, 0x015, 0x016, 0x017,
+       0x018, 0x019, 0x01a, 0x01b, 0x01c, 0x01d, 0x01e, 0x01f,
+       0x020, 0x021, 0x022, 0x000, 0x000, 0x025, 0x026, 0x027,
+       0x028, 0x029, 0x02a, 0x02b, 0x02c, 0x02d, 0x02e, 0x02f,
+       0x030, 0x031, 0x032, 0x033, 0x034, 0x035, 0x036, 0x037,
+       0x038, 0x039, 0x03a, 0x03b, 0x03c, 0x03d, 0x03e, 0x03f,
+       0x040, 0x041, 0x042, 0x043, 0x044, 0x045, 0x046, 0x047,
+       0x048, 0x049, 0x04a, 0x04b, 0x04c, 0x04d, 0x04e, 0x04f,
+       0x050, 0x051, 0x052, 0x053, 0x054, 0x055, 0x056, 0x057,
+       0x058, 0x059, 0x05a, 0x05b, 0x000, 0x05d, 0x000, 0x05f,
+       0x000, 0x061, 0x062, 0x063, 0x064, 0x065, 0x066, 0x067,
+       0x068, 0x069, 0x06a, 0x06b, 0x06c, 0x06d, 0x06e, 0x06f,
+       0x070, 0x071, 0x072, 0x073, 0x074, 0x075, 0x076, 0x077,
+       0x078, 0x079, 0x07a, 0x000, 0x07c, 0x000, 0x000, 0x07f,
+       0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087,
+       0x088, 0x089, 0x08a, 0x08b, 0x08c, 0x08d, 0x08e, 0x08f,
+       0x090, 0x091, 0x092, 0x093, 0x094, 0x095, 0x096, 0x097,
+       0x098, 0x099, 0x09a, 0x09b, 0x09c, 0x09d, 0x09e, 0x09f,
+       0x0a0, 0x0a1, 0x0a2, 0x0a3, 0x024, 0x0a5, 0x023, 0x0a7,
+       0x0a4, 0x000, 0x000, 0x0ab, 0x000, 0x000, 0x000, 0x000,
+       0x0b0, 0x0b1, 0x0b2, 0x0b3, 0x0d7, 0x0b5, 0x0b6, 0x0b7,
+       0x0f7, 0x000, 0x000, 0x0bb, 0x0bc, 0x0bd, 0x0be, 0x0bf,
+       0x000, 0x300, 0x301, 0x302, 0x303, 0x304, 0x306, 0x307,
+       0x308, 0x000, 0x30a, 0x327, 0x332, 0x30b, 0x328, 0x30c,
+       0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
+       0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
+       0x2126, 0xc6, 0x0d0, 0x0aa, 0x126, 0x000, 0x132, 0x13f,
+       0x141, 0x0d8, 0x152, 0x0ba, 0x0de, 0x166, 0x14a, 0x149,
+       0x138, 0x0e6, 0x111, 0x0f0, 0x127, 0x131, 0x133, 0x140,
+       0x142, 0x0f8, 0x153, 0x0df, 0x0fe, 0x167, 0x14b, 0x000
+};
+
+typedef wchar_t wvec16[16];
+typedef wchar_t wvec32[32];
+typedef wchar_t wvec64[64];
+
+/* Substitutions when 0xc1-0xcf appears by itself or with space 0x20 */
+static const wvec16 accents = {
+       0x000, 0x060, 0x0b4, 0x05e, 0x07e, 0x0af, 0x2d8, 0x2d9,
+       0x0a8, 0x000, 0x2da, 0x0b8, 0x000, 0x2dd, 0x2db, 0x2c7};
+
+/* In the following tables, base characters commented in (parentheses)
+ * are not defined by T.61 but are mapped anyway since their Unicode
+ * composite exists.
+ */
+
+/* Grave accented chars AEIOU (NWY) */
+static const wvec32 c1_vec1 = {
+       /* Upper case */
+       0, 0xc0, 0, 0, 0, 0xc8, 0, 0, 0, 0xcc, 0, 0, 0, 0, 0x1f8, 0xd2,
+       0, 0, 0, 0, 0, 0xd9, 0, 0x1e80, 0, 0x1ef2, 0, 0, 0, 0, 0, 0};
+static const wvec32 c1_vec2 = {
+       /* Lower case */
+       0, 0xe0, 0, 0, 0, 0xe8, 0, 0, 0, 0xec, 0, 0, 0, 0, 0x1f9, 0xf2,
+       0, 0, 0, 0, 0, 0xf9, 0, 0x1e81, 0, 0x1ef3, 0, 0, 0, 0, 0, 0};
+       
+static const wvec32 *c1_grave[] = {
+       NULL, NULL, &c1_vec1, &c1_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Acute accented chars AEIOUYCLNRSZ (GKMPW) */
+static const wvec32 c2_vec1 = {
+       /* Upper case */
+       0, 0xc1, 0, 0x106, 0, 0xc9, 0, 0x1f4,
+       0, 0xcd, 0, 0x1e30, 0x139, 0x1e3e, 0x143, 0xd3,
+       0x1e54, 0, 0x154, 0x15a, 0, 0xda, 0, 0x1e82,
+       0, 0xdd, 0x179, 0, 0, 0, 0, 0};
+static const wvec32 c2_vec2 = {
+       /* Lower case */
+       0, 0xe1, 0, 0x107, 0, 0xe9, 0, 0x1f5,
+       0, 0xed, 0, 0x1e31, 0x13a, 0x1e3f, 0x144, 0xf3,
+       0x1e55, 0, 0x155, 0x15b, 0, 0xfa, 0, 0x1e83,
+       0, 0xfd, 0x17a, 0, 0, 0, 0, 0};
+static const wvec32 c2_vec3 = {
+       /* (AE and ae) */
+       0, 0x1fc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0x1fd, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static const wvec32 *c2_acute[] = {
+       NULL, NULL, &c2_vec1, &c2_vec2, NULL, NULL, NULL, &c2_vec3
+};
+
+/* Circumflex AEIOUYCGHJSW (Z) */
+static const wvec32 c3_vec1 = {
+       /* Upper case */
+       0, 0xc2, 0, 0x108, 0, 0xca, 0, 0x11c,
+       0x124, 0xce, 0x134, 0, 0, 0, 0, 0xd4,
+       0, 0, 0, 0x15c, 0, 0xdb, 0, 0x174,
+       0, 0x176, 0x1e90, 0, 0, 0, 0, 0};
+static const wvec32 c3_vec2 = {
+       /* Lower case */
+       0, 0xe2, 0, 0x109, 0, 0xea, 0, 0x11d,
+       0x125, 0xee, 0x135, 0, 0, 0, 0, 0xf4,
+       0, 0, 0, 0x15d, 0, 0xfb, 0, 0x175,
+       0, 0x177, 0x1e91, 0, 0, 0, 0, 0};
+static const wvec32 *c3_circumflex[] = {
+       NULL, NULL, &c3_vec1, &c3_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Tilde AIOUN (EVY) */
+static const wvec32 c4_vec1 = {
+       /* Upper case */
+       0, 0xc3, 0, 0, 0, 0x1ebc, 0, 0, 0, 0x128, 0, 0, 0, 0, 0xd1, 0xd5,
+       0, 0, 0, 0, 0, 0x168, 0x1e7c, 0, 0, 0x1ef8, 0, 0, 0, 0, 0, 0};
+static const wvec32 c4_vec2 = {
+       /* Lower case */
+       0, 0xe3, 0, 0, 0, 0x1ebd, 0, 0, 0, 0x129, 0, 0, 0, 0, 0xf1, 0xf5,
+       0, 0, 0, 0, 0, 0x169, 0x1e7d, 0, 0, 0x1ef9, 0, 0, 0, 0, 0, 0};
+static const wvec32 *c4_tilde[] = {
+       NULL, NULL, &c4_vec1, &c4_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Macron AEIOU (YG) */
+static const wvec32 c5_vec1 = {
+       /* Upper case */
+       0, 0x100, 0, 0, 0, 0x112, 0, 0x1e20, 0, 0x12a, 0, 0, 0, 0, 0, 0x14c,
+       0, 0, 0, 0, 0, 0x16a, 0, 0, 0, 0x232, 0, 0, 0, 0, 0, 0};
+static const wvec32 c5_vec2 = {
+       /* Lower case */
+       0, 0x101, 0, 0, 0, 0x113, 0, 0x1e21, 0, 0x12b, 0, 0, 0, 0, 0, 0x14d,
+       0, 0, 0, 0, 0, 0x16b, 0, 0, 0, 0x233, 0, 0, 0, 0, 0, 0};
+static const wvec32 c5_vec3 = {
+       /* (AE and ae) */
+       0, 0x1e2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0x1e3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 *c5_macron[] = {
+       NULL, NULL, &c5_vec1, &c5_vec2, NULL, NULL, NULL, &c5_vec3
+};
+
+/* Breve AUG (EIO) */
+static const wvec32 c6_vec1 = {
+       /* Upper case */
+       0, 0x102, 0, 0, 0, 0x114, 0, 0x11e, 0, 0x12c, 0, 0, 0, 0, 0, 0x14e,
+       0, 0, 0, 0, 0, 0x16c, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 c6_vec2 = {
+       /* Lower case */
+       0, 0x103, 0, 0, 0, 0x115, 0, 0x11f, 0, 0x12d, 0, 0, 0, 0, 0, 0x14f,
+       0, 0, 0, 0, 0, 0x16d, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 *c6_breve[] = {
+       NULL, NULL, &c6_vec1, &c6_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Dot Above CEGIZ (AOBDFHMNPRSTWXY) */
+static const wvec32 c7_vec1 = {
+       /* Upper case */
+       0, 0x226, 0x1e02, 0x10a, 0x1e0a, 0x116, 0x1e1e, 0x120,
+       0x1e22, 0x130, 0, 0, 0, 0x1e40, 0x1e44, 0x22e,
+       0x1e56, 0, 0x1e58, 0x1e60, 0x1e6a, 0, 0, 0x1e86,
+       0x1e8a, 0x1e8e, 0x17b, 0, 0, 0, 0, 0};
+static const wvec32 c7_vec2 = {
+       /* Lower case */
+       0, 0x227, 0x1e03, 0x10b, 0x1e0b, 0x117, 0x1e1f, 0x121,
+       0x1e23, 0, 0, 0, 0, 0x1e41, 0x1e45, 0x22f,
+       0x1e57, 0, 0x1e59, 0x1e61, 0x1e6b, 0, 0, 0x1e87,
+       0x1e8b, 0x1e8f, 0x17c, 0, 0, 0, 0, 0};
+static const wvec32 *c7_dotabove[] = {
+       NULL, NULL, &c7_vec1, &c7_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Diaeresis AEIOUY (HWXt) */
+static const wvec32 c8_vec1 = {
+       /* Upper case */
+       0, 0xc4, 0, 0, 0, 0xcb, 0, 0, 0x1e26, 0xcf, 0, 0, 0, 0, 0, 0xd6,
+       0, 0, 0, 0, 0, 0xdc, 0, 0x1e84, 0x1e8c, 0x178, 0, 0, 0, 0, 0, 0};
+static const wvec32 c8_vec2 = {
+       /* Lower case */
+       0, 0xe4, 0, 0, 0, 0xeb, 0, 0, 0x1e27, 0xef, 0, 0, 0, 0, 0, 0xf6,
+       0, 0, 0, 0, 0x1e97, 0xfc, 0, 0x1e85, 0x1e8d, 0xff, 0, 0, 0, 0, 0, 0};
+static const wvec32 *c8_diaeresis[] = {
+       NULL, NULL, &c8_vec1, &c8_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Ring Above AU (wy) */
+static const wvec32 ca_vec1 = {
+       /* Upper case */
+       0, 0xc5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0x16e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 ca_vec2 = {
+       /* Lower case */
+       0, 0xe5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0x16f, 0, 0x1e98, 0, 0x1e99, 0, 0, 0, 0, 0, 0};
+static const wvec32 *ca_ringabove[] = {
+       NULL, NULL, &ca_vec1, &ca_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Cedilla CGKLNRST (EDH) */
+static const wvec32 cb_vec1 = {
+       /* Upper case */
+       0, 0, 0, 0xc7, 0x1e10, 0x228, 0, 0x122,
+       0x1e28, 0, 0, 0x136, 0x13b, 0, 0x145, 0,
+       0, 0, 0x156, 0x15e, 0x162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 cb_vec2 = {
+       /* Lower case */
+       0, 0, 0, 0xe7, 0x1e11, 0x229, 0, 0x123,
+       0x1e29, 0, 0, 0x137, 0x13c, 0, 0x146, 0,
+       0, 0, 0x157, 0x15f, 0x163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 *cb_cedilla[] = {
+       NULL, NULL, &cb_vec1, &cb_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Double Acute Accent OU */
+static const wvec32 cd_vec1 = {
+       /* Upper case */
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x150,
+       0, 0, 0, 0, 0, 0x170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 cd_vec2 = {
+       /* Lower case */
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x151,
+       0, 0, 0, 0, 0, 0x171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 *cd_doubleacute[] = {
+       NULL, NULL, &cd_vec1, &cd_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Ogonek AEIU (O) */
+static const wvec32 ce_vec1 = {
+       /* Upper case */
+       0, 0x104, 0, 0, 0, 0x118, 0, 0, 0, 0x12e, 0, 0, 0, 0, 0, 0x1ea,
+       0, 0, 0, 0, 0, 0x172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 ce_vec2 = {
+       /* Lower case */
+       0, 0x105, 0, 0, 0, 0x119, 0, 0, 0, 0x12f, 0, 0, 0, 0, 0, 0x1eb,
+       0, 0, 0, 0, 0, 0x173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static const wvec32 *ce_ogonek[] = {
+       NULL, NULL, &ce_vec1, &ce_vec2, NULL, NULL, NULL, NULL
+};
+
+/* Caron CDELNRSTZ (AIOUGKjH) */
+static const wvec32 cf_vec1 = {
+       /* Upper case */
+       0, 0x1cd, 0, 0x10c, 0x10e, 0x11a, 0, 0x1e6,
+       0x21e, 0x1cf, 0, 0x1e8, 0x13d, 0, 0x147, 0x1d1,
+       0, 0, 0x158, 0x160, 0x164, 0x1d3, 0, 0,
+       0, 0, 0x17d, 0, 0, 0, 0, 0};
+static const wvec32 cf_vec2 = {
+       /* Lower case */
+       0, 0x1ce, 0, 0x10d, 0x10f, 0x11b, 0, 0x1e7,
+       0x21f, 0x1d0, 0x1f0, 0x1e9, 0x13e, 0, 0x148, 0x1d2,
+       0, 0, 0x159, 0x161, 0x165, 0x1d4, 0, 0,
+       0, 0, 0x17e, 0, 0, 0, 0, 0};
+static const wvec32 *cf_caron[] = {
+       NULL, NULL, &cf_vec1, &cf_vec2, NULL, NULL, NULL, NULL
+};
+
+static const wvec32 **cx_tab[] = {
+       NULL, c1_grave, c2_acute, c3_circumflex, c4_tilde, c5_macron,
+       c6_breve, c7_dotabove, c8_diaeresis, NULL, ca_ringabove,
+       cb_cedilla, NULL, cd_doubleacute, ce_ogonek, cf_caron };
+
+int ldap_t61s_valid( struct berval *str )
+{
+       unsigned char *c = (unsigned char *)str->bv_val;
+       int i;
+
+       for (i=0; i < str->bv_len; c++,i++)
+               if (!t61_tab[*c])
+                       return 0;
+       return 1;
+}
+
+/* Transform a T.61 string to UTF-8.
+ */
+int ldap_t61s_to_utf8s( struct berval *src, struct berval *dst )
+{
+       unsigned char *c;
+       char *d;
+       int i, wlen = 0;
+
+       /* Just count the length of the UTF-8 result first */
+       for (i=0,c=(unsigned char *)src->bv_val; i < src->bv_len; c++,i++) {
+               /* Invalid T.61 characters? */
+               if (!t61_tab[*c]) 
+                       return LDAP_INVALID_SYNTAX;
+               if (*c & 0xf0 == 0xc0) {
+                       int j = *c & 0x0f;
+                       /* If this is the end of the string, or if the base
+                        * character is just a space, treat this as a regular
+                        * spacing character.
+                        */
+                       if ((!c[1] || c[1] == 0x20) && accents[j]) {
+                               wlen += ldap_x_wc_to_utf8(NULL, accents[j], 0);
+                       } else if (cx_tab[j] && cx_tab[j][c[1]>>5] &&
+                       /* We have a composite mapping for this pair */
+                               (*cx_tab[j][c[1]>>5])[c[1]&0x1f]) {
+                               wlen += ldap_x_wc_to_utf8( NULL,
+                                       (*cx_tab[j][c[1]>>5])[c[1]&0x1f], 0);
+                       } else {
+                       /* No mapping, just swap it around so the base
+                        * character comes first.
+                        */
+                               wlen += ldap_x_wc_to_utf8(NULL, c[1], 0);
+                               wlen += ldap_x_wc_to_utf8(NULL,
+                                       t61_tab[*c], 0);
+                       }
+                       c++; i++;
+                       continue;
+               } else {
+                       wlen += ldap_x_wc_to_utf8(NULL, t61_tab[*c], 0);
+               }
+       }
+
+       /* Now transform the string */
+       dst->bv_len = wlen;
+       dst->bv_val = LDAP_MALLOC( wlen+1 );
+       d = dst->bv_val;
+       if (!d)
+               return LDAP_NO_MEMORY;
+
+       for (i=0,c=(unsigned char *)src->bv_val; i < src->bv_len; c++,i++) {
+               if (*c & 0xf0 == 0xc0) {
+                       int j = *c & 0x0f;
+                       /* If this is the end of the string, or if the base
+                        * character is just a space, treat this as a regular
+                        * spacing character.
+                        */
+                       if ((!c[1] || c[1] == 0x20) && accents[j]) {
+                               d += ldap_x_wc_to_utf8(d, accents[j], 6);
+                       } else if (cx_tab[j] && cx_tab[j][c[1]>>5] &&
+                       /* We have a composite mapping for this pair */
+                               (*cx_tab[j][c[1]>>5])[c[1]&0x1f]) {
+                               d += ldap_x_wc_to_utf8(d, 
+                               (*cx_tab[j][c[1]>>5])[c[1]&0x1f], 6);
+                       } else {
+                       /* No mapping, just swap it around so the base
+                        * character comes first.
+                        */
+                               d += ldap_x_wc_to_utf8(d, c[1], 6);
+                               d += ldap_x_wc_to_utf8(d, t61_tab[*c], 6);
+                       }
+                       c++; i++;
+                       continue;
+               } else {
+                       d += ldap_x_wc_to_utf8(d, t61_tab[*c], 6);
+               }
+       }
+       *d = '\0';
+       return LDAP_SUCCESS;
+}
+
+/* For the reverse mapping, we just pay attention to the Latin-oriented
+ * code blocks. These are
+ *     0000 - 007f Basic Latin
+ *     0080 - 00ff Latin-1 Supplement
+ *     0100 - 017f Latin Extended-A
+ *     0180 - 024f Latin Extended-B
+ *     1e00 - 1eff Latin Extended Additional
+ *
+ * We have a special case to map Ohm U2126 back to T.61 0xe0. All other
+ * unrecognized characters are replaced with '?' 0x3f.
+ */
+
+static const wvec64 u000 = {
+       0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
+       0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
+       0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
+       0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
+       0x0020, 0x0021, 0x0022, 0x00a6, 0x00a4, 0x0025, 0x0026, 0x0027,
+       0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
+       0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
+       0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f};
+
+/* In this range, we've mapped caret to xc3/x20, backquote to xc1/x20,
+ * and tilde to xc4/x20. T.61 (stupidly!) doesn't define these characters
+ * on their own, even though it provides them as combiners for other
+ * letters. T.61 doesn't define these pairings either, so this may just
+ * have to be replaced with '?' 0x3f if other software can't cope with it.
+ */
+static const wvec64 u001 = {
+       0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
+       0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
+       0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
+       0x0058, 0x0059, 0x005a, 0x005b, 0x003f, 0x005d, 0xc320, 0x005f,
+       0xc120, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
+       0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
+       0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
+       0x0078, 0x0079, 0x007a, 0x003f, 0x007c, 0x003f, 0xc420, 0x007f};
+
+static const wvec64 u002 = {
+       0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
+       0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
+       0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
+       0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
+       0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a8, 0x00a5, 0x003f, 0x00a7,
+       0xc820, 0x003f, 0x00e3, 0x00ab, 0x003f, 0x003f, 0x003f, 0xc520,
+       0x00b0, 0x00b1, 0x00b2, 0x00b3, 0xc220, 0x00b5, 0x00b6, 0x00b7,
+       0xcb20, 0x003f, 0x00eb, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf};
+
+static const wvec64 u003 = {
+       0xc141, 0xc241, 0xc341, 0xc441, 0xc841, 0xca41, 0x00e1, 0xcb43,
+       0xc145, 0xc245, 0xc345, 0xc845, 0xc149, 0xc249, 0xc349, 0xc849,
+       0x00e2, 0xc44e, 0xc14f, 0xc24f, 0xc34f, 0xc44f, 0xc84f, 0x00b4,
+       0x00e9, 0xc155, 0xc255, 0xc355, 0xc855, 0xc259, 0x00ec, 0x00fb,
+       0xc161, 0xc261, 0xc361, 0xc461, 0xc861, 0xca61, 0x00f1, 0xcb63,
+       0xc165, 0xc265, 0xc365, 0xc865, 0xc169, 0xc269, 0xc369, 0xc869,
+       0x00f3, 0xc46e, 0xc16f, 0xc26f, 0xc36f, 0xc46f, 0xc86f, 0x00b8,
+       0x00f9, 0xc175, 0xc275, 0xc375, 0xc875, 0xc279, 0x00fc, 0xc879};
+
+/* These codes are used here but not defined by T.61:
+ * x114 = xc6/x45, x115 = xc6/x65, x12c = xc6/x49, x12d = xc6/x69
+ */
+static const wvec64 u010 = {
+       0xc541, 0xc561, 0xc641, 0xc661, 0xce41, 0xce61, 0xc243, 0xc263,
+       0xc343, 0xc363, 0xc743, 0xc763, 0xcf43, 0xcf63, 0xcf44, 0xcf64,
+       0x003f, 0x00f2, 0xc545, 0xc565, 0xc645, 0xc665, 0xc745, 0xc765,
+       0xce45, 0xce65, 0xcf45, 0xcf65, 0xc347, 0xc367, 0xc647, 0xc667,
+       0xc747, 0xc767, 0xcb47, 0xcb67, 0xc348, 0xc368, 0x00e4, 0x00f4,
+       0xc449, 0xc469, 0xc549, 0xc569, 0xc649, 0xc669, 0xce49, 0xce69,
+       0xc749, 0x00f5, 0x00e6, 0x00f6, 0xc34a, 0xc36a, 0xcb4b, 0xcb6b,
+       0x00f0, 0xc24c, 0xc26c, 0xcb4c, 0xcb6c, 0xcf4c, 0xcf6c, 0x00e7};
+
+/* These codes are used here but not defined by T.61:
+ * x14e = xc6/x4f, x14f = xc6/x6f
+ */
+static const wvec64 u011 = {
+       0x00f7, 0x00e8, 0x00f8, 0xc24e, 0xc26e, 0xcb4e, 0xcb6e, 0xcf4e,
+       0xcf6e, 0x00ef, 0x00ee, 0x00fe, 0xc54f, 0xc56f, 0xc64f, 0xc66f,
+       0xcd4f, 0xcd6f, 0x00ea, 0x00fa, 0xc252, 0xc272, 0xcb52, 0xcb72,
+       0xcf52, 0xcf72, 0xc253, 0xc273, 0xc353, 0xc373, 0xcb53, 0xcb73,
+       0xcf53, 0xcf73, 0xcb54, 0xcb74, 0xcf54, 0xcf74, 0x00ed, 0x00fd,
+       0xc455, 0xc475, 0xc555, 0xc575, 0xc655, 0xc675, 0xca55, 0xca75,
+       0xcd55, 0xcd75, 0xce55, 0xce75, 0xc357, 0xc377, 0xc359, 0xc379,
+       0xc859, 0xc25a, 0xc27a, 0xc75a, 0xc77a, 0xcf5a, 0xcf7a, 0x003f};
+
+/* All of the codes in this block are undefined in T.61.
+ */
+static const wvec64 u013 = {
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0xcf41, 0xcf61, 0xcf49,
+       0xcf69, 0xcf4f, 0xcf6f, 0xcf55, 0xcf75, 0x003f, 0x003f, 0x003f, 
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0xc5e1, 0xc5f1, 0x003f, 0x003f, 0xcf47, 0xcf67,
+       0xcf4b, 0xcf6b, 0xce4f, 0xce6f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0xcf6a, 0x003f, 0x003f, 0x003f, 0xc247, 0xc267, 0x003f, 0x003f,
+       0xc14e, 0xc16e, 0x003f, 0x003f, 0xc2e1, 0xc2f1, 0x003f, 0x003f};
+
+/* All of the codes in this block are undefined in T.61.
+ */
+static const wvec64 u020 = {
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0xcf48, 0xcf68,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0xc741, 0xc761,
+       0xcb45, 0xcb65, 0x003f, 0x003f, 0x003f, 0x003f, 0xc74f, 0xc76f,
+       0x003f, 0x003f, 0xc559, 0xc579, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f};
+
+static const wvec64 u023 = {
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0xcf20,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0xc620, 0xc720, 0xca20, 0xce20, 0x003f, 0xcd20, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f};
+
+/* These are the non-spacing characters by themselves. They should
+ * never appear by themselves in actual text.
+ */
+static const wvec64 u030 = {
+       0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x003f, 0x00c6, 0x00c7,
+       0x00c8, 0x003f, 0x00ca, 0x00cd, 0x00cf, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x00cb,
+       0x00ce, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x00cc, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f};
+
+/* None of the following blocks are defined in T.61.
+ */
+static const wvec64 u1e0 = {
+       0x003f, 0x003f, 0xc742, 0xc762, 0x003f, 0x003f, 0x003f, 0x003f, 
+       0x003f, 0x003f, 0xc744, 0xc764, 0x003f, 0x003f, 0x003f, 0x003f,
+       0xcb44, 0xcb64, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0xc746, 0xc766,
+       0xc547, 0xc567, 0xc748, 0xc768, 0x003f, 0x003f, 0xc848, 0xc868,
+       0xcb48, 0xcb68, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0xc24b, 0xc26b, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0xc24d, 0xc26d,
+};
+
+static const wvec64 u1e1 = {
+       0xc74d, 0xc76d, 0x003f, 0x003f, 0xc74e, 0xc76e, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0xc250, 0xc270, 0xc750, 0xc770,
+       0xc752, 0xc772, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0xc753, 0xc773, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0xc754, 0xc774, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0xc456, 0xc476, 0x003f, 0x003f,
+};
+
+static const wvec64 u1e2 = {
+       0xc157, 0xc177, 0xc257, 0xc277, 0xc857, 0xc877, 0xc757, 0xc777,
+       0x003f, 0x003f, 0xc758, 0xc778, 0xc858, 0xc878, 0xc759, 0xc779,
+       0xc35a, 0xc37a, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0xc874,
+       0xca77, 0xca79, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0xc445, 0xc465, 0x003f, 0x003f,
+};
+
+static const wvec64 u1e3 = {
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+       0x003f, 0x003f, 0xc159, 0xc179, 0x003f, 0x003f, 0x003f, 0x003f,
+       0xc459, 0xc479, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+};
+
+static const wvec64 *wc00[] = {
+       &u000, &u001, &u002, &u003,
+       &u010, &u011, NULL, &u013,
+       &u020, NULL, NULL, &u023,
+       &u030, NULL, NULL, NULL};
+
+static const wvec64 *wc1e[] = {
+       &u1e0, &u1e1, &u1e2, &u1e3};
+
+
+int ldap_utf8s_to_t61s( struct berval *src, struct berval *dst )
+{
+       char *c, *d;
+       wchar_t tmp;
+       int i, j, tlen = 0;
+
+       /* Just count the length of the T.61 result first */
+       for (i=0,c=src->bv_val; i < src->bv_len;) {
+               j = ldap_x_utf8_to_wc( &tmp, c );
+               if (j == -1)
+                       return LDAP_INVALID_SYNTAX;
+               switch (tmp >> 8) {
+               case 0x00:
+               case 0x01:
+               case 0x02:
+               case 0x03:
+                       if (wc00[tmp >> 6] &&
+                               ((*wc00[tmp >> 6])[tmp & 0x3f] & 0xff00)) {
+                               tlen++;
+                       }
+                       tlen++;
+                       break;
+               case 0x1e:
+                       if ((*wc1e[(tmp >> 6) & 3])[tmp & 0x3f] & 0xff00) {
+                               tlen++;
+                       }
+               case 0x21:
+               default:
+                       tlen ++;
+                       break;
+               }
+               i += j;
+               c += j;
+       }
+       dst->bv_len = tlen;
+       dst->bv_val = LDAP_MALLOC( tlen+1 );
+       if (!dst->bv_val)
+               return LDAP_NO_MEMORY;
+       
+       d = dst->bv_val;
+       for (i=0,c=src->bv_val; i < src->bv_len;) {
+               j = ldap_x_utf8_to_wc( &tmp, c );
+               switch (tmp >> 8) {
+               case 0x00:
+               case 0x01:
+               case 0x02:
+                       if (wc00[tmp >> 6]) {
+                               tmp = (*wc00[tmp >> 6])[tmp & 0x3f];
+                               if (tmp & 0xff00)
+                                       *d++ = (tmp >> 8);
+                               *d++ = tmp & 0xff;
+                       } else {
+                               *d++ = 0x3f;
+                       }
+                       break;
+               case 0x03:
+                       /* swap order of non-spacing characters */
+                       if (wc00[tmp >> 6]) {
+                               wchar_t t2 = (*wc00[tmp >> 6])[tmp & 0x3f];
+                               if (t2 != 0x3f) {
+                                       d[0] = d[-1];
+                                       d[-1] = t2;
+                                       d++;
+                               } else {
+                                       *d++ = 0x3f;
+                               }
+                       } else {
+                               *d++ = 0x3f;
+                       }
+                       break;
+               case 0x1e:
+                       tmp = (*wc1e[(tmp >> 6) & 3])[tmp & 0x3f];
+                       if (tmp & 0xff00)
+                               *d++ = (tmp >> 8);
+                       *d++ = tmp & 0xff;
+                       break;
+               case 0x21:
+                       if (tmp == 0x2126) {
+                               *d++ = 0xe0;
+                               break;
+                       }
+                       /* FALLTHRU */
+               default:
+                       *d++ = 0x3f;
+                       break;
+               }
+       }
+       *d = '\0';
+       return LDAP_SUCCESS;
+}
index 06c06e5617db13a85c56e7034c2ec955da6586fa..e5909bac417e7b1905e9e039e17445050e88e901 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
index e5aeeeca360665470f293d69b8a8ef3edd48b58e..e84c775b96d7bddb4f6115778500d197cfa6eb6c 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index ab42cfbf5e15f8ffb6425f32283a212979e97028..d6caf8c47606c9787b5beb75df362e6d6c783d36 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index e9e2e55e6b52c2c09cf9f366e02d2823e0a863d8..59c3db48156f14dee6b5bdbad71c12dd9497f70a 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 64b5cfe5abe40d1348a1c21ab45fc46365f67c85..a4b10cec056912bee721151084ca7efd3d11397b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Adapted for inclusion into OpenLDAP by Kurt D. Zeilenga */
index e4e7dbcadbd2af9e60173871a25186e2edf40666..73dff64219f9ed05581a3fed531df3eadf153232 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
index d869213bf5fa0dc176374a76b710c6e4381a6939..eff722f0836b716028ee6ba3fb6a9a1556633a23 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
index 8eedb75c2deaa4b3d930a457f365cdd841d8aff1..9cb0025561fca554f8a7f859bbb3daad3273b555 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
index 8673f13954f8a603eaed667618545456fb3df378..825761e33035c9e237b695c977b8dd17fc746616 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
index b4e05394417bc6c542d4f15968409a977af1d89f..94e4391947e7036f8160f65383595aed310b4c19 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
index e88931b6be8feb2a6976a55b36ad63cc5a954946..021c95335c27e37a102ba65f9876bc9c9b81ba39 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
index feb42a95d5b2fc9f824ec4cac7db5a6c996ac0a8..231d3be57e1cc89393959f0bd216d6a1f4023f30 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
diff --git a/libraries/libldap_r/threads.c b/libraries/libldap_r/threads.c
new file mode 100644 (file)
index 0000000..7b7ae96
--- /dev/null
@@ -0,0 +1,88 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 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.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdarg.h>
+#include <ac/stdlib.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
+
+#include "ldap_pvt_thread.h"
+
+
+/*
+ * Common LDAP thread routines
+ *     see thr_*.c for implementation specific routines
+ *     see rdwr.c for generic reader/writer lock implementation
+ *     see tpool.c for generic thread pool implementation
+ */
+
+
+int ldap_pvt_thread_initialize( void )
+{
+       int rc;
+       static int init = 0;
+
+       /* we only get one shot at this */
+       if( init++ ) return -1;
+
+       rc = ldap_int_thread_initialize();
+       if( rc ) return rc;
+
+#ifndef LDAP_THREAD_HAVE_TPOOL
+       rc = ldap_int_thread_pool_startup();
+       if( rc ) return rc;
+#endif
+
+       return 0;
+}
+
+int ldap_pvt_thread_destroy( void )
+{
+#ifndef LDAP_THREAD_HAVE_TPOOL
+       (void) ldap_int_thread_pool_shutdown();
+#endif
+       return ldap_int_thread_destroy();
+}
+
+#ifndef LDAP_THREAD_HAVE_GETCONCURRENCY
+int
+ldap_pvt_thread_get_concurrency ( void )
+{
+       return 1;
+}
+#endif
+
+#ifndef LDAP_THREAD_HAVE_SETCONCURRENCY
+int
+ldap_pvt_thread_set_concurrency ( int concurrency )
+{
+       return 1;
+}
+#endif
+
+#ifndef LDAP_THREAD_HAVE_SLEEP
+/*
+ * 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;
+}
+#endif
index aa0eb2d781b909d7d0f7c7ea0f6c504d783c4263..0910124b489a3f83177fb3dc3adc33db4e38cabb 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
diff --git a/libraries/libldbm/Makefile.in b/libraries/libldbm/Makefile.in
new file mode 100644 (file)
index 0000000..a1f0165
--- /dev/null
@@ -0,0 +1,17 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+##
+## Makefile for -lldbm
+##
+
+LIBRARY                = libldbm.a
+SRCS           = ldbm.c
+OBJS           = ldbm.o
+
+LDAP_INCDIR= ../../include       
+LDAP_LIBDIR= ../../libraries
+
+XLIBS          = $(LIBRARY)
+XXLIBS         = $(LDBM_LIBS)
+
index 111ba97e627dbc56cc14ebc24db230feebb7711e..a464cd0f9b6be065a32c188cac430fd6d6fcb80b 100644 (file)
@@ -1,7 +1,7 @@
 /* ldbm.c - ldap dbm compatibility routines */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/libraries/libldif/Makefile.in b/libraries/libldif/Makefile.in
new file mode 100644 (file)
index 0000000..66fbb37
--- /dev/null
@@ -0,0 +1,14 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+##
+## Makefile for -lldif
+##
+
+LIBRARY        = libldif.a
+SRCS   = line64.c fetch.c
+OBJS   = line64.o fetch.o
+
+LDAP_INCDIR= ../../include       
+LDAP_LIBDIR= ../../libraries
+
index 36baf734c2fa3ee9f92219998ba157d896be4c62..cb4d81beed8e93924a413b59713d6405f22bd660 100644 (file)
@@ -1,7 +1,7 @@
 /* line64.c - routines for dealing with the slapd line format */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 1d0310793b98a030a41aa0b47b7695d0c7af1f56..646418c87b177585e4c87811b0db990e50cedab7 100644 (file)
@@ -1,7 +1,7 @@
 /* line64.c - routines for dealing with the slapd line format */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index a96d8d8bc834053a63d878a7535d4308b1c87cba..b8e27695f9ccf560a984c4ff89e5e071c5d2e076 100644 (file)
@@ -1,5 +1,5 @@
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
 ## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 ##
 ## Makefile for -llutil
diff --git a/libraries/liblutil/base64.c b/libraries/liblutil/base64.c
new file mode 100644 (file)
index 0000000..e5d4f36
--- /dev/null
@@ -0,0 +1,322 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * Modified by Kurt D. Zeilenga for inclusion into OpenLDAP
+ */
+
+/*
+ * Copyright (c) 1996, 1998 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software.  No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE.  IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "portable.h"
+
+#include <ac/assert.h>
+#include <ac/stdlib.h>
+#include <ac/ctype.h>
+#include <ac/string.h>
+
+/* include socket.h to get sys/types.h and/or winsock2.h */
+#include <ac/socket.h>
+
+#include "lutil.h"
+
+static const char Base64[] =
+       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char Pad64 = '=';
+
+/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
+   The following encoding technique is taken from RFC 1521 by Borenstein
+   and Freed.  It is reproduced here in a slightly edited form for
+   convenience.
+
+   A 65-character subset of US-ASCII is used, enabling 6 bits to be
+   represented per printable character. (The extra 65th character, "=",
+   is used to signify a special processing function.)
+
+   The encoding process represents 24-bit groups of input bits as output
+   strings of 4 encoded characters. Proceeding from left to right, a
+   24-bit input group is formed by concatenating 3 8-bit input groups.
+   These 24 bits are then treated as 4 concatenated 6-bit groups, each
+   of which is translated into a single digit in the base64 alphabet.
+
+   Each 6-bit group is used as an index into an array of 64 printable
+   characters. The character referenced by the index is placed in the
+   output string.
+
+                         Table 1: The Base64 Alphabet
+
+      Value Encoding  Value Encoding  Value Encoding  Value Encoding
+          0 A            17 R            34 i            51 z
+          1 B            18 S            35 j            52 0
+          2 C            19 T            36 k            53 1
+          3 D            20 U            37 l            54 2
+          4 E            21 V            38 m            55 3
+          5 F            22 W            39 n            56 4
+          6 G            23 X            40 o            57 5
+          7 H            24 Y            41 p            58 6
+          8 I            25 Z            42 q            59 7
+          9 J            26 a            43 r            60 8
+         10 K            27 b            44 s            61 9
+         11 L            28 c            45 t            62 +
+         12 M            29 d            46 u            63 /
+         13 N            30 e            47 v
+         14 O            31 f            48 w         (pad) =
+         15 P            32 g            49 x
+         16 Q            33 h            50 y
+
+   Special processing is performed if fewer than 24 bits are available
+   at the end of the data being encoded.  A full encoding quantum is
+   always completed at the end of a quantity.  When fewer than 24 input
+   bits are available in an input group, zero bits are added (on the
+   right) to form an integral number of 6-bit groups.  Padding at the
+   end of the data is performed using the '=' character.
+
+   Since all base64 input is an integral number of octets, only the
+         -------------------------------------------------                       
+   following cases can arise:
+   
+       (1) the final quantum of encoding input is an integral
+           multiple of 24 bits; here, the final unit of encoded
+          output will be an integral multiple of 4 characters
+          with no "=" padding,
+       (2) the final quantum of encoding input is exactly 8 bits;
+           here, the final unit of encoded output will be two
+          characters followed by two "=" padding characters, or
+       (3) the final quantum of encoding input is exactly 16 bits;
+           here, the final unit of encoded output will be three
+          characters followed by one "=" padding character.
+   */
+
+int
+lutil_b64_ntop(
+       u_char const *src,
+       size_t srclength,
+       char *target,
+       size_t targsize)
+{
+       size_t datalength = 0;
+       u_char input[3];
+       u_char output[4];
+       size_t i;
+
+       while (2 < srclength) {
+               input[0] = *src++;
+               input[1] = *src++;
+               input[2] = *src++;
+               srclength -= 3;
+
+               output[0] = input[0] >> 2;
+               output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+               output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+               output[3] = input[2] & 0x3f;
+               assert(output[0] < 64);
+               assert(output[1] < 64);
+               assert(output[2] < 64);
+               assert(output[3] < 64);
+
+               if (datalength + 4 > targsize)
+                       return (-1);
+               target[datalength++] = Base64[output[0]];
+               target[datalength++] = Base64[output[1]];
+               target[datalength++] = Base64[output[2]];
+               target[datalength++] = Base64[output[3]];
+       }
+    
+       /* Now we worry about padding. */
+       if (0 != srclength) {
+               /* Get what's left. */
+               input[0] = input[1] = input[2] = '\0';
+               for (i = 0; i < srclength; i++)
+                       input[i] = *src++;
+       
+               output[0] = input[0] >> 2;
+               output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+               output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+               assert(output[0] < 64);
+               assert(output[1] < 64);
+               assert(output[2] < 64);
+
+               if (datalength + 4 > targsize)
+                       return (-1);
+               target[datalength++] = Base64[output[0]];
+               target[datalength++] = Base64[output[1]];
+               if (srclength == 1)
+                       target[datalength++] = Pad64;
+               else
+                       target[datalength++] = Base64[output[2]];
+               target[datalength++] = Pad64;
+       }
+       if (datalength >= targsize)
+               return (-1);
+       target[datalength] = '\0';      /* Returned value doesn't count \0. */
+       return (datalength);
+}
+
+/* skips all whitespace anywhere.
+   converts characters, four at a time, starting at (or after)
+   src from base - 64 numbers into three 8 bit bytes in the target area.
+   it returns the number of data bytes stored at the target, or -1 on error.
+ */
+
+int
+lutil_b64_pton(
+       char const *src,
+       u_char *target, 
+       size_t targsize)
+{
+       int tarindex, state, ch;
+       char *pos;
+
+       state = 0;
+       tarindex = 0;
+
+       while ((ch = *src++) != '\0') {
+               if (isascii(ch) && isspace(ch)) /* Skip whitespace anywhere. */
+                       continue;
+
+               if (ch == Pad64)
+                       break;
+
+               pos = strchr(Base64, ch);
+               if (pos == 0)           /* A non-base64 character. */
+                       return (-1);
+
+               switch (state) {
+               case 0:
+                       if (target) {
+                               if ((size_t)tarindex >= targsize)
+                                       return (-1);
+                               target[tarindex] = (pos - Base64) << 2;
+                       }
+                       state = 1;
+                       break;
+               case 1:
+                       if (target) {
+                               if ((size_t)tarindex + 1 >= targsize)
+                                       return (-1);
+                               target[tarindex]   |=  (pos - Base64) >> 4;
+                               target[tarindex+1]  = ((pos - Base64) & 0x0f)
+                                                       << 4 ;
+                       }
+                       tarindex++;
+                       state = 2;
+                       break;
+               case 2:
+                       if (target) {
+                               if ((size_t)tarindex + 1 >= targsize)
+                                       return (-1);
+                               target[tarindex]   |=  (pos - Base64) >> 2;
+                               target[tarindex+1]  = ((pos - Base64) & 0x03)
+                                                       << 6;
+                       }
+                       tarindex++;
+                       state = 3;
+                       break;
+               case 3:
+                       if (target) {
+                               if ((size_t)tarindex >= targsize)
+                                       return (-1);
+                               target[tarindex] |= (pos - Base64);
+                       }
+                       tarindex++;
+                       state = 0;
+                       break;
+               default:
+                       abort();
+               }
+       }
+
+       /*
+        * We are done decoding Base-64 chars.  Let's see if we ended
+        * on a byte boundary, and/or with erroneous trailing characters.
+        */
+
+       if (ch == Pad64) {              /* We got a pad char. */
+               ch = *src++;            /* Skip it, get next. */
+               switch (state) {
+               case 0:         /* Invalid = in first position */
+               case 1:         /* Invalid = in second position */
+                       return (-1);
+
+               case 2:         /* Valid, means one byte of info */
+                       /* Skip any number of spaces. */
+                       for ((void)NULL; ch != '\0'; ch = *src++)
+                               if (! (isascii(ch) && isspace(ch)))
+                                       break;
+                       /* Make sure there is another trailing = sign. */
+                       if (ch != Pad64)
+                               return (-1);
+                       ch = *src++;            /* Skip the = */
+                       /* Fall through to "single trailing =" case. */
+                       /* FALLTHROUGH */
+
+               case 3:         /* Valid, means two bytes of info */
+                       /*
+                        * We know this char is an =.  Is there anything but
+                        * whitespace after it?
+                        */
+                       for ((void)NULL; ch != '\0'; ch = *src++)
+                               if (! (isascii(ch) && isspace(ch)))
+                                       return (-1);
+
+                       /*
+                        * Now make sure for cases 2 and 3 that the "extra"
+                        * bits that slopped past the last full byte were
+                        * zeros.  If we don't check them, they become a
+                        * subliminal channel.
+                        */
+                       if (target && target[tarindex] != 0)
+                               return (-1);
+               }
+       } else {
+               /*
+                * We ended by seeing the end of the string.  Make sure we
+                * have no partial bytes lying around.
+                */
+               if (state != 0)
+                       return (-1);
+       }
+
+       return (tarindex);
+}
index 752ee35f89a3f2b7f6e656ab0711acd9f827331e..6f49a8cf1371dbe108ba8f7282e6cbb3a5dedc06 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Portions
index 74d3f3210ab8b875d5400428b230a376b47a061e..6995cf4bc654451836d93a06a7a9e322bdee57ab 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 137944ab6f7d2552305e311af20fadaa53e6bd8a..1727aaf64166c5c02ac5251f5d261b6215884c90 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
diff --git a/libraries/liblutil/getpass.c b/libraries/liblutil/getpass.c
new file mode 100644 (file)
index 0000000..da404df
--- /dev/null
@@ -0,0 +1,163 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * Copyright (c) 1992, 1993  Regents of the University of Michigan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of Michigan at Ann Arbor. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/signal.h>
+#include <ac/string.h>
+#include <ac/termios.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef NEED_GETPASSPHRASE
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_CONIO_H
+#include <conio.h>
+#endif
+
+#include <lber.h>
+#include <ldap.h>
+
+#include "ldap_defaults.h"
+
+char *
+lutil_getpass( const char *prompt )
+{
+#if !defined(HAVE_POSIX_TERMIOS) && !defined(HAVE_SGTTY_H)
+       static char buf[256];
+       int i, c;
+
+       if( prompt == NULL ) prompt = "Password: ";
+
+#ifdef DEBUG
+       if (debug & D_TRACE)
+               printf("->getpass(%s)\n", prompt);
+#endif
+
+       printf("%s", prompt);
+       i = 0;
+       while ( (c = getch()) != EOF && c != '\n' && c != '\r' )
+               buf[i++] = c;
+       if ( c == EOF )
+               return( NULL );
+       buf[i] = '\0';
+       return (buf);
+#else
+       int no_pass = 0;
+       char i, j, k;
+       TERMIO_TYPE ttyb;
+       TERMFLAG_TYPE flags;
+       static char pbuf[513];
+       register char *p;
+       register int c;
+       FILE *fi;
+       RETSIGTYPE (*sig)( int sig );
+
+       if( prompt == NULL ) prompt = "Password: ";
+
+#ifdef DEBUG
+       if (debug & D_TRACE)
+               printf("->getpass(%s)\n", prompt);
+#endif
+       /*
+        *  Stolen from the getpass() routine.  Can't use the plain
+        *  getpass() for two reasons.  One is that LDAP passwords
+        *  can be really, really long - much longer than 8 chars.
+        *  The second is that we like to make this client available
+        *  out of inetd via a Merit asynch port, and we need to be
+        *  able to do telnet control codes to turn on and off line
+        *  blanking.
+        */
+       if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
+               fi = stdin;
+       else
+               setbuf(fi, (char *)NULL);
+       sig = SIGNAL (SIGINT, SIG_IGN);
+       if (fi != stdin) {
+               if (GETATTR(fileno(fi), &ttyb) < 0)
+                       perror("GETATTR");
+       }
+       flags = GETFLAGS( ttyb );
+       SETFLAGS( ttyb, flags & ~ECHO );
+       if (fi != stdin) {
+               if (SETATTR(fileno(fi), &ttyb) < 0)
+                       perror("SETATTR");
+       }
+
+       /*  blank the line if through Merit */
+       if (fi == stdin) {
+               printf("%c%c%c", 255, 251, 1);
+               fflush(stdout);
+               (void) scanf("%c%c%c", &i, &j, &k);
+               fflush(stdin);
+       }
+
+       /* fetch the password */
+       fprintf(stdout, "%s", prompt); 
+       fflush(stdout);
+       for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) {
+               if (c == '\r')
+                       break;
+               if (p < &pbuf[512])
+                       *p++ = c;
+       }
+       if (c == EOF)
+               no_pass = 1;
+       else {
+               *p = '\0';
+               if (*(p - 1) == '\r')
+                       *(p - 1) = '\0';
+       }
+
+       /*  unblank the line if through Merit */
+       if (fi == stdin) {
+               printf("%c%c%c", 255, 252, 1);
+               fflush(stdout);
+               (void) scanf("%c%c%c", &i, &j, &k);
+               fflush(stdin);
+               printf("\n"); fflush(stdout);
+       }
+       fprintf(stdout, "\n"); 
+       fflush(stdout);
+
+       /* tidy up */
+       SETFLAGS( ttyb, flags );
+       if (fi != stdin) {
+               if (SETATTR(fileno(fi), &ttyb) < 0)
+                       perror("SETATTR");
+       }
+       (void) SIGNAL (SIGINT, sig);
+       if (fi != stdin)
+               (void) fclose(fi);
+       else
+               i = getchar();
+       if (no_pass)
+               return(NULL);
+       return(pbuf);
+#endif
+}
+
+#endif /* !NEED_GETPASSPHRASE */
diff --git a/libraries/liblutil/lockf.c b/libraries/liblutil/lockf.c
new file mode 100644 (file)
index 0000000..ecc7ec4
--- /dev/null
@@ -0,0 +1,114 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 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
diff --git a/libraries/liblutil/md5.c b/libraries/liblutil/md5.c
new file mode 100644 (file)
index 0000000..aaf7ec8
--- /dev/null
@@ -0,0 +1,323 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * Modified by Kurt D. Zeilenga for inclusion into OpenLDAP
+ * I hereby disclaim copyright in any changes I have made; this
+ * code remains in the public domain.
+ */
+
+/*
+ * This code implements the MD5 message-digest algorithm.
+ * The algorithm is due to Ron Rivest.  This code was
+ * written by Colin Plumb in 1993, no copyright is claimed.
+ * This code is in the public domain; do with it what you wish.
+ *
+ * Equivalent code is available from RSA Data Security, Inc.
+ * This code has been tested against that, and is equivalent,
+ * except that you don't need to include two pages of legalese
+ * with every copy.
+ *
+ * To compute the message digest of a chunk of bytes, declare an
+ * MD5Context structure, pass it to MD5Init, call MD5Update as
+ * needed on buffers full of bytes, and then call MD5Final, which
+ * will fill a supplied 16-byte array with the digest.
+ */
+
+/* This code was modified in 1997 by Jim Kingdon of Cyclic Software to
+   not require an integer type which is exactly 32 bits.  This work
+   draws on the changes for the same purpose by Tatu Ylonen
+   <ylo@cs.hut.fi> as part of SSH, but since I didn't actually use
+   that code, there is no copyright issue.  I hereby disclaim
+   copyright in any changes I have made; this code remains in the
+   public domain.  */
+
+#include "portable.h"
+
+#include <ac/string.h>
+
+/* include socket.h to get sys/types.h and/or winsock2.h */
+#include <ac/socket.h>
+
+#include <lutil_md5.h>
+
+/* Little-endian byte-swapping routines.  Note that these do not
+   depend on the size of datatypes such as ber_uint_t, nor do they require
+   us to detect the endianness of the machine we are running on.  It
+   is possible they should be macros for speed, but I would be
+   surprised if they were a performance bottleneck for MD5.  */
+
+static ber_uint_t
+getu32( const unsigned char *addr )
+{
+       return (((((unsigned long)addr[3] << 8) | addr[2]) << 8)
+               | addr[1]) << 8 | addr[0];
+}
+
+static void
+putu32( ber_uint_t data, unsigned char *addr )
+{
+       addr[0] = (unsigned char)data;
+       addr[1] = (unsigned char)(data >> 8);
+       addr[2] = (unsigned char)(data >> 16);
+       addr[3] = (unsigned char)(data >> 24);
+}
+
+/*
+ * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
+ * initialization constants.
+ */
+void
+lutil_MD5Init( struct lutil_MD5Context *ctx )
+{
+       ctx->buf[0] = 0x67452301;
+       ctx->buf[1] = 0xefcdab89;
+       ctx->buf[2] = 0x98badcfe;
+       ctx->buf[3] = 0x10325476;
+
+       ctx->bits[0] = 0;
+       ctx->bits[1] = 0;
+}
+
+/*
+ * Update context to reflect the concatenation of another buffer full
+ * of bytes.
+ */
+void
+lutil_MD5Update(
+    struct lutil_MD5Context    *ctx,
+    const unsigned char                *buf,
+    ber_len_t          len
+)
+{
+       ber_uint_t t;
+
+       /* Update bitcount */
+
+       t = ctx->bits[0];
+       if ((ctx->bits[0] = (t + ((ber_uint_t)len << 3)) & 0xffffffff) < t)
+               ctx->bits[1]++; /* Carry from low to high */
+       ctx->bits[1] += len >> 29;
+
+       t = (t >> 3) & 0x3f;    /* Bytes already in shsInfo->data */
+
+       /* Handle any leading odd-sized chunks */
+
+       if ( t ) {
+               unsigned char *p = ctx->in + t;
+
+               t = 64-t;
+               if (len < t) {
+                       AC_MEMCPY(p, buf, len);
+                       return;
+               }
+               AC_MEMCPY(p, buf, t);
+               lutil_MD5Transform(ctx->buf, ctx->in);
+               buf += t;
+               len -= t;
+       }
+
+       /* Process data in 64-byte chunks */
+
+       while (len >= 64) {
+               AC_MEMCPY(ctx->in, buf, 64);
+               lutil_MD5Transform(ctx->buf, ctx->in);
+               buf += 64;
+               len -= 64;
+       }
+
+       /* Handle any remaining bytes of data. */
+
+       AC_MEMCPY(ctx->in, buf, len);
+}
+
+/*
+ * Final wrapup - pad to 64-byte boundary with the bit pattern 
+ * 1 0* (64-bit count of bits processed, MSB-first)
+ */
+void
+lutil_MD5Final( unsigned char *digest, struct lutil_MD5Context *ctx )
+{
+       unsigned count;
+       unsigned char *p;
+
+       /* Compute number of bytes mod 64 */
+       count = (ctx->bits[0] >> 3) & 0x3F;
+
+       /* Set the first char of padding to 0x80.  This is safe since there is
+          always at least one byte free */
+       p = ctx->in + count;
+       *p++ = 0x80;
+
+       /* Bytes of padding needed to make 64 bytes */
+       count = 64 - 1 - count;
+
+       /* Pad out to 56 mod 64 */
+       if (count < 8) {
+               /* Two lots of padding:  Pad the first block to 64 bytes */
+               memset(p, '\0', count);
+               lutil_MD5Transform(ctx->buf, ctx->in);
+
+               /* Now fill the next block with 56 bytes */
+               memset(ctx->in, '\0', 56);
+       } else {
+               /* Pad block to 56 bytes */
+               memset(p, '\0', count-8);
+       }
+
+       /* Append length in bits and transform */
+       putu32(ctx->bits[0], ctx->in + 56);
+       putu32(ctx->bits[1], ctx->in + 60);
+
+       lutil_MD5Transform(ctx->buf, ctx->in);
+       putu32(ctx->buf[0], digest);
+       putu32(ctx->buf[1], digest + 4);
+       putu32(ctx->buf[2], digest + 8);
+       putu32(ctx->buf[3], digest + 12);
+       memset(ctx, '\0', sizeof(ctx)); /* In case it's sensitive */
+}
+
+#ifndef ASM_MD5
+
+/* The four core functions - F1 is optimized somewhat */
+
+/* #define F1(x, y, z) (x & y | ~x & z) */
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
+#define F2(x, y, z) F1(z, x, y)
+#define F3(x, y, z) (x ^ y ^ z)
+#define F4(x, y, z) (y ^ (x | ~z))
+
+/* This is the central step in the MD5 algorithm. */
+#define MD5STEP(f, w, x, y, z, data, s) \
+       ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<<s | w>>(32-s), w += x )
+
+/*
+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
+ * reflect the addition of 16 longwords of new data.  MD5Update blocks
+ * the data and converts bytes into longwords for this routine.
+ */
+void
+lutil_MD5Transform( ber_uint_t *buf, const unsigned char *inraw )
+{
+       register ber_uint_t a, b, c, d;
+       ber_uint_t in[16];
+       int i;
+
+       for (i = 0; i < 16; ++i)
+               in[i] = getu32 (inraw + 4 * i);
+
+       a = buf[0];
+       b = buf[1];
+       c = buf[2];
+       d = buf[3];
+
+       MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478,  7);
+       MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
+       MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
+       MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
+       MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf,  7);
+       MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
+       MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
+       MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
+       MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8,  7);
+       MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
+       MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
+       MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
+       MD5STEP(F1, a, b, c, d, in[12]+0x6b901122,  7);
+       MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
+       MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
+       MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
+
+       MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562,  5);
+       MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340,  9);
+       MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
+       MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
+       MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d,  5);
+       MD5STEP(F2, d, a, b, c, in[10]+0x02441453,  9);
+       MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
+       MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
+       MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6,  5);
+       MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6,  9);
+       MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
+       MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
+       MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905,  5);
+       MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8,  9);
+       MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
+       MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
+
+       MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942,  4);
+       MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
+       MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
+       MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
+       MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44,  4);
+       MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
+       MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
+       MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
+       MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6,  4);
+       MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
+       MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
+       MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
+       MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039,  4);
+       MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
+       MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
+       MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
+
+       MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244,  6);
+       MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
+       MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
+       MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
+       MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3,  6);
+       MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
+       MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
+       MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
+       MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f,  6);
+       MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
+       MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
+       MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
+       MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82,  6);
+       MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
+       MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
+       MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
+
+       buf[0] += a;
+       buf[1] += b;
+       buf[2] += c;
+       buf[3] += d;
+}
+#endif
+
+#ifdef TEST
+/* Simple test program.  Can use it to manually run the tests from
+   RFC1321 for example.  */
+#include <stdio.h>
+
+int
+main (int  argc, char **argv )
+{
+       struct lutil_MD5Context context;
+       unsigned char checksum[LUTIL_MD5_BYTES];
+       int i;
+       int j;
+
+       if (argc < 2)
+       {
+               fprintf (stderr, "usage: %s string-to-hash\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+       for (j = 1; j < argc; ++j)
+       {
+               printf ("MD5 (\"%s\") = ", argv[j]);
+               lutil_MD5Init (&context);
+               lutil_MD5Update (&context, argv[j], strlen (argv[j]));
+               lutil_MD5Final (checksum, &context);
+               for (i = 0; i < LUTIL_MD5_BYTES; i++)
+               {
+                       printf ("%02x", (unsigned int) checksum[i]);
+               }
+               printf ("\n");
+       }
+       return EXIT_SUCCESS;
+}
+#endif /* TEST */
index efcf1ae1c11b83c86e4136fedb1958f2a81f88a3..42b3d99e76fe2833f2fa452df3ee03ad2a2c590a 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index f31466aea2e97bffe6bb7504698723f68681d2cf..a42eaddb2ebdc9beb82c5a923021540bfb9602d1 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2002-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 751852520aedbbe3e2a5b1775282ebc1c21cf2f1..144dd1afe5daf372756fadd4e94923da70063394 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
diff --git a/libraries/liblutil/ptest.c b/libraries/liblutil/ptest.c
new file mode 100644 (file)
index 0000000..6638551
--- /dev/null
@@ -0,0 +1,103 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/signal.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include <lber.h>
+
+#include "lutil.h"
+
+/*
+ * Password Test Program
+ */
+
+static char *hash[] = {
+#ifdef SLAP_AUTHPASSWD
+       "SHA1", "MD5",
+#else
+#ifdef SLAPD_CRYPT
+       "{CRYPT}",
+#endif
+       "{SSHA}", "{SMD5}",
+       "{SHA}", "{MD5}",
+       "{BOGUS}",
+#endif
+       NULL
+};
+
+static struct berval pw[] = {
+       { sizeof("secret")-1,                   "secret" },
+       { sizeof("binary\0secret")-1,   "binary\0secret" },
+       { 0, NULL }
+};
+
+int
+main( int argc, char *argv[] )
+{
+       int i, j, rc;
+       struct berval *passwd;
+#ifdef SLAP_AUTHPASSWD
+       struct berval *salt;
+#endif
+       struct berval bad;
+       bad.bv_val = "bad password";
+       bad.bv_len = sizeof("bad password")-1;
+
+       for( i= 0; hash[i]; i++ ) {
+               for( j = 0; pw[j].bv_len; j++ ) {
+#ifdef SLAP_AUTHPASSWD
+                       rc = lutil_authpasswd_hash( &pw[j],
+                               &passwd, &salt, hash[i] );
+
+                       if( rc )
+#else
+                       passwd = lutil_passwd_hash( &pw[j], hash[i] );
+
+                       if( passwd == NULL )
+#endif
+                       {
+                               printf("%s generate fail: %s (%d)\n", 
+                                       hash[i], pw[j].bv_val, pw[j].bv_len );
+                               continue;
+                       }
+
+
+#ifdef SLAP_AUTHPASSWD
+                       rc = lutil_authpasswd( &pw[j], passwd, salt, NULL );
+#else
+                       rc = lutil_passwd( passwd, &pw[j], NULL );
+#endif
+
+                       printf("%s (%d): %s (%d)\t(%d) %s\n",
+                               pw[j].bv_val, pw[j].bv_len, passwd->bv_val, passwd->bv_len,
+                               rc, rc == 0 ? "OKAY" : "BAD" );
+
+#ifdef SLAP_AUTHPASSWD
+                       rc = lutil_authpasswd( passwd, salt, &bad, NULL );
+#else
+                       rc = lutil_passwd( passwd, &bad, NULL );
+#endif
+
+                       printf("%s (%d): %s (%d)\t(%d) %s\n",
+                               bad.bv_val, bad.bv_len, passwd->bv_val, passwd->bv_len,
+                               rc, rc != 0 ? "OKAY" : "BAD" );
+               }
+
+               printf("\n");
+       }
+
+       return EXIT_SUCCESS;
+}
\ No newline at end of file
index a486afc7ca96f36778a92aa81e643f4631a62b0d..c920eec66e30d8c5fb271407d87917c0fd0ecec2 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 3ef447e82314da1291971dad165c5658680981c3..db3e9425a8b5bb6f78fad13a16914d8c8d15aaff 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*     Acquired from:
diff --git a/libraries/liblutil/signal.c b/libraries/liblutil/signal.c
new file mode 100644 (file)
index 0000000..4f898ec
--- /dev/null
@@ -0,0 +1,33 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 2000-2003 The OpenLDAP Foundation
+ * COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
+ * of this package for details.
+ */
+
+#include "portable.h"
+
+#ifdef HAVE_SIGACTION
+#include <ac/string.h>
+#include <ac/signal.h>
+
+lutil_sig_t
+lutil_sigaction(int sig, lutil_sig_t func)
+{
+       struct sigaction action, oaction;
+
+       memset( &action, '\0', sizeof(action) );
+
+       action.sa_handler = func;
+       sigemptyset( &action.sa_mask );
+#ifdef SA_RESTART
+       action.sa_flags |= SA_RESTART;
+#endif
+       
+       if( sigaction( sig, &action, &oaction ) != 0 ) {
+               return NULL;
+       }
+
+       return oaction.sa_handler;
+}
+#endif
diff --git a/libraries/liblutil/sockpair.c b/libraries/liblutil/sockpair.c
new file mode 100644 (file)
index 0000000..cfe6ec3
--- /dev/null
@@ -0,0 +1,68 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 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( ber_socket_t sds[2] )
+{
+#ifdef USE_PIPE
+       return pipe( sds );
+#else
+       struct sockaddr_in si;
+       int rc, len = sizeof(si);
+       ber_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] = sd;
+#if !HAVE_WINSOCK
+       sds[1] = dup( sds[0] );
+#else
+       sds[1] = sds[0];
+#endif
+       return 0;
+#endif
+}
index 973406f21ebde25448f840517aba226129c7b79b..1aaa30888340bb8a93a06796bdf27a044aebe24d 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 0f3bbe75f108548f50151c863b3f46ce31a87e3f..a9640c13603197e4ef7dbf3b87a665a88b9ab97a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Portions
diff --git a/libraries/librewrite/Makefile.in b/libraries/librewrite/Makefile.in
new file mode 100644 (file)
index 0000000..f2e4cdf
--- /dev/null
@@ -0,0 +1,28 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+##
+## LIBREWRITE
+##
+## Copyright 2000-2001 Pierangelo Masarati <ando@sys-net.it>
+##
+
+SRCS = config.c context.c info.c ldapmap.c map.c params.c rule.c \
+       session.c subst.c var.c \
+       parse.c rewrite.c
+XSRCS = version.c
+OBJS = config.o context.o info.o ldapmap.o map.o params.o rule.o \
+       session.o subst.o var.o
+
+LDAP_INCDIR= ../../include       
+LDAP_LIBDIR= ../../libraries
+
+LIBRARY = librewrite.a
+PROGRAMS       = rewrite
+XLIBS = $(LIBRARY) $(LDAP_LIBAVL_A) $(LDAP_LIBLUTIL_A) \
+       $(LDAP_LIBLDAP_R_LA) $(LDAP_LIBLBER_LA)
+XXLIBS  = $(SECURITY_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
+XXXLIBS = $(LTHREAD_LIBS)
+
+rewrite:       $(XLIBS) rewrite.o parse.o
+       $(LTLINK) -o $@ rewrite.o parse.o $(LIBS)
diff --git a/servers/Makefile.in b/servers/Makefile.in
new file mode 100644 (file)
index 0000000..38564a2
--- /dev/null
@@ -0,0 +1,8 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+##
+## servers Makefile.in for OpenLDAP
+
+SUBDIRS= slapd slurpd
+
index ab9c56511ed0052bc06f44e07aa350d29230f32a..be4a3f82a2f1652116a03d9d19e01344eaab73c6 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* attr.c - routines for dealing with attributes */
index e0fdd8bb2e8decf242ae5c381d37f9d9d83996f9..01287a0b4f040dd17cfc99dbc327018ba0673c95 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* ava.c - routines for dealing with attribute value assertions */
index 270077928a2dee9f6ad2e2fdf569a19662f1a451..df74448224530dea8c1c4c1677371bfc22ba34cb 100644 (file)
@@ -1,7 +1,7 @@
 /* compare.c - bdb backend compare routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 4ce4913aaca2b2bec9a4dde22cf2d2a7390999af..5011470d54712342c2c4537427453e3ba61471c5 100644 (file)
@@ -1,7 +1,7 @@
 /* config.c - bdb backend configuration file routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 7d8d082590125beaf3a8a950444c8fc03a7820d0..7f5d6718d09a5509be18638cc28058b5f23d933d 100644 (file)
@@ -1,7 +1,7 @@
 /* dbcache.c - manage cache of open databases */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index c2817e23b22104671732c539b0c06adff54c940b..32df2682fc36ae8d428aeb520772a8ab016aa30c 100644 (file)
@@ -1,7 +1,7 @@
 /* dn2entry.c - routines to deal with the dn2id / id2entry glue */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 79d528a0e0272b53aaab46b5902defd5a097718a..783d23cc42e4d54f8215ac4eecdcea4b610f3dce 100644 (file)
@@ -1,7 +1,7 @@
 /* error.c - BDB errcall routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index e3c26e18d12cbda1ef8f2c805a29ecdd8d6faef9..231d4e903d9898ee2fb7fda51eecd48dcce54718 100644 (file)
@@ -1,7 +1,7 @@
 /* extended.c - bdb backend extended routines */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index c06d3bba9af360e572e967184e4b41d6f428cbc1..eaf6b691fda489cad10380bf4315058cf8a27dcd 100644 (file)
@@ -1,7 +1,7 @@
 /* back-bdb.h - ldap ldbm back-end header file */
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 20f59088a3848c06e4470d3534ae95d39d84c7d3..aa6e966fd7ef427758c196fb6dd15e38798c588f 100644 (file)
@@ -1,7 +1,7 @@
 /* index.c - routines for dealing with attribute indexes */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index b9e4151b34aa715c2b2b1a72f9baff38f6591e5a..04b2f267ccb174f34fd0e7bc83fd74d0f570bedb 100644 (file)
@@ -1,7 +1,7 @@
 /* init.c - initialize bdb backend */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 1ecbf1dddce1b3c1f16c867836c8e67adf61914c..2552248bb792870f13f7e1234630f64eefdecd83 100644 (file)
@@ -1,7 +1,7 @@
 /* referral.c - BDB backend referral handler */
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 679ca32c000fc8e13090bc046a747c7ac96fb9a1..cd7a4460412582d98e7806d4b3979ffa99bb40e9 100644 (file)
@@ -1,7 +1,7 @@
 /* tools.c - tools for slap tools */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index adb59251481b4f9f6620fe23adefbc9ae6389144..0ead2caa19b806750ef05041586b8febbb64c99f 100644 (file)
@@ -1,7 +1,7 @@
 /* bind.c - DNS SRV backend bind function */
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/servers/slapd/back-dnssrv/compare.c b/servers/slapd/back-dnssrv/compare.c
new file mode 100644 (file)
index 0000000..980843e
--- /dev/null
@@ -0,0 +1,33 @@
+/* compare.c - DNS SRV backend compare function */
+/* $OpenLDAP$ */
+/*
+ * Copyright 2000-2003 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-dnssrv.h"
+
+int
+dnssrv_back_compare(
+    Backend    *be,
+    Connection *conn,
+    Operation  *op,
+    const char *dn,
+    const char *ndn,
+       AttributeAssertion *ava
+)
+{
+       assert( get_manageDSAit( op ) );
+
+       /* not implemented */
+
+       return LDAP_OTHER;
+}
index 4bdb093846b17b19536f7e09c5fbe538d13a21eb..5050febc8d5a9e03448e8f8a3a122a11cb16f0e1 100644 (file)
@@ -1,7 +1,7 @@
 /* config.c - DNS SRV backend configuration file routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 3363644477c17911ff391cf6ed4d4e10298ae658..52bcd6658d2e6fab335f05e88e049e2d3f821732 100644 (file)
@@ -1,7 +1,7 @@
 /* init.c - initialize ldap backend */
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 9aaf23c79c84509c3fa8d649e7e85b27c6b7d285..aa78cf0bed22523a8fb8e55d365d2413fd08e21d 100644 (file)
@@ -1,7 +1,7 @@
 /* referral.c - DNS SRV backend referral handler */
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 2a831bb8f9d1bdcf883876b32fa9950315c74b40..51320acbbd4fae6db5dbda568ddfc0e4c47507ca 100644 (file)
@@ -1,7 +1,7 @@
 /* search.c - DNS SRV backend search function */
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/servers/slapd/back-ldap/Copyright b/servers/slapd/back-ldap/Copyright
new file mode 100644 (file)
index 0000000..7fd47ed
--- /dev/null
@@ -0,0 +1,36 @@
+Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+
+This is an "altered version" of work originally develeped by
+Howard Chu.
+
+Portions 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.
+
+
+
+Portions Copyright 2000, Pierangelo Masarati, All rights reserved.
+<ando@sys-net.it>
+
+This software is being modified by Pierangelo Masarati.
+The previously reported conditions apply to the modified code as well.
+Changes in the original code are highlighted where required.
+Credits for the original code go to the author, Howard Chu.
+
index 501e4d9802930dc7cceabb5c26d9c06c5fddd63d..bed8436d1fd0ce99939ce7456225af5d226df538 100644 (file)
@@ -1,7 +1,7 @@
 /* bind.c - ldap backend bind function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* This is an altered version */
index 3766df2db9ec2094c7302853c61b4ad8db3099be..170f00b1265209199380f83f480240ac7c227e7f 100644 (file)
@@ -1,7 +1,7 @@
 /* delete.c - ldap backend delete function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* This is an altered version */
diff --git a/servers/slapd/back-ldap/external.h b/servers/slapd/back-ldap/external.h
new file mode 100644 (file)
index 0000000..2872e0d
--- /dev/null
@@ -0,0 +1,46 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef _LDAP_EXTERNAL_H
+#define _LDAP_EXTERNAL_H
+
+LDAP_BEGIN_DECL
+
+extern BI_init ldap_back_initialize;
+extern BI_open ldap_back_open;
+extern BI_close        ldap_back_close;
+extern BI_destroy      ldap_back_destroy;
+
+extern BI_db_init      ldap_back_db_init;
+extern BI_db_destroy   ldap_back_db_destroy;
+
+extern BI_db_config    ldap_back_db_config;
+
+extern BI_op_bind      ldap_back_bind;
+
+extern BI_connection_destroy   ldap_back_conn_destroy;
+
+extern BI_op_search    ldap_back_search;
+
+extern BI_op_compare   ldap_back_compare;
+
+extern BI_op_modify    ldap_back_modify;
+
+extern BI_op_modrdn    ldap_back_modrdn;
+
+extern BI_op_add       ldap_back_add;
+
+extern BI_op_delete    ldap_back_delete;
+
+extern BI_op_abandon   ldap_back_abandon;
+
+extern BI_acl_group    ldap_back_group;
+
+extern BI_acl_attribute        ldap_back_attribute;
+
+LDAP_END_DECL
+
+#endif /* _LDAP_EXTERNAL_H */
index 2eb905c844814ed00202cd285e955d75ca2598b4..76f496a26052302c5aebea1be796308b188c3c7a 100644 (file)
@@ -1,7 +1,7 @@
 /* modrdn.c - ldap backend modrdn function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* This is an altered version */
index d6ac6fb83d256db25dc3f5937b0620c61d971a7c..560ef7baeaebc0762e3125da4b62ec6f4bf214e5 100644 (file)
@@ -1,7 +1,7 @@
 /* add.c - ldap ldbm back-end add routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/servers/slapd/back-ldbm/alias.c b/servers/slapd/back-ldbm/alias.c
new file mode 100644 (file)
index 0000000..4521ca4
--- /dev/null
@@ -0,0 +1,287 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 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 int get_alias_dn(
+       Entry *e,
+       struct berval *al,
+       int *err,
+       const char **errmsg );
+
+static void new_superior(
+       struct berval *dn,
+       struct berval *oldSup,
+       struct berval *newSup,
+       struct berval *res );
+
+static int dnlist_subordinate(
+       BerVarray dnlist,
+       struct berval *dn );
+
+Entry *deref_internal_r(
+       Backend*        be,
+       Entry*          alias,
+       struct berval*  dn_in,
+       int*            err,
+       Entry**         matched,
+       const char**            text )
+{
+       struct berval dn;
+       struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+       Entry *entry;
+       Entry *sup;
+       unsigned depth;
+       BerVarray dnlist;
+
+       assert( ( alias != NULL && dn_in == NULL )
+               || ( alias == NULL && dn_in != NULL ) );
+
+       *matched = NULL;
+       *err = LDAP_NO_SUCH_OBJECT;
+       *text = NULL;
+
+       if( alias == NULL ) {
+               ber_dupbv( &dn, dn_in );
+               entry = dn2entry_r( be, &dn, &sup );
+
+       } else {
+               ber_dupbv( &dn, &alias->e_nname );
+               entry = alias;
+               sup = NULL;
+       }
+
+       dnlist = NULL;
+       ber_bvarray_add( &dnlist, &dn );
+
+       for( depth=0 ; ; depth++ ) {
+               if( entry != NULL ) {
+                       Entry *newe;
+                       struct berval 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 */
+                       if( get_alias_dn( entry, &aliasDN, err, text )) {
+                               *matched = entry;
+                               entry = NULL;
+                               break;
+                       }
+
+                       /* check if aliasDN is a subordinate of any DN in our list */
+                       if( dnlist_subordinate( dnlist, &aliasDN ) ) {
+                               ch_free( aliasDN.bv_val );
+                               *matched = entry;
+                               entry = NULL;
+                               *err = LDAP_ALIAS_PROBLEM;
+                               *text = "circular alias";
+                               break;
+                       }
+
+                       /* attempt to dereference alias */
+
+                       newe = dn2entry_r( be, &aliasDN, &sup );
+                       ch_free( aliasDN.bv_val );
+
+                       if( newe != NULL ) {
+                               cache_return_entry_r(&li->li_cache, entry );
+                               entry = newe;
+                               ber_dupbv( &dn, &entry->e_nname );
+                               ber_bvarray_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;
+                       struct berval supDN;
+                       struct berval 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 */
+                       if( get_alias_dn( sup, &supDN, err, text )) {
+                               *matched = sup;
+                               break;
+                       }
+
+                       new_superior( &dn, &sup->e_nname, &supDN, &aliasDN );
+                       free(supDN.bv_val);
+
+                       /* check if aliasDN is a subordinate of any DN in our list */
+                       if( dnlist_subordinate( dnlist, &aliasDN ) ) {
+                               free(aliasDN.bv_val);
+                               *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.bv_val);
+                               cache_return_entry_r(&li->li_cache, sup );
+                               entry = newe;
+                               ber_dupbv( &dn, &entry->e_nname );
+                               ber_bvarray_add( &dnlist, &dn );
+                               continue;
+                       }
+                       
+                       if ( newSup != NULL ) {
+                               cache_return_entry_r(&li->li_cache, sup );
+                               sup = newSup;
+                               ber_dupbv( &dn, &aliasDN );
+                               continue;
+                       }
+
+                       break;
+
+               } else {
+                       /* no newe and no superior, we're done */
+                       break;
+               }
+       }
+
+       ber_bvarray_free( dnlist );
+       return entry;
+}
+
+
+static int get_alias_dn(
+       Entry *e,
+       struct berval *ndn,
+       int *err,
+       const char **errmsg )
+{      
+       int rc;
+       Attribute *a;
+       AttributeDescription *aliasedObjectName
+               = slap_schema.si_ad_aliasedObjectName;
+
+       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 -1;
+       }
+
+       /* 
+        * aliasedObjectName should be SINGLE-VALUED with a single value. 
+        */                     
+       if ( 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 -1;
+       }
+
+       if( a->a_vals[1].bv_val != NULL ) {
+               *err = LDAP_ALIAS_PROBLEM;
+               *errmsg = "alias has multivalued aliasedObjectName";
+               return -1;
+       }
+
+       rc = dnNormalize2( NULL, &a->a_vals[0], ndn );
+       if( rc != LDAP_SUCCESS ) {
+               *err = LDAP_ALIAS_PROBLEM;
+               *errmsg = "alias aliasedObjectName value is invalid";
+               return -1;
+       }
+
+       return 0;
+}
+
+static void new_superior(
+       struct berval *dn,
+       struct berval *oldSup,
+       struct berval *newSup,
+       struct berval *newDN )
+{
+       size_t dnlen, olen, nlen;
+       assert( dn && oldSup && newSup && newDN );
+
+       dnlen = dn->bv_len;
+       olen = oldSup->bv_len;
+       nlen = newSup->bv_len;
+
+       newDN->bv_val = ch_malloc( dnlen - olen + nlen + 1 );
+
+       AC_MEMCPY( newDN->bv_val, dn->bv_val, dnlen - olen );
+       AC_MEMCPY( &newDN->bv_val[dnlen - olen], newSup->bv_val, nlen );
+       newDN->bv_val[dnlen - olen + nlen] = '\0';
+
+       return;
+}
+
+static int dnlist_subordinate(
+       BerVarray dnlist,
+       struct berval *dn )
+{
+       assert( dnlist );
+
+       for( ; dnlist->bv_val != NULL; dnlist++ ) {
+               if( dnIsSuffix( dnlist, dn ) ) {
+                       return 1;
+               }
+       }
+
+       return 0;
+}
index 4639f7d12094c87784d17d1c26724ef743c5cf29..3246f47a53fa0a9540da2ddab48d2e779a1e814a 100644 (file)
@@ -1,7 +1,7 @@
 /* attribute.c - ldbm backend acl attribute routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 28243301907197768cd7e076f56c776301ff8e73..b4f16656e087d04b256c40871a53cb866d3e8331 100644 (file)
@@ -1,25 +1,36 @@
 /* back-ldbm.h - ldap ldbm back-end header file */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
 
 #ifndef _BACK_LDBM_H_
 #define _BACK_LDBM_H_
 
 #include "ldbm.h"
 
+LDAP_BEGIN_DECL
+
 #define DEFAULT_CACHE_SIZE     1000
-#define DEFAULT_DBCACHE_SIZE   100000
-#define DEFAULT_DB_DIRECTORY   "/usr/tmp"
-#define DEFAULT_MODE           0600
 
-#define SUBLEN                 3
+#if defined(HAVE_BERKELEY_DB) && DB_VERSION_MAJOR >= 2
+#      define DEFAULT_DBCACHE_SIZE (100 * DEFAULT_DB_PAGE_SIZE)
+#else
+#      define DEFAULT_DBCACHE_SIZE 100000
+#endif
+
+#define DN_BASE_PREFIX         SLAP_INDEX_EQUALITY_PREFIX
+#define DN_ONE_PREFIX          '%'
+#define DN_SUBTREE_PREFIX      '@'
 
 /*
- * there is a single index for each attribute.  these prefixes insure
+ * there is a single index for each attribute.  these prefixes ensure
  * that there is no collision among keys.
  */
-#define EQ_PREFIX      '='     /* prefix for equality keys     */
-#define APPROX_PREFIX  '~'     /* prefix for approx keys       */
-#define SUB_PREFIX     '*'     /* prefix for substring keys    */
-#define CONT_PREFIX    '\\'    /* prefix for continuation keys */
+
+/* allow PREFIX + byte for continuate number */
+#define SLAP_INDEX_CONT_SIZE ( sizeof(SLAP_INDEX_CONT_PREFIX) + sizeof(unsigned char) )
 
 #define DEFAULT_BLOCKSIZE      8192
 
  *             the list is terminated by an id of NOID.
  *     b_ids   a list of the actual ids themselves
  */
-typedef struct block {
-       ID              b_nmax;         /* max number of ids in this list  */
-#define ALLIDSBLOCK    0               /* == 0 => this is an allid block  */
-       ID              b_nids;         /* current number of ids used      */
-#define INDBLOCK       0               /* == 0 => this is an indirect blk */
-       ID              b_ids[1];       /* the ids - actually bigger       */
-} Block, IDList;
 
-#define ALLIDS( idl )          ((idl)->b_nmax == ALLIDSBLOCK)
-#define INDIRECT_BLOCK( idl )  ((idl)->b_nids == INDBLOCK)
+typedef ID ID_BLOCK;
+
+#define ID_BLOCK_NMAX_OFFSET   0
+#define ID_BLOCK_NIDS_OFFSET   1
+#define ID_BLOCK_IDS_OFFSET            2
+
+/* all ID_BLOCK macros operate on a pointer to a ID_BLOCK */
+
+#define ID_BLOCK_NMAX(b)               ((b)[ID_BLOCK_NMAX_OFFSET])
+
+/* Use this macro to get the value, but not to set it.
+ * By default this is identical to above.
+ */
+#define        ID_BLOCK_NMAXN(b)               ID_BLOCK_NMAX(b)
+#define ID_BLOCK_NIDS(b)               ((b)[ID_BLOCK_NIDS_OFFSET])
+#define ID_BLOCK_ID(b, n)              ((b)[ID_BLOCK_IDS_OFFSET+(n)])
+
+#define ID_BLOCK_NOID(b, n)            (ID_BLOCK_ID((b),(n)) == NOID)
+
+#define ID_BLOCK_ALLIDS_VALUE  0
+#define ID_BLOCK_ALLIDS(b)             (ID_BLOCK_NMAX(b) == ID_BLOCK_ALLIDS_VALUE)
+
+#define ID_BLOCK_INDIRECT_VALUE        0
+#define ID_BLOCK_INDIRECT(b)   (ID_BLOCK_NIDS(b) == ID_BLOCK_INDIRECT_VALUE)
+
+#define        USE_INDIRECT_NIDS       1
+
+#ifdef USE_INDIRECT_NIDS
+/*
+ * Use the high bit of ID_BLOCK_NMAX to indicate an INDIRECT block, thus
+ * freeing up the ID_BLOCK_NIDS to store an actual count. This allows us
+ * to use binary search on INDIRECT blocks.
+ */
+#undef ID_BLOCK_NMAXN
+#define        ID_BLOCK_NMAXN(b)               ((b)[ID_BLOCK_NMAX_OFFSET]&0x7fffffff)
+#undef ID_BLOCK_INDIRECT_VALUE
+#define        ID_BLOCK_INDIRECT_VALUE 0x80000000
+#undef ID_BLOCK_INDIRECT
+#define        ID_BLOCK_INDIRECT(b)    (ID_BLOCK_NMAX(b) & ID_BLOCK_INDIRECT_VALUE)
+
+#endif /* USE_INDIRECT_NIDS */
 
 /* for the in-core cache of entries */
-struct cache {
+typedef struct ldbm_cache {
        int             c_maxsize;
        int             c_cursize;
        Avlnode         *c_dntree;
        Avlnode         *c_idtree;
        Entry           *c_lruhead;     /* lru - add accessed entries here */
        Entry           *c_lrutail;     /* lru - rem lru entries from here */
-       pthread_mutex_t c_mutex;
-};
+       ldap_pvt_thread_mutex_t c_mutex;
+} Cache;
+
+#define CACHE_READ_LOCK                0
+#define CACHE_WRITE_LOCK       1
 
 /* for the cache of open index files */
-struct dbcache {
-       char            *dbc_name;
+typedef struct ldbm_dbcache {
        int             dbc_refcnt;
-       time_t          dbc_lastref;
-       pthread_mutex_t dbc_mutex;
-       pthread_cond_t  dbc_cv;
-       int             dbc_readers;
-       long            dbc_blksize;
        int             dbc_maxids;
        int             dbc_maxindirect;
-       LDBM            dbc_db;
-};
-
-/* for the cache of attribute information (which are indexed, etc.) */
-struct attrinfo {
-       char    *ai_type;       /* type name (cn, sn, ...)      */
-       int     ai_indexmask;   /* how the attr is indexed      */
-#define INDEX_PRESENCE 0x01
-#define INDEX_EQUALITY 0x02
-#define INDEX_APPROX   0x04
-#define INDEX_SUB      0x08
-#define INDEX_UNKNOWN  0x10
-#define INDEX_FROMINIT 0x20
-       int     ai_syntaxmask;  /* what kind of syntax          */
-/* ...from slap.h...
-#define SYNTAX_CIS      0x01
-#define SYNTAX_CES      0x02
-#define SYNTAX_BIN      0x04
-   ... etc. ...
-*/
-};
+       int             dbc_dirty;
+       int             dbc_flags;
+       time_t  dbc_lastref;
+       long    dbc_blksize;
+       char    *dbc_name;
+       LDBM    dbc_db;
+       ldap_pvt_thread_mutex_t dbc_write_mutex;
+} DBCache;
 
-#define MAXDBCACHE     10
+#define MAXDBCACHE     128
 
 struct ldbminfo {
+       ldap_pvt_thread_rdwr_t          li_giant_rwlock;
        ID                      li_nextid;
-       pthread_mutex_t         li_nextid_mutex;
        int                     li_mode;
+       slap_mask_t     li_defaultmask;
        char                    *li_directory;
-       struct cache            li_cache;
+       Cache           li_cache;
        Avlnode                 *li_attrs;
+       int                     li_dblocking;   /* lock databases */
+       int                     li_dbwritesync; /* write sync */
        int                     li_dbcachesize;
-       struct dbcache          li_dbcache[MAXDBCACHE];
-       pthread_mutex_t         li_dbcache_mutex;
-       pthread_cond_t          li_dbcache_cv;
+       DBCache         li_dbcache[MAXDBCACHE];
+       ldap_pvt_thread_mutex_t         li_dbcache_mutex;
+       ldap_pvt_thread_cond_t          li_dbcache_cv;
+       DB_ENV                  *li_dbenv;
+       int                     li_envdirok;
+       int                     li_dbsyncfreq;
+       int                     li_dbsyncwaitn;
+       int                     li_dbsyncwaitinterval;
+       ldap_pvt_thread_t       li_dbsynctid;
+       int                     li_dbshutdown;
 };
 
-#ifdef NEEDPROTOS
+LDAP_END_DECL
+
 #include "proto-back-ldbm.h"
-#endif
 
 #endif /* _back_ldbm_h_ */
index 383817a5d9baf36b9c4f7cb4ba5699c069b00191..0f31297434e29cafa5a3e0bcd4f8c85605775f7d 100644 (file)
@@ -1,7 +1,7 @@
 /* close.c - close ldbm backend */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index b96dbd0163e45c2fa4061faa470396bb8bd5f76b..921ba2cfdcda3ae86db2d190d98333796facb510 100644 (file)
@@ -1,7 +1,7 @@
 /* compare.c - ldbm backend compare routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 527f3c4c43874ae1425a8a00e692f0901cb7b538..7b8f324ae628606ae422e647520415cf8ec16368 100644 (file)
@@ -1,7 +1,7 @@
 /* config.c - ldbm backend configuration file routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 16225541403879efcc7b98fe57c757224f404fe6..40a0925ad22d93f239bbb7a084811d4c501afc2d 100644 (file)
@@ -1,7 +1,7 @@
 /* delete.c - ldbm backend delete routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 60b6088c0cac4b114c19830e773a5e446a14b918..491723fe47471b14accc103c0a2aaa3bef77a459 100644 (file)
@@ -1,7 +1,7 @@
 /* dn2id.c - routines to deal with the dn2id index */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/servers/slapd/back-ldbm/entry.c b/servers/slapd/back-ldbm/entry.c
new file mode 100644 (file)
index 0000000..4c87512
--- /dev/null
@@ -0,0 +1,45 @@
+/* entry.c - ldbm backend entry_release routine */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-ldbm.h"
+#include "proto-back-ldbm.h"
+
+
+int
+ldbm_back_entry_release_rw(
+       Backend *be,
+       Connection *conn,
+       Operation *op,
+       Entry   *e,
+       int     rw
+)
+{
+       struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+
+       if ( slapMode == SLAP_SERVER_MODE ) {
+               /* free entry and reader or writer lock */
+               cache_return_entry_rw( &li->li_cache, e, rw ); 
+               if( rw ) {
+                       ldap_pvt_thread_rdwr_wunlock( &li->li_giant_rwlock );
+               } else {
+                       ldap_pvt_thread_rdwr_runlock( &li->li_giant_rwlock );
+               }
+
+       } else {
+               entry_free( e );
+       }
+
+       return 0;
+}
index 93da72136db7e599a2ac2ef378829c330bb6c7f6..08d6c6d7456a8c4a5c1e06753bb8811ce3485fe6 100644 (file)
@@ -1,7 +1,7 @@
 /* extended.c - ldbm backend extended routines */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 750a66d929047144101067217d97fe180e71d7a2..5507a78774f589f55f0282eb1519eda938de2210 100644 (file)
@@ -1,7 +1,7 @@
 /* group.c - ldbm backend acl group routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 8c375a6c169b7b9df2c44d00cfb4a97899e0c4bd..5522801fbc86655be55595a4b00a3e1bbf1179d4 100644 (file)
@@ -1,7 +1,7 @@
 /* id2children.c - routines to deal with the id2children index */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 2f071b84420c002c7cdc9de2395138309111658e..00b3a9977408484437ac4ef4de13844e2d5e1f2f 100644 (file)
@@ -1,7 +1,7 @@
 /* id2entry.c - routines to deal with the id2entry index */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 0ea188a473bdf1c6f3d185da46c0ffa41495683c..59269606a5e2495343a8e9da09d2c026b75c0d77 100644 (file)
@@ -1,7 +1,7 @@
 /* index.c - routines for dealing with attribute indexes */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 3ea4e89cd184f9cb2f439315721984de6bafc428..eddeb5a2bd7c25defc177e9da9a3c5dfd8f29c36 100644 (file)
@@ -1,7 +1,7 @@
 /* modrdn.c - ldbm backend modrdn routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 8159ccf39ba8abfd20d1a0703ed32fe815743676..d14c4c6688353ae062397a2b362a3a0e1fdb1ecc 100644 (file)
@@ -1,7 +1,7 @@
 /* nextid.c - keep track of the next id to be given out */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index bc68116c281c2e2a726ea26492546fdf5aa47cfc..1671e9c8c9214d28f9afcc342c3d070a26b20d77 100644 (file)
@@ -1,6 +1,6 @@
 /* operational.c - ldbm backend operational attributes function */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 315277e78496488982eebc89c79008858706ee99..3aed5c4df32f02077146fcee61529041bd478917 100644 (file)
@@ -1,7 +1,7 @@
 /* passwd.c - ldbm backend password routines */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index a1e34bd5b830b4019ff9f4d2c88d52d3bfdc6746..8c988814c2afd0ac52759ad754255fc7682cf830 100644 (file)
@@ -1,7 +1,7 @@
 /* referral.c - LDBM backend referral handler */
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/servers/slapd/back-ldbm/sasl.c b/servers/slapd/back-ldbm/sasl.c
new file mode 100644 (file)
index 0000000..ae8d05c
--- /dev/null
@@ -0,0 +1,60 @@
+/* bind.c - ldbm backend bind and unbind routines */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+
+#include "portable.h"
+
+#if 0
+
+#include <stdio.h>
+
+#include <ac/krb.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
+
+#include "slap.h"
+#include "back-ldbm.h"
+#include "proto-back-ldbm.h"
+
+int
+back_ldbm_sasl_authorize(
+       BackendDB *be,
+       const char *auth_identity,
+       const char *requested_user,
+       const char **user,
+       const char **errstring)
+{
+       return SASL_FAIL;
+}
+
+int
+back_ldbm_sasl_getsecret(
+       Backend *be,
+       const char *mechanism,
+       const char *auth_identity,
+       const char *realm,
+       sasl_secret_t **secret)
+{
+       return SASL_FAIL;
+}
+
+int
+back_ldbm_sasl_putsecret(
+       Backend *be,
+       const char *mechanism,
+       const char *auth_identity,
+       const char *realm,
+       const sasl_secret_t *secret)
+{
+       return SASL_FAIL;
+}
+
+#else
+static int dummy = 1;
+#endif
+
index 5f415384f19d5ec4781a3f8911f00a792ea7060d..e8a2967e84d91e5ee3e97ac8343ff3398383428c 100644 (file)
@@ -1,7 +1,7 @@
 /* tools.c - tools for slap tools */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/servers/slapd/back-meta/Copyright b/servers/slapd/back-meta/Copyright
new file mode 100644 (file)
index 0000000..811227f
--- /dev/null
@@ -0,0 +1,63 @@
+Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+
+Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+
+This work has been developed to fulfill the requirements
+of SysNet s.n.c. <http:www.sys-net.it> and it has been donated
+to the OpenLDAP Foundation in the hope that it may be useful
+to the Open Source community, but WITHOUT ANY WARRANTY.
+
+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 and SysNet s.n.c. are 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.
+   SysNet s.n.c. cannot be responsible for the consequences of the
+   alterations.
+
+4. This notice may not be removed or altered.
+
+
+This software is based on the backend back-ldap, implemented
+by Howard Chu <hyc@highlandsun.com>, and modified by Mark Valence
+<kurash@sassafras.com>, Pierangelo Masarati <ando@sys-net.it> and other
+contributors. The contribution of the original software to the present
+implementation is acknowledged in this copyright statement.
+
+A special acknowledgement goes to Howard for the overall architecture
+(and for borrowing large pieces of code), and to Mark, who implemented
+from scratch the attribute/objectclass mapping.
+
+The original copyright statement follows.
+
+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.
+
+
index 643f78b17c9ee9d75b526229a4ef0d0df82af98d..3aaab4d5fbfeac78075bbb1d61ef7f7fc531dcfd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  *
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
index 29520650ec7d3bec949e6dedaaf0189a22be6e41..22a9e569ed0379ba1a9630bde31d49be7001ba74 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  *
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
index ff8038522ed689c5a54c848b149a23d1e003a1b0..2de2c191acb51b35efe1fccfe15cd06564974a1b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  *
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
diff --git a/servers/slapd/back-meta/external.h b/servers/slapd/back-meta/external.h
new file mode 100644 (file)
index 0000000..e37d552
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ *
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ *
+ * This work has been developed to fulfill the requirements
+ * of SysNet s.n.c. <http:www.sys-net.it> and it has been donated
+ * to the OpenLDAP Foundation in the hope that it may be useful
+ * to the Open Source community, but WITHOUT ANY WARRANTY.
+ *
+ * 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 and SysNet s.n.c. are 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.
+ *    SysNet s.n.c. cannot be responsible for the consequences of the
+ *    alterations.
+ *
+ * 4. This notice may not be removed or altered.
+ *
+ *
+ * This software is based on the backend back-ldap, implemented
+ * by Howard Chu <hyc@highlandsun.com>, and modified by Mark Valence
+ * <kurash@sassafras.com>, Pierangelo Masarati <ando@sys-net.it> and other
+ * contributors. The contribution of the original software to the present
+ * implementation is acknowledged in this copyright statement.
+ *
+ * A special acknowledgement goes to Howard for the overall architecture
+ * (and for borrowing large pieces of code), and to Mark, who implemented
+ * from scratch the attribute/objectclass mapping.
+ *
+ * The original copyright statement follows.
+ *
+ * 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 META_EXTERNAL_H
+#define META_EXTERNAL_H
+
+LDAP_BEGIN_DECL
+
+extern BI_init meta_back_initialize;
+extern BI_open meta_back_open;
+extern BI_close        meta_back_close;
+extern BI_destroy      meta_back_destroy;
+
+extern BI_db_init      meta_back_db_init;
+extern BI_db_destroy   meta_back_db_destroy;
+extern BI_db_config    meta_back_db_config;
+
+extern BI_op_bind      meta_back_bind;
+extern BI_connection_destroy   meta_back_conn_destroy;
+extern BI_op_search    meta_back_search;
+extern BI_op_compare   meta_back_compare;
+extern BI_op_modify    meta_back_modify;
+extern BI_op_modrdn    meta_back_modrdn;
+extern BI_op_add       meta_back_add;
+extern BI_op_delete    meta_back_delete;
+extern BI_op_abandon   meta_back_abandon;
+
+extern BI_acl_group    meta_back_group;
+extern BI_acl_attribute        meta_back_attribute;
+
+LDAP_END_DECL
+
+#endif /* META_EXTERNAL_H */
index ade436e58d3b365594327edf46500246dff9f50d..34cfebfe9691543a0be72b625a6ceaea240ae41f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  *
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
index e4f381e988d376874aac7187314666066e45a1b0..b26dab5203e9080229df45dcc273b75e5632487d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  *
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
diff --git a/servers/slapd/back-monitor/Copyright b/servers/slapd/back-monitor/Copyright
new file mode 100644 (file)
index 0000000..ae05017
--- /dev/null
@@ -0,0 +1,29 @@
+Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+
+Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+
+This work has beed deveolped for the OpenLDAP Foundation 
+in the hope that it may be useful to the Open Source community, 
+but WITHOUT ANY WARRANTY.
+
+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 and SysNet s.n.c. are 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.
+   SysNet s.n.c. cannot be responsible for the consequences of the
+   alterations.
+
+4. This notice may not be removed or altered.
+
index 511facdd796dc0469c06be124bc4a358bae6c5bd..9bc463a1b50ea8723d2e83f2982bb64195771054 100644 (file)
@@ -1,6 +1,6 @@
 /* back-monitor.h - ldap monitor back-end header file */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 987c2b348be1188eb1699d9efebdb51df5382ffd..91a7802a9f0b2798aca4834e718e5b6308762f27 100644 (file)
@@ -1,6 +1,6 @@
 /* backend.c - deals with backend subsystem */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 9c0cd468ba325ac4fbceb37c2838923a6991c834..b57149748fc5f838035e74e8f81638484eb83846 100644 (file)
@@ -1,6 +1,6 @@
 /* bind.c - monitor backend bind routine */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 9fc8c941f8a4ae1bf1995d473cde6840614b2fa8..d1455a182063a960fb35ffb1003d5f9da5afaccd 100644 (file)
@@ -1,6 +1,6 @@
 /* cache.c - routines to maintain an in-core cache of entries */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
diff --git a/servers/slapd/back-monitor/compare.c b/servers/slapd/back-monitor/compare.c
new file mode 100644 (file)
index 0000000..d3846a0
--- /dev/null
@@ -0,0 +1,101 @@
+/* compare.c - monitor backend compare routine */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ * 
+ * This work has beed deveolped for the OpenLDAP Foundation 
+ * in the hope that it may be useful to the Open Source community, 
+ * but WITHOUT ANY WARRANTY.
+ * 
+ * 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 and SysNet s.n.c. are 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.
+ *    SysNet s.n.c. cannot be responsible for the consequences of the
+ *    alterations.
+ * 
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <slap.h>
+#include "back-monitor.h"
+
+int
+monitor_back_compare(
+       Backend                 *be,
+       Connection              *conn,
+       Operation               *op,
+       struct berval           *dn,
+       struct berval           *ndn,
+       AttributeAssertion      *ava
+)
+{
+       struct monitorinfo      *mi = (struct monitorinfo *) be->be_private;            int             rc;
+       Entry           *e, *matched = NULL;
+       Attribute       *a;
+
+       /* get entry with reader lock */
+       monitor_cache_dn2entry( mi, ndn, &e, &matched );
+       if ( e == NULL ) {
+               send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
+                               matched ? matched->e_dn : NULL,
+                               NULL, NULL, NULL );
+               if ( matched ) {
+                       monitor_cache_release( mi, matched );
+               }
+
+               return( 0 );
+       }
+
+       rc = access_allowed( be, conn, op, e, ava->aa_desc, 
+                       &ava->aa_value, ACL_COMPARE, NULL );
+       if ( !rc ) {
+               send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+                               NULL, NULL, NULL, NULL );
+               rc = 1;
+               goto return_results;
+       }
+
+       rc = LDAP_NO_SUCH_ATTRIBUTE;
+
+       for ( a = attrs_find( e->e_attrs, ava->aa_desc );
+                       a != NULL;
+                       a = attrs_find( a->a_next, ava->aa_desc )) {
+               rc = LDAP_COMPARE_FALSE;
+
+               if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 ) {
+                       rc = LDAP_COMPARE_TRUE;
+                       break;
+               }
+       }
+
+       send_ldap_result( conn, op, rc, NULL, NULL, NULL, NULL );
+
+       if( rc != LDAP_NO_SUCH_ATTRIBUTE ) {
+               rc = 0;
+       }
+       
+return_results:;
+       monitor_cache_release( mi, e );
+
+       return( rc );
+}
+
index 5bbaca74e1bcf43960d501240a5b8f414d841416..937b44d2f64a1cfee0f1971e865fd738ace5d417 100644 (file)
@@ -1,6 +1,6 @@
 /* conn.c - deal with connection subsystem */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
diff --git a/servers/slapd/back-monitor/entry.c b/servers/slapd/back-monitor/entry.c
new file mode 100644 (file)
index 0000000..c764fd8
--- /dev/null
@@ -0,0 +1,117 @@
+/* entry.c - monitor backend entry handling routines */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ * 
+ * This work has beed deveolped for the OpenLDAP Foundation 
+ * in the hope that it may be useful to the Open Source community, 
+ * but WITHOUT ANY WARRANTY.
+ * 
+ * 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 and SysNet s.n.c. are 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.
+ *    SysNet s.n.c. cannot be responsible for the consequences of the
+ *    alterations.
+ * 
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <slap.h>
+#include "back-monitor.h"
+
+int
+monitor_entry_update(
+       struct monitorinfo      *mi, 
+       Entry                   *e
+)
+{
+       struct monitorentrypriv *mp;
+
+       assert( mi != NULL );
+       assert( e != NULL );
+       assert( e->e_private != NULL );
+
+       mp = ( struct monitorentrypriv * )e->e_private;
+
+
+       if ( mp->mp_info && mp->mp_info->mss_update ) {
+               return ( *mp->mp_info->mss_update )( mi, e );
+       }
+
+       return( 0 );
+}
+
+int
+monitor_entry_create(
+       struct monitorinfo      *mi,
+       struct berval           *ndn,
+       Entry                   *e_parent,
+       Entry                   **ep
+)
+{
+       struct monitorentrypriv *mp;
+
+       assert( mi != NULL );
+       assert( e_parent != NULL );
+       assert( e_parent->e_private != NULL );
+       assert( ep != NULL );
+
+       mp = ( struct monitorentrypriv * )e_parent->e_private;
+
+       if ( mp->mp_info && mp->mp_info->mss_create ) {
+               return ( *mp->mp_info->mss_create )( mi, ndn, e_parent, ep );
+       }
+       
+       return( 0 );
+}
+
+int
+monitor_entry_modify(
+       struct monitorinfo      *mi, 
+       Entry                   *e,
+       Modifications           *modlist
+)
+{
+       struct monitorentrypriv *mp;
+
+       assert( mi != NULL );
+       assert( e != NULL );
+       assert( e->e_private != NULL );
+
+       mp = ( struct monitorentrypriv * )e->e_private;
+
+       if ( mp->mp_info && mp->mp_info->mss_modify ) {
+               return ( *mp->mp_info->mss_modify )( mi, e, modlist );
+       }
+
+       return( 0 );
+}
+
+int
+monitor_entry_test_flags(
+       struct monitorentrypriv *mp,
+       int                     cond
+)
+{
+       assert( mp != NULL );
+
+       return( ( mp->mp_flags & cond ) || ( mp->mp_info->mss_flags & cond ) );
+}
+
index 48d4e446df2e6a076849b16aa047e734c94dbdaf..90cc486239160a196dd2d47d99f857eedeb72809 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 04ce6664ca9641039018e1b33ffd1aebb0c263c8..ed754ce39695f1ea022426bdee8452cad3337628 100644 (file)
@@ -1,6 +1,6 @@
 /* init.c - initialize monitor backend */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 6eac7660566f063a494a0cfeecb32d0522a2f4e0..71879643f713cccbba70a1cc37039dd4ccb3cbe9 100644 (file)
@@ -1,6 +1,6 @@
 /* listener.c - deals with listener subsystem */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 669f250706494c56b5847d7c3fc25aa2a21621c1..b15053ae25bbc2d8d4108b5db170ed7b8fa2690e 100644 (file)
@@ -1,6 +1,6 @@
 /* log.c - deal with log subsystem */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 5cf4e29c8ff4faaa9d46da8e4cc22c36e3760e02..5cdec1e02d0d0b440f7dfb63531dd4188c23c9ab 100644 (file)
@@ -1,6 +1,6 @@
 /* modify.c - monitor backend modify routine */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 7686bde2bbfa31162b688022e4307f6e9185930f..71ce6cb07ea17ac02c815d126fdcec3ce9072f05 100644 (file)
@@ -1,6 +1,6 @@
 /* operation.c - deal with operation subsystem */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
diff --git a/servers/slapd/back-monitor/operational.c b/servers/slapd/back-monitor/operational.c
new file mode 100644 (file)
index 0000000..fcab8f8
--- /dev/null
@@ -0,0 +1,53 @@
+/* operational.c - monitor backend operational attributes function */
+/*
+ * Copyright 1998-2003 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-monitor.h"
+#include "proto-back-monitor.h"
+
+/*
+ * sets the supported operational attributes (if required)
+ */
+
+int
+monitor_back_operational(
+       BackendDB       *be,
+       Connection      *conn, 
+       Operation       *op,
+       Entry           *e,
+       AttributeName   *attrs,
+       int             opattrs,
+       Attribute       **a )
+{
+       Attribute       **aa = a;
+
+       assert( e );
+
+       if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
+               int                     hs;
+               struct monitorentrypriv *mp;
+
+               mp = ( struct monitorentrypriv * )e->e_private;
+
+               assert( mp );
+
+               hs = MONITOR_HAS_CHILDREN( mp );
+               *aa = slap_operational_hasSubordinate( hs );
+               if ( *aa != NULL ) {
+                       aa = &(*aa)->a_next;
+               }
+       }
+       
+       return 0;
+}
+
diff --git a/servers/slapd/back-monitor/proto-back-monitor.h b/servers/slapd/back-monitor/proto-back-monitor.h
new file mode 100644 (file)
index 0000000..01d44ab
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ * 
+ * This work has beed deveolped for the OpenLDAP Foundation 
+ * in the hope that it may be useful to the Open Source community, 
+ * but WITHOUT ANY WARRANTY.
+ * 
+ * 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 and SysNet s.n.c. are 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.
+ *    SysNet s.n.c. cannot be responsible for the consequences of the
+ *    alterations.
+ * 
+ * 4. This notice may not be removed or altered.
+ */
+
+#ifndef _PROTO_BACK_LDBM
+#define _PROTO_BACK_LDBM
+
+#include <ldap_cdefs.h>
+
+#include "external.h"
+
+LDAP_BEGIN_DECL
+
+/*
+ * entry
+ */
+int monitor_entry_test_flags LDAP_P(( struct monitorentrypriv *mp, int cond ));
+
+/*
+ * backends
+ */
+int monitor_subsys_backend_init LDAP_P(( BackendDB *be ));
+
+/*
+ * databases 
+ */
+int monitor_subsys_database_init LDAP_P(( BackendDB *be ));
+
+/*
+ * threads
+ */
+int monitor_subsys_thread_init LDAP_P(( BackendDB *be ));
+int monitor_subsys_thread_update LDAP_P(( struct monitorinfo *mi, Entry *e ));
+
+/*
+ * connections
+ */
+int monitor_subsys_conn_init LDAP_P(( BackendDB *be ));
+int monitor_subsys_conn_update LDAP_P(( struct monitorinfo *mi, Entry *e ));
+int monitor_subsys_conn_create LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry *e_parent, Entry **ep ));
+
+/*
+ * read waiters
+ */
+int monitor_subsys_readw_update LDAP_P(( struct monitorinfo *mi, Entry *e ));
+
+/*
+ * write waiters
+ */
+int monitor_subsys_writew_update LDAP_P(( struct monitorinfo *mi, Entry *e ));
+
+/*
+ * log
+ */
+int monitor_subsys_log_init LDAP_P(( BackendDB *be ));
+int monitor_subsys_log_modify LDAP_P(( struct monitorinfo *mi, Entry *e, Modifications *modlist        ));
+
+/*
+ * operations
+ */
+int monitor_subsys_ops_init LDAP_P(( BackendDB *be ));
+int monitor_subsys_ops_update LDAP_P(( struct monitorinfo *mi, Entry *e ));
+
+/*
+ * sent
+ */
+int monitor_subsys_sent_init LDAP_P(( BackendDB *be ));
+int monitor_subsys_sent_update LDAP_P(( struct monitorinfo *mi, Entry *e ));
+
+/*
+ * listener
+ */
+int monitor_subsys_listener_init LDAP_P(( BackendDB *be ));
+
+/*
+ * time
+ */
+int monitor_subsys_time_init LDAP_P(( BackendDB *be ));
+int monitor_subsys_time_update LDAP_P(( struct monitorinfo *mi, Entry *e ));
+
+LDAP_END_DECL
+
+#endif
diff --git a/servers/slapd/back-monitor/rww.c b/servers/slapd/back-monitor/rww.c
new file mode 100644 (file)
index 0000000..904a81a
--- /dev/null
@@ -0,0 +1,127 @@
+/* readw.c - deal with read waiters subsystem */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ * 
+ * This work has beed deveolped for the OpenLDAP Foundation 
+ * in the hope that it may be useful to the Open Source community, 
+ * but WITHOUT ANY WARRANTY.
+ * 
+ * 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 and SysNet s.n.c. are 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.
+ *    SysNet s.n.c. cannot be responsible for the consequences of the
+ *    alterations.
+ * 
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include "slap.h"
+#include "back-monitor.h"
+
+static int monitor_subsys_readw_update_internal( struct monitorinfo *mi, Entry *e, int rw );
+
+int 
+monitor_subsys_readw_update( 
+       struct monitorinfo      *mi,
+       Entry                   *e
+)
+{
+       return monitor_subsys_readw_update_internal( mi, e, 0 );
+}
+
+int 
+monitor_subsys_writew_update( 
+       struct monitorinfo      *mi,
+       Entry                   *e
+)
+{
+       return monitor_subsys_readw_update_internal( mi, e, 1 );
+}
+
+static int 
+monitor_subsys_readw_update_internal( 
+       struct monitorinfo      *mi,
+       Entry                   *e,
+       int                     rw
+)
+{
+       Connection              *c;
+       int                     connindex;
+       int                     nconns, nwritewaiters, nreadwaiters;
+       
+       Attribute               *a;
+       struct berval           bv[2], *b = NULL;
+       char                    buf[1024];
+       
+       char                    *str = NULL;
+       int                     num = 0;
+
+       assert( mi != NULL );
+       assert( e != NULL );
+       
+       bv[1].bv_val = NULL;
+       
+       nconns = nwritewaiters = nreadwaiters = 0;
+       for ( c = connection_first( &connindex );
+                       c != NULL;
+                       c = connection_next( c, &connindex ), nconns++ ) {
+               if ( c->c_writewaiter ) {
+                       nwritewaiters++;
+               }
+               if ( c->c_currentber != NULL ) {
+                       nreadwaiters++;
+               }
+       }
+       connection_done(c);
+
+       switch ( rw ) {
+       case 0:
+               str = "read waiters";
+               num = nreadwaiters;
+               break;
+       case 1:
+               str = "write waiters";
+               num = nwritewaiters;
+               break;
+       }
+       snprintf( buf, sizeof( buf ), "%s=%d", str, num );
+
+       if ( ( a = attr_find( e->e_attrs, monitor_ad_desc ) ) != NULL ) {
+               for ( b = a->a_vals; b[0].bv_val != NULL; b++ ) {
+                       if ( strncmp( b[0].bv_val, str, strlen( str ) ) == 0 ) {
+                               free( b[0].bv_val );
+                               ber_str2bv( buf, 0, 1, b );
+                               break;
+                       }
+               }
+       }
+
+       if ( b == NULL || b[0].bv_val == NULL ) {
+               bv[0].bv_val = buf;
+               bv[0].bv_len = strlen( buf );
+               attr_merge( e, monitor_ad_desc, bv );
+       }
+
+       return( 0 );
+}
+
index 2795ee7be1ba50b3c5fe8db7a1dc9242133987cb..99133e90816f12acd3dcac10106d9e6c6d5bd0aa 100644 (file)
@@ -1,6 +1,6 @@
 /* search.c - monitor backend search function */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 62c55f92baef3755a0e99f47f1b00c2620535c35..99bd329a78a552972ca105308a4d2612b9f5efd9 100644 (file)
@@ -1,6 +1,6 @@
 /* sent.c - deal with data sent subsystem */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 112ada7efc844f80229df0d06882ea493c44b70e..85331e597d80d34e8ee6462588d34a770e542d52 100644 (file)
@@ -1,6 +1,6 @@
 /* thread.c - deal with thread subsystem */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index abc29e366a4624101b3a67fac7de97ee81a08638..47b3059901edf01447cc5d6fd11c55d9a4a6f5bd 100644 (file)
@@ -1,6 +1,6 @@
 /* time.c - deal with time subsystem */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 8b54f398890a9137ab146ef9ee380141a5608adb..75e3518606248602809258654d3686aa75db6183 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2002-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #ifndef _NULL_EXTERNAL_H
index 85c671d5404a71c3b26e821b2d6ad6fdaff7bb76..4ab571a6c398ef7e28fe47dc4e8b45ed46ef35a6 100644 (file)
@@ -1,6 +1,6 @@
 /* null.c - the null backend */
 /*
- * Copyright 2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2002-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index b739bf2e2afe6cb6d8534bacfc337b7fd873083c..23c2a66be3fbe0dbeea76a23bbd6a435d0a80713 100644 (file)
@@ -1,5 +1,5 @@
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
 ## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 
 SRCS   = init.c config.c fork.c search.c bind.c unbind.c add.c \
index bbf84db331fb15c1bebb9b5e5a27aa53882b6f3a..801b16c6f16739487511a9f4e449459d3cd76b0c 100644 (file)
@@ -1,7 +1,7 @@
 /* abandon.c - shell backend abandon function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 02a52093808e83789b2eb697dece18e4d67125e7..818ef9267295a327cd404dc3f0190b43c313758b 100644 (file)
@@ -1,7 +1,7 @@
 /* add.c - shell backend add function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index cd083b8ea7971d85b9a5288cc12c2492a04b6289..cb21ff338bb90420e97206f468674fd875d80bb5 100644 (file)
@@ -1,7 +1,7 @@
 /* bind.c - shell backend bind function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 8317214d0d5ade4c27c6fb60751501b5972a7be1..f6037de2e74d7e0617632fc78a5f05e2097839d4 100644 (file)
@@ -1,7 +1,7 @@
 /* compare.c - shell backend compare function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index adc21526f89938e8bd6d576218bc78a661325d6a..a9ec0a95eae9b9db9a8dbbfa87119187509c4f73 100644 (file)
@@ -1,7 +1,7 @@
 /* config.c - shell backend configuration file routine */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index da6c04a0c41109f03747fd382dfcdb782740ae4e..ba56a5779cdde2f62f52dddf224a32ad248a2f36 100644 (file)
@@ -1,7 +1,7 @@
 /* delete.c - shell backend delete function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/servers/slapd/back-shell/external.h b/servers/slapd/back-shell/external.h
new file mode 100644 (file)
index 0000000..1d58992
--- /dev/null
@@ -0,0 +1,41 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+#ifndef _SHELL_EXTERNAL_H
+#define _SHELL_EXTERNAL_H
+
+LDAP_BEGIN_DECL
+
+extern BI_init shell_back_initialize;
+extern BI_open shell_back_open;
+extern BI_close        shell_back_close;
+extern BI_destroy      shell_back_destroy;
+
+extern BI_db_init      shell_back_db_init;
+extern BI_db_destroy   shell_back_db_destroy;
+
+extern BI_db_config    shell_back_db_config;
+
+extern BI_op_bind      shell_back_bind;
+
+extern BI_op_unbind    shell_back_unbind;
+
+extern BI_op_search    shell_back_search;
+
+extern BI_op_compare   shell_back_compare;
+
+extern BI_op_modify    shell_back_modify;
+
+extern BI_op_modrdn    shell_back_modrdn;
+
+extern BI_op_add       shell_back_add;
+
+extern BI_op_delete    shell_back_delete;
+
+extern BI_op_abandon   shell_back_abandon;
+
+LDAP_END_DECL
+
+#endif /* _SHELL_EXTERNAL_H */
index b2b6fdf627c5a2fe7a317df2ea64373acf7552fe..d47e1518a7f73a49a4c1aaa02805c51dff26616e 100644 (file)
@@ -1,7 +1,7 @@
 /* fork.c - fork and exec a process, connecting stdin/out w/pipes */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index d7add624f552cd0df738ecd4ccb63742ec8c0468..cfbd8811c57ed517c80b1dc7f2920c676d7dbecf 100644 (file)
@@ -1,7 +1,7 @@
 /* init.c - initialize shell backend */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 9ea1511a696ed9ab1ae97282a62cc1ecaf1ce936..8696a44dc86f129b5f5dc3e676485652b3dea937 100644 (file)
@@ -1,7 +1,7 @@
 /* modify.c - shell backend modify function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 6b54a499dde667524e6422df0cefe2fc8e44be3f..993ba557ecf3204cffd530a1d35369ab67002055 100644 (file)
@@ -1,7 +1,7 @@
 /* modrdn.c - shell backend modrdn function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index ded78f03c489bca4238d1ea26f69a002c601051f..4fc7d6dc2a4d979e5ad807a42827adfcfae47960 100644 (file)
@@ -1,7 +1,7 @@
 /* result.c - shell backend result reading function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index cc9e4dcca642dbec2775e3e4b9f22a43be7fd6a4..a0661066fd8aa16f7fd566a3051161e82d775ee9 100644 (file)
@@ -1,7 +1,7 @@
 /* search.c - shell backend search function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 41fda5e5d029ebf11cb8156a00d0caac7358f832..7d6287fb59252bc81259e5a3a47803707de4ce68 100644 (file)
@@ -1,5 +1,5 @@
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
 ## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 
 include                /usr/local/etc/openldap/schema/core.schema
index f93ac5e769f5bebff6a5218ff910da76d2408dd3..f975486f930d44d8d3da685d4a15be9be74e9de6 100644 (file)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
 ## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 
 while [ 1 ]; do
index 0bfe91492660ae2aebeb26c61bc5b04d0a32384a..af4609d3f071fb32af3fec6f6cffa4748a502215 100644 (file)
@@ -1,7 +1,7 @@
 /* shell.h - shell backend header file */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index d5d936106e6a865b083709476c271dd7545e8e6e..8326a588d9c07bbf51963b6abbef2d819415a2d3 100644 (file)
@@ -1,7 +1,7 @@
 /* unbind.c - shell backend unbind function */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index f4298a5a5b43093c03b97434fc6aabf390a18866..08557824014ef01936f4d7430a9ada3854dd30cb 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* cancel.c - LDAP cancel extended operation */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index c9af173946e0f06c03a56f9692ba91f180de5678..0b7d1c296a6d3b40f38fbdd5edfa79bfb00f3efe 100644 (file)
@@ -1,7 +1,7 @@
 /* ch_malloc.c - malloc routines that test returns from malloc and friends */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 0084a7c80a22776a1e22295055ac06dea866f300..148d8155e9756adda8cd41f9053395a96af96769 100644 (file)
@@ -1,7 +1,7 @@
 /* dn.c - routines for dealing with distinguished names */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/servers/slapd/kerberos.c b/servers/slapd/kerberos.c
new file mode 100644 (file)
index 0000000..f753efd
--- /dev/null
@@ -0,0 +1,49 @@
+/* kerberos.c - ldbm backend kerberos bind routines */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
+
+#include <stdio.h>
+
+#include <ac/krb.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slap.h"
+
+#define LDAP_KRB_PRINCIPAL     "ldapserver"
+
+krbv4_ldap_auth(
+    Backend            *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 );
+
+       AC_MEMCPY( 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 */
index 79017f23a0dc4bac923e78f995e5d112476a9d85..afc6ba5dcb309d36e240f846678723d88b141ff4 100644 (file)
@@ -1,7 +1,7 @@
 /* lock.c - routines to open and apply an advisory lock to a file */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 5276c546e6700f1ac32a1411c2e6fc67dd8b941b..79c35c4674586753e0bf8f8b4bccb4624dde1a79 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* mra.c - routines for dealing with extensible matching rule assertions */
index 115bada2fc5277f2875a44844b8c6c84333558c2..ebb3a391cfc904d770ac02bb677f269fee8b79df 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 3eca598b574101df9131aa395b7db14d3d1fdbf8..603d82456c59a88cf7ffa213067a3c6e3b202153 100644 (file)
@@ -1,6 +1,6 @@
 /* operational.c - routines to deal with on-the-fly operational attrs */
 /*
- * Copyright 2001-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2001-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 45fcaa259239c526b9d2cb75f21d6108f3472cc8..ccbc2cb4d3b82d165f3636aeaea8ac17f6929c50 100644 (file)
@@ -1,7 +1,7 @@
 /* bind.c - ldbm backend bind and unbind routines */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index bfd2011be191f8017d61e7f00e830f514f7d54e9..51f063649d582734e3b90e0ded7ee91750e605fb 100644 (file)
@@ -1,7 +1,7 @@
 /* phonetic.c - routines to do phonetic matching */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 57a46713a50571e025f7ab01fd474fe1af878ec0..dccd862b7a37e8809657c8230e37a02b42e83be0 100644 (file)
@@ -1,7 +1,7 @@
 /* referral.c - muck with referrals */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 6d0593dfccd56a4a4ac11609b13cc7c9986b9bfa..25fe030e797d022c3c20bf8ccf111f67b2c6a33d 100644 (file)
@@ -1,7 +1,7 @@
 /* repl.c - log modifications for replication purposes */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 4d401f85186e1b2833dffa6eedfe0bab03a460df..5f0a6a717f4d0459feda287223479728e25cf4bf 100644 (file)
@@ -1,7 +1,7 @@
 /* schema.c - routines to manage schema definitions */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index d0aca20d90b8d6f7d89035e1328f587714387d4e..fbfd93a59bd49d527b0772c356e630b73aacbf47 100644 (file)
@@ -1,7 +1,7 @@
 /* schemaparse.c - routines to parse config file objectclass definitions */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index cd4a76c5fccb168fc9c4a75af8e4a2109d68bf42..97b49b46308ad66abcba26d840f16d80f860e062 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
diff --git a/servers/slapd/shell-backends/Makefile.in b/servers/slapd/shell-backends/Makefile.in
new file mode 100644 (file)
index 0000000..7dfe4ae
--- /dev/null
@@ -0,0 +1,29 @@
+# $OpenLDAP$
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+
+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)
+
+# create programs also when using modules
+depend-mod: depend-yes
+all-mod: all-yes
+install-mod: install-yes
+
+passwd-shell:  pwd-version.o
+       $(CC) $(LDFLAGS) -o $@ $(OBJS) pwd-version.o $(LIBS)
+
+pwd-version.c: $(OBJS) $(LDAP_LIBDEPEND)
+       @-$(RM) $@
+       $(MKVERSION) passwd-shell > $@
index 46dbf83b91de5510fe2682a295159804f2e30381..4ab33b10365e59da752622f95561d84435deeff1 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /* 
- * Copyright 1999-2002 The OpenLDAP Foundation.
+ * Copyright 1999-2003 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
index b2a4e4f72f52f7f197e33a62c4f37227b7b9493c..04667cc345b73f4efdf15806ec5b8ea51c950952 100644 (file)
@@ -1,7 +1,7 @@
 /* str2filter.c - parse an rfc 1588 string filter */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 6ae5bdfbfdec758d96fc686e1d388e7a30a540c4..770f5346d036eaf90669d3b279d323950822c0d1 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #include "portable.h"
diff --git a/servers/slapd/tools/slapcat.c b/servers/slapd/tools/slapcat.c
new file mode 100644 (file)
index 0000000..96fd0c9
--- /dev/null
@@ -0,0 +1,79 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#include "slapcommon.h"
+
+int
+main( int argc, char **argv )
+{
+       ID id;
+       int rc = EXIT_SUCCESS;
+
+       slap_tool_init( "slapcat", SLAPCAT, argc, argv );
+
+       if( !be->be_entry_open ||
+               !be->be_entry_close ||
+               !be->be_entry_first ||
+               !be->be_entry_next ||
+               !be->be_entry_get )
+       {
+               fprintf( stderr, "%s: database doesn't support necessary operations.\n",
+                       progname );
+               exit( EXIT_FAILURE );
+       }
+
+       if( be->be_entry_open( be, 0 ) != 0 ) {
+               fprintf( stderr, "%s: could not open database.\n",
+                       progname );
+               exit( EXIT_FAILURE );
+       }
+
+       for ( id = be->be_entry_first( be );
+               id != NOID;
+               id = be->be_entry_next( be ) )
+       {
+               char *data;
+               int len;
+               Entry* e = be->be_entry_get( be, id );
+
+               if( verbose ) {
+                       printf( "# id=%08lx\n", (long) id );
+               }
+
+               if ( e == NULL ) {
+                       printf("# no data for entry id=%08lx\n\n", (long) id );
+                       rc = EXIT_FAILURE;
+                       if( continuemode ) continue;
+                       break;
+               }
+
+               data = entry2str( e, &len );
+               be_entry_release_r( be, 0L, 0L, e );
+
+               if ( data == NULL ) {
+                       printf("# bad data for entry id=%08lx\n\n", (long) id );
+                       rc = EXIT_FAILURE;
+                       if( continuemode ) continue;
+                       break;
+               }
+
+               fputs( data, ldiffp );
+               fputs( "\n", ldiffp );
+       }
+
+       be->be_entry_close( be );
+
+       slap_tool_destroy();
+       return rc;
+}
diff --git a/servers/slapd/tools/slapcommon.h b/servers/slapd/tools/slapcommon.h
new file mode 100644 (file)
index 0000000..4817aa8
--- /dev/null
@@ -0,0 +1,41 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* slapcommon.h - common definitions for the slap tools */
+
+#ifndef SLAPCOMMON_H_
+#define SLAPCOMMON_H_ 1
+
+#define SLAPD_TOOLS 1
+#include "../slap.h"
+
+enum slaptool {
+       SLAPCAT=1,      /* database -> LDIF tool */
+       SLAPADD,        /* LDIF -> database tool */
+       SLAPINDEX,      /* database index tool */
+       SLAPTEST        /* database testing tool */
+};
+
+
+extern char    *progname;
+extern char    *conffile;
+extern Backend *be;
+extern int             appendmode;
+extern int             verbose;
+extern int             continuemode;
+extern int             nosubordinates;
+extern int             dryrun;
+
+extern char    *ldiffile;
+extern FILE    *ldiffp;
+
+void slap_tool_init LDAP_P((
+       const char* name,
+       int tool,
+       int argc, char **argv ));
+
+void slap_tool_destroy LDAP_P((void));
+
+#endif /* SLAPCOMMON_H_ */
diff --git a/servers/slapd/tools/slapindex.c b/servers/slapd/tools/slapindex.c
new file mode 100644 (file)
index 0000000..09cab4e
--- /dev/null
@@ -0,0 +1,67 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/socket.h>
+#include <ac/unistd.h>
+
+#include "slapcommon.h"
+
+int
+main( int argc, char **argv )
+{
+       ID id;
+       int rc = EXIT_SUCCESS;
+
+       slap_tool_init( "slapindex", SLAPINDEX, argc, argv );
+
+       if( !be->be_entry_open ||
+               !be->be_entry_close ||
+               !be->be_entry_first ||
+               !be->be_entry_next  ||
+               !be->be_entry_reindex )
+       {
+               fprintf( stderr, "%s: database doesn't support necessary operations.\n",
+                       progname );
+               exit( EXIT_FAILURE );
+       }
+
+       if( be->be_entry_open( be, 0 ) != 0 ) {
+               fprintf( stderr, "%s: could not open database.\n",
+                       progname );
+               exit( EXIT_FAILURE );
+       }
+
+       for ( id = be->be_entry_first( be );
+               id != NOID;
+               id = be->be_entry_next( be ) )
+       {
+               int rtn;
+
+               if( verbose ) {
+                       printf("indexing id=%08lx\n", (long) id );
+               }
+
+               rtn =  be->be_entry_reindex( be, id );
+
+               if( rtn != LDAP_SUCCESS ) {
+                       rc = EXIT_FAILURE;
+                       if( continuemode ) continue;
+                       break;
+               }
+       }
+
+       (void) be->be_entry_close( be );
+
+       slap_tool_destroy();
+       return( rc );
+}
diff --git a/servers/slapd/tools/slappasswd.c b/servers/slapd/tools/slappasswd.c
new file mode 100644 (file)
index 0000000..d6b9bc1
--- /dev/null
@@ -0,0 +1,121 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/signal.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#include <ldap.h>
+#include <lutil.h>
+
+#include "ldap_defaults.h"
+
+static int     verbose = 0;
+
+static void
+usage(const char *s)
+{
+       fprintf(stderr,
+               "Usage: %s [options]\n"
+               "  -h hash\tpassword scheme\n"
+               "  -s secret\tnew password\n"
+               "  -c format\tcrypt(3) salt format\n"
+               "  -u\t\tgenerate RFC2307 values (default)\n"
+               "  -v\t\tincrease verbosity\n"
+               , s );
+
+       exit( EXIT_FAILURE );
+}
+
+int
+main( int argc, char *argv[] )
+{
+       char    *scheme = "{SSHA}";
+       char    *newpw = NULL;
+
+       int             i;
+       struct berval passwd;
+       struct berval *hash = NULL;
+
+       while( (i = getopt( argc, argv,
+               "c:d:h:s:vu" )) != EOF )
+       {
+               switch (i) {
+               case 'c':       /* crypt salt format */
+                       scheme = "{CRYPT}";
+                       lutil_salt_format( optarg );
+                       break;
+
+               case 'h':       /* scheme */
+                       scheme = strdup( optarg );
+                       break;
+
+               case 's':       /* new password (secret) */
+                       {
+                               char* p;
+                               newpw = strdup( optarg );
+
+                               for( p = optarg; *p != '\0'; p++ ) {
+                                       *p = '\0';
+                               }
+
+                       } break;
+
+               case 'u':       /* RFC2307 userPassword */
+                       break;
+
+               case 'v':       /* verbose */
+                       verbose++;
+                       break;
+
+               default:
+                       usage (argv[0]);
+               }
+       }
+
+       if( argc - optind != 0 ) {
+               usage( argv[0] );
+       } 
+
+       if( newpw == NULL ) {
+               /* prompt for new password */
+               char *cknewpw;
+               newpw = strdup(getpassphrase("New password: "));
+               cknewpw = getpassphrase("Re-enter new password: ");
+
+               if( strcmp( newpw, cknewpw )) {
+                       fprintf( stderr, "Password values do not match\n" );
+                       return EXIT_FAILURE;
+               }
+       }
+
+       passwd.bv_val = newpw;
+       passwd.bv_len = strlen(passwd.bv_val);
+
+       hash = lutil_passwd_hash( &passwd, scheme );
+
+       if( hash == NULL || hash->bv_val == NULL ) {
+               fprintf( stderr, "Password generation failed.\n");
+               return EXIT_FAILURE;
+       }
+
+       if( lutil_passwd( hash, &passwd, NULL ) ) {
+               fprintf( stderr, "Password verification failed.\n");
+               return EXIT_FAILURE;
+       }
+
+       printf( "%s\n" , hash->bv_val );
+       return EXIT_SUCCESS;
+}
index c4c4f18542368b2dd8a69e9da4827b9c4e21db87..44bc42a2e5801b36105759dc030a2536f194ec33 100644 (file)
@@ -1,7 +1,7 @@
 /* unbind.c - decode an ldap unbind operation and pass it to a backend db */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 8df425bc38573407022c1944ceaa3c8e8177a344..3db5b7c6c1dd256542b5d8d1365da2b292c33bc7 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* user.c - set user id, group id and group access list
index a1e081664d1d40f043fc7f1d652bf7c1cc186b08..e93c80c050b1091f5754f9b012a24e277f04feb7 100644 (file)
@@ -1,7 +1,7 @@
 /* value.c - routines for dealing with values */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
index 758c06abf56476174bbcc309574634e4eaf27608..1de4901e4a562ec26e91b889263e238cd89aa143 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index ee889af500a8f2e7fc537d2f45e999a5b181c0c0..97dd2bd4df9c16040374d820394dcf909d19dba3 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 298391e4f3c41ebae00739b16d5ca591374349c6..9c95a72cb7d3e3c22eeef5e0bb9b6612435c561f 100644 (file)
@@ -1,3 +1,8 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
 /*
  * Copyright (c) 1996 Regents of the University of Michigan.
  * All rights reserved.
  * is provided ``as is'' without express or implied warranty.
  */
 
+#define CH_FREE 1
+
 /*
  * ch_malloc.c - malloc() and friends, with check for NULL return.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/stdlib.h>
+#include <ac/socket.h>
+
 #include "../slapd/slap.h"
 
 
+#ifndef CSRIMALLOC
 
 /*
  * Just like malloc, except we check the returned value and exit
  * if anything goes wrong.
  */
-char *
+void *
 ch_malloc(
-    unsigned long      size
+    ber_len_t  size
 )
 {
-       char    *new;
+       void    *new;
 
-       if ( (new = (char *) malloc( size )) == NULL ) {
-               fprintf( stderr, "malloc of %d bytes failed\n", size );
-               exit( 1 );
+       if ( (new = (void *) ber_memalloc( size )) == NULL ) {
+               fprintf( stderr, "malloc of %lu bytes failed\n",
+                       (long) size );
+               exit( EXIT_FAILURE );
        }
 
        return( new );
@@ -47,21 +60,26 @@ ch_malloc(
  * Just like realloc, except we check the returned value and exit
  * if anything goes wrong.
  */
-char *
+void *
 ch_realloc(
-    char               *block,
-    unsigned long      size
+    void               *block,
+    ber_len_t  size
 )
 {
-       char    *new;
+       void    *new;
 
        if ( block == NULL ) {
                return( ch_malloc( size ) );
        }
 
-       if ( (new = (char *) realloc( block, size )) == NULL ) {
-               fprintf( stderr, "realloc of %d bytes failed\n", size );
-               exit( 1 );
+       if ( size == 0 ) {
+               ch_free( block );
+       }
+
+       if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
+               fprintf( stderr, "realloc of %lu bytes failed\n",
+                       (long) size );
+               exit( EXIT_FAILURE );
        }
 
        return( new );
@@ -74,18 +92,18 @@ ch_realloc(
  * Just like calloc, except we check the returned value and exit
  * if anything goes wrong.
  */
-char *
+void *
 ch_calloc(
-    unsigned long      nelem,
-    unsigned long      size
+    ber_len_t  nelem,
+    ber_len_t  size
 )
 {
-       char    *new;
+       void    *new;
 
-       if ( (new = (char *) calloc( nelem, size )) == NULL ) {
-               fprintf( stderr, "calloc of %d elems of %d bytes failed\n",
-                   nelem, size );
-               exit( 1 );
+       if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
+               fprintf( stderr, "calloc of %lu elems of %lu bytes failed\n",
+                   (long) nelem, (long) size );
+               exit( EXIT_FAILURE );
        }
 
        return( new );
@@ -97,12 +115,13 @@ ch_calloc(
  */
 void
 ch_free(
-    char *p
+    void *p
 )
 {
     if ( p != NULL ) {
-       free( p );
+               ber_memfree( p );
     }
     return;
 }
-       
+
+#endif
index cff77048992f51c5217df8aaa8f5e97a0913a2e8..4c6af08b510caa19f24f217065f48795ff119084 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 6b8cec3c10f9247ea2677c6fbf9dc0a1cbcea3ef..50740f25b5bf225ec1fba51078f7fcdba05edef2 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index d55784a8f3be2ae623212e60b409f1f9b825ad00..5ff11118a0c2a8ba5dbbbb25ce804f2242ec8e5e 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 073e34a8ea86fdb6b59bea2b8060f6566ecd8037..7aba1c67278947d1b5f04138cc1864204976664b 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 38882a1b42226351b564a2174a60d21276f683c3..c2efec4bae5b3c251290a0cca5cb29db448f218a 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 5b707942e6a870b299673b60e6a66c3f7a6b95d7..8a8fa65f98c447193addb3ad8e5a61dd6883ce52 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index c67cd382c8e45d2eacca9826713cbf55d40317d2..3220853fb7f0d97fb46ab51e0b37e29fa6deb1e4 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index b168645b216c30b00a5a94294b1e63b6dc336cff..bdcce9ad688fda088a725e2e9d702995c5d78f6b 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #ifndef _PROTO_SLURP
index dc0f48fec69ee356453f0a1e0060c7cb70671186..325d4627361f01b3c7710f13b193d46add6496fc 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index ba551c161f0b0aabbe68df6e2b26811cc494217b..0b4d5ee12e04f1de9d7c49cebc909464f0cc6baf 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 49fc9e178e0ba0d7cca7408b62505e01c31e2fdb..d24ba413a76bfe8e21cbd192a14abb8466bb592a 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 471275a6dfc11b0d4aeaf5be36407427ce08362d..c22bfedee94c0f14edccfb6c031a3ffbad9864d7 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index c9f0a4ffa1ce5a9e17500e5bc1d14fa1887f69aa..7225783c3937faa5044956c347a0aa8f0afbbf18 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 87f2daeb59ee07ce0b8f22d40dba17937334cc96..f19277017e9359b0c0cab9982db2fc7687698973 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index 85103257336cff478078f745207bdc0fc8720a4c..0927e597f2982b8986231bfe63cfc6c85edd4a57 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index b01e141672bd794c88cc6c337c478f2cf63e9248..43f310dc623d0c0cf0274160840de94716264a49 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index f6cc685fff707f09ae6b80d1bf3000aed072c2e0..e2a00299b6ea444204a39ce7557b840f4ab5b6e4 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
index bbbbc87fefed2ba882884ed7ec9e812a6769ba62..f702bb00fa58292c8cc60b9719ea367a661ef8ae 100644 (file)
@@ -1,5 +1,5 @@
 # $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
 ## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 ##
 ## tests Makefile.in for OpenLDAP
index 3721a66eef17717d9cddc4c15865865d5872d51e..618057d629c50c685b5f0db34a434ef89151a50b 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #include "portable.h"
index 0f43c6ae3901382c27fd219e55164ec0ab32ce40..7acb5fb8f4a90aa330f3e590de7cf46264cea96c 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #include "portable.h"
index b96f89964679b6f8f0f4bc06795c1026a7b4f0e4..5830a01cae2e1cb59636a868d854498b6dabd696 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #include "portable.h"
index 5f3d6e19d6631f5561eeacc6266670a2406e3f79..a2a96f415a12419af3a760778030d6a95a7b8acb 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #include "portable.h"