]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
4 years agolib-index: mail_index_sync_map() - Always return -1 on I/O failures
Timo Sirainen [Mon, 10 Aug 2020 14:33:07 +0000 (17:33 +0300)] 
lib-index: mail_index_sync_map() - Always return -1 on I/O failures

Even though with force=FALSE in theory it would be possible to work around
it, but more likely it will just cause another I/O error. This simplifies
the code for the following changes.

4 years agolib-index: Move calling mail_index_sync_map_want_index_reopen() to mail_index_map()
Timo Sirainen [Mon, 10 Aug 2020 14:31:27 +0000 (17:31 +0300)] 
lib-index: Move calling mail_index_sync_map_want_index_reopen() to mail_index_map()

4 years agolib-index: Split off mail_index_sync_map_want_index_reopen()
Timo Sirainen [Mon, 10 Aug 2020 14:29:44 +0000 (17:29 +0300)] 
lib-index: Split off mail_index_sync_map_want_index_reopen()

4 years agolib-index: mail_transaction_log_indexid_changed() - Clarify refcount handling
Timo Sirainen [Mon, 10 Aug 2020 17:02:22 +0000 (20:02 +0300)] 
lib-index: mail_transaction_log_indexid_changed() - Clarify refcount handling

Although the old code worked as well, it wasn't so obvious since the
behavior was slightly different when the log->head had extra references.
Clarify the behavior by always unreferencing after the new log file is
created.

4 years agolib-index: mail_transaction_log_file_free() - Assert that refcount=0
Timo Sirainen [Mon, 10 Aug 2020 17:09:41 +0000 (20:09 +0300)] 
lib-index: mail_transaction_log_file_free() - Assert that refcount=0

4 years agolib-index: mail_index_write() - Make sure index is rewritten after log rotation
Timo Sirainen [Mon, 10 Aug 2020 16:59:36 +0000 (19:59 +0300)] 
lib-index: mail_index_write() - Make sure index is rewritten after log rotation

Otherwise the index will point to .log.2 file, which could become deleted
before the index is rewritten again.

4 years agolib-index: mail_transaction_log_view_set() - Make sure log files aren't freed too...
Timo Sirainen [Mon, 10 Aug 2020 16:54:55 +0000 (19:54 +0300)] 
lib-index: mail_transaction_log_view_set() - Make sure log files aren't freed too early

It's possible that mail_transaction_log_find_file() frees one of the files
that are already in the linked list. Avoid it by referencing the file
immediately when it's added to the list.

4 years agolib-index: test-mail-transaction-log-view - Move test_transaction_log_file_add()
Timo Sirainen [Thu, 12 Nov 2020 16:01:18 +0000 (18:01 +0200)] 
lib-index: test-mail-transaction-log-view - Move test_transaction_log_file_add()

4 years agolib-index: mail_transaction_log_view_set() - Return -1 only on I/O error
Timo Sirainen [Mon, 10 Aug 2020 14:12:32 +0000 (17:12 +0300)] 
lib-index: mail_transaction_log_view_set() - Return -1 only on I/O error

The callers that care about the difference:

 * mail_index_sync_map() already assumes that -1 means I/O error
 * mail_index_sync_set_log_view() handles 0 by logging an error and fscking
   the index, which is likely better than just returning failure.
 * view_sync_set_log_view_range()'s caller handles 0 by rebuilding the
   missing changes in memory. So returning 0 makes it work better.
 * dsync_log_set() and mailbox_get_expunges_init() have fallbacks for
   handling 0, while -1 would just return an error.

4 years agolib-index: mail_transaction_log_file_get_highest_modseq_at() - Separate I/O errors...
Timo Sirainen [Mon, 10 Aug 2020 14:06:05 +0000 (17:06 +0300)] 
lib-index: mail_transaction_log_file_get_highest_modseq_at() - Separate I/O errors from corruption

