]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
4 years agodriver-pgsql: Implement sql_get_flags() reliably
Timo Sirainen [Tue, 28 Sep 2021 12:32:56 +0000 (15:32 +0300)] 
driver-pgsql: Implement sql_get_flags() reliably

Some of the flags aren't known until server is connected to, so wait for the
connect to finish if necessary before returning the flags.

4 years agodriver-sqlpool: Implement sql_wait()
Timo Sirainen [Tue, 28 Sep 2021 12:33:47 +0000 (15:33 +0300)] 
driver-sqlpool: Implement sql_wait()

4 years agodriver-cassandra: Add wait() implementation
Siavash Tavakoli [Mon, 27 Sep 2021 10:59:09 +0000 (11:59 +0100)] 
driver-cassandra: Add wait() implementation

4 years agodriver-pgsql: Add wait() implementation
Siavash Tavakoli [Mon, 27 Sep 2021 10:58:21 +0000 (11:58 +0100)] 
driver-pgsql: Add wait() implementation

4 years agodict-sql: Add "sql_dict_wait()" implementation
Siavash Tavakoli [Mon, 27 Sep 2021 10:48:34 +0000 (11:48 +0100)] 
dict-sql: Add "sql_dict_wait()" implementation

lib-sql now has sql_wait().

4 years agolib-sql: Add "wait" vfunc
Siavash Tavakoli [Mon, 27 Sep 2021 10:46:07 +0000 (11:46 +0100)] 
lib-sql: Add "wait" vfunc

To be used in backends that support async operations. On deinit dicts
should wait for results and then exit.

4 years agodriver-pgsql: Keep a list of pending query results
Siavash Tavakoli [Mon, 27 Sep 2021 18:43:54 +0000 (19:43 +0100)] 
driver-pgsql: Keep a list of pending query results

To be used in wait() to determine if there are pending operations.

4 years agodict: Wait for all dicts to finish pending operations at shutdown
Timo Sirainen [Wed, 22 Sep 2021 17:57:06 +0000 (20:57 +0300)] 
dict: Wait for all dicts to finish pending operations at shutdown

This also changes the dict process to exit cleanly instead of early via
lib_exit().

4 years agodict: Unref dict connection immediately when connection is destroyed
Timo Sirainen [Thu, 11 Jul 2019 09:05:37 +0000 (12:05 +0300)] 
dict: Unref dict connection immediately when connection is destroyed

The delayed unrefing is needed when calling from dict command callbacks to
avoid calling dict_deinit() too early. But the connection's destroy() vfunc
can't be called directly from dict command callbacks, so there's no need
to add further delays. Especially when this happens at deinit where there is
no possibility of calling the delayed callback anymore.

4 years agodriver-pgsql: Fix escaped blob prefix
Siavash Tavakoli [Mon, 27 Sep 2021 10:42:07 +0000 (11:42 +0100)] 
driver-pgsql: Fix escaped blob prefix

Escaped strings must be prefixed with double backslash.

4 years agodriver-pgsql: Fix assert-crash when using binary fields
Siavash Tavakoli [Mon, 27 Sep 2021 10:35:38 +0000 (11:35 +0100)] 
driver-pgsql: Fix assert-crash when using binary fields

array_idx_modifiable() changed behavior in
1d4e5de8414ed93d1c810b30a91ad83d6d954861 and doesn't allocate space
anymore.

Fixes:
Panic: file array.c: line 10 (array_idx_modifiable_i): assertion failed: (idx < array->buffer->used / array->element_size)

4 years agodoveadm mail batch: Fix run() return value on errors
Timo Sirainen [Wed, 29 Sep 2021 16:04:37 +0000 (18:04 +0200)] 
doveadm mail batch: Fix run() return value on errors

The function always returned 0, even when there was an error. This practically
doesn't fix anything, but makes it work the way it was intended. It also makes
scan-build happier.

Broken by fd4360e30b695e596a5081a6080152188a12852a

4 years agomdbox: Add assert to help static analyzers
Timo Sirainen [Wed, 22 Sep 2021 16:34:32 +0000 (19:34 +0300)] 
mdbox: Add assert to help static analyzers

mdbox_sync_begin() can return 0 with sync_ctx=NULL, but not with the
parameters given here.

