]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
4 years agolib-index: Try harder to open index with MAIL_INDEX_OPEN_FLAG_READONLY
Timo Sirainen [Thu, 1 Apr 2021 14:24:10 +0000 (17:24 +0300)] 
lib-index: Try harder to open index with MAIL_INDEX_OPEN_FLAG_READONLY

The readonly-flag is used when rebuilding index or dumping indexes.
In both cases it's better to try to open the index as best as possible,
since fsck isn't allowed.

4 years agolib-lua: Remove obsolete threading check
Josef 'Jeff' Sipek [Thu, 6 May 2021 19:17:05 +0000 (15:17 -0400)] 
lib-lua: Remove obsolete threading check

We support multiple lua thread as long as they are created using the
dlua_script_new_thread() helper.

4 years agodict-ldap: Fix calling dict_wait() on async lookup
Timo Sirainen [Wed, 5 May 2021 13:47:43 +0000 (16:47 +0300)] 
dict-ldap: Fix calling dict_wait() on async lookup

The dict_wait() could have waited forever because nothing stopped the
ioloop. Also fix calling the callback with the proper active ioloop.

4 years agodict-redis: dict-client: Use the proper active ioloop while calling commit() callbacks
Timo Sirainen [Wed, 5 May 2021 13:41:21 +0000 (16:41 +0300)] 
dict-redis: dict-client: Use the proper active ioloop while calling commit() callbacks

If the callbacks did any IO/timeout changes, they would have gone to a wrong
ioloop. This would have caused a warning about IO/timeout leak though, so
it doesn't seem like there were such code paths currently.

4 years agodict-memcached-ascii: Assert-crash if dict ioloop gets any unexpected IOs or timeouts
Timo Sirainen [Wed, 5 May 2021 13:37:52 +0000 (16:37 +0300)] 
dict-memcached-ascii: Assert-crash if dict ioloop gets any unexpected IOs or timeouts

4 years agodict-client: Assert-crash if dict ioloop gets any unexpected IOs or timeouts
Timo Sirainen [Mon, 22 Mar 2021 15:05:24 +0000 (17:05 +0200)] 
dict-client: Assert-crash if dict ioloop gets any unexpected IOs or timeouts

4 years agodict-client: Use the proper active ioloop while calling commit() and lookup() callbacks
Timo Sirainen [Mon, 22 Mar 2021 14:50:04 +0000 (16:50 +0200)] 
dict-client: Use the proper active ioloop while calling commit() and lookup() callbacks

If the callbacks did any IO/timeout changes, they would have gone to a wrong
ioloop.

4 years agolib: Add io_loop_is_empty()
Timo Sirainen [Mon, 22 Mar 2021 14:59:09 +0000 (16:59 +0200)] 
lib: Add io_loop_is_empty()

4 years agostats: Truncate field values to 1000 bytes with log exporter
Timo Sirainen [Wed, 5 May 2021 08:19:24 +0000 (11:19 +0300)] 
stats: Truncate field values to 1000 bytes with log exporter

This attempts to prevent log lines from growing longer than 4 kB, which
causes them to wrap.

4 years agoimap: copy/move: Refresh source mailbox before copying/moving
Timo Sirainen [Tue, 4 May 2021 11:12:20 +0000 (14:12 +0300)] 
imap: copy/move: Refresh source mailbox before copying/moving

This way if another session had just expunged mails, the expunges will be
noticed and the copy/move will abort early.

4 years agoimap: move: Sync source mailbox between commits
Timo Sirainen [Thu, 29 Apr 2021 12:49:00 +0000 (15:49 +0300)] 
imap: move: Sync source mailbox between commits

This way the messages are actually expunged from storage after the commit,
not just requested to be expunged. Most importantly this means that if
another session attempts to start moving the same messages it can be noticed
earlier and one of the moves aborted.

