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