]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
7 years agolib-index: Code cleanup for reading caching decisions
Timo Sirainen [Wed, 24 Jan 2018 16:01:23 +0000 (18:01 +0200)] 
lib-index: Code cleanup for reading caching decisions

No functional changes.

7 years agolib-index: Finish fixing removal of forced cache decisions from existing cache files
Timo Sirainen [Wed, 24 Jan 2018 15:58:57 +0000 (17:58 +0200)] 
lib-index: Finish fixing removal of forced cache decisions from existing cache files

6ef2504d020461b0f480766c41596595a4300023 didn't fix it for already known
fields.

7 years agolib-index: Fix removal of forced cache decisions from existing cache files
Timo Sirainen [Mon, 22 Jan 2018 22:04:28 +0000 (00:04 +0200)] 
lib-index: Fix removal of forced cache decisions from existing cache files

The forced-flags are written to the cache file when the file is created.
They were also read back, and the force-flag was preserved even when the
configuration was removed.

7 years agolib-index: Fix adding forced cache decisions to existing cache files
Timo Sirainen [Mon, 22 Jan 2018 15:38:32 +0000 (17:38 +0200)] 
lib-index: Fix adding forced cache decisions to existing cache files

If a field already existed in the cache file, the cache decision from the
file was always used. This caused force-decisions to be ignored.

7 years agomdbox: Fix rebuilding when dovecot.map.index is missing map/ref extension
Timo Sirainen [Mon, 20 Nov 2017 15:03:47 +0000 (17:03 +0200)] 
mdbox: Fix rebuilding when dovecot.map.index is missing map/ref extension

The rebuild kept just repeatedly failing with:
Error: mdbox map .../dovecot.map.index corrupted: missing map extension

7 years agoimap: support for FETCH SNIPPET
Josef 'Jeff' Sipek [Thu, 4 Jan 2018 17:44:16 +0000 (12:44 -0500)] 
imap: support for FETCH SNIPPET

7 years agolib: Call prctl(PR_SET_DUMPABLE) only when PR_SET_DUMPABLE env variable is set
Sergey Kitov [Tue, 21 Nov 2017 11:27:18 +0000 (13:27 +0200)] 
lib: Call prctl(PR_SET_DUMPABLE) only when PR_SET_DUMPABLE env variable is set

7 years agolib: Add logging of prctl(PR_SET_DUMPABLE) failure.
Sergey Kitov [Wed, 22 Nov 2017 09:34:47 +0000 (11:34 +0200)] 
lib: Add logging of prctl(PR_SET_DUMPABLE) failure.

7 years agoimapc: Fix imap_features=no-msn-updates to not fail on SELECT
Timo Sirainen [Tue, 16 Jan 2018 16:17:00 +0000 (18:17 +0200)] 
imapc: Fix imap_features=no-msn-updates to not fail on SELECT

The initial EXISTS reply shouldn't be ignored, only the following ones.

7 years agoimapc: Add imapc_features=no-msn-updates
Timo Sirainen [Mon, 25 Dec 2017 09:10:19 +0000 (11:10 +0200)] 
imapc: Add imapc_features=no-msn-updates

This is a stricter version of fetch-msn-workarounds. The MSNs aren't trusted
at all. This means any new untagged EXISTS and EXPUNGE replies are ignored,
as well as untagged FETCH replies that don't include UID.

A potential downside with this feature is that UID FETCH/STORE commands
sent to expunged messages will likely fail without the IMAP client being
notified of the EXPUNGEs. New mails are also not noticed, so this should
be used only when it's known that the clients don't keep the connection
open for long.

7 years agoimapc: Fix sending initial FETCH after reconnection SELECTs mailbox
Timo Sirainen [Mon, 25 Dec 2017 14:11:26 +0000 (16:11 +0200)] 
imapc: Fix sending initial FETCH after reconnection SELECTs mailbox

Move sending the FETCH when the SELECT returns tagged OK reply instead of
delaying it until mailbox is next synced. Most importantly this allows
sending the FETCH before any retried commands that are also sent after
SELECT receives tagged reply.

