9 # - perform some modifies and deleted
10 # - retrieve database over ldap and compare against expected results
15 if test ! -x $SLURPD ; then
16 echo ">>>>> $SLURPD is not executable or do not exist."
17 echo ">>>>> Test skipped."
21 echo "Cleaning up in $DBDIR..."
23 echo "Cleaning up in $REPLDIR..."
26 echo "Starting master slapd on TCP/IP port $PORT..."
27 $SLAPD -f $MASTERCONF -p $PORT -d 1 > $MASTERLOG 2>&1 &
30 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
31 $SLAPD -f $SLAVECONF -p $SLAVEPORT -d 1 > $SLAVELOG 2>&1 &
34 echo "Using ldapsearch to check that master slapd is running..."
35 for i in 0 1 2 3 4 5; do
36 $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $PORT \
37 'cn=Monitor' > /dev/null 2>&1
40 echo "Waiting 5 seconds for slapd to start..."
45 echo "Using ldapsearch to check that slave slapd is running..."
46 for i in 0 1 2 3 4 5; do
47 $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $SLAVEPORT \
48 'cn=Monitor' > /dev/null 2>&1
51 echo "Waiting 5 seconds for slapd to start..."
56 echo "Starting slurpd..."
57 $SLURPD -f $MASTERCONF -d 4 -t $REPLDIR > $SLURPLOG 2>&1 &
60 echo "Using ldapmodify to populate the database..."
61 $LDAPMODIFY -a -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
62 $LDIFORDERED > /dev/null 2>&1
65 echo "ldapmodify failed!"
66 kill -HUP $PID $SLAVEPID $SLURPPID
70 echo "Using ldapmodify to modify the database..."
72 # Do some modifications
75 $LDAPMODIFY -v -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD > \
76 /dev/null 2>&1 << EOMODS
77 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
82 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
84 replace: multilinedescription
85 multilinedescription: The replaced multiLineDescription $ Blah Woof.
91 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
93 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
94 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
97 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
98 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
100 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
104 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
108 objectclass: organizationalPerson
109 objectclass: newPilotPerson
110 objectclass: umichPerson
112 title: Chief Investigator, ITD
113 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
114 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
116 krbname: gjensen@umich.edu
120 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
121 multilinedescription: Very odd
122 facsimiletelephonenumber: +1 313 555 7557
123 telephonenumber: +1 313 555 8343
124 mail: gjensen@mailgw.umich.edu
125 homephone: +1 313 555 8844
127 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
132 echo "Waiting 15 seconds for slurpd to send changes..."
135 echo "Using ldapsearch to read all the entries from the master..."
136 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
137 'objectclass=*' > $MASTEROUT 2>&1
139 if [ $RC != 0 ]; then
140 echo "ldapsearch failed!"
141 kill -HUP $PID $SLAVEPID $SLURPPID
145 echo "Using ldapsearch to read all the entries from the slave..."
146 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
147 'objectclass=*' > $SLAVEOUT 2>&1
149 if [ $RC != 0 ]; then
150 echo "ldapsearch failed!"
151 kill -HUP $PID $SLAVEPID $SLURPPID
155 kill -HUP $PID $SLAVEPID $SLURPPID
157 echo "Comparing retrieved entries from master and slave..."
158 cmp $MASTEROUT $SLAVEOUT
160 echo "test failed - master and slave databases differ"
164 echo ">>>>> Test succeeded"