4 years agolib-smtp: smtp_client_transaction_get_state_name() - Fix return value
Timo Sirainen [Wed, 22 Sep 2021 16:02:24 +0000 (19:02 +0300)] 
lib-smtp: smtp_client_transaction_get_state_name() - Fix return value

Only the "new" state was returned correctly, while everything else was
wrong. This didn't really cause problems, because it was used only by
imaptest.

4 years agolib: Ignore COMPILE_ERROR_IF_TRUE() with --enable-static-checker
Timo Sirainen [Wed, 22 Sep 2021 15:46:39 +0000 (18:46 +0300)] 
lib: Ignore COMPILE_ERROR_IF_TRUE() with --enable-static-checker

4 years agolib: container_of() - Always return NULL if input pointer is NULL
Timo Sirainen [Mon, 27 Sep 2021 22:24:24 +0000 (01:24 +0300)] 
lib: container_of() - Always return NULL if input pointer is NULL

4 years agolib: container_of() - Avoid uintptr_t
Timo Sirainen [Wed, 22 Sep 2021 15:40:11 +0000 (18:40 +0300)] 
lib: container_of() - Avoid uintptr_t

Using uintptr_t confused Coverity, but char* works fine.

4 years agoindexer: Abort requests if indexer-worker disconnects unexpectedly
Timo Sirainen [Tue, 28 Sep 2021 21:21:17 +0000 (00:21 +0300)] 
indexer: Abort requests if indexer-worker disconnects unexpectedly

4 years agolib-storage: Add reason_code=mail:header_fields
Timo Sirainen [Mon, 19 Apr 2021 18:43:17 +0000 (21:43 +0300)] 
lib-storage: Add reason_code=mail:header_fields

4 years agolib-storage: Add more specific mail:* reason_codes in when prefetching
Timo Sirainen [Mon, 19 Apr 2021 18:38:35 +0000 (21:38 +0300)] 
lib-storage: Add more specific mail:* reason_codes in when prefetching

Added:
 * mail:attachment_keywords
 * mail:date
 * mail:snippet
 * mail:mime_parts
 * mail:imap_envelope
 * mail:imap_bodystructure

4 years agofts: Add reason_code=fts:index and fts:lookup
Timo Sirainen [Thu, 11 Mar 2021 21:38:01 +0000 (23:38 +0200)] 
fts: Add reason_code=fts:index and fts:lookup

Note that fts:index won't be used for email opening events, because the
emails are already opened by the indexer precache searching code due to
wanted_fields.

4 years agolib-storage: Add reason_code=mailbox:*
Timo Sirainen [Thu, 9 Sep 2021 13:45:23 +0000 (16:45 +0300)] 
lib-storage: Add reason_code=mailbox:*

Added:
 * mailbox:create
 * mailbox:update
 * mailbox:delete
 * mailbox:rename
 * mailbox:subscribe
 * mailbox:unsubscribe
 * mailbox:attributes_changed

4 years agolib-storage: Add reason_code=mailbox:search
Timo Sirainen [Wed, 17 Mar 2021 13:15:00 +0000 (15:15 +0200)] 
lib-storage: Add reason_code=mailbox:search

4 years agolib-storage: Add reason_code=mailbox:thread
Timo Sirainen [Wed, 17 Mar 2021 12:49:24 +0000 (14:49 +0200)] 
lib-storage: Add reason_code=mailbox:thread

This is split into a few different locations in the code.

4 years agolib-storage: Add reason_code=mailbox:vsize*
Timo Sirainen [Wed, 17 Mar 2021 15:48:57 +0000 (17:48 +0200)] 
lib-storage: Add reason_code=mailbox:vsize*

 * mailbox:vsize - mailbox vsize is asked
 * mailbox:vsize_update - mailbox vsize is updated (append/expunge)

4 years agolib-storage: Add reason_code=mailbox:sort
Timo Sirainen [Wed, 17 Mar 2021 15:48:33 +0000 (17:48 +0200)] 
lib-storage: Add reason_code=mailbox:sort

4 years agolib-storage: Add reason_code=mail:*
Timo Sirainen [Thu, 11 Mar 2021 17:43:22 +0000 (19:43 +0200)] 
lib-storage: Add reason_code=mail:*

 * mail:virtual_size
 * mail:physical_size
 * mail:snippet
 * mail:prefetch
 * mail:mime_parts
 * mail:date
 * mail:received_date
 * mail:save_date
 * mail:storage_id
 * mail:pop3_uidl
 * mail:pop3_order
 * mail:guid
 * mail:refcount
 * mail:refcount_id

