]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
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.

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 agolib-storage: Fixed a boolean expression.
Stephan Bosch [Thu, 20 Oct 2016 13:54:40 +0000 (15:54 +0200)] 
lib-storage: Fixed a boolean expression.

Problem found with clang -Wstrict-bool.

8 years agolib-storage: treat empty root_dir as an empty string
Josef 'Jeff' Sipek [Mon, 17 Oct 2016 13:13:21 +0000 (09:13 -0400)] 
lib-storage: treat empty root_dir as an empty string

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 agoimapc: don't mix positional and designated initialization
Josef 'Jeff' Sipek [Wed, 12 Oct 2016 18:32:51 +0000 (14:32 -0400)] 
imapc: don't mix positional and designated initialization

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

8 years agolib-storage: Add mail_namespace_get_driver_settings() and use it.
Timo Sirainen [Mon, 14 Nov 2016 21:43:07 +0000 (22:43 +0100)] 
lib-storage: Add mail_namespace_get_driver_settings() and use it.

It obsoletes mail_storage_get_driver_settings().

8 years agoimapc: use serialized settings as unique_root_dir
Josef 'Jeff' Sipek [Mon, 17 Oct 2016 13:18:27 +0000 (09:18 -0400)] 
imapc: use serialized settings as unique_root_dir

Without this, it is not possible to instantiate multiple imapc storages.
Any attempts to will result in multiple namespaces sharing the same storage,
regardless of if that was the intention.

8 years agolib-storage: Add struct mail_namespace.user_set
Timo Sirainen [Mon, 14 Nov 2016 21:32:42 +0000 (22:32 +0100)] 
lib-storage: Add struct mail_namespace.user_set

8 years agolib-storage: Use mail_namespace_alloc() for mail_namespaces_init_location()
Timo Sirainen [Mon, 14 Nov 2016 17:34:02 +0000 (18:34 +0100)] 
lib-storage: Use mail_namespace_alloc() for mail_namespaces_init_location()

Based on patch by Jeff Sipek

8 years agolib-storage: Add mail_namespace_alloc()
Timo Sirainen [Mon, 14 Nov 2016 17:33:37 +0000 (18:33 +0100)] 
lib-storage: Add mail_namespace_alloc()

This makes it easier to create new namespaces.
Based on patch by Jeff Sipek

8 years agolib-storage: Add asserts to make sure mailbox_header_lookup_ctx is used correctly.
Timo Sirainen [Thu, 10 Nov 2016 11:19:05 +0000 (13:19 +0200)] 
lib-storage: Add asserts to make sure mailbox_header_lookup_ctx is used correctly.

8 years agolib-index: Added mail_index_transaction_get_highest_modseq()
Timo Sirainen [Mon, 14 Nov 2016 16:41:23 +0000 (17:41 +0100)] 
lib-index: Added mail_index_transaction_get_highest_modseq()

8 years agolib-index: Added internal mail_index_transaction_finish_so_far()
Timo Sirainen [Mon, 14 Nov 2016 16:37:31 +0000 (17:37 +0100)] 
lib-index: Added internal mail_index_transaction_finish_so_far()

This can be called multiple times before mail_index_transaction_finish().
It's going to perform all the work of reordering mails and dropping
unnecessary changes that can be done before changing sequences to UIDs.

This will be needed for the following patch that implements
mail_index_transaction_get_highest_modseq().

8 years agolib-index: Assert if mail_index_transaction_sort_appends() sees any uid==0
Timo Sirainen [Mon, 14 Nov 2016 16:22:53 +0000 (17:22 +0100)] 
lib-index: Assert if mail_index_transaction_sort_appends() sees any uid==0

Every mail must have an UID at this stage.

8 years agoconfigure: Fix build with old OpenSSL without SSL_clear_options
Paul Howarth [Mon, 31 Oct 2016 10:49:38 +0000 (10:49 +0000)] 
configure: Fix build with old OpenSSL without SSL_clear_options

SSL_clear_options was introduced in OpenSSL 0.9.8m but may be
backported to older versions in "enterprise" OS releases, so a version
check is insufficient here.

It was originally implemented as a macro but is a function in more
recent OpenSSL versions, so a test that works for both cases is needed.

8 years agolib-index: Make sure an already-corrupted index/log isn't written
Timo Sirainen [Thu, 17 Nov 2016 15:13:09 +0000 (17:13 +0200)] 
lib-index: Make sure an already-corrupted index/log isn't written

8 years agoimapc: Fix assert-crash when deleting mailbox triggers mailbox_get_open_status().
Timo Sirainen [Thu, 17 Nov 2016 00:48:20 +0000 (02:48 +0200)] 
imapc: Fix assert-crash when deleting mailbox triggers mailbox_get_open_status().

