]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
8 years agoReleased v2.2.28. release-2.2.28 2.2.28
Timo Sirainen [Fri, 24 Feb 2017 13:28:42 +0000 (15:28 +0200)] 
Released v2.2.28.

8 years agolib-http: client: Fixed i_unreached() failure occurring when a host's list of IPs...
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.

8 years agoauth: Export oauth2 pass_attrs to passdb reply
Aki Tuomi [Thu, 23 Feb 2017 09:29:17 +0000 (11:29 +0200)] 
auth: Export oauth2 pass_attrs to passdb reply

8 years agovirtual: Include virtual mailbox name in "Mailbox ID unexpectedly lost" error
Timo Sirainen [Wed, 22 Feb 2017 23:24:43 +0000 (01:24 +0200)] 
virtual: Include virtual mailbox name in "Mailbox ID unexpectedly lost" error

8 years agov2.2.28.rc2 released 2.2.28.rc2
Timo Sirainen [Wed, 22 Feb 2017 18:26:31 +0000 (20:26 +0200)] 
v2.2.28.rc2 released

8 years agomaildir: Fix checking vsize caching decision in "is this pop3 user?"
Timo Sirainen [Wed, 22 Feb 2017 18:05:16 +0000 (20:05 +0200)] 
maildir: Fix checking vsize caching decision in "is this pop3 user?"

If vsize extension is used, it's practically the same as if vsize's caching
decision was YES.

8 years agopop3c: Remove unnecessarily duplicated code setting vsize to cache
Timo Sirainen [Wed, 22 Feb 2017 18:04:28 +0000 (20:04 +0200)] 
pop3c: Remove unnecessarily duplicated code setting vsize to cache

This is important now that the vsize can be added also to index's vsize
extension.

8 years agopop3c: Prefetched streams didn't call istream_opened() or set virtual_size
Timo Sirainen [Wed, 22 Feb 2017 18:03:43 +0000 (20:03 +0200)] 
pop3c: Prefetched streams didn't call istream_opened() or set virtual_size

8 years agotrash plugin: Use correct hook for overriding mail_user vfuncs
Timo Sirainen [Wed, 22 Feb 2017 15:45:34 +0000 (17:45 +0200)] 
trash plugin: Use correct hook for overriding mail_user vfuncs

This was always wrong to do, and it crashes after
f32382d2da479a4371e08c443679528db37ea988

8 years agoexpire plugin: Use correct hook for overriding mail_user vfuncs
Timo Sirainen [Wed, 22 Feb 2017 15:21:56 +0000 (17:21 +0200)] 
expire plugin: Use correct hook for overriding mail_user vfuncs

This was always wrong to do, and it crashes after
f32382d2da479a4371e08c443679528db37ea988

8 years agolazy-expunge: Fix error handling for GUID lookups
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.

8 years agolib-storage: Add missing service_user ref when creating shared mailbox's user.
Timo Sirainen [Wed, 22 Feb 2017 14:09:07 +0000 (16:09 +0200)] 
lib-storage: Add missing service_user ref when creating shared mailbox's user.

Was forgotten from d1bf4ae66b8bf3b9e28df1823d6d4adda2b923b6

Fixes:
Panic: file mail-storage-service.c: line 1513 (mail_storage_service_user_unref): assertion failed: (user->refcount > 0)

8 years agolib-mail: Fix message_part_data_is_plain_7bit()
Timo Sirainen [Mon, 30 Jan 2017 19:53:01 +0000 (21:53 +0200)] 
lib-mail: Fix message_part_data_is_plain_7bit()

Content-Type parameters weren't handled exactly right.
Broken by recent changes.

8 years agoquota: Don't log "Internal quota calculation error"
Timo Sirainen [Wed, 22 Feb 2017 11:02:27 +0000 (13:02 +0200)] 
quota: Don't log "Internal quota calculation error"

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.

8 years agoglobal: Replace mail_storage_service_user_free() with _unref()
Timo Sirainen [Wed, 22 Feb 2017 11:30:00 +0000 (13:30 +0200)] 
global: Replace mail_storage_service_user_free() with _unref()

8 years agolib-storage: Use refcounting for mail_storage_service_user
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.

8 years agolib-lda: Fix pigeonhole testsuite to not crash
Timo Sirainen [Wed, 22 Feb 2017 08:44:00 +0000 (10:44 +0200)] 
lib-lda: Fix pigeonhole testsuite to not crash