7 years agoimapc: gmail-migration: Fetch X-GM-MSGID for new mails as well
Timo Sirainen [Mon, 25 Dec 2017 20:48:00 +0000 (22:48 +0200)] 
imapc: gmail-migration: Fetch X-GM-MSGID for new mails as well

I'm not sure why it was originally restricted only for the initial FETCH.
Fetching GUIDs for new mails can be just as useful.

7 years agoimapc: Move imapc_mailbox_fetch_state*() to imapc-mailbox.c
Timo Sirainen [Mon, 25 Dec 2017 18:21:40 +0000 (20:21 +0200)] 
imapc: Move imapc_mailbox_fetch_state*() to imapc-mailbox.c

Mainly to make the next commit smaller.

7 years agoimapc: Handle untagged UIDVALIDITY immediately
Timo Sirainen [Mon, 25 Dec 2017 17:19:09 +0000 (19:19 +0200)] 
imapc: Handle untagged UIDVALIDITY immediately

This is part of the changes to fix mailbox resyncing after reconnect.

7 years agoimapc: If mailbox select fails, rollback any changes done to it
Timo Sirainen [Mon, 25 Dec 2017 17:34:31 +0000 (19:34 +0200)] 
imapc: If mailbox select fails, rollback any changes done to it

Required by the following changes that start adding changes immediately
after SELECT. If the initial syncing doesn't finish successfully, these
changes need to be reverted.

7 years agoimapc: Keep "selected" state TRUE only while mailbox is successfully SELECTed
Timo Sirainen [Mon, 25 Dec 2017 17:33:33 +0000 (19:33 +0200)] 
imapc: Keep "selected" state TRUE only while mailbox is successfully SELECTed

7 years agoimapc: Fix leaking mail_index_view on delayed expunge handling
Timo Sirainen [Wed, 17 Jan 2018 13:05:38 +0000 (15:05 +0200)] 
imapc: Fix leaking mail_index_view on delayed expunge handling

Fixes:
Panic: Leaked view for index (in-memory index): Opened in imapc-mailbox.c:47

7 years agolib-imap-client: Avoid "Unknown tag" errors for aborted commands
Timo Sirainen [Wed, 17 Jan 2018 13:03:06 +0000 (15:03 +0200)] 
lib-imap-client: Avoid "Unknown tag" errors for aborted commands

If mailbox is closed before all command replies were received, the commands
were aborted but they'll still receive the replies from server. Remember
the aborted commands' tag numbers so they can be ignored.

7 years agolib-imap-client: Fix reason text when unselecting mailbox aborts commands
Timo Sirainen [Wed, 17 Jan 2018 13:02:09 +0000 (15:02 +0200)] 
lib-imap-client: Fix reason text when unselecting mailbox aborts commands

7 years agolib-imap-client: Add asserts for reconnect_command_count
Timo Sirainen [Mon, 25 Dec 2017 19:31:05 +0000 (21:31 +0200)] 
lib-imap-client: Add asserts for reconnect_command_count

7 years agolib-imap-client: Delay sending more commands while SELECT is running
Timo Sirainen [Mon, 25 Dec 2017 19:29:06 +0000 (21:29 +0200)] 
lib-imap-client: Delay sending more commands while SELECT is running

7 years agolib-imap-client: After reconnection send retried commands last
Timo Sirainen [Mon, 25 Dec 2017 16:49:15 +0000 (18:49 +0200)] 
lib-imap-client: After reconnection send retried commands last

Previously only SELECT was sent before others. This allows sending more
commands on reconnection before the retried commands.

7 years agodoveadm: client - Fix connecting to UNIX sockets that don't need authentication
Timo Sirainen [Wed, 8 Nov 2017 14:03:17 +0000 (16:03 +0200)] 
doveadm: client - Fix connecting to UNIX sockets that don't need authentication

Trying to access doveadm UNIX socket that didn't require authentication
failed with:

Error: doveadm server sent invalid handshake: ...

7 years agodoveadm: client - Cleanup: Rename handshaked to authenticate_sent
Timo Sirainen [Wed, 8 Nov 2017 14:01:11 +0000 (16:01 +0200)] 
doveadm: client - Cleanup: Rename handshaked to authenticate_sent

