Parcourir la source

[1627] Check for empty origin and file in config, and throw with more relevant error msg

Mukund Sivaraman il y a 13 ans
Parent
commit
c80eae98a8
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4 2
      src/bin/auth/auth_config.cc

+ 4 - 2
src/bin/auth/auth_config.cc

@@ -155,11 +155,13 @@ MemoryDatasourceConfig::build(ConstElementPtr config_value) {
 
     BOOST_FOREACH(ConstElementPtr zone_config, zones_config->listValue()) {
         ConstElementPtr origin = zone_config->get("origin");
-        if (!origin) {
+        const string origin_txt = origin ? origin->stringValue() : "";
+        if (origin_txt.empty()) {
             isc_throw(AuthConfigError, "Missing zone origin");
         }
         ConstElementPtr file = zone_config->get("file");
-        if (!file) {
+        const string file_txt = file ? file->stringValue() : "";
+        if (file_txt.empty()) {
             isc_throw(AuthConfigError, "Missing zone file for zone: "
                       << origin->str());
         }