9 # - perform some modifies and deleted
10 # - retrieve database over ldap and compare against expected results
13 if test $# -eq 0 ; then
18 if test $# -eq 1 ; then
22 echo "running defines.sh $SRCDIR $BACKEND"
23 . $SRCDIR/scripts/defines.sh
25 if test ! -x $SLURPD ; then
26 echo ">>>>> $SLURPD is not executable or do not exist."
27 echo ">>>>> Test skipped."
31 echo "Cleaning up in $DBDIR..."
33 echo "Cleaning up in $REPLDIR..."
36 echo "Starting master slapd on TCP/IP port $PORT..."
37 $SLAPD -f $MASTERCONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
40 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
41 $SLAPD -f $SLAVECONF -p $SLAVEPORT -d $LVL $TIMING > $SLAVELOG 2>&1 &
44 echo "Using ldapsearch to check that master slapd is running..."
45 for i in 0 1 2 3 4 5; do
46 $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $PORT \
47 'cn=Monitor' > /dev/null 2>&1
49 if test $RC = 1 ; then
50 echo "Waiting 5 seconds for slapd to start..."
55 echo "Using ldapsearch to check that slave slapd is running..."
56 for i in 0 1 2 3 4 5; do
57 $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $SLAVEPORT \
58 'cn=Monitor' > /dev/null 2>&1
60 if test $RC = 1 ; then
61 echo "Waiting 5 seconds for slapd to start..."
66 echo "Starting slurpd..."
67 $SLURPD -f $MASTERCONF -d 4 -t $REPLDIR > $SLURPLOG 2>&1 &
70 echo "Using ldapmodify to populate the database..."
71 $LDAPMODIFY -a -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
72 $LDIFORDERED > /dev/null 2>&1
74 if test $RC != 0 ; then
75 echo "ldapmodify failed!"
76 kill -HUP $PID $SLAVEPID $SLURPPID
80 echo "Using ldapmodify to modify the database..."
82 # Do some modifications
85 $LDAPMODIFY -v -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD > \
86 /dev/null 2>&1 << EOMODS
87 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
92 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
94 replace: multilinedescription
95 multilinedescription: The replaced multiLineDescription $ Blah Woof.
101 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
103 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
104 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
107 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
108 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
110 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
114 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
118 objectclass: organizationalPerson
119 objectclass: newPilotPerson
120 objectclass: umichPerson
122 title: Chief Investigator, ITD
123 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
124 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
126 krbname: gjensen@umich.edu
130 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
131 multilinedescription: Very odd
132 facsimiletelephonenumber: +1 313 555 7557
133 telephonenumber: +1 313 555 8343
134 mail: gjensen@mailgw.umich.edu
135 homephone: +1 313 555 8844
137 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
142 echo "Waiting 15 seconds for slurpd to send changes..."
145 echo "Using ldapsearch to read all the entries from the master..."
146 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
147 'objectclass=*' > $MASTEROUT 2>&1
149 if test $RC != 0 ; then
150 echo "ldapsearch failed!"
151 kill -HUP $PID $SLAVEPID $SLURPPID
155 echo "Using ldapsearch to read all the entries from the slave..."
156 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
157 'objectclass=*' > $SLAVEOUT 2>&1
159 if test $RC != 0 ; then
160 echo "ldapsearch failed!"
161 kill -HUP $PID $SLAVEPID $SLURPPID
165 kill -HUP $PID $SLAVEPID $SLURPPID
170 echo "Filtering ldapsearch results..."
171 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
172 echo "Filtering original ldif used to create database..."
173 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
175 echo "Comparing retrieved entries from master and slave..."
176 cmp $SEARCHFLT $LDIFFLT
178 if test $? != 0 ; then
179 echo "test failed - master and slave databases differ"
183 echo ">>>>> Test succeeded"