5 if test $# -ge 1 ; then
9 . $SRCDIR/scripts/args.sh $*
11 echo "running defines.sh"
12 . $SRCDIR/scripts/defines.sh
15 # Test default referral
19 echo "Cleaning up in $DBDIR and $REPLDIR ..."
24 echo "Running slapadd to build slapd database..."
25 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $DBCONF
26 $SLAPADD -f $DBCONF -l $LDIFORDERED
28 if test $RC != 0 ; then
29 echo "slapadd failed ($RC)!"
33 echo "Starting master slapd on TCP/IP port $PORT..."
34 $SLAPD -n master -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
36 if test $WAIT != 0 ; then
41 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
42 . $CONFFILTER $BACKEND $MONITORDB < $REFSLAVECONF > $REPLCONF
43 $SLAPD -n slave -f $REPLCONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
45 if test $WAIT != 0 ; then
46 echo SLAVEPID $SLAVEPID
50 echo "Testing for master slapd..."
51 for i in 0 1 2 3 4 5; do
52 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
53 'objectclass=*' > /dev/null 2>&1
55 if test $RC = 0 ; then
58 echo "Waiting 5 seconds for slapd to start..."
62 if test $RC != 0 ; then
63 echo "ldapsearch failed ($RC)!"
68 echo "Testing for slave slapd..."
69 for i in 0 1 2 3 4 5; do
70 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $SLAVEPORT \
71 'objectclass=*' > /dev/null 2>&1
73 if test $RC = 0 ; then
76 echo "Waiting 5 seconds for slapd to start..."
80 cat /dev/null > $SEARCHOUT
82 echo "Testing exact searching..."
83 $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
84 'sn=jensen' >> $SEARCHOUT 2>&1
86 if test $RC != 0 ; then
87 echo "ldapsearch failed ($RC)!"
88 kill -HUP $PID $SLAVEPID
92 echo "Testing OR searching..."
93 $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
94 '(|(objectclass=groupofnames)(objectClass=groupofuniquenames)(sn=jones))' >> $SEARCHOUT 2>&1
96 if test $RC != 0 ; then
97 echo "ldapsearch failed ($RC)!"
98 kill -HUP $PID $SLAVEPID
102 echo "Testing AND matching and ends-with searching..."
103 $LDAPSEARCH -C -S "" -b "ou=groups,$BASEDN" -s one -h $LOCALHOST -p $SLAVEPORT \
104 '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1
106 if test $RC != 0 ; then
107 echo "ldapsearch failed ($RC)!"
108 kill -HUP $PID $SLAVEPID
112 echo "Testing NOT searching..."
113 $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
114 '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1
116 if test $RC != 0 ; then
117 echo "ldapsearch failed ($RC)!"
118 kill -HUP $PID $SLAVEPID
122 echo "Testing objectClass/attributeType inheritance ..."
123 $LDAPSEARCH -M -a never -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
124 '(&(objectClass=inetorgperson)(userid=uham))' \
125 "2.5.4.0" "userid" >> $SEARCHOUT 2>&1
127 if test $RC != 0 ; then
128 echo "ldapsearch failed ($RC)!"
134 kill -HUP $PID $SLAVEPID
136 LDIF=$SEARCHOUTMASTER
138 echo "Filtering ldapsearch results..."
139 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
140 echo "Filtering original ldif used to create database..."
141 . $LDIFFILTER < $LDIF > $LDIFFLT
142 echo "Comparing filter output..."
143 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
145 if test $? != 0 ; then
146 echo "Comparison failed"
150 echo ">>>>> Test succeeded"