4 years agolib: Add data_stack_get_used_size()
Timo Sirainen [Fri, 13 Nov 2020 17:30:29 +0000 (19:30 +0200)] 
lib: Add data_stack_get_used_size()

Mainly for debugging purposes.

4 years agodoveadm dict iter: Support printing multiple values
Timo Sirainen [Tue, 17 Nov 2020 15:26:28 +0000 (17:26 +0200)] 
doveadm dict iter: Support printing multiple values

4 years agodict-sql: Support dict_iterate_values()
Timo Sirainen [Tue, 17 Nov 2020 12:41:31 +0000 (14:41 +0200)] 
dict-sql: Support dict_iterate_values()

4 years agodict, dict-client: Support dict_iterate_values()
Timo Sirainen [Tue, 17 Nov 2020 12:24:57 +0000 (14:24 +0200)] 
dict, dict-client: Support dict_iterate_values()

This doesn't change the dict client protocol in an incompatible way, so it's
possible to mix old/new client/server.

4 years agolib-dict: Add dict_iterate_values()
Timo Sirainen [Tue, 17 Nov 2020 12:20:40 +0000 (14:20 +0200)] 
lib-dict: Add dict_iterate_values()

4 years agolib-dict: Change dict.iterate() API to support returning multiple values
Timo Sirainen [Tue, 17 Nov 2020 12:09:30 +0000 (14:09 +0200)] 
lib-dict: Change dict.iterate() API to support returning multiple values

This requires changes to all dict drivers.

4 years agolib-dict: dict_iterate() - Always return NULL if DICT_ITERATE_FLAG_NO_VALUE is used
Timo Sirainen [Tue, 17 Nov 2020 12:30:27 +0000 (14:30 +0200)] 
lib-dict: dict_iterate() - Always return NULL if DICT_ITERATE_FLAG_NO_VALUE is used

This way it behaves more consistently across backends.

4 years agodoveadm: mail: doveadm_mail_failed_error() - Set specific exit code for MAIL_ERROR_INUSE
Markus Valentin [Fri, 20 Nov 2020 11:52:47 +0000 (12:52 +0100)] 
doveadm: mail: doveadm_mail_failed_error() - Set specific exit code for MAIL_ERROR_INUSE

Set exit code DOVEADM_EX_NOTPOSSIBLE in case MAIL_ERROR_INUSE is set via
doveadm_mail_failed_error(). This exit code is used to indicate that a
operation cannot be done because another session prevents it.

4 years agodoveadm: When sending server logs to client, make sure ioloop isn't set to NULL
Timo Sirainen [Fri, 20 Nov 2020 10:15:18 +0000 (12:15 +0200)] 
doveadm: When sending server logs to client, make sure ioloop isn't set to NULL

This could have happened if there was any logging done outside command
handling. For example a doveadm command used http-client, which has a
timeout that triggers logging only after the command is finished.

Fixes segfault and:
Panic: file http-client.c: line 642 (http_client_context_close): assertion failed: (cctx->clients_list == NULL)

4 years agolib-lua: Don't add system libs to libdovecot_lua_la_DEPENDENCIES
Josef 'Jeff' Sipek [Fri, 20 Nov 2020 17:23:21 +0000 (12:23 -0500)] 
lib-lua: Don't add system libs to libdovecot_lua_la_DEPENDENCIES

This confuses the build system, causing it to think that it needs to build
those.  This manifests itself as:

make: *** No rule to make target '-L/usr/lib/x86_64-linux-gnu', needed by 'libdovecot-lua.la'.  Stop.

4 years agoimap: Fix memory leak in get_expunges_fallback()
sergey.kitov [Thu, 19 Nov 2020 20:07:37 +0000 (22:07 +0200)] 
imap: Fix memory leak in get_expunges_fallback()

4 years agolib: test-file-cache - Use memcmp
Aki Tuomi [Fri, 11 Sep 2020 13:06:46 +0000 (16:06 +0300)] 
lib: test-file-cache - Use memcmp

Data is not null-terminated, so use memcmp.

