[SCM] Samba Shared Repository - branch master updated
Kai Blin
kai at samba.org
Thu Nov 24 06:11:03 MST 2011
The branch, master has been updated
via 9f1eb8a s4 dns: Test QCLASS_NONE query
via 8685a35 s4 dns: Test QTYPE_ALL query
via 16d9ebb s4 dns: Check more of the returned values for the A query
via 1a599da s4 dns: Move dns_transaction_udp to other helper functions
from 12123e7 pidl:Samba4/NDR/Parser: don't generate code for [ignore] pointers
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9f1eb8ab8ef17a48653f3af51cfd2e678b032595
Author: Kai Blin <kai at samba.org>
Date: Thu Nov 24 12:14:55 2011 +0100
s4 dns: Test QCLASS_NONE query
Autobuild-User: Kai Blin <kai at samba.org>
Autobuild-Date: Thu Nov 24 14:10:45 CET 2011 on sn-devel-104
commit 8685a35e9c3ce9d84ef8c1b9af12213701e50fa8
Author: Kai Blin <kai at samba.org>
Date: Thu Nov 24 12:11:26 2011 +0100
s4 dns: Test QTYPE_ALL query
commit 16d9ebb396db2552de77706b644f299a3c2be79d
Author: Kai Blin <kai at samba.org>
Date: Thu Nov 24 12:10:40 2011 +0100
s4 dns: Check more of the returned values for the A query
commit 1a599da550fb54fd6fb4cc2db827e7ea435ad51d
Author: Kai Blin <kai at samba.org>
Date: Thu Nov 24 12:09:58 2011 +0100
s4 dns: Move dns_transaction_udp to other helper functions
-----------------------------------------------------------------------
Summary of changes:
source4/scripting/python/samba/tests/dns.py | 69 ++++++++++++++++++++++-----
1 files changed, 56 insertions(+), 13 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/scripting/python/samba/tests/dns.py b/source4/scripting/python/samba/tests/dns.py
index 25505d9..df10b71 100644
--- a/source4/scripting/python/samba/tests/dns.py
+++ b/source4/scripting/python/samba/tests/dns.py
@@ -66,6 +66,20 @@ class DNSTest(TestCase):
"Helper to get dns domain"
return os.getenv('REALM', 'example.com').lower()
+ def dns_transaction_udp(self, packet, host=os.getenv('DC_SERVER_IP')):
+ "send a DNS query and read the reply"
+ s = None
+ try:
+ send_packet = ndr.ndr_pack(packet)
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
+ s.connect((host, 53))
+ s.send(send_packet, 0)
+ recv_packet = s.recv(2048, 0)
+ return ndr.ndr_unpack(dns.name_packet, recv_packet)
+ finally:
+ if s is not None:
+ s.close()
+
def test_one_a_query(self):
"create a query packet containing one query record"
p = self.make_name_packet(dns.DNS_OPCODE_QUERY)
@@ -80,6 +94,9 @@ class DNSTest(TestCase):
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('DC_SERVER_IP'))
def test_two_queries(self):
"create a query packet containing two query records"
@@ -98,19 +115,45 @@ class DNSTest(TestCase):
response = self.dns_transaction_udp(p)
self.assert_dns_rcode_equals(response, dns.DNS_RCODE_FORMERR)
- def dns_transaction_udp(self, packet, host=os.getenv('DC_SERVER_IP')):
- "send a DNS query and read the reply"
- s = None
- try:
- send_packet = ndr.ndr_pack(packet)
- s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
- s.connect((host, 53))
- s.send(send_packet, 0)
- recv_packet = s.recv(2048, 0)
- return ndr.ndr_unpack(dns.name_packet, recv_packet)
- finally:
- if s is not None:
- s.close()
+ def test_qtype_all_query(self):
+ "create a QTYPE_ALL query"
+ p = self.make_name_packet(dns.DNS_OPCODE_QUERY)
+ questions = []
+
+ name = "%s.%s" % (os.getenv('DC_SERVER'), self.get_dns_domain())
+ q = self.make_name_question(name, dns.DNS_QTYPE_ALL, dns.DNS_QCLASS_IN)
+ print "asking for ", q.name
+ questions.append(q)
+
+ self.finish_name_packet(p, questions)
+ response = self.dns_transaction_udp(p)
+
+ num_answers = 1
+ dc_ipv6 = os.getenv('DC_SERVER_IPV6')
+ if dc_ipv6 is not None:
+ num_answers += 1
+
+ self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
+ self.assert_dns_opcode_equals(response, dns.DNS_OPCODE_QUERY)
+ self.assertEquals(response.ancount, num_answers)
+ self.assertEquals(response.answers[0].rdata,
+ os.getenv('DC_SERVER_IP'))
+ if dc_ipv6 is not None:
+ self.assertEquals(response.answers[1].rdata, dc_ipv6)
+
+ def test_qclass_none_query(self):
+ "create a QCLASS_NONE query"
+ p = self.make_name_packet(dns.DNS_OPCODE_QUERY)
+ questions = []
+
+ name = "%s.%s" % (os.getenv('DC_SERVER'), self.get_dns_domain())
+ q = self.make_name_question(name, dns.DNS_QTYPE_ALL, dns.DNS_QCLASS_NONE)
+ questions.append(q)
+
+ self.finish_name_packet(p, questions)
+ response = self.dns_transaction_udp(p)
+ self.assert_dns_rcode_equals(response, dns.DNS_RCODE_NOTIMP)
+
if __name__ == "__main__":
import unittest
--
Samba Shared Repository
More information about the samba-cvs
mailing list