4 years agolib-storage: Remove mailbox_set_reason()
Timo Sirainen [Thu, 11 Mar 2021 17:07:10 +0000 (19:07 +0200)] 
lib-storage: Remove mailbox_set_reason()

Event reason_codes should be used instead. Keep the "Mailbox opened"
debug message mainly because it's often used in CI tests.

4 years agoglobal: Remove mailbox_set_reason() calls
Timo Sirainen [Thu, 11 Mar 2021 17:06:00 +0000 (19:06 +0200)] 
global: Remove mailbox_set_reason() calls

These ones that are left are all rather unnecessary.

4 years agopop3: Add reason_code=pop3:cmd_<command name> to events
Timo Sirainen [Wed, 17 Mar 2021 15:40:46 +0000 (17:40 +0200)] 
pop3: Add reason_code=pop3:cmd_<command name> to events

4 years agopop3: Replace mailbox_set_reason() with reason_code=pop3:initialize
Timo Sirainen [Thu, 11 Mar 2021 17:04:36 +0000 (19:04 +0200)] 
pop3: Replace mailbox_set_reason() with reason_code=pop3:initialize

4 years agovirtual: Replace mailbox_set_reason() with reason_code=virtual:config_read
Timo Sirainen [Thu, 11 Mar 2021 15:29:59 +0000 (17:29 +0200)] 
virtual: Replace mailbox_set_reason() with reason_code=virtual:config_read

4 years agotrash: Replace mailbox_set_reason() with reason_code=trash:clean
Timo Sirainen [Thu, 11 Mar 2021 15:27:54 +0000 (17:27 +0200)] 
trash: Replace mailbox_set_reason() with reason_code=trash:clean

4 years agoquota: Replace mailbox_set_reason() with reason_code=quota:recalculate and quota...
Timo Sirainen [Tue, 9 Mar 2021 14:49:12 +0000 (16:49 +0200)] 
quota: Replace mailbox_set_reason() with reason_code=quota:recalculate and quota:count

4 years agopop3-migration: Replace mailbox_set_reason() with reason_code=pop3_migration:uidl_sync
Timo Sirainen [Thu, 11 Mar 2021 15:22:31 +0000 (17:22 +0200)] 
pop3-migration: Replace mailbox_set_reason() with reason_code=pop3_migration:uidl_sync

4 years agolazy_expunge: Replace mailbox_set_reason() with reason_code=lazy_expunge:expunge
Timo Sirainen [Thu, 11 Mar 2021 15:03:49 +0000 (17:03 +0200)] 
lazy_expunge: Replace mailbox_set_reason() with reason_code=lazy_expunge:expunge

4 years agolazy-expunge: Split off lazy_expunge_mail_expunge_move()
Timo Sirainen [Wed, 17 Mar 2021 16:23:11 +0000 (18:23 +0200)] 
lazy-expunge: Split off lazy_expunge_mail_expunge_move()

4 years agolib-storage: Replace mailbox_set_reason() with reason_code=storage:autoexpunge and...
Timo Sirainen [Thu, 11 Mar 2021 14:56:32 +0000 (16:56 +0200)] 
lib-storage: Replace mailbox_set_reason() with reason_code=storage:autoexpunge and storage:mailbox_list_rebuild

4 years agomdbox: Replace mailbox_set_reason() with reason_code=mdbox:rebuild
Timo Sirainen [Thu, 11 Mar 2021 14:53:35 +0000 (16:53 +0200)] 
mdbox: Replace mailbox_set_reason() with reason_code=mdbox:rebuild

4 years agomdbox: Split off mdbox_storage_rebuild_scan_prepare()
Timo Sirainen [Tue, 16 Mar 2021 17:02:06 +0000 (19:02 +0200)] 
mdbox: Split off mdbox_storage_rebuild_scan_prepare()

4 years agoindexer: Replace mailbox_set_reason() with reason_code=indexer:index_mailbox
Timo Sirainen [Thu, 11 Mar 2021 13:46:11 +0000 (15:46 +0200)] 
indexer: Replace mailbox_set_reason() with reason_code=indexer:index_mailbox

4 years agoimap: Add reason_code=imap:fetch_*
Timo Sirainen [Wed, 17 Mar 2021 15:28:03 +0000 (17:28 +0200)] 
imap: Add reason_code=imap:fetch_*

