properly range-check fields that do not allow 0

3362.	[bug]		Setting some option values to 0 in named.conf
			could trigger an assertion failure on startup.
			[RT #27730]
This commit is contained in:
Evan Hunt
2012-08-13 22:39:42 -07:00
parent 8f6d6d72e8
commit 820fdd61dd
4 changed files with 75 additions and 3 deletions

View File

@@ -57,5 +57,35 @@ $CHECKCONF dnssec.3 2>&1 | grep '.*' && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I: range checking fields that do not allow zero"
ret=0
for field in max-retry-time min-retry-time max-refresh-time min-refresh-time; do
cat > badzero.conf << EOF
options {
$field 0;
};
EOF
$CHECKCONF badzero.conf > /dev/null 2>&1
[ $? -eq 1 ] || { echo "I: options $field failed" ; ret=1; }
cat > badzero.conf << EOF
view dummy {
$field 0;
};
EOF
$CHECKCONF badzero.conf > /dev/null 2>&1
[ $? -eq 1 ] || { echo "I: view $field failed" ; ret=1; }
cat > badzero.conf << EOF
zone dummy {
type slave;
masters { 0.0.0.0; };
$field 0;
};
EOF
$CHECKCONF badzero.conf > /dev/null 2>&1
[ $? -eq 1 ] || { echo "I: zone $field failed" ; ret=1; }
done
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:exit status: $status"
exit $status