3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2004 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
107 dn: cn=All Staff,ou=Groups,dc=example,dc=com
112 member: cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example,dc=com
117 objectClass: OpenLDAPdisplayableObject
119 objectClass: userSecurityInformation
122 objectClass: OpenLDAPdisplayableObject
124 objectClass: userSecurityInformation
126 dn: cn=Gern Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
128 objectclass: OpenLDAPperson
132 title: Chief Investigator, ITD
133 postaladdress: ITD $ 535 W. William St $ Anytown, MI 48103
134 seealso: cn=All Staff,ou=Groups,dc=example,dc=com
136 homepostaladdress: 844 Brown St. Apt. 4 $ Anytown, MI 48104
137 description: Very odd
138 facsimiletelephonenumber: +1 313 555 7557
139 telephonenumber: +1 313 555 8343
140 mail: gjensen@mailgw.example.com
141 homephone: +1 313 555 8844
143 dn: cn=James A Jones 2,ou=Information Technology Division,ou=People,dc=example,dc=com
145 # TRAILING COMMENT AND WHITE SPACE
147 dn: ou=People,dc=example,dc=com
158 if test $RC != 0 ; then
159 echo "ldapmodify failed ($RC)!"
160 test $KILLSERVERS != no && kill -HUP $KILLPIDS
164 echo "Using ldapsearch to retrieve all the entries..."
165 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
166 'objectClass=*' > $SEARCHOUT 2>&1
168 test $KILLSERVERS != no && kill -HUP $KILLPIDS
169 if test $RC != 0 ; then
170 echo "ldapsearch failed ($RC)!"
174 LDIF=$MODIFYOUTMASTER
176 echo "Filtering ldapsearch results..."
177 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
178 echo "Filtering original ldif used to create database..."
179 . $LDIFFILTER < $LDIF > $LDIFFLT
180 echo "Comparing filter output..."
181 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
183 if test $? != 0 ; then
184 echo "comparison failed - modify operations did not complete correctly"
188 echo ">>>>> Test succeeded"