4 years agolib: test-file-cache - Assert map value
Aki Tuomi [Fri, 11 Sep 2020 11:11:55 +0000 (14:11 +0300)] 
lib: test-file-cache - Assert map value

Satisfies static analyser

4 years agolib: event-filter-parser - Test simple but invalid input
Josef 'Jeff' Sipek [Thu, 12 Nov 2020 19:15:54 +0000 (14:15 -0500)] 
lib: event-filter-parser - Test simple but invalid input

4 years agolib: event-filter - Do not assert that there in no output on error
Josef 'Jeff' Sipek [Thu, 12 Nov 2020 18:49:49 +0000 (13:49 -0500)] 
lib: event-filter - Do not assert that there in no output on error

When the input is a simple (but invalid) expression (e.g., a=b=c) the output
variable may be set.  This is perfectly fine.

The assertion (and the associated failure) come from when event filter
parsing was switched to the new filter syntax
(fcba1d530737813de11d9d730d5db6496e2e574b).

4 years agostats: openmetrics - Include submetric name only when present
Josef 'Jeff' Sipek [Mon, 19 Oct 2020 17:47:10 +0000 (13:47 -0400)] 
stats: openmetrics - Include submetric name only when present

Otherwise we SIGSEGV.

4 years agodsync: Fix UID renumbering when GUIDs aren't used
Timo Sirainen [Tue, 10 Nov 2020 22:11:35 +0000 (00:11 +0200)] 
dsync: Fix UID renumbering when GUIDs aren't used

Mails that have local UIDs won't be in import_uids hash table, so they're
not otherwise being iterated at the end and checked if they need
renumbering.

4 years agodsync: Incremental sync sometimes missed messages when GUIDs weren't available
Timo Sirainen [Tue, 10 Nov 2020 17:57:26 +0000 (19:57 +0200)] 
dsync: Incremental sync sometimes missed messages when GUIDs weren't available

GUIDs aren't available when using imapc, so this affected migrations.

4 years ago.gitignore: Ignore coverage and temp files
Aki Tuomi [Mon, 9 Nov 2020 07:04:36 +0000 (09:04 +0200)] 
.gitignore: Ignore coverage and temp files

4 years agolib-mail: test-message-part-serialize - Add tests
Aki Tuomi [Thu, 5 Nov 2020 10:08:38 +0000 (12:08 +0200)] 
lib-mail: test-message-part-serialize - Add tests

4 years agolib-mail: test-message-header-parser - Validate header value
Aki Tuomi [Wed, 4 Nov 2020 13:10:04 +0000 (15:10 +0200)] 
lib-mail: test-message-header-parser - Validate header value

4 years agolib-mail: test-message-header-parser - Test NUL bytes in header
Aki Tuomi [Wed, 4 Nov 2020 13:09:45 +0000 (15:09 +0200)] 
lib-mail: test-message-header-parser - Test NUL bytes in header

4 years agolib-mail: test-message-header-decode - Add more tests
Aki Tuomi [Wed, 4 Nov 2020 10:35:16 +0000 (12:35 +0200)] 
lib-mail: test-message-header-decode - Add more tests

4 years agolib-mail: test-message-header-decode - Use libcharset
Aki Tuomi [Wed, 4 Nov 2020 10:34:57 +0000 (12:34 +0200)] 
lib-mail: test-message-header-decode - Use libcharset

Otherwise we can only test utf-8

4 years agolib-mail: test-message-search - Add more message searching tests
Aki Tuomi [Tue, 3 Nov 2020 13:17:45 +0000 (15:17 +0200)] 
lib-mail: test-message-search - Add more message searching tests

4 years agolib-mail: test-mail-user-hash - Add tests for mail_user_hash
Aki Tuomi [Mon, 2 Nov 2020 18:59:18 +0000 (20:59 +0200)] 
lib-mail: test-mail-user-hash - Add tests for mail_user_hash

