]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
5 years agologin-common: Include the proxy's source address in log messages
Josef 'Jeff' Sipek [Thu, 17 Sep 2020 19:43:02 +0000 (15:43 -0400)] 
login-common: Include the proxy's source address in log messages

5 years agologin-common: Move common client info logging into a helper function
Josef 'Jeff' Sipek [Thu, 17 Sep 2020 19:42:52 +0000 (15:42 -0400)] 
login-common: Move common client info logging into a helper function

5 years agologin-common: Add login_proxy_get_source_host() to get the local proxy hostname
Josef 'Jeff' Sipek [Thu, 17 Sep 2020 18:19:46 +0000 (14:19 -0400)] 
login-common: Add login_proxy_get_source_host() to get the local proxy hostname

5 years agologin-common: Heap allocate login source IPs array to avoid use-after-free
Josef 'Jeff' Sipek [Thu, 17 Sep 2020 14:45:44 +0000 (10:45 -0400)] 
login-common: Heap allocate login source IPs array to avoid use-after-free

By default, the service init code runs with a temporary datastack frame that
gets freed at the end of initialization to get rid of any temporary
allocations made during init before the long-running part of the process
executes.

5 years agoman: update doveadm-proxy man page with kick -h option.
sergey.kitov [Fri, 18 Sep 2020 11:55:27 +0000 (14:55 +0300)] 
man: update doveadm-proxy man page with kick -h option.

5 years agodoveadm: Implement proxy kick -h <host>
sergey.kitov [Tue, 15 Sep 2020 12:52:24 +0000 (15:52 +0300)] 
doveadm: Implement proxy kick -h <host>

5 years agologin-common: Implement kicking all user at backend host.
sergey.kitov [Tue, 15 Sep 2020 12:51:26 +0000 (15:51 +0300)] 
login-common: Implement kicking all user at backend host.

