]>
git.ipfire.org Git - thirdparty/dovecot/core.git/log
Aki Tuomi [Thu, 29 Aug 2019 13:52:51 +0000 (16:52 +0300)]
lib-dcrypt: Add API for dcrypt_ecdh_derive_secret
Aki Tuomi [Thu, 29 Aug 2019 09:56:21 +0000 (12:56 +0300)]
lib-dcrypt: Return value from RSA_set0_crt_params
Aki Tuomi [Thu, 29 Aug 2019 09:52:46 +0000 (12:52 +0300)]
lib-dcrypt: Fix key format in raw & jwk keys
It needs to be point compressed with named curve
Aki Tuomi [Thu, 29 Aug 2019 09:25:07 +0000 (12:25 +0300)]
lib-dcrypt: Use correct variables names in RSA_set0_key
Broken in
79e9ccdc4a536f3881ec2b9304020514d1f92590
Aki Tuomi [Thu, 29 Aug 2019 09:24:42 +0000 (12:24 +0300)]
lib-dcrypt: Use ERR_R_PASSED_NULL_PARAMETER
It's the correct error and exists for older OpenSSL
Added in
79e9ccdc4a536f3881ec2b9304020514d1f92590
Aki Tuomi [Tue, 27 Aug 2019 07:09:30 +0000 (10:09 +0300)]
lib-dcrypt: Fix memory leak in raw key test
Aki Tuomi [Mon, 23 Jan 2017 12:56:54 +0000 (14:56 +0200)]
lib-dcrypt: Add unit tests for changes
Aki Tuomi [Mon, 23 Jan 2017 12:56:38 +0000 (14:56 +0200)]
dcrypt-openssl: Implement signature API for OpenSSL
Aki Tuomi [Mon, 23 Jan 2017 15:40:01 +0000 (17:40 +0200)]
lib-dcrypt: Add padding parameter for RSA encrypt/decrypt
Aki Tuomi [Mon, 23 Jan 2017 12:56:27 +0000 (14:56 +0200)]
lib-dcrypt: Add signature API
Aki Tuomi [Fri, 23 Aug 2019 09:34:54 +0000 (12:34 +0300)]
lib-dcrypt: Unit test for JWK keys
Aki Tuomi [Wed, 21 Aug 2019 13:16:22 +0000 (16:16 +0300)]
lib-dcrypt: Add JWK key format support
Aki Tuomi [Fri, 23 Aug 2019 08:51:45 +0000 (11:51 +0300)]
lib-dcrypt: Implement usage and key ID accessors for openssl
Aki Tuomi [Fri, 23 Aug 2019 07:42:09 +0000 (10:42 +0300)]
lib-dcrypt: Add key usage and id
These can be used for e.g. JWK keys.
Aki Tuomi [Fri, 23 Aug 2019 08:51:21 +0000 (11:51 +0300)]
lib-dcrypt: Add key id and usage fields to dcrypt keys
Simplifies next change
Aki Tuomi [Fri, 23 Aug 2019 09:27:23 +0000 (12:27 +0300)]
lib-dcrypt: Make key unref with NULL no-op
Aki Tuomi [Thu, 22 Aug 2019 11:28:17 +0000 (14:28 +0300)]
doveadm: Do not call dcrypt_deinitialize
It can break openssl
Aki Tuomi [Thu, 22 Aug 2019 10:58:52 +0000 (13:58 +0300)]
lib-dcrypt: Clarify when dcrypt_deinitialize is to be used
It should never be called if it's going to be used later on.
Aki Tuomi [Wed, 21 Aug 2019 13:15:57 +0000 (16:15 +0300)]
m4: Check if some RSA key manipulators are present
Needed for JWK
Aki Tuomi [Thu, 22 Aug 2019 15:43:11 +0000 (18:43 +0300)]
lib: hmac - Add hkdf for key derivation
Aki Tuomi [Sun, 25 Aug 2019 17:55:24 +0000 (20:55 +0300)]
lib-dcrypt: Use BN_secure_new when available for secrets
Aki Tuomi [Sun, 25 Aug 2019 17:54:12 +0000 (20:54 +0300)]
m4: Check for BN_secure_new
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.
Timo Sirainen [Fri, 17 May 2019 07:33:53 +0000 (10:33 +0300)]
lib-imap: Make sure str_unescape() won't be writing past allocated memory
The previous commit should already prevent this, but this makes sure it
can't become broken in the future either. It makes the performance a tiny
bit worse, but that's not practically noticeable.
Timo Sirainen [Fri, 10 May 2019 16:24:51 +0000 (19:24 +0300)]
lib-imap: Don't accept strings with NULs
IMAP doesn't allow NULs except in binary literals. We'll still allow them
in regular literals as well, but just not in strings.
This fixes a bug with unescaping a string with NULs: str_unescape() could
have been called for memory that points outside the allocated string,
causing heap corruption. This could cause crashes or theoretically even
result in remote code execution exploit.
Found by Nick Roessler and Rafi Rubin
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
Aki Tuomi [Wed, 21 Aug 2019 10:26:29 +0000 (13:26 +0300)]
lib-dcrypt: Implement dcrypt_key_get_curve_public using openssl
Aki Tuomi [Wed, 21 Aug 2019 10:25:33 +0000 (13:25 +0300)]
lib-dcrypt: Add dcrypt_key_get_curve_public
Returns name of the curve of public key
Aki Tuomi [Mon, 19 Aug 2019 19:40:02 +0000 (22:40 +0300)]
lib-dcrypt: Add tests for raw keys
Aki Tuomi [Mon, 19 Aug 2019 11:39:05 +0000 (14:39 +0300)]
lib-dcrypt: Implement raw key API using OpenSSL
Aki Tuomi [Mon, 19 Aug 2019 11:20:47 +0000 (14:20 +0300)]
lib-dcrypt: Add API for dealing with raw keys
Aki Tuomi [Fri, 23 Aug 2019 16:39:16 +0000 (19:39 +0300)]
lib-dcrypt: Fix i2d_ASN1_OBJECT usage
i2d_ASN1_OBJECT tells how much memory we need.
Aki Tuomi [Fri, 23 Aug 2019 10:48:03 +0000 (13:48 +0300)]
lib-dcrypt: Symbolize maximum OID length
Aki Tuomi [Fri, 23 Aug 2019 10:46:33 +0000 (13:46 +0300)]
lib-dcrypt: Use len instead of ln
Timo Sirainen [Mon, 19 Aug 2019 09:11:59 +0000 (12:11 +0300)]
lib-http: Make http_client_request_delay_from_response() public
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
Aki Tuomi [Tue, 2 Jul 2019 16:33:59 +0000 (19:33 +0300)]
index: Pass index sync flags to index view sync for pvt
When recovering from inconsistent view, this needs to
passed for pvt indexes too. Fixes
Error: dovecot.index.pvt reset, view is now inconsistent
Timo Sirainen [Fri, 16 Aug 2019 19:07:51 +0000 (22:07 +0300)]
push-notification: Allow easy access to Message-ID header
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()
Aki Tuomi [Mon, 19 Nov 2018 11:22:05 +0000 (13:22 +0200)]
auth: Drop postfix socketmap support
It no longer works with recent postfix versions, and it's too much work to fix
it.
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.
Stephan Bosch [Mon, 13 May 2019 22:33:28 +0000 (00:33 +0200)]
submission: Deny anonymous access to significant commands by default.
The transaction and individual recipients can be opened for allowed anonymous
access by flagging these as such.
Stephan Bosch [Fri, 9 Aug 2019 21:13:43 +0000 (23:13 +0200)]
submission: submission-client - Immediately terminate connection when it is an anonymous login.
Unless a plugin flags the client for allowed anonymous login.
Stephan Bosch [Fri, 9 Aug 2019 21:10:59 +0000 (23:10 +0200)]
lib-smtp: smtp-server-connection: Add smtp_server_connection_abort().
Provides a clean method to abort the connection before it is even started.
Stephan Bosch [Mon, 12 Aug 2019 20:10:24 +0000 (22:10 +0200)]
login-common: Deny anonymous login by default.
Only services that explicitly enable anonymous logins will permit them. Plugins
can also mask anonymous logins by dropping the anonymous reply flag in the
sasl_check_login() client vfunc.
Stephan Bosch [Mon, 12 Aug 2019 23:18:57 +0000 (01:18 +0200)]
login-common: sasl-server - Make sasl_server_auth_cancel() suitable for cancelling requests in login phase.
Stephan Bosch [Mon, 12 Aug 2019 21:33:11 +0000 (23:33 +0200)]
login-common: client-common - Add sasl_check_login() vfunc.
This allows checking the auth service success reply before commencing the actual
login.
Stephan Bosch [Fri, 9 Aug 2019 21:44:39 +0000 (23:44 +0200)]
login-common: sasl-server - Make private authentication mechanisms unavailable for normal authentication.
These mechanisms can only be used when the authentication is explicitly marked
as private.
Stephan Bosch [Wed, 7 Aug 2019 23:56:17 +0000 (01:56 +0200)]
login-common: sasl-server - Add means to filter the available SASL mechanisms.
This is accessible as a new client vfunc, so it can be used by protocol login
services and their plugins.
Stephan Bosch [Fri, 9 Aug 2019 21:27:21 +0000 (23:27 +0200)]
pop3-login: client - Use sasl_server_find_available_mech() instead of auth_client_find_mech().
Stephan Bosch [Fri, 9 Aug 2019 21:26:54 +0000 (23:26 +0200)]
imap-login: imap-login-client - Use sasl_server_find_available_mech() instead of auth_client_find_mech().
Stephan Bosch [Fri, 9 Aug 2019 21:22:01 +0000 (23:22 +0200)]
login-common: sasl-server - Add sasl_server_find_available_mech().
This is a wrapper for auth_client_find_mech(). This will be extended with
filtering in next commits.
Stephan Bosch [Wed, 7 Aug 2019 23:55:26 +0000 (01:55 +0200)]
submission-login: client.c - Use designated initializer for struct client_vfuncs.
Stephan Bosch [Wed, 7 Aug 2019 23:55:09 +0000 (01:55 +0200)]
pop3-login: client.c - Use designated initializer for struct client_vfuncs.
Stephan Bosch [Wed, 7 Aug 2019 23:54:26 +0000 (01:54 +0200)]
imap-urlauth: imap-urlauth-login.c - Use designated initializer for struct client_vfuncs.
Stephan Bosch [Wed, 7 Aug 2019 23:53:52 +0000 (01:53 +0200)]
imap-login: imap-login-client.c - Use designated initializer for struct client_vfuncs.
Stephan Bosch [Tue, 6 Aug 2019 20:09:53 +0000 (22:09 +0200)]
lib-storage: mail-user - Add auth_mech field to struct mail_user.
Stephan Bosch [Tue, 6 Aug 2019 20:08:54 +0000 (22:08 +0200)]
lib-storage: mail-storage-service - Parse "auth_mech" field from userdb extra fields.
Stephan Bosch [Mon, 12 Aug 2019 21:12:01 +0000 (23:12 +0200)]
login-common: sasl-server - Parse "anonymous" field in AUTH reply.
Stephan Bosch [Tue, 6 Aug 2019 19:52:23 +0000 (21:52 +0200)]
auth: auth-request-handler - Return "auth_mech" field in master REQUEST reply.
It contains the name of the mechanism used in the authentication.
Stephan Bosch [Mon, 12 Aug 2019 19:06:51 +0000 (21:06 +0200)]
auth: auth-request-handler - Return "anonymous" field for AUTH command that yields anonymous user.
Stephan Bosch [Fri, 9 Aug 2019 22:33:21 +0000 (00:33 +0200)]
login-common: Fix sending locally-generated authentication error reason to client.
This is about authentication errors that emerge at the login service rather than
the auth service. The error reason was always substituted with an unhelpful
"Authentication failed", while e.g. an error like "Unsupported authentication
mechanism" was supposed to be sent instead.
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 [Wed, 17 Jul 2019 08:53:39 +0000 (11:53 +0300)]
run-test-valgrind.supp: Add libunwind supression
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.