4 years agolib-mail: test-message-decoder - Add charset conversion test
Aki Tuomi [Mon, 2 Nov 2020 18:06:28 +0000 (20:06 +0200)] 
lib-mail: test-message-decoder - Add charset conversion test

4 years agolib-mail: test-message-decoder - Test Content-Transfer-Encoding
Aki Tuomi [Mon, 2 Nov 2020 16:38:32 +0000 (18:38 +0200)] 
lib-mail: test-message-decoder - Test Content-Transfer-Encoding

4 years agolib-mail: test-message-parser - Add tests for MIME-Version header
Aki Tuomi [Mon, 2 Nov 2020 11:46:12 +0000 (13:46 +0200)] 
lib-mail: test-message-parser - Add tests for MIME-Version header

4 years agolib-mail: test-* - Add missing test_assert
Aki Tuomi [Mon, 9 Nov 2020 07:29:26 +0000 (09:29 +0200)] 
lib-mail: test-* - Add missing test_assert

Need to ensure stream did not fail during parsing.

4 years agolib-mail: test-message-parser - Use message_part_is_equal
Aki Tuomi [Mon, 9 Nov 2020 07:22:28 +0000 (09:22 +0200)] 
lib-mail: test-message-parser - Use message_part_is_equal

Replace msg_parts_cmp with message_part_is_equal.

4 years agolib-mail: test-message-parser - Refactor message parsing to utility function
Aki Tuomi [Mon, 2 Nov 2020 11:15:24 +0000 (13:15 +0200)] 
lib-mail: test-message-parser - Refactor message parsing to utility function

Makes next changes easier.

4 years agolib-mail: Add message_part_is_equal
Aki Tuomi [Mon, 9 Nov 2020 07:16:27 +0000 (09:16 +0200)] 
lib-mail: Add message_part_is_equal

Returns TRUE if two parts are equal.

4 years agoconfigure.ac: Finish removing vpopmail support
Timo Sirainen [Wed, 11 Nov 2020 09:09:02 +0000 (11:09 +0200)] 
configure.ac: Finish removing vpopmail support

4 years agolib-storage: Add prefix to failed mailbox list index rebuild error messages
Timo Sirainen [Tue, 27 Oct 2020 13:12:19 +0000 (15:12 +0200)] 
lib-storage: Add prefix to failed mailbox list index rebuild error messages

This makes it clearer that the failure is happening because index was being
rebuilt.

4 years agolib-storage: Fix error message when mailbox list index rebuild fails
Timo Sirainen [Tue, 27 Oct 2020 13:13:39 +0000 (15:13 +0200)] 
lib-storage: Fix error message when mailbox list index rebuild fails

The error needs to be copied to mailbox_list, otherwise it's just
"Unknown internal list error".

4 years agolib-storage: Fix mailbox list iteration error handling for INBOX
Timo Sirainen [Tue, 27 Oct 2020 13:11:12 +0000 (15:11 +0200)] 
lib-storage: Fix mailbox list iteration error handling for INBOX

If INBOX isn't in the first namespace, the error wasn't correctly set for
it.

4 years agolib-storage: Use mailbox_get_last_mail_error() for mailbox_get_path_to() errors
Timo Sirainen [Tue, 27 Oct 2020 13:08:15 +0000 (15:08 +0200)] 
lib-storage: Use mailbox_get_last_mail_error() for mailbox_get_path_to() errors

mailbox_list_get_last_error() happens to work currently, but it's
accidental.

4 years agolib-index: Fix detecting if index is undeleted
Timo Sirainen [Mon, 2 Nov 2020 16:55:16 +0000 (18:55 +0200)] 
lib-index: Fix detecting if index is undeleted

It was possible that mail_index_is_deleted() kept returning that the index
was deleted, even if it was marked as undeleted. This happened when the
deletion was in dovecot.index.log.2, undeletion in dovecot.index.log and
dovecot.index pointed to the .log.2 file. This caused the .log file to be
read first, which sees the undeletion. Later on the .log.2 was parsed and
it marked the index back as deleted.

