]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth bindbackend: skip rejected zones during list and search, fixes #10885 10941/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Wed, 3 Nov 2021 13:00:30 +0000 (14:00 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 9 Nov 2021 13:41:46 +0000 (14:41 +0100)
modules/bindbackend/bindbackend2.cc

index 54d9c612ba5f0ea7e95ab5b705793cdb0f166c45..2922798a9ed56805a8637816beb9ef314834bccd 100644 (file)
@@ -1301,6 +1301,10 @@ bool Bind2Backend::list(const DNSName& target, int id, bool include_disabled)
   d_handle.reset();
   DLOG(g_log << "Bind2Backend constructing handle for list of " << id << endl);
 
+  if (!bbd.d_loaded) {
+    throw PDNSException("zone was not loaded, perhaps because of: " + bbd.d_status);
+  }
+
   d_handle.d_records = bbd.d_records.get(); // give it a copy, which will stay around
   d_handle.d_qname_iter = d_handle.d_records->begin();
   d_handle.d_qname_end = d_handle.d_records->end(); // iter now points to a vector of pointers to vector<BBResourceRecords>
@@ -1437,6 +1441,10 @@ bool Bind2Backend::searchRecords(const string& pattern, int maxResults, vector<D
         continue;
       }
 
+      if (!h.d_loaded) {
+        continue;
+      }
+
       shared_ptr<const recordstorage_t> rhandle = h.d_records.get();
 
       for (recordstorage_t::const_iterator ri = rhandle->begin(); result.size() < static_cast<vector<DNSResourceRecord>::size_type>(maxResults) && ri != rhandle->end(); ri++) {