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