Stephan Bosch [Mon, 26 Sep 2016 19:04:44 +0000 (21:04 +0200)]
lib: uri-util: Implemented API to check generic URI syntax.
This allows checking whether something is a valid URI of any type.
This change adds a test suite for the generic URI syntax, which is currently the main purpose of the API addition.
Apart from a few simple vality checks, the test suite also tests various URI examples from RFCs.
Timo Sirainen [Fri, 30 Sep 2016 10:04:48 +0000 (13:04 +0300)]
lib-test: Allow test_istream_set_*() for test-istream's children.
It will internally find the test_istream from parents. This simplifies the
testing code so that it doesn't have to keep track of both the test_istream
and the final istream.
Timo Sirainen [Thu, 29 Sep 2016 11:15:32 +0000 (14:15 +0300)]
lib-storage: Don't reset mail_save_context.saving too early.
If mailbox_save_using_mail() ended up in mail_storage_copy(), saving was set
to FALSE before the copy() method was finished running. This caused e.g.
notify plugin to think that this was a copy event instead of a save event.
Added comments and asserts to clarify how the logic should work between
all the different copying/moving/saving flags.
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:
Timo Sirainen [Mon, 26 Sep 2016 12:38:27 +0000 (15:38 +0300)]
dict-client: Fixed lock and ioloop wait timings in log messages.
Previously it was logging the total amount of time spent on lock waits or on
ioloop during the existence of the entire process, rather than how much time
the command itself was spending on those. This wasn't very useful.
Now it also tries to separate the time spent on the main ioloop and in
dict_wait().
Timo Sirainen [Mon, 26 Sep 2016 13:34:23 +0000 (16:34 +0300)]
dict-client: Remove timeout when there are only background commands.
Normally the timeout wasn't added in the first place, but it was if a
non-background command was added first and it was followed by a background
command.
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.
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.