]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
8 years agolib-storage: Add mailbox_list_get_last_mail_error()
Timo Sirainen [Tue, 27 Jun 2017 13:16:21 +0000 (16:16 +0300)] 
lib-storage: Add mailbox_list_get_last_mail_error()

8 years agolib-storage: Add comments to mailbox-list-delete.h
Timo Sirainen [Tue, 27 Jun 2017 12:57:10 +0000 (15:57 +0300)] 
lib-storage: Add comments to mailbox-list-delete.h

8 years agolib: Fix file_create_locked() unit test to delete temp file afterwards
Timo Sirainen [Wed, 28 Jun 2017 20:37:22 +0000 (23:37 +0300)] 
lib: Fix file_create_locked() unit test to delete temp file afterwards

Also removed a path string that was never used.

8 years agolib-storage: Add VOLATILEDIR setting to mail_location
Timo Sirainen [Wed, 21 Jun 2017 22:28:57 +0000 (01:28 +0300)] 
lib-storage: Add VOLATILEDIR setting to mail_location

This is useful for creating temporary locks that could exist in tmpfs.
Currently this is used for .vsize.lock and dovecot.autoexpunge.lock.

8 years agolib-storage: Move autoexpunge lock creation to a generic mail_user_lock_file_create()
Timo Sirainen [Wed, 21 Jun 2017 23:44:12 +0000 (02:44 +0300)] 
lib-storage: Move autoexpunge lock creation to a generic mail_user_lock_file_create()

8 years agolib-storage: mailbox_autoexpunge_lock() - Don't hide ENOENT error
Timo Sirainen [Wed, 21 Jun 2017 23:33:03 +0000 (02:33 +0300)] 
lib-storage: mailbox_autoexpunge_lock() - Don't hide ENOENT error

It means that the user's home directory doesn't exist, which is pretty
unexpected. Home directory is supposed to be created when the storage is
initialized.

8 years agolib-storage: mailbox_autoexpunge_lock() - small cleanup
Timo Sirainen [Wed, 21 Jun 2017 23:32:10 +0000 (02:32 +0300)] 
lib-storage: mailbox_autoexpunge_lock() - small cleanup

No functional changes - just reorganizing code and adding comments.

8 years agolib-storage: Use file_lock_set_*_on_free() for dovecot.autoexpunge.lock
Timo Sirainen [Wed, 21 Jun 2017 23:24:08 +0000 (02:24 +0300)] 
lib-storage: Use file_lock_set_*_on_free() for dovecot.autoexpunge.lock

8 years agolib-storage: Move .vsize.lock creation to a generic mailbox_lock_file_create()
Timo Sirainen [Wed, 21 Jun 2017 23:19:18 +0000 (02:19 +0300)] 
lib-storage: Move .vsize.lock creation to a generic mailbox_lock_file_create()

8 years agolib-storage: Move .vsize.lock creation to its own function
Timo Sirainen [Wed, 21 Jun 2017 23:07:16 +0000 (02:07 +0300)] 
lib-storage: Move .vsize.lock creation to its own function

8 years agolib-storage: Use file_lock_set_*_on_free() for .vsize.lock
Timo Sirainen [Wed, 21 Jun 2017 23:05:16 +0000 (02:05 +0300)] 
lib-storage: Use file_lock_set_*_on_free() for .vsize.lock

This avoids storing the lock_path and lock_fd separately.

8 years agolib-storage: Fix error logging for failing to create .vsize.lock
Timo Sirainen [Wed, 21 Jun 2017 22:56:18 +0000 (01:56 +0300)] 
lib-storage: Fix error logging for failing to create .vsize.lock

8 years agolib: file_create_locked() - Add settings to mkdir() missing parent directories
Timo Sirainen [Wed, 28 Jun 2017 14:48:01 +0000 (17:48 +0300)] 
lib: file_create_locked() - Add settings to mkdir() missing parent directories

8 years agolib: Add unit test for file_create_locked()
Timo Sirainen [Wed, 28 Jun 2017 14:40:20 +0000 (17:40 +0300)] 
lib: Add unit test for file_create_locked()

