]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
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 agovar-expand: Add tests for var_expand conditionals
Aki Tuomi [Mon, 24 Jul 2017 10:31:49 +0000 (13:31 +0300)] 
var-expand: Add tests for var_expand conditionals

8 years agovar-expand: Add support for conditionals
Aki Tuomi [Mon, 24 Jul 2017 10:31:02 +0000 (13:31 +0300)] 
var-expand: Add support for conditionals

%{if;value-a,op,value-b:true-value:false-value}

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 agolib-storage: Add UIDVALIDITY to mailbox list index on mailbox create
Timo Sirainen [Thu, 20 Jul 2017 13:18:46 +0000 (16:18 +0300)] 
lib-storage: Add UIDVALIDITY to mailbox list index on mailbox create

This avoids an unnecessary secondary write later on when opening the
mailbox.

8 years agolib-storage: Don't update INBOX's sync status to mailbox list index
Timo Sirainen [Thu, 20 Jul 2017 13:01:46 +0000 (16:01 +0300)] 
lib-storage: Don't update INBOX's sync status to mailbox list index

It's not actually used so there's no need to update it either.
Broken by 70092709cdc803c87b8f4ef1b0548eb45515bdae

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 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 agodoc: Change del to deleted in imap_logout_format default to match code
Martti Rannanjärvi [Mon, 3 Jul 2017 12:20:14 +0000 (15:20 +0300)] 
doc: Change del to deleted in imap_logout_format default to match code

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 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)

8 years agovirtual: Stop notifications only if they were started
Aki Tuomi [Tue, 18 Jul 2017 18:04:47 +0000 (21:04 +0300)] 
virtual: Stop notifications only if they were started

Fixes Panic: file mail-storage.c: line 1950: assertion failed: (box->opened)

8 years agopop3-migration: Add unit test for checking that trailing tabs are stripped
Timo Sirainen [Wed, 19 Jul 2017 07:58:43 +0000 (10:58 +0300)] 
pop3-migration: Add unit test for checking that trailing tabs are stripped

8 years agolib-mail: message_header_hash() - add v4 that strips tabs
Timo Sirainen [Wed, 19 Jul 2017 07:57:36 +0000 (10:57 +0300)] 
lib-mail: message_header_hash() - add v4 that strips tabs

This helps with Zimbra, which strips away trailing tabs in BODY[HEADER].

8 years agolib-index: Mark index deleted if index log file is missing
Aki Tuomi [Tue, 18 Jul 2017 11:37:53 +0000 (14:37 +0300)] 
lib-index: Mark index deleted if index log file is missing

This fixes all kinds of errors caused by mailbox being
deleted by another process.

8 years agolib-index: Fix mail_index_get_modification_time() to work when index isn't open.
Timo Sirainen [Tue, 18 Jul 2017 11:42:23 +0000 (14:42 +0300)] 
lib-index: Fix mail_index_get_modification_time() to work when index isn't open.

index->filepath may be NULL after a failed index open, and it's a bit unsafe
to trust that index->log->filepath isn't NULL either.  So just build the full
path from elements that are definitely non-NULL.

Also stat() only dovecot.index.log, because it's always supposed to exist.
If it doesn't, something's broken and stat()ing dovecot.index doesn't make
much sense.

This commit removes mail_transaction_log_get_mtime(), which is no longer
needed.

Fixes:
Panic: file mail-index.c: line 931 (mail_index_file_set_syscall_error): assertion failed: (filepath != NULL)

8 years agolib-storage: Don't allow removing \Recent flags with mail_update_flags()
Timo Sirainen [Tue, 18 Jul 2017 09:39:44 +0000 (12:39 +0300)] 
lib-storage: Don't allow removing \Recent flags with mail_update_flags()

Reverts an ancient commit 7deb24e7453249d09741641bff0f269f68165033. I don't
know why it was added in the first place. Normally \Recent flags are
removed during sync with MAIL_INDEX_SYNC_FLAG_DROP_RECENT. This should be
enough, especially since it's not even possible to remove a single \Recent
flag - only update the first_recent_uid.

