]> git.sur5r.net Git - openldap/blob - tests/scripts/test014-whoami
First rounded of changes in prep for 2.2.beta3
[openldap] / tests / scripts / test014-whoami
1 #! /bin/sh
2 # $OpenLDAP$
3
4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
6
7 mkdir -p $TESTDIR $DBDIR1
8
9 echo "Starting slapd on TCP/IP port $PORT..."
10 . $CONFFILTER $BACKEND $MONITORDB < $PWCONF > $CONF1
11 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
12 PID=$!
13 if test $WAIT != 0 ; then
14     echo PID $PID
15     read foo
16 fi
17 KILLPIDS="$PID"
18
19 echo "Using ldapsearch to check that slapd is running..."
20 for i in 0 1 2 3 4 5; do
21         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
22                 'objectclass=*' > /dev/null 2>&1
23         RC=$?
24         if test $RC = 0 ; then
25                 break
26         fi
27         echo "Waiting 5 seconds for slapd to start..."
28         sleep 5
29 done
30
31 echo "Testing ldapwhoami as anonymous..."
32 $LDAPWHOAMI -h $LOCALHOST -p $PORT1
33
34 RC=$?
35 if test $RC != 0 ; then
36         echo "ldapwhoami failed ($RC)!"
37         test $KILLSERVERS != no && kill -HUP $KILLPIDS
38         exit $RC
39 fi
40
41 echo "Testing ldapwhoami as ${MANAGERDN}..."
42 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD
43
44 RC=$?
45 if test $RC != 0 ; then
46         echo "ldapwhoami failed ($RC)!"
47         test $KILLSERVERS != no && kill -HUP $KILLPIDS
48         exit $RC
49 fi
50
51 echo "Testing ldapwhoami as ${MANAGERDN} for anonymous..."
52 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
53         -e \!authzid=""
54
55 RC=$?
56 if test $RC != 0 ; then
57         echo "ldapwhoami failed ($RC)!"
58         test $KILLSERVERS != no && kill -HUP $KILLPIDS
59         exit $RC
60 fi
61
62 echo "Testing ldapwhoami as ${MANAGERDN} for dn:$BABSDN..."
63 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
64         -e \!authzid="dn:$BABSDN"
65
66 RC=$?
67 if test $RC != 0 ; then
68         echo "ldapwhoami failed ($RC)!"
69         test $KILLSERVERS != no && kill -HUP $KILLPIDS
70         exit $RC
71 fi
72
73 echo "Testing ldapwhoami as ${MANAGERDN} for u:ursula..."
74 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
75         -e \!authzid="u:ursula"
76
77 RC=$?
78 if test $RC != 0 ; then
79         echo "ldapwhoami failed ($RC)!"
80         test $KILLSERVERS != no && kill -HUP $KILLPIDS
81         exit $RC
82 fi
83
84 test $KILLSERVERS != no && kill -HUP $KILLPIDS
85
86 echo ">>>>> Test succeeded"
87 exit 0