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 [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.
Timo Sirainen [Sun, 20 May 2018 15:20:47 +0000 (18:20 +0300)]
director: Make sure host's last_updown_change never shrinks.
Otherwise the ring might get into a loop where two HOST updates keep
fighting each others. This could probably happen if one update comes at
"desynced" state and other one in non-desynced state.
I'm not entirely sure if this is fixing such a loop or not, but it at least
shouldn't hurt.
Timo Sirainen [Sun, 20 May 2018 12:56:51 +0000 (15:56 +0300)]
lib-index: fsck: Fix small log offsets to file's correct header size
Use the file's actual current header size, not
MAIL_TRANSACTION_LOG_HEADER_MIN_SIZE, which is nowadays smaller. This
resulted in unnecessary errors like:
Timo Sirainen [Fri, 18 May 2018 09:47:02 +0000 (12:47 +0300)]
lib: Fix potential crashes when writing to log fails with EAGAIN
The ioloop may nowadays call ioloop context switch callbacks. Since log
writing can happen just about anywhere, the callbacks may be confused
and cause crashes or other weird behavior.
Even if the callbacks aren't called, all the extra code in ioloop can cause
potential problems. Especially any error logging in it wouldn't work properly
since it would just recurse back. So replace the ioloop code with just setting
the log fd to be blocking until the write succeeds.
This commit also removes comments about writes to a blocking terminal fd
causing EAGAINs. This seems unlikely. Probably I was just somehow
confused when originally seeing it and writing the code. If it actually
does happen now, it's still not breaking anything, but it could get into
a busy-loop of write()s constantly returning EAGAIN until they succeed.
Timo Sirainen [Fri, 18 May 2018 14:29:09 +0000 (17:29 +0300)]
lib: Linux, OSX, etc: Avoid race conditions showing \xAB chars in ps title
With bad luck "ps" reads the process title when it hasn't been fully
written. Since the trailing NULs are written last and the previous code kept
the ps title otherwise filled with \xAB chars, this could have caused ps
to sometimes show the process title filled with \xAB chars (visible as '?')
Stephan Bosch [Fri, 18 May 2018 13:56:15 +0000 (15:56 +0200)]
lib-http: client: Drop the ioloop switch callback before freeing the global client context.
This removes the possibility of recursion when the client context object somehow
triggers an ioloop switch (e.g., when debug logging starts blocking at that
inopportune moment).
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)
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.
lib-storage: Return correct root path for PATH_TYPE_ALT_MAILBOX
mailbox_list_set_get_root_path(..., MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX, ...)
must return one of three values:
1. if there is no alt storage, return NULL
2. if there is alt storage and MAILBOXDIR is set,
return ${alt_dir}/${mailbox_dir_name}
3. if there is alt storage but MAILBOXDIR is not set, return ${alt_dir}
Case number 3 was broken, and it mistakenly returned ${root_dir} - in other
words, it behaved as MAILBOX_LIST_PATH_TYPE_MAILBOX.
This correction changes the behavior, but this shouldn't cause
incompatibilities since:
1. it affects only storages that support alternate storage
2. it affects only configurations that use empty MAILBOXDIR
The only storage that supports alternate storage setting is dbox but dbox
defaults to MAILBOXDIR=mailboxes. Additionally, it appears to be impossible
to override it to an empty string (setting it to an empty strings causes
dbox to override it with the default - "mailboxes"). Therefore, nobody
should be affected by this change.
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.
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.
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.