dovecot: If ldap_bind() failed because LDAP server was down, we ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Oct 21 00:03:27 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/66e6311e22b3
changeset: 6576:66e6311e22b3
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Oct 21 00:03:20 2007 +0300
description:
If ldap_bind() failed because LDAP server was down, we never reconnected.
Patch by Brendan Braybrook.

diffstat:

1 file changed, 4 insertions(+), 1 deletion(-)
src/auth/db-ldap.c |    5 ++++-

diffs (15 lines):

diff -r d573bc2a967d -r 66e6311e22b3 src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Sun Oct 21 00:02:13 2007 +0300
+++ b/src/auth/db-ldap.c	Sun Oct 21 00:03:20 2007 +0300
@@ -499,7 +499,10 @@ static int db_ldap_bind(struct ldap_conn
 	msgid = ldap_bind(conn->ld, conn->set.dn, conn->set.dnpass,
 			  LDAP_AUTH_SIMPLE);
 	if (msgid == -1) {
-		db_ldap_connect_finish(conn, ldap_get_errno(conn));
+		if (db_ldap_connect_finish(conn, ldap_get_errno(conn)) < 0) {
+			/* lost connection, close it */
+			ldap_conn_close(conn, TRUE);
+		}
 		i_free(ldap_request);
 		return -1;
 	}


More information about the dovecot-cvs mailing list