]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
4 years agoNEWS: Updates for v2.3.15 release-2.3.15 2.3.15
Timo Sirainen [Mon, 14 Jun 2021 09:47:15 +0000 (12:47 +0300)] 
NEWS: Updates for v2.3.15

4 years agolib-dict-extra: dict-fs - Escape unsafe paths
Aki Tuomi [Tue, 8 Jun 2021 06:13:25 +0000 (09:13 +0300)] 
lib-dict-extra: dict-fs - Escape unsafe paths

Change any path components that are `.` or `..` to `...` and `....`.
Prevents path traversal attacks.

4 years agolib-oauth2: Do not escape '.'
Aki Tuomi [Tue, 8 Jun 2021 06:04:21 +0000 (09:04 +0300)] 
lib-oauth2: Do not escape '.'

This is not really needed and just makes things difficult.

4 years agoacl: Ignore acls in acl_mailbox_right_lookup if ignore_acls is set
Markus Valentin [Wed, 2 Jun 2021 10:39:39 +0000 (12:39 +0200)] 
acl: Ignore acls in acl_mailbox_right_lookup if ignore_acls is set

In case an namespace has been configured to ignore ACLs make sure that
also happens for acl_mailbox_right_lookup.

4 years agoacl: If acl_ignore_namespace is set acl_backend can be NULL
Markus Valentin [Tue, 1 Jun 2021 11:10:23 +0000 (13:10 +0200)] 
acl: If acl_ignore_namespace is set acl_backend can be NULL

Allow an uninitialized acl backend when ignore_acls is set.

4 years agoimap-acl: In case mailbox name is "" set it to INBOX for shared namespaces
Markus Valentin [Fri, 21 May 2021 11:53:02 +0000 (13:53 +0200)] 
imap-acl: In case mailbox name is "" set it to INBOX for shared namespaces

To prevent proxying ACL commands with mailbox "" replace it with "INBOX"
when used with shared namespaces.

4 years agoimapc: Extract imapc_mailbox_name_equals from imapc_untagged_status
Markus Valentin [Tue, 25 May 2021 14:09:25 +0000 (16:09 +0200)] 
imapc: Extract imapc_mailbox_name_equals from imapc_untagged_status

4 years agoimap-acl: Replace mailbox_open_as_admin with mailbox_open_allocated_as_admin
Markus Valentin [Thu, 20 May 2021 14:03:12 +0000 (16:03 +0200)] 
imap-acl: Replace mailbox_open_as_admin with mailbox_open_allocated_as_admin

4 years agoimap-acl: Allow LISTRIGHT replies without opening as admin
Markus Valentin [Thu, 20 May 2021 12:27:46 +0000 (14:27 +0200)] 
imap-acl: Allow LISTRIGHT replies without opening as admin

As the reply is hardcoded there is no need to proxy the ACL
command to a remote backend in case imapc_feature "acl" is
enabled.

4 years agoimap-acl: Implement proxying commands to an imapc location for DELETEACL
Markus Valentin [Wed, 19 May 2021 13:12:35 +0000 (15:12 +0200)] 
imap-acl: Implement proxying commands to an imapc location for DELETEACL

Before calling imap_acl_cmd_deleteacl in cmd_deleteacl the new code
checks if the command should be proxied and if so, does the proxying.

4 years agoimap-acl: Implement proxying commands to an imapc location for SETACL
Markus Valentin [Wed, 19 May 2021 13:11:40 +0000 (15:11 +0200)] 
imap-acl: Implement proxying commands to an imapc location for SETACL

Before calling imap_acl_cmd_setacl in cmd_setacl the new code checks if
the command should be proxied and if so, does the proxying.

4 years agoimap-acl: Implement proxying commands to an imapc location for GETACL
Markus Valentin [Wed, 19 May 2021 13:09:24 +0000 (15:09 +0200)] 
imap-acl: Implement proxying commands to an imapc location for GETACL

Before calling imap_acl_cmd_getacl in cmd_getacl the new code checks if the
command should be proxied and if so, does the proxying.