The code was also wrong: It was dropping \Recent flags even when
modify_type/flags combination didn't ask for it. Even if this was fixed,
there would still be race conditions with multiple processes since this
update is done without locking.

Fixes:
Error: Recent flags state corrupted for mailbox

8 years agolib-storage: If mail_index_header.first_recent_uid shrinks, reset \Recent flags
Timo Sirainen [Tue, 18 Jul 2017 08:57:24 +0000 (11:57 +0300)] 
lib-storage: If mail_index_header.first_recent_uid shrinks, reset \Recent flags

This should never happen.

8 years agocassandra: Improve logging for multipage queries
Timo Sirainen [Mon, 17 Jul 2017 15:10:49 +0000 (18:10 +0300)] 
cassandra: Improve logging for multipage queries

warn_timeout is applied to both individual page requests as well as the sum
of all the page requests.

8 years agocassandra: Add page_size setting to enable paged results for queries
Timo Sirainen [Mon, 17 Jul 2017 14:54:07 +0000 (17:54 +0300)] 
cassandra: Add page_size setting to enable paged results for queries

8 years agocassandra: Add wrapper functions in preparation for following commits
Timo Sirainen [Mon, 17 Jul 2017 14:51:03 +0000 (17:51 +0300)] 
cassandra: Add wrapper functions in preparation for following commits

No functional changes. Shrinks the following commits.

8 years agodict-sql: Add support for sql_result_more()
Timo Sirainen [Mon, 17 Jul 2017 14:54:36 +0000 (17:54 +0300)] 
dict-sql: Add support for sql_result_more()

8 years agolib-sql: Add API support for asynchronously iterating over rows.
Timo Sirainen [Mon, 17 Jul 2017 11:22:35 +0000 (14:22 +0300)] 
lib-sql: Add API support for asynchronously iterating over rows.

sql_query() can already do an async lookup, but the full result needs
to be available immediately. This can be inefficient for large results.
Add a new SQL_RESULT_NEXT_MORE return value and sql_result_more() for
asynchronously requesting more results.

This changes the API a bit, but isn't done by default by any drivers yet.
Also callers that can't handle this are hopefully checking for "ret < 0",
which allows them to handle such an async-more request as an error
instead.

sql_result_next_row() will be changed to return enum in a separate commit to
keep backwards compatibility in v2.2.x.

8 years agoimapc: Fix caching >= 32 kB mail bodies
Timo Sirainen [Mon, 17 Jul 2017 11:05:45 +0000 (14:05 +0300)] 
imapc: Fix caching >= 32 kB mail bodies

When closing the mail, only in-memory mail bodies were stored to cache.

8 years agolib-index: Add missing colon to log text
Aki Tuomi [Mon, 17 Jul 2017 07:46:14 +0000 (10:46 +0300)] 
lib-index: Add missing colon to log text

It's added elsewhere

8 years agomaster: Change service "connections are being dropped" warning interval to 1 second
Timo Sirainen [Fri, 14 Jul 2017 14:00:21 +0000 (17:00 +0300)] 
master: Change service "connections are being dropped" warning interval to 1 second

When this is happening, it's often accompanied with all kinds of other errors and
these warnings drown in them. Make them easier to notice by reducing the interval
from 60 seconds to 1 second.

8 years agolib-storage: mailbox_create_missing_dir() - Fix handling NULL mailbox directory
Timo Sirainen [Thu, 13 Jul 2017 13:20:53 +0000 (16:20 +0300)] 
lib-storage: mailbox_create_missing_dir() - Fix handling NULL mailbox directory

It would have caused stat(NULL), which would have failed.
Broken by 7071a02a8413fb409ade1625f6a1763c7493b66b

8 years agolib-storage: When index dir rmdir() fails with ENOTEMPTY, retry it for 1 second
Timo Sirainen [Thu, 13 Jul 2017 23:11:56 +0000 (02:11 +0300)] 
lib-storage: When index dir rmdir() fails with ENOTEMPTY, retry it for 1 second

