]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Only display "no changes made" message during update if record is unchanged. 16113/head
authorMiod Vallat <miod.vallat@powerdns.com>
Thu, 11 Sep 2025 15:21:00 +0000 (17:21 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Thu, 11 Sep 2025 15:21:00 +0000 (17:21 +0200)
Fixes: #2353
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/rfc2136handler.cc

index 37f11da7eb36feedee9f64877d03a74d0f725ee1..20c65e95dfe8bd062e9854889283abdee94e2615 100644 (file)
@@ -196,31 +196,40 @@ static uint performUpdate(DNSSECKeeper& dsk, const string &msgPrefix, const DNSR
         int updateTTL=0;
         foundRecord = false;
         bool lowerCase = false;
-        if (rrType.getCode() == QType::PTR ||
-            rrType.getCode() == QType::MX ||
-            rrType.getCode() == QType::SRV) {
+        switch (rrType.getCode()) {
+        case QType::MX:
+        case QType::PTR:
+        case QType::SRV:
           lowerCase = true;
+          break;
         }
         string content = rr->getContent()->getZoneRepresentation();
-        if (lowerCase) content = toLower(content);
+        if (lowerCase) {
+          content = toLower(content);
+        }
         for (auto& i : rrset) {
-          string icontent = i.getZoneRepresentation();
-          if (lowerCase) icontent = toLower(icontent);
-          if (rrType == i.qtype.getCode()) {
+          if (rrType != i.qtype.getCode()) {
+            continue;
+          }
+          if (!foundRecord) {
+            string icontent = i.getZoneRepresentation();
+            if (lowerCase) {
+              icontent = toLower(icontent);
+            }
             if (icontent == content) {
               foundRecord=true;
             }
-            if (i.ttl != rr->d_ttl)  {
-              i.ttl = rr->d_ttl;
-              updateTTL++;
-            }
+          }
+          if (i.ttl != rr->d_ttl)  {
+            i.ttl = rr->d_ttl;
+            updateTTL++;
           }
         }
         if (updateTTL > 0) {
           di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset);
           g_log<<Logger::Notice<<msgPrefix<<"Updating TTLs for "<<rr->d_name<<"|"<<rrType.toString()<<endl;
           changedRecords += updateTTL;
-        } else {
+        } else if (foundRecord) {
           g_log<<Logger::Notice<<msgPrefix<<"Replace for recordset "<<rr->d_name<<"|"<<rrType.toString()<<" requested, but no changes made."<<endl;
         }
       }