]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
8 years agolib: Add hmac helpers
Aki Tuomi [Tue, 29 Nov 2016 21:18:56 +0000 (23:18 +0200)] 
lib: Add hmac helpers

These run hmac for given data with given parameters
and returns stack allocated buffer. They are helpful
when doing lots of HMACs, such as the AWS4 signing
protocol.

8 years agolib: add tests for HMAC-SHA256 from RFC 4231
Martti Rannanjärvi [Tue, 29 Nov 2016 13:20:26 +0000 (15:20 +0200)] 
lib: add tests for HMAC-SHA256 from RFC 4231

8 years agomail-crypt: Do not attempt to cache keys on failure
Aki Tuomi [Mon, 28 Nov 2016 21:05:16 +0000 (23:05 +0200)] 
mail-crypt: Do not attempt to cache keys on failure

8 years agoautogen: Use HTTPS for wiki
Aki Tuomi [Tue, 29 Nov 2016 08:57:49 +0000 (10:57 +0200)] 
autogen: Use HTTPS for wiki

8 years agolib-dcrypt: Add error handling for dcrypt_key_id_private
Aki Tuomi [Mon, 28 Nov 2016 13:20:01 +0000 (15:20 +0200)] 
lib-dcrypt: Add error handling for dcrypt_key_id_private

8 years agomail-crypt: Add error handling for mailbox_open in tests
Aki Tuomi [Mon, 28 Nov 2016 13:17:55 +0000 (15:17 +0200)] 
mail-crypt: Add error handling for mailbox_open in tests

8 years agodoveadm-mail-crypt: Skip existing keys properly
Aki Tuomi [Mon, 28 Nov 2016 13:15:21 +0000 (15:15 +0200)] 
doveadm-mail-crypt: Skip existing keys properly

When generating new keypairs, handle existing keys
correctly when skipping them.

8 years agomail-crypt: Do not attempt to cache freed keypair
Aki Tuomi [Mon, 28 Nov 2016 12:52:50 +0000 (14:52 +0200)] 
mail-crypt: Do not attempt to cache freed keypair

8 years agomail-crypt-acl: Use mailbox_get_last_error instead of error
Aki Tuomi [Mon, 28 Nov 2016 12:51:19 +0000 (14:51 +0200)] 
mail-crypt-acl: Use mailbox_get_last_error instead of error

8 years agomail-crypt: Fail if key is not found and save_version less than 2
Aki Tuomi [Mon, 28 Nov 2016 12:45:01 +0000 (14:45 +0200)] 
mail-crypt: Fail if key is not found and save_version less than 2

Fail if save version is set to 0 or 1, instead
of trying to use undefined value for public key.

8 years agomail-crypt: Skip undef values if OpenSSL is <1.0.2
Aki Tuomi [Mon, 28 Nov 2016 11:36:56 +0000 (13:36 +0200)] 
mail-crypt: Skip undef values if OpenSSL is <1.0.2

OpenSSL 1.0.1 and earlier generate undef warnings due
to using stack as randomness source in a way that
valgrind does not like, so we disable undef value
checks for mail-crypt-plugin.

8 years agom4: Detect OpenSSL version 1.0.2
Aki Tuomi [Mon, 28 Nov 2016 11:32:16 +0000 (13:32 +0200)] 
m4: Detect OpenSSL version 1.0.2

valgrind cannot work in all cases if openssl
version is 1.0.2, so we need to know this to
selectively disable valgrind.

8 years agodovecot.m4: Add NOUNDEF option to run-test.sh
Aki Tuomi [Mon, 28 Nov 2016 12:12:23 +0000 (14:12 +0200)] 
dovecot.m4: Add NOUNDEF option to run-test.sh

Using this environment variable will disable
undefined value errors in valgrind.

8 years agolib-index: mail_transaction_log_file_sync(): Don't mix I/O errors and corruption
Timo Sirainen [Mon, 28 Nov 2016 11:52:40 +0000 (13:52 +0200)] 
lib-index: mail_transaction_log_file_sync(): Don't mix I/O errors and corruption

