diff options
author | Andrew Bartlett <abartlet@samba.org> | 2007-11-15 05:54:51 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:45:20 +0100 |
commit | f6312d1b5a55bedbed2d5bd85537663445ec2daf (patch) | |
tree | 10b2733e3fd876b0c74d73068ddfcfe5bb86c27f /source4 | |
parent | 3b6ff04631e51cfae9844db7ec7f49d6cdd03f1f (diff) | |
download | samba-f6312d1b5a55bedbed2d5bd85537663445ec2daf.tar.gz samba-f6312d1b5a55bedbed2d5bd85537663445ec2daf.tar.bz2 samba-f6312d1b5a55bedbed2d5bd85537663445ec2daf.zip |
r25962: Move to more modern ldb functions loading module list.
Andrew Bartlett
(This used to be commit c3bfcf44a49c6a19579c85fb3660331177a436fb)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/common/ldb_modules.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 845628d3ac..d2e55c048e 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -321,28 +321,29 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) return -1; } - ret = ldb_search(ldb, mods_dn, LDB_SCOPE_BASE, "", attrs, &res); + ret = ldb_search_exp_fmt(ldb, mods_dn, &res, mods_dn, LDB_SCOPE_BASE, attrs, "@LIST=*"); 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; + return ret; } else { - talloc_steal(mods_dn, res); - if (res->count == 0 || res->msgs[0]->num_elements == 0) { + const char *module_list; + if (res->count == 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; } 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; + module_list = ldb_msg_find_attr_as_string(res->msgs[0], "@LIST", NULL); + if (!module_list) { + ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db"); } - modules = ldb_modules_list_from_string(ldb, mem_ctx, - (const char *)res->msgs[0]->elements[0].values[0].data); - + module_list); } } |