]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Fix tab/whitespace mix in `rpzFile()` and `rpzMaster()`
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Feb 2017 08:08:01 +0000 (09:08 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 21 Feb 2017 09:33:22 +0000 (10:33 +0100)
pdns/rec-lua-conf.cc

index 1f90d94f3ebfc2d9a9fb90cdbfd22f9c98404a86..1bd32db6aa5772ceecdaadfa99c734bf0c8d4ae0 100644 (file)
@@ -122,47 +122,46 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
 
   Lua.writeFunction("rpzFile", [&lci](const string& filename, const boost::optional<std::unordered_map<string,boost::variant<uint32_t, string>>>& options) {
       try {
-       boost::optional<DNSFilterEngine::Policy> defpol;
-       std::string polName("rpzFile");
-       const size_t zoneIdx = lci.dfe.size();
-       uint32_t maxTTL = std::numeric_limits<uint32_t>::max();
-       if(options) {
-         auto& have = *options;
+        boost::optional<DNSFilterEngine::Policy> defpol;
+        std::string polName("rpzFile");
+        const size_t zoneIdx = lci.dfe.size();
+        uint32_t maxTTL = std::numeric_limits<uint32_t>::max();
+        if(options) {
+          auto& have = *options;
           size_t zoneSizeHint = 0;
           parseRPZParameters(have, polName, defpol, maxTTL, zoneSizeHint);
           if (zoneSizeHint > 0) {
             lci.dfe.reserve(zoneIdx, zoneSizeHint);
           }
-       }
+        }
         theL()<<Logger::Warning<<"Loading RPZ from file '"<<filename<<"'"<<endl;
         lci.dfe.setPolicyName(zoneIdx, polName);
         loadRPZFromFile(filename, lci.dfe, defpol, maxTTL, zoneIdx);
         theL()<<Logger::Warning<<"Done loading RPZ from file '"<<filename<<"'"<<endl;
       }
       catch(std::exception& e) {
-       theL()<<Logger::Error<<"Unable to load RPZ zone from '"<<filename<<"': "<<e.what()<<endl;
+        theL()<<Logger::Error<<"Unable to load RPZ zone from '"<<filename<<"': "<<e.what()<<endl;
       }
     });
 
-
   Lua.writeFunction("rpzMaster", [&lci, checkOnly](const string& master_, const string& zone_, const boost::optional<std::unordered_map<string,boost::variant<uint32_t, string>>>& options) {
       try {
-       boost::optional<DNSFilterEngine::Policy> defpol;
+        boost::optional<DNSFilterEngine::Policy> defpol;
         TSIGTriplet tt;
         uint32_t refresh=0;
-       std::string polName(zone_);
-       size_t maxReceivedXFRMBytes = 0;
-       uint32_t maxTTL = std::numeric_limits<uint32_t>::max();
-       ComboAddress localAddress;
-       const size_t zoneIdx = lci.dfe.size();
-       if(options) {
-         auto& have = *options;
+        std::string polName(zone_);
+        size_t maxReceivedXFRMBytes = 0;
+        uint32_t maxTTL = std::numeric_limits<uint32_t>::max();
+        ComboAddress localAddress;
+        const size_t zoneIdx = lci.dfe.size();
+        if(options) {
+          auto& have = *options;
           size_t zoneSizeHint = 0;
           parseRPZParameters(have, polName, defpol, maxTTL, zoneSizeHint);
           if (zoneSizeHint > 0) {
             lci.dfe.reserve(zoneIdx, zoneSizeHint);
           }
-         if(have.count("tsigname")) {
+          if(have.count("tsigname")) {
             tt.name=DNSName(toLower(boost::get<string>(constGet(have, "tsigname"))));
             tt.algo=DNSName(toLower(boost::get<string>(constGet(have, "tsigalgo"))));
             if(B64Decode(boost::get<string>(constGet(have, "tsigsecret")), tt.secret))
@@ -177,12 +176,12 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
           if(have.count("localAddress")) {
             localAddress = ComboAddress(boost::get<string>(constGet(have,"localAddress")));
           }
-       }
-       ComboAddress master(master_, 53);
+        }
+        ComboAddress master(master_, 53);
         if (localAddress != ComboAddress() && localAddress.sin4.sin_family != master.sin4.sin_family)
           // We were passed a localAddress, check if its AF matches the master's
           throw PDNSException("Master address("+master.toString()+") is not of the same Address Family as the local address ("+localAddress.toString()+").");
-       DNSName zone(zone_);
+        DNSName zone(zone_);
         lci.dfe.setPolicyName(zoneIdx, polName);
 
         if (!checkOnly) {
@@ -194,10 +193,10 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
         }
       }
       catch(std::exception& e) {
-       theL()<<Logger::Error<<"Unable to load RPZ zone '"<<zone_<<"' from '"<<master_<<"': "<<e.what()<<endl;
+        theL()<<Logger::Error<<"Unable to load RPZ zone '"<<zone_<<"' from '"<<master_<<"': "<<e.what()<<endl;
       }
       catch(PDNSException& e) {
-       theL()<<Logger::Error<<"Unable to load RPZ zone '"<<zone_<<"' from '"<<master_<<"': "<<e.reason<<endl;
+        theL()<<Logger::Error<<"Unable to load RPZ zone '"<<zone_<<"' from '"<<master_<<"': "<<e.reason<<endl;
       }
 
     });