The main reason for these is to allow understanding why mails are being
opened. The possibilities:

 * imap:fetch_body
 * imap:fetch_header
 * imap:fetch_header_fields
 * imap:fetch_bodystructure
 * imap:fetch_size

4 years agoimap: Remove mailbox_set_reason() calls
Timo Sirainen [Thu, 11 Mar 2021 13:44:47 +0000 (15:44 +0200)] 
imap: Remove mailbox_set_reason() calls

They are now unnecessary because of the new reason_code field.

4 years agoimap: Add reason_code=imap:unhibernate for events during unhibernation.
Timo Sirainen [Thu, 11 Mar 2021 13:44:10 +0000 (15:44 +0200)] 
imap: Add reason_code=imap:unhibernate for events during unhibernation.

4 years agoimap: Add reason_code=imap:notify_update for events during NOTIFY updates
Timo Sirainen [Thu, 11 Mar 2021 13:39:09 +0000 (15:39 +0200)] 
imap: Add reason_code=imap:notify_update for events during NOTIFY updates

4 years agoimap: Add and use client_command_context.global_event
Timo Sirainen [Tue, 9 Mar 2021 14:37:18 +0000 (16:37 +0200)] 
imap: Add and use client_command_context.global_event

This way all the (potentially large) IMAP command parameters won't be
included in all the events. This change might be reverted in the future
if the performance worries go away.

The global event also contains reason_code=imap:cmd_<command name> field.

4 years agodoveadm: Remove mailbox_set_reason() calls
Timo Sirainen [Thu, 11 Mar 2021 13:26:56 +0000 (15:26 +0200)] 
doveadm: Remove mailbox_set_reason() calls

They are now unnecessary because of the new reason_code field.

4 years agodoveadm: Add reason_code=doveadm:cmd_<command name> to events
Timo Sirainen [Thu, 11 Mar 2021 13:26:09 +0000 (15:26 +0200)] 
doveadm: Add reason_code=doveadm:cmd_<command name> to events

4 years agodsync: ioloop context shouldn't deactivate after ioloop has run
Timo Sirainen [Mon, 19 Apr 2021 21:05:23 +0000 (00:05 +0300)] 
dsync: ioloop context shouldn't deactivate after ioloop has run

Normally that is wanted, but dsync reuses the same ioloop as the parent
doveadm connection, so after the inner io_loop_run() it's still running
in the doveadm connection's io callback.

Without this all the global events will be popped out, and the following
global event change commit will cause crashes.

4 years agodoveadm copy: Don't permanently activate source user's ioloop
Timo Sirainen [Mon, 19 Apr 2021 21:28:02 +0000 (00:28 +0300)] 
doveadm copy: Don't permanently activate source user's ioloop

4 years agodoveadm import: Don't permanently activate source user's ioloop
Timo Sirainen [Mon, 19 Apr 2021 21:24:39 +0000 (00:24 +0300)] 
doveadm import: Don't permanently activate source user's ioloop

After the source user is initialized, the original user's ioloop should be
activated back.

4 years agosubmission: Add reason_code=submission:cmd_<name>
Timo Sirainen [Wed, 17 Mar 2021 16:48:37 +0000 (18:48 +0200)] 
submission: Add reason_code=submission:cmd_<name>

4 years agolmtp: Add reason_code=lmtp:cmd_<name>
Timo Sirainen [Wed, 17 Mar 2021 16:48:24 +0000 (18:48 +0200)] 
lmtp: Add reason_code=lmtp:cmd_<name>

4 years agolib-smtp: Add reason_code=<reason_code_module>:cmd_*
Timo Sirainen [Wed, 17 Mar 2021 16:44:09 +0000 (18:44 +0200)] 
lib-smtp: Add reason_code=<reason_code_module>:cmd_*

This requires caller to set smtp_server_settings.reason_code_module.
For now only cmd_mail, cmd_rcpt and cmd_data are implemented. The other
commands are likely not very useful.

4 years agolib-http: http-client-request - Preserve global events' reason_code in request events
Timo Sirainen [Thu, 22 Apr 2021 17:27:45 +0000 (20:27 +0300)] 
lib-http: http-client-request - Preserve global events' reason_code in request events

Since HTTP requests are asynchronous, it's possible that the global events
go away before the HTTP request is finished. This way the reason_code will
be preserved in http_request_finished event.

