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