diff options
author | Amitay Isaacs <amitay@gmail.com> | 2011-12-15 19:45:10 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2011-12-23 16:17:10 +1100 |
commit | fe0e08acfb1f183178c1277491778c8f0a6219d8 (patch) | |
tree | 7805b3cd40b1964ef2349ff07c1c3f97b704b404 | |
parent | dbf5df5f8ff0868ac0346ab8a489a789c00c680e (diff) | |
download | samba-fe0e08acfb1f183178c1277491778c8f0a6219d8.tar.gz samba-fe0e08acfb1f183178c1277491778c8f0a6219d8.tar.bz2 samba-fe0e08acfb1f183178c1277491778c8f0a6219d8.zip |
s4:rpc-dnsserver: Use cached zone information to get rootservers
This removes the hardcoded search for DC=RootDNSServers, and uses
the cached zone information.
-rw-r--r-- | source4/rpc_server/dnsserver/dcerpc_dnsserver.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c index 2d9fadd91e..345cfb814e 100644 --- a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c +++ b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c @@ -1457,9 +1457,9 @@ static WERROR dnsserver_enumerate_root_records(struct dnsserver_state *dsstate, struct DNS_RPC_RECORDS_ARRAY **buffer) { TALLOC_CTX *tmp_ctx; + struct dnsserver_zone *z; const char * const attrs[] = { "name", "dnsRecord", NULL }; struct ldb_result *res; - struct ldb_dn *dn; struct DNS_RPC_RECORDS_ARRAY *recs; char **add_names; char *rname; @@ -1470,15 +1470,12 @@ static WERROR dnsserver_enumerate_root_records(struct dnsserver_state *dsstate, tmp_ctx = talloc_new(mem_ctx); W_ERROR_HAVE_NO_MEMORY(tmp_ctx); - dn = ldb_dn_copy(tmp_ctx, ldb_get_default_basedn(dsstate->samdb)); - W_ERROR_HAVE_NO_MEMORY_AND_FREE(dn, tmp_ctx); - - if (!ldb_dn_add_child_fmt(dn, "DC=RootDNSServers,CN=MicrosoftDNS,DC=DomainDnsZones")) { - talloc_free(tmp_ctx); - return WERR_NOMEM; + z = dnsserver_find_zone(dsstate->zones, "."); + if (z == NULL) { + return WERR_DNS_ERROR_NAME_DOES_NOT_EXIST; } - ret = ldb_search(dsstate->samdb, tmp_ctx, &res, dn, + ret = ldb_search(dsstate->samdb, tmp_ctx, &res, z->zone_dn, LDB_SCOPE_ONELEVEL, attrs, "(&(objectClass=dnsNode)(name=@))"); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); @@ -1510,7 +1507,7 @@ static WERROR dnsserver_enumerate_root_records(struct dnsserver_state *dsstate, /* Add any additional records */ if (select_flag & DNS_RPC_VIEW_ADDITIONAL_DATA) { for (i=0; i<add_count; i++) { - ret = ldb_search(dsstate->samdb, tmp_ctx, &res, dn, + ret = ldb_search(dsstate->samdb, tmp_ctx, &res, z->zone_dn, LDB_SCOPE_ONELEVEL, attrs, "(&(objectClass=dnsNode)(name=%s))", add_names[i]); if (ret != LDB_SUCCESS || res->count == 0) { |