3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2018 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 if test "$BACKEND" = "ldap"; then
30 echo "LDAP backend not valid, test skipped"
34 mkdir -p $TESTDIR $DBDIR1
37 ITSDIR=$DATADIR/regressions/its$ITS
39 echo "Running slapadd to build slapd database..."
40 . $CONFFILTER $BACKEND $MONITORDB < $RETCODECONF > $CONF1
41 $SLAPADD -f $CONF1 -l $LDIFORDERED
43 if test $RC != 0 ; then
44 echo "slapadd failed ($RC)!"
48 echo "Starting slapd on TCP/IP port $PORT1..."
49 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
51 if test $WAIT != 0 ; then
52 echo SERVERPID $SERVERPID
59 echo "Using ldapsearch to check that 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
64 if test $RC = 0 ; then
67 echo "Waiting 5 seconds for slapd to start..."
71 if test $RC != 0 ; then
72 echo "ldapsearch failed ($RC)!"
73 test $KILLSERVERS != no && kill -HUP $KILLPIDS
77 echo "Starting chain slapd on TCP/IP port $PORT2..."
78 . $CONFFILTER $BACKEND $MONITORDB < $ITSDIR/slapd.conf > $CONF2
79 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
81 if test $WAIT != 0 ; then
82 echo PROXYPID $PROXYPID
85 KILLPIDS="$KILLPIDS $PROXYPID"
89 echo "Using ldapsearch to check that chain slapd is running..."
90 for i in 0 1 2 3 4 5; do
91 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
92 'objectclass=*' > /dev/null 2>&1
94 if test $RC = 0 ; then
97 echo "Waiting 5 seconds for slapd to start..."
101 if test $RC != 0 ; then
102 echo "ldapsearch failed ($RC)!"
103 test $KILLSERVERS != no && kill -HUP $KILLPIDS
107 echo "Searching the chain..."
109 Search an entry that causes a successful result to be returned
110 with a 2 second delay; since size/time limits were erroneously
111 set to 0/0, which internally means 0 instead of unlimited, the
112 underlying back-ldap search timed out.
114 $LDAPSEARCH -b "cn=success w/ delay,ou=RetCodes,$BASEDN" -h $LOCALHOST -p $PORT2 \
115 '(objectClass=*)' > /dev/null 2>&1
117 if test $RC != 0 ; then
118 echo "ldapsearch failed ($RC)!"
119 test $KILLSERVERS != no && kill -HUP $KILLPIDS
123 echo "Re-searching the chain..."
124 $LDAPSEARCH -b "cn=success w/ delay,ou=RetCodes,$BASEDN" -h $LOCALHOST -p $PORT2 \
125 '(objectClass=*)' > /dev/null 2>&1
127 if test $RC != 0 ; then
128 echo "ldapsearch failed ($RC)!"
129 test $KILLSERVERS != no && kill -HUP $KILLPIDS
133 test $KILLSERVERS != no && kill -HUP $KILLPIDS
135 echo ">>>>> Test succeeded"
137 test $KILLSERVERS != no && wait