4 years agoimap-acl: Extract imap_acl_cmd_deleteacl from cmd_deletacl
Markus Valentin [Tue, 25 May 2021 14:59:31 +0000 (16:59 +0200)] 
imap-acl: Extract imap_acl_cmd_deleteacl from cmd_deletacl

This change makes acl_mailbox_open_allocated_as_admin called later which
is necessary for the following proxying IMAP ACL changes.

4 years agoimap-acl: Extract imap_acl_cmd_setacl from cmd_setacl
Markus Valentin [Tue, 25 May 2021 14:45:13 +0000 (16:45 +0200)] 
imap-acl: Extract imap_acl_cmd_setacl from cmd_setacl

This change makes acl_mailbox_open_allocated_as_admin called later which
is necessary for the following proxying IMAP ACL changes.

4 years agoimap-acl: Extract imap_acl_cmd_getacl from cmd_getacl
Markus Valentin [Tue, 25 May 2021 14:29:10 +0000 (16:29 +0200)] 
imap-acl: Extract imap_acl_cmd_getacl from cmd_getacl

This change makes acl_mailbox_open_allocated_as_admin called later which
is necessary for the following proxying IMAP ACL changes.

4 years agoimap-acl: Implement proxying commands to an imapc location for MYRIGHTS
Markus Valentin [Wed, 19 May 2021 12:52:36 +0000 (14:52 +0200)] 
imap-acl: Implement proxying commands to an imapc location for MYRIGHTS

Introduce the needed changes to proxy imap-acl commands to a remote
backend using imap-client.

Before calling imap_acl_cmd_myrights in cmd_myrights the new code checks if
the command should be proxied and if so, does the proxying.

4 years agoimap-acl: Add imapc_acl_get_mailbox_error
Markus Valentin [Tue, 25 May 2021 10:40:55 +0000 (12:40 +0200)] 
imap-acl: Add imapc_acl_get_mailbox_error

Allows to retrieve full mailbox error.

4 years agoimap-acl: Split off imap_acl_cmd_myrights from cmd_myrights
Markus Valentin [Tue, 25 May 2021 09:19:47 +0000 (11:19 +0200)] 
imap-acl: Split off imap_acl_cmd_myrights from cmd_myrights

4 years agoimap-acl: Split acl_mailbox_open_as_admin
Markus Valentin [Thu, 20 May 2021 11:47:55 +0000 (13:47 +0200)] 
imap-acl: Split acl_mailbox_open_as_admin

This allows easier implementation of the imap-acl proxying.

4 years agoimap-acl: Add imap_acl_storage with module context
Markus Valentin [Thu, 20 May 2021 21:21:10 +0000 (23:21 +0200)] 
imap-acl: Add imap_acl_storage with module context

4 years agoimapc: Add imapc_mail_error_to_resp_text_code to access error msg by enum
Markus Valentin [Tue, 25 May 2021 10:38:50 +0000 (12:38 +0200)] 
imapc: Add imapc_mail_error_to_resp_text_code to access error msg by enum

4 years agoimapc: Change function signature prefix to imapc_resp_text_code_parse
Markus Valentin [Wed, 26 May 2021 08:31:26 +0000 (10:31 +0200)] 
imapc: Change function signature prefix to imapc_resp_text_code_parse

4 years agoimapc: Add imapc_storage_client_unregister_untagged function
Markus Valentin [Thu, 20 May 2021 21:18:30 +0000 (23:18 +0200)] 
imapc: Add imapc_storage_client_unregister_untagged function

4 years agoimapc: Add imapc_features=acl
Markus Valentin [Tue, 18 May 2021 14:26:46 +0000 (16:26 +0200)] 
imapc: Add imapc_features=acl

In order to allow proxying IMAP ACL commands to a remote backend

4 years agolib-smtp: smtp-server-connection - Fix STARTTLS command injection vulnerability.
Stephan Bosch [Fri, 21 May 2021 22:16:38 +0000 (00:16 +0200)] 
lib-smtp: smtp-server-connection - Fix STARTTLS command injection vulnerability.

