Stephan Bosch [Tue, 6 Mar 2018 22:11:32 +0000 (23:11 +0100)]
lib-storage: mail-storage-settings: Pre-parse postmaster_address as an SMTP address.
The pre-parsed address is not currently used anywhere, but this does check that
the postmaster address can successfully be converted to an SMTP address, which
is important for Pigeonhole.
Stephan Bosch [Tue, 6 Mar 2018 20:43:22 +0000 (21:43 +0100)]
lib-smtp: address: Add source syntax check for conversion from RFC5322 addresses.
The message-address parser (for RFC 5322) allows UTF-8 characters in the
localpart, which is not acceptable for SMTP addresses. This change adds a check
that determines whether the source RFC5222 address can be converted into a
SMTP address.
This allows making SMTP client connections without performing a DNS lookup. The
optional hostname parameter is used to verify the hostname in the SSL
certificate from the server, if any.
Timo Sirainen [Sun, 25 Mar 2018 20:15:58 +0000 (23:15 +0300)]
imapc: Fix local state if mailbox is empty after reconnection
If local indexes had more than 0 mails, but after reconnection the remote
IMAP server replied with "* 0 EXISTS", the mails in local index weren't
expunged. This could have resulted in:
Timo Sirainen [Thu, 15 Mar 2018 11:19:53 +0000 (13:19 +0200)]
imapc: Update mail size also when RFC822.SIZE is smaller than fetched header size
If this isn't done, istream-mail will detect that the fetched header is
larger than RFC822.SIZE and fail with "Cached message size smaller than
expected"
Timo Sirainen [Thu, 15 Mar 2018 10:20:14 +0000 (12:20 +0200)]
imapc: Update mail size also when istream_opened() hook is called
When fetching a message body the cached message size was set. However,
if istream_opened() hook was used this wasn't done. If a client had
fetched both (RFC822.SIZE BODY.PEEK[]) and the server sent a wrong
RFC822.SIZE, that size was used for the message body size, which resulted
in "Cached message size larger than expected" errors.
Stephan Bosch [Tue, 27 Feb 2018 22:13:33 +0000 (23:13 +0100)]
lmtp: proxy: Use per-connection SMTP client settings.
This is needed for setting source IP in later change. The peer_trusted setting
must me moved, since this setting is overriden by per-connection settings,
rather than merged.
Stephan Bosch [Sun, 24 Dec 2017 13:35:15 +0000 (14:35 +0100)]
lib-smtp: client: Fix rawlog input stream inconsistency by updating streams right after initializing TLS.
Restructured the code to call a new function called smtp_client_connection_streams_changed() which performs all the necessary updates.
Before, enabling rawlog could break the TLS handshake.
Timo Sirainen [Thu, 8 Feb 2018 11:27:25 +0000 (13:27 +0200)]
lib-http: client: Fix using non-context SSL settings
The SSL settings were used for the SSL context, but they weren't used for
individual SSL streams. This broke stream-only settings, like
allow_invalid_cert=TRUE.
Stephan Bosch [Tue, 6 Mar 2018 21:11:34 +0000 (22:11 +0100)]
lib-lda: Do not convert "From:" message address to STMP address, just to make a string for logging.
This leads to problems when the message address (RFC5322) has UTF-8 code points
in the local part, which is (currently) allowed for message addresses, but not
for SMTP addresses (RFC5321).
Stephan Bosch [Mon, 5 Mar 2018 20:02:49 +0000 (21:02 +0100)]
submission: Limit the set of capabilities to those that are actually supported.
Particularly, the XCLIENT capability was inappropriately enabled when the
backend MTA announced support. XCLIENT is not supported by Dovecot post-login.
Stephan Bosch [Sat, 23 Dec 2017 21:49:57 +0000 (22:49 +0100)]
lib-smtp: client: Fix smtp_client_command_name_equals() to work properly after the command is submitted.
At command submission, CRLF is appended to command data. This messed up the name comparison.
This in turn caused a spurious QUIT command to be sent to the server at connection close.
Stephan Bosch [Sat, 23 Dec 2017 21:14:16 +0000 (22:14 +0100)]
lib-smtp: client: Make smtp_client_connection_commands_abort() more reliable by copying the command lists.
Copy the current lists of queued and waiting commands and reference each command before calling smtp_client_command_abort().
Aborting one command can cause other dependent commands to be aborted (in a transaction or from submission service), which could have caused trouble in this function.
Stephan Bosch [Sat, 23 Dec 2017 21:04:13 +0000 (22:04 +0100)]
lib-smtp: client: Make smtp_client_connection_commands_fail_reply() more reliable by copying the command lists.
Copy the current lists of queued and waiting commands and reference each command before calling smtp_client_command_fail_reply().
Failing one command can cause other dependent commands to be aborted (in a transaction or from submission service), which could have caused trouble in this function.
Problems would likely occur at connection disconnect.
Stephan Bosch [Sun, 4 Mar 2018 22:35:53 +0000 (23:35 +0100)]
lib-smtp: server: Fix double decrement of RCPT pending counter upon error.
The pending counter was sometimes decremented twice in specific error
conditions, leading to an assert panic in the DATA command. This was caused by
some dead code. If the MAIL command failed in a pipeline before the RCPT command,
the assert was triggered.
Stephan Bosch [Wed, 31 Jan 2018 23:08:40 +0000 (00:08 +0100)]
lib-mail: message-address: Add support for parsing RFC5322 "path" syntax.
This is either a single angle-addr or just <>. This path syntax differs from the
RFC5321 "Path" syntax in that it allows whitespace, which is very important when
it is parsed from a header.