3 # Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
4 # (Royal Institute of Technology, Stockholm, Sweden).
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
18 # 3. Neither the name of the Institute nor the names of its contributors
19 # may be used to endorse or promote products derived from this software
20 # without specific prior written permission.
22 # THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 # ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 top_builddir
="@top_builddir@"
35 env_setup
="@env_setup@"
40 # If there is no useful db support compile in, disable test
44 # Dont run this test in AFS, since it lacks support for AF_UNIX
45 expr "X`/bin/pwd || pwd`" : "X/afs/.*" > /dev
/null
2>/dev
/null
&& exit 77
51 cache
="FILE:${objdir}/cache.krb5"
52 keytabfile
=${objdir}/iprop.keytab
53 keytab
="FILE:${keytabfile}"
55 kdc
="${kdc} --addresses=localhost -P $port"
56 kadmin
="${kadmin} -r $R"
57 kinit
="${kinit} -c $cache ${afs_no_afslog}"
59 KRB5_CONFIG
="${objdir}/krb5.conf"
71 echo Creating database
74 --realm-max-ticket-life=1day \
75 --realm-max-renewable-life=1month \
78 ${kadmin} -l add
-p foo
--use-defaults user@
${R} ||
exit 1
80 ${kadmin} -l add
--random-key --use-defaults iprop
/localhost@
${R} ||
exit 1
81 ${kadmin} -l ext -k ${keytab} iprop/localhost@${R} ||
exit 1
82 ${kadmin} -l add
--random-key --use-defaults iprop
/slave.
test.h5l.se@
${R} ||
exit 1
83 ${kadmin} -l ext -k ${keytab} iprop/slave.test.h5l.se@${R} ||
exit 1
85 echo foo
> ${objdir}/foopassword
93 trap "echo 'killing ipropd s + m + kdc'; kill -9 \${ipdm} \${ipds} \${kdcpid} >/dev/null 2>/dev/null; tail messages.log ; tail iprop-stats; exit 1;" EXIT
99 sh
${wait_kdc} ||
exit 1
101 echo "starting master"
102 env
${HEIM_MALLOC_DEBUG} \
103 ${ipropd_master} --hostname=localhost
-k ${keytab} \
104 --database=${objdir}/current-db
&
106 sh
${wait_kdc} ipropd-master ||
exit 1
108 echo "starting slave"
109 env
${HEIM_MALLOC_DEBUG} \
110 KRB5_CONFIG
="${objdir}/krb5-slave.conf" \
111 ${ipropd_slave} --hostname=slave.
test.h5l.se
-k ${keytab} localhost
&
113 sh
${wait_kdc} ipropd-slave ||
exit 1
115 echo "checking slave is up"
116 ${EGREP} 'iprop/slave.test.h5l.se@TEST.H5L.SE.*Up' iprop-stats
>/dev
/null ||
exit 1
118 # ----------------- checking: pushing lives changes
121 ${kadmin} -l add
--random-key --use-defaults host
/foo@
${R} ||
exit 1
123 KRB5_CONFIG
="${objdir}/krb5-slave.conf" \
124 ${kadmin} -l get host
/foo@
${R} > /dev
/null ||
exit 1
127 ${kadmin} -l rename host/foo@${R} host/bar@${R} ||
exit 1
129 KRB5_CONFIG
="${objdir}/krb5-slave.conf" \
130 ${kadmin} -l get host
/foo@
${R} > /dev
/null
2>/dev
/null
&& exit 1
131 KRB5_CONFIG
="${objdir}/krb5-slave.conf" \
132 ${kadmin} -l get host
/bar@
${R} > /dev
/null ||
exit 1
135 ${kadmin} -l delete host
/bar@
${R} ||
exit 1
137 KRB5_CONFIG
="${objdir}/krb5-slave.conf" \
138 ${kadmin} -l get host
/bar@
${R} > /dev
/null
2>/dev
/null
&& exit 1
142 sh
${leaks_kill} ipropd-slave
$ipds ||
exit 1
145 ${EGREP} 'iprop/slave.test.h5l.se@TEST.H5L.SE.*Down' iprop-stats
>/dev
/null ||
exit 1
147 # ----------------- checking: slave is missing changes while down
149 echo "doing changes while slave is down"
150 ${kadmin} -l cpw
--random-password user@
${R} > /dev
/null ||
exit 1
151 ${kadmin} -l cpw
--random-password user@
${R} > /dev
/null ||
exit 1
153 echo "Makeing a copy of the master log file"
154 cp ${objdir}/current.log
${objdir}/current.log.tmp
156 # ----------------- checking: checking that master and slaves resyncs
158 echo "starting slave again"
161 env
${HEIM_MALLOC_DEBUG} \
162 KRB5_CONFIG
="${objdir}/krb5-slave.conf" \
163 ${ipropd_slave} --hostname=slave.
test.h5l.se
-k ${keytab} localhost
&
165 sh
${wait_kdc} ipropd-slave ||
exit 1
167 echo "checking slave is up again"
168 ${EGREP} 'iprop/slave.test.h5l.se@TEST.H5L.SE.*Up' iprop-stats
>/dev
/null ||
exit 1
169 echo "checking for replay problems"
170 ${EGREP} 'Entry already exists in database' messages.log
&& exit 1
172 echo "kill slave and remove log and database"
173 sh
${leaks_kill} ipropd-slave
$ipds ||
exit 1
176 rm current.slave.log current-db.slave
* ||
exit 1
179 env
${HEIM_MALLOC_DEBUG} \
180 KRB5_CONFIG
="${objdir}/krb5-slave.conf" \
181 ${ipropd_slave} --hostname=slave.
test.h5l.se
-k ${keytab} localhost
&
183 sh
${wait_kdc} ipropd-slave ||
exit 1
185 echo "checking slave is up again"
186 ${EGREP} 'iprop/slave.test.h5l.se@TEST.H5L.SE.*Up' iprop-stats
>/dev
/null ||
exit 1
187 echo "checking for replay problems"
188 ${EGREP} 'Entry already exists in database' messages.log
&& exit 1
190 # ----------------- checking: checking live truncation of master log
192 ${kadmin} -l cpw
--random-password user@
${R} > /dev
/null ||
exit 1
195 echo "live truncate on master log"
196 ${iprop_log} truncate ||
exit 1
199 echo "Killing master and slave"
200 sh
${leaks_kill} ipropd-master
$ipdm ||
exit 1
201 sh
${leaks_kill} ipropd-slave
$ipds ||
exit 1
204 #${EGREP} "^master down at " iprop-stats > /dev/null || exit 1
206 echo "compare versions on master and slave logs"
207 KRB5_CONFIG
=${objdir}/krb5-slave.conf \
208 ${iprop_log} last-version
> slave-last.tmp
209 ${iprop_log} last-version
> master-last.tmp
210 cmp master-last.tmp slave-last.tmp ||
exit 1
212 # ----------------- checking: master going backward
216 echo "Going back to old version of the master log file"
217 cp ${objdir}/current.log.tmp
${objdir}/current.log
219 echo "starting master"
220 env
${HEIM_MALLOC_DEBUG} \
221 ${ipropd_master} --hostname=localhost
-k ${keytab} \
222 --database=${objdir}/current-db
&
224 sh
${wait_kdc} ipropd-master ||
exit 1
226 echo "starting slave"
227 env
${HEIM_MALLOC_DEBUG} \
228 KRB5_CONFIG
="${objdir}/krb5-slave.conf" \
229 ${ipropd_slave} --hostname=slave.
test.h5l.se
-k ${keytab} localhost
&
231 sh
${wait_kdc} ipropd-slave ||
exit 1
233 echo "checking slave is up again"
234 ${EGREP} 'iprop/slave.test.h5l.se@TEST.H5L.SE.*Up' iprop-stats
>/dev
/null ||
exit 1
235 echo "checking for replay problems"
236 ${EGREP} 'Entry already exists in database' messages.log
&& exit 1
238 echo "pushing one change"
239 ${kadmin} -l cpw
--random-password user@
${R} > /dev
/null ||
exit 1
242 echo "Killing master"
243 sh
${leaks_kill} ipropd-master
$ipdm ||
exit 1
247 if ! tail -30 messages.log |
grep 'disconnected for server' > /dev
/null
; then
248 echo "client didnt disconnect"
252 echo "probing for slave pid"
253 kill -0 ${ipds} ||
{ echo "slave no longer there"; exit 1; }
257 echo "Staring master again"
258 env
${HEIM_MALLOC_DEBUG} \
259 ${ipropd_master} --hostname=localhost
-k ${keytab} \
260 --database=${objdir}/current-db
&
262 sh
${wait_kdc} ipropd-master ||
exit 1
264 echo "probing for slave pid"
265 kill -0 ${ipds} ||
{ echo "slave no longer there"; exit 1; }
267 sh
${wait_kdc} ipropd-slave messages.log
"connection successful to master" ||
exit 1
269 sh
${wait_kdc} ipropd-slave messages.log
"ipropd-slave started at version" ||
exit 1
271 echo "pushing one change"
272 ${kadmin} -l cpw
--random-password user@
${R} > /dev
/null ||
exit 1
275 echo "shutting down all services"
278 sh
${leaks_kill} kdc
$kdcpid ||
exit 1
279 sh
${leaks_kill} ipropd-master
$ipdm ||
exit 1
280 sh
${leaks_kill} ipropd-slave
$ipds ||
exit 1
282 echo "compare versions on master and slave logs"
283 KRB5_CONFIG
=${objdir}/krb5-slave.conf \
284 ${iprop_log} last-version
> slave-last.tmp
285 ${iprop_log} last-version
> master-last.tmp
286 cmp master-last.tmp slave-last.tmp ||
exit 1