1*e670fd5cSchristos#! /bin/sh 2*e670fd5cSchristos# $OpenLDAP$ 3*e670fd5cSchristos## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4*e670fd5cSchristos## 5*e670fd5cSchristos## Copyright 1998-2021 The OpenLDAP Foundation. 6*e670fd5cSchristos## All rights reserved. 7*e670fd5cSchristos## 8*e670fd5cSchristos## Redistribution and use in source and binary forms, with or without 9*e670fd5cSchristos## modification, are permitted only as authorized by the OpenLDAP 10*e670fd5cSchristos## Public License. 11*e670fd5cSchristos## 12*e670fd5cSchristos## A copy of this license is available in the file LICENSE in the 13*e670fd5cSchristos## top-level directory of the distribution or, alternatively, at 14*e670fd5cSchristos## <http://www.OpenLDAP.org/license.html>. 15*e670fd5cSchristos 16*e670fd5cSchristosecho "running defines.sh" 17*e670fd5cSchristos. $SRCDIR/scripts/defines.sh 18*e670fd5cSchristos 19*e670fd5cSchristosmkdir -p $TESTDIR $DBDIR1 $DBDIR2 $DBDIR3 20*e670fd5cSchristos 21*e670fd5cSchristos$SLAPPASSWD -g -n >$CONFIGPWF 22*e670fd5cSchristosecho "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf 23*e670fd5cSchristos 24*e670fd5cSchristosecho "Starting slapd on TCP/IP port $PORT2..." 25*e670fd5cSchristos. $CONFFILTER $BACKEND < $SCHEMACONF > $CONF2 26*e670fd5cSchristos$SLAPD -f $CONF2 -h $URI2 -d $LVL > $LOG2 2>&1 & 27*e670fd5cSchristosPID=$! 28*e670fd5cSchristosif test $WAIT != 0 ; then 29*e670fd5cSchristos echo PID $PID 30*e670fd5cSchristos read foo 31*e670fd5cSchristosfi 32*e670fd5cSchristosKILLPIDS="$PID" 33*e670fd5cSchristos 34*e670fd5cSchristosecho "Starting a second slapd on TCP/IP port $PORT3..." 35*e670fd5cSchristossed -e "s,$DBDIR1,$DBDIR2," < $CONF2 > $CONF3 36*e670fd5cSchristos$SLAPD -f $CONF3 -h $URI3 -d $LVL > $LOG3 2>&1 & 37*e670fd5cSchristosPID=$! 38*e670fd5cSchristosif test $WAIT != 0 ; then 39*e670fd5cSchristos echo PID $PID 40*e670fd5cSchristos read foo 41*e670fd5cSchristosfi 42*e670fd5cSchristosKILLPIDS="$KILLPIDS $PID" 43*e670fd5cSchristos 44*e670fd5cSchristosecho "Starting a third slapd on TCP/IP port $PORT4..." 45*e670fd5cSchristossed -e "s,$DBDIR1,$DBDIR3," < $CONF2 > $CONF4 46*e670fd5cSchristos$SLAPD -f $CONF4 -h $URI4 -d $LVL > $LOG4 2>&1 & 47*e670fd5cSchristosPID=$! 48*e670fd5cSchristosif test $WAIT != 0 ; then 49*e670fd5cSchristos echo PID $PID 50*e670fd5cSchristos read foo 51*e670fd5cSchristosfi 52*e670fd5cSchristosKILLPIDS="$KILLPIDS $PID" 53*e670fd5cSchristos 54*e670fd5cSchristosecho "Starting lloadd on TCP/IP port $PORT1..." 55*e670fd5cSchristos. $CONFFILTER $BACKEND < $LLOADDANONCONF > $CONF1.lloadd 56*e670fd5cSchristosif test $AC_lloadd = lloaddyes; then 57*e670fd5cSchristos $LLOADD -f $CONF1.lloadd -h $URI1 -d $LVL > $LOG1 2>&1 & 58*e670fd5cSchristoselse 59*e670fd5cSchristos . $CONFFILTER $BACKEND < $SLAPDLLOADCONF > $CONF1.slapd 60*e670fd5cSchristos # FIXME: this won't work on Windows, but lloadd doesn't support Windows yet 61*e670fd5cSchristos $SLAPD -f $CONF1.slapd -h $URI6 -d $LVL > $LOG1 2>&1 & 62*e670fd5cSchristosfi 63*e670fd5cSchristosPID=$! 64*e670fd5cSchristosif test $WAIT != 0 ; then 65*e670fd5cSchristos echo PID $PID 66*e670fd5cSchristos read foo 67*e670fd5cSchristosfi 68*e670fd5cSchristosKILLPIDS="$KILLPIDS $PID" 69*e670fd5cSchristos 70*e670fd5cSchristossleep $SLEEP0 71*e670fd5cSchristos 72*e670fd5cSchristosecho "Using ldapsearch to retrieve the root DSE..." 73*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 74*e670fd5cSchristos $LDAPSEARCH -b "" -s base -H $URI1 \ 75*e670fd5cSchristos '@extensibleObject' > $SEARCHOUT 2>&1 76*e670fd5cSchristos RC=$? 77*e670fd5cSchristos if test $RC = 0 ; then 78*e670fd5cSchristos break 79*e670fd5cSchristos fi 80*e670fd5cSchristos echo "Waiting $SLEEP1 seconds for lloadd to start..." 81*e670fd5cSchristos sleep $SLEEP1 82*e670fd5cSchristosdone 83*e670fd5cSchristos 84*e670fd5cSchristosif test $RC = 0 ; then 85*e670fd5cSchristos echo "Using ldapsearch to retrieve the cn=Subschema..." 86*e670fd5cSchristos $LDAPSEARCH -b "cn=Subschema" -s base -H $URI1 \ 87*e670fd5cSchristos '(&(objectClasses=top)(objectClasses=2.5.6.0))' cn objectClass \ 88*e670fd5cSchristos >> $SEARCHOUT 2>&1 89*e670fd5cSchristos RC=$? 90*e670fd5cSchristos 91*e670fd5cSchristosfi 92*e670fd5cSchristos 93*e670fd5cSchristosif test $RC = 0 ; then 94*e670fd5cSchristos echo "Using ldapsearch to retrieve the cn=Monitor..." 95*e670fd5cSchristos $LDAPSEARCH -b "cn=Monitor" -s base -H $URI1 \ 96*e670fd5cSchristos '@monitor' >> $SEARCHOUT 2>&1 97*e670fd5cSchristos RC=$? 98*e670fd5cSchristosfi 99*e670fd5cSchristos 100*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS 101*e670fd5cSchristos 102*e670fd5cSchristoscount=3 103*e670fd5cSchristosif test $RC != 0 ; then 104*e670fd5cSchristos echo ">>>>> Test failed" 105*e670fd5cSchristoselse 106*e670fd5cSchristos RC=`grep '^dn:' $SEARCHOUT | wc -l` 107*e670fd5cSchristos if test $RC != $count ; then 108*e670fd5cSchristos echo ">>>>> Test failed: expected $count entries, got" $RC 109*e670fd5cSchristos RC=1 110*e670fd5cSchristos else 111*e670fd5cSchristos echo ">>>>> Test succeeded" 112*e670fd5cSchristos RC=0 113*e670fd5cSchristos fi 114*e670fd5cSchristosfi 115*e670fd5cSchristos 116*e670fd5cSchristostest $KILLSERVERS != no && wait 117*e670fd5cSchristos 118*e670fd5cSchristosexit $RC 119