Timo Sirainen [Thu, 2 Nov 2017 21:01:20 +0000 (23:01 +0200)]
imap, pop3: Don't access login_set.*_socket_path after they're freed from data stack
Call master_login_init() before master_service_init_finish(), which frees
all the data stack done in initialization.
This didn't normally cause any visible problems, because data stack wasn't
currently being used in a way that the strings were invalidated. However,
it was causing failures if --enable-devel-checks was used.
Timo Sirainen [Thu, 26 Oct 2017 10:56:25 +0000 (13:56 +0300)]
director: Show each director connection in doveadm DIRECTOR-LIST
Previously the host was shown only once, regardless of how many connections
it had. This especially helps when there are just two directors, but also
can be useful when showing incoming/outgoing connections that are still
in handshaking phase.
Timo Sirainen [Thu, 26 Oct 2017 10:02:32 +0000 (13:02 +0300)]
director: Fix updating director connection's last_output timestamp
It was previously updated only in ostream's flush callback, which was called
only when there were a lot of output. This only caused the "last output"
timestamp in disconnection log lines to be wrong.
Timo Sirainen [Wed, 25 Oct 2017 14:18:03 +0000 (17:18 +0300)]
director: Add director_output_buffer_size setting
This allows configuring the max buffer size for outgoing connections.
Previously it was hardcoded to 10 MB, which wasn't necessarily enough for
very busy directors.
Timo Sirainen [Tue, 31 Oct 2017 21:37:44 +0000 (23:37 +0200)]
lib-ssl-iostream: Verify SSL server's hostname against cert if it's non-NULL
The hostname verification was skipped when handshake-callback wasn't used.
All of the existing code used the callback though, so this doesn't fix
any bugs.
Timo Sirainen [Fri, 27 Oct 2017 18:17:23 +0000 (21:17 +0300)]
lib: i_stream_read() - Use snapshots
This guarantees that data returned by i_stream_get_data() won't be freed
until the next i_stream_read() returns >0. This is mainly important,
because often the error handling for <=0 doesn't update the buffer
pointers correctly and it leads to complicated bugs where already freed
memory is attempted to be read (but never written).
Timo Sirainen [Thu, 26 Oct 2017 15:36:09 +0000 (18:36 +0300)]
lib-mail: istream-attachment-extractor - Don't modify buffer during failure
If i_stream_read() returns -1 because the attachment file couldn't be
created, don't add the trailing data to the main istream. It's not useful,
and the following extra checks will cause it to assert-crash.
Timo Sirainen [Fri, 20 Jan 2017 15:34:50 +0000 (17:34 +0200)]
lib-mail: istream-header-filter - Fix header read() when max_buffer_size=0
If the buffer was too small to read anything into it, read_header() returned
-2, but then it continued reading the header as if it was the body already.
This should instead be an error situation - max buffer size just shouldn't be
0 at this point.
Timo Sirainen [Mon, 30 Oct 2017 11:58:54 +0000 (13:58 +0200)]
imap: Set max buffer size for CATENATE istream-chain
This fixes a crash with mbox when nonexistent CATENATE URL is attempted to
be used. The istream doesn't get any size, and istream-header-filter panics
due to having reached the maximum buffer size (0), even though the stream is
empty and there's nothing to read.
Timo Sirainen [Tue, 31 Oct 2017 18:05:19 +0000 (20:05 +0200)]
doveadm-server: Deinitialize log proxying before closing SSL iostream
Otherwise the SSL iostream destroying may trigger debug/error logging,
which attempts to proxy logs when the stream is already closed. This
caused a panic.
Timo Sirainen [Tue, 31 Oct 2017 15:24:06 +0000 (17:24 +0200)]
lib-mail: ostream-dot - Set o_stream_set_finish_also_parent(FALSE) by default
ostream-dot is always used inside another ostream to implement some kind of
data escaping. The ostream-dot always has to be finished to write the "."
line, but the caller never wants it to finish the parent stream.
Timo Sirainen [Tue, 31 Oct 2017 15:09:47 +0000 (17:09 +0200)]
lib: connection - Use o_stream_set_finish_via_child(FALSE)
This allows o_stream_finish() calls on child streams without closing this
parent stream. Since the stream has no error checking by default anyway,
this allows the connection stream to be used more easily.
Timo Sirainen [Tue, 31 Oct 2017 15:07:44 +0000 (17:07 +0200)]
lib: Add o_stream_set_finish_also_parent() and _finish_via_child()
These allow controlling on both directions whether o_stream_finish() should
be finishing the parent stream. If either one is set to FALSE, the parent
stream isn't finished. Which one of these to use depends on the situation.