8 years agolib: Add file_lock_set_close_on_free()
Timo Sirainen [Wed, 21 Jun 2017 22:52:29 +0000 (01:52 +0300)] 
lib: Add file_lock_set_close_on_free()

8 years agolib: Add file_lock_set_unlink_on_free()
Timo Sirainen [Wed, 21 Jun 2017 22:47:51 +0000 (01:47 +0300)] 
lib: Add file_lock_set_unlink_on_free()

8 years agolib: file_create_locked() - update lock path after link()
Timo Sirainen [Thu, 22 Jun 2017 07:35:16 +0000 (10:35 +0300)] 
lib: file_create_locked() - update lock path after link()

8 years agolib: Add file_lock_set_path()
Timo Sirainen [Thu, 22 Jun 2017 06:05:06 +0000 (09:05 +0300)] 
lib: Add file_lock_set_path()

8 years agolib: Add file_lock_get_path()
Timo Sirainen [Wed, 21 Jun 2017 22:42:56 +0000 (01:42 +0300)] 
lib: Add file_lock_get_path()

This allows getting the file path from the lock without having to preserve
it separately.

8 years agolib-storage: Fail at startup if root mail directory isn't a directory
Timo Sirainen [Mon, 26 Jun 2017 16:19:44 +0000 (19:19 +0300)] 
lib-storage: Fail at startup if root mail directory isn't a directory

8 years agolib-ssl-iostream: Fixed deinitialization of openssl library.
Stephan Bosch [Fri, 7 Apr 2017 13:36:58 +0000 (15:36 +0200)] 
lib-ssl-iostream: Fixed deinitialization of openssl library.

Previously, it also dereferenced the library when it was never initialized in the first place.

8 years agolib-program-client: Fixed unix socket test suite's test server to properly read input...
Stephan Bosch [Mon, 22 May 2017 15:41:54 +0000 (17:41 +0200)] 
lib-program-client: Fixed unix socket test suite's test server to properly read input from client.

It did not read all available input in the input handler.

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 agosdbox: Don't create index directory when trying to open nonexistent mailboxes
Timo Sirainen [Tue, 27 Jun 2017 13:55:34 +0000 (16:55 +0300)] 
sdbox: Don't create index directory when trying to open nonexistent mailboxes

8 years agopop3-migration: Drop lines with only spaces or tabs from comparison
Timo Sirainen [Wed, 28 Jun 2017 12:50:11 +0000 (15:50 +0300)] 
pop3-migration: Drop lines with only spaces or tabs from comparison

Zimbra drops out those lines from IMAP BODY[HEADER] replies.

8 years agolib-http: client: Drop peer immediately if it has no more linked queues and it is...
Stephan Bosch [Fri, 20 Jan 2017 00:10:04 +0000 (01:10 +0100)] 
lib-http: client: Drop peer immediately if it has no more linked queues and it is not connected and not waiting for a backoff timeout.

It is currently unlikely to happen at this point, but it is better to make sure it is handled appropriately.
The pending shared HTTP client changes will make this a likely event.
This surfaced as a problem for the HTTP proxy.

8 years agolib-storage: mail_add_temp_wanted_fields() - delay opening stream
Timo Sirainen [Sun, 25 Jun 2017 06:10:52 +0000 (09:10 +0300)] 
lib-storage: mail_add_temp_wanted_fields() - delay opening stream

Allows plugins to call it in mail.get_stream() without infinite loop.

8 years agoglobal: Fixed missing or out-of-date copyright notices.
Stephan Bosch [Fri, 23 Jun 2017 14:45:24 +0000 (16:45 +0200)] 
global: Fixed missing or out-of-date copyright notices.

8 years agodsync: Use header hashing version 3
Timo Sirainen [Fri, 23 Jun 2017 08:15:32 +0000 (11:15 +0300)] 
dsync: Use header hashing version 3

8 years agopop3-migration: Replace trailing whitespace removal with new header hashing version
Timo Sirainen [Fri, 23 Jun 2017 08:02:24 +0000 (11:02 +0300)] 
pop3-migration: Replace trailing whitespace removal with new header hashing version