4 years agoimap: Add imap_search_anyset_to_uidset()
Timo Sirainen [Thu, 29 Apr 2021 12:45:44 +0000 (15:45 +0300)] 
imap: Add imap_search_anyset_to_uidset()

4 years agoimap: Allow imap_search_seqset_iter_init() to iterate over uidset also
Timo Sirainen [Thu, 29 Apr 2021 12:46:48 +0000 (15:46 +0300)] 
imap: Allow imap_search_seqset_iter_init() to iterate over uidset also

4 years agolib-storage: Fix mailbox_get_uid_range() to handle "*" correctly
Timo Sirainen [Thu, 29 Apr 2021 12:43:10 +0000 (15:43 +0300)] 
lib-storage: Fix mailbox_get_uid_range() to handle "*" correctly

Previously attempting to convert e.g. 1:* range would just assert-crash.
There were no such callers currently though.

4 years agolib-storage: Always set struct mail.expunged
Timo Sirainen [Thu, 29 Apr 2021 12:39:29 +0000 (15:39 +0300)] 
lib-storage: Always set struct mail.expunged

Previously it was set only when some error noticed that there was a problem
accessing the mail. Now this is set immediately in mail_set_seq(). This
allows e.g. IMAP COPY/MOVE to abort when it encounters expunged mails.

4 years agolib-program-client: test-program-client-unix - Add test for delayed disconnect after...
Stephan Bosch [Tue, 4 May 2021 00:19:07 +0000 (02:19 +0200)] 
lib-program-client: test-program-client-unix - Add test for delayed disconnect after sending result code.

4 years agolib-program-client: test-program-client-net - Add test for delayed disconnect after...
Stephan Bosch [Mon, 3 May 2021 21:54:11 +0000 (23:54 +0200)] 
lib-program-client: test-program-client-net - Add test for delayed disconnect after sending result code.

4 years agolib-program-client: test-program-client-unix - Fix server-side argument count check.
Stephan Bosch [Tue, 4 May 2021 00:12:21 +0000 (02:12 +0200)] 
lib-program-client: test-program-client-unix - Fix server-side argument count check.

4 years agolib-program-client: test-program-client-net - Fix server-side argument count check.
Stephan Bosch [Tue, 4 May 2021 00:11:34 +0000 (02:11 +0200)] 
lib-program-client: test-program-client-net - Fix server-side argument count check.

4 years agolib-program-client: program-client-remote - Fix result parsing in the istream.
Stephan Bosch [Mon, 3 May 2021 21:54:26 +0000 (23:54 +0200)] 
lib-program-client: program-client-remote - Fix result parsing in the istream.

This fixes internal errors occurring when the parent stream is fully read before
EOF is signaled. This was caused by the fact that the final bytes were not
always reserved properly for parsing, so that these ended up being exposed to
and eaten by the application. At the end, the result parsing code would be faced
with no data, thereby causing an internal error to be returned by the calling
application.

This came to light as CI tests involving Sieve extprograms failed irregularly.
This problem only occurs when a (slight) delay exists between the last data
being sent and the connection being closed by the script service, making this
hard to reproduce. It typically occurred only under high server load.

4 years agolib-program-client: program-client-remote - Fix error handling of istream.
Stephan Bosch [Mon, 3 May 2021 21:51:36 +0000 (23:51 +0200)] 
lib-program-client: program-client-remote - Fix error handling of istream.

These days, input streams also set eof upon error, making the existing code path
wrong.

4 years agolib-program-client: program-client-remote - Add proper error and debug logging for...
Stephan Bosch [Mon, 3 May 2021 23:46:22 +0000 (01:46 +0200)] 
lib-program-client: program-client-remote - Add proper error and debug logging for result code parsing.

4 years agolib-program-client: program-client-local - Add debug for child start problem.
Stephan Bosch [Mon, 3 May 2021 23:34:30 +0000 (01:34 +0200)] 
lib-program-client: program-client-local - Add debug for child start problem.