4 years agolib-fts: Avoid NULL pointer arithmetic
Timo Sirainen [Mon, 9 Nov 2020 23:30:06 +0000 (01:30 +0200)] 
lib-fts: Avoid NULL pointer arithmetic

Even though it was only doing +0. Fixes:
runtime error: applying zero offset to null pointer

4 years agolib-smtp: smtp_address_init_from_msg() - Avoid implicit char to unsigned char conversion
Timo Sirainen [Mon, 9 Nov 2020 16:10:21 +0000 (18:10 +0200)] 
lib-smtp: smtp_address_init_from_msg() - Avoid implicit char to unsigned char conversion

Fixes calling smtp_char_is_qpair() with ubsan:
runtime error: implicit conversion from type 'char' of value -61 (8-bit, signed) to type 'unsigned char' changed the value to 195 (8-bit, unsigned)

4 years agolib-index: Add explicit wrapping to 8bit variable increments
Timo Sirainen [Mon, 9 Nov 2020 15:52:51 +0000 (17:52 +0200)] 
lib-index: Add explicit wrapping to 8bit variable increments

Fixes ubsan errors:
runtime error: implicit conversion from type 'int' of value 256 (32-bit, signed) to type 'uint8_t' (aka 'unsigned char') changed the value to 0 (8-bit, unsigned)

4 years agolib: istream-concat - Avoid NULL pointer arithmetic
Timo Sirainen [Mon, 9 Nov 2020 15:38:26 +0000 (17:38 +0200)] 
lib: istream-concat - Avoid NULL pointer arithmetic

Even though it was only doing +0. Fixes:
runtime error: applying zero offset to null pointer

4 years agolib: istream-chain - Avoid NULL pointer arithmetic
Timo Sirainen [Mon, 9 Nov 2020 15:35:15 +0000 (17:35 +0200)] 
lib: istream-chain - Avoid NULL pointer arithmetic

Even though it was only doing +0. Fixes:
runtime error: applying zero offset to null pointer

4 years agolib: MODULE_CONTEXT_SET*() - Avoid NULL pointer arithmetic
Timo Sirainen [Mon, 9 Nov 2020 14:55:06 +0000 (16:55 +0200)] 
lib: MODULE_CONTEXT_SET*() - Avoid NULL pointer arithmetic

Even though it was only doing +0. Fixes:
runtime error: applying zero offset to null pointer

4 years agolib: Add and use TYPE_CHECKS() macro to standardize type checking for functions
Timo Sirainen [Mon, 9 Nov 2020 14:09:05 +0000 (16:09 +0200)] 
lib: Add and use TYPE_CHECKS() macro to standardize type checking for functions

This helps especially to avoid adding COMPILE_ERROR_*() macros to NULL
pointers, which results in ubsan errors:
runtime error: applying zero offset to null pointer

These changes also remove the use of gcc-specific ({...}) code in the
macros, making them slightly more portable.

4 years agolib: COMPILE_ERROR_IF_TRUE() - Return FALSE instead of 0
Timo Sirainen [Mon, 9 Nov 2020 13:39:57 +0000 (15:39 +0200)] 
lib: COMPILE_ERROR_IF_TRUE() - Return FALSE instead of 0

This will be needed for the following changes to avoid warnings with
-Wstrict-bool.

4 years agolib-fs: fs_file_init_parent() - Keep mode and flags parameters separated
Timo Sirainen [Mon, 9 Nov 2020 11:04:43 +0000 (13:04 +0200)] 
lib-fs: fs_file_init_parent() - Keep mode and flags parameters separated

Internally cast them both to (int) before ORing them together for the
fs_file_init_with_event() call.

This avoids compiler warnings with -Wenum-enum-conversion:
warning: bitwise operation between different enumeration types ('enum fs_open_mode' and 'enum fs_open_flags')

