diff -Nru openldap-2.5.12+dfsg/build/version.var openldap-2.5.13+dfsg/build/version.var --- openldap-2.5.12+dfsg/build/version.var 2022-05-04 14:57:30.000000000 +0000 +++ openldap-2.5.13+dfsg/build/version.var 2022-07-14 17:09:57.000000000 +0000 @@ -15,9 +15,9 @@ ol_package=OpenLDAP ol_major=2 ol_minor=5 -ol_patch=12 -ol_api_inc=20512 +ol_patch=13 +ol_api_inc=20513 ol_api_current=1 -ol_api_revision=7 +ol_api_revision=8 ol_api_age=1 -ol_release_date="2022/05/04" +ol_release_date="2022/07/14" diff -Nru openldap-2.5.12+dfsg/CHANGES openldap-2.5.13+dfsg/CHANGES --- openldap-2.5.12+dfsg/CHANGES 2022-05-04 14:57:30.000000000 +0000 +++ openldap-2.5.13+dfsg/CHANGES 2022-07-14 17:09:57.000000000 +0000 @@ -1,5 +1,30 @@ OpenLDAP 2.5 Change Log +OpenLDAP 2.5.13 Release (2022/07/14) + Fixed librewrite declaration of calloc (ITS#9841) + Fixed libldap memory leaks (ITS#9876) + Fixed slapd kqueue support (ITS#9847) + Fixed slapd delta-sync DN leak on ADD ops (ITS#9866) + Fixed slapd replication with back-glue (ITS#9868) + Fixed slapd-mdb to check for stale readers on MDB_READERS_FULL (ITS#7165) + Fixed slapo-accesslog onetime memory leak (ITS#9864) + Fixed slapo-ppolicy interaction with slapo-rwm (ITS#9871) + Fixed slapo-syncprov memory leaks (ITS#9867) + Fixed slapo-syncprov fallback in delta-sync mode (ITS#9823) + Fixed slapo-unique to not release NULL entry (ITS#8245) + Build Environment + Added slapd-watcher -c contextDN option (ITS#9865) + Fixed parallel builds (ITS#9840) + Fixed test020 to skip back-wt (ITS#9859) + Fixed slapd-watcher SID handling with single URI (ITS#9850) + Fixed test043 with workaround for ITS#9878 + Contrib + Added slapo-emptyds contrib module (ITS#8882) + Fixed slapo-autogroup backwards compat (ITS#9020) + Documentation + Fixed ldap_get_option(3) to clarify ldap_get/set_option restrictions (ITS#9824) + Fixed slapd-ldap(5),slapd-meta(5) missing bold tag on authz parameter (ITS#9872) + OpenLDAP 2.5.12 Release (2022/05/04) Fixed libldap to drop connection when non-LDAP data is received (ITS#9803) Fixed libldap to allow newlines at end of included file (ITS#9811) diff -Nru openldap-2.5.12+dfsg/clients/tools/ldapsearch.c openldap-2.5.13+dfsg/clients/tools/ldapsearch.c --- openldap-2.5.12+dfsg/clients/tools/ldapsearch.c 2022-05-04 14:57:30.000000000 +0000 +++ openldap-2.5.13+dfsg/clients/tools/ldapsearch.c 2022-07-14 17:09:57.000000000 +0000 @@ -1866,12 +1866,13 @@ if ( ldapsync && sync_slimit != -1 && nresponses_psearch >= sync_slimit ) { BerElement *msgidber = NULL; - struct berval *msgidvalp = NULL; + struct berval msgidval; msgidber = ber_alloc_t(LBER_USE_DER); ber_printf(msgidber, "{i}", msgid); - ber_flatten(msgidber, &msgidvalp); + ber_flatten2( msgidber, &msgidval, 0 ); ldap_extended_operation(ld, LDAP_EXOP_CANCEL, - msgidvalp, NULL, NULL, &cancel_msgid); + &msgidval, NULL, NULL, &cancel_msgid); + ber_free( msgidber, 1 ); nresponses_psearch = -1; } } diff -Nru openldap-2.5.12+dfsg/configure openldap-2.5.13+dfsg/configure --- openldap-2.5.12+dfsg/configure 2022-05-04 14:57:30.000000000 +0000 +++ openldap-2.5.13+dfsg/configure 2022-07-14 17:09:57.000000000 +0000 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Id: 1c372d9fe8d80795909df859a01abd486462d0a2 . +# From configure.ac Id: 15bca89511fc428731cf9ab71a9b46e37511be67 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -16316,6 +16316,13 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +$ac_includes_default +#ifdef HAVE_SYS_EVENT_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif int main(int argc, char **argv) { int kqfd = kqueue(); diff -Nru openldap-2.5.12+dfsg/configure.ac openldap-2.5.13+dfsg/configure.ac --- openldap-2.5.12+dfsg/configure.ac 2022-05-04 14:57:30.000000000 +0000 +++ openldap-2.5.13+dfsg/configure.ac 2022-07-14 17:09:57.000000000 +0000 @@ -25,7 +25,7 @@ dnl Configure.in for OpenLDAP AC_COPYRIGHT([[Copyright 1998-2022 The OpenLDAP Foundation. All rights reserved. Restrictions apply, see COPYRIGHT and LICENSE files.]]) -AC_REVISION([$Id: 63b192fdc3ddaf2eabc322c60cd7066c9252e1d8 $]) +AC_REVISION([$Id: 15bca89511fc428731cf9ab71a9b46e37511be67 $]) AC_INIT([OpenLDAP],,[https://bugs.openldap.org],,[https://www.openldap.org]) AC_CONFIG_SRCDIR(build/version.sh)dnl dnl ---------------------------------------------------------------- @@ -1022,7 +1022,14 @@ AC_CHECK_HEADERS( sys/event.h ) if test "${ac_cv_header_sys_event_h}" = yes; then AC_MSG_CHECKING(for kqueue system call) -AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(int argc, char **argv) +AC_RUN_IFELSE([AC_LANG_SOURCE([[$ac_includes_default +#ifdef HAVE_SYS_EVENT_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +int main(int argc, char **argv) { int kqfd = kqueue(); exit (kqfd == -1 ? 1 : 0); diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/autogroup/autogroup.c openldap-2.5.13+dfsg/contrib/slapd-modules/autogroup/autogroup.c --- openldap-2.5.12+dfsg/contrib/slapd-modules/autogroup/autogroup.c 2022-05-04 14:57:30.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/autogroup/autogroup.c 2022-07-14 17:09:57.000000000 +0000 @@ -1733,7 +1733,7 @@ static ConfigOCs agocs[] = { { "( OLcfgCtOc:2.1 " - "NAME 'olcAutoGroupConfig' " + "NAME ( 'olcAutoGroupConfig' 'olcAutomaticGroups' ) " "DESC 'Automatic groups configuration' " "SUP olcOverlayConfig " "MAY ( " diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/autogroup/slapo-autogroup.5 openldap-2.5.13+dfsg/contrib/slapd-modules/autogroup/slapo-autogroup.5 --- openldap-2.5.12+dfsg/contrib/slapd-modules/autogroup/slapo-autogroup.5 2022-05-04 14:57:30.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/autogroup/slapo-autogroup.5 2022-07-14 17:09:57.000000000 +0000 @@ -93,10 +93,15 @@ a consistent namespace as with other overlays. As a side-effect the following cn=config parameters are deprecated and will be removed in a future release: +.IP \[bu] 2 .B olcAGattrSet is replaced with olcAutoGroupAttrSet +.IP \[bu] .B olcAGmemberOfAd is replaced with olcAutoGroupMemberOfAd +.IP \[bu] +.B olcAutomaticGroups +is replaced with olcAutoGroupConfig .SH ACKNOWLEDGEMENTS This module was originally written in 2007 by Michał Szulczyński. Further enhancements were contributed by Howard diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/emptyds.c openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/emptyds.c --- openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/emptyds.c 1970-01-01 00:00:00.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/emptyds.c 2022-07-14 17:09:57.000000000 +0000 @@ -0,0 +1,325 @@ +/* emptyds.c */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software . + * + * Copyright 2014-2022 The OpenLDAP Foundation. + * Portions Copyright (C) 2014 DAASI International GmbH, Tamim Ziai. + * Portions Copyright (C) 2022 Ondřej Kuzník, Symas Corporation. + * 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 in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * http://www.OpenLDAP.org/license.html. + */ +/* ACKNOLEDGEDMENTS: + * This work was initially developed by Tamim Ziai of DAASI International GmbH + * for inclusion in OpenLDAP Software. + */ +/* slapo-emptyds + * + * This is an OpenLDAP overlay that accepts empty strings as attribute values + * without syntax violation but never actually stores them. This allows + * applications that used to work with LDAP implementations allowing empty + * strings (such as Novel eDirectory) to continue to work with OpenLDAP without + * any modifications. Add and modify change types will be proceeded as follows, + * other operations will be forwarded without modifications: + * + * changeType: add changeType: add + * sn: --> sn: blah + * sn: blah + * + * changeType: modify changeType: modify + * add: sn --> add: sn + * sn: sn: blah + * sn: blah + * + * changeType: modify changeType: modify + * delete: sn --> delete: sn + * sn: sn: blah + * sn: blah + * + * changeType: modify changeType: modify + * replace: sn --> replace: sn + * sn: + * + */ + +#include "portable.h" +#include "slap.h" + +static slap_overinst emptyds; + +static const char ds_oid[] = "1.3.6.1.4.1.1466.115.121.1.15"; + +static slap_syntax_validate_func *ssyn_validate_original = NULL; +static slap_syntax_transform_func *ssyn_pretty_original = NULL; +static int emptyds_instances = 0; + +static unsigned int +remove_empty_values( Modification *m, Attribute *a ) +{ + BerVarray vals = m ? m->sm_values : a->a_vals, + nvals = m ? m->sm_nvalues : a->a_nvals; + unsigned int i, j, numvals = m ? m->sm_numvals : a->a_numvals; + + for ( i = 0; i < numvals && !BER_BVISEMPTY( &vals[i] ); i++ ) + /* Find first empty */; + + if ( i == numvals ) return i; + + /* + * We have an empty value at index i, move all of them to the end of the + * list, preserving the order of non-empty values. + */ + j = i + 1; + for ( j = i + 1; j < numvals; j++ ) { + struct berval tmp; + + if ( BER_BVISEMPTY( &vals[j] ) ) continue; + + tmp = vals[i]; + vals[i] = vals[j]; + vals[j] = tmp; + + if ( nvals && vals != nvals ) { + tmp = nvals[i]; + nvals[i] = nvals[j]; + nvals[j] = tmp; + } + + if ( m && a && m->sm_values != a->a_vals ) { + tmp = a->a_vals[i]; + a->a_vals[i] = a->a_vals[j]; + a->a_vals[j] = tmp; + + if ( a->a_nvals && a->a_vals != a->a_nvals ) { + tmp = a->a_nvals[i]; + a->a_nvals[i] = a->a_nvals[j]; + a->a_nvals[j] = tmp; + } + } + i++; + } + + /* Free empty vals */ + for ( ; j && i < j--; ) { + ber_memfree( vals[j].bv_val ); + if ( nvals && vals != nvals ) { + ber_memfree( nvals[j].bv_val ); + BER_BVZERO( &nvals[j] ); + } + + if ( m && a && m->sm_values != a->a_vals ) { + if ( m->sm_values[j].bv_val != a->a_vals[j].bv_val ) { + ber_memfree( a->a_vals[j].bv_val ); + BER_BVZERO( &a->a_vals[j] ); + + if ( a->a_nvals && a->a_vals != a->a_nvals ) { + ber_memfree( a->a_nvals[j].bv_val ); + BER_BVZERO( &a->a_nvals[j] ); + } + } + } + BER_BVZERO( &vals[j] ); + } + + return i; +} + +/** + * Remove all operations with empty strings. + */ +static int +emptyds_op_add( Operation *op, SlapReply *rs ) +{ + Attribute **ap, **nexta, *a; + Modifications **mlp, **nextp = NULL, *ml; + Entry *e = op->ora_e; + + /* + * op->ora_modlist can be NULL, at least accesslog doesn't always populate + * it on an add. + */ + for ( ap = &e->e_attrs, a = e->e_attrs, mlp = &op->ora_modlist, + ml = op->ora_modlist; + a != NULL; + ap = nexta, a = *ap, mlp = nextp, ml = ml ? *mlp : NULL ) { + AttributeType *at = a->a_desc->ad_type; + unsigned int remaining; + + nexta = &a->a_next; + if ( ml ) { + nextp = &ml->sml_next; + } + + if ( at->sat_syntax != slap_schema.si_syn_directoryString || + at->sat_atype.at_usage != LDAP_SCHEMA_USER_APPLICATIONS ) + continue; + + remaining = remove_empty_values( &ml->sml_mod, a ); + if ( remaining == a->a_numvals ) continue; + /* Empty values found */ + + if ( !remaining ) { + /* All values are empty */ + *ap = a->a_next; + a->a_next = NULL; + nexta = ap; + + if ( ml ) { + *mlp = ml->sml_next; + ml->sml_next = NULL; + nextp = mlp; + /* Values are generally shared with attribute */ + slap_mods_free( ml, ml->sml_values != a->a_vals ); + } + attr_free( a ); + } else { + a->a_numvals = remaining; + if ( ml ) { + ml->sml_mod.sm_numvals = remaining; + } + } + } + + return SLAP_CB_CONTINUE; +} + +static int +emptyds_op_modify( Operation *op, SlapReply *rs ) +{ + Modifications **mlp, **nextp, *ml; + + for ( mlp = &op->orm_modlist, ml = op->orm_modlist; ml != NULL; + mlp = nextp, ml = *mlp ) { + AttributeType *at = ml->sml_desc->ad_type; + unsigned int remaining; + + nextp = &ml->sml_next; + + if ( at->sat_syntax != slap_schema.si_syn_directoryString || + at->sat_atype.at_usage != LDAP_SCHEMA_USER_APPLICATIONS ) + continue; + + remaining = remove_empty_values( &ml->sml_mod, NULL ); + if ( remaining == ml->sml_numvals ) continue; + + if ( !remaining ) { + /* All values are empty */ + if ( ml->sml_op == LDAP_MOD_REPLACE ) { + /* Replace is kept */ + if ( ml->sml_nvalues && ml->sml_nvalues != ml->sml_values ) { + ber_bvarray_free( ml->sml_nvalues ); + } + if ( ml->sml_values ) { + ber_bvarray_free( ml->sml_values ); + } + + ml->sml_numvals = 0; + ml->sml_values = NULL; + ml->sml_nvalues = NULL; + } else { + /* Remove modification */ + *mlp = ml->sml_next; + ml->sml_next = NULL; + nextp = mlp; + slap_mods_free( ml, 1 ); + } + } else { + ml->sml_numvals = remaining; + } + } + + return SLAP_CB_CONTINUE; +} + +static int +emptyds_ssyn_validate( Syntax *syntax, struct berval *in ) +{ + if ( BER_BVISEMPTY( in ) && syntax == slap_schema.si_syn_directoryString ) { + return LDAP_SUCCESS; + } + return ssyn_validate_original( syntax, in ); +} + +static int +emptyds_ssyn_pretty( Syntax *syntax, + struct berval *in, + struct berval *out, + void *memctx ) +{ + if ( BER_BVISEMPTY( in ) && syntax == slap_schema.si_syn_directoryString ) { + return LDAP_SUCCESS; + } + return ssyn_pretty_original( syntax, in, out, memctx ); +} + +static int +emptyds_db_init( BackendDB *be, ConfigReply *cr ) +{ + Syntax *syntax = syn_find( ds_oid ); + + if ( syntax == NULL ) { + Debug( LDAP_DEBUG_TRACE, "emptyds_db_init: " + "Syntax %s not found\n", + ds_oid ); + } else { + Debug( LDAP_DEBUG_TRACE, "emptyds_db_init: " + "Found syntax: %s\n", + syntax->ssyn_bvoid.bv_val ); + if ( ssyn_validate_original == NULL && syntax->ssyn_validate != NULL ) { + ssyn_validate_original = syntax->ssyn_validate; + syntax->ssyn_validate = emptyds_ssyn_validate; + } + if ( ssyn_pretty_original == NULL && syntax->ssyn_pretty != NULL ) { + ssyn_pretty_original = syntax->ssyn_pretty; + syntax->ssyn_pretty = &emptyds_ssyn_pretty; + } + } + + emptyds_instances++; + return LDAP_SUCCESS; +} + +static int +emptyds_db_destroy( BackendDB *be, ConfigReply *cr ) +{ + Syntax *syntax = syn_find( ds_oid ); + + if ( --emptyds_instances == 0 && syntax != NULL ) { + if ( syntax->ssyn_validate == emptyds_ssyn_validate ) { + syntax->ssyn_validate = ssyn_validate_original; + } + ssyn_validate_original = NULL; + + if ( syntax->ssyn_pretty == emptyds_ssyn_pretty ) { + syntax->ssyn_pretty = ssyn_pretty_original; + } + ssyn_pretty_original = NULL; + } + + assert( emptyds_instances >= 0 ); + return LDAP_SUCCESS; +} + +int +emptyds_init() +{ + emptyds.on_bi.bi_type = "emptyds"; + emptyds.on_bi.bi_op_add = emptyds_op_add; + emptyds.on_bi.bi_op_modify = emptyds_op_modify; + emptyds.on_bi.bi_db_init = emptyds_db_init; + emptyds.on_bi.bi_db_destroy = emptyds_db_destroy; + + return overlay_register( &emptyds ); +} + +int +init_module( int argc, char *argv[] ) +{ + return emptyds_init(); +} diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/Makefile openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/Makefile --- openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/Makefile 2022-07-14 17:09:57.000000000 +0000 @@ -0,0 +1,78 @@ +# $OpenLDAP$ +# This work is part of OpenLDAP Software . +# +# Copyright 1998-2022 The OpenLDAP Foundation. +# +# 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 in the file LICENSE in the +# top-level directory of the distribution or, alternatively, at +# . + +LDAP_SRC = ../../.. +LDAP_BUILD = $(LDAP_SRC) +SRCDIR = ./ +LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd +LDAP_LIB = $(LDAP_BUILD)/libraries/libldap/libldap.la \ + $(LDAP_BUILD)/libraries/liblber/liblber.la + +LIBTOOL = $(LDAP_BUILD)/libtool +INSTALL = /usr/bin/install +CC = gcc +OPT = -g -O2 +DEFS = -DSLAPD_OVER_EDS=SLAPD_MOD_DYNAMIC +INCS = $(LDAP_INC) +LIBS = $(LDAP_LIB) + +PROGRAMS = emptyds.la +MANPAGES = slapo-emptyds.5 +CLEAN = *.o *.lo *.la .libs +LTVER = 0:0:0 + +prefix=/usr/local +exec_prefix=$(prefix) +ldap_subdir=/openldap + +libdir=$(exec_prefix)/lib +libexecdir=$(exec_prefix)/libexec +moduledir = $(libexecdir)$(ldap_subdir) +mandir = $(exec_prefix)/share/man +man5dir = $(mandir)/man5 + +all: $(PROGRAMS) + +d := +sp := +dir := tests +include $(dir)/Rules.mk + +.SUFFIXES: .c .o .lo + +.c.lo: + $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $< + +all: $(PROGRAMS) + +emptyds.la: emptyds.lo + $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -version-info $(LTVER) \ + -rpath $(moduledir) -module -o $@ $? $(LIBS) + +clean: + rm -rf $(CLEAN) + +install: install-lib install-man FORCE + +install-lib: $(PROGRAMS) + mkdir -p $(DESTDIR)$(moduledir) + for p in $(PROGRAMS) ; do \ + $(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \ + done + +install-man: $(MANPAGES) + mkdir -p $(DESTDIR)$(man5dir) + $(INSTALL) -m 644 $(MANPAGES) $(DESTDIR)$(man5dir) + +FORCE: + diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/README openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/README --- openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/README 1970-01-01 00:00:00.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/README 2022-07-14 17:09:57.000000000 +0000 @@ -0,0 +1,66 @@ +emptyds Overlay README + +DESCRIPTION + This package contains an OpenLDAP overlay called "emptyds" (empty + directory string) that eliminates empty values of type directory string + (OID 1.3.6.1.4.1.1466.115.121.1.15) from the list of the values in the + following manner: + + - add: All empty attribute values will be removed before the add request + is executed + - mod-replace: A replace with empty values will be modified to a replace + without values. As result the attribute will be deleted + - mod-add: All empty attribute values will be removed before the mod-add + request is executed + - mod-delete: All empty attribute values will be removed before the + mod-delete request is executed + + If removing all empty values from a modification makes it a no-op, that + modification is removed from the list. + + At module load time the emptyds overlay manipulates the syntax checking + so that it intercepts the syntax check and allows empty values for + attributes of type directory string only. Non-empty values continue to + go through the normal check routines. It is therefore very important to + configure the overlays in a way that ensures that the emptyds overlay gets + the control over the operation before any other overlay. Otherwise it + could come to the situation with empty attribute values in the data base. + + David Hawes' addpartial overlay has been used as starting point for this + overlay. + +BUILDING + A Makefile is included, please set your LDAP_SRC directory properly. + +INSTALLATION + After compiling the emptyds overlay, add the following to your + slapd.conf: + + ### slapd.conf + ... + moduleload emptyds.la + ... + overlay emptyds + ... + # before database directive... + # this overlay must be the last overlay in the config file to ensure that + # requests are modified before other overlays get them. + ... + ### end slapd.conf + +CAVEATS + - In order to ensure that emptyds does what it needs to do, it must be + the last overlay configured so it will run before the other overlays. + +--- +Copyright 2014-2022 The OpenLDAP Foundation. +Portions Copyright (C) DAASI International GmbH, Tamim Ziai. +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 in file LICENSE in the +top-level directory of the distribution or, alternatively, at +http://www.OpenLDAP.org/license.html. diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/slapo-emptyds.5 openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/slapo-emptyds.5 --- openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/slapo-emptyds.5 1970-01-01 00:00:00.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/slapo-emptyds.5 2022-07-14 17:09:57.000000000 +0000 @@ -0,0 +1,68 @@ +.TH SLAPO-EDS 5 "RELEASEDATE" "OpenLDAP LDVERSION" +.\" Copyright 2022 The OpenLDAP Foundation, All Rights Reserved. +.\" Copyright 2018 Tamim Ziai +.\" Copying restrictions apply. See COPYRIGHT/LICENSE. +.\" $OpenLDAP$ +.SH NAME +slapo-emptyds \- Remove Empty values from Directory String attributes +Overlay to slapd +.SH SYNOPSIS +ETCDIR/slapd.conf +.SH DESCRIPTION +Some non-conformant clients will provide empty values for Directory String +attributes with certain operations. This overlay makes empty values acceptable +for the Directory String syntax and will adjust all operations to make sure +these values are never actually stored in the database. +.LP +.nf +.ft tt + dn: cn=alex,cn=people,dc=example,dc=org + changeType: add changeType: add + sn: --> sn: blah + sn: blah + + dn: cn=alex,cn=people,dc=example,dc=org + changeType: modify changeType: modify + add: sn --> add: sn + sn: sn: blah + sn: blah + + dn: cn=alex,cn=people,dc=example,dc=org + changeType: modify changeType: modify + delete: sn --> delete: sn + sn: sn: blah + sn: blah + + dn: cn=alex,cn=people,dc=example,dc=org + changeType: modify changeType: modify + replace: sn --> replace: sn + sn: + + dn: cn=alex,cn=people,dc=example,dc=org + changeType: modify changeType: modify + replace: sn --> replace: sn + sn: sn: blah + sn: blah +.ft +.fi +.LP +.SH CONFIGURATION +This overlay has no specific configuration, however in order to ensure that it +does what it needs to do, it should be the last overlay configured so it will +run before the other overlays. +.SH EXAMPLES +.LP +.RS +.nf +overlay emptyds +.RE +.SH FILES +.TP +ETCDIR/slapd.conf +default slapd configuration file +.SH SEE ALSO +.BR slapd.conf (5). +.SH ACKNOWLEDGEMENTS +This module was written in 2014 by Tamim Ziai for DAASI International and +updated in 2022 by Ondřej Kuzník for inclusion in the OpenLDAP project. +.so ../Project diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/data/emptyds.conf openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/data/emptyds.conf --- openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/data/emptyds.conf 1970-01-01 00:00:00.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/data/emptyds.conf 2022-07-14 17:09:57.000000000 +0000 @@ -0,0 +1,54 @@ +# basic slapd config -- for testing of slapo-emptyds +# $OpenLDAP$ +## This work is part of OpenLDAP Software . +## +## Copyright 1998-2022 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 in the file LICENSE in the +## top-level directory of the distribution or, alternatively, at +## . + +include @SCHEMADIR@/core.schema +include @SCHEMADIR@/cosine.schema +include @SCHEMADIR@/inetorgperson.schema +include @SCHEMADIR@/openldap.schema +include @SCHEMADIR@/nis.schema +include @DATADIR@/test.schema +# +pidfile @TESTDIR@/slapd.1.pid +argsfile @TESTDIR@/slapd.1.args + +#mod#modulepath ../servers/slapd/back-@BACKEND@/ +#mod#moduleload back_@BACKEND@.la +#accesslogmod#modulepath ../servers/slapd/overlays/ +#accesslogmod#moduleload accesslog.la +moduleload ../emptyds.la + +database @BACKEND@ +suffix "dc=example,dc=com" +rootdn "cn=Manager,dc=example,dc=com" +rootpw secret +#~null~#directory @TESTDIR@/db.1.a + +overlay accesslog +logdb cn=log +logops writes +logsuccess true + +overlay emptyds + +database @BACKEND@ +suffix "cn=log" +rootdn "cn=Manager,dc=example,dc=com" +#~null~#directory @TESTDIR@/db.1.b + +## This one makes no difference except we want to make sure we can +## safely instantiate the overlay on multiple databases +overlay emptyds + +database monitor diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/data/test001.ldif openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/data/test001.ldif --- openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/data/test001.ldif 1970-01-01 00:00:00.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/data/test001.ldif 2022-07-14 17:09:57.000000000 +0000 @@ -0,0 +1,71 @@ +# slapd prevents us from adding the same value multiple times +dn: cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com +changetype: modify +add: description +description: one +description: +description: two +description: three +description: four +# a space is distinct from an empty value +description:: ICAg +- +replace: drink +drink: Earl Grey, hot +- +delete: description +description: +- +replace: drink +drink: Earl Grey, hot + +# there is no such restriction on deletes, so we exercise this part of the overlay here +dn: cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com +changetype: modify +delete: description +description: +description: four +description: +description: three +description: two +description: +description: +description: one +description: +- +add: description +description: + +dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com +changetype: modify +replace: drink +drink: + +dn: cn=All Staff,ou=Groups,dc=example,dc=com +changetype: modify +delete: member +- +add: member +# an empty DN should not be stripped +member: +member: cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example,dc=com + +dn: cn=Gern Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com +changetype: add +objectclass: testPerson +cn: Gern Jensen +sn: Jensen +uid: gjensen +title: +postaladdress: ITD $ 535 W. William St $ Anytown, MI 48103 +seealso: cn=All Staff,ou=Groups,dc=example,dc=com +drink: Coffee +homepostaladdress: 844 Brown St. Apt. 4 $ Anytown, MI 48104 +description: Very odd +description: +description: More than you think +facsimiletelephonenumber: +1 313 555 7557 +telephonenumber: +1 313 555 8343 +mail: gjensen@mailgw.example.com +homephone: +1 313 555 8844 +testTime: 20050304001801.234Z diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/data/test001.out openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/data/test001.out --- openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/data/test001.out 1970-01-01 00:00:00.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/data/test001.out 2022-07-14 17:09:57.000000000 +0000 @@ -0,0 +1,54 @@ +dn: reqStart=timestamp,cn=log +reqDN: cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com +reqMod: description:+ one +reqMod: description:+ two +reqMod: description:+ three +reqMod: description:+ four +# "description:+ " that's a space, then 3 spaces for value +reqMod:: ZGVzY3JpcHRpb246KyAgICA= +reqMod: drink:= Earl Grey, hot +# second mod was removed, so we have two replaces in succession now and need +# to separate them (":") +reqMod:: Og== +reqMod: drink:= Earl Grey, hot + +dn: reqStart=timestamp,cn=log +reqDN: cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com +reqMod: description:- four +reqMod: description:- three +reqMod: description:- two +reqMod: description:- one +# second mod is removed + +dn: reqStart=timestamp,cn=log +reqDN: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com +reqMod: drink:= + +dn: reqStart=timestamp,cn=log +reqDN: cn=All Staff,ou=Groups,dc=example,dc=com +reqMod: member:- +# "member:+ " adding an empty DN +reqMod:: bWVtYmVyOisg +reqMod: member:+ cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example + ,dc=com + +dn: reqStart=timestamp,cn=log +reqDN: cn=Gern Jensen,ou=Information Technology Division,ou=People,dc=example, + dc=com +reqMod: objectClass:+ testPerson +reqMod: cn:+ Gern Jensen +reqMod: sn:+ Jensen +reqMod: uid:+ gjensen +reqMod: postalAddress:+ ITD $ 535 W. William St $ Anytown, MI 48103 +reqMod: seeAlso:+ cn=All Staff,ou=Groups,dc=example,dc=com +reqMod: drink:+ Coffee +reqMod: homePostalAddress:+ 844 Brown St. Apt. 4 $ Anytown, MI 48104 +reqMod: description:+ Very odd +reqMod: description:+ More than you think +reqMod: facsimileTelephoneNumber:+ +1 313 555 7557 +reqMod: telephoneNumber:+ +1 313 555 8343 +reqMod: mail:+ gjensen@mailgw.example.com +reqMod: homePhone:+ +1 313 555 8844 +reqMod: testTime:+ 20050304001801.234Z +reqMod: structuralObjectClass:+ testPerson + diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/Rules.mk openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/Rules.mk --- openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/Rules.mk 1970-01-01 00:00:00.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/Rules.mk 2022-07-14 17:09:57.000000000 +0000 @@ -0,0 +1,23 @@ +sp := $(sp).x +dirstack_$(sp) := $(d) +d := $(dir) + +.PHONY: test + +CLEAN += clients servers tests/progs tests/schema tests/testdata tests/testrun + +test: all clients servers tests/progs + +test: + cd tests; \ + SRCDIR=$(abspath $(LDAP_SRC)) \ + LDAP_BUILD=$(abspath $(LDAP_BUILD)) \ + TOPDIR=$(abspath $(SRCDIR)) \ + LIBTOOL=$(abspath $(LIBTOOL)) \ + $(abspath $(SRCDIR))/tests/run all + +servers clients tests/progs: + ln -s $(abspath $(LDAP_BUILD))/$@ $@ + +d := $(dirstack_$(sp)) +sp := $(basename $(sp)) diff -Nru openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/run openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/run --- openldap-2.5.12+dfsg/contrib/slapd-modules/emptyds/tests/run 1970-01-01 00:00:00.000000000 +0000 +++ openldap-2.5.13+dfsg/contrib/slapd-modules/emptyds/tests/run 2022-07-14 17:09:57.000000000 +0000 @@ -0,0 +1,218 @@ +#!/bin/sh +## $OpenLDAP$ +## This work is part of OpenLDAP Software . +## +## Copyright 1998-2022 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 in the file LICENSE in the +## top-level directory of the distribution or, alternatively, at +## . +## +## ACKNOWLEDGEMENTS: +## This module was written in 2016 by Ondřej Kuzník for Symas Corp. + +USAGE="$0 [-b ] [-c] [-k] [-l #] [-p] [-s {ro|rp}] [-u] [-w]