The input handler kept reading more commands even though the input was locked by
the STARTTLS command, thereby causing it to read the command pipelined beyond
STARTTLS. This causes a STARTTLS command injection vulerability.

4 years agoimap: copy/move: Fix memory leak when no messages were found
Timo Sirainen [Fri, 21 May 2021 11:42:07 +0000 (14:42 +0300)] 
imap: copy/move: Fix memory leak when no messages were found

4 years agoacl: Fix broken LIST for shared namespaces
Markus Valentin [Fri, 14 May 2021 13:57:20 +0000 (15:57 +0200)] 
acl: Fix broken LIST for shared namespaces

Due to the recent changes in the usage of the acl_ignore_namespace
setting shared namespaces where trying to use fast listing too. This
resulted in wrong LIST IMAP command outputs when using acl plugin.

Broken by af18bb0c8c4ffbd3a8008ce9fc7a58db5937b0a6

4 years agoacl: Prevent crashes with acl_ignore_namespace
Markus Valentin [Fri, 30 Apr 2021 09:34:51 +0000 (11:34 +0200)] 
acl: Prevent crashes with acl_ignore_namespace

In case a namespace was ignored for ACLs an crash could occur because of
"Module context acl_storage_module missing". This panic is prevented by this
change.

4 years agoacl: Move static acl_namespace_is_ignored
Markus Valentin [Thu, 6 May 2021 08:18:10 +0000 (10:18 +0200)] 
acl: Move static acl_namespace_is_ignored

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-dict: dict-lua - Don't yield again until previous one has completed
Aki Tuomi [Thu, 6 May 2021 18:25:54 +0000 (21:25 +0300)] 
lib-dict: dict-lua - Don't yield again until previous one has completed

4 years agolib-dict: dict-lua - Use absolute stack positions for arguments
Aki Tuomi [Tue, 4 May 2021 09:15:55 +0000 (12:15 +0300)] 
lib-dict: dict-lua - Use absolute stack positions for arguments

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 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 agolib-oauth2: Add missing test_begin/test_end to token escape
Aki Tuomi [Mon, 3 May 2021 06:58:29 +0000 (09:58 +0300)] 
lib-oauth2: Add missing test_begin/test_end to token escape

4 years agom4: Include local copy of pkg.m4
Aki Tuomi [Mon, 26 Apr 2021 12:39:36 +0000 (15:39 +0300)] 
m4: Include local copy of pkg.m4

We need features not present in early versions. The variable=name
support has been there since 1.7.4 of pkg-config.

4 years agolib-storage: Avoid logging the same mail istream read error multiple times
Timo Sirainen [Wed, 21 Apr 2021 16:18:07 +0000 (19:18 +0300)] 
lib-storage: Avoid logging the same mail istream read error multiple times

4 years agomaster: Notify systemd after we are really stopped
Aki Tuomi [Mon, 26 Apr 2021 09:02:58 +0000 (12:02 +0300)] 
master: Notify systemd after we are really stopped

4 years agoMakefile.am: Fix systemd detection mess in automake
Aki Tuomi [Mon, 26 Apr 2021 05:39:50 +0000 (08:39 +0300)] 
Makefile.am: Fix systemd detection mess in automake

4 years agodovecot.service: Set type to notify only when compiling with systemd
Aki Tuomi [Mon, 26 Apr 2021 05:29:02 +0000 (08:29 +0300)] 
dovecot.service: Set type to notify only when compiling with systemd

4 years agoMakefile.am: Make systemd service file generation more readable
Aki Tuomi [Mon, 26 Apr 2021 05:38:14 +0000 (08:38 +0300)] 
Makefile.am: Make systemd service file generation more readable

4 years agoconfigure.ac: Move CFLAGS to right place
Aki Tuomi [Mon, 26 Apr 2021 06:38:44 +0000 (09:38 +0300)] 
configure.ac: Move CFLAGS to right place

Now it's in middle of passdb displaying

4 years agolib-storage: Fix detecting duplicate nodes in mailbox list index
Timo Sirainen [Wed, 24 Mar 2021 14:09:51 +0000 (16:09 +0200)] 
lib-storage: Fix detecting duplicate nodes in mailbox list index

