2 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ## Copyright 1998-2005 The OpenLDAP Foundation.
5 ## All rights reserved.
7 ## Redistribution and use in source and binary forms, with or without
8 ## modification, are permitted only as authorized by the OpenLDAP
11 ## A copy of this license is available in the file LICENSE in the
12 ## top-level directory of the distribution or, alternatively, at
13 ## <http://www.OpenLDAP.org/license.html>.
15 echo "running defines.sh"
16 . $SRCDIR/scripts/defines.sh
18 mkdir -p $TESTDIR $DBDIR1
20 echo "Running slapadd to build slapd database..."
21 . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
22 $SLAPADD -f $ADDCONF -l $LDIFORDERED
24 if test $RC != 0 ; then
25 echo "slapadd failed ($RC)!"
29 echo "Running slapindex to index slapd database..."
30 . $CONFFILTER $BACKEND $MONITORDB < $DYNLISTCONF > $CONF1
33 if test $RC != 0 ; then
34 echo "warning: slapindex failed ($RC)"
35 echo " assuming no indexing support"
38 echo "Starting slapd on TCP/IP port $PORT1..."
39 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
41 if test $WAIT != 0 ; then
49 echo "Testing slapd searching..."
50 for i in 0 1 2 3 4 5; do
51 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
52 '(objectclass=*)' > /dev/null 2>&1
54 if test $RC = 0 ; then
57 echo "Waiting 5 seconds for slapd to start..."
61 if test $RC != 0 ; then
62 echo "ldapsearch failed ($RC)!"
63 test $KILLSERVERS != no && kill -HUP $KILLPIDS
67 cat /dev/null > $SEARCHOUT
69 LISTDN="ou=Dynamic Lists,$BASEDN"
70 echo "Adding a dynamic list..."
71 $LDAPADD -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
72 > $TESTOUT 2>&1 << EOMODS
74 objectClass: organizationalUnit
77 dn: cn=Dynamic List,$LISTDN
78 objectClass: groupOfURLs
80 memberURL: ldap:///ou=People,${BASEDN}?cn,mail?sub?(objectClass=person)
83 echo "Testing list search of all attrs..."
84 echo "# Testing list search of all attrs..." >> $SEARCHOUT
85 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
86 '(cn=Dynamic List)' '*' \
89 if test $RC != 0 ; then
90 echo "ldapsearch failed ($RC)!"
91 test $KILLSERVERS != no && kill -HUP $KILLPIDS
95 echo "Testing list search of a listed attr..."
96 echo "# Testing list search of a listed attr..." >> $SEARCHOUT
97 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
98 '(cn=Dynamic List)' mail \
101 if test $RC != 0 ; then
102 echo "ldapsearch failed ($RC)!"
103 test $KILLSERVERS != no && kill -HUP $KILLPIDS
107 echo "Testing list search of a non-listed attr..."
108 echo "# Testing list search of a non-listed attr..." >> $SEARCHOUT
109 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
110 '(cn=Dynamic List)' objectClass \
113 if test $RC != 0 ; then
114 echo "ldapsearch failed ($RC)!"
115 test $KILLSERVERS != no && kill -HUP $KILLPIDS
119 echo "Testing list search with (critical) manageDSAit..."
120 echo "# Testing list search with (critical) manageDSAit..." >> $SEARCHOUT
121 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 -MM \
122 '(cn=Dynamic List)' '*' \
125 if test $RC != 0 ; then
126 echo "ldapsearch failed ($RC)!"
127 test $KILLSERVERS != no && kill -HUP $KILLPIDS
131 echo "Testing list compare..."
132 echo "# Testing list compare..." >> $SEARCHOUT
133 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
134 "cn=Dynamic List,$LISTDN" "cn:Bjorn Jensen" \
139 echo "ldapcompare returned FALSE ($RC)!"
140 test $KILLSERVERS != no && kill -HUP $KILLPIDS
144 echo "ldapcompare returned TRUE ($RC)"
147 echo "ldapcompare returned success ($RC)!"
148 test $KILLSERVERS != no && kill -HUP $KILLPIDS
152 echo "ldapcompare failed ($RC)!"
153 test $KILLSERVERS != no && kill -HUP $KILLPIDS
157 echo "" >> $SEARCHOUT
159 echo "Testing list compare with manageDSAit..."
160 echo "# Testing list compare with manageDSAit..." >> $SEARCHOUT
161 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 -MM \
162 "cn=Dynamic List,$LISTDN" "cn:Bjorn Jensen" \
167 echo "ldapcompare returned FALSE ($RC)"
170 echo "ldapcompare returned TRUE ($RC)!"
171 test $KILLSERVERS != no && kill -HUP $KILLPIDS
175 echo "ldapcompare returned success ($RC)!"
176 test $KILLSERVERS != no && kill -HUP $KILLPIDS
180 echo "ldapcompare failed ($RC)!"
181 test $KILLSERVERS != no && kill -HUP $KILLPIDS
185 echo "" >> $SEARCHOUT
187 echo "Stopping slapd..."
191 echo "Reconfiguring slapd..."
192 echo "dynlist-member-ad member" >> $CONF1
194 echo "==========================================================" >> $LOG1
196 echo "Starting slapd on TCP/IP port $PORT1..."
197 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
199 if test $WAIT != 0 ; then
207 echo "Testing slapd searching..."
208 for i in 0 1 2 3 4 5; do
209 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
210 '(objectclass=*)' > /dev/null 2>&1
212 if test $RC = 0 ; then
215 echo "Waiting 5 seconds for slapd to start..."
219 if test $RC != 0 ; then
220 echo "ldapsearch failed ($RC)!"
221 test $KILLSERVERS != no && kill -HUP $KILLPIDS
225 echo "Adding a dynamic list..."
226 $LDAPADD -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
227 > $TESTOUT 2>&1 << EOMODS
228 dn: cn=Dynamic List of Members,$LISTDN
229 objectClass: groupOfURLs
230 cn: Dynamic List of Members
231 memberURL: ldap:///ou=People,${BASEDN}??sub?(objectClass=person)
234 echo "Testing list search of all attrs..."
235 echo "# Testing list search of all attrs..." >> $SEARCHOUT
236 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
237 '(cn=Dynamic List of Members)' '*' \
240 if test $RC != 0 ; then
241 echo "ldapsearch failed ($RC)!"
242 test $KILLSERVERS != no && kill -HUP $KILLPIDS
246 echo "Testing list search of a listed attr..."
247 echo "# Testing list search of a listed attr..." >> $SEARCHOUT
248 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
249 '(cn=Dynamic List of Members)' member \
252 if test $RC != 0 ; then
253 echo "ldapsearch failed ($RC)!"
254 test $KILLSERVERS != no && kill -HUP $KILLPIDS
258 echo "Testing list search of a non-listed attr..."
259 echo "# Testing list search of a non-listed attr..." >> $SEARCHOUT
260 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
261 '(cn=Dynamic List of Members)' objectClass \
264 if test $RC != 0 ; then
265 echo "ldapsearch failed ($RC)!"
266 test $KILLSERVERS != no && kill -HUP $KILLPIDS
270 echo "Testing list search with (critical) manageDSAit..."
271 echo "# Testing list search with (critical) manageDSAit..." >> $SEARCHOUT
272 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 -MM \
273 '(&(cn=Dynamic List of Members)(objectClass=groupOfURLs))' '*' \
276 if test $RC != 0 ; then
277 echo "ldapsearch failed ($RC)!"
278 test $KILLSERVERS != no && kill -HUP $KILLPIDS
282 CMPDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN"
283 echo "Testing list compare..."
284 echo "# Testing list compare..." >> $SEARCHOUT
285 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
286 "cn=Dynamic List,$LISTDN" "member:$CMPDN" \
291 echo "ldapcompare returned FALSE ($RC)!"
292 test $KILLSERVERS != no && kill -HUP $KILLPIDS
296 echo "ldapcompare returned TRUE ($RC)"
299 echo "ldapcompare returned success ($RC)!"
300 test $KILLSERVERS != no && kill -HUP $KILLPIDS
304 echo "ldapcompare failed ($RC)!"
305 test $KILLSERVERS != no && kill -HUP $KILLPIDS
309 echo "" >> $SEARCHOUT
311 echo "Testing list compare with manageDSAit..."
312 echo "# Testing list compare with manageDSAit..." >> $SEARCHOUT
313 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 -MM \
314 "cn=Dynamic List,$LISTDN" "member:$CMPDN" \
319 echo "ldapcompare returned FALSE ($RC)"
322 echo "ldapcompare returned TRUE ($RC)!"
323 test $KILLSERVERS != no && kill -HUP $KILLPIDS
327 echo "ldapcompare returned success ($RC)!"
328 test $KILLSERVERS != no && kill -HUP $KILLPIDS
332 echo "ldapcompare failed ($RC)!"
333 test $KILLSERVERS != no && kill -HUP $KILLPIDS
337 echo "" >> $SEARCHOUT
339 test $KILLSERVERS != no && kill -HUP $KILLPIDS
343 echo "Filtering ldapsearch results..."
344 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
345 echo "Filtering original ldif used to create database..."
346 . $LDIFFILTER < $LDIF > $LDIFFLT
347 echo "Comparing filter output..."
348 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
350 if test $? != 0 ; then
351 echo "Comparison failed"
355 echo ">>>>> Test succeeded"