Timo Sirainen [Tue, 5 Jun 2018 10:25:30 +0000 (13:25 +0300)]
lib: Add i_stream_nonseekable_try_seek()
This can be used by istreams to more easily implement seeking backwards when
it has to be done by first seeking back to offset 0 and reading from there.
Stephan Bosch [Fri, 18 May 2018 08:24:46 +0000 (10:24 +0200)]
lib-smtp: client: Fix assertion panic occurring when DATA dot stream cannot be finished immediately.
If o_stream_finish() returns 0, o_stream_send_istream() would be called again
later which causes the panic. Instead, it should only call o_stream_finish() or
o_stream_flush() again to finish the last bit of the output.
Panic was:
Panic: file ostream.c: line 394 (o_stream_send_istream): assertion failed: (!_outstream->finished)
Stephan Bosch [Mon, 14 May 2018 21:56:21 +0000 (23:56 +0200)]
lmtp: Fix segfault occurring when a user turns out to be over quota at DATA transfer.
The LMTP recipient context was not updated with the final recipient address when
the RCPT command was accepted. This left a dangling struct smtp_address pointer
which triggered the segfault when used.
Bill Cole [Mon, 26 Mar 2018 04:52:06 +0000 (00:52 -0400)]
Fix arc4random build checks
The configure script checks for arc4random() but the actual code uses
arc4random_buf(). This breaks for FreeBSD <8.0 and MacOS X <10.7, which
have the former but not the latter. This change (and an autoreconf run)
solves the problem at the cost of not using the available ARC4
implementation.
Stephan Bosch [Wed, 23 May 2018 13:54:53 +0000 (15:54 +0200)]
lib-smtp: server: Fix the enforcement of the maximum DATA command message size.
The global setting from the server object was used, rather than the
per-connection setting. The latter is usually the one that is properly set,
while the global server setting is left at zero. For LMTP this meant that the
40 Mb implicit limit was still in force.
Stephan Bosch [Wed, 4 Apr 2018 22:34:49 +0000 (00:34 +0200)]
lib-smtp: server: Fix error message logged for errors occurring in data wrapper stream during DATA transfer.
Used the connection stream rather than the data stream to obtain the error.
Obviously, there is no error on the low-level connection when there is a data
istream (e.g. message size) error.
Stephan Bosch [Tue, 22 May 2018 07:42:00 +0000 (09:42 +0200)]
lib: Define NET_BLOCK_SIZE.
This defines the default size for data blocks transferred over the network. It
should be large enough to guarantee filling up the TCP window (for efficiency),
while still preventing sending much data while the peer has already rejected
the rest of the transfer.
Stephan Bosch [Sat, 26 May 2018 11:12:26 +0000 (13:12 +0200)]
lda: Allow -f sender to omit domain.
Several people complained about the original enforcement of the presence of a
domain (added for v2.3.0) to be too restrictive. Apparently, this legitimately
happens with bounce messages on certain platforms.
Timo Sirainen [Thu, 3 May 2018 14:06:04 +0000 (17:06 +0300)]
cassandra: Use fallback_consistency on more types of errors
This could allow for example read_consistency=local-quorum with
read_fallback_consistency=quorum, so most of the time the reads are
from local datacenter, but in case it has problems you can switch to
other datacenters.
Timo Sirainen [Tue, 15 May 2018 14:50:27 +0000 (17:50 +0300)]
fs-posix: Strip trailing "/" from filenames
This is mainly because "doveadm fs delete -R" adds it to indicate to the
fs-driver that the whole directory is wanted to be deleted. This change
fixes fs-posix to work with NFS, where otherwise unlink("symlink-to-dir/")
fails with ENOTDIR. Without NFS the same call succeeds.
mdbox: Assume that empty uid maps found during sync are harmless
Instead of failing the sync and causing index rebuild, just skip over
the empty uid maps. Chances are that they these records came from
various plugins that create fake mails.
This was done to call extension record sync handlers, but the previous
commit removes them. Fixes a problem where obsolete cache offsets were
used in some situations:
- Some cache updates are from external transactions and some are from
non-external transactions. This is because cache offset updates are being
added by whatever the parent index transaction is.
- When mail_index_sync_map() is mapping MAIL_INDEX_SYNC_HANDLER_FILE, it
has already synced the map. But it's calling mail_index_sync_record()
for non-external transactions to call expunge handlers and extension
update handlers. It's calling the regular mail_index_sync_record() to do
this work.
- But mail_index_sync_record() is actually still updating the map. So now
mail_index_sync_record() is called for all non-external cache updates,
but not for external cache updates! And since these are somewhat
randomly either external or non-external, the end result is that the
cache offset may be obsolete.
Timo Sirainen [Thu, 12 Apr 2018 11:27:50 +0000 (14:27 +0300)]
lib-smtp: Fix empty address parsing
sret wasn't initialized, which could have randomly caused "Path only
consists of source route" error with empty addresses. Broken by 81c8955e3d1475c6ab1892b1d3edf91126683fda
Stephan Bosch [Sun, 8 Apr 2018 13:53:37 +0000 (15:53 +0200)]
submission: Add workarounds for well-known MAIL and RCPT command syntax deviations.
This adds a new `submission_client_workarounds' setting that works analogous to
the `imap_client_workarounds' setting.
Workarounds:
- whitespace-before-path: Allow one or more spaces or tabs between `MAIL FROM:'
and path and between `RCPT TO:' and path.
- mailbox-for-path: Allow using bare Mailbox syntax (i.e., without <...>)
instead of full path syntax.
Stephan Bosch [Sat, 14 Apr 2018 00:05:51 +0000 (02:05 +0200)]
lib: Implement str_sanitize_utf8().
Unlike str_sanitize(), this function truncates strings based on a UTF8 code point
limit rather than a maximum size in bytes. Also, the Unicode replacement
character is used to mark invalid/control characters and an ellipsis character
is used to indicate the string truncation. For the normal str_sanitize() this is
done using a question mark and triple dots respectively.