]> granicus.if.org Git - pdns/commitdiff
fix non canonical names in zoneparser
authorKees Monshouwer <mind04@monshouwer.org>
Fri, 5 Jun 2015 08:50:32 +0000 (10:50 +0200)
committermind04 <mind04@monshouwer.org>
Tue, 30 Jun 2015 06:12:46 +0000 (08:12 +0200)
pdns/test-zoneparser_tng_cc.cc
pdns/zoneparser-tng.cc

index 021ec7c14b26e5ec9a35b915d4711304c283fde8..34de26b2d8a8c5daddd872e9d36c8b64a548d5d4 100644 (file)
@@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_types) {
     std::getline(ifs, type, ' ');
     std::getline(ifs, data, '\n');
     // see if these agree
-    BOOST_CHECK_EQUAL(rr.qname, host);
+    BOOST_CHECK_EQUAL(rr.qname.toString(), host);
     BOOST_CHECK_EQUAL(rr.ttl, ttl);
     BOOST_CHECK_EQUAL(rr.qtype.getName(), type);
     if (*(rr.content.rbegin()) != '.' && *(data.rbegin()) == '.') 
index 3f9dedfd4a375569f3e34e3293a80f1bbef5a660..3952d5fb956e9a3e120baa5cff391abafee67720 100644 (file)
@@ -298,17 +298,18 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
     goto retry;
   }
 
-  if(isspace(d_line[0])) 
+  string qname = makeString(d_line, parts[0]); // Don't use DNSName here!
+  if(isspace(d_line[0]))
     rr.qname=d_prevqname;
   else {
-    rr.qname=makeString(d_line, parts[0]); 
+    rr.qname=qname;
     parts.pop_front();
     if(!rr.qname.countLabels() || rr.qname.toString()[0]==';')
       goto retry;
   }
-  if(rr.qname=="@")
+  if(qname=="@")
     rr.qname=d_zonename;
-  else
+  else if(!isCanonical(qname))
     rr.qname += d_zonename;
   d_prevqname=rr.qname;