lib: Use event category representatives instead of user supplied pointers
Since we cannot rely on the consumers to supply us with unique category
pointers, we can switch all our tracking to the category representative
structures.
lib: Maintain a representative event category inside internal state
More than one category can be represented by the internal state. To give
consumers a unique but consistent category pointer, we allocate a category
structure (technically part of the internal state) and use it as the
representative for all the registrations.
Note: This commit only allocates and maintains the representatives. It does
not make use of them.
Replace the existing "subject" field with UTF8 subject. Add new
from_address, from_display_name, to_address and to_display_name where
the *_display_names are UTF8.
Timo Sirainen [Fri, 8 Nov 2019 08:57:01 +0000 (10:57 +0200)]
lib-imap: Add IMAP_ARG_EOL parameter also for unfinished lists
If list parsing was stopped due to IMAP_ARG_LITERAL_SIZE* the list didn't
have IMAP_ARG_EOL added. However, imap_arg_get_list() could still have
been used for it, which assumes that the IMAP_ARG_EOL exists.
This didn't seem to cause any actual bugs so far, but the following commits
require this.
The IMAP_ARG_EOL is appended and deleted immediately. This way it's seen by
imap_arg_get_list(), but it won't change any other behavior unexpectedly.
Stephan Bosch [Thu, 31 Oct 2019 08:07:42 +0000 (09:07 +0100)]
lib-http: http-url - Fix handling of double slash in request target URL.
A origin-form URL starting with double slash caused the initial path segment to
be erroneously recognized as the URL authority, making the path part
unexpectedly empty (NULL). This could cause the HTTP server to crash.
Timo Sirainen [Tue, 22 Oct 2019 16:59:43 +0000 (19:59 +0300)]
lib-storage: Copy vsize record even when destination mailbox doesn't have it
It's almost guaranteed that if the source mailbox has vsize then we want the
destination mailbox to also have it. This condition now happens mainly when
copying mails to a newly created mailbox where the vsize lookups haven't
occurred yet. It's better to do this immediately to avoid unnecessarily slow
lookups later on.
Timo Sirainen [Sun, 20 Oct 2019 10:48:22 +0000 (13:48 +0300)]
dsync: Fix potential hang when initializing remote dsync
The initial dsync handshake TCP packet could be in the same packet as the
previous doveadm command. This started happening more often with the
recent multiplex ostream corking changes in f284865285ae461b293c713e03277cfbb6973eca
Stephan Bosch [Sun, 13 Oct 2019 09:01:53 +0000 (11:01 +0200)]
lib: istream - Fix calling i_stream_nonseekable_try_seek() without intermittent reads.
Calling i_stream_nonseekable_try_seek() sets stream->high_pos when seeking back
within buffer. Once i_stream_read_memarea() is called, the pos is set to
high_pos and the high pos is cleared. However, when no read is performed in the
mean time, another call to i_stream_nonseekable_try_seek() would overwrite the
high_pos value with pos, causing the true value to get lost, leading to all
kinds of issues. This is fixed by checking whether high_pos is already set and
not touching it when it is (first value is the only valid one).
One issue this caused is that the mbox storage would no longer work with
compression, triggering `unexpected EOF' errors.
Timo Sirainen [Tue, 8 Oct 2019 13:14:15 +0000 (16:14 +0300)]
*-login: Fix potential hangs with SSL connections
1) Multi-step SASL authentication could hang when login process waits for
response from a client, but it has already pipelined it together with the
AUTH/AUTHENTICATE command.
2) After failed authentication commands could start hanging.
Timo Sirainen [Sat, 5 Oct 2019 12:46:47 +0000 (15:46 +0300)]
lib-index: Fix checking if log file can be rotated
This fixes a bug caused by 883a3022992d0f832f0aff21572caeb7c63b7668 where
dovecot.index.log file wasn't rotated as often as it was supposed to be. It
also could have caused dovecot.index to be rewritten much more often than
it was supposed to be.
The buggy commit was correct that the tail_offset wasn't updated previously
to the dovecot.index.log file after changes. However, I didn't realize that
the tail_offset was internally still updated and required by this rotation
check to work correctly.
The fix works by relaxing the tail_offset==head_offset requirement for
rotation. It's enough that all the changes are synced, which can be checked
from mail_index_sync_ctx.fully_synced. Any changes after tail_offset are
then supposed to be external transactions, which aren't synced anyway, so
rotation is allowed.
Stephan Bosch [Sun, 4 Nov 2018 18:00:47 +0000 (19:00 +0100)]
lib-smtp: smtp-address - Implement workarounds for parsing addresses with a bad localpart.
Always parse it as normal when it starts with `<' or `"'. The workaround
consists of parsing the address by splitting it on the last `@'. The address is
accepted when the resulting localpart and domain can be used to compose a valid
address. This workaround is now shared with username-to-address parsing, which
existed before.
Stephan Bosch [Sun, 4 Nov 2018 18:09:41 +0000 (19:09 +0100)]
lib-smtp: smtp-address - Allow parsing address from username that contains space, double quote or backslash.
Not allowing double quote and backslash was a bug, while space was explicitly
disallowed. However, these characters can be used in an RFC 5321 address when
inside a quoted string, so there is no reason to disallow those.