This better describes what it does.

7 years agodoveadm-server: Fix protocol handshake order
Timo Sirainen [Wed, 8 Nov 2017 12:06:00 +0000 (14:06 +0200)] 
doveadm-server: Fix protocol handshake order

With version 1.1 protocol, server sent the authentication "+" or "-" line
before the VERSION. doveadm client accepts the VERSION reply either before
or after, so this change doesn't break it. It makes the protocol cleaner
though.

Based on patch by Manuel Mausz

7 years agodoveadm-server: Add client_connection.preauthenticated
Timo Sirainen [Wed, 8 Nov 2017 12:04:12 +0000 (14:04 +0200)] 
doveadm-server: Add client_connection.preauthenticated

7 years agolib-ssl-iostream: Verify SSL server's hostname against cert if it's non-NULL
Timo Sirainen [Tue, 31 Oct 2017 21:37:44 +0000 (23:37 +0200)] 
lib-ssl-iostream: Verify SSL server's hostname against cert if it's non-NULL

The hostname verification was skipped when handshake-callback wasn't used.
All of the existing code used the callback though, so this doesn't fix
any bugs.

7 years agolib-ssl-iostream: Fix checking cert validity when handshake callback isn't used
Timo Sirainen [Tue, 31 Oct 2017 17:49:56 +0000 (19:49 +0200)] 
lib-ssl-iostream: Fix checking cert validity when handshake callback isn't used

7 years agolib-ssl-iostream: Split host to connected_host and sni_host
Timo Sirainen [Wed, 1 Nov 2017 10:58:46 +0000 (12:58 +0200)] 
lib-ssl-iostream: Split host to connected_host and sni_host

Using the same variable for both was causing confusion.

7 years agocassandra: Fix crash when using prepared statements
Timo Sirainen [Thu, 14 Dec 2017 18:56:36 +0000 (20:56 +0200)] 
cassandra: Fix crash when using prepared statements

Broken by cae3c6903c10682429f9849ab1a25093e3f538e4

7 years agodriver-cassandra: Free statement pool on update
Aki Tuomi [Thu, 7 Dec 2017 07:48:51 +0000 (09:48 +0200)] 
driver-cassandra: Free statement pool on update

Otherwise the pool memory will leak. This was happening with non-prepared
statements when version was older than 4.

7 years agodoveconf: add hostname to output
Jarkko Mourujärvi [Thu, 28 Dec 2017 11:53:14 +0000 (13:53 +0200)] 
doveconf: add hostname to output

7 years agolib-http: Only depend on iostream openssl lib if building with openssl
Aki Tuomi [Thu, 28 Dec 2017 08:47:28 +0000 (10:47 +0200)] 
lib-http: Only depend on iostream openssl lib if building with openssl

Fixes build without openssl

7 years agolib-storage: mail_storage_set_index_error() - handle NULL index error
Timo Sirainen [Mon, 25 Dec 2017 16:24:35 +0000 (18:24 +0200)] 
lib-storage: mail_storage_set_index_error() - handle NULL index error

This avoids assert-crashing later on in mail*_get_last_internal_error().

This could potentially be an assert instead of setting it as "BUG", but
it looks like there are various code paths in lib-index that return -1
without setting an error. (That's to avoid duplicate error logging,
although it could now be fixed with mail_index_set_error_nolog().)

7 years agolib-storage: Set index error on transaction commit() callback
Timo Sirainen [Mon, 25 Dec 2017 16:18:14 +0000 (18:18 +0200)] 
lib-storage: Set index error on transaction commit() callback

The commit callback is setting errors to storage. However, it's being
called from mail_index_transaction_commit() whose callers are expecting
the error to be in index. If that index error was attempted to be used,
it could have been wrong or NULL. Fix this by setting the same storage
error also to the index.

7 years agolib-index: Add mail_index_set_error_nolog()
Timo Sirainen [Mon, 25 Dec 2017 16:17:57 +0000 (18:17 +0200)] 
lib-index: Add mail_index_set_error_nolog()

7 years agolib-http: test-http-client - conditionally depend on openssl
Aki Tuomi [Thu, 7 Dec 2017 06:20:02 +0000 (08:20 +0200)] 
lib-http: test-http-client - conditionally depend on openssl

