3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2017 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
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>.
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
19 mkdir -p $TESTDIR $DBDIR1
21 echo "Running slapadd to build slapd database..."
22 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
23 $SLAPADD -f $CONF1 -l $LDIFORDERED
25 if test $RC != 0 ; then
26 echo "slapadd failed ($RC)!"
30 echo "Starting slapd on TCP/IP port $PORT1..."
31 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
33 if test $WAIT != 0 ; then
41 echo "Testing slapd modify operations..."
42 for i in 0 1 2 3 4 5; do
43 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
44 'objectclass=*' > /dev/null 2>&1
46 if test $RC = 0 ; then
49 echo "Waiting 5 seconds for slapd to start..."
53 if test $RC != 0 ; then
54 echo "ldapsearch failed ($RC)!"
55 test $KILLSERVERS != no && kill -HUP $KILLPIDS
59 echo "Testing modify, add, and delete..."
60 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
61 $TESTOUT -f $LDIFMODIFY
63 if test $RC != 0 ; then
64 echo "ldapmodify failed ($RC)!"
65 test $KILLSERVERS != no && kill -HUP $KILLPIDS
69 echo "Using ldapmodify to add an empty entry (should fail with protocolError)..."
70 $LDAPMODIFY -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
71 >> $TESTOUT 2>&1 << EOMODS
72 dn: cn=Foo Bar,dc=example,dc=com
74 # EMPTY SEQUENCE OF ATTRS
80 echo " ldapmodify failed ($RC)"
83 echo " ldapmodify should have failed ($RC)!"
84 test $KILLSERVERS != no && kill -HUP $KILLPIDS
88 echo " ldapmodify failed ($RC)!"
89 test $KILLSERVERS != no && kill -HUP $KILLPIDS
94 echo "Using ldapsearch to retrieve all the entries..."
95 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
96 'objectClass=*' > $SEARCHOUT 2>&1
98 test $KILLSERVERS != no && kill -HUP $KILLPIDS
99 if test $RC != 0 ; then
100 echo "ldapsearch failed ($RC)!"
104 LDIF=$MODIFYOUTMASTER
106 echo "Filtering ldapsearch results..."
107 $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
108 echo "Filtering original ldif used to create database..."
109 $LDIFFILTER < $LDIF > $LDIFFLT
110 echo "Comparing filter output..."
111 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
113 if test $? != 0 ; then
114 echo "comparison failed - modify operations did not complete correctly"
118 echo ">>>>> Test succeeded"
120 test $KILLSERVERS != no && wait