]> git.sur5r.net Git - openldap/blob - tests/scripts/test034-translucent
79eb72425db1c2d1a44998908d1758769eabbd53
[openldap] / tests / scripts / test034-translucent
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 2004-2007 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 PERSONAL="(objectClass=inetOrgPerson)"
20 NOWHERE="/dev/null"
21 FAILURE="additional info:"
22
23 if test $TRANSLUCENT = translucentno ; then 
24         echo "Translucent Proxy overlay not available, test skipped"
25         exit 0
26 fi 
27
28 if test $AC_ldap = ldapno ; then
29         echo "Translucent Proxy overlay requires back-ldap backend, test skipped"
30         exit 0
31 fi
32
33 # configure backside
34 mkdir -p $TESTDIR $DBDIR1
35
36 $SLAPPASSWD -g -n >$CONFIGPWF
37 echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf
38
39 . $CONFFILTER $BACKEND $MONITORDB < $TRANSLUCENTREMOTECONF > $CONF1
40 echo "Running slapadd to build remote slapd database..."
41 $SLAPADD -f $CONF1 -l $LDIFTRANSLUCENTCONFIG
42 RC=$?
43 if test $RC != 0 ; then
44         echo "slapadd failed ($RC)!"
45         exit $RC
46 fi
47
48 echo "Starting remote slapd on TCP/IP port $PORT1..."
49 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
50 PID=$!
51 if test $WAIT != 0 ; then
52     echo PID $PID
53     read foo
54 fi
55 REMOTEPID="$PID"
56 KILLPIDS="$PID"
57
58 sleep 1
59
60 for i in 0 1 2 3 4 5; do
61         $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \
62                 'objectclass=*' > /dev/null 2>&1
63         RC=$?
64         if test $RC = 0 ; then
65                 break
66         fi
67         echo "Waiting 5 seconds for remote slapd to start..."
68         sleep 5
69 done
70
71 if test $RC != 0 ; then
72         echo "ldapsearch failed ($RC)!"
73         test $KILLSERVERS != no && kill -HUP $KILLPIDS
74         exit $RC
75 fi
76
77 # configure frontside
78 mkdir -p $DBDIR2
79
80 . $CONFFILTER $BACKEND $MONITORDB < $TRANSLUCENTLOCALCONF > $CONF2
81
82 echo "Starting local slapd on TCP/IP port $PORT2..."
83 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
84 PID=$!
85 if test $WAIT != 0 ; then
86     echo PID $PID
87     read foo
88 fi
89 LOCALPID="$PID"
90 KILLPIDS="$LOCALPID $REMOTEPID"
91
92 sleep 1
93
94 for i in 0 1 2 3 4 5; do
95         $LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \
96                 'objectclass=*' > /dev/null 2>&1
97         RC=$?
98         if test $RC = 0 ; then
99                 break
100         fi
101         echo "Waiting 5 seconds for local slapd to start..."
102         sleep 5
103 done
104
105 if test $RC != 0 ; then
106         echo "ldapsearch failed ($RC)!"
107         test $KILLSERVERS != no && kill -HUP $KILLPIDS
108         exit $RC
109 fi
110
111 echo "Testing slapd Translucent Proxy operations..."
112
113 echo "Testing search: no remote data defined..."
114
115 $LDAPSEARCH -H $URI2 -b "$TRANSLUCENTUSER" "$PERSONAL" >$SEARCHOUT 2>&1
116
117 RC=$?
118 if test $RC != 0 ; then
119         echo "ldapsearch failed ($RC)!"
120         test $KILLSERVERS != no && kill -HUP $KILLPIDS
121         exit $RC
122 fi
123
124 if test -s $SEARCHOUT; then
125         echo "ldapsearch should have returned no records!"
126         test $KILLSERVERS != no && kill -HUP $KILLPIDS
127         exit 1
128 fi
129
130 echo "Populating remote database..."
131
132 $LDAPADD -D "$TRANSLUCENTROOT" -H $URI1 \
133         -w $PASSWD < $LDIFTRANSLUCENTDATA > $NOWHERE 2>&1
134
135 RC=$?
136 if test $RC != 0 ; then
137         echo "ldapadd failed ($RC)!"
138         test $KILLSERVERS != no && kill -HUP $KILLPIDS
139         exit $RC
140 fi
141
142 echo "Testing search: remote database via local slapd..."
143
144 $LDAPSEARCH -H $URI2 -b "$TRANSLUCENTUSER" "$PERSONAL" > $SEARCHOUT 2>&1
145
146 RC=$?
147 if test $RC != 0 ; then
148         echo "ldapsearch failed ($RC)!"
149         test $KILLSERVERS != no && kill -HUP $KILLPIDS
150         exit $RC
151 fi
152
153 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
154 . $LDIFFILTER < $LDIFTRANSLUCENTDATA > $LDIFFLT
155 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
156
157 if test $? != 0 ; then
158         echo "Comparison failed -- corruption from remote to local!"
159         test $KILLSERVERS != no && kill -HUP $KILLPIDS
160         exit 1
161 fi
162
163 echo "Testing add: prohibited local record..."
164
165 $LDAPADD -D "$TRANSLUCENTDN" -H $URI2 \
166         -w $TRANSLUCENTPASSWD < $LDIFTRANSLUCENTADD > $TESTOUT 2>&1
167
168 RC=$?
169 if test $RC != 50 ; then
170         echo "ldapadd failed ($RC), expected INSUFFICIENT ACCESS!"
171         grep "$FAILURE" $TESTOUT
172         test $KILLSERVERS != no && kill -HUP $KILLPIDS
173         exit 1
174 fi
175
176 echo "Testing add: valid local record, no_glue..."
177
178 $LDAPADD -v -v -v -D "$TRANSLUCENTROOT" -H $URI2 \
179         -w $PASSWD < $LDIFTRANSLUCENTADD > $TESTOUT 2>&1
180
181 RC=$?
182 if test $RC != 32 ; then
183         echo "ldapadd failed ($RC), expected NO SUCH OBJECT!"
184         grep "$FAILURE" $TESTOUT
185         test $KILLSERVERS != no && kill -HUP $KILLPIDS
186         exit 1
187 fi
188
189 echo "Testing modrdn: valid local record, no_glue..."
190
191 $LDAPMODRDN -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
192         $TESTOUT 2>&1 'uid=fred,ou=users,o=translucent' 'uid=someguy'
193
194 RC=$?
195 if test $RC != 32 ; then
196         echo "ldapmodrdn failed ($RC), expected NO SUCH OBJECT!"
197         grep "$FAILURE" $TESTOUT
198         test $KILLSERVERS != no && kill -HUP $KILLPIDS
199         exit 1
200 fi
201
202 echo "Dynamically configuring local slapd without translucent_no_glue..."
203
204 $LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF
205 dn: olcOverlay={0}translucent,olcDatabase={2}$BACKEND,cn=config
206 changetype: modify
207 replace: olcTranslucentNoGlue
208 olcTranslucentNoGlue: FALSE
209 EOF
210 RC=$?
211 if test $RC != 0 ; then
212     echo "ldapmodify of dynamic config failed ($RC)"
213     test $KILLSERVERS != no && kill -HUP $KILLPIDS
214     exit 1
215 fi
216
217 echo "Testing add: valid local record..."
218
219 $LDAPADD -D "$TRANSLUCENTROOT" -H $URI2 \
220         -w $PASSWD < $LDIFTRANSLUCENTADD > $TESTOUT 2>&1
221
222 RC=$?
223 if test $RC != 0 ; then
224         echo "ldapadd failed ($RC)!"
225         grep "$FAILURE" $TESTOUT
226         test $KILLSERVERS != no && kill -HUP $KILLPIDS
227         exit $RC
228 fi
229
230 echo "Testing search: data merging..."
231
232 $LDAPSEARCH -H $URI2 -b "$TRANSLUCENTUSER" "$PERSONAL" > $SEARCHOUT 2>&1
233
234 RC=$?
235 if test $RC != 0 ; then
236         echo "ldapsearch failed ($RC)!"
237         test $KILLSERVERS != no && kill -HUP $KILLPIDS
238         exit $RC
239 fi
240
241 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
242 $CMP $SEARCHFLT $LDIFTRANSLUCENTMERGED > $CMPOUT
243
244 if test $? != 0 ; then
245         echo "Comparison failed -- local data failed to merge with remote!"
246         test $KILLSERVERS != no && kill -HUP $KILLPIDS
247         exit 1
248 fi
249
250 echo "Testing compare: valid local..."
251
252 $LDAPCOMPARE -z -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
253         "uid=danger,ou=users,o=translucent" "carLicense:LIVID"
254
255 RC=$?
256 if test $RC != 6 ; then
257         echo "ldapcompare failed ($RC), expected TRUE!"
258         test $KILLSERVERS != no && kill -HUP $KILLPIDS
259         exit 1
260 fi
261
262 echo "Testing compare: valid remote..."
263
264 $LDAPCOMPARE -z -x -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
265         "uid=binder,o=translucent" "businessCategory:binder-test-user"
266
267 RC=$?
268 if test $RC != 6 ; then
269         echo "ldapcompare failed ($RC), expected TRUE!"
270         test $KILLSERVERS != no && kill -HUP $KILLPIDS
271         exit 1
272 fi
273
274 echo "Testing compare: bogus local..."
275
276 $LDAPCOMPARE -z -x -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
277         "uid=danger,ou=users,o=translucent" "businessCategory:invalid-test-value"
278
279 RC=$?
280 if test $RC != 5 ; then
281         echo "ldapcompare failed ($RC), expected FALSE!"
282         test $KILLSERVERS != no && kill -HUP $KILLPIDS
283         exit 1
284 fi
285
286 echo "Testing compare: bogus remote..."
287
288 $LDAPCOMPARE -z -x -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
289         "uid=binder,o=translucent" "businessCategory:invalid-test-value"
290
291 RC=$?
292 if test $RC != 5 ; then
293         echo "ldapcompare failed ($RC), expected FALSE!"
294         test $KILLSERVERS != no && kill -HUP $KILLPIDS
295         exit 1
296 fi
297
298 echo "Testing modify: nonexistent record..."
299
300 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
301         $TESTOUT 2>&1 << EOF_MOD
302 version: 1
303 dn: uid=bogus,ou=users,o=translucent
304 changetype: modify
305 replace: roomNumber
306 roomNumber: 31J-2112
307 EOF_MOD
308
309 RC=$?
310 if test $RC != 32 ; then
311         echo "ldapmodify failed ($RC), expected NO SUCH OBJECT!"
312         grep "$FAILURE" $TESTOUT
313         test $KILLSERVERS != no && kill -HUP $KILLPIDS
314         exit 1
315 fi
316
317 echo "Testing modify: valid local record, nonexistent attribute..."
318
319 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
320         $TESTOUT 2>&1 << EOF_MOD1
321 version: 1
322 dn: uid=danger,ou=users,o=translucent
323 changetype: modify
324 replace: roomNumber
325 roomNumber: 9N-21
326 EOF_MOD1
327
328 RC=$?
329 if test $RC != 0 ; then
330         echo "ldapmodify failed ($RC)!"
331         grep "$FAILURE" $TESTOUT
332         test $KILLSERVERS != no && kill -HUP $KILLPIDS
333         exit $RC
334 fi
335
336 $LDAPSEARCH -H $URI2 -b "uid=danger,ou=users,o=translucent" > $SEARCHOUT 2>&1
337
338 RC=$?
339 if test $RC != 0 ; then
340         echo "ldapsearch failed ($RC)!"
341         test $KILLSERVERS != no && kill -HUP $KILLPIDS
342         exit $RC
343 fi
344
345 ATTR=`grep roomNumber $SEARCHOUT` > $NOWHERE 2>&1
346 if test "$ATTR" != "roomNumber: 9N-21" ; then
347         echo "modification failed!"
348         test $KILLSERVERS != no && kill -HUP $KILLPIDS
349         exit 1
350 fi
351
352 echo "Testing search: specific nonexistent remote attribute..."
353
354 $LDAPSEARCH -H $URI2 -b "uid=danger,ou=users,o=translucent" roomNumber > $SEARCHOUT 2>&1
355
356 RC=$?
357 if test $RC != 0 ; then
358         echo "ldapsearch failed ($RC)!"
359         test $KILLSERVERS != no && kill -HUP $KILLPIDS
360         exit $RC
361 fi
362
363 echo "Testing modify: nonexistent local record, nonexistent attribute..."
364
365 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
366         $TESTOUT 2>&1 << EOF_MOD2
367 version: 1
368 dn: uid=fred,ou=users,o=translucent
369 changetype: modify
370 replace: roomNumber
371 roomNumber: 31J-2112
372 EOF_MOD2
373
374 RC=$?
375 if test $RC != 0 ; then
376         echo "ldapmodify failed ($RC)!"
377         grep "$FAILURE" $TESTOUT
378         test $KILLSERVERS != no && kill -HUP $KILLPIDS
379         exit $RC
380 fi
381
382 $LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
383
384 RC=$?
385 if test $RC != 0 ; then
386         echo "ldapsearch failed ($RC)!"
387         test $KILLSERVERS != no && kill -HUP $KILLPIDS
388         exit $RC
389 fi
390
391 ATTR=`grep roomNumber $SEARCHOUT` > $NOWHERE 2>&1
392 if test "$ATTR" != "roomNumber: 31J-2112" ; then
393         echo "modification failed!"
394         test $KILLSERVERS != no && kill -HUP $KILLPIDS
395         exit 1
396 fi
397
398 echo "Testing modify: valid remote record, nonexistent attribute..."
399
400 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
401         $TESTOUT 2>&1 << EOF_MOD9
402 version: 1
403 dn: uid=fred,ou=users,o=translucent
404 changetype: modify
405 delete: preferredLanguage
406 EOF_MOD9
407
408 RC=$?
409 if test $RC != 16 ; then
410         echo "ldapmodify failed ($RC), expected NO SUCH ATTRIBUTE!"
411         grep "$FAILURE" $TESTOUT
412         test $KILLSERVERS != no && kill -HUP $KILLPIDS
413         exit 1
414 fi
415
416 echo "Testing delete: valid local record, nonexistent attribute..."
417
418 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
419         $TESTOUT 2>&1 << EOF_MOD4
420 version: 1
421 dn: uid=fred,ou=users,o=translucent
422 changetype: modify
423 delete: roomNumber
424 EOF_MOD4
425
426 RC=$?
427 if test $RC != 0 ; then
428         echo "ldapmodify failed ($RC)!"
429         grep "$FAILURE" $TESTOUT
430         test $KILLSERVERS != no && kill -HUP $KILLPIDS
431         exit $RC
432 fi
433
434 echo "Testing modrdn: prohibited local record..."
435
436 $LDAPMODRDN -D "$TRANSLUCENTDN" -H $URI2 -w $TRANSLUCENTPASSWD > \
437         $TESTOUT 2>&1 'uid=fred,ou=users,o=translucent' 'uid=someguy'
438
439 RC=$?
440 if test $RC != 50 ; then
441         echo "ldapmodrdn failed ($RC), expected INSUFFICIENT ACCESS!"
442         grep "$FAILURE" $TESTOUT
443         test $KILLSERVERS != no && kill -HUP $KILLPIDS
444         exit 1
445 fi
446
447 echo "Testing modrdn: valid local record..."
448
449 $LDAPMODRDN -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
450         $TESTOUT 2>&1 'uid=fred,ou=users,o=translucent' 'uid=someguy'
451
452 RC=$?
453 if test $RC != 0 ; then
454         echo "ldapmodrdn failed ($RC)!"
455         grep "$FAILURE" $TESTOUT
456         test $KILLSERVERS != no && kill -HUP $KILLPIDS
457         exit $RC
458 fi
459
460 echo "Testing delete: prohibited local record..."
461
462 $LDAPMODIFY -v -D "$TRANSLUCENTDN" -H $URI2 -w $TRANSLUCENTPASSWD > \
463         $TESTOUT 2>&1 << EOF_DEL2
464 version: 1
465 dn: uid=someguy,ou=users,o=translucent
466 changetype: delete
467 EOF_DEL2
468
469 RC=$?
470 if test $RC != 50 ; then
471         echo "ldapadd failed ($RC), expected INSUFFICIENT ACCESS!"
472         grep "$FAILURE" $TESTOUT
473         test $KILLSERVERS != no && kill -HUP $KILLPIDS
474         exit 1
475 fi
476
477 echo "Testing delete: valid local record..."
478
479 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
480         $TESTOUT 2>&1 << EOF_DEL3
481 version: 1
482 dn: uid=someguy,ou=users,o=translucent
483 changetype: delete
484 EOF_DEL3
485
486 RC=$?
487 if test $RC != 0 ; then
488         echo "ldapmodify failed ($RC)!"
489         grep "$FAILURE" $TESTOUT
490         test $KILLSERVERS != no && kill -HUP $KILLPIDS
491         exit $RC
492 fi
493
494 echo "Testing delete: valid remote record..."
495
496 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
497         $TESTOUT 2>&1 << EOF_DEL8
498 version: 1
499 dn: uid=fred,ou=users,o=translucent
500 changetype: delete
501 EOF_DEL8
502
503 RC=$?
504 if test $RC != 32 ; then
505         echo "ldapmodify failed ($RC), expected NO SUCH OBJECT!"
506         grep "$FAILURE" $TESTOUT
507         test $KILLSERVERS != no && kill -HUP $KILLPIDS
508         exit 1
509 fi
510
511 echo "Testing delete: nonexistent local record, nonexistent attribute..."
512
513 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
514         $TESTOUT 2>&1 << EOF_DEL1
515 version: 1
516 dn: uid=fred,ou=users,o=translucent
517 changetype: modify
518 delete: roomNumber
519 EOF_DEL1
520
521 RC=$?
522 if test $RC != 0 ; then
523         echo "ldapmodify failed ($RC)!"
524         grep "$FAILURE" $TESTOUT
525         test $KILLSERVERS != no && kill -HUP $KILLPIDS
526         exit $RC
527 fi
528
529 $LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
530
531 RC=$?
532 if test $RC != 0 ; then
533         echo "ldapsearch failed ($RC)!"
534         test $KILLSERVERS != no && kill -HUP $KILLPIDS
535         exit $RC
536 fi
537
538 echo "Testing delete: valid local record, nonexistent attribute..."
539
540 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
541         $TESTOUT 2>&1 << EOF_MOD8
542 version: 1
543 dn: uid=danger,ou=users,o=translucent
544 changetype: modify
545 delete: preferredLanguage
546 EOF_MOD8
547
548 RC=$?
549 if test $RC != 16 ; then
550         echo "ldapmodify failed ($RC), expected NO SUCH ATTRIBUTE!"
551         grep "$FAILURE" $TESTOUT
552         test $KILLSERVERS != no && kill -HUP $KILLPIDS
553         exit 1
554 fi
555
556 echo "Testing delete: valid local record, remote attribute..."
557
558 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
559         $TESTOUT 2>&1 << EOF_MOD8
560 version: 1
561 dn: uid=danger,ou=users,o=translucent
562 changetype: modify
563 delete: initials
564 EOF_MOD8
565
566 RC=$?
567 if test $RC != 0 ; then
568         echo "ldapmodify failed ($RC)"
569         grep "$FAILURE" $TESTOUT
570         test $KILLSERVERS != no && kill -HUP $KILLPIDS
571         exit 1
572 fi
573
574 echo "Testing modify: valid remote record, combination add-modify-delete..."
575
576 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
577         $TESTOUT 2>&1 << EOF_MOD6
578 version: 1
579 dn: uid=fred,ou=users,o=translucent
580 changetype: modify
581 delete: carLicense
582 -
583 add: preferredLanguage
584 preferredLanguage: ISO8859-1
585 -
586 replace: employeeType
587 employeeType: consultant
588 EOF_MOD6
589
590 RC=$?
591 if test $RC != 0 ; then
592         echo "ldapmodify failed ($RC)!"
593         grep "$FAILURE" $TESTOUT
594         test $KILLSERVERS != no && kill -HUP $KILLPIDS
595         exit $RC
596 fi
597
598 $LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
599
600 RC=$?
601 if test $RC != 0 ; then
602         echo "ldapsearch failed ($RC)!"
603         test $KILLSERVERS != no && kill -HUP $KILLPIDS
604         exit $RC
605 fi
606
607 ATTR=`grep employeeType $SEARCHOUT` > $NOWHERE 2>&1
608 if test "$ATTR" != "employeeType: consultant" ; then
609         echo "modification failed!"
610         test $KILLSERVERS != no && kill -HUP $KILLPIDS
611         exit 1
612 fi
613
614 ATTR=`grep preferredLanguage $SEARCHOUT` > $NOWHERE 2>&1
615 if test "$ATTR" != "preferredLanguage: ISO8859-1" ; then
616         echo "modification failed!"
617         test $KILLSERVERS != no && kill -HUP $KILLPIDS
618         exit 1
619 fi
620
621 echo "Dynamically configuring local slapd with translucent_no_glue and translucent_strict..."
622
623 $LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF
624 dn: olcOverlay={0}translucent,olcDatabase={2}$BACKEND,cn=config
625 changetype: modify
626 replace: olcTranslucentNoGlue
627 olcTranslucentNoGlue: TRUE
628 -
629 replace: olcTranslucentStrict
630 olcTranslucentStrict: TRUE
631 EOF
632 RC=$?
633 if test $RC != 0 ; then
634     echo "ldapmodify of dynamic config failed ($RC)"
635     test $KILLSERVERS != no && kill -HUP $KILLPIDS
636     exit 1
637 fi
638
639 echo "Testing strict mode delete: nonexistent local attribute..."
640
641 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
642         $TESTOUT 2>&1 << EOF_MOD5
643 version: 1
644 dn: uid=example,ou=users,o=translucent
645 changetype: modify
646 delete: preferredLanguage
647 EOF_MOD5
648
649 RC=$?
650 if test $RC != 19 ; then
651         echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
652         grep "$FAILURE" $TESTOUT
653         test $KILLSERVERS != no && kill -HUP $KILLPIDS
654         exit 1
655 fi
656
657 echo "Testing strict mode delete: nonexistent remote attribute..."
658
659 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
660         $TESTOUT 2>&1 << EOF_MOD3
661 version: 1
662 dn: uid=danger,ou=users,o=translucent
663 changetype: modify
664 delete: displayName
665 EOF_MOD3
666
667 RC=$?
668 if test $RC != 19 ; then
669         echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
670         grep "$FAILURE" $TESTOUT
671         test $KILLSERVERS != no && kill -HUP $KILLPIDS
672         exit 1
673 fi
674
675 echo "Testing strict mode modify: combination add-modify-delete..."
676
677 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
678         $TESTOUT 2>&1 << EOF_MOD6
679 version: 1
680 dn: uid=example,ou=users,o=translucent
681 changetype: modify
682 delete: carLicense
683 -
684 add: preferredLanguage
685 preferredLanguage: ISO8859-1
686 -
687 replace: employeeType
688 employeeType: consultant
689 EOF_MOD6
690
691 RC=$?
692 if test $RC != 19 ; then
693         echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
694         grep "$FAILURE" $TESTOUT
695         test $KILLSERVERS != no && kill -HUP $KILLPIDS
696         exit 1
697 fi
698
699 echo "Testing invalid Bind request..."
700 $LDAPWHOAMI -D "$TRANSLUCENTDN" -H $URI2 -w Wrong"$TRANSLUCENTPASSWD" > \
701         $TESTOUT 2>&1
702 RC=$?
703 if test $RC != 49 ; then
704         echo "ldapwhoami failed ($RC), expected INVALID CREDENTIALS!"
705         grep "$FAILURE" $TESTOUT
706         test $KILLSERVERS != no && kill -HUP $KILLPIDS
707         exit 1
708 fi
709
710 $LDAPWHOAMI -D "$TRANSLUCENTDN" -H $URI2 -w "$TRANSLUCENTPASSWD" > \
711         $TESTOUT 2>&1
712 RC=$?
713 if test $RC != 0 ; then
714         echo "ldapwhoami failed ($RC), expected SUCCESS!"
715         grep "$FAILURE" $TESTOUT
716         test $KILLSERVERS != no && kill -HUP $KILLPIDS
717         exit 1
718 fi
719
720 test $KILLSERVERS != no && kill -HUP $KILLPIDS
721
722 echo ">>>>> Test succeeded"
723
724 test $KILLSERVERS != no && wait
725
726 exit 0