]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
4 years agolib-ssl-iostream: Use OpenSSL's X509_check_host and X509_check_ip_asc if available
Siavash Tavakoli [Sun, 21 Mar 2021 22:15:48 +0000 (22:15 +0000)] 
lib-ssl-iostream: Use OpenSSL's X509_check_host and X509_check_ip_asc if available

Make use of "X509_check_host()" and "X509_check_ip_asc()" if OpenSSL version
used has support for these functions. Revert back to previous custom
implementation in case either is not available.

Hosts are checked with partial wildcards (e.g. foo*.example.com) disabled.
If host name check fails, check against IP addresses in the certificate.

4 years agom4: Add HAVE_X509_CHECK_HOST, HAVE_X509_CHECK_IP, and HAVE_X509_CHECK_IP_ASC
Siavash Tavakoli [Sun, 21 Mar 2021 22:14:55 +0000 (22:14 +0000)] 
m4: Add HAVE_X509_CHECK_HOST, HAVE_X509_CHECK_IP, and HAVE_X509_CHECK_IP_ASC

Defined when compiling against an OpenSSL version supporting "X509_check_host",
"X509_check_ip()", and "X509_check_ip_asc()" respectively.

4 years agolib-ssl-iostream: Ignore case when checking certificate name
Siavash Tavakoli [Thu, 18 Mar 2021 12:20:35 +0000 (12:20 +0000)] 
lib-ssl-iostream: Ignore case when checking certificate name

Host name case must be ignored when cheking with certificate.

4 years agolib: ioloop - Remove unused timer_is_larger() macro
Timo Sirainen [Mon, 22 Mar 2021 11:00:31 +0000 (13:00 +0200)] 
lib: ioloop - Remove unused timer_is_larger() macro

4 years agolib: test-ioloop - Make sure recreating 0-timeout in callback works
Timo Sirainen [Mon, 1 Mar 2021 10:56:21 +0000 (12:56 +0200)] 
lib: test-ioloop - Make sure recreating 0-timeout in callback works

4 years agolib: ioloop - Fix 0 ms timeouts to trigger without waiting 2ms between calls
Timo Sirainen [Mon, 1 Mar 2021 11:03:16 +0000 (13:03 +0200)] 
lib: ioloop - Fix 0 ms timeouts to trigger without waiting 2ms between calls

4 years agolib-test: test_assert_ucmp() - Fix typo to make it compile
Timo Sirainen [Mon, 1 Mar 2021 11:02:40 +0000 (13:02 +0200)] 
lib-test: test_assert_ucmp() - Fix typo to make it compile

4 years agolib-compression: Get error with i_stream_get_error() so it's recursive
Markus Valentin [Mon, 22 Mar 2021 12:04:15 +0000 (13:04 +0100)] 
lib-compression: Get error with i_stream_get_error() so it's recursive

In some cases the iostream.error was NULL so the errno default message
was used. This fixes an regression introduced by 8b6142f9ba9.

4 years agolib-dict: dict-lua - Do not free pool after iteration finishes
Aki Tuomi [Tue, 23 Mar 2021 07:02:06 +0000 (09:02 +0200)] 
lib-dict: dict-lua - Do not free pool after iteration finishes

Otherwise we get double-free from gc.

Broken in 1e67b93cc9f469bb144fc890a6cb9b9b9cd20811

4 years agoman: doveconf - Fix -P/ typo to just -P
Timo Sirainen [Tue, 23 Mar 2021 10:32:13 +0000 (12:32 +0200)] 
man: doveconf - Fix -P/ typo to just -P

4 years agoman: doveconf - Document -s parameter
Timo Sirainen [Tue, 23 Mar 2021 10:31:46 +0000 (12:31 +0200)] 
man: doveconf - Document -s parameter

4 years agodoveadm zlibconnect: Support multiple compression algorithms
Timo Sirainen [Wed, 27 Jan 2021 18:26:26 +0000 (20:26 +0200)] 
doveadm zlibconnect: Support multiple compression algorithms

Unfortunately they don't work very well, because only the deflate ostream
supports flushing ostream before closing it.

4 years agodoveadm zlibconnect: Support automatically starting compression on COMPRESS command
Timo Sirainen [Wed, 27 Jan 2021 17:50:38 +0000 (19:50 +0200)] 
doveadm zlibconnect: Support automatically starting compression on COMPRESS command

The previous method of using ctrl-d wasn't really suitable for scripting.

