]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3696. [bug] dig failed to handle AXFR style IXFR responses which
authorMark Andrews <marka@isc.org>
Sun, 5 Jan 2014 19:22:30 +0000 (06:22 +1100)
committerMark Andrews <marka@isc.org>
Sun, 5 Jan 2014 19:24:02 +0000 (06:24 +1100)
                        span multiple messages. [RT #35137]

(cherry picked from commit e9649ece3bf32ff43faea13c76bbba7813d7e139)

CHANGES
bin/dig/dighost.c
bin/dig/include/dig/dig.h
bin/tests/system/ixfr/clean.sh
bin/tests/system/ixfr/ns3/named.conf
bin/tests/system/ixfr/setup.sh
bin/tests/system/ixfr/tests.sh

diff --git a/CHANGES b/CHANGES
index 664d453c826cf30869799731556e5afcfc1a28bb..b97eda96f178d58aeab96e55ab37654c1fbd9b10 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3696.  [bug]           dig failed to handle AXFR style IXFR responses which
+                       span multiple messages. [RT #35137]
+
 3695.  [bug]           Address a possible race in dispatch.c. [RT #35107]
 
 3694.  [bug]           Warn when a key-directory is configured for a zone,
index b7d231fdc230869b45a2746ba9b51d3a30998ef6..a9fdb2c90bdf9fd274cd535a571a788b86820329 100644 (file)
@@ -2330,6 +2330,7 @@ setup_lookup(dig_lookup_t *lookup) {
                query->rr_count = 0;
                query->msg_count = 0;
                query->byte_count = 0;
+               query->ixfr_axfr = ISC_FALSE;
                ISC_LIST_INIT(query->recvlist);
                ISC_LIST_INIT(query->lengthlist);
                query->sock = NULL;
@@ -2982,6 +2983,9 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
        isc_boolean_t ixfr = query->lookup->rdtype == dns_rdatatype_ixfr;
        isc_boolean_t axfr = query->lookup->rdtype == dns_rdatatype_axfr;
 
+       if (ixfr)
+               axfr = query->ixfr_axfr;
+
        debug("check_for_more_data()");
 
        /*
@@ -3030,7 +3034,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
                                        query->second_rr_rcvd = ISC_TRUE;
                                        query->second_rr_serial = 0;
                                        debug("got the second rr as nonsoa");
-                                       axfr = ISC_TRUE;
+                                       axfr = query->ixfr_axfr = ISC_TRUE;
                                        goto next_rdata;
                                }
 
index 0046639146e1bd56403bd5e6c912801675d212d4..bab18828bdd084dc949e99f0cecf71e1a7c5f71a 100644 (file)
@@ -202,6 +202,7 @@ struct dig_query {
        isc_uint32_t second_rr_serial;
        isc_uint32_t msg_count;
        isc_uint32_t rr_count;
+       isc_boolean_t ixfr_axfr;
        char *servname;
        char *userarg;
        isc_bufferlist_t sendlist,
index a4457453dece01c90dfbd6481ea85be244b0084f..9bdfb328c446c63c7d60a4c51cd12241ef4487dd 100644 (file)
@@ -22,3 +22,4 @@ rm -f ns3/*.jnl ns3/mytest.db ns3/subtest.db
 rm -f ns4/*.jnl ns4/*.db
 rm -f */named.memstats
 rm -f dig.out
+rm -f ns3/large.db
index c01ce546deb1fc3a40c7d53152b773bf2f3e2b47..acc9d14fe9946b1384802485bbd17a8d5a214e90 100644 (file)
@@ -46,8 +46,12 @@ view "primary" {
                 file "mytest.db";
         };
        zone "sub.test" IN {
-                type master;
-                file "subtest.db";
-                request-ixfr no;
-        };
+               type master;
+               file "subtest.db";
+               request-ixfr no;
+       };
+       zone "large" IN {
+               type master;
+               file "large.db";
+       };
 };
index 7e68ebccba49c5e42dc2b30d1be74e8319705e97..ff484d443f07c797505a964b73257fec319139c8 100644 (file)
@@ -45,3 +45,5 @@ EOF
 # Setup initial db files for ns3
 cp ns3/mytest0.db ns3/mytest.db
 cp ns3/subtest0.db ns3/subtest.db
+sh ../genzone.sh 3 > ns3/large.db
+awk 'END { for (i = 0; i < 10000; i++) printf("record%d 10 IN TXT this is record %d\n", i, i) }' < /dev/null >> ns3/large.db
index 4bccd763f7b1312420ecf22cc1437bfcde063e67..25bb6a03624e6a97772b32d927bee08186024012 100644 (file)
@@ -237,6 +237,17 @@ else
     echo "I:  success: IXFR it was"
 fi
 
+echo "I:testing DiG's handling of a multi message AXFR style IXFR response" 
+(
+(sleep 10 && kill $$) 2>/dev/null &
+sub=$!
+$DIG ixfr=0 large -p 5300 @10.53.0.3 > dig.out
+kill $sub
+)
+lines=`grep hostmaster.large dig.out | wc -l`
+test ${lines:-0} -eq 2 || { echo "I:failed"; status=1; }
+messages=`sed -n 's/^;;.*messages \([0-9]*\),.*/\1/p' dig.out`
+test ${messages:-0} -gt 1 || { echo "I:failed"; status=1; }
 
 echo "I:exit status: $status"
 exit $status