Timo Sirainen [Thu, 15 Feb 2018 16:16:15 +0000 (18:16 +0200)]
imap: Don't set storage callbacks before namespaces are created
This fixes sending untagged OK/NO notifications from storage (e.g. lock
waits/override notifications). It was broken by e031d9aaae59a9f79710dc1138b76b69272615a3
index-mail.c:1182:3: warning: arithmetic on a null pointer treated as a cast
from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
message_parser_parse_body(data->parser_ctx,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/lib-mail/message-parser.h:95:28: note: expanded from macro
'message_parser_parse_body'
(void *)((char *)context + CALLBACK_TYPECHECK(callback, \
~~~~~~~~~~~~~~~ ^
Stephan Bosch [Wed, 14 Feb 2018 21:20:20 +0000 (22:20 +0100)]
lib-smtp: server: Fix segfault occurring when XCLIENT command is handled.
Occurs only when the application (in this case LMTP) has a
conn_proxy_data_updated() callback. The context parameter was the struct
smtp_server_connection object itself, rather than the application context. This
caused the connection object to be overwritten.
Stephan Bosch [Tue, 13 Feb 2018 20:19:18 +0000 (21:19 +0100)]
lib-imap-storage: imap-msgpart-url: Perform the check for a proper messagepart URL in imap_msgpart_url_create().
Before, this was an assert in imap_msgpart_url_create(). The actual check was
performed only in imap_msgpart_url_parse(), meaning that
imap_msgpart_url_create() would fail with an assertion when provided with an
inappropriate URL.
This surfaced as a problem for the submission BURL command.
Timo Sirainen [Thu, 8 Feb 2018 15:14:53 +0000 (17:14 +0200)]
lib-storage: Include mail-index.h from mail-storage.h
This makes it a bit more acceptable to use mail-index.h API, without having
to go through the lib-storage layer. This is also needed by the next patch
to avoid duplicating the same enum in both lib-index and lib-storage layer.
Nothing cares about them. It was only set for POP3 UIDL change with
Maildir. In theory dsync replication would want to replicate such a change,
but it doesn't actually support changing UIDLs for existing mails. Other
mailbox formats don't support it anyway.
Timo Sirainen [Wed, 7 Feb 2018 11:03:23 +0000 (13:03 +0200)]
master: Add default_internal_group setting, defaulting to "dovecot"
It's expected that this is the primary group of the default_internal_user.
This group will be used to provide access to sockets that are generally
required by all Dovecot processes, but aren't safe enough to be allowed
completely open access from untrusted processes.
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.
Timo Sirainen [Wed, 7 Feb 2018 14:48:28 +0000 (16:48 +0200)]
ipc: Change ipc socket's owner to $default_internal_user
This is mainly used by director process, which runs as
$default_internal_user. This setting change is always required for director
installations. Also the ipc process itself is already running as
$default_internal_user so this should be a rather safe change.
Timo Sirainen [Tue, 9 Jan 2018 20:37:25 +0000 (15:37 -0500)]
lib-storage: Lock mailbox_list for mailbox create/delete/rename
This is only required for mailbox creation to fix a race condition with
LAYOUT=index: If INBOX doesn't exist it will rescan the mailboxes to
find out if there are any missing ones. If INBOX creation isn't locked,
it's possible that the first process hasn't finished creating INBOX
before the second process find it and attempts to open it.
The delete and rename locking are probably useful to guard against race
conditions when clients intentionally issues create/delete/rename commands
concurrently.
Timo Sirainen [Tue, 6 Feb 2018 15:35:18 +0000 (17:35 +0200)]
lib: Add file_lock_from_dotlock()
The dotlock creation requires various settings, so the file-lock.h API can't
easily be used to create it. But once created, it's simpler to keep all lock
types in the same struct file_lock, which can be unlocked/freed once
finished.
Timo Sirainen [Mon, 5 Feb 2018 20:21:13 +0000 (22:21 +0200)]
fts: Don't reindex FTS mails if .cache file is deleted
This means that if fts is enabled, "doveadm index" no longer adds mails
to dovecot.index.cache if it's deleted. However, it was rarely used for
that purpose. More likely due to a corrupted cache file all the mails were
unnecessarily being opened and reindexed.
Timo Sirainen [Mon, 5 Feb 2018 21:54:33 +0000 (23:54 +0200)]
fts: Fix searching headers with TEXT/BODY
TEXT is searching headers and BODY is searching MIME headers. Those headers
were indexed with data language, so search must also include data language
when looking up words. We'll just include the data language for all
searches now, so it should always work correctly.
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.
Stephan Bosch [Wed, 31 Jan 2018 09:27:54 +0000 (10:27 +0100)]
lmtp: local: Use recipient index in lmtp_local_rcpt_reply_overquota().
When used during the DATA command, it should send a reply for the correct
recipient. During the RCPT command there is only one reply due. Added assert
that checks this.
Stephan Bosch [Wed, 31 Jan 2018 09:34:11 +0000 (10:34 +0100)]
lmtp: local: Add explicit cmd parameter to lmtp_local_rcpt_reply_overquota().
Using the RCPT cmd is only valid for the RCPT command and not when quota excess
is detected during DATA. That would cause a segmentation fault, since
rcpt->rcpt.rcpt_cmd == NULL.
imap: Iterate over ns settings when deciding to add SPECIAL-USE capability
To determine whether we should add the SPECIAL-USE capability to the
OK response to LOGIN, we have to iterate over namespace and mailbox
*settings* since the namespaces haven't been set up yet.