From 4bbad8a8aea295dc6cc551d00e4bb40b51fba24f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 8 Feb 2018 02:26:23 +0200 Subject: [PATCH] lib-ssl-iostream: Assert-crash if input stream has IO already set --- src/lib-ssl-iostream/iostream-openssl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib-ssl-iostream/iostream-openssl.c b/src/lib-ssl-iostream/iostream-openssl.c index 1d2a359bdc..b6e3c6e4bd 100644 --- a/src/lib-ssl-iostream/iostream-openssl.c +++ b/src/lib-ssl-iostream/iostream-openssl.c @@ -247,6 +247,10 @@ openssl_iostream_create(struct ssl_iostream_context *ctx, const char *host, SSL *ssl; BIO *bio_int, *bio_ext; + /* Don't allow an existing io_add_istream() to be use on the input. + It would seem to work, but it would also cause hangs. */ + i_assert(i_stream_get_root_io(*input)->real_stream->io == NULL); + ssl = SSL_new(ctx->ssl_ctx); if (ssl == NULL) { *error_r = t_strdup_printf("SSL_new() failed: %s", -- 2.47.3