This is now done by message_header_hash(), which makes it work correctly
also for dsync+imapc.

Reverts 0cf3b30b86e6c39f43b8e13a718cd078187ca86d, except for the unit tests.

8 years agolib-mail: message_header_hash_more() - add v3 that strips spaces
Timo Sirainen [Fri, 23 Jun 2017 08:00:37 +0000 (11:00 +0300)] 
lib-mail: message_header_hash_more() - add v3 that strips spaces

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

8 years agolib-mail: test-message-header-hash - add more tests
Timo Sirainen [Fri, 23 Jun 2017 06:24:40 +0000 (09:24 +0300)] 
lib-mail: test-message-header-hash - add more tests

8 years agolib-mail: message_header_hash_more() - refactor to use switch()
Timo Sirainen [Fri, 23 Jun 2017 06:14:40 +0000 (09:14 +0300)] 
lib-mail: message_header_hash_more() - refactor to use switch()

8 years agoquota: Fix failing again if quota setting has invalid parameters
Timo Sirainen [Thu, 22 Jun 2017 08:43:05 +0000 (11:43 +0300)] 
quota: Fix failing again if quota setting has invalid parameters

This was broken by the recent quota parameter parsing changes.

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 agofs-randomfail: Set errno=EIO when random failure is triggered
Timo Sirainen [Wed, 21 Jun 2017 10:10:19 +0000 (13:10 +0300)] 
fs-randomfail: Set errno=EIO when random failure is triggered

Previously the errno wasn't set at all. It was especially bad if it
happened to be EAGAIN, because that potentially caused hangs.

8 years agolib-imap: imap_append_nstring_nolf() - fix crash with datastack_pool strings
Sergey Kitov [Tue, 20 Jun 2017 09:11:37 +0000 (12:11 +0300)] 
lib-imap: imap_append_nstring_nolf() - fix crash with datastack_pool strings

T_BEGIN .. T_END is not used, when string_t is allocated from
datastack pool, unit test updated to verify the fix.

8 years agoacl: Fix reading acl_globals_only setting
Timo Sirainen [Mon, 19 Jun 2017 20:38:35 +0000 (23:38 +0300)] 
acl: Fix reading acl_globals_only setting

It was being read in wrong place, so it may not have been read at all.

8 years agodirector: Fix logging last input/output time when there was no input/output
Timo Sirainen [Mon, 19 Jun 2017 09:05:30 +0000 (12:05 +0300)] 
director: Fix logging last input/output time when there was no input/output

8 years agodirector: Fix whitespace position in some log messages
Timo Sirainen [Mon, 19 Jun 2017 09:03:13 +0000 (12:03 +0300)] 
director: Fix whitespace position in some log messages

8 years agoacl: Add acl_globals_only setting
Timo Sirainen [Mon, 19 Jun 2017 08:30:27 +0000 (11:30 +0300)] 
acl: Add acl_globals_only setting

The local dovecot-acl files aren't even attempted to be looked up if this is
set. This is mainly useful to avoid unnecessary stat()s to dovecot-acl files
that never exist.

8 years agoimap: NOTIFY - Fix potential crash when reading invalid parameters
Timo Sirainen [Sat, 17 Jun 2017 11:39:59 +0000 (14:39 +0300)] 
imap: NOTIFY - Fix potential crash when reading invalid parameters

8 years agoimap: Fix NOTIFY to parse more than just the first event-group
Timo Sirainen [Sat, 17 Jun 2017 11:38:22 +0000 (14:38 +0300)] 
imap: Fix NOTIFY to parse more than just the first event-group

8 years agoimap: NOTIFY - Cleanup notify watch timeout handling
Timo Sirainen [Sun, 18 Jun 2017 21:01:17 +0000 (00:01 +0300)] 
imap: NOTIFY - Cleanup notify watch timeout handling

It's not useful to set the timeout until all the commands are finished.

