]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
8 years agolib-http: client: Cleaned up headers and added some more documentation there.
Stephan Bosch [Sat, 16 Apr 2016 00:03:10 +0000 (02:03 +0200)] 
lib-http: client: Cleaned up headers and added some more documentation there.

8 years agolib-http: client: Unlink all queues from peer when it is disconnected.
Stephan Bosch [Thu, 15 Sep 2016 00:09:47 +0000 (02:09 +0200)] 
lib-http: client: Unlink all queues from peer when it is disconnected.

Before, queues were only destroyed when the whole client was destroyed.
This change and subsequent changes prepare for being able to destroy a queue when it becomes unused.

8 years agolib-http: client: Improved logging of connection loss handling in peer.
Stephan Bosch [Wed, 14 Sep 2016 23:59:23 +0000 (01:59 +0200)] 
lib-http: client: Improved logging of connection loss handling in peer.

8 years agolib-http: client: If a peer object is no longer linked to a queue, don't close it...
Stephan Bosch [Wed, 14 Sep 2016 19:37:38 +0000 (21:37 +0200)] 
lib-http: client: If a peer object is no longer linked to a queue, don't close it until all connections are inactive.

The peer object is canceled, rather than closed. Which means that any newly started and idle connections are closed immediately.
Requests may be pending though.
This is only relevant when hosts/queues are removed at some point.
This is a preparational change for having a maximum lifetime on hosts/queues, in which case this becomes a possibility.

8 years agolib-http: client: Added debug messages that indicate when a queue is linked/unlinked...
Stephan Bosch [Tue, 13 Sep 2016 23:37:05 +0000 (01:37 +0200)] 
lib-http: client: Added debug messages that indicate when a queue is linked/unlinked to a peer.

8 years agolib-http: client: Added function that counts how many connections are active within...
Stephan Bosch [Tue, 13 Sep 2016 23:30:16 +0000 (01:30 +0200)] 
lib-http: client: Added function that counts how many connections are active within a peer.

8 years agolib-http: client: Added function that checks whether a connection is currently active.
Stephan Bosch [Tue, 13 Sep 2016 23:26:10 +0000 (01:26 +0200)] 
lib-http: client: Added function that checks whether a connection is currently active.

8 years agolib-http: client: Created http_client_connection_failure() handler.
Stephan Bosch [Sun, 11 Sep 2016 17:34:34 +0000 (19:34 +0200)] 
lib-http: client: Created http_client_connection_failure() handler.

8 years agolib-http: client: Set conn->connect_request to NULL immediately in http_client_connec...
Stephan Bosch [Sun, 11 Sep 2016 17:44:32 +0000 (19:44 +0200)] 
lib-http: client: Set conn->connect_request to NULL immediately in http_client_connection_tunnel_response().

Prevents referring to this completed request in other parts of the code.

8 years agolib-http: client: Improved handling of hosts with explicit IP address.
Stephan Bosch [Sun, 11 Sep 2016 15:46:10 +0000 (17:46 +0200)] 
lib-http: client: Improved handling of hosts with explicit IP address.

8 years agolib-http: Made test-http-client-errors more reliable.
Stephan Bosch [Sun, 11 Sep 2016 12:51:28 +0000 (14:51 +0200)] 
lib-http: Made test-http-client-errors more reliable.

8 years agolib-index: Don't waste 3 bytes of space in struct mail_index_record.
Timo Sirainen [Tue, 1 Nov 2016 10:35:08 +0000 (12:35 +0200)] 
lib-index: Don't waste 3 bytes of space in struct mail_index_record.

It was always supposed to be used mainly for keywords, but it got broken
many years ago and nobody noticed.

8 years agolib-storage: Don't enable modseqs on STATUS_HIGHESTMODSEQ.
Timo Sirainen [Tue, 1 Nov 2016 10:43:03 +0000 (12:43 +0200)] 
lib-storage: Don't enable modseqs on STATUS_HIGHESTMODSEQ.

This is requested always by IMAP's SELECT command even when the IMAP client
hasn't requested it. We don't want to unnecessarily enable modseqs that use up
memory and disk space when they're not really needed. Other callers may also be
interested in asking for HIGHESTMODSEQ (which is nowadays actually always
available) without enabling full modseq tracking.