This helps to avoid leaving those index directories lying around with NFS.
Hopefully within the 1 second any existing processes that have been keeping those
files open have finished their task. Especially IMAP IDLE will take 0.5 seconds
to start syncing indexes and realize that they're deleted.

8 years agolib-index: If refreshing finds dovecot.index.log gone, assume the mailbox was deleted
Timo Sirainen [Thu, 13 Jul 2017 22:54:31 +0000 (01:54 +0300)] 
lib-index: If refreshing finds dovecot.index.log gone, assume the mailbox was deleted

Don't try to recreate the log file again. It can just cause further problems.

A way to reproduce this problem with NFS when INDEX dir is specified:
 * create mailbox foo, select foo, IDLE
 * delete mailbox foo
--> foo's index is recreated back by IDLEing process

8 years agoquota: Fix negative storage-based quota_warnings to work with count backend
Timo Sirainen [Thu, 13 Jul 2017 00:15:36 +0000 (03:15 +0300)] 
quota: Fix negative storage-based quota_warnings to work with count backend

Finishes f9362223346d10a5866b376ed227b77b26ea4292, which fixed it for
"messages" but not for "storage".

8 years agoquota: When setting auto_updating to transaction, skip invisible quota roots
Timo Sirainen [Wed, 12 Jul 2017 23:56:33 +0000 (02:56 +0300)] 
quota: When setting auto_updating to transaction, skip invisible quota roots

Skip the quota root also if the mailbox matches "ignore" quota_rule.
This is only an optimization fix so that unnecessary work isn't done for
quota roots that aren't actually used.

8 years agolib-storage: mailbox_create_missing_dir() - Handle mailbox delete race condition
Timo Sirainen [Wed, 12 Jul 2017 13:18:42 +0000 (16:18 +0300)] 
lib-storage: mailbox_create_missing_dir() - Handle mailbox delete race condition

Make sure the directory isn't created if the mail root directory no longer
exists. This might happen during mailbox deletion when another process is
opening the mailbox at the same time.

8 years agolib-storage: Improve MAILBOX_LIST_PROP_AUTOCREATE_DIRS related comments
Timo Sirainen [Wed, 12 Jul 2017 13:15:13 +0000 (16:15 +0300)] 
lib-storage: Improve MAILBOX_LIST_PROP_AUTOCREATE_DIRS related comments

8 years agolib-lda: Fix crash if syncing save destination mailbox fails
Timo Sirainen [Sun, 9 Jul 2017 08:31:44 +0000 (11:31 +0300)] 
lib-lda: Fix crash if syncing save destination mailbox fails

8 years agolib-index: Fix compiler warning with 32bit time_t
Timo Sirainen [Wed, 12 Jul 2017 14:54:44 +0000 (17:54 +0300)] 
lib-index: Fix compiler warning with 32bit time_t

8 years agolib-index: Track .log.2 rotation time in index header
Timo Sirainen [Tue, 11 Jul 2017 12:35:16 +0000 (15:35 +0300)] 
lib-index: Track .log.2 rotation time in index header

This avoids unnecessarily stat()ing the file. Also it's a bit better
since it's tracking the actual rotation time, not the mtime of what the
.log file happened to have at the time of rotation.

The initial rotation timestamp is written only to the dovecot.index header
without going through dovecot.index.log. This works, because the
dovecot.index is written practically always after a log rotation. For the
rare cases when it doesn't happen, the dovecot.index.log.2 just gets
deleted later after the next log rotation.

8 years agolib-index: Check .log.2 rotation only when syncing
Timo Sirainen [Tue, 11 Jul 2017 12:33:56 +0000 (15:33 +0300)] 
lib-index: Check .log.2 rotation only when syncing

Instead of also whenever appending transactions to .log file. This
shouldn't change the behavior much, and it's needed for the following
change to work correctly.

8 years agodoveadm dump: Include "last temp file scan" in index header dump
Timo Sirainen [Tue, 11 Jul 2017 12:32:33 +0000 (15:32 +0300)] 
doveadm dump: Include "last temp file scan" in index header dump

