]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ssl-iostrea: ostream-openssl - Add local variable for ssl_io in o_stream_ssl_flus...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Mon, 26 Oct 2020 21:04:53 +0000 (22:04 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Thu, 5 Nov 2020 12:14:52 +0000 (12:14 +0000)
src/lib-ssl-iostream/ostream-openssl.c

index 2e653c7e18d983c54dbf8bd163c6a5598bdf9d43..c763493322e995d11497fe2c4d7d74a177c74cca 100644 (file)
@@ -97,6 +97,7 @@ o_stream_ssl_buffer(struct ssl_ostream *sstream, const struct const_iovec *iov,
 
 static int o_stream_ssl_flush_buffer(struct ssl_ostream *sstream)
 {
+       struct ssl_iostream *ssl_io = sstream->ssl_io;
        size_t pos = 0;
        int ret = 1;
 
@@ -104,15 +105,17 @@ static int o_stream_ssl_flush_buffer(struct ssl_ostream *sstream)
                /* we're writing plaintext data to OpenSSL, which it encrypts
                   and writes to bio_int's buffer. ssl_iostream_bio_sync()
                   reads it from there and adds to plain_output stream. */
-               ret = SSL_write(sstream->ssl_io->ssl,
+               ret = SSL_write(ssl_io->ssl,
                                CONST_PTR_OFFSET(sstream->buffer->data, pos),
                                sstream->buffer->used - pos);
                if (ret <= 0) {
-                       ret = openssl_iostream_handle_error(sstream->ssl_io,
-                               ret, OPENSSL_IOSTREAM_SYNC_TYPE_WRITE, "SSL_write");
+                       ret = openssl_iostream_handle_error(
+                               ssl_io, ret, OPENSSL_IOSTREAM_SYNC_TYPE_WRITE,
+                               "SSL_write");
                        if (ret < 0) {
-                               io_stream_set_error(&sstream->ostream.iostream,
-                                       "%s", sstream->ssl_io->last_error);
+                               io_stream_set_error(
+                                       &sstream->ostream.iostream,
+                                       "%s", ssl_io->last_error);
                                sstream->ostream.ostream.stream_errno = errno;
                                break;
                        }
@@ -120,8 +123,8 @@ static int o_stream_ssl_flush_buffer(struct ssl_ostream *sstream)
                                break;
                } else {
                        pos += ret;
-                       (void)openssl_iostream_bio_sync(sstream->ssl_io,
-                               OPENSSL_IOSTREAM_SYNC_TYPE_WRITE);
+                       (void)openssl_iostream_bio_sync(
+                               ssl_io, OPENSSL_IOSTREAM_SYNC_TYPE_WRITE);
                }
        }
        buffer_delete(sstream->buffer, 0, pos);