s4 dns: More work on updates
authorKai Blin <kai@samba.org>
Mon, 11 Oct 2010 21:50:16 +0000 (23:50 +0200)
committerKai Blin <kai@samba.org>
Sat, 23 Oct 2010 10:17:06 +0000 (10:17 +0000)
librpc/idl/dns.idl
source4/dns_server/dns_server.c

index 486b16e50b382c275c6ae48bddffaccb2a0f0d21..90ac47a83113126117dc9287c8964e88e81e3336 100644 (file)
@@ -160,7 +160,7 @@ interface dns
                dns_qtype  rr_type;
                dns_qclass rr_class;
                uint32     ttl;
-               uint16     length;
+               uint16     length; /* Should be set to either UINT16_MAX or 0 */
                [switch_is(rr_type)] dns_rdata rdata;
                DATA_BLOB  unexpected;
        } dns_res_rec;
index fc759a48326d08ca9863ea509de1e9f5fee22850..1c45691efc08911883d1d53f91239746f32403f5 100644 (file)
@@ -286,6 +286,8 @@ static NTSTATUS handle_question(struct dns_server *dns,
                                continue;
                        }
 
+                       /* TODO: if the record actually is a DNS_QTYPE_A */
+
                        ZERO_STRUCT(ans[ai]);
                        ans[ai].name = talloc_strdup(ans, question->name);
                        ans[ai].rr_type = DNS_QTYPE_A;
@@ -425,15 +427,37 @@ static NTSTATUS dns_server_process_update(struct dns_server *dns,
                                          struct dns_res_rec **additional, uint16_t *arcount)
 {
        struct dns_name_question *zone;
+       const struct dns_server_zone *z;
+       size_t host_part_len = 0;
 
        if (in->qdcount != 1) {
-               return NT_STATUS_NOT_IMPLEMENTED;
+               return NT_STATUS_INVALID_PARAMETER;
        }
 
        zone = in->questions;
 
+       if (zone->question_type != DNS_QTYPE_SOA) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
        DEBUG(0, ("Got a dns update request.\n"));
 
+       for (z = dns->zones; z != NULL; z = z->next) {
+               bool match;
+
+               match = dns_name_match(z->name, zone->name, &host_part_len);
+               if (match) {
+                       break;
+               }
+       }
+
+       if (z == NULL) {
+               return NT_STATUS_FOOBAR;
+       }
+
+       if (host_part_len != 0) {
+               return NT_STATUS_NOT_IMPLEMENTED;
+       }
 
        return NT_STATUS_NOT_IMPLEMENTED;
 }