]> granicus.if.org Git - pdns/commitdiff
pdnsutil increase-serial: set right ordername
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 10:55:24 +0000 (12:55 +0200)
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 69adc32fad6e2c2ffcce371feb76e317755d3f1a..aaa73d0f606f6b19c17ce7afdfbe88dea750eb52 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