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

8 years agolib-ssl-iostream: Detect OPENSSL_cleanup() via configure
Timo Sirainen [Sun, 5 Feb 2017 19:10:04 +0000 (21:10 +0200)] 
lib-ssl-iostream: Detect OPENSSL_cleanup() via configure

It's ugly to have both OpenSSL version number check and a special LibreSSL
check.

8 years agolib-ssl-iostream: Detect OpenSSL memory functions' parameters via configure
Timo Sirainen [Sun, 5 Feb 2017 19:04:35 +0000 (21:04 +0200)] 
lib-ssl-iostream: Detect OpenSSL memory functions' parameters via configure

The version number check doesn't work correctly for LibreSSL.

8 years agolib-ssl-iostream: Use ASN1_STRING_get0_data() if it exists
Timo Sirainen [Sun, 5 Feb 2017 19:56:20 +0000 (21:56 +0200)] 
lib-ssl-iostream: Use ASN1_STRING_get0_data() if it exists

This avoids deprecation warnings about ASN1_STRING_data() in OpenSSL v1.1.

8 years agolib-ssl-iostream: Use RSA_generate_key_ex() if it exists
Timo Sirainen [Sun, 5 Feb 2017 19:51:29 +0000 (21:51 +0200)] 
lib-ssl-iostream: Use RSA_generate_key_ex() if it exists

This avoids deprecation warnings about RSA_generate_key() in OpenSSL v1.1.

8 years agodict-sql: Move USING TIMESTAMP to correct location for INSERTs
Timo Sirainen [Sun, 5 Feb 2017 22:11:14 +0000 (00:11 +0200)] 
dict-sql: Move USING TIMESTAMP to correct location for INSERTs

8 years agoauth: Pass through passdb extra fields to auth-worker requests
Timo Sirainen [Sun, 5 Feb 2017 22:48:18 +0000 (00:48 +0200)] 
auth: Pass through passdb extra fields to auth-worker requests

8 years agoauth: Code cleanup - Move userdb extra fields exporting to its own function
Timo Sirainen [Sun, 5 Feb 2017 22:46:55 +0000 (00:46 +0200)] 
auth: Code cleanup - Move userdb extra fields exporting to its own function

8 years agolib-storage: Expunging now uses GUID only if it's in cache.
Timo Sirainen [Wed, 25 Jan 2017 21:26:35 +0000 (23:26 +0200)] 
lib-storage: Expunging now uses GUID only if it's in cache.

Otherwise the GUID lookup may be expensive, which is especially bad when
deleting a large number of mails.

8 years agolib-storage: Fix autoexpunge locking to actually work correctly.
Timo Sirainen [Fri, 3 Feb 2017 17:40:54 +0000 (19:40 +0200)] 
lib-storage: Fix autoexpunge locking to actually work correctly.

It wasn't actually skipping the autoexpunging if the lock already existed.
It autoexpunged anyway.

8 years agofts: Use mailbox_list_created hook
Aki Tuomi [Fri, 3 Feb 2017 12:22:02 +0000 (14:22 +0200)] 
fts: Use mailbox_list_created hook

Otherwise the deinit hook might get lost and fts would not be deinitialized.

Reverts 11f12ca1c97583b551a4286fa6cd1ab33aa67680 which seems to have been unnecessary

Fixes indexer-worker signal 11 crash

8 years agolib-storage: Once hooks have run, set vlast to NULL to make sure it's not used
Timo Sirainen [Fri, 3 Feb 2017 14:16:26 +0000 (16:16 +0200)] 
lib-storage: Once hooks have run, set vlast to NULL to make sure it's not used

The functions can't be correctly overridden outside their own specific
hooks. It would work only if hook_build_update() is called afterwards and
currently there's no public API for that.

8 years agolib-storage: Put vsize in index only if it's not there
Aki Tuomi [Sat, 4 Feb 2017 08:42:21 +0000 (10:42 +0200)] 
lib-storage: Put vsize in index only if it's not there

