From: Philip Hazel Date: Tue, 21 Dec 2004 13:59:15 +0000 (+0000) Subject: Improve error message when ldap_search fails in OpenLDAP or Solaris X-Git-Tag: exim-4_50~64 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/3ca0ba97c4bd4f8ece7f38b60280222020c1d024?ds=sidebyside Improve error message when ldap_search fails in OpenLDAP or Solaris LDAP. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 2b75b4656..348f15b03 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.53 2004/12/21 12:21:46 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.54 2004/12/21 13:59:15 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -239,6 +239,8 @@ Exim version 4.50 dnsdb lookup now tests whether it's key is an IP address. If not, it leaves it alone. Component reversal etc. now happens only for IP addresses. +56. Improve error message when ldap_search() fails in OpenLDAP or Solaris LDAP. + Exim version 4.43 ----------------- diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c index 043135e03..1b5da047d 100644 --- a/src/src/lookups/ldap.c +++ b/src/src/lookups/ldap.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/lookups/ldap.c,v 1.5 2004/12/21 12:00:59 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/ldap.c,v 1.6 2004/12/21 13:59:15 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -560,7 +560,16 @@ msgid = ldap_search(lcp->ld, ludp->lud_dn, ludp->lud_scope, ludp->lud_filter, if (msgid == -1) { - *errmsg = string_sprintf("ldap search initiation failed"); + #if defined LDAP_LIB_SOLARIS || defined LDAP_LIB_OPENLDAP2 + int err; + ldap_get_option(lcp->ld, LDAP_OPT_ERROR_NUMBER, &err); + *errmsg = string_sprintf("ldap_search failed: %d, %s", err, + ldap_err2string(err)); + + #else + *errmsg = string_sprintf("ldap_search failed"); + #endif + goto RETURN_ERROR; }