8 years agoacl: Fix compiler warning
Timo Sirainen [Mon, 28 Nov 2016 12:40:15 +0000 (14:40 +0200)] 
acl: Fix compiler warning

8 years agoacl-plugin: remove acl_defaults_from_inbox option
Martti Rannanjärvi [Mon, 28 Nov 2016 03:21:06 +0000 (05:21 +0200)] 
acl-plugin: remove acl_defaults_from_inbox option

INBOX ACLs will be used by default from now on.

8 years agolib-index: Fix assert-crash after "log file shrank" error.
Timo Sirainen [Mon, 28 Nov 2016 11:04:47 +0000 (13:04 +0200)] 
lib-index: Fix assert-crash after "log file shrank" error.

Fixes:
Panic: file buffer.c: line 316 (buffer_set_used_size): assertion failed: (used_size <= buf->alloc)

8 years agoAdd suppression for openssl leak
Aki Tuomi [Thu, 24 Nov 2016 23:45:29 +0000 (01:45 +0200)] 
Add suppression for openssl leak

8 years agomail-crypt: Add manpage
Aki Tuomi [Thu, 24 Nov 2016 22:45:35 +0000 (00:45 +0200)] 
mail-crypt: Add manpage

8 years agomail-crypt: Add mail-crypt plugin
Aki Tuomi [Thu, 24 Nov 2016 12:48:03 +0000 (14:48 +0200)] 
mail-crypt: Add mail-crypt plugin

8 years agolib-dcrypt: Use module_dir setting
Aki Tuomi [Fri, 25 Nov 2016 07:49:25 +0000 (09:49 +0200)] 
lib-dcrypt: Use module_dir setting

8 years agolib-dcrypt: Add module_dir setting
Aki Tuomi [Fri, 25 Nov 2016 07:48:43 +0000 (09:48 +0200)] 
lib-dcrypt: Add module_dir setting

This is needed for unit tests that require
dcrypt, so that they can load backend
without installing it first.

8 years agolib-http: client: Fixed assert failure occurring when a new connection fails for...
Stephan Bosch [Mon, 21 Nov 2016 22:19:26 +0000 (23:19 +0100)] 
lib-http: client: Fixed assert failure occurring when a new connection fails for a peer that has active connections.

Fixes: Panic: file http-client-queue.c: line 481 (http_client_queue_connection_failure): assertion failed: (queue->cur_peer == NULL)
8 years agoglobal: Added missing copyright notices.
Stephan Bosch [Mon, 28 Nov 2016 02:26:01 +0000 (03:26 +0100)] 
global: Added missing copyright notices.

8 years agolib-storage: Fix raw storage to sync mailboxes correctly.
Timo Sirainen [Fri, 25 Nov 2016 14:14:16 +0000 (16:14 +0200)] 
lib-storage: Fix raw storage to sync mailboxes correctly.

Broken by b9da8540e665138b3cad0b637c08c0ab7d7a7eeb

8 years agolib-storage: Fix error handling in mailbox_list_index_refresh_force()
Timo Sirainen [Fri, 25 Nov 2016 13:34:46 +0000 (15:34 +0200)] 
lib-storage: Fix error handling in mailbox_list_index_refresh_force()

Broken by recent changes.

8 years agomkcert.sh: Use umask to create key file as 0600
Timo Sirainen [Mon, 21 Nov 2016 23:28:33 +0000 (01:28 +0200)] 
mkcert.sh: Use umask to create key file as 0600

Fixes a race condition between creation of the file and a later chmod.
This script was mostly meant as an example though, and not really for
production use. Especially because it generates self-signed certs.
CVE-2016-4983

8 years agomdbox: Rebuild index after it's been fsck'd
Timo Sirainen [Thu, 24 Nov 2016 16:12:18 +0000 (18:12 +0200)] 
mdbox: Rebuild index after it's been fsck'd

