84
87
echo "Starting proxy cache on TCP/IP port $PORT2..."
85
. $CONFFILTER < $PROXYCACHECONF > $CONF2
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}/" \
86
98
$SLAPD -f $CONF2 -h $URI2 -d $LVL -d pcache > $LOG2 2>&1 &
88
100
if test $WAIT != 0 ; then
453
464
if test $? != 0 ; then
454
465
echo "Comparison failed"
466
test $KILLSERVERS != no && kill -HUP $KILLPIDS
471
echo "Testing cache refresh"
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
481
if test $RC != 0 ; then
482
echo "ldapsearch failed ($RC)!"
483
test $KILLSERVERS != no && kill -HUP $KILLPIDS
487
$LDAPMODIFY -x -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD <<EOF \
489
dn: cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example,dc=com
492
mail: dots@admin.example2.com
497
if test $RC != 0 ; then
498
echo "ldapmodify failed ($RC)!"
499
test $KILLSERVERS != no && kill -HUP $KILLPIDS
503
SLEEP=`expr $PCACHETTR + $PCACHE_CCPERIOD`
504
echo "Waiting $SLEEP seconds for cache to refresh"
508
echo "Checking entry again"
509
$LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
510
"$FILTER" $ATTRS >> $SEARCHOUT 2>> $TESTOUT
512
if test $RC != 0 ; then
513
echo "ldapsearch failed ($RC)!"
514
test $KILLSERVERS != no && kill -HUP $KILLPIDS
518
grep "^mail: dots@admin" $SEARCHOUT > /dev/null
520
if test $RC != 0 ; then
521
echo "Refresh failed"
522
test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait
527
echo "Testing Bind caching"
530
USERDN="cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com"
532
echo "Query $CNT: $USERDN"
533
echo "# Query $CNT: $USERDN" >> $SEARCHOUT
534
$LDAPSEARCH -S "" -b "" -s base -h $LOCALHOST -p $PORT2 \
535
-D "$USERDN" -w "$UPASSWD" >> $SEARCHOUT 2>> $TESTOUT
537
if test $RC != 0 ; then
538
echo "ldapsearch failed ($RC)!"
539
test $KILLSERVERS != no && kill -HUP $KILLPIDS
543
grep "CACHING BIND" $LOG2 > /dev/null
545
if test $RC != 0 ; then
546
echo "Refresh failed"
547
test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait
552
USERDN="cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com"
554
echo "Query $CNT: (Bind should be cached)"
555
echo "# Query $CNT: (Bind should be cached)" >> $SEARCHOUT
556
$LDAPSEARCH -S "" -b "" -s base -h $LOCALHOST -p $PORT2 \
557
-D "$USERDN" -w "$UPASSWD" >> $SEARCHOUT 2>> $TESTOUT
559
if test $RC != 0 ; then
560
echo "ldapsearch failed ($RC)!"
561
test $KILLSERVERS != no && kill -HUP $KILLPIDS
565
grep "CACHED BIND" $LOG2 > /dev/null
567
if test $RC != 0 ; then
568
echo "Refresh failed"
569
test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait
574
echo "Testing pwdModify"
575
$LDAPPASSWD -h $LOCALHOST -p $PORT2 \
576
-D "$MANAGERDN" -w "$PASSWD" -s newpw "$USERDN" >> $TESTOUT 2>&1
578
if test $RC != 0 ; then
579
echo "ldappasswd failed ($RC)!"
580
test $KILLSERVERS != no && kill -HUP $KILLPIDS
584
RC=`grep "CACH.* BIND" $LOG2 | wc -l`
585
if test $RC != 3 ; then
586
echo "ldappasswd didn't update the cache"
587
test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait
592
USERDN="cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com"
594
echo "Query $CNT: (Bind should be cached)"
595
echo "# Query $CNT: (Bind should be cached)" >> $SEARCHOUT
596
$LDAPSEARCH -S "" -b "" -s base -h $LOCALHOST -p $PORT2 \
597
-D "$USERDN" -w "$UPASSWD" >> $SEARCHOUT 2>> $TESTOUT
599
if test $RC != 0 ; then
600
echo "ldapsearch failed ($RC)!"
601
test $KILLSERVERS != no && kill -HUP $KILLPIDS
605
RC=`grep "CACH.* BIND" $LOG2 | wc -l`
606
if test $RC != 4 ; then
607
echo "Bind wasn't answered from cache"
608
test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait
611
test $KILLSERVERS != no && kill -HUP $KILLPIDS
458
613
echo ">>>>> Test succeeded"
460
615
test $KILLSERVERS != no && wait