]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
geoipbackend: Emit error and discard errorneus zones instead of failing completely
authorAki Tuomi <cmouse@cmouse.fi>
Sun, 1 May 2022 18:17:59 +0000 (21:17 +0300)
committerAki Tuomi <cmouse@cmouse.fi>
Mon, 28 Aug 2023 12:44:07 +0000 (15:44 +0300)
modules/geoipbackend/geoipbackend.cc

index 1ff316cd686dc0cb966295f3035eb5f4618cdb03..de939804fee32c4406b6e2398fc83a33473ea163 100644 (file)
@@ -122,6 +122,7 @@ static bool validateMappingLookupFormats(const vector<string>& formats)
 
 bool GeoIPBackend::loadDomain(const YAML::Node& domain, unsigned int id, GeoIPDomain& dom)
 {
+  try {
     dom.domain = DNSName(domain["domain"].as<string>());
     dom.ttl = domain["ttl"].as<int>();
 
@@ -320,6 +321,15 @@ bool GeoIPBackend::loadDomain(const YAML::Node& domain, unsigned int id, GeoIPDo
         }
       }
     }
+  }
+  catch (std::exception& ex) {
+    g_log << Logger::Error << ex.what() << endl;
+    return false;
+  }
+  catch (PDNSException& ex) {
+    g_log << Logger::Error << ex.reason << endl;
+    return false;
+  }
   return true;
 }