]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
8 years agolib-dict: Moved/removed explicit stack frames in dict drivers.
Timo Sirainen [Fri, 6 May 2016 09:19:21 +0000 (12:19 +0300)] 
lib-dict: Moved/removed explicit stack frames in dict drivers.

Added them back to dict_set/unset/atomic_inc() in dict.c. Others are
unlikely to be called many times.

8 years agodict-sql: Change "uint" type to mean 64bit instead of 32bit integer.
Timo Sirainen [Tue, 15 Aug 2017 11:27:40 +0000 (14:27 +0300)] 
dict-sql: Change "uint" type to mean 64bit instead of 32bit integer.

This is likely what is usually wanted (especially in e.g. quotas).
If someone actually wants it to be restricted to 32bit, we could add
uint32 later on.

8 years agolib-sql: Add support for prepared SQL statements.
Timo Sirainen [Tue, 22 Aug 2017 08:37:17 +0000 (11:37 +0300)] 
lib-sql: Add support for prepared SQL statements.

This initial implementation doesn't use prepared statements in drivers, but
simply generates the query string internally.

8 years agolib-sql: Explicitly specify used *_vfuncs methods for drivers.
Timo Sirainen [Tue, 22 Aug 2017 08:31:51 +0000 (11:31 +0300)] 
lib-sql: Explicitly specify used *_vfuncs methods for drivers.

This allows adding more methods without modifying all the existing drivers.

8 years agolib: When logging I/O or timeout leak, log also raw backtrace
Timo Sirainen [Tue, 8 Aug 2017 17:07:18 +0000 (20:07 +0300)] 
lib: When logging I/O or timeout leak, log also raw backtrace

This can be useful when trying to figure out where the io_loop_destroy() was
called from.

8 years agolib-storage: index: Made MIME FILENAME search criterion match case-insensitively.
Stephan Bosch [Tue, 23 May 2017 12:05:02 +0000 (14:05 +0200)] 
lib-storage: index: Made MIME FILENAME search criterion match case-insensitively.

8 years agodirector: Fix flush to kick the user also when all backends are down
Timo Sirainen [Tue, 19 Sep 2017 22:47:38 +0000 (01:47 +0300)] 
director: Fix flush to kick the user also when all backends are down

The user's host can't change, because there are no other hosts. So add a
new parameter to force the kick anyway.

8 years agodirector: Avoid "ring sync timeout" errors when all backends are down
Timo Sirainen [Thu, 14 Sep 2017 09:50:29 +0000 (12:50 +0300)] 
director: Avoid "ring sync timeout" errors when all backends are down

doveadm commands were failing with it. Also pending request failures were
logged as failing due to ring sync timeout, instead of because no hosts.

8 years agodirector: Delay calling state_change_callback() after user kick is finished
Timo Sirainen [Thu, 14 Sep 2017 10:02:40 +0000 (13:02 +0300)] 
director: Delay calling state_change_callback() after user kick is finished

Otherwise it can get into recursive loop and cause problems.

8 years agodoveadm director: Improve logging unexpected disconnections from director socket
Timo Sirainen [Thu, 14 Sep 2017 09:42:13 +0000 (12:42 +0300)] 
doveadm director: Improve logging unexpected disconnections from director socket

Previously it just logged "failed", which wasn't very understandable.

8 years agodirector: Fix crash when flush is run and all backends are down.
Timo Sirainen [Tue, 22 Aug 2017 13:32:32 +0000 (16:32 +0300)] 
director: Fix crash when flush is run and all backends are down.

Instead of moving the users elsewhere, just kill them and flush the backend.

8 years agonotify-status plugin: Use priv/status/<mailbox> for keys
Timo Sirainen [Wed, 20 Sep 2017 12:03:55 +0000 (15:03 +0300)] 
notify-status plugin: Use priv/status/<mailbox> for keys

priv/<mailbox>/status can't be used with dict-sql when <mailbox> has '/'.

8 years agonotify-status: Remove first_unseen_seq field
Timo Sirainen [Mon, 18 Sep 2017 20:04:55 +0000 (23:04 +0300)] 
notify-status: Remove first_unseen_seq field

The sequence number keeps changing, so it's very unlikely to be useful.
It's also not always as efficiently available as the other fields, so
better to avoid having it.

8 years agonotify-status: Provide access to all easy fields
Aki Tuomi [Mon, 4 Sep 2017 12:32:24 +0000 (15:32 +0300)] 
notify-status: Provide access to all easy fields

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: file_lock_set_unlink_on_free() - Avoid unlink() if another process is waiting...
Timo Sirainen [Tue, 12 Sep 2017 11:54:57 +0000 (14:54 +0300)] 
lib: file_lock_set_unlink_on_free() - Avoid unlink() if another process is waiting on the lock

8 years agolib-compression: Fix assert in i_stream_zlib_seek
Anton Yuzhaninov [Thu, 31 Aug 2017 00:49:17 +0000 (20:49 -0400)] 
lib-compression: Fix assert in i_stream_zlib_seek

