]> granicus.if.org Git - pdns/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>
Mon, 16 Oct 2017 15:23:16 +0000 (17:23 +0200)
Closes #5786

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

index a68a7a93a550f95bb4319a2ffa46668d1d432b2e..ccfec1805e28f100975b48f24e7eba4968168b07 100644 (file)
@@ -812,6 +812,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::Notice<<d_logprefix<<" Zone '"<<i->name<<"' has no type specified, assuming 'native'"<<endl;
         if(i->type!="master" && i->type!="slave" && i->type != "native" && i->type != "") {
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;