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 echo "running defines.sh"
16 . $SRCDIR/scripts/defines.sh
18 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C $DBDIR2A $DBDIR2B $DBDIR2C
20 echo "Starting slapd 1 on TCP/IP port $PORT1..."
21 . $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF1 > $CONF1
22 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
24 if test $WAIT != 0 ; then
32 echo "Using ldapsearch to check that slapd 1 is running..."
33 for i in 0 1 2 3 4 5; do
34 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
35 '(objectclass=*)' > /dev/null 2>&1
37 if test $RC = 0 ; then
40 echo "Waiting 5 seconds for slapd to start..."
44 echo "Starting slapd 2 on TCP/IP port $PORT2..."
45 . $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF2 > $CONF2
46 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
48 if test $WAIT != 0 ; then
52 KILLPIDS="$KILLPIDS $PID"
56 echo "Using ldapsearch to check that slapd 2 is running..."
57 for i in 0 1 2 3 4 5; do
58 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
59 '(objectclass=*)' > /dev/null 2>&1
61 if test $RC = 0 ; then
64 echo "Waiting 5 seconds for slapd to start..."
68 SUBTREE1="ou=Information Technology Division,ou=People,dc=example,dc=com"
69 SUBTREE2="ou=Groups,dc=example,dc=com"
73 echo "Using ldapadd to populate the common root on port $P..."
74 $LDAPADD -D "cn=Manager $M,$BASEDN" -w $PASSWD -h $LOCALHOST -p $P \
76 -c -e\!assert="(&(!(entryDN:dnSubtreeMatch:=${SUBTREE1}))(!(entryDN:dnSubtreeMatch:=${SUBTREE2})))" \
81 echo "ldapadd should have failed ($RC)!"
82 test $KILLSERVERS != no && kill -HUP $KILLPIDS
86 # FIXME: we should rather get ASSERT, and ignore it;
87 # see <http://www.openldap.org/lists/openldap-software/200512/msg00250.html>
89 # Fine by now if we get noSuchObject, alreadyExists
93 echo "ldapadd should have failed ($RC)!"
94 test $KILLSERVERS != no && kill -HUP $KILLPIDS
100 echo "Using ldapadd to populate subtree=\"${SUBTREE1}\" on port $PORT1..."
101 $LDAPADD -D "cn=Manager 1,$BASEDN" -w $PASSWD -h $LOCALHOST -p $PORT1 \
103 -c -e\!assert="(entryDN:dnSubtreeMatch:=${SUBTREE1})" \
108 echo "ldapadd should have failed ($RC)!"
109 test $KILLSERVERS != no && kill -HUP $KILLPIDS
113 # FIXME: we should rather get ASSERT, and ignore it;
114 # see <http://www.openldap.org/lists/openldap-software/200512/msg00250.html>
116 # Fine by now if we get noSuchObject, alreadyExists
120 echo "ldapadd should have failed ($RC)!"
121 test $KILLSERVERS != no && kill -HUP $KILLPIDS
126 echo "Using ldapadd to populate subtree=\"${SUBTREE2}\" on port $PORT2..."
127 $LDAPADD -D "cn=Manager 2,$BASEDN" -w $PASSWD -h $LOCALHOST -p $PORT2 \
129 -c -e\!assert="(entryDN:dnSubtreeMatch:=${SUBTREE2})" \
134 echo "ldapadd should have failed ($RC)!"
135 test $KILLSERVERS != no && kill -HUP $KILLPIDS
139 # FIXME: we should rather get ASSERT, and ignore it;
140 # see <http://www.openldap.org/lists/openldap-software/200512/msg00250.html>
142 # Fine by now if we get noSuchObject, alreadyExists
146 echo "ldapadd should have failed ($RC)!"
147 test $KILLSERVERS != no && kill -HUP $KILLPIDS
153 echo "Waiting $SLEEP seconds for shadow subtrees to sync..."
156 echo "Filtering original ldif used to create database..."
157 . $LDIFFILTER < $GLUESYNCOUT > $LDIFFLT
159 for P in $PORT1 $PORT2 ; do
160 echo "Using ldapsearch to read all the entries from port $P..."
161 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $P \
162 -S "" '(objectclass=*)' > "${SEARCHOUT}.${P}" 2>&1
165 if test $RC != 0 ; then
166 echo "ldapsearch failed ($RC)!"
167 test $KILLSERVERS != no && kill -HUP $KILLPIDS
171 echo "Filtering ldapsearch results..."
172 . $LDIFFILTER < "${SEARCHOUT}.${P}" > $SEARCHFLT
173 echo "Comparing filter output..."
174 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
176 if test $? != 0 ; then
177 echo "comparison failed - database was not created correctly"
178 test $KILLSERVERS != no && kill -HUP $KILLPIDS
183 test $KILLSERVERS != no && kill -HUP $KILLPIDS
185 echo ">>>>> Test succeeded"