8 years agoimap: NOTIFY - Fix crash due to not hooking into commands correctly
Timo Sirainen [Sun, 18 Jun 2017 08:14:05 +0000 (11:14 +0300)] 
imap: NOTIFY - Fix crash due to not hooking into commands correctly

The pre/post hooks aren't always called immediately when commands are
created. They're called only after the command input is being read.
Call notify hooks explicitly now immediately when commands are allocated.

Fixes a panic with for example:

a notify set (selected (Messagenew (uid flags) MessageExpunge FlagChange) personal (MessageNew MessageExpunge FlagChange))
b select inbox
c store 1 +flags \deleted
d expunge
e append inbox {10}

Which crashed with:
Panic: file imap-notify.c: line 397 (imap_notify_callback): assertion failed: (client->command_queue_size == 0)

8 years agoimap: NOTIFY - Fix delayed setting notification callback
Timo Sirainen [Sun, 18 Jun 2017 08:19:28 +0000 (11:19 +0300)] 
imap: NOTIFY - Fix delayed setting notification callback

This was done in command-post hook, but then when command was soon freed the
callback was immediately added.

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 ago*-login: Add client_vfuncs.free() that is called when client refcount=0
Timo Sirainen [Fri, 16 Jun 2017 11:34:24 +0000 (14:34 +0300)] 
*-login: Add client_vfuncs.free() that is called when client refcount=0

This can be useful for plugins that want to run something after proxying
ends.

Use an empty default function so plugins can call super.free() without
having to check if it's NULL.

8 years agoimap-login: Fix storing ID NIL values into client_id
Timo Sirainen [Thu, 15 Jun 2017 09:46:47 +0000 (12:46 +0300)] 
imap-login: Fix storing ID NIL values into client_id

8 years agolib-imap: imap_bodystructure_write is changed to skip CRs and LFs.
Sergey Kitov [Wed, 14 Jun 2017 07:44:36 +0000 (10:44 +0300)] 
lib-imap: imap_bodystructure_write is changed to skip CRs and LFs.

8 years agolib-imap: imap_write_envelope changed to skip CRs and LFs.
Sergey Kitov [Wed, 14 Jun 2017 07:44:01 +0000 (10:44 +0300)] 
lib-imap: imap_write_envelope changed to skip CRs and LFs.

8 years agolib-imap: added imap_append_nstring_nolf(), which skips CRs and LFs.
Sergey Kitov [Wed, 14 Jun 2017 07:41:04 +0000 (10:41 +0300)] 
lib-imap: added imap_append_nstring_nolf(), which skips CRs and LFs.

8 years agolib-imap: escaping and quote/literal tests for imap_append_nstring()
Sergey Kitov [Tue, 13 Jun 2017 07:05:23 +0000 (10:05 +0300)] 
lib-imap: escaping and quote/literal tests for imap_append_nstring()

8 years agoimapc: Fix prefetching specific headers
Timo Sirainen [Mon, 12 Jun 2017 21:57:08 +0000 (00:57 +0300)] 
imapc: Fix prefetching specific headers

FETCH BODY[HEADER.FIELDS ...] shouldn't be used if imapc_features doesn't
include fetch-headers. Also neither this nor BODY[HEADER] should be sent
if we already have header/body stream.

8 years agoimapc: Avoid sending FETCH BODY[HEADER] when BODY[] is already being fetched
Timo Sirainen [Mon, 12 Jun 2017 21:55:36 +0000 (00:55 +0300)] 
imapc: Avoid sending FETCH BODY[HEADER] when BODY[] is already being fetched

This probably only shows up in some special situations with plugins.

8 years agolib-master: anvil_client_query() delay calling callback on failures
Timo Sirainen [Tue, 13 Jun 2017 14:18:17 +0000 (17:18 +0300)] 
lib-master: anvil_client_query() delay calling callback on failures

This fixes crash in lmtp on anvil connect failure where the callback wasn't
expecting to be called so early.

8 years agoimap-login: Remove duplicate spaces between ID x-forward parameters
Timo Sirainen [Wed, 14 Jun 2017 08:47:00 +0000 (11:47 +0300)] 
imap-login: Remove duplicate spaces between ID x-forward parameters

