]> git.sur5r.net Git - openldap/blob - tests/scripts/test020-proxycache
ITS#6152 add tests for cache refresh and Bind caching
[openldap] / tests / scripts / test020-proxycache
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2009 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 PCACHETTL=${PCACHETTL-"1m"}
17 PCACHENTTL=${PCACHENTTL-"1m"}
18 PCACHESTTL=${PCACHESTTL-"1m"}
19 PCACHE_ENTRY_LIMIT=${PCACHE_ENTRY_LIMIT-"6"}
20 PCACHE_CCPERIOD=${PCACHE_CCPERIOD-"2"}
21 PCACHETTR=${PCACHETTR-"2"}
22 PCACHEBTTR=${PCACHEBTTR-"5"}
23
24 . $SRCDIR/scripts/defines.sh
25
26 if test $PROXYCACHE = pcacheno; then 
27         echo "Proxy cache overlay not available, test skipped"
28         exit 0
29 fi 
30
31 if test $BACKLDAP = "ldapno" ; then 
32         echo "LDAP backend not available, test skipped"
33         exit 0
34 fi 
35
36 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
37
38 # Test proxy caching:
39 # - start master
40 # - start proxy cache
41 # - populate master 
42 # - perform first set of searches at the proxy
43 # - verify cacheability
44 # - perform second set of searches at the proxy 
45 # - verify answerability
46
47 echo "Starting master slapd on TCP/IP port $PORT1..."
48 . $CONFFILTER < $CACHEMASTERCONF > $CONF1
49 $SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 &
50 PID=$!
51 if test $WAIT != 0 ; then
52         echo PID $PID
53         read foo
54 fi
55 KILLPIDS="$PID"
56
57 sleep 1
58
59 echo "Using ldapsearch to check that master slapd is running..."
60 for i in 0 1 2 3 4 5; do
61         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
62                 'objectclass=*' > /dev/null 2>&1
63         RC=$?
64         if test $RC = 0 ; then
65                 break
66         fi
67         echo "Waiting 5 seconds for 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 echo "Using ldapadd to populate the master directory..."
78 $LDAPADD -x -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
79         $LDIFORDERED > /dev/null 2>&1
80 RC=$?
81 if test $RC != 0 ; then
82         echo "ldapadd failed ($RC)!"
83         test $KILLSERVERS != no && kill -HUP $KILLPIDS
84         exit $RC
85 fi
86
87 echo "Starting proxy cache on TCP/IP port $PORT2..."
88 . $CONFFILTER < $PROXYCACHECONF | sed \
89         -e "s/@TTL@/${PCACHETTL}/"                      \
90         -e "s/@NTTL@/${PCACHENTTL}/"            \
91         -e "s/@STTL@/${PCACHENTTL}/"            \
92         -e "s/@TTR@/${PCACHETTR}/"                      \
93         -e "s/@ENTRY_LIMIT@/${PCACHE_ENTRY_LIMIT}/"     \
94         -e "s/@CCPERIOD@/${PCACHE_CCPERIOD}/"                   \
95         -e "s/@BTTR@/${PCACHEBTTR}/"                    \
96         > $CONF2
97
98 $SLAPD -f $CONF2 -h $URI2 -d $LVL -d pcache > $LOG2 2>&1 &
99 CACHEPID=$!
100 if test $WAIT != 0 ; then
101         echo CACHEPID $CACHEPID
102         read foo
103 fi
104 KILLPIDS="$KILLPIDS $CACHEPID"
105
106 sleep 1
107
108 echo "Using ldapsearch to check that proxy slapd is running..."
109 for i in 0 1 2 3 4 5; do
110         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
111                 'objectclass=*' > /dev/null 2>&1
112         RC=$?
113         if test $RC = 0 ; then
114                 break
115         fi
116         echo "Waiting 5 seconds for slapd to start..."
117         sleep 5
118 done
119
120 if test $RC != 0 ; then
121         echo "ldapsearch failed ($RC)!"
122         test $KILLSERVERS != no && kill -HUP $KILLPIDS
123         exit $RC
124 fi
125
126 cat /dev/null > $SEARCHOUT
127
128 echo "Making queries on the proxy cache..." 
129 CNT=0
130
131 CNT=`expr $CNT + 1`
132 FILTER="(sn=Jon)"
133 echo "Query $CNT: filter:$FILTER attrs:all (expect nothing)" 
134 echo "# Query $CNT: filter:$FILTER attrs:all (expect nothing)" >> $SEARCHOUT
135 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
136         "$FILTER" >> $SEARCHOUT 2>> $TESTOUT
137 RC=$?
138 if test $RC != 0 ; then
139         echo "ldapsearch failed ($RC)!"
140         test $KILLSERVERS != no && kill -HUP $KILLPIDS
141         exit $RC
142 fi
143
144 # ITS#4491, if debug messages are unavailable, we can't verify the tests.
145 grep "query template" $LOG2 > /dev/null
146 RC=$?
147 if test $RC != 0 ; then
148         echo "Debug messages unavailable, test aborted..."
149         test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait
150         exit 0
151 fi
152
153 CNT=`expr $CNT + 1`
154 FILTER="(|(cn=*Jon*)(sn=Jon*))"
155 ATTRS="cn sn title uid"
156 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
157 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
158 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
159         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
160 RC=$?
161 if test $RC != 0 ; then
162         echo "ldapsearch failed ($RC)!"
163         test $KILLSERVERS != no && kill -HUP $KILLPIDS
164         exit $RC
165 fi
166
167 CNT=`expr $CNT + 1`
168 FILTER="(sn=Smith*)"
169 ATTRS="cn sn uid"
170 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
171 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
172 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
173         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
174 RC=$?
175 if test $RC != 0 ; then
176         echo "ldapsearch failed ($RC)!"
177         test $KILLSERVERS != no && kill -HUP $KILLPIDS
178         exit $RC
179 fi
180
181 CNT=`expr $CNT + 1`
182 FILTER="(sn=Doe*)"
183 ATTRS="cn sn title uid"
184 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
185 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
186 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
187         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
188 RC=$?
189 if test $RC != 0 ; then
190         echo "ldapsearch failed ($RC)!"
191         test $KILLSERVERS != no && kill -HUP $KILLPIDS
192         exit $RC
193 fi
194
195 CNT=`expr $CNT + 1`
196 FILTER="(uid=johnd)"
197 ATTRS="mail postaladdress telephonenumber cn uid"
198 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
199 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
200 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
201         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
202 RC=$?
203 if test $RC != 0 ; then
204         echo "ldapsearch failed ($RC)!"
205         test $KILLSERVERS != no && kill -HUP $KILLPIDS
206         exit $RC
207 fi
208
209 CNT=`expr $CNT + 1`
210 FILTER="(mail=*@mail.alumni.example.com)"
211 ATTRS="cn sn title uid"
212 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
213 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
214 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
215         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
216 RC=$?
217 if test $RC != 0 ; then
218         echo "ldapsearch failed ($RC)!"
219         test $KILLSERVERS != no && kill -HUP $KILLPIDS
220         exit $RC
221 fi
222
223 CNT=`expr $CNT + 1`
224 FILTER="(mail=*)"
225 ATTRS="cn sn title uid"
226 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
227 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
228 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
229         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
230 RC=$?
231 if test $RC != 0 ; then
232         echo "ldapsearch failed ($RC)!"
233         test $KILLSERVERS != no && kill -HUP $KILLPIDS
234         exit $RC
235 fi
236
237 CNT=`expr $CNT + 1`
238 FILTER="(mail=*example.com)"
239 ATTRS="cn sn title uid"
240 USERDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com"
241 UPASSWD="bjorn"
242 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
243 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
244 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
245         -D "$USERDN" -w "$UPASSWD" \
246         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
247 RC=$?
248 case $RC in
249 0)
250         echo "ldapsearch should have failed!"
251         test $KILLSERVERS != no && kill -HUP $KILLPIDS
252         exit $RC
253         ;;
254 4)
255         echo "ldapsearch failed ($RC)"
256         ;;
257 *)
258         echo "ldapsearch failed ($RC)!"
259         test $KILLSERVERS != no && kill -HUP $KILLPIDS
260         exit $RC
261         ;;
262 esac
263
264 CNT=`expr $CNT + 1`
265 FILTER="(uid=b*)"
266 ATTRS="mail"
267 USERDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com"
268 UPASSWD="bjorn"
269 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
270 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
271 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
272         -D "$USERDN" -w "$UPASSWD" \
273         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
274 RC=$?
275 case $RC in
276 0)
277         echo "ldapsearch should have failed!"
278         test $KILLSERVERS != no && kill -HUP $KILLPIDS
279         exit $RC
280         ;;
281 4)
282         echo "ldapsearch failed ($RC)"
283         ;;
284 *)
285         echo "ldapsearch failed ($RC)!"
286         test $KILLSERVERS != no && kill -HUP $KILLPIDS
287         exit $RC
288         ;;
289 esac
290
291 FIRST=$CNT
292
293 # queries 2-6,8-9 are cacheable
294 CACHEABILITY=011111011
295 grep CACHEABLE $LOG2 | awk '{ 
296                 if ($2 == "NOT") 
297                         printf "Query %d not cacheable\n",NR
298                 else 
299                         printf "Query %d cacheable\n",NR
300         }' 
301 CACHED=`grep CACHEABLE $LOG2 | awk '{ 
302                 if ($2 == "NOT") 
303                         printf "0" 
304                 else 
305                         printf "1" 
306         }'`
307
308 if test "$CACHEABILITY" = "$CACHED" ; then
309         echo "Successfully verified cacheability"
310 else 
311         echo "Error in verifying cacheability"
312         test $KILLSERVERS != no && kill -HUP $KILLPIDS
313         exit 1
314 fi
315
316 CNT=`expr $CNT + 1`
317 FILTER="(|(cn=*Jones)(sn=Jones))"
318 ATTRS="cn sn title uid"
319 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
320 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
321 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
322         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
323 RC=$?
324 if test $RC != 0 ; then
325         echo "ldapsearch failed ($RC)!"
326         test $KILLSERVERS != no && kill -HUP $KILLPIDS
327         exit $RC
328 fi
329
330 CNT=`expr $CNT + 1`
331 FILTER="(sn=Smith)"
332 ATTRS="cn sn title uid"
333 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
334 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
335 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
336         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
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 CNT=`expr $CNT + 1`
345 FILTER="(uid=bjorn)"
346 ATTRS="mail postaladdress telephonenumber cn uid"
347 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
348 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
349 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
350         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
351 RC=$?
352 if test $RC != 0 ; then
353         echo "ldapsearch failed ($RC)!"
354         test $KILLSERVERS != no && kill -HUP $KILLPIDS
355         exit $RC
356 fi
357
358 CNT=`expr $CNT + 1`
359 FILTER="(mail=jaj@mail.alumni.example.com)"
360 ATTRS="cn sn title uid"
361 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
362 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
363 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
364         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
365 RC=$?
366
367 if test $RC != 0 ; then
368         echo "ldapsearch failed ($RC)!"
369         test $KILLSERVERS != no && kill -HUP $KILLPIDS
370         exit $RC
371 fi
372
373 CNT=`expr $CNT + 1`
374 FILTER="(mail=*example.com)"
375 ATTRS="cn sn title uid"
376 USERDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com"
377 UPASSWD="bjorn"
378 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
379 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
380 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
381         -D "$USERDN" -w "$UPASSWD" \
382         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
383 RC=$?
384 case $RC in
385 0)
386         echo "ldapsearch should have failed!"
387         test $KILLSERVERS != no && kill -HUP $KILLPIDS
388         exit $RC
389         ;;
390 4)
391         echo "ldapsearch failed ($RC)"
392         ;;
393 *)
394         echo "ldapsearch failed ($RC)!"
395         test $KILLSERVERS != no && kill -HUP $KILLPIDS
396         exit $RC
397         ;;
398 esac
399
400 CNT=`expr $CNT + 1`
401 FILTER="(uid=b*)"
402 ATTRS="mail"
403 USERDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com"
404 UPASSWD="bjorn"
405 echo "Query $CNT: filter:$FILTER attrs:$ATTRS"  
406 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
407 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
408         -D "$USERDN" -w "$UPASSWD" \
409         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
410 RC=$?
411 case $RC in
412 0)
413         echo "ldapsearch should have failed!"
414         test $KILLSERVERS != no && kill -HUP $KILLPIDS
415         exit $RC
416         ;;
417 4)
418         echo "ldapsearch failed ($RC)"
419         ;;
420 *)
421         echo "ldapsearch failed ($RC)!"
422         test $KILLSERVERS != no && kill -HUP $KILLPIDS
423         exit $RC
424         ;;
425 esac
426
427 #queries 10-12,15 are answerable, 13-14 are not
428 #actually, 12 would be answerable, but since 8 made mail=*example.com
429 #not answerable because of sizelimit, queries contained in it are no longer
430 #answerable as well
431 ANSWERABILITY=111001
432 grep ANSWERABLE $LOG2 | awk "BEGIN {FIRST=$FIRST}"'{ 
433                 if (NR > FIRST) { 
434                         if ($2 == "NOT") 
435                                 printf "Query %d not answerable\n",NR
436                         else 
437                                 printf "Query %d answerable\n",NR 
438                 }
439         }' 
440 ANSWERED=`grep ANSWERABLE $LOG2 | awk "BEGIN {FIRST=$FIRST}"'{ 
441                 if (NR > FIRST) { 
442                         if ($2 == "NOT") 
443                                 printf "0" 
444                         else 
445                                 printf "1"
446                 } 
447         }'`
448
449 if test "$ANSWERABILITY" = "$ANSWERED" ; then
450         echo "Successfully verified answerability"
451 else 
452         echo "Error in verifying answerability"
453         test $KILLSERVERS != no && kill -HUP $KILLPIDS
454         exit 1
455 fi
456
457 echo "Filtering ldapsearch results..."
458 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
459 echo "Filtering original ldif..."
460 . $LDIFFILTER < $PROXYCACHEOUT > $LDIFFLT
461 echo "Comparing filter output..."
462 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
463
464 if test $? != 0 ; then
465         echo "Comparison failed"
466         test $KILLSERVERS != no && kill -HUP $KILLPIDS
467         exit 1
468 fi
469
470 echo ""
471 echo "Testing cache refresh"
472
473 CNT=`expr $CNT + 1`
474 FILTER="(&(objectclass=person)(uid=dots))"
475 ATTRS="cn mail telephonenumber"
476 echo "Query $CNT: filter:$FILTER attrs:$ATTRS" 
477 echo "# Query $CNT: filter:$FILTER attrs:$ATTRS" >> $SEARCHOUT
478 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
479         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
480 RC=$?
481 if test $RC != 0 ; then
482         echo "ldapsearch failed ($RC)!"
483         test $KILLSERVERS != no && kill -HUP $KILLPIDS
484         exit $RC
485 fi
486
487 $LDAPMODIFY -x -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD <<EOF \
488         > /dev/null 2>&1
489 dn: cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example,dc=com
490 changetype: modify
491 replace: mail
492 mail: dots@admin.example2.com
493 -
494
495 EOF
496
497 SLEEP=`expr $PCACHETTR + $PCACHE_CCPERIOD`
498 echo "Waiting $SLEEP seconds for cache to refresh"
499
500 sleep $SLEEP
501
502 echo "Checking entry again"
503 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
504         "$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
505 RC=$?
506 if test $RC != 0 ; then
507         echo "ldapsearch failed ($RC)!"
508         test $KILLSERVERS != no && kill -HUP $KILLPIDS
509         exit $RC
510 fi
511
512 grep "^mail: dots@admin" $SEARCHOUT > /dev/null
513 RC=$?
514 if test $RC != 0 ; then
515         echo "Refresh failed"
516         test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait
517         exit 0
518 fi
519
520 echo ""
521 echo "Testing Bind caching"
522
523 CNT=`expr $CNT + 1`
524 USERDN="cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com"
525 UPASSWD="jaj"
526 echo "Query $CNT: $USERDN"
527 echo "# Query $CNT: $USERDN" >> $SEARCHOUT
528 $LDAPSEARCH -S "" -b "" -s base -h $LOCALHOST -p $PORT2 \
529         -D "$USERDN" -w "$UPASSWD" >> $SEARCHOUT 2>> $TESTOUT
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 grep "CACHING BIND" $LOG2 > /dev/null
538 RC=$?
539 if test $RC != 0 ; then
540         echo "Refresh failed"
541         test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait
542         exit 0
543 fi
544
545 CNT=`expr $CNT + 1`
546 USERDN="cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com"
547 UPASSWD="jaj"
548 echo "Query $CNT: (Bind should be cached)"
549 echo "# Query $CNT: (Bind should be cached)" >> $SEARCHOUT
550 $LDAPSEARCH -S "" -b "" -s base -h $LOCALHOST -p $PORT2 \
551         -D "$USERDN" -w "$UPASSWD" >> $SEARCHOUT 2>> $TESTOUT
552 RC=$?
553 if test $RC != 0 ; then
554         echo "ldapsearch failed ($RC)!"
555         test $KILLSERVERS != no && kill -HUP $KILLPIDS
556         exit $RC
557 fi
558
559 grep "CACHED BIND" $LOG2 > /dev/null
560 RC=$?
561 if test $RC != 0 ; then
562         echo "Refresh failed"
563         test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait
564         exit 0
565 fi
566
567 test $KILLSERVERS != no && kill -HUP $KILLPIDS
568
569 echo ">>>>> Test succeeded"
570
571 test $KILLSERVERS != no && wait
572
573 exit 0