4 years agolib-program-client: Reformat test-program-client-unix.c.
Stephan Bosch [Mon, 3 May 2021 21:49:11 +0000 (23:49 +0200)] 
lib-program-client: Reformat test-program-client-unix.c.

4 years agolib-program-client: Reformat test-program-client-net.c.
Stephan Bosch [Mon, 3 May 2021 21:43:47 +0000 (23:43 +0200)] 
lib-program-client: Reformat test-program-client-net.c.

4 years agolib-program-client: Reformat program-client-remote.c.
Stephan Bosch [Mon, 3 May 2021 21:35:38 +0000 (23:35 +0200)] 
lib-program-client: Reformat program-client-remote.c.

4 years agolib-test: Convert test_assert()s to fatal asserts when running static analyzer
Timo Sirainen [Thu, 22 Apr 2021 09:07:12 +0000 (12:07 +0300)] 
lib-test: Convert test_assert()s to fatal asserts when running static analyzer

This avoids unnecessary warnings about unit tests crashing when
test_assert()s fail. The warnings are correct, but it's a bit unnecessary
to write the failure code paths that nicely.

4 years agolib: Perform most of the event logging within data stack frame
Timo Sirainen [Mon, 26 Apr 2021 11:14:45 +0000 (14:14 +0300)] 
lib: Perform most of the event logging within data stack frame

4 years agolib-storage: Add data stack frames to mail_set_*()
Timo Sirainen [Mon, 26 Apr 2021 11:13:09 +0000 (14:13 +0300)] 
lib-storage: Add data stack frames to mail_set_*()

This can reduce data stack usage significantly with mail thread building.

4 years agolib: data-stack - If frame doesn't change current block, no blocks need to be freed
Timo Sirainen [Wed, 31 Mar 2021 13:26:00 +0000 (16:26 +0300)] 
lib: data-stack - If frame doesn't change current block, no blocks need to be freed

This is a micro-optimization to t_pop() to avoid an extra if-check.

4 years agolib: data-stack - Use stack_block.left_lowwater only with DEBUG
Timo Sirainen [Wed, 31 Mar 2021 13:22:24 +0000 (16:22 +0300)] 
lib: data-stack - Use stack_block.left_lowwater only with DEBUG

4 years agolib: Remove data_stack_set_clean_after_pop()
Timo Sirainen [Wed, 31 Mar 2021 13:17:30 +0000 (16:17 +0300)] 
lib: Remove data_stack_set_clean_after_pop()

4 years agolib: data-stack - Move frame memory allocation inside data stack block
Timo Sirainen [Wed, 31 Mar 2021 13:04:47 +0000 (16:04 +0300)] 
lib: data-stack - Move frame memory allocation inside data stack block

4 years agolib: data-stack - Replace stack_frame_block with a single stack_frame
Timo Sirainen [Wed, 31 Mar 2021 11:25:47 +0000 (14:25 +0300)] 
lib: data-stack - Replace stack_frame_block with a single stack_frame

This simplifies the code at the cost of more memory allocations.
However, this will be fixed by the following commit.

4 years agolib: data-stack - Add data_stack_grow event
Timo Sirainen [Mon, 16 Nov 2020 18:54:20 +0000 (20:54 +0200)] 
lib: data-stack - Add data_stack_grow event

This is now always enabled, not just in debug builds.

4 years agolib: t_get_bytes_available() - Fix return value when current_block is almost full
Timo Sirainen [Wed, 31 Mar 2021 11:40:12 +0000 (14:40 +0300)] 
lib: t_get_bytes_available() - Fix return value when current_block is almost full

4 years agolib-settings: settings_check() - Avoid growing data stack unnecessarily
Timo Sirainen [Mon, 16 Nov 2020 12:56:50 +0000 (14:56 +0200)] 
lib-settings: settings_check() - Avoid growing data stack unnecessarily

Each check_func() could have increased data stack usage. Add it inside
a data stack frame to avoid it growing unnecessarily large.