8 years agoimap-login: Fix crash in ID if trusted client sends NIL value to internal field
Timo Sirainen [Wed, 14 Jun 2017 07:50:38 +0000 (10:50 +0300)] 
imap-login: Fix crash in ID if trusted client sends NIL value to internal field

Fixes:
Panic: imap-login: file imap-login-client.c: line 215 (cmd_id_handle_keyvalue): assertion failed: (client_id_str == !client_id_reserved_word(key))

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-index: Fix cache lookups from uncommitted transactions with in-memory indexes
Timo Sirainen [Tue, 13 Jun 2017 19:14:11 +0000 (22:14 +0300)] 
lib-index: Fix cache lookups from uncommitted transactions with in-memory indexes

This especially fixes mail_get_header_stream() with imapc and
imapc_features=fetch-headers, because it works by first fetching the
specific headers and putting them to the cache transaction, then later on
relying on index_mail_get_header_stream() to get them from the transaction.
Before this fix they wouldn't be found, which triggered another unnecessary
FETCH BODY.PEEK[HEADER].

8 years agolib-mail: istream-header-filter - Fix HEADER_FILTER_ADD_MISSING_EOH with empty input
Timo Sirainen [Tue, 13 Jun 2017 18:54:00 +0000 (21:54 +0300)] 
lib-mail: istream-header-filter - Fix HEADER_FILTER_ADD_MISSING_EOH with empty input

The result for "" should be "\n", not "\n\n". The second "\n" would belong
to the mail body.

This fixes calculating hashes for incremental dsync when mail didn't have
Date or Message-ID headers, resulting in e.g.:

Warning: Deleting mailbox 'INBOX': UID=1 already exists locally for a different mail: Headers hashes don't match (e1c06d85ae7b8b032bef47e42e4c08f9 vs 68b329da9893e34099c7d8ad5cb9c940)

8 years agolib: istream-seekable - Fix reading when parent stream's content is larger than max_b...
Timo Sirainen [Wed, 14 Jun 2017 00:21:19 +0000 (03:21 +0300)] 
lib: istream-seekable - Fix reading when parent stream's content is larger than max_buffer_size

When writing the parent stream to fd and trying to read it back, it would
try to enforce the max_buffer_size and fail with:

istream-seekable: Couldn't read back in-memory input ...: buffer full

But since the data was already in buffer, istream-seekable shouldn't try to
enforce it at this point anymore.

8 years agolib-oauth2: Handle non-2xx/4xx results for token validation without crash
Timo Sirainen [Tue, 13 Jun 2017 15:26:26 +0000 (18:26 +0300)] 
lib-oauth2: Handle non-2xx/4xx results for token validation without crash

Fixes:
Panic: file oauth2-token-validate.c: line 33 (oauth2_token_validate_continue): assertion failed: (array_is_created(&req->fields))

8 years ago*-login: Add client_vfuncs.input_next_cmd()
Timo Sirainen [Mon, 12 Jun 2017 19:52:56 +0000 (22:52 +0300)] 
*-login: Add client_vfuncs.input_next_cmd()

This allows plugins to hook into all the pre-login commands. For example
with imap-login most of the commands could already be hooked into, except
for ID and AUTHENTICATE because their parameters reading is handled
specially. This allows hooking into them as well.

This is actually internal to all the login binaries, so it wouldn't have to
be in login-common. However, login-common already has all the code to handle
overriding functions nicely and this is a rather useful feature for all the
protocols anyway, so it's easier this way and not too ugly.

8 years agopop3-login: Cleanup - move command handling to pop3_client_input_next_cmd()
Timo Sirainen [Mon, 12 Jun 2017 19:51:12 +0000 (22:51 +0300)] 
pop3-login: Cleanup - move command handling to pop3_client_input_next_cmd()

8 years agoimap: command_stats_start call is added for unknown commands.
Sergey Kitov [Mon, 12 Jun 2017 10:45:33 +0000 (13:45 +0300)] 
imap: command_stats_start call is added for unknown commands.

