The branch, master has been updated
       via  c01efc1 s4 dns: Update requests with QCLASS != IN or ALL trigger 
NOTIMPLEMENTED errors
       via  358a81e s4 dns: Add test to prove two updates in one packet are a 
FORMERR
       via  509acc7 s4 dns: More explicitly use the first question of an update 
packet only
       via  3fbb76c s4 dns: Get rid of const qualifier for prereqs, we do need 
to allocate those
      from  85f8d97 Revert "Install (platform-independent) python scripts to 
the PYTHONDIR rather than PYTHONARCHDIR."

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c01efc1207b097517623d71b2ed9a24bb9c255de
Author: Kai Blin <[email protected]>
Date:   Fri Dec 9 01:26:39 2011 +0100

    s4 dns: Update requests with QCLASS != IN or ALL trigger NOTIMPLEMENTED 
errors
    
    Autobuild-User: Kai Blin <[email protected]>
    Autobuild-Date: Fri Dec  9 03:32:28 CET 2011 on sn-devel-104

commit 358a81eff5279a69270964226b553fb5243ecb84
Author: Kai Blin <[email protected]>
Date:   Fri Dec 9 01:14:35 2011 +0100

    s4 dns: Add test to prove two updates in one packet are a FORMERR

commit 509acc71dd8534539021b0ec57dd83a841119793
Author: Kai Blin <[email protected]>
Date:   Fri Dec 9 00:59:34 2011 +0100

    s4 dns: More explicitly use the first question of an update packet only

commit 3fbb76c119eaa1becb2df72d54cd4685771628df
Author: Kai Blin <[email protected]>
Date:   Fri Dec 9 00:58:32 2011 +0100

    s4 dns: Get rid of const qualifier for prereqs, we do need to allocate those

-----------------------------------------------------------------------

Summary of changes:
 source4/dns_server/dns_server.h             |    6 ++--
 source4/dns_server/dns_update.c             |   13 ++++++++---
 source4/scripting/python/samba/tests/dns.py |   30 +++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dns_server/dns_server.h b/source4/dns_server/dns_server.h
index 28351e8..d658b2a 100644
--- a/source4/dns_server/dns_server.h
+++ b/source4/dns_server/dns_server.h
@@ -49,9 +49,9 @@ WERROR dns_server_process_query(struct dns_server *dns,
 WERROR dns_server_process_update(struct dns_server *dns,
                                 TALLOC_CTX *mem_ctx,
                                 struct dns_name_packet *in,
-                                const struct dns_res_rec *prereqs, uint16_t 
prereq_count,
-                                struct dns_res_rec **updates,      uint16_t 
*update_count,
-                                struct dns_res_rec **additional,   uint16_t 
*arcount);
+                                struct dns_res_rec *prereqs,     uint16_t 
prereq_count,
+                                struct dns_res_rec **updates,    uint16_t 
*update_count,
+                                struct dns_res_rec **additional, uint16_t 
*arcount);
 
 uint8_t werr_to_dns_err(WERROR werror);
 bool dns_name_match(const char *zone, const char *name, size_t *host_part_len);
diff --git a/source4/dns_server/dns_update.c b/source4/dns_server/dns_update.c
index a9fabf6..55589d2 100644
--- a/source4/dns_server/dns_update.c
+++ b/source4/dns_server/dns_update.c
@@ -126,9 +126,9 @@ static WERROR update_prescan(const struct dns_name_question 
*zone,
 WERROR dns_server_process_update(struct dns_server *dns,
                                 TALLOC_CTX *mem_ctx,
                                 struct dns_name_packet *in,
-                                const struct dns_res_rec *prereqs, uint16_t 
prereq_count,
-                                struct dns_res_rec **updates,      uint16_t 
*update_count,
-                                struct dns_res_rec **additional,   uint16_t 
*arcount)
+                                struct dns_res_rec *prereqs,     uint16_t 
prereq_count,
+                                struct dns_res_rec **updates,    uint16_t 
*update_count,
+                                struct dns_res_rec **additional, uint16_t 
*arcount)
 {
        struct dns_name_question *zone;
        const struct dns_server_zone *z;
@@ -140,7 +140,12 @@ WERROR dns_server_process_update(struct dns_server *dns,
                return DNS_ERR(FORMAT_ERROR);
        }
 
-       zone = in->questions;
+       zone = &in->questions[0];
+
+       if (zone->question_class != DNS_QCLASS_IN &&
+           zone->question_class != DNS_QCLASS_ANY) {
+               return DNS_ERR(NOT_IMPLEMENTED);
+       }
 
        if (zone->question_type != DNS_QTYPE_SOA) {
                return DNS_ERR(FORMAT_ERROR);
diff --git a/source4/scripting/python/samba/tests/dns.py 
b/source4/scripting/python/samba/tests/dns.py
index 9f53225..60003fc 100644
--- a/source4/scripting/python/samba/tests/dns.py
+++ b/source4/scripting/python/samba/tests/dns.py
@@ -187,6 +187,36 @@ class DNSTest(TestCase):
         self.assert_dns_opcode_equals(response, dns.DNS_OPCODE_QUERY)
         self.assertEquals(response.ancount, 1)
 
+    def test_two_updates(self):
+        "create two update requests"
+        p = self.make_name_packet(dns.DNS_OPCODE_UPDATE)
+        updates = []
+
+        name = "%s.%s" % (os.getenv('DC_SERVER'), self.get_dns_domain())
+        u = self.make_name_question(name, dns.DNS_QTYPE_A, dns.DNS_QCLASS_IN)
+        updates.append(u)
+
+        name = self.get_dns_domain()
+        u = self.make_name_question(name, dns.DNS_QTYPE_A, dns.DNS_QCLASS_IN)
+        updates.append(u)
+
+        self.finish_name_packet(p, updates)
+        response = self.dns_transaction_udp(p)
+        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_FORMERR)
+
+    def test_update_wrong_qclass(self):
+        "create update with DNS_QCLASS_NONE"
+        p = self.make_name_packet(dns.DNS_OPCODE_UPDATE)
+        updates = []
+
+        name = self.get_dns_domain()
+        u = self.make_name_question(name, dns.DNS_QTYPE_A, dns.DNS_QCLASS_NONE)
+        updates.append(u)
+
+        self.finish_name_packet(p, updates)
+        response = self.dns_transaction_udp(p)
+        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_NOTIMP)
+
 if __name__ == "__main__":
     import unittest
     unittest.main()


-- 
Samba Shared Repository

Reply via email to