lib-master: Fix haproxy PROXY protocol LOCAL type connection behavior when header includes address information or TLVs
PROXY protocol LOCAL type headers can actually include supplementary
information (addresses, TLVs) which need to be skipped to correctly handle the
header. Fixes Invalid TLV bug with haproxy 2.0.14 service checks.
More info here: https://github.com/haproxy/haproxy/issues/511
And here: https://www.mail-archive.com/haproxy@formilux.org/msg36890.html
Timo Sirainen [Tue, 16 Feb 2021 14:40:35 +0000 (16:40 +0200)]
lib: cpu-limit - Don't round current CPU usage up when checking if rlim_max is reached
The fatal error could trigger half a second too early.
Also always increase the provided cpu_limit_sec by 1 second to make sure it
won't trigger too early. Although even with this change it can still
trigger a few milliseconds too early for some reason.
Timo Sirainen [Tue, 10 Nov 2020 14:33:41 +0000 (16:33 +0200)]
lib-storage: Fix assert-crash when parsing binary attachments
EOF may not have been detected in the cur_block istream early enough,
causing the calculation to go wrong. This happened at least with empty
base64 bodies, but could have possibly happened in other situations also.
Markus Valentin [Mon, 1 Feb 2021 14:38:49 +0000 (15:38 +0100)]
acl: acl_lookup_dict_rebuild_update() - Commit transaction after each [un]set
When used with Cassandra an error can occur if multiple changes are
included into one transaction: "Multiple changes in transaction not
supported". Prevent these errors by committing every change on it's
own.
Nis Martensen [Sun, 24 May 2020 20:05:42 +0000 (22:05 +0200)]
systemd integration: notify service manager when ready
With Type=simple or Type=forking, systemd does not really know when the
service is ready to accept connections and might start depending
services too early. Use Type=notify to explicitly tell the service
manager when the service is ready.
For a real problem caused by assuming readiness too early, please see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=951722
For the meaning of the service type and details of the readiness
protocol, see also the following links:
https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=
https://www.freedesktop.org/software/systemd/man/sd_notify.html
As discussed in the last link, more elaborate state notifications are
possible. This patch only implements the most basic part.
Original patch prepared by Michael Biebl, with slight modification.
dsync: Check namespace prefix when syncing shared namespaces
When iterating over namespaces, comparing namespace pointers doesn't
work for shared namespaces. Instead, check the prefix and include all
the mailboxes in the namespace for syncing.
If a view keeps being synced with MAIL_INDEX_VIEW_SYNC_FLAG_NOEXPUNGES,
every sync regenerated the missing log files and logged this error.
This could have resulted in lots of errors being logged about it, as
well as unnecessary CPU usage.
The view syncing was always syncing from the last "expunge log position",
even when expunges weren't being synced. The new behavior is to do that
only when expunges are synced, but otherwise use the "head log position"
to sync only the new changes since the last view sync.
The error is now logged once when the log is first noticed being lost.
Another error is logged when pending expunges are synced.
For now, we keep the read support to allow for a more gradual migration from
lzma/xz.
The code has bugs. Additionally, there is no benefit in keeping it around.
bzip2 or zstd (at maximum compression level) are likely better choices for
archival. For non-archival usecases, a light compression algorithm like
zstd (at low to medium compression level) or lz4 are better choices.
Timo Sirainen [Fri, 22 Jan 2021 11:19:05 +0000 (13:19 +0200)]
lib-master: test-event-stats - Fix unit test when compiling using build directory
When using build directory __FILE__ expands to
"../../../src/lib-master/test-event-stats.c", which doesn't match
"test-event-stats.c" what is normally used.
Paul Howarth [Mon, 4 Jan 2021 16:31:03 +0000 (16:31 +0000)]
lib: Fix timeval_cmp_margin for 32-bit systems
The test suite compares times with seconds values of -INT_MAX and
INT_MAX. The result of this comparison does not fit in a value of
type int and so the test suite fails on 32-bit systems where time_t
is an int. To fix this, calculations on seconds values are done
using long long integers.
Timo Sirainen [Tue, 26 Jan 2021 16:55:22 +0000 (18:55 +0200)]
dsync: Replace escape characters in outgoing mailbox names with alt_char
Especially when dsync is used for migration, we don't want to end up having
invalid mUTF7 mailbox names locally. Also, remote might not even be
configured to use the same escape character.
Timo Sirainen [Thu, 14 Jan 2021 15:45:07 +0000 (17:45 +0200)]
lib-storage: mailbox_list_default_get_storage_name() - Escape ns_prefix/INBOX if possible
If storage_name_escape_char is set, escape the "I" letter in the
storage_name if the namespace also has inbox=yes. This way it's possible to
distinguish between the actual INBOX and ns_prefix/INBOX.
Timo Sirainen [Thu, 14 Jan 2021 15:27:03 +0000 (17:27 +0200)]
lib-storage: Fix mailbox name escape/unescape ordering
This fixes some cases like not properly escaping '/' in storage_name if it
was also the namespace separator. This also allows using the same character
for both vname_escape_char and storage_name_escape_char.
Timo Sirainen [Thu, 14 Jan 2021 15:07:34 +0000 (17:07 +0200)]
lib-storage: mailbox_list_default_get_vname() - Fix escaping namespace separator in storage_name
For example if { storage_name="foo/bar", storage_sep=".", ns_sep="/" }
the "/" in the name shouldn't be treated as a namespace separator.
If vname_escape_char is set, it should be returned escaped instead.
Timo Sirainen [Thu, 14 Jan 2021 13:40:44 +0000 (15:40 +0200)]
lib-storage: mailbox_list_default_get_vname() - Use imap_utf7_to_utf8_escaped()
This changes the output a bit for broken mUTF7 names. Previously if any
part of the string had broken mUTF7 input, none of it was converted.
Now it's instead trying to convert as much as it can.
Timo Sirainen [Thu, 14 Jan 2021 10:34:48 +0000 (12:34 +0200)]
lib-storage: mailbox_list_default_get_storage_name() - Escape each hierarchical name separately
This makes it possible in the following commits to allow unescaping to
write namespace hierarchy separator character without converting it into
the mailbox_list separator.