8 years agolib-storage: Add assert to make sure header parsing isn't recursed
Timo Sirainen [Mon, 30 Jan 2017 19:28:20 +0000 (21:28 +0200)] 
lib-storage: Add assert to make sure header parsing isn't recursed

8 years agolib-http: client: Fixed peer reconnection failure handling.
Stephan Bosch [Thu, 2 Feb 2017 00:36:50 +0000 (01:36 +0100)] 
lib-http: client: Fixed peer reconnection failure handling.

The addressed problem occurs in a very specific situation in which the original successful connection is dropped, yet a new connection fails.
It manifests as an assertion failure or panic:

Panic: file ioloop-epoll.c: line 189 (io_loop_handler_run_internal): assertion failed: (msecs >= 0)
Panic: BUG: No IOs or timeouts set. Not waiting for infinity.

The timing is very critical. However, this doesn't mean that the occurrence of this problem is very unlikely; it can happen frequently under high load.

8 years agolib-http: client: Respect the connection idle timeout, even when all queues have...
Stephan Bosch [Thu, 2 Feb 2017 00:34:35 +0000 (01:34 +0100)] 
lib-http: client: Respect the connection idle timeout, even when all queues have unlinked from a peer.

Otherwise, the DNS TTL timeout dictates the connection idle timeout in some situations.

8 years agodict: Fix error logging if TIMESTAMP parameters are wrong.
Timo Sirainen [Thu, 2 Feb 2017 09:47:24 +0000 (11:47 +0200)] 
dict: Fix error logging if TIMESTAMP parameters are wrong.

8 years agodict-sql: Add missing USING TIMESTAMP for DELETE queries
Timo Sirainen [Thu, 2 Feb 2017 09:32:50 +0000 (11:32 +0200)] 
dict-sql: Add missing USING TIMESTAMP for DELETE queries

8 years agoimap: Fix panic on FETCH X-MAILBOX in virtual mailbox when mail is expunged
Timo Sirainen [Tue, 31 Jan 2017 19:03:29 +0000 (21:03 +0200)] 
imap: Fix panic on FETCH X-MAILBOX in virtual mailbox when mail is expunged

8 years agolib-http: server: Fix premature connection destroy in http_server_connection_output().
Stephan Bosch [Tue, 31 Jan 2017 12:41:48 +0000 (13:41 +0100)] 
lib-http: server: Fix premature connection destroy in http_server_connection_output().

Added a reference to the connection object while it is sending the remainder of a response's payload.
This is necessary, since http_server_response_send_more() can destroy the connection, for example when the request has a "Connection: close" header.
This will only occur for responses with a very large payload, because otherwise the payload is fully sent in in the initial pass.

8 years agolib-storage: When logging corrupted mail size, disable logging Message-ID for now
Timo Sirainen [Mon, 9 Jan 2017 21:13:03 +0000 (23:13 +0200)] 
lib-storage: When logging corrupted mail size, disable logging Message-ID for now

This was causing crashes in some situations. It was originally added to
figure out if there were problems with dovecot.index.cache containing
data for wrong messages. This was never found to happen, although now
thinking about it, the problem may have been
741287129c22cadc14c05584704685b31169dbce. So perhaps this code could be
removed permanently as well.

6b44fc75c0039d1006ce4d543544552449b8e229 also attempted to fix this, but it
wasn't enough. There was still some code path that lead to recursive header
parsing.

8 years agolib-storage: Set vsize extension when copying mails.
Timo Sirainen [Mon, 30 Jan 2017 13:12:04 +0000 (15:12 +0200)] 
lib-storage: Set vsize extension when copying mails.

8 years agolib-storage: Add index_mail_get_vsize_extension()
Timo Sirainen [Mon, 30 Jan 2017 13:11:45 +0000 (15:11 +0200)] 
lib-storage: Add index_mail_get_vsize_extension()

8 years agolib-storage: Move index_mail.vsize_ext_id to mailbox.mail_vsize_ext_id
Timo Sirainen [Mon, 30 Jan 2017 13:06:46 +0000 (15:06 +0200)] 
lib-storage: Move index_mail.vsize_ext_id to mailbox.mail_vsize_ext_id