4 years agolib: Add event_reason_code() for building reason codes easily
Timo Sirainen [Thu, 11 Mar 2021 15:54:18 +0000 (17:54 +0200)] 
lib: Add event_reason_code() for building reason codes easily

4 years agolib: Add event_reason_begin/end() API
Timo Sirainen [Tue, 9 Mar 2021 14:45:20 +0000 (16:45 +0200)] 
lib: Add event_reason_begin/end() API

This can be used to easily add reason_code to all events being emitted
within the begin..end calls. The reasons can also be nested. For example:

reason = event_reason_begin("reason1");
// ...
reason2 = event_reason_begin("reason2");
// ..
event_reason_end(&reason2);
event_reason_end(&reason);

This results in having reason_code=["reason1", "reason2"] for all events
emitted while reason2 exists.

4 years agolib: event_pop_global() - Assert-crash if trying to pop ioloop context's global root...
Timo Sirainen [Wed, 21 Apr 2021 13:55:57 +0000 (16:55 +0300)] 
lib: event_pop_global() - Assert-crash if trying to pop ioloop context's global root event

This makes it easier to debug bugs.

4 years agolib: Push/pop global event stack automatically when ioloop contexts are switched
Timo Sirainen [Thu, 11 Mar 2021 00:19:37 +0000 (02:19 +0200)] 
lib: Push/pop global event stack automatically when ioloop contexts are switched

4 years agolib-storage: mail_storage_service_next*() - On failure don't leave user's io context...
Timo Sirainen [Wed, 21 Apr 2021 14:11:54 +0000 (17:11 +0300)] 
lib-storage: mail_storage_service_next*() - On failure don't leave user's io context activated

4 years agolib-storage: Remove global event stack tracking
Timo Sirainen [Thu, 11 Mar 2021 00:18:55 +0000 (02:18 +0200)] 
lib-storage: Remove global event stack tracking

This will be implemented by ioloop contexts directly in the next commit.

4 years agolib: Fix global events to actually work
Timo Sirainen [Tue, 9 Mar 2021 14:33:15 +0000 (16:33 +0200)] 
lib: Fix global events to actually work

Also add comments to clarify how exactly it works.

4 years agolib: event_push_global() - Assert that event is not NULL
Timo Sirainen [Mon, 19 Apr 2021 21:08:57 +0000 (00:08 +0300)] 
lib: event_push_global() - Assert that event is not NULL

4 years agolib-master: Fix sending events recursively
Timo Sirainen [Thu, 9 Sep 2021 10:46:24 +0000 (13:46 +0300)] 
lib-master: Fix sending events recursively

The event sending itself may recursively trigger more events (e.g.
data_stack_grow). The previous BEGINs must have been flushed by that
time or the recursive events might be pointing to event IDs that haven't
even been sent to the stats process yet.

Fixes:
stats: Error: Client sent invalid input for UPDATE: Unknown event ID

4 years agolib-master, stats: Send global events to stats process
Timo Sirainen [Tue, 9 Mar 2021 14:29:49 +0000 (16:29 +0200)] 
lib-master, stats: Send global events to stats process

4 years agostats: Support group_by for string lists
Timo Sirainen [Fri, 19 Mar 2021 11:13:45 +0000 (13:13 +0200)] 
stats: Support group_by for string lists

4 years agostats: Support exporting event string lists
Aki Tuomi [Wed, 27 Jan 2021 11:10:07 +0000 (13:10 +0200)] 
stats: Support exporting event string lists

4 years agostats: Split off stats_metric_get_sub_metric()
Timo Sirainen [Fri, 19 Mar 2021 11:02:54 +0000 (13:02 +0200)] 
stats: Split off stats_metric_get_sub_metric()

4 years agostats: Rename stats_metric_get_sub_metric() to stats_metric_find_sub_metric()
Timo Sirainen [Fri, 19 Mar 2021 11:05:35 +0000 (13:05 +0200)] 
stats: Rename stats_metric_get_sub_metric() to stats_metric_find_sub_metric()

4 years agostats: Split off stats_metric_group_by_value_label()
Timo Sirainen [Fri, 19 Mar 2021 10:59:53 +0000 (12:59 +0200)] 
stats: Split off stats_metric_group_by_value_label()

