Skip to content

Commit

Permalink
Backport PowerDNS#5641
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlexis committed Nov 13, 2017
2 parents bf3df5e + 786aacb commit 5376c06
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions pdns/zoneparser-tng.cc
Expand Up @@ -421,8 +421,13 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
case QType::MX:
stringtok(recparts, rr.content);
if(recparts.size()==2) {
if (recparts[1]!=".")
recparts[1] = toCanonic(d_zonename, recparts[1]).toStringRootDot();
if (recparts[1]!=".") {
try {
recparts[1] = toCanonic(d_zonename, recparts[1]).toStringRootDot();
} catch (std::exception &e) {
throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
}
}
rr.content=recparts[0]+" "+recparts[1];
}
break;
Expand All @@ -439,8 +444,13 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
case QType::SRV:
stringtok(recparts, rr.content);
if(recparts.size()==4) {
if(recparts[3]!=".")
recparts[3] = toCanonic(d_zonename, recparts[3]).toStringRootDot();
if(recparts[3]!=".") {
try {
recparts[3] = toCanonic(d_zonename, recparts[3]).toStringRootDot();
} catch (std::exception &e) {
throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
}
}
rr.content=recparts[0]+" "+recparts[1]+" "+recparts[2]+" "+recparts[3];
}
break;
Expand All @@ -451,7 +461,11 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
case QType::DNAME:
case QType::PTR:
case QType::AFSDB:
rr.content=toCanonic(d_zonename, rr.content).toStringRootDot();
try {
rr.content = toCanonic(d_zonename, rr.content).toStringRootDot();
} catch (std::exception &e) {
throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
}
break;

case QType::SOA:
Expand All @@ -462,8 +476,8 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
try {
recparts[0]=toCanonic(d_zonename, recparts[0]).toStringRootDot();
recparts[1]=toCanonic(d_zonename, recparts[1]).toStringRootDot();
} catch (runtime_error &re) {
throw PDNSException(re.what());
} catch (std::exception &e) {
throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
}
}
rr.content.clear();
Expand Down

0 comments on commit 5376c06

Please sign in to comment.