It's mailbox-specific, so it doesn't have to be looked up every time.
Also this is needed for the following fix.

8 years agoimapc: Allow using LAYOUT=none without crashing.
Timo Sirainen [Wed, 14 Dec 2016 16:13:25 +0000 (18:13 +0200)] 
imapc: Allow using LAYOUT=none without crashing.

8 years agoimap: Don't unregister internal commands at deinit.
Timo Sirainen [Sat, 28 Jan 2017 22:24:33 +0000 (00:24 +0200)] 
imap: Don't unregister internal commands at deinit.

This allows plugins to unregister commands without errors being logged.

8 years agolib-storage: Lock autoexpunging so only a single process does it.
Timo Sirainen [Thu, 26 Jan 2017 20:42:09 +0000 (22:42 +0200)] 
lib-storage: Lock autoexpunging so only a single process does it.

This hopefully helps to avoid duplicates with lazy_expunge plugin.

8 years agoimap: Use struct mailbox_status.flags for FLAGS reply
Timo Sirainen [Sat, 28 Jan 2017 23:08:23 +0000 (01:08 +0200)] 
imap: Use struct mailbox_status.flags for FLAGS reply

8 years agolib-storage: Add struct mailbox_status.flags
Timo Sirainen [Sat, 28 Jan 2017 23:06:55 +0000 (01:06 +0200)] 
lib-storage: Add struct mailbox_status.flags

This is similar to permanent_flags, except it tells which flags can be
changed at all in the session. Mainly it allows plugins to make changes to
IMAP's untagged FLAGS reply.

8 years agolib: io_loop_set_current() - do nothing if ioloop doesn't change
Timo Sirainen [Fri, 27 Jan 2017 19:36:14 +0000 (21:36 +0200)] 
lib: io_loop_set_current() - do nothing if ioloop doesn't change

There's no need to call the switch callbacks if the ioloop doesn't change.

8 years agodoveadm: add doveadm_http_rawlog_dir setting
Martti Rannanjärvi [Fri, 27 Jan 2017 11:56:30 +0000 (13:56 +0200)] 
doveadm: add doveadm_http_rawlog_dir setting

8 years agolib-fts: Fix assert-crash in fts_icu_lcase()
Timo Sirainen [Tue, 24 Jan 2017 15:18:07 +0000 (17:18 +0200)] 
lib-fts: Fix assert-crash in fts_icu_lcase()

Fixes:
Panic: file fts-icu.c: line 152 (fts_icu_lcase): assertion failed: (err != U_BUFFER_OVERFLOW_ERROR)

8 years agolib-storage: Fix comparison to use virtual size instead of body virtual size
Aki Tuomi [Fri, 27 Jan 2017 07:41:36 +0000 (09:41 +0200)] 
lib-storage: Fix comparison to use virtual size instead of body virtual size

Was forgotten on 7f1ecb14

8 years agolib-index: Don't log error on dovecot.index.cache delete if it doesn't exist
Timo Sirainen [Thu, 26 Jan 2017 07:55:22 +0000 (09:55 +0200)] 
lib-index: Don't log error on dovecot.index.cache delete if it doesn't exist

For example if a cache is marked as corrupted and there is no cache, it's
not really an error that it doesn't exist.

Fixes:
Error: unlink(.../dovecot.index.cache) failed: No such file or directory (in mail-cache.c:29)

8 years agolib-storage: Filling vsize to index on read used wrong size
Timo Sirainen [Thu, 26 Jan 2017 17:51:34 +0000 (19:51 +0200)] 
lib-storage: Filling vsize to index on read used wrong size

8 years agolib-storage: Clear virtual size from index if size is corrupted
Aki Tuomi [Thu, 26 Jan 2017 07:42:26 +0000 (09:42 +0200)] 
lib-storage: Clear virtual size from index if size is corrupted

8 years agofts: Fix search query generation when tokens are filtered out.
Timo Sirainen [Sat, 14 Jan 2017 16:34:11 +0000 (18:34 +0200)] 
fts: Fix search query generation when tokens are filtered out.

