]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ssl-iostream: Assert-crash if input stream has IO already set
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 8 Feb 2018 00:26:23 +0000 (02:26 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 8 Feb 2018 10:55:49 +0000 (12:55 +0200)
src/lib-ssl-iostream/iostream-openssl.c

index 27a0f3c38b159fd532753085978abea0b72b8cc1..8dd0541af83efd147c635426f389768c4cbab8b8 100644 (file)
@@ -254,6 +254,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",