]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dcrypt: Don't finalize encryption on o_stream_flush()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 20 Sep 2016 15:08:10 +0000 (18:08 +0300)
committerGitLab <gitlab@git.dovecot.net>
Wed, 21 Sep 2016 12:42:56 +0000 (15:42 +0300)
For example the default o_stream_uncork() implementation enforces flushing
and it's probably better not to change that. In general there's really no
reason to perform the finalization at flush when the stream can't be written
to anymore (whereas lib-compression ostreams allow writes after flushes).

src/lib-dcrypt/ostream-encrypt.c

index ae661a9e7316e8e8f4c005298cac0885b2c935a0..dbc0afadb084c7656a5109a75b67e0295f27273c 100644 (file)
@@ -484,7 +484,7 @@ ssize_t o_stream_encrypt_sendv(struct ostream_private *stream,
 }
 
 static
-int o_stream_encrypt_flush(struct ostream_private *stream)
+int o_stream_encrypt_finalize(struct ostream_private *stream)
 {
        const char *error;
        struct encrypt_ostream *estream = (struct encrypt_ostream *)stream;
@@ -545,7 +545,7 @@ void o_stream_encrypt_close(struct iostream_private *stream,
        struct encrypt_ostream *estream = (struct encrypt_ostream *)stream;
        if (estream->ctx_sym != NULL && !estream->finalized &&
            estream->ostream.ostream.stream_errno == 0)
-               o_stream_encrypt_flush(&estream->ostream);
+               o_stream_encrypt_finalize(&estream->ostream);
        if (close_parent) {
                o_stream_close(estream->ostream.parent);
        }
@@ -629,7 +629,6 @@ o_stream_create_encrypt_common(enum io_stream_encrypt_flags flags)
 
        estream = i_new(struct encrypt_ostream, 1);
        estream->ostream.sendv = o_stream_encrypt_sendv;
-       estream->ostream.flush = o_stream_encrypt_flush;
        estream->ostream.iostream.close = o_stream_encrypt_close;
        estream->ostream.iostream.destroy = o_stream_encrypt_destroy;