The duplicates were checked only for root nodes, not for child nodes.

4 years agoconfigure: Bump version to 2.3.15
Aki Tuomi [Thu, 22 Apr 2021 12:21:04 +0000 (15:21 +0300)] 
configure: Bump version to 2.3.15

4 years agoNEWS: Add news for 2.3.15
Aki Tuomi [Wed, 21 Apr 2021 07:46:20 +0000 (10:46 +0300)] 
NEWS: Add news for 2.3.15

4 years agoNEWS: fix 2.3.14 version
Aki Tuomi [Wed, 21 Apr 2021 07:01:46 +0000 (10:01 +0300)] 
NEWS: fix 2.3.14 version

4 years agoNEWS: Mention XZ/LZMA removal.
Aki Tuomi [Thu, 4 Mar 2021 07:52:40 +0000 (09:52 +0200)] 
NEWS: Mention XZ/LZMA removal.

4 years agoNEWS: Update news for 2.3.14
Aki Tuomi [Tue, 2 Mar 2021 08:55:53 +0000 (10:55 +0200)] 
NEWS: Update news for 2.3.14

4 years agolib-imap: imap_bodystructure_write() - Return error on corruption instead of assert...
Timo Sirainen [Thu, 1 Apr 2021 17:39:27 +0000 (20:39 +0300)] 
lib-imap: imap_bodystructure_write() - Return error on corruption instead of assert-crash

This could happen if broken message_parts came from cache and
message_part->data was newly read from the mail input.

4 years agolib-storage: Split off index_mail_parse_bodystructure_full()
Timo Sirainen [Thu, 8 Apr 2021 12:04:42 +0000 (15:04 +0300)] 
lib-storage: Split off index_mail_parse_bodystructure_full()

4 years agolib-imap: fuzz-imap-bodystructure - Change failures to i_panic() instead of i_fatal()
Timo Sirainen [Fri, 9 Apr 2021 11:09:17 +0000 (14:09 +0300)] 
lib-imap: fuzz-imap-bodystructure - Change failures to i_panic() instead of i_fatal()

4 years agolib-smtp: smtp-params - Make explicit which extra parameters can be written by smtp_p...
Stephan Bosch [Tue, 30 Mar 2021 19:12:41 +0000 (21:12 +0200)] 
lib-smtp: smtp-params - Make explicit which extra parameters can be written by smtp_params_*_write().

This can be used to prevent sending unsupported parameters to the remote server,
even when these are listed in extra_parameters. Before, blindly proxying
parameters would cause MAIL/RCPT error replies from the remote server.

4 years agolib-smtp: smtp-client-connection - Explicitly specify which MAIL/RCPT parameters...
Stephan Bosch [Tue, 30 Mar 2021 19:06:58 +0000 (21:06 +0200)] 
lib-smtp: smtp-client-connection - Explicitly specify which MAIL/RCPT parameters are added by extra capabilities.

This is used in later commit to limit which custom parameters are actually sent
to the server based on the capabilities supported by said server.

4 years agolib-smtp: smtp-client-connection - Prevent recording extra capabilities from server...
Stephan Bosch [Tue, 30 Mar 2021 19:48:24 +0000 (21:48 +0200)] 
lib-smtp: smtp-client-connection - Prevent recording extra capabilities from server more than once.

4 years agolib-smtp: smtp-client-connection - Prevent duplicate registrations for extra capabili...
Stephan Bosch [Tue, 30 Mar 2021 19:45:33 +0000 (21:45 +0200)] 
lib-smtp: smtp-client-connection - Prevent duplicate registrations for extra capabilities.

4 years agolib-smtp: smtp-client-connection - Move smtp_client_connection_find_extra_capability().
Stephan Bosch [Wed, 31 Mar 2021 10:33:38 +0000 (12:33 +0200)] 
lib-smtp: smtp-client-connection - Move smtp_client_connection_find_extra_capability().

4 years agolib-smtp: smtp-client-connection - Change extra capability registration to use a...
Stephan Bosch [Tue, 30 Mar 2021 19:33:17 +0000 (21:33 +0200)] 
lib-smtp: smtp-client-connection - Change extra capability registration to use a struct.

