]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
2 years agolib-sql: driver-mysql - Initialize MYSQL struct once
Aki Tuomi [Wed, 30 Aug 2023 10:19:47 +0000 (13:19 +0300)] 
lib-sql: driver-mysql - Initialize MYSQL struct once

Calling initialize more than once will leak memory.

2 years agolib-sql: driver-mysql - Use driver_mysql_disconnect() in deinit
Aki Tuomi [Wed, 30 Aug 2023 10:21:12 +0000 (13:21 +0300)] 
lib-sql: driver-mysql - Use driver_mysql_disconnect() in deinit

This ensures we call mysql_close() only in one place.

2 years agolib-sql: driver-mysql - Use container_of instead of blind cast
Aki Tuomi [Tue, 29 Aug 2023 12:04:04 +0000 (15:04 +0300)] 
lib-sql: driver-mysql - Use container_of instead of blind cast

2 years agolib-sql: Disconnect SQL connection on error
Aki Tuomi [Mon, 17 Jul 2023 07:36:32 +0000 (10:36 +0300)] 
lib-sql: Disconnect SQL connection on error

2 years agomdbox: Fix crash still if fdatasync_path() fails
Timo Sirainen [Thu, 22 Jun 2023 07:48:13 +0000 (10:48 +0300)] 
mdbox: Fix crash still if fdatasync_path() fails

Broken still in a8424a71d70e2f5c54d9e2aab8338cf9547b15b4

2 years agologin-common: Make login_proxy_free(&NULL) no-op
Marco Bettini [Thu, 31 Aug 2023 09:22:31 +0000 (09:22 +0000)] 
login-common: Make login_proxy_free(&NULL) no-op

Backport of 92b12678ff85112a0631f58fc2c9422e41e0d376

2 years agostats: Allow empty event exporters when registering metrics
Karl Fleischmann [Thu, 15 Jun 2023 11:32:11 +0000 (13:32 +0200)] 
stats: Allow empty event exporters when registering metrics

2 years agofts: doveadm - Add missing pool initialization in cmd_search_box()
Marco Bettini [Tue, 29 Aug 2023 10:13:34 +0000 (10:13 +0000)] 
fts: doveadm - Add missing pool initialization in cmd_search_box()

Broken by: 467a664b5fce33f3d47a3e1171ecacb508968d1a

2 years agoauth: db-oauth2 - Set default value for active_attribute and active_value to empty...
Aki Tuomi [Thu, 24 Aug 2023 09:26:44 +0000 (12:26 +0300)] 
auth: db-oauth2 - Set default value for active_attribute and active_value to empty string

Otherwise it will always require this attribute to be present when not
configured.

2 years agologin-common: If authentication is aborted, clear out final response.
Aki Tuomi [Thu, 24 Aug 2023 19:16:36 +0000 (22:16 +0300)] 
login-common: If authentication is aborted, clear out final response.

2 years agoauth: db-oauth2 - Handle the case for check on attribute presence only
Marco Bettini [Thu, 1 Jun 2023 10:47:50 +0000 (10:47 +0000)] 
auth: db-oauth2 - Handle the case for check on attribute presence only

2 years agoauth: db_oauth2_user_is_enabled() - Flatten the code
Marco Bettini [Thu, 1 Jun 2023 08:37:56 +0000 (08:37 +0000)] 
auth: db_oauth2_user_is_enabled() - Flatten the code

2 years agoauth: db-oauth2 - Fail login if active_attribute is missing
Steve Mokris [Tue, 17 May 2022 19:19:49 +0000 (15:19 -0400)] 
auth: db-oauth2 - Fail login if active_attribute is missing

If active_attribute is required by config, we should fail to
login when it's missing.

2 years agolib-oauth2: Do not send empty client_id or client_secret
Aki Tuomi [Fri, 12 May 2023 08:48:25 +0000 (11:48 +0300)] 
lib-oauth2: Do not send empty client_id or client_secret

