3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2008 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
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>.
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
19 if test $BACKLDAP = "ldapno" ; then
20 echo "LDAP backend not available, test skipped"
24 if test $RETCODE = retcodeno; then
25 echo "Retcode overlay not available, test skipped"
29 mkdir -p $TESTDIR $DBDIR1
32 ITSDIR=$DATADIR/regressions/its$ITS
34 echo "Running slapadd to build slapd database..."
35 . $CONFFILTER $BACKEND $MONITORDB < $RETCODECONF > $CONF1
36 $SLAPADD -f $CONF1 -l $LDIFORDERED
38 if test $RC != 0 ; then
39 echo "slapadd failed ($RC)!"
43 echo "Starting slapd on TCP/IP port $PORT1..."
44 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
46 if test $WAIT != 0 ; then
47 echo SERVERPID $SERVERPID
54 echo "Using ldapsearch to check that slapd is running..."
55 for i in 0 1 2 3 4 5; do
56 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
57 'objectclass=*' > /dev/null 2>&1
59 if test $RC = 0 ; then
62 echo "Waiting 5 seconds for slapd to start..."
66 if test $RC != 0 ; then
67 echo "ldapsearch failed ($RC)!"
68 test $KILLSERVERS != no && kill -HUP $KILLPIDS
72 echo "Starting chain slapd on TCP/IP port $PORT2..."
73 . $CONFFILTER $BACKEND $MONITORDB < $ITSDIR/slapd.conf > $CONF2
74 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
76 if test $WAIT != 0 ; then
77 echo PROXYPID $PROXYPID
80 KILLPIDS="$KILLPIDS $PROXYPID"
84 echo "Using ldapsearch to check that chain slapd is running..."
85 for i in 0 1 2 3 4 5; do
86 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
87 'objectclass=*' > /dev/null 2>&1
89 if test $RC = 0 ; then
92 echo "Waiting 5 seconds for slapd to start..."
96 if test $RC != 0 ; then
97 echo "ldapsearch failed ($RC)!"
98 test $KILLSERVERS != no && kill -HUP $KILLPIDS
102 echo "Searching the chain..."
104 Search an entry that causes a successful result to be returned
105 with a 2 second delay; since size/time limits were erroneously
106 set to 0/0, which internally means 0 instead of unlimited, the
107 underlying back-ldap search timed out.
109 $LDAPSEARCH -b "cn=success w/ delay,ou=RetCodes,$BASEDN" -h $LOCALHOST -p $PORT2 \
110 '(objectClass=*)' > /dev/null 2>&1
112 if test $RC != 0 ; then
113 echo "ldapsearch failed ($RC)!"
114 test $KILLSERVERS != no && kill -HUP $KILLPIDS
118 echo "Re-searching the chain..."
119 $LDAPSEARCH -b "cn=success w/ delay,ou=RetCodes,$BASEDN" -h $LOCALHOST -p $PORT2 \
120 '(objectClass=*)' > /dev/null 2>&1
122 if test $RC != 0 ; then
123 echo "ldapsearch failed ($RC)!"
124 test $KILLSERVERS != no && kill -HUP $KILLPIDS
128 test $KILLSERVERS != no && kill -HUP $KILLPIDS
130 echo ">>>>> Test succeeded"
132 test $KILLSERVERS != no && wait