]>
git.ipfire.org Git - thirdparty/dovecot/core.git/log
Josef 'Jeff' Sipek [Wed, 10 Jun 2020 20:44:19 +0000 (16:44 -0400)]
lib: event filter parser unit tests
Josef 'Jeff' Sipek [Tue, 26 May 2020 15:35:38 +0000 (11:35 -0400)]
lib: Switch event filtering to the new filter language
Josef 'Jeff' Sipek [Fri, 29 May 2020 17:09:22 +0000 (13:09 -0400)]
lib: Implement a new event filter language
Currently, it is not used by anything.
In general, the new syntax is very SQL-like. It is a boolean expression
made up of key-value comparisons, parentheses, and boolean connectors AND,
OR, and NOT.
The key-value comparisons are of the form:
<key> <operator> <value>
Where the key is one of:
(1) "event"
(2) "category"
(3) "source_location"
(4) a field name
The operator is one of:
(1) =
(2) >
(3) <
(4) >=
(5) <=
And the value is either:
(1) a single word token, or
(2) a quoted string
For example, to match events with the event name "abc", we would use one of
the following expressions. Note that white space is not significant between
tokens, and therefore the following are all equivalent.
event=abc
event="abc"
event = abc
event = "abc"
To match events with the name "abc" that include the "imap" category, we'd
use:
event=abc AND category=imap
To match events with the name "abc" that either include the "imap" or "pop3"
categories, we'd use:
event=abc AND (category=imap OR category=pop3)
Field names don't have any special prefix. Therefore, to match events than
have the field bytes_out equal to 10, we'd use:
bytes_out=10
To match events with bytes_out greater than or equal to 10, we'd use:
bytes_out>=10
Josef 'Jeff' Sipek [Wed, 17 Jun 2020 19:16:48 +0000 (15:16 -0400)]
lib: Allow event filter nodes to represent a log type category
Josef 'Jeff' Sipek [Wed, 17 Jun 2020 19:01:28 +0000 (15:01 -0400)]
lib: Future-proof the log type to event filter log type mapping
The mapping assumed that:
EVENT_FILTER_LOG_TYPE_FOO == (1 << LOG_TYPE_FOO)
While that is true today and will likely continue to be true in the future,
there's no reason why we can't future proof it and ensure that it always
works.
Josef 'Jeff' Sipek [Thu, 28 May 2020 21:43:21 +0000 (17:43 -0400)]
lib: Expose event_filter_category_to_log_type to the rest of event filter code
Josef 'Jeff' Sipek [Thu, 28 May 2020 21:22:09 +0000 (17:22 -0400)]
lib: Add internal code for event filter le/lt/ge/gt comparisons
These are currently unreachable.
Josef 'Jeff' Sipek [Fri, 22 May 2020 17:08:24 +0000 (13:08 -0400)]
lib: Rewrite event filter internals to use an abstract-syntax-tree
Josef 'Jeff' Sipek [Mon, 11 May 2020 18:43:15 +0000 (14:43 -0400)]
stats: Fail to load with empty metric filters
Josef 'Jeff' Sipek [Tue, 21 Apr 2020 14:32:32 +0000 (10:32 -0400)]
stats: replace metric { } filtering with the common filter language
Josef 'Jeff' Sipek [Thu, 14 May 2020 19:11:35 +0000 (15:11 -0400)]
lib: Change event_filter_parse() filter arg to a single pointer
Instead of allocating a new filter, fill in a passed in one.
Josef 'Jeff' Sipek [Thu, 14 May 2020 17:04:10 +0000 (13:04 -0400)]
lib: Assert that we aren't trying to match using filter framents
Josef 'Jeff' Sipek [Thu, 14 May 2020 17:03:52 +0000 (13:03 -0400)]
lib: Add event_filter_create_fragment()
Josef 'Jeff' Sipek [Tue, 21 Apr 2020 14:08:46 +0000 (10:08 -0400)]
lib: Move event filter query language from lib-master
This way we can use it elsewhere.
Josef 'Jeff' Sipek [Tue, 21 Apr 2020 15:05:58 +0000 (11:05 -0400)]
stats: openmetrics shouldn't abuse metric { } filter strings
Once upon a time it was thought that it was a good idea to output labels for
openmetrics metrics based on the fields used in the filter { } sub-block.
For the most part, this is not useful since the labels are going to be
either (1) always the same, or (2) one of several values.
For example, consider the following metric block:
metric foo {
event_name = something
...
filter {
abc = BAR
def = BAZ*
}
}
The value of 'abc' will *always* be 'BAR' for this metric, therefore it is
useless to include it.
The value of 'def' will always start with 'BAZ' for this metric. While it
may be tempting to justify this usage, the group_by provides a superset of
the functionality. In other words, the following config snipped will
provide a superset of the same information.
metric foo {
event_name = something
...
filter {
abc = BAR
def = BAZ*
}
group_by = abc def
}
Therefore, this filter { } sub-block labeling support is redundant and can
be safely removed.
Josef 'Jeff' Sipek [Mon, 11 May 2020 18:07:11 +0000 (14:07 -0400)]
lib: Add a way to merge filter queries with an overridden context
This allows the consumers to construct a filter without setting the context
on each query, and then when merging it with another query "filling in" the
context on the fly.
Josef 'Jeff' Sipek [Mon, 11 May 2020 18:03:52 +0000 (14:03 -0400)]
lib: Better document event filter iteration behavior
Aki Tuomi [Fri, 29 May 2020 06:53:53 +0000 (09:53 +0300)]
auth: auth-worker-client - Fix whitespace formatting
Aki Tuomi [Fri, 29 May 2020 06:52:23 +0000 (09:52 +0300)]
auth: auth-worker-client - Remove global auth_worker_client
All should go through connection list instead.
Broken in
317cb8aa981f856770057e23aeba98a33afc033a
Stephan Bosch [Tue, 29 Jan 2019 00:08:21 +0000 (01:08 +0100)]
lib-http: http-client - Fix assert panic occurring for shared clients.
Occurs as a race condition between connections becoming idle and new connections
being set up.
Panic was:
Panic: file http-client-queue.c: line 373 (http_client_queue_connection_attempt): assertion failed: (http_client_peer_addr_cmp (&(*peer_idx)->shared->addr, addr) != 0)
Timo Sirainen [Tue, 26 May 2020 16:22:52 +0000 (19:22 +0300)]
dict: Delay uncorking ostream in iteration callback
Timo Sirainen [Mon, 15 Jun 2020 07:33:53 +0000 (10:33 +0300)]
lib-storage: istream-mail - Fix assert-crash on handling corrupted mail size
In some situations the "Cached message size smaller than expected" error
handling could have resulted in:
Panic: file istream.c: line 315 (i_stream_read_memarea): assertion failed: (old_size <= _stream->pos - _stream->skip)
Timo Sirainen [Tue, 26 May 2020 16:09:38 +0000 (19:09 +0300)]
dict-client: Fix potential iterator double-free
client_dict_iterate_free() didn't really work properly, because of:
ctx->finished = TRUE;
client_dict_iter_api_callback(ctx, cmd, extra_args);
client_dict_iterate_free(ctx);
Here finished=TRUE is set first (and it needs to be set first). Afterwards
client_dict_iter_api_callback() internally calls
client_dict_iterate_deinit(), which can end up freeing the iterator.
Timo Sirainen [Tue, 26 May 2020 15:59:38 +0000 (18:59 +0300)]
dict-client: Rename struct dict_connection to dict_client_connection
dict server already has struct dict_connection. This naming conflict caused
problems with gdb debugging.
Timo Sirainen [Mon, 18 May 2020 17:34:27 +0000 (20:34 +0300)]
dict: Cork the output while writing iteration output
This reduces system CPU usage by avoiding many tiny write() syscalls.
Broken by
2ff2da52146609f4459bd0f7fd603e13400cb85e
Timo Sirainen [Tue, 28 Apr 2020 08:51:16 +0000 (11:51 +0300)]
fts: Add fts category
For now mainly so that the fts drivers' categories can inherit from it.
Timo Sirainen [Thu, 11 Jun 2020 09:59:14 +0000 (12:59 +0300)]
imap: Fix assert-crash in COPY/MOVE when storage doesn't return UIDs
For example copying mails into virtual storage crashed.
Broken by
09413e35f764a2898cbc26cea94218eed6df5cbf
Fixes:
Panic: file cmd-copy.c: line 152 (fetch_and_copy): assertion failed: (copy_ctx->copy_count == seq_range_count(©_ctx->saved_uids))
Timo Sirainen [Tue, 9 Jun 2020 08:40:53 +0000 (11:40 +0300)]
lib-compression: istream-zstd - Fix infinite loop when istream is nonblocking
Aki Tuomi [Thu, 4 Jun 2020 10:15:11 +0000 (13:15 +0300)]
lib-oauth2: oauth-jwt - Ensure / and . are escaped in kid
Aki Tuomi [Thu, 4 Jun 2020 07:41:32 +0000 (10:41 +0300)]
dovecot-oauth2.conf.ext: Update to match code
Aki Tuomi [Thu, 4 Jun 2020 07:23:36 +0000 (10:23 +0300)]
auth: db-oauth2 - Add more performant defaults for lib-http
Aki Tuomi [Wed, 3 Jun 2020 12:40:40 +0000 (15:40 +0300)]
lib-oauth2: Use azp to find token
This validates that the token is actually for us and also allows
having multiple tokens with same ID but different issuer.
Aki Tuomi [Wed, 3 Jun 2020 12:40:04 +0000 (15:40 +0300)]
lib-oauth2: Validate signature in jwt body process
This way we can utilize fields from body with validation.
Aki Tuomi [Wed, 3 Jun 2020 12:35:48 +0000 (15:35 +0300)]
lib-oauth2: Rename algo to alg
It's the field name.
Aki Tuomi [Tue, 2 Jun 2020 12:59:37 +0000 (15:59 +0300)]
lib-oauth2: Add iss validation support
Aki Tuomi [Tue, 2 Jun 2020 12:52:34 +0000 (15:52 +0300)]
lib-oauth2: Ensure token algorithm matches with key
Otherwise we might mistakenly use key that is not intended
for the token.
Aki Tuomi [Tue, 2 Jun 2020 13:07:48 +0000 (16:07 +0300)]
lib-oauth2: oauth2-jwt - Always uppercase algorithm
Aki Tuomi [Wed, 27 May 2020 12:41:22 +0000 (15:41 +0300)]
lib-dcrypt: dcrypt-openssl - Add helper macro for error_r handling
Avoids missing NULL checks for error_r.
Stephan Bosch [Wed, 27 May 2020 10:16:25 +0000 (12:16 +0200)]
lib-signals: Fix lib_signals_set_expected().
The function made no sense at all.
Problem found by Coverity.
Markus Valentin [Thu, 16 Apr 2020 05:35:25 +0000 (07:35 +0200)]
lib-sql: driver-cassandra - Handle more Cassandra errors as uncertain
Treat CASS_ERROR_LIB_WRITE_ERROR as uncertain error.
Markus Valentin [Thu, 16 Apr 2020 05:32:36 +0000 (07:32 +0200)]
lib-sql: driver-cassandra - Extract uncertain ascertainment to function
Juha-Petri Tyrkkö [Fri, 8 May 2020 00:02:22 +0000 (03:02 +0300)]
lib-fs: Prevent the release of a nonexistent dict.
Aki Tuomi [Wed, 27 May 2020 06:09:45 +0000 (09:09 +0300)]
auth: db-oauth2 - Remove extra oauth2 prefix from log messages
Aki Tuomi [Tue, 26 May 2020 09:46:29 +0000 (12:46 +0300)]
auth, lib-oauth2: Add local introspection mode
Local introspection attempts to decode token always.
This will also happen with password grant, saving
an extra roundtrip to oauth2 server.
Aki Tuomi [Tue, 26 May 2020 06:53:26 +0000 (09:53 +0300)]
auth: db-oauth2 - Use common code for lookup and password grant
Aki Tuomi [Tue, 26 May 2020 10:38:09 +0000 (13:38 +0300)]
auth: db-oauth2 - Clarify how introspect gets called
This should make it more obvious when introspection
actually gets called after lookup.
Introspection failure is now also moved earlier, before
the request would fail later because not all fields
are available.
Aki Tuomi [Tue, 26 May 2020 09:12:32 +0000 (12:12 +0300)]
auth: db-oauth2 - Add token parameter to db_oauth2_local_validation
Aki Tuomi [Mon, 25 May 2020 18:42:08 +0000 (21:42 +0300)]
auth: db-oauth2 - Move db_oauth2_local_validation
Simplifies next change
Aki Tuomi [Mon, 25 May 2020 18:47:35 +0000 (21:47 +0300)]
auth: db-oauth2 - Move db_oauth2_lookup_continue
Simplifies next change
Aki Tuomi [Tue, 26 May 2020 18:24:02 +0000 (21:24 +0300)]
auth: db-oauth2 - Do not fallback into remote validation anymore
It makes no sense anymore with introspection_mode=local. One should
make another passdb.
Aki Tuomi [Mon, 25 May 2020 18:18:45 +0000 (21:18 +0300)]
auth: db-oauth2 - Fix whitespace issue
Aki Tuomi [Tue, 26 May 2020 18:22:51 +0000 (21:22 +0300)]
lib-oauth2: Use hash instead of hash2
Hash2 doesn't work as we want. Fixes key caching
to actually work.
Aki Tuomi [Mon, 25 May 2020 13:19:14 +0000 (16:19 +0300)]
lib-oauth2: Allow nbf and iat to be 0
Some implementations set these intentionally to 0.
Stephan Bosch [Fri, 1 May 2020 15:26:14 +0000 (17:26 +0200)]
lmtp: Support forwarding passdb's forward_* fields via RCPT TO XRCPTFORWARD parameter.
Stephan Bosch [Fri, 1 May 2020 15:26:03 +0000 (17:26 +0200)]
lmtp: lmtp-proxy - Adjust RCPT parameter amendment code for expansion.
Stephan Bosch [Fri, 1 May 2020 15:25:46 +0000 (17:25 +0200)]
lmtp: lmtp-proxy - Wait for client connection login before submitting RCPT command.
This allows evaluating the server capabilities while composing the RCPT command.
Stephan Bosch [Fri, 1 May 2020 15:25:27 +0000 (17:25 +0200)]
lmtp: lmtp-proxy - Make LMTP connection object available in proxy connection struct.
Stephan Bosch [Fri, 1 May 2020 22:05:06 +0000 (00:05 +0200)]
lmtp: lmtp-client - Base client trust on the real remote IP.
LMTP uses real_remote_ip for checking the trust. This means:
* LMTP proxy checks MTA's IP address
* LMTP backend checks LMTP proxy's IP address
* If haproxy is used in front of this LMTP server, the haproxy's IP address is
checked. This may not be what is always wanted, but in LMTP backend it
wouldn't be correct to check the original client IP (= MTA IP) either.
Stephan Bosch [Sun, 26 Apr 2020 09:02:47 +0000 (11:02 +0200)]
lib-storage: mail-storage-service - Add support for sending forward_fields in userdb lookup.
Stephan Bosch [Sun, 26 Apr 2020 08:57:57 +0000 (10:57 +0200)]
lib-auth: auth-master - Add support for sending forward_fields.
Stephan Bosch [Thu, 30 Apr 2020 21:57:41 +0000 (23:57 +0200)]
lib-smtp: smtp-client-connection - Allow smtp_client_connection_connect() to be called several times.
This change allows calling smtp_client_connection_connect() several times with
different login callbacks. If the connection is already available, the
provided login callback is called almost immediately from the ioloop. This way,
several parallel asynchronous activities using the same connection can wait for
its availability and don't need to check whether it is available already. This
is mostly useful to obtain the capabilities of the server.
Stephan Bosch [Fri, 1 May 2020 11:02:57 +0000 (13:02 +0200)]
lib-smtp: smtp-client-connection - Record login reply.
Stephan Bosch [Wed, 22 Apr 2020 00:27:05 +0000 (02:27 +0200)]
lib-smtp: smtp-params - Add support for xtext-encoding/decoding extra parameters.
Stephan Bosch [Wed, 22 Apr 2020 21:24:21 +0000 (23:24 +0200)]
lib-smtp: smtp-params - Split off smtp_params_equal() from smtp_params_rcpt_equal().
Stephan Bosch [Wed, 22 Apr 2020 21:03:57 +0000 (23:03 +0200)]
lib-smtp: smtp-params - Remove code duplication between smtp_params_*_write().
Stephan Bosch [Wed, 22 Apr 2020 20:55:54 +0000 (22:55 +0200)]
lib-smtp: smtp-params - Remove code duplication between smtp_params_*_copy().
Stephan Bosch [Wed, 22 Apr 2020 20:32:55 +0000 (22:32 +0200)]
lib-smtp: smtp-params - Remove code duplication between smtp_params_*_drop_extra().
Stephan Bosch [Wed, 22 Apr 2020 20:26:25 +0000 (22:26 +0200)]
lib-smtp: smtp-params - Remove code duplication between smtp_params_*_add_extra().
Stephan Bosch [Wed, 22 Apr 2020 20:15:43 +0000 (22:15 +0200)]
lib-smtp: smtp-params - Remove code duplication between smtp_params_*_get_extra().
Stephan Bosch [Wed, 22 Apr 2020 19:52:14 +0000 (21:52 +0200)]
lib-smtp: smtp-syntax - Add smtp_xtext_decode().
Stephan Bosch [Mon, 27 Apr 2020 09:50:13 +0000 (11:50 +0200)]
lib-smtp: smtp-params - Rename smtp_params_rcpt_equals() to smtp_params_rcpt_equal().
Stephan Bosch [Fri, 1 May 2020 15:25:05 +0000 (17:25 +0200)]
lmpt: Reformat lmtp-proxy.c.
Stephan Bosch [Fri, 1 May 2020 15:24:47 +0000 (17:24 +0200)]
lmtp: Reformat lmtp-commands.c.
Stephan Bosch [Mon, 4 May 2020 20:25:47 +0000 (22:25 +0200)]
lmtp: Reformat lmtp-client.c.
Stephan Bosch [Sat, 2 May 2020 00:34:34 +0000 (02:34 +0200)]
lib-smtp: Reformat smtp-client-connection.h.
Stephan Bosch [Fri, 1 May 2020 15:16:01 +0000 (17:16 +0200)]
lib-smtp: Reformat smtp-client-connection.c.
Timo Sirainen [Tue, 19 May 2020 16:11:34 +0000 (19:11 +0300)]
lib-storage: mail_search_args_init() - Expand "*" in SEARCH_SEQSET
This is now required by the IMAP MOVE code to correctly handle
"MOVE * folder".
Timo Sirainen [Tue, 19 May 2020 15:31:31 +0000 (18:31 +0300)]
imap: imap_search_seqset_iter_next() - Assert-crash if iteration doesn't progress
This can be done easily with seq_range_array_remove_seq_range(). This is
cleaner to use than invert+intersect. I originally didn't notice that
this function existed.
Timo Sirainen [Tue, 19 May 2020 16:10:59 +0000 (19:10 +0300)]
lib: Add unit test for seq_range_array_remove_range()
Timo Sirainen [Mon, 18 May 2020 09:01:44 +0000 (12:01 +0300)]
lib-storage: mail_search_args_init() - Fix converting UIDSET * to SEQSET on empty mailbox
The "*" caused seq=0 to be added to the seqset. This could have caused
unexpected issues.
Fixes at least UID MOVE on empty mailbox:
Panic: file seq-range-array.c: line 471 (seq_range_array_invert): assertion failed: (range[0].seq1 >= min_seq)
Before
1a5d89d2bfa031903e88af9aff7eafc1b373d521 this assert-crash didn't
happen, but it went to infinite loop.
Stephan Bosch [Sat, 11 Apr 2020 17:19:41 +0000 (19:19 +0200)]
lib-imap-client: test-imapc-client - Use the new sub-process test API.
This makes an effort to terminate server processes gracefully. Killing them
bluntly hampers test coverage measurement and valgrind testing.
Stephan Bosch [Sat, 11 Apr 2020 16:54:06 +0000 (18:54 +0200)]
lib-imap-client: test-imapc-client - Add server debug messages.
Stephan Bosch [Sat, 11 Apr 2020 11:44:45 +0000 (13:44 +0200)]
lib-imap-client: test-imapc-client - Split off test_run_server/client() from test_run_client_server().
Stephan Bosch [Sat, 11 Apr 2020 10:28:25 +0000 (12:28 +0200)]
lib-imap-client: test-imapc-client - Add log prefixes to distinguish client and server debug messages.
Stephan Bosch [Sat, 11 Apr 2020 08:02:12 +0000 (10:02 +0200)]
lib-imap-client: test-imapc-client - Make sure the child server process is killed.
Stephan Bosch [Sat, 11 Apr 2020 08:05:25 +0000 (10:05 +0200)]
lib-imap-client: test-imapc-client - Use getopt() for parsing command line arguments.
Stephan Bosch [Sat, 11 Apr 2020 08:00:32 +0000 (10:00 +0200)]
lib-imap-client: test-imapc-client - Add structural comments.
Stephan Bosch [Sat, 11 Apr 2020 07:30:29 +0000 (09:30 +0200)]
lib-imap-client: test-imapc-client - Move client functions.
Stephan Bosch [Mon, 13 Apr 2020 16:49:12 +0000 (18:49 +0200)]
lib-imap-client: test-imapc-client - Move server functions.
Stephan Bosch [Sat, 11 Apr 2020 07:27:30 +0000 (09:27 +0200)]
lib-imap-client: test-imapc-client - Move test_open_server_fd().
Stephan Bosch [Sat, 11 Apr 2020 11:27:58 +0000 (13:27 +0200)]
lib-imap-client: Reformat test-imapc-client.c.
Timo Sirainen [Sun, 12 Apr 2020 08:51:31 +0000 (11:51 +0300)]
lib-imap-client: Remove unnecessary "Authentication failed: disconnected" errors
If connection failed during login, there were always two log lines logged.
The first line is enough.
Timo Sirainen [Sun, 12 Apr 2020 08:34:14 +0000 (11:34 +0300)]
lib-imap-client: test-imapc-client - Client now sends LOGOUT and server expects it
Timo Sirainen [Sun, 12 Apr 2020 08:30:28 +0000 (11:30 +0300)]
lib-imap-client: test-imapc-client - login_hangs: Client stopped too early
Timo Sirainen [Sun, 12 Apr 2020 08:29:06 +0000 (11:29 +0300)]
lib-imap-client: test-imapc-client - login_hangs: Server checked wrong connection's input
Stephan Bosch [Fri, 10 Apr 2020 22:47:21 +0000 (00:47 +0200)]
master: test-master-login-auth - Use the new sub-process test API.
This makes an effort to terminate server processes gracefully. Killing them
bluntly hampers test coverage measurement and valgrind testing.
Stephan Bosch [Sat, 11 Apr 2020 11:51:49 +0000 (13:51 +0200)]
master: test-master-login-auth - Split off test_run_server/client() from test_run_client_server().
Stephan Bosch [Fri, 10 Apr 2020 22:40:19 +0000 (00:40 +0200)]
master: test-master-login-auth - Rename test_server_kill() to test_servers_kill_forced().
Stephan Bosch [Fri, 10 Apr 2020 22:38:26 +0000 (00:38 +0200)]
master: test-master-login-auth - Move global initialization to main_init/deinit().
Stephan Bosch [Fri, 10 Apr 2020 22:32:25 +0000 (00:32 +0200)]
master: test-master-login-auth - Avoid using sleep()/usleep().