diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-10-13 09:44:55 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:20:59 -0500 |
commit | fa67b43ae8cf850b29e61d5e11e1764f8cd1282e (patch) | |
tree | 0b7e1f9812119cf1ff421a42f78c93d130a1ec3f /source4 | |
parent | f1ed6d2c9bf696b8b101ee9d4f0f0a3959ec8447 (diff) | |
download | samba-fa67b43ae8cf850b29e61d5e11e1764f8cd1282e.tar.gz samba-fa67b43ae8cf850b29e61d5e11e1764f8cd1282e.tar.bz2 samba-fa67b43ae8cf850b29e61d5e11e1764f8cd1282e.zip |
r19264: Clarify behaviour in ldb_search_callback() and provide more
information when modules fail to load.
Andrew Bartlett
(This used to be commit 512ef62f4a63fd90b67757b2c7b2e8ec83969204)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/common/ldb.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 28d1c7235a..7648abf795 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -208,7 +208,8 @@ int ldb_connect(struct ldb_context *ldb, const char *url, unsigned int flags, co } if (ldb_load_modules(ldb, options) != LDB_SUCCESS) { - ldb_debug(ldb, LDB_DEBUG_FATAL, "Unable to load modules for '%s'\n", url); + ldb_debug(ldb, LDB_DEBUG_FATAL, "Unable to load modules for %s: %s\n", + url, ldb_errstring(ldb)); return LDB_ERR_OTHER; } @@ -536,8 +537,9 @@ static int ldb_search_callback(struct ldb_context *ldb, void *context, struct ld if (!res || !ares) { goto error; } - - if (ares->type == LDB_REPLY_ENTRY) { + + switch (ares->type) { + case LDB_REPLY_ENTRY: res->msgs = talloc_realloc(res, res->msgs, struct ldb_message *, res->count + 2); if (! res->msgs) { goto error; @@ -547,9 +549,8 @@ static int ldb_search_callback(struct ldb_context *ldb, void *context, struct ld res->msgs[res->count] = talloc_move(res->msgs, &ares->message); res->count++; - } - - if (ares->type == LDB_REPLY_REFERRAL) { + break; + case LDB_REPLY_REFERRAL: if (res->refs) { for (n = 0; res->refs[n]; n++) /*noop*/ ; } else { @@ -563,8 +564,11 @@ static int ldb_search_callback(struct ldb_context *ldb, void *context, struct ld res->refs[n] = talloc_move(res->refs, &ares->referral); res->refs[n + 1] = NULL; + case LDB_REPLY_DONE: + /* Should do something here to detect if this never + * happens */ + break; } - talloc_steal(res, ares->controls); talloc_free(ares); return LDB_SUCCESS; |