dovecot-2.2: auth ldap: Improved ldap_initialize() failure's err...

dovecot at dovecot.org dovecot at dovecot.org
Mon Mar 16 20:49:30 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/8c77d80e014c
changeset: 18355:8c77d80e014c
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 16 22:48:39 2015 +0200
description:
auth ldap: Improved ldap_initialize() failure's error logging.

diffstat:

 src/auth/db-ldap.c |  18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diffs (33 lines):

diff -r fe05443b3cd6 -r 8c77d80e014c src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Mon Mar 16 22:46:16 2015 +0200
+++ b/src/auth/db-ldap.c	Mon Mar 16 22:48:39 2015 +0200
@@ -1136,18 +1136,22 @@
 	if (conn->ld == NULL) {
 		if (conn->set.uris != NULL) {
 #ifdef LDAP_HAVE_INITIALIZE
-			if (ldap_initialize(&conn->ld, conn->set.uris) != LDAP_SUCCESS)
+			ret = ldap_initialize(&conn->ld, conn->set.uris);
+			if (ret != LDAP_SUCCESS) {
+				i_fatal("LDAP: ldap_initialize() failed with uris %s: %s",
+					conn->set.uris, ldap_err2string(ret));
 				conn->ld = NULL;
+			}
 #else
 			i_unreached(); /* already checked at init */
 #endif
-		} else
+		} else {
 			conn->ld = ldap_init(conn->set.hosts, LDAP_PORT);
-
-		if (conn->ld == NULL)
-			i_fatal("LDAP: ldap_init() failed with hosts: %s",
-				conn->set.hosts);
-
+			if (conn->ld == NULL) {
+				i_fatal("LDAP: ldap_init() failed with hosts: %s",
+					conn->set.hosts);
+			}
+		}
 		db_ldap_set_options(conn);
 	}
 


More information about the dovecot-cvs mailing list