Hi again,
I found the cause of my LDAP assertion problem...
If the ldap_search function fails (ie. when the server is reported being
down), result doesn't get any value (thus is NULL). If ldap_result2error is
called with a NULL "result", it will end up outputing the "assertion" error.
This little patch calls ldap_result2error if result is non-NULL. This
routine, according to LDAP documentation, gets "The ld_errno field in ld
[...] set and returned." If the ldap_result2error isn't called, the
ld->ld_errno field contains the value
set by ldap_result.
ldap_get_option is then called to retrieve ld->ld_errno, and pass it to
ldap_err2string.
--- exim-3.34/src/lookups/ldap.c Wed Dec 19 06:50:29 2001
+++ exim-3.34-orig/src/lookups/ldap.c Fri May 24 14:30:08 2002
@@ -464,11 +464,16 @@
if (rc == -1)
{
+ int err;
DEBUG(9) debug_printf("ldap_result failed\n");
#if defined LDAP_LIB_SOLARIS || defined LDAP_LIB_OPENLDAP2
+ if (result != NULL) ldap_result2error(lcp->ld, result, 0);
+
+ ldap_get_option(lcp->ld, LDAP_OPT_ERROR_NUMBER, &err);
+
*errmsg = string_sprintf("ldap_result failed: %s",
- ldap_err2string(ldap_result2error(lcp->ld, result, 0)));
+ ldap_err2string(err));
#elif defined LDAP_LIB_NETSCAPE
{
Best regards,
__
Tommy Lacroix ( runtime@??? )
Unix/Linux System Administrator, CAM Internet
Web:
http://www.cam.org
Tel: +1 514 529-3000 ext 247
Fax: +1 514 529-3300