4 years agolib: module_dir_*load*(): Avoid growing data stack when checking duplicates
Timo Sirainen [Mon, 16 Nov 2020 12:58:08 +0000 (14:58 +0200)] 
lib: module_dir_*load*(): Avoid growing data stack when checking duplicates

This check could have unnecessarily grown data stack size when many plugins
are installed.

4 years agoglobal: Use T_END_PASS_STR() where possible
Timo Sirainen [Mon, 16 Nov 2020 17:37:26 +0000 (19:37 +0200)] 
global: Use T_END_PASS_STR() where possible

4 years agolib: data-stack - Add t_pop_pass_str() and T_END_PASS_STR[_IF]()
Timo Sirainen [Mon, 16 Nov 2020 16:23:59 +0000 (18:23 +0200)] 
lib: data-stack - Add t_pop_pass_str() and T_END_PASS_STR[_IF]()

This simplifies passing error strings out of stack frames. For example:

   const char *error;
   T_BEGIN {
     ...
     if (ret < 0)
       error = t_strdup_printf("foo() failed: %m");
   } T_END_PASS_STR_IF(ret < 0, &error);
   // error is still valid

4 years agolib: Add data_stack_frame_contains()
Timo Sirainen [Wed, 31 Mar 2021 08:56:10 +0000 (11:56 +0300)] 
lib: Add data_stack_frame_contains()

4 years agolib: Add data_stack_get_alloc_size()
Timo Sirainen [Wed, 31 Mar 2021 10:19:00 +0000 (13:19 +0300)] 
lib: Add data_stack_get_alloc_size()

4 years agolib: Fix data_stack_get_used_size() to return correct size
Timo Sirainen [Wed, 31 Mar 2021 09:59:29 +0000 (12:59 +0300)] 
lib: Fix data_stack_get_used_size() to return correct size

It only included the last allocated block's used size.

4 years agolib: data-stack - Don't set stack_block.next=NULL after mem_block_alloc() already...
Timo Sirainen [Wed, 31 Mar 2021 09:52:47 +0000 (12:52 +0300)] 
lib: data-stack - Don't set stack_block.next=NULL after mem_block_alloc() already did it

4 years agolib: data-stack - mem_block_alloc() - Set stack_block.left to final value immediately
Timo Sirainen [Wed, 31 Mar 2021 09:51:34 +0000 (12:51 +0300)] 
lib: data-stack - mem_block_alloc() - Set stack_block.left to final value immediately

There's no need to first set it to 0 and then have the caller change it
again.

4 years agolib: data-stack - Remove unused_frame_blocks
Timo Sirainen [Mon, 16 Nov 2020 22:36:27 +0000 (00:36 +0200)] 
lib: data-stack - Remove unused_frame_blocks

It's not that expensive to keep allocating them as needed, and it's a
potential waste of memory to keep them around.

4 years agolib: data-stack - Don't keep largest unused block in memory
Timo Sirainen [Mon, 16 Nov 2020 22:32:45 +0000 (00:32 +0200)] 
lib: data-stack - Don't keep largest unused block in memory

It's not that expensive to allocate it again, but it might be expensive to
keep allocated a block that became huge due to a bug. The huge block could
be just wasting memory without ever being used again.

4 years agolib: data-stack - Add unit test for data_stack_set_clean_after_pop()
Timo Sirainen [Mon, 16 Nov 2020 16:09:44 +0000 (18:09 +0200)] 
lib: data-stack - Add unit test for data_stack_set_clean_after_pop()

4 years agolib: data-stack - Rename variables in clean_after_pop handling
Timo Sirainen [Mon, 16 Nov 2020 16:08:57 +0000 (18:08 +0200)] 
lib: data-stack - Rename variables in clean_after_pop handling

These new variables make more sense than the old ones.

4 years agolib: data-stack - Rename lowwater to left_lowwater
Timo Sirainen [Mon, 16 Nov 2020 16:06:55 +0000 (18:06 +0200)] 
lib: data-stack - Rename lowwater to left_lowwater