5 years agologin-common: change want_kick signature from (struct *client, ...) to (struct *login...
sergey.kitov [Thu, 17 Sep 2020 10:51:36 +0000 (13:51 +0300)] 
login-common: change want_kick signature from (struct *client, ...) to (struct *login_proxy, ...)

5 years agologin-common: Put proxy looping on stack in login_proxy_cmd_kick_full()
sergey.kitov [Fri, 25 Sep 2020 07:43:39 +0000 (10:43 +0300)] 
login-common: Put proxy looping on stack in login_proxy_cmd_kick_full()

5 years agolib-smtp: smtp-server-connection - Ignore replied command for pipeline limit calculation.
Stephan Bosch [Wed, 24 Jun 2020 09:20:25 +0000 (11:20 +0200)] 
lib-smtp: smtp-server-connection - Ignore replied command for pipeline limit calculation.

This prevents failed commands with payload from blocking the input pipeline. This caused a hang before.

5 years agolib-smtp: smtp-server-connection - Use connection settings for command pipeline limit.
Stephan Bosch [Wed, 24 Jun 2020 09:15:55 +0000 (11:15 +0200)] 
lib-smtp: smtp-server-connection - Use connection settings for command pipeline limit.

It used the top-level server settings before.

5 years agolib-smtp: smtp-server-connection - Move pipeline limit check to separate function.
Stephan Bosch [Wed, 24 Jun 2020 09:13:59 +0000 (11:13 +0200)] 
lib-smtp: smtp-server-connection - Move pipeline limit check to separate function.

5 years agolib-smtp: smtp-server-command - Always end input lock/capture upon reply submission.
Stephan Bosch [Wed, 24 Jun 2020 08:45:38 +0000 (10:45 +0200)] 
lib-smtp: smtp-server-command - Always end input lock/capture upon reply submission.

5 years agolib-smtp: smtp-server-command - Reliably end input capture in smtp_server_command_inp...
Stephan Bosch [Wed, 24 Jun 2020 08:42:17 +0000 (10:42 +0200)] 
lib-smtp: smtp-server-command - Reliably end input capture in smtp_server_command_input_unlock().

5 years agolib-storage: Rename mail_attachment_detection_options=add-flags-on-save to add-flags
Timo Sirainen [Thu, 17 Sep 2020 10:09:54 +0000 (13:09 +0300)] 
lib-storage: Rename mail_attachment_detection_options=add-flags-on-save to add-flags

Keep add-flags-on-save for backwards compatibility.

5 years agolib-storage: Try to add missing attachment flags when opening mail stream
Timo Sirainen [Thu, 3 Sep 2020 22:58:58 +0000 (01:58 +0300)] 
lib-storage: Try to add missing attachment flags when opening mail stream

Since the message body is being opened in any case, it's pretty inexpensive
to add missing attachment flags. Do this only when
mail_attachment_detection_options has add-flags-on-save but no
no-flags-on-fetch.

5 years agolib-storage: Try to add missing attachment flags when fetching MIME parts or BODYSTRU...
Timo Sirainen [Thu, 10 Sep 2020 13:38:11 +0000 (16:38 +0300)] 
lib-storage: Try to add missing attachment flags when fetching MIME parts or BODYSTRUCTURE

This happens only if both mime.parts and imap.bodystructure are already in
cache and mail_attachment_detection_options has add-flags-on-save but no
no-flags-on-fetch. The no-flags-on-fetch option may be removed in a future
release once it's known that it's not causing any unexpected performance
issues.

5 years agolib-storage: index_mail_get_cached_bodystructure() - Reorder the if statements
Timo Sirainen [Thu, 10 Sep 2020 13:36:14 +0000 (16:36 +0300)] 
lib-storage: index_mail_get_cached_bodystructure() - Reorder the if statements

Simplifies the following commit.

5 years agolib-storage: Avoid initializing stream multiple times recursively
Timo Sirainen [Thu, 10 Sep 2020 13:32:35 +0000 (16:32 +0300)] 
lib-storage: Avoid initializing stream multiple times recursively

This fixes the situation where stream opening causes it to be re-opened by
index_mail_parse_headers(). There are some other more rare situations, but
they're in error handling code paths.

5 years agolib-storage: Avoid caching size.physical unless it's explicitly asked for
Timo Sirainen [Thu, 10 Sep 2020 13:21:17 +0000 (16:21 +0300)] 
lib-storage: Avoid caching size.physical unless it's explicitly asked for

It's internally requested in a few places, but only as an optimization if
it happens to exist. It's not important enough that it should affect
caching decisions.

This change becomes more important after the following changes, which cause
size.physical to be added unnecessarily when filling out attachment flags.

5 years agolib-http: http-client-host - Do not prematurely reset ips_count to zero.
Stephan Bosch [Tue, 22 Sep 2020 18:00:17 +0000 (20:00 +0200)] 
lib-http: http-client-host - Do not prematurely reset ips_count to zero.

It causes problems with existing connection attempts.

Panic was:

Panic: file http-client-queue.c: line 215 (http_client_queue_is_last_connect_ip): assertion failed: (queue->ips_connect_idx < ips_count)

5 years agolib-http: http-client-host - Log debug message for failed DNS lookup.
Stephan Bosch [Wed, 23 Sep 2020 00:04:20 +0000 (02:04 +0200)] 
lib-http: http-client-host - Log debug message for failed DNS lookup.

If the host has no requests, nothing is logged about the failure otherwise.

5 years agolib-http: http-client-host - Move DNS lookup success handling to a common function.
Stephan Bosch [Tue, 22 Sep 2020 17:58:59 +0000 (19:58 +0200)] 
lib-http: http-client-host - Move DNS lookup success handling to a common function.

5 years agolib-http: Reformat http-client-host.c.
Stephan Bosch [Sun, 20 Sep 2020 22:38:11 +0000 (00:38 +0200)] 
lib-http: Reformat http-client-host.c.

5 years agolib-mail: html2text - Fix buffer out-of-bounds access
ihsinme [Mon, 28 Sep 2020 19:26:27 +0000 (15:26 -0400)] 
lib-mail: html2text - Fix buffer out-of-bounds access

The passed in buffer size is at least 1 byte shorter than the actual buffer
size, therefore there is no chance of a crash.

5 years agodict-sql: Fix crash if dict iteration is destroyed early
Timo Sirainen [Fri, 14 Aug 2020 21:56:36 +0000 (00:56 +0300)] 
dict-sql: Fix crash if dict iteration is destroyed early

If the iteration callback is still called after the iterator is freed, the
callback accesses freed memory and crashes.

5 years agolib-smtp: test-smtp-command-parser - Add tests for input ending in partial UTF-8...
Stephan Bosch [Fri, 11 Sep 2020 22:20:51 +0000 (00:20 +0200)] 
lib-smtp: test-smtp-command-parser - Add tests for input ending in partial UTF-8 sequences.

5 years agolib-smtp: test-smtp-command-parser - Test parsing commands from input that comes...
Stephan Bosch [Fri, 11 Sep 2020 22:19:14 +0000 (00:19 +0200)] 
lib-smtp: test-smtp-command-parser - Test parsing commands from input that comes in gradually.

5 years agolib-smtp: smtp-command-parser - Fix parameter parsing not to fail on particular unico...
Stephan Bosch [Fri, 11 Sep 2020 22:15:35 +0000 (00:15 +0200)] 
lib-smtp: smtp-command-parser - Fix parameter parsing not to fail on particular unicode code points.

Unicode code points were sometimes erroneously checked as ASCII characters.

5 years agolib-smtp: smtp-command-parser - Fix read past buffer limit while parsing UTF-8 character.
Stephan Bosch [Fri, 11 Sep 2020 19:53:06 +0000 (21:53 +0200)] 
lib-smtp: smtp-command-parser - Fix read past buffer limit while parsing UTF-8 character.

The buffer limit was specified as (buf->pos - buf->end) rather than (buf->end -
buf->pos). Since at most a valid UTF-8 character can be read beyond the buffer
size, this bug didn't cause noticeable effects, nor does it present an attack
surface.

5 years agolib-smtp: Reformat test-smtp-command-parser.c.
Stephan Bosch [Fri, 11 Sep 2020 21:54:29 +0000 (23:54 +0200)] 
lib-smtp: Reformat test-smtp-command-parser.c.

5 years agolib-smtp: Reformat smtp-command-parser.c.
Stephan Bosch [Fri, 11 Sep 2020 20:57:58 +0000 (22:57 +0200)] 
lib-smtp: Reformat smtp-command-parser.c.

5 years agolib-mail: message_parser_init_from_parts() - Fix crash if MIME boundaries don't end
Timo Sirainen [Mon, 31 Aug 2020 17:38:42 +0000 (20:38 +0300)] 
lib-mail: message_parser_init_from_parts() - Fix crash if MIME boundaries don't end

If the last "boundary--" doens't exist, the parsing assert-crashed at
deinit. This mainly happened when searching mails.

Fixes:
Panic: file message-parser.c: line 175 (message_part_finish): assertion failed: (ctx->nested_parts_count > 0)

5 years agoacl: Ignore acl_object_list_deinit() error when copying ACLs from parent
Timo Sirainen [Fri, 28 Aug 2020 15:35:00 +0000 (18:35 +0300)] 
acl: Ignore acl_object_list_deinit() error when copying ACLs from parent

There's already a FIXME, and this makes static analyzer happier.

5 years agodirector: Explicitly ignore array_bsearch_insert_pos() return value
Timo Sirainen [Thu, 13 Aug 2020 08:38:07 +0000 (11:38 +0300)] 
director: Explicitly ignore array_bsearch_insert_pos() return value

Makes static analyzers happier.

5 years agolib: test-istream - Check or explicitly ignore i_stream_read() return value
Timo Sirainen [Thu, 13 Aug 2020 08:29:38 +0000 (11:29 +0300)] 
lib: test-istream - Check or explicitly ignore i_stream_read() return value

Makes static analyzers happier.

5 years agolib-ssl-iostream: Fix error message with invalid ciphersuites
Timo Sirainen [Wed, 12 Aug 2020 08:05:55 +0000 (11:05 +0300)] 
lib-ssl-iostream: Fix error message with invalid ciphersuites

The error message contained curve_list's value, not ciphersuites' value.

5 years agolib-compression: test-compression - Fix memory leak
Timo Sirainen [Mon, 14 Sep 2020 14:44:58 +0000 (17:44 +0300)] 
lib-compression: test-compression - Fix memory leak

5 years agolib: Add a comment about o_stream_create_buffer()
Timo Sirainen [Mon, 14 Sep 2020 07:37:16 +0000 (10:37 +0300)] 
lib: Add a comment about o_stream_create_buffer()

5 years agolib: ostream-buffer - Revert returning 0 as used buffer size
Timo Sirainen [Mon, 14 Sep 2020 07:28:41 +0000 (10:28 +0300)] 
lib: ostream-buffer - Revert returning 0 as used buffer size

This change broke at least one external plugin that assumed the original
behavior. Safer to just revert this change.

Reverts 48083d9e7fdbe257b0be33043ecf0ca87489eef9

5 years agolib-compression: test-compression - Convert from ostream-buffer to iostream-temp
Timo Sirainen [Mon, 14 Sep 2020 07:27:26 +0000 (10:27 +0300)] 
lib-compression: test-compression - Convert from ostream-buffer to iostream-temp

Using ostream-buffer required 48083d9e7fdbe257b0be33043ecf0ca87489eef9
change, but this broke some code that assumed the original behavior.

5 years agolib-compression: test-compression - Use datastack in test
Aki Tuomi [Fri, 11 Sep 2020 20:28:47 +0000 (23:28 +0300)] 
lib-compression: test-compression - Use datastack in test

Plugs a memory leak.

Broken in 60b4040ba498ce7b19fc8b189d327cc606856f07

5 years agolib-fs: test-fs-async - Fix to work properly after previous changes
Timo Sirainen [Fri, 11 Sep 2020 11:29:14 +0000 (14:29 +0300)] 
lib-fs: test-fs-async - Fix to work properly after previous changes

It's an async test, so it should expect that the fs actually behaves
asynchronously.

5 years agolib-dict: dict_switch_ioloop() - Move also failure timeout
Timo Sirainen [Fri, 11 Sep 2020 11:28:11 +0000 (14:28 +0300)] 
lib-dict: dict_switch_ioloop() - Move also failure timeout

Forgotten in 178bb676ea1dd380789d3587bf5e64fd85a29d7a

5 years agostats: event exporter - Use category exporting helper to avoid duplicates (tabtext)
Josef 'Jeff' Sipek [Fri, 21 Aug 2020 18:31:12 +0000 (14:31 -0400)] 
stats: event exporter - Use category exporting helper to avoid duplicates (tabtext)

5 years agostats: event exporter - Use category exporting helper to avoid duplicates (json)
Josef 'Jeff' Sipek [Fri, 21 Aug 2020 18:23:50 +0000 (14:23 -0400)] 
stats: event exporter - Use category exporting helper to avoid duplicates (json)

5 years agostats: Add helper to append category names without duplicates
Josef 'Jeff' Sipek [Fri, 21 Aug 2020 18:23:14 +0000 (14:23 -0400)] 
stats: Add helper to append category names without duplicates

5 years agolib: net_listen|connect_unix() - Use consistent error handling for too long paths
Timo Sirainen [Fri, 28 Aug 2020 15:36:47 +0000 (18:36 +0300)] 
lib: net_listen|connect_unix() - Use consistent error handling for too long paths

The errno should be the same for both functions. Prefer ENAMETOOLONG if it
exists on the OS, otherwise fallback to EOVERFLOW.

5 years agolib-dict: dict - Keep track of next commit in dict_wait
Aki Tuomi [Fri, 11 Sep 2020 05:22:11 +0000 (08:22 +0300)] 
lib-dict: dict - Keep track of next commit in dict_wait

Satisfies static analyser, broken in
178bb676ea1dd380789d3587bf5e64fd85a29d7a

5 years agolib-dict: dict - Ensure there are no commits during deinit
Aki Tuomi [Thu, 10 Sep 2020 14:56:49 +0000 (17:56 +0300)] 
lib-dict: dict - Ensure there are no commits during deinit

5 years agolib-dict: dict - Allow calling callback immediately
Aki Tuomi [Thu, 10 Sep 2020 14:43:06 +0000 (17:43 +0300)] 
lib-dict: dict - Allow calling callback immediately

Make callback calls the next callback immediately,
instead of adding a timeout that calls the callback.

Forgotten in 178bb676ea1dd380789d3587bf5e64fd85a29d7a

5 years agolib-dict: dict - Change background to delayed_callback
Aki Tuomi [Thu, 10 Sep 2020 14:42:19 +0000 (17:42 +0300)] 
lib-dict: dict - Change background to delayed_callback

It better describes what it's intended to do.

5 years agoacl: Add unit test for acl_rights_sort()
Timo Sirainen [Wed, 12 Aug 2020 12:48:14 +0000 (15:48 +0300)] 
acl: Add unit test for acl_rights_sort()

5 years agoacl: acl_rights_sort() - Handle zero sized rights array properly
Timo Sirainen [Wed, 12 Aug 2020 12:46:31 +0000 (15:46 +0300)] 
acl: acl_rights_sort() - Handle zero sized rights array properly

Fixes ubsan complaint about count-dest wrapping to negative.
The array code handled this properly though, so nothing was broken.

5 years agolib: test-file-cache - Add tests for file-cache
Aki Tuomi [Tue, 1 Sep 2020 06:13:05 +0000 (09:13 +0300)] 
lib: test-file-cache - Add tests for file-cache

5 years agolib: log-throttle - Initialize last_throttle
Aki Tuomi [Thu, 20 Aug 2020 13:47:12 +0000 (16:47 +0300)] 
lib: log-throttle - Initialize last_throttle

It's compared to ioloop_timeval later on and would
produce overflow there.

5 years agoquota: quota_free_bytes - Check we don't decrease more than INT64_MAX
Aki Tuomi [Thu, 20 Aug 2020 13:24:41 +0000 (16:24 +0300)] 
quota: quota_free_bytes - Check we don't decrease more than INT64_MAX

Otherwise we get overflow

5 years agolib: file-dotlock - Do not call callback if we are going to timeout
Aki Tuomi [Thu, 20 Aug 2020 09:46:06 +0000 (12:46 +0300)] 
lib: file-dotlock - Do not call callback if we are going to timeout

5 years agolib-mail: istream-header-filter - Avoid unsigned overflow in last_offset calculation
Aki Tuomi [Thu, 20 Aug 2020 07:55:36 +0000 (10:55 +0300)] 
lib-mail: istream-header-filter - Avoid unsigned overflow in last_offset calculation

Unsigned integer overflow occurs when size is 0.

5 years agolib-ldap: ldap_connection_send_next - Extract next message in separate function
Aki Tuomi [Thu, 20 Aug 2020 07:37:54 +0000 (10:37 +0300)] 
lib-ldap: ldap_connection_send_next - Extract next message in separate function

5 years agolib-storage: index-mail-headers - Avoid unsigned overflow on header_match_value
Aki Tuomi [Thu, 20 Aug 2020 07:31:41 +0000 (10:31 +0300)] 
lib-storage: index-mail-headers - Avoid unsigned overflow on header_match_value

5 years agoimap: imap-sync - Avoid unsigned integer overflow
Aki Tuomi [Thu, 20 Aug 2020 06:53:11 +0000 (09:53 +0300)] 
imap: imap-sync - Avoid unsigned integer overflow

Error: imap-sync.c:433:17: runtime error: unsigned integer overflow:
4294967295 + 1 cannot be represented in type 'unsigned int'

5 years agolib-mail: test-istream-attachment - Avoid unsigned overflow in size calculation
Aki Tuomi [Thu, 20 Aug 2020 06:44:58 +0000 (09:44 +0300)] 
lib-mail: test-istream-attachment - Avoid unsigned overflow in size calculation

5 years agolib: var-expand - Avoid unsigned overflow in offset calculation
Aki Tuomi [Thu, 20 Aug 2020 06:44:20 +0000 (09:44 +0300)] 
lib: var-expand - Avoid unsigned overflow in offset calculation

5 years agolib: time-util - Use correct data types
Aki Tuomi [Thu, 20 Aug 2020 06:43:35 +0000 (09:43 +0300)] 
lib: time-util - Use correct data types

5 years agoquota: quota-imapc - Handle quota limits better
Aki Tuomi [Thu, 20 Aug 2020 06:34:40 +0000 (09:34 +0300)] 
quota: quota-imapc - Handle quota limits better

If quota limit is bigger than INT64_MAX, it's unlimited
as we cannot express this anyways.

5 years agolib-mail: message-parser - Change last_chr to unsigned char
Aki Tuomi [Thu, 20 Aug 2020 06:10:36 +0000 (09:10 +0300)] 
lib-mail: message-parser - Change last_chr to unsigned char

Matches code usage.

5 years agolib-imap-storage: imap-msgpart - Fix constant type
Aki Tuomi [Thu, 20 Aug 2020 06:02:07 +0000 (09:02 +0300)] 
lib-imap-storage: imap-msgpart - Fix constant type

5 years agoauth: password-scheme - Fix salt generation data type mess
Aki Tuomi [Thu, 20 Aug 2020 05:47:16 +0000 (08:47 +0300)] 
auth: password-scheme - Fix salt generation data type mess

Satisfies runtime analyser

5 years agoauth: mech-scram - Use correct data type for proof calculation
Aki Tuomi [Thu, 20 Aug 2020 05:44:45 +0000 (08:44 +0300)] 
auth: mech-scram - Use correct data type for proof calculation

Satisfies runtime analyzer

5 years agolib: Remove istream-mmap.c
Aki Tuomi [Mon, 31 Aug 2020 13:15:15 +0000 (16:15 +0300)] 
lib: Remove istream-mmap.c

Nothing uses it.

5 years agolib-ntlm: Ensure data_size is large enough for buffer
Aki Tuomi [Mon, 31 Aug 2020 07:33:05 +0000 (10:33 +0300)] 
lib-ntlm: Ensure data_size is large enough for buffer

5 years agolib-ntlm: Use CONST_PTR_OFFSET
Aki Tuomi [Thu, 13 Aug 2020 06:48:27 +0000 (09:48 +0300)] 
lib-ntlm: Use CONST_PTR_OFFSET

5 years agoauth, lib-ntlm: Use dovecot byteorder functions
Aki Tuomi [Thu, 13 Aug 2020 06:46:37 +0000 (09:46 +0300)] 
auth, lib-ntlm: Use dovecot byteorder functions

5 years agolib: buffer - Assert that we don't try to allocate SIZE_MAX buffer
Aki Tuomi [Tue, 11 Aug 2020 06:00:17 +0000 (09:00 +0300)] 
lib: buffer - Assert that we don't try to allocate SIZE_MAX buffer

Only if devel checks are enabled

5 years agolib-ssl-iostream: ostream-openssl - Allocate at most IO_BLOCK_SIZE initial buffer
Aki Tuomi [Tue, 11 Aug 2020 05:45:37 +0000 (08:45 +0300)] 
lib-ssl-iostream: ostream-openssl - Allocate at most IO_BLOCK_SIZE initial buffer

Otherwise we might attempt to allocate way too large buffers. This has not caused
issues yet, except with max_buffer_size=SIZE_T, which has been causing us to allocate
0-sized buffers.

5 years agoauth: auth-cache - Data is not 4 bytes but variable sized
Aki Tuomi [Mon, 10 Aug 2020 16:54:51 +0000 (19:54 +0300)] 
auth: auth-cache - Data is not 4 bytes but variable sized

5 years agolib-otp: Use for-loop instead while
Aki Tuomi [Thu, 13 Aug 2020 08:41:23 +0000 (11:41 +0300)] 
lib-otp: Use for-loop instead while

Avoids unsigned integer wrap

5 years agolib-compression: istream-zstd - Handle signed/unsigned return values correctly
Aki Tuomi [Thu, 13 Aug 2020 08:40:35 +0000 (11:40 +0300)] 
lib-compression: istream-zstd - Handle signed/unsigned return values correctly

5 years agolib: lib-event - Use for-loop in copying categories
Aki Tuomi [Thu, 13 Aug 2020 08:39:59 +0000 (11:39 +0300)] 
lib: lib-event - Use for-loop in copying categories

Avoids unsigned integer wrap

5 years agoglobal: Use i_rand_limit(limit) instead of i_rand() % limit
Aki Tuomi [Wed, 19 Aug 2020 10:55:18 +0000 (13:55 +0300)] 
global: Use i_rand_limit(limit) instead of i_rand() % limit

spatch with coccinelle/random-misuse.cocci

5 years agolib: Use i_rand_limit() helpers
Aki Tuomi [Wed, 19 Aug 2020 11:01:50 +0000 (14:01 +0300)] 
lib: Use i_rand_limit() helpers

5 years agolib: test-base32/64 - Use unsigned char
Aki Tuomi [Wed, 19 Aug 2020 11:00:03 +0000 (14:00 +0300)] 
lib: test-base32/64 - Use unsigned char

Simplifies next change

5 years agolib: Add some helpers for random values
Aki Tuomi [Wed, 19 Aug 2020 16:49:38 +0000 (19:49 +0300)] 
lib: Add some helpers for random values

5 years agolib: Document how i_rand_limit() ensures uniform distribution
Josef 'Jeff' Sipek [Wed, 19 Aug 2020 18:33:59 +0000 (14:33 -0400)] 
lib: Document how i_rand_limit() ensures uniform distribution

This algorithm is not original, but it is dense enough that a detailed
explanation is in order.

5 years agolib: rand - Fix random number bounding
Aki Tuomi [Thu, 13 Aug 2020 08:35:17 +0000 (11:35 +0300)] 
lib: rand - Fix random number bounding

5 years agoauth: password-scheme - Use generate_salt in md5crypt
Aki Tuomi [Tue, 11 Aug 2020 05:48:09 +0000 (08:48 +0300)] 
auth: password-scheme - Use generate_salt in md5crypt

Deduplicates code

5 years agolib-sql: driver-cassandra - Add SSL options
Aki Tuomi [Sun, 23 Aug 2020 20:24:35 +0000 (23:24 +0300)] 
lib-sql: driver-cassandra - Add SSL options

ssl_ca=<path>: Sets trusted peer certificate filename
ssl_cert=<path>: Sets client certificate filename
sl_key=<path>: Sets client certificate private key filename
ssl_key_password=<string>: Sets password for private key
ssl_verify=none | cert | cert-ip | cert-dns: Sets verify mode
 * none = don't verify
 * cert = verify certificate
 * cert-ip = verify IP from CN or SubjectAltName
 * cert-dns = verify hostname from CN or SubjectAltName

5 years agolib: buffer - Add buffer_append_full_(file|istream)
Aki Tuomi [Sun, 23 Aug 2020 20:05:33 +0000 (23:05 +0300)] 
lib: buffer - Add buffer_append_full_(file|istream)

Consume istream or file up to max_read_size or EOF.

5 years agom4: want_cassandra.m4 - Add check for CASS_SSL_VERIFY_PEER_IDENTITY_DNS
Aki Tuomi [Sun, 23 Aug 2020 19:24:07 +0000 (22:24 +0300)] 
m4: want_cassandra.m4 - Add check for CASS_SSL_VERIFY_PEER_IDENTITY_DNS

5 years agom4: want_cassandra.m4 - Add check for cass_cluster_set_use_hostname_resolution
Aki Tuomi [Sun, 23 Aug 2020 19:06:50 +0000 (22:06 +0300)] 
m4: want_cassandra.m4 - Add check for cass_cluster_set_use_hostname_resolution

5 years agom4: Modernize want_cassandra.m4
Aki Tuomi [Sun, 23 Aug 2020 19:06:34 +0000 (22:06 +0300)] 
m4: Modernize want_cassandra.m4

5 years agolib-sql: driver-cassandra - Use INTx_MIN and INTx_MAX
Aki Tuomi [Fri, 28 Aug 2020 10:17:10 +0000 (13:17 +0300)] 
lib-sql: driver-cassandra - Use INTx_MIN and INTx_MAX

Preferred over magic numbers

5 years agolib-sql: Reformat driver-cassandra.c
Aki Tuomi [Fri, 28 Aug 2020 10:13:32 +0000 (13:13 +0300)] 
lib-sql: Reformat driver-cassandra.c

5 years agolib-compression: Add unit test to compress large input
Timo Sirainen [Wed, 9 Sep 2020 09:08:38 +0000 (12:08 +0300)] 
lib-compression: Add unit test to compress large input

This catches earlier zstd and lzma bugs.

5 years agolib-compression: ostream-lzma - Compressed output could have been truncated
Timo Sirainen [Wed, 9 Sep 2020 10:00:44 +0000 (13:00 +0300)] 
lib-compression: ostream-lzma - Compressed output could have been truncated

The compression wasn't fully finished, resulting in truncated compressed
output that couldn't be fully read back. Reading would result in "Broken
pipe" errors.

Broken by 6080aa16e1bd50cd661acc31203d9f4986a9450a

5 years agolib-compression: istream-lzma - Improve error messages in EOF handling
Timo Sirainen [Wed, 9 Sep 2020 09:48:39 +0000 (12:48 +0300)] 
lib-compression: istream-lzma - Improve error messages in EOF handling

5 years agolib-compression: istream-lzma - Fix EOF handling
Timo Sirainen [Wed, 9 Sep 2020 09:46:51 +0000 (12:46 +0300)] 
lib-compression: istream-lzma - Fix EOF handling

lzma_stream_end() call was accidentally dropped by
c6248b825d8c6562b1320e51ad0d88e99b9fbe85

This (probably) didn't result in visible problems.

5 years agolib-compression: ostream-zstd - Fix assert-crash with large input
Timo Sirainen [Tue, 8 Sep 2020 18:19:21 +0000 (21:19 +0300)] 
lib-compression: ostream-zstd - Fix assert-crash with large input

If the input was large enough, the ostream write could have returned
partially written output. Since this ostream-zstd was only used for
blocking ostreams, this would always result in an assert-crash. Fix is
to keep flushing the output to parent if the output buffer becomes full.

Fixes:
Panic: file ostream.c: line 287 (o_stream_sendv_int): assertion failed: (!stream->blocking)

5 years agolib: ostream-buffer: Return 0 as the used size, not the destination buffer size
Timo Sirainen [Wed, 9 Sep 2020 09:03:31 +0000 (12:03 +0300)] 
lib: ostream-buffer: Return 0 as the used size, not the destination buffer size

This allows using ostream-buffer in places that previously would think that
the ostream buffer needed to be flushed because its buffer size was too
large.

This also changes o_stream_get_buffer_avail_size() to always return the
ostream max buffer size.