4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
8 # Test default referral
11 mkdir $TESTDIR $DBDIR1 $DBDIR2
13 echo "Running slapadd to build slapd database..."
14 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
15 $SLAPADD -f $CONF1 -l $LDIFORDERED
17 if test $RC != 0 ; then
18 echo "slapadd failed ($RC)!"
22 echo "Starting master slapd on TCP/IP port $PORT1..."
23 $SLAPD -n master -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
25 if test $WAIT != 0 ; then
30 echo "Starting slave slapd on TCP/IP port $PORT2..."
31 . $CONFFILTER $BACKEND $MONITORDB < $REFSLAVECONF > $CONF2
32 $SLAPD -n slave -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
34 if test $WAIT != 0 ; then
35 echo SLAVEPID $SLAVEPID
39 KILLPIDS="$PID $SLAVEPID"
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 $PORT1 \
44 'objectclass=*' > /dev/null 2>&1
46 if test $RC = 0 ; then
49 echo "Waiting 5 seconds for master slapd to start..."
53 if test $RC != 0 ; then
54 echo "ldapsearch failed ($RC)!"
55 test $KILLSERVERS != no && kill -HUP $KILLPIDS
59 echo "Testing for slave slapd..."
60 for i in 0 1 2 3 4 5; do
61 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
62 'objectclass=*' > /dev/null 2>&1
64 if test $RC = 0 ; then
67 echo "Waiting 5 seconds for slave slapd to start..."
71 cat /dev/null > $SEARCHOUT
73 echo "Testing exact searching..."
74 $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
75 'sn=jensen' >> $SEARCHOUT 2>&1
77 if test $RC != 0 ; then
78 echo "ldapsearch failed ($RC)!"
79 test $KILLSERVERS != no && kill -HUP $KILLPIDS
83 echo "Testing OR searching..."
84 $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
85 '(|(objectclass=groupofnames)(objectClass=groupofuniquenames)(sn=jones))' >> $SEARCHOUT 2>&1
87 if test $RC != 0 ; then
88 echo "ldapsearch failed ($RC)!"
89 test $KILLSERVERS != no && kill -HUP $KILLPIDS
93 echo "Testing AND matching and ends-with searching..."
94 $LDAPSEARCH -C -S "" -b "ou=groups,$BASEDN" -s one -h $LOCALHOST -p $PORT2 \
95 '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1
97 if test $RC != 0 ; then
98 echo "ldapsearch failed ($RC)!"
99 test $KILLSERVERS != no && kill -HUP $KILLPIDS
103 echo "Testing NOT searching..."
104 $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
105 '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1
107 if test $RC != 0 ; then
108 echo "ldapsearch failed ($RC)!"
109 test $KILLSERVERS != no && kill -HUP $KILLPIDS
113 echo "Testing objectClass/attributeType inheritance ..."
114 $LDAPSEARCH -M -a never -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
115 '(&(objectClass=inetorgperson)(userid=uham))' \
116 "2.5.4.0" "userid" >> $SEARCHOUT 2>&1
118 if test $RC != 0 ; then
119 echo "ldapsearch failed ($RC)!"
120 test $KILLSERVERS != no && kill -HUP $KILLPIDS
125 test $KILLSERVERS != no && kill -HUP $KILLPIDS
127 LDIF=$SEARCHOUTMASTER
129 echo "Filtering ldapsearch results..."
130 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
131 echo "Filtering original ldif used to create database..."
132 . $LDIFFILTER < $LDIF > $LDIFFLT
133 echo "Comparing filter output..."
134 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
136 if test $? != 0 ; then
137 echo "Comparison failed"
141 echo ">>>>> Test succeeded"