This is needed for adding additional features in later commit.

4 years agolib-smtp: smtp-client-connection - Fix typo in function name.
Stephan Bosch [Tue, 30 Mar 2021 19:41:48 +0000 (21:41 +0200)] 
lib-smtp: smtp-client-connection - Fix typo in function name.

4 years agolmtp: lmtp-commands - Drop XRCPTFORWARD parameter once processed.
Stephan Bosch [Tue, 30 Mar 2021 22:06:29 +0000 (00:06 +0200)] 
lmtp: lmtp-commands - Drop XRCPTFORWARD parameter once processed.

This prevents it from popping up elsewhere. This for example crudely fixes a
problem in the proxy where XRCPTFORWARD was sent even without backend server support.

4 years agoimap: NOTIFY - Fix crash if client disconnects while sending FETCH notification ...
Timo Sirainen [Mon, 19 Apr 2021 09:46:44 +0000 (12:46 +0300)] 
imap: NOTIFY - Fix crash if client disconnects while sending FETCH notification (try #2)

Continues the incomplete fix for c4f4058d16096f23eea0b3182205d6653f5954dd

Fixes:
Panic: Trying to close mailbox INBOX with open transactions

4 years agolib-oauth2: test-oauth2-jwt - Fix linkage for openssl
Aki Tuomi [Wed, 14 Apr 2021 16:17:30 +0000 (19:17 +0300)] 
lib-oauth2: test-oauth2-jwt - Fix linkage for openssl

Without whole archive option ssl_iostream_unref isn't
included in linkage, which will prevent libdcrypt from
loading openssl backend.

4 years agolib-oauth2: Ensure azp is escaped too
Aki Tuomi [Thu, 19 Nov 2020 17:55:42 +0000 (19:55 +0200)] 
lib-oauth2: Ensure azp is escaped too

4 years agolib-oauth2: Add test for token escape
Aki Tuomi [Wed, 14 Apr 2021 10:47:16 +0000 (13:47 +0300)] 
lib-oauth2: Add test for token escape

4 years agolib-oauth2: Improve identifier escaping function
Aki Tuomi [Wed, 14 Apr 2021 11:12:16 +0000 (14:12 +0300)] 
lib-oauth2: Improve identifier escaping function

4 years agolib-oauth2: Move identifier escaping to own function
Aki Tuomi [Sat, 10 Apr 2021 14:54:45 +0000 (17:54 +0300)] 
lib-oauth2: Move identifier escaping to own function

4 years agologin-common: Fix memory leak if anvil query is aborted
Timo Sirainen [Fri, 16 Apr 2021 13:13:39 +0000 (16:13 +0300)] 
login-common: Fix memory leak if anvil query is aborted

4 years agovirtual: virtual-mail - Use index_mail_set_seq to ensure cleanup
Aki Tuomi [Fri, 16 Apr 2021 08:18:15 +0000 (11:18 +0300)] 
virtual: virtual-mail - Use index_mail_set_seq to ensure cleanup

Forgotten in 67ab2070cf513179382b564871f2a0f177987cc9

4 years agovirtual: virtual-mail - Pass wanted_headers and wanted_fields to backend mails only
Aki Tuomi [Fri, 16 Apr 2021 08:16:36 +0000 (11:16 +0300)] 
virtual: virtual-mail - Pass wanted_headers and wanted_fields to backend mails only

Broken in 67ab2070cf513179382b564871f2a0f177987cc9

4 years agovirtual: virtual-mail - Use index_mail_free
Aki Tuomi [Fri, 16 Apr 2021 07:01:45 +0000 (10:01 +0300)] 
virtual: virtual-mail - Use index_mail_free

Since we are using index_mail_init, we need to use index_mail_free
to free up the virtual mail.

4 years agovirtual: virtual-mail - Free wanted headers in close if we are freeing
Aki Tuomi [Fri, 16 Apr 2021 07:24:22 +0000 (10:24 +0300)] 
virtual: virtual-mail - Free wanted headers in close if we are freeing

Simplifies next change

4 years agovirtual: virtual-mail - Free up mails in virtual_mail_close if we are freeing up
Aki Tuomi [Fri, 16 Apr 2021 07:03:33 +0000 (10:03 +0300)] 
virtual: virtual-mail - Free up mails in virtual_mail_close if we are freeing up

Makes next change easier

4 years agolib: Add comment to CALLBACK_TYPECHECK() macro
Timo Sirainen [Wed, 14 Apr 2021 15:08:03 +0000 (18:08 +0300)] 
lib: Add comment to CALLBACK_TYPECHECK() macro

4 years agolib-index: Add "mail_cache_lookup" event
Siavash Tavakoli [Wed, 31 Mar 2021 02:08:26 +0000 (03:08 +0100)] 
lib-index: Add "mail_cache_lookup" event

Adds new event for cache lookups with lookup name as "field" event field.

4 years agolib-index: Small refactor in mail_cache_lookup_field()
Siavash Tavakoli [Wed, 31 Mar 2021 16:28:46 +0000 (17:28 +0100)] 
lib-index: Small refactor in mail_cache_lookup_field()

Makes it easier to emit event in next commit regardless of code path.

4 years agolib-storage: Add "mail_expunged" event
Siavash Tavakoli [Mon, 29 Mar 2021 23:37:59 +0000 (00:37 +0100)] 
lib-storage: Add "mail_expunged" event

Emitted when a message is actually expunged. Has UID as a field.

4 years agolib-storage, plugins/virtual: Use mail_sync_notify()
Siavash Tavakoli [Mon, 29 Mar 2021 12:41:55 +0000 (13:41 +0100)] 
lib-storage, plugins/virtual: Use mail_sync_notify()

Instead of calling sync_notify vfunc directly.

4 years agolib-storage: Add mailbox_sync_notify()
Siavash Tavakoli [Mon, 29 Mar 2021 12:41:32 +0000 (13:41 +0100)] 
lib-storage: Add mailbox_sync_notify()

Instead of calling sync_notify vfunc directly everywhere.

4 years agolib-storage: Emit "mail_expunge_requested" event
Siavash Tavakoli [Mon, 29 Mar 2021 12:01:40 +0000 (13:01 +0100)] 
lib-storage: Emit "mail_expunge_requested" event

Adds a new event, "mail_expunge_requested" which is emitted when a
message is marked to being expunged.

4 years agolib-storage: Emit "mail_opened" event when mails opened
Aki Tuomi [Wed, 10 Feb 2021 11:57:08 +0000 (13:57 +0200)] 
lib-storage: Emit "mail_opened" event when mails opened

Adds a new event, "mail_opened" with "reason" as field. Also drop duplicate
event in index_mail_init_stream().

4 years agolib-storage: Include "age_days" field in mail.event
Siavash Tavakoli [Mon, 5 Apr 2021 23:38:06 +0000 (00:38 +0100)] 
lib-storage: Include "age_days" field in mail.event

Goes back one week, if mail age information is known, an integer field is added
with value of mail age in number of days.

4 years agoplugins/virtual: Use index_mail_init() to initialize the mail
Siavash Tavakoli [Wed, 31 Mar 2021 15:08:06 +0000 (16:08 +0100)] 
plugins/virtual: Use index_mail_init() to initialize the mail

Cleans up duplicated code. Also, index_mail_init initializes mail.event
as well. Something that was missing previously.

4 years agolib-storage: Refactor index_mail_init() to make it more reusable
Siavash Tavakoli [Wed, 31 Mar 2021 15:01:02 +0000 (16:01 +0100)] 
lib-storage: Refactor index_mail_init() to make it more reusable

Adds arguments for two memory pools, to be set for mail.pool and
mail.data_pool. If data_pool is NULL, a pool is allocated but mail_pool
is required.

4 years agolib-storage: Recreate mail.event when active mail is changed
Timo Sirainen [Thu, 11 Mar 2021 12:14:53 +0000 (14:14 +0200)] 
lib-storage: Recreate mail.event when active mail is changed

This makes sure that the two mails' events are treated completely
independently without any accidental spilling. It also prevents wasting
memory if each mail changes the event and grows the memory pool.

4 years agolib-smtp: fuzz-smtp-server - Implement all callbacks required for full transaction.
Stephan Bosch [Mon, 12 Apr 2021 19:18:05 +0000 (21:18 +0200)] 
lib-smtp: fuzz-smtp-server - Implement all callbacks required for full transaction.

Before required RCPT and DATA callbacks were omitted, causing assertion failures
when the fuzzer reached the RCPT stage.

4 years agolib-test: fuzzer - Fix FD-based fuzzing to only shutdown input FD upon end of data.
Stephan Bosch [Mon, 12 Apr 2021 19:14:07 +0000 (21:14 +0200)] 
lib-test: fuzzer - Fix FD-based fuzzing to only shutdown input FD upon end of data.

Before, it closed the whole socket once the data input ended. This for
example caused the SMTP server fuzzer to end before all replies were sent. This
shortened the test and could have hidden bugs that occur later in the SMTP
transaction.

4 years agolib-smtp: smtp-reply - Add debug message for reply send error.
Stephan Bosch [Mon, 12 Apr 2021 19:12:27 +0000 (21:12 +0200)] 
lib-smtp: smtp-reply - Add debug message for reply send error.

This makes it a little clearer at what point the connection loss or error was
noticed and for which command/reply.

4 years agolib-lua: Fix compiler warning with dlua_pcall_yieldable()
Timo Sirainen [Wed, 14 Apr 2021 08:57:39 +0000 (11:57 +0300)] 
lib-lua: Fix compiler warning with dlua_pcall_yieldable()

4 years agolib-storage: Make sure listescape can work correctly with shared namespaces
Markus Valentin [Fri, 9 Apr 2021 09:35:05 +0000 (11:35 +0200)] 
lib-storage: Make sure listescape can work correctly with shared namespaces

This makes sure that if storage_name_escape_char is set, shared mailboxes
do not return the invalid/unescaped mailbox storage_name internally which
could result in failures like "Invalid mailbox name: Name must not have '/'
character" even when using the listescape plugin.

Broken by 5fd5ad3a2be6708e81f8dcfcbb06a3957dddd276

4 years agolib: Fix buffer_t aliasing problems with LTO
Timo Sirainen [Thu, 1 Apr 2021 18:42:02 +0000 (21:42 +0300)] 
lib: Fix buffer_t aliasing problems with LTO

This changes the buffer_t slightly, which requires adding extra braces
when buffer_t contents are directly defined.

This changes Dovecot to require C11 compatible compiler, because it uses
anonymous union and struct. GNU99 extensions are also enough.

4 years agolib: buffer - Change real_buffer.r_buffer type to const void *
Timo Sirainen [Thu, 1 Apr 2021 18:37:27 +0000 (21:37 +0300)] 
lib: buffer - Change real_buffer.r_buffer type to const void *

4 years agoimap: Fix accessing uninitialized variable warning with LTO
Timo Sirainen [Thu, 1 Apr 2021 09:47:15 +0000 (12:47 +0300)] 
imap: Fix accessing uninitialized variable warning with LTO

There doesn't seem to be any other way to quiet this warning, although
it's wrong.

4 years agodoveadm dict: Handle missing parameters without crashing
Timo Sirainen [Thu, 1 Apr 2021 09:45:39 +0000 (12:45 +0300)] 
doveadm dict: Handle missing parameters without crashing

4 years agoglobal: Fix accessing uninitialized variables on unit test failures
Timo Sirainen [Thu, 1 Apr 2021 09:20:46 +0000 (12:20 +0300)] 
global: Fix accessing uninitialized variables on unit test failures

4 years agolib-imap: imap_envelope_parse() - Refactor to avoid LTO warnings
Timo Sirainen [Thu, 1 Apr 2021 09:33:33 +0000 (12:33 +0300)] 
lib-imap: imap_envelope_parse() - Refactor to avoid LTO warnings

The original code was correct, but gcc with LTO still gave warnings about
potentially uninitialized envlp_r and error_r.