4 years agoauth: Remove ntlm mechanism & the LANMAN and NTLM password schemes
Josef 'Jeff' Sipek [Fri, 23 Oct 2020 20:24:09 +0000 (16:24 -0400)] 
auth: Remove ntlm mechanism & the LANMAN and NTLM password schemes

4 years agoauth: Remove vpopmail user & pass db support
Josef 'Jeff' Sipek [Fri, 16 Oct 2020 13:18:31 +0000 (09:18 -0400)] 
auth: Remove vpopmail user & pass db support

4 years agoauth: Remove S/Key mechanism & password scheme
Josef 'Jeff' Sipek [Fri, 16 Oct 2020 13:01:19 +0000 (09:01 -0400)] 
auth: Remove S/Key mechanism & password scheme

4 years agoauth: Remove RPA mechanism & password scheme
Josef 'Jeff' Sipek [Fri, 16 Oct 2020 12:50:21 +0000 (08:50 -0400)] 
auth: Remove RPA mechanism & password scheme

4 years agoauth: Remove postmap socket type
Josef 'Jeff' Sipek [Fri, 16 Oct 2020 12:31:34 +0000 (08:31 -0400)] 
auth: Remove postmap socket type

4 years agoauth: Remove support for SIA passdb
Josef 'Jeff' Sipek [Fri, 16 Oct 2020 12:28:12 +0000 (08:28 -0400)] 
auth: Remove support for SIA passdb

4 years agolib: Be less verbose in event filter tests
Josef 'Jeff' Sipek [Fri, 23 Oct 2020 14:56:08 +0000 (10:56 -0400)] 
lib: Be less verbose in event filter tests

Only print the input string if the test failed.

4 years agolib-smtp: smtp-server-connection - Make sure output stream errors are handled.
Stephan Bosch [Tue, 27 Oct 2020 22:16:44 +0000 (23:16 +0100)] 
lib-smtp: smtp-server-connection - Make sure output stream errors are handled.

4 years agolib-ssl-iosteam: ostream-openssl - Make sure error on plaintext streams is propagated.
Stephan Bosch [Mon, 26 Oct 2020 09:19:46 +0000 (10:19 +0100)] 
lib-ssl-iosteam: ostream-openssl - Make sure error on plaintext streams is propagated.

4 years agolib-ssl-iostrea: ostream-openssl - Add local variable for ssl_io in o_stream_ssl_flus...
Stephan Bosch [Mon, 26 Oct 2020 21:04:53 +0000 (22:04 +0100)] 
lib-ssl-iostrea: ostream-openssl - Add local variable for ssl_io in o_stream_ssl_flush_buffer().

4 years agoauth: db-oauth2 - Do not allow empty active_value or active_attribute, when other...
Aki Tuomi [Thu, 5 Nov 2020 11:25:19 +0000 (13:25 +0200)] 
auth: db-oauth2 - Do not allow empty active_value or active_attribute, when other is set

4 years agoauth: db-oauth2 - If active attribute is present in request, check it
Aki Tuomi [Thu, 29 Oct 2020 09:37:22 +0000 (11:37 +0200)] 
auth: db-oauth2 - If active attribute is present in request, check it

If the attribute is missing, do not assume it's false.

4 years agoauth: db-oauth2 - Check active attribute by default
Aki Tuomi [Thu, 29 Oct 2020 09:36:00 +0000 (11:36 +0200)] 
auth: db-oauth2 - Check active attribute by default

4 years agoauth: db-oauth2 - Change active:false to mean invalid token
Aki Tuomi [Thu, 22 Oct 2020 08:42:23 +0000 (11:42 +0300)] 
auth: db-oauth2 - Change active:false to mean invalid token

Specifications say that invalid token, expired token and any other
reason why the token can be considered invalid should return
{"active":false} reply with no other fields.

Thus, we need to consider this as invalid token.

4 years agoauth: db-oauth2 - Allow active:false without username
Aki Tuomi [Thu, 22 Oct 2020 08:41:16 +0000 (11:41 +0300)] 
auth: db-oauth2 - Allow active:false without username

