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>.
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
29 echo "Using ldapsearch to check that slapd is running..."
30 for i in 0 1 2 3 4 5; do
31 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
32 'objectclass=*' > /dev/null 2>&1
34 if test $RC = 0 ; then
37 echo "Waiting 5 seconds for slapd to start..."
40 if test $RC != 0 ; then
41 echo "ldapsearch failed ($RC)!"
42 test $KILLSERVERS != no && kill -HUP $KILLPIDS
46 echo "Using ldapadd to populate the database..."
47 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
48 $LDIFORDERED > $TESTOUT 2>&1
50 if test $RC != 0 ; then
51 echo "ldapadd failed ($RC)!"
52 test $KILLSERVERS != no && kill -HUP $KILLPIDS
56 cat /dev/null > $SEARCHOUT
58 BASEDN="dc=example,dc=com"
59 echo "Searching base=\"$BASEDN\"..."
60 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
61 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
63 if test $RC != 0 ; then
64 echo "Search failed ($RC)!"
65 test $KILLSERVERS != no && kill -HUP $KILLPIDS
69 BASEDN="o=Example,c=US"
70 echo "Searching base=\"$BASEDN\"..."
71 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
72 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
74 if test $RC != 0 ; then
75 echo "Search failed ($RC)!"
76 test $KILLSERVERS != no && kill -HUP $KILLPIDS
80 BASEDN="o=Esempio,c=IT"
81 echo "Searching base=\"$BASEDN\"..."
82 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
83 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
85 if test $RC != 0 ; then
86 echo "Search failed ($RC)!"
87 test $KILLSERVERS != no && kill -HUP $KILLPIDS
91 BASEDN="o=Beispiel,c=DE"
92 echo "Searching base=\"$BASEDN\"..."
93 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
94 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
96 if test $RC != 0 ; then
97 echo "Search failed ($RC)!"
98 test $KILLSERVERS != no && kill -HUP $KILLPIDS
103 # Do some modifications
106 BASEDN="o=Beispiel,c=DE"
107 echo "Modifying database \"$BASEDN\"..."
108 $LDAPMODIFY -v -D "cn=Manager,$BASEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
109 -M >> $TESTOUT 2>&1 << EOMODS
110 dn: cn=Added User,ou=Alumni Association,ou=People,$BASEDN
112 objectClass: OpenLDAPperson
116 seealso: cn=All Staff,ou=Groups,$BASEDN
117 homephone: +49 1234567890
119 mail: auser@mail.alumni.example.com
120 telephonenumber: +49 1234-567-890
121 description: Just added in o=Beispiel,c=DE naming context
123 dn: cn=Ursula Hampster,ou=Alumni Association,ou=People,$BASEDN
126 seeAlso: cn=Ursula Hampster,ou=Alumni Association,ou=People,$BASEDN
129 description: Just added self to seeAlso in $BASEDN virtual naming context
132 dn: cn=Mark Elliot,ou=Alumni Association,ou=People,$BASEDN
135 dn: cn=John Doe,ou=Information Technology Division,ou=People,$BASEDN
137 newrdn: cn=John P. Doe
140 dn: cn=Jane Doe,ou=Alumni Association,ou=People,$BASEDN
142 newrdn: cn=Jane Q. Doe
144 newsuperior: ou=Information Technology Division,ou=People,$BASEDN
146 dn: cn=Jane Q. Doe,ou=Information Technology Division,ou=People,$BASEDN
149 cn: Jane Qissapaolo Doe
151 # This operation (delete of DN-valued attribute) triggered ITS#3498
155 dn: cn=Jane Q. Doe,ou=Information Technology Division,ou=People,$BASEDN
158 seeAlso: cn=All Staff,ou=Groups,$BASEDN
161 dn: ou=Referrals,$BASEDN
163 objectclass: referral
164 objectclass: extensibleObject
166 ref: ldap://localhost.localdomain/ou=Referrals,$BASEDN
167 description: Just added as ldap://localhost.localdomain:389/ou=Referrals,$BASEDN
169 dn: ou=Referrals,$BASEDN
172 ref: ldap://localhost:9010/ou=Referrals,$BASEDN
175 description: ...and modified as ldap://localhost:9010/ou=Referrals,$BASEDN
180 if test $RC != 0 ; then
181 echo "Modify failed ($RC)!"
182 test $KILLSERVERS != no && kill -HUP $KILLPIDS
186 BASEDN="o=Example,c=US"
187 echo "Modifying database \"$BASEDN\"..."
188 $LDAPMODIFY -v -D "cn=Manager,$BASEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
189 -M >> $TESTOUT 2>&1 << EOMODS
190 # These operations (updates with objectClass mapping) triggered ITS#3499
191 dn: cn=Added Group,ou=Groups,$BASEDN
193 objectClass: groupOfNames
194 objectClass: uidObject
196 member: cn=Added Group,ou=Groups,$BASEDN
199 dn: cn=Another Added Group,ou=Groups,$BASEDN
201 objectClass: groupOfNames
202 cn: Another Added Group
203 member: cn=Added Group,ou=Groups,$BASEDN
204 member: cn=Another Added Group,ou=Groups,$BASEDN
206 dn: cn=Another Added Group,ou=Groups,$BASEDN
209 objectClass: uidObject
215 dn: cn=Added Group,ou=Groups,$BASEDN
218 objectClass: uidObject
225 if test $RC != 0 ; then
226 echo "Modify failed ($RC)!"
227 test $KILLSERVERS != no && kill -HUP $KILLPIDS
231 echo "Searching base=\"$BASEDN\"..."
232 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
233 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
235 if test $RC != 0 ; then
236 echo "Search failed ($RC)!"
237 test $KILLSERVERS != no && kill -HUP $KILLPIDS
241 BASEDN="o=Esempio,c=IT"
242 echo "Searching base=\"$BASEDN\"..."
243 echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
244 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
246 if test $RC != 0 ; then
247 echo "Search failed ($RC)!"
248 test $KILLSERVERS != no && kill -HUP $KILLPIDS
252 FILTER="(objectClass=referral)"
253 echo "Searching filter=\"$FILTER\""
254 echo " attrs=\"'*' ref\""
255 echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
256 echo "# attrs=\"'*' ref\"" >> $SEARCHOUT
258 BASEDN="dc=example,dc=com"
259 echo " base=\"$BASEDN\"..."
260 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
261 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -M "$FILTER" '*' ref \
264 if test $RC != 0 ; then
265 echo "Search failed ($RC)!"
266 test $KILLSERVERS != no && kill -HUP $KILLPIDS
270 BASEDN="o=Example,c=US"
271 echo " base=\"$BASEDN\"..."
272 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
273 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -M "$FILTER" '*' ref \
276 if test $RC != 0 ; then
277 echo "Search failed ($RC)!"
278 test $KILLSERVERS != no && kill -HUP $KILLPIDS
282 BASEDN="o=Esempio,c=IT"
283 echo " base=\"$BASEDN\"..."
284 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
285 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -M "$FILTER" '*' ref \
288 if test $RC != 0 ; then
289 echo "Search failed ($RC)!"
290 test $KILLSERVERS != no && kill -HUP $KILLPIDS
294 BASEDN="o=Example,c=US"
295 FILTER="(seeAlso=cn=all staff,ou=Groups,$BASEDN)"
296 echo "Searching filter=\"$FILTER\""
297 echo " attrs=\"seeAlso\""
298 echo " base=\"$BASEDN\"..."
299 echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
300 echo "# attrs=\"seeAlso\"" >> $SEARCHOUT
301 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
302 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" "$FILTER" seeAlso \
305 if test $RC != 0 ; then
306 echo "Search failed ($RC)!"
307 test $KILLSERVERS != no && kill -HUP $KILLPIDS
311 FILTER="(uid=example)"
312 echo "Searching filter=\"$FILTER\""
313 echo " attrs=\"uid\""
314 echo " base=\"$BASEDN\"..."
315 echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
316 echo "# attrs=\"uid\"" >> $SEARCHOUT
317 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
318 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" "$FILTER" uid \
321 if test $RC != 0 ; then
322 echo "Search failed ($RC)!"
323 test $KILLSERVERS != no && kill -HUP $KILLPIDS
327 FILTER="(member=cn=Another Added Group,ou=Groups,$BASEDN)"
328 echo "Searching filter=\"$FILTER\""
329 echo " attrs=\"member\""
330 echo " base=\"$BASEDN\"..."
331 echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
332 echo "# attrs=\"member\"" >> $SEARCHOUT
333 echo "# base=\"$BASEDN\"..." >> $SEARCHOUT
334 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" "$FILTER" member \
337 if test $RC != 0 ; then
338 echo "Search failed ($RC)!"
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 < $RELAYOUT > $LDIFFLT
347 echo "Comparing filter output..."
348 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
350 if test $? != 0 ; then
351 echo "comparison failed - relay search/modification didn't succeed"
352 test $KILLSERVERS != no && kill -HUP $KILLPIDS
356 BASEDN="o=Example,c=US"
357 echo "Changing password to database \"$BASEDN\"..."
358 $LDAPPASSWD -h $LOCALHOST -p $PORT1 -D "cn=Manager,$BASEDN" -w $PASSWD \
359 -s $PASSWD "cn=Added User,ou=Alumni Association,ou=People,$BASEDN" \
362 if test $RC != 0 ; then
363 echo "Passwd ExOp failed ($RC)!"
364 test $KILLSERVERS != no && kill -HUP $KILLPIDS
368 BASEDN="o=Beispiel,c=DE"
369 echo "Binding with newly changed password to database \"$BASEDN\"..."
370 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 \
371 -D "cn=Added User,ou=Alumni Association,ou=People,$BASEDN" \
372 -w $PASSWD >> $TESTOUT 2>&1
374 if test $RC != 0 ; then
375 echo "WhoAmI failed ($RC)!"
376 test $KILLSERVERS != no && kill -HUP $KILLPIDS
380 BASEDN="o=Esempio,c=IT"
381 echo "Comparing to database \"$BASEDN\"..."
382 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
383 "cn=Added User,ou=Alumni Association,ou=People,$BASEDN" \
384 "seeAlso:cn=All Staff,ou=Groups,$BASEDN" >> $TESTOUT 2>&1
386 if test $RC != 6 ; then
387 echo "Compare failed ($RC)!"
388 test $KILLSERVERS != no && kill -HUP $KILLPIDS
392 test $KILLSERVERS != no && kill -HUP $KILLPIDS