Timo Sirainen [Mon, 19 Dec 2016 13:31:50 +0000 (15:31 +0200)]
lib-index: Fix assert-crash if .log creation unexpectedly fails at the end
Pretty much the only reason for this to happen is if the index directory
was deleted while another process still had the index open. Even this
doesn't normally trigger this crash, because there are other checks earlier
that usually catch it. So it crashes only in some race conditions.
Fixes:
Error: rename(.../dovecot.index.log.newlock, .../dovecot.index.log) failed: No such file or directory
Panic: file mail-transaction-log-file.c: line 105 (mail_transaction_log_file_free): assertion failed: (!file->locked)
Stephan Bosch [Fri, 16 Dec 2016 22:36:19 +0000 (23:36 +0100)]
lib-http: client: Treat connections that get disconnected prematurely as connection failures.
This means that the backoff time is increased when this happens.
A premature disconnection happens when the connection is disconnected before any data is received from the server.
Timo Sirainen [Thu, 15 Dec 2016 15:36:39 +0000 (17:36 +0200)]
imapc: Don't retry a failed reconnection before 10 secs have passed
This mainly avoids a lot of unnecessary connect attempts within a short
time period, for example if the caller attempts to perform some work for
all the mailboxes.
Timo Sirainen [Mon, 12 Dec 2016 05:19:55 +0000 (07:19 +0200)]
global: Change string position/length from unsigned int to size_t
Mainly to avoid truncating >4GB strings, which might potentially cause
some security holes. Normally there are other limits, which prevent such
excessive strings from being created in the first place.
I'm sure this didn't find everything. Maybe everything could be found with
compiler warnings. -Wconversion kind of does it, but it gives way too many
unnecessary warnings.
Timo Sirainen [Mon, 12 Dec 2016 01:55:54 +0000 (03:55 +0200)]
lib: Remove t_buffer_*_type()
The t_buffer_*() shouldn't normally be used anyway except in some low-level
string/buffer manipulation code, so there's not much point in trying to make
easier to use versions of them.
Timo Sirainen [Thu, 15 Dec 2016 17:03:39 +0000 (19:03 +0200)]
director: Fix USER-KICK and USER-KICK-ALT forwarding
The internal IPC command was prefixed, which caused the remote director
to reject the commands and disconnect:
director(...): Command proxy: Unknown command proxy
director(...): Remote sent invalid protocol data recently, waiting 57 secs before allowing further communication
Timo Sirainen [Thu, 15 Dec 2016 13:20:02 +0000 (15:20 +0200)]
lib-storage: Fix "*" in SEARCH seqset/uidset
4294967295 is used for "*", which matches the last existing message.
Which we don't know what it is at the time of search args simplification,
so avoid making any assumptions about it.
It's a bit ugly that 4294967295 can't be used as a valid UID, but this
restriction has already existed since the beginning of Dovecot. A future
alternative might be to add MAIL_SEARCH_ARG_FLAG_SEQSET_WITH_STAR, but
that's a bit complicated change.
Aki Tuomi [Wed, 14 Dec 2016 09:42:56 +0000 (11:42 +0200)]
auth-policy: Allow unsupported attributes in response
Do not choke if we receive unsupported attributes in
response. This allows better interoperability with
different systems that are getting signals from
auth policy server that are not (yet) supported by
dovecot.
This needs to be silenced since it's logging errors of variable
expansions that are not meant to be successful. The function is used
here just for filling the attr_names array in ldap_field_find_context
and the resulting string is not used.
Stephan Bosch [Wed, 14 Dec 2016 01:51:54 +0000 (02:51 +0100)]
lib-imap: imap-bodystructure: Prevent writing erroneous whitespace between items in an envelope address list.
Both imap_bodystructure_write() and imap_body_parse_from_bodystructure() produced such invalid output.
This caused an RFC 3501 violation in IMAP FETCH BODY and BODYSTRUCTURE responses.
Timo Sirainen [Tue, 13 Dec 2016 12:51:20 +0000 (14:51 +0200)]
acl: Don't set acl_defaults_from_inbox=yes as default after all.
Reverts b56d462fff46511b7efa0ccf254ba93d72322920 and removes the FIXME.
Some people might actually want to give someone else access to their INBOX
but not to all the other mailboxes. We should make it possible to use the
"" mailbox name as the default ACL instead.
Timo Sirainen [Mon, 12 Dec 2016 10:37:34 +0000 (12:37 +0200)]
dsync: Fix .dovecot-sync.lock timeout checking
Whenever the lock file was recreated, the lock timeout was reset. Switched
to using file_create_locked(), which already solves this problem and has
compatible locking.
Paul Howarth [Mon, 5 Dec 2016 15:17:30 +0000 (15:17 +0000)]
configure: Fix some implicit function declarations
Some configure tests fail unexpectedly if the compiler flag
-Werror=implicit-function-declarations is enabled, which can result
in the wrong implementations being used.
This compiler flag is now enabled by default in Fedora Rawhide:
https://fedoraproject.org/wiki/Changes/Fedora26CFlags
<stdlib.h> is needed for exit()
<string.h> is needed for strcpy()
manuel [Wed, 7 Dec 2016 13:23:12 +0000 (14:23 +0100)]
openssl: Clear error queue after an incomplete SSL_shutdown
If the SSL_shutdown-call fails (e.g. because the underlaying socket has
already been closed) OpenSSL puts the corresponding error into the
queue. We don't care about details so we need to clear the queue.
Otherwise the error will be pulled while error checking the next OpenSSL
call of an unrelated connection.
Timo Sirainen [Fri, 9 Dec 2016 13:06:05 +0000 (15:06 +0200)]
imapc: Don't send NOOP immediately after SELECT
NOOP is normally used by mailbox syncing to check if there are any changes
done by other concurrent IMAP sessions. But doing it immediately after
SELECT is unnecessary, because nothing could have changed.