]> granicus.if.org Git - pdns/commitdiff
RPZ: Always set the policy name
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 22 Jul 2016 19:14:47 +0000 (21:14 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 25 Aug 2016 08:44:33 +0000 (10:44 +0200)
For slaved zones, set it to the name of the zone by default. For
file-based RPZs, use "rpzFile";

pdns/rec-lua-conf.cc

index 8150f84574de0c02c64c45226630a87df39dfa7a..c362f5276ab4e664c0867392e19f979e9a8120b7 100644 (file)
@@ -92,7 +92,7 @@ void loadRecursorLuaConfig(const std::string& fname)
   Lua.writeFunction("rpzFile", [&lci](const string& fname, const boost::optional<std::unordered_map<string,boost::variant<int, string>>>& options) {
       try {
        boost::optional<DNSFilterEngine::Policy> defpol;
-       std::string polName;
+       std::string polName("rpzFile");
        if(options) {
          auto& have = *options;
          if(have.count("policyName")) {
@@ -137,9 +137,9 @@ void loadRecursorLuaConfig(const std::string& fname)
         ComboAddress localAddress;
        if(options) {
          auto& have = *options;
-         if(have.count("policyName")) {
+          polName = zone_;
+         if(have.count("policyName"))
            polName = boost::get<std::string>(constGet(have, "policyName"));
-         }
          if(have.count("defpol")) {
            //      cout<<"Set a default policy"<<endl;
            defpol=DNSFilterEngine::Policy();