From 2ad8e1443de55a005cb9249ba317ab8541ec7c90 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 14 Oct 2006 04:43:51 +0000 Subject: r19273: - fixed error handling with the ldap backend - propogate errors to the ldbadd command line tool - use the rdn_name module when testing the tdb backend to allow the same test code to correctly test the ldap and non-ldap backends (This used to be commit dd82c474a123d90329bda653a4cb73c93e087b15) --- source4/lib/ldb/ldb_ldap/ldb_ldap.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source4/lib/ldb/ldb_ldap') diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 10563816b9..a34e35c6db 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/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; -- cgit