]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Record types which support a empty rdata field were not handling the empty rdata...
authorMark Andrews <marka@isc.org>
Fri, 26 Oct 2018 22:58:23 +0000 (09:58 +1100)
committerMark Andrews <marka@isc.org>
Tue, 30 Oct 2018 00:03:02 +0000 (11:03 +1100)
CHANGES
bin/tests/system/digcomp.pl
bin/tests/system/genzone.sh
bin/tests/system/xfer/dig1.good
bin/tests/system/xfer/dig2.good
lib/dns/rdata.c
lib/dns/tests/dnstest.c
lib/dns/tests/rdata_test.c

diff --git a/CHANGES b/CHANGES
index 02e42282a4635dd685b5add80468d2ec98a4dc39..e53a0bedf4d95090e55a75a250f4acad73f4fb46 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+5070.  [bug]           Record types which support a empty rdata field were
+                       not handling the empty rdata field case. [GL #638]
+
 5069.  [bug]           Fix a hang on in RPZ when named is shutdown during RPZ
                        zone update. [GL !907]
 
index 5c2e85c08163e57fef2ccda188ed23b6df5b6bf8..fa0381606cef0bbd41d7e2255e9b9b1882a760cb 100644 (file)
@@ -57,6 +57,28 @@ while (<FILE1>) {
                } else {
                        $entry{"$name ; $class.$type ; $value"} = $_;
                }
+       } elsif (/^(\S+)\s+\S+\s+(\S+)\s+(\S+)\s*$/) {
+               $name = $1;
+               $class = $2;
+               $type = $3;
+               $value = "";
+               if ($lc) {
+                       $name = lc($name);
+                       $value = lc($value);
+               }
+               if ($type eq "SOA") {
+                       $firstname = $name if ($firstname eq "");
+                       if ($name eq $firstname) {
+                               $name = "$name$count";
+                               $count++;
+                       }
+               }
+               if ($entry{"$name ; $class.$type ; $value"} ne "") {
+                       $line = $entry{"$name ; $class.$type ; $value"};
+                       print("Duplicate entry in $file1:\n> $_\n< $line\n");
+               } else {
+                       $entry{"$name ; $class.$type ; $value"} = $_;
+               }
        }
 }
 close(FILE1);
@@ -93,6 +115,28 @@ while (<FILE2>) {
                        $printed++;
                        $status = 1;
                }
+       } elsif (/^(\S+)\s+\S+\s+(\S+)\s+(\S+)\s*$/) {
+               $name = $1;
+               $class = $2;
+               $type = $3;
+               $value = "";
+               if ($lc) {
+                       $name = lc($name);
+                       $value = lc($value);
+               }
+               if (($name eq $firstname) && ($type eq "SOA")) {
+                       $count--;
+                       $name = "$name$count";
+               }
+               if ($entry{"$name ; $class.$type ; $value"} ne "") {
+                       $entry{"$name ; $class.$type ; $value"} = "";
+               } else {
+                       print("Only in $file2 (missing from $file1):\n")
+                           if ($printed == 0);
+                       print("> $_\n");
+                       $printed++;
+                       $status = 1;
+               }
        }
 }
 close(FILE2);
index 062778063e3621c831782e9c638e5fb889f5b7e6..d160a4ece3435048b623ec1adfc440a3d613257a 100644 (file)
@@ -236,6 +236,7 @@ sink02                      SINK    8 0 2 l4ik
 
 ; type 42
 apl01                  APL     !1:10.0.0.1/32 1:10.0.0.0/24
+apl02                  APL
 
 ; type 43
 ds01                   DS      12892 5 2 26584835CA80C81C91999F31CFAF2A0E89D4FF1C8FAFD0DDB31A85C7 19277C13
index 26d2ca25c9e3bfce4abfab208cc7ecd0e00ff20e..7a5dd725ebd005f52c53566585263e5998e2143a 100644 (file)
@@ -12,6 +12,7 @@ aaaa02.example.               3600    IN      AAAA    fd92:7065:b8e:ffff::5
 afsdb01.example.       3600    IN      AFSDB   0 hostname.example.
 afsdb02.example.       3600    IN      AFSDB   65535 .
 apl01.example.         3600    IN      APL     !1:10.0.0.1/32 1:10.0.0.0/24
+apl02.example.         3600    IN      APL
 atma01.example.                3600    IN      ATMA    +61200000000
 atma02.example.                3600    IN      ATMA    +61200000000
 atma03.example.                3600    IN      ATMA    1234567890abcdef
index 759267d7d7c127628b03d273f452e7e88b8d3734..df017d866e73570b8a9837ce5846f22ce2395eb9 100644 (file)
@@ -12,6 +12,7 @@ aaaa02.example.               3600    IN      AAAA    fd92:7065:b8e:ffff::5
 afsdb01.example.       3600    IN      AFSDB   0 hostname.example.
 afsdb02.example.       3600    IN      AFSDB   65535 .
 apl01.example.         3600    IN      APL     !1:10.0.0.1/32 1:10.0.0.1/24