8 years agolib-storage: Reverse MAIL_SEARCH_ARG_FLAG_USE_TZ handling.
Timo Sirainen [Tue, 1 Nov 2016 13:51:02 +0000 (15:51 +0200)] 
lib-storage: Reverse MAIL_SEARCH_ARG_FLAG_USE_TZ handling.

It was being used the wrong way. SEARCH SENTON/BEFORE/AFTER should have
checked the times within the mail's timezone, not UTC.

8 years agodoveadm director: Fix memory leaks if hostname lookup fails.
Timo Sirainen [Mon, 31 Oct 2016 19:39:44 +0000 (21:39 +0200)] 
doveadm director: Fix memory leaks if hostname lookup fails.

8 years agolib: Fix str_truncate() when string size is already smaller.
Timo Sirainen [Tue, 1 Nov 2016 15:09:27 +0000 (17:09 +0200)] 
lib: Fix str_truncate() when string size is already smaller.

Previous behavior either added extra NULs to the string or assert-crashed.

8 years agolib: Added more unit tests to str_*()
Timo Sirainen [Tue, 3 May 2016 17:17:12 +0000 (20:17 +0300)] 
lib: Added more unit tests to str_*()

8 years agolib: Make str_*() inline which are simple buffer_* wrappers.
Timo Sirainen [Sat, 30 Apr 2016 11:03:32 +0000 (14:03 +0300)] 
lib: Make str_*() inline which are simple buffer_* wrappers.

8 years agoimap/pop3 proxy: If passdb returns proxy_not_trusted, don't send ID/XCLIENT
Timo Sirainen [Fri, 16 Sep 2016 06:53:06 +0000 (09:53 +0300)] 
imap/pop3 proxy: If passdb returns proxy_not_trusted, don't send ID/XCLIENT

This allows using Dovecot proxying feature towards less trusted servers.

8 years agoauth: If passwd-file can't be read, return tempfail (not user unknown).
Timo Sirainen [Mon, 31 Oct 2016 18:19:07 +0000 (20:19 +0200)] 
auth: If passwd-file can't be read, return tempfail (not user unknown).

8 years agoauth: If uidgid_file doesn't exist, fail the userdb lookup.
Timo Sirainen [Mon, 31 Oct 2016 18:06:35 +0000 (20:06 +0200)] 
auth: If uidgid_file doesn't exist, fail the userdb lookup.

8 years agomdbox: Fix assert-crash caused by race condition with multiple doveadm purges.
Timo Sirainen [Fri, 28 Oct 2016 10:26:42 +0000 (13:26 +0300)] 
mdbox: Fix assert-crash caused by race condition with multiple doveadm purges.

This fixes a problem where an email that was just written to a new m.* file gets
expunged and purged by another process.

Fixes:
Panic: file mdbox-map.c: line 1359: unreached

8 years agofs-randomfail: "write" probability was reversed.
Timo Sirainen [Mon, 31 Oct 2016 17:12:14 +0000 (19:12 +0200)] 
fs-randomfail: "write" probability was reversed.

0 meant 100% while 100 meant 0%

8 years agolib-test: Do not init/deinit library twice
Aki Tuomi [Mon, 31 Oct 2016 13:37:00 +0000 (15:37 +0200)] 
lib-test: Do not init/deinit library twice

If lib is initialized, do not initialize
or deinitialize library. This is done to
allow using master_service in unit tests
which also wants to perform lib init
and deinit itself.

8 years agolib: Add function to see if lib is initialized
Aki Tuomi [Mon, 31 Oct 2016 13:36:39 +0000 (15:36 +0200)] 
lib: Add function to see if lib is initialized

This is needed by test-lib to prevent double init/deinit.

8 years agodsync: Fix potential assert on mailbox deinit.
Timo Sirainen [Fri, 28 Oct 2016 16:38:43 +0000 (19:38 +0300)] 
dsync: Fix potential assert on mailbox deinit.

Should have happened only in somewhat rare error conditions that require
resyncing.

Fixes:
Panic: file dsync-brain-mailbox.c: line 358 (dsync_brain_sync_mailbox_deinit): assertion failed: (brain->failed || brain->sync_type == DSYNC_BRAIN_SYNC_TYPE_CHANGED)