8 years agosdbox: Rebuild index after it's been fsck'd
Timo Sirainen [Thu, 24 Nov 2016 16:12:00 +0000 (18:12 +0200)] 
sdbox: Rebuild index after it's been fsck'd

8 years agolib-storge: Call mail_storage.list_index_corrupted() when needed
Timo Sirainen [Thu, 24 Nov 2016 15:52:01 +0000 (17:52 +0200)] 
lib-storge: Call mail_storage.list_index_corrupted() when needed

The callback is called whenever mailbox list index appears to be corrupted
with LAYOUT=index. The storage is responsible for adding to the index any
mailboxes that are missing.

8 years agolib-storage: Add mail_storage.list_index_corrupted()
Timo Sirainen [Thu, 24 Nov 2016 13:50:01 +0000 (15:50 +0200)] 
lib-storage: Add mail_storage.list_index_corrupted()

The actual implementation is in the next commit.

8 years agolib-index: Add mail_index_unset_fscked()
Timo Sirainen [Thu, 24 Nov 2016 15:16:30 +0000 (17:16 +0200)] 
lib-index: Add mail_index_unset_fscked()

This can be used to easily remove MAIL_INDEX_HDR_FLAG_FSCKD. It takes a
transaction parameter instead of sync_ctx because some index rebuilds
are done with a separate transaction while the sync_ctx is rolled back.

8 years agolib-index: fsck now adds MAIL_INDEX_HDR_FLAG_FSCKD to header.
Timo Sirainen [Thu, 24 Nov 2016 13:49:15 +0000 (15:49 +0200)] 
lib-index: fsck now adds MAIL_INDEX_HDR_FLAG_FSCKD to header.

It can only be removed by an explicit header update.

8 years agolib-storage: Rename mailbox_list_index.corrupted to corrupted_names_or_parents
Timo Sirainen [Thu, 24 Nov 2016 13:41:38 +0000 (15:41 +0200)] 
lib-storage: Rename mailbox_list_index.corrupted to corrupted_names_or_parents

Makes it clearer what exactly the flag means.

8 years agolib-index: If index open fails with fsck, retry opening once.
Timo Sirainen [Thu, 24 Nov 2016 13:14:06 +0000 (15:14 +0200)] 
lib-index: If index open fails with fsck, retry opening once.

The fsck should have fixed the log offsets and open should work.

8 years agolib-index: fsck: Fix log_file_head|tail_offset properly
Timo Sirainen [Thu, 24 Nov 2016 13:12:21 +0000 (15:12 +0200)] 
lib-index: fsck: Fix log_file_head|tail_offset properly

8 years agolib-dcrypt: Add assert that vfs is initialized
Aki Tuomi [Fri, 25 Nov 2016 08:22:18 +0000 (10:22 +0200)] 
lib-dcrypt: Add assert that vfs is initialized

8 years agolib-storage: Fail if no namespaces have list=yes
Timo Sirainen [Thu, 24 Nov 2016 17:53:17 +0000 (19:53 +0200)] 
lib-storage: Fail if no namespaces have list=yes

The previous check allowed all namespaces to have list=children. This
crashed later on in mail_namespaces_get_root_sep(), because it couldn't
find any list=yes namespaces.

8 years agolib-index: Compiler warning fix
Timo Sirainen [Thu, 24 Nov 2016 22:17:45 +0000 (00:17 +0200)] 
lib-index: Compiler warning fix

8 years agolib-mail: Add randomness test to test-mail-html2text
Timo Sirainen [Tue, 22 Nov 2016 16:34:53 +0000 (18:34 +0200)] 
lib-mail: Add randomness test to test-mail-html2text

8 years agolib-mail: Fix assert-crash in mail_html2text_more() with invalid input.
Timo Sirainen [Tue, 22 Nov 2016 16:33:12 +0000 (18:33 +0200)] 
lib-mail: Fix assert-crash in mail_html2text_more() with invalid input.

