]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
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.

7 years agolib-index: Make sure error is set on sync & commit failures
Timo Sirainen [Tue, 19 Jun 2018 09:31:43 +0000 (12:31 +0300)] 
lib-index: Make sure error is set on sync & commit failures

This avoids "BUG: Unknown internal index error" after view is marked
inconsistent or after index is deleted.

7 years agoquota-clone: Send quota clone data to dict asynchronously
Timo Sirainen [Tue, 19 Jun 2018 12:46:41 +0000 (15:46 +0300)] 
quota-clone: Send quota clone data to dict asynchronously

Based on patch by Michael Slusarz

7 years agoquota-clone: Move state tracking to user context
Timo Sirainen [Tue, 19 Jun 2018 12:00:02 +0000 (15:00 +0300)] 
quota-clone: Move state tracking to user context

This way there's no need to do multiple flushes when e.g. multiple
mailboxes change.

The flush had to be removed from close(), because the code path recurses:

 * mailbox_transaction_commit() when mail is saved
 * quota_count() starts counting the quota, which opens and closes mailbox
 * quota_clone_mailbox_close() attempts to flush quota, which again recurses
into quota_count(), which returns 0 for the quota value.

Based on patch by Michael Slusarz

7 years agoquota: Add quota_root_iter_init_user()
Timo Sirainen [Tue, 19 Jun 2018 11:12:45 +0000 (14:12 +0300)] 
quota: Add quota_root_iter_init_user()

7 years agolib-dcrypt: istream-decrypt - Fix memory leak when stream is seeked backwards
Timo Sirainen [Tue, 12 Jun 2018 18:07:38 +0000 (21:07 +0300)] 
lib-dcrypt: istream-decrypt - Fix memory leak when stream is seeked backwards

The key already exists in memory at that time.

7 years agomaster: Don't recreate master UNIX listener socket on reload
Timo Sirainen [Mon, 18 Jun 2018 19:44:53 +0000 (22:44 +0300)] 
master: Don't recreate master UNIX listener socket on reload

This way it works similar to all other listeners and it's not even
temporarily unavailable.

7 years agomaster: Close all listener fds at deinit.
Timo Sirainen [Mon, 18 Jun 2018 19:38:48 +0000 (22:38 +0300)] 
master: Close all listener fds at deinit.

Just makes the deinit cleaner.

7 years agomaster: Set listener fd to -1 after closing it
Timo Sirainen [Mon, 18 Jun 2018 19:53:38 +0000 (22:53 +0300)] 
master: Set listener fd to -1 after closing it

The listener fds weren't used for anything afterwards, so it wasn't a
problem so far. The next commit requires it though.

7 years agolib-smtp: Allocate ORCPT addr_type from given memory pool, not data stack
Timo Sirainen [Tue, 12 Jun 2018 17:49:59 +0000 (20:49 +0300)] 
lib-smtp: Allocate ORCPT addr_type from given memory pool, not data stack

This could have caused crashes when parsing ORCPT.

7 years agoimapc: Fix assert-crash if syncing adds delayed expunges, but fails afterwards
Timo Sirainen [Sat, 16 Jun 2018 16:40:34 +0000 (19:40 +0300)] 
imapc: Fix assert-crash if syncing adds delayed expunges, but fails afterwards

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 agoimapc: Fix potential assert-crash when reconnecting during syncing
Timo Sirainen [Sat, 16 Jun 2018 16:37:27 +0000 (19:37 +0300)] 
imapc: Fix potential assert-crash when reconnecting during syncing

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 agoimapc: Fix assert-crash when reconnecting during initial FETCH finds expunges
Timo Sirainen [Sat, 16 Jun 2018 12:56:26 +0000 (15:56 +0300)] 
imapc: Fix assert-crash when reconnecting during initial FETCH finds expunges

The initial FETCH is automatically retried on failure, but the FETCH state
wasn't reset during the reconnection.

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 agoimapc: Fix assert-crash when reconnecting expunges newly added messages
Timo Sirainen [Sat, 16 Jun 2018 12:09:53 +0000 (15:09 +0300)] 
imapc: Fix assert-crash when reconnecting expunges newly added messages

The initial FETCH 1:* during reconnection may notice some messages that are
missing and tries to expunge them. But those messages could still be in
delayed_sync_trans, and currently lib-index doesn't support expunging anything
but the latest mail from a transaction.

Fixes:
Panic: file mail-index-transaction-update.c: line 337 (mail_index_expunge_last_append): assertion failed: (seq == t->last_new_seq)

7 years agoimapc: Move expunging from index to imapc_mailbox_index_expunge()
Timo Sirainen [Sat, 16 Jun 2018 12:08:26 +0000 (15:08 +0300)] 
imapc: Move expunging from index to imapc_mailbox_index_expunge()

