]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
In getUpdatedPrimaries(), parse zone name first.
authorMiod Vallat <miod.vallat@powerdns.com>
Fri, 10 Oct 2025 12:12:04 +0000 (14:12 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Fri, 10 Oct 2025 12:12:04 +0000 (14:12 +0200)
Otherwise, if another field is not parsed correctly, we risk triggering
another exception while attempting to use the unset zone name in the
error report.

Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/backends/gsql/gsqlbackend.cc

index 06de81732c4499dc7df43d073c843d0ca5c951ea..d2e78b189274634d984c3f81f7e3ebc4c30e6570 100644 (file)
@@ -556,14 +556,6 @@ void GSQLBackend::getUpdatedPrimaries(vector<DomainInfo>& updatedDomains, std::u
 
     di.backend = this;
 
-    try {
-      pdns::checked_stoi_into(di.id, row[0]);
-    }
-    catch (const std::exception& e) {
-      g_log << Logger::Warning << __PRETTY_FUNCTION__ << " could not convert id '" << row[0] << "' for zone '" << di.zone << "' into an integer: " << e.what() << endl;
-      continue;
-    }
-
     try {
       di.zone = ZoneName(row[1]);
     }
@@ -576,6 +568,14 @@ void GSQLBackend::getUpdatedPrimaries(vector<DomainInfo>& updatedDomains, std::u
       continue;
     }
 
+    try {
+      pdns::checked_stoi_into(di.id, row[0]);
+    }
+    catch (const std::exception& e) {
+      g_log << Logger::Warning << __PRETTY_FUNCTION__ << " could not convert id '" << row[0] << "' for zone '" << di.zone << "' into an integer: " << e.what() << endl;
+      continue;
+    }
+
     try {
       di.catalog = ZoneName(row[5]);
     }