]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
pdnsutil increase-serial: set right ordername 8166/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 6 Aug 2019 09:12:05 +0000 (11:12 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 6 Aug 2019 17:00:55 +0000 (19:00 +0200)
(cherry picked from commit 970badd2b07b50e6103570f0ed91a834ac40cb15)

pdns/pdnsutil.cc
regression-tests/tests/pdnsutil-increase-serial/command [new file with mode: 0755]
regression-tests/tests/pdnsutil-increase-serial/description [new file with mode: 0644]
regression-tests/tests/pdnsutil-increase-serial/expected_result [new file with mode: 0644]
regression-tests/tests/pdnsutil-increase-serial/skip.nodyndns [new file with mode: 0644]

index e7c8dd5ede7498ffc6a867ea8e1e101a9a80bfa8..e57ad26d996d90b072901df40177cc67970fc8cf 100644 (file)
@@ -679,9 +679,9 @@ int increaseSerial(const DNSName& zone, DNSSECKeeper &dk)
     DNSName ordername;
     if(haveNSEC3) {
       if(!narrow)
-        ordername=DNSName(toBase32Hex(hashQNameWithSalt(ns3pr, zone))) + zone;
+        ordername=DNSName(toBase32Hex(hashQNameWithSalt(ns3pr, zone)));
     } else
-      ordername=zone;
+      ordername=DNSName("");
     if(g_verbose)
       cerr<<"'"<<rr.qname<<"' -> '"<< ordername <<"'"<<endl;
     sd.db->updateDNSSECOrderNameAndAuth(sd.domain_id, rr.qname, ordername, true);
diff --git a/regression-tests/tests/pdnsutil-increase-serial/command b/regression-tests/tests/pdnsutil-increase-serial/command
new file mode 100755 (executable)
index 0000000..cc3a369
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+mysqldiff
+
+$PDNSUTIL --config-dir=. --config-name=gmysql increase-serial test.dyndns
+
+mysqldiff 1 "Check that test.dyndns. still has a valid ordername"
+
+[ -z "$GMYSQLDB" ] && GMYSQLDB=pdnstest
+[ -z "$GMYSQLUSER" ] && GMYSQLUSER=root
+[ -z "$GMYSQLHOST" ] && GMYSQLHOST=localhost
+[ -z "$GMYSQLPASSWD" ] && GMYSQLPASSWD=''
+
+mysql --user="$GMYSQLUSER" --password="$GMYSQLPASSWD" --host="$GMYSQLHOST" \
+               "$GMYSQLDB" \
+               -e "UPDATE records SET content='ns1.test.dyndns ahu.example.dyndns 2012060701 28800 7200 604800 86400' WHERE name='test.dyndns' AND type='SOA'"
diff --git a/regression-tests/tests/pdnsutil-increase-serial/description b/regression-tests/tests/pdnsutil-increase-serial/description
new file mode 100644 (file)
index 0000000..327d6d9
--- /dev/null
@@ -0,0 +1 @@
+Make sure that pdnsutil increase-serial does not destroy ordername.
diff --git a/regression-tests/tests/pdnsutil-increase-serial/expected_result b/regression-tests/tests/pdnsutil-increase-serial/expected_result
new file mode 100644 (file)
index 0000000..13b2d73
--- /dev/null
@@ -0,0 +1,6 @@
+SOA serial for zone test.dyndns set to 2012060702
+Check that test.dyndns. still has a valid ordername
+--- Start: diff start step.1 ---
+no difference
+--- End: diff start step.1 ---
+
diff --git a/regression-tests/tests/pdnsutil-increase-serial/skip.nodyndns b/regression-tests/tests/pdnsutil-increase-serial/skip.nodyndns
new file mode 100644 (file)
index 0000000..81c071b
--- /dev/null
@@ -0,0 +1 @@
+Skip this test if the backend does not support dyndns/rfc2136