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