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 "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
19 mkdir -p $TESTDIR $DBDIR1
21 echo "Running slapadd to build slapd database..."
22 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
23 $SLAPADD -f $CONF1 -l $LDIFORDERED
25 if test $RC != 0 ; then
26 echo "slapadd failed ($RC)!"
30 echo "Starting slapd on TCP/IP port $PORT1..."
31 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
33 if test $WAIT != 0 ; then
41 echo "Testing slapd modify operations..."
42 for i in 0 1 2 3 4 5; do
43 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
44 'objectclass=*' > /dev/null 2>&1
46 if test $RC = 0 ; then
49 echo "Waiting 5 seconds for slapd to start..."
53 if test $RC != 0 ; then
54 echo "ldapsearch failed ($RC)!"
55 test $KILLSERVERS != no && kill -HUP $KILLPIDS
59 echo "Testing modify, add, and delete..."
60 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
61 $TESTOUT 2>&1 << EOMODS
64 # LEADING COMMENT AND WHITE SPACE
66 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
84 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
89 description: The replaced multiLineDescription $ Blah Woof.
95 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
98 uniquemember: cn=James A Jones 2,ou=Information Technology Division,
99 ou=People,dc=example,dc=com
100 uniquemember: cn=Bjorn Jensen,ou=Information Technology Division,
101 ou=People,dc=example,dc=com
104 uniquemember: cn=Dorothy Stevens,ou=Alumni Association,
105 ou=People,dc=example,dc=com
106 uniquemember: cn=James A Jones 1,ou=Alumni Association,
107 ou=People,dc=example,dc=com
110 objectClass: OpenLDAPdisplayableObject
112 objectClass: userSecurityInformation
115 objectClass: userSecurityInformation
117 objectClass: OpenLDAPdisplayableObject
119 dn: cn=All Staff,ou=Groups,dc=example,dc=com
124 member: cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example,dc=com
129 objectClass: OpenLDAPdisplayableObject
131 objectClass: userSecurityInformation
134 objectClass: OpenLDAPdisplayableObject
136 objectClass: userSecurityInformation
138 dn: cn=Gern Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
140 objectclass: testPerson
144 title: Chief Investigator, ITD
145 postaladdress: ITD $ 535 W. William St $ Anytown, MI 48103
146 seealso: cn=All Staff,ou=Groups,dc=example,dc=com
148 homepostaladdress: 844 Brown St. Apt. 4 $ Anytown, MI 48104
149 description: Very odd
150 facsimiletelephonenumber: +1 313 555 7557
151 telephonenumber: +1 313 555 8343
152 mail: gjensen@mailgw.example.com
153 homephone: +1 313 555 8844
154 testTime: 20050304001801.234Z
156 dn: cn=James A Jones 2,ou=Information Technology Division,ou=People,dc=example,dc=com
158 # TRAILING COMMENT AND WHITE SPACE
160 dn: ou=People,dc=example,dc=com
171 if test $RC != 0 ; then
172 echo "ldapmodify failed ($RC)!"
173 test $KILLSERVERS != no && kill -HUP $KILLPIDS
177 echo "Using ldapsearch to retrieve all the entries..."
178 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
179 'objectClass=*' > $SEARCHOUT 2>&1
181 test $KILLSERVERS != no && kill -HUP $KILLPIDS
182 if test $RC != 0 ; then
183 echo "ldapsearch failed ($RC)!"
187 LDIF=$MODIFYOUTMASTER
189 echo "Filtering ldapsearch results..."
190 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
191 echo "Filtering original ldif used to create database..."
192 . $LDIFFILTER < $LDIF > $LDIFFLT
193 echo "Comparing filter output..."
194 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
196 if test $? != 0 ; then
197 echo "comparison failed - modify operations did not complete correctly"
201 echo ">>>>> Test succeeded"