Timo Sirainen [Thu, 15 Sep 2016 08:30:15 +0000 (11:30 +0300)]
lib: safe_mkstemp*() didn't always truncate prefix back to original on failure.
This caused repeated safe_mkstemp*() calls with the same prefix to keep
increasing its size. It probably didn't really break anything (unless it was
called enough many times to reach 255 filename length), but the filenames
were still confusingly ugly.
Timo Sirainen [Wed, 14 Sep 2016 11:19:39 +0000 (14:19 +0300)]
iostream-temp: If write() to temp file fails at any time, move it back to memory.
Similarly to if the write() to temp fails during the initial move attempt.
This way even if write() fails due to out of disk space, it's not visible
to caller. An error message is logged in any case.
index_storage_attribute_{set,get} should assume that the caller performed
due diligence and checked whether or not the user is allowed to store under
the key.
Stephan Bosch [Tue, 13 Sep 2016 20:54:02 +0000 (22:54 +0200)]
lib-http: client: Fixed hang occurring when nested ioloops are used in response callbacks.
To prevent missing disconnect events, i_stream_read() is called once a change in ioloop is detected.
However, if something was actually read into the stream, the input handler was never called.
So, a response could linger in the stream buffer, without being handled, thereby causing the connection to hang indefinitely.
An additional input event could end the hang, but sometimes this doesn't happen before the request times out.
This problem was seen in test-http-payload once in about 10 invocations.
Obox uses nested ioloops, to this applies there.
Timo Sirainen [Sat, 10 Sep 2016 08:28:38 +0000 (11:28 +0300)]
lib-lda: Cleanup error handling in LMTP client code.
If there are no successful recipients, we'll need to deinit the client.
But at that point we've already called all the callbacks, so the line
parameter to lmtp_client_fail_full() isn't actually used anywhere.
This was confusing static analyzer because global_fail_string was used
as parameter, which could have been NULL and wouldn't have been valid
for the callbacks.
Timo Sirainen [Tue, 13 Sep 2016 04:22:03 +0000 (07:22 +0300)]
imap, pop3: Added rawlog_dir setting to store IMAP/POP3 traffic logs.
This at least partially replaces the "rawlog" post-login binary. For now
the "rawlog" binary supports some parameters, which aren't configurable
for rawlog_dir.
Before this change, the argument parsing was busted. The --help string only
compounded the incorrect behavior by suggesting that --disable-hardening
could take a yes/no argument.
Phil Carmody [Mon, 5 Sep 2016 13:26:56 +0000 (16:26 +0300)]
plugins: fts - replace i_assert under _expunge_log_subtract with warning (API change)
The helper whose interface is changing currently has no other known
clients (there's little need for it to be exposed at all).
This should never happen, but if it does, just tally the number of times
it happened, and squirt out a warning message after the whole subtract.
If it happens at all, there's no reason not to expect a lot, so only
warn once per file.
In particular - do not assert crash when this is seen - it has been seen
on live test systems where file corruption seems to have occured. As
this can only be associated with corrupt fts indexes, seeing this error
implies that the whole FTS index should be rebuilt for that user.
Aki Tuomi [Wed, 10 Aug 2016 10:07:01 +0000 (13:07 +0300)]
lib-storage: Limit folder full name only
Before we had limit of 16 levels and 255 bytes per name
which is same as 4096 bytes. Now we limit only the total
length of the name to MAILBOX_LIST_NAME_MAX_LENGTH. For
compability reasons, we are restricting individual component
names to 255 characters.
Timo Sirainen [Thu, 8 Sep 2016 21:59:53 +0000 (00:59 +0300)]
lib-index: Fixed mail_index_modseq_get_next_log_offset() when accessing .log.2
file->sync_offset was set only after header, so sync_highest_modseq was also
same as initial_modseq. The previous code then just returned offset pointing
to sync_offset, which was too early.
Timo Sirainen [Thu, 8 Sep 2016 22:42:50 +0000 (01:42 +0300)]
imap-hibernate: Increased imap-master communication timeout from 5s to 30s
Looks like 5s isn't enough in loaded environments. It's also not really a
problem if the timeout is large, it's just going to take a while longer to
restore the connection. When timeout is reached the client would just get
disconnected anyway.
Aki Tuomi [Mon, 5 Sep 2016 12:56:05 +0000 (15:56 +0300)]
zlib-plugin: Check that UID is assigned
When caching, code has to check whether UID is
assigned to avoid reusing cache for different
email since they all have UID = 0 before they
are actually committed.
Timo Sirainen [Mon, 5 Sep 2016 23:56:39 +0000 (02:56 +0300)]
lib-dcrypt: Avoid infinite loop if istream header is too large.
We'll return an error now instead. We can't just return -2 here, because nothing
was actually being returned to the caller. Attempting to do that would just trigger
an assert:
Phil Carmody [Wed, 31 Aug 2016 17:14:41 +0000 (20:14 +0300)]
Fix control flow and T_BEGIN/T_END hygiene
You mustn't goto, break, continue, or return from out of a
T_BEGIN {...} T_END block, as that will lose a t_pop().
This has been seen in the wild: Panic: Leaked t_pop() call