8 years agoconfigure: Improve check for OpenSSL without EC support
Paul Howarth [Fri, 28 Oct 2016 14:10:16 +0000 (17:10 +0300)] 
configure: Improve check for OpenSSL without EC support

The original test was for EC_KEY_new but some systems had that and not
EVP_PKEY_CTX_new_id, so the test was switched to that function.
However, Fedora releases 12 through 17 have EVP_PKEY_CTX_new_id but
not EC_KEY_new. So we need to test for both functions before enabling
the dcrypt build.

8 years agoauth: Fix crash when exporting passdb fields to auth-worker that have NULL values
Timo Sirainen [Fri, 28 Oct 2016 08:54:27 +0000 (11:54 +0300)] 
auth: Fix crash when exporting passdb fields to auth-worker that have NULL values

8 years agolib-compression: Fixed fd leak in unit test
Timo Sirainen [Thu, 27 Oct 2016 10:20:03 +0000 (13:20 +0300)] 
lib-compression: Fixed fd leak in unit test

8 years agolib-auth: Minor debug logging improvement.
Timo Sirainen [Thu, 27 Oct 2016 08:19:50 +0000 (11:19 +0300)] 
lib-auth: Minor debug logging improvement.

Include "PASS" or "USER" in the prefix to make it clear what the reply is
for.

8 years agolib-program-client: Fix building with compilers that have no typeof()
Timo Sirainen [Fri, 28 Oct 2016 14:00:13 +0000 (17:00 +0300)] 
lib-program-client: Fix building with compilers that have no typeof()

8 years agoauth: Remove i_assert for credentials scheme
Aki Tuomi [Fri, 15 Jul 2016 08:31:25 +0000 (11:31 +0300)] 
auth: Remove i_assert for credentials scheme

8 years agodoveadm: fix compile warning in doveadm-dump-index
Martti Rannanjärvi [Thu, 27 Oct 2016 00:58:21 +0000 (03:58 +0300)] 
doveadm: fix compile warning in doveadm-dump-index

8 years agodirector: Fix shutdown_clients=no to not break
Timo Sirainen [Fri, 21 Oct 2016 11:34:47 +0000 (14:34 +0300)] 
director: Fix shutdown_clients=no to not break

The director process must shut down even with with shutdown_clients=no.
Otherwise the two director processes will try to keep competing with each
others and log errors like:

director: Warning: Director 10.0.0.123:9090/right disconnected us with reason: Replacing with new incoming connection
director: Warning: Director 10.0.0.123:9090/right disconnected us with reason: Replacing with 10.0.0.124:9090

8 years agoimap-hibernate: Fix "DONE" handling.
Timo Sirainen [Thu, 20 Oct 2016 21:25:20 +0000 (00:25 +0300)] 
imap-hibernate: Fix "DONE" handling.

1. If only "DONE\r\n" was sent, it randomly failed with BAD because of
out-of-bounds buffer read.

2. If "DONE\r\n" was followed by a command tag but no space afterwards, we
kept waiting for the input to continue. But since the DONE was already sent,
we should break the IDLE already at that point without any further waiting.

8 years agodoveadm dump: Dump mailbox names in mailbox.list.index's header.
Timo Sirainen [Wed, 26 Oct 2016 20:20:17 +0000 (23:20 +0300)] 
doveadm dump: Dump mailbox names in mailbox.list.index's header.

8 years ago*-login: Removed enforcing maximum calculated fd limit.
Timo Sirainen [Wed, 26 Oct 2016 15:06:36 +0000 (18:06 +0300)] 
*-login: Removed enforcing maximum calculated fd limit.

Just use the regular ulimit. Login process has become complicated enough
that counting the exact fd size isn't so easy anymore.

Also apparently this low fd limit is causing errors with new Linux kernels:
pop3-login: Error: fd_send(pop3, 18) failed: Too many references: cannot splice

8 years agoCompiler warning fixes with -Wstrict-bool
Timo Sirainen [Wed, 26 Oct 2016 15:05:32 +0000 (18:05 +0300)] 
Compiler warning fixes with -Wstrict-bool

