]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Support command line and include-dir properly in reload-zones
authorAki Tuomi <cmouse@desteem.org>
Fri, 7 Feb 2014 10:55:34 +0000 (12:55 +0200)
committerAki Tuomi <cmouse@desteem.org>
Fri, 7 Feb 2014 10:56:22 +0000 (12:56 +0200)
pdns/reczones.cc

index f56a9ee2bcdb5eeb774c2664f1cad27034057fd9..832a47fbd84fc900d12931114d611887482cfd87 100644 (file)
 #include "zoneparser-tng.hh"
 #include "logger.hh"
 #include "dnsrecords.hh"
+#include <boost/foreach.hpp>
+
+extern int g_argc;
+extern char** g_argv;
 
 void primeHints(void)
 {
@@ -250,11 +254,29 @@ string reloadAuthAndForwards()
     
     if(!::arg().preParseFile(configname.c_str(), "forward-zones")) 
       L<<Logger::Warning<<"Unable to re-parse configuration file '"<<configname<<"'"<<endl;
-    
+    ::arg().preParse(g_argc, g_argv, "forward-zones");
     ::arg().preParseFile(configname.c_str(), "forward-zones-file");
+    ::arg().preParse(g_argc, g_argv, "forward-zones-file");
     ::arg().preParseFile(configname.c_str(), "auth-zones");
+    ::arg().preParse(g_argc, g_argv, "auth-zones");
     ::arg().preParseFile(configname.c_str(), "export-etc-hosts", "off");
+    ::arg().preParse(g_argc, g_argv, "export-etc-hosts");
     ::arg().preParseFile(configname.c_str(), "serve-rfc1918");
+    ::arg().preParse(g_argc, g_argv, "serve-rfc1918");
+    ::arg().preParseFile(configname.c_str(), "include-dir");
+    ::arg().preParse(g_argc, g_argv, "include-dir");
+
+    // then process includes
+    std::vector<std::string> extraConfigs;
+    ::arg().gatherIncludes(extraConfigs);
+
+    BOOST_FOREACH(const std::string& fn, extraConfigs) {
+      ::arg().preParseFile(fn.c_str(), "forward-zones", ::arg()["forward-zones"]);
+      ::arg().preParseFile(fn.c_str(), "forward-zones-file", ::arg()["forward-zones-file"]);
+      ::arg().preParseFile(fn.c_str(), "auth-zones",::arg()["auth-zones"]);
+      ::arg().preParseFile(fn.c_str(), "export-etc-hosts",::arg()["export-etc-hosts"]);
+      ::arg().preParseFile(fn.c_str(), "serve-rfc1918",::arg()["serve-rfc1918"]);
+    }
 
     SyncRes::domainmap_t* newDomainMap = parseAuthAndForwards();