summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_ldap/ldb_ldap.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-10-14 04:43:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:21:00 -0500
commit2ad8e1443de55a005cb9249ba317ab8541ec7c90 (patch)
treef770faf7ff80afa3fde12694b62a9a59eee9317c /source4/lib/ldb/ldb_ldap/ldb_ldap.c
parent57b8c5cd227d33b2eec34ed503b0b14c04344a87 (diff)
downloadsamba-2ad8e1443de55a005cb9249ba317ab8541ec7c90.tar.gz
samba-2ad8e1443de55a005cb9249ba317ab8541ec7c90.tar.bz2
samba-2ad8e1443de55a005cb9249ba317ab8541ec7c90.zip
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)
Diffstat (limited to 'source4/lib/ldb/ldb_ldap/ldb_ldap.c')
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c12
1 files changed, 9 insertions, 3 deletions
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;