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 "Starting slapd on TCP/IP port $PORT1..."
195 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
197 if test $WAIT != 0 ; then
205 echo "Testing slapd searching..."
206 for i in 0 1 2 3 4 5; do
207 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
208 '(objectclass=*)' > /dev/null 2>&1
210 if test $RC = 0 ; then
213 echo "Waiting 5 seconds for slapd to start..."
217 if test $RC != 0 ; then
218 echo "ldapsearch failed ($RC)!"
219 test $KILLSERVERS != no && kill -HUP $KILLPIDS
223 echo "Adding a dynamic list..."
224 $LDAPADD -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
225 > $TESTOUT 2>&1 << EOMODS
226 dn: cn=Dynamic List of Members,$LISTDN
227 objectClass: groupOfURLs
228 cn: Dynamic List of Members
229 memberURL: ldap:///ou=People,${BASEDN}??sub?(objectClass=person)
232 echo "Testing list search of all attrs..."
233 echo "# Testing list search of all attrs..." >> $SEARCHOUT
234 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
235 '(cn=Dynamic List of Members)' '*' \
238 if test $RC != 0 ; then
239 echo "ldapsearch failed ($RC)!"
240 test $KILLSERVERS != no && kill -HUP $KILLPIDS
244 echo "Testing list search of a listed attr..."
245 echo "# Testing list search of a listed attr..." >> $SEARCHOUT
246 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
247 '(cn=Dynamic List of Members)' member \
250 if test $RC != 0 ; then
251 echo "ldapsearch failed ($RC)!"
252 test $KILLSERVERS != no && kill -HUP $KILLPIDS
256 echo "Testing list search of a non-listed attr..."
257 echo "# Testing list search of a non-listed attr..." >> $SEARCHOUT
258 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
259 '(cn=Dynamic List of Members)' objectClass \
262 if test $RC != 0 ; then
263 echo "ldapsearch failed ($RC)!"
264 test $KILLSERVERS != no && kill -HUP $KILLPIDS
268 echo "Testing list search with (critical) manageDSAit..."
269 echo "# Testing list search with (critical) manageDSAit..." >> $SEARCHOUT
270 $LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 -MM \
271 '(&(cn=Dynamic List of Members)(objectClass=groupOfURLs))' '*' \
274 if test $RC != 0 ; then
275 echo "ldapsearch failed ($RC)!"
276 test $KILLSERVERS != no && kill -HUP $KILLPIDS
280 CMPDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN"
281 echo "Testing list compare..."
282 echo "# Testing list compare..." >> $SEARCHOUT
283 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
284 "cn=Dynamic List,$LISTDN" "member:$CMPDN" \
289 echo "ldapcompare returned FALSE ($RC)!"
290 test $KILLSERVERS != no && kill -HUP $KILLPIDS
294 echo "ldapcompare returned TRUE ($RC)"
297 echo "ldapcompare returned success ($RC)!"
298 test $KILLSERVERS != no && kill -HUP $KILLPIDS
302 echo "ldapcompare failed ($RC)!"
303 test $KILLSERVERS != no && kill -HUP $KILLPIDS
307 echo "" >> $SEARCHOUT
309 echo "Testing list compare with manageDSAit..."
310 echo "# Testing list compare with manageDSAit..." >> $SEARCHOUT
311 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 -MM \
312 "cn=Dynamic List,$LISTDN" "member:$CMPDN" \
317 echo "ldapcompare returned FALSE ($RC)"
320 echo "ldapcompare returned TRUE ($RC)!"
321 test $KILLSERVERS != no && kill -HUP $KILLPIDS
325 echo "ldapcompare returned success ($RC)!"
326 test $KILLSERVERS != no && kill -HUP $KILLPIDS
330 echo "ldapcompare failed ($RC)!"
331 test $KILLSERVERS != no && kill -HUP $KILLPIDS
335 echo "" >> $SEARCHOUT
337 test $KILLSERVERS != no && kill -HUP $KILLPIDS
341 echo "Filtering ldapsearch results..."
342 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
343 echo "Filtering original ldif used to create database..."
344 . $LDIFFILTER < $LDIF > $LDIFFLT
345 echo "Comparing filter output..."
346 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
348 if test $? != 0 ; then
349 echo "Comparison failed"
353 echo ">>>>> Test succeeded"