9 # - perform some modifies and deleted
10 # - retrieve database over ldap and compare against expected results
19 . $SRCDIR/scripts/defines.sh $SRCDIR
21 if test ! -x $SLURPD ; then
22 echo ">>>>> $SLURPD is not executable or do not exist."
23 echo ">>>>> Test skipped."
27 echo "Cleaning up in $DBDIR..."
29 echo "Cleaning up in $REPLDIR..."
32 echo "Starting master slapd on TCP/IP port $PORT..."
33 $SLAPD -f $MASTERCONF -p $PORT -d 1 > $MASTERLOG 2>&1 &
36 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
37 $SLAPD -f $SLAVECONF -p $SLAVEPORT -d 1 > $SLAVELOG 2>&1 &
40 echo "Using ldapsearch to check that master slapd is running..."
41 for i in 0 1 2 3 4 5; do
42 $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $PORT \
43 'cn=Monitor' > /dev/null 2>&1
46 echo "Waiting 5 seconds for slapd to start..."
51 echo "Using ldapsearch to check that slave slapd is running..."
52 for i in 0 1 2 3 4 5; do
53 $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $SLAVEPORT \
54 'cn=Monitor' > /dev/null 2>&1
57 echo "Waiting 5 seconds for slapd to start..."
62 echo "Starting slurpd..."
63 $SLURPD -f $MASTERCONF -d 4 -t $REPLDIR > $SLURPLOG 2>&1 &
66 echo "Using ldapmodify to populate the database..."
67 $LDAPMODIFY -a -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
68 $LDIFORDERED > /dev/null 2>&1
71 echo "ldapmodify failed!"
72 kill -HUP $PID $SLAVEPID $SLURPPID
76 echo "Using ldapmodify to modify the database..."
78 # Do some modifications
81 $LDAPMODIFY -v -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD > \
82 /dev/null 2>&1 << EOMODS
83 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
88 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
90 replace: multilinedescription
91 multilinedescription: The replaced multiLineDescription $ Blah Woof.
97 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
99 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
100 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
103 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
104 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
106 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
110 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
114 objectclass: organizationalPerson
115 objectclass: newPilotPerson
116 objectclass: umichPerson
118 title: Chief Investigator, ITD
119 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
120 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
122 krbname: gjensen@umich.edu
126 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
127 multilinedescription: Very odd
128 facsimiletelephonenumber: +1 313 555 7557
129 telephonenumber: +1 313 555 8343
130 mail: gjensen@mailgw.umich.edu
131 homephone: +1 313 555 8844
133 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
138 echo "Waiting 15 seconds for slurpd to send changes..."
141 echo "Using ldapsearch to read all the entries from the master..."
142 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
143 'objectclass=*' > $MASTEROUT 2>&1
145 if [ $RC != 0 ]; then
146 echo "ldapsearch failed!"
147 kill -HUP $PID $SLAVEPID $SLURPPID
151 echo "Using ldapsearch to read all the entries from the slave..."
152 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
153 'objectclass=*' > $SLAVEOUT 2>&1
155 if [ $RC != 0 ]; then
156 echo "ldapsearch failed!"
157 kill -HUP $PID $SLAVEPID $SLURPPID
161 kill -HUP $PID $SLAVEPID $SLURPPID
163 echo "Comparing retrieved entries from master and slave..."
164 cmp $MASTEROUT $SLAVEOUT
166 echo "test failed - master and slave databases differ"
170 echo ">>>>> Test succeeded"