For example with English stopwords when searching "foo and bar" it should
be equilevant to "foo bar", since "and" is filtered out.

8 years agodirector: "doveadm director move" to same host now refreshes user's timeout
Timo Sirainen [Mon, 23 Jan 2017 16:02:05 +0000 (18:02 +0200)] 
director: "doveadm director move" to same host now refreshes user's timeout

This allows keeping user constantly in the same backend by just periodically
moving the user there.

8 years agodict-sql: Do not increment on set
Aki Tuomi [Mon, 16 Jan 2017 12:01:57 +0000 (14:01 +0200)] 
dict-sql: Do not increment on set

When merging sets do not use increment mode in builder.

8 years agodict-sql: Fix iterator to not fail
Aki Tuomi [Tue, 17 Jan 2017 07:59:54 +0000 (09:59 +0200)] 
dict-sql: Fix iterator to not fail

When iterating a prefix without exact key flag,
do not fail when no more maps are matched if at least
one map has already matched.

Fixes
Error: dict_iterate_deinit failed: sql dict iterate failed for ...: Invalid/unmapped path

8 years agodict-sql: Error handling fix & code cleanup
Timo Sirainen [Sun, 16 Oct 2016 19:55:26 +0000 (22:55 +0300)] 
dict-sql: Error handling fix & code cleanup

Only the first sql_dict_iterate_next_query() error was handled correctly.

8 years agolib-sasl: Fix oauthbearer compatibility with 2.2
Aki Tuomi [Tue, 24 Jan 2017 10:42:25 +0000 (12:42 +0200)] 
lib-sasl: Fix oauthbearer compatibility with 2.2

8 years agolib-http: client: Fixed handling of errors occurring for unsubmitted requests during...
Stephan Bosch [Sun, 22 Jan 2017 22:55:24 +0000 (23:55 +0100)] 
lib-http: client: Fixed handling of errors occurring for unsubmitted requests during http_client_request_send_payload().

When http_client_request_send_payload() is executed for the first time, the request is submitted.
Errors occurring during submission don't trigger a callback immediately.
Instead, these are queued in the client and will trigger a callback when an ioloop is run with the client.
However, in http_client_request_send_payload() the ioloop is never executed when the request fails that way, meaning that
the callback was never called. Since for example SOLR assumes the callback is always called for an error in
http_client_request_send_payload(), this causes all kinds of problems.

Fixed by manually handling the delayed request errors in http_client_request_send_payload() explicitly.

8 years agolib-sasl: Add OAUTHBEARER and XOAUTH2 mechanism
Aki Tuomi [Wed, 18 Jan 2017 11:46:12 +0000 (13:46 +0200)] 
lib-sasl: Add OAUTHBEARER and XOAUTH2 mechanism

8 years agolib-sasl: Add API for setting and getting extra values
Aki Tuomi [Wed, 18 Jan 2017 11:45:27 +0000 (13:45 +0200)] 
lib-sasl: Add API for setting and getting extra values

This allows setting extra parameters for authentication
and recovering extended result information from
mechanism.

8 years agoimapc: Fix assert-crash on some connect failures
Timo Sirainen [Fri, 20 Jan 2017 16:19:05 +0000 (18:19 +0200)] 
imapc: Fix assert-crash on some connect failures

imapc_storage_has_modseqs() causes imapc_client_get_capabilities() to be
called, which assert-crashes if there isn't a valid connection:

Panic: file imapc-client.c: line 438 (imapc_client_get_capabilities): assertion failed: (conn != NULL)

8 years agodirector: Add more debug logging for moving & killing users
Timo Sirainen [Fri, 20 Jan 2017 13:57:10 +0000 (15:57 +0200)] 
director: Add more debug logging for moving & killing users

8 years agodirector: Fix USER-MOVE getting stuck if a director already uses the correct host
Timo Sirainen [Fri, 20 Jan 2017 14:06:48 +0000 (16:06 +0200)] 
director: Fix USER-MOVE getting stuck if a director already uses the correct host