parse_data() continues forward thinking that it might have valid input,
until it has enough data and realizes that there's nothing valid. This
triggers:

Panic: file mail-html2text.c: line 312 (mail_html2text_more): assertion failed: (pos >= buf_orig_size)

8 years agolib: Clarify that buffer_write() zero-fills buffer when writing past its size
Timo Sirainen [Sat, 19 Nov 2016 00:32:21 +0000 (02:32 +0200)] 
lib: Clarify that buffer_write() zero-fills buffer when writing past its size

8 years agoglobal: Code cleanup - avoid passing NULL to functions with non-null parameter
Timo Sirainen [Fri, 18 Nov 2016 23:54:14 +0000 (01:54 +0200)] 
global: Code cleanup - avoid passing NULL to functions with non-null parameter

8 years agoglobal: Avoid unnecessary unsigned integer wraps.
Timo Sirainen [Sat, 19 Nov 2016 00:00:25 +0000 (02:00 +0200)] 
global: Avoid unnecessary unsigned integer wraps.

Avoids complains from clang -fsanitize=integer

8 years agoglobal: Avoid loops unnecessarily decreasing below zero.
Timo Sirainen [Fri, 18 Nov 2016 23:59:03 +0000 (01:59 +0200)] 
global: Avoid loops unnecessarily decreasing below zero.

Avoids complains from clang -fsanitize=integer

8 years agolib: Mark md4/md5/sha1/sha2 code with ATTR_UNSIGNED_WRAPS
Timo Sirainen [Fri, 18 Nov 2016 23:57:40 +0000 (01:57 +0200)] 
lib: Mark md4/md5/sha1/sha2 code with ATTR_UNSIGNED_WRAPS

8 years agolib-index: mail_index_map_register_ext(ext_offset=-1) now sets hdr_offset=-1
Timo Sirainen [Fri, 18 Nov 2016 23:56:19 +0000 (01:56 +0200)] 
lib-index: mail_index_map_register_ext(ext_offset=-1) now sets hdr_offset=-1

It shouldn't make any difference, but this is a less confusing value.

8 years agolib: Add ATTR_UNSIGNED_WRAPS for disabling clang -fsanitize=integer
Timo Sirainen [Fri, 18 Nov 2016 23:39:42 +0000 (01:39 +0200)] 
lib: Add ATTR_UNSIGNED_WRAPS for disabling clang -fsanitize=integer

8 years agolib-index: Compiler warning fix.
Timo Sirainen [Thu, 24 Nov 2016 21:26:40 +0000 (23:26 +0200)] 
lib-index: Compiler warning fix.

8 years agolib-storage: Rotate dovecot.list.index.log* more often.
Timo Sirainen [Wed, 23 Nov 2016 21:19:05 +0000 (23:19 +0200)] 
lib-storage: Rotate dovecot.list.index.log* more often.

The history in these files isn't as important as in mailbox indexes.
Reduce disk space usage by rotating them more often and deleting the
.log.2 more quickly.

8 years agolib-index: Add mail_index_set_log_rotation()
Timo Sirainen [Wed, 23 Nov 2016 21:12:29 +0000 (23:12 +0200)] 
lib-index: Add mail_index_set_log_rotation()

8 years agolib-storage: Try harder to rename a corrupted mailbox name to its old name.
Timo Sirainen [Wed, 23 Nov 2016 20:42:03 +0000 (22:42 +0200)] 
lib-storage: Try harder to rename a corrupted mailbox name to its old name.

If the old name exists, use it as a prefix for the new name. This is
especially useful when restoring autocreated mailboxes. A new mailbox
could have already been autocreated, but it's still useful to have
the broken one renamed with the same prefix, so it'll be clear that
these mailboxes should be merged.

8 years agodsync: Do not try replace remote folder GUID when doing oneway sync
Aki Tuomi [Thu, 24 Nov 2016 17:32:44 +0000 (19:32 +0200)] 
dsync: Do not try replace remote folder GUID when doing oneway sync