Fixes compiling without openssl, broken by c45da70c

7 years agolib: rename bswap_*() to i_bswap()
Josef 'Jeff' Sipek [Fri, 17 Nov 2017 16:37:45 +0000 (11:37 -0500)] 
lib: rename bswap_*() to i_bswap()

7 years agodoveadm-auth-server: Further fix json problems
Aki Tuomi [Wed, 15 Nov 2017 12:29:59 +0000 (14:29 +0200)] 
doveadm-auth-server: Further fix json problems

Remove excess comma from start, forgotten in 3e06a782584ea2c4ae2a8cb0451e9952f05f9dc8

7 years agodoveadm-auth-server: Send comma only if we are sending field too
Aki Tuomi [Wed, 15 Nov 2017 08:28:37 +0000 (10:28 +0200)] 
doveadm-auth-server: Send comma only if we are sending field too

Fixes json output

7 years agoman: doveadm proxy -a parameter doesn't support TCP sockets
Timo Sirainen [Thu, 9 Nov 2017 14:30:34 +0000 (16:30 +0200)] 
man: doveadm proxy -a parameter doesn't support TCP sockets

7 years agolib-master: Fix SSL_TXT_SSLV2 check in settings
Martti Rannanjärvi [Wed, 10 Jan 2018 10:26:10 +0000 (12:26 +0200)] 
lib-master: Fix SSL_TXT_SSLV2 check in settings

Include <openssl/ssl.h> in src/lib-master/master-service-ssl-settings.c
so SSL_TXT_SSLV2 is defined there when defined in the header.

7 years agodoveadm-server: Switch to TCP connection's ioloop while sending logs to remote
Aki Tuomi [Wed, 3 Jan 2018 15:26:38 +0000 (17:26 +0200)] 
doveadm-server: Switch to TCP connection's ioloop while sending logs to remote

Fixes:
Warning: I/O leak: 0x558d7c074ed0 (ostream-file.c:349, fd 16)
Panic: file ioloop.c: line 127 (io_remove_full): assertion failed: (io->callback != NULL)

7 years agoimapc: Add imapc_features=fetch-empty-is-expunged
Timo Sirainen [Mon, 30 Oct 2017 09:19:17 +0000 (11:19 +0200)] 
imapc: Add imapc_features=fetch-empty-is-expunged

When FETCH returns an empty mail, the mail is assumed to be expunged.

7 years agolib: include inttypes.h to get PRIu64 & friends
Josef 'Jeff' Sipek [Wed, 17 May 2017 07:35:03 +0000 (10:35 +0300)] 
lib: include inttypes.h to get PRIu64 & friends

Including it in lib.h allows all of the Dovecot code (as well as any
external plugins) to just use these macros without worrying about what
system headers to include.

7 years agocassandra: Include the used timestamp in logged queries
Timo Sirainen [Sat, 4 Nov 2017 12:33:52 +0000 (14:33 +0200)] 
cassandra: Include the used timestamp in logged queries

7 years agocassandra: Rename cassandra_sql_statement.pending_timestamp to just timestamp
Timo Sirainen [Mon, 6 Nov 2017 09:00:06 +0000 (11:00 +0200)] 
cassandra: Rename cassandra_sql_statement.pending_timestamp to just timestamp

7 years agolib: printf_format_fix*() - Support '*' in precision
Timo Sirainen [Thu, 19 Oct 2017 10:05:41 +0000 (13:05 +0300)] 
lib: printf_format_fix*() - Support '*' in precision

We're commonly using "%.*s"

7 years agolib: printf_format_fix*() - Move minimum field width check to its own function
Timo Sirainen [Thu, 19 Oct 2017 10:02:34 +0000 (13:02 +0300)] 
lib: printf_format_fix*() - Move minimum field width check to its own function

7 years agolib: printf_format_fix*() - Use the same 4 digits as maximum precision length
Timo Sirainen [Thu, 19 Oct 2017 10:26:27 +0000 (13:26 +0300)] 
lib: printf_format_fix*() - Use the same 4 digits as maximum precision length