8 years agolib: Fixed net_str2port*() comments
Timo Sirainen [Wed, 26 Oct 2016 11:58:56 +0000 (14:58 +0300)] 
lib: Fixed net_str2port*() comments

8 years agodoveadm fs get: Use pager formatter by default to avoid extra LF at the end.
Timo Sirainen [Tue, 25 Oct 2016 17:52:16 +0000 (20:52 +0300)] 
doveadm fs get: Use pager formatter by default to avoid extra LF at the end.

8 years agodoveadm: Code cleanup - add and use DOVEADM_PRINT_TYPE_PAGER macro
Timo Sirainen [Tue, 25 Oct 2016 17:54:17 +0000 (20:54 +0300)] 
doveadm: Code cleanup - add and use DOVEADM_PRINT_TYPE_PAGER macro

8 years agodoveadm: "pager" formatter supports now DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE
Timo Sirainen [Tue, 25 Oct 2016 17:51:36 +0000 (20:51 +0300)] 
doveadm: "pager" formatter supports now DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE

8 years agodoveadm: \f\n only between pages in pager
Martti Rannanjärvi [Thu, 21 Apr 2016 11:22:10 +0000 (14:22 +0300)] 
doveadm: \f\n only between pages in pager

No more \f\n in the end.

8 years agodirector: Avoid assert-crash at deinit if user moves are still being added.
Timo Sirainen [Tue, 25 Oct 2016 19:39:38 +0000 (22:39 +0300)] 
director: Avoid assert-crash at deinit if user moves are still being added.

Fixes:
Panic: file user-directory.c: line 312 (user_directory_deinit): assertion failed: (array_count(&dir->iters) == 0)

8 years agodirector: Send user's old and new backend IPs to flush script.
Timo Sirainen [Tue, 25 Oct 2016 19:17:23 +0000 (22:17 +0300)] 
director: Send user's old and new backend IPs to flush script.

If user was created due to the user-move, don't execute the flush script
since it wouldn't really have any work to do anyway.

8 years agodirector: User move - Don't try to kick user's connections if user wasn't even known.
Timo Sirainen [Tue, 25 Oct 2016 19:12:01 +0000 (22:12 +0300)] 
director: User move - Don't try to kick user's connections if user wasn't even known.

8 years agodirector: Code cleanup - moved user kill startup to its own function.
Timo Sirainen [Tue, 25 Oct 2016 19:06:02 +0000 (22:06 +0300)] 
director: Code cleanup - moved user kill startup to its own function.

No functional changes.

8 years agodirector: Code cleanup - global director is no longer needed.
Timo Sirainen [Tue, 25 Oct 2016 18:47:01 +0000 (21:47 +0300)] 
director: Code cleanup - global director is no longer needed.

8 years agodirector: Moved all user killing state to struct director_kill_context
Timo Sirainen [Sun, 16 Oct 2016 22:07:50 +0000 (01:07 +0300)] 
director: Moved all user killing state to struct director_kill_context

This should make it a bit easier to understand the life time of user
killing. It also simplifies code by removing struct
director_user_kill_finish_ctx.

Finally, this already reduces memory usage with 32bit systems, and would
make it possible to reduce also on 64bit systems if timestamp is shrank to
31 bits and weak bit moved after it. I'm not sure if that would be better
for performance though. In any case it would provide free space for 4 extra
bytes if that were needed in future.

8 years agodirector: Code cleanup - rename director_kill_context.self to kill_is_self_initiated
Timo Sirainen [Tue, 25 Oct 2016 18:41:16 +0000 (21:41 +0300)] 
director: Code cleanup - rename director_kill_context.self to kill_is_self_initiated

8 years agodirector: Code cleanup - added USER_IS_BEING_KILLED() macro
Timo Sirainen [Thu, 20 Oct 2016 13:46:31 +0000 (16:46 +0300)] 
director: Code cleanup - added USER_IS_BEING_KILLED() macro

8 years agodirector: Code cleanup - move enum user_kill_state to director.h
Timo Sirainen [Thu, 20 Oct 2016 13:41:23 +0000 (16:41 +0300)] 
director: Code cleanup - move enum user_kill_state to director.h

This will be needed by following commits

