1#! /bin/sh 2## $OpenLDAP$ 3## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4## 5## Copyright 2016-2021 The OpenLDAP Foundation. 6## All rights reserved. 7## 8## Redistribution and use in source and binary forms, with or without 9## modification, are permitted only as authorized by the OpenLDAP 10## Public License. 11## 12## A copy of this license is available in the file LICENSE in the 13## top-level directory of the distribution or, alternatively, at 14## <http://www.OpenLDAP.org/license.html>. 15## 16## ACKNOWLEDGEMENTS: 17## This module was written in 2016 by Ondřej Kuzník for Symas Corp. 18 19echo "running defines.sh" 20. $SRCDIR/scripts/defines.sh 21 22. ${SCRIPTDIR}/common.sh 23 24echo "Modifying entry..." 25$LDAPMODIFY -D $MANAGERDN -H $URI1 -w $PASSWD \ 26 -f data/test005-changes.ldif >> $TESTOUT 2>&1 27RC=$? 28if test $RC != 0 ; then 29 echo "ldapmodify failed ($RC)!" 30 test $KILLSERVERS != no && kill -HUP $KILLPIDS 31 exit $RC 32fi 33 34echo "Applying invalid changes (should fail)..." 35for CHANGE in data/test005-*fail.ldif; do 36 echo "... $CHANGE" 37 $LDAPMODIFY -D $MANAGERDN -H $URI1 -w $PASSWD \ 38 -f $CHANGE >> $TESTOUT 2>&1 39 RC=$? 40 case $RC in 41 0) 42 echo "ldapmodify should have failed ($RC)!" 43 test $KILLSERVERS != no && kill -HUP $KILLPIDS 44 exit 1 45 ;; 46 16|19) 47 echo "ldapmodify failed ($RC)" 48 ;; 49 *) 50 echo "ldapmodify failed ($RC)!" 51 test $KILLSERVERS != no && kill -HUP $KILLPIDS 52 exit $RC 53 ;; 54 esac 55done 56 57echo "Reading affected entries back..." 58echo "# Reading affected entries back..." >> $SEARCHOUT 59$LDAPSEARCH -b "$BASEDN" -H $URI1 \ 60 '(|(objectClass=OpenLDAPperson)(ou=people))' \ 61 >> $SEARCHOUT 2>&1 62RC=$? 63if test $RC != 0 ; then 64 echo "ldapsearch failed ($RC)!" 65 test $KILLSERVERS != no && kill -HUP $KILLPIDS 66 exit $RC 67fi 68 69test $KILLSERVERS != no && kill -HUP $KILLPIDS 70 71LDIF=data/test005-out.ldif 72 73echo "Filtering ldapsearch results..." 74$LDIFFILTER -s e < $SEARCHOUT > $SEARCHFLT 75echo "Filtering expected entries..." 76$LDIFFILTER -s e < $LDIF > $LDIFFLT 77echo "Comparing filter output..." 78$CMP $SEARCHFLT $LDIFFLT > $CMPOUT 79 80if test $? != 0 ; then 81 echo "Comparison failed" 82 exit 1 83fi 84 85echo ">>>>> Test succeeded" 86 87test $KILLSERVERS != no && wait 88 89exit 0 90