This describes its behavior better. Also add a comment explaining what
exactly it is.

4 years agolib: data-stack - Rename block_space_used[] to block_space_left[]
Timo Sirainen [Mon, 16 Nov 2020 15:57:39 +0000 (17:57 +0200)] 
lib: data-stack - Rename block_space_used[] to block_space_left[]

This describes its behavior better. Also add a comment explaining what
exactly it is.

4 years agolib: data-stack - Use INITIAL_STACK_SIZE without growing it to nearest power
Timo Sirainen [Mon, 16 Nov 2020 13:25:36 +0000 (15:25 +0200)] 
lib: data-stack - Use INITIAL_STACK_SIZE without growing it to nearest power

4 years agoglobal: Never use t_push(NULL)
Timo Sirainen [Wed, 31 Mar 2021 10:13:22 +0000 (13:13 +0300)] 
global: Never use t_push(NULL)

A non-NULL name is expected by the debug logging.

4 years agolib: Recalculate events' debug logging state after replacing event filters
Timo Sirainen [Wed, 31 Mar 2021 10:11:16 +0000 (13:11 +0300)] 
lib: Recalculate events' debug logging state after replacing event filters

4 years agolib-index: test-mail-index-sync-ext - Fix memory leak
Timo Sirainen [Mon, 3 May 2021 16:40:23 +0000 (19:40 +0300)] 
lib-index: test-mail-index-sync-ext - Fix memory leak

4 years agolib-smtp: smtp-server-transaction - Make sure current data command is recorded as...
Stephan Bosch [Mon, 12 Apr 2021 20:43:57 +0000 (22:43 +0200)] 
lib-smtp: smtp-server-transaction - Make sure current data command is recorded as soon as possible.

This prevents crashes when replies are sent early. This also prevents crashes
when invalid DATA commands are sent in succession.

4 years agolib-smtp: smtp-server-transaction - Rename smtp_server_transaction_last_data() to...
Stephan Bosch [Mon, 12 Apr 2021 20:50:48 +0000 (22:50 +0200)] 
lib-smtp: smtp-server-transaction - Rename smtp_server_transaction_last_data() to smtp_server_transaction_data_command().

4 years agolib-smtp: smtp-server-recipient - Rename smtp_server_recipient_last_data() to smtp_se...
Stephan Bosch [Mon, 12 Apr 2021 20:46:17 +0000 (22:46 +0200)] 
lib-smtp: smtp-server-recipient - Rename smtp_server_recipient_last_data() to smtp_server_recipient_data_command().

4 years agologin-common: Add client.list_type to better track which linked list client belongs to
Timo Sirainen [Mon, 3 May 2021 11:07:44 +0000 (14:07 +0300)] 
login-common: Add client.list_type to better track which linked list client belongs to

Add asserts to make sure the client is always in the expected list.

4 years agologin-common: Fix handling destroyed_clients linked list
Timo Sirainen [Fri, 23 Apr 2021 13:43:36 +0000 (16:43 +0300)] 
login-common: Fix handling destroyed_clients linked list

The client needs to be removed from destroyed_clients linked list before
it's added to client_fd_proxies linked list.

Broken by 1c622cdbe08df2f642e28923c39894516143ae2a

4 years agolib-index: test-mail-index-sync-ext - Fix to link with the full libindex
Timo Sirainen [Sat, 6 Feb 2021 18:11:14 +0000 (20:11 +0200)] 
lib-index: test-mail-index-sync-ext - Fix to link with the full libindex

4 years agolib-index: Add/update comments related to cloning maps
Timo Sirainen [Tue, 2 Feb 2021 15:41:28 +0000 (17:41 +0200)] 
lib-index: Add/update comments related to cloning maps

4 years agolib-index: Don't call mail_index_modseq_sync_map_replaced() if nothing changed
Timo Sirainen [Tue, 2 Feb 2021 15:25:33 +0000 (17:25 +0200)] 
lib-index: Don't call mail_index_modseq_sync_map_replaced() if nothing changed

