diff options
author | Amitay Isaacs <amitay@gmail.com> | 2011-12-15 19:45:22 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2011-12-23 16:18:24 +1100 |
commit | 07639b502382a3c708350bdf4ca19d9437e0beaa (patch) | |
tree | f14ac9aa2a690c83d96e32eeef16f4f64b38f6a6 | |
parent | fe0e08acfb1f183178c1277491778c8f0a6219d8 (diff) | |
download | samba-07639b502382a3c708350bdf4ca19d9437e0beaa.tar.gz samba-07639b502382a3c708350bdf4ca19d9437e0beaa.tar.bz2 samba-07639b502382a3c708350bdf4ca19d9437e0beaa.zip |
s4:rpc-dnsserver: Fix the enumeration of DNS records
If a node has data and children, do not return the children unless
the node is the top level node.
-rw-r--r-- | source4/rpc_server/dnsserver/dnsdata.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source4/rpc_server/dnsserver/dnsdata.c b/source4/rpc_server/dnsserver/dnsdata.c index 535996036d..b2ab2d9ff5 100644 --- a/source4/rpc_server/dnsserver/dnsdata.c +++ b/source4/rpc_server/dnsserver/dnsdata.c @@ -617,6 +617,11 @@ struct dns_tree *dns_build_tree(TALLOC_CTX *mem_ctx, const char *name, struct ld goto failed; } + /* If the node is on leaf, then add record data */ + if (match_count+1 == ncount) { + tree->data = res->msgs[i]; + } + /* Add missing name components */ for (level=match_count+1; level<ncount; level++) { if (tree->level == rootcount+1) { @@ -754,6 +759,11 @@ WERROR dns_fill_records_array(TALLOC_CTX *mem_ctx, return WERR_OK; } + /* Do not return RR records, if the node has children */ + if (branch_name != NULL && num_children > 0) { + return WERR_OK; + } + ptr = ldb_msg_find_attr_as_string(msg, "name", NULL); el = ldb_msg_find_element(msg, "dnsRecord"); if (el == NULL || el->values == 0) { |