8 years agodirector: Fix HOST-RESET-USERS with host parameter.
Timo Sirainen [Tue, 25 Oct 2016 18:20:54 +0000 (21:20 +0300)] 
director: Fix HOST-RESET-USERS with host parameter.

The logic was reversed: It should flush the specified host, not some other
host. Broken by 11ee3b40320a31669bd717fecbe1e332dad4fd84

8 years agodoveadm director dump: Fixed output to include LFs
Timo Sirainen [Mon, 24 Oct 2016 22:03:05 +0000 (01:03 +0300)] 
doveadm director dump: Fixed output to include LFs

Otherwise all the output will be mixed up in the same line.

8 years agodirector: Execute director_flush_socket only from one director.
Timo Sirainen [Mon, 24 Oct 2016 21:48:08 +0000 (00:48 +0300)] 
director: Execute director_flush_socket only from one director.

Having each director do it would be redundant since they're all supposed to
be performing the same flush task to the same backend.

8 years agodirector: Improve debug logging output.
Timo Sirainen [Mon, 24 Oct 2016 21:32:59 +0000 (00:32 +0300)] 
director: Improve debug logging output.

8 years agodirector: Fix user move hangs when another move is triggered early.
Timo Sirainen [Mon, 24 Oct 2016 21:25:38 +0000 (00:25 +0300)] 
director: Fix user move hangs when another move is triggered early.

Running "doveadm director flush" before the previous flush hadn't fully
finished could have caused users to hang until their move timeout:

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

8 years agodirector: Prevent race conditions by adding USER_KILL_STATE_FLUSHING
Timo Sirainen [Mon, 24 Oct 2016 21:22:20 +0000 (00:22 +0300)] 
director: Prevent race conditions by adding USER_KILL_STATE_FLUSHING

In theory it's possible that a user is freed during a flush and added back
before flush is finished, possibly even being moved again. This check makes
sure that we don't finish such move unless we're actually at the correct
flushing state. (If there's another flush also running for the user it'll
be ignored.)

This is also useful for logging purposes.

8 years agodirector: If user host conflict is detected, make sure new host is sent back.
Timo Sirainen [Mon, 24 Oct 2016 21:13:23 +0000 (00:13 +0300)] 
director: If user host conflict is detected, make sure new host is sent back.

USER-KICK-HASH was sent, but the sender didn't get back a USER reply with
the new host. This could have increased how long user's host differred in
directors.

Avoids repeating this error:
Error: User hash 2957018085 is being redirected to two hosts: 10.0.0.30 and 10.0.0.201 (old_ts=1477338836)

8 years agodoveadm director flush: Added --max-parallel parameter.
Timo Sirainen [Mon, 24 Oct 2016 19:42:43 +0000 (22:42 +0300)] 
doveadm director flush: Added --max-parallel parameter.

8 years agodirector: HOST-RESET-USERS moves users more slowly now.
Timo Sirainen [Mon, 24 Oct 2016 19:41:25 +0000 (22:41 +0300)] 
director: HOST-RESET-USERS moves users more slowly now.

By default only 100 users can be moved in parallel. This can be overridden
with HOST-RESET-USERS parameter.

This delaying is especially useful when director_flush_socket is used to
avoid huge floods to the script service. Even without the socket it's still
good for avoiding unnecessary load spikes when all users are kicked at once
and they reconnect back at the same time.

8 years agodirector: If user move times out, log the state it was in at the time.
Timo Sirainen [Mon, 24 Oct 2016 21:11:50 +0000 (00:11 +0300)] 
director: If user move times out, log the state it was in at the time.

8 years agodirector: Log user's kill_state with a human-readable string.
Timo Sirainen [Mon, 24 Oct 2016 19:39:56 +0000 (22:39 +0300)] 
director: Log user's kill_state with a human-readable string.

8 years agodoveadm director: Invalid parameters cause doveadm to fail silently.
Timo Sirainen [Mon, 24 Oct 2016 19:27:30 +0000 (22:27 +0300)] 
doveadm director: Invalid parameters cause doveadm to fail silently.

doveadm_cmd_context.cmd doesn't point directly to doveadm_cmd_director.