8 years agodirector: Ignore doveadm user move if host is already the same.
Timo Sirainen [Fri, 20 Jan 2017 14:03:12 +0000 (16:03 +0200)] 
director: Ignore doveadm user move if host is already the same.

8 years agodirector: Make sure USER-KILLED isn't sent before USER-MOVE
Timo Sirainen [Fri, 20 Jan 2017 13:54:27 +0000 (15:54 +0200)] 
director: Make sure USER-KILLED isn't sent before USER-MOVE

If USER-MOVE was for a user that didn't exist, killing sent USER-KILLED
immediately before the forwarding USER-MOVE. This caused the move to get
stuck, giving errors like:

director: Error: Finishing user 3224731354 move timed out, its state may now be inconsistent (state=waiting-for-everyone)

8 years agodirector: Add assert to make sure USER-MOVE doesn't change tag
Timo Sirainen [Fri, 20 Jan 2017 13:52:43 +0000 (15:52 +0200)] 
director: Add assert to make sure USER-MOVE doesn't change tag

8 years agolib-storage: Copy cache decisions from inbox on create
Aki Tuomi [Tue, 27 Dec 2016 07:45:58 +0000 (09:45 +0200)] 
lib-storage: Copy cache decisions from inbox on create

Otherwise the decisions are definitely wrong, since
they are nonexistent. Copying from INBOX would make sense.

8 years agolib-index: Add mail_cache_decisions_copy
Aki Tuomi [Tue, 27 Dec 2016 07:44:52 +0000 (09:44 +0200)] 
lib-index: Add mail_cache_decisions_copy

This allows priming cache decisions for a folder.

8 years agolib-index: Unconstify mail_cache_register_get_list
Aki Tuomi [Tue, 3 Jan 2017 10:50:58 +0000 (12:50 +0200)] 
lib-index: Unconstify mail_cache_register_get_list

This way the result is usable as input for
mail_cache_register_fields.

8 years agolib-storage: Fix mailbox's vsize header check for mailboxes not in dovecot.list.index
Timo Sirainen [Fri, 20 Jan 2017 12:46:30 +0000 (14:46 +0200)] 
lib-storage: Fix mailbox's vsize header check for mailboxes not in dovecot.list.index

If mailbox wasn't yet in the dovecot.list.index, mailbox_list_index_status()
for it returns FALSE and doesn't initialize the status. In some situations this
may have caused a non-empty mailbox's vsize to be returned as 0.

8 years agolib-http: client: Make sure req->conn is only not NULL when that connection holds...
Stephan Bosch [Tue, 10 Jan 2017 01:12:25 +0000 (02:12 +0100)] 
lib-http: client: Make sure req->conn is only not NULL when that connection holds a reference to that request.

This consolidates the management of req->conn to one place, thereby preventing mishaps.
It makes sure req->conn is always properly assigned, making it more reliable.
This fixes a problem that emerged in the http-proxy.

8 years agolib-http: client: Keep connection reference throughout http_client_connection_return_...
Stephan Bosch [Thu, 19 Jan 2017 01:16:06 +0000 (02:16 +0100)] 
lib-http: client: Keep connection reference throughout http_client_connection_return_response().

Before, it was held in two intervals.
Next commit requires this change, but it also simplifies this function significantly.

8 years agomaster: Remove unnecessary service listener start
Timo Sirainen [Tue, 17 Jan 2017 17:49:39 +0000 (19:49 +0200)] 
master: Remove unnecessary service listener start

The listening was already started later on in the same function. Also
in some cases it would have been started unnecessarily, like when service
was stopped or more processes were created immediately.

8 years agoindex: don't try to unlink in-memory cache file
Josef 'Jeff' Sipek [Wed, 18 Jan 2017 09:46:15 +0000 (04:46 -0500)] 
index: don't try to unlink in-memory cache file

Avoid these errors:

Error: unlink((in-memory index).cache) failed: No such file or directory (in mail-cache.c:29)

8 years agodoveadm direcor add: Fix checking number as hostname.
Timo Sirainen [Tue, 17 Jan 2017 18:34:51 +0000 (20:34 +0200)] 
doveadm direcor add: Fix checking number as hostname.

