]> git.sur5r.net Git - openldap/blob - tests/scripts/test014-whoami
Suck in HEAD changes since 2.1alpha
[openldap] / tests / scripts / test014-whoami
1 #! /bin/sh
2 # $OpenLDAP$
3
4 SRCDIR="."
5 if test $# -ge 1 ; then
6         SRCDIR=$1; shift
7 fi
8 BACKEND=bdb
9 if test $# -ge 1 ; then
10         BACKEND=$1; shift
11 fi
12 WAIT=0
13 if test $# -ge 1 ; then
14         WAIT=1; shift
15 fi
16
17 echo "running defines.sh"
18 . $SRCDIR/scripts/defines.sh
19
20 echo "Cleaning up in $DBDIR..."
21
22 rm -f $DBDIR/[!C]*
23
24 echo "Starting slapd on TCP/IP port $PORT..."
25 . $CONFFILTER $BACKEND < $PWCONF > $DBCONF
26 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
27 PID=$!
28 if test $WAIT != 0 ; then
29     echo PID $PID
30     read foo
31 fi
32
33 echo "Using ldapsearch to check that slapd is running..."
34 for i in 0 1 2 3 4 5; do
35         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
36                 'objectclass=*' > /dev/null 2>&1
37         RC=$?
38         if test $RC = 1 ; then
39                 echo "Waiting 5 seconds for slapd to start..."
40                 sleep 5
41         fi
42 done
43
44 echo "Testing ldapwhoami ..."
45 $LDAPWHOAMI -h $LOCALHOST -p $PORT \
46         -D "$MANAGERDN" -w $PASSWD
47
48 RC=$?
49 if test $RC != 0 ; then
50         echo "ldapwhoami failed ($RC)!"
51         kill -HUP $PID
52         exit $RC
53 fi
54
55 kill -HUP $PID
56
57 echo ">>>>> Test succeeded"
58
59 exit 0