--- /dev/null
+#!/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 <<!
+server $nameserver $port
+zone test.dyndns
+update add $RECORDNAME. 3600 CNAME powerdns-cname.example.
+update add $RECORDNAME. 3600 A 192.0.2.1
+send
+answer
+!
+
+echo '* check that indeed nothing was added'
+cleandig $RECORDNAME A hidesoadetails
+cleandig $RECORDNAME CNAME hidesoadetails
+
+echo '* Add a CNAME'
+cleannsupdate <<!
+server $nameserver $port
+zone test.dyndns
+update add $RECORDNAME. 3600 CNAME powerdns-cname.example.
+send
+answer
+!
+
+echo '* Attempt to add an A record (should be REFUSED)'
+cleannsupdate <<!
+server $nameserver $port
+zone test.dyndns
+update add $RECORDNAME. 3600 A 192.0.2.1
+send
+answer
+!
+
+echo '* Check that we only still have the CNAME'
+cleandig $RECORDNAME A hidesoadetails
+
+echo '* Delete the CNAME and add the A record in one go'
+cleannsupdate <<!
+server $nameserver $port
+zone test.dyndns
+update delete $RECORDNAME. 3600 CNAME powerdns-cname.example.
+update add $RECORDNAME. 3600 A 192.0.2.1
+send
+answer
+!
+
+echo '* Check that we have only the A-record'
+cleandig $RECORDNAME A hidesoadetails
+cleandig $RECORDNAME CNAME hidesoadetails
+
+echo '* Attempt to add a CNAME (should be REFUSED)'
+cleannsupdate <<!
+server $nameserver $port
+zone test.dyndns
+update add $RECORDNAME. 3600 CNAME powerdns-cname.example.
+send
+answer
+!
+
+echo '* check that we have only the A-record'
+cleandig $RECORDNAME ANY hidesoadetails
+
+echo '* Clean up'
+cleannsupdate <<!
+server $nameserver $port
+zone test.dyndns
+update delete $RECORDNAME. 3600 A 192.0.2.1
+send
+answer
+!
--- /dev/null
+* Check if there is nothing there
+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=ANY
+* Try to add 2 records that are not allowed together (should lead to FORMERR)
+Answer:
+;; ->>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
+