4 years agolib-storage: Skip setting log view in mailbox_get_expunges_init when box->view is...
sergey.kitov [Tue, 13 Oct 2020 14:34:12 +0000 (17:34 +0300)] 
lib-storage: Skip setting log view in mailbox_get_expunges_init when box->view is outdated.

This fixes assert-crash when IMAP client uses QRESYNC and lots of changes happen between syncing points.

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

4 years agolib-fts: test-fts-filter - Fix clang suspicious concatenation of string literals...
Timo Sirainen [Thu, 29 Oct 2020 10:34:57 +0000 (12:34 +0200)] 
lib-fts: test-fts-filter - Fix clang suspicious concatenation of string literals warning

Fixes:
warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Wstring-concatenation]

4 years agolib: Standardize STMT_BEGIN and STMT_END
Timo Sirainen [Thu, 29 Oct 2020 10:33:14 +0000 (12:33 +0200)] 
lib: Standardize STMT_BEGIN and STMT_END

do .. while(0) should work everywhere.

This also fixes warnings given by new clang:
warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]

4 years agolib: test-istream - Don't try to return void
Timo Sirainen [Thu, 29 Oct 2020 10:32:44 +0000 (12:32 +0200)] 
lib: test-istream - Don't try to return void

4 years agolib: test-file-cache - Add asserts for initial return value of file_cache_get
Aki Tuomi [Wed, 28 Oct 2020 10:45:09 +0000 (12:45 +0200)] 
lib: test-file-cache - Add asserts for initial return value of file_cache_get

4 years agolib-lda: Update mail sizes to event only if they are known
Aki Tuomi [Wed, 28 Oct 2020 10:23:40 +0000 (12:23 +0200)] 
lib-lda: Update mail sizes to event only if they are known

4 years agolib-storage: raw-mail - Cast st_size to uoff_t
Aki Tuomi [Wed, 28 Oct 2020 10:22:58 +0000 (12:22 +0200)] 
lib-storage: raw-mail - Cast st_size to uoff_t

mbox->size is unsigned field, and st_size will be -1
is the stat target is not regular file or symbolic link.
This can happen if it's stream like stdin.

4 years agolib-fs: iteration - Fix crash when overwriting iteration error
Timo Sirainen [Fri, 23 Oct 2020 11:54:22 +0000 (14:54 +0300)] 
lib-fs: iteration - Fix crash when overwriting iteration error

Can't use fs_file_path() because file is NULL. Instead, add the path to
struct fs_iter directly so it can be used in the error.

Broken by eaaf40ca4e8994824abff89fc617c3cc737d83a5

4 years agoquota: Avoid implicit integer conversion to unsigned in quota calculation
Aki Tuomi [Thu, 22 Oct 2020 17:21:41 +0000 (20:21 +0300)] 
quota: Avoid implicit integer conversion to unsigned in quota calculation

Deducting negative number from unsigned integer causes
signed integer conversion to unsigned int, which results a
too large positive number. Do calculations using int64 instead.

This did not cause any visible problems, found by
clang integer sanitization.

4 years agoglobal: Fix overzealous use of ENUM_NEGATE
Aki Tuomi [Thu, 22 Oct 2020 15:53:34 +0000 (18:53 +0300)] 
global: Fix overzealous use of ENUM_NEGATE

4 years agolib: istream-seekable - Fix returning stream size
Timo Sirainen [Thu, 22 Oct 2020 19:46:35 +0000 (22:46 +0300)] 
lib: istream-seekable - Fix returning stream size

The returned size may have been truncated.

4 years agolib-fs: Add assert to make sure we never log "(null)" as the old error
Timo Sirainen [Fri, 16 Oct 2020 08:21:51 +0000 (11:21 +0300)] 
lib-fs: Add assert to make sure we never log "(null)" as the old error

4 years agolib-fs: Fix logging old error when an unlogged error is replaced by new error
Timo Sirainen [Fri, 16 Oct 2020 08:20:04 +0000 (11:20 +0300)] 
lib-fs: Fix logging old error when an unlogged error is replaced by new error

