ph10 2004/12/21 13:59:15 GMT
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src/lookups ldap.c
exim-test-orig/AutoTest/scripts 901
exim-test-orig/AutoTest/stdout 901
Log:
Improve error message when ldap_search fails in OpenLDAP or Solaris
LDAP.
Revision Changes Path
1.54 +2 -0 exim/exim-doc/doc-txt/ChangeLog
1.6 +10 -1 exim/exim-src/src/lookups/ldap.c
1.2 +5 -0 exim/exim-test-orig/AutoTest/scripts/901
1.4 +3 -0 exim/exim-test-orig/AutoTest/stdout/901
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- ChangeLog 21 Dec 2004 12:21:46 -0000 1.53
+++ ChangeLog 21 Dec 2004 13:59:15 -0000 1.54
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.53 2004/12/21 12:21:46 ph10 Exp $
+$Cambridge: exim/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
-------------------------------------------
@@ -238,6 +238,8 @@
keys for these records are domain names, not reversed IP addresses. The
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
Index: ldap.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/lookups/ldap.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ldap.c 21 Dec 2004 12:00:59 -0000 1.5
+++ ldap.c 21 Dec 2004 13:59:15 -0000 1.6
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/lookups/ldap.c,v 1.5 2004/12/21 12:00:59 ph10 Exp $ */
+/* $Cambridge: exim/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 @@
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;
}
Index: 901
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/scripts/901,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 901 8 Oct 2004 14:49:53 -0000 1.1
+++ 901 21 Dec 2004 13:59:15 -0000 1.2
@@ -173,3 +173,8 @@
\${lookup ldap {user="cn=manager,o=University of Cambridge,c=UK" pass="se\"cret" ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
${lookup ldap {user="cn=manager,o=University of Cambridge,c=UK" pass=${quote:se"cret} ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
****
+0
+exim -be
+Expect ldap_search to fail
+${lookup ldap {ldap:///o=top?mailRoutingAddress,mailHost,objectClass?sub?(&(mailLocalAddress=3-1546081-domain.net?wendling@???)(objectClass=inetLocalMailRecipient))}{$value}fail}
+****
Index: 901
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/stdout/901,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- 901 11 Nov 2004 12:05:54 -0000 1.3
+++ 901 21 Dec 2004 13:59:15 -0000 1.4
@@ -174,3 +174,6 @@
> ${lookup ldap {user="cn=manager,o=University of Cambridge,c=UK" pass="se"cret" ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{}fail}
> Failed: lookup of "user="cn=manager,o=University of Cambridge,c=UK" pass="se\"cret" ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)" gave DEFER: failed to bind the LDAP connection to server 127.0.0.1:636 - LDAP error 49: Invalid credentials
>
+> Expect ldap_search to fail
+> Failed: lookup of "ldap:///o=top?mailRoutingAddress,mailHost,objectClass?sub?(&(mailLocalAddress=3-1546081-domain.net?wendling@???)(objectClass=inetLocalMailRecipient))" gave DEFER: ldap_search failed: 87, Bad search filter
+>