]> git.sur5r.net Git - openldap/blob - tests/scripts/test034-translucent
backend hardcoded in dynamic configuration makes test fail
[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 modify: valid remote record, combination add-modify-delete..."
554
555 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
556         $TESTOUT 2>&1 << EOF_MOD6
557 version: 1
558 dn: uid=fred,ou=users,o=translucent
559 changetype: modify
560 delete: carLicense
561 -
562 add: preferredLanguage
563 preferredLanguage: ISO8859-1
564 -
565 replace: employeeType
566 employeeType: consultant
567 EOF_MOD6
568
569 RC=$?
570 if test $RC != 0 ; then
571         echo "ldapmodify failed ($RC)!"
572         grep "$FAILURE" $TESTOUT
573         test $KILLSERVERS != no && kill -HUP $KILLPIDS
574         exit $RC
575 fi
576
577 $LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
578
579 RC=$?
580 if test $RC != 0 ; then
581         echo "ldapsearch failed ($RC)!"
582         test $KILLSERVERS != no && kill -HUP $KILLPIDS
583         exit $RC
584 fi
585
586 ATTR=`grep employeeType $SEARCHOUT` > $NOWHERE 2>&1
587 if test "$ATTR" != "employeeType: consultant" ; then
588         echo "modification failed!"
589         test $KILLSERVERS != no && kill -HUP $KILLPIDS
590         exit 1
591 fi
592
593 ATTR=`grep preferredLanguage $SEARCHOUT` > $NOWHERE 2>&1
594 if test "$ATTR" != "preferredLanguage: ISO8859-1" ; then
595         echo "modification failed!"
596         test $KILLSERVERS != no && kill -HUP $KILLPIDS
597         exit 1
598 fi
599
600 echo "Dynamically configuring local slapd with translucent_no_glue and translucent_strict..."
601
602 $LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF
603 dn: olcOverlay={0}translucent,olcDatabase={2}$BACKEND,cn=config
604 changetype: modify
605 replace: olcTranslucentNoGlue
606 olcTranslucentNoGlue: TRUE
607 -
608 replace: olcTranslucentStrict
609 olcTranslucentStrict: TRUE
610 EOF
611 RC=$?
612 if test $RC != 0 ; then
613     echo "ldapmodify of dynamic config failed ($RC)"
614     test $KILLSERVERS != no && kill -HUP $KILLPIDS
615     exit 1
616 fi
617
618 echo "Testing strict mode delete: nonexistent local attribute..."
619
620 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
621         $TESTOUT 2>&1 << EOF_MOD5
622 version: 1
623 dn: uid=example,ou=users,o=translucent
624 changetype: modify
625 delete: preferredLanguage
626 EOF_MOD5
627
628 RC=$?
629 if test $RC != 19 ; then
630         echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
631         grep "$FAILURE" $TESTOUT
632         test $KILLSERVERS != no && kill -HUP $KILLPIDS
633         exit 1
634 fi
635
636 echo "Testing strict mode delete: nonexistent remote attribute..."
637
638 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
639         $TESTOUT 2>&1 << EOF_MOD3
640 version: 1
641 dn: uid=danger,ou=users,o=translucent
642 changetype: modify
643 delete: displayName
644 EOF_MOD3
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 modify: combination add-modify-delete..."
655
656 $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
657         $TESTOUT 2>&1 << EOF_MOD6
658 version: 1
659 dn: uid=example,ou=users,o=translucent
660 changetype: modify
661 delete: carLicense
662 -
663 add: preferredLanguage
664 preferredLanguage: ISO8859-1
665 -
666 replace: employeeType
667 employeeType: consultant
668 EOF_MOD6
669
670 RC=$?
671 if test $RC != 19 ; then
672         echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
673         grep "$FAILURE" $TESTOUT
674         test $KILLSERVERS != no && kill -HUP $KILLPIDS
675         exit 1
676 fi
677
678 echo "Testing invalid Bind request..."
679 $LDAPWHOAMI -D "$TRANSLUCENTDN" -H $URI2 -w Wrong"$TRANSLUCENTPASSWD" > \
680         $TESTOUT 2>&1
681 RC=$?
682 if test $RC != 49 ; then
683         echo "ldapwhoami failed ($RC), expected INVALID CREDENTIALS!"
684         grep "$FAILURE" $TESTOUT
685         test $KILLSERVERS != no && kill -HUP $KILLPIDS
686         exit 1
687 fi
688
689 $LDAPWHOAMI -D "$TRANSLUCENTDN" -H $URI2 -w "$TRANSLUCENTPASSWD" > \
690         $TESTOUT 2>&1
691 RC=$?
692 if test $RC != 0 ; then
693         echo "ldapwhoami failed ($RC), expected SUCCESS!"
694         grep "$FAILURE" $TESTOUT
695         test $KILLSERVERS != no && kill -HUP $KILLPIDS
696         exit 1
697 fi
698
699 test $KILLSERVERS != no && kill -HUP $KILLPIDS
700
701 echo ">>>>> Test succeeded"
702
703 test $KILLSERVERS != no && wait
704
705 exit 0