From: Kurt Zeilenga Date: Mon, 3 Mar 2003 18:10:01 +0000 (+0000) Subject: Happy (belated) new year X-Git-Tag: OPENLDAP_REL_ENG_2_1_15~14 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=30be0c2240546e16dc5d2d6f124558f0a42b3e2d;p=openldap Happy (belated) new year --- diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000000..934c1bedac --- /dev/null +++ b/Makefile.in @@ -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 diff --git a/acconfig.h b/acconfig.h index dd00c4506d..a076b059c7 100644 --- a/acconfig.h +++ b/acconfig.h @@ -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 index 0000000000..3a29222ebe --- /dev/null +++ b/acinclude.m4 @@ -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 diff --git a/aclocal.m4 b/aclocal.m4 index 218c5c7853..a0d401d96c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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 index 0000000000..28101bbd47 --- /dev/null +++ b/build/build.mak @@ -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 index 0000000000..b392ebcc47 --- /dev/null +++ b/build/dir.mk @@ -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 index 0000000000..c6eb2450b5 --- /dev/null +++ b/build/info.mk @@ -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 index 0000000000..02409a97fd --- /dev/null +++ b/build/lib-shared.mk @@ -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 index 0000000000..6b79999dc3 --- /dev/null +++ b/build/lib-static.mk @@ -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 index 0000000000..6a4527c8c1 --- /dev/null +++ b/build/lib.mk @@ -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 + diff --git a/build/man.mk b/build/man.mk index 5c09377e7f..af4c60aa57 100644 --- a/build/man.mk +++ b/build/man.mk @@ -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. ##--------------------------------------------------------------------------- diff --git a/build/mkdep b/build/mkdep index 4384b2853f..506126e3a7 100755 --- a/build/mkdep +++ b/build/mkdep @@ -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/mkrelease b/build/mkrelease index f0e7a1f5d7..906a78ab89 100755 --- a/build/mkrelease +++ b/build/mkrelease @@ -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 index 0000000000..f8778179f6 --- /dev/null +++ b/build/mod.mk @@ -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 index 0000000000..bef349c373 --- /dev/null +++ b/build/rules.mk @@ -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 index 0000000000..f0e0fb77a5 --- /dev/null +++ b/build/srv.mk @@ -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 diff --git a/clients/Makefile.in b/clients/Makefile.in index e9deeb06e7..3cd0d85d41 100644 --- a/clients/Makefile.in +++ b/clients/Makefile.in @@ -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 index 0000000000..6f2755cffa --- /dev/null +++ b/contrib/ldapc++/COPYRIGHT @@ -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 index 0000000000..57b4111ade --- /dev/null +++ b/contrib/ldapc++/src/ac/time.h @@ -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 +# include +#elif HAVE_SYS_TIME_H +# include +# ifdef HAVE_SYS_TIMEB_H +# include +# endif +#else +# include +#endif + +#endif /* _AC_TIME_H */ diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000000..9b05a9cf11 --- /dev/null +++ b/doc/Makefile.in @@ -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 index 0000000000..aaf6637b15 --- /dev/null +++ b/doc/man/Makefile.in @@ -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 index 0000000000..829fe6c827 --- /dev/null +++ b/doc/man/man1/Makefile.in @@ -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 diff --git a/doc/man/man1/ldapcompare.1 b/doc/man/man1/ldapcompare.1 index dd955a7a16..6bb8541389 100644 --- a/doc/man/man1/ldapcompare.1 +++ b/doc/man/man1/ldapcompare.1 @@ -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 diff --git a/doc/man/man1/ldapdelete.1 b/doc/man/man1/ldapdelete.1 index bb5d2dbc8d..137cb63ff6 100644 --- a/doc/man/man1/ldapdelete.1 +++ b/doc/man/man1/ldapdelete.1 @@ -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 diff --git a/doc/man/man1/ldapmodify.1 b/doc/man/man1/ldapmodify.1 index ebc7faaaf1..007458340c 100644 --- a/doc/man/man1/ldapmodify.1 +++ b/doc/man/man1/ldapmodify.1 @@ -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 diff --git a/doc/man/man1/ldapmodrdn.1 b/doc/man/man1/ldapmodrdn.1 index 66c803693c..a0fbe3bc2f 100644 --- a/doc/man/man1/ldapmodrdn.1 +++ b/doc/man/man1/ldapmodrdn.1 @@ -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 diff --git a/doc/man/man1/ldappasswd.1 b/doc/man/man1/ldappasswd.1 index a7f30f0b0b..3e03a03f48 100644 --- a/doc/man/man1/ldappasswd.1 +++ b/doc/man/man1/ldappasswd.1 @@ -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 diff --git a/doc/man/man1/ldapsearch.1 b/doc/man/man1/ldapsearch.1 index cd5bdd7e1d..79accc266b 100644 --- a/doc/man/man1/ldapsearch.1 +++ b/doc/man/man1/ldapsearch.1 @@ -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 diff --git a/doc/man/man1/ldapwhoami.1 b/doc/man/man1/ldapwhoami.1 index 9d2038e595..519f581860 100644 --- a/doc/man/man1/ldapwhoami.1 +++ b/doc/man/man1/ldapwhoami.1 @@ -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 index 0000000000..2d84de3b57 --- /dev/null +++ b/doc/man/man3/Makefile.in @@ -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 diff --git a/doc/man/man3/lber-decode.3 b/doc/man/man3/lber-decode.3 index a8194cc970..0494010a43 100644 --- a/doc/man/man3/lber-decode.3 +++ b/doc/man/man3/lber-decode.3 @@ -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, diff --git a/doc/man/man3/lber-encode.3 b/doc/man/man3/lber-encode.3 index 3598bdec04..c9a1115074 100644 --- a/doc/man/man3/lber-encode.3 +++ b/doc/man/man3/lber-encode.3 @@ -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 diff --git a/doc/man/man3/lber-memory.3 b/doc/man/man3/lber-memory.3 index a1e0c4a777..62aeccc925 100644 --- a/doc/man/man3/lber-memory.3 +++ b/doc/man/man3/lber-memory.3 @@ -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 diff --git a/doc/man/man3/lber-types.3 b/doc/man/man3/lber-types.3 index e5e4abbec2..4b6b8a7aa3 100644 --- a/doc/man/man3/lber-types.3 +++ b/doc/man/man3/lber-types.3 @@ -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 diff --git a/doc/man/man3/ldap.3 b/doc/man/man3/ldap.3 index e9954b7ba4..b1a9c5a0c6 100644 --- a/doc/man/man3/ldap.3 +++ b/doc/man/man3/ldap.3 @@ -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 diff --git a/doc/man/man3/ldap_abandon.3 b/doc/man/man3/ldap_abandon.3 index aeeb3e6c16..879db11aee 100644 --- a/doc/man/man3/ldap_abandon.3 +++ b/doc/man/man3/ldap_abandon.3 @@ -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 diff --git a/doc/man/man3/ldap_add.3 b/doc/man/man3/ldap_add.3 index e993a9c87b..f65bd5e8a2 100644 --- a/doc/man/man3/ldap_add.3 +++ b/doc/man/man3/ldap_add.3 @@ -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 diff --git a/doc/man/man3/ldap_bind.3 b/doc/man/man3/ldap_bind.3 index ca8247f634..5714b04303 100644 --- a/doc/man/man3/ldap_bind.3 +++ b/doc/man/man3/ldap_bind.3 @@ -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 diff --git a/doc/man/man3/ldap_cache.3 b/doc/man/man3/ldap_cache.3 index 1b35e5b916..20e1c794db 100644 --- a/doc/man/man3/ldap_cache.3 +++ b/doc/man/man3/ldap_cache.3 @@ -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 diff --git a/doc/man/man3/ldap_compare.3 b/doc/man/man3/ldap_compare.3 index 145e44626f..0f0363be8c 100644 --- a/doc/man/man3/ldap_compare.3 +++ b/doc/man/man3/ldap_compare.3 @@ -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 diff --git a/doc/man/man3/ldap_delete.3 b/doc/man/man3/ldap_delete.3 index 0657138f23..7375078712 100644 --- a/doc/man/man3/ldap_delete.3 +++ b/doc/man/man3/ldap_delete.3 @@ -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 diff --git a/doc/man/man3/ldap_error.3 b/doc/man/man3/ldap_error.3 index 227f32a408..b86af8422f 100644 --- a/doc/man/man3/ldap_error.3 +++ b/doc/man/man3/ldap_error.3 @@ -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 diff --git a/doc/man/man3/ldap_first_attribute.3 b/doc/man/man3/ldap_first_attribute.3 index 75bd21d84f..cdc18dbf2a 100644 --- a/doc/man/man3/ldap_first_attribute.3 +++ b/doc/man/man3/ldap_first_attribute.3 @@ -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 diff --git a/doc/man/man3/ldap_first_entry.3 b/doc/man/man3/ldap_first_entry.3 index 0c98662ce2..884c98d878 100644 --- a/doc/man/man3/ldap_first_entry.3 +++ b/doc/man/man3/ldap_first_entry.3 @@ -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 diff --git a/doc/man/man3/ldap_first_message.3 b/doc/man/man3/ldap_first_message.3 index 0abe91e44f..87e2411a20 100644 --- a/doc/man/man3/ldap_first_message.3 +++ b/doc/man/man3/ldap_first_message.3 @@ -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 diff --git a/doc/man/man3/ldap_first_reference.3 b/doc/man/man3/ldap_first_reference.3 index ecd8d87d84..f7401391e6 100644 --- a/doc/man/man3/ldap_first_reference.3 +++ b/doc/man/man3/ldap_first_reference.3 @@ -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 diff --git a/doc/man/man3/ldap_get_dn.3 b/doc/man/man3/ldap_get_dn.3 index 9b78de5083..1b51a6bb28 100644 --- a/doc/man/man3/ldap_get_dn.3 +++ b/doc/man/man3/ldap_get_dn.3 @@ -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 diff --git a/doc/man/man3/ldap_get_values.3 b/doc/man/man3/ldap_get_values.3 index 845499e1e9..9aa28fb401 100644 --- a/doc/man/man3/ldap_get_values.3 +++ b/doc/man/man3/ldap_get_values.3 @@ -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 diff --git a/doc/man/man3/ldap_modify.3 b/doc/man/man3/ldap_modify.3 index 856a81c02c..d71a93fdc6 100644 --- a/doc/man/man3/ldap_modify.3 +++ b/doc/man/man3/ldap_modify.3 @@ -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 diff --git a/doc/man/man3/ldap_modrdn.3 b/doc/man/man3/ldap_modrdn.3 index 19f9e70886..3036dd2076 100644 --- a/doc/man/man3/ldap_modrdn.3 +++ b/doc/man/man3/ldap_modrdn.3 @@ -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 diff --git a/doc/man/man3/ldap_open.3 b/doc/man/man3/ldap_open.3 index af934ea13f..01278035ce 100644 --- a/doc/man/man3/ldap_open.3 +++ b/doc/man/man3/ldap_open.3 @@ -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 diff --git a/doc/man/man3/ldap_parse_reference.3 b/doc/man/man3/ldap_parse_reference.3 index 61b83433ef..e38d1519e6 100644 --- a/doc/man/man3/ldap_parse_reference.3 +++ b/doc/man/man3/ldap_parse_reference.3 @@ -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 diff --git a/doc/man/man3/ldap_parse_result.3 b/doc/man/man3/ldap_parse_result.3 index 6ec4d1ab1a..471f2f755a 100644 --- a/doc/man/man3/ldap_parse_result.3 +++ b/doc/man/man3/ldap_parse_result.3 @@ -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 diff --git a/doc/man/man3/ldap_result.3 b/doc/man/man3/ldap_result.3 index 624a32a3c5..128d79a551 100644 --- a/doc/man/man3/ldap_result.3 +++ b/doc/man/man3/ldap_result.3 @@ -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 diff --git a/doc/man/man3/ldap_schema.3 b/doc/man/man3/ldap_schema.3 index 4ba1c495b1..ffa50beb5b 100644 --- a/doc/man/man3/ldap_schema.3 +++ b/doc/man/man3/ldap_schema.3 @@ -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, diff --git a/doc/man/man3/ldap_search.3 b/doc/man/man3/ldap_search.3 index a78fb09842..3530b25b6a 100644 --- a/doc/man/man3/ldap_search.3 +++ b/doc/man/man3/ldap_search.3 @@ -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 diff --git a/doc/man/man3/ldap_sort.3 b/doc/man/man3/ldap_sort.3 index 90a5f3f94b..8ef18ed125 100644 --- a/doc/man/man3/ldap_sort.3 +++ b/doc/man/man3/ldap_sort.3 @@ -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 diff --git a/doc/man/man3/ldap_url.3 b/doc/man/man3/ldap_url.3 index eeb60a4744..0cc3f3774f 100644 --- a/doc/man/man3/ldap_url.3 +++ b/doc/man/man3/ldap_url.3 @@ -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 index 0000000000..58de520bd9 --- /dev/null +++ b/doc/man/man5/Makefile.in @@ -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 diff --git a/doc/man/man5/ldap.conf.5 b/doc/man/man5/ldap.conf.5 index 4d406dd2b9..20f07f291a 100644 --- a/doc/man/man5/ldap.conf.5 +++ b/doc/man/man5/ldap.conf.5 @@ -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 diff --git a/doc/man/man5/ldif.5 b/doc/man/man5/ldif.5 index eec8fdfa4c..5b0c9e07df 100644 --- a/doc/man/man5/ldif.5 +++ b/doc/man/man5/ldif.5 @@ -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 diff --git a/doc/man/man5/slapd-bdb.5 b/doc/man/man5/slapd-bdb.5 index c76dbdb4bc..a642aeb582 100644 --- a/doc/man/man5/slapd-bdb.5 +++ b/doc/man/man5/slapd-bdb.5 @@ -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 diff --git a/doc/man/man5/slapd-dnssrv.5 b/doc/man/man5/slapd-dnssrv.5 index 674d524707..9e9be5ca55 100644 --- a/doc/man/man5/slapd-dnssrv.5 +++ b/doc/man/man5/slapd-dnssrv.5 @@ -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 diff --git a/doc/man/man5/slapd-ldap.5 b/doc/man/man5/slapd-ldap.5 index 800508ce79..398ef24b27 100644 --- a/doc/man/man5/slapd-ldap.5 +++ b/doc/man/man5/slapd-ldap.5 @@ -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 diff --git a/doc/man/man5/slapd-ldbm.5 b/doc/man/man5/slapd-ldbm.5 index 8faa44e7da..70b46055d1 100644 --- a/doc/man/man5/slapd-ldbm.5 +++ b/doc/man/man5/slapd-ldbm.5 @@ -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 diff --git a/doc/man/man5/slapd-meta.5 b/doc/man/man5/slapd-meta.5 index ed3fa7bba4..11d5cbfd88 100644 --- a/doc/man/man5/slapd-meta.5 +++ b/doc/man/man5/slapd-meta.5 @@ -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. .\" $OpenLDAP$ diff --git a/doc/man/man5/slapd-passwd.5 b/doc/man/man5/slapd-passwd.5 index dfb7ca5bc8..0222f69e71 100644 --- a/doc/man/man5/slapd-passwd.5 +++ b/doc/man/man5/slapd-passwd.5 @@ -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 diff --git a/doc/man/man5/slapd-shell.5 b/doc/man/man5/slapd-shell.5 index b84d6201cc..70f479d1d0 100644 --- a/doc/man/man5/slapd-shell.5 +++ b/doc/man/man5/slapd-shell.5 @@ -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 diff --git a/doc/man/man5/slapd.access.5 b/doc/man/man5/slapd.access.5 index 7eefc54cc5..fa6b945214 100644 --- a/doc/man/man5/slapd.access.5 +++ b/doc/man/man5/slapd.access.5 @@ -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 diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5 index 6538c3bdee..7d7a5ca0eb 100644 --- a/doc/man/man5/slapd.conf.5 +++ b/doc/man/man5/slapd.conf.5 @@ -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 diff --git a/doc/man/man5/slapd.replog.5 b/doc/man/man5/slapd.replog.5 index 4ad60bbc20..668132afae 100644 --- a/doc/man/man5/slapd.replog.5 +++ b/doc/man/man5/slapd.replog.5 @@ -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 index 0000000000..ff6958d823 --- /dev/null +++ b/doc/man/man8/Makefile.in @@ -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 diff --git a/doc/man/man8/slapadd.8 b/doc/man/man8/slapadd.8 index e003feca3a..df4ed7bed8 100644 --- a/doc/man/man8/slapadd.8 +++ b/doc/man/man8/slapadd.8 @@ -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 diff --git a/doc/man/man8/slapcat.8 b/doc/man/man8/slapcat.8 index f0d1129ea2..33ba59290e 100644 --- a/doc/man/man8/slapcat.8 +++ b/doc/man/man8/slapcat.8 @@ -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 diff --git a/doc/man/man8/slapd.8 b/doc/man/man8/slapd.8 index e8f7dc4832..63b457e496 100644 --- a/doc/man/man8/slapd.8 +++ b/doc/man/man8/slapd.8 @@ -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 diff --git a/doc/man/man8/slapindex.8 b/doc/man/man8/slapindex.8 index 5b77e152ce..1434391e34 100644 --- a/doc/man/man8/slapindex.8 +++ b/doc/man/man8/slapindex.8 @@ -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 diff --git a/doc/man/man8/slappasswd.8 b/doc/man/man8/slappasswd.8 index cfbc2b6573..41fd51e277 100644 --- a/doc/man/man8/slappasswd.8 +++ b/doc/man/man8/slappasswd.8 @@ -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 diff --git a/doc/man/man8/slurpd.8 b/doc/man/man8/slurpd.8 index 097e30bda6..8d85515524 100644 --- a/doc/man/man8/slurpd.8 +++ b/doc/man/man8/slurpd.8 @@ -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 index 0000000000..88b419a106 --- /dev/null +++ b/include/ac/alloca.h @@ -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 +# 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 index 0000000000..3f71af57e0 --- /dev/null +++ b/include/ac/crypt.h @@ -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 + +/* crypt() may be defined in a separate include file */ +#if HAVE_CRYPT_H +# include +#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 index 0000000000..9c59f6973e --- /dev/null +++ b/include/ac/ctype.h @@ -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 + +#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 index 0000000000..8d2da0dd55 --- /dev/null +++ b/include/ac/dirent.h @@ -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 +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include +# endif +# if HAVE_SYS_DIR_H +# include +# endif +# if HAVE_NDIR_H +# include +# endif +#endif + +#endif /* _AC_DIRENT_H */ diff --git a/include/ac/errno.h b/include/ac/errno.h new file mode 100644 index 0000000000..29cedf4262 --- /dev/null +++ b/include/ac/errno.h @@ -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 +#elif defined( HAVE_SYS_ERRNO_H ) +# include +#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 index 0000000000..9ebbb742b6 --- /dev/null +++ b/include/ac/krb.h @@ -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 +#elif defined( HAVE_KRB_H ) +#include +#endif + +#if defined( HAVE_KERBEROSIV_DES_H ) +#include +#elif defined( HAVE_DES_H ) +#include +#endif + +#endif /* HAVE_KRB4 */ +#endif /* _AC_KRB_H */ diff --git a/include/ac/krb5.h b/include/ac/krb5.h new file mode 100644 index 0000000000..1f4dc18557 --- /dev/null +++ b/include/ac/krb5.h @@ -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 +#endif /* HAVE_KRB5 */ + +#endif /* _AC_KRB5_H */ diff --git a/include/ac/param.h b/include/ac/param.h new file mode 100644 index 0000000000..4f67a107ab --- /dev/null +++ b/include/ac/param.h @@ -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 +#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 index 0000000000..e63c03c419 --- /dev/null +++ b/include/ac/regex.h @@ -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 +#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 +#else + /* have regex.h, assume it's POSIX compliant */ +# include +#endif /* regex.h */ + +#endif /* _AC_REGEX_H_ */ diff --git a/include/ac/setproctitle.h b/include/ac/setproctitle.h new file mode 100644 index 0000000000..13002cdfaf --- /dev/null +++ b/include/ac/setproctitle.h @@ -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 +#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 index 0000000000..8c45a6cc18 --- /dev/null +++ b/include/ac/signal.h @@ -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 + +#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 index 0000000000..16bedb1b98 --- /dev/null +++ b/include/ac/stdarg.h @@ -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 + +#ifndef HAVE_STDARG +# define HAVE_STDARG 1 +#endif + +#endif /* _AC_STDARG_H */ diff --git a/include/ac/stdlib.h b/include/ac/stdlib.h index 2e3eb5502d..94be31c517 100644 --- a/include/ac/stdlib.h +++ b/include/ac/stdlib.h @@ -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 diff --git a/include/ac/string.h b/include/ac/string.h index 930e757c7c..1d71d79332 100644 --- a/include/ac/string.h +++ b/include/ac/string.h @@ -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 index 0000000000..c953845e04 --- /dev/null +++ b/include/ac/sysexits.h @@ -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 +#else +# include +#endif + +#endif /* _AC_SYSEXITS_H_ */ diff --git a/include/ac/syslog.h b/include/ac/syslog.h new file mode 100644 index 0000000000..f4eed2644f --- /dev/null +++ b/include/ac/syslog.h @@ -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 +#elif defined ( HAVE_SYS_SYSLOG_H ) +#include +#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 index 0000000000..61109e2f03 --- /dev/null +++ b/include/ac/termios.h @@ -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 + +#ifdef GCWINSZ_IN_SYS_IOCTL +#include +#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 + +#ifdef HAVE_SYS_IOCTL_H +#include +#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 index 0000000000..01b911156d --- /dev/null +++ b/include/ac/time.h @@ -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 +# include +#elif HAVE_SYS_TIME_H +# include +# ifdef HAVE_SYS_TIMEB_H +# include +# endif +#else +# include +#endif + +#endif /* _AC_TIME_H */ diff --git a/include/ac/unistd.h b/include/ac/unistd.h new file mode 100644 index 0000000000..70c6197c03 --- /dev/null +++ b/include/ac/unistd.h @@ -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 +#endif + +#if HAVE_UNISTD_H +# include +#endif + +#if HAVE_PROCESS_H +# include +#endif + +/* note: callers of crypt(3) should include */ + +#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 + +#elif !defined(HAVE_GETOPT) + /* no getopt, assume we need getopt-compat.h */ +# include + +#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 + +/* + * 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 index 0000000000..667b36de93 --- /dev/null +++ b/include/ac/wait.h @@ -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 + +#if HAVE_SYS_WAIT_H +# include +#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 */ diff --git a/include/avl.h b/include/avl.h index 745cc17d61..3d8a619dc9 100644 --- a/include/avl.h +++ b/include/avl.h @@ -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. * @@ -10,47 +20,90 @@ * 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 + /* * 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 index 0000000000..27fde3211e --- /dev/null +++ b/include/getopt-compat.h @@ -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_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 */ diff --git a/include/lber_pvt.h b/include/lber_pvt.h index ba77229bb7..7f5a141e1f 100644 --- a/include/lber_pvt.h +++ b/include/lber_pvt.h @@ -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 index 0000000000..ed1b3e9378 --- /dev/null +++ b/include/lber_types.h.in @@ -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_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 index 0000000000..5e1bc8f646 --- /dev/null +++ b/include/lber_types.nt @@ -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_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 index 0000000000..9b6bab2d64 --- /dev/null +++ b/include/ldap_cdefs.h @@ -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 */ diff --git a/include/ldap_defaults.h b/include/ldap_defaults.h index 5c2570ed62..f7d1d9d944 100644 --- a/include/ldap_defaults.h +++ b/include/ldap_defaults.h @@ -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 index 0000000000..eb2d39c370 --- /dev/null +++ b/include/ldap_int_thread.h @@ -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 +#ifdef HAVE_SCHED_H +#include +#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 +#elif defined( HAVE_CTHREAD_H +# include +#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 + +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 +#include + +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 +#include +#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 +#include + +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 */ diff --git a/include/ldap_log.h b/include/ldap_log.h index 1490fa8744..4e38b45ab5 100644 --- a/include/ldap_log.h +++ b/include/ldap_log.h @@ -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_pvt.h b/include/ldap_pvt.h index 4150e41700..6988c16c41 100644 --- a/include/ldap_pvt.h +++ b/include/ldap_pvt.h @@ -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_pvt_uc.h b/include/ldap_pvt_uc.h index 14e8c84524..cffebaa47c 100644 --- a/include/ldap_pvt_uc.h +++ b/include/ldap_pvt_uc.h @@ -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_queue.h b/include/ldap_queue.h index 78852f427a..c7230470af 100644 --- a/include/ldap_queue.h +++ b/include/ldap_queue.h @@ -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 diff --git a/include/ldap_schema.h b/include/ldap_schema.h index 49078d832c..fea7020184 100644 --- a/include/ldap_schema.h +++ b/include/ldap_schema.h @@ -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 index 0000000000..68d95606e7 --- /dev/null +++ b/include/ldap_utf8.h @@ -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 /* 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 */ diff --git a/include/ldbm.h b/include/ldbm.h index 95bd55ffa7..9c92ac6e96 100644 --- a/include/ldbm.h +++ b/include/ldbm.h @@ -1,120 +1,205 @@ +/* $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 + +/* 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 +#include +#include -#include +#ifdef HAVE_DB_185_H +# include +#else +# ifdef HAVE_DB1_DB_H +# include +# else +# include +# 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 -#include -#include -#include +#include -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 -#include -#include -#include +#include -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 +#include +#include /* 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 -#ifndef O_RDONLY + +#ifdef HAVE_FCNTL_H #include #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_ */ diff --git a/include/ldif.h b/include/ldif.h index dd2b339193..799bfd1b0b 100644 --- a/include/ldif.h +++ b/include/ldif.h @@ -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. * @@ -13,18 +24,21 @@ #ifndef _LDIF_H #define _LDIF_H -#ifdef __cplusplus -extern "C" { -#endif +#include + +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 */ diff --git a/include/lutil.h b/include/lutil.h index d5f334f433..ae629eb1a6 100644 --- a/include/lutil.h +++ b/include/lutil.h @@ -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 index 0000000000..b17d5774a0 --- /dev/null +++ b/include/lutil_hash.h @@ -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 + +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 index 0000000000..a2ade22023 --- /dev/null +++ b/include/lutil_ldap.h @@ -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 +#include + +/* + * 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 index 0000000000..e0330261e5 --- /dev/null +++ b/include/lutil_lockf.h @@ -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 index 0000000000..bb203897e2 --- /dev/null +++ b/include/lutil_md5.h @@ -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 + +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 index 0000000000..a7667566b4 --- /dev/null +++ b/include/lutil_sha1.h @@ -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 +#include + +#ifdef AC_INT4_TYPE + +LDAP_BEGIN_DECL + + +/* + * SHA-1 in C + * By Steve Reid + */ +#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_ */ diff --git a/include/portable.h.in b/include/portable.h.in index de12f095bb..83d03f3ab8 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -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 index 0000000000..1a4c8de916 --- /dev/null +++ b/include/setup.mak @@ -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 diff --git a/include/sysexits-compat.h b/include/sysexits-compat.h index 9be67fa417..98c4a4b811 100644 --- a/include/sysexits-compat.h +++ b/include/sysexits-compat.h @@ -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. * diff --git a/libraries/Makefile.in b/libraries/Makefile.in index 28ab9116e2..b344a6b7b7 100644 --- a/libraries/Makefile.in +++ b/libraries/Makefile.in @@ -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 diff --git a/libraries/liblber/Makefile.in b/libraries/liblber/Makefile.in index e29ed051ae..440c370953 100644 --- a/libraries/liblber/Makefile.in +++ b/libraries/liblber/Makefile.in @@ -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 index 0000000000..0f420ac7fd --- /dev/null +++ b/libraries/liblber/assert.c @@ -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 + +/* + * 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 diff --git a/libraries/liblber/bprint.c b/libraries/liblber/bprint.c index 0535603b0c..5ba264ae6f 100644 --- a/libraries/liblber/bprint.c +++ b/libraries/liblber/bprint.c @@ -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/liblber/debug.c b/libraries/liblber/debug.c index 4d354513c3..02f439d87d 100644 --- a/libraries/liblber/debug.c +++ b/libraries/liblber/debug.c @@ -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/liblber/decode.c b/libraries/liblber/decode.c index d1afb510a8..33f33b4c6d 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -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 diff --git a/libraries/liblber/dtest.c b/libraries/liblber/dtest.c index 6847e1539c..387bf6dcc1 100644 --- a/libraries/liblber/dtest.c +++ b/libraries/liblber/dtest.c @@ -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 diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c index fefad6d3ec..8c11027c47 100644 --- a/libraries/liblber/encode.c +++ b/libraries/liblber/encode.c @@ -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 diff --git a/libraries/liblber/etest.c b/libraries/liblber/etest.c index 21d13d4a25..25db4cdc5d 100644 --- a/libraries/liblber/etest.c +++ b/libraries/liblber/etest.c @@ -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 diff --git a/libraries/liblber/idtest.c b/libraries/liblber/idtest.c index 1ad58fae79..8dedefbb56 100644 --- a/libraries/liblber/idtest.c +++ b/libraries/liblber/idtest.c @@ -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. * @@ -11,46 +16,50 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include + +#include + +#ifdef HAVE_PSAP_H #include #include +#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 } diff --git a/libraries/liblber/lber-int.h b/libraries/liblber/lber-int.h index 1d6ad83ba3..9f7409544a 100644 --- a/libraries/liblber/lber-int.h +++ b/libraries/liblber/lber-int.h @@ -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 diff --git a/libraries/liblber/memory.c b/libraries/liblber/memory.c index 077f7e3282..5b90650868 100644 --- a/libraries/liblber/memory.c +++ b/libraries/liblber/memory.c @@ -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 index 0000000000..7ae2f4fe22 --- /dev/null +++ b/libraries/liblber/nt_err.c @@ -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 +#elif HAVE_WINSOCK +#include +#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 index 0000000000..4ecee6485b --- /dev/null +++ b/libraries/liblber/options.c @@ -0,0 +1,214 @@ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ +#include "portable.h" + +#include +#include +#include +#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; +} diff --git a/libraries/liblber/sockbuf.c b/libraries/liblber/sockbuf.c index 7fa6e85321..62af5e3690 100644 --- a/libraries/liblber/sockbuf.c +++ b/libraries/liblber/sockbuf.c @@ -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 */ diff --git a/libraries/liblber/stdio.c b/libraries/liblber/stdio.c index 4dd47535b6..99e0da4e11 100644 --- a/libraries/liblber/stdio.c +++ b/libraries/liblber/stdio.c @@ -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 */ diff --git a/libraries/libldap/abandon.c b/libraries/libldap/abandon.c index 04397a275e..aa3f9d5885 100644 --- a/libraries/libldap/abandon.c +++ b/libraries/libldap/abandon.c @@ -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 diff --git a/libraries/libldap/add.c b/libraries/libldap/add.c index 20a987e977..7ce74dd97a 100644 --- a/libraries/libldap/add.c +++ b/libraries/libldap/add.c @@ -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 diff --git a/libraries/libldap/addentry.c b/libraries/libldap/addentry.c index a0fc4174e6..b5fafc5938 100644 --- a/libraries/libldap/addentry.c +++ b/libraries/libldap/addentry.c @@ -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 -#include -#include -#ifdef MACOS -#include -#include "macos.h" -#else /* MACOS */ -#if defined( DOS ) || defined( _WIN32 ) -#include -#include "msdos.h" -#else /* DOS */ -#include -#include -#endif /* DOS */ -#endif /* MACOS */ - -#include "lber.h" -#include "ldap.h" + +#include + +#include +#include +#include + +#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 index 0000000000..ca41a78c6a --- /dev/null +++ b/libraries/libldap/apitest.c @@ -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 + +#include + +#include + +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: "); + } + +#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; +} diff --git a/libraries/libldap/bind.c b/libraries/libldap/bind.c index 4040da1804..04ba176d28 100644 --- a/libraries/libldap/bind.c +++ b/libraries/libldap/bind.c @@ -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 diff --git a/libraries/libldap/charray.c b/libraries/libldap/charray.c index d29c5d5842..ad5c4c8b3b 100644 --- a/libraries/libldap/charray.c +++ b/libraries/libldap/charray.c @@ -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 */ diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 48d2845a5e..b984f13305 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -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 */ diff --git a/libraries/libldap/delete.c b/libraries/libldap/delete.c index e930fc579b..0dd046569f 100644 --- a/libraries/libldap/delete.c +++ b/libraries/libldap/delete.c @@ -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 diff --git a/libraries/libldap/dnssrv.c b/libraries/libldap/dnssrv.c index 5c0a2cfe73..c76b1c07e2 100644 --- a/libraries/libldap/dnssrv.c +++ b/libraries/libldap/dnssrv.c @@ -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/dntest.c b/libraries/libldap/dntest.c index e99b48b2ed..31342a5bae 100644 --- a/libraries/libldap/dntest.c +++ b/libraries/libldap/dntest.c @@ -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/extended.c b/libraries/libldap/extended.c index 64463e59d8..c9c27be37d 100644 --- a/libraries/libldap/extended.c +++ b/libraries/libldap/extended.c @@ -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/filter.c b/libraries/libldap/filter.c index 45eebb9483..912bf20c28 100644 --- a/libraries/libldap/filter.c +++ b/libraries/libldap/filter.c @@ -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 diff --git a/libraries/libldap/free.c b/libraries/libldap/free.c index b208b2f88f..bbb411950c 100644 --- a/libraries/libldap/free.c +++ b/libraries/libldap/free.c @@ -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 diff --git a/libraries/libldap/getattr.c b/libraries/libldap/getattr.c index 90b969aeb5..6e67e71c68 100644 --- a/libraries/libldap/getattr.c +++ b/libraries/libldap/getattr.c @@ -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 diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index 761fc416f4..ceb199427d 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -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 diff --git a/libraries/libldap/getentry.c b/libraries/libldap/getentry.c index 4fb23eff6c..1f8ebea022 100644 --- a/libraries/libldap/getentry.c +++ b/libraries/libldap/getentry.c @@ -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 diff --git a/libraries/libldap/getvalues.c b/libraries/libldap/getvalues.c index 43e159f190..82e36299ba 100644 --- a/libraries/libldap/getvalues.c +++ b/libraries/libldap/getvalues.c @@ -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 diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index 4c992ac53f..093cedf32f 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -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/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index e7ce439674..a769f287af 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -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 diff --git a/libraries/libldap/messages.c b/libraries/libldap/messages.c index bcb13a7f14..808a39509b 100644 --- a/libraries/libldap/messages.c +++ b/libraries/libldap/messages.c @@ -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/modify.c b/libraries/libldap/modify.c index f346064370..bba2a25de7 100644 --- a/libraries/libldap/modify.c +++ b/libraries/libldap/modify.c @@ -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 diff --git a/libraries/libldap/modrdn.c b/libraries/libldap/modrdn.c index 6907a22998..a038389277 100644 --- a/libraries/libldap/modrdn.c +++ b/libraries/libldap/modrdn.c @@ -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 diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index 45ec0e5f75..3b129036b8 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -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/os-ip.c b/libraries/libldap/os-ip.c index 96755c76dc..fc705e9f33 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -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 diff --git a/libraries/libldap/print.c b/libraries/libldap/print.c index 7ea14d63a3..f71f3689c9 100644 --- a/libraries/libldap/print.c +++ b/libraries/libldap/print.c @@ -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/references.c b/libraries/libldap/references.c index ff9b63fc0c..0e0730f6c8 100644 --- a/libraries/libldap/references.c +++ b/libraries/libldap/references.c @@ -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/request.c b/libraries/libldap/request.c index 66c5b67524..dedb1ee286 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -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 diff --git a/libraries/libldap/sbind.c b/libraries/libldap/sbind.c index 1d016bbf92..cec3af36d7 100644 --- a/libraries/libldap/sbind.c +++ b/libraries/libldap/sbind.c @@ -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 diff --git a/libraries/libldap/schema.c b/libraries/libldap/schema.c index 894b09de4a..0ac55075bf 100644 --- a/libraries/libldap/schema.c +++ b/libraries/libldap/schema.c @@ -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 */ /* diff --git a/libraries/libldap/sort.c b/libraries/libldap/sort.c index 84557eb33a..3f8484c8ea 100644 --- a/libraries/libldap/sort.c +++ b/libraries/libldap/sort.c @@ -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 diff --git a/libraries/libldap/sortctrl.c b/libraries/libldap/sortctrl.c index 37bf38f2e9..8079b0549f 100644 --- a/libraries/libldap/sortctrl.c +++ b/libraries/libldap/sortctrl.c @@ -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 */ diff --git a/libraries/libldap/string.c b/libraries/libldap/string.c index dbedf5741f..21330d4ae5 100644 --- a/libraries/libldap/string.c +++ b/libraries/libldap/string.c @@ -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 index 0000000000..4450e2d3ba --- /dev/null +++ b/libraries/libldap/t61.c @@ -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 + +#include + +#include +#include +#include + +#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; +} diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index 06c06e5617..e5909bac41 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -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 diff --git a/libraries/libldap/utf-8-conv.c b/libraries/libldap/utf-8-conv.c index e5aeeeca36..e84c775b96 100644 --- a/libraries/libldap/utf-8-conv.c +++ b/libraries/libldap/utf-8-conv.c @@ -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/libraries/libldap/utf-8.c b/libraries/libldap/utf-8.c index ab42cfbf5e..d6caf8c476 100644 --- a/libraries/libldap/utf-8.c +++ b/libraries/libldap/utf-8.c @@ -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/util-int.c b/libraries/libldap/util-int.c index e9e2e55e6b..59c3db4815 100644 --- a/libraries/libldap/util-int.c +++ b/libraries/libldap/util-int.c @@ -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/vlvctrl.c b/libraries/libldap/vlvctrl.c index 64b5cfe5ab..a4b10cec05 100644 --- a/libraries/libldap/vlvctrl.c +++ b/libraries/libldap/vlvctrl.c @@ -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 */ diff --git a/libraries/libldap_r/thr_cthreads.c b/libraries/libldap_r/thr_cthreads.c index e4e7dbcadb..73dff64219 100644 --- a/libraries/libldap_r/thr_cthreads.c +++ b/libraries/libldap_r/thr_cthreads.c @@ -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/thr_lwp.c b/libraries/libldap_r/thr_lwp.c index d869213bf5..eff722f083 100644 --- a/libraries/libldap_r/thr_lwp.c +++ b/libraries/libldap_r/thr_lwp.c @@ -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/thr_nt.c b/libraries/libldap_r/thr_nt.c index 8eedb75c2d..9cb0025561 100644 --- a/libraries/libldap_r/thr_nt.c +++ b/libraries/libldap_r/thr_nt.c @@ -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/thr_posix.c b/libraries/libldap_r/thr_posix.c index 8673f13954..825761e330 100644 --- a/libraries/libldap_r/thr_posix.c +++ b/libraries/libldap_r/thr_posix.c @@ -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/thr_pth.c b/libraries/libldap_r/thr_pth.c index b4e0539441..94e4391947 100644 --- a/libraries/libldap_r/thr_pth.c +++ b/libraries/libldap_r/thr_pth.c @@ -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/thr_stub.c b/libraries/libldap_r/thr_stub.c index e88931b6be..021c95335c 100644 --- a/libraries/libldap_r/thr_stub.c +++ b/libraries/libldap_r/thr_stub.c @@ -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/thr_thr.c b/libraries/libldap_r/thr_thr.c index feb42a95d5..231d3be57e 100644 --- a/libraries/libldap_r/thr_thr.c +++ b/libraries/libldap_r/thr_thr.c @@ -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 index 0000000000..7b7ae96b57 --- /dev/null +++ b/libraries/libldap_r/threads.c @@ -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 + +#include +#include +#include +#include + +#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 diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index aa0eb2d781..0910124b48 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -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 index 0000000000..a1f016545e --- /dev/null +++ b/libraries/libldbm/Makefile.in @@ -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) + diff --git a/libraries/libldbm/ldbm.c b/libraries/libldbm/ldbm.c index 111ba97e62..a464cd0f9b 100644 --- a/libraries/libldbm/ldbm.c +++ b/libraries/libldbm/ldbm.c @@ -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 index 0000000000..66fbb37126 --- /dev/null +++ b/libraries/libldif/Makefile.in @@ -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 + diff --git a/libraries/libldif/fetch.c b/libraries/libldif/fetch.c index 36baf734c2..cb4d81beed 100644 --- a/libraries/libldif/fetch.c +++ b/libraries/libldif/fetch.c @@ -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 */ diff --git a/libraries/libldif/line64.c b/libraries/libldif/line64.c index 1d0310793b..646418c87b 100644 --- a/libraries/libldif/line64.c +++ b/libraries/libldif/line64.c @@ -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 */ diff --git a/libraries/liblutil/Makefile.in b/libraries/liblutil/Makefile.in index a96d8d8bc8..b8e27695f9 100644 --- a/libraries/liblutil/Makefile.in +++ b/libraries/liblutil/Makefile.in @@ -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 index 0000000000..e5d4f36813 --- /dev/null +++ b/libraries/liblutil/base64.c @@ -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 +#include +#include +#include + +/* include socket.h to get sys/types.h and/or winsock2.h */ +#include + +#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); +} diff --git a/libraries/liblutil/csn.c b/libraries/liblutil/csn.c index 752ee35f89..6f49a8cf13 100644 --- a/libraries/liblutil/csn.c +++ b/libraries/liblutil/csn.c @@ -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/liblutil/entropy.c b/libraries/liblutil/entropy.c index 74d3f3210a..6995cf4bc6 100644 --- a/libraries/liblutil/entropy.c +++ b/libraries/liblutil/entropy.c @@ -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/getopt.c b/libraries/liblutil/getopt.c index 137944ab6f..1727aaf641 100644 --- a/libraries/liblutil/getopt.c +++ b/libraries/liblutil/getopt.c @@ -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 index 0000000000..da404df6f4 --- /dev/null +++ b/libraries/liblutil/getpass.c @@ -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 + +#include + +#include +#include +#include +#include +#include +#include + +#ifdef NEED_GETPASSPHRASE + +#ifdef HAVE_FCNTL_H +#include +#endif + +#ifdef HAVE_CONIO_H +#include +#endif + +#include +#include + +#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 index 0000000000..ecc7ec4e2d --- /dev/null +++ b/libraries/liblutil/lockf.c @@ -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 +#include + +#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 +# 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 +# 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 index 0000000000..aaf7ec8761 --- /dev/null +++ b/libraries/liblutil/md5.c @@ -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 + 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 + +/* include socket.h to get sys/types.h and/or winsock2.h */ +#include + +#include + +/* 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<>(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 + +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 */ diff --git a/libraries/liblutil/ntservice.c b/libraries/liblutil/ntservice.c index efcf1ae1c1..42b3d99e76 100644 --- a/libraries/liblutil/ntservice.c +++ b/libraries/liblutil/ntservice.c @@ -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/passfile.c b/libraries/liblutil/passfile.c index f31466aea2..a42eaddb2e 100644 --- a/libraries/liblutil/passfile.c +++ b/libraries/liblutil/passfile.c @@ -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 */ diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index 751852520a..144dd1afe5 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -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 index 0000000000..6638551dde --- /dev/null +++ b/libraries/liblutil/ptest.c @@ -0,0 +1,103 @@ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "portable.h" + +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#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 diff --git a/libraries/liblutil/sasl.c b/libraries/liblutil/sasl.c index a486afc7ca..c920eec66e 100644 --- a/libraries/liblutil/sasl.c +++ b/libraries/liblutil/sasl.c @@ -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/libraries/liblutil/sha1.c b/libraries/liblutil/sha1.c index 3ef447e823..db3e9425a8 100644 --- a/libraries/liblutil/sha1.c +++ b/libraries/liblutil/sha1.c @@ -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 index 0000000000..4f898ecf2a --- /dev/null +++ b/libraries/liblutil/signal.c @@ -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 +#include + +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 index 0000000000..cfe6ec3a61 --- /dev/null +++ b/libraries/liblutil/sockpair.c @@ -0,0 +1,68 @@ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "portable.h" +#include +#include + +#include + +/* 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 +} diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c index 973406f21e..1aaa308883 100644 --- a/libraries/liblutil/utils.c +++ b/libraries/liblutil/utils.c @@ -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/uuid.c b/libraries/liblutil/uuid.c index 0f3bbe75f1..a9640c1360 100644 --- a/libraries/liblutil/uuid.c +++ b/libraries/liblutil/uuid.c @@ -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 index 0000000000..f2e4cdfa6a --- /dev/null +++ b/libraries/librewrite/Makefile.in @@ -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 +## + +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 index 0000000000..38564a23a0 --- /dev/null +++ b/servers/Makefile.in @@ -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 + diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index ab9c56511e..be4a3f82a2 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -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 */ diff --git a/servers/slapd/ava.c b/servers/slapd/ava.c index e0fdd8bb2e..01287a0b4f 100644 --- a/servers/slapd/ava.c +++ b/servers/slapd/ava.c @@ -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 */ diff --git a/servers/slapd/back-bdb/compare.c b/servers/slapd/back-bdb/compare.c index 270077928a..df74448224 100644 --- a/servers/slapd/back-bdb/compare.c +++ b/servers/slapd/back-bdb/compare.c @@ -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 */ diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index 4ce4913aac..5011470d54 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -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 */ diff --git a/servers/slapd/back-bdb/dbcache.c b/servers/slapd/back-bdb/dbcache.c index 7d8d082590..7f5d6718d0 100644 --- a/servers/slapd/back-bdb/dbcache.c +++ b/servers/slapd/back-bdb/dbcache.c @@ -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 */ diff --git a/servers/slapd/back-bdb/dn2entry.c b/servers/slapd/back-bdb/dn2entry.c index c2817e23b2..32df2682fc 100644 --- a/servers/slapd/back-bdb/dn2entry.c +++ b/servers/slapd/back-bdb/dn2entry.c @@ -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 */ diff --git a/servers/slapd/back-bdb/error.c b/servers/slapd/back-bdb/error.c index 79d528a0e0..783d23cc42 100644 --- a/servers/slapd/back-bdb/error.c +++ b/servers/slapd/back-bdb/error.c @@ -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 */ diff --git a/servers/slapd/back-bdb/extended.c b/servers/slapd/back-bdb/extended.c index e3c26e18d1..231d4e903d 100644 --- a/servers/slapd/back-bdb/extended.c +++ b/servers/slapd/back-bdb/extended.c @@ -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 */ diff --git a/servers/slapd/back-bdb/idl.h b/servers/slapd/back-bdb/idl.h index c06d3bba9a..eaf6b691fd 100644 --- a/servers/slapd/back-bdb/idl.h +++ b/servers/slapd/back-bdb/idl.h @@ -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 */ diff --git a/servers/slapd/back-bdb/key.c b/servers/slapd/back-bdb/key.c index 20f59088a3..aa6e966fd7 100644 --- a/servers/slapd/back-bdb/key.c +++ b/servers/slapd/back-bdb/key.c @@ -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 */ diff --git a/servers/slapd/back-bdb/nextid.c b/servers/slapd/back-bdb/nextid.c index b9e4151b34..04b2f267cc 100644 --- a/servers/slapd/back-bdb/nextid.c +++ b/servers/slapd/back-bdb/nextid.c @@ -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 */ diff --git a/servers/slapd/back-bdb/referral.c b/servers/slapd/back-bdb/referral.c index 1ecbf1dddc..2552248bb7 100644 --- a/servers/slapd/back-bdb/referral.c +++ b/servers/slapd/back-bdb/referral.c @@ -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 */ diff --git a/servers/slapd/back-bdb/tools.c b/servers/slapd/back-bdb/tools.c index 679ca32c00..cd7a446041 100644 --- a/servers/slapd/back-bdb/tools.c +++ b/servers/slapd/back-bdb/tools.c @@ -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-dnssrv/bind.c b/servers/slapd/back-dnssrv/bind.c index adb5925148..0ead2caa19 100644 --- a/servers/slapd/back-dnssrv/bind.c +++ b/servers/slapd/back-dnssrv/bind.c @@ -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 index 0000000000..980843e31a --- /dev/null +++ b/servers/slapd/back-dnssrv/compare.c @@ -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 + +#include +#include + +#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; +} diff --git a/servers/slapd/back-dnssrv/config.c b/servers/slapd/back-dnssrv/config.c index 4bdb093846..5050febc8d 100644 --- a/servers/slapd/back-dnssrv/config.c +++ b/servers/slapd/back-dnssrv/config.c @@ -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 */ diff --git a/servers/slapd/back-dnssrv/init.c b/servers/slapd/back-dnssrv/init.c index 3363644477..52bcd6658d 100644 --- a/servers/slapd/back-dnssrv/init.c +++ b/servers/slapd/back-dnssrv/init.c @@ -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 */ diff --git a/servers/slapd/back-dnssrv/referral.c b/servers/slapd/back-dnssrv/referral.c index 9aaf23c79c..aa78cf0bed 100644 --- a/servers/slapd/back-dnssrv/referral.c +++ b/servers/slapd/back-dnssrv/referral.c @@ -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 */ diff --git a/servers/slapd/back-dnssrv/search.c b/servers/slapd/back-dnssrv/search.c index 2a831bb8f9..51320acbbd 100644 --- a/servers/slapd/back-dnssrv/search.c +++ b/servers/slapd/back-dnssrv/search.c @@ -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 index 0000000000..7fd47eda8f --- /dev/null +++ b/servers/slapd/back-ldap/Copyright @@ -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. + + +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. + + +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. + diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index 501e4d9802..bed8436d1f 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -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 */ diff --git a/servers/slapd/back-ldap/delete.c b/servers/slapd/back-ldap/delete.c index 3766df2db9..170f00b126 100644 --- a/servers/slapd/back-ldap/delete.c +++ b/servers/slapd/back-ldap/delete.c @@ -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 index 0000000000..2872e0d72a --- /dev/null +++ b/servers/slapd/back-ldap/external.h @@ -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 */ diff --git a/servers/slapd/back-ldap/modrdn.c b/servers/slapd/back-ldap/modrdn.c index 2eb905c844..76f496a260 100644 --- a/servers/slapd/back-ldap/modrdn.c +++ b/servers/slapd/back-ldap/modrdn.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index d6ac6fb83d..560ef7baea 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -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 index 0000000000..4521ca491c --- /dev/null +++ b/servers/slapd/back-ldbm/alias.c @@ -0,0 +1,287 @@ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "portable.h" + +#include +#include +#include +#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; +} diff --git a/servers/slapd/back-ldbm/attribute.c b/servers/slapd/back-ldbm/attribute.c index 4639f7d120..3246f47a53 100644 --- a/servers/slapd/back-ldbm/attribute.c +++ b/servers/slapd/back-ldbm/attribute.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/back-ldbm.h b/servers/slapd/back-ldbm/back-ldbm.h index 2824330190..b4f16656e0 100644 --- a/servers/slapd/back-ldbm/back-ldbm.h +++ b/servers/slapd/back-ldbm/back-ldbm.h @@ -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 @@ -37,78 +48,104 @@ * 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_ */ diff --git a/servers/slapd/back-ldbm/close.c b/servers/slapd/back-ldbm/close.c index 383817a5d9..0f31297434 100644 --- a/servers/slapd/back-ldbm/close.c +++ b/servers/slapd/back-ldbm/close.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/compare.c b/servers/slapd/back-ldbm/compare.c index b96dbd0163..921ba2cfdc 100644 --- a/servers/slapd/back-ldbm/compare.c +++ b/servers/slapd/back-ldbm/compare.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/config.c b/servers/slapd/back-ldbm/config.c index 527f3c4c43..7b8f324ae6 100644 --- a/servers/slapd/back-ldbm/config.c +++ b/servers/slapd/back-ldbm/config.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/delete.c b/servers/slapd/back-ldbm/delete.c index 1622554140..40a0925ad2 100644 --- a/servers/slapd/back-ldbm/delete.c +++ b/servers/slapd/back-ldbm/delete.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/dn2id.c b/servers/slapd/back-ldbm/dn2id.c index 60b6088c0c..491723fe47 100644 --- a/servers/slapd/back-ldbm/dn2id.c +++ b/servers/slapd/back-ldbm/dn2id.c @@ -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 index 0000000000..4c87512b32 --- /dev/null +++ b/servers/slapd/back-ldbm/entry.c @@ -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 + +#include +#include + +#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; +} diff --git a/servers/slapd/back-ldbm/extended.c b/servers/slapd/back-ldbm/extended.c index 93da72136d..08d6c6d745 100644 --- a/servers/slapd/back-ldbm/extended.c +++ b/servers/slapd/back-ldbm/extended.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/group.c b/servers/slapd/back-ldbm/group.c index 750a66d929..5507a78774 100644 --- a/servers/slapd/back-ldbm/group.c +++ b/servers/slapd/back-ldbm/group.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/id2children.c b/servers/slapd/back-ldbm/id2children.c index 8c375a6c16..5522801fbc 100644 --- a/servers/slapd/back-ldbm/id2children.c +++ b/servers/slapd/back-ldbm/id2children.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/id2entry.c b/servers/slapd/back-ldbm/id2entry.c index 2f071b8442..00b3a99774 100644 --- a/servers/slapd/back-ldbm/id2entry.c +++ b/servers/slapd/back-ldbm/id2entry.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/key.c b/servers/slapd/back-ldbm/key.c index 0ea188a473..59269606a5 100644 --- a/servers/slapd/back-ldbm/key.c +++ b/servers/slapd/back-ldbm/key.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index 3ea4e89cd1..eddeb5a2bd 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/nextid.c b/servers/slapd/back-ldbm/nextid.c index 8159ccf39b..d14c4c6688 100644 --- a/servers/slapd/back-ldbm/nextid.c +++ b/servers/slapd/back-ldbm/nextid.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/operational.c b/servers/slapd/back-ldbm/operational.c index bc68116c28..1671e9c8c9 100644 --- a/servers/slapd/back-ldbm/operational.c +++ b/servers/slapd/back-ldbm/operational.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/passwd.c b/servers/slapd/back-ldbm/passwd.c index 315277e784..3aed5c4df3 100644 --- a/servers/slapd/back-ldbm/passwd.c +++ b/servers/slapd/back-ldbm/passwd.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/referral.c b/servers/slapd/back-ldbm/referral.c index a1e34bd5b8..8c988814c2 100644 --- a/servers/slapd/back-ldbm/referral.c +++ b/servers/slapd/back-ldbm/referral.c @@ -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 index 0000000000..ae8d05ce67 --- /dev/null +++ b/servers/slapd/back-ldbm/sasl.c @@ -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 + +#include +#include +#include +#include + +#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 + diff --git a/servers/slapd/back-ldbm/tools.c b/servers/slapd/back-ldbm/tools.c index 5f415384f1..e8a2967e84 100644 --- a/servers/slapd/back-ldbm/tools.c +++ b/servers/slapd/back-ldbm/tools.c @@ -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 index 0000000000..811227f5db --- /dev/null +++ b/servers/slapd/back-meta/Copyright @@ -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. + +This work has been developed to fulfill the requirements +of SysNet s.n.c. 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 , and modified by Mark Valence +, Pierangelo Masarati 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. + +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. + + diff --git a/servers/slapd/back-meta/candidates.c b/servers/slapd/back-meta/candidates.c index 643f78b17c..3aaab4d5fb 100644 --- a/servers/slapd/back-meta/candidates.c +++ b/servers/slapd/back-meta/candidates.c @@ -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. diff --git a/servers/slapd/back-meta/delete.c b/servers/slapd/back-meta/delete.c index 29520650ec..22a9e569ed 100644 --- a/servers/slapd/back-meta/delete.c +++ b/servers/slapd/back-meta/delete.c @@ -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. diff --git a/servers/slapd/back-meta/dncache.c b/servers/slapd/back-meta/dncache.c index ff8038522e..2de2c191ac 100644 --- a/servers/slapd/back-meta/dncache.c +++ b/servers/slapd/back-meta/dncache.c @@ -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. diff --git a/servers/slapd/back-meta/external.h b/servers/slapd/back-meta/external.h new file mode 100644 index 0000000000..e37d552b8c --- /dev/null +++ b/servers/slapd/back-meta/external.h @@ -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. + * + * This work has been developed to fulfill the requirements + * of SysNet s.n.c. 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 , and modified by Mark Valence + * , Pierangelo Masarati 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. + * + * 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 */ diff --git a/servers/slapd/back-meta/modrdn.c b/servers/slapd/back-meta/modrdn.c index ade436e58d..34cfebfe96 100644 --- a/servers/slapd/back-meta/modrdn.c +++ b/servers/slapd/back-meta/modrdn.c @@ -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. diff --git a/servers/slapd/back-meta/unbind.c b/servers/slapd/back-meta/unbind.c index e4f381e988..b26dab5203 100644 --- a/servers/slapd/back-meta/unbind.c +++ b/servers/slapd/back-meta/unbind.c @@ -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. diff --git a/servers/slapd/back-monitor/Copyright b/servers/slapd/back-monitor/Copyright new file mode 100644 index 0000000000..ae05017da7 --- /dev/null +++ b/servers/slapd/back-monitor/Copyright @@ -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. + +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. + diff --git a/servers/slapd/back-monitor/back-monitor.h b/servers/slapd/back-monitor/back-monitor.h index 511facdd79..9bc463a1b5 100644 --- a/servers/slapd/back-monitor/back-monitor.h +++ b/servers/slapd/back-monitor/back-monitor.h @@ -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 */ /* diff --git a/servers/slapd/back-monitor/backend.c b/servers/slapd/back-monitor/backend.c index 987c2b348b..91a7802a9f 100644 --- a/servers/slapd/back-monitor/backend.c +++ b/servers/slapd/back-monitor/backend.c @@ -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 */ /* diff --git a/servers/slapd/back-monitor/bind.c b/servers/slapd/back-monitor/bind.c index 9c0cd468ba..b57149748f 100644 --- a/servers/slapd/back-monitor/bind.c +++ b/servers/slapd/back-monitor/bind.c @@ -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 */ /* diff --git a/servers/slapd/back-monitor/cache.c b/servers/slapd/back-monitor/cache.c index 9fc8c941f8..d1455a1820 100644 --- a/servers/slapd/back-monitor/cache.c +++ b/servers/slapd/back-monitor/cache.c @@ -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 index 0000000000..d3846a0746 --- /dev/null +++ b/servers/slapd/back-monitor/compare.c @@ -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. + * + * 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 + +#include +#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 ); +} + diff --git a/servers/slapd/back-monitor/conn.c b/servers/slapd/back-monitor/conn.c index 5bbaca74e1..937b44d2f6 100644 --- a/servers/slapd/back-monitor/conn.c +++ b/servers/slapd/back-monitor/conn.c @@ -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 index 0000000000..c764fd8100 --- /dev/null +++ b/servers/slapd/back-monitor/entry.c @@ -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. + * + * 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 +#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 ) ); +} + diff --git a/servers/slapd/back-monitor/external.h b/servers/slapd/back-monitor/external.h index 48d4e446df..90cc486239 100644 --- a/servers/slapd/back-monitor/external.h +++ b/servers/slapd/back-monitor/external.h @@ -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 */ /* diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index 04ce6664ca..ed754ce396 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -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 */ /* diff --git a/servers/slapd/back-monitor/listener.c b/servers/slapd/back-monitor/listener.c index 6eac766056..71879643f7 100644 --- a/servers/slapd/back-monitor/listener.c +++ b/servers/slapd/back-monitor/listener.c @@ -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 */ /* diff --git a/servers/slapd/back-monitor/log.c b/servers/slapd/back-monitor/log.c index 669f250706..b15053ae25 100644 --- a/servers/slapd/back-monitor/log.c +++ b/servers/slapd/back-monitor/log.c @@ -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 */ /* diff --git a/servers/slapd/back-monitor/modify.c b/servers/slapd/back-monitor/modify.c index 5cf4e29c8f..5cdec1e02d 100644 --- a/servers/slapd/back-monitor/modify.c +++ b/servers/slapd/back-monitor/modify.c @@ -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 */ /* diff --git a/servers/slapd/back-monitor/operation.c b/servers/slapd/back-monitor/operation.c index 7686bde2bb..71ce6cb07e 100644 --- a/servers/slapd/back-monitor/operation.c +++ b/servers/slapd/back-monitor/operation.c @@ -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 index 0000000000..fcab8f811b --- /dev/null +++ b/servers/slapd/back-monitor/operational.c @@ -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 + +#include +#include + +#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 index 0000000000..01d44ab01e --- /dev/null +++ b/servers/slapd/back-monitor/proto-back-monitor.h @@ -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. + * + * 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 + +#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 index 0000000000..904a81afae --- /dev/null +++ b/servers/slapd/back-monitor/rww.c @@ -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. + * + * 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 + +#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 ); +} + diff --git a/servers/slapd/back-monitor/search.c b/servers/slapd/back-monitor/search.c index 2795ee7be1..99133e9081 100644 --- a/servers/slapd/back-monitor/search.c +++ b/servers/slapd/back-monitor/search.c @@ -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 */ /* diff --git a/servers/slapd/back-monitor/sent.c b/servers/slapd/back-monitor/sent.c index 62c55f92ba..99bd329a78 100644 --- a/servers/slapd/back-monitor/sent.c +++ b/servers/slapd/back-monitor/sent.c @@ -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 */ /* diff --git a/servers/slapd/back-monitor/thread.c b/servers/slapd/back-monitor/thread.c index 112ada7efc..85331e597d 100644 --- a/servers/slapd/back-monitor/thread.c +++ b/servers/slapd/back-monitor/thread.c @@ -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 */ /* diff --git a/servers/slapd/back-monitor/time.c b/servers/slapd/back-monitor/time.c index abc29e366a..47b3059901 100644 --- a/servers/slapd/back-monitor/time.c +++ b/servers/slapd/back-monitor/time.c @@ -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 */ /* diff --git a/servers/slapd/back-null/external.h b/servers/slapd/back-null/external.h index 8b54f39889..75e3518606 100644 --- a/servers/slapd/back-null/external.h +++ b/servers/slapd/back-null/external.h @@ -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 diff --git a/servers/slapd/back-null/null.c b/servers/slapd/back-null/null.c index 85c671d540..4ab571a6c3 100644 --- a/servers/slapd/back-null/null.c +++ b/servers/slapd/back-null/null.c @@ -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 */ diff --git a/servers/slapd/back-shell/Makefile.in b/servers/slapd/back-shell/Makefile.in index b739bf2e2a..23c2a66be3 100644 --- a/servers/slapd/back-shell/Makefile.in +++ b/servers/slapd/back-shell/Makefile.in @@ -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 \ diff --git a/servers/slapd/back-shell/abandon.c b/servers/slapd/back-shell/abandon.c index bbf84db331..801b16c6f1 100644 --- a/servers/slapd/back-shell/abandon.c +++ b/servers/slapd/back-shell/abandon.c @@ -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 */ diff --git a/servers/slapd/back-shell/add.c b/servers/slapd/back-shell/add.c index 02a5209380..818ef92672 100644 --- a/servers/slapd/back-shell/add.c +++ b/servers/slapd/back-shell/add.c @@ -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 */ diff --git a/servers/slapd/back-shell/bind.c b/servers/slapd/back-shell/bind.c index cd083b8ea7..cb21ff338b 100644 --- a/servers/slapd/back-shell/bind.c +++ b/servers/slapd/back-shell/bind.c @@ -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 */ diff --git a/servers/slapd/back-shell/compare.c b/servers/slapd/back-shell/compare.c index 8317214d0d..f6037de2e7 100644 --- a/servers/slapd/back-shell/compare.c +++ b/servers/slapd/back-shell/compare.c @@ -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 */ diff --git a/servers/slapd/back-shell/config.c b/servers/slapd/back-shell/config.c index adc21526f8..a9ec0a95ea 100644 --- a/servers/slapd/back-shell/config.c +++ b/servers/slapd/back-shell/config.c @@ -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 */ diff --git a/servers/slapd/back-shell/delete.c b/servers/slapd/back-shell/delete.c index da6c04a0c4..ba56a5779c 100644 --- a/servers/slapd/back-shell/delete.c +++ b/servers/slapd/back-shell/delete.c @@ -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 index 0000000000..1d58992ea3 --- /dev/null +++ b/servers/slapd/back-shell/external.h @@ -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 */ diff --git a/servers/slapd/back-shell/fork.c b/servers/slapd/back-shell/fork.c index b2b6fdf627..d47e1518a7 100644 --- a/servers/slapd/back-shell/fork.c +++ b/servers/slapd/back-shell/fork.c @@ -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 */ diff --git a/servers/slapd/back-shell/init.c b/servers/slapd/back-shell/init.c index d7add624f5..cfbd8811c5 100644 --- a/servers/slapd/back-shell/init.c +++ b/servers/slapd/back-shell/init.c @@ -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 */ diff --git a/servers/slapd/back-shell/modify.c b/servers/slapd/back-shell/modify.c index 9ea1511a69..8696a44dc8 100644 --- a/servers/slapd/back-shell/modify.c +++ b/servers/slapd/back-shell/modify.c @@ -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 */ diff --git a/servers/slapd/back-shell/modrdn.c b/servers/slapd/back-shell/modrdn.c index 6b54a499dd..993ba557ec 100644 --- a/servers/slapd/back-shell/modrdn.c +++ b/servers/slapd/back-shell/modrdn.c @@ -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 */ diff --git a/servers/slapd/back-shell/result.c b/servers/slapd/back-shell/result.c index ded78f03c4..4fc7d6dc2a 100644 --- a/servers/slapd/back-shell/result.c +++ b/servers/slapd/back-shell/result.c @@ -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 */ diff --git a/servers/slapd/back-shell/search.c b/servers/slapd/back-shell/search.c index cc9e4dcca6..a0661066fd 100644 --- a/servers/slapd/back-shell/search.c +++ b/servers/slapd/back-shell/search.c @@ -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 */ diff --git a/servers/slapd/back-shell/searchexample.conf b/servers/slapd/back-shell/searchexample.conf index 41fda5e5d0..7d6287fb59 100644 --- a/servers/slapd/back-shell/searchexample.conf +++ b/servers/slapd/back-shell/searchexample.conf @@ -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 diff --git a/servers/slapd/back-shell/searchexample.sh b/servers/slapd/back-shell/searchexample.sh index f93ac5e769..f975486f93 100644 --- a/servers/slapd/back-shell/searchexample.sh +++ b/servers/slapd/back-shell/searchexample.sh @@ -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 diff --git a/servers/slapd/back-shell/shell.h b/servers/slapd/back-shell/shell.h index 0bfe914926..af4609d3f0 100644 --- a/servers/slapd/back-shell/shell.h +++ b/servers/slapd/back-shell/shell.h @@ -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 */ diff --git a/servers/slapd/back-shell/unbind.c b/servers/slapd/back-shell/unbind.c index d5d936106e..8326a588d9 100644 --- a/servers/slapd/back-shell/unbind.c +++ b/servers/slapd/back-shell/unbind.c @@ -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 */ diff --git a/servers/slapd/cancel.c b/servers/slapd/cancel.c index f4298a5a5b..0855782401 100644 --- a/servers/slapd/cancel.c +++ b/servers/slapd/cancel.c @@ -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 */ diff --git a/servers/slapd/ch_malloc.c b/servers/slapd/ch_malloc.c index c9af173946..0b7d1c296a 100644 --- a/servers/slapd/ch_malloc.c +++ b/servers/slapd/ch_malloc.c @@ -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 */ diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 0084a7c80a..148d8155e9 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -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 index 0000000000..f753efd3c4 --- /dev/null +++ b/servers/slapd/kerberos.c @@ -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 + +#include +#include +#include + +#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 */ diff --git a/servers/slapd/lock.c b/servers/slapd/lock.c index 79017f23a0..afc6ba5dcb 100644 --- a/servers/slapd/lock.c +++ b/servers/slapd/lock.c @@ -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 */ diff --git a/servers/slapd/mra.c b/servers/slapd/mra.c index 5276c546e6..79c35c4674 100644 --- a/servers/slapd/mra.c +++ b/servers/slapd/mra.c @@ -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 */ diff --git a/servers/slapd/nt_svc.c b/servers/slapd/nt_svc.c index 115bada2fc..ebb3a391cf 100644 --- a/servers/slapd/nt_svc.c +++ b/servers/slapd/nt_svc.c @@ -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/servers/slapd/operational.c b/servers/slapd/operational.c index 3eca598b57..603d82456c 100644 --- a/servers/slapd/operational.c +++ b/servers/slapd/operational.c @@ -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 */ diff --git a/servers/slapd/passwd.c b/servers/slapd/passwd.c index 45fcaa2592..ccbc2cb4d3 100644 --- a/servers/slapd/passwd.c +++ b/servers/slapd/passwd.c @@ -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 */ diff --git a/servers/slapd/phonetic.c b/servers/slapd/phonetic.c index bfd2011be1..51f063649d 100644 --- a/servers/slapd/phonetic.c +++ b/servers/slapd/phonetic.c @@ -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 */ diff --git a/servers/slapd/referral.c b/servers/slapd/referral.c index 57a46713a5..dccd862b7a 100644 --- a/servers/slapd/referral.c +++ b/servers/slapd/referral.c @@ -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 */ diff --git a/servers/slapd/repl.c b/servers/slapd/repl.c index 6d0593dfcc..25fe030e79 100644 --- a/servers/slapd/repl.c +++ b/servers/slapd/repl.c @@ -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 */ diff --git a/servers/slapd/schema.c b/servers/slapd/schema.c index 4d401f8518..5f0a6a717f 100644 --- a/servers/slapd/schema.c +++ b/servers/slapd/schema.c @@ -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 */ diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index d0aca20d90..fbfd93a59b 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -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 */ diff --git a/servers/slapd/sets.c b/servers/slapd/sets.c index cd4a76c5fc..97b49b4630 100644 --- a/servers/slapd/sets.c +++ b/servers/slapd/sets.c @@ -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 index 0000000000..7dfe4aea96 --- /dev/null +++ b/servers/slapd/shell-backends/Makefile.in @@ -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 > $@ diff --git a/servers/slapd/starttls.c b/servers/slapd/starttls.c index 46dbf83b91..4ab33b1036 100644 --- a/servers/slapd/starttls.c +++ b/servers/slapd/starttls.c @@ -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 diff --git a/servers/slapd/str2filter.c b/servers/slapd/str2filter.c index b2a4e4f72f..04667cc345 100644 --- a/servers/slapd/str2filter.c +++ b/servers/slapd/str2filter.c @@ -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 */ diff --git a/servers/slapd/tools/slapadd.c b/servers/slapd/tools/slapadd.c index 6ae5bdfbfd..770f5346d0 100644 --- a/servers/slapd/tools/slapadd.c +++ b/servers/slapd/tools/slapadd.c @@ -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 index 0000000000..96fd0c9caf --- /dev/null +++ b/servers/slapd/tools/slapcat.c @@ -0,0 +1,79 @@ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ +#include "portable.h" + +#include + +#include +#include +#include +#include + +#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 index 0000000000..4817aa86a5 --- /dev/null +++ b/servers/slapd/tools/slapcommon.h @@ -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 index 0000000000..09cab4e267 --- /dev/null +++ b/servers/slapd/tools/slapindex.c @@ -0,0 +1,67 @@ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ +#include "portable.h" + +#include + +#include + +#include +#include +#include +#include + +#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 index 0000000000..d6b9bc1b13 --- /dev/null +++ b/servers/slapd/tools/slappasswd.c @@ -0,0 +1,121 @@ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "portable.h" + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#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; +} diff --git a/servers/slapd/unbind.c b/servers/slapd/unbind.c index c4c4f18542..44bc42a2e5 100644 --- a/servers/slapd/unbind.c +++ b/servers/slapd/unbind.c @@ -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 */ diff --git a/servers/slapd/user.c b/servers/slapd/user.c index 8df425bc38..3db5b7c6c1 100644 --- a/servers/slapd/user.c +++ b/servers/slapd/user.c @@ -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 diff --git a/servers/slapd/value.c b/servers/slapd/value.c index a1e081664d..e93c80c050 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -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 */ diff --git a/servers/slurpd/admin.c b/servers/slurpd/admin.c index 758c06abf5..1de4901e4a 100644 --- a/servers/slurpd/admin.c +++ b/servers/slurpd/admin.c @@ -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/servers/slurpd/args.c b/servers/slurpd/args.c index ee889af500..97dd2bd4df 100644 --- a/servers/slurpd/args.c +++ b/servers/slurpd/args.c @@ -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/servers/slurpd/ch_malloc.c b/servers/slurpd/ch_malloc.c index 298391e4f3..9c95a72cb7 100644 --- a/servers/slurpd/ch_malloc.c +++ b/servers/slurpd/ch_malloc.c @@ -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. @@ -10,31 +15,39 @@ * 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 -#include -#include + +#include +#include + #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 diff --git a/servers/slurpd/config.c b/servers/slurpd/config.c index cff7704899..4c6af08b51 100644 --- a/servers/slurpd/config.c +++ b/servers/slurpd/config.c @@ -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/servers/slurpd/fm.c b/servers/slurpd/fm.c index 6b8cec3c10..50740f25b5 100644 --- a/servers/slurpd/fm.c +++ b/servers/slurpd/fm.c @@ -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/servers/slurpd/globals.c b/servers/slurpd/globals.c index d55784a8f3..5ff11118a0 100644 --- a/servers/slurpd/globals.c +++ b/servers/slurpd/globals.c @@ -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/servers/slurpd/globals.h b/servers/slurpd/globals.h index 073e34a8ea..7aba1c6727 100644 --- a/servers/slurpd/globals.h +++ b/servers/slurpd/globals.h @@ -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/servers/slurpd/ldap_op.c b/servers/slurpd/ldap_op.c index 38882a1b42..c2efec4bae 100644 --- a/servers/slurpd/ldap_op.c +++ b/servers/slurpd/ldap_op.c @@ -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/servers/slurpd/lock.c b/servers/slurpd/lock.c index 5b707942e6..8a8fa65f98 100644 --- a/servers/slurpd/lock.c +++ b/servers/slurpd/lock.c @@ -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/servers/slurpd/main.c b/servers/slurpd/main.c index c67cd382c8..3220853fb7 100644 --- a/servers/slurpd/main.c +++ b/servers/slurpd/main.c @@ -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/servers/slurpd/proto-slurp.h b/servers/slurpd/proto-slurp.h index b168645b21..bdcce9ad68 100644 --- a/servers/slurpd/proto-slurp.h +++ b/servers/slurpd/proto-slurp.h @@ -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 diff --git a/servers/slurpd/re.c b/servers/slurpd/re.c index dc0f48fec6..325d462736 100644 --- a/servers/slurpd/re.c +++ b/servers/slurpd/re.c @@ -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/servers/slurpd/reject.c b/servers/slurpd/reject.c index ba551c161f..0b4d5ee12e 100644 --- a/servers/slurpd/reject.c +++ b/servers/slurpd/reject.c @@ -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/servers/slurpd/replica.c b/servers/slurpd/replica.c index 49fc9e178e..d24ba413a7 100644 --- a/servers/slurpd/replica.c +++ b/servers/slurpd/replica.c @@ -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/servers/slurpd/replog.c b/servers/slurpd/replog.c index 471275a6df..c22bfedee9 100644 --- a/servers/slurpd/replog.c +++ b/servers/slurpd/replog.c @@ -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/servers/slurpd/ri.c b/servers/slurpd/ri.c index c9f0a4ffa1..7225783c39 100644 --- a/servers/slurpd/ri.c +++ b/servers/slurpd/ri.c @@ -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/servers/slurpd/rq.c b/servers/slurpd/rq.c index 87f2daeb59..f19277017e 100644 --- a/servers/slurpd/rq.c +++ b/servers/slurpd/rq.c @@ -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/servers/slurpd/sanity.c b/servers/slurpd/sanity.c index 8510325733..0927e597f2 100644 --- a/servers/slurpd/sanity.c +++ b/servers/slurpd/sanity.c @@ -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/servers/slurpd/slurp.h b/servers/slurpd/slurp.h index b01e141672..43f310dc62 100644 --- a/servers/slurpd/slurp.h +++ b/servers/slurpd/slurp.h @@ -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/servers/slurpd/st.c b/servers/slurpd/st.c index f6cc685fff..e2a00299b6 100644 --- a/servers/slurpd/st.c +++ b/servers/slurpd/st.c @@ -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/tests/Makefile.in b/tests/Makefile.in index bbbbc87fef..f702bb00fa 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 diff --git a/tests/progs/slapd-addel.c b/tests/progs/slapd-addel.c index 3721a66eef..618057d629 100644 --- a/tests/progs/slapd-addel.c +++ b/tests/progs/slapd-addel.c @@ -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/tests/progs/slapd-read.c b/tests/progs/slapd-read.c index 0f43c6ae39..7acb5fb8f4 100644 --- a/tests/progs/slapd-read.c +++ b/tests/progs/slapd-read.c @@ -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/tests/progs/slapd-search.c b/tests/progs/slapd-search.c index b96f899646..5830a01cae 100644 --- a/tests/progs/slapd-search.c +++ b/tests/progs/slapd-search.c @@ -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/tests/progs/slapd-tester.c b/tests/progs/slapd-tester.c index 5f3d6e19d6..a2a96f415a 100644 --- a/tests/progs/slapd-tester.c +++ b/tests/progs/slapd-tester.c @@ -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"