]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
8 years agoglobal: Add/change switch case "fall through" comments
Timo Sirainen [Thu, 17 Aug 2017 10:20:26 +0000 (13:20 +0300)] 
global: Add/change switch case "fall through" comments

These fix warnings with gcc 7's -Wimplicit-fallthrough

8 years agolib: Add missing parenthesis to timeout_add()'s msecs parameter checks
Timo Sirainen [Thu, 17 Aug 2017 11:42:07 +0000 (14:42 +0300)] 
lib: Add missing parenthesis to timeout_add()'s msecs parameter checks

This caused wrong results when the msecs parameter contained e.g. var?1:2

8 years agolib: Fix compiler warning about mixing boolean with multiplication
Timo Sirainen [Thu, 17 Aug 2017 10:14:16 +0000 (13:14 +0300)] 
lib: Fix compiler warning about mixing boolean with multiplication

8 years agopush-notification plugin: properly terminate strings
Michael Koch [Wed, 16 Aug 2017 10:53:55 +0000 (13:53 +0300)] 
push-notification plugin: properly terminate strings

Without this fix, if the new message does not contain a from, a subject, and
a snippet the generated JSON will be malformed (the status check at the end
appended a '"' when it shouldn't have).

8 years agolib-storage: If root dir already exists as file, log better error message.
Timo Sirainen [Tue, 25 Jul 2017 06:35:31 +0000 (09:35 +0300)] 
lib-storage: If root dir already exists as file, log better error message.

8 years agolib-storage: Try to get mailbox list index's permissions from its parent directory
Timo Sirainen [Mon, 24 Jul 2017 18:08:33 +0000 (21:08 +0300)] 
lib-storage: Try to get mailbox list index's permissions from its parent directory

This avoids stat()ing the mail/index root directory, which is especially
useful when mailbox list index is stored in tmpfs.

8 years agolib-index: Add mail_index_use_existing_permissions()
Timo Sirainen [Mon, 24 Jul 2017 18:07:44 +0000 (21:07 +0300)] 
lib-index: Add mail_index_use_existing_permissions()

This has annoyingly lot of copy&pasting from
mailbox_list_get_permissions_stat(), but there didn't seem to be any nice
place where to share the code.

8 years agolib-storage: If ITERINDEX is set, delay checking whether mail root exists
Timo Sirainen [Mon, 24 Jul 2017 17:48:25 +0000 (20:48 +0300)] 
lib-storage: If ITERINDEX is set, delay checking whether mail root exists

In future this could be done even without ITERINDEX. It's not done yet,
since it might break backwards compatibility with some systems.

8 years agolib-storage: Fix INBOX notifications to set correct events
Timo Sirainen [Mon, 4 Sep 2017 14:48:52 +0000 (17:48 +0300)] 
lib-storage: Fix INBOX notifications to set correct events

This fixes IMAP NOTIFY so it doesn't send STATUS notifications to INBOX when
it doesn't have to.

8 years agolib-storage: List index notify cleanup - move code to separate functions
Timo Sirainen [Mon, 4 Sep 2017 14:37:05 +0000 (17:37 +0300)] 
lib-storage: List index notify cleanup - move code to separate functions

No functional changes. In preparation for the next commit.

8 years agolib-storage: Remove INBOX notification checks if mailbox events aren't requested
Timo Sirainen [Mon, 4 Sep 2017 13:59:52 +0000 (16:59 +0300)] 
lib-storage: Remove INBOX notification checks if mailbox events aren't requested

Nothing would be done with the results of those checks.

Note that MAILBOX_LIST_NOTIFY_UIDVALIDITY can be handled using mailbox list
index, even for INBOX with mailbox_list_index_include_inbox=no.

8 years agolib-storage: Optimize INBOX notifications with mailbox_list_index_include_inbox=yes
Timo Sirainen [Mon, 4 Sep 2017 13:55:30 +0000 (16:55 +0300)] 
lib-storage: Optimize INBOX notifications with mailbox_list_index_include_inbox=yes

There's no need for special INBOX checks in that case, because INBOX is
tracked in the mailbox list index the same as any other mailbox.

8 years agopop3-migration: Fail if all IMAP mails were matched by size, but POP3 had extra mails
Timo Sirainen [Mon, 4 Sep 2017 16:37:12 +0000 (19:37 +0300)] 
pop3-migration: Fail if all IMAP mails were matched by size, but POP3 had extra mails

This makes the handling same as what happens when the same situation happens
and the last mails were matched by headers. That's an error, unless
pop3_migration_ignore_*_uidls=yes.

8 years agopop3-migration: Add pop3_migration_ignore_extra_uidls=yes setting
Timo Sirainen [Mon, 4 Sep 2017 15:32:15 +0000 (18:32 +0300)] 
pop3-migration: Add pop3_migration_ignore_extra_uidls=yes setting

8 years agopop3-migration: Strip away invalid header lines.
Timo Sirainen [Mon, 4 Sep 2017 09:40:49 +0000 (12:40 +0300)] 
pop3-migration: Strip away invalid header lines.

If there's no ":" in the header, remove it. Fixes matching mails with
Zimbra.

8 years agopop3-migration: Try to assign UIDLs based on dovecot.index.cache
Timo Sirainen [Fri, 25 Aug 2017 10:38:35 +0000 (13:38 +0300)] 
pop3-migration: Try to assign UIDLs based on dovecot.index.cache

Add the UIDLs to (imapc) mailbox cache after they've been assigned.
Try to read them from the cache on the next sync to avoid reading
mails' headers.

This can be disabled with pop3_migration_skip_uidl_cache=yes, just in case
there's some kind of a problem with it.

8 years agopop3-migration: Delete unnecessary POP3 order checking code
Timo Sirainen [Fri, 25 Aug 2017 10:36:11 +0000 (13:36 +0300)] 
pop3-migration: Delete unnecessary POP3 order checking code

Nothing is actually using the result.

8 years agolib-storage: Support LISTINDEX= to disable it
Timo Sirainen [Fri, 25 Aug 2017 10:16:26 +0000 (13:16 +0300)] 
lib-storage: Support LISTINDEX= to disable it

8 years agoapparmor: Add apparmor plugin
Aki Tuomi [Thu, 13 Jul 2017 07:02:26 +0000 (10:02 +0300)] 
apparmor: Add apparmor plugin

It lets dovecot temporarily switch to a new apparmor
context for a user.

8 years agodirector: Fix rapid reconnection on failed outgoing connections
Timo Sirainen [Fri, 18 Aug 2017 08:09:41 +0000 (11:09 +0300)] 
director: Fix rapid reconnection on failed outgoing connections

last_network_failure wasn't set, which caused a failed outgoing connection
to immediately reconnect to it. This resulted in rapid logging of
connect() errors.

8 years agodoveadm-server: Deinitialize print on connection destroy
Aki Tuomi [Fri, 18 Aug 2017 08:22:52 +0000 (11:22 +0300)] 
doveadm-server: Deinitialize print on connection destroy

Otherwise print remains initialized and can break when reusing the service.

8 years agoapparmor: Add apparmor plugin
Aki Tuomi [Thu, 13 Jul 2017 07:02:26 +0000 (10:02 +0300)] 
apparmor: Add apparmor plugin

It lets dovecot temporarily switch to a new apparmor
context for a user.

8 years agolib-storage: Call mail_cache_close_mail() when mail is closed
Timo Sirainen [Fri, 18 Aug 2017 14:38:34 +0000 (17:38 +0300)] 
lib-storage: Call mail_cache_close_mail() when mail is closed

Fixes caching problems with INDEX=MEMORY

8 years agolib-index: Add mail_cache_close_mail() to smartly drop cached data with INDEX=MEMORY
Timo Sirainen [Fri, 18 Aug 2017 14:34:14 +0000 (17:34 +0300)] 
lib-index: Add mail_cache_close_mail() to smartly drop cached data with INDEX=MEMORY

Instead of reseting the entire transaction buffer when 256 kB is reached,
just drop mails have have been marked closed with mail_cache_close_mail().
If that's not enough, continue deleting forcibly until the buffer is below
256 kB.

This is especially important when mail_prefetch_count>0 and INDEX=MEMORY.
In that case there can be multiple mails that are being added to cache
and used later on. If they were dropped from cache too early, the work
would have to be done all over again.

8 years agolib-index: Fix compiler warning in test-mail-transaction-log-file
Timo Sirainen [Wed, 16 Aug 2017 09:44:02 +0000 (12:44 +0300)] 
lib-index: Fix compiler warning in test-mail-transaction-log-file

8 years agodoveadm: mailbox_list_index_very_dirty_syncs disabled for force-resync
Sergey Kitov [Mon, 7 Aug 2017 13:03:46 +0000 (16:03 +0300)] 
doveadm: mailbox_list_index_very_dirty_syncs disabled for force-resync

prerun of cmd force-resync sets mailbox_list_index_very_dirty_syncs to
no for mail_storage_service_user befor mail_user is allocated.

8 years agolib-storage: added settings updating function for the mail_storage_service user
Sergey Kitov [Mon, 7 Aug 2017 12:59:35 +0000 (15:59 +0300)] 
lib-storage: added settings updating function for the mail_storage_service user

8 years agoauth: Escape LDAP search filter properly
Aki Tuomi [Thu, 20 Jul 2017 10:24:21 +0000 (13:24 +0300)] 
auth: Escape LDAP search filter properly

This is syntaxical escaping to make ldap servers accept queries
with escapable characters, instead of erroring out.

8 years agodict-ldap: Escape LDAP search filter properly
Aki Tuomi [Thu, 20 Jul 2017 05:49:25 +0000 (08:49 +0300)] 
dict-ldap: Escape LDAP search filter properly

This is syntaxical escaping to make ldap servers accept queries
with escapable characters, instead of erroring out. It is possible
that the filter could have been modified in unexpected ways
if the input comes from untrusted sources.

8 years agolib-ldap: Store error if sending request to LDAP fails
Aki Tuomi [Thu, 20 Jul 2017 05:48:30 +0000 (08:48 +0300)] 
lib-ldap: Store error if sending request to LDAP fails

If the request cannot be sent e.g. due to bad search filter
store the error into the result.

Fixes Panic: file ldap-connection.c: line 709 (ldap_result_has_failed): assertion failed: ((result->openldap_ret == LDAP_SUCCESS) == (result->error_string == NULL))

8 years agoimap: Set client created before initializing namespaces
Aki Tuomi [Wed, 26 Jul 2017 16:42:48 +0000 (19:42 +0300)] 
imap: Set client created before initializing namespaces

Fixes Panic: file master-service.c: line 819 (master_service_client_connection_destroyed): assertion failed: (service->master_status.available_count < service->total_available_count)

8 years agolib: file_create_locked() - Treat mkdir() EEXIST error as success
Timo Sirainen [Thu, 6 Jul 2017 10:24:31 +0000 (13:24 +0300)] 
lib: file_create_locked() - Treat mkdir() EEXIST error as success

This can happen in race conditions when multiple processes are mkdir()ing
the same directory. It shouldn't result in failure.

8 years agoimap: Flush response to client before starting possibly long operation
Aki Tuomi [Wed, 26 Jul 2017 16:47:16 +0000 (19:47 +0300)] 
imap: Flush response to client before starting possibly long operation

Fixes Error: Timeout communicating with /var/run/dovecot/imap-master (version received)

8 years agocassandra: Fix confusing debug logging for paged query results.
Timo Sirainen [Mon, 14 Aug 2017 12:44:24 +0000 (15:44 +0300)] 
cassandra: Fix confusing debug logging for paged query results.

Even when caller supported paged queries, the debug output contained
"Paged query has more results, but not supported by the caller".
Clear out the error after sql_result_more() is called, so it won't be
logged.

8 years agolib: Created basic test suite for ostream-buffer.
Stephan Bosch [Sun, 2 Jul 2017 10:05:36 +0000 (12:05 +0200)] 
lib: Created basic test suite for ostream-buffer.

8 years agolib-index: Fix wrong mail_index_modseq_header automatically
Timo Sirainen [Tue, 8 Aug 2017 13:56:02 +0000 (16:56 +0300)] 
lib-index: Fix wrong mail_index_modseq_header automatically

It happens only on the next sync, although that isn't actually guaranteed to
happen. Still, it happens almost always so this should be good enough.

8 years agolib-index: Code cleanup - move code to get_modseq_next_offset_at()
Timo Sirainen [Tue, 8 Aug 2017 13:54:42 +0000 (16:54 +0300)] 
lib-index: Code cleanup - move code to get_modseq_next_offset_at()

In preparation for making the next commit smaller.

8 years agolib-index: Add unit tests to mail_transaction_log_file_get_modseq_next_offset() and...
Timo Sirainen [Tue, 8 Aug 2017 11:55:48 +0000 (14:55 +0300)] 
lib-index: Add unit tests to mail_transaction_log_file_get_modseq_next_offset() and _get_highest_modseq_at()

8 years agolib-index: Add unit test to mail_transaction_update_modseq()
Timo Sirainen [Tue, 8 Aug 2017 11:01:18 +0000 (14:01 +0300)] 
lib-index: Add unit test to mail_transaction_update_modseq()

8 years agolib-index: Remove tracking of mail_index_modseq_sync.highest_modseq
Timo Sirainen [Sat, 5 Aug 2017 05:38:50 +0000 (14:38 +0900)] 
lib-index: Remove tracking of mail_index_modseq_sync.highest_modseq

It's no longer necessary after the previous changes.

8 years agolib-index: Fix setting highest_modseq correctly in mail_index_modseq_header
Timo Sirainen [Sat, 5 Aug 2017 05:33:12 +0000 (14:33 +0900)] 
lib-index: Fix setting highest_modseq correctly in mail_index_modseq_header

The internally counted ctx->highest_modseq wasn't correct if all of the
records weren't synced. This could have happened for various reasons.
Since the view's current log seq/offset is used for the header, we can
also use the current highest_modseq from the view as well and it's
guaranteed to be correct.

This fixes various potential problems with using QRESYNC and CONDSTORE
extensions. It also fixes potential errors with unhibernating imap
clients, including:

Error: .../dovecot.index.log: Transaction log changed unexpectedly, can't get modseq

8 years agolib-index: Update per-flag modseq value a bit more correctly.
Timo Sirainen [Sat, 5 Aug 2017 05:29:12 +0000 (14:29 +0900)] 
lib-index: Update per-flag modseq value a bit more correctly.

This changes the code to be similar to the per-mail modseq updating in
mail_index_modseq_update(). It probably wasn't exactly wrong previously
either, but this change is required for the following commits.

8 years agolib-index: Fix checking if modseq header is up-to-date
Timo Sirainen [Sat, 5 Aug 2017 05:16:31 +0000 (14:16 +0900)] 
lib-index: Fix checking if modseq header is up-to-date

We were almost always assuming that it is.

8 years agolib-index: Fix modseq tracking with multiple flag updates
Timo Sirainen [Sat, 5 Aug 2017 05:11:17 +0000 (14:11 +0900)] 
lib-index: Fix modseq tracking with multiple flag updates

The earlier code was checking only the first flag record update. If the
first one had only internal flag changes but (some of) the rest didn't,
the modseq wasn't counted correctly. This was probably pretty rare.

8 years agolib-index: Fix modseq tracking for MAIL_INDEX_MAIL_FLAG_UPDATE_MODSEQ
Timo Sirainen [Sat, 5 Aug 2017 05:07:58 +0000 (14:07 +0900)] 
lib-index: Fix modseq tracking for MAIL_INDEX_MAIL_FLAG_UPDATE_MODSEQ

This is used to increase modseq for mails when their private flags change.
Use an already existing MAIL_TRANSACTION_FLAG_UPDATE_IS_INTERNAL() that
does this properly.

(This change preserves another bug, which is fixed in the next commit.)

8 years agolib-master: Allow userdb to return postlogin socket path.
Timo Sirainen [Sun, 23 Jul 2017 09:32:38 +0000 (12:32 +0300)] 
lib-master: Allow userdb to return postlogin socket path.

Returning "postlogin=socketpath" as userdb extra field overrides the
postlogin socket path in the service { executable } parameter.

8 years agopush-notification: Switch to main ioloop while calling drivers' deinit/cleanup callbacks
Timo Sirainen [Wed, 9 Aug 2017 10:23:36 +0000 (13:23 +0300)] 
push-notification: Switch to main ioloop while calling drivers' deinit/cleanup callbacks

Continues a44595f7b1afc7ccbd8653598753b32899d01c76 to other functions.
For example the OX backend would call http_client_wait(), which would move
the I/Os and timeouts to the current ioloop, which might not be main_ioloop
always. When that ioloop gets destroyed, I/O and timeout leaks are logged
and eventually the process crashes when calling http_client_deinit() in
cleanup() (this would happen later for another mail_user).

8 years agovirtual: Sync backend flags on initial sync when UIDVALIDITY hasn't changed
Aki Tuomi [Wed, 26 Jul 2017 09:53:16 +0000 (12:53 +0300)] 
virtual: Sync backend flags on initial sync when UIDVALIDITY hasn't changed

Before recent fixes the UIDVALIDITY was thought to change almost every time,
so this bug wasn't visible.

8 years agovirtual: Do not store recent flags to virtual index
Aki Tuomi [Wed, 26 Jul 2017 10:35:36 +0000 (13:35 +0300)] 
virtual: Do not store recent flags to virtual index

Setting the flag here would case unnecessary index update
to clear the flag later on.

8 years agomdbox: "Inconsistency in map index" wasn't fixing itself automatically
Timo Sirainen [Mon, 7 Aug 2017 21:31:57 +0000 (00:31 +0300)] 
mdbox: "Inconsistency in map index" wasn't fixing itself automatically

Broken by b9da8540e665138b3cad0b637c08c0ab7d7a7eeb

8 years agolib-imap-client: Log an info-line when connected to remote server
Timo Sirainen [Tue, 1 Aug 2017 04:48:55 +0000 (13:48 +0900)] 
lib-imap-client: Log an info-line when connected to remote server

Include the remote IP:port ad local IP:port. This allows matching the
connection with the remote server's logs (or e.g. haproxy logs).

8 years agofts: Log when indexing requires adding more mails to index than requested
Timo Sirainen [Sun, 18 Jun 2017 10:07:14 +0000 (13:07 +0300)] 
fts: Log when indexing requires adding more mails to index than requested

This should mainly happen when FTS indexing is requested for a virtual
mailbox.

8 years agoindexer-worker: Log first and last UID of which mails were indexed
Timo Sirainen [Sun, 18 Jun 2017 09:18:31 +0000 (12:18 +0300)] 
indexer-worker: Log first and last UID of which mails were indexed

8 years agoindexer-worker: Log number of indexing attempts in transaction commit failure
Timo Sirainen [Sun, 18 Jun 2017 10:04:43 +0000 (13:04 +0300)] 
indexer-worker: Log number of indexing attempts in transaction commit failure

This could be interesting if the number is large.

8 years agoindexer-worker: Log "Indexed .. messages" even if mailbox_search fails
Timo Sirainen [Sun, 18 Jun 2017 10:00:57 +0000 (13:00 +0300)] 
indexer-worker: Log "Indexed .. messages" even if mailbox_search fails

The transaction is still being committed.

8 years agolib: Fix ostream-buffer to return buffer contents size in o_stream_get_buffer_used_si...
Stephan Bosch [Thu, 15 Jun 2017 07:18:03 +0000 (09:18 +0200)] 
lib: Fix ostream-buffer to return buffer contents size in o_stream_get_buffer_used_size().

This is necessary for querying o_stream_get_buffer_avail_size() with respect to a limit set earlier using o_stream_set_max_buffer_size().
This is mainly useful for test suites.

8 years agoconfig: Log a warning about plugin { ...=no } probably being treated as "yes"
Timo Sirainen [Thu, 10 Aug 2017 07:23:32 +0000 (10:23 +0300)] 
config: Log a warning about plugin { ...=no } probably being treated as "yes"

This is properly fixed in v2.3. This should be good enough for now.

8 years agoquota-status: Fix compiling
Timo Sirainen [Tue, 8 Aug 2017 08:25:10 +0000 (11:25 +0300)] 
quota-status: Fix compiling

8 years agoquota-status: Support recipient_delimiter
Aki Tuomi [Mon, 3 Jul 2017 15:40:47 +0000 (18:40 +0300)] 
quota-status: Support recipient_delimiter

8 years agoquota-status: Use pooled memory for globals
Aki Tuomi [Mon, 3 Jul 2017 15:31:56 +0000 (18:31 +0300)] 
quota-status: Use pooled memory for globals

8 years agolmtp: Use message_detail_address_parse
Aki Tuomi [Mon, 3 Jul 2017 15:27:53 +0000 (18:27 +0300)] 
lmtp: Use message_detail_address_parse

8 years agolib-mail: Add unit test for message detail address parser
Aki Tuomi [Mon, 3 Jul 2017 16:00:14 +0000 (19:00 +0300)] 
lib-mail: Add unit test for message detail address parser

8 years agolib-mail: Add message_detail_address_parse
Aki Tuomi [Mon, 3 Jul 2017 15:18:36 +0000 (18:18 +0300)] 
lib-mail: Add message_detail_address_parse

Parses e.g. username+foo@domain into
username@domain with detail foo, when
delimiter is set to +

8 years agolib-storage: If mailbox_list_index_very_dirty_syncs=yes, still rebuild empty list...
Timo Sirainen [Fri, 4 Aug 2017 04:31:19 +0000 (13:31 +0900)] 
lib-storage: If mailbox_list_index_very_dirty_syncs=yes, still rebuild empty list index

8 years agolib-storage: Fix using BROKENCHAR
Timo Sirainen [Wed, 2 Aug 2017 05:09:23 +0000 (08:09 +0300)] 
lib-storage: Fix using BROKENCHAR

f3f617e25186daac43833d94b37833f0a43af917 was incorrectly merged from master.

8 years agolib: add explicit casts to byteorder macros
Josef 'Jeff' Sipek [Mon, 12 Jun 2017 14:34:59 +0000 (17:34 +0300)] 
lib: add explicit casts to byteorder macros

Some consumers of lib.h are in C++ and therefore they try to compile
byteorder.h as C++ code.  C++ compilers don't like the implicit void *
-> struct anything * conversion, so we squelch those by adding explicit
casts.

8 years agoglobal: use new byte ordering API
Josef 'Jeff' Sipek [Thu, 8 Jun 2017 11:49:56 +0000 (14:49 +0300)] 
global: use new byte ordering API

8 years agolib: import byte swapping & endian converting functions
Josef 'Jeff' Sipek [Thu, 8 Jun 2017 10:20:18 +0000 (13:20 +0300)] 
lib: import byte swapping & endian converting functions

8 years agolib-storage: Add BROKENCHAR to mail_location
Timo Sirainen [Fri, 30 Jun 2017 12:02:40 +0000 (15:02 +0300)] 
lib-storage: Add BROKENCHAR to mail_location

This makes the mailbox_list_settings.broken_char configurable. Mainly useful
with imapc when remote server doesn't contain valid mUTF-7 mailbox names.

8 years agolib-storage: Don't autocreate mailbox during deletion.
Timo Sirainen [Mon, 26 Jun 2017 16:44:43 +0000 (19:44 +0300)] 
lib-storage: Don't autocreate mailbox during deletion.

Trying to delete a nonexistent autocreated mailbox first created it and then
immediately deleted it.

8 years agolib-storage: Make mailbox_is_autocreated() public
Timo Sirainen [Tue, 27 Jun 2017 11:22:50 +0000 (14:22 +0300)] 
lib-storage: Make mailbox_is_autocreated() public

This also removes duplicated code from acl plugin.

8 years agoacl: Don't read/write dovecot-acl-list with acl_globals_only=yes
Timo Sirainen [Wed, 21 Jun 2017 22:12:56 +0000 (01:12 +0300)] 
acl: Don't read/write dovecot-acl-list with acl_globals_only=yes

It's only an optimization for the dovecot-acl files, which don't exist
with acl_globals_only=yes

8 years agolib/bits.c: Finish fix for compiling with gcc 3.0 .. 3.3
Timo Sirainen [Wed, 21 Jun 2017 13:54:25 +0000 (16:54 +0300)] 
lib/bits.c: Finish fix for compiling with gcc 3.0 .. 3.3

8 years agolib/bits.h: Fix compiling with gcc 3.0 .. 3.3
Timo Sirainen [Wed, 21 Jun 2017 13:14:14 +0000 (16:14 +0300)] 
lib/bits.h: Fix compiling with gcc 3.0 .. 3.3

According to gcc's online manuals, 3.4 is the first version with
__builtin_clzll

8 years agolib-storage: MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS wasn't working correctly
Timo Sirainen [Sun, 30 Jul 2017 06:39:18 +0000 (09:39 +0300)] 
lib-storage: MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS wasn't working correctly

Especially with "doveadm user" it still triggered running the plugins,
because doveadm loads all the plugins early.

8 years agolib-http: message parser: Allow duplicate date header if HTTP_MESSAGE_PARSE_FLAG_STRI...
Stephan Bosch [Tue, 11 Jul 2017 12:34:06 +0000 (14:34 +0200)] 
lib-http: message parser: Allow duplicate date header if HTTP_MESSAGE_PARSE_FLAG_STRICT is not set.

The last instance of the date header is used.

8 years agolib-http: Restructured the header, message, request, and response parsers to have...
Stephan Bosch [Tue, 11 Jul 2017 12:18:47 +0000 (14:18 +0200)] 
lib-http: Restructured the header, message, request, and response parsers to have an extensible and consistent API using flags.

Extended the test suites with a few cases that test parsing with and without the STRICT flag.

8 years agolib-http: Changed test-http-server to actually use the http-server API.
Stephan Bosch [Fri, 12 May 2017 02:25:08 +0000 (04:25 +0200)] 
lib-http: Changed test-http-server to actually use the http-server API.

This currently serves as a simple demonstration of how to structure an HTTP server.

8 years agolib-storage: Hide and rmdir \NoSelect leaf mailboxes with NO-NOSELECT
Timo Sirainen [Tue, 25 Jul 2017 17:53:18 +0000 (20:53 +0300)] 
lib-storage: Hide and rmdir \NoSelect leaf mailboxes with NO-NOSELECT

If the leaf is successfully rmdir()ed, rmdir() also its parents.

This doesn't work perfectly with if there are multiple levels of \NoSelect
mailboxes. For example with "a/b/c" the listing will already have returned
"a" and "a/b" before it reaches the "a/b/c" code, which will rmdir all of
them, but it's a bit too late at that point. It's too much work to fix
though, and the situation will be fixed on the next list anyway.

8 years agolib-storage: Add setting to disable \NoSelect mailboxes
Timo Sirainen [Tue, 25 Jul 2017 13:10:51 +0000 (16:10 +0300)] 
lib-storage: Add setting to disable \NoSelect mailboxes

Enabled using mail_location = ...:NO-NOSELECT

Trying to create \NoSelect "dir/" will result just creating "dir", similar
to how Maildir++ layout already did it.

Deleting a mailbox will delete all of its \NoSelect parents.

8 years agolib-storage: Mailbox rename shouldn't auto-rmdir parent index dirs with ITERINDEX
Timo Sirainen [Tue, 25 Jul 2017 12:54:37 +0000 (15:54 +0300)] 
lib-storage: Mailbox rename shouldn't auto-rmdir parent index dirs with ITERINDEX

For example:
 - create a/b
 - rename a/b c

This resulted in "a" existing in mail root directory, but not in index
directory. With ITERINDEX this meant that the "a" was lost.

8 years agolib-storage: If userdb returns chdir extra field, chdir() there instead of home
Timo Sirainen [Mon, 24 Jul 2017 13:37:42 +0000 (16:37 +0300)] 
lib-storage: If userdb returns chdir extra field, chdir() there instead of home

This can avoid unnecessary home directory accesses if indexes are stored
outside the home and there's no other reason to chdir() to home.

8 years agolib-storage: If chdir(home) fails due to EACCES, don't log two errors.
Timo Sirainen [Mon, 24 Jul 2017 13:36:45 +0000 (16:36 +0300)] 
lib-storage: If chdir(home) fails due to EACCES, don't log two errors.

8 years agolib-storage: Add mailbox_list_index_include_inbox setting
Timo Sirainen [Mon, 24 Jul 2017 11:17:22 +0000 (14:17 +0300)] 
lib-storage: Add mailbox_list_index_include_inbox setting

This controls whether to update INBOX's STATUS information in the mailbox
list index. It can be useful especially if LISTINDEX points to a tmpfs,
but perhaps also in other situations.

I considered adding a more generic setting to exclude other mailboxes, but
the namespace prefixes and hierarchy separators get a bit complicated with
shared mailboxes. It's probably also not very useful to change this for
anything but the INBOX.

8 years agoexample-config: Add mailbox_list_index_very_dirty_syncs
Timo Sirainen [Mon, 24 Jul 2017 11:12:55 +0000 (14:12 +0300)] 
example-config: Add mailbox_list_index_very_dirty_syncs

8 years agolib-storage: Allow LISTINDEX to point to a different directory
Timo Sirainen [Sat, 22 Jul 2017 15:39:19 +0000 (18:39 +0300)] 
lib-storage: Allow LISTINDEX to point to a different directory

Most importantly because the mailbox list index is only a cache, it could be
safely pointed to e.g. tmpfs to save disk I/O.

8 years agovirtual: Make sure index is rewritten when new mailboxes are added
Timo Sirainen [Fri, 21 Jul 2017 16:52:23 +0000 (19:52 +0300)] 
virtual: Make sure index is rewritten when new mailboxes are added

Otherwise multiple bbox->sync_mailbox_idx point to 0 and they keep overwriting
each others in the header. This causes the header to be constantly updated with
wrong contents.

8 years agodict-sql: Do not increment on set (again)
Timo Sirainen [Fri, 21 Jul 2017 14:01:05 +0000 (17:01 +0300)] 
dict-sql: Do not increment on set (again)

Reverts f1fc1560914f87dc44a0d48f40b97250adb33e73, which was a broken merge
caused by accidentally trying to re-merge
595b94c8d8e2700a0c50f3a9c06a535adb63f8f3 and somehow ended up reverting
29e8c5a8e26a9ed398c37d4a6e1488d4630f5627.

8 years agoimap: Add %{appended} to imap_logout_format
Martti Rannanjärvi [Tue, 11 Jul 2017 10:12:46 +0000 (13:12 +0300)] 
imap: Add %{appended} to imap_logout_format

8 years agoimap-client: Add %{autoexpunged} to imap_logout_format
Martti Rannanjärvi [Mon, 3 Jul 2017 14:12:08 +0000 (17:12 +0300)] 
imap-client: Add %{autoexpunged} to imap_logout_format

8 years agoimap-client: Add const char *disconnect_reason to client
Martti Rannanjärvi [Tue, 4 Jul 2017 06:25:21 +0000 (09:25 +0300)] 
imap-client: Add const char *disconnect_reason to client

This is to allow using reason given to client_disconnect() via timeout
context.

8 years agolib-index: Fix next_uid lookup in open transaction that has appended mails
Timo Sirainen [Wed, 19 Jul 2017 10:43:09 +0000 (13:43 +0300)] 
lib-index: Fix next_uid lookup in open transaction that has appended mails

The appended mails were used for returning an updated
mail_index_header.next_uid, but only if the mails were assigned UIDs in
mail_index_append(). It should have updated the next_uid also after
mail_index_append_finish_uids() was used to assign the UIDs.

This fixes setting first_recent_uid correctly for virtual mailboxes when the
sync finds new mails. Avoids multiple sessions from getting \Recent flags
for the same mails.

8 years agolib-sql: Remove duplicate Cassandra consistency names
Martti Rannanjärvi [Thu, 20 Jul 2017 06:46:00 +0000 (09:46 +0300)] 
lib-sql: Remove duplicate Cassandra consistency names

8 years agovirtual: Do not remove mailbox notify if the mailbox is closed
Aki Tuomi [Thu, 20 Jul 2017 08:01:37 +0000 (11:01 +0300)] 
virtual: Do not remove mailbox notify if the mailbox is closed

The backend mailbox close/open status is not related to
the notify API usage. The notify is removed in
virtual_mailbox_close_internal instead when we are
actually deinitializing.

8 years agovirtual: Optimize mailbox_notify_changes() when there's only a single backend mailbox
Timo Sirainen [Wed, 19 Jul 2017 20:19:12 +0000 (23:19 +0300)] 
virtual: Optimize mailbox_notify_changes() when there's only a single backend mailbox

8 years agolib-storage: mailbox_watch_extract_notify_fd() - give better reason if mailbox has...
Timo Sirainen [Wed, 19 Jul 2017 20:11:12 +0000 (23:11 +0300)] 
lib-storage: mailbox_watch_extract_notify_fd() - give better reason if mailbox has no IOs

This happens currently with virtual mailboxes.

8 years agolib: io_loop_extract_notify_fd() - Don't crash if no notifys have been added
Timo Sirainen [Wed, 19 Jul 2017 20:09:13 +0000 (23:09 +0300)] 
lib: io_loop_extract_notify_fd() - Don't crash if no notifys have been added

8 years agocassandra: Fix read/write buffer overflows after adding CASSANDRA_QUERY_TYPE_READ_MORE
Timo Sirainen [Wed, 19 Jul 2017 07:37:25 +0000 (10:37 +0300)] 
cassandra: Fix read/write buffer overflows after adding CASSANDRA_QUERY_TYPE_READ_MORE

8 years agolib-sql: Add assert to sql_result_more_s()
Timo Sirainen [Wed, 19 Jul 2017 07:35:43 +0000 (10:35 +0300)] 
lib-sql: Add assert to sql_result_more_s()

Should avoid a warning from static analyzer.

8 years agovirtual: Stop watching notification on backend box close
Aki Tuomi [Wed, 19 Jul 2017 09:03:58 +0000 (12:03 +0300)] 
virtual: Stop watching notification on backend box close

Fixes Panic: file mail-index.c: line 662 (mail_index_close_nonopened): assertion failed: (index->views == NULL)