]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
lmdb: fill di.serial 8707/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Wed, 15 Jan 2020 20:02:13 +0000 (21:02 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 17 Nov 2020 17:21:19 +0000 (18:21 +0100)
modules/lmdbbackend/lmdbbackend.cc
pdns/pdnsutil.cc

index a79b8d837cfd4dc0ffbeacfb9ea5feae55c4c0a7..020a275f179755c3dec37f77faca8f56c9899063 100644 (file)
@@ -811,6 +811,25 @@ bool LMDBBackend::getDomainInfo(const DNSName &domain, DomainInfo &di, bool getS
   if(!(di.id=txn.get<0>(domain, di)))
     return false;
   di.backend = this;
+
+  di.serial = 0;
+
+  if(getSerial) {
+    auto txn2 = getRecordsROTransaction(di.id);
+    compoundOrdername co;
+    MDBOutVal val;
+
+    if(!txn2->txn->get(txn2->db->dbi, co(di.id, g_rootdnsname, QType::SOA), val)) {
+      DNSResourceRecord rr;
+      serFromString(val.get<string_view>(), rr);
+
+      if(rr.content.size() >= 5 * sizeof(uint32_t)) {
+        uint32_t serial = *reinterpret_cast<uint32_t*>(&rr.content[rr.content.size() - (5 * sizeof(uint32_t))]);
+        di.serial = ntohl(serial);
+      }
+    }
+  }
+
   return true;
 }
 
index 9325291efb4a31725e657382475bd313f79a21cc..918171deaae20af26507fb174fe653c1c7b5e92b 100644 (file)
@@ -1860,7 +1860,7 @@ static bool secureZone(DNSSECKeeper& dk, const DNSName& zone)
 
   DomainInfo di;
   UeberBackend B("default");
-  if(!B.getDomainInfo(zone, di) || !di.backend) { // di.backend and B are mostly identical
+  if(!B.getDomainInfo(zone, di, false) || !di.backend) { // di.backend and B are mostly identical
     cerr<<"Can't find a zone called '"<<zone<<"'"<<endl;
     return false;
   }