Also fix same bug in i_stream_bzlib_seek, i_stream_lz4_seek, i_stream_lzma_seek.

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 agodsync: Fix panic if syncing fails during attribute iteration
Timo Sirainen [Tue, 13 Jun 2017 18:00:23 +0000 (21:00 +0300)] 
dsync: Fix panic if syncing fails during attribute iteration

Fixes:
Panic: file dict.c: line 104 (dict_deinit): assertion failed: (dict->iter_count == 0)

8 years agolib-storage: mail_storage_set_critical() - don't free old error_string too early
Timo Sirainen [Fri, 25 Aug 2017 15:02:44 +0000 (18:02 +0300)] 
lib-storage: mail_storage_set_critical() - don't free old error_string too early

It may be used in one of the parameters.

8 years agolib-smtp: lmtp-client: Fixed handling of unexpected reply while sending RCPT TO commands.
Stephan Bosch [Tue, 12 Sep 2017 22:28:38 +0000 (00:28 +0200)] 
lib-smtp: lmtp-client: Fixed handling of unexpected reply while sending RCPT TO commands.

It caused a segfault.

8 years agodoveadm director kick: Fix -f parameter to work
Timo Sirainen [Fri, 8 Sep 2017 13:00:53 +0000 (16:00 +0300)] 
doveadm director kick: Fix -f parameter to work

It already worked as --passdb-field, but now it matches the usage string.

8 years agodsync: Ignore missing remote mailbox when doing unidirectional sync
Aki Tuomi [Tue, 5 Sep 2017 07:43:46 +0000 (10:43 +0300)] 
dsync: Ignore missing remote mailbox when doing unidirectional sync

If there are some folders on remote system that
are being ignored by remote brain, do not error out.

8 years agodoveadm: Actually use resolved IP address(es) in director flush
Aki Tuomi [Fri, 18 Aug 2017 11:58:37 +0000 (14:58 +0300)] 
doveadm: Actually use resolved IP address(es) in director flush

It left the IP variable unitialized which caused host parameter
to be left empty causing flush all. Flushing with IP address
was not affected.

8 years agodirector: Make sure users gets expired even on an idle director
Timo Sirainen [Thu, 10 Aug 2017 14:50:04 +0000 (17:50 +0300)] 
director: Make sure users gets expired even on an idle director

Normally expiring gets done while looking up users, but if nothing is doing
that on an idle director the users won't get expired. This can cause confusion
in "doveadm director status" output.

8 years agodoveconf: Preserve import_environment when execing binary
Timo Sirainen [Wed, 7 Jun 2017 22:03:13 +0000 (01:03 +0300)] 
doveconf: Preserve import_environment when execing binary

This allows import_environment setting to work with doveadm and other
standalone tools.

8 years agolib-master, config: Move the responsibility of cleaning environment to doveconf
Timo Sirainen [Wed, 7 Jun 2017 21:40:12 +0000 (00:40 +0300)] 
lib-master, config: Move the responsibility of cleaning environment to doveconf

8 years agolib-master: Use master_service_import_environment() for preserving environments
Timo Sirainen [Wed, 7 Jun 2017 21:35:08 +0000 (00:35 +0300)] 
lib-master: Use master_service_import_environment() for preserving environments

8 years agolib-master: master_service_import_environment() - use a data stack frame
Timo Sirainen [Wed, 7 Jun 2017 21:33:32 +0000 (00:33 +0300)] 
lib-master: master_service_import_environment() - use a data stack frame

This way the caller doesn't have to do it.

8 years agomaster: Move master_set_import_environment() to lib-master
Timo Sirainen [Wed, 7 Jun 2017 21:24:19 +0000 (00:24 +0300)] 
master: Move master_set_import_environment() to lib-master

8 years agomaster: Append to existing DOVECOT_PRESERVE_ENVS instead of overwriting it
Timo Sirainen [Wed, 7 Jun 2017 21:20:38 +0000 (00:20 +0300)] 
master: Append to existing DOVECOT_PRESERVE_ENVS instead of overwriting it

8 years agomaster: Move import_environment setting to lib-master's master_service_settings
Timo Sirainen [Wed, 7 Jun 2017 21:14:30 +0000 (00:14 +0300)] 
master: Move import_environment setting to lib-master's master_service_settings

8 years agolib-storage: Fix mailbox list notification assert-crash when mailbox is deleted
Timo Sirainen [Mon, 11 Sep 2017 09:27:17 +0000 (12:27 +0300)] 
lib-storage: Fix mailbox list notification assert-crash when mailbox is deleted

Reproduced with if IMAP NOTIFY is used for non-selected mailboxes without
MailboxName being specified. Another session then does changes to a
mailbox and immediately deletes it, which causes the crash.

Fixes:
Panic: file mailbox-list-index-notify.c: line 751: unreached

8 years agolib-index: mail_index_use_existing_permissions() - Ignore with INDEX=MEMORY
Timo Sirainen [Mon, 11 Sep 2017 09:59:27 +0000 (12:59 +0300)] 
lib-index: mail_index_use_existing_permissions() - Ignore with INDEX=MEMORY

