summaryrefslogtreecommitdiff
path: root/source3/lib/ldb/ldb_ldap/ldb_ldap.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/ldb/ldb_ldap/ldb_ldap.c')
-rw-r--r--source3/lib/ldb/ldb_ldap/ldb_ldap.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/lib/ldb/ldb_ldap/ldb_ldap.c b/source3/lib/ldb/ldb_ldap/ldb_ldap.c
index 10563816b9..410ad64b4a 100644
--- a/source3/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source3/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -497,9 +497,11 @@ static int lldb_parse_result(struct ldb_handle *handle, LDAPMessage *result)
char **referralsp = NULL;
LDAPControl **serverctrlsp = NULL;
int ret = LDB_SUCCESS;
-
+
type = ldap_msgtype(result);
+ handle->status = 0;
+
switch (type) {
case LDAP_RES_SEARCH_ENTRY:
@@ -631,15 +633,19 @@ static int lldb_parse_result(struct ldb_handle *handle, LDAPMessage *result)
}
if (matcheddnp) ldap_memfree(matcheddnp);
- if (errmsgp) {
+ if (errmsgp && *errmsgp) {
ldb_set_errstring(ac->module->ldb, errmsgp);
+ } else if (handle->status) {
+ ldb_set_errstring(ac->module->ldb, ldap_err2string(handle->status));
+ }
+ if (errmsgp) {
ldap_memfree(errmsgp);
}
if (referralsp) ldap_value_free(referralsp);
if (serverctrlsp) ldap_controls_free(serverctrlsp);
ldap_msgfree(result);
- return ret;
+ return lldb_ldap_to_ldb(handle->status);
error:
handle->state = LDB_ASYNC_DONE;
@@ -816,6 +822,7 @@ static int lldb_connect(struct ldb_context *ldb,
talloc_free(lldb);
return -1;
}
+ talloc_set_name_const(*module, "ldb_ldap backend");
(*module)->ldb = ldb;
(*module)->prev = (*module)->next = NULL;
(*module)->private_data = lldb;