]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth 2136: apply new TTL to whole RRset, not only to the added record 10981/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 15 Nov 2021 15:28:58 +0000 (16:28 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 15 Nov 2021 15:29:15 +0000 (16:29 +0100)
fixes #10921

pdns/rfc2136handler.cc
regression-tests/tests/1dyndns-update-add-delete-mx/expected_result
regression-tests/tests/1dyndns-update-delete-mx-prio/expected_result
regression-tests/tests/1dyndns-update-replace-mx/expected_result
regression-tests/tests/1dyndns-update-srv/expected_result

index be1d3aa5210208af2a9ab3f2e22a3eb8b23f5c54..ea985b35c05ff8595935ff8fc4bf809f26fcfaea 100644 (file)
@@ -194,8 +194,10 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
         for (auto& i : rrset) {
           string icontent = i.getZoneRepresentation();
           if (lowerCase) icontent = toLower(icontent);
-          if (rrType == i.qtype.getCode() && icontent == content) {
-            foundRecord=true;
+          if (rrType == i.qtype.getCode()) {
+            if (icontent == content) {
+              foundRecord=true;
+            }
             if (i.ttl != rr->d_ttl)  {
               i.ttl = rr->d_ttl;
               updateTTL++;
@@ -204,10 +206,10 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr,
         }
         if (updateTTL > 0) {
           di->backend->replaceRRSet(di->id, rr->d_name, rrType, rrset);
-          g_log<<Logger::Notice<<msgPrefix<<"Replacing record "<<rr->d_name<<"|"<<rrType.toString()<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Updating TTLs for "<<rr->d_name<<"|"<<rrType.toString()<<endl;
           changedRecords += updateTTL;
         } else {
-          g_log<<Logger::Notice<<msgPrefix<<"Replace for record "<<rr->d_name<<"|"<<rrType.toString()<<" requested, but no changes made."<<endl;
+          g_log<<Logger::Notice<<msgPrefix<<"Replace for recordset "<<rr->d_name<<"|"<<rrType.toString()<<" requested, but no changes made."<<endl;
         }
       }
 
index cc504a97949bc6bb540465abce3edac0638421c2..c25d426d076b41753a8f9269afdb74bf0cfa3db4 100644 (file)
@@ -10,9 +10,9 @@ Answer:
 ;; ZONE SECTION:
 ;test.dyndns.                  IN      SOA
 
+0      test.dyndns.    IN      MX      3000    10 host-1.test.dyndns.
+0      test.dyndns.    IN      MX      3000    20 host-2.test.dyndns.
 0      test.dyndns.    IN      MX      3000    30 host-3.test.dyndns.
-0      test.dyndns.    IN      MX      3600    10 host-1.test.dyndns.
-0      test.dyndns.    IN      MX      3600    20 host-2.test.dyndns.
 2      host-1.test.dyndns.     IN      A       3600    127.0.0.101
 2      host-2.test.dyndns.     IN      A       3600    127.0.0.102
 2      host-3.test.dyndns.     IN      A       3600    127.0.0.103
@@ -24,8 +24,8 @@ Answer:
 ;; ZONE SECTION:
 ;test.dyndns.                  IN      SOA
 
-0      test.dyndns.    IN      MX      3600    10 host-1.test.dyndns.
-0      test.dyndns.    IN      MX      3600    20 host-2.test.dyndns.
+0      test.dyndns.    IN      MX      3000    10 host-1.test.dyndns.
+0      test.dyndns.    IN      MX      3000    20 host-2.test.dyndns.
 2      host-1.test.dyndns.     IN      A       3600    127.0.0.101
 2      host-2.test.dyndns.     IN      A       3600    127.0.0.102
 Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
index 07509ebed44ee70e7afd6a510035aee22bc9474d..d31c55603b0c6587735a86d44ba40dabdae9ec54 100644 (file)
@@ -1,5 +1,5 @@
-0      test.dyndns.    IN      MX      3600    10 host-1.test.dyndns.
-0      test.dyndns.    IN      MX      3600    20 host-2.test.dyndns.
+0      test.dyndns.    IN      MX      3000    10 host-1.test.dyndns.
+0      test.dyndns.    IN      MX      3000    20 host-2.test.dyndns.
 2      host-1.test.dyndns.     IN      A       3600    127.0.0.101
 2      host-2.test.dyndns.     IN      A       3600    127.0.0.102
 Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
index 93bef4c580b3ecb65aa86b8921616fc45cfeb7ac..e14d411ef6d51f8ccd768ae24f07801003fec273 100644 (file)
@@ -11,7 +11,7 @@ Answer:
 ;test.dyndns.                  IN      SOA
 
 0      test.dyndns.    IN      MX      3000    10 host-1.test.dyndns.
-0      test.dyndns.    IN      MX      3600    20 host-2.test.dyndns.
+0      test.dyndns.    IN      MX      3000    20 host-2.test.dyndns.
 2      host-1.test.dyndns.     IN      A       3600    127.0.0.101
 2      host-2.test.dyndns.     IN      A       3600    127.0.0.102
 Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
index 0738f8dbf4da4c2f9681f3c602545abf45bb57b7..f2032dd7fb718fc4009dcfe313901820adbf695b 100644 (file)
@@ -16,8 +16,8 @@ Answer:
 ;; ZONE SECTION:
 ;test.dyndns.                  IN      SOA
 
-0      srv.test.dyndns.        IN      SRV     3600    1 100 389 server2.
 0      srv.test.dyndns.        IN      SRV     3601    0 100 389 server1.
+0      srv.test.dyndns.        IN      SRV     3601    1 100 389 server2.
 Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
 Reply to question for qname='srv.test.dyndns.', qtype=SRV
 1      test.dyndns.    IN      SOA     3600    ns1.test.dyndns. ahu.example.dyndns. [serial] 28800 7200 604800 86400