Sergey Kitov [Mon, 19 Mar 2018 14:10:49 +0000 (16:10 +0200)]
global: Replace "if(auth_debug){i_debug(...)}" with e_debug(event, ...)
event is one of: global auth::auth_event,
auth_client_connection->event, auth_request->event,
login-common::event_auth. These event have category "auth".
Sergey Kitov [Mon, 19 Mar 2018 12:50:31 +0000 (14:50 +0200)]
global: Remove unnecessary checks for mail_debug and auth_request->debug
These checks are performed before calling auth_request_log_debug() and
push_notification_driver_debug(), while the same checks are performed
inside of these functions, and they return without doing anything.
Stephan Bosch [Sat, 26 May 2018 12:49:01 +0000 (14:49 +0200)]
lib-smtp: client: Avoid sending an XCLIENT command longer than 512 bytes.
Send several separate XCLIENT commands instead. This way, it complies with the
base SMTP line length limit and with Postfix' original specification for the
XCLIENT command.
With the XCLIENT fields that Dovecot currently uses, this is very unlikely to
happen. Still, this needs to be fixed to make things reliable.
Stephan Bosch [Sat, 26 May 2018 13:44:43 +0000 (15:44 +0200)]
lib-smtp: server: Provide full proxy data to the conn_proxy_data_updated() callback.
Before, it would only provide the fields that were updated, meaning that some
fields would remain unset, which caused problems for LMTP when more than one
XCLIENT command was sent or the ADDR field was not specified.
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.
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.