1#! /bin/sh 2# $OpenLDAP$ 3## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4## 5## Copyright 1998-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 16echo "running defines.sh" 17. $SRCDIR/scripts/defines.sh 18 19mkdir -p $TESTDIR $DBDIR1 20 21echo "Running slapadd to build slapd database..." 22. $CONFFILTER $BACKEND < $CONF > $ADDCONF 23$SLAPADD -f $ADDCONF -l $LDIFORDERED 24RC=$? 25if test $RC != 0 ; then 26 echo "slapadd failed ($RC)!" 27 exit $RC 28fi 29 30echo "Testing modify, add, and delete using slapmodify..." 31$SLAPMODIFY -f $ADDCONF -d $LVL -l $LDIFMODIFY > $TESTOUT 2>&1 32RC=$? 33if test $RC != 0 ; then 34 echo "slapmodify failed ($RC)!" 35 exit $RC 36fi 37 38echo "Starting slapd on TCP/IP port $PORT1..." 39. $CONFFILTER $BACKEND < $CONF > $CONF1 40$SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & 41PID=$! 42if test $WAIT != 0 ; then 43 echo PID $PID 44 read foo 45fi 46KILLPIDS="$PID" 47 48sleep 1 49 50echo "Using ldapsearch to retrieve all the entries..." 51for i in 0 1 2 3 4 5; do 52 $LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 > $SEARCHOUT 2>&1 53 RC=$? 54 if test $RC = 0 ; then 55 break 56 fi 57 echo "Waiting 5 seconds for slapd to start..." 58 sleep 5 59done 60 61if test $RC != 0 ; then 62 echo "ldapsearch failed ($RC)!" 63 test $KILLSERVERS != no && kill -HUP $KILLPIDS 64 exit $RC 65fi 66 67LDIF=$MODIFYOUTPROVIDER 68 69echo "Filtering ldapsearch results..." 70$LDIFFILTER < $SEARCHOUT > $SEARCHFLT 71echo "Filtering original ldif used to create database..." 72$LDIFFILTER < $LDIF > $LDIFFLT 73echo "Comparing filter output..." 74$CMP $SEARCHFLT $LDIFFLT > $CMPOUT 75 76if test $? != 0 ; then 77 echo "modify operations did not complete correctly" 78 echo $SEARCHFLT $LDIFFLT 79 $DIFF $SEARCHFLT $LDIFFLT 80 test $KILLSERVERS != no && kill -HUP $KILLPIDS 81 exit 1 82fi 83 84test $KILLSERVERS != no && kill -HUP $KILLPIDS 85 86echo ">>>>> Test succeeded" 87 88test $KILLSERVERS != no && wait 89 90exit 0 91