8 years agodirector: Fix sending up/down state in handshakes.
Timo Sirainen [Mon, 24 Oct 2016 19:22:28 +0000 (22:22 +0300)] 
director: Fix sending up/down state in handshakes.

They were never sent, because HOSTs were sent before director had waited for
the remote to send its version number. So sender thought that the remote's
minor_version was too old and it didn't send the up/down state at all.

This caused errors like:

Warning: director(10.0.0.30:9090/left): Host 10.0.0.30 is being updated before previous update had finished (up -> down) - setting to state=down vhosts=100
Error: director(10.0.0.30:9090/left): Director 10.0.0.30 SYNC request hosts don't match us - resending hosts (seq=6, remote hosts_hash=262126213, my hosts_hash=2458934259)

8 years agodirector: If SYNCs are received during handshake, send them later.
Timo Sirainen [Mon, 24 Oct 2016 18:58:03 +0000 (21:58 +0300)] 
director: If SYNCs are received during handshake, send them later.

This fixes delays during handshake:
Error: Ring SYNC appears to have got lost, resending

8 years agodirector: Code cleanup - Give tab-unescaped args to all doveadm command handlers.
Timo Sirainen [Mon, 24 Oct 2016 17:21:36 +0000 (20:21 +0300)] 
director: Code cleanup - Give tab-unescaped args to all doveadm command handlers.

8 years agodirector: USER-MOVE didn't handle non-hash username correctly.
Timo Sirainen [Mon, 24 Oct 2016 17:20:09 +0000 (20:20 +0300)] 
director: USER-MOVE didn't handle non-hash username correctly.

The entire command line was being hashed instead of just the username.

8 years agodirector: Make sure IP address parsing works in DIRECTOR-ADD/REMOVE
Timo Sirainen [Mon, 24 Oct 2016 17:16:57 +0000 (20:16 +0300)] 
director: Make sure IP address parsing works in DIRECTOR-ADD/REMOVE

We were passing the entire string through to net_addr2ip(). It seems that
inet_aton() stops at whitespace though, so this wasn't actually causing
errors at least on Linux.

8 years agodirector: Code cleanup - moved command handling to its own function.
Timo Sirainen [Mon, 24 Oct 2016 17:08:54 +0000 (20:08 +0300)] 
director: Code cleanup - moved command handling to its own function.

8 years agodirector: Show in process title how many users are being moved.
Timo Sirainen [Mon, 24 Oct 2016 17:07:26 +0000 (20:07 +0300)] 
director: Show in process title how many users are being moved.

8 years agodirector: Code cleanup - Finish user move always in the same function.
Timo Sirainen [Mon, 24 Oct 2016 17:00:40 +0000 (20:00 +0300)] 
director: Code cleanup - Finish user move always in the same function.

8 years agodirector: Call state_change_callback on user move timeout.
Timo Sirainen [Mon, 24 Oct 2016 16:59:54 +0000 (19:59 +0300)] 
director: Call state_change_callback on user move timeout.

8 years agodirector: Code cleanup - allow commands handlers to stop processing input
Timo Sirainen [Fri, 21 Oct 2016 09:50:56 +0000 (12:50 +0300)] 
director: Code cleanup - allow commands handlers to stop processing input

Now returning 0 exits the input reading without disconnecting client.

8 years agolib-mail: Add tests for dec/hexdec encoded entities
Aki Tuomi [Tue, 25 Oct 2016 10:27:29 +0000 (13:27 +0300)] 
lib-mail: Add tests for dec/hexdec encoded entities

8 years agolib-mail: Support decimal/hexadecimal encoded entities
Aki Tuomi [Tue, 25 Oct 2016 09:48:23 +0000 (12:48 +0300)] 
lib-mail: Support decimal/hexadecimal encoded entities

Add support for &#nnn; and &#xnnn; entities.

8 years agoimap-login: Skip NIL value in ID handler
Aki Tuomi [Tue, 25 Oct 2016 07:29:50 +0000 (10:29 +0300)] 
imap-login: Skip NIL value in ID handler

NIL value can cause hard crash, depending what
the key is. For x-proxy-ttl, NIL will crash
on any system, x-originating-ip will crash on
some nss versions (e.g. centos 6.7).

Migitating factor here is that the NIL value is only
accepted from trusted network.