7 years agolib: When log writing keeps returning EAGAIN, change process title only once
Timo Sirainen [Mon, 18 Jun 2018 14:03:01 +0000 (17:03 +0300)] 
lib: When log writing keeps returning EAGAIN, change process title only once

Otherwise each call will use up data stack memory.

7 years agolib: If log write returns EAGAIN, use poll() instead of ioloop for waiting
Timo Sirainen [Mon, 18 Jun 2018 13:19:55 +0000 (16:19 +0300)] 
lib: If log write returns EAGAIN, use poll() instead of ioloop for waiting

As explained in 861d40b9aebabccae7d48e49a18cbc631ab1fefe commit message,
ioloop can call various callbacks and it can also recurse back to error
logging. Using poll() directly is safer.

7 years agolib: Revert earlier "log write is blocking" handling change
Timo Sirainen [Mon, 18 Jun 2018 13:07:30 +0000 (16:07 +0300)] 
lib: Revert earlier "log write is blocking" handling change

1) It was buggy, because it set O_NONBLOCK rather than removing it.

2) fd flags are shared across all the processes using the fd. We can't
reliably implement the process title update, because some processes are
blocking on the log write() before they change the process title.

Reverts 861d40b9aebabccae7d48e49a18cbc631ab1fefe

7 years agolib-imap-client: Remove assert from imapc_client_mailbox_reconnect
Timo Sirainen [Sat, 16 Jun 2018 16:58:57 +0000 (19:58 +0300)] 
lib-imap-client: Remove assert from imapc_client_mailbox_reconnect

It's possible for the assert to trigger if there are multiple reconnections.
imapc_connection_can_reconnect() checks a bit later whether the reconnection
can still be done.

7 years agoimapc: Don't trust mail stream to have correct CRLFs
Timo Sirainen [Mon, 18 Jun 2018 16:13:30 +0000 (19:13 +0300)] 
imapc: Don't trust mail stream to have correct CRLFs

It's not that expensive to just recalculate them. If they're not correct in
the stream, it can result in e.g. truncated emails due to wrong virtual_size
being used in body_size calculation. The wrong CRLFs can especially happen
if plugins modify the stream in istream_opened() hook.

7 years agodoveadm dump: Fix dumping "vsize" header in dovecot.index
Timo Sirainen [Wed, 13 Jun 2018 17:09:32 +0000 (20:09 +0300)] 
doveadm dump: Fix dumping "vsize" header in dovecot.index

It was trying to print it as the "vsize" header in dovecot.list.index.
This caused confusing output, as well as potentially accessing memory
out of bounds.

7 years agodoveadm log find: Fix memory leak
Timo Sirainen [Wed, 13 Jun 2018 17:08:08 +0000 (20:08 +0300)] 
doveadm log find: Fix memory leak

7 years agodoveadm user: Fix memory leak
Timo Sirainen [Wed, 13 Jun 2018 17:07:52 +0000 (20:07 +0300)] 
doveadm user: Fix memory leak

7 years agodsync: Fix memory leak - unreference iostreams at deinit
Timo Sirainen [Wed, 13 Jun 2018 17:07:28 +0000 (20:07 +0300)] 
dsync: Fix memory leak - unreference iostreams at deinit

Only some of the code paths need unreferencing, so also add a reference to
the other code paths.

7 years agodsync: ibc - reference iostreams internally
Timo Sirainen [Wed, 13 Jun 2018 17:06:11 +0000 (20:06 +0300)] 
dsync: ibc - reference iostreams internally

This makes it clearer who needs to reference and unreference the streams.

7 years agostr_data(): cast return to correct type to fix include in c++ code
Danny Al-Gaaf [Wed, 30 May 2018 09:16:04 +0000 (11:16 +0200)] 
str_data(): cast return to correct type to fix include in c++ code

/usr/include/dovecot/str.h: In function ‘const unsigned char* str_data(const string_t*)’:
/usr/include/dovecot/str.h:22:14: warning: invalid conversion from ‘const void*’ to ‘const unsigned char*’ [-fpermissive]
  return str->data;
         ~~~~~^~~~

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
7 years agolib: istream-try - Don't assert-crash with empty parent istream
Timo Sirainen [Fri, 8 Jun 2018 20:17:04 +0000 (23:17 +0300)] 
lib: istream-try - Don't assert-crash with empty parent istream

Fixes:
Panic: file istream.c: line 327 (i_stream_read_memarea): assertion failed: (stream->eof)

