Timo Sirainen [Mon, 28 Feb 2022 19:43:27 +0000 (14:43 -0500)]
anvil: Use memmove() for moving penalty checksum buffer
The memory wasn't actually overlapping, because CHECKSUM_VALUE_COUNT=2 so
only 1 element was memcpy()d. However, it would have been wrong if
CHECKSUM_VALUE_COUNT had been higher, so fix it to make the code
future-safe.
Timo Sirainen [Tue, 28 Jun 2022 09:53:26 +0000 (12:53 +0300)]
login-proxy: Increase LOGIN_PROXY_TTL from 5 to 7
5 is a bit too much on the low side in case there are several redirects.
It shouldn't be too high either, since it'll increase how long it takes
to detect a proxying loop.
Each such parameter was intended to replace the previous one, but
the code was only deleting the string without adding the new string.
This didn't really matter, since Dovecot would only ever send a
single FORWARD parameter.
This reverts commit 90ec0579eda9bec1a3e636c6716d4edebf795cff, which
incorrectly determined the macros to be unnecessary. The cached values
are used in various places. This commit reverts and comments on the
necessity of the macros.
Timo Sirainen [Wed, 2 Mar 2022 22:49:27 +0000 (17:49 -0500)]
virtual: When saving to virtual mailbox, convert it early on to backend mailbox
This fixes some confusion in plugins that don't understand that the mailbox
changes. For example when virtual mailbox is configured to save mails to a
backend mailbox, saving mails to the virtual mailbox will now trigger the
backend mailbox's imapsieve scripts. (Virtual mailbox names can't be used
in the imapsieve scripts or configuration, only the backend mailbox names.)
Timo Sirainen [Wed, 2 Mar 2022 22:37:50 +0000 (17:37 -0500)]
lib-storage: mailbox_list_get_storage() - Add flags, and allow changing vname
The previous API allowed changing the mailbox_list, but not the vname
string. Now it's possible to change both.
The flags allows the implementation more flexibility. It will be used by
following commits to determine whether opening a virtual mailbox should
actually be opening the backend mailbox (for saving mails).
Marco Bettini [Tue, 5 Jul 2022 09:50:32 +0000 (09:50 +0000)]
lib-imap: fuzz-imap-bodystructure - Replace string comparison with part comparison
bodystructure strings comparison can break due to imap_append_string_for_humans()
can alter some fields (Subject, Addresses). Instead, we do a part vs part comparison
checking several string fields that are known not to use the aforementioned call.
This gives the fuzzer 'space' to explore the string parser anyway and to test if
the re-encoding is coherent.
Marco Bettini [Tue, 5 Jul 2022 09:50:19 +0000 (09:50 +0000)]
lib-test: FUZZ_BEGIN_STR() - Replace NULs('\0') with backslashes '\\'
This is done so that the strings generated from fuzzer data always contain a
maximal length string. The presence of NULs creates aliases in the fuzz space
and makes less likely to generate very long NUL terminated strings.
The backslash is chosen instead of space as replacement because it is usually
a more troublesome character to handle.
Timo Sirainen [Mon, 9 May 2022 12:23:33 +0000 (15:23 +0300)]
auth: Fix handling passdbs with identical driver/args but different mechanisms/username_filter
The passdb was wrongly deduplicated in this situation, causing wrong
mechanisms or username_filter setting to be used. This would be a rather
unlikely configuration though.
Fixed by moving mechanisms and username_filter from struct passdb_module
to struct auth_passdb, which is where they should have been in the first
place.
Karl Fleischmann [Fri, 24 Jun 2022 07:45:15 +0000 (09:45 +0200)]
stat/event-exporter-fmt.c: Cast tv_usec value to unsigned int in rfc3339-time formatter
This commit prevents compilation warnings if tv_usec has a different
type than the assumed unsigned long (e.g. on macOS). This also makes the
rfc3339-time formatter consistent with the unix-time formatter for this
field.
Karl Fleischmann [Fri, 24 Jun 2022 06:07:09 +0000 (08:07 +0200)]
lib: Use size of size_t instead of data-model for bit-widths
This commit drops the generic and confusing data-model check (that
is a platform-specific value of bit-widths for various data types) in
favor of checking the actually used size (i.e. size_t).
Karl Fleischmann [Wed, 22 Jun 2022 08:02:35 +0000 (10:02 +0200)]
global: Replace madvise() with posix_madvise() function
To allow compilation on POSIX conformant systems this commit replaces
the non-standard madvise() call and it's advice-values with the posix
specific posix_madvise() and appropriate values.
Karl Fleischmann [Tue, 21 Jun 2022 12:50:11 +0000 (14:50 +0200)]
lib: Make pagesize-retrieval portable
The getpagesize() function has been deprecated in POSIX.1-2001. This
commit replaces the function call with the portable way to retrieve this
value at runtime. All callsites now use mmap_get_page_size() as the
canonical way to retrieve this value in this project.
Karl Fleischmann [Mon, 13 Jun 2022 13:10:53 +0000 (15:10 +0200)]
lib/compat.h: Remove workardound for dev_t comparisons
dev_t is defined by POSIX to be a number, and all supported systems
define major() and minor() at one place or the other, thus this commit
removes the workarounds.
Karl Fleischmann [Mon, 13 Jun 2022 12:32:52 +0000 (14:32 +0200)]
lib/compat.h: Remove HAVE_PREAD workaround
pread() should be included in the systems that we officially support (as
is required by defining _POSIX_C_SOURCE), there is no further need to
check for this function's existence or manual
re-implementations/workarounds.
Add macros to setup the compiler environment for a specific baseline,
this allows us to drop manual re-implementations of system-provided
functionality.
The base system is now required to supply a sensibly up-to-date compiler
suite/standard library that defines LLONG_MAX natively and thus this
manual re-definition can be dropped.
Karl Fleischmann [Thu, 16 Jun 2022 13:27:02 +0000 (15:27 +0200)]
m4: want_lua.m4 - Maintain code quality
This commit is mainly for making the lua-related macros consistent with
the rest of the configurations. No functional changes were made:
- Move lua argument registration into configure to be co-located with
other options,
- move lua conditionals into want_lua macro for increased consistency,
- rename parameter to "want_lua", and
- fix indentation.
Karl Fleischmann [Thu, 16 Jun 2022 13:24:38 +0000 (15:24 +0200)]
m4: want_lua.m4 - Fix pkg-config check
Make sure the configuration errors out when --with-lua is requested but
not viable library can be found. Previously this would lead to
compilation errors.