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
118 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
120 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
121 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
124 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
125 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
127 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
131 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
135 objectclass: organizationalPerson
136 objectclass: newPilotPerson
139 title: Chief Investigator, ITD
140 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
141 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
143 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
144 description: Very odd
145 facsimiletelephonenumber: +1 313 555 7557
146 telephonenumber: +1 313 555 8343
147 mail: gjensen@mailgw.umich.edu
148 homephone: +1 313 555 8844
150 dn: ou=Retired, ou=People, o=University of Michigan, c=US
153 objectclass: organizationalUnit
156 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
160 cn: Rosco P. Coltrane
163 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
165 newrdn: cn=Rosco P. Coltrane
167 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
169 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
174 echo "Waiting 15 seconds for slurpd to send changes..."
177 echo "Using ldapsearch to read all the entries from the master..."
178 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
179 'objectclass=*' > $MASTEROUT 2>&1
181 if test $RC != 0 ; then
182 echo "ldapsearch failed ($RC)!"
183 kill -INT $PID $SLAVEPID
188 echo "Using ldapsearch to read all the entries from the slave..."
189 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
190 'objectclass=*' > $SLAVEOUT 2>&1
192 if test $RC != 0 ; then
193 echo "ldapsearch failed ($RC)!"
194 kill -INT $PID $SLAVEPID
199 kill -INT $PID $SLAVEPID
205 echo "Filtering ldapsearch results..."
206 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
207 echo "Filtering original ldif used to create database..."
208 . $LDIFFILTER < $LDIF > $LDIFFLT
210 echo "Comparing retrieved entries from master and slave..."
211 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
213 if test $? != 0 ; then
214 echo "test failed - master and slave databases differ"
218 echo ">>>>> Test succeeded"