7 years agolib-master: Allow calling master_service_deinit() without _init_finish()
Timo Sirainen [Tue, 12 Jun 2018 21:58:55 +0000 (00:58 +0300)] 
lib-master: Allow calling master_service_deinit() without _init_finish()

7 years agolib: restrict-access: Free chroot_dir at deinit
Timo Sirainen [Tue, 12 Jun 2018 19:05:52 +0000 (22:05 +0300)] 
lib: restrict-access: Free chroot_dir at deinit

7 years agolib: Free global_event_stack array at deinit
Timo Sirainen [Tue, 12 Jun 2018 19:05:35 +0000 (22:05 +0300)] 
lib: Free global_event_stack array at deinit

7 years agovirtual: Fix memory leak when selecting mailboxes with '-' or /metadata
Timo Sirainen [Tue, 12 Jun 2018 15:01:21 +0000 (18:01 +0300)] 
virtual: Fix memory leak when selecting mailboxes with '-' or /metadata

7 years agomail-crypt-acl: Fix memory leak when updating ACLs
Timo Sirainen [Tue, 12 Jun 2018 14:23:35 +0000 (17:23 +0300)] 
mail-crypt-acl: Fix memory leak when updating ACLs

7 years agolib-dcrypt, mail-crypt: Fix leaking memory when using non-global keys
Timo Sirainen [Tue, 12 Jun 2018 14:08:04 +0000 (17:08 +0300)] 
lib-dcrypt, mail-crypt: Fix leaking memory when using non-global keys

The users' private keys had one reference too much. Because of key cache,
most likely the keys were leaked only once at deinit.

Changed the i_stream_create_decrypt_callback() API so that it allows the
callback to create the key itself without having to store it anywhere.

In this case the key was already added to cache, which increased its
refcount. So an alternative fix would have been to simply unreferenced the
key before returning it. It's a bit ugly though to rely on such caches,
since without the cache the code would be buggy.

7 years agomail-crypt: Fix memory leak in "doveadm mailbox cryptokey generate"
Timo Sirainen [Tue, 12 Jun 2018 13:56:51 +0000 (16:56 +0300)] 
mail-crypt: Fix memory leak in "doveadm mailbox cryptokey generate"

7 years agolib-smtp: server: Fix memory leak when handling BDAT command
Timo Sirainen [Tue, 12 Jun 2018 13:49:36 +0000 (16:49 +0300)] 
lib-smtp: server: Fix memory leak when handling BDAT command

7 years agoimapc: Fix leaking memory when sending imapc commands after authentication failure
Timo Sirainen [Tue, 12 Jun 2018 13:45:26 +0000 (16:45 +0300)] 
imapc: Fix leaking memory when sending imapc commands after authentication failure

7 years agolib-storage: Fix memory leak when mail_storage_service_next() is called multiple...
Timo Sirainen [Tue, 12 Jun 2018 13:07:25 +0000 (16:07 +0300)] 
lib-storage: Fix memory leak when mail_storage_service_next() is called multiple times

dsync uses it twice for the same mail_storage_service_user.

7 years agodoveadm-dict: Initialize set variable in cmd_dict_init
Aki Tuomi [Mon, 11 Jun 2018 11:22:38 +0000 (14:22 +0300)] 
doveadm-dict: Initialize set variable in cmd_dict_init

Makes valgrind happy with clang's optimizations

7 years agodoveadm-dict: Remove spurious `key =` debug logging
Aki Tuomi [Mon, 11 Jun 2018 11:06:20 +0000 (14:06 +0300)] 
doveadm-dict: Remove spurious `key =` debug logging

Was added in 42db3821

7 years agoimap: Finish client ostream at disconnect
Timo Sirainen [Thu, 7 Jun 2018 11:20:33 +0000 (14:20 +0300)] 
imap: Finish client ostream at disconnect

With IMAP COMPRESS this sends the EOF marker, indicating cleanly closed
connection.

7 years agodoveadm: Fix compiler warning
Timo Sirainen [Fri, 8 Jun 2018 16:56:01 +0000 (19:56 +0300)] 
doveadm: Fix compiler warning

7 years agodoveadm: Simplify destroying ioloop using o_stream_switch_ioloop_to()
Timo Sirainen [Tue, 5 Jun 2018 17:28:45 +0000 (20:28 +0300)] 
doveadm: Simplify destroying ioloop using o_stream_switch_ioloop_to()

7 years agodoveadm-server: Fix hang when sending a lot of output to clients
Timo Sirainen [Tue, 5 Jun 2018 17:23:52 +0000 (20:23 +0300)] 
doveadm-server: Fix hang when sending a lot of output to clients

Nowadays ostream adds its io to the stream's specified ioloop, not to
current ioloop.