]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Handle AFSDB record separately due to record structure.
authorJohan Jatko <armedguy@ludd.ltu.se>
Tue, 5 Sep 2017 15:59:55 +0000 (17:59 +0200)
committerJohan Jatko <armedguy@ludd.ltu.se>
Tue, 5 Sep 2017 15:59:55 +0000 (17:59 +0200)
Closes #4703.

AFSDB records has two elements, <subtype> <hostname>,
as per RFC1183, and needs special treatment when parsing.

pdns/zoneparser-tng.cc

index 9906ef40fc14536322d1b3aa8956f9589fd8fa92..7b3670df2fd8a951e2a362137aaf7c252f3abf76 100644 (file)
@@ -461,14 +461,32 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
   case QType::CNAME:
   case QType::DNAME:
   case QType::PTR:
-  case QType::AFSDB:
     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::AFSDB:
+    try {
+      stringtok(recparts, rr.content);
+      if(recparts.size() == 2)
+      {
+        recparts[1]=toCanonic(d_zonename, recparts[1]).toStringRootDot();
+      } else {
+        throw PDNSException("AFSDB record for "+rr.qname.toString()+" invalid");
+      }
+      rr.content.clear();
+      for(string::size_type n = 0; n < recparts.size(); ++n) {
+        if(n)
+          rr.content.append(1,' ');
 
+        rr.content+=recparts[n];
+      }
+    } catch (std::exception &e) {
+      throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
+    }
+    break;
   case QType::SOA:
     stringtok(recparts, rr.content);
     if(recparts.size() > 7)