dovecot-2.2: lib-ssl-iostream: Don't set EPIPE/ECONNRESET error ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jan 29 16:44:39 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/1d1a310bb488
changeset: 18204:1d1a310bb488
user: Timo Sirainen <tss at iki.fi>
date: Thu Jan 29 18:43:15 2015 +0200
description:
lib-ssl-iostream: Don't set EPIPE/ECONNRESET error to istream when connection is closed.
Several istream users verify at EOF that stream_errno=0 and fail if it
isn't.
diffstat:
src/lib-ssl-iostream/iostream-openssl.c | 16 +++++++++-------
src/lib-ssl-iostream/istream-openssl.c | 3 ++-
2 files changed, 11 insertions(+), 8 deletions(-)
diffs (53 lines):
diff -r 93851d1ca12d -r 1d1a310bb488 src/lib-ssl-iostream/iostream-openssl.c
--- a/src/lib-ssl-iostream/iostream-openssl.c Tue Jan 27 02:19:01 2015 +0200
+++ b/src/lib-ssl-iostream/iostream-openssl.c Thu Jan 29 18:43:15 2015 +0200
@@ -387,11 +387,13 @@
ret = openssl_iostream_read_more(ssl_io, &data, &size);
ssl_io->plain_input->real_stream->try_alloc_limit = 0;
if (ret == -1 && size == 0 && !bytes_read) {
- i_free(ssl_io->plain_stream_errstr);
- ssl_io->plain_stream_errstr =
- i_strdup(i_stream_get_error(ssl_io->plain_input));
- ssl_io->plain_stream_errno =
- ssl_io->plain_input->stream_errno;
+ if (ssl_io->plain_input->stream_errno != 0) {
+ i_free(ssl_io->plain_stream_errstr);
+ ssl_io->plain_stream_errstr =
+ i_strdup(i_stream_get_error(ssl_io->plain_input));
+ ssl_io->plain_stream_errno =
+ ssl_io->plain_input->stream_errno;
+ }
ssl_io->closed = TRUE;
return FALSE;
}
@@ -504,7 +506,7 @@
errstr = strerror(errno);
} else {
/* EOF. */
- errno = ECONNRESET;
+ errno = EPIPE;
errstr = "Disconnected";
break;
}
@@ -513,7 +515,7 @@
break;
case SSL_ERROR_ZERO_RETURN:
/* clean connection closing */
- errno = ECONNRESET;
+ errno = EPIPE;
i_free_and_null(ssl_io->last_error);
return -1;
case SSL_ERROR_SSL:
diff -r 93851d1ca12d -r 1d1a310bb488 src/lib-ssl-iostream/istream-openssl.c
--- a/src/lib-ssl-iostream/istream-openssl.c Tue Jan 27 02:19:01 2015 +0200
+++ b/src/lib-ssl-iostream/istream-openssl.c Thu Jan 29 18:43:15 2015 +0200
@@ -78,7 +78,8 @@
io_stream_set_error(&stream->iostream,
"%s", ssl_io->last_error);
}
- stream->istream.stream_errno = errno;
+ if (errno != EPIPE)
+ stream->istream.stream_errno = errno;
stream->istream.eof = TRUE;
sstream->seen_eof = TRUE;
return -1;
More information about the dovecot-cvs
mailing list