]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test014-whoami
notices
[openldap] / tests / scripts / test014-whoami
index 4ca77636919f986673b2ab153eef40ad7ab687f5..21a93819c13adc9aeb2d450efe5b332c106a2463 100755 (executable)
@@ -1,23 +1,36 @@
 #! /bin/sh
 # $OpenLDAP$
+## 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>.
 
 echo "running defines.sh"
 . $SRCDIR/scripts/defines.sh
 
-mkdir $DBDIR
+mkdir -p $TESTDIR $DBDIR1
 
 echo "Starting slapd on TCP/IP port $PORT..."
-. $CONFFILTER $BACKEND $MONITORDB < $PWCONF > $DBCONF
-$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
+. $CONFFILTER $BACKEND $MONITORDB < $PWCONF > $CONF1
+$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
 PID=$!
 if test $WAIT != 0 ; then
     echo PID $PID
     read foo
 fi
+KILLPIDS="$PID"
 
 echo "Using ldapsearch to check that slapd is running..."
 for i in 0 1 2 3 4 5; do
-       $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
+       $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
                'objectclass=*' > /dev/null 2>&1
        RC=$?
        if test $RC = 0 ; then
@@ -28,59 +41,59 @@ for i in 0 1 2 3 4 5; do
 done
 
 echo "Testing ldapwhoami as anonymous..."
-$LDAPWHOAMI -h $LOCALHOST -p $PORT
+$LDAPWHOAMI -h $LOCALHOST -p $PORT1
 
 RC=$?
 if test $RC != 0 ; then
        echo "ldapwhoami failed ($RC)!"
-       kill -HUP $PID
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
 fi
 
 echo "Testing ldapwhoami as ${MANAGERDN}..."
-$LDAPWHOAMI -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD
+$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD
 
 RC=$?
 if test $RC != 0 ; then
        echo "ldapwhoami failed ($RC)!"
-       kill -HUP $PID
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
 fi
 
 echo "Testing ldapwhoami as ${MANAGERDN} for anonymous..."
-$LDAPWHOAMI -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD \
+$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
        -e \!authzid=""
 
 RC=$?
 if test $RC != 0 ; then
        echo "ldapwhoami failed ($RC)!"
-       kill -HUP $PID
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
 fi
 
 echo "Testing ldapwhoami as ${MANAGERDN} for dn:$BABSDN..."
-$LDAPWHOAMI -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD \
+$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
        -e \!authzid="dn:$BABSDN"
 
 RC=$?
 if test $RC != 0 ; then
        echo "ldapwhoami failed ($RC)!"
-       kill -HUP $PID
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
 fi
 
 echo "Testing ldapwhoami as ${MANAGERDN} for u:ursula..."
-$LDAPWHOAMI -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD \
+$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
        -e \!authzid="u:ursula"
 
 RC=$?
 if test $RC != 0 ; then
        echo "ldapwhoami failed ($RC)!"
-       kill -HUP $PID
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
 fi
 
-kill -HUP $PID
+test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
 echo ">>>>> Test succeeded"
 exit 0