4 years agolib-index: Add comments to struct mail_transaction_log and related
Timo Sirainen [Tue, 2 Feb 2021 14:13:50 +0000 (16:13 +0200)] 
lib-index: Add comments to struct mail_transaction_log and related

4 years agolib-index: Rename MAIL_TRANSACTION_LOG_LOCK_CHANGE_TIMEOUT to .._DOTLOCK_..
Timo Sirainen [Tue, 2 Feb 2021 14:13:01 +0000 (16:13 +0200)] 
lib-index: Rename MAIL_TRANSACTION_LOG_LOCK_CHANGE_TIMEOUT to .._DOTLOCK_..

4 years agolib-index: Rename mail_transaction_log_file.lock_created to lock_create_time
Timo Sirainen [Tue, 2 Feb 2021 14:02:58 +0000 (16:02 +0200)] 
lib-index: Rename mail_transaction_log_file.lock_created to lock_create_time

4 years agolib-index: Move mail_transaction_log_file_get_modseq_next_offset() to its own file
Timo Sirainen [Tue, 2 Feb 2021 13:59:34 +0000 (15:59 +0200)] 
lib-index: Move mail_transaction_log_file_get_modseq_next_offset() to its own file

This nicely isolates the modseq_cache code to its own file.

4 years agolib-index: Remove unused mail_transaction_log_file.saved_tail_sync_offset
Timo Sirainen [Tue, 2 Feb 2021 13:26:08 +0000 (15:26 +0200)] 
lib-index: Remove unused mail_transaction_log_file.saved_tail_sync_offset

Shrinking tail_offsets have been ignored since
082e82792b8ac33ad42beac510441b37a3c50737

4 years agolib-index: Rename mail_transaction_log_file.saved_tail_offset to last_read_hdr_tail_o...
Timo Sirainen [Tue, 2 Feb 2021 13:24:53 +0000 (15:24 +0200)] 
lib-index: Rename mail_transaction_log_file.saved_tail_offset to last_read_hdr_tail_offset

This describes better what it's actually used for.

4 years agolib-index: Remove mail_transaction_log.nfs_flush
Timo Sirainen [Tue, 2 Feb 2021 13:07:02 +0000 (15:07 +0200)] 
lib-index: Remove mail_transaction_log.nfs_flush

Just access it via mail_index.flags like it's done elsewhere.

4 years agolib-index: Rename mail_transaction_log.dotlock_count to dotlock_refcount
Timo Sirainen [Tue, 2 Feb 2021 12:59:02 +0000 (14:59 +0200)] 
lib-index: Rename mail_transaction_log.dotlock_count to dotlock_refcount

Also change it to a signed integer and add asserts to make sure it's >=0.
This is how refcounts are handled generally in Dovecot.

4 years agolib-index: Update mail caching decisions explanation comment.
Timo Sirainen [Mon, 1 Feb 2021 21:05:50 +0000 (23:05 +0200)] 
lib-index: Update mail caching decisions explanation comment.

4 years agolib-index: Add test-mail-cache-fields unit test
Timo Sirainen [Mon, 1 Feb 2021 20:30:27 +0000 (22:30 +0200)] 
lib-index: Add test-mail-cache-fields unit test

4 years agolib-index: Add comments to struct mail_cache and related
Timo Sirainen [Mon, 1 Feb 2021 20:11:11 +0000 (22:11 +0200)] 
lib-index: Add comments to struct mail_cache and related

Also reorder some fields so the grouping makes more sense.

4 years agolib-index: Add comments to struct mail_cache_header and related
Timo Sirainen [Mon, 25 Jan 2021 19:10:32 +0000 (21:10 +0200)] 
lib-index: Add comments to struct mail_cache_header and related

