Timo Sirainen [Sat, 14 Jan 2017 13:10:17 +0000 (15:10 +0200)]
lib-storage: Fix accessing the same "raw" mailbox multiple times in process.
If the same file was opened as the raw mailbox multiple times, the previous
mail_index was cached by mail-index-alloc-cache. Opening it the second time
already contained a mail in the index, so trying to add another one logged
an error:
Error: Log synchronization error at seq=1,offset=256 for (in-memory index): Append with UID 1, but next_uid = 2
Aki Tuomi [Thu, 5 Jan 2017 08:50:55 +0000 (10:50 +0200)]
lib-storage: Prevent recursion in header parsing
If header parsing error occurs and error handling tries
to get fields, such as Message-ID, it will cause
crash. This fixes problem by preventing reading from
non-cached headers while they are being parsed.
Timo Sirainen [Mon, 9 Jan 2017 20:39:09 +0000 (22:39 +0200)]
dict-client: When failing to resend commands after reconnect, their success is uncertain.
It's possible that the writes before the disconnection did actually finish
successfully. If any of them were commits, we need to return
DICT_COMMIT_RET_WRITE_UNCERTAIN.
Stephan Bosch [Fri, 30 Dec 2016 15:20:12 +0000 (16:20 +0100)]
lib-lda: Moved LMTP client to lib-smtp.
This makes the LMTP client available without dependency on lib-storage.
For Dovecot v2.3, the newly created lib-smtp will evolve into a full client/server SMTP implementation.
That will then remove the remaining SMTP code from lib-lda.
lib-mail: header filter should call callback for added EOH
If we add a EOH because there wasn't one and
HEADER_FILTER_ADD_MISSING_EOH was specified, we should invoke the
callback for it. Otherwise, it is unnecessarily difficult for consumers
to add a header since there is no way to know if EOH will be present
ahead of time.
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.