8 years agolib-index: Use nfs_safe_stat() to avoid having to handle stat() ESTALE error
Timo Sirainen [Tue, 11 Jul 2017 11:31:10 +0000 (14:31 +0300)] 
lib-index: Use nfs_safe_stat() to avoid having to handle stat() ESTALE error

Slightly simplifies the code.

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 agosdbox: Create missing mail directory on resync if index directory exists
Timo Sirainen [Tue, 11 Jul 2017 11:14:47 +0000 (14:14 +0300)] 
sdbox: Create missing mail directory on resync if index directory exists

This problem should be visible only with ITERINDEX enabled.

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-storage: Remove user namespaces on hook error
Aki Tuomi [Tue, 11 Jul 2017 07:45:16 +0000 (10:45 +0300)] 
lib-storage: Remove user namespaces on hook error

If there is a hook error during namespaces added
remove the namespaces from user. This avoids attempts
to use the namespaces later on without proper initialization.

8 years agolib-storage: Ensure list index is present
Aki Tuomi [Tue, 11 Jul 2017 07:26:38 +0000 (10:26 +0300)] 
lib-storage: Ensure list index is present

Otherwise we end up with signal 11 crash later on.

8 years agolib-ssl-iostream: Fix compiler warning
Timo Sirainen [Fri, 7 Apr 2017 06:23:01 +0000 (09:23 +0300)] 
lib-ssl-iostream: Fix compiler warning

~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS makes it unsigned, so it doesn't fit
into signed 32bit long.

8 years agolib-storage: Fix mailbox_update() to always update mailbox list index.
Timo Sirainen [Mon, 10 Jul 2017 13:11:48 +0000 (16:11 +0300)] 
lib-storage: Fix mailbox_update() to always update mailbox list index.

It previously was updating it only if the list index for the mailbox was
already fully up-to-date. But that doesn't really matter, because
mailbox_update() is supposed to be changing the values regardless.

This fixes mailbox_update() to always work with LAYOUT=index. It also
fixes mailbox_update() for INBOX to update UIDVALIDITY/GUID.

8 years agolib-storage: Don't use mailbox list index if it has refresh_flag set
Timo Sirainen [Mon, 10 Jul 2017 12:54:07 +0000 (15:54 +0300)] 
lib-storage: Don't use mailbox list index if it has refresh_flag set

For example if INBOX is deleted, looking up its GUID shouldn't be returned
from the list index since it contains the old GUID.

8 years agolib-storage: Track INBOX UIDVALIDITY and GUID in mailbox list index
Timo Sirainen [Mon, 10 Jul 2017 10:34:17 +0000 (13:34 +0300)] 
lib-storage: Track INBOX UIDVALIDITY and GUID in mailbox list index

This allows existence checks and GUID lookups for INBOX to be done from the
index.

8 years agolib-storage: Avoid index refresh with mailbox_list_index_very_dirty_syncs=yes
Timo Sirainen [Thu, 6 Jul 2017 16:00:35 +0000 (19:00 +0300)] 
lib-storage: Avoid index refresh with mailbox_list_index_very_dirty_syncs=yes

8 years agolib-storage: Refresh mailbox list index if mailbox's existence differs from index
Timo Sirainen [Thu, 6 Jul 2017 14:48:19 +0000 (17:48 +0300)] 
lib-storage: Refresh mailbox list index if mailbox's existence differs from index

8 years agolib-storage: Set mailbox list index to be refreshed after changes, not before
Timo Sirainen [Thu, 6 Jul 2017 14:45:02 +0000 (17:45 +0300)] 
lib-storage: Set mailbox list index to be refreshed after changes, not before

Mailbox deletion and rename set the refresh-flag before the change was done.
This was unnecessary if the change didn't happen. Also there was a race
condition that another process could have done the refresh before the
change was even done.

8 years agolib-storage: Add mailbox_list_last_error_push/pop()
Timo Sirainen [Thu, 6 Jul 2017 14:36:28 +0000 (17:36 +0300)] 
lib-storage: Add mailbox_list_last_error_push/pop()

