4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
8 mkdir $REPLDIR $REPLDIR/r1
14 # - populate over ldap
15 # - perform some modifies and deleted
16 # - retrieve database over ldap and compare against expected results
19 echo "Starting master slapd on TCP/IP port $PORT..."
20 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
21 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
23 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 $PORT \
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)!"
46 echo "Using ldapadd to create the context prefix entry in the master..."
47 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
48 $LDIFORDEREDCP > /dev/null 2>&1
50 if test $RC != 0 ; then
51 echo "ldapadd failed ($RC)!"
56 echo "Starting slave slapd on TCP/IP port $R1SLAVEPORT..."
57 . $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
58 $SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
60 if test $WAIT != 0 ; then
61 echo SLAVEPID $SLAVEPID
65 echo "Using ldapsearch to check that slave slapd is running..."
66 for i in 0 1 2 3 4 5; do
67 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R1SLAVEPORT \
68 'objectclass=*' > /dev/null 2>&1
70 if test $RC = 0 ; then
73 echo "Waiting 5 seconds for slapd to start..."
77 if test $RC != 0 ; then
78 echo "ldapsearch failed ($RC)!"
79 kill -HUP $PID $SLAVEPID
83 echo "Using ldapadd to populate the master directory..."
84 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
85 $LDIFORDEREDNOCP > /dev/null 2>&1
87 if test $RC != 0 ; then
88 echo "ldapadd failed ($RC)!"
89 kill -HUP $PID $SLAVEPID
93 echo "Waiting 90 seconds for syncrepl to receive changes..."
96 echo "Using ldapmodify to modify master directory..."
99 # Do some modifications
102 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
103 $TESTOUT 2>&1 << EOMODS
104 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
115 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
121 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
124 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
125 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
128 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
129 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
131 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
135 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
137 objectclass: OpenLDAPperson
141 title: Chief Investigator, ITD
142 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
143 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
145 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
146 description: Very odd
147 facsimiletelephonenumber: +1 313 555 7557
148 telephonenumber: +1 313 555 8343
149 mail: gjensen@mailgw.example.com
150 homephone: +1 313 555 8844
152 dn: ou=Retired, ou=People, o=University of Michigan, c=US
154 objectclass: organizationalUnit
157 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
159 objectclass: OpenLDAPperson
160 cn: Rosco P. Coltrane
164 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
166 newrdn: cn=Rosco P. Coltrane
168 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
170 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
175 echo "Waiting 90 seconds for syncrepl to receive changes..."
178 echo "Using ldapsearch to read all the entries from the master..."
179 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
180 'objectclass=*' > $MASTEROUT 2>&1
183 if test $RC != 0 ; then
184 echo "ldapsearch failed at master ($RC)!"
185 kill -HUP $PID $SLAVEPID
189 echo "Using ldapsearch to read all the entries from the slave..."
190 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $R1SLAVEPORT \
191 'objectclass=*' > $R1SLAVEOUT 2>&1
194 if test $RC != 0 ; then
195 echo "ldapsearch failed at slave ($RC)!"
196 kill -HUP $PID $SLAVEPID
200 kill -HUP $PID $SLAVEPID
205 echo "Filtering ldapsearch results..."
206 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
207 echo "Filtering original ldif used to create database..."
208 . $LDIFFILTER < $LDIF > $R1LDIFFLT
210 echo "Comparing retrieved entries from master and slave..."
211 $CMP $SEARCHFLT $R1LDIFFLT > $CMPOUT
213 if test $? != 0 ; then
214 echo "test failed - master and slave databases differ"
218 echo ">>>>> Test succeeded"