s4-rpc:dnsserver: Do not replace @ with zone_name in update operation
authorAmitay Isaacs <amitay@gmail.com>
Thu, 5 Jan 2012 22:26:49 +0000 (09:26 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 6 Jan 2012 00:04:49 +0000 (11:04 +1100)
This fixes the problem when updating DNS record for '@' or domain name.

source4/rpc_server/dnsserver/dcerpc_dnsserver.c

index 5f4009bafea82c6057b1c4ce2b9c98a914cff991..fac99e1cb6fba061b42d9293676a05a6db520eea 100644 (file)
@@ -1852,7 +1852,12 @@ static WERROR dnsserver_update_record(struct dnsserver_state *dsstate,
        tmp_ctx = talloc_new(mem_ctx);
        W_ERROR_HAVE_NO_MEMORY(tmp_ctx);
 
-       name = dns_split_node_name(tmp_ctx, node_name, z->name);
+       /* If node_name is @ or zone name, dns record is @ */
+       if (strcmp(node_name, "@") == 0 || strcmp(node_name, z->name) == 0) {
+               name = talloc_strdup(tmp_ctx, "@");
+       } else {
+               name = dns_split_node_name(tmp_ctx, node_name, z->name);
+       }
        W_ERROR_HAVE_NO_MEMORY_AND_FREE(name, tmp_ctx);
 
        if (add_buf != NULL) {