Oneway sync tried to replace remote folder's GUID when
running in one way mode. This causes trouble, e.g.
when running with imapc, because you can't do this.

8 years agolib-storage: Fix rotation of dovecot.list.index.log
Timo Sirainen [Wed, 23 Nov 2016 16:43:17 +0000 (18:43 +0200)] 
lib-storage: Fix rotation of dovecot.list.index.log

After b9da8540e665138b3cad0b637c08c0ab7d7a7eeb the tail offsets weren't
being updated anymore when mail_index_sync_next() wasn't used to skip
over all the data. Mailbox list index wasn't doing this, and so the log
was never rotated since tail_offset was never equal to head_offset.

8 years agoimapc: Fix assert that checks if mail is expunged locally.
Timo Sirainen [Wed, 23 Nov 2016 15:14:48 +0000 (17:14 +0200)] 
imapc: Fix assert that checks if mail is expunged locally.

The EXPUNGE may have been sent while imapc_sync_index() was issuing
remote imapc commands. It would end up being in delayed_expunged_uids,
so the assert needs to check that too.

Fixes:
Panic: file imapc-sync.c: line 290 (imapc_initial_sync_check): assertion failed: (mail_index_is_expunged(view, lseq))

8 years agoimapc: Cleanup - change delayed_expunged_uids to seq_range.
Timo Sirainen [Wed, 23 Nov 2016 15:14:14 +0000 (17:14 +0200)] 
imapc: Cleanup - change delayed_expunged_uids to seq_range.

This simplifies the next commit.

8 years agoauth: Don't crash expanding %variables when username isn't set.
Timo Sirainen [Wed, 23 Nov 2016 13:57:03 +0000 (15:57 +0200)] 
auth: Don't crash expanding %variables when username isn't set.

This continues the auth-policy fix in
c3d3faa4f72a676e183f34be960cff13a5a725ae

8 years agosdbox: Don't log an error if stub is added twice
Timo Sirainen [Wed, 23 Nov 2016 11:25:54 +0000 (13:25 +0200)] 
sdbox: Don't log an error if stub is added twice

There's no locking for them, so it's fine if two processes add the same
mail. The second one could be ignored, but it was a bit easier to just
let it rename over the first one.

8 years agoauth: Fix auth-policy crash when username is NULL
Aki Tuomi [Wed, 23 Nov 2016 11:16:19 +0000 (13:16 +0200)] 
auth: Fix auth-policy crash when username is NULL

If SASL request is invalid, or incomplete, and username
is left NULL, handle it gracefully by adding just
NUL byte in auth policy digest for username.

8 years agolib-storage: require MAIL_STORAGE_CLASS_FLAG_STUBS when caching
Josef 'Jeff' Sipek [Tue, 22 Nov 2016 15:21:24 +0000 (10:21 -0500)] 
lib-storage: require MAIL_STORAGE_CLASS_FLAG_STUBS when caching

If we are going to be using the storage for caching, we should check that
the storage actually supports mail stubs.

8 years agolib-fts: Add randomness test to test-fts-tokenizer
Timo Sirainen [Tue, 22 Nov 2016 16:00:13 +0000 (18:00 +0200)] 
lib-fts: Add randomness test to test-fts-tokenizer

8 years agolib-fts: Make sure address tokenizer can't return empty tokens.
Timo Sirainen [Tue, 22 Nov 2016 14:35:58 +0000 (16:35 +0200)] 
lib-fts: Make sure address tokenizer can't return empty tokens.

This happened when address was a token that first looked like it could be
a valid address, but then got truncated due to reaching maxlen, followed
by truncating the UTF8-sequence and finally all the rest of the '-' or
'.' chars that were valid at the beginning of the address are stripped
away by fts_tokenizer_delete_trailing_invalid_char(), leaving nothing left.

Fixes:
Panic: file fts-tokenizer.c: line 206 (fts_tokenizer_next): assertion failed: (ret <= 0 || (*token_r)[0] != '\0')

