Timo Sirainen [Thu, 23 Aug 2018 11:33:59 +0000 (14:33 +0300)]
fts: Fix indexing mails with NULs in headers
After the first NUL all the rest of the string was converted to spaces.
This was broken already in the initial commit that attempted to fix this: 4d27f95c76bd008bb38f9c442567046da2b6ce14
Timo Sirainen [Fri, 17 Aug 2018 08:34:02 +0000 (11:34 +0300)]
lib: Mark signal waiting IO as "never wait alone"
This signal is being automatically moved to nested ioloops. It can't be the
only IO being waited, since there's no code that simply wants to wait for a
signal.
Stephan Bosch [Wed, 15 Aug 2018 22:42:50 +0000 (00:42 +0200)]
lib-smtp: client: Fix transaction state transition for the DATA command.
It progressed to the DATA state too early. By the looks of things, this only
affected the correctness of error and debug messages. It does not affect the
transaction itself.
The delay (previously 100ms, now 1s) is intended to delay our exit enough so
that the child processes have a chance to receive & handle the SIGQUITs we
just sent. If we don't wait long enough, it is possible that we'll get
restarted before our children had the chance to stop listening on their
sockets and we'll hit "address already in use" type errors.
Increasing the delay does not fix the issue, but it masks it better.
Timo Sirainen [Fri, 17 Aug 2018 11:39:41 +0000 (14:39 +0300)]
lib-storage: Fix NUL handling in mail_get_first_header*(), mail_get_headers*()
These functions return NUL-terminated values, so they got truncated whenever
a header value contained a NUL. Fix this by converting NULs to unicode
replacement characters in the output.
Stephan Bosch [Mon, 13 Aug 2018 17:23:31 +0000 (19:23 +0200)]
lib-http: test-http-client-errors: Make "peer reuse failure" test reliable.
It was highly timing-sensitive, since it required a particular error status to
be returned. Sometimes, it would yield a different error based on a
slightly different order of events, making the test fail. Such failures aren't
relevant though, since this regression test is about triggering a segfault that
used to occur.
Timo Sirainen [Mon, 6 Aug 2018 09:39:25 +0000 (12:39 +0300)]
imap: Fix command ambiguity checking with special plugins
If the tagged line is already sent, that command can't result in ambiguity
anymore.
A cleaner fix would be to add a new _WAIT_SYNC_OUTPUT state, but that
requires all the existing code to understand that new state correctly, so it
has a higher chance of breaking something. So at least for now don't add it.
Aki Tuomi [Mon, 30 Jul 2018 17:26:19 +0000 (20:26 +0300)]
lib-ssl-iostream: Make DH parameters optional
Since a lot of connections use elliptic curve
Diffie-Hellman these days, make it possible to
use dovecot without providing Diffie-Hellman
parameters. This reduces setup cost as the
parameters do not need to be generated, which
can be a time consuming task.
Timo Sirainen [Tue, 24 Jul 2018 12:00:19 +0000 (15:00 +0300)]
lib-imap: Remove content_subtype==NULL checks
This can never happen after the previous commit. This also changes the
BODYSTRUCTURE output for invalid Content-Types, but since they're invalid
anyway it doesn't really matter what the output is.
Timo Sirainen [Wed, 25 Jul 2018 10:17:45 +0000 (13:17 +0300)]
lib-storage: Fix bodystructure parsing crash if header is parsed twice
The second parsing will recreate the parser_ctx, discarding the old parsed
message_part.data for the header. On the second parsing
save_bodystructure_header=FALSE so the message_part.data isn't filled for
the header. Later on the bodystructure parsing assumes the data is set,
and crashes.
This only happened with mail_attachment_detection_options=add-flags-on-save
and Sieve script that first accessed a non-cached header and then used the
"body" extension.
Fixes segfault and also:
Panic: file imap-bodystructure.c: line 116 (part_write_body_multipart): assertion failed: (part->data != NULL)
Stephan Bosch [Fri, 6 Jul 2018 13:07:32 +0000 (15:07 +0200)]
lib-http: client: Notify host object about submission of request before submitting the request to the queue.
This makes sure the host idle timeout is stopped before the request is submitted
and the host object's refresh function is called. If the idle timeout is still
running at that point, the refresh function will return success without
performing a lookup, which can lead to a panic.
Timo Sirainen [Wed, 4 Jul 2018 09:45:39 +0000 (12:45 +0300)]
auth: Fix nonexistent passwd-file error handling
If the path uses %variables, the missing file was logged with info-level,
but it was still returning tempfail as the result. Return "user doesn't
exist" instead.
Timo Sirainen [Fri, 6 Jul 2018 08:25:07 +0000 (11:25 +0300)]
lib-ssl-iostream: Shutdown connection cleanly whenever i/ostream is destroyed
Do this while both istream and ostream still exist. Fixes crash where
openssl_iostream_destroy() attempts to flush the shutdown, but ssl_input
is NULL and it crashes.
lib: Make sure exactly one of _ILP32 and _LP64 is defined at all times
These defines are very common, but not universal. For example, clang on
illumos and FreeBSD always defines one of them, while 32-bit Ubuntu 16.04
doesn't define either.
Timo Sirainen [Fri, 29 Jun 2018 11:37:36 +0000 (14:37 +0300)]
director: Fix assert-crash when doveadm disconnects immediately after sending command
Any command that requires a ring sync should cause the doveadm connection to
wait until the ring is synced. However, if the disconnection happened early
enough the connection is deinitialized before the ring sync is finished.