I forgot the precision can also be used to truncate strings, not just
specify the precision for floating point numbers. So it makes more sense
that the limit is the same as for minimum field width.

7 years agolib: printf_format_fix*() - Be over-strict in what format strings are allowed
Timo Sirainen [Tue, 17 Oct 2017 14:39:32 +0000 (17:39 +0300)] 
lib: printf_format_fix*() - Be over-strict in what format strings are allowed

The checks could have been bypassed by some invalid format strings that were
handled differently by the printf_format_fix*() code and libc. For example
"%**%n" was passed through as ok, but glibc handled the %n in it.

Found by cPanel Security Team.

7 years agolib: fix illumos build issue
Josef 'Jeff' Sipek [Thu, 9 Nov 2017 15:52:12 +0000 (10:52 -0500)] 
lib: fix illumos build issue

The recent performance improvements to the net_addr2ip() code broke
build on illumos which has a 's_addr' #define in netinit/in.h.

7 years agodoveadm dump: Add "multiplex" dump type
Timo Sirainen [Fri, 22 Dec 2017 13:12:30 +0000 (15:12 +0200)] 
doveadm dump: Add "multiplex" dump type

This allows dumping all channels from istream-multiplex stream.

7 years agodoveadm dump: Allow doveadm_cmd_dump.test() to be NULL
Timo Sirainen [Fri, 22 Dec 2017 13:11:45 +0000 (15:11 +0200)] 
doveadm dump: Allow doveadm_cmd_dump.test() to be NULL

This means that there's no auto-detection for the dump type.

7 years agolib: istream-multiplex - Return error if the last packet wasn't fully read
Timo Sirainen [Fri, 22 Dec 2017 13:10:00 +0000 (15:10 +0200)] 
lib: istream-multiplex - Return error if the last packet wasn't fully read

7 years agodoveadm: Fix potential crash or reading garbage from doveadm-server
Timo Sirainen [Fri, 22 Dec 2017 13:07:28 +0000 (15:07 +0200)] 
doveadm: Fix potential crash or reading garbage from doveadm-server

The connection's input buffer may have been reallocated or otherwise moved
while checking for log input.

7 years agodsync: Add missing transaction flags when performing UID renumbering
Timo Sirainen [Wed, 9 Aug 2017 10:17:15 +0000 (13:17 +0300)] 
dsync: Add missing transaction flags when performing UID renumbering

The transaction didn't have MAILBOX_TRANSACTION_FLAG_SYNC or
MAILBOX_TRANSACTION_FLAG_NO_NOTIFY (with DSYNC_BRAIN_FLAG_NO_NOTIFY).

This caused replication-dsync to unnecessarily trigger another dsync
replication notification.

7 years agodsync: Add debug logging for .dovecot-sync.lock locking/unlocking
Timo Sirainen [Thu, 28 Dec 2017 08:27:27 +0000 (10:27 +0200)] 
dsync: Add debug logging for .dovecot-sync.lock locking/unlocking

7 years agodsync: Add per-mailbox sync lock that is always used.
Timo Sirainen [Thu, 28 Dec 2017 12:10:23 +0000 (14:10 +0200)] 
dsync: Add per-mailbox sync lock that is always used.

Both importing and exporting gets the lock before they even sync the
mailbox. The lock is kept until the import/export finishes. This guarantees
that no matter how dsync is run, two dsyncs can't be working on the same
mailbox at the same time.

This lock is in addition to the optional per-user lock enabled by the -l
parameter. If the -l parameter is used, the same lock timeout is used for
the per-mailbox lock. Otherwise 30s timeout is used.

This should help to avoid email duplication when replication is enabled for
public namespaces, and maybe in some other rare situations as well.

7 years agolib: Make file_lock_free(NULL) no-op
Timo Sirainen [Thu, 28 Dec 2017 17:40:29 +0000 (19:40 +0200)] 
lib: Make file_lock_free(NULL) no-op

7 years agoUpdated copyright notices to include the year 2018.
Stephan Bosch [Mon, 1 Jan 2018 21:42:08 +0000 (22:42 +0100)] 
Updated copyright notices to include the year 2018.

