Timo Sirainen [Sun, 5 Nov 2017 21:11:25 +0000 (23:11 +0200)]
director: Fix off-by-one when checking if user weakness is stuck
When the weakness was exactly at the second, the weakness wasn't detected
and the next expiration timeout was removed entirely. This shouldn't have
caused any bigger problems, because another user lookup on the following
second would have then detected the weakness, removed the user and restored
the next expiration timeout.
Timo Sirainen [Thu, 26 Oct 2017 10:56:25 +0000 (13:56 +0300)]
director: Show each director connection in doveadm DIRECTOR-LIST
Previously the host was shown only once, regardless of how many connections
it had. This especially helps when there are just two directors, but also
can be useful when showing incoming/outgoing connections that are still
in handshaking phase.
Timo Sirainen [Thu, 26 Oct 2017 10:02:32 +0000 (13:02 +0300)]
director: Fix updating director connection's last_output timestamp
It was previously updated only in ostream's flush callback, which was called
only when there were a lot of output. This only caused the "last output"
timestamp in disconnection log lines to be wrong.
Timo Sirainen [Wed, 25 Oct 2017 14:18:03 +0000 (17:18 +0300)]
director: Add director_output_buffer_size setting
This allows configuring the max buffer size for outgoing connections.
Previously it was hardcoded to 10 MB, which wasn't necessarily enough for
very busy directors.
Bill Cole [Tue, 10 Oct 2017 21:40:04 +0000 (17:40 -0400)]
Added "ULL" to the hex literals that needed it.
On 32-bit platforms with older compilers (e.g. gcc 4.2 on MacOS 10.6
running on a 1st-gen Core Duo) a 'long' is 4 bytes and the compiler does
not automatically use a 'long long' when needed, but instead generates
an error. e.g.:
libtool: compile: /usr/bin/g++-4.2 -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib -I../../../src/lib-mail -I../../../src/lib-index -I../../../src/lib-storage -I../../../src/plugins/fts -I../../../src/doveadm -I/opt/local/include/openssl -I/opt/local/include -I/opt/local/include/CLucene/ext -pipe -Os -arch i386 -D__STDC_LIMIT_MACROS -MT lucene-wrapper.lo -MD -MP -MF .deps/lucene-wrapper.Tpo -c lucene-wrapper.cc -fno-common -DPIC -o .libs/lucene-wrapper.o
In file included from ../../../src/lib/lib.h:33,
from lucene-wrapper.cc:4:
../../../src/lib/byteorder.h:94: error: integer constant is too large for ‘long’ type
../../../src/lib/byteorder.h:95: error: integer constant is too large for ‘long’ type
../../../src/lib/byteorder.h:96: error: integer constant is too large for ‘long’ type
../../../src/lib/byteorder.h:97: error: integer constant is too large for ‘long’ type
make[4]: *** [lucene-wrapper.lo] Error 1
Adding the 'ULL' to the end of the 16-digit hex literals that are used
to test the structure of 64-bit integers fixes this and avoids any
problem which could arise from the compiler using a 32-bit type for
those literals that could fit in 32 bites.
Timo Sirainen [Mon, 16 Oct 2017 11:49:56 +0000 (14:49 +0300)]
cassandra: Fix using bigint types with unprepared statements
This reverts the code to not using the statements with binding at all.
Alternative fix would be to start using explicit int32 or int64 parameter
types, but that breaks backwards compatibility a bit.
Timo Sirainen [Mon, 11 Sep 2017 10:48:17 +0000 (13:48 +0300)]
lib-storage: Make sure mailbox list notification flush sees latest changes.
This is mainly useful with imaptest test scripts to make sure they're seeing
the changes done by the other session, without assuming that inotify will
always notify about the change before NOOP is run (it doesn't).
Do this only if mailbox_idle_check_interval>0, so it's not run when periodic
stat()s are wanted to be avoided.
Timo Sirainen [Mon, 9 Oct 2017 10:19:32 +0000 (13:19 +0300)]
lib: ostream-multiplex - set ostream_private.parent
Unlike with istream-multiplex, there are no issues with I/Os. Only the
parent stream will have the I/O. Using the default parent adds the
missing methods that otherwise would have needed to be implemented:
- cork
- flush_pending
- switch_ioloop
Timo Sirainen [Mon, 9 Oct 2017 10:14:23 +0000 (13:14 +0300)]
lib: istream-multiplex - Forward i_stream_switch_ioloop() to parent
Most istreams do this because istream_private.parent is set to the parent
stream, but this can't be done with istream-multiplex. The main problem
with attempting to do the same with istream-multiplex is that the different
channels don't share the same I/O. Just because one channel received data
doesn't mean that other channels received any data. (It would be possible
to solve this by implementing a new method that allows overriding
i_stream_set_io(), but I'm not sure if that's a good idea either.)
Timo Sirainen [Fri, 6 Oct 2017 13:55:28 +0000 (16:55 +0300)]
acl: Fix checking create (k) permission in global acl-file
Just because the global ACL file hasn't changed since it was last refreshed
for another ACL object, it doesn't mean that those ACLs don't need to be
applied to this ACL object.
This didn't usually cause problems, because the initial ACL object refresh
was always done due to local-path refresh returning "needs a refresh".
The only exception was when acl_object_init_from_parent() was called,
because it added an empty non-NULL validity for the local-path, so the
"needs a refresh" wasn't returned. This happened only when trying to
CREATE or RENAME mailbox under a parent where user didn't have create
permissions.
This affected only when using a single global acl-file, not when using
global acl directory containing per-mailbox files.
Timo Sirainen [Thu, 5 Oct 2017 08:46:55 +0000 (11:46 +0300)]
director: Don't crash if DIRECTOR-REMOVE is received for itself
This triggers the director removal from the ring, which causes the
connection to be destroyed. But since we're still in the middle of handling
the connection it needs refcounting.
Timo Sirainen [Thu, 14 Sep 2017 14:57:29 +0000 (17:57 +0300)]
director: After CONNECT was received, make sure we disconnect
The remote side won't be reading anything after the CONNECT, so we have to
disconnect anyway. If we decide that the CONNECT request is wrong, reconnect
after a short delay and hope that the remote agrees with us the next time.
Timo Sirainen [Thu, 14 Sep 2017 14:38:24 +0000 (17:38 +0300)]
director: Don't reset directors' last_network_failure while handshaking
The reset is done mainly to make it faster for a director that has been down
to connect back to the ring, without other directors still thinking that
it's down. But DIRECTOR that is sent during handshake says nothing about
whether the director is up at the moment or not.
Timo Sirainen [Tue, 3 Oct 2017 11:51:16 +0000 (14:51 +0300)]
lib-master: master_service_init_log() - Switch log handlers only on the first call
The secondary calls were only done by mail_storage_service_*() calls. They
want to initialize the logging once, but afterwards they only care about
changing the log prefix. Switch to this behavior now explicitly.
This fixes behavior if logging functions are changed between
mail_storage_service_*() calls, so they don't get reset.
Timo Sirainen [Wed, 4 Oct 2017 12:41:03 +0000 (15:41 +0300)]
director: Fix HOST-RESET-USERS when all hosts are down
If there were a lot of users being kicked, the host was flushed after the
initial round of user kills. This caused the rest of the user connections to
be just discarded instead of actually being killed.
Timo Sirainen [Wed, 4 Oct 2017 12:39:08 +0000 (15:39 +0300)]
director: Fix tracking user move count when user is freed early
users_moving_count wasn't updated if the user was freed before killing it
finished. This caused "doveadm director flush" to hang while waiting for
the move count to drop to 0, which it never did. Also following flushes
were doing less work in parallel, or possibly even nothing since director
thought there were too many users already being moved.