]> git.sur5r.net Git - openldap/blob - tests/scripts/passwd-search
Add cn=monitor, cn=config, cn=schema to namingContexts.
[openldap] / tests / scripts / passwd-search
1 #! /bin/sh
2
3 if test $# -eq 0 ; then
4         SRCDIR="."
5 else
6         SRCDIR=$1; shift
7 fi
8 if test $# -eq 1 ; then
9         BACKEND=$1; shift
10 fi
11
12 echo "running defines.sh $SRCDIR $BACKEND"
13 . $SRCDIR/scripts/defines.sh
14
15 echo "Cleaning up in $DBDIR..."
16
17 rm -f $DBDIR/[!C]*
18
19 echo "Starting slapd on TCP/IP port $PORT..."
20 $SLAPD -f $PASSWDCONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
21 PID=$!
22
23 echo "Testing slapd searching..."
24 for i in 0 1 2 3 4 5; do
25         $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $PORT \
26                 'objectclass=*' > /dev/null 2>&1
27         RC=$?
28         if test $RC = 1 ; then
29                 echo "Waiting 5 seconds for slapd to start..."
30                 sleep 5
31         fi
32 done
33
34 if test $RC != 0 ; then
35         echo "ldapsearch failed!"
36         kill -HUP $PID
37         exit $RC
38 fi
39
40 cat /dev/null > $TESTOUT
41
42 echo "Testing base suffix searching..."
43 $LDAPSEARCH -L -S "" -b "$BASEDN" -s base -h localhost -p $PORT \
44         '(objectclass=*)' >> $TESTOUT 2>&1
45 if test $RC != 0 ; then
46         echo "ldapsearch failed!"
47         kill -HUP $PID
48         exit $RC
49 fi
50
51 echo " ------------ " >> $TESTOUT
52
53 echo "Testing user searching..."
54 $LDAPSEARCH -L -S "" -b "uid=root,$BASEDN" -s base -h localhost -p $PORT \
55         '(objectclass=*)' >> $TESTOUT 2>&1
56 if test $RC != 0 ; then
57         echo "ldapsearch failed!"
58         kill -HUP $PID
59         exit $RC
60 fi
61
62 echo " ------------ " >> $TESTOUT
63
64 echo "Testing exact searching..."
65 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
66         '(uid=root)' >> $TESTOUT 2>&1
67 if test $RC != 0 ; then
68         echo "ldapsearch failed!"
69         kill -HUP $PID
70         exit $RC
71 fi
72
73 echo " ------------ " >> $TESTOUT
74
75 echo "Testing OR searching..."
76 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
77         '(|(objectclass=person)(cn=root))' >> $TESTOUT 2>&1
78 if test $RC != 0 ; then
79         echo "ldapsearch failed!"
80         kill -HUP $PID
81         exit $RC
82 fi
83
84 echo " ------------ " >> $TESTOUT
85
86 echo "Testing AND searching..."
87 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
88         '(&(objectclass=person)(cn=root))' >> $TESTOUT 2>&1
89 if test $RC != 0 ; then
90         echo "ldapsearch failed!"
91         kill -HUP $PID
92         exit $RC
93 fi
94
95 kill -HUP $PID
96
97 echo "Assuming everything is fine."
98 #echo "Comparing results"
99 #cmp $TESTOUT $SEARCHOUTMASTER
100 #if test $? != 0 ; then
101 #       echo "Comparison failed"
102 #       exit 1
103 #fi
104
105 echo ">>>>> Test succeeded"
106
107
108 exit 0