6 if test $# -ge 1 ; then
10 . $SRCDIR/scripts/args.sh $*
12 echo "running defines.sh"
13 . $SRCDIR/scripts/defines.sh
15 echo "Cleaning up in $DBDIR..."
19 echo "Running slapadd to build slapd database..."
20 . $CONFFILTER $BACKEND $MONITORDB < $RCONF > $DBCONF
21 $SLAPADD -f $DBCONF -l $LDIFREF
23 if test $RC != 0 ; then
24 echo "slapadd failed ($RC)!"
28 echo "Starting slapd on TCP/IP port $PORT..."
29 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
31 if test $WAIT != 0 ; then
36 echo "Testing slapd searching..."
37 for i in 0 1 2 3 4 5; do
38 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
39 '(objectclass=*)' > /dev/null 2>&1
41 if test $RC = 0 ; then
44 echo "Waiting 5 seconds for slapd to start..."
48 if test $RC != 0 ; then
49 echo "ldapsearch failed ($RC)!"
54 cat /dev/null > $SEARCHOUT
56 echo "Testing ManageDsaIT searching at $REFDN..."
57 $LDAPRSEARCH -S "" -MM -b "$REFDN" -h $LOCALHOST -p $PORT \
58 '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
60 if test $RC != 0 ; then
61 echo "ldapsearch failed ($RC)!"
66 echo "Testing ManageDsaIT searching at referral object..."
67 $LDAPRSEARCH -S "" -MM -b "o=abc,$REFDN" -h $LOCALHOST -p $PORT \
68 '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
70 if test $RC != 0 ; then
71 echo "ldapsearch failed ($RC)!"
76 echo "Testing ManageDsaIT searching below referral object..."
77 $LDAPRSEARCH -S "" -MM -b "uid=xxx,o=abc,$REFDN" -h $LOCALHOST -p $PORT \
78 '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
80 if test $RC != $RCODE ; then
81 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
87 echo "Testing base searching at $XREFDN..."
88 $LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
90 if test $RC != 0 ; then
91 echo "ldapsearch failed ($RC)!"
96 echo "Testing one-level searching at $XREFDN..."
97 $LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
99 if test $RC != 0 ; then
100 echo "ldapsearch failed ($RC)!"
105 echo "Testing subtree searching at $XREFDN..."
106 $LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
108 if test $RC != 0 ; then
109 echo "ldapsearch failed ($RC)!"
114 XREFDN="o=abc,$REFDN"
115 echo "Testing base searching at $XREFDN..."
116 $LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
118 if test $RC != $RCODE ; then
119 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
124 echo "Testing one-level searching at $XREFDN..."
125 $LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
127 if test $RC != $RCODE ; then
128 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
133 echo "Testing subtree searching at $XREFDN..."
134 $LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
136 if test $RC != $RCODE ; then
137 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
142 XREFDN="uid=xxx,o=abc,$REFDN"
143 echo "Testing base searching at $XREFDN..."
144 $LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
146 if test $RC != $RCODE ; then
147 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
152 echo "Testing one-level searching at $XREFDN..."
153 $LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
155 if test $RC != $RCODE ; then
156 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
161 echo "Testing subtree searching at $XREFDN..."
162 $LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
164 if test $RC != $RCODE ; then
165 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
171 LDIF=$SEARCHOUTMASTER
172 echo "Filtering ldapsearch results..."
173 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
174 echo "Filtering expected LDIF for comparison..."
175 . $LDIFFILTER < $REFERRALOUT > $LDIFFLT
176 echo "Comparing filter output..."
177 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
179 if test $? != 0 ; then
180 echo "Comparison failed"
184 echo ">>>>> Test succeeded"