]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
BIND: reject zones without 'file' stanza
authorPieter Lexis <pieter.lexis@powerdns.com>
Mon, 16 Oct 2017 15:20:38 +0000 (17:20 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 7 Nov 2017 20:26:24 +0000 (21:26 +0100)
Closes #5786

(cherry picked from commit 6808f3b5faf6ffc4bea8f78107be99766d2be75c)

modules/bindbackend/bindbackend2.cc
pdns/bindparser.yy
pdns/bindparserclasses.hh

index 3baf25ebb43e7e8b937bf08407d22243e5ca29dd..2ec75f2df801949a510316f3d2874fe6a77ceffb 100644 (file)
@@ -806,6 +806,12 @@ void Bind2Backend::loadConfig(string* status)
         i!=domains.end();
         ++i) 
       {
+        if (!(i->hadFileDirective)) {
+          L<<Logger::Warning<<d_logprefix<<" Zone '"<<i->name<<"' has no 'file' directive set in "<<getArg("config")<<endl;
+          rejected++;
+          continue;
+        }
+
         if(i->type == "") {
           L<<Logger::Warning<<d_logprefix<<" Warning! Skipping zone '"<<i->name<<"' because it has no type specified"<<endl;
           rejected++;
index d83190313f2b7ae89c45ae3ef0e9a7dad44d099e..9f3bf4b8c7b36c76c7bff11e1ee595498dd66f02 100644 (file)
@@ -89,6 +89,8 @@ void BindParser::setVerbose(bool verbose)
 
 void BindParser::commit(BindDomainInfo DI)
 {
+  DI.hadFileDirective = (DI.filename != "");
+
   if(DI.filename[0]!='/')
     DI.filename=d_dir+"/"+DI.filename;
 
index 4d717638036ccf9d355fb60336630b711c54c782..b8a3caa231d7b311ad8c1e529ea12a3be13e6ca7 100644 (file)
@@ -51,6 +51,7 @@ public:
   vector<string> masters;
   set<string> alsoNotify;
   string type;
+  bool hadFileDirective;
     
   dev_t d_dev;
   ino_t d_ino;