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

8 years agopop3c: Increase timeout for PASS to 5 minutes.
Timo Sirainen [Wed, 8 Feb 2017 21:01:32 +0000 (23:01 +0200)] 
pop3c: Increase timeout for PASS to 5 minutes.

8 years agosdbox: Fix assert-crash on mailbox create race
Timo Sirainen [Mon, 6 Feb 2017 16:34:05 +0000 (18:34 +0200)] 
sdbox: Fix assert-crash on mailbox create race

If another process created the mailbox at the same time, the mailbox_guid
wasn't set and opening the mailbox assert-crashed:

Panic: file mail-storage.c: line 1744 (mailbox_get_metadata): assertion failed: ((items & MAILBOX_METADATA_GUID) == 0 || !guid_128_is_empty(metadata_r->guid))

8 years agoquota: Clarify quota_count() return value.
Timo Sirainen [Tue, 7 Feb 2017 19:07:54 +0000 (21:07 +0200)] 
quota: Clarify quota_count() return value.

8 years agoquota: Make sure quota_warning doesn't wrap "quota before" value.
Timo Sirainen [Tue, 7 Feb 2017 18:41:41 +0000 (20:41 +0200)] 
quota: Make sure quota_warning doesn't wrap "quota before" value.

This could happen in some race conditions (and with bugs).

8 years agoquota: When executing quota_warning/over_flag script, log the reason why.
Timo Sirainen [Tue, 7 Feb 2017 16:26:50 +0000 (18:26 +0200)] 
quota: When executing quota_warning/over_flag script, log the reason why.

8 years agolib-storage: remove mail_storage_get_driver_settings
Martti Rannanjärvi [Mon, 6 Feb 2017 12:37:05 +0000 (14:37 +0200)] 
lib-storage: remove mail_storage_get_driver_settings

It has been marked obsolete.

8 years agolib: Check that output max size is non-zero when version specified
Aki Tuomi [Tue, 7 Feb 2017 11:19:17 +0000 (13:19 +0200)] 
lib: Check that output max size is non-zero when version specified

Otherwise we try to send version to non-existent output
stream.

8 years agofts-tika: Fixed HTTPS support by properly propagating SSL client settings from mail_user.
Stephan Bosch [Sun, 22 Jan 2017 12:42:25 +0000 (13:42 +0100)] 
fts-tika: Fixed HTTPS support by properly propagating SSL client settings from mail_user.

8 years agofts-solr: Fixed HTTPS support by properly propagating SSL client settings from mail_user.
Stephan Bosch [Sun, 22 Jan 2017 12:41:25 +0000 (13:41 +0100)] 
fts-solr: Fixed HTTPS support by properly propagating SSL client settings from mail_user.

8 years agolib-storage: Added mail_user_init_ssl_client_settings().
Stephan Bosch [Sun, 22 Jan 2017 12:40:00 +0000 (13:40 +0100)] 
lib-storage: Added mail_user_init_ssl_client_settings().

8 years agolib-ldap: Remove extra return
johnkwoods [Wed, 28 Dec 2016 18:02:14 +0000 (12:02 -0600)] 
lib-ldap: Remove extra return

The ldap_connection_queue_request() function returns void. Trying to
"return" something from a void function caused compiling issues on
Solaris (Oracle Developer Studio 12.5).

8 years agofts-solr: Allow username/password for solr connction
J. Nick Koston [Sun, 22 Jan 2017 23:24:02 +0000 (17:24 -0600)] 
fts-solr: Allow username/password for solr connction

Solr comes open to the world by default. For better
security, we protect our solr installs with a user
and password.  This change allows dovecot to connect
to these instances.

Example usage in a fts.conf (permissions 0600)
 fts_solr = url=http://nick:pass@127.0.0.1:8983/solr/dovecot/

8 years agoindexer: Don't send more requests directly from worker status callback
Timo Sirainen [Mon, 6 Feb 2017 12:05:47 +0000 (14:05 +0200)] 
indexer: Don't send more requests directly from worker status callback

This causes assert-crashes when workers disconnect while having multiple
requests:

indexer: Error: Indexer worker disconnected, discarding 2 requests for user@domain
indexer: Panic: file indexer.c: line 69 (queue_try_send_more): assertion failed: (worker_connection_is_connected(conn))

8 years agoimap: Add imap_fetch_failure setting
Timo Sirainen [Sun, 5 Feb 2017 14:49:05 +0000 (16:49 +0200)] 
imap: Add imap_fetch_failure setting

This controls what happens when FETCH fails for some mails. The possible
values are:

disconnect-immediately: This is the original behavior. Whenever FETCH
fails for a mail, the FETCH is aborted and client is disconnected.

disconnect-after: The FETCH runs for all the requested mails, skipping
any mails that returned failures, but at the end the client is still
disconnected.

no-after: The FETCH runs for all the requested mails, skipping any mails
that returned failures. At the end tagged NO reply is returned. If the
client attempts to FETCH the same failed mail more than once, the client
is disconnected. This is to avoid clients from going into infinite loops
trying to FETCH a broken mail.

8 years agoimap: Share mailbox closing code in SELECT/UNSELECT/CLOSE/LOGOUT/deinit
Timo Sirainen [Sun, 5 Feb 2017 14:24:08 +0000 (16:24 +0200)] 
imap: Share mailbox closing code in SELECT/UNSELECT/CLOSE/LOGOUT/deinit