8 years agolib: Fix again test-utc-mktime with 32bit time_t
Timo Sirainen [Tue, 21 Feb 2017 20:34:14 +0000 (22:34 +0200)] 
lib: Fix again test-utc-mktime with 32bit time_t

8 years agolib-lda: Fix delivery logging when Sieve performs multiple actions
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

While it really works:
 - transaction 1: save/copy
 - transaction 2: save/copy
 - transaction 1: commit
 - mail_deliver_ctx_get_log_var_expand_table()
 - transaction 2: commit
 - mail_deliver_ctx_get_log_var_expand_table()

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).

8 years agolib-lda: Refactor - mail_deliver_log_update_cache() doesn't need entire deliver_ctx
Timo Sirainen [Tue, 21 Feb 2017 10:36:52 +0000 (12:36 +0200)] 
lib-lda: Refactor - mail_deliver_log_update_cache() doesn't need entire deliver_ctx

8 years agolib-lda: Refactor - Add struct mail_deliver_mailbox
Timo Sirainen [Tue, 21 Feb 2017 10:34:59 +0000 (12:34 +0200)] 
lib-lda: Refactor - Add struct mail_deliver_mailbox

8 years agolib: Fix test-utc-mktime with 32bit time_t
Timo Sirainen [Tue, 21 Feb 2017 17:55:48 +0000 (19:55 +0200)] 
lib: Fix test-utc-mktime with 32bit time_t

8 years agolib-mail: Place input/output of message-date tests in one struct
Martti Rannanjärvi [Tue, 21 Feb 2017 14:25:48 +0000 (16:25 +0200)] 
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.

8 years agolib: Place input/output of utc_mktime tests in one struct
Martti Rannanjärvi [Tue, 21 Feb 2017 15:00:14 +0000 (17:00 +0200)] 
lib: Place input/output of utc_mktime tests in one struct

Define both input and output of a utc_mktime test case in a single
struct so it is easier to follow and less error prone.

8 years agolib: Accept leap second in utc_mktime
Martti Rannanjärvi [Tue, 21 Feb 2017 14:25:25 +0000 (16:25 +0200)] 
lib: Accept leap second in utc_mktime

Accept leap second at any time in utc_mktime since utc_mktime is being
used before applying the timezone offset everywhere.

8 years agoimap: Fix error message in failed FETCH's NO reply.
Timo Sirainen [Tue, 21 Feb 2017 12:42:01 +0000 (14:42 +0200)] 
imap: Fix error message in failed FETCH's NO reply.

This was broken only with the new imap_fetch_failure = no-after setting.

8 years agoimapc: Error handling wasn't setting storage error everywhere.
Timo Sirainen [Tue, 21 Feb 2017 13:44:09 +0000 (15:44 +0200)] 
imapc: Error handling wasn't setting storage error everywhere.

This would have used the previous error, which might not have been correct.

8 years agolib-storage: Fix mail.access_type for search prefetches
Timo Sirainen [Tue, 21 Feb 2017 12:20:22 +0000 (14:20 +0200)] 
lib-storage: Fix mail.access_type for search prefetches

8 years agolmtp: Fix lmtp_user_concurrency_limit when userdb changes the username
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.

8 years agocassandra: Don't use i_error() from non-main thread
Timo Sirainen [Tue, 21 Feb 2017 09:55:55 +0000 (11:55 +0200)] 
cassandra: Don't use i_error() from non-main thread

It will only cause crashes. This was done only if the internal
communication pipe couldn't be written to, which was pretty unlikely
to happen.

8 years agolib-storage: Fix assert-crash on corrupted dovecot.list.index with name_id==0
Timo Sirainen [Tue, 21 Feb 2017 11:08:59 +0000 (13:08 +0200)] 
lib-storage: Fix assert-crash on corrupted dovecot.list.index with name_id==0

Fixes:
Panic: file hash.c: line 213 (hash_table_insert_node): assertion failed: (key != NULL)

8 years agolib-storage: Add asserts to make sure lookup_abort is being used correctly.
Timo Sirainen [Mon, 20 Feb 2017 17:35:45 +0000 (19:35 +0200)] 
lib-storage: Add asserts to make sure lookup_abort is being used correctly.

8 years agolib-storage, pop3-migration: Reset lookup_abort before continuing to search
Timo Sirainen [Mon, 20 Feb 2017 17:34:25 +0000 (19:34 +0200)] 
lib-storage, pop3-migration: Reset lookup_abort before continuing to search

This doesn't really fix anything right now, but it'll allow adding the
asserts in the following commit.