4 years agolib-compression: Fix potential hangs with non-blocking istreams
Timo Sirainen [Wed, 27 Jan 2021 18:29:11 +0000 (20:29 +0200)] 
lib-compression: Fix potential hangs with non-blocking istreams

4 years agolib: i_stream_read() - Fix assert with DEBUG enabled
Timo Sirainen [Wed, 27 Jan 2021 18:34:29 +0000 (20:34 +0200)] 
lib: i_stream_read() - Fix assert with DEBUG enabled

It doesn't matter if the data buffer changes for <=0 return value if the
buffer was previously empty.

4 years agolib-storage: mailbox_list_init_fs() - Add event_parent
Timo Sirainen [Thu, 4 Feb 2021 00:15:22 +0000 (02:15 +0200)] 
lib-storage: mailbox_list_init_fs() - Add event_parent

4 years agolib-storage: Rename mail_storage_service_input.parent_event to event_parent
Timo Sirainen [Thu, 4 Feb 2021 00:00:28 +0000 (02:00 +0200)] 
lib-storage: Rename mail_storage_service_input.parent_event to event_parent

This makes it more consistent with other settings.

4 years agolib-fs: Rename fs_settings.event to event_parent
Timo Sirainen [Wed, 3 Feb 2021 23:58:25 +0000 (01:58 +0200)] 
lib-fs: Rename fs_settings.event to event_parent

This makes it more consistent with other settings.

4 years agolib-dict: Set connections' event_parent correctly
Timo Sirainen [Wed, 3 Feb 2021 23:36:52 +0000 (01:36 +0200)] 
lib-dict: Set connections' event_parent correctly

dict->dict.event is NULL at this point.

4 years agoauth: db-sql - Fill sql_settings.event_parent
Timo Sirainen [Wed, 3 Feb 2021 23:27:34 +0000 (01:27 +0200)] 
auth: db-sql - Fill sql_settings.event_parent

4 years agoglobal: Set http_client_settings.event_parent when possible
Timo Sirainen [Wed, 3 Feb 2021 23:16:12 +0000 (01:16 +0200)] 
global: Set http_client_settings.event_parent when possible

4 years agofts-solr: solr-connection - Add parent event
Timo Sirainen [Wed, 3 Feb 2021 23:13:40 +0000 (01:13 +0200)] 
fts-solr: solr-connection - Add parent event

4 years agoglobal: Set dns_lookup_settings.event_parent
Timo Sirainen [Wed, 3 Feb 2021 23:10:57 +0000 (01:10 +0200)] 
global: Set dns_lookup_settings.event_parent

4 years agoimapc: Add parent event
Timo Sirainen [Wed, 3 Feb 2021 23:09:57 +0000 (01:09 +0200)] 
imapc: Add parent event

4 years agopop3c: Add parent event
Timo Sirainen [Wed, 3 Feb 2021 23:07:38 +0000 (01:07 +0200)] 
pop3c: Add parent event

4 years agoglobal: Set dict_settings.event_parent when possible
Timo Sirainen [Wed, 3 Feb 2021 23:01:42 +0000 (01:01 +0200)] 
global: Set dict_settings.event_parent when possible

4 years agolib-lua: dlua-threads - pop thread table after manipulation
Aki Tuomi [Mon, 22 Mar 2021 14:24:20 +0000 (16:24 +0200)] 
lib-lua: dlua-threads - pop thread table after manipulation

Forgot on a84bfdaf6df8fd6a4cbbf0845c18b09e6ceada36

4 years agoauth: Fix Makefile variables for Lua
Aki Tuomi [Mon, 22 Feb 2021 13:29:45 +0000 (15:29 +0200)] 
auth: Fix Makefile variables for Lua

Otherwise automake complains about touching
the variables in many places.

4 years agodovecot-config: Include used Lua details
Aki Tuomi [Fri, 5 Feb 2021 13:40:49 +0000 (15:40 +0200)] 
dovecot-config: Include used Lua details

4 years agopush-notification-driver-lua: Use dlua_pcall
Aki Tuomi [Fri, 5 Feb 2021 13:21:46 +0000 (15:21 +0200)] 
push-notification-driver-lua: Use dlua_pcall

4 years agomail-lua: Pop return values after use
Aki Tuomi [Fri, 5 Feb 2021 13:17:44 +0000 (15:17 +0200)] 
mail-lua: Pop return values after use

