]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
8 years agolib-storage: Add mail.access_type
Timo Sirainen [Fri, 17 Feb 2017 17:29:03 +0000 (19:29 +0200)] 
lib-storage: Add mail.access_type

8 years agolib-storage: Add mail_sort_max_read_count setting.
Timo Sirainen [Fri, 17 Feb 2017 17:07:53 +0000 (19:07 +0200)] 
lib-storage: Add mail_sort_max_read_count setting.

This controls how many slow mail accesses sorting can perform before it
fails:

a NO [LIMIT] Requested sort would have taken too long

The SORT reply is still returned, but it's likely not correct.

8 years agolib-storage: Add MAIL_ERROR_LIMIT
Timo Sirainen [Fri, 17 Feb 2017 16:56:23 +0000 (18:56 +0200)] 
lib-storage: Add MAIL_ERROR_LIMIT

8 years agoimap: If SEARCH/SORT fails but returns some results, send them to client.
Timo Sirainen [Fri, 17 Feb 2017 16:32:05 +0000 (18:32 +0200)] 
imap: If SEARCH/SORT fails but returns some results, send them to client.

The previous error handling fixes cause SEARCH/SORT to now fail if there
are any problems reading mails. This change makes the commands still
return the best known results, so the IMAP client can still use them,
even though they may not be entirely correct.

8 years agolib-storage: Fix error handling when searching mails
Timo Sirainen [Fri, 17 Feb 2017 16:30:51 +0000 (18:30 +0200)] 
lib-storage: Fix error handling when searching mails

Only expunge errors and failures caused by lookup_abort should be ignored.
The rest of the mail errors mean that the search result might not be
correct. We'll still run the search as fully as possible, but we just
return an error at the end.

8 years agolib-storage: Search optimization - avoid parsing message_parts unnecessarily
Timo Sirainen [Fri, 17 Feb 2017 16:24:31 +0000 (18:24 +0200)] 
lib-storage: Search optimization - avoid parsing message_parts unnecessarily

If they're not already cached, the mail is parsed twice: once to get the
message_parts and again to perform the actual search. The searching can
however do the message_parts parsing internally as well.

8 years agolib-storage: Fix error handling when sorting mails.
Timo Sirainen [Fri, 17 Feb 2017 16:19:46 +0000 (18:19 +0200)] 
lib-storage: Fix error handling when sorting mails.

All errors were treated the same as if message had been expunged. This
caused potentially wrong results to be sent to the client without any
indication that they're wrong.

8 years agolib-storage: Change vsize calculation to use the new mail_stream_opened
Timo Sirainen [Fri, 17 Feb 2017 14:31:52 +0000 (16:31 +0200)] 
lib-storage: Change vsize calculation to use the new mail_stream_opened

This avoids calling mail_get_virtual_size() twice and is a bit cleaner
approach.

8 years agolib-storage: Add mail.mail_stream_opened and .mail_metadata_accessed
Timo Sirainen [Fri, 17 Feb 2017 14:20:06 +0000 (16:20 +0200)] 
lib-storage: Add mail.mail_stream_opened and .mail_metadata_accessed

These allow determining after mail_*() calls how efficiently they were
performed.

8 years agolib-storage: Clarify what MAIL_LOOKUP_ABORT_READ_MAIL means.
Timo Sirainen [Fri, 17 Feb 2017 14:14:39 +0000 (16:14 +0200)] 
lib-storage: Clarify what MAIL_LOOKUP_ABORT_READ_MAIL means.

It should maybe even be renamed to something clearer.

8 years agodsync: Don't assert-crash if duplicate attributes are seen
Timo Sirainen [Sat, 18 Feb 2017 23:44:21 +0000 (01:44 +0200)] 
dsync: Don't assert-crash if duplicate attributes are seen

Just ignore the duplicates. Normally this shouldn't happen, but due to
some bugs for example a Sieve script could be returned once by doveadm_sieve
plugin and another time from mail_attribute_dict.

