]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: support catalog version "1" as consumer
authorKees Monshouwer <mind04@monshouwer.org>
Thu, 14 Jul 2022 19:22:07 +0000 (21:22 +0200)
committermind04 <mind04@monshouwer.org>
Fri, 15 Jul 2022 14:40:00 +0000 (16:40 +0200)
docs/catalog.rst
pdns/slavecommunicator.cc

index 4703d8ff50c485f06e1d9dbdb5e3dbadb3355dbd..36677ef9c082749267794e6a3dcb390647acdf7e 100644 (file)
@@ -1,7 +1,20 @@
 Catalog Zone (RFC  TBD)
 =======================
 
-Starting with the PowerDNS Authoritative Server 4.7.0, catalog zone support is available. The current supported catalog version is "2". All all the important features of catalog zones are supported. There are however a few properties where support is limited:
+Starting with the PowerDNS Authoritative Server 4.7.0, catalog zone support is available.
+
+Supported catalog versions
+--------------------------
+
++-----------------+----------+----------+
+| Catalog version | Producer | Consumer |
++=================+==========+==========+
+| 1 (ICS)         | No       | Yes      |
++-----------------+----------+----------+
+| 2 (RFC TBD)     | Yes      | Yes      |
++-----------------+----------+----------+
+
+All all the important features of catalog zone version "2" are supported. There are however a few properties where support is limited:
 
 -  There is no support for group templates on consumers;
 -  There is no support for custom extensions;
index 83ecc21856be872436cb01fb22c24731461f4ba1..7c8d76af8e77fafe595d8813bbc4cfbd4de5cf1b 100644 (file)
@@ -292,8 +292,8 @@ static bool catalogProcess(const DomainInfo& di, vector<DNSResourceRecord>& rrs,
 
   // From XFR
   bool hasSOA{false};
-  bool hasVersion{false};
   bool zoneInvalid{false};
+  int hasVersion{0};
 
   CatalogInfo ci;
 
@@ -313,9 +313,16 @@ static bool catalogProcess(const DomainInfo& di, vector<DNSResourceRecord>& rrs,
     }
 
     else if (rr.qname == DNSName("version") + di.zone && rr.qtype == QType::TXT) {
-      if (rr.content == "\"2\"") {
-        hasVersion = true;
-        continue;
+      if (hasVersion) {
+        g_log << Logger::Warning << logPrefix << "zone '" << di.zone << "', multiple version records found, aborting" << endl;
+        return false;
+      }
+
+      if (rr.content == "\"1\"") {
+        hasVersion = 1;
+      }
+      else if (rr.content == "\"2\"") {
+        hasVersion = 2;
       }
       else {
         g_log << Logger::Warning << logPrefix << "zone '" << di.zone << "', unsupported catalog zone schema version " << rr.content << ", aborting" << endl;
@@ -355,21 +362,23 @@ static bool catalogProcess(const DomainInfo& di, vector<DNSResourceRecord>& rrs,
         }
       }
 
-      else if (rel == (DNSName("coo") + unique) && rr.qtype == QType::PTR) {
-        if (!ci.d_coo.empty()) {
-          g_log << Logger::Warning << logPrefix << "zone '" << di.zone << "', duplicate COO for unique '" << unique << "'" << endl;
-          zoneInvalid = true;
-        }
-        else {
-          ci.d_coo = DNSName(rr.content);
+      else if (hasVersion == 2) {
+        if (rel == (DNSName("coo") + unique) && rr.qtype == QType::PTR) {
+          if (!ci.d_coo.empty()) {
+            g_log << Logger::Warning << logPrefix << "zone '" << di.zone << "', duplicate COO for unique '" << unique << "'" << endl;
+            zoneInvalid = true;
+          }
+          else {
+            ci.d_coo = DNSName(rr.content);
+          }
         }
-      }
-      else if (rel == (DNSName("group") + unique) && rr.qtype == QType::TXT) {
-        std::string content = rr.content;
-        if (content.length() >= 2 && content.at(0) == '\"' && content.at(content.length() - 1) == '\"') { // TXT pain
-          content = content.substr(1, content.length() - 2);
+        else if (rel == (DNSName("group") + unique) && rr.qtype == QType::TXT) {
+          std::string content = rr.content;
+          if (content.length() >= 2 && content.at(0) == '\"' && content.at(content.length() - 1) == '\"') { // TXT pain
+            content = content.substr(1, content.length() - 2);
+          }
+          ci.d_group.insert(content);
         }
-        ci.d_group.insert(content);
       }
     }
     rr.disabled = true;