5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 echo "running defines.sh"
18 . $SRCDIR/scripts/defines.sh
25 # - populate over ldap
26 # - perform some modifies and deleted
27 # - retrieve database over ldap and compare against expected results
30 if test ! -x $SLURPD ; then
31 echo ">>>>> $SLURPD is not executable or do not exist."
32 echo ">>>>> Test skipped."
36 echo "Cleaning up in $DBDIR..."
38 echo "Cleaning up in $REPLDIR..."
41 echo "Starting master slapd on TCP/IP port $PORT..."
42 . $CONFFILTER $BACKEND < $MASTERCONF > $DBCONF
43 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
45 if test $WAIT != 0 ; then
50 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
51 . $CONFFILTER $BACKEND < $SLAVECONF > $REPLCONF
52 $SLAPD -f $REPLCONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
54 if test $WAIT != 0 ; then
55 echo SLAVEPID $SLAVEPID
59 echo "Using ldapsearch to check that master slapd is running..."
60 for i in 0 1 2 3 4 5; do
61 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
62 'objectclass=*' > /dev/null 2>&1
64 if test $RC = 1 ; then
65 echo "Waiting 5 seconds for slapd to start..."
70 echo "Using ldapsearch to check that slave slapd is running..."
71 for i in 0 1 2 3 4 5; do
72 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
73 'objectclass=*' > /dev/null 2>&1
75 if test $RC = 1 ; then
76 echo "Waiting 5 seconds for slapd to start..."
81 echo "Starting slurpd..."
82 $SLURPD -f $MASTERCONF -d ${SLURPD_DEBUG-5} -t $REPLDIR > $SLURPLOG 2>&1 &
85 echo "Using ldapadd to populate the master directory..."
86 $LDAPADD -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
87 $LDIFORDERED > /dev/null 2>&1
89 if test $RC != 0 ; then
90 echo "ldapadd failed ($RC)!"
91 kill -INT $PID $SLAVEPID
96 echo "Waiting 15 seconds for slurpd to send changes..."
99 echo "Using ldapmodify to modify master directory..."
102 # Do some modifications
105 $LDAPMODIFY -v -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD > \
106 $TESTOUT 2>&1 << EOMODS
107 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
112 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
114 replace: multilinedescription
115 multilinedescription: The replaced multiLineDescription $ Blah Woof.
121 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
123 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
124 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
127 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
128 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
130 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
134 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
138 objectclass: organizationalPerson
139 objectclass: newPilotPerson
142 title: Chief Investigator, ITD
143 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
144 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
146 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
147 description: Very odd
148 facsimiletelephonenumber: +1 313 555 7557
149 telephonenumber: +1 313 555 8343
150 mail: gjensen@mailgw.umich.edu
151 homephone: +1 313 555 8844
153 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
158 echo "Waiting 15 seconds for slurpd to send changes..."
161 echo "Using ldapsearch to read all the entries from the master..."
162 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
163 'objectclass=*' > $MASTEROUT 2>&1
165 if test $RC != 0 ; then
166 echo "ldapsearch failed ($RC)!"
167 kill -INT $PID $SLAVEPID
172 echo "Using ldapsearch to read all the entries from the slave..."
173 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
174 'objectclass=*' > $SLAVEOUT 2>&1
176 if test $RC != 0 ; then
177 echo "ldapsearch failed ($RC)!"
178 kill -INT $PID $SLAVEPID
183 kill -INT $PID $SLAVEPID
189 echo "Filtering ldapsearch results..."
190 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
191 echo "Filtering original ldif used to create database..."
192 . $LDIFFILTER < $LDIF > $LDIFFLT
194 echo "Comparing retrieved entries from master and slave..."
195 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
197 if test $? != 0 ; then
198 echo "test failed - master and slave databases differ"
202 echo ">>>>> Test succeeded"