]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
7 years agologin-proxy: Fix potential crash when kicking user with alt username
Timo Sirainen [Fri, 6 Jul 2018 10:23:58 +0000 (13:23 +0300)] 
login-proxy: Fix potential crash when kicking user with alt username

If a new alt username field was returned after other users already were
being proxied, trying to kick with the new alt username field will crash.

7 years agolib-http: client: Notify host object about submission of request before submitting...
Stephan Bosch [Fri, 6 Jul 2018 13:07:32 +0000 (15:07 +0200)] 
lib-http: client: Notify host object about submission of request before submitting the request to the queue.

This makes sure the host idle timeout is stopped before the request is submitted
and the host object's refresh function is called. If the idle timeout is still
running at that point, the refresh function will return success without
performing a lookup, which can lead to a panic.

Panic was:

Panic: file ./http-client-private.h: line 672 (http_client_host_get_ip): assertion failed: (idx < host->shared->ips_count)

7 years agolib-http: client: Reset ips count to zero before DNS lookup.
Stephan Bosch [Mon, 2 Jul 2018 21:59:50 +0000 (23:59 +0200)] 
lib-http: client: Reset ips count to zero before DNS lookup.

7 years agoauth: Fix nonexistent passwd-file error handling
Timo Sirainen [Wed, 4 Jul 2018 09:45:39 +0000 (12:45 +0300)] 
auth: Fix nonexistent passwd-file error handling

If the path uses %variables, the missing file was logged with info-level,
but it was still returning tempfail as the result. Return "user doesn't
exist" instead.

7 years agolib-ssl-iostream: Shutdown connection cleanly whenever i/ostream is destroyed
Timo Sirainen [Fri, 6 Jul 2018 08:25:07 +0000 (11:25 +0300)] 
lib-ssl-iostream: Shutdown connection cleanly whenever i/ostream is destroyed

Do this while both istream and ostream still exist. Fixes crash where
openssl_iostream_destroy() attempts to flush the shutdown, but ssl_input
is NULL and it crashes.

7 years agolib-ssl-iostream: Split code to openssl_iostream_shutdown()
Timo Sirainen [Fri, 6 Jul 2018 08:24:41 +0000 (11:24 +0300)] 
lib-ssl-iostream: Split code to openssl_iostream_shutdown()

7 years agolib: mempool - Remove unnecessary check
Josef 'Jeff' Sipek [Thu, 5 Jul 2018 14:50:32 +0000 (10:50 -0400)] 
lib: mempool - Remove unnecessary check

The previous commit guarantees that we always have one of _ILP32 and _LP64
defined so we don't have to check ourselves.

7 years agolib: Make sure exactly one of _ILP32 and _LP64 is defined at all times
Josef 'Jeff' Sipek [Thu, 5 Jul 2018 14:48:49 +0000 (10:48 -0400)] 
lib: Make sure exactly one of _ILP32 and _LP64 is defined at all times

These defines are very common, but not universal.  For example, clang on
illumos and FreeBSD always defines one of them, while 32-bit Ubuntu 16.04
doesn't define either.

7 years agolib: o_stream_send*() - Add ATTR_WARN_UNUSED_RESULT
Timo Sirainen [Mon, 21 May 2018 15:35:23 +0000 (18:35 +0300)] 
lib: o_stream_send*() - Add ATTR_WARN_UNUSED_RESULT

Callers either need to check the return value or use o_stream_nsend*().

7 years agoimap-urlauth: Ignore ostream errors and use o_stream_nsend*()
Timo Sirainen [Wed, 4 Jul 2018 08:20:15 +0000 (11:20 +0300)] 
imap-urlauth: Ignore ostream errors and use o_stream_nsend*()

7 years agoglobal: Replace (void)o_stream_send*() with o_stream_nsend*()
Timo Sirainen [Wed, 23 May 2018 11:38:05 +0000 (14:38 +0300)] 
global: Replace (void)o_stream_send*() with o_stream_nsend*()

7 years agolib-http: http-server: Flush output after sending 500 error for aborted request
Timo Sirainen [Wed, 23 May 2018 11:36:55 +0000 (14:36 +0300)] 
lib-http: http-server: Flush output after sending 500 error for aborted request