2 years agolib-oauth2: Do not send client_id and client_secret as parameters in POST queries
Aki Tuomi [Fri, 12 May 2023 08:47:41 +0000 (11:47 +0300)] 
lib-oauth2: Do not send client_id and client_secret as parameters in POST queries

They need to be configured in the URL as Basic auth instead.

2 years agolib-oauth2: Do not send client_id & client_secret as POST parameters when doing intro...
Aki Tuomi [Fri, 12 May 2023 05:59:50 +0000 (08:59 +0300)] 
lib-oauth2: Do not send client_id & client_secret as POST parameters when doing introspection

2 years agolib-oauth2: Validate scope when configured
Aki Tuomi [Mon, 8 May 2023 05:38:20 +0000 (08:38 +0300)] 
lib-oauth2: Validate scope when configured

2 years agolib-oauth2: Remove typ check
Aki Tuomi [Mon, 8 May 2023 05:23:39 +0000 (08:23 +0300)] 
lib-oauth2: Remove typ check

It is not really useful. And mostly just keeps breaking when people
invent new kty values.

2 years agolib-oauth2: Ensure aud field has client_id when set.
Aki Tuomi [Mon, 8 May 2023 05:21:43 +0000 (08:21 +0300)] 
lib-oauth2: Ensure aud field has client_id when set.

OpenID Connect 1.0 specification says that "aud" field must contain
OAuth 2.0 client_id of the Relying Party as an audience value.

2 years agoauth: mech-oauth2 - Always fail with protocol specific error
Aki Tuomi [Mon, 15 May 2023 10:49:58 +0000 (13:49 +0300)] 
auth: mech-oauth2 - Always fail with protocol specific error

2 years agoauth: mech-oauth2 - Look for openid configuration URL if missing
Aki Tuomi [Mon, 15 May 2023 08:51:19 +0000 (11:51 +0300)] 
auth: mech-oauth2 - Look for openid configuration URL if missing

2 years agolib-oauth2: Return failure instead of crash with invalid or missing token
Aki Tuomi [Thu, 4 May 2023 12:44:15 +0000 (15:44 +0300)] 
lib-oauth2: Return failure instead of crash with invalid or missing token

2 years agoauth: db-oauth2 - Add accessor for OpenID configuration URL
Aki Tuomi [Wed, 14 Dec 2022 08:10:12 +0000 (10:10 +0200)] 
auth: db-oauth2 - Add accessor for OpenID configuration URL

2 years agoauth: db-oauth2 - Store request username
Aki Tuomi [Fri, 2 Jun 2023 11:20:08 +0000 (14:20 +0300)] 
auth: db-oauth2 - Store request username

2 years agoauth: Add auth_request_fail_with_reply()
Aki Tuomi [Mon, 15 May 2023 09:41:39 +0000 (12:41 +0300)] 
auth: Add auth_request_fail_with_reply()

2 years agoauth: Pass along final response with failure
Aki Tuomi [Mon, 15 May 2023 10:49:41 +0000 (13:49 +0300)] 
auth: Pass along final response with failure

2 years agolib-auth: Move auth_client_request_continue() lower
Aki Tuomi [Mon, 15 May 2023 09:28:53 +0000 (12:28 +0300)] 
lib-auth: Move auth_client_request_continue() lower

Simplifies next commit

2 years agologin-common: Serve final response for client on failure
Aki Tuomi [Mon, 15 May 2023 11:27:55 +0000 (14:27 +0300)] 
login-common: Serve final response for client on failure

2 years agologin-common: Ignore resp when present
Aki Tuomi [Mon, 15 May 2023 10:49:51 +0000 (13:49 +0300)] 
login-common: Ignore resp when present

2 years agoacl: Fix wrong \HasChildren flags for parent mailboxes containing '*' and '%'
sergey.kitov [Wed, 3 May 2023 11:35:54 +0000 (14:35 +0300)] 
acl: Fix wrong \HasChildren flags for parent mailboxes containing '*' and '%'

'*' in mailbox name is replaced with '%' while child mailboxes still
have '*' in their path, this results in wrong \HasNoChildren flag.