8 years agoimap: Free search updates on CLOSE
Timo Sirainen [Sun, 5 Feb 2017 14:23:35 +0000 (16:23 +0200)] 
imap: Free search updates on CLOSE

8 years agoimap: Don't send empty FETCH () on failure
Timo Sirainen [Sun, 5 Feb 2017 14:10:44 +0000 (16:10 +0200)] 
imap: Don't send empty FETCH () on failure

It violates IMAP RFC. Send FETCH (UID n) instead.

8 years agolib-ssl-iostream: Fix memory leak in RSA_generate_key_ex() usage
Timo Sirainen [Mon, 6 Feb 2017 09:02:46 +0000 (11:02 +0200)] 
lib-ssl-iostream: Fix memory leak in RSA_generate_key_ex() usage

8 years agoauth: Handle delayed credentials identically in auth-workers
Timo Sirainen [Mon, 6 Feb 2017 09:23:50 +0000 (11:23 +0200)] 
auth: Handle delayed credentials identically in auth-workers

8 years agolib: Make sure NULL is defined to be ((void *)0)
Timo Sirainen [Mon, 6 Feb 2017 08:55:40 +0000 (10:55 +0200)] 
lib: Make sure NULL is defined to be ((void *)0)

This avoids us having to do explicit (void *)NULL casts in e.g.
io_add(..., NULL) context parameter.

8 years agolib-storage: Don't duplicate service user's settings into mail_user
Timo Sirainen [Sat, 4 Feb 2017 11:51:13 +0000 (13:51 +0200)] 
lib-storage: Don't duplicate service user's settings into mail_user

The mail_storage_service_user.user_set isn't used afterwards, so it can be
directly used to avoid wasting memory.

8 years agolib-storage: Don't unnecessarily duplicate user's all setting strings
Timo Sirainen [Sat, 4 Feb 2017 11:38:17 +0000 (13:38 +0200)] 
lib-storage: Don't unnecessarily duplicate user's all setting strings

user->unexpanded_set and user->set have the same life-time, so they can
point to same strings.

8 years agolib-ssl-iostream: Remove libdovecot_openssl_common.la
Timo Sirainen [Sun, 5 Feb 2017 18:29:10 +0000 (20:29 +0200)] 
lib-ssl-iostream: Remove libdovecot_openssl_common.la

Using such a library results in the same code being duplicated (in OSX) in
both libssl_iostream_openssl.so and libdcrypt_openssl.so.  This breaks the
idea of openssl_init_refcount, because each one will have their own one.

libdcrypt_openssl.so now links to libssl_iostream_openssl.so, which
shouldn't really be a problem, because lib-ssl-iostream is part of the core
libdovecot.so already. It would have been possible to also install
libdovecot_openssl_common.so and link it to both libssl_iostream_openssl.so
and libdcrypt_openssl.so, but that seems unnecessarily complicated.

8 years agolib-ssl-iostream: Remove empty $(ssl_sources) from Makefile
Timo Sirainen [Sun, 5 Feb 2017 18:28:04 +0000 (20:28 +0200)] 
lib-ssl-iostream: Remove empty $(ssl_sources) from Makefile

8 years agolib-dcrypt: Link unit tests with libssl_iostream.la
Timo Sirainen [Sun, 5 Feb 2017 18:26:12 +0000 (20:26 +0200)] 
lib-dcrypt: Link unit tests with libssl_iostream.la

libssl_iostream_openssl.so requires this, and it doesn't get added from
anywhere automatically.

8 years agolib-dcrypt: Remove unnecessary -shared link flag
Timo Sirainen [Sun, 5 Feb 2017 18:24:41 +0000 (20:24 +0200)] 
lib-dcrypt: Remove unnecessary -shared link flag

Not sure if this is harmful, but since no other plugin uses this it's not
needed either.

8 years agolib-dcrypt: Don't link liblib.la to libdcrypt_openssl.so
Timo Sirainen [Sun, 5 Feb 2017 18:22:27 +0000 (20:22 +0200)] 
lib-dcrypt: Don't link liblib.la to libdcrypt_openssl.so

At best this does nothing, at worst (like with OSX) it duplicates the
entire liblib and creates split state between the two instances.

8 years agolib-dcrypt: If dcrypt can't be initialized, log also the reason.
Timo Sirainen [Sun, 5 Feb 2017 18:20:37 +0000 (20:20 +0200)] 
lib-dcrypt: If dcrypt can't be initialized, log also the reason.

This is very helpful when debugging linking issues.

8 years agolib-ssl-iostream: Detect whether to call ERR_remove_[thread_]state() via configure
Timo Sirainen [Sun, 5 Feb 2017 19:38:33 +0000 (21:38 +0200)] 
lib-ssl-iostream: Detect whether to call ERR_remove_[thread_]state() via configure

8 years agolib-ssl-iostream: Call OBJ_cleanup() for all OpenSSL versions
Timo Sirainen [Sun, 5 Feb 2017 19:31:08 +0000 (21:31 +0200)] 
lib-ssl-iostream: Call OBJ_cleanup() for all OpenSSL versions

Just to reduce the #if checks that uglify the code.