8 years agolib-compression: Added unit tests for reading .gz files
Timo Sirainen [Mon, 24 Oct 2016 15:52:24 +0000 (18:52 +0300)] 
lib-compression: Added unit tests for reading .gz files

8 years agolib-compression: Added file uncompression support for test-compression
Timo Sirainen [Mon, 24 Oct 2016 15:31:53 +0000 (18:31 +0300)] 
lib-compression: Added file uncompression support for test-compression

This can be useful for debugging.

8 years agolib-compress: Don't assume too early that gz file continues after a trailer.
Timo Sirainen [Mon, 24 Oct 2016 15:29:06 +0000 (18:29 +0300)] 
lib-compress: Don't assume too early that gz file continues after a trailer.

Some istreams don't have EOF immediately set after the gz trailer. This
fixes errors like "missing gz trailer at 1675"

8 years agodoveadm: Rewind input early enough
Aki Tuomi [Fri, 21 Oct 2016 10:55:42 +0000 (13:55 +0300)] 
doveadm: Rewind input early enough

Command input needs to be rewinded earlier
in doveadm_mail_next_user.

8 years agoistream-zlib: "missing gz trailer" error message was wrong.
Timo Sirainen [Mon, 24 Oct 2016 14:15:00 +0000 (17:15 +0300)] 
istream-zlib: "missing gz trailer" error message was wrong.

8 years agolib: With FILE_LOCK_SLOW_WARNING_MSECS log a warning also when keeping lock for long.
Timo Sirainen [Mon, 24 Oct 2016 12:59:07 +0000 (15:59 +0300)] 
lib: With FILE_LOCK_SLOW_WARNING_MSECS log a warning also when keeping lock for long.

This can help catching which process kept the lock for too long.

8 years agoconfigure: Fixed checking if OpenSSL is too old for lib-dcrypt
Timo Sirainen [Mon, 24 Oct 2016 13:57:49 +0000 (16:57 +0300)] 
configure: Fixed checking if OpenSSL is too old for lib-dcrypt

EVP_PKEY_CTX_set_ec_paramgen_curve_nid() is a macro, so it can't be checked
with AC_CHECK_LIB().

8 years agolib: Fix compiler warnings in test-ioloop
Timo Sirainen [Mon, 24 Oct 2016 13:05:00 +0000 (16:05 +0300)] 
lib: Fix compiler warnings in test-ioloop

Fixes:
test-ioloop.c:72: error: ignoring return value of ‘write’, declared with attribute warn_unused_result

8 years agolib-http: Add ioloop and lock wait information to timeout messages.
Timo Sirainen [Mon, 24 Oct 2016 10:08:47 +0000 (13:08 +0300)] 
lib-http: Add ioloop and lock wait information to timeout messages.

It'll now log for example:
9007 Request timed out (Request sent 7.087 secs ago, 0.076 in other ioloops, 7.012 in locks, connected 7.087 secs ago)

Which points out that the problem wasn't really with the HTTP, but with
locking. This likely should be fixed in some way also in lib-http so that
it gives a bit of extra time for reading the request, but that's a separate
fix.

8 years agodict-client: Fix logging how much time was spent in other ioloops in slow lookup...
Timo Sirainen [Mon, 24 Oct 2016 09:17:44 +0000 (12:17 +0300)] 
dict-client: Fix logging how much time was spent in other ioloops in slow lookup warnings.

The warning's idea is to show why the lookup could have been slow. We
differentiate between time spent in dict_wait() waiting only for the
dict result and time spent in other ioloops waiting for potentially other
things as well (and time spent waiting for locks during this time).

The previous code didn't work right when multiple ioloops were used, which
happened sometimes.

Also changed %u to %d just in case some calculation is wrong. It's nicer to
get a slightly negative value rather than a huge positive one.

8 years agolib: Added ioloop_global_wait_usecs
Timo Sirainen [Mon, 24 Oct 2016 09:16:48 +0000 (12:16 +0300)] 
lib: Added ioloop_global_wait_usecs

This is helpful when multiple ioloops aren't used and
io_loop_get_wait_usecs() can't be easily used for all of them.