4 years agomail-lua: Use dlua_pcall
Aki Tuomi [Fri, 5 Feb 2021 13:17:37 +0000 (15:17 +0200)] 
mail-lua: Use dlua_pcall

4 years agoauth: db-lua - Use dlua_pcall
Aki Tuomi [Fri, 5 Feb 2021 13:13:26 +0000 (15:13 +0200)] 
auth: db-lua - Use dlua_pcall

4 years agolib-lua: Fix script loading
Aki Tuomi [Tue, 16 Feb 2021 07:21:58 +0000 (09:21 +0200)] 
lib-lua: Fix script loading

Handle error cases correctly.

4 years agolib-lua: Use dlua_pcall
Aki Tuomi [Fri, 5 Feb 2021 11:34:27 +0000 (13:34 +0200)] 
lib-lua: Use dlua_pcall

4 years agolib-lua: Add dlua_pcall
Aki Tuomi [Fri, 5 Feb 2021 11:33:47 +0000 (13:33 +0200)] 
lib-lua: Add dlua_pcall

4 years agolib-lua: dlua-dovecot - Ensure script is not NULL
Aki Tuomi [Fri, 5 Feb 2021 11:41:24 +0000 (13:41 +0200)] 
lib-lua: dlua-dovecot - Ensure script is not NULL

4 years agolib-lua: Define LUA_OK if missing
Aki Tuomi [Tue, 16 Feb 2021 10:47:17 +0000 (12:47 +0200)] 
lib-lua: Define LUA_OK if missing

It's defined since lua 5.2, and we support lua 5.1.

4 years agolib-lua: Reformat macros in dlua-script-private.h
Aki Tuomi [Fri, 19 Feb 2021 13:20:07 +0000 (15:20 +0200)] 
lib-lua: Reformat macros in dlua-script-private.h

4 years agolib-lua: Add callback typecheck for dlua_pcall_yieldable
Aki Tuomi [Mon, 22 Mar 2021 08:36:24 +0000 (10:36 +0200)] 
lib-lua: Add callback typecheck for dlua_pcall_yieldable

4 years agolib-dict: Expose dict and dict transactions to lua scripts
Josef 'Jeff' Sipek [Thu, 25 Feb 2021 15:22:28 +0000 (10:22 -0500)] 
lib-dict: Expose dict and dict transactions to lua scripts

4 years agolib-lua: Implement lua_seti() fallback for pre-5.3 support
Josef 'Jeff' Sipek [Thu, 25 Feb 2021 20:35:26 +0000 (15:35 -0500)] 
lib-lua: Implement lua_seti() fallback for pre-5.3 support

4 years agolib-lua: Add DLUA_WRAP_C_DATA macro to more easily expose C structures to lua
Josef 'Jeff' Sipek [Thu, 25 Feb 2021 15:22:24 +0000 (10:22 -0500)] 
lib-lua: Add DLUA_WRAP_C_DATA macro to more easily expose C structures to lua

4 years agolib-lua: Add dlua_pcall_yieldable
Josef 'Jeff' Sipek [Wed, 24 Feb 2021 18:57:10 +0000 (13:57 -0500)] 
lib-lua: Add dlua_pcall_yieldable

4 years agom4: want_lua - Check for lua_{resume,yieldk}
Josef 'Jeff' Sipek [Thu, 25 Feb 2021 20:49:18 +0000 (15:49 -0500)] 
m4: want_lua - Check for lua_{resume,yieldk}

4 years agolib-lua: Add thread local storage API
Josef 'Jeff' Sipek [Wed, 24 Feb 2021 19:53:59 +0000 (14:53 -0500)] 
lib-lua: Add thread local storage API

4 years agolib-lua: Add new thread/close thread dlua wrappers
Aki Tuomi [Fri, 5 Feb 2021 14:47:53 +0000 (16:47 +0200)] 
lib-lua: Add new thread/close thread dlua wrappers

Code rewritten to use lua registry, warn about unclosed threads, and moved
to a separate file by Josef 'Jeff' Sipek <jeff.sipek@open-xchange.com>

4 years agoglobal: Avoid casting away const
Timo Sirainen [Fri, 12 Mar 2021 00:58:37 +0000 (02:58 +0200)] 
global: Avoid casting away const

4 years agolib: iostreams - Use container_of()
Timo Sirainen [Fri, 12 Mar 2021 12:53:38 +0000 (14:53 +0200)] 
lib: iostreams - Use container_of()