It probably doesn't make a difference, but it's a bit clearer what the
intent is.

7 years agoglobal: Replace o_stream_send*() with o_stream_nsend*() where return value is ignored
Timo Sirainen [Mon, 21 May 2018 15:33:33 +0000 (18:33 +0300)] 
global: Replace o_stream_send*() with o_stream_nsend*() where return value is ignored

Verified that in all of these places either o_stream_set_no_error_handling()
has been called or o_stream_flush/finish() is called afterwards.

7 years agodoveadm service status: Show total number of processes created
Timo Sirainen [Wed, 30 May 2018 11:55:19 +0000 (14:55 +0300)] 
doveadm service status: Show total number of processes created

7 years agodoveadm service status: Support different number of fields returned by master
Timo Sirainen [Wed, 4 Jul 2018 13:17:57 +0000 (16:17 +0300)] 
doveadm service status: Support different number of fields returned by master

7 years agodoveadm: Add doveadm_print_get_headers_count()
Timo Sirainen [Wed, 4 Jul 2018 13:16:36 +0000 (16:16 +0300)] 
doveadm: Add doveadm_print_get_headers_count()

Returns the number of headers added to printer.

7 years agomaster: Track total number of processes created per service
Timo Sirainen [Wed, 30 May 2018 11:54:34 +0000 (14:54 +0300)] 
master: Track total number of processes created per service

7 years agodirector: Fix assert-crash when doveadm disconnects immediately after sending command
Timo Sirainen [Fri, 29 Jun 2018 11:37:36 +0000 (14:37 +0300)] 
director: Fix assert-crash when doveadm disconnects immediately after sending command

Any command that requires a ring sync should cause the doveadm connection to
wait until the ring is synced. However, if the disconnection happened early
enough the connection is deinitialized before the ring sync is finished.

Fixes:
Panic: file doveadm-connection.c: line 1097 (doveadm_connection_deinit): assertion failed: (conn->to_ring_sync_abort == NULL)

7 years agolib-mail: Change MESSAGE_ADDRESS_PARSE_FLAG_NON_STRICT_DOTS to _FLAG_STRICT_DOTS
Timo Sirainen [Fri, 4 May 2018 16:53:27 +0000 (19:53 +0300)] 
lib-mail: Change MESSAGE_ADDRESS_PARSE_FLAG_NON_STRICT_DOTS to _FLAG_STRICT_DOTS

Generally we want it to be enabled everywhere, so it's easier to just enable
it by default.