These are similar to mail_storage_last_error_push/pop()

8 years agolib-storage: Try to avoid opening mailbox list index on mailbox access
Timo Sirainen [Mon, 10 Jul 2017 11:37:04 +0000 (14:37 +0300)] 
lib-storage: Try to avoid opening mailbox list index on mailbox access

Perform the STATUS (and other relevant) updates only if syncing or
transaction commits changed anything. This could be optimized further to
check even more strongly whether the seen changes could cause changes to
the list index, but it's probably not worth the effort.

8 years agolib-storage: Storage backend sync_init()s no longer need to check if mailbox is open
Timo Sirainen [Mon, 10 Jul 2017 11:20:50 +0000 (14:20 +0300)] 
lib-storage: Storage backend sync_init()s no longer need to check if mailbox is open

The previous change guarantees it.

8 years agolib-storage: mailbox_sync_init() - open mailbox immediately if it's not open yet
Timo Sirainen [Mon, 10 Jul 2017 11:19:47 +0000 (14:19 +0300)] 
lib-storage: mailbox_sync_init() - open mailbox immediately if it's not open yet

This simplifies the work for plugins that want to hook into
mailbox.sync_init() so they no longer have to handle the "mailbox isn't
opened" case.

8 years agoimap: Don't do autoexpunging when IMAP client is hibernated
Timo Sirainen [Mon, 10 Jul 2017 10:56:49 +0000 (13:56 +0300)] 
imap: Don't do autoexpunging when IMAP client is hibernated

8 years agolib-fs: Add init function that can use fs string directly
Aki Tuomi [Tue, 2 May 2017 11:01:16 +0000 (14:01 +0300)] 
lib-fs: Add init function that can use fs string directly

This avoids doing splitting the fs driver and args
everywhere and ensures that separators are consistent.

8 years agolib: remove support for Boehm GC
Josef 'Jeff' Sipek [Wed, 5 Jul 2017 13:08:41 +0000 (16:08 +0300)] 
lib: remove support for Boehm GC

There were several issues with our usage of Boehm GC:

 - it didn't help with memory fragmentation
 - it is not very efficient
 - it was rarely enabled & used

Proper use of a GC would involve radical changes to how we write code
and cause portability issues.  We can get most of the benefits of a GC
with data stacks and alloc-only memory pools.

8 years agovirtual: If virtual_uid is not assigned skip it
Aki Tuomi [Thu, 6 Jul 2017 09:40:33 +0000 (12:40 +0300)] 
virtual: If virtual_uid is not assigned skip it

We cannot lookup mails with uid 0, so if we see
that mail has virtual uid 0, do not attempt to look it
up from index, but skip it.

Fixes Panic: file mail-index-map.c: line 549 (mail_index_map_lookup_seq_range): assertion failed: (first_uid > 0)

8 years agovirtual: Append virtual mailbox name to open reason on box alloc
Aki Tuomi [Wed, 5 Jul 2017 12:20:32 +0000 (15:20 +0300)] 
virtual: Append virtual mailbox name to open reason on box alloc

8 years agovirtual: Append virtual mailbox information to get stream reason
Aki Tuomi [Wed, 5 Jul 2017 12:20:18 +0000 (15:20 +0300)] 
virtual: Append virtual mailbox information to get stream reason

8 years agovirtual: Expunge virtual mails if backend box is deleted
Aki Tuomi [Wed, 5 Jul 2017 11:24:49 +0000 (14:24 +0300)] 
virtual: Expunge virtual mails if backend box is deleted

When mail is added to a mailbox and then deleted, expunge
the sequences from virtual index in sync.

Fixes Error: Unexpectedly lost Mailbox ID 4

8 years agovirtual: Do not mark broken folder as initialized
Aki Tuomi [Mon, 3 Jul 2017 10:53:49 +0000 (13:53 +0300)] 
virtual: Do not mark broken folder as initialized

Otherwise it won't get repaired

