From f50ae72ec3417cae55dd4e085991c01af9fdc5f1 Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Wed, 11 Feb 2009 20:37:59 +0100 Subject: Initial commit --- bin/tests/system/nsupdate/clean.sh | 28 ++ bin/tests/system/nsupdate/knowngood.ns1.after | 99 +++++ bin/tests/system/nsupdate/knowngood.ns1.afterstop | 3 + bin/tests/system/nsupdate/knowngood.ns1.before | 98 +++++ bin/tests/system/nsupdate/ns1/example1.db | 152 ++++++++ bin/tests/system/nsupdate/ns1/named.conf | 58 +++ bin/tests/system/nsupdate/ns2/named.conf | 49 +++ bin/tests/system/nsupdate/setup.sh | 42 +++ bin/tests/system/nsupdate/tests.sh | 161 ++++++++ bin/tests/system/nsupdate/update_test.pl | 426 ++++++++++++++++++++++ 10 files changed, 1116 insertions(+) create mode 100644 bin/tests/system/nsupdate/clean.sh create mode 100644 bin/tests/system/nsupdate/knowngood.ns1.after create mode 100644 bin/tests/system/nsupdate/knowngood.ns1.afterstop create mode 100644 bin/tests/system/nsupdate/knowngood.ns1.before create mode 100644 bin/tests/system/nsupdate/ns1/example1.db create mode 100644 bin/tests/system/nsupdate/ns1/named.conf create mode 100644 bin/tests/system/nsupdate/ns2/named.conf create mode 100644 bin/tests/system/nsupdate/setup.sh create mode 100644 bin/tests/system/nsupdate/tests.sh create mode 100644 bin/tests/system/nsupdate/update_test.pl (limited to 'bin/tests/system/nsupdate') diff --git a/bin/tests/system/nsupdate/clean.sh b/bin/tests/system/nsupdate/clean.sh new file mode 100644 index 0000000..565c97b --- /dev/null +++ b/bin/tests/system/nsupdate/clean.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2000, 2001 Internet Software Consortium. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# $Id: clean.sh,v 1.12 2007/09/26 03:22:44 marka Exp $ + +# +# Clean up after zone transfer tests. +# + +rm -f dig.out.ns1 dig.out.ns2 dig.out.ns1.after ns1/*.jnl ns2/*.jnl \ + ns1/example.db ns1/update.db +rm -f ns2/example.bk +rm -f ns2/update.bk +rm -f */named.memstats diff --git a/bin/tests/system/nsupdate/knowngood.ns1.after b/bin/tests/system/nsupdate/knowngood.ns1.after new file mode 100644 index 0000000..32e1c8d --- /dev/null +++ b/bin/tests/system/nsupdate/knowngood.ns1.after @@ -0,0 +1,99 @@ +example.nil. 300 IN SOA ns1.example.nil. hostmaster.example.nil. 2 2000 2000 1814400 3600 +example.nil. 300 IN NS ns1.example.nil. +example.nil. 300 IN NS ns2.example.nil. +*.example.nil. 300 IN MX 10 mail.example.nil. +a.example.nil. 300 IN TXT "foo foo foo" +a.example.nil. 300 IN PTR foo.net. +a01.example.nil. 3600 IN A 0.0.0.0 +a02.example.nil. 3600 IN A 255.255.255.255 +a601.example.nil. 3600 IN AAAA ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff +afsdb01.example.nil. 3600 IN AFSDB 0 hostname.example.nil. +afsdb02.example.nil. 3600 IN AFSDB 65535 . +b.example.nil. 300 IN CNAME foo.net. +c.example.nil. 300 IN A 73.80.65.49 +cert01.example.nil. 3600 IN CERT 65534 65535 PRIVATEOID MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgiWCn/GxHhai6V AuHAoNUz4YoU1tVfSCSqQYn6//11U6Nld80jEeC8aTrO+KKmCaY= +cname01.example.nil. 3600 IN CNAME cname-target. +cname02.example.nil. 3600 IN CNAME cname-target.example.nil. +cname03.example.nil. 3600 IN CNAME . +d.example.nil. 300 IN A 73.80.65.49 +dname01.example.nil. 3600 IN DNAME dname-target. +dname02.example.nil. 3600 IN DNAME dname-target.example.nil. +dname03.example.nil. 3600 IN DNAME . +e.example.nil. 300 IN MX 10 mail.example.nil. +e.example.nil. 300 IN TXT "one" +e.example.nil. 300 IN TXT "two" +e.example.nil. 300 IN TXT "three" +e.example.nil. 300 IN A 73.80.65.49 +e.example.nil. 300 IN A 73.80.65.50 +e.example.nil. 300 IN A 73.80.65.51 +e.example.nil. 300 IN A 73.80.65.52 +f.example.nil. 300 IN A 73.80.65.52 +gpos01.example.nil. 3600 IN GPOS "-22.6882" "116.8652" "250.0" +gpos02.example.nil. 3600 IN GPOS "" "" "" +hinfo01.example.nil. 3600 IN HINFO "Generic PC clone" "NetBSD-1.4" +hinfo02.example.nil. 3600 IN HINFO "PC" "NetBSD" +isdn01.example.nil. 3600 IN ISDN "isdn-address" +isdn02.example.nil. 3600 IN ISDN "isdn-address" "subaddress" +isdn03.example.nil. 3600 IN ISDN "isdn-address" +isdn04.example.nil. 3600 IN ISDN "isdn-address" "subaddress" +key01.example.nil. 3600 IN KEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aRyzWZriO6i2od GWWQVucZqKVsENW91IOW4vqudngPZsY3GvQ/xVA8/7pyFj6b7Esga60z yGW6LFe9r8n6paHrlG5ojqf0BaqHT+8= +kx01.example.nil. 3600 IN KX 10 kdc.example.nil. +kx02.example.nil. 3600 IN KX 10 . +loc01.example.nil. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m +loc02.example.nil. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m +mb01.example.nil. 3600 IN MG madname.example.nil. +mb02.example.nil. 3600 IN MG . +mg01.example.nil. 3600 IN MG mgmname.example.nil. +mg02.example.nil. 3600 IN MG . +minfo01.example.nil. 3600 IN MINFO rmailbx.example.nil. emailbx.example.nil. +minfo02.example.nil. 3600 IN MINFO . . +mr01.example.nil. 3600 IN MR mrname.example.nil. +mr02.example.nil. 3600 IN MR . +mx01.example.nil. 3600 IN MX 10 mail.example.nil. +mx02.example.nil. 3600 IN MX 10 . +naptr01.example.nil. 3600 IN NAPTR 0 0 "" "" "" . +naptr02.example.nil. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +ns1.example.nil. 300 IN A 10.53.0.1 +ns2.example.nil. 300 IN A 10.53.0.2 +nsap-ptr01.example.nil. 3600 IN NSAP-PTR . +nsap-ptr01.example.nil. 3600 IN NSAP-PTR foo. +nsap01.example.nil. 3600 IN NSAP 0x47000580005a0000000001e133ffffff00016100 +nsap02.example.nil. 3600 IN NSAP 0x47000580005a0000000001e133ffffff00016100 +nxt01.example.nil. 3600 IN NXT a.secure.example.nil. NS SOA MX SIG KEY LOC NXT +nxt02.example.nil. 3600 IN NXT . NSAP-PTR NXT +nxt03.example.nil. 3600 IN NXT . A +nxt04.example.nil. 3600 IN NXT . 127 +ptr01.example.nil. 3600 IN PTR example.nil. +px01.example.nil. 3600 IN PX 65535 foo. bar. +px02.example.nil. 3600 IN PX 65535 . . +rp01.example.nil. 3600 IN RP mbox-dname.example.nil. txt-dname.example.nil. +rp02.example.nil. 3600 IN RP . . +rt01.example.nil. 3600 IN RT 0 intermediate-host.example.nil. +rt02.example.nil. 3600 IN RT 65535 . +s.example.nil. 300 IN NS ns.s.example.nil. +ns.s.example.nil. 300 IN A 73.80.65.49 +sig01.example.nil. 3600 IN SIG NXT 1 3 3600 20000102030405 19961211100908 2143 foo.example.nil. MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgiWCn/GxHhai6V AuHAoNUz4YoU1tVfSCSqQYn6//11U6Nld80jEeC8aTrO+KKmCaY= +srv01.example.nil. 3600 IN SRV 0 0 0 . +srv02.example.nil. 3600 IN SRV 65535 65535 65535 old-slow-box.example.com. +txt01.example.nil. 3600 IN TXT "foo" +txt02.example.nil. 3600 IN TXT "foo" "bar" +txt03.example.nil. 3600 IN TXT "foo" +txt04.example.nil. 3600 IN TXT "foo" "bar" +txt05.example.nil. 3600 IN TXT "foo bar" +txt06.example.nil. 3600 IN TXT "foo bar" +txt07.example.nil. 3600 IN TXT "foo bar" +txt08.example.nil. 3600 IN TXT "foo\010bar" +txt09.example.nil. 3600 IN TXT "foo\010bar" +txt10.example.nil. 3600 IN TXT "foo bar" +txt11.example.nil. 3600 IN TXT "\"foo\"" +txt12.example.nil. 3600 IN TXT "\"foo\"" +u.example.nil. 300 IN TXT "txt-not-in-nxt" +a.u.example.nil. 300 IN A 73.80.65.49 +b.u.example.nil. 300 IN A 73.80.65.49 +updated.example.nil. 600 IN TXT "Foo" +updated.example.nil. 600 IN A 10.10.10.1 +wks01.example.nil. 3600 IN WKS 10.0.0.1 6 0 1 2 21 23 +wks02.example.nil. 3600 IN WKS 10.0.0.1 17 0 1 2 53 +wks03.example.nil. 3600 IN WKS 10.0.0.2 6 65535 +x2501.example.nil. 3600 IN X25 "123456789" +example.nil. 300 IN SOA ns1.example.nil. hostmaster.example.nil. 2 2000 2000 1814400 3600 diff --git a/bin/tests/system/nsupdate/knowngood.ns1.afterstop b/bin/tests/system/nsupdate/knowngood.ns1.afterstop new file mode 100644 index 0000000..e871d4c --- /dev/null +++ b/bin/tests/system/nsupdate/knowngood.ns1.afterstop @@ -0,0 +1,3 @@ +updated4.example.nil. 600 IN A 10.10.10.3 +example.nil. 300 IN NS ns1.example.nil. +example.nil. 300 IN NS ns2.example.nil. diff --git a/bin/tests/system/nsupdate/knowngood.ns1.before b/bin/tests/system/nsupdate/knowngood.ns1.before new file mode 100644 index 0000000..e108c2a --- /dev/null +++ b/bin/tests/system/nsupdate/knowngood.ns1.before @@ -0,0 +1,98 @@ +example.nil. 300 IN SOA ns1.example.nil. hostmaster.example.nil. 1 2000 2000 1814400 3600 +example.nil. 300 IN NS ns1.example.nil. +example.nil. 300 IN NS ns2.example.nil. +*.example.nil. 300 IN MX 10 mail.example.nil. +a.example.nil. 300 IN TXT "foo foo foo" +a.example.nil. 300 IN PTR foo.net. +a01.example.nil. 3600 IN A 0.0.0.0 +a02.example.nil. 3600 IN A 255.255.255.255 +a601.example.nil. 3600 IN AAAA ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff +afsdb01.example.nil. 3600 IN AFSDB 0 hostname.example.nil. +afsdb02.example.nil. 3600 IN AFSDB 65535 . +b.example.nil. 300 IN CNAME foo.net. +c.example.nil. 300 IN A 73.80.65.49 +cert01.example.nil. 3600 IN CERT 65534 65535 PRIVATEOID MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgiWCn/GxHhai6V AuHAoNUz4YoU1tVfSCSqQYn6//11U6Nld80jEeC8aTrO+KKmCaY= +cname01.example.nil. 3600 IN CNAME cname-target. +cname02.example.nil. 3600 IN CNAME cname-target.example.nil. +cname03.example.nil. 3600 IN CNAME . +d.example.nil. 300 IN A 73.80.65.49 +dname01.example.nil. 3600 IN DNAME dname-target. +dname02.example.nil. 3600 IN DNAME dname-target.example.nil. +dname03.example.nil. 3600 IN DNAME . +e.example.nil. 300 IN MX 10 mail.example.nil. +e.example.nil. 300 IN TXT "one" +e.example.nil. 300 IN TXT "two" +e.example.nil. 300 IN TXT "three" +e.example.nil. 300 IN A 73.80.65.49 +e.example.nil. 300 IN A 73.80.65.50 +e.example.nil. 300 IN A 73.80.65.51 +e.example.nil. 300 IN A 73.80.65.52 +f.example.nil. 300 IN A 73.80.65.52 +gpos01.example.nil. 3600 IN GPOS "-22.6882" "116.8652" "250.0" +gpos02.example.nil. 3600 IN GPOS "" "" "" +hinfo01.example.nil. 3600 IN HINFO "Generic PC clone" "NetBSD-1.4" +hinfo02.example.nil. 3600 IN HINFO "PC" "NetBSD" +isdn01.example.nil. 3600 IN ISDN "isdn-address" +isdn02.example.nil. 3600 IN ISDN "isdn-address" "subaddress" +isdn03.example.nil. 3600 IN ISDN "isdn-address" +isdn04.example.nil. 3600 IN ISDN "isdn-address" "subaddress" +key01.example.nil. 3600 IN KEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aRyzWZriO6i2od GWWQVucZqKVsENW91IOW4vqudngPZsY3GvQ/xVA8/7pyFj6b7Esga60z yGW6LFe9r8n6paHrlG5ojqf0BaqHT+8= +kx01.example.nil. 3600 IN KX 10 kdc.example.nil. +kx02.example.nil. 3600 IN KX 10 . +loc01.example.nil. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m +loc02.example.nil. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m +mb01.example.nil. 3600 IN MG madname.example.nil. +mb02.example.nil. 3600 IN MG . +mg01.example.nil. 3600 IN MG mgmname.example.nil. +mg02.example.nil. 3600 IN MG . +minfo01.example.nil. 3600 IN MINFO rmailbx.example.nil. emailbx.example.nil. +minfo02.example.nil. 3600 IN MINFO . . +mr01.example.nil. 3600 IN MR mrname.example.nil. +mr02.example.nil. 3600 IN MR . +mx01.example.nil. 3600 IN MX 10 mail.example.nil. +mx02.example.nil. 3600 IN MX 10 . +naptr01.example.nil. 3600 IN NAPTR 0 0 "" "" "" . +naptr02.example.nil. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +ns1.example.nil. 300 IN A 10.53.0.1 +ns2.example.nil. 300 IN A 10.53.0.2 +nsap-ptr01.example.nil. 3600 IN NSAP-PTR . +nsap-ptr01.example.nil. 3600 IN NSAP-PTR foo. +nsap01.example.nil. 3600 IN NSAP 0x47000580005a0000000001e133ffffff00016100 +nsap02.example.nil. 3600 IN NSAP 0x47000580005a0000000001e133ffffff00016100 +nxt01.example.nil. 3600 IN NXT a.secure.example.nil. NS SOA MX SIG KEY LOC NXT +nxt02.example.nil. 3600 IN NXT . NSAP-PTR NXT +nxt03.example.nil. 3600 IN NXT . A +nxt04.example.nil. 3600 IN NXT . 127 +ptr01.example.nil. 3600 IN PTR example.nil. +px01.example.nil. 3600 IN PX 65535 foo. bar. +px02.example.nil. 3600 IN PX 65535 . . +rp01.example.nil. 3600 IN RP mbox-dname.example.nil. txt-dname.example.nil. +rp02.example.nil. 3600 IN RP . . +rt01.example.nil. 3600 IN RT 0 intermediate-host.example.nil. +rt02.example.nil. 3600 IN RT 65535 . +s.example.nil. 300 IN NS ns.s.example.nil. +ns.s.example.nil. 300 IN A 73.80.65.49 +sig01.example.nil. 3600 IN SIG NXT 1 3 3600 20000102030405 19961211100908 2143 foo.example.nil. MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgiWCn/GxHhai6V AuHAoNUz4YoU1tVfSCSqQYn6//11U6Nld80jEeC8aTrO+KKmCaY= +srv01.example.nil. 3600 IN SRV 0 0 0 . +srv02.example.nil. 3600 IN SRV 65535 65535 65535 old-slow-box.example.com. +t.example.nil. 301 IN A 73.80.65.49 +txt01.example.nil. 3600 IN TXT "foo" +txt02.example.nil. 3600 IN TXT "foo" "bar" +txt03.example.nil. 3600 IN TXT "foo" +txt04.example.nil. 3600 IN TXT "foo" "bar" +txt05.example.nil. 3600 IN TXT "foo bar" +txt06.example.nil. 3600 IN TXT "foo bar" +txt07.example.nil. 3600 IN TXT "foo bar" +txt08.example.nil. 3600 IN TXT "foo\010bar" +txt09.example.nil. 3600 IN TXT "foo\010bar" +txt10.example.nil. 3600 IN TXT "foo bar" +txt11.example.nil. 3600 IN TXT "\"foo\"" +txt12.example.nil. 3600 IN TXT "\"foo\"" +u.example.nil. 300 IN TXT "txt-not-in-nxt" +a.u.example.nil. 300 IN A 73.80.65.49 +b.u.example.nil. 300 IN A 73.80.65.49 +wks01.example.nil. 3600 IN WKS 10.0.0.1 6 0 1 2 21 23 +wks02.example.nil. 3600 IN WKS 10.0.0.1 17 0 1 2 53 +wks03.example.nil. 3600 IN WKS 10.0.0.2 6 65535 +x2501.example.nil. 3600 IN X25 "123456789" +example.nil. 300 IN SOA ns1.example.nil. hostmaster.example.nil. 1 2000 2000 1814400 3600 diff --git a/bin/tests/system/nsupdate/ns1/example1.db b/bin/tests/system/nsupdate/ns1/example1.db new file mode 100644 index 0000000..e8856fe --- /dev/null +++ b/bin/tests/system/nsupdate/ns1/example1.db @@ -0,0 +1,152 @@ +; Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +; Copyright (C) 2000-2002 Internet Software Consortium. +; +; Permission to use, copy, modify, and/or distribute this software for any +; purpose with or without fee is hereby granted, provided that the above +; copyright notice and this permission notice appear in all copies. +; +; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +; PERFORMANCE OF THIS SOFTWARE. + +; $Id: example1.db,v 1.8 2007/06/19 23:47:04 tbox Exp $ + +$ORIGIN . +$TTL 300 ; 5 minutes +example.nil IN SOA ns1.example.nil. hostmaster.example.nil. ( + 1 ; serial + 2000 ; refresh (2000 seconds) + 2000 ; retry (2000 seconds) + 1814400 ; expire (3 weeks) + 3600 ; minimum (1 hour) + ) +example.nil. NS ns1.example.nil. +ns1.example.nil. A 10.53.0.1 +example.nil. NS ns2.example.nil. +ns2.example.nil. A 10.53.0.2 + +$ORIGIN example.nil. +* MX 10 mail +a TXT "foo foo foo" + PTR foo.net. +$TTL 3600 ; 1 hour +a01 A 0.0.0.0 +a02 A 255.255.255.255 +a601 AAAA ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff +afsdb01 AFSDB 0 hostname +afsdb02 AFSDB 65535 . +$TTL 300 ; 5 minutes +b CNAME foo.net. +c A 73.80.65.49 +$TTL 3600 ; 1 hour +cert01 CERT 65534 65535 PRIVATEOID ( + MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi + WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl + d80jEeC8aTrO+KKmCaY= ) +cname01 CNAME cname-target. +cname02 CNAME cname-target +cname03 CNAME . +$TTL 300 ; 5 minutes +d A 73.80.65.49 +$TTL 3600 ; 1 hour +dname01 DNAME dname-target. +dname02 DNAME dname-target +dname03 DNAME . +$TTL 300 ; 5 minutes +e MX 10 mail + TXT "one" + TXT "three" + TXT "two" + A 73.80.65.49 + A 73.80.65.50 + A 73.80.65.52 + A 73.80.65.51 +f A 73.80.65.52 +$TTL 3600 ; 1 hour +gpos01 GPOS "-22.6882" "116.8652" "250.0" +gpos02 GPOS "" "" "" +hinfo01 HINFO "Generic PC clone" "NetBSD-1.4" +hinfo02 HINFO "PC" "NetBSD" +isdn01 ISDN "isdn-address" +isdn02 ISDN "isdn-address" "subaddress" +isdn03 ISDN "isdn-address" +isdn04 ISDN "isdn-address" "subaddress" +key01 KEY 512 255 1 ( + AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR + yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3 + GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o + jqf0BaqHT+8= ) +kx01 KX 10 kdc +kx02 KX 10 . +loc01 LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m +loc02 LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m +mb01 MG madname +mb02 MG . +mg01 MG mgmname +mg02 MG . +minfo01 MINFO rmailbx emailbx +minfo02 MINFO . . +mr01 MR mrname +mr02 MR . +mx01 MX 10 mail +mx02 MX 10 . +naptr01 NAPTR 0 0 "" "" "" . +naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo. +nsap-ptr01 NSAP-PTR foo. + NSAP-PTR . +nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 +nsap02 NSAP 0x47000580005a0000000001e133ffffff00016100 +nxt01 NXT a.secure ( NS SOA MX SIG KEY LOC NXT ) +nxt02 NXT . ( NSAP-PTR NXT ) +nxt03 NXT . ( A ) +nxt04 NXT . ( 127 ) +ptr01 PTR example.nil. +px01 PX 65535 foo. bar. +px02 PX 65535 . . +rp01 RP mbox-dname txt-dname +rp02 RP . . +rt01 RT 0 intermediate-host +rt02 RT 65535 . +$TTL 300 ; 5 minutes +s NS ns.s +$ORIGIN s.example.nil. +ns A 73.80.65.49 +$ORIGIN example.nil. +$TTL 3600 ; 1 hour +sig01 SIG NXT 1 3 3600 20000102030405 ( + 19961211100908 2143 foo + MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi + WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl + d80jEeC8aTrO+KKmCaY= ) +srv01 SRV 0 0 0 . +srv02 SRV 65535 65535 65535 old-slow-box.example.com. +$TTL 301 ; 5 minutes 1 second +t A 73.80.65.49 +$TTL 3600 ; 1 hour +txt01 TXT "foo" +txt02 TXT "foo" "bar" +txt03 TXT "foo" +txt04 TXT "foo" "bar" +txt05 TXT "foo bar" +txt06 TXT "foo bar" +txt07 TXT "foo bar" +txt08 TXT "foo\010bar" +txt09 TXT "foo\010bar" +txt10 TXT "foo bar" +txt11 TXT "\"foo\"" +txt12 TXT "\"foo\"" +$TTL 300 ; 5 minutes +u TXT "txt-not-in-nxt" +$ORIGIN u.example.nil. +a A 73.80.65.49 +b A 73.80.65.49 +$ORIGIN example.nil. +$TTL 3600 ; 1 hour +wks01 WKS 10.0.0.1 6 ( 0 1 2 21 23 ) +wks02 WKS 10.0.0.1 17 ( 0 1 2 53 ) +wks03 WKS 10.0.0.2 6 ( 65535 ) +x2501 X25 "123456789" diff --git a/bin/tests/system/nsupdate/ns1/named.conf b/bin/tests/system/nsupdate/ns1/named.conf new file mode 100644 index 0000000..0c0e8ff --- /dev/null +++ b/bin/tests/system/nsupdate/ns1/named.conf @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2000, 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: named.conf,v 1.17 2007/06/19 23:47:04 tbox Exp $ */ + +controls { /* empty */ }; + +options { + query-source address 10.53.0.1; + notify-source 10.53.0.1; + transfer-source 10.53.0.1; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.1; }; + listen-on-v6 { none; }; + recursion no; + notify yes; +}; + +key rndc_key { + secret "1234abcd8765"; + algorithm hmac-md5; +}; + +controls { + inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; }; +}; + +zone "example.nil" { + type master; + file "example.db"; + check-integrity no; + allow-update { any; }; + allow-transfer { any; }; +}; + +zone "update.nil" { + type master; + file "update.db"; + check-integrity no; + allow-update { any; }; + allow-transfer { any; }; + also-notify { 10.53.0.2; }; +}; diff --git a/bin/tests/system/nsupdate/ns2/named.conf b/bin/tests/system/nsupdate/ns2/named.conf new file mode 100644 index 0000000..77e4013 --- /dev/null +++ b/bin/tests/system/nsupdate/ns2/named.conf @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2000, 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: named.conf,v 1.14 2007/06/18 23:47:30 tbox Exp $ */ + +controls { /* empty */ }; + +options { + query-source address 10.53.0.2; + notify-source 10.53.0.2; + transfer-source 10.53.0.2; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.2; }; + listen-on-v6 { none; }; + recursion yes; + acache-enable yes; + notify yes; +}; + +zone "example.nil" { + type slave; + masters { 10.53.0.1; }; + file "example.bk"; + allow-transfer { any; }; +}; + +zone "update.nil" { + type slave; + masters { 10.53.0.1; }; + file "update.bk"; + allow-transfer { any; }; +}; + + diff --git a/bin/tests/system/nsupdate/setup.sh b/bin/tests/system/nsupdate/setup.sh new file mode 100644 index 0000000..2d9d51b --- /dev/null +++ b/bin/tests/system/nsupdate/setup.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2000, 2001 Internet Software Consortium. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# $Id: setup.sh,v 1.10 2007/06/19 23:47:04 tbox Exp $ + +# +# jnl and database files MUST be removed before we start +# + +rm -f ns1/*.jnl ns1/example.db ns2/*.jnl ns2/example.bk + +cp -f ns1/example1.db ns1/example.db + +# update_test.pl has its own zone file because it +# requires a specific NS record set. +cat <<\EOF >ns1/update.db +$ORIGIN . +$TTL 300 ; 5 minutes +update.nil IN SOA ns1.example.nil. hostmaster.example.nil. ( + 1 ; serial + 2000 ; refresh (2000 seconds) + 2000 ; retry (2000 seconds) + 1814400 ; expire (3 weeks) + 3600 ; minimum (1 hour) + ) +update.nil. NS ns1.update.nil. +ns1.update.nil. A 10.53.0.2 +EOF diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh new file mode 100644 index 0000000..c6a26bb --- /dev/null +++ b/bin/tests/system/nsupdate/tests.sh @@ -0,0 +1,161 @@ +#!/bin/sh +# +# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2000, 2001 Internet Software Consortium. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# $Id: tests.sh,v 1.25 2007/06/19 23:47:04 tbox Exp $ + +SYSTEMTESTTOP=.. +. $SYSTEMTESTTOP/conf.sh + +status=0 + +echo "I:fetching first copy of zone before update" +$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ + @10.53.0.1 axfr -p 5300 > dig.out.ns1 || status=1 + +echo "I:fetching second copy of zone before update" +$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ + @10.53.0.1 axfr -p 5300 > dig.out.ns2 || status=1 + +echo "I:comparing pre-update copies to known good data" +$PERL ../digcomp.pl knowngood.ns1.before dig.out.ns1 || status=1 +$PERL ../digcomp.pl knowngood.ns1.before dig.out.ns2 || status=1 + +echo "I:updating zone" +# nsupdate will print a ">" prompt to stdout as it gets each input line. +$NSUPDATE < /dev/null || status=1 +server 10.53.0.1 5300 +update add updated.example.nil. 600 A 10.10.10.1 +update add updated.example.nil. 600 TXT Foo +update delete t.example.nil. + +END +echo "I:sleeping 15 seconds for server to incorporate changes" +sleep 15 + +echo "I:fetching first copy of zone after update" +$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ + @10.53.0.1 axfr -p 5300 > dig.out.ns1 || status=1 + +echo "I:fetching second copy of zone after update" +$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ + @10.53.0.2 axfr -p 5300 > dig.out.ns2 || status=1 + +echo "I:comparing post-update copies to known good data" +$PERL ../digcomp.pl knowngood.ns1.after dig.out.ns1 || status=1 +$PERL ../digcomp.pl knowngood.ns1.after dig.out.ns2 || status=1 + +if $PERL -e 'use Net::DNS;' 2>/dev/null +then + echo "I:running update.pl test" + $PERL update_test.pl -s 10.53.0.1 -p 5300 update.nil. || status=1 +else + echo "I:The second part of this test requires the Net::DNS library." >&2 +fi + +echo "I:fetching first copy of test zone" +$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ + @10.53.0.1 axfr -p 5300 > dig.out.ns1 || status=1 + +echo "I:fetching second copy of test zone" +$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ + @10.53.0.2 axfr -p 5300 > dig.out.ns2 || status=1 + +echo "I:comparing zones" +$PERL ../digcomp.pl dig.out.ns1 dig.out.ns2 || status=1 + +echo "I:SIGKILL and restart server ns1" +cd ns1 +kill -KILL `cat named.pid` +rm named.pid +cd .. +sleep 10 +if + $PERL $SYSTEMTESTTOP/start.pl --noclean . ns1 +then + echo "I:restarted server ns1" +else + echo "I:could not restart server ns1" + exit 1 +fi +sleep 10 + +echo "I:fetching ns1 after hard restart" +$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ + @10.53.0.1 axfr -p 5300 > dig.out.ns1.after || status=1 + +echo "I:comparing zones" +$PERL ../digcomp.pl dig.out.ns1 dig.out.ns1.after || status=1 + +echo "I:begin RT #482 regression test" + +echo "I:update master" +$NSUPDATE < /dev/null || status=1 +server 10.53.0.1 5300 +update add updated2.example.nil. 600 A 10.10.10.2 +update add updated2.example.nil. 600 TXT Bar +update delete c.example.nil. +send +END + +sleep 5 + +echo "I:SIGHUP slave" +kill -HUP `cat ns2/named.pid` + +sleep 5 + +echo "I:update master again" +$NSUPDATE < /dev/null || status=1 +server 10.53.0.1 5300 +update add updated3.example.nil. 600 A 10.10.10.3 +update add updated3.example.nil. 600 TXT Zap +update delete d.example.nil. +send +END + +sleep 5 + +echo "I:SIGHUP slave again" +kill -HUP `cat ns2/named.pid` + +sleep 5 + +if grep "out of sync" ns2/named.run +then + status=1 +fi + +echo "I:end RT #482 regression test" + +echo "I:testing that rndc stop updates the master file" +$NSUPDATE < /dev/null || status=1 +server 10.53.0.1 5300 +update add updated4.example.nil. 600 A 10.10.10.3 +send +END +$PERL $SYSTEMTESTTOP/stop.pl --use-rndc . ns1 +# Removing the journal file and restarting the server means +# that the data served by the new server process are exactly +# those dumped to the master file by "rndc stop". +rm -f ns1/*jnl +$PERL $SYSTEMTESTTOP/start.pl --noclean . ns1 +$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd updated4.example.nil.\ + @10.53.0.1 a -p 5300 > dig.out.ns1 || status=1 +$PERL ../digcomp.pl knowngood.ns1.afterstop dig.out.ns1 || status=1 + +echo "I:exit status: $status" +exit $status diff --git a/bin/tests/system/nsupdate/update_test.pl b/bin/tests/system/nsupdate/update_test.pl new file mode 100644 index 0000000..ef41b00 --- /dev/null +++ b/bin/tests/system/nsupdate/update_test.pl @@ -0,0 +1,426 @@ +#!/usr/bin/perl +# +# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2000, 2001 Internet Software Consortium. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# +# Dynamic update test suite. +# +# Usage: +# +# perl update_test.pl [-s server] [-p port] zone +# +# The server defaults to 127.0.0.1. +# The port defaults to 53. +# +# The "Special NS rules" tests will only work correctly if the +# zone has no NS records to begin with, or alternatively has a +# single NS record pointing at the name "ns1" (relative to +# the zone name). +# +# Installation notes: +# +# This program uses the Net::DNS::Resolver module. +# You can install it by saying +# +# perl -MCPAN -e "install Net::DNS" +# +# $Id: update_test.pl,v 1.10 2007/06/19 23:47:04 tbox Exp $ +# + +use Getopt::Std; +use Net::DNS; +use Net::DNS::Update; +use Net::DNS::Resolver; + +$opt_s = "127.0.0.1"; +$opt_p = 53; + +getopt('s:p:'); + +$res = new Net::DNS::Resolver; +$res->nameservers($opt_s); +$res->port($opt_p); +$res->defnames(0); # Do not append default domain. + +@ARGV == 1 or die + "usage: perl update_test.pl [-s server] [-p port] zone\n"; + +$zone = shift @ARGV; + +my $failures = 0; + +sub assert { + my ($cond, $explanation) = @_; + if (!$cond) { + print "I:Test Failed: $explanation ***\n"; + $failures++ + } +} + +sub test { + my ($expected, @records) = @_; + + my $update = new Net::DNS::Update("$zone"); + + foreach $rec (@records) { + $update->push(@$rec); + } + + $reply = $res->send($update); + + # Did it work? + if (defined $reply) { + my $rcode = $reply->header->rcode; + assert($rcode eq $expected, "expected $expected, got $rcode"); + } else { + print "I:Update failed: ", $res->errorstring, "\n"; + } +} + +sub section { + my ($msg) = @_; + print "I:$msg\n"; +} + +section("Delete any leftovers from previous tests"); +test("NOERROR", ["update", rr_del("a.$zone")]); +test("NOERROR", ["update", rr_del("b.$zone")]); +test("NOERROR", ["update", rr_del("c.$zone")]); +test("NOERROR", ["update", rr_del("d.$zone")]); +test("NOERROR", ["update", rr_del("e.$zone")]); +test("NOERROR", ["update", rr_del("f.$zone")]); +test("NOERROR", ["update", rr_del("ns.s.$zone")]); +test("NOERROR", ["update", rr_del("s.$zone")]); +test("NOERROR", ["update", rr_del("t.$zone")]); +test("NOERROR", ["update", rr_del("*.$zone")]); +test("NOERROR", ["update", rr_del("u.$zone")]); +test("NOERROR", ["update", rr_del("a.u.$zone")]); +test("NOERROR", ["update", rr_del("b.u.$zone")]); + +section("Simple prerequisites in the absence of data"); +# Name is in Use +test("NXDOMAIN", ["pre", yxdomain("a.$zone")]); +# RRset exists (value independent) +test("NXRRSET", ["pre", yxrrset("a.$zone A")]); +# Name is not in use +test("NOERROR", ["pre", nxdomain("a.$zone")]); +# RRset does not exist +test("NOERROR", ["pre", nxrrset("a.$zone A")]); +# RRset exists (value dependent) +test("NXRRSET", ["pre", yxrrset("a.$zone 300 A 73.80.65.49")]); + + +section ("Simple creation of data"); +test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.49")]); + +section ("Simple prerequisites in the presence of data"); +# Name is in use +test("NOERROR", ["pre", yxdomain("a.$zone")]); +# RRset exists (value independent) +test("NOERROR", ["pre", yxrrset("a.$zone A")]); +# Name is not in use +test("YXDOMAIN", ["pre", nxdomain("a.$zone")]); +# RRset does not exist +test("YXRRSET", ["pre", nxrrset("a.$zone A")]); +# RRset exists (value dependent) +test("NOERROR", ["pre", yxrrset("a.$zone 300 A 73.80.65.49")]); + +# +# Merging of RRsets +# +test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.50")]); + +section("Detailed tests of \"RRset exists (value dependent)\" prerequisites"); +test("NOERROR", ["pre", + yxrrset("a.$zone 300 A 73.80.65.49"), + yxrrset("a.$zone 300 A 73.80.65.50")]); +test("NOERROR", ["pre", + yxrrset("a.$zone 300 A 73.80.65.50"), + yxrrset("a.$zone 300 A 73.80.65.49")]); +test("NXRRSET", ["pre", yxrrset("a.$zone 300 A 73.80.65.49")]); +test("NXRRSET", ["pre", yxrrset("a.$zone 300 A 73.80.65.50")]); +test("NXRRSET", ["pre", + yxrrset("a.$zone 300 A 73.80.65.49"), + yxrrset("a.$zone 300 A 73.80.65.50"), + yxrrset("a.$zone 300 A 73.80.65.51")]); + + +section("Torture test of \"RRset exists (value dependent)\" prerequisites."); + +test("NOERROR", ["update", + rr_add("e.$zone 300 A 73.80.65.49"), + rr_add("e.$zone 300 TXT 'one'"), + rr_add("e.$zone 300 A 73.80.65.50")]); +test("NOERROR", ["update", + rr_add("e.$zone 300 A 73.80.65.52"), + rr_add("f.$zone 300 A 73.80.65.52"), + rr_add("e.$zone 300 A 73.80.65.51")]); +test("NOERROR", ["update", + rr_add("e.$zone 300 TXT 'three'"), + rr_add("e.$zone 300 TXT 'two'")]); +test("NOERROR", ["update", + rr_add("e.$zone 300 MX 10 mail.$zone")]); + +test("NOERROR", ["pre", + yxrrset("e.$zone 300 A 73.80.65.52"), + yxrrset("e.$zone 300 TXT 'two'"), + yxrrset("e.$zone 300 A 73.80.65.51"), + yxrrset("e.$zone 300 TXT 'three'"), + yxrrset("e.$zone 300 A 73.80.65.50"), + yxrrset("f.$zone 300 A 73.80.65.52"), + yxrrset("e.$zone 300 A 73.80.65.49"), + yxrrset("e.$zone 300 TXT 'one'")]); + + +section("Subtraction of RRsets"); +test("NOERROR", ["update", rr_del("a.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["pre", + yxrrset("a.$zone 300 A 73.80.65.50")]); + +test("NOERROR", ["update", rr_del("a.$zone 300 A 73.80.65.50")]); +test("NOERROR", ["pre", nxrrset("a.$zone 300 A")]); +test("NOERROR", ["pre", nxdomain("a.$zone")]); + +section("Other forms of deletion"); +test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.50")]); +test("NOERROR", ["update", rr_add("a.$zone 300 MX 10 mail.$zone")]); +test("NOERROR", ["update", rr_del("a.$zone 300 A")]); +test("NOERROR", ["pre", nxrrset("a.$zone 300 A")]); +test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.50")]); +test("NOERROR", ["update", rr_del("a.$zone")]); +test("NOERROR", ["pre", nxdomain("a.$zone")]); + +section("Case insensitivity"); +test("NOERROR", ["update", rr_add("a.$zone 300 PTR foo.net.")]); +test("NOERROR", ["pre", yxrrset("A.$zone 300 PTR fOo.NeT.")]); + +section("Special CNAME rules"); +test("NOERROR", ["update", rr_add("b.$zone 300 CNAME foo.net.")]); +test("NOERROR", ["update", rr_add("b.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["pre", yxrrset("b.$zone 300 CNAME foo.net.")]); +test("NOERROR", ["pre", nxrrset("b.$zone A")]); + +test("NOERROR", ["update", rr_add("c.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["update", rr_add("c.$zone 300 CNAME foo.net.")]); +test("NOERROR", ["pre", yxrrset("c.$zone A")]); +test("NOERROR", ["pre", nxrrset("c.$zone CNAME")]); + +# XXX should test with SIG, KEY, NXT, too. + +# +# Currently commented out because Net::DNS does not properly +# support WKS records. +# +#section("Special WKS rules"); +#test("NOERROR", ["update", rr_add("c.$zone 300 WKS 73.80.65.49 TCP telnet ftp")]); +#test("NOERROR", ["update", rr_add("c.$zone 300 WKS 73.80.65.49 UDP telnet ftp")]); +#test("NOERROR", ["update", rr_add("c.$zone 300 WKS 73.80.65.50 TCP telnet ftp")]); +#test("NOERROR", ["update", rr_add("c.$zone 300 WKS 73.80.65.49 TCP smtp")]); +#test("NOERROR", ["pre", +# yxrrset("c.$zone 300 WKS 73.80.65.49 TCP smtp"), +# yxrrset("c.$zone 300 WKS 73.80.65.49 UDP telnet ftp"), +# yxrrset("c.$zone 300 WKS 73.80.65.50 TCP telnet ftp")]); + + +section("Special NS rules"); + +# Deleting the last NS record using "Delete an RR from an RRset" +# should fail at the zone apex and work elsewhere. The pseudocode +# in RFC2136 says it should fail everywhere, but this is in conflict +# with the actual text. + +# Apex +test("NOERROR", ["update", + rr_add("$zone 300 NS ns1.$zone"), + rr_add("$zone 300 NS ns2.$zone")]); +test("NOERROR", ["update", rr_del("$zone 300 NS ns1.$zone")]); +test("NOERROR", ["update", rr_del("$zone 300 NS ns2.$zone")]); +test("NOERROR", ["pre", + yxrrset("$zone 300 NS ns2.$zone")]); + +# Non-apex +test("NOERROR", ["update", rr_add("n.$zone 300 NS ns1.$zone")]); +test("NOERROR", ["update", rr_del("n.$zone 300 NS ns1.$zone")]); +test("NOERROR", ["pre", nxrrset("n.$zone 300 NS")]); + +# Other ways of deleting NS records should also fail at the apex +# and work elsewhere. + +# Non-apex +test("NOERROR", ["update", rr_add("n.$zone 300 NS ns1.$zone")]); +test("NOERROR", ["update", rr_del("n.$zone 300 NS")]); +test("NOERROR", ["pre", nxrrset("n.$zone 300 NS")]); + +test("NOERROR", ["update", rr_add("n.$zone 300 NS ns1.$zone")]); +test("NOERROR", ["pre", yxrrset("n.$zone 300 NS")]); +test("NOERROR", ["update", rr_del("n.$zone")]); +test("NOERROR", ["pre", nxrrset("n.$zone 300 NS")]); + +# Apex +test("NOERROR", ["update", rr_del("$zone NS")]); +test("NOERROR", ["pre", + yxrrset("$zone 300 NS ns2.$zone")]); + +test("NOERROR", ["update", rr_del("$zone")]); +test("NOERROR", ["pre", + yxrrset("$zone 300 NS ns2.$zone")]); + +# They should not touch the SOA, either. + +test("NOERROR", ["update", rr_del("$zone SOA")]); +test("NOERROR", ["pre", yxrrset("$zone SOA")]); + + +section("Idempotency"); + +test("NOERROR", ["update", rr_add("d.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["pre", yxrrset("d.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["update", + rr_add("d.$zone 300 A 73.80.65.49"), + rr_del("d.$zone A")]); +test("NOERROR", ["pre", nxrrset("d.$zone 300 A 73.80.65.49")]); + +test("NOERROR", ["update", rr_del("d.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["pre", nxrrset("d.$zone 300 A")]); +test("NOERROR", ["update", + rr_del("d.$zone 300 A"), + rr_add("d.$zone 300 A 73.80.65.49")]); + +test("NOERROR", ["pre", yxrrset("d.$zone 300 A")]); + +section("Out-of-zone prerequisites and updates"); +test("NOTZONE", ["pre", yxrrset("a.somewhere.else. 300 A 73.80.65.49")]); +test("NOTZONE", ["update", rr_add("a.somewhere.else. 300 A 73.80.65.49")]); + + +section("Glue"); +test("NOERROR", ["update", rr_add("s.$zone 300 NS ns.s.$zone")]); +test("NOERROR", ["update", rr_add("ns.s.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["pre", yxrrset("ns.s.$zone 300 A 73.80.65.49")]); + +section("Wildcards"); +test("NOERROR", ["update", rr_add("*.$zone 300 MX 10 mail.$zone")]); +test("NOERROR", ["pre", yxrrset("*.$zone 300 MX 10 mail.$zone")]); +test("NXRRSET", ["pre", yxrrset("w.$zone 300 MX 10 mail.$zone")]); +test("NOERROR", ["pre", nxrrset("w.$zone MX")]); +test("NOERROR", ["pre", nxdomain("w.$zone")]); + + +section("SOA serial handling"); + +my $soatimers = "20 20 1814400 3600"; + +# Get the current SOA serial number. +my $query = $res->query($zone, "SOA"); +my ($old_soa) = $query->answer; + +my $old_serial = $old_soa->serial; + +# Increment it by 10. +my $new_serial = $old_serial + 10; +if ($new_serial > 0xFFFFFFFF) { + $new_serial -= 0x80000000; + $new_serial -= 0x80000000; +} + +# Replace the SOA with a new one. +test("NOERROR", ["update", rr_add("$zone 300 SOA mname1. . $new_serial $soatimers")]); + +# Check that the SOA really got replaced. +($db_soa) = $res->query($zone, "SOA")->answer; +assert($db_soa->mname eq "mname1"); + +# Check that attempts to decrement the serial number are ignored. +$new_serial = $old_serial - 10; +if ($new_serial < 0) { + $new_serial += 0x80000000; + $new_serial += 0x80000000; +} +test("NOERROR", ["update", rr_add("$zone 300 SOA mname2. . $new_serial $soatimers")]); +assert($db_soa->mname eq "mname1"); + +# Check that attempts to leave the serial number unchanged are ignored. +($old_soa) = $res->query($zone, "SOA")->answer; +$old_serial = $old_soa->serial; +test("NOERROR", ["update", rr_add("$zone 300 SOA mname3. . $old_serial " . + $soatimers)]); +($db_soa) = $res->query($zone, "SOA")->answer; +assert($db_soa->mname eq "mname1"); + +# +# Currently commented out because Net::DNS does not properly +# support multiple strings in TXT records. +# +#section("Big data"); +#test("NOERROR", ["update", rr_add("a.$zone 300 TXT aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc")]); +#test("NOERROR", ["update", rr_del("a.$zone 300 TXT aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc")]); +test("NOERROR", ["update", rr_add("a.$zone 300 TXT " . ("foo " x 3))]); + +section("Updating TTLs only"); + +test("NOERROR", ["update", rr_add("t.$zone 300 A 73.80.65.49")]); +($a) = $res->query("t.$zone", "A")->answer; +$ttl = $a->ttl; +assert($ttl == 300, "incorrect TTL value $ttl != 300"); +test("NOERROR", ["update", + rr_del("t.$zone 300 A 73.80.65.49"), + rr_add("t.$zone 301 A 73.80.65.49")]); +($a) = $res->query("t.$zone", "A")->answer; +$ttl = $a->ttl; +assert($ttl == 301, "incorrect TTL value $ttl != 301"); + +# Add an RR that is identical to an existing one except for the TTL. +# RFC2136 is not clear about what this should do; it says "duplicate RRs +# will be silently ignored" but is an RR differing only in TTL +# to be considered a duplicate or not? The test assumes that it +# should not be considered a duplicate. +test("NOERROR", ["update", rr_add("t.$zone 302 A 73.80.65.50")]); +($a) = $res->query("t.$zone", "A")->answer; +$ttl = $a->ttl; +assert($ttl == 302, "incorrect TTL value $ttl != 302"); + +section("TTL normalization"); + +# The desired behaviour is that the old RRs get their TTL +# changed to match the new one. RFC2136 does not explicitly +# specify this, but I think it makes more sense than the +# alternatives. + +test("NOERROR", ["update", rr_add("t.$zone 303 A 73.80.65.51")]); +(@answers) = $res->query("t.$zone", "A")->answer; +$nanswers = scalar @answers; +assert($nanswers == 3, "wrong number of answers $nanswers != 3"); +foreach $a (@answers) { + $ttl = $a->ttl; + assert($ttl == 303, "incorrect TTL value $ttl != 303"); +} + +section("Obscuring existing data by zone cut"); +test("NOERROR", ["update", rr_add("a.u.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["update", rr_add("b.u.$zone 300 A 73.80.65.49")]); +test("NOERROR", ["update", rr_add("u.$zone 300 TXT txt-not-in-nxt")]); +test("NOERROR", ["update", rr_add("u.$zone 300 NS ns.u.$zone")]); + +test("NOERROR", ["update", rr_del("u.$zone 300 NS ns.u.$zone")]); + +if ($failures) { + print "I:$failures tests failed.\n"; +} else { + print "I:All tests successful.\n"; +} +exit $failures; -- cgit