]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Do not keep secpolling for non-releases. 17134/head
authorMiod Vallat <miod.vallat@powerdns.com>
Fri, 10 Apr 2026 11:58:07 +0000 (13:58 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Fri, 10 Apr 2026 11:58:07 +0000 (13:58 +0200)
Fixes: #17133
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/auth-main.cc
pdns/secpoll-auth.cc
pdns/secpoll-auth.hh

index 6da017a84e542bc7eada993976fd7d6e702e06dc..2e591481acd325da1c4d05fb6b10ef8065732352 100644 (file)
@@ -890,8 +890,9 @@ static void mainthread()
     DP->go();
   }
 
+  bool performSecPoll{true};
   try {
-    doSecPoll(slog, true);
+    performSecPoll = doSecPoll(slog, true);
   }
   catch (...) {
   }
@@ -1017,13 +1018,15 @@ static void mainthread()
       }
     }
 
-    secpollSince += sleeptime;
-    if (secpollSince >= secpollInterval) {
-      secpollSince = 0;
-      try {
-        doSecPoll(slog, false);
-      }
-      catch (...) {
+    if (performSecPoll) {
+      secpollSince += sleeptime;
+      if (secpollSince >= secpollInterval) {
+        secpollSince = 0;
+        try {
+          performSecPoll = doSecPoll(slog, false);
+        }
+        catch (...) {
+        }
       }
     }
   }
index a499dd7a91ba65a10724caf8bdb417b2c9461e46..fa9603a26d27ec93b9bcc0275d4217ef27cfdb02 100644 (file)
@@ -29,11 +29,12 @@ extern StatBag S;
 
 /** Do an actual secpoll for the current version
  * @param first bool that tells if this is the first secpoll run since startup
+ * @return whether polling should continue
  */
-void doSecPoll(Logr::log_t slog, bool first)
+bool doSecPoll(Logr::log_t slog, bool first)
 {
   if(::arg()["security-poll-suffix"].empty())
-    return;
+    return false;
 
   struct timeval now;
   gettimeofday(&now, nullptr);
@@ -56,7 +57,7 @@ void doSecPoll(Logr::log_t slog, bool first)
   if (res == RCode::NXDomain && !isReleaseVersion(pkgv)) {
     SLOG(g_log<<Logger::Warning<<"Not validating response for security status update, this is a non-release version"<<endl,
          slog->info(Logr::Warning, "Not validating response for security status update, this is a non-release version"));
-    return;
+    return false;
   }
 
   string security_message;
@@ -67,7 +68,7 @@ void doSecPoll(Logr::log_t slog, bool first)
     S.set("security-status", security_status);
     SLOG(g_log<<Logger::Warning<<"Failed to retrieve security status update for '" + pkgv + "' on '"+ query + "': "<<pe.reason<<endl,
          slog->error(Logr::Warning, pe.reason, "Failed to retrieve security status update", "package", Logging::Loggable(pkgv), "query", Logging::Loggable(query)));
-    return;
+    return true;
   }
 
 
@@ -86,4 +87,5 @@ void doSecPoll(Logr::log_t slog, bool first)
     SLOG(g_log<<Logger::Error<<"PowerDNS Security Update Mandatory: "<<g_security_message<<endl,
          slog->info(Logr::Error, "PowerDNS Security Update Mandatory", "status", Logging::Loggable(g_security_message)));
   }
+  return true;
 }
index 99e0124b7973271a0ed33e67b21d6c6bee1bf495..e66e98a5ede81c3b3236f2e3c2dcafcc7e942dd6 100644 (file)
@@ -24,4 +24,4 @@
 #include "namespaces.hh"
 #include "stubresolver.hh"
 
-void doSecPoll(Logr::log_t slog, bool first);
+bool doSecPoll(Logr::log_t slog, bool first);