Timo Sirainen [Tue, 6 Feb 2018 15:35:18 +0000 (17:35 +0200)]
lib: Add file_lock_from_dotlock()
The dotlock creation requires various settings, so the file-lock.h API can't
easily be used to create it. But once created, it's simpler to keep all lock
types in the same struct file_lock, which can be unlocked/freed once
finished.
Timo Sirainen [Mon, 5 Feb 2018 20:21:13 +0000 (22:21 +0200)]
fts: Don't reindex FTS mails if .cache file is deleted
This means that if fts is enabled, "doveadm index" no longer adds mails
to dovecot.index.cache if it's deleted. However, it was rarely used for
that purpose. More likely due to a corrupted cache file all the mails were
unnecessarily being opened and reindexed.
Timo Sirainen [Mon, 5 Feb 2018 21:54:33 +0000 (23:54 +0200)]
fts: Fix searching headers with TEXT/BODY
TEXT is searching headers and BODY is searching MIME headers. Those headers
were indexed with data language, so search must also include data language
when looking up words. We'll just include the data language for all
searches now, so it should always work correctly.
Stephan Bosch [Wed, 31 Jan 2018 23:08:40 +0000 (00:08 +0100)]
lib-mail: message-address: Add support for parsing RFC5322 "path" syntax.
This is either a single angle-addr or just <>. This path syntax differs from the
RFC5321 "Path" syntax in that it allows whitespace, which is very important when
it is parsed from a header.
Stephan Bosch [Wed, 31 Jan 2018 09:27:54 +0000 (10:27 +0100)]
lmtp: local: Use recipient index in lmtp_local_rcpt_reply_overquota().
When used during the DATA command, it should send a reply for the correct
recipient. During the RCPT command there is only one reply due. Added assert
that checks this.
Stephan Bosch [Wed, 31 Jan 2018 09:34:11 +0000 (10:34 +0100)]
lmtp: local: Add explicit cmd parameter to lmtp_local_rcpt_reply_overquota().
Using the RCPT cmd is only valid for the RCPT command and not when quota excess
is detected during DATA. That would cause a segmentation fault, since
rcpt->rcpt.rcpt_cmd == NULL.
imap: Iterate over ns settings when deciding to add SPECIAL-USE capability
To determine whether we should add the SPECIAL-USE capability to the
OK response to LOGIN, we have to iterate over namespace and mailbox
*settings* since the namespaces haven't been set up yet.
Phil Carmody [Tue, 30 Jan 2018 12:14:42 +0000 (14:14 +0200)]
lib/randgen - warn when DOVECOT_SRAND is not able to be used
As suggested by Jeff, it's friendly to warn if we're unable to act
upon the request for reproduceable random numbers because we're not
built for that.
Note, this deliberately permits a blank string, so that you can
silence the warning by prefixing a command with an empty
DOVECOT_SRAND=
which is taken as an explicit attempt to disable use of the feature.
Phil Carmody [Tue, 30 Jan 2018 11:47:18 +0000 (13:47 +0200)]
lib/randgen - always print the DOVECOT_SRAND seed, not just on fatals
Devs might want to reproduce "working" pathways that show slight
misbehaviour, not just crashing ones. The later print upon a crash/
fatal is left in, as the heads of logs can become separated from the
tails of logs quite easily, it's only one extra line per run.
Phil Carmody [Tue, 30 Jan 2018 16:48:51 +0000 (18:48 +0200)]
lib/randgen - use KISS as intended, not as originally posted to sci.crypt
The original KISS, as posted to sci.crypt, had a SHR3 component with
short cycles. The buggy version contradicted Marsaglia's original
cycle length claim, and it had already been fixed in KISS11, so it's
fair to assume this was always the intended implementation.
For details see G. Rose "KISS: A Bit Too Simple".
Whilst dealing with that issue, fix seeding so w and z can't both
be short (length 2) cycles, as also pointed out in the Rose paper.
Stephan Bosch [Mon, 29 Jan 2018 18:10:38 +0000 (19:10 +0100)]
doveadm: dsync: Switch ioloop for input/output streams while making TCP connection.
This task is performed in a sub-ioloop, and when returning from that ioloop, the
output stream would sometimes still have an object on the sub-ioloop that was
just destroyed.
Stephan Bosch [Mon, 29 Jan 2018 17:28:25 +0000 (18:28 +0100)]
lib-ssl-iostream: openssl: Make verbose logging robust against i_debug() writing to stream itself.
In dsync, i_debug() is overridden to write to the SSL stream itself through a
multiplexed data stream. So, during the i_debug() call all kinds of things can
happen to the persisted error string in the stream, which caused problems.
Stephan Bosch [Mon, 22 Jan 2018 22:43:18 +0000 (23:43 +0100)]
lib-program-client: Flush/finish the output stream after o_stream_send_istream().
There may still be data in the output stream buffer. Failing to flush this
leads to truncated output. For the output towards the program o_stream_finish()
is used, since there may be an ostream_dot in between (or something else for
future features).
Stephan Bosch [Wed, 24 Jan 2018 00:09:16 +0000 (01:09 +0100)]
lib-program-client: remote: Don't change exit_code in program_client_remote_disconnect() when program_input is already NULL.
When the program_input is NULL, the stream is finished, meaning that the
exit_code is set based on the return code. There can be a program_input for
remote streams, even when the program produces no output.
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.
lib: cast {,CONST_}PTR_OFFSET's offset argument to size_t
This fixes build on 32-bit systems where the addition may cause integer
promotion to an integer type larger than uintptr_t.
gcc 6.3.0 warning:
file-cache.c: In function 'file_cache_write':
macros.h:25:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
((void *) (((uintptr_t) (ptr)) + (offset)))