# Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
status=0
n=0
n=`expr $n + 1`
echo "I:verifying that named started normally ($n)"
ret=0
if [ ! "$CYGWIN" ]; then
n=`expr $n + 1`
echo "I:verifying that named checks for conflicting listeners ($n)"
ret=0
(cd ns2; $NAMED -c named-alt1.conf -D ns2-extra-1 -X other.lock -m record,size,mctx -d 99 -g -U 4 >> named2.run 2>&1 & )
do
sleep 1
done
do
sleep 1
done
fi
n=`expr $n + 1`
echo "I:verifying that named checks for conflicting named processes ($n)"
ret=0
(cd ns2; $NAMED -c named-alt2.conf -D ns2-extra-2 -X named.lock -m record,size,mctx -d 99 -g -U 4 >> named3.run 2>&1 & )
sleep 2
n=`expr $n + 1`
echo "I:verifying that 'lock-file none' disables process check ($n)"
ret=0
(cd ns2; $NAMED -c named-alt3.conf -D ns2-extra-3 -m record,size,mctx -d 99 -g -U 4 >> named4.run 2>&1 & )
sleep 2
if $SHELL ../testcrypto.sh -q
then
n=`expr $n + 1`
echo "I: checking that named refuses to reconfigure if managed-keys-directory is set and not writable ($n)"
ret=0
sleep 1
n=`expr $n + 1`
echo "I: checking that named refuses to reconfigure if managed-keys-directory is unset and working directory is not writable ($n)"
ret=0
sleep 1
n=`expr $n + 1`
echo "I: checking that named reconfigures if working directory is not writable but managed-keys-directory is ($n)"
ret=0
echo "I: shutting down existing named"
pid=`cat named4.pid 2>/dev/null`
pid=`cat named5.pid 2>/dev/null`
pid=`cat named6.pid 2>/dev/null`
fi
n=`expr $n + 1`
echo "I: checking that named refuses to start if managed-keys-directory is set and not writable ($n)"
ret=0
cd ns2
sleep 2
pid=`cat named4.pid 2>/dev/null`
cd ..
n=`expr $n + 1`
echo "I: checking that named refuses to start if managed-keys-directory is unset and working directory is not writable ($n)"
ret=0
cd ns2
sleep 2
pid=`cat named5.pid 2>/dev/null`
cd ..
n=`expr $n + 1`
echo "I: checking that named starts if managed-keys-directory is writable and working directory is not writable ($n)"
ret=0
cd ns2
sleep 2
pid=`cat named6.pid 2>/dev/null`
cd ..
echo "I:exit status: $status"