3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2018 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 if test $SYNCPROV = syncprovno; then
20 echo "Syncrepl provider overlay not available, test skipped"
23 if test $ACCESSLOG = accesslogno; then
24 echo "Accesslog overlay not available, test skipped"
27 if test $DYNLIST = dynlistno; then
28 echo "Accesslog overlay not available, test skipped"
31 if test $MEMBEROF = memberofno; then
32 echo "Memberof overlay not available, test skipped"
35 if test $BACKEND = ldif ; then
36 # Onelevel search does not return entries in order of creation or CSN.
37 echo "$BACKEND backend unsuitable for syncprov logdb, test skipped"
41 echo "This test tracks a case where changes are incorrectly skipped"
42 echo "See http://www.openldap.org/its/index.cgi/?findid=8444 for more information."
49 $SLAPPASSWD -g -n >$CONFIGPWF
52 ITSDIR=$DATADIR/regressions/its$ITS
54 echo "Initializing server configurations..."
57 while [ $n -le $MMR ]; do
59 CFDIR=${XDIR}$n/slapd.d
61 mkdir -p ${XDIR}$n $DBDIR.1 $DBDIR.2 $CFDIR
62 . $CONFFILTER $BACKEND $MONITORDB < $ITSDIR/slapd-provider${n}.ldif > $CONFLDIF
63 $SLAPADD -F $CFDIR -n 0 -l $CONFLDIF
69 while [ $n -le $MMR ]; do
70 MYURI=`eval echo '$URI'$n`
71 MYLOG=`eval echo '$LOG'$n`
72 CFDIR=${XDIR}$n/slapd.d
74 echo "Starting provider slapd on TCP/IP URI $MYURI"
75 $SLAPD -F $CFDIR -h $MYURI -d $LVL $TIMING > $MYLOG 2>&1 &
78 if test $WAIT != 0 ; then
82 KILLPIDS="$PID $KILLPIDS"
85 echo "Using ldapsearch to check that provider slapd is running..."
86 for i in 0 1 2 3 4 5; do
87 $LDAPSEARCH -s base -b "" -H $MYURI \
88 'objectclass=*' > /dev/null 2>&1
90 if test $RC = 0 ; then
93 echo "Waiting 5 seconds for slapd to start..."
97 if test $RC != 0 ; then
98 echo "ldapsearch failed ($RC)!"
99 test $KILLSERVERS != no && kill -HUP $KILLPIDS
105 echo "Populating database on first provider..."
106 $LDAPADD -D $MANAGERDN -H $URI1 -w $PASSWD << EOMODS >> $TESTOUT 2>&1
108 objectClass: organization
109 objectClass: dcObject
113 dn: ou=People,$BASEDN
114 objectClass: organizationalUnit
117 dn: ou=Groups,$BASEDN
118 objectClass: organizationalUnit
121 dn: cn=Roger Rabbit,ou=People,$BASEDN
122 objectClass: inetOrgPerson
126 dn: cn=Baby Herman,ou=People,$BASEDN
127 objectClass: inetOrgPerson
131 dn: cn=Jessica_Rabbit,ou=People,$BASEDN
132 objectClass: inetOrgPerson
136 dn: cn=Bugs_Bunny,ou=People,$BASEDN
137 objectClass: inetOrgPerson
141 dn: cn=Daffy_Duck,ou=People,$BASEDN
142 objectClass: inetOrgPerson
146 dn: cn=Elmer_Fudd,ou=People,$BASEDN
147 objectClass: inetOrgPerson
151 dn: cn=Cartoonia,ou=Groups,$BASEDN
152 objectClass: groupOfNames
154 member: cn=Roger Rabbit,ou=People,$BASEDN
155 member: cn=Baby Herman,ou=People,$BASEDN
159 if test $RC != 0 ; then
160 echo "ldapadd failed ($RC)!"
161 test $KILLSERVERS != no && kill -HUP $KILLPIDS
165 echo "Sleeping 10 seconds to allow replication to initiate..."
168 echo "Looping 50 times adding and deleting members to the Cartoonia group..."
170 while [ $modloop -le 50 ]; do
171 echo "Adding new members to the group (${modloop}/50)..."
172 $LDAPMODIFY -H $URI1 \
173 -D "cn=Manager,$BASEDN" -w $PASSWD \
174 >> $TESTOUT 2>&1 << EOF
175 dn: cn=Cartoonia,ou=Groups,$BASEDN
178 member: cn=Jessica_Rabbit,ou=People,$BASEDN
179 member: cn=Elmer_Fudd,ou=People,$BASEDN
180 member: cn=Daffy_Duck,ou=People,$BASEDN
181 member: cn=Bugs_Bunny,ou=People,$BASEDN
186 echo "Deleting new members from the group..."
187 $LDAPMODIFY -H $URI1 \
188 -D "cn=Manager,$BASEDN" -w $PASSWD \
189 >> $TESTOUT 2>&1 << EOF
190 dn: cn=Cartoonia,ou=Groups,$BASEDN
193 member: cn=Jessica_Rabbit,ou=People,$BASEDN
194 member: cn=Elmer_Fudd,ou=People,$BASEDN
195 member: cn=Daffy_Duck,ou=People,$BASEDN
196 member: cn=Bugs_Bunny,ou=People,$BASEDN
200 echo "Searching new members to see if they still have memberOf present..."
201 TOON1="cn=Jessica_Rabbit,ou=People,$BASEDN"
202 TOON2="cn=Elmer_Fudd,ou=People,$BASEDN"
203 TOON3="cn=Daffy_Duck,ou=People,$BASEDN"
204 TOON4="cn=Bugs_Bunny,ou=People,$BASEDN"
205 for member in $TOON1 $TOON2 $TOON3 $TOON4; do
207 while [ $n -le $MMR ]; do
209 echo "# Searching member $member after removal from Cartoonia group, provider $n" >> $SEARCHOUT
210 MYURI=`eval echo '$URI'$n`
211 $LDAPSEARCH -S "" -b "$member" -s base -H $MYURI -D "cn=manager,$BASEDN" -w $PASSWD \
212 '(objectClass=*)' 'memberOf' >> $SEARCHOUT 2>&1
214 if test $RC != 0 ; then
215 echo "ldapsearch failed ($RC)!"
216 test $KILLSERVERS != no && kill -HUP $KILLPIDS
219 grep "memberOf:" $SEARCHOUT >/dev/null 2>&1
222 if test $RC != 1 ; then
223 echo "User delete failed on one or more consumer."
224 test $KILLSERVERS != no && kill -HUP $KILLPIDS
230 modloop=`expr $modloop + 1`
233 echo "Looping 50 times deleting and adding Cartoonia group..."
235 while [ $modloop -le 50 ]; do
237 echo "Running ldapdelete to remove a group (${modloop}/50)..."
238 $LDAPMODIFY -H $URI1 \
239 -D "cn=Manager,$BASEDN" -w $PASSWD \
240 >> $TESTOUT 2>&1 << EOF
241 dn: cn=Cartoonia,ou=Groups,$BASEDN
247 echo "Searching entire database on each provider after deleting Cartoonia group"
250 while [ $n -le $MMR ]; do
251 echo "# Searching the entire database after deleting Cartoonia, provider $n" >> $SEARCHOUT
252 MYURI=`eval echo '$URI'$n`
253 $LDAPSEARCH -S "" -b "$BASEDN" -H $MYURI -D "cn=manager,$BASEDN" -w $PASSWD \
254 '(objectClass=*)' '*' >> $SEARCHOUT 2>&1
256 if test $RC != 0 ; then
257 echo "ldapsearch failed ($RC)!"
258 test $KILLSERVERS != no && kill -HUP $KILLPIDS
264 grep "cn=Cartoonia" $SEARCHOUT >/dev/null 2>&1
267 if test $RC != 1 ; then
268 echo "Group delete failed on one or more consumer."
269 test $KILLSERVERS != no && kill -HUP $KILLPIDS
273 echo "Running ldapmodify to add the group back..."
274 $LDAPMODIFY -H $URI1 \
275 -D "cn=Manager,$BASEDN" -w $PASSWD \
276 >> $TESTOUT 2>&1 <<EOF
277 dn: cn=Cartoonia,ou=Groups,$BASEDN
279 objectClass: groupOfNames
281 member: cn=Roger Rabbit,ou=People,$BASEDN
282 member: cn=Baby Herman,ou=People,$BASEDN
287 echo "Searching entire database on each provider after re-adding Cartoonia group"
290 while [ $n -le $MMR ]; do
292 echo "# Searching the entire database after re-adding Cartoonia, provider $n" >> $SEARCHOUT
293 MYURI=`eval echo '$URI'$n`
294 $LDAPSEARCH -S "" -b "$BASEDN" -H $MYURI -D "cn=manager,$BASEDN" -w $PASSWD \
295 '(objectClass=*)' '*' memberOf>> $SEARCHOUT 2>&1
297 if test $RC != 0 ; then
298 echo "ldapsearch failed ($RC)!"
299 test $KILLSERVERS != no && kill -HUP $KILLPIDS
302 grep "memberOf:" $SEARCHOUT >/dev/null 2>&1
305 if test $RC != 0 ; then
306 echo "Group add failed on one or more consumer."
307 test $KILLSERVERS != no && kill -HUP $KILLPIDS
313 modloop=`expr $modloop + 1`
316 test $KILLSERVERS != no && kill -HUP $KILLPIDS
318 echo ">>>>> Test succeeded"
320 test $KILLSERVERS != no && wait