xref: /netbsd-src/external/bsd/openldap/dist/tests/scripts/test075-dsee-persist (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1*e670fd5cSchristos#! /bin/sh
2*e670fd5cSchristos# $OpenLDAP$
3*e670fd5cSchristos## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4*e670fd5cSchristos##
5*e670fd5cSchristos## Copyright 1998-2021 The OpenLDAP Foundation.
6*e670fd5cSchristos## All rights reserved.
7*e670fd5cSchristos##
8*e670fd5cSchristos## Redistribution and use in source and binary forms, with or without
9*e670fd5cSchristos## modification, are permitted only as authorized by the OpenLDAP
10*e670fd5cSchristos## Public License.
11*e670fd5cSchristos##
12*e670fd5cSchristos## A copy of this license is available in the file LICENSE in the
13*e670fd5cSchristos## top-level directory of the distribution or, alternatively, at
14*e670fd5cSchristos## <http://www.OpenLDAP.org/license.html>.
15*e670fd5cSchristos
16*e670fd5cSchristosecho "running defines.sh"
17*e670fd5cSchristos. $SRCDIR/scripts/defines.sh
18*e670fd5cSchristos
19*e670fd5cSchristosOPATTRS="creatorsName createTimestamp modifiersName modifyTimestamp"
20*e670fd5cSchristos
21*e670fd5cSchristosDSADM=`command -v dsadm`
22*e670fd5cSchristosif test -z "$DSADM"; then
23*e670fd5cSchristos	echo "DSEE dsadm not in path, test skipped"
24*e670fd5cSchristos	exit 0
25*e670fd5cSchristosfi
26*e670fd5cSchristos
27*e670fd5cSchristosmkdir -p $TESTDIR $DBDIR4
28*e670fd5cSchristos
29*e670fd5cSchristos#
30*e670fd5cSchristos# Test replication:
31*e670fd5cSchristos# - start provider
32*e670fd5cSchristos# - start consumer
33*e670fd5cSchristos# - populate over ldap
34*e670fd5cSchristos# - perform some modifies and deleted
35*e670fd5cSchristos# - attempt to modify the consumer (referral or chain)
36*e670fd5cSchristos# - retrieve database over ldap and compare against expected results
37*e670fd5cSchristos#
38*e670fd5cSchristos
39*e670fd5cSchristosDSEEPW=secret21
40*e670fd5cSchristosDSEEDN="cn=Directory Manager"
41*e670fd5cSchristosDSEEPWF=$TESTDIR/dseepw
42*e670fd5cSchristos
43*e670fd5cSchristosecho "secret21" > $DSEEPWF
44*e670fd5cSchristos
45*e670fd5cSchristosecho "Setting up DSEE provider slapd on TCP/IP port $PORT1..."
46*e670fd5cSchristosdsadm create -p $PORT1 -w $DSEEPWF $DBDIR1
47*e670fd5cSchristosdsadm start $DBDIR1
48*e670fd5cSchristosdsconf create-suffix -c -p $PORT1 -w $DSEEPWF $BASEDN
49*e670fd5cSchristosdsconf set-server-prop -p $PORT1 -w $DSEEPWF moddn-enabled:on
50*e670fd5cSchristosdsconf set-server-prop -p $PORT1 -w $DSEEPWF retro-cl-enabled:on
51*e670fd5cSchristosdsadm restart $DBDIR1
52*e670fd5cSchristosPID=`basename $DBDIR1/locks/server/*`
53*e670fd5cSchristosKILLPIDS="$PID"
54*e670fd5cSchristos
55*e670fd5cSchristossleep 1
56*e670fd5cSchristos
57*e670fd5cSchristosecho "Using ldapsearch to check that provider slapd is running..."
58*e670fd5cSchristosfor i in 0 1 2 3 4 5; do
59*e670fd5cSchristos	$LDAPSEARCH -s base -b "$BASEDN" -H $URI1 \
60*e670fd5cSchristos		'objectclass=*' > /dev/null 2>&1
61*e670fd5cSchristos	RC=$?
62*e670fd5cSchristos	if test $RC = 0 ; then
63*e670fd5cSchristos		break
64*e670fd5cSchristos	fi
65*e670fd5cSchristos	echo "Waiting 5 seconds for slapd to start..."
66*e670fd5cSchristos	sleep 5
67*e670fd5cSchristosdone
68*e670fd5cSchristos
69*e670fd5cSchristosif test $RC != 0 ; then
70*e670fd5cSchristos	echo "ldapsearch failed ($RC)!"
71*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
72*e670fd5cSchristos	exit $RC
73*e670fd5cSchristosfi
74*e670fd5cSchristos
75*e670fd5cSchristosecho "Starting consumer slapd on TCP/IP port $PORT4..."
76*e670fd5cSchristos. $CONFFILTER $BACKEND < $DSEESYNC2CONF > $CONF4
77*e670fd5cSchristos$SLAPD -f $CONF4 -h $URI4 -d $LVL > $LOG4 2>&1 &
78*e670fd5cSchristosCONSUMERPID=$!
79*e670fd5cSchristosif test $WAIT != 0 ; then
80*e670fd5cSchristos    echo CONSUMERPID $CONSUMERPID
81*e670fd5cSchristos    read foo
82*e670fd5cSchristosfi
83*e670fd5cSchristosKILLPIDS="$KILLPIDS $CONSUMERPID"
84*e670fd5cSchristos
85*e670fd5cSchristossleep 1
86*e670fd5cSchristos
87*e670fd5cSchristosecho "Using ldapsearch to check that consumer slapd is running..."
88*e670fd5cSchristosfor i in 0 1 2 3 4 5; do
89*e670fd5cSchristos	$LDAPSEARCH -s base -b "$MONITOR" -H $URI4 \
90*e670fd5cSchristos		'objectclass=*' > /dev/null 2>&1
91*e670fd5cSchristos	RC=$?
92*e670fd5cSchristos	if test $RC = 0 ; then
93*e670fd5cSchristos		break
94*e670fd5cSchristos	fi
95*e670fd5cSchristos	echo "Waiting 5 seconds for slapd to start..."
96*e670fd5cSchristos	sleep 5
97*e670fd5cSchristosdone
98*e670fd5cSchristos
99*e670fd5cSchristosif test $RC != 0 ; then
100*e670fd5cSchristos	echo "ldapsearch failed ($RC)!"
101*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
102*e670fd5cSchristos	exit $RC
103*e670fd5cSchristosfi
104*e670fd5cSchristos
105*e670fd5cSchristos# using LDIFDIRSYNCNOCP to avoid custom OpenLDAP schema
106*e670fd5cSchristosecho "Using ldapadd to populate the provider directory..."
107*e670fd5cSchristos$LDAPADD -D "$DSEEDN" -H $URI1 -w $DSEEPW < \
108*e670fd5cSchristos	$LDIFDIRSYNCNOCP > /dev/null 2>&1
109*e670fd5cSchristosRC=$?
110*e670fd5cSchristosif test $RC != 0 ; then
111*e670fd5cSchristos	echo "ldapadd failed ($RC)!"
112*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
113*e670fd5cSchristos	exit $RC
114*e670fd5cSchristosfi
115*e670fd5cSchristos
116*e670fd5cSchristosecho "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
117*e670fd5cSchristossleep $SLEEP1
118*e670fd5cSchristos
119*e670fd5cSchristosecho "Using ldapsearch to read all the entries from the provider..."
120*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \
121*e670fd5cSchristos	-D "$DSEEDN" -w "$DSEEPW" \
122*e670fd5cSchristos	'(objectclass=*)' '*' $OPATTRS > $PROVIDEROUT 2>&1
123*e670fd5cSchristosRC=$?
124*e670fd5cSchristos
125*e670fd5cSchristosif test $RC != 0 ; then
126*e670fd5cSchristos	echo "ldapsearch failed at provider ($RC)!"
127*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
128*e670fd5cSchristos	exit $RC
129*e670fd5cSchristosfi
130*e670fd5cSchristos
131*e670fd5cSchristosecho "Using ldapsearch to read all the entries from the consumer..."
132*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI4 \
133*e670fd5cSchristos	'(objectclass=*)' '*' $OPATTRS > $CONSUMEROUT 2>&1
134*e670fd5cSchristosRC=$?
135*e670fd5cSchristos
136*e670fd5cSchristosif test $RC != 0 ; then
137*e670fd5cSchristos	echo "ldapsearch failed at consumer ($RC)!"
138*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
139*e670fd5cSchristos	exit $RC
140*e670fd5cSchristosfi
141*e670fd5cSchristos
142*e670fd5cSchristosecho "Filtering provider results..."
143*e670fd5cSchristos$LDIFFILTER -s a < $PROVIDEROUT > $PROVIDERFLT
144*e670fd5cSchristosecho "Filtering consumer results..."
145*e670fd5cSchristos$LDIFFILTER -s a < $CONSUMEROUT > $CONSUMERFLT
146*e670fd5cSchristos
147*e670fd5cSchristosecho "Comparing retrieved entries from provider and consumer..."
148*e670fd5cSchristos$CMP $PROVIDERFLT $CONSUMERFLT > $CMPOUT
149*e670fd5cSchristos
150*e670fd5cSchristosif test $? != 0 ; then
151*e670fd5cSchristos	echo "test failed - provider and consumer databases differ"
152*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
153*e670fd5cSchristos	exit 1
154*e670fd5cSchristosfi
155*e670fd5cSchristos
156*e670fd5cSchristosecho "Stopping the provider, sleeping 10 seconds and restarting it..."
157*e670fd5cSchristoskill -HUP "$PID"
158*e670fd5cSchristoswait $PID
159*e670fd5cSchristossleep 10
160*e670fd5cSchristosecho "RESTART" >> $LOG1
161*e670fd5cSchristosdsadm start $DBDIR1
162*e670fd5cSchristosPID=`basename $DBDIR1/locks/server/*`
163*e670fd5cSchristosif test $WAIT != 0 ; then
164*e670fd5cSchristos    echo PID $PID
165*e670fd5cSchristos    read foo
166*e670fd5cSchristosfi
167*e670fd5cSchristosKILLPIDS="$PID $CONSUMERPID"
168*e670fd5cSchristos
169*e670fd5cSchristossleep 1
170*e670fd5cSchristos
171*e670fd5cSchristosecho "Using ldapsearch to check that provider slapd is running..."
172*e670fd5cSchristosfor i in 0 1 2 3 4 5; do
173*e670fd5cSchristos	$LDAPSEARCH -s base -b "$BASEDN" -H $URI1 \
174*e670fd5cSchristos		'objectclass=*' > /dev/null 2>&1
175*e670fd5cSchristos	RC=$?
176*e670fd5cSchristos	if test $RC = 0 ; then
177*e670fd5cSchristos		break
178*e670fd5cSchristos	fi
179*e670fd5cSchristos	echo "Waiting 5 seconds for slapd to start..."
180*e670fd5cSchristos	sleep 5
181*e670fd5cSchristosdone
182*e670fd5cSchristos
183*e670fd5cSchristosecho "Waiting $SLEEP1 seconds for consumer to reconnect..."
184*e670fd5cSchristossleep $SLEEP1
185*e670fd5cSchristos
186*e670fd5cSchristosif test $RC != 0 ; then
187*e670fd5cSchristos	echo "ldapsearch failed ($RC)!"
188*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
189*e670fd5cSchristos	exit $RC
190*e670fd5cSchristosfi
191*e670fd5cSchristos
192*e670fd5cSchristosecho "Using ldapmodify to modify provider directory..."
193*e670fd5cSchristos
194*e670fd5cSchristos#
195*e670fd5cSchristos# Do some modifications
196*e670fd5cSchristos#
197*e670fd5cSchristos
198*e670fd5cSchristos$LDAPMODIFY -v -D "$DSEEDN" -H $URI1 -w $DSEEPW > \
199*e670fd5cSchristos	$TESTOUT 2>&1 << EOMODS
200*e670fd5cSchristosdn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
201*e670fd5cSchristoschangetype: modify
202*e670fd5cSchristosadd: carLicense
203*e670fd5cSchristoscarLicense: Orange Juice
204*e670fd5cSchristos-
205*e670fd5cSchristosdelete: sn
206*e670fd5cSchristossn: Jones
207*e670fd5cSchristos-
208*e670fd5cSchristosadd: sn
209*e670fd5cSchristossn: Jones
210*e670fd5cSchristos
211*e670fd5cSchristosdn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
212*e670fd5cSchristoschangetype: modify
213*e670fd5cSchristosreplace: carLicense
214*e670fd5cSchristoscarLicense: Iced Tea
215*e670fd5cSchristos
216*e670fd5cSchristosdn: cn=ITD Staff,ou=Groups,dc=example,dc=com
217*e670fd5cSchristoschangetype: modify
218*e670fd5cSchristosdelete: uniquemember
219*e670fd5cSchristosuniquemember: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
220*e670fd5cSchristosuniquemember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
221*e670fd5cSchristos-
222*e670fd5cSchristosadd: uniquemember
223*e670fd5cSchristosuniquemember: cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example,dc=com
224*e670fd5cSchristosuniquemember: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
225*e670fd5cSchristos
226*e670fd5cSchristosdn: cn=All Staff,ou=Groups,dc=example,dc=com
227*e670fd5cSchristoschangetype: modify
228*e670fd5cSchristosdelete: description
229*e670fd5cSchristos
230*e670fd5cSchristosdn: cn=Gern Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
231*e670fd5cSchristoschangetype: add
232*e670fd5cSchristosobjectclass: inetOrgPerson
233*e670fd5cSchristoscn: Gern Jensen
234*e670fd5cSchristossn: Jensen
235*e670fd5cSchristosuid: gjensen
236*e670fd5cSchristostitle: Chief Investigator, ITD
237*e670fd5cSchristospostaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
238*e670fd5cSchristosseealso: cn=All Staff,ou=Groups,dc=example,dc=com
239*e670fd5cSchristoscarLicense: Coffee
240*e670fd5cSchristoshomepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
241*e670fd5cSchristosdescription: Very odd
242*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 7557
243*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 9998
244*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 9999
245*e670fd5cSchristostelephonenumber: +1 313 555 8343
246*e670fd5cSchristosmail: gjensen@mailgw.example.com
247*e670fd5cSchristoshomephone: +1 313 555 8844
248*e670fd5cSchristos
249*e670fd5cSchristos# modify attribute with no matching rule (ITS#6458)
250*e670fd5cSchristosdn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
251*e670fd5cSchristoschangetype: modify
252*e670fd5cSchristosreplace: facsimiletelephonenumber
253*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 9998
254*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 9999
255*e670fd5cSchristos
256*e670fd5cSchristosdn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
257*e670fd5cSchristoschangetype: modify
258*e670fd5cSchristosreplace: facsimiletelephonenumber
259*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 9998
260*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 9999
261*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 7557
262*e670fd5cSchristos
263*e670fd5cSchristosdn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
264*e670fd5cSchristoschangetype: modify
265*e670fd5cSchristosreplace: facsimiletelephonenumber
266*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 9998
267*e670fd5cSchristosfacsimiletelephonenumber: +1 313 555 9999
268*e670fd5cSchristos
269*e670fd5cSchristosdn: ou=Retired,ou=People,dc=example,dc=com
270*e670fd5cSchristoschangetype: add
271*e670fd5cSchristosobjectclass: organizationalUnit
272*e670fd5cSchristosou: Retired
273*e670fd5cSchristos
274*e670fd5cSchristosdn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
275*e670fd5cSchristoschangetype: add
276*e670fd5cSchristosobjectclass: inetOrgPerson
277*e670fd5cSchristoscn: Rosco P. Coltrane
278*e670fd5cSchristossn: Coltrane
279*e670fd5cSchristosuid: rosco
280*e670fd5cSchristosdescription: Fat tycoon
281*e670fd5cSchristos
282*e670fd5cSchristosdn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
283*e670fd5cSchristoschangetype: modrdn
284*e670fd5cSchristosnewrdn: cn=Rosco P. Coltrane
285*e670fd5cSchristosdeleteoldrdn: 1
286*e670fd5cSchristosnewsuperior: ou=Retired,ou=People,dc=example,dc=com
287*e670fd5cSchristos
288*e670fd5cSchristosdn: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
289*e670fd5cSchristoschangetype: delete
290*e670fd5cSchristos
291*e670fd5cSchristosdn: ou=testdomain1,dc=example,dc=com
292*e670fd5cSchristoschangetype: modrdn
293*e670fd5cSchristosnewrdn: ou=itsdomain1
294*e670fd5cSchristosdeleteoldrdn: 1
295*e670fd5cSchristos
296*e670fd5cSchristosdn: ou=itsdomain1,dc=example,dc=com
297*e670fd5cSchristoschangetype: modify
298*e670fd5cSchristosreplace: description
299*e670fd5cSchristosdescription: Example, Inc. ITS test domain
300*e670fd5cSchristos
301*e670fd5cSchristosdn: ou=testdomain2,dc=example,dc=com
302*e670fd5cSchristoschangetype: modrdn
303*e670fd5cSchristosnewrdn: ou=itsdomain2
304*e670fd5cSchristosdeleteoldrdn: 1
305*e670fd5cSchristos
306*e670fd5cSchristosEOMODS
307*e670fd5cSchristos
308*e670fd5cSchristosRC=$?
309*e670fd5cSchristosif test $RC != 0 ; then
310*e670fd5cSchristos	echo "ldapmodify failed ($RC)!"
311*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
312*e670fd5cSchristos	exit $RC
313*e670fd5cSchristosfi
314*e670fd5cSchristos
315*e670fd5cSchristos## ldappasswd test removed, not supported on DSEE
316*e670fd5cSchristos
317*e670fd5cSchristosecho "Stopping consumer to test recovery..."
318*e670fd5cSchristoskill -HUP $CONSUMERPID
319*e670fd5cSchristoswait $CONSUMERPID
320*e670fd5cSchristos
321*e670fd5cSchristosecho "Modifying more entries on the provider..."
322*e670fd5cSchristos$LDAPMODIFY -v -D "$DSEEDN" -H $URI1 -w $DSEEPW >> \
323*e670fd5cSchristos	$TESTOUT 2>&1 << EOMODS
324*e670fd5cSchristosdn: cn=Rosco P. Coltrane, ou=Retired, ou=People, dc=example,dc=com
325*e670fd5cSchristoschangetype: delete
326*e670fd5cSchristos
327*e670fd5cSchristosdn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
328*e670fd5cSchristoschangetype: modify
329*e670fd5cSchristosadd: carLicense
330*e670fd5cSchristoscarLicense: Mad Dog 20/20
331*e670fd5cSchristos
332*e670fd5cSchristosdn: cn=Rosco P. Coltrane,ou=Retired,ou=People,dc=example,dc=com
333*e670fd5cSchristoschangetype: add
334*e670fd5cSchristosobjectclass: inetOrgPerson
335*e670fd5cSchristossn: Coltrane
336*e670fd5cSchristosuid: rosco
337*e670fd5cSchristoscn: Rosco P. Coltrane
338*e670fd5cSchristos
339*e670fd5cSchristosdn: ou=itsdomain2,dc=example,dc=com
340*e670fd5cSchristoschangetype: modify
341*e670fd5cSchristosreplace: description
342*e670fd5cSchristosdescription: Example, Inc. itsdomain2 test domain
343*e670fd5cSchristos
344*e670fd5cSchristos# rename with a newly added newSuperior while the consumer is down (ITS#6472)
345*e670fd5cSchristosdn: ou=New Branch,dc=example,dc=com
346*e670fd5cSchristoschangetype: add
347*e670fd5cSchristosobjectClass: organizationalUnit
348*e670fd5cSchristosou: New Branch
349*e670fd5cSchristos
350*e670fd5cSchristosdn: cn=Dorothy Stevens, ou=Alumni Association, ou=People, dc=example,dc=com
351*e670fd5cSchristoschangetype: modrdn
352*e670fd5cSchristosnewrdn: cn=Dorothy Stevens
353*e670fd5cSchristosdeleteoldrdn: 0
354*e670fd5cSchristosnewsuperior: ou=New Branch,dc=example,dc=com
355*e670fd5cSchristos
356*e670fd5cSchristosEOMODS
357*e670fd5cSchristos
358*e670fd5cSchristosRC=$?
359*e670fd5cSchristosif test $RC != 0 ; then
360*e670fd5cSchristos	echo "ldapmodify failed ($RC)!"
361*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
362*e670fd5cSchristos	exit $RC
363*e670fd5cSchristosfi
364*e670fd5cSchristos
365*e670fd5cSchristosecho "Restarting consumer..."
366*e670fd5cSchristosecho "RESTART" >> $LOG4
367*e670fd5cSchristos$SLAPD -f $CONF4 -h $URI4 -d $LVL >> $LOG4 2>&1 &
368*e670fd5cSchristosCONSUMERPID=$!
369*e670fd5cSchristosif test $WAIT != 0 ; then
370*e670fd5cSchristos    echo CONSUMERPID $CONSUMERPID
371*e670fd5cSchristos    read foo
372*e670fd5cSchristosfi
373*e670fd5cSchristosKILLPIDS="$PID $CONSUMERPID"
374*e670fd5cSchristos
375*e670fd5cSchristosecho "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
376*e670fd5cSchristossleep $SLEEP1
377*e670fd5cSchristos
378*e670fd5cSchristosecho "Using ldapsearch to read all the entries from the provider..."
379*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \
380*e670fd5cSchristos	-D "$DSEEDN" -w "$DSEEPW" \
381*e670fd5cSchristos	'(objectclass=*)' '*' $OPATTRS > $PROVIDEROUT 2>&1
382*e670fd5cSchristosRC=$?
383*e670fd5cSchristos
384*e670fd5cSchristosif test $RC != 0 ; then
385*e670fd5cSchristos	echo "ldapsearch failed at provider ($RC)!"
386*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
387*e670fd5cSchristos	exit $RC
388*e670fd5cSchristosfi
389*e670fd5cSchristos
390*e670fd5cSchristosecho "Using ldapsearch to read all the entries from the consumer..."
391*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -H $URI4 \
392*e670fd5cSchristos	'(objectclass=*)' '*' $OPATTRS > $CONSUMEROUT 2>&1
393*e670fd5cSchristosRC=$?
394*e670fd5cSchristos
395*e670fd5cSchristosif test $RC != 0 ; then
396*e670fd5cSchristos	echo "ldapsearch failed at consumer ($RC)!"
397*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
398*e670fd5cSchristos	exit $RC
399*e670fd5cSchristosfi
400*e670fd5cSchristos
401*e670fd5cSchristosecho "Filtering provider results..."
402*e670fd5cSchristos$LDIFFILTER -s a < $PROVIDEROUT > $PROVIDERFLT
403*e670fd5cSchristosecho "Filtering consumer results..."
404*e670fd5cSchristos$LDIFFILTER -s a < $CONSUMEROUT > $CONSUMERFLT
405*e670fd5cSchristos
406*e670fd5cSchristosecho "Comparing retrieved entries from provider and consumer..."
407*e670fd5cSchristos$CMP $PROVIDERFLT $CONSUMERFLT > $CMPOUT
408*e670fd5cSchristos
409*e670fd5cSchristosif test $? != 0 ; then
410*e670fd5cSchristos	echo "test failed - provider and consumer databases differ"
411*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
412*e670fd5cSchristos	exit 1
413*e670fd5cSchristosfi
414*e670fd5cSchristos
415*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS
416*e670fd5cSchristos
417*e670fd5cSchristosecho ">>>>> Test succeeded"
418*e670fd5cSchristos
419*e670fd5cSchristostest $KILLSERVERS != no && wait
420*e670fd5cSchristos
421*e670fd5cSchristosexit 0
422