1#! /bin/sh
2# $OpenLDAP$
3## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4##
5## Copyright 1998-2011 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
19echo ""
20
21if test $BACKLDAP = ldapno ; then 
22	echo "ldap backend not available, test skipped"
23	exit 0
24fi
25
26if test $RWM = rwmno ; then 
27	echo "rwm (rewrite/remap) overlay not available, test skipped"
28	exit 0
29fi 
30
31rm -rf $TESTDIR
32
33mkdir -p $TESTDIR $DBDIR1 $DBDIR2
34
35echo "Starting slapd on TCP/IP port $PORT1..."
36. $CONFFILTER $BACKEND $MONITORDB < $METACONF1 > $CONF1
37$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
38PID=$!
39if test $WAIT != 0 ; then
40    echo PID $PID
41    read foo
42fi
43KILLPIDS="$PID"
44
45sleep 1
46
47echo "Using ldapsearch to check that slapd is running..."
48for i in 0 1 2 3 4 5; do
49	$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
50		'objectclass=*' > /dev/null 2>&1
51	RC=$?
52	if test $RC = 0 ; then
53		break
54	fi
55	echo "Waiting 5 seconds for slapd to start..."
56	sleep 5
57done
58if test $RC != 0 ; then
59	echo "ldapsearch failed ($RC)!"
60	test $KILLSERVERS != no && kill -HUP $KILLPIDS
61	exit $RC
62fi
63
64echo "Using ldapadd to populate the database..."
65$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
66	$LDIFORDERED > $TESTOUT 2>&1
67RC=$?
68if test $RC != 0 ; then
69	echo "ldapadd failed ($RC)!"
70	test $KILLSERVERS != no && kill -HUP $KILLPIDS
71	exit $RC
72fi
73
74echo "Starting slapd on TCP/IP port $PORT2..."
75. $CONFFILTER $BACKEND $MONITORDB < $METACONF2 > $CONF2
76$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
77PID=$!
78if test $WAIT != 0 ; then
79    echo PID $PID
80    read foo
81fi
82KILLPIDS="$KILLPIDS $PID"
83
84sleep 1
85
86echo "Using ldapsearch to check that slapd is running..."
87for i in 0 1 2 3 4 5; do
88	$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
89		'objectclass=*' > /dev/null 2>&1
90	RC=$?
91	if test $RC = 0 ; then
92		break
93	fi
94	echo "Waiting 5 seconds for slapd to start..."
95	sleep 5
96done
97if test $RC != 0 ; then
98	echo "ldapsearch failed ($RC)!"
99	test $KILLSERVERS != no && kill -HUP $KILLPIDS
100	exit $RC
101fi
102
103echo "Using ldapadd to populate the database..."
104$LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
105	$LDIFMETA >> $TESTOUT 2>&1
106RC=$?
107if test $RC != 0 ; then
108	echo "ldapadd failed ($RC)!"
109	test $KILLSERVERS != no && kill -HUP $KILLPIDS
110	exit $RC
111fi
112
113echo "Starting slapd on TCP/IP port $PORT3..."
114. $CONFFILTER $BACKEND $MONITORDB < $GLUELDAPCONF > $CONF3
115$SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
116PID=$!
117if test $WAIT != 0 ; then
118    echo PID $PID
119    read foo
120fi
121KILLPIDS="$KILLPIDS $PID"
122
123sleep 1
124
125echo "Using ldapsearch to check that slapd is running..."
126for i in 0 1 2 3 4 5; do
127	$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
128		'objectclass=*' > /dev/null 2>&1
129	RC=$?
130	if test $RC = 0 ; then
131		break
132	fi
133	echo "Waiting 5 seconds for slapd to start..."
134	sleep 5
135done
136if test $RC != 0 ; then
137	echo "ldapsearch failed ($RC)!"
138	test $KILLSERVERS != no && kill -HUP $KILLPIDS
139	exit $RC
140fi
141
142cat /dev/null > $SEARCHOUT
143
144BASEDN="o=Example,c=US"
145echo "Searching base=\"$BASEDN\"..."
146echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
147$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" >> $SEARCHOUT 2>&1
148RC=$?
149#if test $RC != 0 ; then
150#	echo "Search failed ($RC)!"
151#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
152#	exit $RC
153#fi
154case $RC in 
155	0)
156	;;
157	51)
158		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
159		test $KILLSERVERS != no && kill -HUP $KILLPIDS
160		exit 0
161	;;
162	*)
163		echo "Search failed ($RC)!"
164		test $KILLSERVERS != no && kill -HUP $KILLPIDS
165		exit $RC
166	;;
167esac
168
169# ITS#4195: spurious matchedDN when the search scopes the main target,
170# and the searchBase is not present, so that target returns noSuchObject
171BASEDN="ou=Meta,o=Example,c=US"
172echo "Searching base=\"$BASEDN\"..."
173echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
174$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" >> $SEARCHOUT 2>&1
175RC=$?
176#if test $RC != 0 ; then
177#	echo "Search failed ($RC)!"
178#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
179#	exit $RC
180#fi
181case $RC in 
182	0)
183	;;
184	51)
185		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
186		test $KILLSERVERS != no && kill -HUP $KILLPIDS
187		exit 0
188	;;
189	*)
190		echo "Search failed ($RC)!"
191		test $KILLSERVERS != no && kill -HUP $KILLPIDS
192		exit $RC
193	;;
194esac
195
196#
197# Do some modifications
198#
199
200BASEDN="o=Example,c=US"
201echo "Modifying database \"$BASEDN\"..."
202$LDAPMODIFY -v -D "cn=Manager,$BASEDN" -h $LOCALHOST -p $PORT3 -w $PASSWD \
203	-M >> $TESTOUT 2>&1 << EOMODS
204# These operations (updates with objectClass mapping) triggered ITS#3499
205dn: cn=Added Group,ou=Groups,$BASEDN
206changetype: add
207objectClass: groupOfNames
208objectClass: uidObject
209cn: Added Group
210member: cn=Added Group,ou=Groups,$BASEDN
211uid: added
212
213dn: cn=Another Added Group,ou=Groups,$BASEDN
214changetype: add
215objectClass: groupOfNames
216cn: Another Added Group
217member: cn=Added Group,ou=Groups,$BASEDN
218member: cn=Another Added Group,ou=Groups,$BASEDN
219
220dn: cn=Another Added Group,ou=Groups,$BASEDN
221changetype: modify
222add: objectClass
223objectClass: uidObject
224-
225add: uid
226uid: added
227-
228
229dn: cn=Added Group,ou=Groups,$BASEDN
230changetype: modify
231delete: objectClass
232objectClass: uidObject
233-
234delete: uid
235-
236
237dn: ou=Meta,$BASEDN
238changetype: modify
239add: description
240description: added to "ou=Meta,$BASEDN"
241-
242
243dn: ou=Who's going to handle this?,$BASEDN
244changetype: add
245objectClass: organizationalUnit
246ou: Who's going to handle this?
247description: added
248description: will be deleted
249
250dn: ou=Same as above,$BASEDN
251changetype: add
252objectClass: organizationalUnit
253ou: Same as above
254description: added right after "Who's going to handle this?"
255description: will be preserved
256
257dn: ou=Who's going to handle this?,$BASEDN
258changetype: delete
259
260dn: ou=Who's going to handle this?,ou=Meta,$BASEDN
261changetype: add
262objectClass: organizationalUnit
263ou: Who's going to handle this?
264description: added
265description: will be deleted
266
267dn: ou=Same as above,ou=Meta,$BASEDN
268changetype: add
269objectClass: organizationalUnit
270ou: Same as above
271description: added right after "Who's going to handle this?"
272description: will be preserved
273
274dn: cn=Added User,ou=Same as above,ou=Meta,$BASEDN
275changetype: add
276objectClass: inetOrgPerson
277cn: Added User
278sn: User
279userPassword: secret
280
281dn: ou=Who's going to handle this?,ou=Meta,$BASEDN
282changetype: delete
283EOMODS
284
285RC=$?
286#if test $RC != 0 ; then
287#	echo "Modify failed ($RC)!"
288#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
289#	exit $RC
290#fi
291case $RC in 
292	0)
293	;;
294	51)
295		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
296		test $KILLSERVERS != no && kill -HUP $KILLPIDS
297		exit 0
298	;;
299	*)
300		echo "Modify failed ($RC)!"
301		test $KILLSERVERS != no && kill -HUP $KILLPIDS
302		exit $RC
303	;;
304esac
305
306echo "Searching base=\"$BASEDN\"..."
307echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
308$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" >> $SEARCHOUT 2>&1
309RC=$?
310#if test $RC != 0 ; then
311#	echo "Search failed ($RC)!"
312#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
313#	exit $RC
314#fi
315case $RC in 
316	0)
317	;;
318	51)
319		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
320		test $KILLSERVERS != no && kill -HUP $KILLPIDS
321		exit 0
322	;;
323	*)
324		echo "Search failed ($RC)!"
325		test $KILLSERVERS != no && kill -HUP $KILLPIDS
326		exit $RC
327	;;
328esac
329
330BASEDN="o=Example,c=US"
331echo "	base=\"$BASEDN\"..."
332echo "# 	base=\"$BASEDN\"..." >> $SEARCHOUT
333$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" -M "$FILTER" '*' ref \
334	>> $SEARCHOUT 2>&1
335RC=$?
336#if test $RC != 0 ; then
337#	echo "Search failed ($RC)!"
338#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
339#	exit $RC
340#fi
341case $RC in 
342	0)
343	;;
344	51)
345		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
346		test $KILLSERVERS != no && kill -HUP $KILLPIDS
347		exit 0
348	;;
349	*)
350		echo "Search failed ($RC)!"
351		test $KILLSERVERS != no && kill -HUP $KILLPIDS
352		exit $RC
353	;;
354esac
355
356BASEDN="o=Example,c=US"
357FILTER="(seeAlso=cn=all staff,ou=Groups,$BASEDN)"
358echo "Searching filter=\"$FILTER\""
359echo "	attrs=\"seeAlso\""
360echo "	base=\"$BASEDN\"..."
361echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
362echo "# 	attrs=\"seeAlso\"" >> $SEARCHOUT
363echo "# 	base=\"$BASEDN\"..." >> $SEARCHOUT
364$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" "$FILTER" seeAlso \
365	>> $SEARCHOUT 2>&1
366RC=$?
367#if test $RC != 0 ; then
368#	echo "Search failed ($RC)!"
369#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
370#	exit $RC
371#fi
372case $RC in 
373	0)
374	;;
375	51)
376		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
377		test $KILLSERVERS != no && kill -HUP $KILLPIDS
378		exit 0
379	;;
380	*)
381		echo "Search failed ($RC)!"
382		test $KILLSERVERS != no && kill -HUP $KILLPIDS
383		exit $RC
384	;;
385esac
386
387FILTER="(uid=example)"
388echo "Searching filter=\"$FILTER\""
389echo "	attrs=\"uid\""
390echo "	base=\"$BASEDN\"..."
391echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
392echo "# 	attrs=\"uid\"" >> $SEARCHOUT
393echo "# 	base=\"$BASEDN\"..." >> $SEARCHOUT
394$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" "$FILTER" uid \
395	>> $SEARCHOUT 2>&1
396RC=$?
397#if test $RC != 0 ; then
398#	echo "Search failed ($RC)!"
399#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
400#	exit $RC
401#fi
402case $RC in 
403	0)
404	;;
405	51)
406		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
407		test $KILLSERVERS != no && kill -HUP $KILLPIDS
408		exit 0
409	;;
410	*)
411		echo "Search failed ($RC)!"
412		test $KILLSERVERS != no && kill -HUP $KILLPIDS
413		exit $RC
414	;;
415esac
416
417FILTER="(member=cn=Another Added Group,ou=Groups,$BASEDN)"
418echo "Searching filter=\"$FILTER\""
419echo "	attrs=\"member\""
420echo "	base=\"$BASEDN\"..."
421echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
422echo "# 	attrs=\"member\"" >> $SEARCHOUT
423echo "# 	base=\"$BASEDN\"..." >> $SEARCHOUT
424$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" "$FILTER" member \
425	>> $SEARCHOUT 2>&1
426RC=$?
427#if test $RC != 0 ; then
428#	echo "Search failed ($RC)!"
429#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
430#	exit $RC
431#fi
432case $RC in 
433	0)
434	;;
435	51)
436		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
437		test $KILLSERVERS != no && kill -HUP $KILLPIDS
438		exit 0
439	;;
440	*)
441		echo "Search failed ($RC)!"
442		test $KILLSERVERS != no && kill -HUP $KILLPIDS
443		exit $RC
444	;;
445esac
446
447echo "Waiting 10 seconds for cached connections to timeout..."
448sleep 10
449
450echo "Searching with a timed out connection..."
451echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
452echo "# 	attrs=\"member\"" >> $SEARCHOUT
453echo "# 	base=\"$BASEDN\"" >> $SEARCHOUT
454echo "# 	with a timed out connection..." >> $SEARCHOUT
455$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -D "cn=Manager,$BASEDN" -w $PASSWD \
456	-b "$BASEDN" "$FILTER" member \
457	>> $SEARCHOUT 2>&1
458RC=$?
459#if test $RC != 0 ; then
460#	echo "Search failed ($RC)!"
461#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
462#	exit $RC
463#fi
464case $RC in 
465	0)
466	;;
467	51)
468		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
469		test $KILLSERVERS != no && kill -HUP $KILLPIDS
470		exit 0
471	;;
472	*)
473		echo "Search failed ($RC)!"
474		test $KILLSERVERS != no && kill -HUP $KILLPIDS
475		exit $RC
476	;;
477esac
478
479# NOTE: cannot send to $SEARCHOUT because the returned entries
480# are not predictable...
481echo "Checking server-enforced size limit..."
482echo "# Checking server-enforced size limit..." >> $SEARCHOUT
483$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 \
484	-D "cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN" -w bjorn \
485	-b "$BASEDN" "(objectClass=*)" 1.1 \
486	>> $TESTOUT 2>&1
487RC=$?
488case $RC,$BACKEND in
489	4,* | 0,null)
490	;;
491	0,*)
492		echo "Search should have failed ($RC)!"
493		test $KILLSERVERS != no && kill -HUP $KILLPIDS
494		exit -1
495	;;
496	*)
497		echo "Search failed ($RC)!"
498		test $KILLSERVERS != no && kill -HUP $KILLPIDS
499		exit $RC
500	;;
501esac
502
503# NOTE: cannot send to $SEARCHOUT because the returned entries
504# are not predictable...
505echo "Checking client-requested size limit..."
506echo "# Checking client-requested size limit..." >> $SEARCHOUT
507$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 \
508	-D "cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN" -w bjorn \
509	-b "$BASEDN" -z 2 "(objectClass=*)" 1.1 \
510	>> $TESTOUT 2>&1
511RC=$?
512case $RC,$BACKEND in
513	4,* | 0,null)
514	;;
515	0,*)
516		echo "Search should have failed ($RC)!"
517		test $KILLSERVERS != no && kill -HUP $KILLPIDS
518		exit -1
519	;;
520	*)
521		echo "Search failed ($RC)!"
522		test $KILLSERVERS != no && kill -HUP $KILLPIDS
523		exit $RC
524	;;
525esac
526
527echo "Filtering ldapsearch results..."
528$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
529echo "Filtering original ldif used to create database..."
530$LDIFFILTER < $METAOUT > $LDIFFLT
531echo "Comparing filter output..."
532$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
533	
534if test $? != 0 ; then
535	echo "comparison failed - meta search/modification didn't succeed"
536	test $KILLSERVERS != no && kill -HUP $KILLPIDS
537	exit 1
538fi
539
540# ITS#4458 needs patch to slapo-rwm for global rewriting of passwd_exop
541BASEDN="o=Example,c=US"
542echo "Changing password to database \"$BASEDN\"..."
543$LDAPPASSWD -h $LOCALHOST -p $PORT3 -D "cn=Manager,$BASEDN" -w $PASSWD \
544	-s $PASSWD "cn=Ursula Hampster,ou=Alumni Association,ou=People,$BASEDN" \
545	>> $TESTOUT 2>&1
546RC=$?
547#if test $RC != 0 ; then
548#	echo "Passwd ExOp failed ($RC)!"
549#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
550#	exit $RC
551#fi
552case $RC in 
553	0)
554	;;
555#	51)
556#		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
557#		test $KILLSERVERS != no && kill -HUP $KILLPIDS
558#		exit 0
559#	;;
560#	80)
561	1)
562		echo "Passwd ExOp failed ($RC)! ITS#4458?"
563		;;
564	*)
565		echo "Passwd ExOp failed ($RC)!"
566		test $KILLSERVERS != no && kill -HUP $KILLPIDS
567		exit $RC
568	;;
569esac
570
571if test $RC = 0 ; then
572	echo "Binding with newly changed password to database \"$BASEDN\"..."
573	$LDAPWHOAMI -h $LOCALHOST -p $PORT3 \
574		-D "cn=Ursula Hampster,ou=Alumni Association,ou=People,$BASEDN" \
575		-w $PASSWD >> $TESTOUT 2>&1
576	RC=$?
577	#if test $RC != 0 ; then
578	#	echo "WhoAmI failed ($RC)!"
579	#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
580	#	exit $RC
581	#fi
582	case $RC in 
583		0)
584		;;
585		51)
586			echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
587		;;
588		*)
589			echo "WhoAmI failed ($RC)!"
590			test $KILLSERVERS != no && kill -HUP $KILLPIDS
591			exit $RC
592		;;
593	esac
594fi
595
596echo "Binding as newly added user to database \"$BASEDN\"..."
597$LDAPWHOAMI -h $LOCALHOST -p $PORT3 \
598	-D "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \
599	-w $PASSWD >> $TESTOUT 2>&1
600RC=$?
601#if test $RC != 0 ; then
602#	echo "WhoAmI failed ($RC)!"
603#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
604#	exit $RC
605#fi
606case $RC in 
607	0)
608	;;
609	51)
610		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
611	;;
612	*)
613		echo "WhoAmI failed ($RC)!"
614		test $KILLSERVERS != no && kill -HUP $KILLPIDS
615		exit $RC
616	;;
617esac
618
619echo "Changing password to database \"$BASEDN\"..."
620$LDAPPASSWD -h $LOCALHOST -p $PORT3 -D "cn=Manager,$BASEDN" -w $PASSWD \
621	-s meta "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \
622	>> $TESTOUT 2>&1
623RC=$?
624#if test $RC != 0 ; then
625#	echo "Passwd ExOp failed ($RC)!"
626#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
627#	exit $RC
628#fi
629case $RC in 
630	0)
631	;;
632#	51)
633#		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
634#		test $KILLSERVERS != no && kill -HUP $KILLPIDS
635#		exit 0
636#	;;
637#	80)
638	1)
639		echo "Passwd ExOp failed ($RC)! ITS#4458?"
640		;;
641	*)
642		echo "Passwd ExOp failed ($RC)!"
643		test $KILLSERVERS != no && kill -HUP $KILLPIDS
644		exit $RC
645	;;
646esac
647
648if test $RC = 0 ; then
649	echo "Binding with newly changed password to database \"$BASEDN\"..."
650	$LDAPWHOAMI -h $LOCALHOST -p $PORT3 \
651		-D "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \
652		-w meta >> $TESTOUT 2>&1
653	RC=$?
654	#if test $RC != 0 ; then
655	#	echo "WhoAmI failed ($RC)!"
656	#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
657	#	exit $RC
658	#fi
659	case $RC in 
660		0)
661		;;
662		51)
663			echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
664		;;
665		*)
666			echo "WhoAmI failed ($RC)!"
667			test $KILLSERVERS != no && kill -HUP $KILLPIDS
668			exit $RC
669		;;
670	esac
671fi
672
673echo "Binding with incorrect password to database \"$BASEDN\"..."
674$LDAPWHOAMI -h $LOCALHOST -p $PORT3 \
675	-D "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \
676	-w bogus >> $TESTOUT 2>&1
677RC=$?
678#if test $RC != 0 ; then
679#	echo "WhoAmI failed ($RC)!"
680#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
681#	exit $RC
682#fi
683case $RC,$BACKEND in
684	0,null)
685	;;
686	0,*)
687		echo "WhoAmI should have failed ($RC)!"
688		test $KILLSERVERS != no && kill -HUP $KILLPIDS
689		exit -1
690	;;
691	51,*)
692		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
693	;;
694	*)
695	;;
696esac
697
698echo "Binding with non-existing user to database \"$BASEDN\"..."
699$LDAPWHOAMI -h $LOCALHOST -p $PORT3 \
700	-D "cn=Non-existing User,ou=Same as above,ou=Meta,$BASEDN" \
701	-w bogus >> $TESTOUT 2>&1
702RC=$?
703#if test $RC != 0 ; then
704#	echo "WhoAmI failed ($RC)!"
705#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
706#	exit $RC
707#fi
708case $RC,$BACKEND in
709	0,null)
710	;;
711	0,*)
712		echo "WhoAmI should have failed ($RC)!"
713		test $KILLSERVERS != no && kill -HUP $KILLPIDS
714		exit -1
715	;;
716	51,*)
717		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
718	;;
719	*)
720	;;
721esac
722
723echo "Comparing to database \"$BASEDN\"..."
724$LDAPCOMPARE -h $LOCALHOST -p $PORT3 \
725	"cn=Another Added Group,ou=Groups,$BASEDN" \
726	"member:cn=Added Group,ou=Groups,$BASEDN" >> $TESTOUT 2>&1
727RC=$?
728#if test $RC != 6 ; then
729#	echo "Compare failed ($RC)!"
730#	test $KILLSERVERS != no && kill -HUP $KILLPIDS
731#	exit -1
732#fi
733case $RC,$BACKEND in
734	5,null)
735	;;
736	6,*)
737	;;
738	51,*)
739		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
740	;;
741	*)
742		echo "Compare failed ($RC)!"
743		test $KILLSERVERS != no && kill -HUP $KILLPIDS
744		exit 1
745	;;
746esac
747
748test $KILLSERVERS != no && kill -HUP $KILLPIDS
749
750echo ">>>>> Test succeeded"
751
752test $KILLSERVERS != no && wait
753
754exit 0
755