2 years agolib-storage: Whitespace cleanup.
sergey.kitov [Wed, 3 May 2023 11:35:18 +0000 (14:35 +0300)] 
lib-storage: Whitespace cleanup.

2 years agolib-storage: Add mail_get_message_id_no_validation()
Marco Bettini [Tue, 9 May 2023 07:22:15 +0000 (07:22 +0000)] 
lib-storage: Add mail_get_message_id_no_validation()

2 years agolib-dict: redis_reply_callback() - Don't crash if there is no callback
Marco Bettini [Tue, 16 May 2023 09:40:55 +0000 (09:40 +0000)] 
lib-dict: redis_reply_callback() - Don't crash if there is no callback

2 years agolib-index: Delete dovecot.index.cache during purging if it becomes too large
Timo Sirainen [Mon, 17 Apr 2023 21:08:40 +0000 (00:08 +0300)] 
lib-index: Delete dovecot.index.cache during purging if it becomes too large

This only happens if the file was already too large before the purging
happens. This mainly fixes assert-crashes caused by old huge >1GB cache
files.

Fixes:
Panic: file mail-index-util.c: line 10 (mail_index_uint32_to_offset): assertion failed: (offset < 0x40000000)

2 years agolib-master: Use ssl_require_crl setting only for server-side SSL settings
Timo Sirainen [Tue, 17 May 2022 10:31:40 +0000 (12:31 +0200)] 
lib-master: Use ssl_require_crl setting only for server-side SSL settings

We don't currently properly support checking CRLs when acting as SSL client.
The CRL would have to be stored as part of the CAs, which isn't commonly
done. This bug has been in the code ever since it was added in
30c5c1fc3608ae575f11960281d3e338b6bf7bc8, but it became more noticeable
with recent changes that started using lib-master for getting all SSL
client settings, e.g. 1e5324b5805bf7299cd8196f7b659fe935f027bd

2 years agostats: stats_metrics_add_dynamic() - Validate event exporter
Karl Fleischmann [Thu, 6 Apr 2023 07:04:35 +0000 (09:04 +0200)] 
stats: stats_metrics_add_dynamic() - Validate event exporter

2 years agolib-master: stats_client_deinit() - Ensure conn.output is flushed before returning
Marco Bettini [Thu, 23 Mar 2023 15:37:28 +0000 (15:37 +0000)] 
lib-master: stats_client_deinit() - Ensure conn.output is flushed before returning

This prevents losing exported events still waiting in buffers while the process exits.

2 years agolib-master: stats_event_callback() - Skip if conn.output is already closed
Marco Bettini [Mon, 27 Mar 2023 08:19:38 +0000 (08:19 +0000)] 
lib-master: stats_event_callback() - Skip if conn.output is already closed

This also prevents further errors from happening on the closed stream.

2 years agolib-master: stats_client_send_event() - Also flush conn.output and check for errors
Marco Bettini [Fri, 24 Mar 2023 14:04:00 +0000 (14:04 +0000)] 
lib-master: stats_client_send_event() - Also flush conn.output and check for errors

2 years agolib-master: stats_event_write() - Don't accumulate more than IO_BLOCK_SIZE bytes...
Marco Bettini [Thu, 23 Mar 2023 15:35:49 +0000 (15:35 +0000)] 
lib-master: stats_event_write() - Don't accumulate more than IO_BLOCK_SIZE bytes in str buffer

2 years agolib: event-filter-parser.y - Add workaround for nerrs being unused warning
Timo Sirainen [Fri, 24 Feb 2023 12:06:14 +0000 (14:06 +0200)] 
lib: event-filter-parser.y - Add workaround for nerrs being unused warning

Fixes with clang-17:
warning: variable 'event_filter_parser_nerrs' set but not used

2 years agoglobal: Remove dead code
Timo Sirainen [Fri, 24 Feb 2023 12:02:01 +0000 (14:02 +0200)] 
global: Remove dead code

2 years agolib-dict: test-dict-client - Handle shutdown cleanly with ctrl-c
Timo Sirainen [Fri, 31 Dec 2021 09:29:02 +0000 (11:29 +0200)] 
lib-dict: test-dict-client - Handle shutdown cleanly with ctrl-c