4 years agolib: stats_dist_get_median(), stats_dist_get_percentile() - Remove const parameter
Timo Sirainen [Fri, 12 Mar 2021 00:56:20 +0000 (02:56 +0200)] 
lib: stats_dist_get_median(), stats_dist_get_percentile() - Remove const parameter

They weren't really const, because they required modifying the stats to sort
them.

4 years agologin-common: sasl-server - Remove data transfered to post-login service from input...
Stephan Bosch [Fri, 26 Feb 2021 23:04:54 +0000 (00:04 +0100)] 
login-common: sasl-server - Remove data transfered to post-login service from input stream.

This prevents duplicating input when SSL is involved, causing commands pipelined
after authenticate commands from being duplicated. This issue emerged when login
proxy was changed to use the iostream pump/proxy. This means that the proxy uses
streams rather than raw FDs, which means that data buffered in input stream
before proxy is inherently forwarded to the post-login service... a second time.

4 years agolib: test-cpu-limit - Test upper CPU limit only for user CPU, not for system CPU
Timo Sirainen [Thu, 18 Mar 2021 10:17:07 +0000 (11:17 +0100)] 
lib: test-cpu-limit - Test upper CPU limit only for user CPU, not for system CPU

The system CPU check kept randomly failing with larger and larger limits, so
there doesn't seem to be any point trying to test it at all.

4 years agolib-index: Fix crash when cache record size is larger than file size
Timo Sirainen [Fri, 12 Mar 2021 00:26:32 +0000 (02:26 +0200)] 
lib-index: Fix crash when cache record size is larger than file size

This shouldn't happen unless the dovecot.index.cache file was corrupted.

4 years agolib-index: mail_cache_map() - Fix handling huge size values correctly
Timo Sirainen [Sat, 8 Aug 2020 09:11:54 +0000 (12:11 +0300)] 
lib-index: mail_cache_map() - Fix handling huge size values correctly

offset+size could have wrapped in 32bit systems.

4 years agoauth: test-auth-cache - Fix auth_request_var_expand_static_tab[]
Timo Sirainen [Mon, 15 Mar 2021 10:53:19 +0000 (12:53 +0200)] 
auth: test-auth-cache - Fix auth_request_var_expand_static_tab[]

Its size is explicitly set in .h file, so it should be in .c file as well.

4 years agoauth: userdb-passwd: Close the password database in iteration deinit
Siavash Tavakoli [Mon, 15 Mar 2021 12:02:32 +0000 (12:02 +0000)] 
auth: userdb-passwd: Close the password database in iteration deinit

Otherwise, next "getpwent()" will continue to return next entries in
passwd database which results in unwanted skipping of entries.

4 years agodoveconf: Don't print an error if $rundir/dovecot.conf symlink doesn't exist
Timo Sirainen [Tue, 9 Mar 2021 19:35:15 +0000 (21:35 +0200)] 
doveconf: Don't print an error if $rundir/dovecot.conf symlink doesn't exist

4 years agolib-storage: Set mail_index_* and mail_cache_* settings hidden
Timo Sirainen [Wed, 15 Apr 2020 14:57:43 +0000 (17:57 +0300)] 
lib-storage: Set mail_index_* and mail_cache_* settings hidden

It's not recommended to change these settings outside testing.

4 years agodoveconf: Add -s parameter to show also hidden settings
Timo Sirainen [Tue, 9 Mar 2021 17:10:01 +0000 (19:10 +0200)] 
doveconf: Add -s parameter to show also hidden settings

4 years agodoveconf: Don't show hidden settings unless they've been explicitly set
Timo Sirainen [Wed, 15 Apr 2020 14:50:42 +0000 (17:50 +0300)] 
doveconf: Don't show hidden settings unless they've been explicitly set

4 years agolib-settings: Add SET_FLAG_HIDDEN setting flag
Timo Sirainen [Wed, 15 Apr 2020 14:44:56 +0000 (17:44 +0300)] 
lib-settings: Add SET_FLAG_HIDDEN setting flag

4 years agoglobal: Initialize struct setting_define fields with explicit names
Timo Sirainen [Wed, 15 Apr 2020 14:35:14 +0000 (17:35 +0300)] 
global: Initialize struct setting_define fields with explicit names

This allows changing the struct contents without breaking compiling.

