Timo Sirainen [Wed, 18 Nov 2020 18:48:11 +0000 (20:48 +0200)]
lib-imap: Fix writing BODYSTRUCTURE for truncated multipart/ part
If the max nesting limit is reached, write the last part out as
application/octet-stream. The original content-type could be confusing
IMAP clients when they don't see any child parts.
Stephan Bosch [Tue, 1 Dec 2020 09:25:09 +0000 (10:25 +0100)]
lib-http: http-client-request - Fix payload assertions in http_client_request_send_more().
When the request payload is finished, both req->payload_input and
req->payload_output could be NULL, so the assertions on those being not NULL
need to happen after the check for req->payload_finished.
This particularly causes problems with the
blocking http_client_request_send/finish_payload() API, which constantly
modifies req->payload_input and sets it to NULL to finish the output.
Timo Sirainen [Thu, 29 Oct 2020 10:55:21 +0000 (12:55 +0200)]
imap: Fix potential hang if client disconnects with pipelined ambiguous commands
For example if client pipelines FETCH+LOGOUT commands and disconnects during
a large FETCH output, the LOGOUT command is processed as waiting for
unambiguity. This code path however doesn't detect a client disconnection,
and input IO handler is removed so it can't detect it either. So the imap
process hangs.
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.
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.
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).
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.
Timo Sirainen [Fri, 11 Sep 2020 07:57:51 +0000 (10:57 +0300)]
lib-imap: Don't generate invalid BODYSTRUCTURE when reaching MIME part limit
If the last MIME part was message/rfc822 and its child was truncated away,
BODYSTRUCTURE was missing the ENVELOPE and BODY[STRUCTURE] parts. Fixed by
writing empty dummy ones.
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.
Fixes:
warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Wstring-concatenation]
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]
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.
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.
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.