dovecot-2.1: lib-ssl-iostream: When SSL i/ostream is closed, clo...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 7 10:28:25 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/0e1a65d30964
changeset: 13415:0e1a65d30964
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 07 10:24:11 2011 +0300
description:
lib-ssl-iostream: When SSL i/ostream is closed, close also the plain stream.

diffstat:

 src/lib-ssl-iostream/istream-openssl.c |   8 ++++++++
 src/lib-ssl-iostream/ostream-openssl.c |  12 ++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r 3ae5d7e0a4b4 -r 0e1a65d30964 src/lib-ssl-iostream/istream-openssl.c
--- a/src/lib-ssl-iostream/istream-openssl.c	Wed Sep 07 10:01:36 2011 +0300
+++ b/src/lib-ssl-iostream/istream-openssl.c	Wed Sep 07 10:24:11 2011 +0300
@@ -10,6 +10,13 @@
 	bool seen_eof;
 };
 
+static void i_stream_ssl_close(struct iostream_private *stream)
+{
+	struct ssl_istream *sstream = (struct ssl_istream *)stream;
+
+	i_stream_close(sstream->ssl_io->plain_input);
+}
+
 static void i_stream_ssl_destroy(struct iostream_private *stream)
 {
 	struct ssl_istream *sstream = (struct ssl_istream *)stream;
@@ -66,6 +73,7 @@
 
 	sstream = i_new(struct ssl_istream, 1);
 	sstream->ssl_io = ssl_io;
+	sstream->istream.iostream.close = i_stream_ssl_close;
 	sstream->istream.iostream.destroy = i_stream_ssl_destroy;
 	sstream->istream.max_buffer_size =
 		ssl_io->plain_input->real_stream->max_buffer_size;
diff -r 3ae5d7e0a4b4 -r 0e1a65d30964 src/lib-ssl-iostream/ostream-openssl.c
--- a/src/lib-ssl-iostream/ostream-openssl.c	Wed Sep 07 10:01:36 2011 +0300
+++ b/src/lib-ssl-iostream/ostream-openssl.c	Wed Sep 07 10:24:11 2011 +0300
@@ -11,7 +11,14 @@
 	buffer_t *buffer;
 };
 
-static void i_stream_ssl_destroy(struct iostream_private *stream)
+static void o_stream_ssl_close(struct iostream_private *stream)
+{
+	struct ssl_ostream *sstream = (struct ssl_ostream *)stream;
+
+	o_stream_close(sstream->ssl_io->plain_output);
+}
+
+static void o_stream_ssl_destroy(struct iostream_private *stream)
 {
 	struct ssl_ostream *sstream = (struct ssl_ostream *)stream;
 
@@ -198,7 +205,8 @@
 	sstream->ssl_io = ssl_io;
 	sstream->ostream.max_buffer_size =
 		ssl_io->plain_output->real_stream->max_buffer_size;
-	sstream->ostream.iostream.destroy = i_stream_ssl_destroy;
+	sstream->ostream.iostream.close = o_stream_ssl_close;
+	sstream->ostream.iostream.destroy = o_stream_ssl_destroy;
 	sstream->ostream.sendv = o_stream_ssl_sendv;
 	sstream->ostream.flush = o_stream_ssl_flush;
 


More information about the dovecot-cvs mailing list