diff options
author | Andrew Bartlett <abartlet@samba.org> | 2007-11-13 04:32:36 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:45:08 +0100 |
commit | 08dd389ddfe4da99ae8463c017608bc0b95f560f (patch) | |
tree | 309b5a514d316a47ce9d5395c80b6cadcf2c1498 /source4/lib | |
parent | f1ec8da56dd106481b9d79f5d590ee6ba26f7a4b (diff) | |
download | samba-08dd389ddfe4da99ae8463c017608bc0b95f560f.tar.gz samba-08dd389ddfe4da99ae8463c017608bc0b95f560f.tar.bz2 samba-08dd389ddfe4da99ae8463c017608bc0b95f560f.zip |
r25934: Handle a LDB_ERR_NO_SUCH_OBJECT return value when looking for the
modules.
This will be useful when we start enforcing validity in base DNs.
Andrew Bartlett
(This used to be commit aa8348a27a6938a1a26d4a7ed3b7405966202ad8)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/common/ldb_modules.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 2ffd49786b..845628d3ac 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -323,24 +323,27 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) ret = ldb_search(ldb, mods_dn, LDB_SCOPE_BASE, "", attrs, &res); - if (ret != LDB_SUCCESS) { + if (ret == LDB_ERR_NO_SUCH_OBJECT) { + ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db"); + } else if (ret != LDB_SUCCESS) { ldb_debug(ldb, LDB_DEBUG_FATAL, "ldb error (%s) occurred searching for modules, bailing out\n", ldb_errstring(ldb)); talloc_free(mem_ctx); return -1; - } - talloc_steal(mods_dn, res); - if (res->count == 0 || res->msgs[0]->num_elements == 0) { - ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db"); } else { - if (res->count > 1) { - ldb_debug(ldb, LDB_DEBUG_FATAL, "Too many records found (%d), bailing out\n", res->count); - talloc_free(mem_ctx); - return -1; + talloc_steal(mods_dn, res); + if (res->count == 0 || res->msgs[0]->num_elements == 0) { + ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db"); + } else { + if (res->count > 1) { + ldb_debug(ldb, LDB_DEBUG_FATAL, "Too many records found (%d), bailing out\n", res->count); + talloc_free(mem_ctx); + return -1; + } + + modules = ldb_modules_list_from_string(ldb, mem_ctx, + (const char *)res->msgs[0]->elements[0].values[0].data); + } - - modules = ldb_modules_list_from_string(ldb, mem_ctx, - (const char *)res->msgs[0]->elements[0].values[0].data); - } talloc_free(mods_dn); |