521c0460fe705f32ea6899c8b1f101043fe0898c was completely broken.

8 years agodoveconf: Don't read freed memory.
Timo Sirainen [Tue, 17 Jan 2017 18:03:40 +0000 (20:03 +0200)] 
doveconf: Don't read freed memory.

Giving -c parameter frees the returned orig_config_path.

8 years agodoveadm direcor add: Don't accept number as a valid hostname.
Timo Sirainen [Tue, 17 Jan 2017 13:22:44 +0000 (15:22 +0200)] 
doveadm direcor add: Don't accept number as a valid hostname.

This is usually a mistake. For example "doveadm director add -t host 100"
shouldn't be adding a new IP 100 (0.0.0.100)

8 years agostats plugin: Fix /proc/self/io fd leak on plugin deinit
Timo Sirainen [Tue, 17 Jan 2017 14:28:10 +0000 (16:28 +0200)] 
stats plugin: Fix /proc/self/io fd leak on plugin deinit

This could have been a problem with doveadm-server processes if they had
service_count>1, because doveadm unloads all plugins between commands.

8 years agodoveadm: Outgoing dsync TCP connections leaked socket
Timo Sirainen [Tue, 17 Jan 2017 14:23:50 +0000 (16:23 +0200)] 
doveadm: Outgoing dsync TCP connections leaked socket

If doveadm-server was running with service_count>1, each dsync run leaked a
socket.

8 years agolib-dict: Compiler warning fix
Timo Sirainen [Tue, 17 Jan 2017 17:21:08 +0000 (19:21 +0200)] 
lib-dict: Compiler warning fix

8 years agodict-sql: Fix flushing
Aki Tuomi [Mon, 16 Jan 2017 07:37:05 +0000 (09:37 +0200)] 
dict-sql: Fix flushing

Remove flushing from set, and add it to unset. Fixes
signal 11 crash caused by infinite recursion.

8 years agodict-file: Fix potential crash when doing other dict calls during iteration.
Timo Sirainen [Mon, 16 Jan 2017 14:58:31 +0000 (16:58 +0200)] 
dict-file: Fix potential crash when doing other dict calls during iteration.

If file was refreshed, the hash table was cleared, which broke the existing
iterators.

8 years agolib-dict: Add assert to make sure all iterators are deinitialized.
Timo Sirainen [Mon, 16 Jan 2017 15:12:41 +0000 (17:12 +0200)] 
lib-dict: Add assert to make sure all iterators are deinitialized.

8 years agolib: Add asserts to make sure hash table isn't freed while it's frozen.
Timo Sirainen [Mon, 16 Jan 2017 14:57:21 +0000 (16:57 +0200)] 
lib: Add asserts to make sure hash table isn't freed while it's frozen.

8 years agofts-solr: Escape {} chars when sending queries
Timo Sirainen [Mon, 16 Jan 2017 21:55:17 +0000 (23:55 +0200)] 
fts-solr: Escape {} chars when sending queries

Fixes:
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

Based on patch by Michael Welsh Duggan

8 years agolib-http: server: Do not generate a payload for a failure response for a HEAD request.
Stephan Bosch [Tue, 17 Jan 2017 00:37:25 +0000 (01:37 +0100)] 
lib-http: server: Do not generate a payload for a failure response for a HEAD request.

8 years agolib-http: server: Prevent sending response payload when it is not allowed by the...
Stephan Bosch [Tue, 17 Jan 2017 00:36:10 +0000 (01:36 +0100)] 
lib-http: server: Prevent sending response payload when it is not allowed by the specification.

For a HEAD request, the payload is omitted, but the associated headers are generated.
For the other cases, an assert failure is now triggered.

8 years agolib-storage: Add vsize extension to index
Aki Tuomi [Tue, 3 Jan 2017 15:21:33 +0000 (17:21 +0200)] 
lib-storage: Add vsize extension to index

Keep virtual size in index, instead of cache
when it's less than 2^32-1. This helps when
cache becomes corrupted, and goes away, we
still have virtual sizes for quota calculations.