8 years agolib: Add FILE_LOCK_SLOW_WARNING_MSECS environment.
Timo Sirainen [Mon, 24 Oct 2016 11:05:58 +0000 (14:05 +0300)] 
lib: Add FILE_LOCK_SLOW_WARNING_MSECS environment.

Log a warning if any locking takes longer than the specified number of
milliseconds. This can be enabled globally with:

import_environment = $import_environment FILE_LOCK_SLOW_WARNING_MSECS=1000

8 years agolib-index: Fix potential error when reading from uncommitted cache transaction
Timo Sirainen [Mon, 24 Oct 2016 10:28:44 +0000 (13:28 +0300)] 
lib-index: Fix potential error when reading from uncommitted cache transaction

If dovecot.index.cache is compressed during the transaction, the new cache
fields mapping doesn't necessarily match what is in the transaction.

Fixes:
Error: Corrupted index cache file .../dovecot.index.cache: field index too large (27 >= 17)

Although there may be other cache corruption errors it also fixes.

8 years agolib-index: Fix potential assert-crash when reading cache
Timo Sirainen [Mon, 24 Oct 2016 09:25:48 +0000 (12:25 +0300)] 
lib-index: Fix potential assert-crash when reading cache

Fixes:
Panic: file mail-cache-lookup.c: line 258 (mail_cache_lookup_iter_next): assertion failed: (ctx->offset != 0)

Broken by d33fc6c584718efd46159e1d8f46488b9dfc66f5

8 years agomaster: If chrooted service's core wasn't dumped, suggest to unset the chroot.
Timo Sirainen [Mon, 24 Oct 2016 09:23:49 +0000 (12:23 +0300)] 
master: If chrooted service's core wasn't dumped, suggest to unset the chroot.

8 years agolib: Add test for ioloop fd polling
Aki Tuomi [Mon, 24 Oct 2016 08:34:05 +0000 (11:34 +0300)] 
lib: Add test for ioloop fd polling

8 years agolib: Fix kqueue io_loop_get_wait_time usage
Aki Tuomi [Mon, 24 Oct 2016 07:13:42 +0000 (10:13 +0300)] 
lib: Fix kqueue io_loop_get_wait_time usage

The code needs to take into consideration,
when there is no IO to be waited, but possibly
there is io_set_pending used, or just timeouts.

8 years agolib: Ensure tv_r gets set in io_loop_get_wait_time
Aki Tuomi [Mon, 24 Oct 2016 07:08:42 +0000 (10:08 +0300)] 
lib: Ensure tv_r gets set in io_loop_get_wait_time

If this does not get reset here to 0 it can cause
errors or unpredictable behaviour in select/kqueue
polling, such as very long delays.

8 years agodirector: Fix crash handling director_flush_socket when user is freed.
Timo Sirainen [Sat, 22 Oct 2016 19:45:48 +0000 (22:45 +0300)] 
director: Fix crash handling director_flush_socket when user is freed.

8 years agodirector: Support flush socket
Aki Tuomi [Thu, 13 Oct 2016 13:11:48 +0000 (16:11 +0300)] 
director: Support flush socket

This allows specifying an URI to execute
on user kill. It can be of form
exec:/path/to/bin, unix:/path/to/socket or
tcp:ip:port

The location is sent FLUSH username-hash
per killed user. You can execute some
action there, and you are expected to
return '+\nOK\n' as reply once you are
done.

9 years agoconfigure: Improved checking if OpenSSL is too old for lib-dcrypt
Timo Sirainen [Sat, 22 Oct 2016 09:58:40 +0000 (12:58 +0300)] 
configure: Improved checking if OpenSSL is too old for lib-dcrypt

Some OpenSSL versions had EC_KEY_new, but not other needed functions.

9 years agolib-program-client: Add URI based constructor
Aki Tuomi [Fri, 21 Oct 2016 11:34:51 +0000 (14:34 +0300)] 
lib-program-client: Add URI based constructor

9 years agodovecot.m4: Added DOVECOT_BINARY_LDFLAGS for future compatibility
Timo Sirainen [Thu, 20 Oct 2016 19:59:10 +0000 (22:59 +0300)] 
dovecot.m4: Added DOVECOT_BINARY_LDFLAGS for future compatibility

Mainly to keep the serial number the same in v2.2 and v2.3 tree.