From 0563e9f198e046326f60839adce44a8f361e673d Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Fri, 16 Feb 2018 17:16:54 +0100 Subject: [PATCH] dyndns: Add tests for the CNAME-with-other-data issue (cherry picked from commit e07c665fba49183eafafffc493c6c0e7c36fd4ab) --- .../1dyndns-cname-and-other-data/command | 76 +++++++++++++++++++ .../1dyndns-cname-and-other-data/description | 3 + .../expected_result | 68 +++++++++++++++++ .../skip.nodyndns | 1 + 4 files changed, 148 insertions(+) create mode 100755 regression-tests/tests/1dyndns-cname-and-other-data/command create mode 100644 regression-tests/tests/1dyndns-cname-and-other-data/description create mode 100644 regression-tests/tests/1dyndns-cname-and-other-data/expected_result create mode 100644 regression-tests/tests/1dyndns-cname-and-other-data/skip.nodyndns diff --git a/regression-tests/tests/1dyndns-cname-and-other-data/command b/regression-tests/tests/1dyndns-cname-and-other-data/command new file mode 100755 index 000000000..32ef5676e --- /dev/null +++ b/regression-tests/tests/1dyndns-cname-and-other-data/command @@ -0,0 +1,76 @@ +#!/bin/sh + +RECORDNAME=cname-and-other.test.dyndns + +echo '* Check if there is nothing there' +cleandig $RECORDNAME ANY hidesoadetails + +echo '* Try to add 2 records that are not allowed together (should lead to FORMERR)' +cleannsupdate <>HEADER<<- opcode: UPDATE, status: FORMERR, id: [id] +;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0 +;; ZONE SECTION: +;test.dyndns. IN SOA + +* check that indeed nothing was added +1 test.dyndns. IN SOA 3600 ns1.test.dyndns. ahu.example.dyndns. [serial] 28800 7200 604800 86400 +Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='cname-and-other.test.dyndns.', qtype=A +1 test.dyndns. IN SOA 3600 ns1.test.dyndns. ahu.example.dyndns. [serial] 28800 7200 604800 86400 +Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='cname-and-other.test.dyndns.', qtype=CNAME +* Add a CNAME +Answer: +;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id] +;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0 +;; ZONE SECTION: +;test.dyndns. IN SOA + +* Attempt to add an A record (should be REFUSED) +Answer: +;; ->>HEADER<<- opcode: UPDATE, status: REFUSED, id: [id] +;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0 +;; ZONE SECTION: +;test.dyndns. IN SOA + +* Check that we only still have the CNAME +0 cname-and-other.test.dyndns. IN CNAME 3600 powerdns-cname.example. +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='cname-and-other.test.dyndns.', qtype=A +* Delete the CNAME and add the A record in one go +Answer: +;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id] +;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0 +;; ZONE SECTION: +;test.dyndns. IN SOA + +* Check that we have only the A-record +0 cname-and-other.test.dyndns. IN A 3600 192.0.2.1 +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='cname-and-other.test.dyndns.', qtype=A +1 test.dyndns. IN SOA 3600 ns1.test.dyndns. ahu.example.dyndns. [serial] 28800 7200 604800 86400 +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='cname-and-other.test.dyndns.', qtype=CNAME +* Attempt to add a CNAME (should be REFUSED) +Answer: +;; ->>HEADER<<- opcode: UPDATE, status: REFUSED, id: [id] +;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0 +;; ZONE SECTION: +;test.dyndns. IN SOA + +* check that we have only the A-record +0 cname-and-other.test.dyndns. IN A 3600 192.0.2.1 +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='cname-and-other.test.dyndns.', qtype=ANY +* Clean up +Answer: +;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id] +;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0 +;; ZONE SECTION: +;test.dyndns. IN SOA + diff --git a/regression-tests/tests/1dyndns-cname-and-other-data/skip.nodyndns b/regression-tests/tests/1dyndns-cname-and-other-data/skip.nodyndns new file mode 100644 index 000000000..81c071b81 --- /dev/null +++ b/regression-tests/tests/1dyndns-cname-and-other-data/skip.nodyndns @@ -0,0 +1 @@ +Skip this test if the backend does not support dyndns/rfc2136 -- 2.40.0