Timo Sirainen [Wed, 15 Nov 2017 13:53:03 +0000 (15:53 +0200)]
lib-imap: imap_envelope_parse() - remove unnecessary data stack frame
imap_envelope_parse_args() isn't using data stack at all, so this
unnecessarily complicates the code. It also prevents using datastack-pool
as the pool parameter.
Timo Sirainen [Fri, 13 Apr 2018 13:14:18 +0000 (16:14 +0300)]
lib-master: If connect() to backend UNIX socket is retried, log a warning
For example if imap-login process needs to retry before it successfully
connects to imap process's socket, a warning is logged. This warning is
important because it means that the imap-login process may have been
sleeping up to 0.5 seconds and causing all the other connections to hang
during it.
It would be better to make this retrying asynchronous, but before spending
time on doing that, lets see if this warning is ever even being logged.
Timo Sirainen [Thu, 3 May 2018 14:06:04 +0000 (17:06 +0300)]
cassandra: Use fallback_consistency on more types of errors
This could allow for example read_consistency=local-quorum with
read_fallback_consistency=quorum, so most of the time the reads are
from local datacenter, but in case it has problems you can switch to
other datacenters.
Timo Sirainen [Tue, 15 May 2018 14:50:27 +0000 (17:50 +0300)]
fs-posix: Strip trailing "/" from filenames
This is mainly because "doveadm fs delete -R" adds it to indicate to the
fs-driver that the whole directory is wanted to be deleted. This change
fixes fs-posix to work with NFS, where otherwise unlink("symlink-to-dir/")
fails with ENOTDIR. Without NFS the same call succeeds.
Timo Sirainen [Thu, 3 May 2018 12:22:09 +0000 (15:22 +0300)]
fs-posix: mkdir missing directory if it's changed by FS_METADATA_WRITE_FNAME
The temp file is created to the initial directory. If the directory is
changed by FS_METADATA_WRITE_FNAME, the new destination directory didn't
necessarily exist. If the link() or rename() fails with ENOENT, try to
mkdir the missing directories.
mdbox: Assume that empty uid maps found during sync are harmless
Instead of failing the sync and causing index rebuild, just skip over
the empty uid maps. Chances are that they these records came from
various plugins that create fake mails.
This was done to call extension record sync handlers, but the previous
commit removes them. Fixes a problem where obsolete cache offsets were
used in some situations:
- Some cache updates are from external transactions and some are from
non-external transactions. This is because cache offset updates are being
added by whatever the parent index transaction is.
- When mail_index_sync_map() is mapping MAIL_INDEX_SYNC_HANDLER_FILE, it
has already synced the map. But it's calling mail_index_sync_record()
for non-external transactions to call expunge handlers and extension
update handlers. It's calling the regular mail_index_sync_record() to do
this work.
- But mail_index_sync_record() is actually still updating the map. So now
mail_index_sync_record() is called for all non-external cache updates,
but not for external cache updates! And since these are somewhat
randomly either external or non-external, the end result is that the
cache offset may be obsolete.
Stephan Bosch [Sat, 14 Apr 2018 00:05:51 +0000 (02:05 +0200)]
lib: Implement str_sanitize_utf8().
Unlike str_sanitize(), this function truncates strings based on a UTF8 code point
limit rather than a maximum size in bytes. Also, the Unicode replacement
character is used to mark invalid/control characters and an ellipsis character
is used to indicate the string truncation. For the normal str_sanitize() this is
done using a question mark and triple dots respectively.
Timo Sirainen [Tue, 17 Apr 2018 12:46:41 +0000 (15:46 +0300)]
imapc: Fix expunges+appends in same session with imapc_features=no-msn-updates
Since the EXPUNGEs were ignored, the sequence numbers weren't updated.
When a new mail arrived, the sequence number sent by the remote IMAP server
pointed to existing mails in imapc's mapping. Fix this by changing the
sequence number if the returned UID is >= next_uid.
Timo Sirainen [Sun, 25 Mar 2018 20:15:58 +0000 (23:15 +0300)]
imapc: Fix local state if mailbox is empty after reconnection
If local indexes had more than 0 mails, but after reconnection the remote
IMAP server replied with "* 0 EXISTS", the mails in local index weren't
expunged. This could have resulted in:
Timo Sirainen [Thu, 15 Mar 2018 11:19:53 +0000 (13:19 +0200)]
imapc: Update mail size also when RFC822.SIZE is smaller than fetched header size
If this isn't done, istream-mail will detect that the fetched header is
larger than RFC822.SIZE and fail with "Cached message size smaller than
expected"
Timo Sirainen [Thu, 15 Mar 2018 10:20:14 +0000 (12:20 +0200)]
imapc: Update mail size also when istream_opened() hook is called
When fetching a message body the cached message size was set. However,
if istream_opened() hook was used this wasn't done. If a client had
fetched both (RFC822.SIZE BODY.PEEK[]) and the server sent a wrong
RFC822.SIZE, that size was used for the message body size, which resulted
in "Cached message size larger than expected" errors.