[svn] commit: r1164 - in /trunk/src/lib/dns: rdata/generic/nsec3_50.cc rdata/generic/nsec_47.cc tests/rdata_nsec3_unittest.cc tests/rdata_nsec_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Sun Mar 7 01:04:38 UTC 2010


Author: each
Date: Sun Mar  7 01:04:38 2010
New Revision: 1164

Log:
- nsec3 now allows an empty list of rrtypes; the unit test needed to
  be informed of this
- both nsec and nsec3 now throw InvalidRdataText when encountering an
  unknown rrtype, rather than InvalidRRType (which was somewhat misleading)

Modified:
    trunk/src/lib/dns/rdata/generic/nsec3_50.cc
    trunk/src/lib/dns/rdata/generic/nsec_47.cc
    trunk/src/lib/dns/tests/rdata_nsec3_unittest.cc
    trunk/src/lib/dns/tests/rdata_nsec_unittest.cc

Modified: trunk/src/lib/dns/rdata/generic/nsec3_50.cc
==============================================================================
--- trunk/src/lib/dns/rdata/generic/nsec3_50.cc (original)
+++ trunk/src/lib/dns/rdata/generic/nsec3_50.cc Sun Mar  7 01:04:38 2010
@@ -96,15 +96,14 @@
         string type;
         int code;
         iss >> type;
-
-        if (iss.eof() || type.length() == 0) {
-            break;
+        if (type.length() != 0) {
+            try {
+                code = RRType(type).getCode();
+                bitmap[code / 8] |= (0x80 >> (code % 8));
+            } catch (...) {
+                dns_throw(InvalidRdataText, "Invalid RRtype in NSEC3");
+            }
         }
-
-        try {
-            code = RRType(type).getCode();
-            bitmap[code / 8] |= (0x80 >> (code % 8));
-        } catch (...) {}
     } while(!iss.eof());
 
     for (int window = 0; window < 256; window++) {

Modified: trunk/src/lib/dns/rdata/generic/nsec_47.cc
==============================================================================
--- trunk/src/lib/dns/rdata/generic/nsec_47.cc (original)
+++ trunk/src/lib/dns/rdata/generic/nsec_47.cc Sun Mar  7 01:04:38 2010
@@ -64,8 +64,12 @@
         string type;
         int code;
         iss >> type;
-        code = RRType(type).getCode();
-        bitmap[code / 8] |= (0x80 >> (code % 8));
+        try {
+            code = RRType(type).getCode();
+            bitmap[code / 8] |= (0x80 >> (code % 8));
+        } catch (...) {
+            dns_throw(InvalidRdataText, "Invalid RRtype in NSEC");
+        }
     } while(!iss.eof());
 
     for (int window = 0; window < 256; window++) {

Modified: trunk/src/lib/dns/tests/rdata_nsec3_unittest.cc
==============================================================================
--- trunk/src/lib/dns/tests/rdata_nsec3_unittest.cc (original)
+++ trunk/src/lib/dns/tests/rdata_nsec3_unittest.cc Sun Mar  7 01:04:38 2010
@@ -54,10 +54,7 @@
     EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1 ADDAFEE "
                                             "0123456789ABCDEFGHIJKLMNOPQRSTUV "
                                             "BIFF POW SPOON"),
-                 InvalidRRType);
-    EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1 ADDAFEE "
-                                            "0123456789ABCDEFGHIJKLMNOPQRSTUV"),
-                 InvalidRRType);
+                 InvalidRdataText);
     EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1 ADDAFEE "
                                             "WXYZWXYZWXYZ=WXYZWXYZ==WXYZWXYZW "
                                             "A NS SOA"),

Modified: trunk/src/lib/dns/tests/rdata_nsec_unittest.cc
==============================================================================
--- trunk/src/lib/dns/tests/rdata_nsec_unittest.cc (original)
+++ trunk/src/lib/dns/tests/rdata_nsec_unittest.cc Sun Mar  7 01:04:38 2010
@@ -49,9 +49,9 @@
 TEST_F(Rdata_NSEC_Test, badText_NSEC)
 {
     EXPECT_THROW(generic::NSEC rdata_nsec("www.isc.org. BIFF POW SPOON"),
-                 InvalidRRType);
+                 InvalidRdataText);
     EXPECT_THROW(generic::NSEC rdata_nsec("www.isc.org."),
-                 InvalidRRType);
+                 InvalidRdataText);
 }
 
 TEST_F(Rdata_NSEC_Test, createFromWire_NSEC)




More information about the bind10-changes mailing list