8 years agoauth: Make sure tokeninfo or introspection URL is given
Aki Tuomi [Tue, 21 Feb 2017 09:52:59 +0000 (11:52 +0200)] 
auth: Make sure tokeninfo or introspection URL is given

8 years agoauth: Make tokeninfo optional
Aki Tuomi [Tue, 21 Feb 2017 09:21:19 +0000 (11:21 +0200)] 
auth: Make tokeninfo optional

It is not supported by all OAuth2 solutions

8 years agolib-oauth2: Support basic authorization
Aki Tuomi [Tue, 21 Feb 2017 09:18:37 +0000 (11:18 +0200)] 
lib-oauth2: Support basic authorization

8 years agolib-lda: Do not involve mail-deliver plugin unnecessarely
Aki Tuomi [Mon, 20 Feb 2017 12:50:39 +0000 (14:50 +0200)] 
lib-lda: Do not involve mail-deliver plugin unnecessarely

If no mail delivery by LDA/LMTP is being done, do not
hook into the process.

Fixes signal 11 crash with lazy-expunge.

8 years agolib-compression: Fix test-compression to build without zlib
Timo Sirainen [Mon, 20 Feb 2017 12:26:41 +0000 (14:26 +0200)] 
lib-compression: Fix test-compression to build without zlib

8 years agoimap: Revert change to use [PARSE] in FETCH replies.
Timo Sirainen [Mon, 20 Feb 2017 12:07:23 +0000 (14:07 +0200)] 
imap: Revert change to use [PARSE] in FETCH replies.

Lets leave this for v2.3. Apparently Roundcube has some workarounds that
assume [UNKNOWNCTE].

Partially reverts 8fe64e2af5b6ce7b6ffa6453beaf569dca089e59

8 years agopop3c: Add no pipelining pop3c feature
Aki Tuomi [Mon, 20 Feb 2017 07:18:45 +0000 (09:18 +0200)] 
pop3c: Add no pipelining pop3c feature

This should help with certain broken pop3c
servers that advertise that they support pipelining
but they really don't.

8 years agov2.2.28.rc1 released 2.2.28.rc1
Timo Sirainen [Mon, 20 Feb 2017 09:34:05 +0000 (11:34 +0200)] 
v2.2.28.rc1 released

8 years agoPartially implemented IMAP SEARCH=X-MIMEPART capability.
Stephan Bosch [Tue, 24 May 2016 23:57:08 +0000 (01:57 +0200)] 
Partially implemented IMAP SEARCH=X-MIMEPART capability.

This capability is currently Dovecot-specific.

8 years agolib-imap: Created test-imap-envelope.
Stephan Bosch [Sat, 14 Jan 2017 12:33:05 +0000 (13:33 +0100)] 
lib-imap: Created test-imap-envelope.

8 years agolib-imap: imap-envelope: Added function for parsing ENVELOPE from string.
Stephan Bosch [Thu, 29 Dec 2016 13:02:05 +0000 (14:02 +0100)] 
lib-imap: imap-envelope: Added function for parsing ENVELOPE from string.

8 years agolib-imap: Added more comments to imap-bodystructure and imap-envelope.
Stephan Bosch [Wed, 26 Oct 2016 21:44:47 +0000 (23:44 +0200)] 
lib-imap: Added more comments to imap-bodystructure and imap-envelope.

