Timo Sirainen [Thu, 20 Oct 2016 17:31:33 +0000 (20:31 +0300)]
director: Code cleanup - moved username_hash generation to director.h
It's not really user_directory specific. This is especially important
in the following patches that add per-tag user_directories. It's also not
always known which tag the username_hash refers to, so there can't be
different tag-specific username_hash generators.
Timo Sirainen [Fri, 4 Nov 2016 10:04:11 +0000 (12:04 +0200)]
lib-storage: Fix doveadm search query parsing to use timezones correctly.
When using a date string, e.g. "senton 25-Mar-2007" it should work the same
way as IMAP does and show all mails whose sent date is on 25th, ignoring
whatever the timezone is in the Date header (or in case of received/saved-date
it would be using the timestamps in server's local timezone, again just like
IMAP).
When search with an exact UNIX timestamp or a time interval (e.g.
"3 days"), it should be using UTC times for doing all comparisons.
data-stack: T_BEGIN should use file & line number as the t_push marker
Using a function name is not unique if there is more than one T_BEGIN in a
function. Therefore, switch the marker passed into t_push to be the
concatenation of __FILE__ and __LINE__.
data-stack: t_push should always keep track of the marker
Instead of only keeping track of it on DEBUG builds, t_push should always
keep the marker around. This will help diagnosing issues on non-debug
builds.
Timo Sirainen [Wed, 2 Nov 2016 21:00:50 +0000 (23:00 +0200)]
auth: Make static analyzer happier.
Don't complain about uninitialized static_password being sent to
passdb_handle_credentials(). It could only happen for failures, and
passdb_handle_credentials() wouldn't have used the password then.
Stephan Bosch [Fri, 16 Sep 2016 18:22:17 +0000 (20:22 +0200)]
lib-http: client: Implemented host name lookup TTL.
Host name lookups will now be performed again when the results have expired.
Without access to TTL information from DNS lookups, all lookups will use the same default TTL for now.
Stephan Bosch [Thu, 15 Sep 2016 23:35:09 +0000 (01:35 +0200)]
lib-http: client: Link peers to queue earlier: during connection attempts.
This makes sure that queues keep track of which peers are doing stuff on its behalf.
This is important to be able to manage the active peers when a new host name lookup was performed; if a peer is no longer listed in the returned IPs it should be dropped.
Stephan Bosch [Thu, 15 Sep 2016 00:14:46 +0000 (02:14 +0200)]
lib-http: client: Created http_client_peer_drop() function that closes a peer object gracefully.
It checks whether any connections are still present.
It checks whether a backoff timer is still active.
This change and subsequent changes prepare for being able to destroy a queue when it becomes unused.
All peers linked to such a queue are unlinked and dropped when inactive and unlinked.
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.
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.
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.
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.
Paul Howarth [Fri, 28 Oct 2016 13:36:41 +0000 (14:36 +0100)]
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.
Timo Sirainen [Fri, 28 Oct 2016 09:12:28 +0000 (12:12 +0300)]
auth-worker: Fix potential crash when importing passdb/userdb fields without value.
These were being converted to NULL values in auth-worker, while elsewhere they were
converted to "". Changed to "" here as well and added asserts to make sure they
won't happen again.
Most of the NULL values would have been fine, but overriding any IP/port
fields would have caused a crash when trying to parse the value.