4 years agoglobal: Use SETTING_DEFINE_STRUCT_*() macros when defining settings
Timo Sirainen [Wed, 15 Apr 2020 14:21:03 +0000 (17:21 +0300)] 
global: Use SETTING_DEFINE_STRUCT_*() macros when defining settings

This adds type checking to them.

4 years agoquota-status: Fix quota_status_settings.recipient_delimiter to be const
Timo Sirainen [Wed, 15 Apr 2020 14:20:20 +0000 (17:20 +0300)] 
quota-status: Fix quota_status_settings.recipient_delimiter to be const

4 years agomail-crypt, master: Remove unused DEF & DEFLIST macros
Timo Sirainen [Wed, 15 Apr 2020 14:18:42 +0000 (17:18 +0300)] 
mail-crypt, master: Remove unused DEF & DEFLIST macros

4 years agolib-settings: Rewrite and add missing SETTING_DEFINE_STRUCT_* macros
Timo Sirainen [Wed, 15 Apr 2020 13:53:26 +0000 (16:53 +0300)] 
lib-settings: Rewrite and add missing SETTING_DEFINE_STRUCT_* macros

These hadn't been used anywhere.

4 years agolib-smtp: fuzz-smtp-server - Fix compiling due to lib-smtp API change
Timo Sirainen [Sat, 13 Mar 2021 12:23:46 +0000 (14:23 +0200)] 
lib-smtp: fuzz-smtp-server - Fix compiling due to lib-smtp API change

Forgotten from 2cdab962670df394c28fb7858cb0d4f90f70f71c

4 years agosubmission: Remove dead assignment
Timo Sirainen [Tue, 16 Mar 2021 15:09:11 +0000 (17:09 +0200)] 
submission: Remove dead assignment

4 years agologin-common: Fix client_destroy_oldest() return value to be more exact
Timo Sirainen [Wed, 15 Jan 2020 18:22:00 +0000 (20:22 +0200)] 
login-common: Fix client_destroy_oldest() return value to be more exact

Only return TRUE if a client connection is immediately destroyed.

4 years agolib-master: Add a delay to calling avail_overflow_callback with client_limit=1
Timo Sirainen [Wed, 15 Jan 2020 16:09:14 +0000 (18:09 +0200)] 
lib-master: Add a delay to calling avail_overflow_callback with client_limit=1

Without the delay all (or many/most) processes will call the callback,
because the OS notifies all of the processes of the incoming connection.
This results in all of the connections being killed instead of only a few
of them.

4 years agolib-master: Change master_service_set_avail_overflow_callback() API
Timo Sirainen [Wed, 15 Jan 2020 17:10:43 +0000 (19:10 +0200)] 
lib-master: Change master_service_set_avail_overflow_callback() API

Needed by the following changes.

4 years agologin-common: Change struct client.created to timeval
Timo Sirainen [Wed, 15 Jan 2020 17:06:32 +0000 (19:06 +0200)] 
login-common: Change struct client.created to timeval

4 years agolib-master: Code cleanup to refreshing login state
Timo Sirainen [Wed, 15 Jan 2020 15:49:52 +0000 (17:49 +0200)] 
lib-master: Code cleanup to refreshing login state

Unexpected seek offsets are now handled better.

4 years agolib-master: Fix calling avail_overflow_callback with service_count=1
Timo Sirainen [Wed, 15 Jan 2020 14:30:34 +0000 (16:30 +0200)] 
lib-master: Fix calling avail_overflow_callback with service_count=1

This is used by login processes to kill the oldest connection when all of
the clients and processes for the service are taken. This wasn't working
when service_count=1 because the listeners were closed already.

It's not really useful anymore to even do this kind of a listener closing.
It was originally added in 9217d2426b4f8ece47441357f35d8bb34d97c4eb to
prevent restart problems with long-running login processes. However,
nowadays listeners can be closed via SIGQUIT so this isn't necessary.

4 years agolib-storage: Correct escaping for list index lookups
Siavash Tavakoli [Fri, 26 Feb 2021 12:28:03 +0000 (12:28 +0000)] 
lib-storage: Correct escaping for list index lookups

- Escape storage name when listing mailbox from index and unescape mailbox name
when looking for sibling nodes.
- Unescape when adding node to list index.
- List index iteration is performed with storage name where separators must be
escaped with storage_name_escape_char. Index lookup is done with storage_name
which is escaped with storage_name_escape_char but node names are unescaped.

