diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-05-07 22:43:36 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-05-09 21:18:52 +1000 |
commit | 6dfa851ce95b372c6c4bdd7a6c07c1ee183d1f7a (patch) | |
tree | ac6df4ca6dd5382d277a31c84ee720000a8d762c /source4/dsdb | |
parent | 23cafd5569729fe15f0c390cf5a276945662d8e8 (diff) | |
download | samba-6dfa851ce95b372c6c4bdd7a6c07c1ee183d1f7a.tar.gz samba-6dfa851ce95b372c6c4bdd7a6c07c1ee183d1f7a.tar.bz2 samba-6dfa851ce95b372c6c4bdd7a6c07c1ee183d1f7a.zip |
s4:dsdb Provide an intelegent fallback if not CN=Subnets is found
We may as well fall back rather than return NULL (which callers don't
do useful things with).
Andrew Bartlett
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/common/util.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 7064fcf67d..40f0a7f6c6 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -1607,7 +1607,7 @@ const char *samdb_client_site_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const struct ldb_val *val; const char *site_name = NULL, *l_subnet_name = NULL; const char *allow_list[2] = { NULL, NULL }; - unsigned int i; + unsigned int i, count; int cnt, ret; /* @@ -1632,13 +1632,17 @@ const char *samdb_client_site_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, ret = ldb_search(ldb, mem_ctx, &res, subnets_dn, LDB_SCOPE_ONELEVEL, attrs, NULL); - if (ret != LDB_SUCCESS) { + if (ret == LDB_ERR_NO_SUCH_OBJECT) { + count = 0; + } else if (ret != LDB_SUCCESS) { talloc_free(sites_container_dn); talloc_free(subnets_dn); return NULL; + } else { + count = res->count; } - for (i = 0; i < res->count; i++) { + for (i = 0; i < count; i++) { l_subnet_name = ldb_msg_find_attr_as_string(res->msgs[i], "cn", NULL); |