diff options
author | Andrew Bartlett <abartlet@samba.org> | 2007-03-08 06:23:39 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:49:24 -0500 |
commit | 3370f2f2d7e5296e8f54f721003c07fac111d1ad (patch) | |
tree | 8149619a220e76f7904d04b163e792dac50749ad /source4/lib/ldb/ldb_ildap | |
parent | f80d21069b7e22fbe8abdd59e7acb748f0a6b1ce (diff) | |
download | samba-3370f2f2d7e5296e8f54f721003c07fac111d1ad.tar.gz samba-3370f2f2d7e5296e8f54f721003c07fac111d1ad.tar.bz2 samba-3370f2f2d7e5296e8f54f721003c07fac111d1ad.zip |
r21761: - Give more detail on LDAP client library failures (make it clear
where the error is from)
- Make default error string more consistant
Andrew Bartlett
(This used to be commit 7f115579d20a3112efd11444fafcbf78698fc9a1)
Diffstat (limited to 'source4/lib/ldb/ldb_ildap')
-rw-r--r-- | source4/lib/ldb/ldb_ildap/ldb_ildap.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index bff54ded2d..f5642f8303 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -123,10 +123,16 @@ failed: */ static int ildb_map_error(struct ildb_private *ildb, NTSTATUS status) { + TALLOC_CTX *mem_ctx = talloc_new(ildb); if (NT_STATUS_IS_OK(status)) { return LDB_SUCCESS; } - ldb_set_errstring(ildb->module->ldb, ldap_errstr(ildb->ldap, status)); + if (!mem_ctx) { + ldb_oom(ildb->module->ldb); + return LDB_ERR_OPERATIONS_ERROR; + } + ldb_set_errstring(ildb->module->ldb, ldap_errstr(ildb->ldap, mem_ctx, status)); + talloc_free(mem_ctx); if (NT_STATUS_IS_LDAP(status)) { return NT_STATUS_LDAP_CODE(status); } @@ -763,7 +769,7 @@ static int ildb_connect(struct ldb_context *ldb, const char *url, status = ldap_connect(ildb->ldap, url); if (!NT_STATUS_IS_OK(status)) { ldb_debug(ldb, LDB_DEBUG_ERROR, "Failed to connect to ldap URL '%s' - %s\n", - url, ldap_errstr(ildb->ldap, status)); + url, ldap_errstr(ildb->ldap, module, status)); goto failed; } @@ -783,14 +789,14 @@ static int ildb_connect(struct ldb_context *ldb, const char *url, status = ldap_bind_simple(ildb->ldap, bind_dn, password); if (!NT_STATUS_IS_OK(status)) { ldb_debug(ldb, LDB_DEBUG_ERROR, "Failed to bind - %s\n", - ldap_errstr(ildb->ldap, status)); + ldap_errstr(ildb->ldap, module, status)); goto failed; } } else { status = ldap_bind_sasl(ildb->ldap, creds); if (!NT_STATUS_IS_OK(status)) { ldb_debug(ldb, LDB_DEBUG_ERROR, "Failed to bind - %s\n", - ldap_errstr(ildb->ldap, status)); + ldap_errstr(ildb->ldap, module, status)); goto failed; } } |