2002-03-11 08:23:18 +08:00
|
|
|
#! /bin/sh
|
|
|
|
# $OpenLDAP$
|
|
|
|
|
|
|
|
echo "running defines.sh"
|
|
|
|
. $SRCDIR/scripts/defines.sh
|
|
|
|
|
2003-10-22 13:14:08 +08:00
|
|
|
mkdir -p $TESTDIR $DBDIR1
|
2002-03-11 08:23:18 +08:00
|
|
|
|
|
|
|
echo "Starting slapd on TCP/IP port $PORT..."
|
2003-10-22 13:14:08 +08:00
|
|
|
. $CONFFILTER $BACKEND $MONITORDB < $PWCONF > $CONF1
|
|
|
|
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
|
2002-03-11 08:23:18 +08:00
|
|
|
PID=$!
|
|
|
|
if test $WAIT != 0 ; then
|
|
|
|
echo PID $PID
|
|
|
|
read foo
|
|
|
|
fi
|
2003-10-22 13:14:08 +08:00
|
|
|
KILLPIDS="$PID"
|
2002-03-11 08:23:18 +08:00
|
|
|
|
|
|
|
echo "Using ldapsearch to check that slapd is running..."
|
|
|
|
for i in 0 1 2 3 4 5; do
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
|
2002-03-11 08:23:18 +08:00
|
|
|
'objectclass=*' > /dev/null 2>&1
|
|
|
|
RC=$?
|
2002-09-01 19:39:08 +08:00
|
|
|
if test $RC = 0 ; then
|
|
|
|
break
|
2002-03-11 08:23:18 +08:00
|
|
|
fi
|
2002-09-01 19:39:08 +08:00
|
|
|
echo "Waiting 5 seconds for slapd to start..."
|
|
|
|
sleep 5
|
2002-03-11 08:23:18 +08:00
|
|
|
done
|
|
|
|
|
2002-10-30 08:17:36 +08:00
|
|
|
echo "Testing ldapwhoami as anonymous..."
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPWHOAMI -h $LOCALHOST -p $PORT1
|
2002-10-30 08:17:36 +08:00
|
|
|
|
|
|
|
RC=$?
|
|
|
|
if test $RC != 0 ; then
|
|
|
|
echo "ldapwhoami failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
2002-10-30 08:17:36 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Testing ldapwhoami as ${MANAGERDN}..."
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD
|
2002-03-11 08:23:18 +08:00
|
|
|
|
|
|
|
RC=$?
|
|
|
|
if test $RC != 0 ; then
|
|
|
|
echo "ldapwhoami failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
2002-03-11 08:23:18 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
|
|
|
|
2002-12-03 14:11:32 +08:00
|
|
|
echo "Testing ldapwhoami as ${MANAGERDN} for anonymous..."
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
|
2002-12-03 14:11:32 +08:00
|
|
|
-e \!authzid=""
|
|
|
|
|
|
|
|
RC=$?
|
|
|
|
if test $RC != 0 ; then
|
|
|
|
echo "ldapwhoami failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
2002-12-03 14:11:32 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Testing ldapwhoami as ${MANAGERDN} for dn:$BABSDN..."
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
|
2002-12-03 14:11:32 +08:00
|
|
|
-e \!authzid="dn:$BABSDN"
|
|
|
|
|
|
|
|
RC=$?
|
|
|
|
if test $RC != 0 ; then
|
|
|
|
echo "ldapwhoami failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
2002-12-06 02:14:02 +08:00
|
|
|
exit $RC
|
2002-12-03 14:11:32 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Testing ldapwhoami as ${MANAGERDN} for u:ursula..."
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
|
2002-12-03 14:11:32 +08:00
|
|
|
-e \!authzid="u:ursula"
|
|
|
|
|
|
|
|
RC=$?
|
|
|
|
if test $RC != 0 ; then
|
|
|
|
echo "ldapwhoami failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
2002-12-06 02:14:02 +08:00
|
|
|
exit $RC
|
2002-12-03 14:11:32 +08:00
|
|
|
fi
|
|
|
|
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
2002-03-11 08:23:18 +08:00
|
|
|
|
|
|
|
echo ">>>>> Test succeeded"
|
|
|
|
exit 0
|