8 years agolib-fts: Fix fts_tokenizer_delete_trailing_partial_char() unit test
Timo Sirainen [Tue, 22 Nov 2016 15:31:02 +0000 (17:31 +0200)] 
lib-fts: Fix fts_tokenizer_delete_trailing_partial_char() unit test

8 years agolib-index: Handle invalid headers as "corruption", not "temporary error"
Timo Sirainen [Tue, 22 Nov 2016 10:03:01 +0000 (12:03 +0200)] 
lib-index: Handle invalid headers as "corruption", not "temporary error"

This is especially required for "Header's corrupted flag is set" error,
which won't get fixed otherwise.

It's a bit more questionable if we should treat major version or CPU
architecture change as corruption, but it's possible those only exist
because of corruption. It's also very unlikely that either is really
happening. Ideally there would be a hash that verifies whether the
header is corrupted or not.

8 years agodict-client: dict_lookup*() deleted the first byte of the result.
Timo Sirainen [Tue, 22 Nov 2016 08:59:36 +0000 (10:59 +0200)] 
dict-client: dict_lookup*() deleted the first byte of the result.

8 years agoquota-clone: Flush quota-clone 10s after quota update if it's not already done
Timo Sirainen [Mon, 21 Nov 2016 12:05:42 +0000 (14:05 +0200)] 
quota-clone: Flush quota-clone 10s after quota update if it's not already done

This way a long-running IMAP session can't keep the quota-clone desynced
for a long time.

8 years agoquota-clone: Code cleanup - moved recursion check to quota_clone_flush()
Timo Sirainen [Mon, 21 Nov 2016 12:02:11 +0000 (14:02 +0200)] 
quota-clone: Code cleanup - moved recursion check to quota_clone_flush()

8 years agolib-dict: Add extra NULL-check to make static analyzer happier
Timo Sirainen [Mon, 21 Nov 2016 21:43:08 +0000 (23:43 +0200)] 
lib-dict: Add extra NULL-check to make static analyzer happier

str_array_length() already checked NULL internally though.

8 years agolib-index: Limit mmap errors in txn log file to 1/s
Aki Tuomi [Mon, 21 Nov 2016 11:57:23 +0000 (13:57 +0200)] 
lib-index: Limit mmap errors in txn log file to 1/s

8 years agolib-index: Limit mmap errors in index cache to 1/s
Aki Tuomi [Mon, 21 Nov 2016 11:53:50 +0000 (13:53 +0200)] 
lib-index: Limit mmap errors in index cache to 1/s

8 years agolib-index: Limit mmap syscall errors in index to 1/s
Aki Tuomi [Mon, 21 Nov 2016 11:34:57 +0000 (13:34 +0200)] 
lib-index: Limit mmap syscall errors in index to 1/s

8 years agolib-index: Do not crash if log is missing
Aki Tuomi [Mon, 21 Nov 2016 11:33:42 +0000 (13:33 +0200)] 
lib-index: Do not crash if log is missing

Fixes sigfault when index and index.log files are
corrupted.

8 years agodict-client: Server can now send command replies in any order.
Timo Sirainen [Mon, 21 Nov 2016 17:05:49 +0000 (19:05 +0200)] 
dict-client: Server can now send command replies in any order.

This way one slow lookup doesn't block all the other ones.

This change keeps backwards compatibility in the dict protocol for both
client and server.

8 years agodict: Make sure iterate doesn't add to ostream when it's already full.
Timo Sirainen [Mon, 21 Nov 2016 17:04:26 +0000 (19:04 +0200)] 
dict: Make sure iterate doesn't add to ostream when it's already full.

8 years agodict: Moved iterate's corking to more correct location.
Timo Sirainen [Mon, 21 Nov 2016 16:52:25 +0000 (18:52 +0200)] 
dict: Moved iterate's corking to more correct location.