+apl02.example.         3600    IN      APL
 atma01.example.                3600    IN      ATMA    +61200000000
 atma02.example.                3600    IN      ATMA    +61200000000
 atma03.example.                3600    IN      ATMA    1234567890abcdef
index c3175553d463335d4d45978badc8ca6a09b6481a..ea5000fab299add5bb55eef55a66d2184fd308f1 100644 (file)
@@ -933,7 +933,7 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
                callback = default_fromtext_callback;
 
        result = isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring,
-                                       false);
+                                       true);
        if (result != ISC_R_SUCCESS) {
                name = isc_lex_getsourcename(lexer);
                line = isc_lex_getsourceline(lexer);
index 3761abc7f06bfc44262c62cccae3d2ee43ccc417..4b0923c5fcddf8c981b2a49959f20d2ebadce2cf 100644 (file)
@@ -482,7 +482,7 @@ dns_test_rdatafromstring(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
         * Parse input string, determining result.
         */
        result = dns_rdata_fromtext(rdata, rdclass, rdtype, lex, dns_rootname,
-                                   0, NULL, &target, NULL);
+                                   0, mctx, &target, NULL);
 
  destroy_lexer:
        isc_lex_destroy(&lex);
index 19ac114f28ab3959985444b983dc4f08099a2d22..826bcd327ab7ff21ba498083210e6b8b433ab326 100644 (file)
@@ -346,6 +346,64 @@ check_rdata(const text_ok_t *text_ok, const wire_ok_t *wire_ok,
  ***** Individual unit tests
  *****/
 
+ATF_TC(apl);
+ATF_TC_HEAD(apl, tc) {
+       atf_tc_set_md_var(tc, "descr", "APL RDATA manipulations");
+}
+ATF_TC_BODY(apl, tc) {
+       text_ok_t text_ok[] = {
+               /* empty list */
+               TEXT_VALID(""),
+               /* min,max prefix IPv4 */
+               TEXT_VALID("1:0.0.0.0/0"),
+               TEXT_VALID("1:127.0.0.1/32"),
+               /* min,max prefix IPv6 */
+               TEXT_VALID("2:::/0"),
+               TEXT_VALID("2:::1/128"),
+               /* negated */
+               TEXT_VALID("!1:0.0.0.0/0"),
+               TEXT_VALID("!1:127.0.0.1/32"),
+               TEXT_VALID("!2:::/0"),
+               TEXT_VALID("!2:::1/128"),
+               /* bits set after prefix length - not disallowed */
+               TEXT_VALID("1:127.0.0.0/0"),
+               TEXT_VALID("2:8000::/0"),
+               /* multiple */
+               TEXT_VALID("1:0.0.0.0/0 1:127.0.0.1/32"),
+               TEXT_VALID("1:0.0.0.0/0 !1:127.0.0.1/32"),
+               /* family 0, prefix 0, positive */
+               TEXT_VALID("\\# 4 00000000"),
+               /* family 0, prefix 0, negative */
+               TEXT_VALID("\\# 4 00000080"),
+               /* prefix too long */
+               TEXT_INVALID("1:0.0.0.0/33"),
+               TEXT_INVALID("2:::/129"),
+               /*
+                * Sentinel.
+                */
+               TEXT_SENTINEL()
+       };
+       wire_ok_t wire_ok[] = {
+               /* zero length */
+               WIRE_VALID(),
+               /* prefix too big IPv4 */
+               WIRE_INVALID(0x00, 0x01, 33U, 0x00),
+               /* prefix too big IPv6 */
+               WIRE_INVALID(0x00, 0x02, 129U, 0x00),
+               /* trailing zero octet in afdpart */
+               WIRE_INVALID(0x00, 0x00, 0x00, 0x01, 0x00),
+               /*
+                * Sentinel.
+                */
+               WIRE_SENTINEL()
+       };
+
+       UNUSED(tc);
+
+       check_rdata(text_ok, wire_ok, true, dns_rdataclass_in,
+                   dns_rdatatype_apl, sizeof(dns_rdata_in_apl_t));
+}
+
 ATF_TC(atma);
 ATF_TC_HEAD(atma, tc) {
        atf_tc_set_md_var(tc, "descr", "ATMA RDATA manipulations");
@@ -1372,6 +1430,7 @@ ATF_TC_BODY(wks, tc) {
  *****/
 
 ATF_TP_ADD_TCS(tp) {
+       ATF_TP_ADD_TC(tp, apl);
        ATF_TP_ADD_TC(tp, atma);
        ATF_TP_ADD_TC(tp, csync);
        ATF_TP_ADD_TC(tp, doa);