3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2006 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>.
16 echo "Using $RELAY backend..."
19 echo "Starting slapd on TCP/IP port $PORT1..."
20 . $CONFFILTER $BACKEND $MONITORDB < $RELAYCONF > $CONF1
21 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
23 if test $WAIT != 0 ; then
31 echo "Using ldapsearch to check that slapd is running..."
32 for i in 0 1 2 3 4 5; do
33 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
34 'objectclass=*' > /dev/null 2>&1
36 if test $RC = 0 ; then
39 echo "Waiting 5 seconds for slapd to start..."
42 if test $RC != 0 ; then
43 echo "ldapsearch failed ($RC)!"
44 test $KILLSERVERS != no && kill -HUP $KILLPIDS
48 echo "Using ldapadd to populate the database..."
49 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
50 $LDIFORDERED > $TESTOUT 2>&1
52 if test $RC != 0 ; then
53 echo "ldapadd failed ($RC)!"
54 test $KILLSERVERS != no && kill -HUP $KILLPIDS
58 cat /dev/null > $SEARCHOUT
60 BASEDN="dc=example,dc=com"
61 echo "Searching base=\"$BASEDN\"..."
62 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
63 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
65 if test $RC != 0 ; then
66 echo "Search failed ($RC)!"
67 test $KILLSERVERS != no && kill -HUP $KILLPIDS
71 BASEDN="o=Example,c=US"
72 echo "Searching base=\"$BASEDN\"..."
73 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
74 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
76 if test $RC != 0 ; then
77 echo "Search failed ($RC)!"
78 test $KILLSERVERS != no && kill -HUP $KILLPIDS
82 BASEDN="o=Esempio,c=IT"
83 echo "Searching base=\"$BASEDN\"..."
84 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
85 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
87 if test $RC != 0 ; then
88 echo "Search failed ($RC)!"
89 test $KILLSERVERS != no && kill -HUP $KILLPIDS
93 BASEDN="o=Beispiel,c=DE"
94 echo "Searching base=\"$BASEDN\"..."
95 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
96 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
98 if test $RC != 0 ; then
99 echo "Search failed ($RC)!"
100 test $KILLSERVERS != no && kill -HUP $KILLPIDS
105 # Do some modifications
108 BASEDN="o=Beispiel,c=DE"
109 echo "Modifying database \"$BASEDN\"..."
110 $LDAPMODIFY -v -D "cn=Manager,$BASEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
111 -M >> $TESTOUT 2>&1 << EOMODS
112 dn: cn=Added User,ou=Alumni Association,ou=People,$BASEDN
114 objectClass: OpenLDAPperson
118 seealso: cn=All Staff,ou=Groups,$BASEDN
119 homephone: +49 1234567890
121 mail: auser@mail.alumni.example.com
122 telephonenumber: +49 1234-567-890
123 description: Just added in o=Beispiel,c=DE naming context
125 dn: cn=Ursula Hampster,ou=Alumni Association,ou=People,$BASEDN
128 seeAlso: cn=Ursula Hampster,ou=Alumni Association,ou=People,$BASEDN
131 description: Just added self to seeAlso in $BASEDN virtual naming context
134 dn: cn=Mark Elliot,ou=Alumni Association,ou=People,$BASEDN
137 dn: cn=John Doe,ou=Information Technology Division,ou=People,$BASEDN
139 newrdn: cn=John P. Doe
142 dn: cn=Jane Doe,ou=Alumni Association,ou=People,$BASEDN
144 newrdn: cn=Jane Q. Doe
146 newsuperior: ou=Information Technology Division,ou=People,$BASEDN
148 dn: cn=Jane Q. Doe,ou=Information Technology Division,ou=People,$BASEDN
151 cn: Jane Qissapaolo Doe
153 # This operation (delete of DN-valued attribute) triggered ITS#3498
157 dn: cn=Jane Q. Doe,ou=Information Technology Division,ou=People,$BASEDN
160 seeAlso: cn=All Staff,ou=Groups,$BASEDN
163 dn: ou=Referrals,$BASEDN
165 objectclass: referral
166 objectclass: extensibleObject
168 ref: ldap://localhost.localdomain/ou=Referrals,$BASEDN
169 description: Just added as ldap://localhost.localdomain:389/ou=Referrals,$BASEDN
171 dn: ou=Referrals,$BASEDN
174 ref: ldap://localhost:9012/ou=Referrals,$BASEDN
177 description: ...and modified as ldap://localhost:9012/ou=Referrals,$BASEDN
182 if test $RC != 0 ; then
183 echo "Modify failed ($RC)!"
184 test $KILLSERVERS != no && kill -HUP $KILLPIDS
188 BASEDN="o=Example,c=US"
189 echo "Modifying database \"$BASEDN\"..."
190 $LDAPMODIFY -v -D "cn=Manager,$BASEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
191 -M >> $TESTOUT 2>&1 << EOMODS
192 # These operations (updates with objectClass mapping) triggered ITS#3499
193 dn: cn=Added Group,ou=Groups,$BASEDN
195 objectClass: groupOfNames
196 objectClass: uidObject
198 member: cn=Added Group,ou=Groups,$BASEDN
201 dn: cn=Another Added Group,ou=Groups,$BASEDN
203 objectClass: groupOfNames
204 cn: Another Added Group
205 member: cn=Added Group,ou=Groups,$BASEDN
206 member: cn=Another Added Group,ou=Groups,$BASEDN
208 dn: cn=Another Added Group,ou=Groups,$BASEDN
211 objectClass: uidObject
217 dn: cn=Added Group,ou=Groups,$BASEDN
220 objectClass: uidObject
227 if test $RC != 0 ; then
228 echo "Modify failed ($RC)!"
229 test $KILLSERVERS != no && kill -HUP $KILLPIDS
233 echo "Searching base=\"$BASEDN\"..."
234 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
235 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
237 if test $RC != 0 ; then
238 echo "Search failed ($RC)!"
239 test $KILLSERVERS != no && kill -HUP $KILLPIDS
243 BASEDN="o=Esempio,c=IT"
244 echo "Searching base=\"$BASEDN\"..."
245 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
246 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
248 if test $RC != 0 ; then
249 echo "Search failed ($RC)!"
250 test $KILLSERVERS != no && kill -HUP $KILLPIDS
254 FILTER="(objectClass=referral)"
255 echo "Searching filter=\"$FILTER\""
256 echo " attrs=\"'*' ref\""
257 echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
258 echo "# attrs=\"'*' ref\"" >> $SEARCHOUT
260 BASEDN="dc=example,dc=com"
261 echo " base=\"$BASEDN\"..."
262 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
263 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -M "$FILTER" '*' ref \
266 if test $RC != 0 ; then
267 echo "Search failed ($RC)!"
268 test $KILLSERVERS != no && kill -HUP $KILLPIDS
272 BASEDN="o=Example,c=US"
273 echo " base=\"$BASEDN\"..."
274 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
275 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -M "$FILTER" '*' ref \
278 if test $RC != 0 ; then
279 echo "Search failed ($RC)!"
280 test $KILLSERVERS != no && kill -HUP $KILLPIDS
284 BASEDN="o=Esempio,c=IT"
285 echo " base=\"$BASEDN\"..."
286 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
287 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -M "$FILTER" '*' ref \
290 if test $RC != 0 ; then
291 echo "Search failed ($RC)!"
292 test $KILLSERVERS != no && kill -HUP $KILLPIDS
296 BASEDN="o=Example,c=US"
297 FILTER="(seeAlso=cn=all staff,ou=Groups,$BASEDN)"
298 echo "Searching filter=\"$FILTER\""
299 echo " attrs=\"seeAlso\""
300 echo " base=\"$BASEDN\"..."
301 echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
302 echo "# attrs=\"seeAlso\"" >> $SEARCHOUT
303 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
304 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" "$FILTER" seeAlso \
307 if test $RC != 0 ; then
308 echo "Search failed ($RC)!"
309 test $KILLSERVERS != no && kill -HUP $KILLPIDS
313 FILTER="(uid=example)"
314 echo "Searching filter=\"$FILTER\""
315 echo " attrs=\"uid\""
316 echo " base=\"$BASEDN\"..."
317 echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
318 echo "# attrs=\"uid\"" >> $SEARCHOUT
319 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
320 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" "$FILTER" uid \
323 if test $RC != 0 ; then
324 echo "Search failed ($RC)!"
325 test $KILLSERVERS != no && kill -HUP $KILLPIDS
329 FILTER="(member=cn=Another Added Group,ou=Groups,$BASEDN)"
330 echo "Searching filter=\"$FILTER\""
331 echo " attrs=\"member\""
332 echo " base=\"$BASEDN\"..."
333 echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
334 echo "# attrs=\"member\"" >> $SEARCHOUT
335 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
336 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" "$FILTER" member \
339 if test $RC != 0 ; then
340 echo "Search failed ($RC)!"
341 test $KILLSERVERS != no && kill -HUP $KILLPIDS
345 echo "Filtering ldapsearch results..."
346 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
347 echo "Filtering original ldif used to create database..."
348 . $LDIFFILTER < $RELAYOUT > $LDIFFLT
349 echo "Comparing filter output..."
350 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
352 if test $? != 0 ; then
353 echo "comparison failed - relay search/modification didn't succeed"
354 test $KILLSERVERS != no && kill -HUP $KILLPIDS
358 BASEDN="o=Example,c=US"
359 echo "Changing password to database \"$BASEDN\"..."
360 $LDAPPASSWD -h $LOCALHOST -p $PORT1 -D "cn=Manager,$BASEDN" -w $PASSWD \
361 -s $PASSWD "cn=Added User,ou=Alumni Association,ou=People,$BASEDN" \
364 if test $RC != 0 ; then
365 echo "Passwd ExOp failed ($RC)!"
366 test $KILLSERVERS != no && kill -HUP $KILLPIDS
370 BASEDN="o=Beispiel,c=DE"
371 echo "Binding with newly changed password to database \"$BASEDN\"..."
372 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 \
373 -D "cn=Added User,ou=Alumni Association,ou=People,$BASEDN" \
374 -w $PASSWD >> $TESTOUT 2>&1
376 if test $RC != 0 ; then
377 echo "WhoAmI failed ($RC)!"
378 test $KILLSERVERS != no && kill -HUP $KILLPIDS
382 BASEDN="o=Esempio,c=IT"
383 echo "Comparing to database \"$BASEDN\"..."
384 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
385 "cn=Added User,ou=Alumni Association,ou=People,$BASEDN" \
386 "seeAlso:cn=All Staff,ou=Groups,$BASEDN" >> $TESTOUT 2>&1
388 if test $RC != 6 ; then
389 echo "Compare failed ($RC)!"
390 test $KILLSERVERS != no && kill -HUP $KILLPIDS
394 test $KILLSERVERS != no && kill -HUP $KILLPIDS