Compare commits

...

17 Commits

Author SHA1 Message Date
Mark Andrews
c1cce13f0e 9.6-ESV-R7-P3 2012-08-24 14:34:54 +10:00
Mark Andrews
7221b0a758 3364. [security] Named could die on specially crafted record.
[RT #30416]
2012-08-16 13:36:44 +10:00
Mark Andrews
05ea0705d1 3358 [bug] Fix declaration of fatal in bin/named/server.c
and bin/nsupdate/main.c. [RT #30522]
2012-08-05 13:07:51 +10:00
Mark Andrews
1021e81004 Fix declaration of fatal in bin/named/server.c. 2012-08-05 01:45:23 +10:00
Evan Hunt
e7903c066b remove unneeded files from unknown test 2012-07-02 13:55:35 -07:00
Evan Hunt
b6d1d6cb78 prep for release 2012-07-02 10:16:18 -07:00
Evan Hunt
2a64ca198c fix bad-cache assert
3346.	[security]	Bad-cache data could be used before it was
			initialized, causing an assert. [RT #30025]
2012-07-02 10:05:41 -07:00
Evan Hunt
25c0e3ab49 wrong RT number 2012-07-02 09:27:52 -07:00
Mark Andrews
79e7fdd8dc 3343. [bug] Relax isc_random_jitter() REQUIRE tests. [RT# 19821] 2012-06-27 10:08:22 +10:00
Mark Andrews
5e24f346a8 3342. [bug] Change #3314 broke saving of stub zones to disk
resulting in excessive cpu usage in some cases.
                        [RT #29952]
2012-06-27 09:49:47 +10:00
Mark Andrews
96fd57c8c0 Merge branch 'v9_6_ESV_R7_patch' of repo.isc.org:/proj/git/prod/bind9 into v9_6_ESV_R7_patch 2012-06-02 15:01:57 +10:00
Evan Hunt
81b9842e47 wrong path for genrandom 2012-06-01 10:05:49 -07:00
Evan Hunt
4e440cb859 9.6-ESV-R7-P1
3331.	[security]	dns_rdataslab_fromrdataset could produce bad
			rdataslabs. [RT #29644]
2012-06-01 08:55:15 -07:00
Mark Andrews
9c9012fe9c 9.6-ESV-R7-P1 2012-06-02 00:10:27 +10:00
Mark Andrews
8f7389a4da fix change # 2012-06-02 00:06:06 +10:00
Mark Andrews
79ed70957c 3331. [security] dns_rdataslab_fromrdataset could produce bad
rdataslabs. [RT #29644]
2012-06-02 00:05:39 +10:00
Mark Andrews
ea59ea422c 3321. [security] dns_rdataslab_fromrdataset could produce bad
rdataslabs. [RT #29644]
2012-06-02 00:04:39 +10:00
23 changed files with 6533 additions and 86 deletions

24
CHANGES
View File

@@ -1,3 +1,27 @@
--- 9.6-ESV-R7-P3 released ---
3364. [security] Named could die on specially crafted record.
[RT #30416]
3358 [bug] Fix declaration of fatal in bin/named/server.c
and bin/nsupdate/main.c. [RT #30522]
--- 9.6-ESV-R7-P2 released ---
3346. [security] Bad-cache data could be used before it was
initialized, causing an assert. [RT #30025]
3343. [bug] Relax isc_random_jitter() REQUIRE tests. [RT #29821]
3342. [bug] Change #3314 broke saving of stub zones to disk
resulting in excessive cpu usage in some cases.
[RT #29952]
--- 9.6-ESV-R7-P1 released ---
3331. [security] dns_rdataslab_fromrdataset could produce bad
rdataslabs. [RT #29644]
--- 9.6-ESV-R7 released ---
3318. [tuning] Reduce the amount of work performed while holding a

View File

@@ -228,7 +228,7 @@ static const struct {
{ NULL, ISC_FALSE }
};
ISC_PLATFORM_NORETURN_POST static void
ISC_PLATFORM_NORETURN_PRE static void
fatal(const char *msg, isc_result_t result) ISC_PLATFORM_NORETURN_POST;
static void

View File

@@ -174,7 +174,7 @@ typedef struct nsu_requestinfo {
static void
sendrequest(isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr,
dns_message_t *msg, dns_request_t **request);
ISC_PLATFORM_NORETURN_POST static void
ISC_PLATFORM_NORETURN_PRE static void
fatal(const char *format, ...)
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;

View File

@@ -21,14 +21,24 @@ SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
status=0
echo "I:check that the stub zone has been saved to disk"
for i in 1 2 3 4 5 6 7 8 9 20
do
[ -f ns3/child.example.st ] && break
sleep 1
done
[ -f ns3/child.example.st ] || { status=1; echo "I:failed"; }
echo "I:trying an axfr that should be denied (NOTAUTH)"
for pass in 1 2
do
echo "I:trying an axfr that should be denied (NOTAUTH) (pass=$pass)"
ret=0
$DIG +tcp data.child.example. @10.53.0.3 axfr -p 5300 > dig.out.ns3 || ret=1
$DIG +tcp child.example. @10.53.0.3 axfr -p 5300 > dig.out.ns3 || ret=1
grep "; Transfer failed." dig.out.ns3 > /dev/null || ret=1
[ $ret = 0 ] || { status=1; echo "I:failed"; }
echo "I:look for stub zone data without recursion (should not be found)"
echo "I:look for stub zone data without recursion (should not be found) (pass=$pass)"
for i in 1 2 3 4 5 6 7 8 9
do
ret=0
@@ -41,11 +51,20 @@ done
$PERL ../digcomp.pl knowngood.dig.out.norec dig.out.ns3 || ret=1
[ $ret = 0 ] || { status=1; echo "I:failed"; }
echo "I:look for stub zone data with recursion (should be found)"
echo "I:look for stub zone data with recursion (should be found) (pass=$pass)"
ret=0
$DIG +tcp data.child.example. @10.53.0.3 txt -p 5300 > dig.out.ns3 || ret=1
$PERL ../digcomp.pl knowngood.dig.out.rec dig.out.ns3 || ret=1
[ $ret = 0 ] || { status=1; echo "I:failed"; }
[ $pass = 1 ] && {
echo "I:stopping stub server"
$PERL $SYSTEMTESTTOP/stop.pl . ns3
echo "I:re-starting stub server"
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns3
}
done
echo "I:exit status: $status"
exit $status

View File

@@ -19,3 +19,6 @@
rm -f dig.out
rm -f */named.memstats
rm -f */*.bk
rm -f */*.bk.*
rm -f ns3/Kexample.*

File diff suppressed because one or more lines are too long

View File

@@ -41,6 +41,10 @@ a12 IN A \# 4 0A000001
null IN NULL \# 1 00
empty IN NULL \# 0
empty IN TYPE124 \# 0
emptyplus IN TYPE125 \# 0
emptyplus IN TYPE125 \# 1 11
txt1 IN TXT "hello"
txt2 CLASS1 TXT "hello"
@@ -53,3 +57,4 @@ txt7 IN TXT \# 6 0568656C6C6F
unk1 TYPE123 \# 1 00
unk2 CLASS1 TYPE123 \# 1 00
unk3 IN TYPE123 \# 1 00
$INCLUDE large.db

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: named.conf,v 1.11 2007/06/19 23:47:06 tbox Exp $ */
controls { /* empty */ };
options {
query-source address 10.53.0.2;
notify-source 10.53.0.2;
transfer-source 10.53.0.2;
port 5300;
pid-file "named.pid";
listen-on { 10.53.0.2; };
listen-on-v6 { none; };
recursion no;
notify no;
};
view "in" {
zone "example." {
type slave;
masters { 10.53.0.1; };
file "example-in.bk";
};
};

View File

@@ -0,0 +1,17 @@
# Copyright (C) 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: setup.sh,v 1.11 2012/02/23 06:53:15 marka Exp $
sh clean.sh

View File

@@ -22,13 +22,13 @@ SYSTEMTESTTOP=..
status=0
DIGOPTS="@10.53.0.1 -p 5300"
DIGOPTS="-p 5300"
echo "I:querying for various representations of an IN A record"
for i in 1 2 3 4 5 6 7 8 9 10 11 12
do
ret=0
$DIG +short $DIGOPTS a$i.example a in > dig.out || ret=1
$DIG +short $DIGOPTS @10.53.0.1 a$i.example a in > dig.out || ret=1
echo 10.0.0.1 | diff - dig.out || ret=1
if [ $ret != 0 ]
then
@@ -41,7 +41,7 @@ echo "I:querying for various representations of an IN TXT record"
for i in 1 2 3 4 5 6 7
do
ret=0
$DIG +short $DIGOPTS txt$i.example txt in > dig.out || ret=1
$DIG +short $DIGOPTS @10.53.0.1 txt$i.example txt in > dig.out || ret=1
echo '"hello"' | diff - dig.out || ret=1
if [ $ret != 0 ]
then
@@ -54,7 +54,7 @@ echo "I:querying for various representations of an IN TYPE123 record"
for i in 1 2 3
do
ret=0
$DIG +short $DIGOPTS unk$i.example type123 in > dig.out || ret=1
$DIG +short $DIGOPTS @10.53.0.1 unk$i.example type123 in > dig.out || ret=1
echo '\# 1 00' | diff - dig.out || ret=1
if [ $ret != 0 ]
then
@@ -65,14 +65,14 @@ done
echo "I:querying for NULL record"
ret=0
$DIG +short $DIGOPTS null.example null in > dig.out || ret=1
$DIG +short $DIGOPTS @10.53.0.1 null.example null in > dig.out || ret=1
echo '\# 1 00' | diff - dig.out || ret=1
[ $ret = 0 ] || echo "I: failed"
status=`expr $status + $ret`
echo "I:querying for empty NULL record"
ret=0
$DIG +short $DIGOPTS empty.example null in > dig.out || ret=1
$DIG +short $DIGOPTS @10.53.0.1 empty.example null in > dig.out || ret=1
echo '\# 0' | diff - dig.out || ret=1
[ $ret = 0 ] || echo "I: failed"
status=`expr $status + $ret`
@@ -81,7 +81,7 @@ echo "I:querying for various representations of a CLASS10 TYPE1 record"
for i in 1 2
do
ret=0
$DIG +short $DIGOPTS a$i.example a class10 > dig.out || ret=1
$DIG +short $DIGOPTS @10.53.0.1 a$i.example a class10 > dig.out || ret=1
echo '\# 4 0A000001' | diff - dig.out || ret=1
if [ $ret != 0 ]
then
@@ -94,7 +94,7 @@ echo "I:querying for various representations of a CLASS10 TXT record"
for i in 1 2 3 4
do
ret=0
$DIG +short $DIGOPTS txt$i.example txt class10 > dig.out || ret=1
$DIG +short $DIGOPTS @10.53.0.1 txt$i.example txt class10 > dig.out || ret=1
echo '"hello"' | diff - dig.out || ret=1
if [ $ret != 0 ]
then
@@ -107,7 +107,7 @@ echo "I:querying for various representations of a CLASS10 TYPE123 record"
for i in 1 2
do
ret=0
$DIG +short $DIGOPTS unk$i.example type123 class10 > dig.out || ret=1
$DIG +short $DIGOPTS @10.53.0.1 unk$i.example type123 class10 > dig.out || ret=1
echo '\# 1 00' | diff - dig.out || ret=1
if [ $ret != 0 ]
then
@@ -120,7 +120,7 @@ echo "I:querying for SOAs of zone that should have failed to load"
for i in 1 2 3 4
do
ret=0
$DIG $DIGOPTS broken$i. soa in > dig.out || ret=1
$DIG $DIGOPTS @10.53.0.1 broken$i. soa in > dig.out || ret=1
grep "SERVFAIL" dig.out > /dev/null || ret=1
if [ $ret != 0 ]
then
@@ -129,5 +129,30 @@ do
status=`expr $status + $ret`
done
echo "I:checking large unknown record loading on master"
ret=0
$DIG $DIGOPTS @10.53.0.1 +tcp +short large.example TYPE45234 > dig.out || { ret=1 ; echo I: dig failed ; }
diff -s large.out dig.out > /dev/null || { ret=1 ; echo "I: diff failed"; }
[ $ret = 0 ] || echo "I: failed"
status=`expr $status + $ret`
echo "I:checking large unknown record loading on slave"
ret=0
$DIG $DIGOPTS @10.53.0.2 +tcp +short large.example TYPE45234 > dig.out || { ret=1 ; echo I: dig failed ; }
diff -s large.out dig.out > /dev/null || { ret=1 ; echo "I: diff failed"; }
[ $ret = 0 ] || echo "I: failed"
status=`expr $status + $ret`
echo "I:stop and restart slave"
$PERL $SYSTEMTESTTOP/stop.pl . ns2
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns2
echo "I:checking large unknown record loading on slave"
ret=0
$DIG $DIGOPTS @10.53.0.2 +tcp +short large.example TYPE45234 > dig.out || { ret=1 ; echo I: dig failed ; }
diff -s large.out dig.out > /dev/null || { ret=1 ; echo "I: diff failed"; }
[ $ret = 0 ] || echo "I: failed"
status=`expr $status + $ret`
echo "I:exit status: $status"
exit $status

View File

@@ -127,6 +127,17 @@ struct dns_rdata {
#define DNS_RDATA_UPDATE 0x0001 /*%< update pseudo record. */
#define DNS_RDATA_OFFLINE 0x0002 /*%< RRSIG has a offline key. */
/*
* The maximum length of a RDATA that can be sent on the wire.
* Max packet size (65535) less header (12), less name (1), type (2),
* class (2), ttl(4), length (2).
*
* None of the defined types that support name compression can exceed
* this and all new types are to be sent uncompressed.
*/
#define DNS_RDATA_MAXLENGTH 65512U
/*
* Flags affecting rdata formatting style. Flags 0xFFFF0000
* are used by masterfile-level formatting and defined elsewhere.

View File

@@ -75,7 +75,7 @@
/*%
* max message size - header - root - type - class - ttl - rdlen
*/
#define MINTSIZ (65535 - 12 - 1 - 2 - 2 - 4 - 2)
#define MINTSIZ DNS_RDATA_MAXLENGTH
/*%
* Size for tokens in the presentation format,
* The largest tokens are the base64 blocks in KEY and CERT records,

View File

@@ -345,8 +345,8 @@ dns_rdata_compare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2) {
REQUIRE(rdata1 != NULL);
REQUIRE(rdata2 != NULL);
REQUIRE(rdata1->data != NULL);
REQUIRE(rdata2->data != NULL);
REQUIRE(rdata1->length == 0 || rdata1->data != NULL);
REQUIRE(rdata2->length == 0 || rdata2->data != NULL);
REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1));
REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2));
@@ -414,6 +414,7 @@ dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
isc_buffer_t st;
isc_boolean_t use_default = ISC_FALSE;
isc_uint32_t activelength;
size_t length;
REQUIRE(dctx != NULL);
if (rdata != NULL) {
@@ -443,6 +444,14 @@ dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
}
}
/*
* Reject any rdata that expands out to more than DNS_RDATA_MAXLENGTH
* as we cannot transmit it.
*/
length = isc_buffer_usedlength(target) - isc_buffer_usedlength(&st);
if (result == ISC_R_SUCCESS && length > DNS_RDATA_MAXLENGTH)
result = DNS_R_FORMERR;
/*
* We should have consumed all of our buffer.
*/
@@ -451,8 +460,7 @@ dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
if (rdata != NULL && result == ISC_R_SUCCESS) {
region.base = isc_buffer_used(&st);
region.length = isc_buffer_usedlength(target) -
isc_buffer_usedlength(&st);
region.length = length;
dns_rdata_fromregion(rdata, rdclass, type, &region);
}
@@ -587,6 +595,7 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
unsigned long line;
void (*callback)(dns_rdatacallbacks_t *, const char *, ...);
isc_result_t tresult;
size_t length;
REQUIRE(origin == NULL || dns_name_isabsolute(origin) == ISC_TRUE);
if (rdata != NULL) {
@@ -658,10 +667,13 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
}
} while (1);
length = isc_buffer_usedlength(target) - isc_buffer_usedlength(&st);
if (result == ISC_R_SUCCESS && length > DNS_RDATA_MAXLENGTH)
result = ISC_R_NOSPACE;
if (rdata != NULL && result == ISC_R_SUCCESS) {
region.base = isc_buffer_used(&st);
region.length = isc_buffer_usedlength(target) -
isc_buffer_usedlength(&st);
region.length = length;
dns_rdata_fromregion(rdata, rdclass, type, &region);
}
if (result != ISC_R_SUCCESS) {
@@ -789,6 +801,7 @@ dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
isc_buffer_t st;
isc_region_t region;
isc_boolean_t use_default = ISC_FALSE;
size_t length;
REQUIRE(source != NULL);
if (rdata != NULL) {
@@ -803,10 +816,13 @@ dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
if (use_default)
(void)NULL;
length = isc_buffer_usedlength(target) - isc_buffer_usedlength(&st);
if (result == ISC_R_SUCCESS && length > DNS_RDATA_MAXLENGTH)
result = ISC_R_NOSPACE;
if (rdata != NULL && result == ISC_R_SUCCESS) {
region.base = isc_buffer_used(&st);
region.length = isc_buffer_usedlength(target) -
isc_buffer_usedlength(&st);
region.length = length;
dns_rdata_fromregion(rdata, rdclass, type, &region);
}
if (result != ISC_R_SUCCESS)

View File

@@ -126,6 +126,11 @@ isc_result_t
dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
isc_region_t *region, unsigned int reservelen)
{
/*
* Use &removed as a sentinal pointer for duplicate
* rdata as rdata.data == NULL is valid.
*/
static unsigned char removed;
struct xrdata *x;
unsigned char *rawbuf;
#if DNS_RDATASET_FIXED
@@ -165,6 +170,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
INSIST(result == ISC_R_SUCCESS);
dns_rdata_init(&x[i].rdata);
dns_rdataset_current(rdataset, &x[i].rdata);
INSIST(x[i].rdata.data != &removed);
#if DNS_RDATASET_FIXED
x[i].order = i;
#endif
@@ -197,8 +203,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
*/
for (i = 1; i < nalloc; i++) {
if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) {
x[i-1].rdata.data = NULL;
x[i-1].rdata.length = 0;
x[i-1].rdata.data = &removed;
#if DNS_RDATASET_FIXED
/*
* Preserve the least order so A, B, A -> A, B
@@ -285,7 +290,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
#endif
for (i = 0; i < nalloc; i++) {
if (x[i].rdata.data == NULL)
if (x[i].rdata.data == &removed)
continue;
#if DNS_RDATASET_FIXED
offsettable[x[i].order] = rawbuf - offsetbase;
@@ -293,6 +298,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
length = x[i].rdata.length;
if (rdataset->type == dns_rdatatype_rrsig)
length++;
INSIST(length <= 0xffff);
*rawbuf++ = (length & 0xff00) >> 8;
*rawbuf++ = (length & 0x00ff);
#if DNS_RDATASET_FIXED

View File

@@ -8124,6 +8124,7 @@ dns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name,
goto cleanup;
bad->type = type;
bad->hashval = hashval;
bad->expire = *expire;
isc_buffer_init(&buffer, bad + 1, name->length);
dns_name_init(&bad->name, NULL);
dns_name_copy(name, &bad->name, &buffer);
@@ -8135,8 +8136,8 @@ dns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name,
if (resolver->badcount < resolver->badhash * 2 &&
resolver->badhash > DNS_BADCACHE_SIZE)
resizehash(resolver, &now, ISC_FALSE);
}
bad->expire = *expire;
} else
bad->expire = *expire;
cleanup:
UNLOCK(&resolver->lock);
}

View File

@@ -76,6 +76,10 @@ nsec3_test@EXEEXT@: nsec3_test.@O@ dnstest.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
nsec3_test.@O@ dnstest.@O@ ${DNSLIBS} \
${ISCLIBS} ${LIBS}
rdata_test@EXEEXT@: rdata_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
rdata_test.@O@ ${DNSLIBS} ${ISCLIBS} ${LIBS}
unit::
sh ${top_srcdir}/unit/unittest.sh

View File

@@ -40,7 +40,7 @@
*/
#define BUFLEN 255
#define BIGBUFLEN (64 * 1024)
#define BIGBUFLEN (70 * 1024)
#define TEST_ORIGIN "test"
static isc_result_t
@@ -106,12 +106,12 @@ test_master(const char *testfile) {
*/
/* Successful load test */
ATF_TC(master_load);
ATF_TC_HEAD(master_load, tc) {
ATF_TC(load);
ATF_TC_HEAD(load, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() loads a "
"valid master file and returns success");
}
ATF_TC_BODY(master_load, tc) {
ATF_TC_BODY(load, tc) {
isc_result_t result;
UNUSED(tc);
@@ -127,13 +127,13 @@ ATF_TC_BODY(master_load, tc) {
/* Unepxected end of file test */
ATF_TC(master_unexpected);
ATF_TC_HEAD(master_unexpected, tc) {
ATF_TC(unexpected);
ATF_TC_HEAD(unexpected, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() returns "
"DNS_R_UNEXPECTED when file ends "
"too soon");
}
ATF_TC_BODY(master_unexpected, tc) {
ATF_TC_BODY(unexpected, tc) {
isc_result_t result;
UNUSED(tc);
@@ -149,13 +149,13 @@ ATF_TC_BODY(master_unexpected, tc) {
/* No owner test */
ATF_TC(master_noowner);
ATF_TC_HEAD(master_noowner, tc) {
ATF_TC(noowner);
ATF_TC_HEAD(noowner, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() accepts broken "
"zones with no TTL for first record "
"if it is an SOA");
}
ATF_TC_BODY(master_noowner, tc) {
ATF_TC_BODY(noowner, tc) {
isc_result_t result;
UNUSED(tc);
@@ -171,14 +171,14 @@ ATF_TC_BODY(master_noowner, tc) {
/* No TTL test */
ATF_TC(master_nottl);
ATF_TC_HEAD(master_nottl, tc) {
ATF_TC(nottl);
ATF_TC_HEAD(nottl, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() returns "
"DNS_R_NOOWNER when no owner name "
"is specified");
}
ATF_TC_BODY(master_nottl, tc) {
ATF_TC_BODY(nottl, tc) {
isc_result_t result;
UNUSED(tc);
@@ -194,13 +194,13 @@ ATF_TC_BODY(master_nottl, tc) {
/* Bad class test */
ATF_TC(master_badclass);
ATF_TC_HEAD(master_badclass, tc) {
ATF_TC(badclass);
ATF_TC_HEAD(badclass, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() returns "
"DNS_R_BADCLASS when record class "
"doesn't match zone class");
}
ATF_TC_BODY(master_badclass, tc) {
ATF_TC_BODY(badclass, tc) {
isc_result_t result;
UNUSED(tc);
@@ -214,13 +214,54 @@ ATF_TC_BODY(master_badclass, tc) {
dns_test_end();
}
/* Too big rdata test */
ATF_TC(toobig);
ATF_TC_HEAD(toobig, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() returns "
"ISC_R_NOSPACE when record is too big");
}
ATF_TC_BODY(toobig, tc) {
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = test_master("testdata/master/master15.data");
ATF_REQUIRE_EQ(result, ISC_R_NOSPACE);
dns_test_end();
}
/* Maximum rdata test */
ATF_TC(maxrdata);
ATF_TC_HEAD(maxrdata, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() returns "
"ISC_R_SUCCESS when record is maximum "
"size");
}
ATF_TC_BODY(maxrdata, tc) {
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = test_master("testdata/master/master16.data");
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
dns_test_end();
}
/* DNSKEY test */
ATF_TC(master_dnskey);
ATF_TC_HEAD(master_dnskey, tc) {
ATF_TC(dnskey);
ATF_TC_HEAD(dnskey, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() understands "
"DNSKEY with key material");
}
ATF_TC_BODY(master_dnskey, tc) {
ATF_TC_BODY(dnskey, tc) {
isc_result_t result;
UNUSED(tc);
@@ -236,12 +277,12 @@ ATF_TC_BODY(master_dnskey, tc) {
/* DNSKEY with no key material test */
ATF_TC(master_dnsnokey);
ATF_TC_HEAD(master_dnsnokey, tc) {
ATF_TC(dnsnokey);
ATF_TC_HEAD(dnsnokey, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() understands "
"DNSKEY with no key material");
}
ATF_TC_BODY(master_dnsnokey, tc) {
ATF_TC_BODY(dnsnokey, tc) {
isc_result_t result;
UNUSED(tc);
@@ -256,12 +297,12 @@ ATF_TC_BODY(master_dnsnokey, tc) {
}
/* Include test */
ATF_TC(master_include);
ATF_TC_HEAD(master_include, tc) {
ATF_TC(include);
ATF_TC_HEAD(include, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() understands "
"$INCLUDE");
}
ATF_TC_BODY(master_include, tc) {
ATF_TC_BODY(include, tc) {
isc_result_t result;
UNUSED(tc);
@@ -276,12 +317,12 @@ ATF_TC_BODY(master_include, tc) {
}
/* Include failure test */
ATF_TC(master_includefail);
ATF_TC_HEAD(master_includefail, tc) {
ATF_TC(includefail);
ATF_TC_HEAD(includefail, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() understands "
"$INCLUDE failures");
}
ATF_TC_BODY(master_includefail, tc) {
ATF_TC_BODY(includefail, tc) {
isc_result_t result;
UNUSED(tc);
@@ -297,12 +338,12 @@ ATF_TC_BODY(master_includefail, tc) {
/* Non-empty blank lines test */
ATF_TC(master_blanklines);
ATF_TC_HEAD(master_blanklines, tc) {
ATF_TC(blanklines);
ATF_TC_HEAD(blanklines, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() handles "
"non-empty blank lines");
}
ATF_TC_BODY(master_blanklines, tc) {
ATF_TC_BODY(blanklines, tc) {
isc_result_t result;
UNUSED(tc);
@@ -317,12 +358,12 @@ ATF_TC_BODY(master_blanklines, tc) {
}
/* SOA leading zeroes test */
ATF_TC(master_leadingzero);
ATF_TC_HEAD(master_leadingzero, tc) {
ATF_TC(leadingzero);
ATF_TC_HEAD(leadingzero, tc) {
atf_tc_set_md_var(tc, "descr", "dns_master_loadfile() allows "
"leading zeroes in SOA");
}
ATF_TC_BODY(master_leadingzero, tc) {
ATF_TC_BODY(leadingzero, tc) {
isc_result_t result;
UNUSED(tc);
@@ -336,11 +377,11 @@ ATF_TC_BODY(master_leadingzero, tc) {
dns_test_end();
}
ATF_TC(master_totext);
ATF_TC_HEAD(master_totext, tc) {
ATF_TC(totext);
ATF_TC_HEAD(totext, tc) {
atf_tc_set_md_var(tc, "descr", "masterfile totext tests");
}
ATF_TC_BODY(master_totext, tc) {
ATF_TC_BODY(totext, tc) {
isc_result_t result;
dns_rdataset_t rdataset;
dns_rdatalist_t rdatalist;
@@ -384,18 +425,20 @@ ATF_TC_BODY(master_totext, tc) {
* Main
*/
ATF_TP_ADD_TCS(tp) {
ATF_TP_ADD_TC(tp, master_load);
ATF_TP_ADD_TC(tp, master_unexpected);
ATF_TP_ADD_TC(tp, master_noowner);
ATF_TP_ADD_TC(tp, master_nottl);
ATF_TP_ADD_TC(tp, master_badclass);
ATF_TP_ADD_TC(tp, master_dnskey);
ATF_TP_ADD_TC(tp, master_dnsnokey);
ATF_TP_ADD_TC(tp, master_include);
ATF_TP_ADD_TC(tp, master_includefail);
ATF_TP_ADD_TC(tp, master_blanklines);
ATF_TP_ADD_TC(tp, master_leadingzero);
ATF_TP_ADD_TC(tp, master_totext);
ATF_TP_ADD_TC(tp, load);
ATF_TP_ADD_TC(tp, unexpected);
ATF_TP_ADD_TC(tp, noowner);
ATF_TP_ADD_TC(tp, nottl);
ATF_TP_ADD_TC(tp, badclass);
ATF_TP_ADD_TC(tp, dnskey);
ATF_TP_ADD_TC(tp, dnsnokey);
ATF_TP_ADD_TC(tp, include);
ATF_TP_ADD_TC(tp, includefail);
ATF_TP_ADD_TC(tp, blanklines);
ATF_TP_ADD_TC(tp, leadingzero);
ATF_TP_ADD_TC(tp, totext);
ATF_TP_ADD_TC(tp, toobig);
ATF_TP_ADD_TC(tp, maxrdata);
return (atf_no_error());
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -6054,6 +6054,7 @@ zone_maintenance(dns_zone_t *zone) {
switch (zone->type) {
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
LOCK_ZONE(zone);
if (zone->masterfile != NULL &&
isc_time_compare(&now, &zone->dumptime) >= 0 &&
@@ -6395,7 +6396,7 @@ zone_dump(dns_zone_t *zone, isc_boolean_t compact) {
goto fail;
}
if (compact) {
if (compact && zone->type != dns_zone_stub) {
dns_zone_t *dummy = NULL;
LOCK_ZONE(zone);
zone_iattach(zone, &dummy);
@@ -7251,7 +7252,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
dns_zone_t *zone = NULL;
char master[ISC_SOCKADDR_FORMATSIZE];
char source[ISC_SOCKADDR_FORMATSIZE];
isc_uint32_t nscnt, cnamecnt;
isc_uint32_t nscnt, cnamecnt, refresh, retry, expire;
isc_result_t result;
isc_time_t now;
isc_boolean_t exiting = ISC_FALSE;
@@ -7399,19 +7400,32 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_write);
if (zone->db == NULL)
zone_attachdb(zone, stub->db);
result = zone_get_from_db(zone, zone->db, NULL, NULL, NULL, &refresh,
&retry, &expire, NULL, NULL);
if (result == ISC_R_SUCCESS) {
zone->refresh = RANGE(refresh, zone->minrefresh,
zone->maxrefresh);
zone->retry = RANGE(retry, zone->minretry, zone->maxretry);
zone->expire = RANGE(expire, zone->refresh + zone->retry,
DNS_MAX_EXPIRE);
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_HAVETIMERS);
}
ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_write);
dns_db_detach(&stub->db);
if (zone->masterfile != NULL)
zone_needdump(zone, 0);
dns_message_destroy(&msg);
isc_event_free(&event);
dns_request_destroy(&zone->request);
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH);
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED);
DNS_ZONE_JITTER_ADD(&now, zone->refresh, &zone->refreshtime);
isc_interval_set(&i, zone->expire, 0);
DNS_ZONE_TIME_ADD(&now, zone->expire, &zone->expiretime);
if (zone->masterfile != NULL)
zone_needdump(zone, 0);
zone_settimer(zone, &now);
goto free_stub;

View File

@@ -103,7 +103,7 @@ isc_uint32_t
isc_random_jitter(isc_uint32_t max, isc_uint32_t jitter) {
isc_uint32_t rnd;
REQUIRE(jitter < max);
REQUIRE(jitter < max || (jitter == 0 && max == 0));
if (jitter == 0)
return (max);

View File

@@ -7,4 +7,4 @@ MAJORVER=9
MINORVER=6
PATCHVER=
RELEASETYPE=-ESV
RELEASEVER=-R7
RELEASEVER=-R7-P3