8 years agolib-imap: imap-bodystructure: Added support for making imap_bodystructure_parse(...
Stephan Bosch [Sun, 23 Oct 2016 23:45:18 +0000 (01:45 +0200)] 
lib-imap: imap-bodystructure: Added support for making imap_bodystructure_parse() work without a pre-existing message_part tree.

It can now create the tree from the BODYSTRUCTURE string itself.

8 years agolib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch [Sun, 23 Oct 2016 23:01:19 +0000 (01:01 +0200)] 
lib-mail: message-part-data: Implemented message_part_data_get_filename().

Gets the message part's filename if it has any.

8 years agolib-mail: message-part-data: Renamed struct message_part_envelope_data to message_par...
Stephan Bosch [Sun, 23 Oct 2016 22:19:05 +0000 (00:19 +0200)] 
lib-mail: message-part-data: Renamed struct message_part_envelope_data to message_part_envelope.

8 years agolib-imap: imap-envelope: Moved imap_envelope_headers to lib-mail/message-part-data...
Stephan Bosch [Sun, 23 Oct 2016 20:29:49 +0000 (22:29 +0200)] 
lib-imap: imap-envelope: Moved imap_envelope_headers to lib-mail/message-part-data as message_part_envelope_headers.

8 years agolib-imap: imap-bodystructure: Moved message_part_data header parsing and query functi...
Stephan Bosch [Sun, 23 Oct 2016 18:05:33 +0000 (20:05 +0200)] 
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.

Moved code from imap-bodystructure and imap-envelope.

8 years agolib-imap: imap-bodystructure: Renamed imap_bodystructure_is_plain_7bit() to message_p...
Stephan Bosch [Sun, 23 Oct 2016 17:47:12 +0000 (19:47 +0200)] 
lib-imap: imap-bodystructure: Renamed imap_bodystructure_is_plain_7bit() to message_part_data_is_plain_7bit().

8 years agolib-imap: imap-envelope: Renamed imap_envelope_parse_header() to message_part_envelop...
Stephan Bosch [Sun, 23 Oct 2016 17:00:10 +0000 (19:00 +0200)] 
lib-imap: imap-envelope: Renamed imap_envelope_parse_header() to message_part_envelope_parse_from_header().

8 years agolib-imap: imap-evenvelope: Changed imap_envelope_get_field() into a private equivalent.
Stephan Bosch [Sun, 23 Oct 2016 16:10:01 +0000 (18:10 +0200)] 
lib-imap: imap-evenvelope: Changed imap_envelope_get_field() into a private equivalent.

8 years agolib-imap: imap-bodystructure: Renamed imap_bodystructure_parse_header() to message_pa...
Stephan Bosch [Sun, 23 Oct 2016 15:51:59 +0000 (17:51 +0200)] 
lib-imap: imap-bodystructure: Renamed imap_bodystructure_parse_header() to message_part_data_parse_from_header().

8 years agolib-imap: imap-bodystructure: Grouped together functions relating to the conversion...
Stephan Bosch [Sun, 23 Oct 2016 15:27:07 +0000 (17:27 +0200)] 
lib-imap: imap-bodystructure: Grouped together functions relating to the conversion of BODYSTRUCTURE to BODY.

This only moves code.

8 years agolib-imap: imap-bodystructure: Changed struct message_part_body to contain fully decod...
Stephan Bosch [Sun, 23 Oct 2016 14:50:25 +0000 (16:50 +0200)] 
lib-imap: imap-bodystructure: Changed struct message_part_body to contain fully decoded data.

Contained unparsed IMAP string data before.

8 years agolib-imap: imap-envelope: Added function to parse struct message_part_envelope_data...
Stephan Bosch [Sun, 23 Oct 2016 14:49:37 +0000 (16:49 +0200)] 
lib-imap: imap-envelope: Added function to parse struct message_part_envelope_data from parsed imap args.

8 years agolib-imap: imap-bodystructure: Renamed `d' parameter to `data' in parse_content_header...
Stephan Bosch [Sun, 23 Oct 2016 12:06:44 +0000 (14:06 +0200)] 
lib-imap: imap-bodystructure: Renamed `d' parameter to `data' in parse_content_header() function.

8 years agolib-imap: imap-envelope: Removed useless pool field from struct message_part_envelope...
Stephan Bosch [Sun, 23 Oct 2016 11:52:10 +0000 (13:52 +0200)] 
lib-imap: imap-envelope: Removed useless pool field from struct message_part_envelope_data.

8 years agolib-imap: imap-bodystructure: Removed useless pool field from struct message_part_data.
Stephan Bosch [Sun, 23 Oct 2016 11:50:05 +0000 (13:50 +0200)] 
lib-imap: imap-bodystructure: Removed useless pool field from struct message_part_data.

8 years agolib-mail: Gave message_part_data its own field in struct message_part.
Stephan Bosch [Sun, 23 Oct 2016 11:29:43 +0000 (13:29 +0200)] 
lib-mail: Gave message_part_data its own field in struct message_part.

8 years agolib-imap: imap-bodystructure: Renamed struct message_part_body_data to message_part_data.
Stephan Bosch [Sun, 23 Oct 2016 11:10:11 +0000 (13:10 +0200)] 
lib-imap: imap-bodystructure: Renamed struct message_part_body_data to message_part_data.

8 years agolib-imap: Removed existing envelope parsing function.
Stephan Bosch [Sun, 23 Oct 2016 10:10:44 +0000 (12:10 +0200)] 
lib-imap: Removed existing envelope parsing function.

This is currently only used by imaptest. Alternative API is provided in later commit.

8 years agolib-imap: test-imap-bodystructure: Added normalization tests.
Stephan Bosch [Sun, 8 Jan 2017 11:00:15 +0000 (12:00 +0100)] 
lib-imap: test-imap-bodystructure: Added normalization tests.

8 years agolib-imap: imap-bodystructure: Allow alternative syntax and omitted optional elements...
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.

8 years agolib-imap: test-imap-bodystructure: Added more tests.
Stephan Bosch [Mon, 9 Jan 2017 15:29:26 +0000 (16:29 +0100)] 
lib-imap: test-imap-bodystructure: Added more tests.

8 years agolib-imap: test-imap-bodystructure: Improved handing of parse errors.
Stephan Bosch [Mon, 9 Jan 2017 15:20:29 +0000 (16:20 +0100)] 
lib-imap: test-imap-bodystructure: Improved handing of parse errors.

Actually show the parse error.

8 years agolib-imap: test-imap-bodystructure: Added support for more than one test case.
Stephan Bosch [Mon, 9 Jan 2017 15:16:46 +0000 (16:16 +0100)] 
lib-imap: test-imap-bodystructure: Added support for more than one test case.

8 years agolib-imap: imap-bodystructure: Fixed parse error message about invalid Content-M5...
Stephan Bosch [Sun, 8 Jan 2017 21:50:02 +0000 (22:50 +0100)] 
lib-imap: imap-bodystructure: Fixed parse error message about invalid Content-M5 field.

8 years agoexample-config: Add mail_sort_max_read_count setting.
Timo Sirainen [Sun, 19 Feb 2017 23:24:09 +0000 (01:24 +0200)] 
example-config: Add mail_sort_max_read_count setting.

8 years agoexample-config: Add mail_vsize_bg_after_count setting.
Timo Sirainen [Sun, 19 Feb 2017 23:16:56 +0000 (01:16 +0200)] 
example-config: Add mail_vsize_bg_after_count setting.

8 years agoexample-config: Add imap_fetch_failure setting.
Timo Sirainen [Sun, 19 Feb 2017 23:00:05 +0000 (01:00 +0200)] 
example-config: Add imap_fetch_failure setting.

8 years agolib-mail: Fix matched-parameter in HEADER_FILTER_ADD_MISSING_EOH callback
Timo Sirainen [Sun, 19 Feb 2017 22:26:28 +0000 (00:26 +0200)] 
lib-mail: Fix matched-parameter in HEADER_FILTER_ADD_MISSING_EOH callback

The matched-parameter in the regular EOH callback is the reverse of what
it's in v2.3 tree. So preserve it here.

8 years ago.gitignore: Fixed location of ignored m4 files.
Stephan Bosch [Sun, 19 Feb 2017 22:03:40 +0000 (23:03 +0100)] 
.gitignore: Fixed location of ignored m4 files.

Probably got cherry-picked wrong from development branch.

8 years agolib-http: test-http-response-parse: Properly test multiple sequential responses.
Stephan Bosch [Sat, 4 Feb 2017 15:15:57 +0000 (16:15 +0100)] 
lib-http: test-http-response-parse: Properly test multiple sequential responses.

8 years agoauth: oauth2 mechanism: Fixed implicit boolean expression involving a pointer.
Stephan Bosch [Sun, 19 Feb 2017 20:58:54 +0000 (21:58 +0100)] 
auth: oauth2 mechanism: Fixed implicit boolean expression involving a pointer.

Found with Clang -Wstrict-bool.

8 years agolib-storage: Add explicit MAIL_ERROR_LOOKUP_ABORT error
Timo Sirainen [Sat, 18 Feb 2017 03:01:50 +0000 (05:01 +0200)] 
lib-storage: Add explicit MAIL_ERROR_LOOKUP_ABORT error

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.

8 years agolib-storage: Add mail.access_type
Timo Sirainen [Fri, 17 Feb 2017 17:29:03 +0000 (19:29 +0200)] 
lib-storage: Add mail.access_type

8 years agolib-storage: Add mail_sort_max_read_count setting.
Timo Sirainen [Fri, 17 Feb 2017 17:07:53 +0000 (19:07 +0200)] 
lib-storage: Add mail_sort_max_read_count setting.

This controls how many slow mail accesses sorting can perform before it
fails:

a NO [LIMIT] Requested sort would have taken too long

The SORT reply is still returned, but it's likely not correct.

8 years agolib-storage: Add MAIL_ERROR_LIMIT
Timo Sirainen [Fri, 17 Feb 2017 16:56:23 +0000 (18:56 +0200)] 
lib-storage: Add MAIL_ERROR_LIMIT

8 years agoimap: If SEARCH/SORT fails but returns some results, send them to client.
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.

8 years agolib-storage: Fix error handling when searching mails
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.

8 years agolib-storage: Search optimization - avoid parsing message_parts unnecessarily
Timo Sirainen [Fri, 17 Feb 2017 16:24:31 +0000 (18:24 +0200)] 
lib-storage: Search optimization - avoid parsing message_parts unnecessarily

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.

8 years agolib-storage: Fix error handling when sorting mails.
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.

8 years agolib-storage: Change vsize calculation to use the new mail_stream_opened
Timo Sirainen [Fri, 17 Feb 2017 14:31:52 +0000 (16:31 +0200)] 
lib-storage: Change vsize calculation to use the new mail_stream_opened

This avoids calling mail_get_virtual_size() twice and is a bit cleaner
approach.

8 years agolib-storage: Add mail.mail_stream_opened and .mail_metadata_accessed
Timo Sirainen [Fri, 17 Feb 2017 14:20:06 +0000 (16:20 +0200)] 
lib-storage: Add mail.mail_stream_opened and .mail_metadata_accessed

These allow determining after mail_*() calls how efficiently they were
performed.

8 years agolib-storage: Clarify what MAIL_LOOKUP_ABORT_READ_MAIL means.
Timo Sirainen [Fri, 17 Feb 2017 14:14:39 +0000 (16:14 +0200)] 
lib-storage: Clarify what MAIL_LOOKUP_ABORT_READ_MAIL means.

It should maybe even be renamed to something clearer.

8 years agodsync: Don't assert-crash if duplicate attributes are seen
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.

8 years agoimap: Fix running time in tagged command replies.
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.

8 years agodoveadm: Add explicit mail_storage_init/deinit() calls
Timo Sirainen [Sun, 19 Feb 2017 00:03:08 +0000 (02:03 +0200)] 
doveadm: Add explicit mail_storage_init/deinit() calls

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.

8 years agolib-storage: mail_storage_init/deinit() is now reference counted.
Timo Sirainen [Sun, 19 Feb 2017 00:02:20 +0000 (02:02 +0200)] 
lib-storage: mail_storage_init/deinit() is now reference counted.

This allows calling them multiple times and only the final deinit frees the
data.

8 years agolib-storage: Assert-crash if duplicate internal hooks are added.
Timo Sirainen [Sun, 19 Feb 2017 00:01:24 +0000 (02:01 +0200)] 
lib-storage: Assert-crash if duplicate internal hooks are added.

8 years agofs-posix: Add "no-fsync" parameter.
Timo Sirainen [Sun, 19 Feb 2017 13:54:53 +0000 (15:54 +0200)] 
fs-posix: Add "no-fsync" parameter.

This disables calling fdatasync() when fs_write() was done with
FS_OPEN_FLAG_FSYNC. Useful for making tests faster.

8 years agoimap: Code cleanup - Remove duplicate flags from imap_fetch_state
Timo Sirainen [Sun, 19 Feb 2017 12:49:20 +0000 (14:49 +0200)] 
imap: Code cleanup - Remove duplicate flags from imap_fetch_state

All the cur_flushed, line_partial and line_finished were about the same
thing.

8 years agoimap: Fix sending UID only when necessary on broken FETCHes.
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).

8 years agoimap: Include info about last command in disconnection log line.
Timo Sirainen [Thu, 16 Feb 2017 18:39:12 +0000 (20:39 +0200)] 
imap: Include info about last command in disconnection log line.

Only if LOGOUT isn't sent, because that's already visible.

8 years agoimap: Code cleanup - Move code to client_command_stats_append()
Timo Sirainen [Thu, 16 Feb 2017 18:29:46 +0000 (20:29 +0200)] 
imap: Code cleanup - Move code to client_command_stats_append()

8 years agoimap: Add imap_client.logged_out at LOGOUT
Timo Sirainen [Thu, 16 Feb 2017 18:17:32 +0000 (20:17 +0200)] 
imap: Add imap_client.logged_out at LOGOUT

This is useful for determining if client did a clean logout

8 years agoimap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen [Thu, 16 Feb 2017 18:14:55 +0000 (20:14 +0200)] 
imap: Code cleanup - move command stats to struct client_command_stats

8 years agomech-oauth2: Clarify logging
Aki Tuomi [Fri, 17 Feb 2017 13:46:38 +0000 (15:46 +0200)] 
mech-oauth2: Clarify logging