From ec97506a51bf211409dedd6f14b5a40267879c94 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Mar 2005 21:59:02 +0000 Subject: r5664: simo, please look into this. It is possible for the number of elements in msg[0] to be 0, in which case we crash. This is a workaround. Also, if you could please split up this function into readable pieces. It's a bit of a mess at the moment. (This used to be commit 19a22f78c28a4b265f59df1b43c1bb6c9e58f736) --- source4/lib/ldb/common/ldb_modules.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index f8162aee8c..ee70a639fa 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -94,7 +94,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) char *modstr, *c, *p; ret = ldb_search(ldb, "", LDB_SCOPE_BASE, "dn=@MODULES", attrs, &msg); - if (ret == 0) { + if (ret == 0 || (ret == 1 && msg[0]->num_elements == 0)) { ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db\n"); } else { if (ret < 0) { @@ -184,6 +184,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) continue; } +#ifdef _SAMBA_BUILD_ if (strcmp(modules[i], "samldb") == 0) { current = samldb_module_init(ldb, options); if (!current) { @@ -193,6 +194,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) DLIST_ADD(ldb->modules, current); continue; } +#endif #ifdef HAVE_DLOPEN_DISABLED filename = talloc_asprintf(ldb, "%s.so", modules[i]); -- cgit