Stephan Bosch [Thu, 23 Feb 2017 18:38:31 +0000 (19:38 +0100)]
lib-http: client: Fixed i_unreached() failure occurring when a host's list of IPs changes while a connection is still pending.
In that case, the IP of the pending connection may no longer be associated with that host.
If the IP was not found anymore, the i_unreached() error occurred.
Timo Sirainen [Wed, 22 Feb 2017 13:32:19 +0000 (15:32 +0200)]
lazy-expunge: Fix error handling for GUID lookups
If the mail is already expunged, the error should be ignored.
In other situations the original error string should be preserved as
part of the logged error message.
It's not very informative and we can't give a better error message without
changing the APIs. The real error should have been logged already anyway,
so this is just duplication of an error. I think originally this was added
because some backend forgot to log an error.
Timo Sirainen [Wed, 22 Feb 2017 11:28:43 +0000 (13:28 +0200)]
lib-storage: Use refcounting for mail_storage_service_user
doveadm import was freeing the user too early, which resulted
mail_user._service_user pointing to freed memory. More importantly,
after 34512eaad8b1b2f929e6d6e3a2f7252c29fba97b user->set was pointing
to already freed memory.
Timo Sirainen [Tue, 21 Feb 2017 10:38:10 +0000 (12:38 +0200)]
lib-lda: Fix delivery logging when Sieve performs multiple actions
Previous code assumed that it would work like:
- save/copy
- transaction commit
- mail_deliver_ctx_get_log_var_expand_table()
- repeat for transaction 2
So the cache needs to be stored per transaction. This code still wouldn't
work correctly if Sieve saved mails multiple times within the same
transaction, but that doesn't happen (at least currently).
lib-mail: Place input/output of message-date tests in one struct
Define both input and output of a message date test case in a single
struct so it is easier to follow and less error prone. Also add some
leap second tests.
Timo Sirainen [Tue, 21 Feb 2017 11:48:36 +0000 (13:48 +0200)]
lmtp: Fix lmtp_user_concurrency_limit when userdb changes the username
Anvil LOOKUP was done with the original username, while CONNECT/DISCONNECT
was done with the changed username. So LOOKUP always thought that there
were zero concurrent sessions for the user.
Stephan Bosch [Mon, 9 Jan 2017 01:03:25 +0000 (02:03 +0100)]
lib-imap: imap-bodystructure: Allow alternative syntax and omitted optional elements in parser input.
This makes the parser accept any RFC-compliant BODYSTRUCTURE syntax, instead of only what Dovecot itself produces.
This way the parser could reliably be used in the lib-imap-client if ever needed.
The MAIL_ERROR_NOTPOSSIBLE was a bit too generic to assume to mean the same
thing. It doesn't look like there are any external plugins that break
because of this change.
Timo Sirainen [Fri, 17 Feb 2017 16:32:05 +0000 (18:32 +0200)]
imap: If SEARCH/SORT fails but returns some results, send them to client.
The previous error handling fixes cause SEARCH/SORT to now fail if there
are any problems reading mails. This change makes the commands still
return the best known results, so the IMAP client can still use them,
even though they may not be entirely correct.
Timo Sirainen [Fri, 17 Feb 2017 16:30:51 +0000 (18:30 +0200)]
lib-storage: Fix error handling when searching mails
Only expunge errors and failures caused by lookup_abort should be ignored.
The rest of the mail errors mean that the search result might not be
correct. We'll still run the search as fully as possible, but we just
return an error at the end.
If they're not already cached, the mail is parsed twice: once to get the
message_parts and again to perform the actual search. The searching can
however do the message_parts parsing internally as well.
Timo Sirainen [Fri, 17 Feb 2017 16:19:46 +0000 (18:19 +0200)]
lib-storage: Fix error handling when sorting mails.
All errors were treated the same as if message had been expunged. This
caused potentially wrong results to be sent to the client without any
indication that they're wrong.
Timo Sirainen [Sat, 18 Feb 2017 23:44:21 +0000 (01:44 +0200)]
dsync: Don't assert-crash if duplicate attributes are seen
Just ignore the duplicates. Normally this shouldn't happen, but due to
some bugs for example a Sieve script could be returned once by doveadm_sieve
plugin and another time from mail_attribute_dict.
Timo Sirainen [Sun, 19 Feb 2017 13:47:48 +0000 (15:47 +0200)]
imap: Fix running time in tagged command replies.
The timing information was updated only after command_exec() returned.
Most of the commands were handled within a single command_exec() though,
so at the time when tagline was sent the running_usecs was still zero.
The msecs in ioloop timing was correct though, because it relied only on
the command start timing info.
This mainly prevents losing hooks that were registered by doveadm plugins.
Otherwise what happens is:
- mail_plugins are unloaded and they unregister their hooks
- doveadm plugins (e.g. doveadm_sieve) are NOT unloaded
- mail_storage_deinit() frees all the registered hooks
- next mail_storage_init() initializes all new hooks
- All mail_plugins are loaded and they register again their hooks
- doveadm plugins are NOT re-loaded or re-initialized, so their existing
hooks were lost.
Timo Sirainen [Sun, 19 Feb 2017 12:34:45 +0000 (14:34 +0200)]
imap: Fix sending UID only when necessary on broken FETCHes.
b748f91d0677fffaa2208b39ebb6db3aeb2e937b changed UID to be sent for most
FETCH replies. There was also some existing code that attempted to do this,
but didn't fully work.
So now:
1) If there are no non-buffered replies, the entire FETCH response isn't
sent.
2) If the buffer was already flushed and nothing else was sent, add UID to
reply. The code paths for handling this are differently for
imap_fetch_failure = disconnect-immediately vs others (depending on
imap_fetch_cur_failed() return value).