⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 update_test.pl

📁 bind 9.3结合mysql数据库
💻 PL
📖 第 1 页 / 共 2 页
字号:
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.# Apextest("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-apextest("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-apextest("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")]);# Apextest("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;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -