3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2005 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
18 echo "running defines.sh"
19 . $SRCDIR/scripts/defines.sh
21 mkdir $TESTDIR $DBDIR1
23 echo "Running slapadd to build slapd database..."
24 . $CONFFILTER $BACKEND $MONITORDB < $RCONF > $CONF1
25 $SLAPADD -f $CONF1 -l $LDIFREF
27 if test $RC != 0 ; then
28 echo "slapadd failed ($RC)!"
32 echo "Starting slapd on TCP/IP port $PORT1..."
33 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
35 if test $WAIT != 0 ; then
41 echo "Testing slapd searching..."
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 slapd to start..."
53 if test $RC != 0 ; then
54 echo "ldapsearch failed ($RC)!"
55 test $KILLSERVERS != no && kill -HUP $KILLPIDS
59 cat /dev/null > $SEARCHOUT
61 echo "Testing ManageDsaIT searching at $REFDN..."
62 $LDAPRSEARCH -S "" -MM -b "$REFDN" -h $LOCALHOST -p $PORT1 \
63 '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
65 if test $RC != 0 ; then
66 echo "ldapsearch failed ($RC)!"
67 test $KILLSERVERS != no && kill -HUP $KILLPIDS
71 echo "Testing ManageDsaIT searching at referral object..."
72 $LDAPRSEARCH -S "" -MM -b "o=abc,$REFDN" -h $LOCALHOST -p $PORT1 \
73 '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
75 if test $RC != 0 ; then
76 echo "ldapsearch failed ($RC)!"
77 test $KILLSERVERS != no && kill -HUP $KILLPIDS
81 echo "Testing ManageDsaIT searching below referral object..."
82 $LDAPRSEARCH -S "" -MM -b "uid=xxx,o=abc,$REFDN" -h $LOCALHOST -p $PORT1 \
83 '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
85 if test $RC != $RCODE ; then
86 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
87 test $KILLSERVERS != no && kill -HUP $KILLPIDS
92 echo "Testing base searching at $XREFDN..."
93 $LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
95 if test $RC != 0 ; then
96 echo "ldapsearch failed ($RC)!"
97 test $KILLSERVERS != no && kill -HUP $KILLPIDS
101 echo "Testing one-level searching at $XREFDN..."
102 $LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
104 if test $RC != 0 ; then
105 echo "ldapsearch failed ($RC)!"
106 test $KILLSERVERS != no && kill -HUP $KILLPIDS
110 echo "Testing subtree searching at $XREFDN..."
111 $LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
113 if test $RC != 0 ; then
114 echo "ldapsearch failed ($RC)!"
115 test $KILLSERVERS != no && kill -HUP $KILLPIDS
119 XREFDN="o=abc,$REFDN"
120 echo "Testing base searching at $XREFDN..."
121 $LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
123 if test $RC != $RCODE ; then
124 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
125 test $KILLSERVERS != no && kill -HUP $KILLPIDS
129 echo "Testing one-level searching at $XREFDN..."
130 $LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
132 if test $RC != $RCODE ; then
133 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
134 test $KILLSERVERS != no && kill -HUP $KILLPIDS
138 echo "Testing subtree searching at $XREFDN..."
139 $LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
141 if test $RC != $RCODE ; then
142 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
143 test $KILLSERVERS != no && kill -HUP $KILLPIDS
147 XREFDN="uid=xxx,o=abc,$REFDN"
148 echo "Testing base searching at $XREFDN..."
149 $LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
151 if test $RC != $RCODE ; then
152 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
153 test $KILLSERVERS != no && kill -HUP $KILLPIDS
157 echo "Testing one-level searching at $XREFDN..."
158 $LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
160 if test $RC != $RCODE ; then
161 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
162 test $KILLSERVERS != no && kill -HUP $KILLPIDS
166 echo "Testing subtree searching at $XREFDN..."
167 $LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT1 1.1 >> $SEARCHOUT 2>&1
169 if test $RC != $RCODE ; then
170 echo "ldapsearch: unexpected result ($RC)! (referral expected)"
171 test $KILLSERVERS != no && kill -HUP $KILLPIDS
175 test $KILLSERVERS != no && kill -HUP $KILLPIDS
177 LDIF=$SEARCHOUTMASTER
178 echo "Filtering ldapsearch results..."
179 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
180 echo "Filtering expected LDIF for comparison..."
181 . $LDIFFILTER < $REFERRALOUT > $LDIFFLT
182 echo "Comparing filter output..."
183 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
185 if test $? != 0 ; then
186 echo "Comparison failed"
190 echo ">>>>> Test succeeded"