diff options
author | Samuel Cabrero <scabrero@samba.org> | 2019-10-08 13:29:28 +0200 |
---|---|---|
committer | Samuel Cabrero <scabrero@sn-devel-184> | 2019-11-08 11:01:29 +0000 |
commit | 8dbb8643499c495474f28071750cbfc2da5b60f0 (patch) | |
tree | 745ec9334a1c167509b67bf4b4703f1b78e7b045 | |
parent | f5f89b1b990a3de0e9366beef81cf1a2ce8374da (diff) | |
download | samba-8dbb8643499c495474f28071750cbfc2da5b60f0.tar.gz |
dns: Extend DNS tests to check the SOA record is always returned
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | python/samba/tests/dns.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/python/samba/tests/dns.py b/python/samba/tests/dns.py index 275d4fcd692..1dd1f549a33 100644 --- a/python/samba/tests/dns.py +++ b/python/samba/tests/dns.py @@ -264,6 +264,25 @@ class TestSimpleQueries(DNSTest): # But we do respond with an authority section self.assertEqual(response.nscount, 1) + def test_soa_unknown_hostname_query(self): + "create a SOA query for an unknown hostname" + p = self.make_name_packet(dns.DNS_OPCODE_QUERY) + questions = [] + + name = "foobar.%s" % (self.get_dns_domain()) + q = self.make_name_question(name, dns.DNS_QTYPE_SOA, dns.DNS_QCLASS_IN) + questions.append(q) + + self.finish_name_packet(p, questions) + (response, response_packet) =\ + self.dns_transaction_udp(p, host=server_ip) + self.assert_dns_rcode_equals(response, dns.DNS_RCODE_NXDOMAIN) + self.assert_dns_opcode_equals(response, dns.DNS_OPCODE_QUERY) + # We don't get SOA records for single hosts + self.assertEquals(response.ancount, 0) + # But we do respond with an authority section + self.assertEqual(response.nscount, 1) + def test_soa_domain_query(self): "create a SOA query for a domain" p = self.make_name_packet(dns.DNS_OPCODE_QUERY) |