Commands' input handling already corks ostream in connection.c.
ostream's flush callback corks the ostream automatically.
So the only place left for corking is in dict iterate callback.

8 years agodict-client: Include reconnection-status in slow dict lookup messages.
Timo Sirainen [Mon, 21 Nov 2016 16:46:48 +0000 (18:46 +0200)] 
dict-client: Include reconnection-status in slow dict lookup messages.

8 years agodict-client: Add warn_slow_msecs setting
Timo Sirainen [Mon, 21 Nov 2016 14:55:45 +0000 (16:55 +0200)] 
dict-client: Add warn_slow_msecs setting

This allows configuring the default 5 seconds "slow dict lookup" warning.

8 years agodict-client: Add time spent in dict-server to "slow dict lookup" messages.
Timo Sirainen [Mon, 21 Nov 2016 14:45:55 +0000 (16:45 +0200)] 
dict-client: Add time spent in dict-server to "slow dict lookup" messages.

This way you can see if the slowness was due to some communication problem
between dict-client/server or internally in dict server.

This change keeps backwards compatibility in the dict protocol for both
client and server.

8 years agodict-client: Code cleanup - handle tab-unescaping before callbacks.
Timo Sirainen [Mon, 21 Nov 2016 14:44:38 +0000 (16:44 +0200)] 
dict-client: Code cleanup - handle tab-unescaping before callbacks.

8 years agolib-index: Revert log flooding prevention / 3c014db6f
Timo Sirainen [Mon, 21 Nov 2016 11:29:12 +0000 (13:29 +0200)] 
lib-index: Revert log flooding prevention / 3c014db6f

This was intended only for mmap() errors.

8 years agofts: Fixed potential crash when indexing mails.
Timo Sirainen [Sat, 19 Nov 2016 02:04:02 +0000 (04:04 +0200)] 
fts: Fixed potential crash when indexing mails.

Normally it seems like compilers had built code that had added a NULL
after the array, but there was no guarantee for that.

8 years agoimap: Fix recent flags importing when un-hibernating
Timo Sirainen [Fri, 18 Nov 2016 14:03:00 +0000 (16:03 +0200)] 
imap: Fix recent flags importing when un-hibernating

The initial RECENT counter that was sent didn't include pre-hibernation
\Recent flags.

\Recent flags were also added for mails that were already expunged, which
could have caused recent counter to be wrong later on, and possibly
assert-crash with:

Panic: file index-status.c: line 130 (index_storage_get_open_status): assertion failed: (status_r->recent <= status_r->messages)

8 years agolib-index: Improve errors - return reason in mail_transaction_log_refresh()
Timo Sirainen [Fri, 18 Nov 2016 14:58:00 +0000 (16:58 +0200)] 
lib-index: Improve errors - return reason in mail_transaction_log_refresh()

8 years agolib-index: Improve errors - return reason in mail_transaction_log_file_open()
Timo Sirainen [Fri, 18 Nov 2016 14:52:31 +0000 (16:52 +0200)] 
lib-index: Improve errors - return reason in mail_transaction_log_file_open()

8 years agolib-index: Add more information to "Missing middle file" error.
Timo Sirainen [Fri, 18 Nov 2016 14:41:18 +0000 (16:41 +0200)] 
lib-index: Add more information to "Missing middle file" error.

8 years agolib-index: mail_transaction_log_find_file() - remove wrong optimization.
Timo Sirainen [Fri, 18 Nov 2016 14:27:33 +0000 (16:27 +0200)] 
lib-index: mail_transaction_log_find_file() - remove wrong optimization.

When opening the index, it's possible that:

process A: .log is opened with seq=1
process B: Rotates the .log and writes a new dovecot.index with
  log_file_seq=2
process A: dovecot.index is opened. mail_transaction_log_view_set() now
  wants to file log_file_seq=2 with mail_transaction_log_find_file(), but
  because open_count==0, the .log isn't refreshed.

