summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-09-21 23:06:13 +0200
committerStefan Metzmacher <metze@samba.org>2012-09-22 06:08:04 +0200
commitcb157e19cb6e96f319008c7178d04bfe7b30b5b4 (patch)
tree4851d1a9d70f5184041426e8c04fab2231ecd0d9 /source4
parenteacdd9f730c09bc59e3906e4f2eff6b8b3051169 (diff)
downloadsamba-cb157e19cb6e96f319008c7178d04bfe7b30b5b4.tar.gz
samba-cb157e19cb6e96f319008c7178d04bfe7b30b5b4.tar.bz2
samba-cb157e19cb6e96f319008c7178d04bfe7b30b5b4.zip
s4:dns.py: reproducer for (bug #9184)
metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sat Sep 22 06:08:05 CEST 2012 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/tests/dns.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/tests/dns.py b/source4/scripting/python/samba/tests/dns.py
index 3eee306d43..327e166314 100644
--- a/source4/scripting/python/samba/tests/dns.py
+++ b/source4/scripting/python/samba/tests/dns.py
@@ -547,6 +547,35 @@ class TestComplexQueries(DNSTest):
self.assertEquals(response.answers[1].rdata,
os.getenv('SERVER_IP'))
+class TestInvalidQueries(DNSTest):
+
+ def test_one_a_query(self):
+ "send 0 bytes follows by create a query packet containing one query record"
+
+ s = None
+ try:
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
+ s.connect((os.getenv('SERVER_IP'), 53))
+ s.send("", 0)
+ finally:
+ if s is not None:
+ s.close()
+
+ p = self.make_name_packet(dns.DNS_OPCODE_QUERY)
+ questions = []
+
+ name = "%s.%s" % (os.getenv('SERVER'), self.get_dns_domain())
+ q = self.make_name_question(name, dns.DNS_QTYPE_A, dns.DNS_QCLASS_IN)
+ print "asking for ", q.name
+ questions.append(q)
+
+ self.finish_name_packet(p, questions)
+ response = self.dns_transaction_udp(p)
+ self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
+ self.assert_dns_opcode_equals(response, dns.DNS_OPCODE_QUERY)
+ self.assertEquals(response.ancount, 1)
+ self.assertEquals(response.answers[0].rdata,
+ os.getenv('SERVER_IP'))
if __name__ == "__main__":
import unittest