3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2009 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 if test "$BACKEND" != "bdb" && test "$BACKEND" != "hdb" ; then
17 echo "Test does not support $BACKEND"
21 # test now handles known issues
22 #if test x"$PROXYSYNC" = x ; then
23 # echo "Test disabled; set PROXYSYNC=yes to enable"
27 echo "running defines.sh"
28 . $SRCDIR/scripts/defines.sh
30 if test $BACKLDAP = ldapno; then
31 echo "LDAP backend not available, test skipped"
35 if test $SYNCPROV = syncprovno; then
36 echo "Syncrepl provider overlay not available, test skipped"
40 if test $MONITORDB = no; then
41 echo "Monitor backend not available, test skipped"
45 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
51 # - populate over ldap
52 # - perform some modifies and deleted
53 # - attempt to modify the slave (referral or chain)
54 # - retrieve database over ldap and compare against expected results
57 echo "Starting master slapd on TCP/IP port $PORT1..."
58 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $CONF1
59 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
61 if test $WAIT != 0 ; then
62 echo MASTERPID $MASTERPID
69 echo "Using ldapsearch to check that master slapd is running..."
70 for i in 0 1 2 3 4 5; do
71 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
72 '(objectClass=*)' > /dev/null 2>&1
74 if test $RC = 0 ; then
77 echo "Waiting 5 seconds for slapd to start..."
81 if test $RC != 0 ; then
82 echo "ldapsearch failed ($RC)!"
83 test $KILLSERVERS != no && kill -HUP $KILLPIDS
87 echo "Using ldapadd to create the context prefix entry in the master..."
88 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
89 $LDIFORDEREDCP > /dev/null 2>&1
91 if test $RC != 0 ; then
92 echo "ldapadd failed ($RC)!"
93 test $KILLSERVERS != no && kill -HUP $KILLPIDS
97 echo "Starting slave slapd on TCP/IP port $PORT2..."
98 . $CONFFILTER $BACKEND $MONITORDB < $RSLAVECONF > $CONF2
99 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
101 if test $WAIT != 0 ; then
102 echo SLAVEPID $SLAVEPID
105 KILLPIDS="$MASTERPID $SLAVEPID"
109 echo "Using ldapsearch to check that slave slapd is running..."
110 for i in 0 1 2 3 4 5; do
111 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
112 '(objectClass=*)' > /dev/null 2>&1
114 if test $RC = 0 ; then
117 echo "Waiting 5 seconds for slapd to start..."
121 if test $RC != 0 ; then
122 echo "ldapsearch failed ($RC)!"
123 test $KILLSERVERS != no && kill -HUP $KILLPIDS
127 echo "Starting proxy slapd on TCP/IP port $PORT3..."
128 . $CONFFILTER $BACKEND $MONITORDB < $PLSRSLAVECONF > $CONF3
129 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
131 if test $WAIT != 0 ; then
132 echo PROXYPID $PROXYPID
135 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
139 echo "Using ldapsearch to check that proxy slapd is running..."
140 for i in 0 1 2 3 4 5; do
141 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
142 '(objectClass=*)' > /dev/null 2>&1
144 if test $RC = 0 || test $RC = 53 ; then
147 echo "Waiting 5 seconds for slapd to start..."
153 echo "ldapsearch should have failed ($RC)!"
154 test $KILLSERVERS != no && kill -HUP $KILLPIDS
160 echo "ldapsearch failed ($RC)!"
161 test $KILLSERVERS != no && kill -HUP $KILLPIDS
167 echo "$CHECK > Using ldapadd to populate the master directory..."
168 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
169 $LDIFORDEREDNOCP > /dev/null 2>&1
171 if test $RC != 0 ; then
172 echo "ldapadd failed ($RC)!"
173 test $KILLSERVERS != no && kill -HUP $KILLPIDS
177 # get master contextCSN
178 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
179 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
181 if test $RC != 0 ; then
182 echo "ldapsearch failed at master ($RC)!"
183 test $KILLSERVERS != no && kill -HUP $KILLPIDS
187 # check slave contextCSN
190 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
191 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
194 if test $RC != 0 ; then
195 echo "ldapsearch failed at slave ($RC)!"
196 test $KILLSERVERS != no && kill -HUP $KILLPIDS
200 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
202 if test $? = 0 ; then
206 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
210 #echo "Using ldapsearch to read all the entries from the master..."
211 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
212 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
215 if test $RC != 0 ; then
216 echo "ldapsearch failed at master ($RC)!"
217 test $KILLSERVERS != no && kill -HUP $KILLPIDS
221 #echo "Using ldapsearch to read all the entries from the slave..."
222 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
223 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
226 if test $RC != 0 ; then
227 echo "ldapsearch failed at slave ($RC)!"
228 test $KILLSERVERS != no && kill -HUP $KILLPIDS
232 #echo "Filtering master results..."
233 . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
234 #echo "Filtering slave results..."
235 . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
237 echo "$CHECK < Comparing retrieved entries from master and slave..."
238 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
240 if test $? != 0 ; then
241 echo "test failed - master and slave databases differ"
242 test $KILLSERVERS != no && kill -HUP $KILLPIDS
246 CHECK=`expr $CHECK + 1`
247 echo "$CHECK > Stopping the provider, sleeping $SLEEP2 seconds and restarting it..."
248 kill -HUP "$MASTERPID"
252 echo "======================= RESTART =======================" >> $LOG1
253 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
255 if test $WAIT != 0 ; then
256 echo MASTERPID $MASTERPID
259 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
263 echo "Using ldapsearch to check that master slapd is running..."
264 for i in 0 1 2 3 4 5; do
265 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
266 '(objectClass=*)' > /dev/null 2>&1
268 if test $RC = 0 ; then
271 echo "Waiting 5 seconds for slapd to start..."
275 if test $RC != 0 ; then
276 echo "ldapsearch failed ($RC)!"
277 test $KILLSERVERS != no && kill -HUP $KILLPIDS
281 echo "Using ldapmodify to modify master directory..."
284 # Do some modifications
287 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
288 $TESTOUT 2>&1 << EOMODS
289 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
300 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
305 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
308 uniquemember: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
309 uniquemember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
312 uniquemember: cn=Dorothy Stevens, ou=Alumni Association, ou=People, dc=example,dc=com
313 uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
315 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc
321 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
323 objectclass: OpenLDAPperson
327 title: Chief Investigator, ITD
328 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
329 seealso: cn=All Staff, ou=Groups, dc=example,dc=com
331 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
332 description: Very odd
333 facsimiletelephonenumber: +1 313 555 7557
334 telephonenumber: +1 313 555 8343
335 mail: gjensen@mailgw.example.com
336 homephone: +1 313 555 8844
338 dn: ou=Retired, ou=People, dc=example,dc=com
340 objectclass: organizationalUnit
343 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
345 objectclass: OpenLDAPperson
346 cn: Rosco P. Coltrane
349 description: Fat tycoon
351 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
353 newrdn: cn=Rosco P. Coltrane
355 newsuperior: ou=Retired, ou=People, dc=example,dc=com
357 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
362 if test $RC != 0 ; then
363 echo "ldapmodify failed ($RC)!"
364 test $KILLSERVERS != no && kill -HUP $KILLPIDS
368 # get master contextCSN
369 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
370 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
372 if test $RC != 0 ; then
373 echo "ldapsearch failed at master ($RC)!"
374 test $KILLSERVERS != no && kill -HUP $KILLPIDS
378 # check slave contextCSN
380 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
383 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
384 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
387 if test $RC != 0 ; then
388 echo "ldapsearch failed at slave ($RC)!"
389 test $KILLSERVERS != no && kill -HUP $KILLPIDS
393 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
395 if test $? = 0 ; then
400 #echo "Using ldapsearch to read all the entries from the master..."
401 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
402 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
405 if test $RC != 0 ; then
406 echo "ldapsearch failed at master ($RC)!"
407 test $KILLSERVERS != no && kill -HUP $KILLPIDS
411 #echo "Using ldapsearch to read all the entries from the slave..."
412 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
413 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
416 if test $RC != 0 ; then
417 echo "ldapsearch failed at slave ($RC)!"
418 test $KILLSERVERS != no && kill -HUP $KILLPIDS
422 #echo "Filtering master results..."
423 . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
424 #echo "Filtering slave results..."
425 . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
427 echo "$CHECK < Comparing retrieved entries from master and slave..."
428 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
430 if test $? != 0 ; then
431 echo "test failed - master and slave databases differ"
432 test $KILLSERVERS != no && kill -HUP $KILLPIDS
436 CHECK=`expr $CHECK + 1`
437 echo "$CHECK > Stopping proxy to test recovery..."
441 echo "Modifying more entries on the master..."
442 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
443 $TESTOUT 2>&1 << EOMODS
444 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
447 description: proxy is down...
449 dn: cn=James T. Kirk, ou=Retired, ou=People, dc=example,dc=com
451 objectclass: OpenLDAPperson
456 dn: cn=Tiberius J. Hooker, ou=Retired, ou=People, dc=example,dc=com
458 objectclass: OpenLDAPperson
461 cn: Tiberius J. Hooker
465 echo "Restarting proxy..."
466 echo "======================= RESTART =======================" >> $LOG3
467 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
469 if test $WAIT != 0 ; then
470 echo PROXYPID $PROXYPID
473 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
475 # get master contextCSN
476 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
477 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
479 if test $RC != 0 ; then
480 echo "ldapsearch failed at master ($RC)!"
481 test $KILLSERVERS != no && kill -HUP $KILLPIDS
485 # check slave contextCSN
486 for i in 1 2 3 4 5; do
487 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
490 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
491 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
494 if test $RC != 0 ; then
495 echo "ldapsearch failed at slave ($RC)!"
496 test $KILLSERVERS != no && kill -HUP $KILLPIDS
500 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
502 if test $? = 0 ; then
507 #echo "Using ldapsearch to read all the entries from the master..."
508 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
509 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
512 if test $RC != 0 ; then
513 echo "ldapsearch failed at master ($RC)!"
514 test $KILLSERVERS != no && kill -HUP $KILLPIDS
518 #echo "Using ldapsearch to read all the entries from the slave..."
519 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
520 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
523 if test $RC != 0 ; then
524 echo "ldapsearch failed at slave ($RC)!"
525 test $KILLSERVERS != no && kill -HUP $KILLPIDS
529 #echo "Filtering master results..."
530 . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
531 #echo "Filtering slave results..."
532 . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
534 echo "$CHECK < Comparing retrieved entries from master and slave..."
535 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
537 if test $? != 0 ; then
538 echo "test failed - master and slave databases differ"
539 test $KILLSERVERS != no && kill -HUP $KILLPIDS
543 CHECK=`expr $CHECK + 1`
544 echo "$CHECK > Try updating the slave slapd..."
545 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD > \
546 $TESTOUT 2>&1 << EOMODS
547 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
550 description: This write must fail because directed to a shadow context,
551 description: unless the chain overlay is configured appropriately ;)
556 if test $RC != 0 ; then
557 echo "ldapmodify failed ($RC)!"
558 test $KILLSERVERS != no && kill -HUP $KILLPIDS
562 # get master contextCSN
563 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
564 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
566 if test $RC != 0 ; then
567 echo "ldapsearch failed at master ($RC)!"
568 test $KILLSERVERS != no && kill -HUP $KILLPIDS
572 # check slave contextCSN
576 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
577 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
580 if test $RC != 0 ; then
581 echo "ldapsearch failed at slave ($RC)!"
582 test $KILLSERVERS != no && kill -HUP $KILLPIDS
586 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
588 if test $? = 0 ; then
592 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
596 #echo "Using ldapsearch to read all the entries from the master..."
597 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
598 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
601 if test $RC != 0 ; then
602 echo "ldapsearch failed at master ($RC)!"
603 test $KILLSERVERS != no && kill -HUP $KILLPIDS
607 #echo "Using ldapsearch to read all the entries from the slave..."
608 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
609 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
612 if test $RC != 0 ; then
613 echo "ldapsearch failed at slave ($RC)!"
614 test $KILLSERVERS != no && kill -HUP $KILLPIDS
618 #echo "Filtering master results..."
619 . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
620 #echo "Filtering slave results..."
621 . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
623 echo "$CHECK < Comparing retrieved entries from master and slave..."
624 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
626 if test $? != 0 ; then
627 echo "test failed - master and slave databases differ"
628 test $KILLSERVERS != no && kill -HUP $KILLPIDS
632 CHECK=`expr $CHECK + 1`
633 echo "$CHECK > Stopping consumer to test recovery..."
637 echo "Modifying more entries on the master..."
638 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
639 $TESTOUT 2>&1 << EOMODS
640 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
647 echo "Waiting $SLEEP2 seconds for syncrepl to retry..."
650 echo "Restarting consumer..."
651 echo "======================= RESTART =======================" >> $LOG2
652 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
654 if test $WAIT != 0 ; then
655 echo SLAVEPID $SLAVEPID
658 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
660 # get master contextCSN
661 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
662 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
664 if test $RC != 0 ; then
665 echo "ldapsearch failed at master ($RC)!"
666 test $KILLSERVERS != no && kill -HUP $KILLPIDS
670 # check slave contextCSN
672 for i in 1 2 3 4 5; do
673 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
676 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
677 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
680 if test $RC != 0 ; then
681 echo "ldapsearch failed at slave ($RC)!"
682 test $KILLSERVERS != no && kill -HUP $KILLPIDS
686 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
688 if test $? = 0 ; then
693 #echo "Using ldapsearch to read all the entries from the master..."
694 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
695 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
698 if test $RC != 0 ; then
699 echo "ldapsearch failed at master ($RC)!"
700 test $KILLSERVERS != no && kill -HUP $KILLPIDS
704 #echo "Using ldapsearch to read all the entries from the slave..."
705 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
706 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
709 if test $RC != 0 ; then
710 echo "ldapsearch failed at slave ($RC)!"
711 test $KILLSERVERS != no && kill -HUP $KILLPIDS
715 #echo "Filtering master results..."
716 . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
717 #echo "Filtering slave results..."
718 . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
720 echo "$CHECK < Comparing retrieved entries from master and slave..."
721 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
723 if test $? != 0 ; then
724 # FIXME: keep the original workaround in place, in case we needed again
726 echo "test failed - master and slave databases differ"
727 test $KILLSERVERS != no && kill -HUP $KILLPIDS
731 echo " test failed - master and slave databases differ (ignored by now)"
732 echo " Stopping proxy to see if it auto-recovers..."
736 echo " ${CHECK}.1 > Restarting proxy..."
737 echo "======================= RESTART =======================" >> $LOG3
738 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
740 if test $WAIT != 0 ; then
741 echo PROXYPID $PROXYPID
744 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
746 echo " Waiting $SLEEP2 seconds for syncrepl to receive changes..."
749 #echo "Using ldapsearch to read all the entries from the slave..."
750 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
751 '(objectClass=*)' > "${SLAVEOUT}.5.1" 2>&1
754 if test $RC != 0 ; then
755 echo " ldapsearch failed at slave ($RC)!"
756 test $KILLSERVERS != no && kill -HUP $KILLPIDS
760 #echo "Filtering slave results..."
761 . $LDIFFILTER < "${SLAVEOUT}.5.1" > $SLAVEFLT
763 echo " ${CHECK}.1 < Comparing retrieved entries from master and slave..."
764 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
766 if test $? != 0 ; then
767 echo " test failed - master and slave databases differ"
768 test $KILLSERVERS != no && kill -HUP $KILLPIDS
774 # Modifications formerly known to fail
776 CHECK=`expr $CHECK + 1`
777 echo "$CHECK > Performing modifications that were formerly known to fail..."
778 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
779 $TESTOUT 2>&1 << EOMODS
780 # First, back out previous change
781 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
786 # From now on, perform modifications that were formerly known to fail
787 dn: cn=All Staff,ou=Groups,dc=example,dc=com
794 if test $RC != 0 ; then
795 echo "ldapmodify failed ($RC)!"
796 test $KILLSERVERS != no && kill -HUP $KILLPIDS
800 # get master contextCSN
801 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
802 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
804 if test $RC != 0 ; then
805 echo "ldapsearch failed at master ($RC)!"
806 test $KILLSERVERS != no && kill -HUP $KILLPIDS
810 # check slave contextCSN
813 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
814 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
817 if test $RC != 0 ; then
818 echo "ldapsearch failed at slave ($RC)!"
819 test $KILLSERVERS != no && kill -HUP $KILLPIDS
823 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
825 if test $? = 0 ; then
829 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
833 #echo "Using ldapsearch to read all the entries from the master..."
834 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
835 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
838 if test $RC != 0 ; then
839 echo "ldapsearch failed at master ($RC)!"
840 test $KILLSERVERS != no && kill -HUP $KILLPIDS
844 #echo "Using ldapsearch to read all the entries from the slave..."
845 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
846 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
849 if test $RC != 0 ; then
850 echo "ldapsearch failed at slave ($RC)!"
851 test $KILLSERVERS != no && kill -HUP $KILLPIDS
855 #echo "Filtering master results..."
856 . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
857 #echo "Filtering slave results..."
858 . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
860 echo "$CHECK < Comparing retrieved entries from master and slave..."
861 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
863 if test $? != 0 ; then
864 echo "test failed - master and slave databases differ (ignored by now)"
865 #echo "test failed - master and slave databases differ"
866 #test $KILLSERVERS != no && kill -HUP $KILLPIDS
870 test $KILLSERVERS != no && kill -HUP $KILLPIDS
872 echo ">>>>> Test succeeded"
874 test $KILLSERVERS != no && wait