4 years agolib-storage: Expose mailbox_list_name_{escape,unescape} functions in header
Siavash Tavakoli [Mon, 22 Feb 2021 15:37:19 +0000 (15:37 +0000)] 
lib-storage: Expose mailbox_list_name_{escape,unescape} functions in header

To be used in mailbox-list-index.

4 years agolib-storage: test-mail-storage: Separate test cases for "LAYOUT=INDEX"
Siavash Tavakoli [Thu, 11 Mar 2021 17:55:08 +0000 (17:55 +0000)] 
lib-storage: test-mail-storage: Separate test cases for "LAYOUT=INDEX"

With default escaping for "INDEX" layout, more mailbox name are accepted.

4 years agolib-storage: mailbox-list: Add default storage name escaping for index layout
Siavash Tavakoli [Mon, 22 Feb 2021 15:29:30 +0000 (15:29 +0000)] 
lib-storage: mailbox-list: Add default storage name escaping for index layout

Add a default value for "storage_name_escape_char" when "LAYOUT=index".
Needed for situations where mailbox name contains separator char (e.g.
after migration to new separator) and listescape plugin is not active.

4 years agolib-storage: Rename mailbox_list_index_node.name to raw_name
Siavash Tavakoli [Fri, 26 Feb 2021 16:03:50 +0000 (16:03 +0000)] 
lib-storage: Rename mailbox_list_index_node.name to raw_name

To make it clear that the string is unescaped raw value, rename from
generic "name" to "raw_name".

4 years agolib-storage: Add mailbox list index alt separator
Siavash Tavakoli [Thu, 11 Mar 2021 12:31:52 +0000 (12:31 +0000)] 
lib-storage: Add mailbox list index alt separator

To avoid collision with storage name escape character, use an
alternative char ('^') if hierarchy separator for list index is the same char.

4 years agologin-common: Finish freeing the client when anvil lookup is pending at destroy
Timo Sirainen [Tue, 16 Mar 2021 12:37:54 +0000 (14:37 +0200)] 
login-common: Finish freeing the client when anvil lookup is pending at destroy

Broken by f32daf5ac9eaa886e28659965fc0156b52b60bda

4 years agologin-common: Assert-crash at deinit if there are still referenced clients
Timo Sirainen [Tue, 16 Mar 2021 12:37:38 +0000 (14:37 +0200)] 
login-common: Assert-crash at deinit if there are still referenced clients

4 years agologin-common: Track referenced but destroyed clients in a linked list
Timo Sirainen [Tue, 16 Mar 2021 12:36:35 +0000 (14:36 +0200)] 
login-common: Track referenced but destroyed clients in a linked list

This helps debugging.

4 years agolib: test-cpu-limit - Increase ALLOW_MSECS_ABOVE further
Timo Sirainen [Thu, 11 Mar 2021 11:00:56 +0000 (13:00 +0200)] 
lib: test-cpu-limit - Increase ALLOW_MSECS_ABOVE further

1500 was still not enough to prevent random failures.

4 years agolib: cpu-limit - Redesign the API
Timo Sirainen [Mon, 15 Mar 2021 16:18:07 +0000 (18:18 +0200)] 
lib: cpu-limit - Redesign the API

The new API no longer has a signal callback, just a cpu_limit_exceeded()
function that needs to be periodically called to check if the limit has
exceeded. The callback could be added back if really necessary, but it's
just too easy to use signal handlers unsafely.

The new API also supports separating limits for user and system CPU usage.
It also attempts to guard against any unexpected kernel behavior resulting
from unclear behavior on how exactly the getrlimit(), setrlimit() and XCPU
signals interact.

4 years agolib: cpu-limit - Split off cpu_limit_get_usage_msecs_with()
Timo Sirainen [Mon, 15 Mar 2021 15:22:00 +0000 (17:22 +0200)] 
lib: cpu-limit - Split off cpu_limit_get_usage_msecs_with()

4 years agolib: cpu-limit - Move cpu_limit_get_usage_msecs()
Timo Sirainen [Mon, 15 Mar 2021 15:21:03 +0000 (17:21 +0200)] 
lib: cpu-limit - Move cpu_limit_get_usage_msecs()

4 years agolib: cpu-limit - Update comments related to nesting
Timo Sirainen [Mon, 15 Mar 2021 14:50:25 +0000 (16:50 +0200)] 
lib: cpu-limit - Update comments related to nesting