2 years agologin-common: Handle missing ssl_iostream in get_var_expand_table()
Aki Tuomi [Thu, 7 Jul 2022 10:58:02 +0000 (13:58 +0300)] 
login-common: Handle missing ssl_iostream in get_var_expand_table()

It can be missing during connection disconnection when connection
is lost uncleanly.

2 years agonotify-status: Fix crash if user initialization fails
Timo Sirainen [Tue, 4 Apr 2023 08:51:22 +0000 (11:51 +0300)] 
notify-status: Fix crash if user initialization fails

The deinit code crashed if mail_namespaces_created hook hadn't been called
before user was deinitialized.

2 years agolib-sql: pgsql - Use orig_ioloop instead of local variable
Aki Tuomi [Thu, 29 Jun 2023 10:40:24 +0000 (13:40 +0300)] 
lib-sql: pgsql - Use orig_ioloop instead of local variable

orig_ioloop is used later, leaving it NULL here causes
problems when timeout is added by sqlpool.

Broken in 8981a973987c237552e46b68075b64caa8c1f5bb

2 years agodbox: Fix for dangling pointer being passed to cleanup_interval()
Marco Bettini [Mon, 26 Jun 2023 10:43:00 +0000 (10:43 +0000)] 
dbox: Fix for dangling pointer being passed to cleanup_interval()

Broken in 88eee28fd86d619b26ce6aebadca5b18e748dc6f

2 years agomdbox: Optimize mail_temp_scan_interval storage/ scanning
Timo Sirainen [Tue, 20 Jun 2023 15:58:13 +0000 (18:58 +0300)] 
mdbox: Optimize mail_temp_scan_interval storage/ scanning

Use the generic dbox scanning code, which avoids stat()ing the directory by
keeping the timestamp in index header. Also do the scanning while at
session deinit instead of startup, so the latency isn't visible to clients.

2 years agolib-storage: Split off index_mailbox_view_update_last_temp_file_scan()
Timo Sirainen [Tue, 20 Jun 2023 15:58:00 +0000 (18:58 +0300)] 
lib-storage: Split off index_mailbox_view_update_last_temp_file_scan()

2 years agodbox: mail_temp_scan_interval - Fix deleted temp file prefix
Timo Sirainen [Tue, 20 Jun 2023 19:28:35 +0000 (22:28 +0300)] 
dbox: mail_temp_scan_interval - Fix deleted temp file prefix

dbox files are always created with DBOX_TEMP_FILE_PREFIX, not the mailbox
list-specific prefix. This was a problem only if dbox was used with
LAYOUT=Maildir++, which nobody was likely to do. Other layouts had
identical temp file prefixes to DBOX_TEMP_FILE_PREFIX.

2 years agodbox: Split off dbox_mailbox_list_cleanup()
Timo Sirainen [Tue, 20 Jun 2023 15:54:49 +0000 (18:54 +0300)] 
dbox: Split off dbox_mailbox_list_cleanup()

2 years agomdbox: Don't do temp file scanning for mailbox directories
Timo Sirainen [Tue, 20 Jun 2023 15:44:52 +0000 (18:44 +0300)] 
mdbox: Don't do temp file scanning for mailbox directories

The intention was to delete any temporary mail files that have been left
behind by crashed processes, but mail files are written to storage/
directory.

2 years agomdbox: Fix fdatasync() path when saving mails
Timo Sirainen [Tue, 20 Jun 2023 15:24:34 +0000 (18:24 +0300)] 
mdbox: Fix fdatasync() path when saving mails

It was supposed to be called on the parent directory of where mails were
written, i.e. storage/ directory. The previous code was instead calling it
on the mailbox-specific directory (similarly to sdbox) where nothing was
written.

2 years agomdbox: Fix crash if fdatasync_path() fails
Timo Sirainen [Tue, 20 Jun 2023 15:21:38 +0000 (18:21 +0300)] 
mdbox: Fix crash if fdatasync_path() fails

