]> granicus.if.org Git - pdns/commitdiff
fix two more Shawn bugs: don't trip up over a line consisting of nothing but comments...
authorBert Hubert <bert.hubert@netherlabs.nl>
Tue, 15 Jul 2008 21:51:16 +0000 (21:51 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Tue, 15 Jul 2008 21:51:16 +0000 (21:51 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1234 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/misc.hh
pdns/zoneparser-tng.cc

index 7e325e1cf637e625601bcba5ccc9ce55e1cee7eb..9f49c0b0a317401e188e876434bea58899035734 100644 (file)
@@ -384,7 +384,8 @@ inline string toCanonic(const string& zone, const string& domain)
     return domain;
   string ret=domain;
   ret.append(1,'.');
-  ret.append(zone);
+  if(!zone.empty() && zone[0]!='.')
+    ret.append(zone);
   return ret;
 }
 
index 1d2cbfb50e077d71214de82998260dbfdf7b1a87..49a1775954aa6e76bd000c01292e0d11c01ea4a5 100644 (file)
@@ -1,6 +1,6 @@
 /*
     PowerDNS Versatile Database Driven Nameserver
-    Copyright (C) 2005 - 2007  PowerDNS.COM BV
+    Copyright (C) 2005 - 2008  PowerDNS.COM BV
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 
@@ -234,6 +234,9 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr)
   if(parts.empty())
     goto retry;
 
+  if(parts[0].first != parts[0].second && makeString(d_line, parts[0])[0]==';') // line consisting of nothing but comments
+    goto retry;
+
   if(d_line[0]=='$') { 
     string command=makeString(d_line, parts[0]);
     if(iequals(command,"$TTL") && parts.size() > 1)
@@ -330,7 +333,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr)
     }
   }
   if(!haveQTYPE) 
-    throw exception("Malformed line '"+d_line+"'");
+    throw exception("Malformed line "+lexical_cast<string>(d_filestates.top().d_lineno)+" of '"+d_filestates.top().d_filename+"': "+d_line+"'");
 
   rr.content=d_line.substr(range.first);
 
@@ -343,7 +346,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr)
   if(findAndElide(rr.content, '(')) {      // have found a ( and elided it
     if(!findAndElide(rr.content, ')')) {
       while(getLine()) {
-       chomp(d_line,"\r\n ");
+       chomp(d_line,"\t\r\n ");
        chopComment(d_line);
        trim(d_line);