10 # - perform some modifies and deleted
11 # - retrieve database over ldap and compare against expected results
14 if test $# -eq 0 ; then
19 if test $# -eq 1 ; then
23 echo "running defines.sh $SRCDIR $BACKEND"
24 . $SRCDIR/scripts/defines.sh
26 if test ! -x $SLURPD ; then
27 echo ">>>>> $SLURPD is not executable or do not exist."
28 echo ">>>>> Test skipped."
32 echo "Cleaning up in $DBDIR..."
34 echo "Cleaning up in $REPLDIR..."
37 echo "Starting master slapd on TCP/IP port $PORT..."
38 $SLAPD -f $MASTERCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
41 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
42 $SLAPD -f $SLAVECONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
45 echo "Using ldapsearch to check that master slapd is running..."
46 for i in 0 1 2 3 4 5; do
47 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
48 'objectclass=*' > /dev/null 2>&1
50 if test $RC = 1 ; then
51 echo "Waiting 5 seconds for slapd to start..."
56 echo "Using ldapsearch to check that slave slapd is running..."
57 for i in 0 1 2 3 4 5; do
58 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
59 'objectclass=*' > /dev/null 2>&1
61 if test $RC = 1 ; then
62 echo "Waiting 5 seconds for slapd to start..."
67 echo "Starting slurpd..."
68 $SLURPD -f $MASTERCONF -d ${SLURPD_DEBUG-4} -t $REPLDIR > $SLURPLOG 2>&1 &
71 echo "Using ldapadd to populate the master directory..."
72 $LDAPADD -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
73 $LDIFORDERED > /dev/null 2>&1
75 if test $RC != 0 ; then
76 echo "ldapadd failed!"
77 kill -HUP $PID $SLAVEPID $SLURPPID
81 echo "Waiting 15 seconds for slurpd to send changes..."
84 echo "Using ldapmodify to modify slave directory..."
87 # Do some modifications
90 $LDAPMODIFY -v -D "$MANAGERDN" -h localhost -p $SLAVEPORT -w $PASSWD > \
91 $TESTOUT 2>&1 << EOMODS
92 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
97 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
99 replace: multilinedescription
100 multilinedescription: The replaced multiLineDescription $ Blah Woof.
106 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
108 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
109 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
112 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
113 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
115 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
119 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
123 objectclass: organizationalPerson
124 objectclass: newPilotPerson
125 objectclass: umichPerson
127 title: Chief Investigator, ITD
128 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
129 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
131 krbname: gjensen@umich.edu
135 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
136 multilinedescription: Very odd
137 facsimiletelephonenumber: +1 313 555 7557
138 telephonenumber: +1 313 555 8343
139 mail: gjensen@mailgw.umich.edu
140 homephone: +1 313 555 8844
142 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
147 echo "Waiting 15 seconds for slurpd to send changes..."
150 echo "Using ldapsearch to read all the entries from the master..."
151 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
152 'objectclass=*' > $MASTEROUT 2>&1
154 if test $RC != 0 ; then
155 echo "ldapsearch failed!"
156 kill -HUP $PID $SLAVEPID $SLURPPID
160 echo "Using ldapsearch to read all the entries from the slave..."
161 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
162 'objectclass=*' > $SLAVEOUT 2>&1
164 if test $RC != 0 ; then
165 echo "ldapsearch failed!"
166 kill -HUP $PID $SLAVEPID $SLURPPID
170 kill -HUP $PID $SLAVEPID $SLURPPID
175 echo "Filtering ldapsearch results..."
176 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
177 echo "Filtering original ldif used to create database..."
178 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
180 echo "Comparing retrieved entries from master and slave..."
181 cmp $SEARCHFLT $LDIFFLT
183 if test $? != 0 ; then
184 echo "test failed - master and slave databases differ"
188 echo ">>>>> Test succeeded"