]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
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

8 years agolib-http: Compiling fix to host->ips reallocation.
Timo Sirainen [Sat, 10 Jun 2017 08:40:43 +0000 (11:40 +0300)] 
lib-http: Compiling fix to host->ips reallocation.

8 years agoquota-fs: Make sure quota calculations don't overflow in old systems
Timo Sirainen [Fri, 9 Jun 2017 20:42:34 +0000 (23:42 +0300)] 
quota-fs: Make sure quota calculations don't overflow in old systems

Patch by M. Balridge

8 years agolib: ioloop-kqueue - Improve kevent() panic log message
Timo Sirainen [Fri, 9 Jun 2017 20:32:28 +0000 (23:32 +0300)] 
lib: ioloop-kqueue - Improve kevent() panic log message

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-http: Try to reuse memory for host->ips allocation.
Timo Sirainen [Sat, 4 Feb 2017 18:45:30 +0000 (20:45 +0200)] 
lib-http: Try to reuse memory for host->ips allocation.

If the host already had an IP, most of the time ips_count doesn't change
anymore.

8 years agolib: Fix test-path-util unit test with some cwd path lengths
Timo Sirainen [Sat, 10 Jun 2017 07:35:54 +0000 (10:35 +0300)] 
lib: Fix test-path-util unit test with some cwd path lengths

The component-component directory might not have been created at all,
in which case the following symlink creations would fail since they were
already created to the same directory in a previous test.

8 years agomail-crypt-acl: Fix assert-crash due to missing namespace initialization
Timo Sirainen [Fri, 9 Jun 2017 15:10:14 +0000 (18:10 +0300)] 
mail-crypt-acl: Fix assert-crash due to missing namespace initialization

This was broken by e031d9aaae59a9f79710dc1138b76b69272615a3.

8 years agoquota: count backend - Don't ignore mailbox list iteration errors
Timo Sirainen [Fri, 9 Jun 2017 13:18:56 +0000 (16:18 +0300)] 
quota: count backend - Don't ignore mailbox list iteration errors

8 years agolib: Fix test-path-util.c formatting to conform coding style
Aki Tuomi [Fri, 9 Jun 2017 11:08:22 +0000 (14:08 +0300)] 
lib: Fix test-path-util.c formatting to conform coding style

8 years agolib: Fix infinite loop in path-util.c
Aki Tuomi [Fri, 9 Jun 2017 10:15:35 +0000 (13:15 +0300)] 
lib: Fix infinite loop in path-util.c

Infinite loop was reached if the path was longer than
128 bytes, and the 128 boundary was in middle of path
name component.

8 years agoquota: Fix negative quota_warnings with count backend
Timo Sirainen [Fri, 9 Jun 2017 09:07:00 +0000 (12:07 +0300)] 
quota: Fix negative quota_warnings with count backend

For example this never triggered:

  quota_warning = -messages=100%% quota-warning %u -100

The change to quota_alloc() to update the count_used doesn't seem to
actually fix anything right now, but it makes the code more correct.

8 years agolib-storage: Fix sort index writing to not leave sort_id=0 gaps
Timo Sirainen [Fri, 9 Jun 2017 09:42:51 +0000 (12:42 +0300)] 
lib-storage: Fix sort index writing to not leave sort_id=0 gaps

This fixes errors like:
Error: INBOX: Broken sort-f indexes, resetting

8 years agolib-storage: Add details to "Broken sort-* indexes" error
Timo Sirainen [Fri, 9 Jun 2017 09:25:36 +0000 (12:25 +0300)] 
lib-storage: Add details to "Broken sort-* indexes" error

8 years agodsync: Display namespace locations on init in debug mode
Aki Tuomi [Fri, 9 Jun 2017 12:22:56 +0000 (15:22 +0300)] 
dsync: Display namespace locations on init in debug mode

This simplifies debugging as you can more easily tell
which brain is using which mail location.

8 years agolib-storage: Fix setting the correct cache record corrupted
Timo Sirainen [Fri, 9 Jun 2017 11:31:15 +0000 (14:31 +0300)] 
lib-storage: Fix setting the correct cache record corrupted

It was mixing UIDs and sequences, so a wrong mail could have been set
corrupted or it could have crashed with:

Panic: file mail-index-transaction-update.c: line 1018 (mail_index_update_ext): assertion failed: (seq > 0 && (seq <= mail_index_view_get_messages_count(t->view) || seq <= t->last_new_seq))