There is no dest_mail anymore at this stage of transaction.

2 years agolib-storage: Rollback save transaction when transaction commit fails.
sergey.kitov [Wed, 12 Apr 2023 09:06:52 +0000 (12:06 +0300)] 
lib-storage: Rollback save transaction when transaction commit fails.

2 years agosdbox: Fix panic due to leaked mail_index_view if sync fails
Timo Sirainen [Sun, 5 Feb 2023 18:51:12 +0000 (20:51 +0200)] 
sdbox: Fix panic due to leaked mail_index_view if sync fails

Fixes:
Panic: Leaked view for index .../dbox-Mails/dovecot.index: Opened in mail-index-sync.c:445

2 years agolib-index: Don't update log_file_tail_offset on sync if reading dovecot.index.log...
Timo Sirainen [Sun, 5 Feb 2023 18:50:06 +0000 (20:50 +0200)] 
lib-index: Don't update log_file_tail_offset on sync if reading dovecot.index.log failed

This is more of a theoretical issue, since dovecot.index.log read failure is
very unlikely.

2 years agolib-index: Don't update max_tail_offset if write to dovecot.index.log fails
Timo Sirainen [Sun, 5 Feb 2023 18:47:08 +0000 (20:47 +0200)] 
lib-index: Don't update max_tail_offset if write to dovecot.index.log fails

The max_tail_offset didn't actually increase in that situation.
This fixes wrongly updating mail_index_header.log_file_tail_offset after
write to dovecot.index.log failed (due to out of disk space), which in
turn can cause some unexpected errors.

2 years agolib-index: Fix event leak if purging dovecot.index.cache fails
Timo Sirainen [Sun, 5 Feb 2023 18:46:34 +0000 (20:46 +0200)] 
lib-index: Fix event leak if purging dovecot.index.cache fails

2 years agolib-oauth2: jwt - Allow missing 'typ' field
Aki Tuomi [Wed, 2 Nov 2022 13:56:54 +0000 (15:56 +0200)] 
lib-oauth2: jwt - Allow missing 'typ' field

2 years agolib-oauth2: test-oauth2-jwt - Ensure we ignore 'none' algorithm
Aki Tuomi [Thu, 28 May 2020 12:05:08 +0000 (15:05 +0300)] 
lib-oauth2: test-oauth2-jwt - Ensure we ignore 'none' algorithm

2 years agolib-login: Don't update process title if verbose_proctitle=no
Timo Sirainen [Fri, 14 Apr 2023 08:35:30 +0000 (11:35 +0300)] 
lib-login: Don't update process title if verbose_proctitle=no

Broken by 4fcd7f497577af361fc3313fbc07a61c14e17715

2 years agoglobal: Enable login_server_settings.update_proctitle
Timo Sirainen [Fri, 24 Mar 2023 01:26:33 +0000 (03:26 +0200)] 
global: Enable login_server_settings.update_proctitle

2 years agolib-login: Add login_server_settings.update_proctitle
Timo Sirainen [Fri, 24 Mar 2023 01:26:11 +0000 (03:26 +0200)] 
lib-login: Add login_server_settings.update_proctitle

Update the current login state in process title when enabled.

2 years agolib-login: Keep connection in server's linked list until it's fully freed
Timo Sirainen [Fri, 24 Mar 2023 02:02:28 +0000 (04:02 +0200)] 
lib-login: Keep connection in server's linked list until it's fully freed

Otherwise the connection isn't accessible from any global variables.

2 years agoimap: Update process title while unhibernating
Timo Sirainen [Fri, 24 Mar 2023 00:29:39 +0000 (02:29 +0200)] 
imap: Update process title while unhibernating

Previously the process title stayed as [idling] even though the process was
busy waiting on the imap-hibernate process to finish sending the
unhibernation request.

2 years agolib-master: Set process title to [initializing] until master_service_init_finish()
Timo Sirainen [Fri, 24 Mar 2023 00:00:37 +0000 (02:00 +0200)] 
lib-master: Set process title to [initializing] until master_service_init_finish()

