4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
7 mkdir -p $TESTDIR $DBDIR1 $DBDIR4
13 # - populate over ldap
14 # - perform some modifies and deleted
15 # - retrieve database over ldap and compare against expected results
18 echo "Starting master slapd on TCP/IP port $PORT1..."
19 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $CONF1
20 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
22 if test $WAIT != 0 ; then
28 echo "Using ldapsearch to check that master slapd is running..."
29 for i in 0 1 2 3 4 5; do
30 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
31 'objectclass=*' > /dev/null 2>&1
33 if test $RC = 0 ; then
36 echo "Waiting 5 seconds for slapd to start..."
40 if test $RC != 0 ; then
41 echo "ldapsearch failed ($RC)!"
42 test $KILLSERVERS != no && kill -HUP $KILLPIDS
46 echo "Using ldapadd to create the context prefix entry in the master..."
47 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
48 $LDIFORDEREDCP > /dev/null 2>&1
50 if test $RC != 0 ; then
51 echo "ldapadd failed ($RC)!"
52 test $KILLSERVERS != no && kill -HUP $KILLPIDS
56 echo "Starting slave slapd on TCP/IP port $PORT4..."
57 . $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $CONF4
58 $SLAPD -f $CONF4 -h $URI4 -d $LVL $TIMING > $LOG4 2>&1 &
60 if test $WAIT != 0 ; then
61 echo SLAVEPID $SLAVEPID
64 KILLPIDS="$KILLPIDS $SLAVEPID"
66 echo "Using ldapsearch to check that slave slapd is running..."
67 for i in 0 1 2 3 4 5; do
68 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT4 \
69 'objectclass=*' > /dev/null 2>&1
71 if test $RC = 0 ; then
74 echo "Waiting 5 seconds for slapd to start..."
78 if test $RC != 0 ; then
79 echo "ldapsearch failed ($RC)!"
80 test $KILLSERVERS != no && kill -HUP $KILLPIDS
84 echo "Using ldapadd to populate the master directory..."
85 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
86 $LDIFORDEREDNOCP > /dev/null 2>&1
88 if test $RC != 0 ; then
89 echo "ldapadd failed ($RC)!"
90 test $KILLSERVERS != no && kill -HUP $KILLPIDS
94 echo "Waiting 15 seconds for syncrepl to receive changes..."
97 echo "Using ldapmodify to modify master directory..."
100 # Do some modifications
103 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
104 $TESTOUT 2>&1 << EOMODS
105 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
116 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
122 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
125 uniquemember: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
126 uniquemember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
129 uniquemember: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
130 uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
132 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
136 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
138 objectclass: OpenLDAPperson
142 title: Chief Investigator, ITD
143 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
144 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
146 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
147 description: Very odd
148 facsimiletelephonenumber: +1 313 555 7557
149 telephonenumber: +1 313 555 8343
150 mail: gjensen@mailgw.example.com
151 homephone: +1 313 555 8844
153 dn: ou=Retired, ou=People, o=University of Michigan, c=US
155 objectclass: organizationalUnit
158 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
160 objectclass: OpenLDAPperson
161 cn: Rosco P. Coltrane
165 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
167 newrdn: cn=Rosco P. Coltrane
169 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
171 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
177 if test $RC != 0 ; then
178 echo "ldapmodify failed ($RC)!"
179 test $KILLSERVERS != no && kill -HUP $KILLPIDS
183 echo "Waiting 15 seconds for syncrepl to receive changes..."
186 echo "Using ldapsearch to read all the entries from the master..."
187 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
188 'objectclass=*' > $MASTEROUT 2>&1
191 if test $RC != 0 ; then
192 echo "ldapsearch failed at master ($RC)!"
193 test $KILLSERVERS != no && kill -HUP $KILLPIDS
197 echo "Using ldapsearch to read all the entries from the slave..."
198 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT4 \
199 'objectclass=*' > $SLAVEOUT 2>&1
202 if test $RC != 0 ; then
203 echo "ldapsearch failed at slave ($RC)!"
204 test $KILLSERVERS != no && kill -HUP $KILLPIDS
208 test $KILLSERVERS != no && kill -HUP $KILLPIDS
210 echo "Filtering master results..."
211 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
212 echo "Filtering slave results..."
213 . $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
215 echo "Comparing retrieved entries from master and slave..."
216 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
218 if test $? != 0 ; then
219 echo "test failed - master and slave databases differ"
223 echo ">>>>> Test succeeded"