8 years agovirtual: Fix highest_mailbox_id if it's wrong
Aki Tuomi [Mon, 3 Jul 2017 10:53:31 +0000 (13:53 +0300)] 
virtual: Fix highest_mailbox_id if it's wrong

8 years agovirtual: Force header rewrite if header not found or crc32 changed
Aki Tuomi [Mon, 3 Jul 2017 10:25:35 +0000 (13:25 +0300)] 
virtual: Force header rewrite if header not found or crc32 changed

Otherwise the header gets only partially written

8 years agolib-storage: Clarify keywords handling in mail_save_finish
Aki Tuomi [Thu, 29 Jun 2017 10:22:32 +0000 (13:22 +0300)] 
lib-storage: Clarify keywords handling in mail_save_finish

8 years agovirtual: Fix keywords handling
Aki Tuomi [Wed, 28 Jun 2017 10:45:19 +0000 (13:45 +0300)] 
virtual: Fix keywords handling

Keywords are per-mail object, and should be treated as one. The old
code left pointer to keywords dandling which lead into double-free.
Now the ctx->data is treated in similar way as other backends.

Fixes Panic: file mail-index.c: line 417 (mail_index_keywords_unref): assertion failed: (keywords->refcount > 0)
Fixes Panic: file mail-storage.c: line 2311 (mailbox_save_context_reset): assertion failed: (!ctx->unfinished)

8 years agovirtual: Fix recent flag updates
Aki Tuomi [Tue, 27 Jun 2017 11:19:16 +0000 (14:19 +0300)] 
virtual: Fix recent flag updates

View must be updated before looking up seqs

8 years agovirtual: Call mailbox_save_context_deinit before freeing context
Aki Tuomi [Thu, 29 Jun 2017 10:46:06 +0000 (13:46 +0300)] 
virtual: Call mailbox_save_context_deinit before freeing context

Otherwise dest_mail does not get free'd

8 years agovirtual: Use mailbox_notify_list API when mailbox_list_index is enabled
Aki Tuomi [Tue, 27 Jun 2017 09:51:51 +0000 (12:51 +0300)] 
virtual: Use mailbox_notify_list API when mailbox_list_index is enabled

8 years agovirtual: Generate GUID for virtual folder
Aki Tuomi [Tue, 27 Jun 2017 07:54:08 +0000 (10:54 +0300)] 
virtual: Generate GUID for virtual folder

GUID is generated when index is first created
or the rules change.

8 years agolib-storage: Add type checking for mailbox_list_notify_wait
Aki Tuomi [Tue, 27 Jun 2017 09:42:27 +0000 (12:42 +0300)] 
lib-storage: Add type checking for mailbox_list_notify_wait

8 years agolmtp: client_input_data_write_local() refactored
Sergey Kitov [Thu, 6 Jul 2017 12:51:17 +0000 (15:51 +0300)] 
lmtp: client_input_data_write_local() refactored

loops in client_input_data_write_local() and in client_deliver_next()
are merged as they are essentially the same loop,
client_deliver_next() renamed to client_deliver_to_rcpts().

8 years agolmtp: Fix for wrong session id of mail user when saving mail, quota checking on
Sergey Kitov [Thu, 6 Jul 2017 12:45:24 +0000 (15:45 +0300)] 
lmtp: Fix for wrong session id of mail user when saving mail, quota checking on

When quota is checked mail user is allocated with custom ":quota" session id
suffix without incrementing service user session id counter

8 years agolib-storage: Use ST_CHANGED in mailbox-watch
Aki Tuomi [Thu, 6 Jul 2017 11:45:26 +0000 (14:45 +0300)] 
lib-storage: Use ST_CHANGED in mailbox-watch

Allows notifying sub-second changes.

8 years agolib, lib-storage: Move INOTIFY_ST_CHANGED to ST_CHANGED in lib
Aki Tuomi [Thu, 6 Jul 2017 11:44:40 +0000 (14:44 +0300)] 
lib, lib-storage: Move INOTIFY_ST_CHANGED to ST_CHANGED in lib