This makes timing shown in reply to unknown commands correct

8 years agopush-notification: Switch to main ioloop while calling drivers' commit callbacks
Timo Sirainen [Mon, 12 Jun 2017 20:45:05 +0000 (23:45 +0300)] 
push-notification: Switch to main ioloop while calling drivers' commit callbacks

There aren't any guarantees what ioloop happens to be active at the time
the commit is called. The active ioloop can also be destroyed early on,
which can cause an I/O leak and crashes later on.

8 years agoimap: Fix pipelining commands with SEARCH
Timo Sirainen [Mon, 12 Jun 2017 20:20:12 +0000 (23:20 +0300)] 
imap: Fix pipelining commands with SEARCH

If the SEARCH wasn't a long-running one, it ends with going to sync.
The command state shouldn't then be changed to _WAIT_EXTERNAL.

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 agoimapc: If mailbox iteration fails, make sure error message isn't lost.
Timo Sirainen [Mon, 12 Jun 2017 11:35:22 +0000 (14:35 +0300)] 
imapc: If mailbox iteration fails, make sure error message isn't lost.

8 years agolib-storage: Fail mailbox list iteration early if it fails to get INBOX flags
Timo Sirainen [Mon, 12 Jun 2017 11:33:46 +0000 (14:33 +0300)] 
lib-storage: Fail mailbox list iteration early if it fails to get INBOX flags

The resulting INBOX reply could be wrong in that case.

Also with imapc if the remote server is down, this causes two connection
errors instead of just one.

8 years agolib-storage: If mailbox list iteration fails, don't add INBOX
Timo Sirainen [Mon, 12 Jun 2017 11:16:13 +0000 (14:16 +0300)] 
lib-storage: If mailbox list iteration fails, don't add INBOX

It possibly should have been returned by the list iteration itself and we
could be returning it wrong here.

Also calling this causes imapc to lost the error message in mailbox_list.

8 years agoimapc: Don't reconnect on DELETE if auth failure was already seen.
Timo Sirainen [Mon, 12 Jun 2017 09:18:28 +0000 (12:18 +0300)] 
imapc: Don't reconnect on DELETE if auth failure was already seen.

8 years agoimapc: Don't reconnect on STATUS if auth failure was already seen.
Timo Sirainen [Mon, 12 Jun 2017 09:16:19 +0000 (12:16 +0300)] 
imapc: Don't reconnect on STATUS if auth failure was already seen.

8 years agoimapc: Remove root_sep_lookup_failed cache
Timo Sirainen [Mon, 12 Jun 2017 08:57:52 +0000 (11:57 +0300)] 
imapc: Remove root_sep_lookup_failed cache

The auth_failed_* should already be enough for this. This removal also
fixes the storage error message to be auth_failed_reason when possible.

8 years agoimapc: Check for auth failures when saving messages
Timo Sirainen [Mon, 12 Jun 2017 09:07:52 +0000 (12:07 +0300)] 
imapc: Check for auth failures when saving messages

First, don't even attempt an APPEND if we've already seen an auth failure.
Second, if APPEND does fail because of auth error, set the correct error to
storage.

8 years agoimapc: Fix APPEND error message to include APPEND, not COPY
Timo Sirainen [Mon, 12 Jun 2017 09:03:39 +0000 (12:03 +0300)] 
imapc: Fix APPEND error message to include APPEND, not COPY

8 years agoimapc: Make sure storage error has the proper auth failure error string
Timo Sirainen [Mon, 12 Jun 2017 08:40:03 +0000 (11:40 +0300)] 
imapc: Make sure storage error has the proper auth failure error string

The first failed command always had the correct error string, but the
following failed commands just returned -1 without updating storage error.
The storage error could have been something completely different by then.

8 years agoimapc: Cleanup - Rename auth_error to auth_failed_reason for consistency
Timo Sirainen [Mon, 12 Jun 2017 08:33:38 +0000 (11:33 +0300)] 
imapc: Cleanup - Rename auth_error to auth_failed_reason for consistency