7 years agolib-storage: mailbox_list_index - Don't overwrite INBOX's flags with prefix/INBOX's
Timo Sirainen [Thu, 14 Dec 2017 00:11:28 +0000 (02:11 +0200)] 
lib-storage: mailbox_list_index - Don't overwrite INBOX's flags with prefix/INBOX's

This made the real INBOX appear as if it was \NoSelect

7 years agolib-storage: mailbox_list_index - indentation cleanup
Timo Sirainen [Thu, 14 Dec 2017 00:10:27 +0000 (02:10 +0200)] 
lib-storage: mailbox_list_index - indentation cleanup

7 years agolib-storage: mailbox_list_index - List prefix/INBOX if it necessary
Timo Sirainen [Wed, 13 Dec 2017 23:39:32 +0000 (01:39 +0200)] 
lib-storage: mailbox_list_index - List prefix/INBOX if it necessary

7 years agoLAYOUT=fs: Fix listing prefix/INBOX
Timo Sirainen [Wed, 13 Dec 2017 23:36:50 +0000 (01:36 +0200)] 
LAYOUT=fs: Fix listing prefix/INBOX

Removed some confusing special case code that didn't seem to work very well.
Implemented this now properly so that prefix/INBOX is listed as \NoSelect
mailbox whenever it has children.

It's not actually possible to differentiate between INBOX and prefix/INBOX
in the storage for a inbox=yes namespace, because they both are converted
into the same storage_name=INBOX.

7 years agoLAYOUT=fs: List INBOX as \NoInferiors when necessary
Timo Sirainen [Wed, 13 Dec 2017 23:34:25 +0000 (01:34 +0200)] 
LAYOUT=fs: List INBOX as \NoInferiors when necessary

7 years agoLAYOUT=index: List INBOX as \NoInferiors when necessary
Timo Sirainen [Wed, 13 Dec 2017 23:31:10 +0000 (01:31 +0200)] 
LAYOUT=index: List INBOX as \NoInferiors when necessary

7 years agoLAYOUT=Maildir++: List INBOX as \NoInferiors when necessary
Timo Sirainen [Wed, 13 Dec 2017 23:23:45 +0000 (01:23 +0200)] 
LAYOUT=Maildir++: List INBOX as \NoInferiors when necessary

7 years agolib-storage: Add mail_namespace_is_inbox_noinferiors()
Timo Sirainen [Wed, 13 Dec 2017 23:23:01 +0000 (01:23 +0200)] 
lib-storage: Add mail_namespace_is_inbox_noinferiors()

7 years agoimapc: Don't skip listing "INBOX" when INBOX/ namespace prefix is used.
Timo Sirainen [Fri, 8 Dec 2017 14:14:11 +0000 (16:14 +0200)] 
imapc: Don't skip listing "INBOX" when INBOX/ namespace prefix is used.

The INBOX was still listed as part of the autocreated mailboxes, unless
MAILBOX_LIST_ITER_NO_AUTO_BOXES was used.

7 years agopop3: Include mail user variables in logout format
Aki Tuomi [Mon, 4 Dec 2017 09:18:24 +0000 (11:18 +0200)] 
pop3: Include mail user variables in logout format

7 years agopop3: Simplify logout format variable handling
Aki Tuomi [Mon, 4 Dec 2017 09:15:15 +0000 (11:15 +0200)] 
pop3: Simplify logout format variable handling

7 years agoimap: Include mail user variables in logout format
Aki Tuomi [Mon, 4 Dec 2017 09:04:09 +0000 (11:04 +0200)] 
imap: Include mail user variables in logout format

7 years agoimap: Simplify logout format variable handling
Aki Tuomi [Mon, 4 Dec 2017 09:03:45 +0000 (11:03 +0200)] 
imap: Simplify logout format variable handling

7 years agolib-storage: Log an error when mailbox list index is rebuilt due to header fsck flag
Timo Sirainen [Wed, 29 Nov 2017 13:20:29 +0000 (15:20 +0200)] 
lib-storage: Log an error when mailbox list index is rebuilt due to header fsck flag

