The counter was increased even if the UID was already in recent_flags.
This is the only place where I found that recent_flags and
recent_flags_count could become desynced (which they definitely were in
a core dump), so hopefully this fixes assert-crashes like:
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.
Timo Sirainen [Tue, 20 Sep 2016 15:08:10 +0000 (18:08 +0300)]
lib-dcrypt: Don't finalize encryption on o_stream_flush()
For example the default o_stream_uncork() implementation enforces flushing
and it's probably better not to change that. In general there's really no
reason to perform the finalization at flush when the stream can't be written
to anymore (whereas lib-compression ostreams allow writes after flushes).
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.
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.
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 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.
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.
Phil Carmody [Tue, 12 Jul 2016 10:28:54 +0000 (13:28 +0300)]
lib-test: enable naming of tests, such that only a subset is run
How to use these will become clear in a subsequent patch. Even if you
don't want to name tests, the macros can reduce redundancy in the code,
as the list of test function prototypes and the list of test functions
to call become the same lists, expanded through 2 different macros.
Phil Carmody [Wed, 1 Jun 2016 10:57:34 +0000 (13:57 +0300)]
lib-test: improve expected error handling
If we expect a specific error string, then when we see it, suppress it.
We do not suppress errors expected by count, because if we get unexpected
errors, then we do not want them suppressed, and we have no way of
distinguishing between the expected and unexpected errors.
This of course favours the use of the expected string version of the helper,
but alas that's not always usable, as you can only expect one at a time.
Additionally, if we failed to see an expected message, then when we no longer
expect to see it, reset the expected message state to not cascade further
test assertion failures.
Signed-off-by: Phil Carmody <phil@dovecot.fi>
Conflicts:
src/lib-test/test-common.c
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.