8 years agoquota: Remove unused quota_free()
Timo Sirainen [Sun, 4 Jun 2017 10:07:48 +0000 (13:07 +0300)] 
quota: Remove unused quota_free()

8 years agoquota: Fix quota_vsizes=yes to work with all backends
Timo Sirainen [Sun, 4 Jun 2017 10:06:06 +0000 (13:06 +0300)] 
quota: Fix quota_vsizes=yes to work with all backends

8 years agolib-storage: simplify mailbox_get_path_to()
Josef 'Jeff' Sipek [Wed, 7 Jun 2017 11:37:47 +0000 (14:37 +0300)] 
lib-storage: simplify mailbox_get_path_to()

Instead of special casing MAILBOX_LIST_PATH_TYPE_{MAILBOX,INDEX}, we can use
a common helper to remove code duplication.

8 years agoimapc: Don't send UID FETCH 1:* after SELECT if mailbox is empty
Timo Sirainen [Tue, 30 May 2017 21:07:46 +0000 (00:07 +0300)] 
imapc: Don't send UID FETCH 1:* after SELECT if mailbox is empty

8 years agolib-storage: test-mail-search-args-simplify - test with initialized args
Timo Sirainen [Wed, 7 Jun 2017 16:54:10 +0000 (19:54 +0300)] 
lib-storage: test-mail-search-args-simplify - test with initialized args

8 years agolib-storage: mail_search_args_simplify() - Fix merging already-initialized keywords
Timo Sirainen [Wed, 7 Jun 2017 16:53:00 +0000 (19:53 +0300)] 
lib-storage: mail_search_args_simplify() - Fix merging already-initialized keywords

It was deinitializing the arg that was kept instead of the one being removed.

8 years agolib-storage: Fix mail_search_args_simplify() to not deinit too many args
Timo Sirainen [Wed, 7 Jun 2017 16:37:46 +0000 (19:37 +0300)] 
lib-storage: Fix mail_search_args_simplify() to not deinit too many args

Removing an arg should deinit it, but not its following siblings.

8 years agolib-storage: Add mail_search_arg_one_deinit()
Timo Sirainen [Wed, 7 Jun 2017 16:36:19 +0000 (19:36 +0300)] 
lib-storage: Add mail_search_arg_one_deinit()

8 years agomaster: Don't include imap-hibernate when counting auth's max client_limit
Timo Sirainen [Wed, 7 Jun 2017 20:47:56 +0000 (23:47 +0300)] 
master: Don't include imap-hibernate when counting auth's max client_limit

imap-hibernate doesn't do any auth connections, so it doesn't need it.
It's a bit ugly to add an explicit service name comparison here, but
there didn't really seem to be many other good choices:

 * Could have removed protocol=imap from imap-hibernate. I was close to
doing this, but maybe it's better that imap-only processes would have
their protocol set to "imap".

 * Could have added a new service type, but seems pretty unnecessary to add
some kind of a "nonauth" just for this. A reverse "needs-auth" might have
been ok though.

Perhaps in future we'll implement proper dependencies across services and
those dependencies could be used to calculate this limit more precisely.

8 years agolib: Add unit tests for p_strdup*()
Timo Sirainen [Wed, 7 Jun 2017 07:17:55 +0000 (10:17 +0300)] 
lib: Add unit tests for p_strdup*()

8 years agolib-storage: Fix crash in mail_get_header_stream() when its previous stream wasn...
Timo Sirainen [Tue, 30 May 2017 15:25:50 +0000 (18:25 +0300)] 
lib-storage: Fix crash in mail_get_header_stream() when its previous stream wasn't at EOF

At least this could have happened when indexes were disabled and running:

FETCH 1 (envelope body.peek[header.fields (foo)] bodystructure)

Fixes:
Panic: file index-mail-headers.c: line 198 (index_mail_parse_header_init): assertion failed: (!mail->data.header_parser_initialized)

8 years agoglobal: Use i_realloc_type() wherever possible
Timo Sirainen [Wed, 7 Jun 2017 08:35:18 +0000 (11:35 +0300)] 
global: Use i_realloc_type() wherever possible

8 years agolib: Add test-mempool unit test.
Timo Sirainen [Wed, 7 Jun 2017 08:24:38 +0000 (11:24 +0300)] 
lib: Add test-mempool unit test.

It verifies that the p_new() and p_realloc_type() handle overflows
correctly. test-malloc-overflow already does this for the low-level
MALLOC_*() macros, but here we're cheking that the actually used
memory allocation macros also work.