2 years agolib: Add process_title_get_counter()
Timo Sirainen [Fri, 24 Mar 2023 00:02:58 +0000 (02:02 +0200)] 
lib: Add process_title_get_counter()

2 years agomaster: Set VERBOSE_PROCTITLE environment to child processes
Timo Sirainen [Thu, 23 Mar 2023 23:53:43 +0000 (01:53 +0200)] 
master: Set VERBOSE_PROCTITLE environment to child processes

This is needed for updating process title during initialization before
settings are read.

2 years agoimap: Disconnect imap-master client if it's not sending anything for 25 seconds
Timo Sirainen [Thu, 23 Mar 2023 23:15:21 +0000 (01:15 +0200)] 
imap: Disconnect imap-master client if it's not sending anything for 25 seconds

2 years agoimap: Improve disconnection log message if it happens immediately after unhibernation
Timo Sirainen [Thu, 23 Mar 2023 23:45:34 +0000 (01:45 +0200)] 
imap: Improve disconnection log message if it happens immediately after unhibernation

The "No commands sent after unhibernation" can mean that imap-hibernate
process saw a timeout while unhibernating and shutdown the connection.
Or it can also mean just that the client itself disconnected.

2 years agoimap-hibernate: If unhibernation fails, make sure imap process won't finish it later on
Timo Sirainen [Thu, 23 Mar 2023 23:41:37 +0000 (01:41 +0200)] 
imap-hibernate: If unhibernation fails, make sure imap process won't finish it later on

Especially if unhibernation fails due to a connection timeout to imap
process due to high load, it's possible that the imap process will
eventually finish the unhibernation and continue with the client. This is
rather confusing, since imap-hibernate process already logged that the
client got disconnected.

2 years agoimap: Add client.unhibernated boolean
Timo Sirainen [Thu, 13 Jan 2022 14:54:18 +0000 (16:54 +0200)] 
imap: Add client.unhibernated boolean

2 years agoauth: mech_gssapi_unwrap() - Release gss_release_buffe(outbuf) before returning
Marco Bettini [Fri, 5 May 2023 15:20:34 +0000 (15:20 +0000)] 
auth: mech_gssapi_unwrap() - Release gss_release_buffe(outbuf) before returning

2 years agomaster: Fix service { idle_kill } to work better on busy servers
Timo Sirainen [Thu, 23 Mar 2023 20:23:39 +0000 (22:23 +0200)] 
master: Fix service { idle_kill } to work better on busy servers

The previous behavior was to kill a process once it had idled for idle_kill
seconds. However, on a busy server the new connections are picked up somewhat
randomly by all the idling processes, so there's never any single process
idling for a long time. This effectively prevents the idle_kill from killing
any processes, even if there are unnecessarily many of them.

The new behavior here tracks the lowest number of idling processes during
idle_kill time interval. Then it kills that many processes. If the load
stays the same, this should shrink the number of processes to the number
that is needed to handle the load, but no more.

2 years agomaster: Replace per-process idle_kill timeout with per-service
Timo Sirainen [Thu, 23 Mar 2023 14:07:26 +0000 (16:07 +0200)] 
master: Replace per-process idle_kill timeout with per-service

This is much more efficient, since it doesn't have to keep updating the
timeout constantly for busy processes.

This change still preserves the original way the idle_kill setting behaves.

2 years agomaster: Add asserts to make sure counters don't wrap
Timo Sirainen [Thu, 23 Mar 2023 14:37:08 +0000 (16:37 +0200)] 
master: Add asserts to make sure counters don't wrap

2 years agomaster: Add service.process_idling to count number of idling processes
Timo Sirainen [Thu, 23 Mar 2023 14:36:10 +0000 (16:36 +0200)] 
master: Add service.process_idling to count number of idling processes

2 years agomaster: Split processes list to busy and idling processes
Timo Sirainen [Thu, 23 Mar 2023 13:09:43 +0000 (15:09 +0200)] 
master: Split processes list to busy and idling processes

Keep the idling processes sorted by idle_start time. This will be needed
by the next commit.

