summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Cabrero <scabrero@samba.org>2019-10-08 13:29:28 +0200
committerSamuel Cabrero <scabrero@sn-devel-184>2019-11-08 11:01:29 +0000
commit8dbb8643499c495474f28071750cbfc2da5b60f0 (patch)
tree745ec9334a1c167509b67bf4b4703f1b78e7b045
parentf5f89b1b990a3de0e9366beef81cf1a2ce8374da (diff)
downloadsamba-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.py19
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)