7 years agolib-storage: Rebuild list index when doing doveadm force-resync
Timo Sirainen [Wed, 29 Nov 2017 13:14:02 +0000 (15:14 +0200)] 
lib-storage: Rebuild list index when doing doveadm force-resync

7 years agoLAYOUT=index: Rebuild list index if INBOX is missing on inbox=yes namespace
Timo Sirainen [Wed, 29 Nov 2017 12:51:02 +0000 (14:51 +0200)] 
LAYOUT=index: Rebuild list index if INBOX is missing on inbox=yes namespace

This avoids having to manually rebuild the list index afterwards if it
becomes lost.

7 years agolib-storage: Add rebuild reason for mail_storage.list_index_corrupted()
Timo Sirainen [Wed, 29 Nov 2017 13:39:45 +0000 (15:39 +0200)] 
lib-storage: Add rebuild reason for mail_storage.list_index_corrupted()

This is done in a bit kludgy way to keep API backwards compatible.
v2.3 cleans this up.

7 years agolib-storage: Remove obsolete comment
Timo Sirainen [Wed, 29 Nov 2017 12:38:38 +0000 (14:38 +0200)] 
lib-storage: Remove obsolete comment

7 years agodirector: Fix logging disconnection error reasons
Timo Sirainen [Tue, 28 Nov 2017 17:01:19 +0000 (19:01 +0200)] 
director: Fix logging disconnection error reasons

The previous commit set errno=0, which weren't logged. If error string is
provided, it doesn't matter what the errno is set (as long as it's not 0),
so we'll just use EINVAL.

7 years agodirector: Log connection stats for all types of disconnections
Timo Sirainen [Tue, 28 Nov 2017 13:06:27 +0000 (15:06 +0200)] 
director: Log connection stats for all types of disconnections

7 years agodirector: Log whether connection is synced when it's being disconnected.
Timo Sirainen [Tue, 28 Nov 2017 12:57:27 +0000 (14:57 +0200)] 
director: Log whether connection is synced when it's being disconnected.

7 years agodirector: Fix crash when handling expired USER timestamps.
Timo Sirainen [Tue, 28 Nov 2017 11:10:35 +0000 (13:10 +0200)] 
director: Fix crash when handling expired USER timestamps.

The fix in 154f91726624265fce15097eb4bbbf6e55f8c477 wasn't complete.

7 years agolib-storage: Fix sorting mails with the same primary sort key
Timo Sirainen [Fri, 24 Nov 2017 10:31:22 +0000 (12:31 +0200)] 
lib-storage: Fix sorting mails with the same primary sort key

The sorting order may have been wrong when there was a combination of:
 * Messages were sorted by a string (e.g. Subject)
 * Some messages had the same sort key (e.g. same base subject)
 * Within the messages with the same sort key, some of the messages already
   had the "sort-*" index number in Dovecot indexes, but some of them
   didn't.

The result was that Dovecot found that the two messages had exactly the same
sort key. It should have continued with the secondary sort key (e.g.
message sequence number), but it didn't.

7 years agodirector: Fix logging of uninitialized PONG buffer size
Timo Sirainen [Mon, 27 Nov 2017 09:58:39 +0000 (11:58 +0200)] 
director: Fix logging of uninitialized PONG buffer size

PONG always has 0 or 2 parameters. The easiest fix here is to just not even
try to support 1 parameter.

7 years agodirector: Fix delayed request count in ps title after request timeouts
Timo Sirainen [Sun, 26 Nov 2017 21:00:30 +0000 (23:00 +0200)] 
director: Fix delayed request count in ps title after request timeouts

The timeouts weren't shrinking the delayed request count. This didn't cause
any other problems.

7 years agodirector: DIRECTOR-LIST - Return results sorted by host
Timo Sirainen [Sun, 26 Nov 2017 10:33:33 +0000 (12:33 +0200)] 
director: DIRECTOR-LIST - Return results sorted by host

7 years agodirector: DIRECTOR-LIST - Move connection/host output to their own functions
Timo Sirainen [Sun, 26 Nov 2017 10:26:27 +0000 (12:26 +0200)] 
director: DIRECTOR-LIST - Move connection/host output to their own functions

