Timo Sirainen [Sun, 11 May 2014 18:08:51 +0000 (21:08 +0300)]
lib-mail: message_header_encode_[bq]() now explicitly takes the first line length parameter.
So this change partially reverts the previous change, because
message_header_encode() was actually internally relying on this behavior.
The explicit parameter makes it clearer.
Timo Sirainen [Sun, 11 May 2014 15:28:03 +0000 (18:28 +0300)]
lib-mail: message_header_encode() no longer tries to lookup the first line's length from output string.
This function is used only by Pigeonhole, which only uses it for empty
output strings, so it's not useful there. Also that behavior is somewhat
unexpected and confusing.
The pointer will never be NULL, as it's initialised pointing to an empty
string, and can only be overridden by setting it to another string. So
the test always failed. Instead, check the 1st character of the password.
Phil Carmody [Tue, 6 May 2014 09:44:38 +0000 (12:44 +0300)]
lib: cosmetic - rename parameters so that .h and .c files match
These functions were flagging sparse warnings, but those warnings are
trivially (robotically) dismissable if the parameters are identically
named in the two contexts. Opted for whichever name seemed to be more
meaningful or sensible. e.g. char** became p rather than s, as it's
a pointer more than a string.
Phil Carmody [Wed, 7 May 2014 13:52:22 +0000 (16:52 +0300)]
lib: a couple of trivial sparse cleanups
The #include isn't needed on modern linux, as the macros are already defined
The compiler seems to silently ignore redefinitions in system header files,
so didn't throw a warning, but probably should have, as redefinitions can lead
to insanity.
The cast just makes it explicit that we're changing the prototype.
Phil Carmody [Tue, 6 May 2014 15:10:55 +0000 (18:10 +0300)]
treewide sparse cleanup - make single-unit-only data static
Helps keep the global namespace clean. Not all the things suggested by
sparse have been moved. All DOVECOT_ABI_VERSION strings, and anything
replicated in all-settings.c by src/config/settings-get.pl has been
left untouched. Some of the latter could be moved, but the script would
need to be modified to replicate the 'static' (it outputs 'extern').
Timo Sirainen [Thu, 8 May 2014 10:45:37 +0000 (13:45 +0300)]
lib-storage: Code cleanups and potential crashfix.
Usually in blocks_count_lines() the full_input stream reading doesn't return
eof=true in the last read but only on the next. If this had changed for some
reason the code would have crashed in the assert checks.
Timo Sirainen [Thu, 8 May 2014 07:21:56 +0000 (10:21 +0300)]
run-test.sh: Valgrind version check was broken for v3.10+, removed it entirely.
RHEL 5.9 has valgrind v3.5 already, so there shouldn't really be any
important OSes using old valgrind that we need to support.
Timo Sirainen [Wed, 7 May 2014 16:47:12 +0000 (19:47 +0300)]
lib-imap: IMAP parser didn't parse atoms correctly that started with '~' character.
literal8 begins only after "~{", not immediately after "~" which is a valid
ATOM-CHAR.
Phil Carmody [Wed, 7 May 2014 15:39:23 +0000 (18:39 +0300)]
lib: fix md4/md5 buffer read overrun
uint_fast32_t may be 64 bits and read too many bytes at the end of the buffer.
This didn't actually break anything as long as there was 32 bits of readable
memory past the buffer.
Timo Sirainen [Wed, 7 May 2014 10:02:29 +0000 (13:02 +0300)]
liblib: Added unit test for hash methods to make sure they don't do read access beyond buffer.
This currently fails for MD4 and MD5, so they need to be fixed/replaced..
Timo Sirainen [Wed, 7 May 2014 09:26:38 +0000 (12:26 +0300)]
lib-compression: Fixed LZMA compression.
The code now looks more like the doc/examples/01_compress_easy.c distributed
with xz-utils. Most importantly this changes LZMA_OK to be allowed as a
result for lzma_code(zs, LZMA_FINISH).
Timo Sirainen [Mon, 5 May 2014 15:37:16 +0000 (18:37 +0300)]
mkdir_parents(): Handle mkdir() EEXIST errors that may happen during race conditions.
We don't care about EEXIST errors that happen when trying to mkdir() parent
directories, only if it happens when mkdir()ing the last directory.
Timo Sirainen [Mon, 5 May 2014 13:01:58 +0000 (16:01 +0300)]
lib-storage: mail_get_headers_utf8() now replaces NULs with spaces.
Perhaps there should also be another API function which actually allows
returning strings with NULs in them.
Timo Sirainen [Mon, 5 May 2014 12:05:20 +0000 (15:05 +0300)]
liblib: Added str_append_data(), which is simply a wrapper to buffer_append()
This is intended for appending data that may contain NUL characters that are
wanted to be added to the string.
Timo Sirainen [Mon, 5 May 2014 11:18:31 +0000 (14:18 +0300)]
imap: Brought back the original SEARCH PARTIAL code with the minor fix that it actually needed.
The new code in v2.2.11 was completely wrong. The code in previous commit
was broken with SORT. The original code was correct otherwise, except it
couldn't handle partial1 pointing past the valid range.
Timo Sirainen [Fri, 2 May 2014 10:36:00 +0000 (13:36 +0300)]
maildir: Returning mail's received/saved date or refcount was sometimes broken with zlib plugin.
If the value wasn't already cached and the same transaction also accessed
the message body, i_stream_stat() was used, which ended up to
i_stream_seekable_stat() due to caching the file, which didn't again fstat()
the actual maildir file but just used some internal values.
Timo Sirainen [Fri, 2 May 2014 08:40:05 +0000 (11:40 +0300)]
auth: Fixed userdb extra fields handling in passdb failure.
userdb prefetch -flag wasn't correctly set, causing the prefetch userdb in
some situations incorrectly either to be called or not be called.
This also fixes a crash when using userdb static and multiple passdbs. The
userdb_reply was set to NULL, which caused a crash later.
Timo Sirainen [Fri, 2 May 2014 08:12:58 +0000 (11:12 +0300)]
imap: Make sure we don't return empty "* n FETCH ()" reply, which violates RFC 3501 ABNF.
It happened only during error conditions, and it would be a bit too much
trouble to try to remove the reply entirely, so just append the message UID
there.
Timo Sirainen [Wed, 30 Apr 2014 14:37:43 +0000 (17:37 +0300)]
lib-storage: Partially reverted the mail.get_real_mail() API change for backwards compatibility.
I hadn't realized Pigeonhole was also using it. (I thought it was using only
the mail_get_real_mail() public API.) This fixes Pigeonhole v0.4.2 to work
again.
Timo Sirainen [Wed, 30 Apr 2014 03:08:46 +0000 (06:08 +0300)]
dsync: saved-date doesn't need to be looked up until mail body is being read.
This should improve the performance when the saved-date isn't already cached
or otherwise quickly accessible.
This change also makes dsync slightly incompatible with earlier versions.
When using dsync with an earlier version the saved-dates aren't synced. It
would be too much trouble to try to preserve full backwards compatibility,
especially because saved-date doesn't matter so much and isn't even visible
to IMAP clients.
Timo Sirainen [Tue, 29 Apr 2014 13:03:17 +0000 (16:03 +0300)]
lib-mail: istream-attachment-extractor handled mixed LFs vs CRLFs correctly.
Unless all the lines have the same newlines, the attachment can't be
recreated back exactly the same.
Timo Sirainen [Mon, 28 Apr 2014 17:14:03 +0000 (20:14 +0300)]
dsync: If incremental dsync finds that its state is stale, retry (later) with full sync.
This works only when the master itself notices such changes locally. Remote
changes aren't noticed, because the master doesn't send the state to remote
dsync and the master is also the one that decides which mailboxes are
synced. The fix to this probably means sending the state string to remote
dsync and have it check if the state is still valid (= protocol change).
Timo Sirainen [Mon, 28 Apr 2014 15:34:27 +0000 (18:34 +0300)]
doveadm replicator add <user mask> command added.
This allows quickly adding users from userdb that don't exist in replicator.
For example "doveadm replicator add '*'" adds all the new users from userdb.
This isn't really necessary though. Users will be automatically added as
soon as their mailboxes change in some way and replicator gets notified
about them.
Stephan Bosch [Sat, 26 Apr 2014 19:40:14 +0000 (22:40 +0300)]
lib-http: Fixed problem with connections idling indefinitely.
Forgot to check for idle connections when request finished after waiting
for payload to be read by application.