3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2006 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 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
27 ITSDIR=$DATADIR/regressions/its$ITS
29 echo "Running slapadd to build slapd database..."
30 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
31 $SLAPADD -f $CONF1 -l $LDIFORDERED
33 if test $RC != 0 ; then
34 echo "slapadd failed ($RC)!"
38 echo "Starting slapd on TCP/IP port $PORT1..."
39 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
41 if test $WAIT != 0 ; then
42 echo SERVERPID $SERVERPID
49 echo "Using ldapsearch to check that slapd is running..."
50 for i in 0 1 2 3 4 5; do
51 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
52 'objectclass=*' > /dev/null 2>&1
54 if test $RC = 0 ; then
57 echo "Waiting 5 seconds for slapd to start..."
61 if test $RC != 0 ; then
62 echo "ldapsearch failed ($RC)!"
63 test $KILLSERVERS != no && kill -HUP $KILLPIDS
67 echo "Running slapadd to create glue entry..."
68 . $CONFFILTER $BACKEND $MONITORDB < $ITSDIR/slapd.conf > $CONF2
69 #$SLAPADD -f $CONF2 << EODATA
70 #dn: dc=example,dc=com
75 #if test $RC != 0 ; then
76 # echo "slapadd failed ($RC)!"
77 # test $KILLSERVERS != no && kill -HUP $KILLPIDS
81 echo "Starting proxy slapd on TCP/IP port $PORT2..."
82 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
84 if test $WAIT != 0 ; then
85 echo PROXYPID $PROXYPID
88 KILLPIDS="$KILLPIDS $PROXYPID"
92 echo "Using ldapsearch to check that proxy slapd is running..."
93 for i in 0 1 2 3 4 5; do
94 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
95 'objectclass=*' > /dev/null 2>&1
97 if test $RC = 0 ; then
100 echo "Waiting 5 seconds for slapd to start..."
104 if test $RC != 0 ; then
105 echo "ldapsearch failed ($RC)!"
106 test $KILLSERVERS != no && kill -HUP $KILLPIDS
110 echo "Searching the proxy..."
111 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
112 '(objectClass=*)' > /dev/null 2>&1
114 if test $RC != 0 ; then
115 echo "ldapsearch failed ($RC)!"
116 test $KILLSERVERS != no && kill -HUP $KILLPIDS
120 echo "Re-searching the proxy..."
121 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
122 '(objectClass=*)' > /dev/null 2>&1
124 if test $RC != 0 ; then
125 echo "ldapsearch failed ($RC)!"
126 test $KILLSERVERS != no && kill -HUP $KILLPIDS
131 echo "Stopping the provider and sleeping $SLEEP seconds..."
132 kill -HUP "$SERVERPID"
137 echo "Searching the proxy..."
138 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
139 '(objectClass=*)' > /dev/null 2>&1
143 echo "ldapsearch should have failed ($RC)!"
144 test $KILLSERVERS != no && kill -HUP $KILLPIDS
148 echo "ldapsearch failed ($RC)"
151 echo "ldapsearch failed ($RC)!"
152 test $KILLSERVERS != no && kill -HUP $KILLPIDS
157 echo "Re-searching the proxy..."
158 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
159 '(objectClass=*)' > /dev/null 2>&1
163 echo "ldapsearch should have failed ($RC)!"
164 test $KILLSERVERS != no && kill -HUP $KILLPIDS
168 echo "ldapsearch failed ($RC)"
171 echo "ldapsearch failed ($RC)!"
172 test $KILLSERVERS != no && kill -HUP $KILLPIDS
177 echo "Restarting slapd on TCP/IP port $PORT1..."
178 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
180 if test $WAIT != 0 ; then
181 echo SERVERPID $SERVERPID
184 KILLPIDS="$SERVERPID $PROXYPID"
188 echo "Using ldapsearch to check that slapd is running..."
189 for i in 0 1 2 3 4 5; do
190 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
191 'objectclass=*' > /dev/null 2>&1
193 if test $RC = 0 ; then
196 echo "Waiting 5 seconds for slapd to start..."
200 if test $RC != 0 ; then
201 echo "ldapsearch failed ($RC)!"
202 test $KILLSERVERS != no && kill -HUP $KILLPIDS
206 echo "Searching the proxy..."
207 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
208 '(objectClass=*)' > /dev/null 2>&1
210 if test $RC != 0 ; then
211 echo "ldapsearch failed ($RC)!"
212 test $KILLSERVERS != no && kill -HUP $KILLPIDS
216 echo "Re-searching the proxy..."
217 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
218 '(objectClass=*)' > /dev/null 2>&1
220 if test $RC != 0 ; then
221 echo "ldapsearch failed ($RC)!"
222 test $KILLSERVERS != no && kill -HUP $KILLPIDS
226 test $KILLSERVERS != no && kill -HUP $KILLPIDS
228 echo ">>>>> Test succeeded"
230 test $KILLSERVERS != no && wait