8 years agolib: Add i_realloc_type() for i_realloc() that checks for overflows
Timo Sirainen [Wed, 7 Jun 2017 08:24:03 +0000 (11:24 +0300)] 
lib: Add i_realloc_type() for i_realloc() that checks for overflows

8 years agoimapc: Fix potential crash if initial sync fails.
Timo Sirainen [Thu, 8 Jun 2017 08:35:58 +0000 (11:35 +0300)] 
imapc: Fix potential crash if initial sync fails.

Happened at least if mailbox had 0 mails and a failing mailbox_sync() was
called twice.

Fixes:
Panic: file imapc-sync.c: line 477 (imapc_sync_index): assertion failed: (mbox->sync_fetch_first_uid == 1)

8 years agolib-mail: message_address_parse() - Fix fill_missing==TRUE handling
Timo Sirainen [Wed, 7 Jun 2017 15:10:10 +0000 (18:10 +0300)] 
lib-mail: message_address_parse() - Fix fill_missing==TRUE handling

Mainly MISSING_DOMAIN wasn't set in all situations. Also added unit tests.

8 years agolib-mail: message_address_parse() - Handle invalid standalone phrases better
Timo Sirainen [Wed, 7 Jun 2017 12:33:42 +0000 (15:33 +0300)] 
lib-mail: message_address_parse() - Handle invalid standalone phrases better

We'll treat "local-part" (without quotes) as a mailbox even without
@domain, but if it continues with anything or if it's a quoted-string,
we'll treat it as a display-name instead.

This is probably better than just converting everything to display-name,
since there are likely to exist headers like "To: localuser"

8 years agolib-mail: Improve test-message-address to test invalid addresses in lists
Timo Sirainen [Wed, 7 Jun 2017 12:22:22 +0000 (15:22 +0300)] 
lib-mail: Improve test-message-address to test invalid addresses in lists

Test in both a group and list of addresses.

8 years agolib-mail: message_address_parse() - don't stop at <> when parsing address lists
Timo Sirainen [Wed, 7 Jun 2017 12:21:10 +0000 (15:21 +0300)] 
lib-mail: message_address_parse() - don't stop at <> when parsing address lists

And similarly don't stop at <@domain>

8 years agolib-mail: message_address_parse() - don't stop at invalid addresses when parsing...
Timo Sirainen [Wed, 7 Jun 2017 12:08:27 +0000 (15:08 +0300)] 
lib-mail: message_address_parse() - don't stop at invalid addresses when parsing group

Also the end-group's message_address shouldn't have invalid_syntax=TRUE,
except when we didn't actually find the ending ';'

8 years agolib-mail: message_address_parse() - Fix reading out-of-bounds read on invalid input
Timo Sirainen [Wed, 7 Jun 2017 11:57:12 +0000 (14:57 +0300)] 
lib-mail: message_address_parse() - Fix reading out-of-bounds read on invalid input

8 years agolib-mail: message_address_parse() - Remove unnecessary NULL checks
Timo Sirainen [Wed, 7 Jun 2017 10:34:39 +0000 (13:34 +0300)] 
lib-mail: message_address_parse() - Remove unnecessary NULL checks

message_address_parse() always initialized rfc822_parser_init() with
last_comment string.

8 years agolib-mail: test-message-address - add more and better organized tests
Timo Sirainen [Wed, 7 Jun 2017 10:19:40 +0000 (13:19 +0300)] 
lib-mail: test-message-address - add more and better organized tests

8 years agolib-mail: message_address_parse() - Add INVALID_ROUTE/SYNTAX_ERROR only if fill_missi...
Timo Sirainen [Wed, 7 Jun 2017 09:58:21 +0000 (12:58 +0300)] 
lib-mail: message_address_parse() - Add INVALID_ROUTE/SYNTAX_ERROR only if fill_missing==TRUE

This allows message_address_write() to write the parsed invalid address in a
way that at least somewhat resembles the original input.

8 years agolib-mail: message_address_write() - Write empy username as ""
Timo Sirainen [Wed, 7 Jun 2017 09:42:28 +0000 (12:42 +0300)] 
lib-mail: message_address_write() - Write empy username as ""

We can't output <@domain> because that conflicts with the <@route:...>
syntax. Also ""@domain seems to be a valid address.

8 years agolib-mail: message_address_write() - Always write <user@domain> as output
Timo Sirainen [Wed, 7 Jun 2017 09:37:09 +0000 (12:37 +0300)] 
lib-mail: message_address_write() - Always write <user@domain> as output