8 years agospelling fixes
klemens [Sat, 18 Feb 2017 09:39:56 +0000 (10:39 +0100)] 
spelling fixes

8 years agoimap: Fix running time in tagged command replies.
Timo Sirainen [Sun, 19 Feb 2017 13:47:48 +0000 (15:47 +0200)] 
imap: Fix running time in tagged command replies.

The timing information was updated only after command_exec() returned.
Most of the commands were handled within a single command_exec() though,
so at the time when tagline was sent the running_usecs was still zero.

The msecs in ioloop timing was correct though, because it relied only on
the command start timing info.

8 years agodoveadm: Add explicit mail_storage_init/deinit() calls
Timo Sirainen [Sun, 19 Feb 2017 00:03:08 +0000 (02:03 +0200)] 
doveadm: Add explicit mail_storage_init/deinit() calls

This mainly prevents losing hooks that were registered by doveadm plugins.

Otherwise what happens is:
 - mail_plugins are unloaded and they unregister their hooks
 - doveadm plugins (e.g. doveadm_sieve) are NOT unloaded
 - mail_storage_deinit() frees all the registered hooks
 - next mail_storage_init() initializes all new hooks
 - All mail_plugins are loaded and they register again their hooks
 - doveadm plugins are NOT re-loaded or re-initialized, so their existing
hooks were lost.

8 years agolib-storage: mail_storage_init/deinit() is now reference counted.
Timo Sirainen [Sun, 19 Feb 2017 00:02:20 +0000 (02:02 +0200)] 
lib-storage: mail_storage_init/deinit() is now reference counted.

This allows calling them multiple times and only the final deinit frees the
data.

8 years agolib-storage: Assert-crash if duplicate internal hooks are added.
Timo Sirainen [Sun, 19 Feb 2017 00:01:24 +0000 (02:01 +0200)] 
lib-storage: Assert-crash if duplicate internal hooks are added.

8 years agofs-posix: Add "no-fsync" parameter.
Timo Sirainen [Sun, 19 Feb 2017 13:54:53 +0000 (15:54 +0200)] 
fs-posix: Add "no-fsync" parameter.

This disables calling fdatasync() when fs_write() was done with
FS_OPEN_FLAG_FSYNC. Useful for making tests faster.

8 years agoimap: Code cleanup - Remove duplicate flags from imap_fetch_state
Timo Sirainen [Sun, 19 Feb 2017 12:49:20 +0000 (14:49 +0200)] 
imap: Code cleanup - Remove duplicate flags from imap_fetch_state

All the cur_flushed, line_partial and line_finished were about the same
thing.

8 years agoimap: Fix sending UID only when necessary on broken FETCHes.
Timo Sirainen [Sun, 19 Feb 2017 12:34:45 +0000 (14:34 +0200)] 
imap: Fix sending UID only when necessary on broken FETCHes.

b748f91d0677fffaa2208b39ebb6db3aeb2e937b changed UID to be sent for most
FETCH replies. There was also some existing code that attempted to do this,
but didn't fully work.

So now:

1) If there are no non-buffered replies, the entire FETCH response isn't
sent.

2) If the buffer was already flushed and nothing else was sent, add UID to
reply. The code paths for handling this are differently for
imap_fetch_failure = disconnect-immediately vs others (depending on
imap_fetch_cur_failed() return value).

8 years agoimap: Include info about last command in disconnection log line.
Timo Sirainen [Thu, 16 Feb 2017 18:39:12 +0000 (20:39 +0200)] 
imap: Include info about last command in disconnection log line.

Only if LOGOUT isn't sent, because that's already visible.

8 years agoimap: Code cleanup - Move code to client_command_stats_append()
Timo Sirainen [Thu, 16 Feb 2017 18:29:46 +0000 (20:29 +0200)] 
imap: Code cleanup - Move code to client_command_stats_append()

8 years agoimap: Add imap_client.logged_out at LOGOUT
Timo Sirainen [Thu, 16 Feb 2017 18:17:32 +0000 (20:17 +0200)] 
imap: Add imap_client.logged_out at LOGOUT