For example vsize header updating triggers this.

Fixes:
Panic: file mail-storage.c: line 1683: unreached

8 years agolib-storage: Fix compiler warnings about enum mismatches
Timo Sirainen [Wed, 16 Nov 2016 19:40:37 +0000 (21:40 +0200)] 
lib-storage: Fix compiler warnings about enum mismatches

8 years agoLAYOUT=index: Try to rename corrupted mailbox name during mailbox open.
Timo Sirainen [Wed, 16 Nov 2016 01:11:30 +0000 (03:11 +0200)] 
LAYOUT=index: Try to rename corrupted mailbox name during mailbox open.

8 years agolib-storage: Added struct mailbox.corrupted_mailbox_name
Timo Sirainen [Wed, 16 Nov 2016 01:10:10 +0000 (03:10 +0200)] 
lib-storage: Added struct mailbox.corrupted_mailbox_name

This allows backends that are adding lost mailboxes to mailbox list index to
indicate that they don't actually know the name of the mailbox, and the
mailbox list index should try to figure it out and rename the mailbox to its
proper name.

8 years agoLAYOUT=index: Don't write corrupted mailbox names to box-name header.
Timo Sirainen [Wed, 16 Nov 2016 01:06:31 +0000 (03:06 +0200)] 
LAYOUT=index: Don't write corrupted mailbox names to box-name header.

This way when opening a mailbox the box-name header isn't overwritten by
a corrupted name.

Keep track of the corrupted names with MAILBOX_LIST_INDEX_FLAG_CORRUPTED_NAME
flag in list index records. The flag isn't removed until the mailbox is
renamed.

8 years agolib-storage: Preserve box-name header when rebuilding index.
Timo Sirainen [Wed, 16 Nov 2016 01:01:22 +0000 (03:01 +0200)] 
lib-storage: Preserve box-name header when rebuilding index.

8 years agodoveadm dump: Add support for the new box-name index header.
Timo Sirainen [Tue, 15 Nov 2016 23:44:58 +0000 (01:44 +0200)] 
doveadm dump: Add support for the new box-name index header.

8 years agoLAYOUT=index: Update mailbox name to mailbox index's header when opening.
Timo Sirainen [Tue, 15 Nov 2016 23:43:34 +0000 (01:43 +0200)] 
LAYOUT=index: Update mailbox name to mailbox index's header when opening.

This way if the mailbox list index gets lost, a recent mailbox name is still
available.

8 years agolib-storage: Prevent renaming mailbox under itself.
Timo Sirainen [Tue, 15 Nov 2016 23:09:57 +0000 (01:09 +0200)] 
lib-storage: Prevent renaming mailbox under itself.

This resulted earlier in a loop, which broke the mailbox index.
Note that IMAP already prevented this, so it could only be triggered by
other tools, like doveadm.

8 years agolib-storage: Prevent parent loops in mailbox list index
Timo Sirainen [Tue, 15 Nov 2016 23:04:18 +0000 (01:04 +0200)] 
lib-storage: Prevent parent loops in mailbox list index

8 years agolib-storage: Fix invalid parents in LAYOUT=index
Timo Sirainen [Tue, 15 Nov 2016 23:03:20 +0000 (01:03 +0200)] 
lib-storage: Fix invalid parents in LAYOUT=index

Previously it just kept complaining without fixing the errors.

8 years agolib-storage: Improve mailbox list index corruption errors
Timo Sirainen [Tue, 15 Nov 2016 23:01:58 +0000 (01:01 +0200)] 
lib-storage: Improve mailbox list index corruption errors

8 years agolib-storage: If LAYOUT=index loses mailbox names, write the generated ones to index.
Timo Sirainen [Tue, 15 Nov 2016 22:57:06 +0000 (00:57 +0200)] 
lib-storage: If LAYOUT=index loses mailbox names, write the generated ones to index.

Previously it just kept complaining and regenerating new names, without
actually fixing up the situation.

8 years agolib-storage: Fix handling LAYOUT=index losing mailbox names
Timo Sirainen [Tue, 15 Nov 2016 22:55:38 +0000 (00:55 +0200)] 
lib-storage: Fix handling LAYOUT=index losing mailbox names

It lost all the mailbox names.

8 years agoconfig: Match local_name using dns-util
Aki Tuomi [Fri, 11 Nov 2016 11:40:55 +0000 (13:40 +0200)] 
config: Match local_name using dns-util

This way it correctly handles wildcards.

8 years agolib-dns: Add tests for dns-util
Aki Tuomi [Fri, 11 Nov 2016 11:36:23 +0000 (13:36 +0200)] 
lib-dns: Add tests for dns-util