5 # Test default referral
8 if test $# -eq 0 ; then
13 if test $# -eq 1 ; then
17 echo "running defines.sh $SRCDIR $BACKEND"
18 . $SRCDIR/scripts/defines.sh
20 echo "Cleaning up in $DBDIR and $REPLDIR ..."
25 echo "Running slapadd to build slapd database..."
26 $LDIF2LDBM -f $CONF -l $LDIF
28 if test $RC != 0 ; then
29 echo "slapadd failed!"
33 echo "Starting master slapd on TCP/IP port $PORT..."
34 $SLAPD -n master -f $CONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
37 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
38 $SLAPD -n slave -f $REFSLAVECONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
41 echo "Testing for master slapd..."
42 for i in 0 1 2 3 4 5; do
43 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
44 'objectclass=*' > /dev/null 2>&1
46 if test $RC = 1 ; then
47 echo "Waiting 5 seconds for slapd to start..."
52 if test $RC != 0 ; then
53 echo "ldapsearch failed!"
58 echo "Testing for slave slapd..."
59 for i in 0 1 2 3 4 5; do
60 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $SLAVEPORT \
61 'objectclass=*' > /dev/null 2>&1
63 if test $RC = 1 ; then
64 echo "Waiting 5 seconds for slapd to start..."
69 cat /dev/null > $SEARCHOUT
71 echo "Testing exact searching..."
72 $LDAPSEARCH -C -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
73 'sn=jensen' >> $SEARCHOUT 2>&1
74 if test $RC != 0 ; then
75 echo "ldapsearch failed!"
76 kill -HUP $PID $SLAVEPID
80 echo "Testing OR searching..."
81 $LDAPSEARCH -C -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
82 '(|(objectclass=groupofnames)(sn=jones))' >> $SEARCHOUT 2>&1
83 if test $RC != 0 ; then
84 echo "ldapsearch failed!"
85 kill -HUP $PID $SLAVEPID
89 echo "Testing AND matching and ends-with searching..."
90 $LDAPSEARCH -C -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
91 '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1
92 if test $RC != 0 ; then
93 echo "ldapsearch failed!"
94 kill -HUP $PID $SLAVEPID
98 echo "Testing NOT searching..."
99 $LDAPSEARCH -C -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
100 '(!(objectclass=person))' >> $SEARCHOUT 2>&1
101 if test $RC != 0 ; then
102 echo "ldapsearch failed!"
103 kill -HUP $PID $SLAVEPID
107 kill -HUP $PID $SLAVEPID
109 LDIF=$SEARCHOUTMASTER
111 echo "Filtering ldapsearch results..."
112 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
113 echo "Filtering original ldif used to create database..."
114 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
115 echo "Comparing filter output..."
116 $CMP $SEARCHFLT $LDIFFLT
118 if test $? != 0 ; then
119 echo "Comparison failed"
123 echo ">>>>> Test succeeded"