(This is kept as a separate commit from the previous one so it'll be easy to
revert this in case we actually don't want this to be the default.)

7 years agolib-mail: Add MESSAGE_ADDRESS_PARSE_FLAG_NON_STRICT_DOTS
Timo Sirainen [Fri, 4 May 2018 16:49:57 +0000 (19:49 +0300)] 
lib-mail: Add MESSAGE_ADDRESS_PARSE_FLAG_NON_STRICT_DOTS

This code is somewhat copy&pasted from parse_local_part() in Pigeonhole.

7 years agolib-mail: message_address_parse() - Change fill_missing parameter to flags
Timo Sirainen [Fri, 4 May 2018 16:31:26 +0000 (19:31 +0300)] 
lib-mail: message_address_parse() - Change fill_missing parameter to flags

This change allows adding more flags. The API is also backwards compatible
in a way that the old FALSE/TRUE values still map to compatible 0/1 flags.

7 years agolib-mail: Fix rfc822_parse_dot_atom() to reject if dot isn't followed by atom
Timo Sirainen [Fri, 4 May 2018 16:21:52 +0000 (19:21 +0300)] 
lib-mail: Fix rfc822_parse_dot_atom() to reject if dot isn't followed by atom

7 years agolib-storage: Initialize reset_id in index_index_copy_cache
Timo Sirainen [Wed, 27 Jun 2018 14:16:24 +0000 (17:16 +0300)] 
lib-storage: Initialize reset_id in index_index_copy_cache

Makes valgrind happy with clang's optimizations.

7 years agolib: mempool - Improve p_realloc() panic message
Josef 'Jeff' Sipek [Thu, 21 Jun 2018 13:45:03 +0000 (09:45 -0400)] 
lib: mempool - Improve p_realloc() panic message

Most importantly, this differentiates it from the panic message that
p_malloc() prints.

7 years agolib: mempool - Centralize p_free() NULL pointer check
Josef 'Jeff' Sipek [Wed, 20 Jun 2018 16:24:34 +0000 (12:24 -0400)] 
lib: mempool - Centralize p_free() NULL pointer check

This changes the behavior of p_free(pool, some_null_pointer) slightly.

datastack mempools:

    Previously, the datastack frame id was checked regardless of whether or
    not the pointer was NULL.  Now, only non-NULL pointers perform this
    check.

system mempools:

    Previously, the process would SIGSEGV if a NULL pointer was freed in a
    debug binary on a system with malloc_usable_size().  Now, no SIGSEGV
    occurs.

allocfree, alloconly, and unsafe datastack:

    No change in behavior.

7 years agolib: mempool - Centralize p_realloc() NULL pointer check
Josef 'Jeff' Sipek [Wed, 20 Jun 2018 15:47:26 +0000 (11:47 -0400)] 
lib: mempool - Centralize p_realloc() NULL pointer check

Instead of each mempool implementation having to check the pointer passed in
for being NULL, we can check that the sizes are within the required bounds
in p_realloc().

7 years agolib: mempool - Centralize p_{m,re}alloc() size checks
Josef 'Jeff' Sipek [Wed, 20 Jun 2018 15:42:28 +0000 (11:42 -0400)] 
lib: mempool - Centralize p_{m,re}alloc() size checks

Instead of each mempool implementation having to check the allocation sizes
for sanity, we can check that the sizes are within the required bounds in
p_malloc() and p_realloc().

Since p_malloc() and p_realloc() are static inlines, some consumers will see
a little bit of growth in binary size, but others will be able to optimize
the check away at compile time.

7 years agolib: mempool - Define a global max allocation size supported by all pools
Josef 'Jeff' Sipek [Fri, 22 Jun 2018 20:51:40 +0000 (16:51 -0400)] 
lib: mempool - Define a global max allocation size supported by all pools

Instead of relying on each mempool implementation to define its own limits
and checks, this commit defines a generic one that's sufficient to make any
mempool present or future happy.

7 years agolib: mempool-allocfree: Remove unused #define
Josef 'Jeff' Sipek [Fri, 22 Jun 2018 21:28:24 +0000 (17:28 -0400)] 
lib: mempool-allocfree: Remove unused #define

This define was never actually used.

7 years agolib: mempool-datastack - Use container_of instead of casts
Josef 'Jeff' Sipek [Wed, 20 Jun 2018 15:18:32 +0000 (11:18 -0400)] 
lib: mempool-datastack - Use container_of instead of casts

7 years agolib: mempool-alloconly - Use container_of instead of casts
Josef 'Jeff' Sipek [Wed, 20 Jun 2018 15:18:13 +0000 (11:18 -0400)] 
lib: mempool-alloconly - Use container_of instead of casts

7 years agolib: Rename a alloconly mempool helper function to make its scope obvious
Josef 'Jeff' Sipek [Wed, 20 Jun 2018 14:35:15 +0000 (10:35 -0400)] 
lib: Rename a alloconly mempool helper function to make its scope obvious

pool_try_grow() makes it look like it is part of the mempool API, even
though it is an internal helper specific to the alloconly pool.

7 years agolib: Document the unsafe datastack mempool
Josef 'Jeff' Sipek [Wed, 20 Jun 2018 14:55:53 +0000 (10:55 -0400)] 
lib: Document the unsafe datastack mempool

7 years agolib: Document the system mempool
Josef 'Jeff' Sipek [Tue, 19 Jun 2018 20:08:40 +0000 (16:08 -0400)] 
lib: Document the system mempool

7 years agolib: Document datastack mempools
Josef 'Jeff' Sipek [Wed, 20 Jun 2018 11:50:38 +0000 (07:50 -0400)] 
lib: Document datastack mempools

7 years agolib: Document allocfree mempools
Josef 'Jeff' Sipek [Tue, 19 Jun 2018 19:36:43 +0000 (15:36 -0400)] 
lib: Document allocfree mempools

7 years agolib: Document alloconly mempools
Josef 'Jeff' Sipek [Tue, 19 Jun 2018 18:04:43 +0000 (14:04 -0400)] 
lib: Document alloconly mempools

7 years agolib: mempool - Further reduce test code duplication
Josef 'Jeff' Sipek [Fri, 29 Jun 2018 20:17:40 +0000 (16:17 -0400)] 
lib: mempool - Further reduce test code duplication

We have to use a macro because we need to pass a type as an argument.

7 years agolib: mempool - Reduce test code duplication
Josef 'Jeff' Sipek [Thu, 28 Jun 2018 17:07:48 +0000 (13:07 -0400)] 
lib: mempool - Reduce test code duplication

The 32 and 64 bit versions of the tests were identical.

7 years agolib: mempool - Generalize the test
Josef 'Jeff' Sipek [Thu, 28 Jun 2018 15:13:43 +0000 (11:13 -0400)] 
lib: mempool - Generalize the test

Instead of hardcoding what appear to be arbitrary constants, use expressions
based on UINT{16,32,64}_MAX.

7 years agoman: doveadm-search-query.7 - Add sequence-set and update UID
Timo Sirainen [Tue, 29 May 2018 21:38:45 +0000 (00:38 +0300)] 
man: doveadm-search-query.7 - Add sequence-set and update UID

7 years agolib-compression: Fix assert-crash in test suite on 32bit systems
Paul Howarth [Mon, 2 Jul 2018 10:52:14 +0000 (11:52 +0100)] 
lib-compression: Fix assert-crash in test suite on 32bit systems

Fix compilation warnings in test-compression.c due to mismatches
between size_t and uoff_t, which then manifests in assert-crashes
running the test suite on 32bit systems.

7 years agolib-http: request-parser: Do not require Host header for HTTP/1.0 requests.
Stephan Bosch [Fri, 29 Jun 2018 10:52:28 +0000 (12:52 +0200)] 
lib-http: request-parser: Do not require Host header for HTTP/1.0 requests.

7 years agolib-http: server: Properly handle empty Host header by providing a default authority.
Stephan Bosch [Mon, 2 Jul 2018 18:19:34 +0000 (20:19 +0200)] 
lib-http: server: Properly handle empty Host header by providing a default authority.

This behavior is required by the RFC.

7 years agolib-http: request-parser: Add support for empty Host header (default base url).
Stephan Bosch [Mon, 2 Jul 2018 18:17:51 +0000 (20:17 +0200)] 
lib-http: request-parser: Add support for empty Host header (default base url).

7 years agolib-http: url: Add support for default base url to request target parsing.
Stephan Bosch [Mon, 2 Jul 2018 18:14:19 +0000 (20:14 +0200)] 
lib-http: url: Add support for default base url to request target parsing.

7 years agolib-http: request-parser: Allocate parser on alloconly pool.
Stephan Bosch [Fri, 29 Jun 2018 16:40:29 +0000 (18:40 +0200)] 
lib-http: request-parser: Allocate parser on alloconly pool.

7 years agolib-http: server: Record ip:port in connection object for later use.
Stephan Bosch [Fri, 29 Jun 2018 13:19:27 +0000 (15:19 +0200)] 
lib-http: server: Record ip:port in connection object for later use.

7 years agolib: i_close_fd_path() - Replace assert with more descriptive panic
Timo Sirainen [Sun, 1 Jul 2018 09:58:05 +0000 (12:58 +0300)] 
lib: i_close_fd_path() - Replace assert with more descriptive panic

Since this function can be called from so many places, it's easier to figure
out the bug if the panic message contains what called it.

7 years agoglobal: Start relying on event_set_forced_debug(e, FALSE) being a no-op
Josef 'Jeff' Sipek [Sat, 30 Jun 2018 14:13:10 +0000 (10:13 -0400)] 
global: Start relying on event_set_forced_debug(e, FALSE) being a no-op

Converted using the following semantic patch:

@@
expression event;
expression cond;
@@

- if (cond) {
-  event_set_forced_debug(event,
(
- TRUE
|
- cond
)
- );
- }
+ event_set_forced_debug(event, cond);

7 years agolib: Change event_set_forced_debug(e, FALSE) to be a no-op
Josef 'Jeff' Sipek [Sat, 30 Jun 2018 14:08:27 +0000 (10:08 -0400)] 
lib: Change event_set_forced_debug(e, FALSE) to be a no-op

7 years agolib: Add event_unset_forced_debug()
Josef 'Jeff' Sipek [Sat, 30 Jun 2018 14:06:04 +0000 (10:06 -0400)] 
lib: Add event_unset_forced_debug()

7 years agolda: Deinitialize cleanly if user doesn't exist in userdb
Timo Sirainen [Wed, 27 Jun 2018 15:28:23 +0000 (18:28 +0300)] 
lda: Deinitialize cleanly if user doesn't exist in userdb

7 years agolda: Deinitialize cleanly if mail delivery fails
Timo Sirainen [Wed, 27 Jun 2018 15:24:06 +0000 (18:24 +0300)] 
lda: Deinitialize cleanly if mail delivery fails

7 years agolda: Cleanup - move code to lda_deliver() function
Timo Sirainen [Wed, 27 Jun 2018 15:22:01 +0000 (18:22 +0300)] 
lda: Cleanup - move code to lda_deliver() function

No functional changes.

7 years agolda: Cleanup - reorder code
Timo Sirainen [Wed, 27 Jun 2018 15:17:23 +0000 (18:17 +0300)] 
lda: Cleanup - reorder code

Makes the next commit cleaner.

7 years agoacl: Fix return value of acl_attribute_get_acl
Aki Tuomi [Thu, 24 May 2018 12:48:58 +0000 (12:48 +0000)] 
acl: Fix return value of acl_attribute_get_acl

If matching acl entry is not found, it must return 0
and not 1 because it did not find anything.

Fixes dsync: Panic: file mailbox-attribute.c: line 362 (mailbox_attribute_get_stream): assertion failed: (value_r->value != NULL || value_r->value_stream != NULL)

Broken in 37c72fa0cd3f1d74d79b64afb3fb6da5ffd4fe3a

Found by @dl8bh

7 years agodict-file: If write failed, file was left locked
Timo Sirainen [Thu, 28 Jun 2018 08:51:22 +0000 (11:51 +0300)] 
dict-file: If write failed, file was left locked

7 years agodict-file: Fix memory leak when file is recreated during lock wait
Timo Sirainen [Thu, 28 Jun 2018 08:50:36 +0000 (11:50 +0300)] 
dict-file: Fix memory leak when file is recreated during lock wait

7 years agolib: Assert-crash if duplicate event categories are tried to be registered
Timo Sirainen [Wed, 13 Jun 2018 14:26:57 +0000 (17:26 +0300)] 
lib: Assert-crash if duplicate event categories are tried to be registered

7 years agolib: str-sanitize: Use uni_utf8_data_truncate().
Stephan Bosch [Thu, 31 May 2018 21:59:50 +0000 (23:59 +0200)] 
lib: str-sanitize: Use uni_utf8_data_truncate().

7 years agolib: Add str_truncate_utf8().
Stephan Bosch [Thu, 31 May 2018 22:02:53 +0000 (00:02 +0200)] 
lib: Add str_truncate_utf8().

It works similar to str_truncate(), but it makes sure the truncated string
remains valid UTF-8.

7 years agolib: unichar: Add uni_utf8_data_truncate().
Stephan Bosch [Thu, 31 May 2018 22:02:16 +0000 (00:02 +0200)] 
lib: unichar: Add uni_utf8_data_truncate().

Returns the size of the data when truncated to be less than or equal to
a specified size, making sure UTF-8 character boundaries are respected.

7 years agoindexer: Don't log error when getting path to nonexistent mailbox fails
Martti Rannanjärvi [Wed, 27 Jun 2018 21:34:14 +0000 (00:34 +0300)] 
indexer: Don't log error when getting path to nonexistent mailbox fails

7 years agoindexer: Don't log mailbox was deleted under us error
Martti Rannanjärvi [Wed, 27 Jun 2018 21:05:26 +0000 (00:05 +0300)] 
indexer: Don't log mailbox was deleted under us error

7 years agoindexer: Don't log error when mailbox was not found
Martti Rannanjärvi [Wed, 27 Jun 2018 20:58:11 +0000 (23:58 +0300)] 
indexer: Don't log error when mailbox was not found

7 years agofts-solr: Properly URL encode quotes for empty string
Martti Rannanjärvi [Wed, 27 Jun 2018 14:19:38 +0000 (17:19 +0300)] 
fts-solr: Properly URL encode quotes for empty string

Invalid URL encoding of empty string made Solr server give 400 Bad
Request HTTP responses for searches like SEARCH HEADER FROM "".

7 years agofts-solr: Fix default_ns parameter parsing
Martti Rannanjärvi [Wed, 27 Jun 2018 14:27:15 +0000 (17:27 +0300)] 
fts-solr: Fix default_ns parameter parsing

This version makes it possible to specify a value to the setting as
well.

7 years agofts-solr: Append '/' to URL path when missing in configuration
Martti Rannanjärvi [Tue, 26 Jun 2018 09:38:50 +0000 (12:38 +0300)] 
fts-solr: Append '/' to URL path when missing in configuration

This fixes a crash when url parameter has empty path like
http://localhost:8080 instead of http://localhost:8080/ and makes using
url like http://localhost:8080/solr behave the same as
http://localhost:8080/solr/

7 years agolib-master: Fix reading settings when local_name has multiple names
Timo Sirainen [Thu, 28 Jun 2018 09:23:00 +0000 (12:23 +0300)] 
lib-master: Fix reading settings when local_name has multiple names

Only the last name was matching. For example with local_name "one two
three" { ...  } only "three" matched.

7 years agofts-solr: Remove obsolete break-imap-search setting
Martti Rannanjärvi [Thu, 28 Jun 2018 11:36:51 +0000 (14:36 +0300)] 
fts-solr: Remove obsolete break-imap-search setting

7 years agoauth: Fix LDAP user iteration to not access already freed memory
Timo Sirainen [Tue, 26 Jun 2018 20:50:03 +0000 (23:50 +0300)] 
auth: Fix LDAP user iteration to not access already freed memory

db_ldap_request_free() was called on already freed request. Changed to use
auth_request's pool to fix this, since the request is correctly referenced.

7 years agoquota-clone: Fix assert-crash at deinit if quota_clone update fails
Timo Sirainen [Tue, 26 Jun 2018 19:33:33 +0000 (22:33 +0300)] 
quota-clone: Fix assert-crash at deinit if quota_clone update fails

The timeout isn't removed on failure, so it crashed with:
Panic: file quota-clone-plugin.c: line 257 (quota_clone_mail_user_deinit_pre): assertion failed: (quser->to_quota_flush == NULL)

7 years agolib-storage: Fix memory leak in mail_storage_set_internal_error()
Timo Sirainen [Wed, 27 Jun 2018 10:22:03 +0000 (13:22 +0300)] 
lib-storage: Fix memory leak in mail_storage_set_internal_error()

7 years agolib-ssl-iostream: Turn on SSL_OP_SINGLE_DH_USE
Aki Tuomi [Wed, 27 Jun 2018 06:10:39 +0000 (09:10 +0300)] 
lib-ssl-iostream: Turn on SSL_OP_SINGLE_DH_USE

Improves forward secrecy in case a DH cipher is used.

7 years agodoveconf: Hide URL userpart
Aki Tuomi [Wed, 30 May 2018 11:10:41 +0000 (14:10 +0300)] 
doveconf: Hide URL userpart

7 years agodoveconf: Add find_next_secret
Aki Tuomi [Tue, 19 Jun 2018 11:26:29 +0000 (14:26 +0300)] 
doveconf: Add find_next_secret

Find start of possible next secret, and return
what the found secret was. Makes next commit easier.

7 years agolib-http: Add/fix default value comments in http_client_settings
Timo Sirainen [Tue, 26 Jun 2018 10:45:54 +0000 (13:45 +0300)] 
lib-http: Add/fix default value comments in http_client_settings

7 years agolib-smtp: server: Fix memory leak occurring when an error occurs early for BDAT/BURL.
Stephan Bosch [Tue, 19 Jun 2018 22:22:47 +0000 (00:22 +0200)] 
lib-smtp: server: Fix memory leak occurring when an error occurs early for BDAT/BURL.

7 years agolib-smtp: server: connection: Rely on i_stream_destroy(NULL) being a no-op.
Stephan Bosch [Wed, 20 Jun 2018 13:54:21 +0000 (15:54 +0200)] 
lib-smtp: server: connection: Rely on i_stream_destroy(NULL) being a no-op.

7 years agolib-smtp: server: Restructure reference counting of BDAT/BURL chain stream.
Stephan Bosch [Tue, 19 Jun 2018 22:31:43 +0000 (00:31 +0200)] 
lib-smtp: server: Restructure reference counting of BDAT/BURL chain stream.

It is now dereferenced directly, rather than via a local variable; thereby
making sure it is reset to NULL.

7 years agolib-smtp: server: data command: Hold a reference to the connection while handling...
Stephan Bosch [Thu, 21 Jun 2018 20:55:50 +0000 (22:55 +0200)] 
lib-smtp: server: data command: Hold a reference to the connection while handling input.

Makes sure connection object remains available while command is handled. Fixes a
valgrind error reported for accessing the connection object after it is freed,
which happens for the destroy debug message of the command (even when debugging
is not enabled).

7 years agolib-smtp: server: data command: Dereference command at single place during input...
Stephan Bosch [Thu, 21 Jun 2018 20:51:26 +0000 (22:51 +0200)] 
lib-smtp: server: data command: Dereference command at single place during input handling.

7 years agolib: event-filter - Increase initial allocation
Aki Tuomi [Mon, 25 Jun 2018 11:04:31 +0000 (14:04 +0300)] 
lib: event-filter - Increase initial allocation

Reduces reallocations on startup.

7 years agolib-storage: Turn on debug early if MAIL_STORAGE_SERVICE_FLAG_DEBUG set
Aki Tuomi [Tue, 26 Jun 2018 10:18:20 +0000 (13:18 +0300)] 
lib-storage: Turn on debug early if MAIL_STORAGE_SERVICE_FLAG_DEBUG set

7 years agolib-storage: Use provided flags in mail_storage_service_first_init
Aki Tuomi [Tue, 26 Jun 2018 10:22:20 +0000 (13:22 +0300)] 
lib-storage: Use provided flags in mail_storage_service_first_init

7 years agolib-storage: Fix MAIL_STORAGE_SERVICE_FLAG_DEBUG work again
Aki Tuomi [Tue, 26 Jun 2018 10:18:00 +0000 (13:18 +0300)] 
lib-storage: Fix MAIL_STORAGE_SERVICE_FLAG_DEBUG work again

7 years agolib-master: Set instance_name to the syslog name
SATOH Fumiyasu [Tue, 1 Jul 2014 10:22:56 +0000 (19:22 +0900)] 
lib-master: Set instance_name to the syslog name

7 years agovirtual: Clamp backend uids to available uids in virtual_get_virtual_uids
Aki Tuomi [Mon, 25 Jun 2018 10:13:43 +0000 (13:13 +0300)] 
virtual: Clamp backend uids to available uids in virtual_get_virtual_uids

7 years agolib-imap-client: Fix crash when ostream output blocks before connection finishes
Timo Sirainen [Mon, 18 Jun 2018 10:15:55 +0000 (13:15 +0300)] 
lib-imap-client: Fix crash when ostream output blocks before connection finishes

It's possible that ostream tries to add IO_WRITE callback before
imapc_connection_connected() callback is called.

Fixes:
Panic: io_add(0x2) called twice fd=15, callback=0x... -> 0x...

7 years agoimapc: Move selected=TRUE to imap_mailbox_select_finish()
Timo Sirainen [Mon, 25 Jun 2018 09:16:25 +0000 (12:16 +0300)] 
imapc: Move selected=TRUE to imap_mailbox_select_finish()

Minor code deduplication cleanup.

7 years agoimapc: Fix potential assert-crash when selecting empty mailbox
Timo Sirainen [Mon, 25 Jun 2018 09:10:55 +0000 (12:10 +0300)] 
imapc: Fix potential assert-crash when selecting empty mailbox

imapc_mailbox_fetch_state_finish() should have been expunging all the mails,
but it didn't happen since UIDNEXT wasn't received yet at the time EXISTS
was sent, so sync_uid_next was always 0 when checking it. Fix this by
calling imapc_mailbox_fetch_state_finish() only after SELECT/EXAMINE tagged
reply is received.

This practically happened only when index files were used. It could also
happen without index files, if the session had received new mails after
opening the mailbox, then getting disconnected and before reconnect was
finished all the mails were externally expunged.

Fixes:
Panic: file imapc-sync.c: line 328 (imapc_initial_sync_check): assertion failed: (mail_index_is_expunged(view, lseq) || seq_range_exists(&ctx->mbox->delayed_expunged_uids, luid))

7 years agoauth: Move auth_policy_deinit later
Aki Tuomi [Fri, 22 Jun 2018 21:23:04 +0000 (00:23 +0300)] 
auth: Move auth_policy_deinit later

Fixes signal 11 crash, which happens when
auth_worker_destroy is called which finishes
up requests.

7 years agolib-smtp: server: Make sure conn->state.data_failed is only set when no previous...
Stephan Bosch [Wed, 20 Jun 2018 12:01:18 +0000 (14:01 +0200)] 
lib-smtp: server: Make sure conn->state.data_failed is only set when no previous BDAT/BURL is pending.

Otherwise, the server would sometimes send 503 error for the first BDAT/BURL
command, while a subsequent command was actually failing earlier than the
initial one completed. Additionally, this caused a panic crash.

Panic was:

submission(stephan)<8353><C+7QBfysKluhIAAAmoV78g>: Panic: Input stream /home/stephan/Maildir/cur/1517515808.M176007P2993.johanna,S=1903,W=1956:2,DFS unexpectedly has references

7 years agolib-storage: fail storage: Allocate event for mailbox.
Stephan Bosch [Wed, 20 Jun 2018 10:40:37 +0000 (12:40 +0200)] 
lib-storage: fail storage: Allocate event for mailbox.

Absence of event causes segfault when event logging is performed for the
mailbox.

7 years agom4/dovecot.m4: run-test.sh - disable valgrind for individual tests
Phil Carmody [Mon, 4 Jun 2018 16:58:23 +0000 (19:58 +0300)] 
m4/dovecot.m4: run-test.sh - disable valgrind for individual tests

OpenSSL doesn't like valgrind on my setup, so permit a local instalation
to have a list of excluded binaries that won't use valgrind in make check.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
7 years agolmtp, submission: Remove extra spaces from "state = X" in disconnect log line
Timo Sirainen [Wed, 20 Jun 2018 07:49:46 +0000 (10:49 +0300)] 
lmtp, submission: Remove extra spaces from "state = X" in disconnect log line

Other Dovecot log messages don't have spaces in key=value.

7 years agolib: Fix memory leak at deinit if log_core_filter is set
Timo Sirainen [Tue, 19 Jun 2018 14:42:55 +0000 (17:42 +0300)] 
lib: Fix memory leak at deinit if log_core_filter is set

7 years agolib-ssl-iostream: Enable partial writes and moving buffers
Aki Tuomi [Wed, 20 Jun 2018 05:52:52 +0000 (08:52 +0300)] 
lib-ssl-iostream: Enable partial writes and moving buffers

Dovecot is able to provide same content to SSL_write, and
can also take care of consuming written data from the buffer.

Fixes SSL_write failed:error:1409F07F:SSL routines:SSL3_WRITE_PENDING:bad write retry

7 years agoimapc: Fix handling UIDVALIDITY changes
Timo Sirainen [Tue, 19 Jun 2018 09:33:49 +0000 (12:33 +0300)] 
imapc: Fix handling UIDVALIDITY changes

Index was being correctly reset, but the transaction was rolled back.