]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add d_wasRejectedLastRelaod bool to BindDomainInfo
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 29 Jul 2016 11:26:29 +0000 (13:26 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 2 Aug 2016 13:50:49 +0000 (15:50 +0200)
Before, we used d_loaded to show "[rejected]" in the `pdns_control
bind-reload-now` output. However, an already loaded zone that was
rejected later, it would not show "[rejected], it would not show
"[rejected]".

modules/bindbackend/bindbackend2.cc
modules/bindbackend/bindbackend2.hh

index d3c9cca0d8cae74179beef04d01ab8fba194c2d6..d47abb0a3487a94f459761115e84db638afd9e14 100644 (file)
@@ -520,7 +520,7 @@ string Bind2Backend::DLReloadNowHandler(const vector<string>&parts, Utility::pid
       Bind2Backend bb2;
       bb2.queueReloadAndStore(bbd.d_id);
       safeGetBBDomainInfo(zone, &bbd); // Read the *new* domain status
-      ret<< *i << ": "<< (bbd.d_loaded ? "": "[rejected]") <<"\t"<<bbd.d_status<<"\n";
+      ret<< *i << ": "<< (bbd.d_wasRejectedLastReload ? "[rejected]": "") <<"\t"<<bbd.d_status<<"\n";
     }
     else
       ret<< *i << " no such domain\n";
@@ -901,6 +901,7 @@ void Bind2Backend::queueReloadAndStore(unsigned int id)
       return;
     parseZoneFile(&bbold);
     bbold.d_checknow=false;
+    bbold.d_wasRejectedLastReload=false;
     safePutBBDomainInfo(bbold);
     L<<Logger::Warning<<"Zone '"<<bbold.d_name<<"' ("<<bbold.d_filename<<") reloaded"<<endl;
   }
@@ -909,6 +910,7 @@ void Bind2Backend::queueReloadAndStore(unsigned int id)
     msg<<" error at "+nowTime()+" parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.reason;
     L<<Logger::Warning<<" error parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.reason<<endl;
     bbold.d_status=msg.str();
+    bbold.d_wasRejectedLastReload=true;
     safePutBBDomainInfo(bbold);
   }
   catch(std::exception &ae) {
@@ -916,6 +918,7 @@ void Bind2Backend::queueReloadAndStore(unsigned int id)
     msg<<" error at "+nowTime()+" parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.what();
     L<<Logger::Warning<<" error parsing '"<<bbold.d_name<<"' from file '"<<bbold.d_filename<<"': "<<ae.what()<<endl;
     bbold.d_status=msg.str();
+    bbold.d_wasRejectedLastReload=true;
     safePutBBDomainInfo(bbold);
   }
 }
index adb38faf9e54e22c16900c34608dbcd9c2da4caa..10732688493f22141c294e7b9f0f71080484a526 100644 (file)
@@ -166,6 +166,7 @@ public:
   unsigned int d_id;  //!< internal id of the domain
   mutable bool d_checknow; //!< if this domain has been flagged for a check
   bool d_loaded;  //!< if a domain is loaded
+  bool d_wasRejectedLastReload{false}; //!< if the domain was rejected during Bind2Backend::queueReloadAndStore
 
 private:
   time_t getCtime();