2 years agodbox: dbox_cleanup_temp_files() - Fuzz scan interval adding 0..+30% based on username...
Marco Bettini [Tue, 28 Feb 2023 12:05:44 +0000 (12:05 +0000)] 
dbox: dbox_cleanup_temp_files() - Fuzz scan interval adding 0..+30% based on username hash

2 years agodbox: dbox_cleanup_temp_files() - Reformat code
Marco Bettini [Tue, 28 Feb 2023 11:45:43 +0000 (11:45 +0000)] 
dbox: dbox_cleanup_temp_files() - Reformat code

2 years agodbox: dbox_cleanup_temp_files() - Remove unnecessary else/else if after returns
Marco Bettini [Tue, 28 Feb 2023 11:44:48 +0000 (11:44 +0000)] 
dbox: dbox_cleanup_temp_files() - Remove unnecessary else/else if after returns

2 years agodbox: dbox_mailbox_open() - Drop unused ctime
Marco Bettini [Tue, 28 Feb 2023 11:30:22 +0000 (11:30 +0000)] 
dbox: dbox_mailbox_open() - Drop unused ctime

2 years agodbox: dbox_mailbox_open() - Move dbox_cleanup_temp_files() to dbox_mailbox_close()
Marco Bettini [Tue, 28 Feb 2023 11:21:10 +0000 (11:21 +0000)] 
dbox: dbox_mailbox_open() - Move dbox_cleanup_temp_files() to dbox_mailbox_close()

2 years agodbox: dbox_mailbox_open() - Infer last_temp_file_scan from dir's atime if 0
Marco Bettini [Tue, 28 Feb 2023 10:15:50 +0000 (10:15 +0000)] 
dbox: dbox_mailbox_open() - Infer last_temp_file_scan from dir's atime if 0

2 years agodbox: dbox_mailbox_create() - Update last_temp_file_scan
Marco Bettini [Tue, 28 Feb 2023 10:14:26 +0000 (10:14 +0000)] 
dbox: dbox_mailbox_create() - Update last_temp_file_scan

2 years agolib-storage: dbox_cleanup_temp_files() - Fix inverted check for ENOENT
Marco Bettini [Fri, 3 Mar 2023 16:15:17 +0000 (16:15 +0000)] 
lib-storage: dbox_cleanup_temp_files() - Fix inverted check for ENOENT

2 years agostats: openmetrics - Set field always when used
Aki Tuomi [Fri, 24 Mar 2023 06:53:27 +0000 (08:53 +0200)] 
stats: openmetrics - Set field always when used

Satisfied static analysers.

Broken in ba19a18d54cb7cf7de93d6a235862a408cfe5828

2 years agostats: openmetrics - Create metrics for all specified fields
Aki Tuomi [Thu, 26 Jan 2023 06:15:29 +0000 (08:15 +0200)] 
stats: openmetrics - Create metrics for all specified fields

2 years agodsync: Fix handling mailboxes with % character when BROKENCHAR isn't explicitly set...
Timo Sirainen [Mon, 3 Apr 2023 21:43:55 +0000 (00:43 +0300)] 
dsync: Fix handling mailboxes with % character when BROKENCHAR isn't explicitly set in config

When vname_escape_char (= BROKENCHAR) isn't explicitly set in configuration,
'%' character (or if it was hierarchy separator, '~') was used as the default
internal escape character. However, this was used inconsistently between local
and remote mailbox trees. The remote tree stored the mailbox names unescaped,
while the local mailbox names were escaped. This inconsistency caused dsync
to do unnecessary mailbox renames, which might have ended up failing.

This especially fixes dsync failures when mailbox name ended with the '%'
character.

2 years agodsync: Refactor dsync_brain_mailbox_to_parts() into dsync_mailbox_name_to_parts()
Timo Sirainen [Mon, 3 Apr 2023 21:43:04 +0000 (00:43 +0300)] 
dsync: Refactor dsync_brain_mailbox_to_parts() into dsync_mailbox_name_to_parts()