This is useful for determining if client did a clean logout

8 years agoimap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen [Thu, 16 Feb 2017 18:14:55 +0000 (20:14 +0200)] 
imap: Code cleanup - move command stats to struct client_command_stats

8 years agomech-oauth2: Clarify logging
Aki Tuomi [Fri, 17 Feb 2017 13:46:38 +0000 (15:46 +0200)] 
mech-oauth2: Clarify logging

8 years agomech-oauth2: Set user_given=TRUE when username given in OAUTHBEARER
Aki Tuomi [Fri, 17 Feb 2017 13:45:34 +0000 (15:45 +0200)] 
mech-oauth2: Set user_given=TRUE when username given in OAUTHBEARER

8 years agomech-oauth2: Fix gs2-header parsing
Aki Tuomi [Fri, 17 Feb 2017 13:44:17 +0000 (15:44 +0200)] 
mech-oauth2: Fix gs2-header parsing

8 years agolib-storage: Update vsize header after sync only if sizes are cached.
Timo Sirainen [Tue, 14 Feb 2017 16:48:51 +0000 (18:48 +0200)] 
lib-storage: Update vsize header after sync only if sizes are cached.

The result isn't needed yet in that case, so if it's slow to get the sizes
it might as well be delayd until later. This is especially useful when
indexer-worker triggers FTS indexing. The vsizes can be added to index
after the mail is already read for FTS. Without this change the vsize
update would first open all the mails and then the FTS indexing would
open all the mails a second time.

8 years agolib-storage: Add mail_vsize_bg_after_count setting.
Timo Sirainen [Tue, 7 Feb 2017 14:18:55 +0000 (16:18 +0200)] 
lib-storage: Add mail_vsize_bg_after_count setting.