8 years agolib-index: mail_index_use_existing_permissions() - Log error if stat() unexpectedly...
Timo Sirainen [Mon, 11 Sep 2017 09:58:28 +0000 (12:58 +0300)] 
lib-index: mail_index_use_existing_permissions() - Log error if stat() unexpectedly fails

8 years agolib-http: message parser: Reject messages with invalid Date header when HTTP_MESSAGE_...
Stephan Bosch [Thu, 27 Jul 2017 14:34:34 +0000 (16:34 +0200)] 
lib-http: message parser: Reject messages with invalid Date header when HTTP_MESSAGE_PARSE_FLAG_STRICT flag is enabled.

8 years agolib-http: Fixed bug in date parser: sometimes read one byte past end of input.
Stephan Bosch [Thu, 27 Jul 2017 14:30:20 +0000 (16:30 +0200)] 
lib-http: Fixed bug in date parser: sometimes read one byte past end of input.

This caused spurious parse errors.

8 years agolib-http: test-http-response-parser: Show error message for tests of invalid responses.
Stephan Bosch [Thu, 27 Jul 2017 14:03:44 +0000 (16:03 +0200)] 
lib-http: test-http-response-parser: Show error message for tests of invalid responses.

8 years ago*-login: Cache director_username_hash between KICK-DIRECTOR-HASH commands
Timo Sirainen [Wed, 19 Jul 2017 13:53:17 +0000 (16:53 +0300)] 
*-login: Cache director_username_hash between KICK-DIRECTOR-HASH commands

This should make the kicking much faster, which is important when director
is moving thousands of users.

8 years agolib-mail: Make sure mail_user_hash() won't return 0 as the hash.
Timo Sirainen [Wed, 19 Jul 2017 13:49:18 +0000 (16:49 +0300)] 
lib-mail: Make sure mail_user_hash() won't return 0 as the hash.

It doesn't seem to actually happen, but this makes sure of it.

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 agosdbox: Don't open mail files when expunging
Timo Sirainen [Fri, 25 Aug 2017 15:40:23 +0000 (18:40 +0300)] 
sdbox: Don't open mail files when expunging

It was done when mail_attachment_fs was non-empty (and default is
non-empty), even though mail_attachment_dir was empty.

8 years agomdbox: Use mail_storage_set_index_error() instead of poorly duplicating it
Timo Sirainen [Mon, 21 Aug 2017 12:44:41 +0000 (15:44 +0300)] 
mdbox: Use mail_storage_set_index_error() instead of poorly duplicating it

8 years agolib-storage: Add mail_storage_set_index_error()
Timo Sirainen [Mon, 21 Aug 2017 12:34:40 +0000 (15:34 +0300)] 
lib-storage: Add mail_storage_set_index_error()

8 years agolib-storage: index_mail_set_cache_corrupted() - Don't reset internal error string
Timo Sirainen [Mon, 21 Aug 2017 12:29:46 +0000 (15:29 +0300)] 
lib-storage: index_mail_set_cache_corrupted() - Don't reset internal error string

It's already set correctly by the earlier functions.

8 years agolib-storage: mail_set_mail_cache_corrupted() - set also internal error string
Timo Sirainen [Mon, 21 Aug 2017 12:27:48 +0000 (15:27 +0300)] 
lib-storage: mail_set_mail_cache_corrupted() - set also internal error string

8 years agolib-storage: mailbox_set_index_error() - Set internal error string to index's error
Timo Sirainen [Mon, 21 Aug 2017 12:26:13 +0000 (15:26 +0300)] 
lib-storage: mailbox_set_index_error() - Set internal error string to index's error

8 years agolib-storage: Fix error logging after mail_storage_set_internal_error()
Timo Sirainen [Mon, 21 Aug 2017 12:11:30 +0000 (15:11 +0300)] 
lib-storage: Fix error logging after mail_storage_set_internal_error()

The function doesn't actually set the last_internal_error and it also
doesn't update last_error_is_internal, so calling
mail_storage_get_last_internal_error() afterwards could be returning an
error for some different older error.

Since there's no parameter to set the internal error string, just reset
last_error_is_internal=FALSE.

8 years agolib-storage: Preserve messages' vsize record when rebuilding index
Timo Sirainen [Fri, 8 Sep 2017 09:20:21 +0000 (12:20 +0300)] 
lib-storage: Preserve messages' vsize record when rebuilding index

Since vsize is often used by quota, losing this can be very expensive.
If the vsize is wrong, it gets fixed automatically when fetching the
message body.

8 years agolib-index: Avoid opening .log.2 file if .log was reset
Timo Sirainen [Fri, 25 Aug 2017 12:12:06 +0000 (15:12 +0300)] 
lib-index: Avoid opening .log.2 file if .log was reset

After a reset there's no point in trying to read the older log files.
This avoids trying to open .log.2 at least for newly created mailboxes
when trying to lookup log file sequence 1 (since due to some bug/feature
the log files start from sequence 2).

8 years agolib-settings: Escape comma in section name.
Sergey Kitov [Thu, 24 Aug 2017 07:01:02 +0000 (10:01 +0300)] 
lib-settings: Escape comma in section name.

Comma is valid symbol in encoded non-ascii section names, so it
shouldn't be used as splitting symbol in section name.

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.