8 years agolib-storage: Fix assert-crash on mailbox_copy/move() failure
Timo Sirainen [Sun, 15 Jan 2017 17:56:32 +0000 (19:56 +0200)] 
lib-storage: Fix assert-crash on mailbox_copy/move() failure

If mailbox_save_cancel() was being called outside mail_storage_copy()
it assert-crashed:

Panic: file mail-storage.c: line 2168 (mailbox_save_context_reset): assertion failed: (ctx->copying_via_save)

8 years agolib: Minor panic message improvement.
Timo Sirainen [Fri, 20 May 2016 10:53:01 +0000 (13:53 +0300)] 
lib: Minor panic message improvement.

8 years agolib-storage: If namespaces weren't successfully created, don't autoexpunge at deinit.
Timo Sirainen [Sat, 14 Jan 2017 14:11:37 +0000 (16:11 +0200)] 
lib-storage: If namespaces weren't successfully created, don't autoexpunge at deinit.

8 years agolib-storage: Add struct mail_user.namespaces_created
Timo Sirainen [Sat, 14 Jan 2017 14:12:56 +0000 (16:12 +0200)] 
lib-storage: Add struct mail_user.namespaces_created

This makes it easier to determine in mail_namespaces_added hook if the
namespaces being added are the initial ones or later ones.

8 years agolib-storage: Stop namespaces_added|created hooks immediately when user has failed
Timo Sirainen [Sat, 14 Jan 2017 14:12:03 +0000 (16:12 +0200)] 
lib-storage: Stop namespaces_added|created hooks immediately when user has failed

8 years agodoveadm dict get: Support printing multiple values.
Timo Sirainen [Sat, 14 Jan 2017 14:10:15 +0000 (16:10 +0200)] 
doveadm dict get: Support printing multiple values.

8 years agodict-sql: Support multiple values for lookups
Timo Sirainen [Mon, 9 Jan 2017 18:32:12 +0000 (20:32 +0200)] 
dict-sql: Support multiple values for lookups

The value's fields must be comma-separated without spaces, for example:

map {
  value_field = field1,field2
  value_type = string,uint
  ...

Only the first field is used for INSERTs and UPDATEs.

8 years agodict-client: Support multiple values for lookups
Timo Sirainen [Thu, 12 Jan 2017 18:35:12 +0000 (20:35 +0200)] 
dict-client: Support multiple values for lookups

8 years agolib-dict: Add support for lookup to return multiple values
Timo Sirainen [Thu, 12 Jan 2017 18:22:38 +0000 (20:22 +0200)] 
lib-dict: Add support for lookup to return multiple values

Implements only the initial stubs to the drivers.

8 years agodict-sql: Remove unnecessary "affected rows" tracking from dict_set()
Timo Sirainen [Sat, 14 Jan 2017 14:54:34 +0000 (16:54 +0200)] 
dict-sql: Remove unnecessary "affected rows" tracking from dict_set()

This was useful for dict_atomic_inc(), but not for dict_set().

Fixes assert-crash with Cassandra:
Panic: file driver-cassandra.c: line 1350 (driver_cassandra_update): assertion failed: (affected_rows == NULL)

8 years agodict-sql: Fix previous "merge sets" to flush at commit
Timo Sirainen [Sat, 14 Jan 2017 14:45:06 +0000 (16:45 +0200)] 
dict-sql: Fix previous "merge sets" to flush at commit

The last dict_set() within transaction was being ignored.

8 years agolib-storage: Fix accessing the same "raw" mailbox multiple times in process.
Timo Sirainen [Sat, 14 Jan 2017 13:10:17 +0000 (15:10 +0200)] 
lib-storage: Fix accessing the same "raw" mailbox multiple times in process.

If the same file was opened as the raw mailbox multiple times, the previous
mail_index was cached by mail-index-alloc-cache. Opening it the second time
already contained a mail in the index, so trying to add another one logged
an error:

Error: Log synchronization error at seq=1,offset=256 for (in-memory index): Append with UID 1, but next_uid = 2

8 years agoimapc: Fix re-sending retryable commands after reconnect
Timo Sirainen [Fri, 13 Jan 2017 18:39:42 +0000 (20:39 +0200)] 
imapc: Fix re-sending retryable commands after reconnect

8 years agolib-dict: Fix compability for 2.2
Aki Tuomi [Fri, 13 Jan 2017 08:10:00 +0000 (10:10 +0200)] 
lib-dict: Fix compability for 2.2

Fixes commit 595b94c8 compability with
2.2.

8 years agolib-storage: Allow namespaces_created hook to return failure via user error.
Timo Sirainen [Thu, 12 Jan 2017 14:20:40 +0000 (16:20 +0200)] 
lib-storage: Allow namespaces_created hook to return failure via user error.

8 years agolib-storage: Improve namespace error message - include separator char.
Timo Sirainen [Wed, 11 Jan 2017 22:53:54 +0000 (00:53 +0200)] 
lib-storage: Improve namespace error message - include separator char.

It wasn't always obvious what the character should have been when
namespace didn't have an explicitly configured separator.

8 years agolib-dict-sql: Try merge sets to single update
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.

8 years agoUpdated copyright notices to include the year 2017.
Stephan Bosch [Wed, 11 Jan 2017 01:51:13 +0000 (02:51 +0100)] 
Updated copyright notices to include the year 2017.

8 years agoglobal: Replaced all instances of memset(p, 0, sizeof(*p)) with the new i_zero()...
Stephan Bosch [Wed, 11 Jan 2017 00:57:46 +0000 (01:57 +0100)] 
global: Replaced all instances of memset(p, 0, sizeof(*p)) with the new i_zero() macro.

Used the following script:

C_FILES=`git ls-files *.c`
H_FILES=`git ls-files *.h`
for F in "$C_FILES $H_FILES"; do
        echo "$F"
  perl -p -i -e 's/safe_memset\(&\(?([^,]*)\)?,\s*0,\s*sizeof\(\g1\)\)/i_zero_safe(&$1)/g' $F
  perl -p -i -e 's/safe_memset\(([^,]*),\s*0,\s*sizeof\(\*\g1\)\)/i_zero_safe($1)/g' $F
  perl -p -i -e 's/memset\(&\(?([^,]*)\)?,\s*0,\s*sizeof\(\g1\)\)/i_zero(&$1)/g' $F
  perl -p -i -e 's/memset\(([^,]*),\s*0,\s*sizeof\(\*\g1\)\)/i_zero($1)/g' $F
done

8 years agoconfigure: Link libsmtp before libdns
Timo Sirainen [Tue, 10 Jan 2017 17:23:30 +0000 (19:23 +0200)] 
configure: Link libsmtp before libdns

Fixes linking LIBDOVECOT when using .a libraries

8 years agolib-settings: Added settings_get_time_msecs()
Timo Sirainen [Fri, 6 May 2016 18:43:04 +0000 (21:43 +0300)] 
lib-settings: Added settings_get_time_msecs()

8 years agolib-storage: Compile & indent fix for previous change.
Timo Sirainen [Tue, 10 Jan 2017 12:45:20 +0000 (14:45 +0200)] 
lib-storage: Compile & indent fix for previous change.

8 years agolib-storage: Prevent recursion in header parsing
Aki Tuomi [Thu, 5 Jan 2017 08:50:55 +0000 (10:50 +0200)] 
lib-storage: Prevent recursion in header parsing

If header parsing error occurs and error handling tries
to get fields, such as Message-ID, it will cause
crash. This fixes problem by preventing reading from
non-cached headers while they are being parsed.

Fixes lmtp: Panic: file ../../../src/lib/array.h: line 219 (array_idx_i):
assertion failed: (idx * array->element_size < array->buffer->used)

8 years agocassandra: Support configuring heartbeat_interval and idle_timeout
Timo Sirainen [Mon, 9 Jan 2017 15:48:56 +0000 (17:48 +0200)] 
cassandra: Support configuring heartbeat_interval and idle_timeout