7 years agodirector: Make director_host_cmp_p() public
Timo Sirainen [Sun, 26 Nov 2017 10:36:54 +0000 (12:36 +0200)] 
director: Make director_host_cmp_p() public

7 years agodirector: Improve PING/PONG timeout errors and add new warnings
Timo Sirainen [Fri, 24 Nov 2017 16:46:19 +0000 (18:46 +0200)] 
director: Improve PING/PONG timeout errors and add new warnings

Log a warning if PING-PONG takes over 5 secs in total, or also if the
recipient notices that the PING took >= 5 seconds to receive.

7 years agodirector: Add director_ping_idle/max_timeout setting.
Timo Sirainen [Fri, 24 Nov 2017 16:22:04 +0000 (18:22 +0200)] 
director: Add director_ping_idle/max_timeout setting.

director_ping_idle_timeout is used when there's otherwise no input coming
from the connection. Changed its default from 10 secs to 30 secs.

director_ping_max_timeout is used when the other director keeps sending
input, but among it is no PONG reply.

7 years agodirector: Log exactly how long PING was waited on before it timed out.
Timo Sirainen [Fri, 24 Nov 2017 16:18:45 +0000 (18:18 +0200)] 
director: Log exactly how long PING was waited on before it timed out.

7 years agodirector: DIRECTOR-LIST - Add "ring " prefix to self's status
Timo Sirainen [Sun, 26 Nov 2017 10:20:26 +0000 (12:20 +0200)] 
director: DIRECTOR-LIST - Add "ring " prefix to self's status

This is to make it a bit easier to understand the difference between a
connection's "handshaking" state vs. "ring handshaking" state.

7 years agodirector: DIRECTOR-LIST - Show number of USERs sent/received in "handshaking" state
Timo Sirainen [Sun, 26 Nov 2017 10:19:36 +0000 (12:19 +0200)] 
director: DIRECTOR-LIST - Show number of USERs sent/received in "handshaking" state

7 years agodirector: Include number of users sent in handshake in disconnection log lines
Timo Sirainen [Sun, 26 Nov 2017 10:13:35 +0000 (12:13 +0200)] 
director: Include number of users sent in handshake in disconnection log lines

7 years agodirector: Show number of incoming USERs/sec in ps title
Timo Sirainen [Sun, 26 Nov 2017 01:45:00 +0000 (03:45 +0200)] 
director: Show number of incoming USERs/sec in ps title

7 years agodirector: Include number of USERs received in disconnection log lines
Timo Sirainen [Sat, 25 Nov 2017 21:28:12 +0000 (23:28 +0200)] 
director: Include number of USERs received in disconnection log lines

Separate handshake and refresh USERs.

7 years agodirector: Don't send USERs in handshake that were already sent between handshake
Timo Sirainen [Sat, 25 Nov 2017 08:01:31 +0000 (10:01 +0200)] 
director: Don't send USERs in handshake that were already sent between handshake

If the user was refreshed since the handshake was started, it means that
the same user was already sent to the other side (added to the stream
immediately after it was received/handled). There's no need to send it
again.

This fixes a potentally infinite handshake when users are rapidly changing
and the handshake iterator never sees the end of the list. (Each refreshed
user is moved to the end of the list, so handshaking can keep sending the
same user over and over again.)

7 years agodirector: Delay sorting users until there are no more user iterators
Timo Sirainen [Sat, 25 Nov 2017 08:05:27 +0000 (10:05 +0200)] 
director: Delay sorting users until there are no more user iterators

This shouldn't have normally happened. Only when an outgoing handshake was
going on at the same time as a) another outgoing handshake was going on, or
b) doveadm was doing HOST-RESET-USERS

7 years agodirector: Avoid USER loops with >1s ring latency also with old directors
Timo Sirainen [Sat, 25 Nov 2017 23:31:08 +0000 (01:31 +0200)] 
director: Avoid USER loops with >1s ring latency also with old directors

Do this by ignoring USER refreshes that were already updated recently.
The "recently" is calculated by director_user_expire/4 seconds ago, but
with an upper limit of 15 secs. This means that the USER loops can now
only exist if the director ring latency is above 15 seconds. (Once all
directors in the ring are running the new version, there's no looping
at any latency.)