This is the standard format nowadays, so don't convert <user@domain> into
plain user@domain.

8 years agolib-mail: message_address_write() - Don't write empty <>
Timo Sirainen [Wed, 7 Jun 2017 09:35:35 +0000 (12:35 +0300)] 
lib-mail: message_address_write() - Don't write empty <>

8 years agolib-mail: message_address_write() - Don't add '@' if domain is missing
Timo Sirainen [Wed, 7 Jun 2017 09:34:17 +0000 (12:34 +0300)] 
lib-mail: message_address_write() - Don't add '@' if domain is missing

8 years agolib-mail: test-message-address - Test also writing invalid addresses
Timo Sirainen [Wed, 7 Jun 2017 09:33:10 +0000 (12:33 +0300)] 
lib-mail: test-message-address - Test also writing invalid addresses

8 years agolib-mail: test-message-address cleanup
Timo Sirainen [Wed, 7 Jun 2017 09:01:07 +0000 (12:01 +0300)] 
lib-mail: test-message-address cleanup

Merge input and output into the same struct to make it clearer.

8 years agolib: test for guid_128_generate() time handling
Josef 'Jeff' Sipek [Mon, 5 Jun 2017 11:21:23 +0000 (14:21 +0300)] 
lib: test for guid_128_generate() time handling

Make sure that guids always increase regardless of what is happening to
the time.

8 years agolib: guid_128_generate() shouldn't generate invalid timestamps
Josef 'Jeff' Sipek [Mon, 5 Jun 2017 09:55:56 +0000 (12:55 +0300)] 
lib: guid_128_generate() shouldn't generate invalid timestamps

The nsec validity check must take into account the soon-to-be-done increment.

8 years agolib: guid_128_generate() needs to correctly convert usecs to nsecs
Josef 'Jeff' Sipek [Mon, 5 Jun 2017 09:53:23 +0000 (12:53 +0300)] 
lib: guid_128_generate() needs to correctly convert usecs to nsecs

The timestamp in the guid starts off with real time, but "runs ahead" if a lot
of guids are generated.  If not many guids are being generated, the timestamp
is fast-forwarded to the current ioloop_timeval.  The buggy comparison prevented
fast forwarding when tv_sec matched, but tv_nsec value was > 0 (which
was true most of the time).

8 years agoquota: assertion for *args != NULL is added in order to avoid warning from static...
Sergey Kitov [Wed, 31 May 2017 11:32:30 +0000 (14:32 +0300)] 
quota: assertion for *args != NULL is added in order to avoid warning from static analyzer and *args[0] changed to (*args)[0]

8 years agodict-cdb: Add simple iteration support
Aki Tuomi [Tue, 6 Jun 2017 10:59:14 +0000 (13:59 +0300)] 
dict-cdb: Add simple iteration support

8 years agolib-index: Fix reset_id handling in mail_cache_get_missing_reason() cache
Timo Sirainen [Tue, 6 Jun 2017 14:18:27 +0000 (17:18 +0300)] 
lib-index: Fix reset_id handling in mail_cache_get_missing_reason() cache

Broken by bd897f82a5d9b00ba256b462d2056c2dc7df257c

8 years agolib: test-utc-mktime: Remove duplicate test
Timo Sirainen [Fri, 7 Apr 2017 06:19:02 +0000 (09:19 +0300)] 
lib: test-utc-mktime: Remove duplicate test

Also fixes a compiler warning when time_t is signed 32bit.

8 years agolib-storage: Fix assert-crash in SORT caused by earlier changes
Timo Sirainen [Tue, 6 Jun 2017 06:39:34 +0000 (09:39 +0300)] 
lib-storage: Fix assert-crash in SORT caused by earlier changes

Broken by 0a6a527f0c42b5478d80ac53ab357885676fd516

Fixes:
Panic: file index-sort-string.c: line 668 (index_sort_add_ids_range): assertion failed: (str != NULL)

8 years agolib-oauth2: Make sure fields are always initialized
Aki Tuomi [Tue, 6 Jun 2017 09:47:53 +0000 (12:47 +0300)] 
lib-oauth2: Make sure fields are always initialized

8 years agolib-oauth2: Accept empty responses
Aki Tuomi [Tue, 6 Jun 2017 09:44:55 +0000 (12:44 +0300)] 
lib-oauth2: Accept empty responses