]>
git.ipfire.org Git - thirdparty/dovecot/core.git/log
Timo Sirainen [Mon, 24 Apr 2017 15:12:55 +0000 (18:12 +0300)]
imap: Add client_add_capability()
Timo Sirainen [Mon, 24 Apr 2017 10:29:13 +0000 (13:29 +0300)]
imapc: Add imapc_features=fetch-bodystructure
This allows using the remote IMAP server's BODY and BODYSTRUCTURE replies.
Timo Sirainen [Mon, 24 Apr 2017 10:27:43 +0000 (13:27 +0300)]
lib-storage: Add mail_storage.nonbody_access_fields
This avoids index_mail_update_access_parts_pre() from opening the mail
stream unnecessarily for fields that can be looked up via other methods
by the storage.
Timo Sirainen [Mon, 24 Apr 2017 10:05:48 +0000 (13:05 +0300)]
lib-storage: Add index_mail_get_cached_body[structure]()
This just moves the code to these functions without changing any of the
logic.
Timo Sirainen [Mon, 24 Apr 2017 11:04:01 +0000 (14:04 +0300)]
lib-imap: Make imap_bodystructure_parse_args() public
Timo Sirainen [Mon, 24 Apr 2017 09:50:10 +0000 (12:50 +0300)]
lib-imap: Add imap_write_arg() to write only a single arg
Timo Sirainen [Sun, 23 Apr 2017 16:57:11 +0000 (19:57 +0300)]
lib-imap-client: Fix imapc_client_get_capabilities() when called without connections
Timo Sirainen [Sun, 23 Apr 2017 14:19:36 +0000 (17:19 +0300)]
imapc: Fix crash in mailbox_exists() when LAYOUT isn't imapc.
Especially breaks LAYOUT=none.
Timo Sirainen [Sun, 23 Apr 2017 10:35:18 +0000 (13:35 +0300)]
imapc: Support imapc_features=search without ESEARCH extension
Timo Sirainen [Sun, 23 Apr 2017 16:14:54 +0000 (19:14 +0300)]
imapc: Make sure client is logged in when checking capabilities
Especially with imapc_features=delay-login the capability could have been
looked at before the client was even connected.
Timo Sirainen [Sun, 23 Apr 2017 15:51:02 +0000 (18:51 +0300)]
imapc: Add imapc_mailbox.capabilities
Use it instead of imapc_client_get_capabilities(). Simplifies the
following patch.
Timo Sirainen [Sun, 23 Apr 2017 15:57:15 +0000 (18:57 +0300)]
imapc: Rename imapc_storage_has_modseqs() to imapc_mailbox_has_modseqs()
Simplifies the following patch.
Timo Sirainen [Fri, 21 Apr 2017 09:54:17 +0000 (12:54 +0300)]
cassandra: Use fallback consistency for CASS_ERROR_LIB_NO_HOSTS_AVAILABLE errors
I'm not entirely sure if this is always appropriate, but at least this error
happens every time when attempting to use write_consistency=two when there
is only a single Cassandra node.
Timo Sirainen [Fri, 21 Apr 2017 17:59:55 +0000 (20:59 +0300)]
dsync-server: Fix support for dsync_features=empty-header-workaround
Fixes:
Panic: Unknown key: empty_hdr_workaround
Timo Sirainen [Fri, 21 Apr 2017 10:35:33 +0000 (13:35 +0300)]
*-login: Add client_vfuncs.send_raw_data()
This allows login plugins to hook into seeing all the data that is sent to
the imap/pop3 client.
Timo Sirainen [Fri, 21 Apr 2017 10:27:18 +0000 (13:27 +0300)]
imap: Add imap_client_vfuncs.send_tagline()
This allows plugins to catch all the IMAP command replies.
Timo Sirainen [Tue, 18 Apr 2017 07:23:37 +0000 (10:23 +0300)]
*-login: Unload plugins at deinit.
Timo Sirainen [Wed, 19 Apr 2017 12:01:19 +0000 (15:01 +0300)]
lib-storage: Allow mail_add_temp_wanted_fields() to be called before mail_set_seq*()
Quota plugin was already doing this, but it didn't actually work. It was
also crashing with imapc:
Panic: file mail-cache-lookup.c: line 341 (mail_cache_field_exists): assertion failed: (seq > 0)
Timo Sirainen [Thu, 20 Apr 2017 16:16:46 +0000 (19:16 +0300)]
lib-storage: Add mailbox_attribute_unregister_internal[s]()
This allows plugins to unregister internal attributes when they're unloaded.
Timo Sirainen [Thu, 13 Apr 2017 12:13:19 +0000 (15:13 +0300)]
lib-storage: mail_search_args_simplify() - deduplicate flags
This needs to be done in a bit more complicated way because multiple
SEARCH_FLAGS parameters are wanted to be merged together using a single
shared value.flags. Move this merging last after all the deduplication is
done.
Timo Sirainen [Thu, 13 Apr 2017 12:09:19 +0000 (15:09 +0300)]
lib-storage: mail_search_args_simplify() - simplify "x AND NOT x"
Implemented for SEARCH_KEYWORD, SEARCH_TEXT, SEARCH_BODY and SEARCH_HEADER*.
Dates and sizes would need special code, which gets a bit complicated.
Timo Sirainen [Thu, 13 Apr 2017 11:05:55 +0000 (14:05 +0300)]
lib-storage: Add more tests to test-mail-search-args-simplify
Timo Sirainen [Thu, 13 Apr 2017 10:57:41 +0000 (13:57 +0300)]
lib-storage: mail_search_arg_to_imap() - remove () around a single flag/keyword
Timo Sirainen [Thu, 13 Apr 2017 10:04:25 +0000 (13:04 +0300)]
lib-storage: mail_search_args_simplify() - deduplicate KEYWORDs
Timo Sirainen [Thu, 13 Apr 2017 09:51:25 +0000 (12:51 +0300)]
lib-storage: mail_search_args_to_cmdline() - Fix writing FLAGS & KEYWORDS
Timo Sirainen [Thu, 13 Apr 2017 09:36:30 +0000 (12:36 +0300)]
lib-storage: mail_search_args_to_cmdline() - Write MAILBOX glob without X- prefix
Since SEARCH_MAILBOX is written out as "MAILBOX", SEARCH_MAILBOX_GLOB should
also be written as "MAILBOX" rather than "X-MAILBOX".
Aki Tuomi [Tue, 11 Apr 2017 17:39:55 +0000 (20:39 +0300)]
auth: Check var_expand error in vpopmail
Aki Tuomi [Tue, 11 Apr 2017 12:50:14 +0000 (15:50 +0300)]
auth: Filter passdbs on credentials lookup start
Consistency with how plain verify works.
Aki Tuomi [Tue, 11 Apr 2017 12:47:33 +0000 (15:47 +0300)]
auth: Fix mechanism filter to support `none`
Otherwise credentials lookup can fail. None indicates
that it should match when no mech is specified.
Timo Sirainen [Tue, 11 Apr 2017 12:33:22 +0000 (15:33 +0300)]
auth: Use mem_equals_timing_safe() for all password hash comparisons.
It's unlikely these could be used to perform timing attacks, since the
attacker would have to have broken MD5/SHA badly enough to be able to
quickly generate string that result in wanted hashes. Still, the extra
cost is almost nothing and it's always better to be super paranoid!
Timo Sirainen [Sun, 9 Apr 2017 12:31:11 +0000 (15:31 +0300)]
auth: Shuffle failed auth requests before sending the failure replies.
This might be helpful against some timing attacks.
Using Fisher–Yates shuffle.
Timo Sirainen [Sun, 9 Apr 2017 12:19:25 +0000 (15:19 +0300)]
doveadm: Make doveadm_password safe against timing attacks.
Timo Sirainen [Sat, 8 Apr 2017 21:50:15 +0000 (00:50 +0300)]
auth: Make plaintext password comparisons safe against timing attacks
Timo Sirainen [Sat, 8 Apr 2017 21:49:37 +0000 (00:49 +0300)]
lib: Add mem_equals_timing_safe()
Aki Tuomi [Mon, 10 Apr 2017 17:53:29 +0000 (20:53 +0300)]
fts: Initialize fts after namespaces have been added
This way paths are correctly set, and fts indexes are
written to correct place. This affects mbox with lucene.
Fixes Panic: file mailbox-list.c: line 1158 (mailbox_list_try_mkdir_root): assertion failed (strncmp(root_dir, path, strlen(root_dir)) == 0)
Aki Tuomi [Tue, 11 Apr 2017 12:05:53 +0000 (15:05 +0300)]
fts: Remove indentation from fts_mailbox_list_created
Preparation for next commit
Timo Sirainen [Wed, 12 Apr 2017 09:24:05 +0000 (12:24 +0300)]
Makefile: Another fix for make distcheck when using scan-build
It seems to run two configures with different parameters, which results in
some of the files not being cleaned up. So this hopefully fixes:
ERROR: files left in build directory after distclean:
./src/util/tcpwrap
Stephan Bosch [Tue, 11 Apr 2017 07:34:11 +0000 (09:34 +0200)]
lib-imap: imap-bodystructure: Fixed handling of a multipart part without children in imap_bodystructure_parse().
In imap_bodystructure_write(), an empty multipart part is addressed by generating an empty text/plain part.
However, when parsing that back with imap_bodystructure_parse() against a parsed message_part tree, this case needs to be considered explicitly.
Otherwise, it will not be able to match the message part hierarchies.
This adds a test suite item that tests both the write (previous commit) and parse functions.
Stephan Bosch [Wed, 12 Apr 2017 08:13:15 +0000 (10:13 +0200)]
lib-imap: imap-bodystructure: Fixed handling of a multipart part without children in imap_bodystructure_write().
In that case it writes an empty text/plain part to prevent generating an invalid BODYSTRUCURE.
However, it always generated the basic BODY version without the extra fields for a full BODYSTRUCTURE.
Aki Tuomi [Tue, 11 Apr 2017 17:32:19 +0000 (20:32 +0300)]
auth: Fix compile problem with vpopmail
79fe1b28df44ba22b230326bee895583c1df5a28 forgot to remove const from table.
Timo Sirainen [Tue, 11 Apr 2017 11:55:04 +0000 (14:55 +0300)]
Makefile: Fix make distcheck when using scan-build
The _build directory shouldn't be deleted afterwards or it'll just fail.
Timo Sirainen [Tue, 11 Apr 2017 08:23:17 +0000 (11:23 +0300)]
Improve valgrind suppressions.
Aki Tuomi [Wed, 11 Jan 2017 17:43:30 +0000 (19:43 +0200)]
lib-dict-sql: Try merge sets to single update
This attempts to put mergeable keys into same
update instead of using multiple SQL statements.
Timo Sirainen [Tue, 11 Apr 2017 07:11:00 +0000 (10:11 +0300)]
lib, userdb-vpopmail: Fully remove var_expand_table_build()
It was accidentally removed in master-2.2 as part of the changes in
122014ad84488d6309dc7d1572dfc988fedc18c4
This finishes up the removal as it was done in master in
79fe1b28df44ba22b230326bee895583c1df5a28
Timo Sirainen [Mon, 10 Apr 2017 14:07:28 +0000 (17:07 +0300)]
lib-imap-client: Fix reconnection
There was already code for reconnection. We just shouldn't have gone very
far in imapc_connection_connect() if we were still waiting for reconnection
delay to pass.
Timo Sirainen [Mon, 10 Apr 2017 15:12:47 +0000 (18:12 +0300)]
lib-imap-client: Fixes to unit test
Timo Sirainen [Mon, 10 Apr 2017 14:10:21 +0000 (17:10 +0300)]
lib-imap-client: Add unit test
Initially this tests some connection and reconnection problems.
Timo Sirainen [Mon, 10 Apr 2017 14:09:29 +0000 (17:09 +0300)]
lib-imap-client: Include "ms" in reconnect warning message
Timo Sirainen [Mon, 10 Apr 2017 14:06:34 +0000 (17:06 +0300)]
lib-imap-client: Remove hardcoded IMAPC_CONNECT_RETRY_WAIT_MSECS
We have a setting for it now.
Timo Sirainen [Mon, 10 Apr 2017 13:44:52 +0000 (16:44 +0300)]
lib-imap-client: Disconnection during LOGIN should still have state=disconnected
It's not an authentication failure, which would imply that the user or
password was wrong.
Timo Sirainen [Mon, 10 Apr 2017 13:18:46 +0000 (16:18 +0300)]
lib-imap-client: Make command tag counter externally accessible
This allows unit tests to reset it.
Timo Sirainen [Mon, 10 Apr 2017 12:49:24 +0000 (15:49 +0300)]
lib-imap-client: Call the public login callback exactly once.
Previously it was also called only once, as long as there were only a single
imap connection. (The current imapc code wouldn't create more than one
connection.) It was a bit confusing what the expectation was, so now the
callback is never called more than once.
Timo Sirainen [Mon, 10 Apr 2017 11:14:40 +0000 (14:14 +0300)]
lib-imap-client: imapc_client_deinit() didn't set client=NULL
Timo Sirainen [Mon, 10 Apr 2017 10:50:40 +0000 (13:50 +0300)]
imapc: Change imapc_connection_retry_interval default to be 1 second.
10 secs at least is too high. Usually the connection problem is very
intermittent and even an immediate reconnection would succeed.
Timo Sirainen [Mon, 10 Apr 2017 10:48:23 +0000 (13:48 +0300)]
lib-imap-client: Change connect_retry_interval_secs to _msecs
This allows caller to provide better precision.
Timo Sirainen [Mon, 10 Apr 2017 10:46:03 +0000 (13:46 +0300)]
lib-imap-client: Use struct timeval for tracking last_connect time.
This provides better accuracy when calculating how much time there's left
until reconnection.
Timo Sirainen [Mon, 10 Apr 2017 10:02:17 +0000 (13:02 +0300)]
lib-http: Improve request stats text.
It's important to know how long the request was in queue before it was sent.
Also the "n attempts in m secs" makes more sense if it was counting only the
time after the initial request was sent, not including the queuing time.
If there is more than 1 attempt, log separately how long all the attempts
were waited on vs. how long the last attempt took.
Timo Sirainen [Mon, 10 Apr 2017 09:59:08 +0000 (12:59 +0300)]
lib-http: Add http_client_request_stats.first_sent_msecs
Also rename sent_msecs to last_sent_msecs.
Timo Sirainen [Mon, 10 Apr 2017 09:53:43 +0000 (12:53 +0300)]
lib-http: Track request's first and last send attempt times separately.
Timo Sirainen [Wed, 5 Apr 2017 09:36:32 +0000 (12:36 +0300)]
*-login: Move code to login_anvil_init()
Calling this allows plugins that need to talk to anvil make sure they have
an anvil connection even if mail_max_userip_connections=0.
Timo Sirainen [Wed, 5 Apr 2017 09:52:14 +0000 (12:52 +0300)]
doveadm who: Don't aggregate empty usernames with different IPs
We'll assume that in that case anvil is used to track IP addresses rather
than usernames. (Dovecot core doesn't currently use this.)
Timo Sirainen [Fri, 7 Apr 2017 06:28:55 +0000 (09:28 +0300)]
lib-http: Remove unnecessary enum declaration.
Most of these were removed by
a8fe899601735459641edae975c0fa08be8482e2
Timo Sirainen [Wed, 5 Apr 2017 11:14:57 +0000 (14:14 +0300)]
example-config: Add blocking setting to dovecot-ldap.conf.ext
Timo Sirainen [Sat, 8 Apr 2017 06:58:57 +0000 (09:58 +0300)]
auth-var-expand-crypt plugin: Add missing ldflags
Timo Sirainen [Sun, 9 Apr 2017 12:48:59 +0000 (15:48 +0300)]
fts-solr: Don't double-escape headers.
Timo Sirainen [Fri, 7 Apr 2017 13:27:12 +0000 (16:27 +0300)]
auth: Fix crash in passdb imap on connection failures
Timo Sirainen [Fri, 7 Apr 2017 13:13:13 +0000 (16:13 +0300)]
lib-ssl-iostream: Don't require SSL CA certs if require_valid_cert==FALSE
This happened only when verify_remote_cert was also TRUE. But this behavior
now allows verifying the cert without actually requiring it to be valid.
Timo Sirainen [Fri, 7 Apr 2017 12:47:27 +0000 (15:47 +0300)]
auth: passdb imap: Use ssl_client_ca_* settings.
The args = ssl_ca_dir=.. setting still overrides the ssl_client_ca_dir.
Timo Sirainen [Fri, 7 Apr 2017 06:34:39 +0000 (09:34 +0300)]
global: Remove extra ';' to fix compiler errors
Sun C doesn't like them.
Timo Sirainen [Fri, 7 Apr 2017 06:32:30 +0000 (09:32 +0300)]
global: Make sure all files end with newline
Fixes compiler warnings with Sun C.
Timo Sirainen [Fri, 7 Apr 2017 07:55:40 +0000 (10:55 +0300)]
fs-posix: Fix FS_METADATA_WRITE_FNAME to preserve the path
It should only change the filename.
Timo Sirainen [Fri, 7 Apr 2017 09:45:49 +0000 (12:45 +0300)]
doveadm force-resync: Skip autocreated mailboxes that don't exist yet.
Since they don't exist, there's nothing to resync in them either.
This avoids unnecessarily creating them.
Timo Sirainen [Fri, 7 Apr 2017 09:42:12 +0000 (12:42 +0300)]
dict-sql: Fix setting $variables to iteration key when map had multiple values
Timo Sirainen [Fri, 7 Apr 2017 06:14:27 +0000 (09:14 +0300)]
lib: Redefine NULL only if HAVE_TYPE_CHECKS is set
Timo Sirainen [Fri, 7 Apr 2017 06:11:53 +0000 (09:11 +0300)]
lib: Add a common HAVE_TYPE_CHECKS
I'm not sure if it should be checking gcc >= 3.0 or 3.3, but they're
all old so doesn't really matter.
The __cplusplus check was added to both, since it wouldn't have done
anything anyway as COMPILE_ERROR_IF_TRUE() is 0 for __cplusplus.
Timo Sirainen [Wed, 5 Apr 2017 12:59:51 +0000 (15:59 +0300)]
*-login: Minor logging cleanup if client is disconnected before sending banner.
Avoid unnecessarily adding "(no auth attempts in 0 secs)" when the reason
string already makes it clear that the user didn't even have a chance to
authenticate.
This kind of disconnection currently happens only with some plugins.
Timo Sirainen [Thu, 6 Apr 2017 17:43:20 +0000 (20:43 +0300)]
example-config: Add connect/read/write_timeout to mysql connect settings
Timo Sirainen [Thu, 6 Apr 2017 17:00:31 +0000 (20:00 +0300)]
imapc: Remove "_sec" suffix from imapc_connection_retry_interval_secs
Its type is SET_TIME, so the value doesn't have to be in seconds.
Aki Tuomi [Thu, 6 Apr 2017 16:49:07 +0000 (19:49 +0300)]
imap-login: Retain client ID only when enabled
Aki Tuomi [Wed, 5 Apr 2017 11:23:47 +0000 (14:23 +0300)]
lib-storage: Set internal error in imapc_list_get_hierarchy_sep
Aki Tuomi [Wed, 5 Apr 2017 11:23:26 +0000 (14:23 +0300)]
imapc: Use IMAPC_COMMAND_STATE_AUTH_FAILED to indicate auth failure
Aki Tuomi [Wed, 5 Apr 2017 11:22:38 +0000 (14:22 +0300)]
lib-imap-client: Do not reset ips when reconnecting
Avoids infinite loop
Aki Tuomi [Wed, 5 Apr 2017 10:27:57 +0000 (13:27 +0300)]
lib-storage: Return empty value in imapc_list_get_storage_name on auth error
Avoids clobbering authentication error.
Aki Tuomi [Wed, 5 Apr 2017 09:48:31 +0000 (12:48 +0300)]
lib-storage: Do not clobber error with imapc
Aki Tuomi [Wed, 5 Apr 2017 09:47:24 +0000 (12:47 +0300)]
global: Fix imapc_client_login usage
Aki Tuomi [Wed, 5 Apr 2017 09:09:57 +0000 (12:09 +0300)]
lib-imap-client: Add login_callback setter
This way it can be set before actually calling login
which might happen some time later.
Dmitry Yakunin [Tue, 4 Apr 2017 20:33:51 +0000 (23:33 +0300)]
imapc: Fix memory leak in disconnected state
Aki Tuomi [Wed, 5 Apr 2017 06:26:54 +0000 (09:26 +0300)]
auth: Update default policy string to include device id and protocol
Timo Sirainen [Tue, 4 Apr 2017 12:59:04 +0000 (15:59 +0300)]
imap: Set command reason strings using the new human_args
This way the reason string is already suitable for logging, since it's
guaranteed to be valid UTF-8 without control chars.
Timo Sirainen [Tue, 4 Apr 2017 12:58:42 +0000 (15:58 +0300)]
imap: Add client_command_context.human_args
Generated with imap_write_args_for_human()
Timo Sirainen [Tue, 4 Apr 2017 12:58:15 +0000 (15:58 +0300)]
lib-imap: Add imap_write_args_for_human()
Timo Sirainen [Tue, 4 Apr 2017 12:38:00 +0000 (15:38 +0300)]
imap: Add imap_client_command_get_reason()
All the command -> reason string conversions now go through this function.
Timo Sirainen [Tue, 4 Apr 2017 10:28:44 +0000 (13:28 +0300)]
lib: Increase net_connect*() EADDRNOTAVAIL retries to 20
4 is too little, since on busy systems it's sometimes failing. These calls
should be pretty cheap, so lets try if 20 is enough.
It would be nice if this was configurable, but the only practical way right
now would be to use environment variable, which is a bit ugly. We could
try it next if 20 is still not enough.
Timo Sirainen [Mon, 3 Apr 2017 15:44:52 +0000 (18:44 +0300)]
imapc: Compiler warning fix for 32bit systems
Aki Tuomi [Fri, 31 Mar 2017 07:57:14 +0000 (10:57 +0300)]
lib-imap-client: Make authentication failures more consistent
This way they always say the same prefix, which is easier to
spot.
Aki Tuomi [Fri, 31 Mar 2017 07:49:50 +0000 (10:49 +0300)]
lib-imap-client: Call login_callback on all authentication failures
Aki Tuomi [Fri, 31 Mar 2017 07:12:58 +0000 (10:12 +0300)]
lib-imap-client: Fix reconnection
This patch fixes reconnections to actually consider
all IP addresses first and then delay for interval and
retry at most retry count times.
Aki Tuomi [Fri, 31 Mar 2017 08:01:15 +0000 (11:01 +0300)]
lib-imap-client: Remove io earlier to avoid hammering
If connection has failed and reconnection is not yet
possible, io has to be removed here, otherwise it will
keep hammering the callback.
Aki Tuomi [Fri, 31 Mar 2017 07:58:47 +0000 (10:58 +0300)]
lib-imap-client: Only LOGOUT from connected connections
Aki Tuomi [Fri, 31 Mar 2017 06:44:28 +0000 (09:44 +0300)]
lib-imap-client: Make retry count and interval configurable