From: Bert Hubert Date: Tue, 15 Jul 2008 21:51:16 +0000 (+0000) Subject: fix two more Shawn bugs: don't trip up over a line consisting of nothing but comments... X-Git-Tag: rec-3.2~288 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d2c97aa1715368f700a4ec389230b1eff7b0195;p=thirdparty%2Fpdns.git fix two more Shawn bugs: don't trip up over a line consisting of nothing but comments and leading whitespace, plus deal with "$ORIGIN ." correctly git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1234 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/misc.hh b/pdns/misc.hh index 7e325e1cf6..9f49c0b0a3 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -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; } diff --git a/pdns/zoneparser-tng.cc b/pdns/zoneparser-tng.cc index 1d2cbfb50e..49a1775954 100644 --- a/pdns/zoneparser-tng.cc +++ b/pdns/zoneparser-tng.cc @@ -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(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);