8 years agoimapc: Change auth_failed boolean to more specific auth_failed_state
Timo Sirainen [Mon, 12 Jun 2017 08:32:23 +0000 (11:32 +0300)] 
imapc: Change auth_failed boolean to more specific auth_failed_state

Since we now rely on auth_failed_state being initialized to zero,
explicitly set IMAPC_COMMAND_STATE_OK to be defined as 0.

8 years agoimapc: Remove auth_failed check from imapc_list_get_storage_name()
Timo Sirainen [Mon, 12 Jun 2017 08:05:31 +0000 (11:05 +0300)] 
imapc: Remove auth_failed check from imapc_list_get_storage_name()

Reverts 9949dc3649ac7a00289f6bf0662c793bee3d4286. It doesn't seem to be
actually needed at least now, and it's breaking:

 * SELECT INBOX -> failure due to remote server being down
 * SELECT INBOX -> NO [CANNOT] Invalid mailbox name: Name is empty

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 agopop3-migration: Strip trailing spaces from headers when calculating hash
Timo Sirainen [Mon, 12 Jun 2017 11:24:59 +0000 (14:24 +0300)] 
pop3-migration: Strip trailing spaces from headers when calculating hash

Fixes matching mails with Zimbra.

8 years agoimap-quota: If quota lookups fail, return NO for GETQUOTA/GETQUOTAROOT
Timo Sirainen [Thu, 8 Jun 2017 17:34:39 +0000 (20:34 +0300)] 
imap-quota: If quota lookups fail, return NO for GETQUOTA/GETQUOTAROOT

8 years agoquota: Update comments in quota.h
Timo Sirainen [Thu, 8 Jun 2017 17:34:27 +0000 (20:34 +0300)] 
quota: Update comments in quota.h

8 years agoquota: quota_root_iter_next() - Iterate all visible roots
Timo Sirainen [Thu, 8 Jun 2017 17:25:11 +0000 (20:25 +0300)] 
quota: quota_root_iter_next() - Iterate all visible roots

Don't try to skip the roots that don't have an active quota. imap_quota
plugin does the skipping now itself, and quota_clone shouldn't really be
even used with more than one quota root.

8 years agoimap-quota: If quota root doesn't have any quotas, don't send empty QUOTA reply
Timo Sirainen [Thu, 8 Jun 2017 17:24:26 +0000 (20:24 +0300)] 
imap-quota: If quota root doesn't have any quotas, don't send empty QUOTA reply

For example if GETQUOTA is asked for fs quota, but the user doesn't have fs
quota enabled.

8 years agoquota-clone: Don't clone quota resources that aren't enabled.
Timo Sirainen [Thu, 8 Jun 2017 17:29:05 +0000 (20:29 +0300)] 
quota-clone: Don't clone quota resources that aren't enabled.

They would always just be zeros anyway, so this makes the update slightly
more efficient. Although practically this only matters with dirsize and
fs quotas, which people generally don't use with quota_clone.

8 years agolib: correct comment in path_normalize
Josef 'Jeff' Sipek [Fri, 9 Jun 2017 12:30:02 +0000 (15:30 +0300)] 
lib: correct comment in path_normalize

Don't blame static analyzers for doing their job.

8 years agowelcome: Fix sending parameters to welcome script.
Timo Sirainen [Mon, 12 Jun 2017 09:44:37 +0000 (12:44 +0300)] 
welcome: Fix sending parameters to welcome script.

Broken by f38b0dafbffa9d79542e36b4b3e598ed4115e5a3

8 years agolib-imap-client: Fix hang when imapc_client_get_capabilities() is called without...
Timo Sirainen [Thu, 8 Jun 2017 17:39:47 +0000 (20:39 +0300)] 
lib-imap-client: Fix hang when imapc_client_get_capabilities() is called without connection

8 years agolib-index: Don't ignore mail_transaction_log_move_to_memory() failure
Timo Sirainen [Tue, 6 Jun 2017 12:31:01 +0000 (15:31 +0300)] 
lib-index: Don't ignore mail_transaction_log_move_to_memory() failure