4 years agostats: stats_metric_group_by_*() - Add _r suffix to returned value parameter
Timo Sirainen [Fri, 19 Mar 2021 10:52:13 +0000 (12:52 +0200)] 
stats: stats_metric_group_by_*() - Add _r suffix to returned value parameter

4 years agolib: lib-event - Add support for string lists
Aki Tuomi [Tue, 15 Dec 2020 07:17:57 +0000 (09:17 +0200)] 
lib: lib-event - Add support for string lists

Provide API to create string lists. These are particularly
useful if you need to provide list of causes for an event,
such as why some mail was opened.

4 years agolib: test-event-filter - Improve "override parent fields" test
Timo Sirainen [Mon, 23 Aug 2021 14:21:58 +0000 (17:21 +0300)] 
lib: test-event-filter - Improve "override parent fields" test

4 years agolib: test-event-filter - Fix parent/child events to actually be parent/child
Timo Sirainen [Mon, 23 Aug 2021 14:15:47 +0000 (17:15 +0300)] 
lib: test-event-filter - Fix parent/child events to actually be parent/child

4 years agolib: Split off event_import_arg()
Timo Sirainen [Tue, 16 Mar 2021 17:22:25 +0000 (19:22 +0200)] 
lib: Split off event_import_arg()

4 years agolib: Split off event_import_field()
Timo Sirainen [Tue, 16 Mar 2021 17:19:43 +0000 (19:19 +0200)] 
lib: Split off event_import_field()

4 years agolib-index: Allow ignoring index corruption checks with --enable-devel-checks
Timo Sirainen [Fri, 24 Sep 2021 15:21:29 +0000 (18:21 +0300)] 
lib-index: Allow ignoring index corruption checks with --enable-devel-checks

If DEBUG_IGNORE_INDEX_CORRUPTION environment is set, don't check if
index contains internal corruption. This is useful for CI tests that
intentionally test corrupted indexes.

4 years agolib-http: http-server: Add request events
Siavash Tavakoli [Mon, 27 Sep 2021 23:28:35 +0000 (00:28 +0100)] 
lib-http: http-server: Add request events

Adds http_server_request_started and http_server_request_finished.

4 years agolib-http: http-server-request - Add request_id and status_code fields to event
Siavash Tavakoli [Thu, 26 Aug 2021 12:13:55 +0000 (13:13 +0100)] 
lib-http: http-server-request - Add request_id and status_code fields to event

4 years agostats: Use duplicated metric settings in stats_metrics_add_dynamic().
sergey.kitov [Tue, 28 Sep 2021 12:35:21 +0000 (15:35 +0300)] 
stats: Use duplicated metric settings in stats_metrics_add_dynamic().

4 years agoimapc: Add MAIL_STORAGE_CLASS_FLAG_SECONDARY_INDEX storage class flag
Markus Valentin [Wed, 15 Sep 2021 12:44:42 +0000 (14:44 +0200)] 
imapc: Add MAIL_STORAGE_CLASS_FLAG_SECONDARY_INDEX storage class flag

Add SECONDARY_INDEX storage class flag to enable storing shared private
indexes in obox user root bundle.

4 years agolib-storage: mail_get_binary_stream() - Add comment about having to unref returned...
Timo Sirainen [Fri, 24 Sep 2021 14:33:38 +0000 (17:33 +0300)] 
lib-storage: mail_get_binary_stream() - Add comment about having to unref returned istream

4 years agolib: test-cpu-limit - Remove dead code
Timo Sirainen [Wed, 22 Sep 2021 12:58:55 +0000 (15:58 +0300)] 
lib: test-cpu-limit - Remove dead code

No longer needed after 6d902507c24fca4f64e3e9bf7d79ae5a48281cd8

4 years agolib: test-strfuncs - Avoid testing p_strndup() with overlong max_chars parameter
Timo Sirainen [Mon, 27 Sep 2021 08:49:05 +0000 (11:49 +0300)] 
lib: test-strfuncs - Avoid testing p_strndup() with overlong max_chars parameter

This ended up in memchr() call with n=SIZE_MAX-1, which sometimes doesn't
work right with old glibc versions.

Fixes:
Panic: Trying to allocate 18446744073709551615 bytes

4 years agolib-mail: Add test for empty header value
Aki Tuomi [Wed, 8 Sep 2021 07:39:36 +0000 (10:39 +0300)] 
lib-mail: Add test for empty header value

