2 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ## Copyright 1998-2005 The OpenLDAP Foundation.
5 ## All rights reserved.
7 ## Redistribution and use in source and binary forms, with or without
8 ## modification, are permitted only as authorized by the OpenLDAP
11 ## A copy of this license is available in the file LICENSE in the
12 ## top-level directory of the distribution or, alternatively, at
13 ## <http://www.OpenLDAP.org/license.html>.
15 if test "$BACKEND" != "bdb" && test "$BACKEND" != "hdb" ; then
16 echo "Test does not support $BACKEND"
20 echo "running defines.sh"
21 . $SRCDIR/scripts/defines.sh
23 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C $DBDIR2A $DBDIR2B $DBDIR2C
25 echo "Starting slapd 1 on TCP/IP port $PORT1..."
26 . $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF1 > $CONF1
27 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
29 if test $WAIT != 0 ; then
37 echo "Using ldapsearch to check that slapd 1 is running..."
38 for i in 0 1 2 3 4 5; do
39 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
40 '(objectclass=*)' > /dev/null 2>&1
42 if test $RC = 0 ; then
45 echo "Waiting 5 seconds for slapd to start..."
49 echo "Starting slapd 2 on TCP/IP port $PORT2..."
50 . $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF2 > $CONF2
51 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
53 if test $WAIT != 0 ; then
57 KILLPIDS="$KILLPIDS $PID"
61 echo "Using ldapsearch to check that slapd 2 is running..."
62 for i in 0 1 2 3 4 5; do
63 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
64 '(objectclass=*)' > /dev/null 2>&1
66 if test $RC = 0 ; then
69 echo "Waiting 5 seconds for slapd to start..."
73 SUBTREE1="ou=Information Technology Division,ou=People,dc=example,dc=com"
74 SUBTREE2="ou=Groups,dc=example,dc=com"
78 echo "Using ldapadd to populate the common root on port $P..."
79 $LDAPADD -D "cn=Manager $M,$BASEDN" -w $PASSWD -h $LOCALHOST -p $P \
81 -c -e\!assert="(&(!(entryDN:dnSubtreeMatch:=${SUBTREE1}))(!(entryDN:dnSubtreeMatch:=${SUBTREE2})))" \
86 echo "ldapadd should have failed ($RC)!"
87 test $KILLSERVERS != no && kill -HUP $KILLPIDS
91 # FIXME: we should rather get ASSERT, and ignore it;
92 # see <http://www.openldap.org/lists/openldap-software/200512/msg00250.html>
94 # Fine by now if we get noSuchObject, alreadyExists
98 echo "ldapadd failed ($RC)!"
99 test $KILLSERVERS != no && kill -HUP $KILLPIDS
105 echo "Using ldapadd to populate subtree=\"${SUBTREE1}\" on port $PORT1..."
106 $LDAPADD -D "cn=Manager 1,$BASEDN" -w $PASSWD -h $LOCALHOST -p $PORT1 \
108 -c -e\!assert="(entryDN:dnSubtreeMatch:=${SUBTREE1})" \
113 echo "ldapadd should have failed ($RC)!"
114 test $KILLSERVERS != no && kill -HUP $KILLPIDS
118 # FIXME: we should rather get ASSERT, and ignore it;
119 # see <http://www.openldap.org/lists/openldap-software/200512/msg00250.html>
121 # Fine by now if we get noSuchObject, alreadyExists
125 echo "ldapadd failed ($RC)!"
126 test $KILLSERVERS != no && kill -HUP $KILLPIDS
131 echo "Using ldapadd to populate subtree=\"${SUBTREE2}\" on port $PORT2..."
132 $LDAPADD -D "cn=Manager 2,$BASEDN" -w $PASSWD -h $LOCALHOST -p $PORT2 \
134 -c -e\!assert="(entryDN:dnSubtreeMatch:=${SUBTREE2})" \
139 echo "ldapadd should have failed ($RC)!"
140 test $KILLSERVERS != no && kill -HUP $KILLPIDS
144 # FIXME: we should rather get ASSERT, and ignore it;
145 # see <http://www.openldap.org/lists/openldap-software/200512/msg00250.html>
147 # Fine by now if we get noSuchObject, alreadyExists
151 echo "ldapadd failed ($RC)!"
152 test $KILLSERVERS != no && kill -HUP $KILLPIDS
158 echo "Waiting $SLEEP seconds for shadow subtrees to sync..."
161 echo "Filtering original ldif used to create database..."
162 . $LDIFFILTER < $GLUESYNCOUT > $LDIFFLT
164 for P in $PORT1 $PORT2 ; do
165 echo "Using ldapsearch to read all the entries from port $P..."
166 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $P \
167 -S "" '(objectclass=*)' > "${SEARCHOUT}.${P}" 2>&1
170 if test $RC != 0 ; then
171 echo "ldapsearch failed ($RC)!"
172 test $KILLSERVERS != no && kill -HUP $KILLPIDS
176 echo "Filtering ldapsearch results..."
177 . $LDIFFILTER < "${SEARCHOUT}.${P}" > $SEARCHFLT
178 echo "Comparing filter output..."
179 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
181 if test $? != 0 ; then
182 echo "comparison failed - database was not created correctly"
183 test $KILLSERVERS != no && kill -HUP $KILLPIDS
188 test $KILLSERVERS != no && kill -HUP $KILLPIDS
190 echo ">>>>> Test succeeded"