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
39 echo "Testing slapd modify operations..."
40 for i in 0 1 2 3 4 5; do
41 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
42 'objectclass=*' > /dev/null 2>&1
44 if test $RC = 0 ; then
47 echo "Waiting 5 seconds for slapd to start..."
51 if test $RC != 0 ; then
52 echo "ldapsearch failed ($RC)!"
53 test $KILLSERVERS != no && kill -HUP $KILLPIDS
57 echo "Testing modify, add, and delete..."
58 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
59 $TESTOUT 2>&1 << EOMODS
62 # LEADING COMMENT AND WHITE SPACE
64 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
82 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
87 description: The replaced multiLineDescription $ Blah Woof.
93 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
96 uniquemember: cn=James A Jones 2,ou=Information Technology Division,
97 ou=People,dc=example,dc=com
98 uniquemember: cn=Bjorn Jensen,ou=Information Technology Division,
99 ou=People,dc=example,dc=com
102 uniquemember: cn=Dorothy Stevens,ou=Alumni Association,
103 ou=People,dc=example,dc=com
104 uniquemember: cn=James A Jones 1,ou=Alumni Association,
105 ou=People,dc=example,dc=com
108 objectClass: OpenLDAPdisplayableObject
110 objectClass: userSecurityInformation
113 objectClass: userSecurityInformation
115 objectClass: OpenLDAPdisplayableObject
117 dn: cn=All Staff,ou=Groups,dc=example,dc=com
122 member: cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example,dc=com
127 objectClass: OpenLDAPdisplayableObject
129 objectClass: userSecurityInformation
132 objectClass: OpenLDAPdisplayableObject
134 objectClass: userSecurityInformation
136 dn: cn=Gern Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
138 objectclass: testPerson
142 title: Chief Investigator, ITD
143 postaladdress: ITD $ 535 W. William St $ Anytown, MI 48103
144 seealso: cn=All Staff,ou=Groups,dc=example,dc=com
146 homepostaladdress: 844 Brown St. Apt. 4 $ Anytown, MI 48104
147 description: Very odd
148 facsimiletelephonenumber: +1 313 555 7557
149 telephonenumber: +1 313 555 8343
150 mail: gjensen@mailgw.example.com
151 homephone: +1 313 555 8844
152 testTime: 20050304001801.234Z
154 dn: cn=James A Jones 2,ou=Information Technology Division,ou=People,dc=example,dc=com
156 # TRAILING COMMENT AND WHITE SPACE
158 dn: ou=People,dc=example,dc=com
169 if test $RC != 0 ; then
170 echo "ldapmodify failed ($RC)!"
171 test $KILLSERVERS != no && kill -HUP $KILLPIDS
175 echo "Using ldapsearch to retrieve all the entries..."
176 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
177 'objectClass=*' > $SEARCHOUT 2>&1
179 test $KILLSERVERS != no && kill -HUP $KILLPIDS
180 if test $RC != 0 ; then
181 echo "ldapsearch failed ($RC)!"
185 LDIF=$MODIFYOUTMASTER
187 echo "Filtering ldapsearch results..."
188 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
189 echo "Filtering original ldif used to create database..."
190 . $LDIFFILTER < $LDIF > $LDIFFLT
191 echo "Comparing filter output..."
192 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
194 if test $? != 0 ; then
195 echo "comparison failed - modify operations did not complete correctly"
199 echo ">>>>> Test succeeded"