2002-03-11 08:23:18 +08:00
|
|
|
#! /bin/sh
|
|
|
|
# $OpenLDAP$
|
2003-11-29 04:00:23 +08:00
|
|
|
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
##
|
|
|
|
## Copyright 1998-2003 The OpenLDAP Foundation.
|
|
|
|
## All rights reserved.
|
|
|
|
##
|
|
|
|
## Redistribution and use in source and binary forms, with or without
|
|
|
|
## modification, are permitted only as authorized by the OpenLDAP
|
|
|
|
## Public License.
|
|
|
|
##
|
|
|
|
## A copy of this license is available in the file LICENSE in the
|
|
|
|
## top-level directory of the distribution or, alternatively, at
|
|
|
|
## <http://www.OpenLDAP.org/license.html>.
|
2002-03-11 08:23:18 +08:00
|
|
|
|
|
|
|
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
|