The old error was logged as "(null)" if the error happened in a non-root
(filter) file.

4 years agolib-fs: Include file's path when logging pending error messages
Timo Sirainen [Fri, 16 Oct 2020 07:19:59 +0000 (10:19 +0300)] 
lib-fs: Include file's path when logging pending error messages

Otherwise it may not be known which file the error is about.

This happens when a file is freed without the last error being logged.
Also when an unlogged error is being replaced with a new error.

4 years agolib: event-filter-parser - Disallow non-equals comparators on non-fields
Josef 'Jeff' Sipek [Thu, 24 Sep 2020 17:44:58 +0000 (13:44 -0400)] 
lib: event-filter-parser - Disallow non-equals comparators on non-fields

Non-equals comparisons (<, <=, >, and >=) aren't well defined for anything
other than fields.  Therefore, if we encounter one of these comparators with
an event name, category name, or source location, we should error out and
avoid confusing the user.

4 years agolib-storage: Delay recreating event when closing mail
Timo Sirainen [Thu, 15 Oct 2020 17:34:05 +0000 (20:34 +0300)] 
lib-storage: Delay recreating event when closing mail

If the mail isn't reused, the event is unnecessary.

4 years agoglobal: Explicitly wrap values to fit target
Aki Tuomi [Mon, 19 Oct 2020 10:49:29 +0000 (13:49 +0300)] 
global: Explicitly wrap values to fit target

4 years agoglobal: Add explicit casts where needed
Aki Tuomi [Tue, 1 Sep 2020 06:44:04 +0000 (09:44 +0300)] 
global: Add explicit casts where needed

Squash implicit conversion complains from sanitizer.

4 years agoglobal: Disable undefined behaviour sanitization for select locations
Aki Tuomi [Thu, 13 Aug 2020 08:36:08 +0000 (11:36 +0300)] 
global: Disable undefined behaviour sanitization for select locations

4 years agoglobal: Fix negation with constants to match target type
Aki Tuomi [Thu, 20 Aug 2020 05:39:26 +0000 (08:39 +0300)] 
global: Fix negation with constants to match target type

4 years agoglobal: Use ENUM_NEGATE() macro where necessary
Aki Tuomi [Thu, 20 Aug 2020 05:35:59 +0000 (08:35 +0300)] 
global: Use ENUM_NEGATE() macro where necessary

4 years agoglobal: Use UOFF_T_MAX instead of (uoff_t)-1
Aki Tuomi [Wed, 23 Sep 2020 11:51:53 +0000 (14:51 +0300)] 
global: Use UOFF_T_MAX instead of (uoff_t)-1

4 years agoglobal: Use SIZE_MAX instead of (size_t)-1
Aki Tuomi [Wed, 23 Sep 2020 11:43:29 +0000 (14:43 +0300)] 
global: Use SIZE_MAX instead of (size_t)-1

4 years agolib: macros - Add ENUM_NEGATE
Aki Tuomi [Tue, 11 Aug 2020 05:41:54 +0000 (08:41 +0300)] 
lib: macros - Add ENUM_NEGATE

Handles enumeration flag negation.

4 years agoconfigure: Add ubsan support
Aki Tuomi [Tue, 28 Jul 2020 10:42:01 +0000 (13:42 +0300)] 
configure: Add ubsan support

4 years agolib-mail: test-message-header-hash: Fix type issue
Aki Tuomi [Wed, 23 Sep 2020 11:39:36 +0000 (14:39 +0300)] 
lib-mail: test-message-header-hash: Fix type issue

Satisfies runtime analyzer.

4 years agodoveadm: mailbox status - Handle first_save_date correctly
Aki Tuomi [Tue, 22 Sep 2020 11:39:41 +0000 (14:39 +0300)] 
doveadm: mailbox status - Handle first_save_date correctly

If first_save_date is -1 it means no save has been done.