4 years agolib-index: Add comments to mail-transaction-log.h
Timo Sirainen [Fri, 29 Jan 2021 17:11:36 +0000 (19:11 +0200)] 
lib-index: Add comments to mail-transaction-log.h

4 years agolib-index: Update mail_index_mail_flags comments and add MAIL_INDEX_MAIL_FLAG_UNUSED
Timo Sirainen [Mon, 25 Jan 2021 21:06:59 +0000 (23:06 +0200)] 
lib-index: Update mail_index_mail_flags comments and add MAIL_INDEX_MAIL_FLAG_UNUSED

4 years agolib-index: Add comments to struct mail_index_ext_header and related
Timo Sirainen [Mon, 25 Jan 2021 20:42:37 +0000 (22:42 +0200)] 
lib-index: Add comments to struct mail_index_ext_header and related

4 years agolib-index: Add comments to struct mail_index_header and related
Timo Sirainen [Mon, 25 Jan 2021 20:10:29 +0000 (22:10 +0200)] 
lib-index: Add comments to struct mail_index_header and related

4 years agolib-index: Add comments to struct mail_index_view
Timo Sirainen [Wed, 20 Jan 2021 17:22:06 +0000 (19:22 +0200)] 
lib-index: Add comments to struct mail_index_view

4 years agolib-index: Add comments and reorder fields in struct mail_index
Timo Sirainen [Wed, 20 Jan 2021 17:21:10 +0000 (19:21 +0200)] 
lib-index: Add comments and reorder fields in struct mail_index

The field ordering was pretty random for some fields. The new ordering
should make more sense.

4 years agolib-index: Rename mail_index.pending_log2_rotate_time to hdr_log2_rotate_time_delayed...
Timo Sirainen [Wed, 20 Jan 2021 16:43:27 +0000 (18:43 +0200)] 
lib-index: Rename mail_index.pending_log2_rotate_time to hdr_log2_rotate_time_delayed_update

This describes better what it does. Also add some comments explaining
what its purpose is.

4 years agolib-index: mail_index_expunge_handler_t - Remove seq and context parameters
Timo Sirainen [Sat, 6 Feb 2021 19:00:58 +0000 (21:00 +0200)] 
lib-index: mail_index_expunge_handler_t - Remove seq and context parameters

They're not actually used anywhere.

4 years agolib-index: mail_index_register_expunge_handler() - Remove call_always handling
Timo Sirainen [Mon, 25 Jan 2021 20:44:17 +0000 (22:44 +0200)] 
lib-index: mail_index_register_expunge_handler() - Remove call_always handling

It's not needed anymore.

4 years agolib-index: Remove "sync lost" callback handlers
Timo Sirainen [Wed, 20 Jan 2021 16:17:27 +0000 (18:17 +0200)] 
lib-index: Remove "sync lost" callback handlers

These were used to invalidate in-memory dovecot.index.cache cache with
mmap_disable=yes. This became unnecessary when cache file became
append-only.

4 years agolib-index: Move fields from struct mail_index to struct mail_index_error
Timo Sirainen [Wed, 20 Jan 2021 16:07:33 +0000 (18:07 +0200)] 
lib-index: Move fields from struct mail_index to struct mail_index_error

This clarifies which are error related fields.

nodiskspace isn't actually currently used for anything, but it seems
potentially useful in the future.

4 years agolib-index: Use mail_index_reset_error() when opening index
Timo Sirainen [Wed, 20 Jan 2021 16:04:40 +0000 (18:04 +0200)] 
lib-index: Use mail_index_reset_error() when opening index

This resets the error more cleanly than changing nodiskspace directly.

4 years agolib-index: Remove mail_index.index_lock_timeout
Timo Sirainen [Wed, 20 Jan 2021 16:01:03 +0000 (18:01 +0200)] 
lib-index: Remove mail_index.index_lock_timeout

Nothing needs it.

4 years agolib-index: Move fields from struct mail_index to struct mail_index_settings
Timo Sirainen [Wed, 20 Jan 2021 15:54:49 +0000 (17:54 +0200)] 
lib-index: Move fields from struct mail_index to struct mail_index_settings