4 years agolib-mail: Limit header length to 1000 bytes
Aki Tuomi [Thu, 2 Sep 2021 14:10:11 +0000 (17:10 +0300)] 
lib-mail: Limit header length to 1000 bytes

4 years agolib-mail: If message header has no colon, store it as value only
Aki Tuomi [Thu, 2 Sep 2021 14:12:55 +0000 (17:12 +0300)] 
lib-mail: If message header has no colon, store it as value only

If the header is missing :, it is not valid header. Storing it as
value only ensures it will be kept by mbox rewrite, but will not
be processed as a header.

4 years agolib-mail: test-message-header-parser - Add NAME10, 100, 1000 macros for testing
Aki Tuomi [Thu, 2 Sep 2021 13:46:19 +0000 (16:46 +0300)] 
lib-mail: test-message-header-parser - Add NAME10, 100, 1000 macros for testing

4 years agolib: Add i_memspn() and i_memcspn()
Aki Tuomi [Tue, 7 Sep 2021 11:37:34 +0000 (14:37 +0300)] 
lib: Add i_memspn() and i_memcspn()

Binary data safe variants of strspn() and strcspn()

4 years agovirtual: Log a debug message why backend mailbox has changed
Timo Sirainen [Thu, 16 Sep 2021 11:32:37 +0000 (13:32 +0200)] 
virtual: Log a debug message why backend mailbox has changed

4 years agolib-storage: mail-duplicate - Restructure mail_duplicate_read_db_file() to make sure...
Stephan Bosch [Fri, 24 Sep 2021 08:39:43 +0000 (10:39 +0200)] 
lib-storage: mail-duplicate - Restructure mail_duplicate_read_db_file() to make sure fd is closed.

Found by Coverity.

4 years agolib-storage: mail-duplicate - Fix segfault occurring upon failure to lock and open...
Stephan Bosch [Fri, 24 Sep 2021 08:22:28 +0000 (10:22 +0200)] 
lib-storage: mail-duplicate - Fix segfault occurring upon failure to lock and open DB file.

Found by Coverity.

4 years agoindexer-worker: Fix event leak on error handling
Timo Sirainen [Wed, 18 Aug 2021 14:54:00 +0000 (16:54 +0200)] 
indexer-worker: Fix event leak on error handling

4 years agolib-storage: mail-duplicate - Implement separate error code for deadlock.
Stephan Bosch [Tue, 13 Jul 2021 02:15:14 +0000 (04:15 +0200)] 
lib-storage: mail-duplicate - Implement separate error code for deadlock.

4 years agolib-storage: mail-duplicate - Update records from duplicate DB file after acquirement...
Stephan Bosch [Wed, 15 Sep 2021 23:49:57 +0000 (01:49 +0200)] 
lib-storage: mail-duplicate - Update records from duplicate DB file after acquirement of per-ID lock.

The process previously holding the per-ID lock may have updated the DB.

4 years agolib-storage: mail-duplicate - Move acquirement of dotlock for DB file into mail_dupli...
Stephan Bosch [Fri, 17 Sep 2021 09:11:21 +0000 (11:11 +0200)] 
lib-storage: mail-duplicate - Move acquirement of dotlock for DB file into mail_duplicate_read().

4 years agolib-storage: mail-duplicate - Implement per-ID locking.
Stephan Bosch [Mon, 20 Sep 2021 09:58:12 +0000 (11:58 +0200)] 
lib-storage: mail-duplicate - Implement per-ID locking.

4 years agolib-storage: mail-duplicate - Allow calling mail_duplicate_read() more than once...
Stephan Bosch [Fri, 17 Sep 2021 09:16:39 +0000 (11:16 +0200)] 
lib-storage: mail-duplicate - Allow calling mail_duplicate_read() more than once in a transaction.

4 years agolib-storage: mail-duplicate - Record an entry for both checked and marked IDs.
Stephan Bosch [Tue, 13 Jul 2021 21:22:52 +0000 (23:22 +0200)] 
lib-storage: mail-duplicate - Record an entry for both checked and marked IDs.

Still only write the marked IDs to the file. The in-memory record is needed for
the locking introduced in a later commit.

4 years agolib-storage: mail-duplicate - Add debug messages for transaction.
Stephan Bosch [Tue, 13 Jul 2021 03:03:02 +0000 (05:03 +0200)] 
lib-storage: mail-duplicate - Add debug messages for transaction.