6 echo "running defines.sh"
7 . $SRCDIR/scripts/defines.sh
11 echo "Running slapadd to build slapd database..."
12 . $CONFFILTER $BACKEND $MONITORDB < $RCONF > $CONF1
13 $SLAPADD -f $CONF1 -l $LDIFREF
15 if test $RC != 0 ; then
16 echo "slapadd failed ($RC)!"
20 echo "Starting slapd on TCP/IP port $PORT1..."
21 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
23 if test $WAIT != 0 ; then
29 echo "Testing slapd searching..."
30 for i in 0 1 2 3 4 5; do
31 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
32 '(objectclass=*)' > /dev/null 2>&1
34 if test $RC = 0 ; then
37 echo "Waiting 5 seconds for slapd to start..."
41 if test $RC != 0 ; then
42 echo "ldapsearch failed ($RC)!"
43 test $KILLSERVERS != no && kill -HUP $KILLPIDS
47 cat /dev/null > $SEARCHOUT
49 echo "Testing ManageDsaIT searching at $REFDN..."
50 $LDAPRSEARCH -S "" -MM -b "$REFDN" -h $LOCALHOST -p $PORT1 \
51 '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
53 if test $RC != 0 ; then
54 echo "ldapsearch failed ($RC)!"
55 test $KILLSERVERS != no && kill -HUP $KILLPIDS
59 echo "Testing ManageDsaIT searching at referral object..."
60 $LDAPRSEARCH -S "" -MM -b "o=abc,$REFDN" -h $LOCALHOST -p $PORT1 \
61 '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
63 if test $RC != 0 ; then
64 echo "ldapsearch failed ($RC)!"
65 test $KILLSERVERS != no && kill -HUP $KILLPIDS
69 echo "Testing ManageDsaIT searching below referral object..."
70 $LDAPRSEARCH -S "" -MM -b "uid=xxx,o=abc,$REFDN" -h $LOCALHOST -p $PORT1 \
71 '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
73 if test $RC != $RCODE ; then
74 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
75 test $KILLSERVERS != no && kill -HUP $KILLPIDS
80 echo "Testing base searching at $XREFDN..."
81 $LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
83 if test $RC != 0 ; then
84 echo "ldapsearch failed ($RC)!"
85 test $KILLSERVERS != no && kill -HUP $KILLPIDS
89 echo "Testing one-level searching at $XREFDN..."
90 $LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
92 if test $RC != 0 ; then
93 echo "ldapsearch failed ($RC)!"
94 test $KILLSERVERS != no && kill -HUP $KILLPIDS
98 echo "Testing subtree searching at $XREFDN..."
99 $LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
101 if test $RC != 0 ; then
102 echo "ldapsearch failed ($RC)!"
103 test $KILLSERVERS != no && kill -HUP $KILLPIDS
107 XREFDN="o=abc,$REFDN"
108 echo "Testing base searching at $XREFDN..."
109 $LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
111 if test $RC != $RCODE ; then
112 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
113 test $KILLSERVERS != no && kill -HUP $KILLPIDS
117 echo "Testing one-level searching at $XREFDN..."
118 $LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
120 if test $RC != $RCODE ; then
121 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
122 test $KILLSERVERS != no && kill -HUP $KILLPIDS
126 echo "Testing subtree searching at $XREFDN..."
127 $LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
129 if test $RC != $RCODE ; then
130 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
131 test $KILLSERVERS != no && kill -HUP $KILLPIDS
135 XREFDN="uid=xxx,o=abc,$REFDN"
136 echo "Testing base searching at $XREFDN..."
137 $LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
139 if test $RC != $RCODE ; then
140 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
141 test $KILLSERVERS != no && kill -HUP $KILLPIDS
145 echo "Testing one-level searching at $XREFDN..."
146 $LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
148 if test $RC != $RCODE ; then
149 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
150 test $KILLSERVERS != no && kill -HUP $KILLPIDS
154 echo "Testing subtree searching at $XREFDN..."
155 $LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
157 if test $RC != $RCODE ; then
158 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
159 test $KILLSERVERS != no && kill -HUP $KILLPIDS
163 test $KILLSERVERS != no && kill -HUP $KILLPIDS
165 LDIF=$SEARCHOUTMASTER
166 echo "Filtering ldapsearch results..."
167 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
168 echo "Filtering expected LDIF for comparison..."
169 . $LDIFFILTER < $REFERRALOUT > $LDIFFLT
170 echo "Comparing filter output..."
171 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
173 if test $? != 0 ; then
174 echo "Comparison failed"
178 echo ">>>>> Test succeeded"