8 years agolib-index: Compiler warning fix
Timo Sirainen [Fri, 18 Nov 2016 14:15:59 +0000 (16:15 +0200)] 
lib-index: Compiler warning fix

8 years agolib-index: If mmap() fails, include the attempted size in the error.
Timo Sirainen [Fri, 18 Nov 2016 13:46:39 +0000 (15:46 +0200)] 
lib-index: If mmap() fails, include the attempted size in the error.

8 years agolib-storage: Fix checking stub_seq failure in mailbox_save_set_uid()
Timo Sirainen [Fri, 18 Nov 2016 13:39:45 +0000 (15:39 +0200)] 
lib-storage: Fix checking stub_seq failure in mailbox_save_set_uid()

8 years agosdbox: Implement support for mail stubs
Timo Sirainen [Fri, 18 Nov 2016 13:17:08 +0000 (15:17 +0200)] 
sdbox: Implement support for mail stubs

8 years agolib-storage: Add support for storing "mail stubs"
Timo Sirainen [Fri, 18 Nov 2016 13:16:27 +0000 (15:16 +0200)] 
lib-storage: Add support for storing "mail stubs"

These allow treating a storage backend as a cache where the mail bodies
don't necessarily exist.

8 years agoimapc: %zu isn't standard, use PRIuSIZE_T instead.
Timo Sirainen [Fri, 18 Nov 2016 12:10:02 +0000 (14:10 +0200)] 
imapc: %zu isn't standard, use PRIuSIZE_T instead.

8 years agolib: Add connection.allow_empty_args_input
Timo Sirainen [Tue, 15 Nov 2016 16:39:08 +0000 (18:39 +0200)] 
lib: Add connection.allow_empty_args_input

This simplifies input_args() callbacks since they don't always have to check
for args[0] == NULL. This is enabled by default, because none of the current
users want it and it's somewhat unlikely there even will be those in future.

8 years agolib-storage: fix index_mail_get_headers return value
Josef 'Jeff' Sipek [Thu, 17 Nov 2016 20:59:02 +0000 (15:59 -0500)] 
lib-storage: fix index_mail_get_headers return value

And make it more obvious that we're not setting the actual return value in
index_mail_get_first_header.

8 years agolib-index: Fix detecting whether caller synced everything in mailbox.
Timo Sirainen [Thu, 17 Nov 2016 23:23:13 +0000 (01:23 +0200)] 
lib-index: Fix detecting whether caller synced everything in mailbox.

When mailbox_index_sync_begin() was followed by _commit(), without _next()s
in the middle actually syncing the mailbox, the tail_offset was updated to
indicate that the mailbox was fully synced. Existing code didn't rely on
this, so it probably didn't break anything.

This code hasn't worked for a long time, because log_view is always read
fully to the end in _sync_begin().

8 years agolib-storage: Add mail_storage_service_user_get_pool()
Timo Sirainen [Mon, 14 Nov 2016 23:42:27 +0000 (00:42 +0100)] 
lib-storage: Add mail_storage_service_user_get_pool()

8 years agoglobal: Replace some settings_parse_line() calls with settings_parse_keyvalue()
Timo Sirainen [Mon, 14 Nov 2016 23:41:38 +0000 (00:41 +0100)] 
global: Replace some settings_parse_line() calls with settings_parse_keyvalue()

8 years agolib-settings: Add settings_parse_keyvalue()
Timo Sirainen [Mon, 14 Nov 2016 23:36:57 +0000 (00:36 +0100)] 
lib-settings: Add settings_parse_keyvalue()

8 years agolib-settings: Avoid duplicating settings' values when not needed
Timo Sirainen [Mon, 14 Nov 2016 22:32:05 +0000 (23:32 +0100)] 
lib-settings: Avoid duplicating settings' values when not needed

8 years agoimapc: Use struct mail_namespace.user_set
Timo Sirainen [Mon, 14 Nov 2016 21:57:41 +0000 (22:57 +0100)] 
imapc: Use struct mail_namespace.user_set