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 if test $DYNLIST = "dynlistno" ; then
19 echo "dynlist overlay not available, test skipped"
23 mkdir -p $TESTDIR $DBDIR1
25 echo "Running slapadd to build slapd database..."
26 . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
27 $SLAPADD -f $ADDCONF -l $LDIFORDERED
29 if test $RC != 0 ; then
30 echo "slapadd failed ($RC)!"
34 echo "Running slapindex to index slapd database..."
35 . $CONFFILTER $BACKEND $MONITORDB < $DYNLISTCONF > $CONF1
38 if test $RC != 0 ; then
39 echo "warning: slapindex failed ($RC)"
40 echo " assuming no indexing support"
43 echo "Starting slapd on TCP/IP port $PORT1..."
44 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
46 if test $WAIT != 0 ; then
54 echo "Testing slapd searching..."
55 for i in 0 1 2 3 4 5; do
56 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
57 '(objectclass=*)' > /dev/null 2>&1
59 if test $RC = 0 ; then
62 echo "Waiting 5 seconds for slapd to start..."
66 if test $RC != 0 ; then
67 echo "ldapsearch failed ($RC)!"
68 test $KILLSERVERS != no && kill -HUP $KILLPIDS
72 cat /dev/null > $SEARCHOUT
74 LISTDN="ou=Dynamic Lists,$BASEDN"
75 echo "Adding a dynamic list..."
76 $LDAPADD -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
77 > $TESTOUT 2>&1 << EOMODS
79 objectClass: organizationalUnit
82 dn: cn=Dynamic List,$LISTDN
83 objectClass: groupOfURLs
85 memberURL: ldap:///ou=People,${BASEDN}?cn,mail?sub?(objectClass=person)
88 echo "Testing list search of all attrs..."
89 echo "# Testing list search of all attrs..." >> $SEARCHOUT
90 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
91 '(cn=Dynamic List)' '*' \
94 if test $RC != 0 ; then
95 echo "ldapsearch failed ($RC)!"
96 test $KILLSERVERS != no && kill -HUP $KILLPIDS
100 echo "Testing list search of a listed attr..."
101 echo "# Testing list search of a listed attr..." >> $SEARCHOUT
102 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
103 '(cn=Dynamic List)' mail \
106 if test $RC != 0 ; then
107 echo "ldapsearch failed ($RC)!"
108 test $KILLSERVERS != no && kill -HUP $KILLPIDS
112 echo "Testing list search of a non-listed attr..."
113 echo "# Testing list search of a non-listed attr..." >> $SEARCHOUT
114 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
115 '(cn=Dynamic List)' objectClass \
118 if test $RC != 0 ; then
119 echo "ldapsearch failed ($RC)!"
120 test $KILLSERVERS != no && kill -HUP $KILLPIDS
124 echo "Testing list search with (critical) manageDSAit..."
125 echo "# Testing list search with (critical) manageDSAit..." >> $SEARCHOUT
126 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 -MM \
127 '(cn=Dynamic List)' '*' \
130 if test $RC != 0 ; then
131 echo "ldapsearch failed ($RC)!"
132 test $KILLSERVERS != no && kill -HUP $KILLPIDS
136 echo "Testing list compare..."
137 echo "# Testing list compare..." >> $SEARCHOUT
138 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
139 "cn=Dynamic List,$LISTDN" "cn:Bjorn Jensen" \
144 echo "ldapcompare returned FALSE ($RC)!"
145 test $KILLSERVERS != no && kill -HUP $KILLPIDS
149 echo "ldapcompare returned TRUE ($RC)"
152 echo "ldapcompare returned success ($RC)!"
153 test $KILLSERVERS != no && kill -HUP $KILLPIDS
157 echo "ldapcompare failed ($RC)!"
158 test $KILLSERVERS != no && kill -HUP $KILLPIDS
162 echo "" >> $SEARCHOUT
164 echo "Testing list compare with manageDSAit..."
165 echo "# Testing list compare with manageDSAit..." >> $SEARCHOUT
166 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 -MM \
167 "cn=Dynamic List,$LISTDN" "cn:Bjorn Jensen" \
172 echo "ldapcompare returned FALSE ($RC)"
175 echo "ldapcompare returned TRUE ($RC)!"
176 test $KILLSERVERS != no && kill -HUP $KILLPIDS
180 echo "ldapcompare returned success ($RC)!"
181 test $KILLSERVERS != no && kill -HUP $KILLPIDS
185 echo "ldapcompare failed ($RC)!"
186 test $KILLSERVERS != no && kill -HUP $KILLPIDS
190 echo "" >> $SEARCHOUT
192 echo "Stopping slapd..."
196 echo "Reconfiguring slapd..."
197 echo "dynlist-member-ad member" >> $CONF1
199 echo "==========================================================" >> $LOG1
201 echo "Starting slapd on TCP/IP port $PORT1..."
202 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
204 if test $WAIT != 0 ; then
212 echo "Testing slapd searching..."
213 for i in 0 1 2 3 4 5; do
214 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
215 '(objectclass=*)' > /dev/null 2>&1
217 if test $RC = 0 ; then
220 echo "Waiting 5 seconds for slapd to start..."
224 if test $RC != 0 ; then
225 echo "ldapsearch failed ($RC)!"
226 test $KILLSERVERS != no && kill -HUP $KILLPIDS
230 echo "Adding a dynamic list..."
231 $LDAPADD -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
232 > $TESTOUT 2>&1 << EOMODS
233 dn: cn=Dynamic List of Members,$LISTDN
234 objectClass: groupOfURLs
235 cn: Dynamic List of Members
236 memberURL: ldap:///ou=People,${BASEDN}??sub?(objectClass=person)
239 echo "Testing list search of all attrs..."
240 echo "# Testing list search of all attrs..." >> $SEARCHOUT
241 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
242 '(cn=Dynamic List of Members)' '*' \
245 if test $RC != 0 ; then
246 echo "ldapsearch failed ($RC)!"
247 test $KILLSERVERS != no && kill -HUP $KILLPIDS
251 echo "Testing list search of a listed attr..."
252 echo "# Testing list search of a listed attr..." >> $SEARCHOUT
253 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
254 '(cn=Dynamic List of Members)' member \
257 if test $RC != 0 ; then
258 echo "ldapsearch failed ($RC)!"
259 test $KILLSERVERS != no && kill -HUP $KILLPIDS
263 echo "Testing list search of a non-listed attr..."
264 echo "# Testing list search of a non-listed attr..." >> $SEARCHOUT
265 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
266 '(cn=Dynamic List of Members)' objectClass \
269 if test $RC != 0 ; then
270 echo "ldapsearch failed ($RC)!"
271 test $KILLSERVERS != no && kill -HUP $KILLPIDS
275 echo "Testing list search with (critical) manageDSAit..."
276 echo "# Testing list search with (critical) manageDSAit..." >> $SEARCHOUT
277 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 -MM \
278 '(&(cn=Dynamic List of Members)(objectClass=groupOfURLs))' '*' \
281 if test $RC != 0 ; then
282 echo "ldapsearch failed ($RC)!"
283 test $KILLSERVERS != no && kill -HUP $KILLPIDS
287 CMPDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN"
288 echo "Testing list compare..."
289 echo "# Testing list compare..." >> $SEARCHOUT
290 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
291 "cn=Dynamic List,$LISTDN" "member:$CMPDN" \
296 echo "ldapcompare returned FALSE ($RC)!"
297 test $KILLSERVERS != no && kill -HUP $KILLPIDS
301 echo "ldapcompare returned TRUE ($RC)"
304 echo "ldapcompare returned success ($RC)!"
305 test $KILLSERVERS != no && kill -HUP $KILLPIDS
309 echo "ldapcompare failed ($RC)!"
310 test $KILLSERVERS != no && kill -HUP $KILLPIDS
314 echo "" >> $SEARCHOUT
316 echo "Testing list compare with manageDSAit..."
317 echo "# Testing list compare with manageDSAit..." >> $SEARCHOUT
318 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 -MM \
319 "cn=Dynamic List,$LISTDN" "member:$CMPDN" \
324 echo "ldapcompare returned FALSE ($RC)"
327 echo "ldapcompare returned TRUE ($RC)!"
328 test $KILLSERVERS != no && kill -HUP $KILLPIDS
332 echo "ldapcompare returned success ($RC)!"
333 test $KILLSERVERS != no && kill -HUP $KILLPIDS
337 echo "ldapcompare failed ($RC)!"
338 test $KILLSERVERS != no && kill -HUP $KILLPIDS
342 echo "" >> $SEARCHOUT
344 test $KILLSERVERS != no && kill -HUP $KILLPIDS
348 echo "Filtering ldapsearch results..."
349 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
350 echo "Filtering original ldif used to create database..."
351 . $LDIFFILTER < $LDIF > $LDIFFLT
352 echo "Comparing filter output..."
353 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
355 if test $? != 0 ; then
356 echo "Comparison failed"
360 echo ">>>>> Test succeeded"