dovecot-2.2: lib-ssl-iostream: Error handling fix.

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 3 09:55:04 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/72b50ae2f0c3
changeset: 17183:72b50ae2f0c3
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 03 12:50:43 2014 +0300
description:
lib-ssl-iostream: Error handling fix.
Don't set last_error="(null)" when the connection was simply disconnected.

diffstat:

 src/lib-ssl-iostream/istream-openssl.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (25 lines):

diff -r d55ae5d268a2 -r 72b50ae2f0c3 src/lib-ssl-iostream/istream-openssl.c
--- a/src/lib-ssl-iostream/istream-openssl.c	Sat Mar 29 22:45:16 2014 +0200
+++ b/src/lib-ssl-iostream/istream-openssl.c	Thu Apr 03 12:50:43 2014 +0300
@@ -71,14 +71,16 @@
 		/* failed to read anything */
 		ret = openssl_iostream_handle_error(ssl_io, ret, "SSL_read");
 		if (ret <= 0) {
-			if (ret < 0) {
+			if (ret == 0)
+				return 0;
+			if (ssl_io->last_error != NULL) {
 				io_stream_set_error(&stream->iostream,
 						    "%s", ssl_io->last_error);
-				stream->istream.stream_errno = errno;
-				stream->istream.eof = TRUE;
-				sstream->seen_eof = TRUE;
 			}
-			return ret;
+			stream->istream.stream_errno = errno;
+			stream->istream.eof = TRUE;
+			sstream->seen_eof = TRUE;
+			return -1;
 		}
 		/* we did some BIO I/O, try reading again */
 	}


More information about the dovecot-cvs mailing list