5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 if test $# -ge 1 ; then
21 echo "running defines.sh"
22 . $SRCDIR/scripts/defines.sh
29 # - populate over ldap
30 # - perform some modifies and deleted
31 # - retrieve database over ldap and compare against expected results
34 if test ! -x $SLURPD ; then
35 echo ">>>>> $SLURPD is not executable or do not exist."
36 echo ">>>>> Test skipped."
40 echo "Cleaning up in $DBDIR..."
42 echo "Cleaning up in $REPLDIR..."
45 echo "Starting master slapd on TCP/IP port $PORT..."
46 . $CONFFILTER $BACKEND $MONITORDB < $MASTERCONF > $DBCONF
47 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
49 if test $WAIT != 0 ; then
54 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
55 . $CONFFILTER $BACKEND $MONITORDB < $SLAVECONF > $REPLCONF
56 $SLAPD -f $REPLCONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
58 if test $WAIT != 0 ; then
59 echo SLAVEPID $SLAVEPID
63 echo "Using ldapsearch to check that master slapd is running..."
64 for i in 0 1 2 3 4 5; do
65 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
66 'objectclass=*' > /dev/null 2>&1
68 if test $RC = 0 ; then
71 echo "Waiting 5 seconds for slapd to start..."
75 echo "Using ldapsearch to check that slave slapd is running..."
76 for i in 0 1 2 3 4 5; do
77 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
78 'objectclass=*' > /dev/null 2>&1
80 if test $RC = 0 ; then
83 echo "Waiting 5 seconds for slapd to start..."
87 echo "Starting slurpd..."
88 $SLURPD -f $MASTERCONF -d ${SLURPD_DEBUG-5} -t $REPLDIR > $SLURPLOG 2>&1 &
91 echo "Using ldapadd to populate the master directory..."
92 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
93 $LDIFORDERED > /dev/null 2>&1
95 if test $RC != 0 ; then
96 echo "ldapadd failed ($RC)!"
97 kill -HUP $PID $SLAVEPID
102 echo "Waiting 15 seconds for slurpd to send changes..."
105 echo "Using ldapmodify to modify master directory..."
108 # Do some modifications
111 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
112 $TESTOUT 2>&1 << EOMODS
113 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
124 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
130 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
132 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
133 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
136 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
137 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
139 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
143 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
145 objectclass: OpenLDAPperson
149 title: Chief Investigator, ITD
150 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
151 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
153 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
154 description: Very odd
155 facsimiletelephonenumber: +1 313 555 7557
156 telephonenumber: +1 313 555 8343
157 mail: gjensen@mailgw.example.com
158 homephone: +1 313 555 8844
160 dn: ou=Retired, ou=People, o=University of Michigan, c=US
162 objectclass: organizationalUnit
165 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
167 objectclass: OpenLDAPperson
168 cn: Rosco P. Coltrane
172 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
174 newrdn: cn=Rosco P. Coltrane
176 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
178 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
183 echo "Waiting 15 seconds for slurpd to send changes..."
186 echo "Using ldapsearch to read all the entries from the master..."
187 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
188 'objectclass=*' > $MASTEROUT 2>&1
191 if test $RC != 0 ; then
192 echo "ldapsearch failed ($RC)!"
193 kill -HUP $PID $SLAVEPID
198 echo "Using ldapsearch to read all the entries from the slave..."
199 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
200 'objectclass=*' > $SLAVEOUT 2>&1
203 if test $RC != 0 ; then
204 echo "ldapsearch failed ($RC)!"
205 kill -HUP $PID $SLAVEPID
210 kill -HUP $PID $SLAVEPID
216 echo "Filtering ldapsearch results..."
217 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
218 echo "Filtering original ldif used to create database..."
219 . $LDIFFILTER < $LDIF > $LDIFFLT
221 echo "Comparing retrieved entries from master and slave..."
222 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
224 if test $? != 0 ; then
225 echo "test failed - master and slave databases differ"
229 echo ">>>>> Test succeeded"