2 years agovirtual: virtual_backend_box_lookup() - Enforce callers to check if the call succeeded
Marco Bettini [Mon, 20 Mar 2023 14:00:48 +0000 (14:00 +0000)] 
virtual: virtual_backend_box_lookup() - Enforce callers to check if the call succeeded

2 years agovirtual: virtual_sync_apply_existing_expunges() - Don't crash if the backend mailbox...
Marco Bettini [Fri, 24 Mar 2023 13:50:29 +0000 (13:50 +0000)] 
virtual: virtual_sync_apply_existing_expunges() - Don't crash if the backend mailbox has been removed

2 years agolib-index: Fix assert-crash when header's log_file_seq/offset shrinks
Timo Sirainen [Mon, 2 Jan 2023 08:23:43 +0000 (10:23 +0200)] 
lib-index: Fix assert-crash when header's log_file_seq/offset shrinks

mail_index_sync_set_log_view() is also missing this check, but it doesn't
seem to actually happen. It's likely handled by mail_index_map() already.

Fixes:
Panic: file mail-transaction-log-view.c: line 165 (mail_transaction_log_view_set): assertion failed: (min_file_seq <= max_file_seq)

2 years agolib-http: http-server-connection - Fix segfault occurring when output is resumed...
Stephan Bosch [Mon, 21 Mar 2022 11:22:38 +0000 (12:22 +0100)] 
lib-http: http-server-connection - Fix segfault occurring when output is resumed on closed connection.

2 years agoman: Add doveadm fts check fast/full
Timo Sirainen [Tue, 7 Mar 2023 13:53:06 +0000 (15:53 +0200)] 
man: Add doveadm fts check fast/full

2 years agolib-imap-client: Fix/clarify selection state handling
Timo Sirainen [Thu, 9 Feb 2023 15:04:22 +0000 (17:04 +0200)] 
lib-imap-client: Fix/clarify selection state handling

The old code assumed that selected_box would be non-NULL while a new mailbox
is being selected. That's not true though, the imapc-storage code closes the
old mailbox before selecting the next one. So the QRESYNC-specific code for
tracking selected-state was never being used. Fixed this, and clarified in
general how the selected-state is supposed to work.

2 years agolib-imap-client: Rename imapc_connection.selecting_box to qresync_selecting_box
Timo Sirainen [Thu, 9 Feb 2023 15:03:00 +0000 (17:03 +0200)] 
lib-imap-client: Rename imapc_connection.selecting_box to qresync_selecting_box

It's only used when QRESYNC extension is enabled.

2 years agoimapc: Fix handling EXISTS reply to previous mailbox while selecting new mailbox
Timo Sirainen [Thu, 9 Feb 2023 14:21:24 +0000 (16:21 +0200)] 
imapc: Fix handling EXISTS reply to previous mailbox while selecting new mailbox

For example if the communication was:

C: a SELECT box1
...
C: b SELECT box2
S: * 10 EXISTS
S: * 1 EXISTS
S: * OK [UIDVALIDITY 1675948459] UIDs valid
S: ...
S: b OK

The first EXISTS is meant for box1, not box2. Fixed by not starting a FETCH
(FLAGS) for the mailbox being selected until the tagged reply is received.

2 years agoimapc: Don't process untagged replies in mailbox that isn't fully selected yet
Timo Sirainen [Thu, 9 Feb 2023 14:12:35 +0000 (16:12 +0200)] 
imapc: Don't process untagged replies in mailbox that isn't fully selected yet

For example if the communication was:

C: a SELECT box1
...
C: b SELECT box2
S: * 1 EXPUNGE
S: * 1 EXISTS
S: * OK [UIDVALIDITY 1675948459] UIDs valid
S: ...
S: b OK

The expunge was intended for box1, not box2. This caused:
Warning: imapc(...): Mailbox '...' state corrupted: EXPUNGE received for empty mailbox - reconnecting

Fixed this by ignoring untagged EXPUNGE, FETCH, SEARCH and ESEARCH replies
when the UIDVALIDITY reply hasn't been yet received for a mailbox.