]> git.sur5r.net Git - openldap/blob - tests/scripts/test034-translucent
7728d676efd1d62b4d7290725e2b49e384f769ae
[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 $RC
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 $RC
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 $RC
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 $CMP $SEARCHOUT $LDIFTRANSLUCENTMERGED > $CMPOUT
260
261 if test $? != 0 ; then
262         echo "Comparison failed -- local data failed to merge with remote!"
263         test $KILLSERVERS != no && kill -HUP $KILLPIDS
264         exit 1
265 fi
266
267 echo "Testing compare: valid local..."
268
269 $LDAPCOMPARE -z -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
270         "uid=danger,ou=users,o=translucent" "carLicense:LIVID"
271
272 RC=$?
273 if test $RC != 6 ; then
274         echo "ldapcompare failed ($RC), expected TRUE!"
275         test $KILLSERVERS != no && kill -HUP $KILLPIDS
276         exit $RC
277 fi
278
279 echo "Testing compare: valid remote..."
280
281 $LDAPCOMPARE -z -x -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
282         "uid=binder,o=translucent" "businessCategory:binder-test-user"
283
284 RC=$?
285 if test $RC != 6 ; then
286         echo "ldapcompare failed ($RC), expected TRUE!"
287         test $KILLSERVERS != no && kill -HUP $KILLPIDS
288         exit $RC
289 fi
290
291 echo "Testing compare: bogus local..."
292
293 $LDAPCOMPARE -z -x -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
294         "uid=danger,ou=users,o=translucent" "businessCategory:invalid-test-value"
295
296 RC=$?
297 if test $RC != 5 ; then
298         echo "ldapcompare failed ($RC), expected FALSE!"
299         test $KILLSERVERS != no && kill -HUP $KILLPIDS
300         exit $RC
301 fi
302
303 echo "Testing compare: bogus remote..."
304
305 $LDAPCOMPARE -z -x -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
306         "uid=binder,o=translucent" "businessCategory:invalid-test-value"
307
308 RC=$?
309 if test $RC != 5 ; then
310         echo "ldapcompare failed ($RC), expected FALSE!"
311         test $KILLSERVERS != no && kill -HUP $KILLPIDS
312         exit $RC
313 fi
314
315 echo "Testing modify: nonexistent record..."
316
317 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
318         $TESTOUT 2>&1 << EOF_MOD
319 version: 1
320 dn: uid=bogus,ou=users,o=translucent
321 changetype: modify
322 replace: roomNumber
323 roomNumber: 31J-2112
324 EOF_MOD
325
326 RC=$?
327 if test $RC != 32 ; then
328         echo "ldapmodify failed ($RC), expected NO SUCH OBJECT!"
329         grep "$FAILURE" $TESTOUT
330         test $KILLSERVERS != no && kill -HUP $KILLPIDS
331         exit $RC
332 fi
333
334 echo "Testing modify: valid local record, nonexistent attribute..."
335
336 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
337         $TESTOUT 2>&1 << EOF_MOD1
338 version: 1
339 dn: uid=danger,ou=users,o=translucent
340 changetype: modify
341 replace: roomNumber
342 roomNumber: 9N-21
343 EOF_MOD1
344
345 RC=$?
346 if test $RC != 0 ; then
347         echo "ldapmodify failed ($RC)!"
348         grep "$FAILURE" $TESTOUT
349         test $KILLSERVERS != no && kill -HUP $KILLPIDS
350         exit $RC
351 fi
352
353 $LDAPSEARCH -H $URI2 -b "uid=danger,ou=users,o=translucent" > $SEARCHOUT 2>&1
354
355 RC=$?
356 if test $RC != 0 ; then
357         echo "ldapsearch failed ($RC)!"
358         test $KILLSERVERS != no && kill -HUP $KILLPIDS
359         exit $RC
360 fi
361
362 ATTR=`grep roomNumber $SEARCHOUT` > $NOWHERE 2>&1
363 if test "$ATTR" != "roomNumber: 9N-21" ; then
364         echo "modification failed!"
365         test $KILLSERVERS != no && kill -HUP $KILLPIDS
366         exit 1
367 fi
368
369 echo "Testing search: specific nonexistent remote attribute..."
370
371 $LDAPSEARCH -H $URI2 -b "uid=danger,ou=users,o=translucent" roomNumber > $SEARCHOUT 2>&1
372
373 RC=$?
374 if test $RC != 0 ; then
375         echo "ldapsearch failed ($RC)!"
376         test $KILLSERVERS != no && kill -HUP $KILLPIDS
377         exit $RC
378 fi
379
380 echo "Testing modify: nonexistent local record, nonexistent attribute..."
381
382 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
383         $TESTOUT 2>&1 << EOF_MOD2
384 version: 1
385 dn: uid=fred,ou=users,o=translucent
386 changetype: modify
387 replace: roomNumber
388 roomNumber: 31J-2112
389 EOF_MOD2
390
391 RC=$?
392 if test $RC != 0 ; then
393         echo "ldapmodify failed ($RC)!"
394         grep "$FAILURE" $TESTOUT
395         test $KILLSERVERS != no && kill -HUP $KILLPIDS
396         exit $RC
397 fi
398
399 $LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
400
401 RC=$?
402 if test $RC != 0 ; then
403         echo "ldapsearch failed ($RC)!"
404         test $KILLSERVERS != no && kill -HUP $KILLPIDS
405         exit $RC
406 fi
407
408 ATTR=`grep roomNumber $SEARCHOUT` > $NOWHERE 2>&1
409 if test "$ATTR" != "roomNumber: 31J-2112" ; then
410         echo "modification failed!"
411         test $KILLSERVERS != no && kill -HUP $KILLPIDS
412         exit 1
413 fi
414
415 echo "Testing modify: valid remote record, nonexistent attribute..."
416
417 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
418         $TESTOUT 2>&1 << EOF_MOD9
419 version: 1
420 dn: uid=fred,ou=users,o=translucent
421 changetype: modify
422 delete: preferredLanguage
423 EOF_MOD9
424
425 RC=$?
426 if test $RC != 16 ; then
427         echo "ldapmodify failed ($RC), expected NO SUCH ATTRIBUTE!"
428         grep "$FAILURE" $TESTOUT
429         test $KILLSERVERS != no && kill -HUP $KILLPIDS
430         exit $RC
431 fi
432
433 echo "Testing delete: valid local record, nonexistent attribute..."
434
435 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
436         $TESTOUT 2>&1 << EOF_MOD4
437 version: 1
438 dn: uid=fred,ou=users,o=translucent
439 changetype: modify
440 delete: roomNumber
441 EOF_MOD4
442
443 RC=$?
444 if test $RC != 0 ; then
445         echo "ldapmodify failed ($RC)!"
446         grep "$FAILURE" $TESTOUT
447         test $KILLSERVERS != no && kill -HUP $KILLPIDS
448         exit $RC
449 fi
450
451 echo "Testing modrdn: prohibited local record..."
452
453 $LDAPMODRDN -D "$TRANSLUCENTDN" -H $URI2 -w $TRANSLUCENTPASSWD > \
454         $TESTOUT 2>&1 'uid=fred,ou=users,o=translucent' 'uid=someguy'
455
456 RC=$?
457 if test $RC != 50 ; then
458         echo "ldapmodrdn failed ($RC), expected INSUFFICIENT ACCESS!"
459         grep "$FAILURE" $TESTOUT
460         test $KILLSERVERS != no && kill -HUP $KILLPIDS
461         exit $RC
462 fi
463
464 echo "Testing modrdn: valid local record..."
465
466 $LDAPMODRDN -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
467         $TESTOUT 2>&1 'uid=fred,ou=users,o=translucent' 'uid=someguy'
468
469 RC=$?
470 if test $RC != 0 ; then
471         echo "ldapmodrdn failed ($RC)!"
472         grep "$FAILURE" $TESTOUT
473         test $KILLSERVERS != no && kill -HUP $KILLPIDS
474         exit $RC
475 fi
476
477 echo "Testing delete: prohibited local record..."
478
479 $LDAPMODIFY -v -D "$TRANSLUCENTDN" -H $URI2 -w $TRANSLUCENTPASSWD > \
480         $TESTOUT 2>&1 << EOF_DEL2
481 version: 1
482 dn: uid=someguy,ou=users,o=translucent
483 changetype: delete
484 EOF_DEL2
485
486 RC=$?
487 if test $RC != 50 ; then
488         echo "ldapadd failed ($RC), expected INSUFFICIENT ACCESS!"
489         grep "$FAILURE" $TESTOUT
490         test $KILLSERVERS != no && kill -HUP $KILLPIDS
491         exit $RC
492 fi
493
494 echo "Testing delete: valid local record..."
495
496 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
497         $TESTOUT 2>&1 << EOF_DEL3
498 version: 1
499 dn: uid=someguy,ou=users,o=translucent
500 changetype: delete
501 EOF_DEL3
502
503 RC=$?
504 if test $RC != 0 ; then
505         echo "ldapmodify failed ($RC)!"
506         grep "$FAILURE" $TESTOUT
507         test $KILLSERVERS != no && kill -HUP $KILLPIDS
508         exit $RC
509 fi
510
511 echo "Testing delete: valid remote record..."
512
513 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
514         $TESTOUT 2>&1 << EOF_DEL8
515 version: 1
516 dn: uid=fred,ou=users,o=translucent
517 changetype: delete
518 EOF_DEL8
519
520 RC=$?
521 if test $RC != 32 ; then
522         echo "ldapmodify failed ($RC), expected NO SUCH OBJECT!"
523         grep "$FAILURE" $TESTOUT
524         test $KILLSERVERS != no && kill -HUP $KILLPIDS
525         exit $RC
526 fi
527
528 echo "Testing delete: nonexistent local record, nonexistent attribute..."
529
530 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
531         $TESTOUT 2>&1 << EOF_DEL1
532 version: 1
533 dn: uid=fred,ou=users,o=translucent
534 changetype: modify
535 delete: roomNumber
536 EOF_DEL1
537
538 RC=$?
539 if test $RC != 0 ; then
540         echo "ldapmodify failed ($RC)!"
541         grep "$FAILURE" $TESTOUT
542         test $KILLSERVERS != no && kill -HUP $KILLPIDS
543         exit $RC
544 fi
545
546 $LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
547
548 RC=$?
549 if test $RC != 0 ; then
550         echo "ldapsearch failed ($RC)!"
551         test $KILLSERVERS != no && kill -HUP $KILLPIDS
552         exit $RC
553 fi
554
555 echo "Testing delete: valid local record, nonexistent attribute..."
556
557 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
558         $TESTOUT 2>&1 << EOF_MOD8
559 version: 1
560 dn: uid=danger,ou=users,o=translucent
561 changetype: modify
562 delete: preferredLanguage
563 EOF_MOD8
564
565 RC=$?
566 if test $RC != 16 ; then
567         echo "ldapmodify failed ($RC), expected NO SUCH ATTRIBUTE!"
568         grep "$FAILURE" $TESTOUT
569         test $KILLSERVERS != no && kill -HUP $KILLPIDS
570         exit $RC
571 fi
572
573 echo "Testing modify: valid remote record, combination add-modify-delete..."
574
575 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
576         $TESTOUT 2>&1 << EOF_MOD6
577 version: 1
578 dn: uid=fred,ou=users,o=translucent
579 changetype: modify
580 delete: carLicense
581 -
582 add: preferredLanguage
583 preferredLanguage: ISO8859-1
584 -
585 replace: employeeType
586 employeeType: consultant
587 EOF_MOD6
588
589 RC=$?
590 if test $RC != 0 ; then
591         echo "ldapmodify failed ($RC)!"
592         grep "$FAILURE" $TESTOUT
593         test $KILLSERVERS != no && kill -HUP $KILLPIDS
594         exit $RC
595 fi
596
597 $LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
598
599 RC=$?
600 if test $RC != 0 ; then
601         echo "ldapsearch failed ($RC)!"
602         test $KILLSERVERS != no && kill -HUP $KILLPIDS
603         exit $RC
604 fi
605
606 ATTR=`grep employeeType $SEARCHOUT` > $NOWHERE 2>&1
607 if test "$ATTR" != "employeeType: consultant" ; then
608         echo "modification failed!"
609         test $KILLSERVERS != no && kill -HUP $KILLPIDS
610         exit 1
611 fi
612
613 ATTR=`grep preferredLanguage $SEARCHOUT` > $NOWHERE 2>&1
614 if test "$ATTR" != "preferredLanguage: ISO8859-1" ; then
615         echo "modification failed!"
616         test $KILLSERVERS != no && kill -HUP $KILLPIDS
617         exit 1
618 fi
619
620 echo "Shutting down local slapd..."
621 kill -HUP $LOCALPID
622 sleep 5
623
624 echo "Configuring local slapd with translucent_strict..."
625 echo translucent_strict >> $CONF2
626
627 echo "Restarting slapd on TCP/IP port $PORT2..."
628 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
629 PID=$!
630 if test $WAIT != 0 ; then
631     echo PID $PID
632     read foo
633 fi
634 LOCALPID="$PID"
635 KILLPIDS="$REMOTEPID $PID"
636
637 for i in 0 1 2 3 4 5; do
638         $LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \
639                 'objectclass=*' > /dev/null 2>&1
640         RC=$?
641         if test $RC = 0 ; then
642                 break
643         fi
644         echo "Waiting 5 seconds for local slapd to start..."
645         sleep 5
646 done
647
648 if test $RC != 0 ; then
649         echo "ldapsearch failed ($RC)!"
650         test $KILLSERVERS != no && kill -HUP $KILLPIDS
651         exit $RC
652 fi
653
654 echo "Testing strict mode delete: nonexistent local attribute..."
655
656 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
657         $TESTOUT 2>&1 << EOF_MOD5
658 version: 1
659 dn: uid=example,ou=users,o=translucent
660 changetype: modify
661 delete: preferredLanguage
662 EOF_MOD5
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 $RC
670 fi
671
672 echo "Testing strict mode delete: nonexistent remote attribute..."
673
674 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
675         $TESTOUT 2>&1 << EOF_MOD3
676 version: 1
677 dn: uid=danger,ou=users,o=translucent
678 changetype: modify
679 delete: displayName
680 EOF_MOD3
681
682 RC=$?
683 if test $RC != 19 ; then
684         echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
685         grep "$FAILURE" $TESTOUT
686         test $KILLSERVERS != no && kill -HUP $KILLPIDS
687         exit $RC
688 fi
689
690 echo "Testing strict mode modify: combination add-modify-delete..."
691
692 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
693         $TESTOUT 2>&1 << EOF_MOD6
694 version: 1
695 dn: uid=example,ou=users,o=translucent
696 changetype: modify
697 delete: carLicense
698 -
699 add: preferredLanguage
700 preferredLanguage: ISO8859-1
701 -
702 replace: employeeType
703 employeeType: consultant
704 EOF_MOD6
705
706 RC=$?
707 if test $RC != 19 ; then
708         echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
709         grep "$FAILURE" $TESTOUT
710         test $KILLSERVERS != no && kill -HUP $KILLPIDS
711         exit $RC
712 fi
713
714 test $KILLSERVERS != no && kill -HUP $KILLPIDS
715
716 echo ">>>>> Test succeeded"
717 exit 0