This clarifies which fields are settings related.

4 years agolib-index: Remove mail_index_view.index_sync_view
Timo Sirainen [Wed, 20 Jan 2021 15:35:20 +0000 (17:35 +0200)] 
lib-index: Remove mail_index_view.index_sync_view

Nothing was using it.

4 years agolib-index: Remove mail_index_view.transactions and related functions
Timo Sirainen [Wed, 20 Jan 2021 15:34:01 +0000 (17:34 +0200)] 
lib-index: Remove mail_index_view.transactions and related functions

It's enough to have transaction_list, nothing needs the count.

4 years agolib-index: Change mail_index_view_get_transaction_count() into _have_transactions()
Timo Sirainen [Wed, 20 Jan 2021 15:31:36 +0000 (17:31 +0200)] 
lib-index: Change mail_index_view_get_transaction_count() into _have_transactions()

This allows removing mail_index_view.transactions in the next commit.

4 years agolib-index: Rename mail_index.last_read_log_* to main_index_hdr_log_*
Timo Sirainen [Wed, 20 Jan 2021 15:22:20 +0000 (17:22 +0200)] 
lib-index: Rename mail_index.last_read_log_* to main_index_hdr_log_*

Also update the comment to describe better what the variables do.

4 years agolib-index: Remove mail_index_map.hdr_base
Timo Sirainen [Tue, 19 Jan 2021 10:51:07 +0000 (12:51 +0200)] 
lib-index: Remove mail_index_map.hdr_base

It was just causing unnecessary complexity. Simpler to just keep
hdr_copy_buf always up-to-date and access it directly.

4 years agolib-index: MAIL_TRANSACTION_LOG_VERSION_* - Add also FEATURE_ suffix for feature...
Timo Sirainen [Fri, 29 Jan 2021 15:45:45 +0000 (17:45 +0200)] 
lib-index: MAIL_TRANSACTION_LOG_VERSION_* - Add also FEATURE_ suffix for feature macros

This more clearly differentiates them from the other
MAIL_TRANSACTION_LOG_VERSION_* macros

4 years agolib-index: Verify that keywords in dovecot.index header don't change unexpectedly
Timo Sirainen [Fri, 29 Jan 2021 15:03:34 +0000 (17:03 +0200)] 
lib-index: Verify that keywords in dovecot.index header don't change unexpectedly

Previously this was behind DEBUG for performance reasons, but that was only
because dovecot.index file used to be modified directly. Nowadays it's rare
that the index is being re-read within the same session (most changes are
read via dovecot.index.log), so it's better to verify that things are
working correctly.

4 years agolib-index: Add and use MAIL_INDEX_MAP_HDR_OFFSET() helper macro
Timo Sirainen [Tue, 19 Jan 2021 10:48:16 +0000 (12:48 +0200)] 
lib-index: Add and use MAIL_INDEX_MAP_HDR_OFFSET() helper macro

4 years agolib-index: Fill mail_index_map.hdr_copy_buf also when mmap()ing index
Timo Sirainen [Tue, 19 Jan 2021 10:42:02 +0000 (12:42 +0200)] 
lib-index: Fill mail_index_map.hdr_copy_buf also when mmap()ing index

This doesn't seem to have been necessary so far, but will be required by
the following changes.

4 years agoimap: Fix using SETMETADATA NIL to unset value
Timo Sirainen [Mon, 3 May 2021 10:15:17 +0000 (13:15 +0300)] 
imap: Fix using SETMETADATA NIL to unset value

Broken by 923362d27d9b2428e301614673cb0efba3bf928f

4 years agomaster: Explain how "client_limit is lower than required" is calculated in the warning
Timo Sirainen [Thu, 22 Apr 2021 08:36:40 +0000 (11:36 +0300)] 
master: Explain how "client_limit is lower than required" is calculated in the warning