If folder vsize calculation requires opening more than this many mails from
disk (i.e. mail sizes aren't in cache already), return failure and finish
the calculation via indexer process.

This should be used like:

protocol !indexer-worker {
  mail_vsize_bg_after_count = 10
}

8 years agolib-storage: Don't stop vsize calculation on expunged mails.
Timo Sirainen [Tue, 7 Feb 2017 11:53:52 +0000 (13:53 +0200)] 
lib-storage: Don't stop vsize calculation on expunged mails.

I don't know why I added such logic there in the first place. If we just
skip the expunged mails, the end result should still be correct and
usable when cached.

8 years agoREADME: Add note that we support OAUTHBEARER and XOAUTH2
Aki Tuomi [Tue, 14 Feb 2017 11:33:47 +0000 (13:33 +0200)] 
README: Add note that we support OAUTHBEARER and XOAUTH2

8 years agoauth: Add oauth2 passdb
Aki Tuomi [Mon, 13 Feb 2017 13:33:21 +0000 (15:33 +0200)] 
auth: Add oauth2 passdb

8 years agoauth: Add xoauth2 and oauthbearer mechanisms
Aki Tuomi [Sat, 4 Feb 2017 21:56:04 +0000 (23:56 +0200)] 
auth: Add xoauth2 and oauthbearer mechanisms

8 years agoauth: Add mechanism filter for passdbs
Aki Tuomi [Mon, 6 Feb 2017 10:56:27 +0000 (12:56 +0200)] 
auth: Add mechanism filter for passdbs

8 years agoauth: Add accessor for passdb template arguments
Aki Tuomi [Wed, 8 Feb 2017 11:06:13 +0000 (13:06 +0200)] 
auth: Add accessor for passdb template arguments

8 years agolib-oauth2: Add support library for OAUTH2
Aki Tuomi [Thu, 26 Jan 2017 08:49:08 +0000 (10:49 +0200)] 
lib-oauth2: Add support library for OAUTH2

8 years agolib-index: Fix updating mail_index_header.day_first_uid
Timo Sirainen [Wed, 15 Feb 2017 20:13:12 +0000 (22:13 +0200)] 
lib-index: Fix updating mail_index_header.day_first_uid

If user received a mail every day, the day_first_uid wasn't being updated.
This caused wrong caching decisions to be made in dovecot.index.cache:

 - Accessing >1 week old emails should have changed caching decision from
"tmp" to "yes". This might not have happened, although as long as
day_first_uid[7] pointed to an existing mail and email client accessed
all the mails, this wouldn't have changed anything.

 - Cache compression is supposed to drop >1 week old mails when caching
decision is "tmp". Not enough mails were being dropped because
day_first_uid[7] pointed to a much older than 1 week old mails.

Also added a unit test to make sure this works.

Broken by d9ee2f9fb3ef7b9391bfeeff1b374aead51667aa

8 years agolib-index: Add day_stamp parameter to mail_index_update_day_headers()
Timo Sirainen [Wed, 15 Feb 2017 20:12:15 +0000 (22:12 +0200)] 
lib-index: Add day_stamp parameter to mail_index_update_day_headers()

This will help creating a unit test.

8 years agolib-storage: Re-open mailbox after it's undeleted.
Timo Sirainen [Wed, 15 Feb 2017 16:20:05 +0000 (18:20 +0200)] 
lib-storage: Re-open mailbox after it's undeleted.

This is needed with mailbox formats that didn't fully open the mailbox while
it was undeleted.

8 years agolib-storage: Don't sync mailbox after undeleting it.
Timo Sirainen [Wed, 15 Feb 2017 16:18:46 +0000 (18:18 +0200)] 
lib-storage: Don't sync mailbox after undeleting it.

This is useful only when deleting it. With undeletion the syncing isn't
useful and might actually be harmful with mailbox formats that didn't
fully open the mailbox while it was undeleted.

8 years agolib-storage: Make sure mailbox undeletion won't go to infinite loop
Timo Sirainen [Wed, 15 Feb 2017 16:05:14 +0000 (18:05 +0200)] 
lib-storage: Make sure mailbox undeletion won't go to infinite loop

8 years agomail-log: Add mail_log_cached_only setting.
Timo Sirainen [Wed, 15 Feb 2017 21:32:52 +0000 (23:32 +0200)] 
mail-log: Add mail_log_cached_only setting.

If enabled, everything except "save" event will log only the fields that can
be looked up from cache. This improves performance if some of the fields
aren't cached and it's not a strict requirement to log them.

8 years agolib-imap-client: pass the reply text to the auth-failed state change callback
Josef 'Jeff' Sipek [Wed, 15 Feb 2017 18:46:06 +0000 (13:46 -0500)] 
lib-imap-client: pass the reply text to the auth-failed state change callback

8 years agolib-imap-client: invoke state change callback on "authentication success"
Josef 'Jeff' Sipek [Wed, 15 Feb 2017 14:13:05 +0000 (09:13 -0500)] 
lib-imap-client: invoke state change callback on "authentication success"

8 years agolib-imap-client: add callback to notify consumers about state changes
Josef 'Jeff' Sipek [Wed, 15 Feb 2017 14:12:35 +0000 (09:12 -0500)] 
lib-imap-client: add callback to notify consumers about state changes

Add a callback to notify imapc users about failures.  Currently, the only
failure defined is "authentication failed".

8 years agolib-imap-client: centralize authentication failed error logging
Josef 'Jeff' Sipek [Tue, 14 Feb 2017 13:58:10 +0000 (08:58 -0500)] 
lib-imap-client: centralize authentication failed error logging

8 years agolib-http: response parser: Drop previous response's pool immediately when parsing...
Stephan Bosch [Sat, 4 Feb 2017 14:40:41 +0000 (15:40 +0100)] 
lib-http: response parser: Drop previous response's pool immediately when parsing continues.

Prevously, it would only do that when the first byte of the next response was received.
This prevents wasting memory when no response is being parsed.

8 years agolib-http: response parser: Always clear response to prevent referring to stale data.
Stephan Bosch [Sat, 4 Feb 2017 15:21:51 +0000 (16:21 +0100)] 
lib-http: response parser: Always clear response to prevent referring to stale data.

8 years agolib-http: test-http-response-parse: Properly test multiple sequential responses.
Stephan Bosch [Sat, 4 Feb 2017 15:15:57 +0000 (16:15 +0100)] 
lib-http: test-http-response-parse: Properly test multiple sequential responses.

8 years agolib-http: message parser: Don't allocate a pool for the next message until it is...
Stephan Bosch [Sat, 4 Feb 2017 12:59:10 +0000 (13:59 +0100)] 
lib-http: message parser: Don't allocate a pool for the next message until it is needed.

This prevents wasting memory when no message is being parsed.

8 years agolib-http: message parser: Delay allocation of message header.
Stephan Bosch [Sat, 4 Feb 2017 13:11:36 +0000 (14:11 +0100)] 
lib-http: message parser: Delay allocation of message header.

8 years agolib-http: message parser: Don't create the connection_options array, unless it is...
Stephan Bosch [Sat, 4 Feb 2017 13:03:25 +0000 (14:03 +0100)] 
lib-http: message parser: Don't create the connection_options array, unless it is actually used.

8 years agolib-mail: Fix duplicate HEADER_FILTER_ADD_MISSING_EOH callback call
Timo Sirainen [Tue, 14 Feb 2017 15:35:54 +0000 (17:35 +0200)] 
lib-mail: Fix duplicate HEADER_FILTER_ADD_MISSING_EOH callback call

If headers weren't modified, the second reading of the istream shouldn't
call any callbacks.

8 years agodoveadm: Added "mailbox path" command
Timo Sirainen [Tue, 14 Feb 2017 22:08:49 +0000 (00:08 +0200)] 
doveadm: Added "mailbox path" command

This allows easily printing a path for a mailbox, index, control dir, etc.

8 years agolib-lda: Code cleanup - remove unnecessary dest_mail check
Timo Sirainen [Tue, 14 Feb 2017 18:23:16 +0000 (20:23 +0200)] 
lib-lda: Code cleanup - remove unnecessary dest_mail check

8 years agolib-lda: Don't set mail_deliver_context.dest_mail too early.
Timo Sirainen [Tue, 14 Feb 2017 18:20:07 +0000 (20:20 +0200)] 
lib-lda: Don't set mail_deliver_context.dest_mail too early.

It must be NULL for the caller, unless save_dest_mail==TRUE

8 years agolib-lda: Implement %{storage_id} correctly
Timo Sirainen [Mon, 13 Feb 2017 18:49:12 +0000 (20:49 +0200)] 
lib-lda: Implement %{storage_id} correctly

8 years agolib-lda: Fix deliver_log_format variables with Sieve
Timo Sirainen [Mon, 13 Feb 2017 18:47:51 +0000 (20:47 +0200)] 
lib-lda: Fix deliver_log_format variables with Sieve

With Sieve it was using src_mail for getting the values, which weren't
correct especially if Sieve had modified the mail.

8 years agolib-lda: Code cleanup - mail_deliver_open_mail() now uses uid parameter
Timo Sirainen [Mon, 13 Feb 2017 18:46:16 +0000 (20:46 +0200)] 
lib-lda: Code cleanup - mail_deliver_open_mail() now uses uid parameter

8 years agolib-lda: Remove %{storage_id} setting for now.
Timo Sirainen [Mon, 13 Feb 2017 18:44:31 +0000 (20:44 +0200)] 
lib-lda: Remove %{storage_id} setting for now.

It doesn't work with Sieve. The following patches add it back properly.

8 years agolib-lda: Redesign mail_deliver_context.var_expand_table cache
Timo Sirainen [Thu, 9 Feb 2017 17:00:12 +0000 (19:00 +0200)] 
lib-lda: Redesign mail_deliver_context.var_expand_table cache

8 years agolib-lda: Avoid using mailbox_save_set_dest_mail()
Timo Sirainen [Thu, 9 Feb 2017 16:49:53 +0000 (18:49 +0200)] 
lib-lda: Avoid using mailbox_save_set_dest_mail()

8 years agolib-storage: Add mailbox_save_get_dest_mail()
Timo Sirainen [Thu, 9 Feb 2017 16:46:14 +0000 (18:46 +0200)] 
lib-storage: Add mailbox_save_get_dest_mail()

This marks mailbox_save_set_dest_mail deprecated. It's not efficient to use
since it frees the already-created dest_mail.

8 years agolib-lda: Remove unused mail_deliver_get_log_var_expand_table()
Timo Sirainen [Thu, 9 Feb 2017 16:01:14 +0000 (18:01 +0200)] 
lib-lda: Remove unused mail_deliver_get_log_var_expand_table()

8 years agovirtual: Fix saving to a virtual mailbox to work again
Timo Sirainen [Mon, 13 Feb 2017 18:23:49 +0000 (20:23 +0200)] 
virtual: Fix saving to a virtual mailbox to work again

Previous changes broke it.

8 years agoplugins: Remove unnecessary mail_save_context.dest_mail==NULL checks
Timo Sirainen [Thu, 9 Feb 2017 15:18:51 +0000 (17:18 +0200)] 
plugins: Remove unnecessary mail_save_context.dest_mail==NULL checks

It can never be NULL after the previous change: "lib-storage: Always create
mail_save_context.dest_mail".

8 years agolib-storage: Remove unnecessary mail_save_context.dest_mail==NULL checks
Timo Sirainen [Thu, 9 Feb 2017 15:14:57 +0000 (17:14 +0200)] 
lib-storage: Remove unnecessary mail_save_context.dest_mail==NULL checks

It can never be NULL after the previous change: "lib-storage: Always create
mail_save_context.dest_mail".

The code removal in maildir_transaction_save_commit_pre() seemed
potentially dangerous, but I don't think such code path is possible
anymore. Also even if it is, it's probably fine since the mail_free()
is called even earlier than before (although that itself might have
been a problem).

This also removes last traces of code that made it possible to save mails to
mbox without assigning UID to the mail. The previous commit already caused
this, so this is just removing dead code.

8 years agolib-storage: Always create mail_save_context.dest_mail
Timo Sirainen [Thu, 9 Feb 2017 14:53:47 +0000 (16:53 +0200)] 
lib-storage: Always create mail_save_context.dest_mail

This allows removing similar mail_alloc() from storage backends and plugins
that need it.

As a side effect, this changes mbox code to always assign UIDs to saved
mails. This shouldn't be much of a problem, since it happened practically
always already.

8 years agolib-storage: Fix mailbox list index hook usage
Timo Sirainen [Thu, 9 Feb 2017 14:34:52 +0000 (16:34 +0200)] 
lib-storage: Fix mailbox list index hook usage

The previous method appeared to work, but not if the internal hooks were
used more than once.

8 years agodict-sql: Fix error handling in commit
Timo Sirainen [Mon, 13 Feb 2017 21:34:25 +0000 (23:34 +0200)] 
dict-sql: Fix error handling in commit

sql_dict_prev_inc_flush() or sql_dict_prev_set_flush() might set ctx->error,
so they need to be done earlier.

8 years agolib-index: zero mmap_length after logging error
Martti Rannanjärvi [Tue, 14 Feb 2017 08:42:26 +0000 (10:42 +0200)] 
lib-index: zero mmap_length after logging error

Logging that mmap(size=0) failed looks suspicious.

8 years agomail-crypt: Do not restrict access in unit test
Aki Tuomi [Mon, 13 Feb 2017 17:40:22 +0000 (19:40 +0200)] 
mail-crypt: Do not restrict access in unit test

This works around problem with docker

8 years agolib: Clarify *_strsplit_spaces() and add unit test
Timo Sirainen [Tue, 14 Feb 2017 08:54:29 +0000 (10:54 +0200)] 
lib: Clarify *_strsplit_spaces() and add unit test

8 years agolib: Add pool_alloconly_create_clean()
Timo Sirainen [Mon, 13 Feb 2017 21:46:15 +0000 (23:46 +0200)] 
lib: Add pool_alloconly_create_clean()

This partially reverts 2a2beae3a4c1e75b3aeff996781503138e6f24bc

8 years agoLAYOUT=index: Fix duplicate mailbox name renaming to actually work
Timo Sirainen [Mon, 13 Feb 2017 18:02:24 +0000 (20:02 +0200)] 
LAYOUT=index: Fix duplicate mailbox name renaming to actually work

8 years agoLAYOUT=index: Rename mailbox_list_index_node.corrupted_parent to corrupted_ext
Timo Sirainen [Mon, 13 Feb 2017 18:01:13 +0000 (20:01 +0200)] 
LAYOUT=index: Rename mailbox_list_index_node.corrupted_parent to corrupted_ext

The code will be useful for other purposes also besides updating corrupted
parents.

8 years agodriver-cassandra: Add support for speculative execution
Aki Tuomi [Tue, 31 Jan 2017 17:43:30 +0000 (19:43 +0200)] 
driver-cassandra: Add support for speculative execution

8 years agolib-index: Add MAIL_INDEX_OPEN_FLAG_NO_DIRTY
Timo Sirainen [Wed, 8 Feb 2017 10:03:30 +0000 (12:03 +0200)] 
lib-index: Add MAIL_INDEX_OPEN_FLAG_NO_DIRTY

This way mailbox format backends that don't need dirty flags can use them
for other purposes.

8 years agocassandra: Track query counts internally and include them in metrics
Timo Sirainen [Fri, 10 Feb 2017 14:26:15 +0000 (16:26 +0200)] 
cassandra: Track query counts internally and include them in metrics

8 years agolib-compress: Fix missing .gz header error message
Timo Sirainen [Mon, 13 Feb 2017 16:06:46 +0000 (18:06 +0200)] 
lib-compress: Fix missing .gz header error message

8 years agolib-compress: Fix assert-crash when .gz header size exceeds buffer max length
Timo Sirainen [Mon, 13 Feb 2017 16:05:13 +0000 (18:05 +0200)] 
lib-compress: Fix assert-crash when .gz header size exceeds buffer max length

Instead treat the stream as corrupted and return EINVAL.

Fixes:
Panic: file istream.c: line 182 (i_stream_read): assertion failed: (_stream->skip != _stream->pos)

8 years agolib-http: http_client_request_add_header() - Add key/value asserts
Timo Sirainen [Fri, 10 Feb 2017 13:27:13 +0000 (15:27 +0200)] 
lib-http: http_client_request_add_header() - Add key/value asserts

These don't check that they're entirely correct as required by HTTP
specifications. They're mainly there as a quick check that if the caller
didn't validate the key/value in any way, we'll crash instead of creating
a potential security hole. (Because with line feeds the attacker could
add extra headers or even entirely new HTTP requests.)

8 years agolib-index: clear file->mmap_size only after logging it
Martti Rannanjärvi [Mon, 13 Feb 2017 07:09:28 +0000 (09:09 +0200)] 
lib-index: clear file->mmap_size only after logging it

Logging the error with size=0 loses information.

8 years agolib-index: don't reset ioloop_time on mmap error
Martti Rannanjärvi [Mon, 13 Feb 2017 07:08:25 +0000 (09:08 +0200)] 
lib-index: don't reset ioloop_time on mmap error

The variables seems to have been in the wrong order.

8 years agoquota: Log why quota_over_flag check is skipped if mail_debug=yes
Timo Sirainen [Wed, 8 Feb 2017 10:47:06 +0000 (12:47 +0200)] 
quota: Log why quota_over_flag check is skipped if mail_debug=yes

8 years agoquota: If quota_over_script is unset, skip the quota_over check.
Timo Sirainen [Tue, 7 Feb 2017 13:46:47 +0000 (15:46 +0200)] 
quota: If quota_over_script is unset, skip the quota_over check.

8 years agoquota: If quota_over_flag_value is unset, skip the quota_over check.
Timo Sirainen [Tue, 7 Feb 2017 13:44:20 +0000 (15:44 +0200)] 
quota: If quota_over_flag_value is unset, skip the quota_over check.

8 years agoquota: Remove quota_over_flag_* from quota_root.
Timo Sirainen [Tue, 7 Feb 2017 13:33:07 +0000 (15:33 +0200)] 
quota: Remove quota_over_flag_* from quota_root.

They are used only in one specific location and don't need to be stored
permanently.

8 years agoglobal: Add asserts to make static analyzer happier.
Timo Sirainen [Fri, 10 Feb 2017 11:17:00 +0000 (13:17 +0200)] 
global: Add asserts to make static analyzer happier.

8 years agopop3-login: Code cleanup - Make sure destroying client stops processing.
Timo Sirainen [Fri, 10 Feb 2017 11:15:58 +0000 (13:15 +0200)] 
pop3-login: Code cleanup - Make sure destroying client stops processing.

It would currently do it in any case, but this makes it clearer.

8 years agoglobal: Ignore unnecessary return values.
Timo Sirainen [Fri, 10 Feb 2017 11:15:26 +0000 (13:15 +0200)] 
global: Ignore unnecessary return values.

8 years agomail-filter: Handle handshake write() failure
Timo Sirainen [Fri, 10 Feb 2017 11:13:01 +0000 (13:13 +0200)] 
mail-filter: Handle handshake write() failure

8 years agofts: Fix crash using fts_autoexpunge_exclude = \Special-use crash
Timo Sirainen [Fri, 10 Feb 2017 10:50:58 +0000 (12:50 +0200)] 
fts: Fix crash using fts_autoexpunge_exclude = \Special-use crash

It crashed whenever seeing a mailbox that didn't have any special-use flags.

8 years agodoveadm mailbox metadata list: Fix listing all metadata.
Timo Sirainen [Fri, 10 Feb 2017 10:46:50 +0000 (12:46 +0200)] 
doveadm mailbox metadata list: Fix listing all metadata.

It was listing only private attributes, because key_type=0 happens to be
MAIL_ATTRIBUTE_TYPE_PRIVATE and key was never NULL.

8 years agomail-crypt-acl: Fix error handling
Timo Sirainen [Fri, 10 Feb 2017 10:41:28 +0000 (12:41 +0200)] 
mail-crypt-acl: Fix error handling

Don't crash if mail_user creation failed.

8 years agodoveadm mailbox cryptokey generate: Fix error handling
Timo Sirainen [Fri, 10 Feb 2017 10:40:41 +0000 (12:40 +0200)] 
doveadm mailbox cryptokey generate: Fix error handling

Don't crash if mail_user creation failed.

8 years agodoveadm mailbox cryptokey generate: Fix memory leak
Timo Sirainen [Fri, 10 Feb 2017 10:33:01 +0000 (12:33 +0200)] 
doveadm mailbox cryptokey generate: Fix memory leak

dest_user was set to NULL, but never freed.

8 years agolib-program-client: Clarify dot_input/dot_output NULL checks.
Timo Sirainen [Fri, 10 Feb 2017 10:20:37 +0000 (12:20 +0200)] 
lib-program-client: Clarify dot_input/dot_output NULL checks.

Helps to avoid static analyzer false positives about NULL pointer
dereference.

8 years agodoveadm director map: Fix checking if host parameter is required
Timo Sirainen [Fri, 10 Feb 2017 10:09:50 +0000 (12:09 +0200)] 
doveadm director map: Fix checking if host parameter is required

8 years agolib: Avoid unnecessary Coverity warnings in MALLOC_*()
Timo Sirainen [Fri, 10 Feb 2017 09:58:17 +0000 (11:58 +0200)] 
lib: Avoid unnecessary Coverity warnings in MALLOC_*()

There doesn't seem to be any other nice way of avoiding these without
separately marking every instance.

8 years agoTODO: Remove some of the implemented features
Timo Sirainen [Thu, 9 Feb 2017 14:33:35 +0000 (16:33 +0200)] 
TODO: Remove some of the implemented features