s4 dns: Update requests with QCLASS != IN or ALL trigger NOTIMPLEMENTED errors
authorKai Blin <kai@samba.org>
Fri, 9 Dec 2011 00:26:39 +0000 (01:26 +0100)
committerKai Blin <kai@samba.org>
Fri, 9 Dec 2011 02:32:28 +0000 (03:32 +0100)
Autobuild-User: Kai Blin <kai@samba.org>
Autobuild-Date: Fri Dec  9 03:32:28 CET 2011 on sn-devel-104

source4/dns_server/dns_update.c
source4/scripting/python/samba/tests/dns.py

index a8c49998f79ce9aa25828144441a4e723975e6a1..55589d227a891b9525f0c5ae8dc6bf7c73d7d2de 100644 (file)
@@ -142,6 +142,11 @@ WERROR dns_server_process_update(struct dns_server *dns,
 
        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);
        }
index c95148b70e287e0d9be90b7f1a5b6d42d73b6a49..60003fcf7a356aa3d092d87d96c7e0cdc83ae084 100644 (file)
@@ -204,6 +204,18 @@ class DNSTest(TestCase):
         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