Allows reusing this elsewhere

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 agovirtual: Avoid assert-crash if backend mailbox's have_guid lookup fails
Timo Sirainen [Thu, 6 Jul 2017 08:24:35 +0000 (11:24 +0300)] 
virtual: Avoid assert-crash if backend mailbox's have_guid lookup fails

The MAIL_ERROR_NOTFOUND can happen if the mailbox was already deleted.
Other errors aren't expected to happen and possibly point to a bug.

Fixes:
Panic: file mail-storage.c: line 1831: unreached

8 years agodoveadm: Fix a typo in doveadm-print-flow function name
Martti Rannanjärvi [Wed, 5 Jul 2017 11:38:19 +0000 (14:38 +0300)] 
doveadm: Fix a typo in doveadm-print-flow function name

doveadm_print_flow_print_heder() -> doveadm_print_flow_print_header()

8 years agonotify-status: Add notify-status plugin
Aki Tuomi [Tue, 4 Jul 2017 11:22:19 +0000 (14:22 +0300)] 
notify-status: Add notify-status plugin

This enables updating a dictionary with mailbox
status information when the mailbox changes.

It requires notify_status_dict setting for specifying
the dict where the data is stored.

One can optionally use notify_status_mailbox patterns
for specifying which box(es) the status update is done.
Subsequent patterns are notify_status_mailbox2 and so forth.

One can also specify data format using notify_status_value
plugin setting.

8 years agolib-http: server: Implemented API for handling the incoming request payload in the...
Stephan Bosch [Mon, 27 Mar 2017 22:03:04 +0000 (00:03 +0200)] 
lib-http: server: Implemented API for handling the incoming request payload in the background.

It allows forwarding the incoming payload to an output stream (e.g. iostream-temp) or to a buffer.
The maximum size of the payload is configurable. The client will get a 413 error if the maximum is exceeded.

8 years agolib-http: server: Explicitly record the number of references held for a request by...
Stephan Bosch [Sat, 17 Jun 2017 13:51:09 +0000 (15:51 +0200)] 
lib-http: server: Explicitly record the number of references held for a request by the application from within the callback.

8 years agolib-http: server: Allow holding only a reference to the request payload stream, rathe...
Stephan Bosch [Tue, 28 Mar 2017 22:17:50 +0000 (00:17 +0200)] 
lib-http: server: Allow holding only a reference to the request payload stream, rather than the request itself.

This mimics the http-client behavior in this case.
It makes the implementation of the background payload handling API in subsequent commits a little simpler.

8 years agolib-http: server: Changed http_server_request_is_complete() from an inline to a norma...
Stephan Bosch [Mon, 27 Mar 2017 18:44:37 +0000 (20:44 +0200)] 
lib-http: server: Changed http_server_request_is_complete() from an inline to a normal function.

8 years agolib-http: server: Restructured http-server-private.h.
Stephan Bosch [Mon, 27 Mar 2017 18:34:21 +0000 (20:34 +0200)] 
lib-http: server: Restructured http-server-private.h.

8 years agolib-http: server: Improved documentation in http-server.h.
Stephan Bosch [Mon, 27 Mar 2017 18:18:18 +0000 (20:18 +0200)] 
lib-http: server: Improved documentation in http-server.h.

8 years agolib-http: server: Restructured http-server.h.
Stephan Bosch [Mon, 27 Mar 2017 17:50:31 +0000 (19:50 +0200)] 
lib-http: server: Restructured http-server.h.

8 years agodsync: fix splitting login from host
Thomas Reifferscheid [Mon, 3 Jul 2017 20:06:21 +0000 (22:06 +0200)] 
dsync: fix splitting login from host

Using strchr() was splitting login and host at the first
occurrence of '@' which leads to troublesome behaviour.
When calling strace one would notice the misbehaviour:

execve("/usr/sbin/ssh", ["ssh", "-lthomas", "domain.org@10.8.13.2"

using strrch() however splits login and host at the last occurrence
of '@'.

Signed-off-by: Thomas Reifferscheid <thomas@reifferscheid.org>
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