]>
git.ipfire.org Git - thirdparty/dovecot/core.git/log
Markus Valentin [Tue, 3 Sep 2019 12:33:03 +0000 (14:33 +0200)]
lib-storage: change caching decision for lazy requests in cache lookup
In case lookup_abort is set to NOT_IN_CACHE_START_CACHING update the
cacheing decision for the requested field.
Markus Valentin [Tue, 3 Sep 2019 12:30:15 +0000 (14:30 +0200)]
lib-storage: introduce MAIL_LOOKUP_ABORT_NOT_IN_CACHE_START_CACHING
In some cases we would like to mark an field as to be cached but still
don't fetch it now. For this occasions this change introduces a new enum
value for mail_lookup_abort which allows to implement such a behaviour.
Markus Valentin [Tue, 3 Sep 2019 12:16:41 +0000 (14:16 +0200)]
lib-index: move mail_cache_decision_add to public header
To allow other components to mark fields as to be cached move the
declaration from mail-cache-private.h to mail-cache.h.
Aki Tuomi [Mon, 2 Sep 2019 11:09:04 +0000 (14:09 +0300)]
lib-ssl-iostream: Remove problematic unit tests
These unit tests are unreliable with new versions of openssl
present in ubuntu 18 and debian buster.
Timo Sirainen [Sun, 1 Sep 2019 17:50:05 +0000 (20:50 +0300)]
auth: winbind - Make static analyzer happier
Stephan Bosch [Wed, 28 Aug 2019 21:21:31 +0000 (23:21 +0200)]
lib: base64 - Add high-level data and string encode functions with data stack buffer output.
Stephan Bosch [Wed, 28 Aug 2019 22:42:14 +0000 (00:42 +0200)]
lib: base64 - Add flags and max_line_size parameters to the new high-level encode functions.
Cannot change the API of existing functions.
Stephan Bosch [Wed, 28 Aug 2019 22:04:54 +0000 (00:04 +0200)]
lib: base64 - Add high-level data decode functions with data stack buffer output.
Similar functions accepting C string input already exist.
Stephan Bosch [Wed, 28 Aug 2019 21:34:54 +0000 (23:34 +0200)]
lib: base64 - Add flags parameters to the new high-level decode functions.
Cannot change the API of existing functions.
Stephan Bosch [Tue, 27 Aug 2019 23:21:01 +0000 (01:21 +0200)]
lib: base64 - Add BASE64_DECODE_FLAG_IGNORE_PADDING.
Makes padding optional rather than either disallowed or required.
Stephan Bosch [Tue, 27 Aug 2019 18:46:42 +0000 (20:46 +0200)]
lib: base64 - Reformat flag handling in base64_decode_more().
Stephan Bosch [Tue, 27 Aug 2019 18:37:40 +0000 (20:37 +0200)]
lib: base64 - Remove unused assignment.
Found by Clang scan-build.
Stephan Bosch [Fri, 17 May 2019 08:17:19 +0000 (10:17 +0200)]
lib: base64 - Add support for decoding without padding.
Stephan Bosch [Wed, 15 May 2019 13:36:18 +0000 (15:36 +0200)]
lib: base64 - Add support for encoding without padding.
Stephan Bosch [Tue, 2 Apr 2019 18:45:54 +0000 (20:45 +0200)]
lib: istream-base64-encoder - Use the new low-level incremental Base64 encoding API.
Stephan Bosch [Mon, 1 Apr 2019 23:49:57 +0000 (01:49 +0200)]
lib: base64 - Add support for adding line breaks to encoded output.
Stephan Bosch [Wed, 15 May 2019 08:09:01 +0000 (10:09 +0200)]
lib: base64 - Add base64_get_full_encoded_size().
Stephan Bosch [Sat, 30 Mar 2019 17:57:34 +0000 (18:57 +0100)]
lib: base64 - Add decode flag for prohibiting whitespace.
Stephan Bosch [Mon, 26 Aug 2019 11:09:30 +0000 (13:09 +0200)]
lib: base64 - Deprecate src_pos_r parameter of base64_decode().
Only NULL pointer is allowed. This allows using the new incremental API
internally, thereby dropping the old decoder implementation.
Stephan Bosch [Sat, 30 Mar 2019 18:12:39 +0000 (19:12 +0100)]
lib: istream-base64-decoder - Use the new low-level incremental Base64 decoding API.
Stephan Bosch [Sat, 30 Mar 2019 18:08:10 +0000 (19:08 +0100)]
lib: base64 - Properly implemenent incremental decoding.
Stephan Bosch [Sat, 16 Mar 2019 20:19:49 +0000 (21:19 +0100)]
lib: base64 - Properly implemenent incremental encoding.
Stephan Bosch [Sun, 31 Mar 2019 11:18:04 +0000 (13:18 +0200)]
lib: buffer - Add buffer_get_avail_size().
This determines how much data can be added to buffer.
Stephan Bosch [Wed, 13 Feb 2019 18:36:52 +0000 (19:36 +0100)]
lib: istream-base64 - Add support for base64url encoding.
Stephan Bosch [Wed, 13 Feb 2019 16:55:31 +0000 (17:55 +0100)]
lib: base64 - Add support for base64url encoding.
Stephan Bosch [Wed, 13 Feb 2019 18:00:11 +0000 (19:00 +0100)]
lib: base64 - Make code suitable for encoding/decoding different Base64 variants.
Stephan Bosch [Fri, 17 May 2019 08:09:11 +0000 (10:09 +0200)]
lib: base64 - Add structural comments.
Stephan Bosch [Wed, 13 Feb 2019 18:09:43 +0000 (19:09 +0100)]
lib: base64.h - Move size macros.
Stephan Bosch [Wed, 13 Feb 2019 18:05:38 +0000 (19:05 +0100)]
lib: base64 - Make encoding table an explicit array.
Before, it was a string constant.
Stephan Bosch [Wed, 13 Feb 2019 18:03:02 +0000 (19:03 +0100)]
lib: base64.c - Move mapping tables.
Timo Sirainen [Tue, 28 May 2019 19:44:43 +0000 (22:44 +0300)]
lib: test-base64 - Make sure base64_decode() won't allocate any extra space
I was just considering an optimization where it would, until I realized it
could break some existing code.
Timo Sirainen [Tue, 28 May 2019 09:57:24 +0000 (12:57 +0300)]
lib: test-base64 - Cleanup: Use more exact test_asserts
This way it's easier to see why tests are failing.
Timo Sirainen [Tue, 28 May 2019 09:51:09 +0000 (12:51 +0300)]
lib: test-base64 - Cleanup: Use the same struct for test input and output
Josef 'Jeff' Sipek [Fri, 29 Mar 2019 07:59:09 +0000 (09:59 +0200)]
lib: test-base64 - Test MAX_BASE64_{EN,DE}CODED_SIZE() with existing tests
Timo Sirainen [Tue, 28 May 2019 10:35:11 +0000 (13:35 +0300)]
lib: base64 - Change MAX_BASE64_DECODED_SIZE() to be more exact
If the input has only full base64 blocks (is divisible by 4), there's no
need to add the extra +3.
Josef 'Jeff' Sipek [Thu, 28 Mar 2019 09:25:41 +0000 (11:25 +0200)]
lib: base64 - Simplify MAX_BASE64_ENCODED_SIZE() calculation
Rely on (X + (Y - 1)) / Y being the same as ceil(X / Y) when operating on
integers.
This has a couple of benefits over the previous expression:
1) the size argument is evaluated only once
2) the generated code is simpler (no conditional instructions)
3) the generated code is smaller
The generated code shrinks in terms of both bytes and instruction count.
The following table lists the number of bytes (B) and instructions (I) used
by the code before and after this change on an assortment of architectures
when the input is not known at compile time. Unless otherwise noted, the
results are based clang 6.0.1 output.
| before | after | delta
---------+---------+--------+-------------
aarch64 | 32B 8I | 24B 6I | -25%B -25%I
amd64 | 38B 10I | 25B 5I | -34%B -50%I
amd64 [1]| 43B 10I | 31B 6I | -28%B -40%I
armv7 | 36B 9I | 24B 6I | -33%B -33%I
i386 | 32B 12I | 20B 6I | -38%B -50%I
i386 [1] | 35B 11I | 25B 7I | -29%B -36%I
ppc32 | 44B 11I | 20B 5I | -55%B -55%I
ppc64 | 52B 13I | 32B 8I | -38%B -38%I
s390x | 74B 16I | 26B 5I | -65%B -69%I
sparcv9 | 36B 9I | 12B 3I | -66%B -66%I
[1] gcc 8.2.0
Timo Sirainen [Sat, 17 Aug 2019 10:44:53 +0000 (13:44 +0300)]
lib: Fix updating timeouts after time moves backwards
Broken by
b258137d0e0618ae792e3606071a1715d26f107b
Fixes:
Panic: file ioloop.c: line 479 (timeout_get_wait_time): assertion failed: (ret > 0 && tv_r->tv_sec >= 0 && tv_r->tv_usec >= 0)
Timo Sirainen [Sat, 17 Aug 2019 10:43:21 +0000 (13:43 +0300)]
lib: timeval_add/sub_usecs() - Add assert to make sure negative values aren't used
The current code doesn't work correctly if negative values are used.
The code could of course be changed to handle them, but maybe assert is
better to catch bugs.
Timo Sirainen [Sun, 18 Aug 2019 14:44:33 +0000 (17:44 +0300)]
lib, lib-dcrypt: Fix unit tests to check i_stream_read() return value
Timo Sirainen [Fri, 9 Aug 2019 09:19:17 +0000 (12:19 +0300)]
cassandra: Fix crash due to race condition with threads
Broken by changes in
0a5a2b81c266c11c34ab36b20816909dc3e715ac
The crash could happen because driver_cassandra_future_callback() can be
called any time, even before returning from driver_cassandra_set_callback().
This could result in both cb->id and cb->to being set and using the cb
after it's already freed.
Timo Sirainen [Fri, 9 Aug 2019 09:18:04 +0000 (12:18 +0300)]
cassandra: Cleanup - Move code to cassandra_callback_detach()
Timo Sirainen [Wed, 14 Aug 2019 16:18:20 +0000 (19:18 +0300)]
lib-storage: Add mailbox_attribute_internal.iter()
This mainly allows internal attributes with children to actually be able to
list the childrens' keys.
Martti Rannanjärvi [Fri, 9 Aug 2019 11:07:58 +0000 (14:07 +0300)]
imap: Only send NIL on GETMETADATA when query depth is 0
Timo Sirainen [Wed, 7 Aug 2019 12:46:39 +0000 (15:46 +0300)]
imap: GETMETADATA: Ignore MAIL_ERROR_NOTPOSSIBLE errors when using DEPTH parameter
This most likely means that imap_metadata=no, but the client still wants to
fetch recursively validated metadata entries. This should return in OK
instead of NO reply.
Aki Tuomi [Tue, 6 Aug 2019 05:44:18 +0000 (08:44 +0300)]
auth: Do not unref policy payload too early
This can cause the context to be free'd too early leading
to crashes.
Markus Valentin [Fri, 2 Aug 2019 13:57:09 +0000 (15:57 +0200)]
lib-imap-metadata: setting metadata literal value does not delete it
Only if value and value_stream are NULL the metadata can be unset.
Timo Sirainen [Tue, 30 Jul 2019 11:15:11 +0000 (14:15 +0300)]
lib-smtp: Fix encoding quoted localparts that end with "."
For example "user..@example.com" or "user..test.@example.com" resulted
in an extra '"' prefix.
Timo Sirainen [Mon, 29 Jul 2019 07:30:05 +0000 (10:30 +0300)]
lib-storage: Mark /private/specialuse attribute to be validated
Timo Sirainen [Wed, 24 Jul 2019 12:39:37 +0000 (15:39 +0300)]
imap: GETMETADATA: Send the last error as tagged reply
This way if there's only a single error, the error is in the tagged reply
with the [resp-code]. Clients can handle this better than untagged NO
replies.
Timo Sirainen [Wed, 24 Jul 2019 12:36:03 +0000 (15:36 +0300)]
imap: GETMETADATA: If i_stream_get_size() fails, send client an internal error line
Previously the client didn't get any kind of an explanation why the
GETMETADATA failed.
Timo Sirainen [Wed, 24 Jul 2019 12:31:20 +0000 (15:31 +0300)]
imap: GETMETADATA: Move error handling to a common function
Timo Sirainen [Wed, 24 Jul 2019 12:26:08 +0000 (15:26 +0300)]
imap: GETMETADATA: Replace failed boolean with last_error code
Timo Sirainen [Wed, 24 Jul 2019 12:05:27 +0000 (15:05 +0300)]
imap: Allow SET/GETMETADATA to access validated attributes with imap_metadata=no
Some IMAP extensions use these commands to set/get their internal state.
This should be allowed even if full METADATA isn't enabled.
The initial plan was to restrict this in the lib-imap-storage layer, so it
would apply to everything using the imap-metadata API. This would have
affected for example accessing metadata in Sieve scripts, which could be
either good or bad. It might not be wanted to give users read access to
some metadata either, but admins really should be given the ability to
write Sieve scripts that access the metadata. However there's just no good
way to differentiate between admin-written (or tool-written) Sieve script
and user-written Sieve script.
Another issue is using metadata to configure virtual mailboxes. Currently
they're all admin-written and should be allowed to access metadata, but in
the future we might want to allow user-written virtual mailbox rules as
well.
So the end result at least for now is to just prevent IMAP GETMETADATA and
SETMETADATA specifically from accessing the non-validated attributes. Most
of the time there aren't any secrets in the metadata. In case there is,
users need to be prevented from accessing metadata via Sieve, and in such
systems users rarely have direct Sieve access anyway.
Timo Sirainen [Tue, 30 Jul 2019 08:04:44 +0000 (11:04 +0300)]
lib-imap-metadata: Add imap_metadata_transaction_validated_only()
Timo Sirainen [Wed, 24 Jul 2019 11:42:21 +0000 (14:42 +0300)]
lib-storage: Add support for "validated attributes"
If an attribute is marked with MAIL_ATTRIBUTE_INTERNAL_FLAG_VALIDATED, it's
assumed to be "validated". This means that it has a set() callback that
validates the value, which at minimum means that its size isn't excessively
large.
MAIL_ATTRIBUTE_TYPE_FLAG_VALIDATED can be used with set/get/iterate to allow
access only to these validated attributes. Trying to access non-validated
attributes will result in error.
Timo Sirainen [Tue, 23 Jul 2019 11:42:45 +0000 (12:42 +0100)]
lib-storage: Prepare attribute API for having flags in the type
Aki Tuomi [Mon, 29 Jul 2019 13:08:07 +0000 (16:08 +0300)]
lib-ssl-iostream: Support TLSv1.3 ciphersuites
Aki Tuomi [Mon, 29 Jul 2019 13:17:27 +0000 (16:17 +0300)]
lib-ssl-iostream: test-iostream-ssl - Wait until both sides have handshaked
Produces consistent result with different TLS flavors
Aki Tuomi [Mon, 29 Jul 2019 13:24:49 +0000 (16:24 +0300)]
lib-ssl-iostream: test-iostream-ssl - Plug memory leak
If either endpoint fails to initialize it needs to be deinitialized too.
Aki Tuomi [Mon, 29 Jul 2019 12:39:20 +0000 (15:39 +0300)]
lib-ssl-iostream: test-iostream-ssl - Always fail on error
Consistently fail the real function if something goes wrong.
Needed for TLSv1.3 support.
Aki Tuomi [Mon, 29 Jul 2019 12:36:21 +0000 (15:36 +0300)]
lib-ssl-iostream: test-iostream-ssl - Explicitly increment idx
The test_assert macro does not evaluate the idx increment
if the test succeeds.
Aki Tuomi [Mon, 29 Jul 2019 08:11:11 +0000 (11:11 +0300)]
stats: event exporters - Support https
Aki Tuomi [Mon, 29 Jul 2019 07:56:52 +0000 (10:56 +0300)]
stats: event-exporter - Use DNS for http
Aki Tuomi [Mon, 29 Jul 2019 08:20:48 +0000 (11:20 +0300)]
stats: Disable chroot to make event exporters work
This is mostly needed for dns-client unix socket and
accessing ssl CA certificates.
Aki Tuomi [Mon, 29 Jul 2019 07:56:20 +0000 (10:56 +0300)]
dns-client: Make dns client available in login chroot
Otherwise it's not possible to use it for login processes.
Siavash Tavakoli [Fri, 26 Jul 2019 08:55:11 +0000 (11:55 +0300)]
mail-crypt: test-mail-key - Skip test before allocating test_pool
Fixes a memory leak if test is skipped.
Siavash Tavakoli [Fri, 26 Jul 2019 08:55:05 +0000 (11:55 +0300)]
lib-smtp: test-smtp-payload - exclude ssl cases if ssl not supported
Siavash Tavakoli [Fri, 26 Jul 2019 08:54:47 +0000 (11:54 +0300)]
lib-http: test-http-payload - Include test_echo_ssl only if ssl is supported
Josef 'Jeff' Sipek [Thu, 18 Jul 2019 15:45:28 +0000 (11:45 -0400)]
lib: Allow event filtering with wildcarded integers
Timo Sirainen [Mon, 22 Jul 2019 15:35:05 +0000 (18:35 +0300)]
lib-ssl-iostream: Don't build test-iostream-ssl if building without ssl
Fixes compiling when building without ssl.
Josef 'Jeff' Sipek [Wed, 6 Feb 2019 16:33:11 +0000 (11:33 -0500)]
lib: Correct comment typo (UIID -> UUID)
Aki Tuomi [Fri, 12 Jul 2019 07:29:00 +0000 (10:29 +0300)]
lib: test-ostream-multiplex - Check flush return value
Fixes coverity nit
Aki Tuomi [Tue, 21 May 2019 09:14:35 +0000 (12:14 +0300)]
lib: test-ostream-multiplex - Test corking
Aki Tuomi [Wed, 10 Jul 2019 08:25:14 +0000 (11:25 +0300)]
lib: ostream-multiplex - Fix last_sent
The intention was to choose oldest channel. The old code however
always chose last channel to send, which was not really the point.
Using unix timestamp is also problematic due to sub-second granularity.
Aki Tuomi [Tue, 21 May 2019 09:43:46 +0000 (12:43 +0300)]
lib: ostream-multiplex - Optimize writing
Aki Tuomi [Tue, 21 May 2019 08:45:57 +0000 (11:45 +0300)]
lib: ostream-multiplex - Implement cork support
Support corking for multiplex channels
Aki Tuomi [Wed, 10 Jul 2019 08:16:03 +0000 (11:16 +0300)]
lib: ostream-multiplex - Fix code format issue
Aki Tuomi [Tue, 21 May 2019 10:34:57 +0000 (13:34 +0300)]
lib-ssl-iostream: Add unit test
Aki Tuomi [Tue, 21 May 2019 10:32:14 +0000 (13:32 +0300)]
lib-ssl-iostream: ostream-openssl - Prevent segfault o_stream_get_buffer_*_size() when buffer is not allocated yet.
Aki Tuomi [Tue, 21 May 2019 10:31:08 +0000 (13:31 +0300)]
m4: Substitute variables in modules.m4
Otherwise they do not work in Makefiles
Aki Tuomi [Fri, 5 Oct 2018 07:18:35 +0000 (10:18 +0300)]
userdb-passwd: Fix getpwent errno handling
In https://bugs.gentoo.org/667118 Reuben Farrelly
noticed that running
# doveadm user '*'
causes auth daemon to generate errors like:
auth-worker(3585): Error: getpwent() failed: Invalid argument
This happens because on successful call getpwent()
now sets errno=EINVAL starting from glibc-2.28.
See https://sourceware.org/PR16004 for details.
The fix is to reset 'errno' before 'getpwent()' is called.
Reported-by: Reuben Farrelly
Bug: https://bugs.gentoo.org/667118
Bug: https://sourceware.org/PR16004
Original-Author: Sergei Trofimovich <slyfox@gentoo.org>
Timo Sirainen [Fri, 8 Mar 2019 16:39:49 +0000 (18:39 +0200)]
dsync: Fix importing keywords with MAIL_TRANSACTION_SYNC flag set
Reading transaction logs was handled differently depending on the
MAIL_TRANSACTION_SYNC flag. The flag was set for all transactions written
by dsync.
So for example:
* doveadm backup mdbox:/tmp/mdbox1 # keywords imported ok
* doveadm -o mail=mdbox:/tmp/mdbox1 backup mdbox:/tmp/mdbox2 # keywords lost
Aki Tuomi [Fri, 5 Jul 2019 11:29:36 +0000 (14:29 +0300)]
lib-smtp: test-smtp-submit - Fix typo in error message
Markus Valentin [Mon, 24 Jun 2019 14:06:19 +0000 (16:06 +0200)]
auth: oauth2: set scope to passdb_oauth2_settings
Markus Valentin [Mon, 24 Jun 2019 14:03:37 +0000 (16:03 +0200)]
lib-oauth2: append scope to the access request payload
Shaun A. Johnson [Mon, 13 Aug 2018 23:43:04 +0000 (16:43 -0700)]
lib: Changed chown to chmod for Linux NFS Flush
This change switches the chown call to a chmod call in the function
nfs_flush_chown_uid because the chown call was resulting in certain
permission bits being dropped when the nfs attributes were flushed.
Functionality for FreeBSD/Solaris was left unchanged.
Shaun A. Johnson [Mon, 13 Aug 2018 23:35:54 +0000 (16:35 -0700)]
lib: Split up logic in nfs_flush_chown_uid
This splits up the logic of nfs_flush_chown_uid() so that there is an
individual chown call for each platform instead of a single call that is
compiled for both platforms.
This is the first step to adjusting how nfs attributes are flushed on
Linux because of an issue with chown resetting permissions on the files.
Timo Sirainen [Fri, 28 Jun 2019 07:10:50 +0000 (10:10 +0300)]
doveadm: Fix "service stop" to not print "Interrupted system call" error
The "service stop" handler no longer needs to read the VERSION line.
Broken by
2148805a75abd86d1769d9fd20652551cc5c5ac2
Stephan Bosch [Sun, 16 Dec 2018 13:25:58 +0000 (14:25 +0100)]
master: Handle and report system clock glitches in millisecond resolution internally.
Stephan Bosch [Sun, 16 Dec 2018 13:23:15 +0000 (14:23 +0100)]
master: Handle throttling of services in millisecond resolution internally.
Stephan Bosch [Sun, 16 Dec 2018 12:56:47 +0000 (13:56 +0100)]
lib-storage: mail-storage-service: Handle and report system clock glitches in millisecond resolution.
Stephan Bosch [Sun, 16 Dec 2018 12:55:34 +0000 (13:55 +0100)]
lib: ioloop: Make the callback for io_loop_set_time_moved_callback() use struct timeval.
This allows reporting sub-second glitches.
Stephan Bosch [Sun, 16 Dec 2018 13:09:17 +0000 (14:09 +0100)]
lib: ioloop: Perform calculcations for the detection of system clock glitches in microseconds.
Stephan Bosch [Thu, 13 Dec 2018 09:23:44 +0000 (10:23 +0100)]
global: Replace usleep() with i_sleep*_usecs and i_sleep*_msecs().
This prevents overflows and makes sure signal interruptions are handled
appropriately.
Stephan Bosch [Thu, 13 Dec 2018 09:06:17 +0000 (10:06 +0100)]
lib: Implement reliable sleep functions i_sleep*_usecs(), i_sleep*_msecs(), and i_sleep*_secs().
Versions with and without support for being interrupted by signals are available.
Stephan Bosch [Thu, 13 Dec 2018 08:53:18 +0000 (09:53 +0100)]
lib: time-util: Add timeval_add_usecs() and timeval_sub_usecs().
Stephan Bosch [Tue, 11 Dec 2018 19:52:44 +0000 (20:52 +0100)]
lib: ioloop: Never decrease wait time counters in ioloop_add_wait_time().
Prevents problems when time moves backwards.
Stephan Bosch [Tue, 11 Dec 2018 19:54:09 +0000 (20:54 +0100)]
lib: file-lock: Never decrease the wait time counter in file_lock_wait_end().
Prevents problems when time moves backwards.
Markus Valentin [Wed, 19 Jun 2019 14:29:49 +0000 (16:29 +0200)]
script: health-check: add health-check.sh default script
As a example for an simple tcp health check the health-check.sh script
is added. It closes the connection after 10 seconds and only answer to
"PING\n" with a "PONG\n". It is installed by default next to the script
executable.
Markus Valentin [Wed, 19 Jun 2019 12:36:12 +0000 (14:36 +0200)]
script: add a parameter -p for passthrough scripts
Adding the passthrough option to script, this allows to configure a
script to be straightly called from a socket connection, without
implementing any specific protocol.