From: Stephan Bosch Date: Mon, 26 Oct 2020 21:04:53 +0000 (+0100) Subject: lib-ssl-iostrea: ostream-openssl - Add local variable for ssl_io in o_stream_ssl_flus... X-Git-Tag: 2.3.13~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5b4e8e9819e1b3a1047bb36aaf64f099e22f1bc3;p=thirdparty%2Fdovecot%2Fcore.git lib-ssl-iostrea: ostream-openssl - Add local variable for ssl_io in o_stream_ssl_flush_buffer(). --- diff --git a/src/lib-ssl-iostream/ostream-openssl.c b/src/lib-ssl-iostream/ostream-openssl.c index 2e653c7e18..c763493322 100644 --- a/src/lib-ssl-iostream/ostream-openssl.c +++ b/src/lib-ssl-iostream/ostream-openssl.c @@ -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);