Timo Sirainen [Wed, 9 Sep 2020 10:00:44 +0000 (13:00 +0300)]
lib-compression: ostream-lzma - Compressed output could have been truncated
The compression wasn't fully finished, resulting in truncated compressed
output that couldn't be fully read back. Reading would result in "Broken
pipe" errors.
Timo Sirainen [Tue, 8 Sep 2020 18:19:21 +0000 (21:19 +0300)]
lib-compression: ostream-zstd - Fix assert-crash with large input
If the input was large enough, the ostream write could have returned
partially written output. Since this ostream-zstd was only used for
blocking ostreams, this would always result in an assert-crash. Fix is
to keep flushing the output to parent if the output buffer becomes full.
Fixes:
Panic: file ostream.c: line 287 (o_stream_sendv_int): assertion failed: (!stream->blocking)
Timo Sirainen [Wed, 9 Sep 2020 09:03:31 +0000 (12:03 +0300)]
lib: ostream-buffer: Return 0 as the used size, not the destination buffer size
This allows using ostream-buffer in places that previously would think that
the ostream buffer needed to be flushed because its buffer size was too
large.
This also changes o_stream_get_buffer_avail_size() to always return the
ostream max buffer size.
Stephan Bosch [Mon, 31 Aug 2020 13:29:03 +0000 (15:29 +0200)]
lib-smtp: smtp-server-recipient - Recipient event should be using the transaction event as parent.
The connection event is only used as event parent when the MAIL command failed
in pipeline or when the recipient is destroyed prematurely. The log prefix of
the transaction event is dropped, so that the connection event log prefix is
used in either case. Therefore, the main visible effect of this commit is that
the transaction event fields are available in the recipient event when there is
a transaction, the log messages will not change.
Stephan Bosch [Wed, 2 Sep 2020 09:15:33 +0000 (11:15 +0200)]
lib: event-log - Fix handling dropping parent prefixes beyond a drop at a higher level.
Before, the drop in the higher level became invisible to the lower
hiererarchies. For example:
parent1, parent2, parent3, parent4(drop one) yielded
"parent1: parent2: parent4: " as a prefix (which is still OK), whereas
parent1: parent2: parent3: parent4(drop one): leaf(drop 3) yielded
"parent1: leaf: ", while the expected prefix would be:
"leaf: ".
This means that the drop of one prefix by parent4 is ignored. Instead it should
apply that drop and operate on the prefixes that are still visible at the lowel
level, so the number of prefixes dropped should be additive, which is what this
commit changes.
Aki Tuomi [Mon, 7 Sep 2020 07:56:34 +0000 (10:56 +0300)]
lib-dict: dict_transaction_commit_async() - Never call callback immediately
This could cause confusion for the callers. Although so far all the callers
have handled it fine.
Use this wrappers for all dict drivers, even if they support async commits
themselves. This is because many of them were still calling the callback
immediately on error handling.
Timo Sirainen [Tue, 8 Sep 2020 14:32:32 +0000 (17:32 +0300)]
lib: istream-try - Fix detecting istream when its input buffer is full
The previous check didn't work when the stream's buffer_size was 0,
which happened with istream-concat parent.
Added also a unit test that tries to test for these kind of situations.
It doesn't actually reproduce this specific bug, but it tests that the
code paths works at least in the generic situation.
Timo Sirainen [Mon, 31 Aug 2020 15:30:18 +0000 (18:30 +0300)]
lib-index: Fix cache being purged too often when it had unaccessed fields
Cache was being purged when it had a field that was last accessed
after mail_cache_unaccessed_field_drop but before
2*mail_cache_unaccessed_field_drop. This purging may not have even
done anything.
Use shared code now between the check in mail_cache_header_fields_read()
and the actual purging in mail_cache_purge_check_field(). This way they
can't become desynced again.
Timo Sirainen [Fri, 28 Aug 2020 13:57:57 +0000 (16:57 +0300)]
auth: Fix leaking memory if auth client disconnects with pending penalty delays
* auth penalty lookup returns that auth_request needs a penalty delay
* during the penalty timeout auth client disconnects
* auth requests are freed, but auth_request_handler isn't unreferenced
This resulted in memory leak, and after recent changes also logging warnings
about event leaks.
Timo Sirainen [Wed, 5 Aug 2020 19:48:40 +0000 (22:48 +0300)]
auth: Worker commands: Rename "id" event field to "command_id"
Now that auth_request events are inherited from worker command events, the
"id" field was also inherited. This is rather confusing and might conflict
with other IDs in the future, so better to rename it already.
Timo Sirainen [Wed, 5 Aug 2020 19:45:30 +0000 (22:45 +0300)]
auth: Support inheritance for master auth_requests' events
Requests created by auth worker will inherit from the command's event, while
other events inherit from the global auth_event for now (since
auth-master-connection doesn't have its own event yet).
Timo Sirainen [Tue, 4 Aug 2020 14:30:02 +0000 (17:30 +0300)]
auth: Remove "credentials_scheme" event field
This field wasn't set for plaintext authentication, and in general it's not
quite what it was intended to be. Better to remove it entirely to avoid
confusion.
Timo Sirainen [Mon, 3 Aug 2020 15:51:33 +0000 (18:51 +0300)]
auth: Keep auth_request_fields const for most of the code
This way there's a compiler warning/error if anything outside
auth-request-fields.c attempts to modify them. It makes it easier to
keep the values synced with events.