dovecot-2.1: imapc: Error logging fix when SSL handshake fails.

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 6 16:42:30 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/991ce1aed5f7
changeset: 13406:991ce1aed5f7
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 06 16:42:19 2011 +0300
description:
imapc: Error logging fix when SSL handshake fails.

diffstat:

 src/lib-storage/index/imapc/imapc-connection.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r e40d6b5ef97e -r 991ce1aed5f7 src/lib-storage/index/imapc/imapc-connection.c
--- a/src/lib-storage/index/imapc/imapc-connection.c	Tue Sep 06 16:33:09 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-connection.c	Tue Sep 06 16:42:19 2011 +0300
@@ -99,6 +99,7 @@
 	unsigned int idling:1;
 	unsigned int idle_stopping:1;
 	unsigned int idle_plus_waiting:1;
+	unsigned int handshake_failed:1;
 };
 
 static int imapc_connection_output(struct imapc_connection *conn);
@@ -941,6 +942,7 @@
 
 static void imapc_connection_input(struct imapc_connection *conn)
 {
+	const char *errstr;
 	ssize_t ret = 0;
 
 	/* we need to read as much as we can with SSL streams to avoid
@@ -953,9 +955,10 @@
 		if (conn->ssl_iostream == NULL) {
 			i_error("imapc(%s): Server disconnected unexpectedly",
 				conn->name);
-		} else {
-			i_error("imapc(%s): Server disconnected: %s", conn->name,
-				ssl_iostream_get_last_error(conn->ssl_iostream));
+		} else if (!conn->handshake_failed) {
+			errstr = ssl_iostream_get_last_error(conn->ssl_iostream);
+			i_error("imapc(%s): Server disconnected: %s",
+				conn->name, errstr != NULL ? errstr : "");
 		}
 		imapc_connection_disconnect(conn);
 		return;
@@ -985,6 +988,7 @@
 		}
 		return 0;
 	}
+	conn->handshake_failed = TRUE;
 	i_stream_close(conn->input);
 	return -1;
 }


More information about the dovecot-cvs mailing list