1#! /bin/sh
2# OpenLDAP: pkg/ldap/tests/scripts/sql-test901-syncrepl,v 1.4.2.6 2010/04/19 19:14:32 quanah Exp
3## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4##
5## Copyright 1998-2010 The OpenLDAP Foundation.
6## All rights reserved.
7##
8## Redistribution and use in source and binary forms, with or without
9## modification, are permitted only as authorized by the OpenLDAP
10## Public License.
11##
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>.
15
16echo "running defines.sh"
17. $SRCDIR/scripts/defines.sh
18
19if test $BACKSQL = "sqlno" ; then 
20	echo "SQL backend not available, test skipped"
21	exit 0
22fi 
23
24if test $RDBMS = "rdbmsno" ; then
25	echo "SQL test not requested, test skipped"
26	exit 0
27fi
28
29if test "${RDBMSWRITE}" != "yes"; then
30	echo "write test disabled for ${RDBMS}; set SLAPD_USE_SQLWRITE=yes to enable"
31	exit 0
32fi
33
34mkdir -p $TESTDIR $DBDIR2A
35
36echo "Starting slapd on TCP/IP port $PORT1..."
37. $CONFFILTER $BACKEND $MONITORDB < $SQLSRMASTERCONF > $CONF1
38$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
39PID=$!
40if test $WAIT != 0 ; then
41    echo PID $PID
42    read foo
43fi
44KILLPIDS="$PID"
45
46echo "Testing SQL backend write operations..."
47for i in 0 1 2 3 4 5; do
48	$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
49		'objectclass=*' > /dev/null 2>&1
50	RC=$?
51	if test $RC = 0 ; then
52		break
53	fi
54	echo "Waiting 5 seconds for slapd to start..."
55	sleep 5
56done
57
58if test $RC != 0 ; then
59	echo "ldapsearch failed ($RC)!"
60	test $KILLSERVERS != no && kill -HUP $KILLPIDS
61	exit $RC
62fi
63
64echo "Starting slave slapd on TCP/IP port $PORT2..."
65. $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $CONF2
66$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
67SLAVEPID=$!
68if test $WAIT != 0 ; then
69    echo SLAVEPID $SLAVEPID
70    read foo
71fi
72KILLPIDS="$KILLPIDS $SLAVEPID"
73
74echo "Using ldapsearch to check that slave slapd is running..."
75for i in 0 1 2 3 4 5; do
76	$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
77		'objectclass=*' > /dev/null 2>&1
78	RC=$?
79	if test $RC = 0 ; then
80		break
81	fi
82	echo "Waiting 5 seconds for slapd to start..."
83	sleep 5
84done
85
86if test $RC != 0 ; then
87	echo "ldapsearch failed ($RC)!"
88	test $KILLSERVERS != no && kill -HUP $KILLPIDS
89	exit $RC
90fi
91
92cat /dev/null > $SEARCHOUT
93
94echo "Using ldapsearch to retrieve all the entries from the master..."
95echo "# Using ldapsearch to retrieve all the entries from the master..." \
96	>> $SEARCHOUT
97$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
98	-D "$MANAGERDN" -w $PASSWD \
99	 "(!(objectClass=referral))" >> $SEARCHOUT 2>&1
100
101RC=$?
102if test $RC != 0 ; then
103	echo "ldapsearch failed ($RC)!"
104	test $KILLSERVERS != no && kill -HUP $KILLPIDS
105	exit $RC
106fi
107
108cat /dev/null > $SEARCHOUT2
109
110echo "Using ldapsearch to retrieve all the entries from the slave..."
111echo "# Using ldapsearch to retrieve all the entries from the slave..." \
112	>> $SEARCHOUT2
113$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT2 -b "$BASEDN" \
114	-D "$UPDATEDN" -w $PASSWD \
115	 "(objectClass=*)" >> $SEARCHOUT2 2>&1
116
117RC=$?
118if test $RC != 0 ; then
119	echo "ldapsearch failed ($RC)!"
120	test $KILLSERVERS != no && kill -HUP $KILLPIDS
121	exit $RC
122fi
123
124echo "Filtering ldapsearch results from master..."
125$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
126echo "Filtering ldapsearch results from slave..."
127$LDIFFILTER < $SEARCHOUT2 > $SEARCHFLT2
128echo "Comparing filter output..."
129$CMP $SEARCHFLT $SEARCHFLT2 > $CMPOUT
130
131if test $? != 0 ; then
132	echo "Comparison failed"
133	test $KILLSERVERS != no && kill -HUP $KILLPIDS
134	exit 1
135fi
136
137cat /dev/null > $SEARCHOUT
138
139echo "Using ldapsearch to retrieve all the entries..."
140echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
141$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
142	 "objectClass=*" >> $SEARCHOUT 2>&1
143
144RC=$?
145if test $RC != 0 ; then
146	echo "ldapsearch failed ($RC)!"
147	test $KILLSERVERS != no && kill -HUP $KILLPIDS
148	exit $RC
149fi
150
151case ${RDBMS} in
152	# list here the RDBMSes whose mapping allows writes
153pgsql|ibmdb2)
154	MANAGERDN="cn=Manager,${BASEDN}"
155	echo "Testing add..."
156	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
157		-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
158version: 1
159
160# Adding an organization...
161dn: o=An Org,${BASEDN}
162changetype: add
163objectClass: organization
164o: An Org
165
166# Adding an organization with an "auxiliary" objectClass..
167dn: dc=subnet,${BASEDN}
168changetype: add
169objectClass: organization
170objectClass: dcObject
171o: SubNet
172dc: subnet
173
174# Adding another organization with an "auxiliary" objectClass..
175dn: dc=subnet2,${BASEDN}
176changetype: add
177objectClass: organization
178objectClass: dcObject
179o: SubNet 2
180dc: subnet2
181
182# Adding a person...
183dn: cn=Lev Tolstoij,${BASEDN}
184changetype: add
185objectClass: inetOrgPerson
186cn: Lev Tolstoij
187sn: Tolstoij
188givenName: Lev
189telephoneNumber: +39 02 XXXX YYYY
190telephoneNumber: +39 02 XXXX ZZZZ
191userPassword: tanja
192
193# Adding a person with an "auxiliary" objectClass...
194dn: cn=Some One,${BASEDN}
195changetype: add
196objectClass: inetOrgPerson
197objectClass: simpleSecurityObject
198cn: Some One
199sn: One
200givenName: Some
201telephoneNumber: +1 800 900 1234
202telephoneNumber: +1 800 900 1235
203userPassword: someone
204
205# Adding a person in another subtree...
206dn: cn=SubNet User,dc=subnet,${BASEDN}
207changetype: add
208objectClass: inetOrgPerson
209cn: SubNet User
210sn: User
211givenName: SubNet
212
213# Adding a document...
214dn: documentTitle=War and Peace,${BASEDN}
215changetype: add
216objectClass: document
217description: Historical novel
218documentTitle: War and Peace
219documentAuthor: cn=Lev Tolstoij,dc=example,dc=com
220documentIdentifier: document 3
221EOMODS
222
223	RC=$?
224	if test $RC != 0 ; then
225		echo "ldapmodify failed ($RC)!"
226		test $KILLSERVERS != no && kill -HUP $KILLPIDS
227		exit $RC
228	fi
229
230	echo "Using ldapsearch to retrieve all the entries..."
231	echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
232	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
233		 "objectClass=*" >> $SEARCHOUT 2>&1
234
235	RC=$?
236	if test $RC != 0 ; then
237		echo "ldapsearch failed ($RC)!"
238		test $KILLSERVERS != no && kill -HUP $KILLPIDS
239		exit $RC
240	fi
241
242	echo "Testing modify..."
243	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
244		-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
245version: 1
246
247# Deleting all telephone numbers...
248dn: cn=Some One,${BASEDN}
249changetype: modify
250delete: telephoneNumber
251-
252
253# Adding a telephone number...
254dn: cn=Mitya Kovalev,${BASEDN}
255changetype: modify
256add: telephoneNumber
257telephoneNumber: +1 800 123 4567
258-
259
260# Deleting a specific telephone number and adding a new one...
261dn: cn=Lev Tolstoij,${BASEDN}
262changetype: modify
263delete: telephoneNumber
264telephoneNumber: +39 02 XXXX YYYY
265-
266add: telephoneNumber
267telephoneNumber: +39 333 ZZZ 1234
268-
269
270# Adding an author to a document...
271dn: documentTitle=book1,${BASEDN}
272changetype: modify
273add: documentAuthor
274documentAuthor: cn=Lev Tolstoij,${BASEDN}
275-
276
277# Adding an author to another document...
278dn: documentTitle=book2,${BASEDN}
279changetype: modify
280add: documentAuthor
281documentAuthor: cn=Lev Tolstoij,${BASEDN}
282-
283
284# Adding an "auxiliary" objectClass...
285dn: cn=Mitya Kovalev,${BASEDN}
286changetype: modify
287add: objectClass
288objectClass: simpleSecurityObject
289-
290
291# Deleting an "auxiliary" objectClass...
292dn: cn=Some One,${BASEDN}
293changetype: modify
294delete: objectClass
295objectClass: simpleSecurityObject
296-
297
298# Deleting userPasswords
299dn: cn=Lev Tolstoij,${BASEDN}
300changetype: modify
301delete: userPassword
302-
303EOMODS
304
305	RC=$?
306	if test $RC != 0 ; then
307		echo "ldapmodify failed ($RC)!"
308		test $KILLSERVERS != no && kill -HUP $KILLPIDS
309		exit $RC
310	fi
311
312	echo "Using ldapsearch to retrieve all the entries..."
313	echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
314	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
315		 "objectClass=*" >> $SEARCHOUT 2>&1
316
317	RC=$?
318	if test $RC != 0 ; then
319		echo "ldapsearch failed ($RC)!"
320		test $KILLSERVERS != no && kill -HUP $KILLPIDS
321		exit $RC
322	fi
323
324	echo "Testing delete..."
325	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
326		-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
327version: 1
328
329# Deleting a person...
330dn: cn=Torvlobnor Puzdoy,${BASEDN}
331changetype: delete
332
333# Deleting a document...
334dn: documentTitle=book1,${BASEDN}
335changetype: delete
336
337# Deleting an organization with an "auxiliary" objectClass...
338dn: dc=subnet2,${BASEDN}
339changetype: delete
340EOMODS
341
342	RC=$?
343	if test $RC != 0 ; then
344		echo "ldapmodify failed ($RC)!"
345		test $KILLSERVERS != no && kill -HUP $KILLPIDS
346		exit $RC
347	fi
348
349	echo "Using ldapsearch to retrieve all the entries..."
350	echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
351	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
352		 "objectClass=*" >> $SEARCHOUT 2>&1
353
354	RC=$?
355	if test $RC != 0 ; then
356		echo "ldapsearch failed ($RC)!"
357		test $KILLSERVERS != no && kill -HUP $KILLPIDS
358		exit $RC
359	fi
360
361	echo "Testing rename..."
362	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
363		-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
364version: 1
365
366# Renaming an organization...
367dn: o=An Org,${BASEDN}
368changetype: modrdn
369newrdn: o=Renamed Org
370deleteoldrdn: 1
371
372# Moving a person to another subtree...
373dn: cn=Lev Tolstoij,${BASEDN}
374changetype: modrdn
375newrdn: cn=Lev Tolstoij
376deleteoldrdn: 0
377newsuperior: dc=subnet,${BASEDN}
378
379# Renaming a book...
380dn: documentTitle=book2,${BASEDN}
381changetype: modrdn
382newrdn: documentTitle=Renamed Book
383deleteoldrdn: 1
384EOMODS
385
386	RC=$?
387	if test $RC != 0 ; then
388		echo "ldapmodify failed ($RC)!"
389		test $KILLSERVERS != no && kill -HUP $KILLPIDS
390		exit $RC
391	fi
392
393	echo "Using ldapsearch to retrieve all the entries..."
394	echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
395	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
396		 "objectClass=*" >> $SEARCHOUT 2>&1
397
398	RC=$?
399	if test $RC != 0 ; then
400		echo "ldapsearch failed ($RC)!"
401		test $KILLSERVERS != no && kill -HUP $KILLPIDS
402		exit $RC
403	fi
404
405	echo "Adding a child to a referral (should fail)..."
406	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
407		-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
408version: 1
409
410dn: cn=Should Fail,ou=Referral,${BASEDN}
411changetype: add
412objectClass: inetOrgPerson
413cn: Should Fail
414sn: Fail
415telephoneNumber: +39 02 23456789
416EOMODS
417
418	RC=$?
419	if test $RC = 0 ; then
420		echo "ldapmodify should have failed ($RC)!"
421		test $KILLSERVERS != no && kill -HUP $KILLPIDS
422		exit 1
423	fi
424
425	echo "Modifying a referral (should fail)..."
426	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
427		-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
428version: 1
429
430dn: ou=Referral,${BASEDN}
431changetype: modify
432replace: ref
433ref: ldap://localhost:9009/
434-
435EOMODS
436
437	RC=$?
438	if test $RC = 0 ; then
439		echo "ldapmodify should have failed ($RC)!"
440		test $KILLSERVERS != no && kill -HUP $KILLPIDS
441		exit 1
442	fi
443
444	echo "Renaming a referral (should fail)..."
445	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
446		-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
447version: 1
448
449dn: ou=Referral,${BASEDN}
450changetype: modrdn
451newrdn: ou=Renamed Referral
452deleteoldrdn: 1
453EOMODS
454
455	RC=$?
456	if test $RC = 0 ; then
457		echo "ldapmodify should have failed ($RC)!"
458		test $KILLSERVERS != no && kill -HUP $KILLPIDS
459		exit 1
460	fi
461
462	echo "Deleting a referral (should fail)..."
463	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
464		-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
465version: 1
466
467dn: ou=Referral,${BASEDN}
468changetype: delete
469EOMODS
470
471	RC=$?
472	if test $RC = 0 ; then
473		echo "ldapmodify should have failed ($RC)!"
474		test $KILLSERVERS != no && kill -HUP $KILLPIDS
475		exit 1
476	fi
477
478	echo "Adding a referral..."
479	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
480		-h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS
481version: 1
482
483dn: ou=Another Referral,${BASEDN}
484changetype: add
485objectClass: referral
486objectClass: extensibleObject
487ou: Another Referral
488ref: ldap://localhost:9009/
489EOMODS
490
491	RC=$?
492	if test $RC != 0 ; then
493		echo "ldapmodify failed ($RC)!"
494		test $KILLSERVERS != no && kill -HUP $KILLPIDS
495		exit $RC
496	fi
497
498	echo "Modifying a referral with manageDSAit..."
499	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
500		-h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS
501version: 1
502
503dn: ou=Referral,${BASEDN}
504changetype: modify
505replace: ref
506ref: ldap://localhost:9009/
507-
508EOMODS
509
510	RC=$?
511	if test $RC != 0 ; then
512		echo "ldapmodify failed ($RC)!"
513		test $KILLSERVERS != no && kill -HUP $KILLPIDS
514		exit $RC
515	fi
516
517	echo "Using ldapsearch to retrieve the modified entry..."
518	echo "# Using ldapsearch to retrieve the modified entry..." >> $SEARCHOUT
519	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "ou=Referral,$BASEDN" -M \
520		 "objectClass=*" '*' ref >> $SEARCHOUT 2>&1
521
522	RC=$?
523	if test $RC != 0 ; then
524		echo "ldapsearch failed ($RC)!"
525		test $KILLSERVERS != no && kill -HUP $KILLPIDS
526		exit $RC
527	fi
528
529	echo "Renaming a referral with manageDSAit..."
530	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
531		-h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS
532version: 1
533
534dn: ou=Referral,${BASEDN}
535changetype: modrdn
536newrdn: ou=Renamed Referral
537deleteoldrdn: 1
538EOMODS
539
540	RC=$?
541	if test $RC != 0 ; then
542		echo "ldapmodify failed ($RC)!"
543		test $KILLSERVERS != no && kill -HUP $KILLPIDS
544		exit $RC
545	fi
546
547	echo "Using ldapsearch to retrieve the renamed entry..."
548	echo "# Using ldapsearch to retrieve the renamed entry..." >> $SEARCHOUT
549	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "ou=Renamed Referral,$BASEDN" -M \
550		 "objectClass=*" '*' ref >> $SEARCHOUT 2>&1
551
552	RC=$?
553	if test $RC != 0 ; then
554		echo "ldapsearch failed ($RC)!"
555		test $KILLSERVERS != no && kill -HUP $KILLPIDS
556		exit $RC
557	fi
558
559	echo "Deleting a referral with manageDSAit..."
560	$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
561		-h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS
562version: 1
563
564dn: ou=Renamed Referral,${BASEDN}
565changetype: delete
566EOMODS
567
568	RC=$?
569	if test $RC != 0 ; then
570		echo "ldapmodify failed ($RC)!"
571		test $KILLSERVERS != no && kill -HUP $KILLPIDS
572		exit $RC
573	fi
574
575	BINDDN="cn=Mitya Kovalev,${BASEDN}"
576	BINDPW="mit"
577	NEWPW="newsecret"
578	echo "Testing passwd change..."
579	$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
580		-D "${BINDDN}" -w ${BINDPW} -s ${NEWPW} \
581		"$BINDDN" >> $TESTOUT 2>&1
582
583	RC=$?
584	if test $RC != 0 ; then
585		echo "ldappasswd failed ($RC)!"
586		test $KILLSERVERS != no && kill -HUP $KILLPIDS
587		exit $RC
588	fi
589
590	echo -n "Testing bind with new secret... "
591	$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w $NEWPW
592	RC=$?
593	if test $RC != 0 ; then
594		echo "ldapwhoami failed ($RC)!"
595		test $KILLSERVERS != no && kill -HUP $KILLPIDS
596		exit $RC
597	fi
598
599	BINDDN="cn=Some One,${BASEDN}"
600	BINDPW="someone"
601	echo -n "Testing bind with newly added user... "
602	$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w $BINDPW
603	RC=$?
604	if test $RC != 0 ; then
605		echo "ldapwhoami failed ($RC)!"
606		test $KILLSERVERS != no && kill -HUP $KILLPIDS
607		exit $RC
608	fi
609
610	echo "Using ldapsearch to retrieve all the entries..."
611	echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
612	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
613		 "objectClass=*" >> $SEARCHOUT 2>&1
614
615	RC=$?
616	if test $RC != 0 ; then
617		echo "ldapsearch failed ($RC)!"
618		test $KILLSERVERS != no && kill -HUP $KILLPIDS
619		exit $RC
620	fi
621
622	echo "Filtering ldapsearch results..."
623	$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
624	echo "Filtering modified ldif..."
625	$LDIFFILTER < $SQLWRITE > $LDIFFLT
626	echo "Comparing filter output..."
627	$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
628
629	if test $? != 0 ; then
630		echo "comparison failed - SQL mods search didn't succeed"
631		test $KILLSERVERS != no && kill -HUP $KILLPIDS
632		exit 1
633	fi
634
635	echo "Waiting 25 seconds for master to send changes..."
636	sleep 25
637
638	cat /dev/null > $SEARCHOUT
639
640	echo "Using ldapsearch to retrieve all the entries from the master..."
641	echo "# Using ldapsearch to retrieve all the entries from the master..." \
642		>> $SEARCHOUT
643	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
644		-D "$MANAGERDN" -w $PASSWD \
645		 "(!(objectClass=referral))" >> $SEARCHOUT 2>&1
646
647	RC=$?
648	if test $RC != 0 ; then
649		echo "ldapsearch failed ($RC)!"
650		test $KILLSERVERS != no && kill -HUP $KILLPIDS
651		exit $RC
652	fi
653
654	cat /dev/null > $SEARCHOUT2
655
656	echo "Using ldapsearch to retrieve all the entries from the slave..."
657	echo "# Using ldapsearch to retrieve all the entries from the slave..." \
658		>> $SEARCHOUT2
659	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT2 -b "$BASEDN" \
660		-D "$UPDATEDN" -w $PASSWD \
661		 "(objectClass=*)" >> $SEARCHOUT2 2>&1
662
663	RC=$?
664	if test $RC != 0 ; then
665		echo "ldapsearch failed ($RC)!"
666		test $KILLSERVERS != no && kill -HUP $KILLPIDS
667		exit $RC
668	fi
669
670	echo "Filtering ldapsearch results from master..."
671	$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
672	echo "Filtering ldapsearch results from slave..."
673	$LDIFFILTER < $SEARCHOUT2 > $SEARCHFLT2
674	echo "Comparing filter output..."
675	$CMP $SEARCHFLT $SEARCHFLT2 > $CMPOUT
676
677	if test $? != 0 ; then
678		echo "Comparison failed"
679		test $KILLSERVERS != no && kill -HUP $KILLPIDS
680		exit 1
681	fi
682	;;
683
684*)
685	echo "apparently ${RDBMS} does not support writes; skipping..."
686	;;
687esac
688
689test $KILLSERVERS != no && kill -HUP $KILLPIDS
690
691echo ">>>>> Test succeeded"
692exit 0
693