| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan |
| 4 |
# (Royal Institute of Technology, Stockholm, Sweden). |
| 5 |
# All rights reserved. |
| 6 |
# |
| 7 |
# Redistribution and use in source and binary forms, with or without |
| 8 |
# modification, are permitted provided that the following conditions |
| 9 |
# are met: |
| 10 |
# |
| 11 |
# 1. Redistributions of source code must retain the above copyright |
| 12 |
# notice, this list of conditions and the following disclaimer. |
| 13 |
# |
| 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. |
| 17 |
# |
| 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. |
| 21 |
# |
| 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 |
| 32 |
# SUCH DAMAGE. |
| 33 |
|
| 34 |
top_builddir="@top_builddir@" |
| 35 |
env_setup="@env_setup@" |
| 36 |
objdir="@objdir@" |
| 37 |
|
| 38 |
db_type=@db_type@ |
| 39 |
|
| 40 |
. ${env_setup} |
| 41 |
|
| 42 |
# If there is no useful db support compiled in, disable test |
| 43 |
${have_db} || exit 77 |
| 44 |
|
| 45 |
|
| 46 |
# Don't run this test in AFS, since it lacks support for AF_UNIX |
| 47 |
expr "X`/bin/pwd || pwd`" : "X/afs/.*" > /dev/null 2>/dev/null && exit 77 |
| 48 |
|
| 49 |
R=TEST.H5L.SE |
| 50 |
|
| 51 |
port=@port@ |
| 52 |
|
| 53 |
cache="FILE:${objdir}/cache.krb5" |
| 54 |
keytabfile=${objdir}/iprop.keytab |
| 55 |
keytab="FILE:${keytabfile}" |
| 56 |
|
| 57 |
kdc="${kdc} --addresses=localhost -P $port" |
| 58 |
kadmin="${kadmin} -r $R" |
| 59 |
kinit="${kinit} -c $cache ${afs_no_afslog}" |
| 60 |
|
| 61 |
slave_ver_from_master_old= |
| 62 |
slave_ver_from_master_new= |
| 63 |
slave_ver_old= |
| 64 |
slave_ver_new= |
| 65 |
get_iprop_ver () { |
| 66 |
min_change=${1:-1} |
| 67 |
slave_ver_from_master_new=`grep '^iprop/' iprop-stats | head -1 | awk '{print $3}'` |
| 68 |
slave_ver_new=`grep 'up-to-date with version:' iprop-slave-status | awk '{print $4}'` |
| 69 |
if [ -z "$slave_ver_from_master_new" -o -z "$slave_ver_new" ]; then |
| 70 |
return 1 |
| 71 |
fi |
| 72 |
if [ x"$slave_ver_from_master_new" != x"$slave_ver_new" ]; then |
| 73 |
return 1 |
| 74 |
fi |
| 75 |
if [ x"$slave_ver_from_master_old" != x ]; then |
| 76 |
change=`expr "$slave_ver_from_master_new" - "$slave_ver_from_master_old"` |
| 77 |
if [ "$change" -lt "$min_change" ]; then |
| 78 |
return 1 |
| 79 |
fi |
| 80 |
fi |
| 81 |
slave_ver_from_master_old=$slave_ver_from_master_new |
| 82 |
slave_ver_old=$slave_ver_new |
| 83 |
return 0 |
| 84 |
} |
| 85 |
|
| 86 |
waitsec=65 |
| 87 |
sleeptime=2 |
| 88 |
wait_for () { |
| 89 |
msg=$1 |
| 90 |
shift |
| 91 |
t=0 |
| 92 |
while ! "$@"; do |
| 93 |
sleep $sleeptime; |
| 94 |
t=`expr $t + $sleeptime` |
| 95 |
if [ $t -gt $waitsec ]; then |
| 96 |
echo "Waited too long for $msg" |
| 97 |
exit 1 |
| 98 |
fi |
| 99 |
done |
| 100 |
return 0 |
| 101 |
} |
| 102 |
|
| 103 |
check_pidfile_is_dead () { |
| 104 |
if test ! -f lt-${1}.pid -a ! -f ${1}.pid; then |
| 105 |
return 0 |
| 106 |
fi |
| 107 |
_pid=`cat lt-${1}.pid ${1}.pid 2>/dev/null` |
| 108 |
if [ -z "$_pid" ]; then |
| 109 |
return 0 |
| 110 |
fi |
| 111 |
if kill -0 $_pid 2>/dev/null; then |
| 112 |
return 1 |
| 113 |
fi |
| 114 |
return 0 |
| 115 |
} |
| 116 |
|
| 117 |
wait_for_slave () { |
| 118 |
wait_for "iprop versions to change and/or slave to catch up" get_iprop_ver "$@" |
| 119 |
} |
| 120 |
|
| 121 |
wait_for_master_down () { |
| 122 |
wait_for "master to exit" check_pidfile_is_dead ipropd-master |
| 123 |
} |
| 124 |
|
| 125 |
wait_for_slave_down () { |
| 126 |
wait_for "slave to exit" check_pidfile_is_dead ipropd-slave |
| 127 |
} |
| 128 |
|
| 129 |
KRB5_CONFIG="${objdir}/krb5.conf" |
| 130 |
export KRB5_CONFIG |
| 131 |
|
| 132 |
rm -f ${keytabfile} |
| 133 |
rm -f current-db* |
| 134 |
rm -f current*.log |
| 135 |
rm -f out-* |
| 136 |
rm -f mkey.file* |
| 137 |
rm -f messages.log |
| 138 |
|
| 139 |
> messages.log |
| 140 |
|
| 141 |
echo Creating database |
| 142 |
${kadmin} -l \ |
| 143 |
init \ |
| 144 |
--realm-max-ticket-life=1day \ |
| 145 |
--realm-max-renewable-life=1month \ |
| 146 |
${R} || exit 1 |
| 147 |
|
| 148 |
${kadmin} -l add -p foo --use-defaults user@${R} || exit 1 |
| 149 |
|
| 150 |
${kadmin} -l add --random-key --use-defaults iprop/localhost@${R} || exit 1 |
| 151 |
${kadmin} -l ext -k ${keytab} iprop/localhost@${R} || exit 1 |
| 152 |
${kadmin} -l add --random-key --use-defaults iprop/slave.test.h5l.se@${R} || exit 1 |
| 153 |
${kadmin} -l ext -k ${keytab} iprop/slave.test.h5l.se@${R} || exit 1 |
| 154 |
|
| 155 |
echo foo > ${objdir}/foopassword |
| 156 |
|
| 157 |
echo "Test log recovery" |
| 158 |
${kadmin} -l add --random-key --use-defaults recovtest@${R} || exit 1 |
| 159 |
# Test theory: save the log, make a change and save the record it |
| 160 |
# produced, restore the log, append to it the saved record, then add dummy |
| 161 |
# record. |
| 162 |
|
| 163 |
# Save the log |
| 164 |
cp current.log current.log.tmp |
| 165 |
ls -l current.log.tmp | awk '{print $5}' > tmp |
| 166 |
read sz < tmp |
| 167 |
# Make a change |
| 168 |
${kadmin} -l mod -a requires-pre-auth recovtest@${R} || exit 1 |
| 169 |
${kadmin} -l get recovtest@${R} | grep 'Attributes: requires-pre-auth$' > /dev/null || exit 1 |
| 170 |
# Save the resulting log record |
| 171 |
ls -l current.log | awk '{print $5}' > tmp |
| 172 |
read nsz < tmp |
| 173 |
rm tmp |
| 174 |
dd bs=1 if=current.log skip=$sz of=current.log.tmp.saved-record count=`expr $nsz - $sz` 2>/dev/null |
| 175 |
# Undo the change |
| 176 |
${kadmin} -l mod -a -requires-pre-auth recovtest@${R} || exit 1 |
| 177 |
${kadmin} -l get recovtest@${R} | grep 'Attributes:.$' > /dev/null || exit 1 |
| 178 |
# Restore the log |
| 179 |
cp current.log current.log.save |
| 180 |
mv current.log.tmp current.log |
| 181 |
# Append the saved record |
| 182 |
cat current.log.tmp.saved-record >> current.log |
| 183 |
rm current.log.tmp.saved-record |
| 184 |
# Check that we still see the principal as modified after another write forcing |
| 185 |
# log recovery. |
| 186 |
${kadmin} -l add --random-key --use-defaults dummy@${R} || exit 1 |
| 187 |
${kadmin} -l del dummy@${R} || exit 1 |
| 188 |
${kadmin} -l get recovtest@${R} | grep 'Attributes: requires-pre-auth$' > /dev/null || exit 1 |
| 189 |
|
| 190 |
# -- foo |
| 191 |
ipds= |
| 192 |
ipdm= |
| 193 |
kdcpid= |
| 194 |
|
| 195 |
> iprop-stats |
| 196 |
rm -f iprop-slave-status |
| 197 |
|
| 198 |
ipropd_slave="${ipropd_slave} --status-file=iprop-slave-status" |
| 199 |
|
| 200 |
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 |
| 201 |
|
| 202 |
echo Starting kdc ; > messages.log |
| 203 |
${kdc} --detach --testing || { echo "kdc failed to start"; exit 1; } |
| 204 |
kdcpid=`getpid kdc` |
| 205 |
|
| 206 |
echo "starting master" ; > messages.log |
| 207 |
env ${HEIM_MALLOC_DEBUG} \ |
| 208 |
${ipropd_master} --hostname=localhost -k ${keytab} \ |
| 209 |
--database=${objdir}/current-db --detach || |
| 210 |
{ echo "ipropd-master failed to start"; exit 1; } |
| 211 |
ipdm=`getpid ipropd-master` |
| 212 |
|
| 213 |
echo "starting slave" ; > messages.log |
| 214 |
env ${HEIM_MALLOC_DEBUG} \ |
| 215 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 216 |
${ipropd_slave} --hostname=slave.test.h5l.se -k ${keytab} --detach localhost || |
| 217 |
{ echo "ipropd-slave failed to start"; exit 1; } |
| 218 |
ipds=`getpid ipropd-slave` |
| 219 |
sh ${wait_kdc} ipropd-slave messages.log 'slave status change: up-to-date' || exit 1 |
| 220 |
get_iprop_ver || exit 1 |
| 221 |
|
| 222 |
echo "checking slave is up" |
| 223 |
${EGREP} 'iprop/[email protected].*Up' iprop-stats >/dev/null || exit 1 |
| 224 |
${EGREP} 'up-to-date with version' iprop-slave-status >/dev/null || { echo "slave to up to date" ; cat iprop-slave-status ; exit 1; } |
| 225 |
|
| 226 |
# ----------------- checking: pushing lives changes |
| 227 |
|
| 228 |
slave_get() { KRB5_CONFIG="${objdir}/krb5-slave.conf" ${kadmin} -l get "$@"; } |
| 229 |
slave_check_exists() { |
| 230 |
# Creation with a random key is not atomic, there are at present |
| 231 |
# 3 log entries to create a random key principal, the entry is |
| 232 |
# "invalid" for the first two of these. We wait for the entry to |
| 233 |
# exist and not be invalid |
| 234 |
# |
| 235 |
attrs=`slave_get -o attributes "$@" 2>/dev/null` || return 1 |
| 236 |
echo $attrs | egrep 'Attributes:' | egrep -v invalid >/dev/null || return 1 |
| 237 |
get_iprop_ver 0 |
| 238 |
} |
| 239 |
|
| 240 |
echo "Add host" |
| 241 |
${kadmin} -l add --random-key --use-defaults host/foo@${R} || exit 1 |
| 242 |
wait_for "Slave sees new host" slave_check_exists "host/foo@${R}" |
| 243 |
|
| 244 |
echo "Rollover host keys" |
| 245 |
${kadmin} -l cpw -r --keepold host/foo@${R} || exit 1 |
| 246 |
${kadmin} -l cpw -r --keepold host/foo@${R} || exit 1 |
| 247 |
${kadmin} -l cpw -r --keepold host/foo@${R} || exit 1 |
| 248 |
wait_for_slave 3 |
| 249 |
slave_get host/foo@${R} | \ |
| 250 |
${EGREP} Keytypes: | cut -d: -f2 | tr ' ' ' |
| 251 |
' | sed 's/^.*[[]\(.*\)[]].*$/\1/' | grep '[0-9]' | sort -nu | tr -d ' |
| 252 |
' | ${EGREP} 1234 > /dev/null || exit 1 |
| 253 |
|
| 254 |
echo "Delete 3DES keys" |
| 255 |
${kadmin} -l del_enctype host/foo@${R} des3-cbc-sha1 |
| 256 |
wait_for_slave |
| 257 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 258 |
${kadmin} -l get host/foo@${R} | \ |
| 259 |
${EGREP} Keytypes: | cut -d: -f2 | tr ' ' ' |
| 260 |
' | sed 's/^.*[[]\(.*\)[]].*$/\1/' | grep '[0-9]' | sort -nu | tr -d ' |
| 261 |
' | ${EGREP} 1234 > /dev/null || exit 1 |
| 262 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 263 |
${kadmin} -l get host/foo@${R} | \ |
| 264 |
${EGREP} 'Keytypes:.*des3-cbc-sha1' > /dev/null && exit 1 |
| 265 |
|
| 266 |
echo "Change policy host" |
| 267 |
${kadmin} -l modify --policy=default host/foo@${R} || exit 1 |
| 268 |
wait_for_slave |
| 269 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 270 |
${kadmin} -l get host/foo@${R} > /dev/null 2>/dev/null || exit 1 |
| 271 |
|
| 272 |
echo "Rename host" |
| 273 |
${kadmin} -l rename host/foo@${R} host/bar@${R} || exit 1 |
| 274 |
wait_for_slave |
| 275 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 276 |
${kadmin} -l get host/foo@${R} > /dev/null 2>/dev/null && exit 1 |
| 277 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 278 |
${kadmin} -l get host/bar@${R} > /dev/null || exit 1 |
| 279 |
|
| 280 |
echo "Delete host" |
| 281 |
${kadmin} -l delete host/bar@${R} || exit 1 |
| 282 |
wait_for_slave |
| 283 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 284 |
${kadmin} -l get host/bar@${R} > /dev/null 2>/dev/null && exit 1 |
| 285 |
|
| 286 |
# See note below in LMDB sanity checking |
| 287 |
echo "Re-add host" |
| 288 |
${kadmin} -l add --random-key --use-defaults host/foo@${R} || exit 1 |
| 289 |
${kadmin} -l add --random-key --use-defaults host/bar@${R} || exit 1 |
| 290 |
wait_for "Slave sees re-added host" slave_check_exists "host/bar@${R}" |
| 291 |
|
| 292 |
echo "kill slave and remove log and database" |
| 293 |
> iprop-stats |
| 294 |
sh ${leaks_kill} ipropd-slave $ipds || exit 1 |
| 295 |
rm -f iprop-slave-status |
| 296 |
|
| 297 |
wait_for_slave_down |
| 298 |
${EGREP} 'iprop/[email protected].*Down' iprop-stats >/dev/null || exit 1 |
| 299 |
|
| 300 |
# ----------------- checking: slave is missing changes while down |
| 301 |
|
| 302 |
rm current.slave.log current-db.slave* || exit 1 |
| 303 |
|
| 304 |
echo "doing changes while slave is down" |
| 305 |
${kadmin} -l cpw --random-password user@${R} > /dev/null || exit 1 |
| 306 |
${kadmin} -l cpw --random-password user@${R} > /dev/null || exit 1 |
| 307 |
|
| 308 |
echo "Making a copy of the master log file" |
| 309 |
cp ${objdir}/current.log ${objdir}/current.log.tmp |
| 310 |
|
| 311 |
# ----------------- checking: checking that master and slaves resyncs |
| 312 |
|
| 313 |
echo "starting slave again" ; > messages.log |
| 314 |
> iprop-stats |
| 315 |
env ${HEIM_MALLOC_DEBUG} \ |
| 316 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 317 |
${ipropd_slave} --hostname=slave.test.h5l.se -k ${keytab} --detach localhost || |
| 318 |
{ echo "ipropd-slave failed to start"; exit 1; } |
| 319 |
ipds=`getpid ipropd-slave` |
| 320 |
|
| 321 |
echo "checking slave is up again" |
| 322 |
wait_for "slave to start and connect to master" \ |
| 323 |
${EGREP} 'iprop/[email protected].*Up' iprop-stats >/dev/null |
| 324 |
wait_for_slave 2 |
| 325 |
${EGREP} 'up-to-date with version' iprop-slave-status >/dev/null || { echo "slave not up to date" ; cat iprop-slave-status ; exit 1; } |
| 326 |
echo "checking for replay problems" |
| 327 |
${EGREP} 'Entry already exists in database' messages.log && exit 1 |
| 328 |
|
| 329 |
echo "compare versions on master and slave logs (no lock)" |
| 330 |
KRB5_CONFIG=${objdir}/krb5-slave.conf \ |
| 331 |
${iprop_log} last-version -n > slave-last.tmp |
| 332 |
${iprop_log} last-version -n > master-last.tmp |
| 333 |
cmp master-last.tmp slave-last.tmp || exit 1 |
| 334 |
|
| 335 |
echo "kill slave and remove log and database" |
| 336 |
sh ${leaks_kill} ipropd-slave $ipds || exit 1 |
| 337 |
wait_for_slave_down |
| 338 |
|
| 339 |
rm current.slave.log current-db.slave* || exit 1 |
| 340 |
> iprop-stats |
| 341 |
rm -f iprop-slave-status |
| 342 |
echo "starting slave" ; > messages.log |
| 343 |
env ${HEIM_MALLOC_DEBUG} \ |
| 344 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 345 |
${ipropd_slave} --hostname=slave.test.h5l.se -k ${keytab} --detach localhost || |
| 346 |
{ echo "ipropd-slave failed to start"; exit 1; } |
| 347 |
ipds=`getpid ipropd-slave` |
| 348 |
wait_for_slave 0 |
| 349 |
|
| 350 |
echo "checking slave is up again" |
| 351 |
wait_for "slave to start and connect to master" \ |
| 352 |
${EGREP} 'iprop/[email protected].*Up' iprop-stats >/dev/null |
| 353 |
${EGREP} 'up-to-date with version' iprop-slave-status >/dev/null || { echo "slave not up to date" ; cat iprop-slave-status ; exit 1; } |
| 354 |
echo "checking for replay problems" |
| 355 |
${EGREP} 'Entry already exists in database' messages.log && exit 1 |
| 356 |
|
| 357 |
# ----------------- checking: checking live truncation of master log |
| 358 |
|
| 359 |
${kadmin} -l cpw --random-password user@${R} > /dev/null || exit 1 |
| 360 |
wait_for_slave |
| 361 |
|
| 362 |
echo "live truncate on master log" |
| 363 |
${iprop_log} truncate -K 5 || exit 1 |
| 364 |
wait_for_slave 0 |
| 365 |
|
| 366 |
echo "Killing master and slave" |
| 367 |
sh ${leaks_kill} ipropd-master $ipdm || exit 1 |
| 368 |
sh ${leaks_kill} ipropd-slave $ipds || exit 1 |
| 369 |
|
| 370 |
rm -f iprop-slave-status |
| 371 |
|
| 372 |
wait_for_slave_down |
| 373 |
wait_for_master_down |
| 374 |
|
| 375 |
echo "compare versions on master and slave logs" |
| 376 |
KRB5_CONFIG=${objdir}/krb5-slave.conf \ |
| 377 |
${iprop_log} last-version > slave-last.tmp |
| 378 |
${iprop_log} last-version > master-last.tmp |
| 379 |
cmp master-last.tmp slave-last.tmp || exit 1 |
| 380 |
|
| 381 |
# ----------------- checking: master going backward |
| 382 |
> iprop-stats |
| 383 |
> messages.log |
| 384 |
|
| 385 |
echo "Going back to old version of the master log file" |
| 386 |
cp ${objdir}/current.log.tmp ${objdir}/current.log |
| 387 |
|
| 388 |
echo "starting master" ; > messages.log |
| 389 |
env ${HEIM_MALLOC_DEBUG} \ |
| 390 |
${ipropd_master} --hostname=localhost -k ${keytab} \ |
| 391 |
--database=${objdir}/current-db --detach || |
| 392 |
{ echo "ipropd-master failed to start"; exit 1; } |
| 393 |
ipdm=`getpid ipropd-master` |
| 394 |
|
| 395 |
echo "starting slave" ; > messages.log |
| 396 |
env ${HEIM_MALLOC_DEBUG} \ |
| 397 |
KRB5_CONFIG="${objdir}/krb5-slave.conf" \ |
| 398 |
${ipropd_slave} --hostname=slave.test.h5l.se -k ${keytab} --detach localhost || |
| 399 |
{ echo "ipropd-slave failed to start"; exit 1; } |
| 400 |
ipds=`getpid ipropd-slave` |
| 401 |
wait_for_slave -1 |
| 402 |
|
| 403 |
echo "checking slave is up again" |
| 404 |
wait_for "slave to start and connect to master" \ |
| 405 |
${EGREP} 'iprop/[email protected].*Up' iprop-stats >/dev/null |
| 406 |
${EGREP} 'up-to-date with version' iprop-slave-status >/dev/null || { echo "slave to up to date" ; cat iprop-slave-status ; exit 1; } |
| 407 |
echo "checking for replay problems" |
| 408 |
${EGREP} 'Entry already exists in database' messages.log && exit 1 |
| 409 |
|
| 410 |
echo "pushing one change" |
| 411 |
${kadmin} -l cpw --random-password user@${R} > /dev/null || exit 1 |
| 412 |
wait_for_slave |
| 413 |
|
| 414 |
echo "Killing master" |
| 415 |
sh ${leaks_kill} ipropd-master $ipdm || exit 1 |
| 416 |
|
| 417 |
wait_for_master_down |
| 418 |
|
| 419 |
wait_for "slave to disconnect" \ |
| 420 |
${EGREP} 'disconnected' iprop-slave-status >/dev/null |
| 421 |
|
| 422 |
if ! tail -30 messages.log | grep 'disconnected for server' > /dev/null; then |
| 423 |
echo "client didnt disconnect" |
| 424 |
exit 1 |
| 425 |
fi |
| 426 |
|
| 427 |
echo "probing for slave pid" |
| 428 |
kill -0 ${ipds} || { echo "slave no longer there"; exit 1; } |
| 429 |
|
| 430 |
> messages.log |
| 431 |
|
| 432 |
echo "Staring master again" ; > messages.log |
| 433 |
env ${HEIM_MALLOC_DEBUG} \ |
| 434 |
${ipropd_master} --hostname=localhost -k ${keytab} \ |
| 435 |
--database=${objdir}/current-db --detach || |
| 436 |
{ echo "ipropd-master failed to start"; exit 1; } |
| 437 |
ipdm=`getpid ipropd-master` |
| 438 |
|
| 439 |
echo "probing for slave pid" |
| 440 |
kill -0 ${ipds} || { echo "slave no longer there"; exit 1; } |
| 441 |
|
| 442 |
|
| 443 |
echo "pushing one change" |
| 444 |
${kadmin} -l cpw --random-password user@${R} > /dev/null || exit 1 |
| 445 |
wait_for_slave |
| 446 |
|
| 447 |
echo "shutting down all services" |
| 448 |
|
| 449 |
leaked=false |
| 450 |
sh ${leaks_kill} kdc $kdcpid || leaked=true |
| 451 |
sh ${leaks_kill} ipropd-master $ipdm || leaked=true |
| 452 |
sh ${leaks_kill} ipropd-slave $ipds || leaked=true |
| 453 |
rm -f iprop-slave-status |
| 454 |
trap "" EXIT |
| 455 |
$leaked && exit 1 |
| 456 |
|
| 457 |
echo "compare versions on master and slave logs" |
| 458 |
KRB5_CONFIG=${objdir}/krb5-slave.conf \ |
| 459 |
${iprop_log} last-version > slave-last.tmp |
| 460 |
${iprop_log} last-version > master-last.tmp |
| 461 |
cmp master-last.tmp slave-last.tmp || exit 1 |
| 462 |
|
| 463 |
if [ "$db_type" = lmdb ] && type mdb_stat > /dev/null 2>&1; then |
| 464 |
# Sanity check that we have the same number of principals at the HDB |
| 465 |
# and LMDB levels. |
| 466 |
# |
| 467 |
# We should also do this for the sqlite backend, but that would |
| 468 |
# require a sqlite3(1) shell that is capable of opening our HDB |
| 469 |
# files. |
| 470 |
echo "checking that principals in DB == entries in LMDB" |
| 471 |
# Add one to match lmdb overhead |
| 472 |
princs=`(echo; ${kadmin} -l list '*') | wc -l` |
| 473 |
entries=`mdb_stat -n current-db.mdb | grep 'Entries:' | awk '{print $2}'` |
| 474 |
[ "$princs" -eq "$entries" ] || exit 1 |
| 475 |
fi |
| 476 |
|
| 477 |
exit 0 |