4 years agolib: cpu_limit_get_usage_[m]secs() - Add type parameter
Timo Sirainen [Mon, 15 Mar 2021 13:42:56 +0000 (15:42 +0200)] 
lib: cpu_limit_get_usage_[m]secs() - Add type parameter

It can now return user CPU, system CPU or both usages.

4 years agolib: cpu-time - Use the original struct rusage as the initial_usage
Timo Sirainen [Mon, 15 Mar 2021 13:37:55 +0000 (15:37 +0200)] 
lib: cpu-time - Use the original struct rusage as the initial_usage

This will allow separation of user and system CPU usage tracking.
They could have been tracked with two separate struct timevals, but
the extra memory usage is small and it might be nice to have all the
available data for debugging.

4 years agolib: test-cpu-limit - Fix nested limit asserts
Timo Sirainen [Mon, 15 Mar 2021 16:00:55 +0000 (18:00 +0200)] 
lib: test-cpu-limit - Fix nested limit asserts

4 years agolib-imap: Handle empty lists in IMAP BODYSTRUCTURE parsing as invalid
Timo Sirainen [Wed, 10 Mar 2021 15:56:12 +0000 (17:56 +0200)] 
lib-imap: Handle empty lists in IMAP BODYSTRUCTURE parsing as invalid

They should be NIL instead of () if they're empty.

4 years agolib-imap: Fix assert-crash if parsing invalid BODYSTRUCTURE with empty Content-Langua...
Timo Sirainen [Wed, 10 Mar 2021 15:40:47 +0000 (17:40 +0200)] 
lib-imap: Fix assert-crash if parsing invalid BODYSTRUCTURE with empty Content-Language list

If there's no Content-Language, it should be NIL in the bodystructure.
So if the value is (), it is invalid.

This could in theory have happened when parsing corrupted
dovecot.index.cache or receiving it from a broken remote IMAP server with
imapc. The bug was found by fuzzing though.

Fixes:
Panic: file imap-bodystructure.c: line 98 (part_write_bodystructure_common): assertion failed: (*lang != NULL)

4 years agolib-imap: test-imap-bodystructure - imap_bodystructure_parse() - Test returned error
Timo Sirainen [Wed, 10 Mar 2021 15:39:48 +0000 (17:39 +0200)] 
lib-imap: test-imap-bodystructure - imap_bodystructure_parse() - Test returned error

4 years agolib-lua: Error out the build if using Lua 5.2
Josef 'Jeff' Sipek [Thu, 11 Mar 2021 18:13:24 +0000 (13:13 -0500)] 
lib-lua: Error out the build if using Lua 5.2

4 years agoGlobal: Remove support for Lua 5.2
Josef 'Jeff' Sipek [Thu, 11 Mar 2021 18:13:03 +0000 (13:13 -0500)] 
Global: Remove support for Lua 5.2

It took far too much effort to keep compatible with it.  Since every distro
out there provides either Lua 5.1 or 5.3, it makes sense to give up on 5.2.

4 years agom4: Allow explict override of lua version
Josef 'Jeff' Sipek [Tue, 9 Mar 2021 15:53:50 +0000 (10:53 -0500)] 
m4: Allow explict override of lua version

It is possible that the system has several different versions of Lua
installed.  This change allows one to force a specific version of Lua during
./configure.  For example:

LUA_CFLAGS="`pkg-config lua51 --cflags`" \
LUA_LIBS="`pkg-config lua51 --libs`" \
./configure \
--with-lua

4 years agolib-storage: Preserve last-rename-stamp when rebuilding index
Timo Sirainen [Tue, 9 Mar 2021 16:40:32 +0000 (18:40 +0200)] 
lib-storage: Preserve last-rename-stamp when rebuilding index

4 years agolib-storage: Don't trust last-rename-stamp that is too far into the future
Timo Sirainen [Tue, 9 Mar 2021 16:42:38 +0000 (18:42 +0200)] 
lib-storage: Don't trust last-rename-stamp that is too far into the future

If the timestamp is in the future, autoexpunging stops working until the
future time is passed. If this happened due to corruption, it could take
a long time before the timestamp is reached.

4 years agolib-storage: Preserve hdr-pop3-uidl when rebuilding index
Timo Sirainen [Tue, 9 Mar 2021 16:37:51 +0000 (18:37 +0200)] 
lib-storage: Preserve hdr-pop3-uidl when rebuilding index

This prevents potentially expensive metadata lookups afterwards when trying
to find out which mails have the POP3 UIDLs in their metadata.