diff options
author | Gary Lockyer <gary@catalyst.net.nz> | 2019-02-14 09:18:20 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-02-14 05:03:24 +0100 |
commit | 2546f2609189ae6075f626de7eb9f63a083d3386 (patch) | |
tree | f50be794d83ce31daff6e510c25d2cdf2f8d600e /source4 | |
parent | 7fc379ce867ed18e1d4ac508bea4a6b90c59300f (diff) | |
download | samba-2546f2609189ae6075f626de7eb9f63a083d3386.tar.gz |
s4 dsdb util: samdb_client_site_name use dsdb_domain_count
Replace the call to samdb_search_count with dsdb_domain_count. As this
is the only remaining caller of samdb_search_count, replacing it will
allow the removal of samdb_search_count.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/common/util.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index f5496c7d17e..e2ed8405c93 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -1899,7 +1899,7 @@ const char *samdb_client_site_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *site_name = NULL, *l_subnet_name = NULL; const char *allow_list[2] = { NULL, NULL }; unsigned int i, count; - int cnt, ret; + int ret; /* * if we don't have a client ip e.g. ncalrpc @@ -1965,8 +1965,18 @@ const char *samdb_client_site_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, * is for sure the same as our server site). If more sites do * exist then we don't know which one to use and set the site * name to "". */ - cnt = samdb_search_count(ldb, mem_ctx, sites_container_dn, - "(objectClass=site)"); + size_t cnt = 0; + ret = dsdb_domain_count( + ldb, + &cnt, + sites_container_dn, + NULL, + LDB_SCOPE_SUBTREE, + "(objectClass=site)"); + if (ret != LDB_SUCCESS) { + site_name = NULL; + goto exit; + } if (cnt == 1) { site_name = samdb_server_site_name(ldb, mem_ctx); } else { @@ -1979,6 +1989,7 @@ const char *samdb_client_site_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, *subnet_name = talloc_strdup(mem_ctx, l_subnet_name); } +exit: talloc_free(sites_container_dn); talloc_free(subnets_dn); talloc_free(res); |