]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Backport #4781: API: correctly take TTL from first record even if we are at the last... 4932/head
authorChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Tue, 24 Jan 2017 10:13:19 +0000 (11:13 +0100)
committerChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Tue, 24 Jan 2017 10:13:19 +0000 (11:13 +0100)
Cherry picked from master 50d739d0ae978b8b0b737b079992744ff8aa126d

pdns/ws-auth.cc
regression-tests.api/test_Zones.py

index a8201d31d4c910df422bb24a792e7b11275ee549..95624904109db1dfd2c2aa377c0836469622becd 100644 (file)
@@ -384,7 +384,7 @@ static void fillZone(const DNSName& zonename, HttpResponse* resp) {
   auto cit = comments.begin();
 
   while (rit != records.end() || cit != comments.end()) {
-    if (cit == comments.end() || (rit != records.end() && (cit->qname.toString() < rit->qname.toString() || cit->qtype < rit->qtype))) {
+    if (cit == comments.end() || (rit != records.end() && (cit->qname.toString() <= rit->qname.toString() || cit->qtype < rit->qtype || cit->qtype == rit->qtype))) {
       current_qname = rit->qname;
       current_qtype = rit->qtype;
       ttl = rit->ttl;
index 958e192e3cc6cc25dbe08f01cc060372a4b95d74..396d26b83b9d83a7becf31c11694182be1ea80b3 100644 (file)
@@ -886,6 +886,8 @@ fred   IN  A      192.168.0.4
         self.assertNotEquals(serverset['comments'], [])
         # verify that modified_at has been set by pdns
         self.assertNotEquals([c for c in serverset['comments']][0]['modified_at'], 0)
+        # verify that TTL is correct (regression test)
+        self.assertEquals(serverset['ttl'], 3600)
 
     def test_zone_comment_delete(self):
         # Test: Delete ONLY comments.