]>
git.ipfire.org Git - thirdparty/dovecot/core.git/log
Timo Sirainen [Tue, 8 Oct 2019 13:14:15 +0000 (16:14 +0300)]
*-login: Fix potential hangs with SSL connections
1) Multi-step SASL authentication could hang when login process waits for
response from a client, but it has already pipelined it together with the
AUTH/AUTHENTICATE command.
2) After failed authentication commands could start hanging.
Timo Sirainen [Thu, 13 Jun 2019 13:39:42 +0000 (16:39 +0300)]
lib: backtrace_append() - If libunwind returns failure, fallback to libc's method
Timo Sirainen [Mon, 30 Sep 2019 20:00:37 +0000 (23:00 +0300)]
lib: backtrace_get/append() - skip stack frames only based name
It's not really safe to do anything else because functions may potentially
be inlined.
Timo Sirainen [Mon, 30 Sep 2019 19:52:50 +0000 (22:52 +0300)]
lib: test-backtrace - Remove unnecessary includes
Timo Sirainen [Thu, 13 Jun 2019 13:37:34 +0000 (16:37 +0300)]
lib: backtrace_append() - If libunwind fails to get any symbols, return error
Stephan Bosch [Thu, 5 Oct 2017 10:28:43 +0000 (12:28 +0200)]
lib-storage: mail-storage - Add mailbox_has_special_use().
Implements checking whether a mailbox has a particular special-use flag.
Stephan Bosch [Thu, 5 Oct 2017 10:27:08 +0000 (12:27 +0200)]
lib-storage: mail-storage - Add API for allocating a mailbox based on a special-use flag.
Stephan Bosch [Wed, 2 Oct 2019 22:43:07 +0000 (00:43 +0200)]
lib-storage: mail-storage - Merge mailbox_alloc_delivery() into mailbox_alloc_for_user().
Uses the MAILBOX_FLAG_POST_SESSION flag.
Stephan Bosch [Wed, 2 Oct 2019 21:54:44 +0000 (23:54 +0200)]
lib-storage: mail-storage - Add mailbox_alloc_for_user().
Timo Sirainen [Sat, 5 Oct 2019 12:46:47 +0000 (15:46 +0300)]
lib-index: Fix checking if log file can be rotated
This fixes a bug caused by
883a3022992d0f832f0aff21572caeb7c63b7668 where
dovecot.index.log file wasn't rotated as often as it was supposed to be. It
also could have caused dovecot.index to be rewritten much more often than
it was supposed to be.
The buggy commit was correct that the tail_offset wasn't updated previously
to the dovecot.index.log file after changes. However, I didn't realize that
the tail_offset was internally still updated and required by this rotation
check to work correctly.
The fix works by relaxing the tail_offset==head_offset requirement for
rotation. It's enough that all the changes are synced, which can be checked
from mail_index_sync_ctx.fully_synced. Any changes after tail_offset are
then supposed to be external transactions, which aren't synced anyway, so
rotation is allowed.
Stephan Bosch [Fri, 13 Sep 2019 20:51:04 +0000 (22:51 +0200)]
lmtp: lmtp-proxy - Support forwarding a broken sender address to the backend LMTP service.
This is subject to configuration.
Stephan Bosch [Fri, 13 Sep 2019 20:33:05 +0000 (22:33 +0200)]
lib-smtp: smtp-client - Add support for proxying MAIL command with broken path.
Stephan Bosch [Fri, 13 Sep 2019 20:49:37 +0000 (22:49 +0200)]
lmtp: Accept MAIL command with broken sender address.
The address is treated as <> in most cases. For logging, the unparsed broken
address is available in the `raw' field of the address.
Stephan Bosch [Sat, 14 Sep 2019 15:59:29 +0000 (17:59 +0200)]
lda: Accept -f argument with broken sender address.
Stephan Bosch [Sat, 14 Sep 2019 15:59:08 +0000 (17:59 +0200)]
lib-smtp: smtp-server - Support accepting broken path parameter in MAIL command.
Stephan Bosch [Fri, 4 Oct 2019 18:47:35 +0000 (20:47 +0200)]
lib-smtp: smtp-command-parser - Accept valid UTF-8 characters for command parameters.
Stephan Bosch [Fri, 13 Sep 2019 20:31:37 +0000 (22:31 +0200)]
lib-smtp: smtp-address - Add smtp_address_is_broken().
Stephan Bosch [Fri, 13 Sep 2019 00:04:59 +0000 (02:04 +0200)]
lib-smtp: smtp-address - Add SMTP_ADDRESS_PARSE_FLAG_IGNORE_BROKEN parse flag.
Makes the path parser try to skip over a broken address to allow working around
syntax errors in e.g. the sender address for the MAIL command.
Stephan Bosch [Fri, 13 Sep 2019 00:04:59 +0000 (02:04 +0200)]
lib-smtp: smtp-address - Add SMTP_ADDRESS_PARSE_FLAG_PRESERVE_RAW parse flag.
It stores the unparsed representation of the address in the new raw field of
struct smtp_address. This is only relevant to smtp_address_parse_path().
Stephan Bosch [Sat, 14 Sep 2019 17:57:31 +0000 (19:57 +0200)]
lib-smtp: test-smtp-address - Restructure valid address tests.
Stephan Bosch [Fri, 13 Sep 2019 00:01:52 +0000 (02:01 +0200)]
lib-smtp: smtp-address - Add smtp_address_encode_raw*().
These are special variants of smtp_address_encode*(), which use the new raw
field when it is set.
Stephan Bosch [Thu, 12 Sep 2019 23:59:57 +0000 (01:59 +0200)]
lib-smtp: smtp-address - Also copy the new raw field when cloning struct smtp_address.
Stephan Bosch [Thu, 12 Sep 2019 23:57:18 +0000 (01:57 +0200)]
lib-smtp: smtp-address - Add raw field to struct smtp_address.
Stephan Bosch [Sun, 4 Nov 2018 18:00:47 +0000 (19:00 +0100)]
lib-smtp: smtp-address - Implement workarounds for parsing addresses with a bad localpart.
Always parse it as normal when it starts with `<' or `"'. The workaround
consists of parsing the address by splitting it on the last `@'. The address is
accepted when the resulting localpart and domain can be used to compose a valid
address. This workaround is now shared with username-to-address parsing, which
existed before.
Stephan Bosch [Sun, 4 Nov 2018 18:09:41 +0000 (19:09 +0100)]
lib-smtp: smtp-address - Allow parsing address from username that contains space, double quote or backslash.
Not allowing double quote and backslash was a bug, while space was explicitly
disallowed. However, these characters can be used in an RFC 5321 address when
inside a quoted string, so there is no reason to disallow those.
Stephan Bosch [Tue, 10 Sep 2019 21:20:26 +0000 (23:20 +0200)]
lib-smtp: smtp-address - Add smtp_address_parse_any().
This allows parsing any RFC5321 address as a string, even severely broken ones.
Stephan Bosch [Fri, 13 Sep 2019 00:03:26 +0000 (02:03 +0200)]
lib-smtp: smtp-address - Remove useless check in smtp_address_write().
Stephan Bosch [Tue, 10 Sep 2019 00:17:17 +0000 (02:17 +0200)]
lib-smtp: smtp-server-transaction - Create transaction using struct smtp_server_cmd_mail directly.
Before, it used separate parameters for the individual fields, but that makes it
hard to extend.
Stephan Bosch [Wed, 2 Oct 2019 10:58:01 +0000 (12:58 +0200)]
lib-smtp: smtp-address - Change return values of parse functions to be either 0 or -1.
Before it used 1 and -1, which does not match other parts of Dovecot.
Stephan Bosch [Sat, 14 Sep 2019 16:27:08 +0000 (18:27 +0200)]
lib-smtp: smtp-address - Document the parse functions.
Stephan Bosch [Sat, 14 Sep 2019 18:42:24 +0000 (20:42 +0200)]
lib-smtp: Reformat test-smtp-address.c.
Stephan Bosch [Sat, 14 Sep 2019 11:53:59 +0000 (13:53 +0200)]
lib-smtp: Reformat smtp-client-command.h.
Stephan Bosch [Sat, 14 Sep 2019 11:38:01 +0000 (13:38 +0200)]
lib-smtp: Reformat smtp-client-command.c.
Stephan Bosch [Thu, 12 Sep 2019 23:41:04 +0000 (01:41 +0200)]
lib-smtp: Reformat smtp-address.h.
Stephan Bosch [Thu, 12 Sep 2019 23:35:56 +0000 (01:35 +0200)]
lib-smtp: Reformat smtp-address.c.
Timo Sirainen [Tue, 1 Oct 2019 09:15:51 +0000 (12:15 +0300)]
lib-storage: Simplify mail_save_context.keywords reference counting
This change also makes it possible for plugins to change the keywords
without leaking memory.
Aki Tuomi [Thu, 26 Sep 2019 09:34:18 +0000 (12:34 +0300)]
login-common: Retrieve error from ssl context if handshake fails
Fixes
imap-login: Error: proxy: Failed to start SSL handshake to 127.0.0.2:43143: (null)
and
imap-login: Error: Failed to initialize SSL server context: Can't load SSL certificate: error:
140AB18F :SSL routines:SSL_CTX_use_certificate:ee key too small
Fatal: master: service(imap-login): child 14764 killed with signal 11 (core dumped)
Broken in
9f1038760ca5ba154366176a7056aad1c7b6c77e
Timo Sirainen [Fri, 20 Sep 2019 09:04:37 +0000 (12:04 +0300)]
lib-sql: Add asserts to make sure refcount unexpectedly doesn't drop below 1
Timo Sirainen [Fri, 20 Sep 2019 09:03:21 +0000 (12:03 +0300)]
lib-sql: Initialize sqlpool db properly
Fixes a crash at sql_unref() caused by recent changes.
Timo Sirainen [Mon, 16 Sep 2019 07:51:03 +0000 (10:51 +0300)]
lib-storage: Include mailbox name and UID when logging about flag vs GUID mismatches
Timo Sirainen [Sun, 15 Sep 2019 17:58:14 +0000 (20:58 +0300)]
lib-storage: mailbox list index - detect if non-selectable mailbox has GUID
If it has, mark it as selectable.
Timo Sirainen [Tue, 17 Sep 2019 16:52:25 +0000 (19:52 +0300)]
lib-index: Add index alloc cache timeout to root ioloop
The cache is a global one and the timeout shouldn't trigger until the global
root ioloop is reached.
This fixes a timeout leak / crash when index was opened in an inner ioloop.
Timo Sirainen [Tue, 17 Sep 2019 16:52:14 +0000 (19:52 +0300)]
lib: Add io_loop_get_root()
Timo Sirainen [Sun, 15 Sep 2019 18:52:39 +0000 (21:52 +0300)]
lib-dict-backend: Remove cache for prepared statements
Timo Sirainen [Sun, 15 Sep 2019 18:49:13 +0000 (21:49 +0300)]
lib-sql: Rename sql_prepared_statement_deinit() to _unref()
Timo Sirainen [Sun, 15 Sep 2019 18:45:18 +0000 (21:45 +0300)]
lib-sql: Keep prepared statements in memory until db is deinitialized
There aren't supposed to be many different prepared statements.
Timo Sirainen [Sun, 15 Sep 2019 18:39:07 +0000 (21:39 +0300)]
lib-sql: Try to reuse prepared statements if possible
Timo Sirainen [Sun, 15 Sep 2019 20:45:30 +0000 (23:45 +0300)]
lib-sql: Fix the new sql_db refcounting to work with sql-db-cache
Timo Sirainen [Sun, 15 Sep 2019 20:15:33 +0000 (23:15 +0300)]
lib-sql: Add refcounting to sql_db
Timo Sirainen [Sun, 15 Sep 2019 18:35:01 +0000 (21:35 +0300)]
lib-sql: Move query_template to struct sql_prepared_statement directly
Markus Valentin [Wed, 10 Jul 2019 13:45:51 +0000 (15:45 +0200)]
lib-storage: fix typo in mailbox-list-iter.h
Timo Sirainen [Wed, 4 Sep 2019 09:11:43 +0000 (12:11 +0300)]
imap-hibernate: Fix crash if unhibernation fd_send() fails
The imap-master connection needs to be freed when the client is freed.
Otherwise it attempts to free the client again.
Timo Sirainen [Wed, 11 Sep 2019 08:11:57 +0000 (11:11 +0300)]
lib: i_stream_get_data() - Mark invalid buffer code path unlikely
This really isn't expected to happen, so marking it unlikely optimizes
slightly callers that cause i_stream_get_data() to be called a huge number
of times.
Timo Sirainen [Tue, 10 Sep 2019 07:14:24 +0000 (10:14 +0300)]
doveadm fs: Use mail_temp_dir as temp_dir for fs operations' temp_dir
Timo Sirainen [Tue, 10 Sep 2019 07:50:14 +0000 (10:50 +0300)]
doveadm: Expand variables in doveadm_settings
Required by the next commit.
Timo Sirainen [Tue, 10 Sep 2019 07:48:32 +0000 (10:48 +0300)]
doveadm: Use a memory pool for duplicating settings
Required by the next commit.
Timo Sirainen [Mon, 9 Sep 2019 09:24:00 +0000 (12:24 +0300)]
auth: If user is already authenticated, passdb result shouldn't be password_mismatch
This caused confusion in the auth_request_passdb_finished event's result
parameter. Otherwise it shouldn't have caused any bugs.
Timo Sirainen [Mon, 9 Sep 2019 09:21:39 +0000 (12:21 +0300)]
auth: Add and use auth_request_password_missing() where possible
Timo Sirainen [Mon, 9 Sep 2019 09:08:33 +0000 (12:08 +0300)]
auth: Add passdb_id and userdb_id to auth_request_passdb/userdb_* events
Timo Sirainen [Wed, 4 Sep 2019 14:13:15 +0000 (17:13 +0300)]
lib-auth: Fix auth_client_is_connected() to work after disconnection
Timo Sirainen [Mon, 9 Sep 2019 14:57:14 +0000 (17:57 +0300)]
lib-http: test-http-client should use PKG_RUNDIR/dns-client
Instead of hardcoded /var/run/dovecot/dns-client
Timo Sirainen [Fri, 6 Sep 2019 13:49:44 +0000 (16:49 +0300)]
lib, lib-program-client: Fix i_stream_read_memarea() usage
Calling it may change the stream's buffer and free the old buffer. However,
some istreams didn't change the buffer if i_stream_read_memarea() returned
-2. The old buffer was kept referenced, which could have caused the istream
to read garbage or crash due to accessing freed memory.
This fixes:
* istream-limit
* istream-sized
* istream-rawlog
* program-client-istream
* Anything using i_stream_read_copy_from_parent(), which includes:
* istream-fs-file
* istream-fs-stats
* istream-metawrap
* http-server-istream
* istream-header-filter
* istream-mail
* istream-failure-at
* istream-hash
* istream-timeout
* istream-try
Timo Sirainen [Thu, 5 Sep 2019 09:06:02 +0000 (12:06 +0300)]
lib-master: Event filter parsing - Accept "service:<name>"
This is short for "category:service:<name>"
Timo Sirainen [Thu, 5 Sep 2019 09:04:50 +0000 (12:04 +0300)]
lib-master: Code cleanup for handling event filter category parsing
Timo Sirainen [Thu, 5 Sep 2019 09:02:16 +0000 (12:02 +0300)]
lib, lib-master: Add service:<name> category for all events
Timo Sirainen [Thu, 5 Sep 2019 08:59:20 +0000 (11:59 +0300)]
lib: Add EVENT_CALLBACK_TYPE_CREATE to call a callback on event creation
It's not called for event_dup() or event_flatten(), because those are based
on events that were already created.
Timo Sirainen [Thu, 5 Sep 2019 12:36:40 +0000 (15:36 +0300)]
lib: Add and use event_create_internal() wrapper
This avoids p_strdup()ing the source_filename twice. Also it'll be extended
by the following commit.
Timo Sirainen [Thu, 5 Sep 2019 12:42:34 +0000 (15:42 +0300)]
lib: event_set_source() - Avoid p_strdup() if source filename doesn't change
Timo Sirainen [Thu, 5 Sep 2019 12:41:54 +0000 (15:41 +0300)]
lib: event_import_unescaped() - Use event_set_source() to set the source
Timo Sirainen [Thu, 5 Sep 2019 08:58:48 +0000 (11:58 +0300)]
lib: Add and use event_call_callbacks_noargs() helper
Timo Sirainen [Thu, 5 Sep 2019 08:57:20 +0000 (11:57 +0300)]
lib, lib-master: Remove event.call_free
Just call the EVENT_CALLBACK_TYPE_FREE always. Having this flag isn't
really going to affect the performance, and it might be useful in the
future to work this way.
Only the unit test was relying on call_free to be different from
id_sent_to_stats. This commit changes the unit test to check for the
END strings where necessary.
Timo Sirainen [Thu, 5 Sep 2019 08:52:05 +0000 (11:52 +0300)]
lib: Rename event_send_callbacks() to event_call_callbacks()
Timo Sirainen [Thu, 5 Sep 2019 08:51:44 +0000 (11:51 +0300)]
lib: Move event_send_callbacks() and event_send_free() earlier in the file
Timo Sirainen [Thu, 5 Sep 2019 08:48:27 +0000 (11:48 +0300)]
lib, lib-master: Rename EVENT_CALLBACK_TYPE_EVENT to _SEND
This describes the functionality better.
Stephan Bosch [Thu, 5 Sep 2019 11:06:28 +0000 (13:06 +0200)]
lib: test-istream-base64-decoder - Make random test also test CRLF vs LF line endings at random.
Stephan Bosch [Thu, 5 Sep 2019 09:50:04 +0000 (11:50 +0200)]
lib: test-istream-base64-decoder - Add explicit test cases for decoding the empty string.
Stephan Bosch [Thu, 5 Sep 2019 09:45:02 +0000 (11:45 +0200)]
lib: test-base64 - Add explicit test cases for encoding/decoding the empty string.
Stephan Bosch [Thu, 5 Sep 2019 00:31:58 +0000 (02:31 +0200)]
lib: base64 - Add assertion preventing calling base64_encode_more() after base64_encode_finish().
Stephan Bosch [Wed, 4 Sep 2019 23:13:46 +0000 (01:13 +0200)]
lib: test-istream-base64-decoder - Reduce minimum random stream buffer size to 1.
Stephan Bosch [Wed, 4 Sep 2019 23:11:53 +0000 (01:11 +0200)]
lib: test-istream-base64-decoder - Abort random test at first error and print parameters.
Stephan Bosch [Wed, 4 Sep 2019 21:40:25 +0000 (23:40 +0200)]
lib: test-istream-base64-encoder - Fix test names.
Stephan Bosch [Wed, 4 Sep 2019 21:37:11 +0000 (23:37 +0200)]
lib: test-base64 - Abort random test at first error and print parameters.
Stephan Bosch [Wed, 4 Sep 2019 21:16:24 +0000 (23:16 +0200)]
lib: test-base64 - Test Base64 encoding with maximum line length of 1.
This corner case is a useful test for problems in the line encoding.
Stephan Bosch [Wed, 4 Sep 2019 20:52:00 +0000 (22:52 +0200)]
lib: test-base64 - Better check output of incrementally encoded random Base64.
Check whether it is equal to the same data encoded as a single block and whether
the length matches the base64_get_full_encoded_size() output.
Stephan Bosch [Wed, 4 Sep 2019 20:44:03 +0000 (22:44 +0200)]
lib: base64 - Fix incremental/streaming Base64 encoding with CRLF line endings.
Line lengths became inconsistent due to a design error. The encoding itself
remained valid. The linefeed is no longer appended to the write buffer when the
destination buffer is full. Rather, a flag is set that makes the encoder emit
the linefeed immediately next time the encoder is called with more buffer
space. Appending it to the write buffer was wrong; it in fact needs to be
prepended and in that case a flag is more efficient.
Stephan Bosch [Wed, 4 Sep 2019 23:17:55 +0000 (01:17 +0200)]
lib: base64 - Restructure base64_encode_get_size().
Stephan Bosch [Wed, 4 Sep 2019 20:23:25 +0000 (22:23 +0200)]
lib: base64 - Use unsigned size type for base64_get_full_encoded_size().
Makes more sense.
Stephan Bosch [Wed, 4 Sep 2019 16:34:30 +0000 (18:34 +0200)]
lib: base64 - Truly fix dest buffer assertion in base64_decode_more().
Previous fix was inadequate in the presence of padding at the end of input.
Stephan Bosch [Thu, 5 Sep 2019 12:21:53 +0000 (14:21 +0200)]
lib: test-istream-base64-decoder - Use unsigned int for bit field in random test.
Josef 'Jeff' Sipek [Tue, 23 Jul 2019 12:05:02 +0000 (08:05 -0400)]
global: Clean up MAX_INT_STRLEN usage
A number of MAX_INT_STRLEN consumers did not realize that it already
includes space for the trailing nul.
Timo Sirainen [Tue, 23 Jul 2019 10:56:18 +0000 (13:56 +0300)]
lib: Add comment to MAX_INT_STRLEN macro
Timo Sirainen [Wed, 4 Sep 2019 18:02:27 +0000 (21:02 +0300)]
auth: Set auth_request successful before auth_request_finished event
Otherwise the event never has success=yes parameter.
Timo Sirainen [Tue, 3 Sep 2019 14:46:39 +0000 (17:46 +0300)]
doveadm fs iter[-dirs]: Add --object-ids and --no-cache parameters
Timo Sirainen [Wed, 4 Sep 2019 12:02:11 +0000 (15:02 +0300)]
imap-old-stats: Fix plugin dependency variable names
Timo Sirainen [Wed, 4 Sep 2019 12:43:06 +0000 (15:43 +0300)]
master: Don't log "Sent SIGKILL to .. processes" when actually sending SIGUSR1
The SIGUSR1 is sent when all login processes are full and can't accept any
more connections. This should be handled silently by the master.
Timo Sirainen [Wed, 4 Sep 2019 12:38:09 +0000 (15:38 +0300)]
lib-auth: Remove "BUG:" prefix from "Authentication server sent unknown id" error
It's not necessarily a bug.
Timo Sirainen [Wed, 4 Sep 2019 12:35:55 +0000 (15:35 +0300)]
lib-auth: Don't disconnect from auth server when receiving "unknown id"
It doesn't mean that the state between auth client and server is broken.
Just that the client had already forgotten about some of the IDs.
This also means that the "unknown id" lines aren't treated as invalid lines.
Previously the whole OK/FAIL line may have been logged, which could have
included e.g. passwords.
Timo Sirainen [Wed, 4 Sep 2019 10:52:10 +0000 (13:52 +0300)]
push-notification-lua: Use the new accessor functions instead of variables directly
This fixes plugin dependency checking. Instead of:
Fatal: Couldn't load required plugin .../lib22_push_notification_lua_plugin.so: dlopen() failed: /usr/local/lib/dovecot/lib22_push_notification_lua_plugin.so: undefined symbol: event_category_push_notification
The error is now clearer:
Fatal: Couldn't load required plugin .../lib22_push_notification_lua_plugin.so: Plugin push_notification must be loaded also
Timo Sirainen [Wed, 4 Sep 2019 10:51:26 +0000 (13:51 +0300)]
push-notification: Add accessor functions to global variables
These are enough for the current plugin. Maybe others will be needed in the
future.
Stephan Bosch [Wed, 4 Sep 2019 10:33:08 +0000 (12:33 +0200)]
lib: base64 - Fix dest buffer assertion in base64_decode_more().
The assertion is supposed to trigger when the encoder hits the buffer size limit
unexpectedly (src_pos_r==NULL means that all should be encoded at once). It
triggered erroneously when the destination buffer had the exact size needed
for the encoded data.