lib: Fix hang in safe_sendfile on SmartOS
The call to sendfile on SmartOS can fail with EOPNOTSUPP. This is a valid
error code and documented in the man page. This error code needs to be
handled or else dovecot will retry the sendfile call endlessly and hang.
Timo Sirainen [Mon, 7 Sep 2015 19:14:18 +0000 (22:14 +0300)]
imap: Fixed assert-crash in NOTIFY when using multiple namespaces.
I'm not sure why the original code was trying to add it to multiple
namespaces. A single mailbox name should be matching only a single
namespace (visible one at least). In any case we can't use
mail_namespace_find() with only partial namespaces-list, because it'll
assert-crash if it can't find a namespace for the mailbox.
Timo Sirainen [Mon, 7 Sep 2015 17:24:25 +0000 (20:24 +0300)]
director: Added director_user_kick_delay setting.
This replaces the hardcoded 2 seconds delay. This setting specifies how long
to wait for after user has been kicked from all directors before letting the
user login to the new server. This timeout should be large enough that the
user's existing processes in the old backend should be finished.
Timo Sirainen [Mon, 7 Sep 2015 15:50:24 +0000 (18:50 +0300)]
login proxy: Added delayed disconnection of clients on server mass-disconnect.
login_proxy_max_disconnect_delay setting (default 0 = disabled) controls for
how long time period the disconnections are spread to. The idea behind this
is to avoid load spikes due to client reconnections when a backend server
dies or is restarted.
Timo Sirainen [Mon, 7 Sep 2015 13:23:40 +0000 (16:23 +0300)]
lib-storage: Allow MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT to use get=NULL
This is useful for registering internal attributes whose only purpose is to
be able to set/get them via dict. (Because normally the dict access would be
denied completely.)
Timo Sirainen [Mon, 7 Sep 2015 13:22:11 +0000 (16:22 +0300)]
lib-storage: Allow set/get for Dovecot-private attributes via internal attributes.
This allows registering attributes with MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT
prefix and having them be get/set via dict, instead of failing them.
Timo Sirainen [Mon, 7 Sep 2015 13:38:24 +0000 (16:38 +0300)]
lib-storage: Added MAIL_ATTRIBUTE_INTERNAL_FLAG_CHILDREN
This also adds the key to get() and set() functions, so they can know
exactly what key is wanted to be accessed.
Timo Sirainen [Mon, 7 Sep 2015 11:08:52 +0000 (14:08 +0300)]
auth: Fixed passdb skip_password_check / result_success=continue-fail handling
If passdb returned success, but result_success=continue-fail, it means that
the authentication didn't succeed. So we still want to check the password
again and in general treat the request as unauthenticated (especially for
the passdb { skip } setting).
So the current logic means that there are 2 ways for the request to be
treated as authenticated and skipping any password checking:
1) passdb lookup succeeding, with result_success=continue, continue-ok,
return or return-ok
2) passdb lookup not succeeding, with result_failure=continue-ok or
return-ok
It's a bit questionable though if 2) should be allowed.
Timo Sirainen [Thu, 3 Sep 2015 18:37:09 +0000 (21:37 +0300)]
cassandra: Handle async queries internally - don't use sql pooling code.
There's no need to create multiple Cassandra instances, since the single
instance is capable of doing multiple asynchronous requests in parallel.
Timo Sirainen [Thu, 3 Sep 2015 17:55:18 +0000 (20:55 +0300)]
lib-storage: Another fix to using index_storage_mailbox_close() without an opened view.
Calling mail_index_close() without mail_index_open() caused it to
assert-crash.
Timo Sirainen [Thu, 3 Sep 2015 11:10:36 +0000 (14:10 +0300)]
Removed SET_IN_PORT_ZERO - SET_IN_PORT now always allows zeros as well.
A zero in all the port settings means that the port is disabled, which is
also the default. So it shouldn't be an error to explicitly set it to zero
in the config file.
Phil Carmody [Thu, 3 Sep 2015 11:01:57 +0000 (14:01 +0300)]
lib: strnum - simplify hex and oct overflow code
uintmax_t is defined to have modulo-2^n semantics, and therefore the bottom
bits of (uintmax_t) are guaranteed to be all set. Therefore the checking of
the next character read is unnecessary, as it's already done in the loop
control statement itself. (This is not true about the bottom digit base 10,
which is why the check remains in the decimal case)
Timo Sirainen [Wed, 2 Sep 2015 14:36:47 +0000 (17:36 +0300)]
dict: Use the new async APIs for everything.
If the dict backend supports async operations, this means that dict service
can now be configured with client_count>1.
Timo Sirainen [Wed, 2 Sep 2015 14:20:02 +0000 (17:20 +0300)]
lib-sql: Mark Cassandra driver as pooled.
Otherwise all the asynchronous operations will assert-crash, since all the
auto-connecting code is in the sqlpool code.
Timo Sirainen [Wed, 2 Sep 2015 14:19:08 +0000 (17:19 +0300)]
lib-sql: Debugging help - Added assert before clearing sql_result.callback.
If result is unrefed too many times, this still allows accessing the
callback from a debugger.
Timo Sirainen [Tue, 1 Sep 2015 13:25:11 +0000 (16:25 +0300)]
lib-imap-client: If connect() fails immediately, log an error and retry the next IP.
Only if all IPs fail return a full failure. This is mainly intended to skip
IPv6 addresses when IPv6 connectivity doesn't work.
Timo Sirainen [Mon, 31 Aug 2015 21:11:37 +0000 (00:11 +0300)]
auth: Added ":protected" suffix to passdb and userdb field names.
This means that if the field is set only if it hasn't already been set.
Usually an earlier passdb/userdb would have set the field and this is
setting a default (e.g. per-user settings override per-domain settings).
Teemu Huovila [Mon, 31 Aug 2015 10:33:26 +0000 (13:33 +0300)]
lib-fts: Add prefixing contraction filter.
Filters away prefixing contracted words, e.g. "l'homme" -> "homme".
Tokens to be filtered must be lower case. Only supports French in
this initial version.
Stephan Bosch [Sat, 29 Aug 2015 11:26:30 +0000 (14:26 +0300)]
Changed type of internet port values to in_port_t everywhere.
Created special SET_IN_PORT setting type for internet port values.
Created net_str2port() for parsing internet port values.
Removed several atoi() invocations in the process.
Stephan Bosch [Sat, 29 Aug 2015 11:20:57 +0000 (14:20 +0300)]
lib-http: client: Added proper handling of 408 response status.
This is treated as a special server connection close event, rather than a
response to the last issued request.
Timo Sirainen [Fri, 28 Aug 2015 13:07:35 +0000 (15:07 +0200)]
lib: If var_expand_with_funcs() function returns NULL, it should be treated the same as ""
The previous behavior was to return "%{foo:bar}" as "foo:bar}".
Timo Sirainen [Thu, 27 Aug 2015 15:34:52 +0000 (17:34 +0200)]
lib: Try fixing ec6e672a6e32 (ioloop timeout fixing)
Previous code was broken at least when moving a timeout between ioloops.
This is now tested and works.
Timo Sirainen [Thu, 27 Aug 2015 11:38:44 +0000 (13:38 +0200)]
dsync: Added -D parameter to disable mailbox renaming.
The renaming logic is annoyingly complex and there are some bugs left in it.
With this parameter renames are never even attempted, but instead a rename
would be done (slowly) with mailbox delete + create + fill.
Although with imapc protocol mailbox renames are rarely detected anyway.
Timo Sirainen [Thu, 27 Aug 2015 10:33:47 +0000 (12:33 +0200)]
dsync: Fixed again waiting for remote process wait to die.
We can't rely on stderr getting closed. It doesn't happen if the remote
process crashes. Now waiting for SIGCHLD in ioloop should solve this and
still log all the error messages at exit.
Stephan Bosch [Thu, 27 Aug 2015 08:39:26 +0000 (10:39 +0200)]
ioloop: Delay actual start of a new normal timeout until the next io_loop_run() cycle.
This makes sure that timeouts will not expire before they get a chance to
run.