]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
7 years agolib: Add restrict_access_flags enum to use with restrict_access[_by_env]()
Martti Rannanjärvi [Fri, 29 Sep 2017 10:40:12 +0000 (13:40 +0300)] 
lib: Add restrict_access_flags enum to use with restrict_access[_by_env]()

Swap parameter locations in the functions to make sure plugins are
updated to use the new api.

7 years agolib: Flip drop_setuid_root in restrict_access_settings
Martti Rannanjärvi [Mon, 18 Dec 2017 09:35:27 +0000 (11:35 +0200)] 
lib: Flip drop_setuid_root in restrict_access_settings

7 years agolib-program-client: Remove extra drop_setuid_root flag copy
Martti Rannanjärvi [Mon, 18 Dec 2017 10:44:14 +0000 (12:44 +0200)] 
lib-program-client: Remove extra drop_setuid_root flag copy

7 years agolib-program-client: Run local client tests with valgrind --trace-children=no.
Stephan Bosch [Fri, 2 Feb 2018 17:35:49 +0000 (18:35 +0100)] 
lib-program-client: Run local client tests with valgrind --trace-children=no.

Before, valgrind was omitted entirely.

7 years agoAdd support for running valgrind tests with --trace-children=no.
Stephan Bosch [Fri, 2 Feb 2018 17:33:49 +0000 (18:33 +0100)] 
Add support for running valgrind tests with --trace-children=no.

7 years agolib-program-client: test-program-client-local: Properly deallocate all streams for...
Stephan Bosch [Fri, 2 Feb 2018 17:37:23 +0000 (18:37 +0100)] 
lib-program-client: test-program-client-local: Properly deallocate all streams for big I/O test.

7 years agoauth: Set correct context type when bypassing reporting in auth_success
Aki Tuomi [Mon, 12 Feb 2018 10:28:37 +0000 (12:28 +0200)] 
auth: Set correct context type when bypassing reporting in auth_success

Broken in 41ff6e6a4a085786d4c15a58c7c50a28e2110c3f

7 years agoglobal: Set extra_groups=$default_internal_group for various services
Timo Sirainen [Wed, 7 Feb 2018 14:31:12 +0000 (16:31 +0200)] 
global: Set extra_groups=$default_internal_group for various services

Services with user=$default_internal_user are expected to already set the
group properly. This change is adding the group for mail processes.

7 years agolib: restrict_access_by_env() - Preserve RESTRICT_SETEXTRAGROUPS if root isn't dropped
Timo Sirainen [Wed, 7 Feb 2018 14:00:46 +0000 (16:00 +0200)] 
lib: restrict_access_by_env() - Preserve RESTRICT_SETEXTRAGROUPS if root isn't dropped

This way service { extra_groups } is preserved for the whole duration of the
process lifetime (e.g. lmtp, doveadm)

7 years agoimap-hibernate: Change imap-hibernate default socket permissions to allow default_int...
Timo Sirainen [Wed, 7 Feb 2018 11:06:06 +0000 (13:06 +0200)] 
imap-hibernate: Change imap-hibernate default socket permissions to allow default_internal_group

It would be enough to allow only imap processes access to it, but it
shouldn't really harm to allow other processes access to it also.

7 years agostats: Change stats-writer default socket permissions to allow default_internal_group
Timo Sirainen [Wed, 7 Feb 2018 11:05:09 +0000 (13:05 +0200)] 
stats: Change stats-writer default socket permissions to allow default_internal_group

It's important that all dovecot processes can send statistics to the stats
process.

7 years agodict: Change dict and dict-async default socket permissions to allow default_internal...
Timo Sirainen [Wed, 7 Feb 2018 11:04:03 +0000 (13:04 +0200)] 
dict: Change dict and dict-async default socket permissions to allow default_internal_group

Many mail processes need to talk to dict. This makes it easier to enable
dict without having to configure permissions.

7 years agomaster: Add default_internal_group setting, defaulting to "dovecot"
Timo Sirainen [Wed, 7 Feb 2018 11:03:23 +0000 (13:03 +0200)] 
master: Add default_internal_group setting, defaulting to "dovecot"

It's expected that this is the primary group of the default_internal_user.

This group will be used to provide access to sockets that are generally
required by all Dovecot processes, but aren't safe enough to be allowed
completely open access from untrusted processes.

7 years agoauth: Support standard auth variables in LDAP subqueries
Aki Tuomi [Thu, 8 Feb 2018 13:45:55 +0000 (15:45 +0200)] 
auth: Support standard auth variables in LDAP subqueries

7 years agoold-stats: Set process dumpable during stats gathering
Aki Tuomi [Thu, 8 Feb 2018 11:04:48 +0000 (13:04 +0200)] 
old-stats: Set process dumpable during stats gathering

/proc/self/io is not accessible otherwise

7 years agolib: Add restrict_access_get/set_dumpable
Aki Tuomi [Thu, 8 Feb 2018 11:03:37 +0000 (13:03 +0200)] 
lib: Add restrict_access_get/set_dumpable

7 years agolib: Clarify restrict_access_allow_coredumps
Aki Tuomi [Thu, 8 Feb 2018 11:01:50 +0000 (13:01 +0200)] 
lib: Clarify restrict_access_allow_coredumps

7 years agoconfig: Fix ssl_params.dat conversion warning
Aki Tuomi [Thu, 8 Feb 2018 13:34:53 +0000 (15:34 +0200)] 
config: Fix ssl_params.dat conversion warning

The command is dhparam, not dh.

7 years agolib-http: client: Fix using non-context SSL settings
Timo Sirainen [Thu, 8 Feb 2018 11:27:25 +0000 (13:27 +0200)] 
lib-http: client: Fix using non-context SSL settings

The SSL settings were used for the SSL context, but they weren't used for
individual SSL streams. This broke stream-only settings, like
allow_invalid_cert=TRUE.

7 years agoipc: Change ipc socket's owner to $default_internal_user
Timo Sirainen [Wed, 7 Feb 2018 14:48:28 +0000 (16:48 +0200)] 
ipc: Change ipc socket's owner to $default_internal_user

This is mainly used by director process, which runs as
$default_internal_user. This setting change is always required for director
installations. Also the ipc process itself is already running as
$default_internal_user so this should be a rather safe change.

7 years agolib-ssl-iostream: Assert-crash if input stream has IO already set
Timo Sirainen [Thu, 8 Feb 2018 00:26:23 +0000 (02:26 +0200)] 
lib-ssl-iostream: Assert-crash if input stream has IO already set

7 years agolib: Add i_stream_get_root_io() and use it to deduplicate code
Timo Sirainen [Thu, 8 Feb 2018 00:22:18 +0000 (02:22 +0200)] 
lib: Add i_stream_get_root_io() and use it to deduplicate code

7 years agolib-smtp: Recreate connection IO after streams change
Timo Sirainen [Thu, 8 Feb 2018 08:53:50 +0000 (10:53 +0200)] 
lib-smtp: Recreate connection IO after streams change

This fixes hangs after STARTTLS.

Originally by Stephan Bosch

7 years agolib: Add connection_streams_changed()
Timo Sirainen [Thu, 8 Feb 2018 08:52:57 +0000 (10:52 +0200)] 
lib: Add connection_streams_changed()

Originally by Stephan Bosch

7 years agodoveadm: client: Set IO only after enabling SSL
Timo Sirainen [Thu, 8 Feb 2018 00:38:23 +0000 (02:38 +0200)] 
doveadm: client: Set IO only after enabling SSL

io_add_istream() needs to be used with the SSL istream, otherwise it can
cause hangs.

7 years agolib-imap-client: Fix IO after enabling SSL
Timo Sirainen [Thu, 8 Feb 2018 00:28:54 +0000 (02:28 +0200)] 
lib-imap-client: Fix IO after enabling SSL

io_add_istream() needs to be used with the SSL istream, otherwise it can
cause hangs.

7 years agodsync: Log a warning if copying a mail fails unexpectedly
Timo Sirainen [Thu, 1 Feb 2018 21:04:12 +0000 (23:04 +0200)] 
dsync: Log a warning if copying a mail fails unexpectedly

Don't log a warning if it happens because the source message was expunged.
That's an expected failure.

7 years agolib-storage: Lock mailbox_list for mailbox create/delete/rename
Timo Sirainen [Tue, 9 Jan 2018 20:37:25 +0000 (15:37 -0500)] 
lib-storage: Lock mailbox_list for mailbox create/delete/rename

This is only required for mailbox creation to fix a race condition with
LAYOUT=index: If INBOX doesn't exist it will rescan the mailboxes to
find out if there are any missing ones. If INBOX creation isn't locked,
it's possible that the first process hasn't finished creating INBOX
before the second process find it and attempts to open it.

The delete and rename locking are probably useful to guard against race
conditions when clients intentionally issues create/delete/rename commands
concurrently.

7 years agolib-storage: Add mailbox_list_[un]lock()
Timo Sirainen [Tue, 9 Jan 2018 20:36:58 +0000 (15:36 -0500)] 
lib-storage: Add mailbox_list_[un]lock()

7 years agolib-storage: mailbox_delete() - Fix cleanup in error handling
Timo Sirainen [Tue, 9 Jan 2018 20:35:13 +0000 (15:35 -0500)] 
lib-storage: mailbox_delete() - Fix cleanup in error handling

If removing index deletion mark failed, box->deleting wasn't set to FALSE
and the mailbox was left opened.

7 years agolib-storage: mailbox_rename() - Use source storage for errors
Timo Sirainen [Tue, 9 Jan 2018 20:33:26 +0000 (15:33 -0500)] 
lib-storage: mailbox_rename() - Use source storage for errors

It was documented to use source storage for errors, but some of the errors
were set to destination storage.

7 years agolib-storage: Fix mailbox rename checking child mailbox name lengths
Timo Sirainen [Fri, 2 Feb 2018 16:07:43 +0000 (18:07 +0200)] 
lib-storage: Fix mailbox rename checking child mailbox name lengths

It was supposed to prevent allowing renames that would cause any child
mailbox name to be too long. However, the check wasn't working.

7 years agofs-posix: Fix iterating directories when readdir() returns DT_UNKNOWN
Timo Sirainen [Tue, 6 Feb 2018 10:37:34 +0000 (12:37 +0200)] 
fs-posix: Fix iterating directories when readdir() returns DT_UNKNOWN

Files were iterated correctly, but directories weren't. This mainly broke
directory iteration with NFS when nordirplus mount option was used.

7 years agoreplication: Don't send notification for changes done by dsync transactions
Timo Sirainen [Tue, 6 Feb 2018 13:12:26 +0000 (15:12 +0200)] 
replication: Don't send notification for changes done by dsync transactions

7 years agolib-storage: Set mailbox_transaction_context.flags earlier
Timo Sirainen [Tue, 6 Feb 2018 13:10:48 +0000 (15:10 +0200)] 
lib-storage: Set mailbox_transaction_context.flags earlier

Set it in index_transaction_init() so plugins' transaction_begin() methods
see it after calling super.transaction_begin().

7 years agocassandra: Make sure timestamp is always logged (if set) with debug_queries=y
Timo Sirainen [Wed, 7 Feb 2018 13:28:45 +0000 (15:28 +0200)] 
cassandra: Make sure timestamp is always logged (if set) with debug_queries=y

It wasn't logged in some code paths.

7 years agocassandra: Fix setting timestamp for transaction queries with v3 protocol
Timo Sirainen [Wed, 7 Feb 2018 13:27:07 +0000 (15:27 +0200)] 
cassandra: Fix setting timestamp for transaction queries with v3 protocol

It was working for prepared statements, but not for non-prepared statements.

7 years agolib-index: Fix assert-crash with lock_method=dotlock
Timo Sirainen [Wed, 7 Feb 2018 14:17:13 +0000 (16:17 +0200)] 
lib-index: Fix assert-crash with lock_method=dotlock

The dotlock wasn't deleted in all code paths. Fix this by simplifying
the unlocking to be done the same way with and without dotlock.

Fixes:
Panic: file mail-cache.c: line 624 (mail_cache_lock_file): assertion failed: (cache->dotlock == NULL)

7 years agoauth: Add policy check configuration options
Aki Tuomi [Tue, 6 Feb 2018 07:48:11 +0000 (09:48 +0200)] 
auth: Add policy check configuration options

Allows disabling before/after auth checks, or reporting.

7 years agoauth: Use correct username is auth policy requests
Aki Tuomi [Mon, 5 Feb 2018 12:26:15 +0000 (14:26 +0200)] 
auth: Use correct username is auth policy requests

When doing master authentication as first, use
the username of the user, not master user, for policy lookup.

7 years agolib-storage: mail_storage_lock_create() - add support for dotlocks
Timo Sirainen [Tue, 6 Feb 2018 16:01:04 +0000 (18:01 +0200)] 
lib-storage: mail_storage_lock_create() - add support for dotlocks

7 years agolib-storage: Change mail_user_lock_file_create() to use mail_storage_lock_create()
Timo Sirainen [Tue, 6 Feb 2018 15:49:15 +0000 (17:49 +0200)] 
lib-storage: Change mail_user_lock_file_create() to use mail_storage_lock_create()

7 years agolib-storage: Add mail_storage_lock_create()
Timo Sirainen [Tue, 6 Feb 2018 15:47:37 +0000 (17:47 +0200)] 
lib-storage: Add mail_storage_lock_create()

This is split off of mailbox_lock_file_create().

7 years agolib: Add file_lock_from_dotlock()
Timo Sirainen [Tue, 6 Feb 2018 15:35:18 +0000 (17:35 +0200)] 
lib: Add file_lock_from_dotlock()

The dotlock creation requires various settings, so the file-lock.h API can't
easily be used to create it. But once created, it's simpler to keep all lock
types in the same struct file_lock, which can be unlocked/freed once
finished.

7 years agolib: time-util: Fix timeval_cmp_margin() to correctly handle a margin crossing the...
Stephan Bosch [Tue, 6 Feb 2018 14:50:19 +0000 (15:50 +0100)] 
lib: time-util: Fix timeval_cmp_margin() to correctly handle a margin crossing the second boundary.

The timeval_cmp_margin() function incorrectly assumed that the margin is
irrelevent when the tv_sec values are different.

7 years agolib: test-time-util: Put all test data for timeval_cmp() test in a single struct...
Stephan Bosch [Tue, 6 Feb 2018 15:51:23 +0000 (16:51 +0100)] 
lib: test-time-util: Put all test data for timeval_cmp() test in a single struct array.

7 years agofts: Don't reindex FTS mails if .cache file is deleted
Timo Sirainen [Mon, 5 Feb 2018 20:21:13 +0000 (22:21 +0200)] 
fts: Don't reindex FTS mails if .cache file is deleted

This means that if fts is enabled, "doveadm index" no longer adds mails
to dovecot.index.cache if it's deleted. However, it was rarely used for
that purpose. More likely due to a corrupted cache file all the mails were
unnecessarily being opened and reindexed.

7 years agofts: Fix searching headers with TEXT/BODY
Timo Sirainen [Mon, 5 Feb 2018 21:54:33 +0000 (23:54 +0200)] 
fts: Fix searching headers with TEXT/BODY

TEXT is searching headers and BODY is searching MIME headers. Those headers
were indexed with data language, so search must also include data language
when looking up words. We'll just include the data language for all
searches now, so it should always work correctly.

7 years agofts: Fix searching SEARCH_HEADER_ADDRESS/COMPRESS_LWSP
Timo Sirainen [Mon, 5 Feb 2018 21:51:51 +0000 (23:51 +0200)] 
fts: Fix searching SEARCH_HEADER_ADDRESS/COMPRESS_LWSP

These are "non-language" headers that are being searched, so they need to be
searched using data language.

7 years agoquota: Warn when quota check is blocked by background quota calculation
Martti Rannanjärvi [Thu, 14 Dec 2017 09:44:52 +0000 (11:44 +0200)] 
quota: Warn when quota check is blocked by background quota calculation

This was previously double logged as "Quota transaction has failed
earlier" error.

7 years agoquota: Remove "Failed to set quota transaction limits" error
Martti Rannanjärvi [Wed, 10 Jan 2018 13:45:51 +0000 (15:45 +0200)] 
quota: Remove "Failed to set quota transaction limits" error

This error adds nothing that helps the user to debug a problem.

7 years agoquota-count: Remove extra "quota-count failed:" from error_r
Martti Rannanjärvi [Thu, 14 Dec 2017 10:47:00 +0000 (12:47 +0200)] 
quota-count: Remove extra "quota-count failed:" from error_r

7 years agolib-lda: Parse Return-Path header using RFC5322 (IMF) "path" syntax, rather than...
Stephan Bosch [Wed, 31 Jan 2018 23:14:55 +0000 (00:14 +0100)] 
lib-lda: Parse Return-Path header using RFC5322 (IMF) "path" syntax, rather than RFC5321 (SMTP) "Path" syntax.

SMTP does not allow white space, which causes all kinds of trouble when the
address is parsed from a header field.

7 years agolib-mail: message-address: Add support for parsing RFC5322 "path" syntax.
Stephan Bosch [Wed, 31 Jan 2018 23:08:40 +0000 (00:08 +0100)] 
lib-mail: message-address: Add support for parsing RFC5322 "path" syntax.

This is either a single angle-addr or just <>. This path syntax differs from the
RFC5321 "Path" syntax in that it allows whitespace, which is very important when
it is parsed from a header.

7 years agolib-ssl-iostream: Fix premature NULL deref
Aki Tuomi [Thu, 1 Feb 2018 07:19:10 +0000 (09:19 +0200)] 
lib-ssl-iostream: Fix premature NULL deref

Broken in 4836d541b1c1354073e068aabe5cd92aa67fe61d

Found by coverity

7 years agolib-imap: imap_match_deinit(NULL) should be a no-op
Aki Tuomi [Wed, 31 Jan 2018 17:48:49 +0000 (19:48 +0200)] 
lib-imap: imap_match_deinit(NULL) should be a no-op

7 years agolib-imap-urlauth: Fix segfault occurring when userid part is missing for "user+"...
Stephan Bosch [Wed, 31 Jan 2018 21:14:49 +0000 (22:14 +0100)] 
lib-imap-urlauth: Fix segfault occurring when userid part is missing for "user+" or "submit+" URLAUTH access.

7 years agolmtp: local: Use recipient index in lmtp_local_rcpt_reply_overquota().
Stephan Bosch [Wed, 31 Jan 2018 09:27:54 +0000 (10:27 +0100)] 
lmtp: local: Use recipient index in lmtp_local_rcpt_reply_overquota().

When used during the DATA command, it should send a reply for the correct
recipient. During the RCPT command there is only one reply due. Added assert
that checks this.

7 years agolmtp: local: Add explicit cmd parameter to lmtp_local_rcpt_reply_overquota().
Stephan Bosch [Wed, 31 Jan 2018 09:34:11 +0000 (10:34 +0100)] 
lmtp: local: Add explicit cmd parameter to lmtp_local_rcpt_reply_overquota().

Using the RCPT cmd is only valid for the RCPT command and not when quota excess
is detected during DATA. That would cause a segmentation fault, since
rcpt->rcpt.rcpt_cmd == NULL.

7 years agolmtp: local: Make local variable for rcpt->rcpt.rcpt_cmd in lmtp_local_rcpt_check_quo...
Stephan Bosch [Wed, 31 Jan 2018 09:30:23 +0000 (10:30 +0100)] 
lmtp: local: Make local variable for rcpt->rcpt.rcpt_cmd in lmtp_local_rcpt_check_quota().

7 years agoimap: Iterate over ns settings when deciding to add SPECIAL-USE capability
Josef 'Jeff' Sipek [Mon, 29 Jan 2018 14:55:51 +0000 (09:55 -0500)] 
imap: Iterate over ns settings when deciding to add SPECIAL-USE capability

To determine whether we should add the SPECIAL-USE capability to the
OK response to LOGIN, we have to iterate over namespace and mailbox
*settings* since the namespaces haven't been set up yet.

7 years agosubmission: Add settings that configure the connect and command reply timeouts.
Stephan Bosch [Sat, 27 Jan 2018 22:20:08 +0000 (23:20 +0100)] 
submission: Add settings that configure the connect and command reply timeouts.

7 years agoglobal: start relying on file_lock_free(NULL) being a no-op
Josef 'Jeff' Sipek [Mon, 29 Jan 2018 13:43:05 +0000 (08:43 -0500)] 
global: start relying on file_lock_free(NULL) being a no-op

Cleanup performed with the following semantic patch:

@@
expression E;
@@

- if (E != NULL) {
-       file_lock_free(&E);
- }
+ file_lock_free(&E);

7 years agoglobal: start relying on mailbox_header_lookup_unref(NULL) being a no-op
Josef 'Jeff' Sipek [Mon, 29 Jan 2018 13:41:03 +0000 (08:41 -0500)] 
global: start relying on mailbox_header_lookup_unref(NULL) being a no-op

Cleanup performed with the following semantic patch:

@@
expression E;
@@

- if (E != NULL) {
-       mailbox_header_lookup_unref(&E);
- }
+ mailbox_header_lookup_unref(&E);

7 years agolib-storage: mailbox_header_lookup_unref(NULL) should be a no-op
Josef 'Jeff' Sipek [Mon, 29 Jan 2018 13:40:27 +0000 (08:40 -0500)] 
lib-storage: mailbox_header_lookup_unref(NULL) should be a no-op

7 years agolib-mail: start relying on mail_html2text_deinit(NULL) being a no-op
Josef 'Jeff' Sipek [Mon, 29 Jan 2018 13:38:45 +0000 (08:38 -0500)] 
lib-mail: start relying on  mail_html2text_deinit(NULL) being a no-op

Cleanup performed with the following semantic patch:

@@
expression E;
@@

- if (E != NULL) {
-       mail_html2text_deinit(&E);
- }
+ mail_html2text_deinit(&E);

7 years agolib-mail: mail_html2text_deinit(NULL) should be a no-op
Josef 'Jeff' Sipek [Mon, 29 Jan 2018 13:38:16 +0000 (08:38 -0500)] 
lib-mail: mail_html2text_deinit(NULL) should be a no-op

7 years agoglobal: start relying on ssl_iostream_destroy(NULL) being a no-op
Josef 'Jeff' Sipek [Thu, 9 Nov 2017 15:37:34 +0000 (10:37 -0500)] 
global: start relying on ssl_iostream_destroy(NULL) being a no-op

Cleanup performed with the following semantic patch:

@@
expression E;
@@

- if (E != NULL) {
-  ssl_iostream_destroy(&E);
- }
+ ssl_iostream_destroy(&E);

7 years agossl-iostream: ssl_iostream_destroy(NULL) should be a no-op
Josef 'Jeff' Sipek [Thu, 9 Nov 2017 15:39:25 +0000 (10:39 -0500)] 
ssl-iostream: ssl_iostream_destroy(NULL) should be a no-op

7 years agoglobal: start relying on iostream_proxy_unref(NULL) being a no-op
Josef 'Jeff' Sipek [Thu, 9 Nov 2017 15:34:21 +0000 (10:34 -0500)] 
global: start relying on iostream_proxy_unref(NULL) being a no-op

Cleanup performed with the following semantic patch:

@@
expression E;
@@

- if (E != NULL) {
-  iostream_proxy_unref(&E);
- }
+ iostream_proxy_unref(&E);

7 years agolib: iostream_proxy_unref(NULL) should be a no-op
Josef 'Jeff' Sipek [Thu, 9 Nov 2017 15:36:02 +0000 (10:36 -0500)] 
lib: iostream_proxy_unref(NULL) should be a no-op

7 years agoglobal: start relying on str_free(NULL) being a no-op
Josef 'Jeff' Sipek [Thu, 9 Nov 2017 15:30:51 +0000 (10:30 -0500)] 
global: start relying on str_free(NULL) being a no-op

Cleanup performed with the following semantic patch:

@@
expression E;
@@

- if (E != NULL) {
-  str_free(&E);
- }
+ str_free(&E);

7 years agolib: str_free(NULL) should be a no-op
Josef 'Jeff' Sipek [Thu, 9 Nov 2017 15:32:32 +0000 (10:32 -0500)] 
lib: str_free(NULL) should be a no-op

7 years agolib/randgen - warn when DOVECOT_SRAND is not able to be used
Phil Carmody [Tue, 30 Jan 2018 12:14:42 +0000 (14:14 +0200)] 
lib/randgen - warn when DOVECOT_SRAND is not able to be used

As suggested by Jeff, it's friendly to warn if we're unable to act
upon the request for reproduceable random numbers because we're not
built for that.

Note, this deliberately permits a blank string, so that you can
silence the warning by prefixing a command with an empty
  DOVECOT_SRAND=
which is taken as an explicit attempt to disable use of the feature.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
7 years agolib/randgen - always print the DOVECOT_SRAND seed, not just on fatals
Phil Carmody [Tue, 30 Jan 2018 11:47:18 +0000 (13:47 +0200)] 
lib/randgen - always print the DOVECOT_SRAND seed, not just on fatals

Devs might want to reproduce "working" pathways that show slight
misbehaviour, not just crashing ones. The later print upon a crash/
fatal is left in, as the heads of logs can become separated from the
tails of logs quite easily, it's only one extra line per run.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
7 years agolib/randgen - use KISS as intended, not as originally posted to sci.crypt
Phil Carmody [Tue, 30 Jan 2018 16:48:51 +0000 (18:48 +0200)] 
lib/randgen - use KISS as intended, not as originally posted to sci.crypt

The original KISS, as posted to sci.crypt, had a SHR3 component with
short cycles. The buggy version contradicted Marsaglia's original
cycle length claim, and it had already been fixed in KISS11, so it's
fair to assume this was always the intended implementation.

For details see G. Rose "KISS: A Bit Too Simple".

Whilst dealing with that issue, fix seeding so w and z can't both
be short (length 2) cycles, as also pointed out in the Rose paper.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
7 years agodoveadm: dsync: Switch ioloop for input/output streams while making TCP connection.
Stephan Bosch [Mon, 29 Jan 2018 18:10:38 +0000 (19:10 +0100)] 
doveadm: dsync: Switch ioloop for input/output streams while making TCP connection.

This task is performed in a sub-ioloop, and when returning from that ioloop, the
output stream would sometimes still have an object on the sub-ioloop that was
just destroyed.

7 years agolib-ssl-iostream: openssl: Make verbose logging robust against i_debug() writing...
Stephan Bosch [Mon, 29 Jan 2018 17:28:25 +0000 (18:28 +0100)] 
lib-ssl-iostream: openssl: Make verbose logging robust against i_debug() writing to stream itself.

In dsync, i_debug() is overridden to write to the SSL stream itself through a
multiplexed data stream. So, during the i_debug() call all kinds of things can
happen to the persisted error string in the stream, which caused problems.

7 years agolib-http: client: Make sure all ioloop objects are created on the ioloop that the...
Stephan Bosch [Tue, 16 Jan 2018 01:02:11 +0000 (02:02 +0100)] 
lib-http: client: Make sure all ioloop objects are created on the ioloop that the client/context is switched to.

7 years agolib-dns: Allow setting the ioloop that the dns_lookup/dns_client is started on.
Stephan Bosch [Tue, 16 Jan 2018 23:37:37 +0000 (00:37 +0100)] 
lib-dns: Allow setting the ioloop that the dns_lookup/dns_client is started on.

7 years agolib: connection: Allow switching to a specific ioloop.
Stephan Bosch [Wed, 17 Jan 2018 01:50:05 +0000 (02:50 +0100)] 
lib: connection: Allow switching to a specific ioloop.

7 years agolib: ostream: Allow switching to a specific ioloop.
Stephan Bosch [Wed, 17 Jan 2018 01:49:44 +0000 (02:49 +0100)] 
lib: ostream: Allow switching to a specific ioloop.

7 years agolib: istream: Allow switching to a specific ioloop.
Stephan Bosch [Wed, 17 Jan 2018 01:48:43 +0000 (02:48 +0100)] 
lib: istream: Allow switching to a specific ioloop.

7 years agolib: iostream: Record the ioloop that the iostream was last switched to.
Stephan Bosch [Wed, 24 Jan 2018 22:02:03 +0000 (23:02 +0100)] 
lib: iostream: Record the ioloop that the iostream was last switched to.

7 years agolib: ioloop: Add functions for adding/moving timeouts and ios to a specific ioloop.
Stephan Bosch [Tue, 16 Jan 2018 18:37:46 +0000 (19:37 +0100)] 
lib: ioloop: Add functions for adding/moving timeouts and ios to a specific ioloop.

7 years agoimap-login: Fix copyright notice in imap-login-cmd-id.c.
Stephan Bosch [Mon, 29 Jan 2018 21:17:44 +0000 (22:17 +0100)] 
imap-login: Fix copyright notice in imap-login-cmd-id.c.

7 years agolib-auth: Remove request after abort
Aki Tuomi [Fri, 26 Jan 2018 08:55:54 +0000 (10:55 +0200)] 
lib-auth: Remove request after abort

Otherwise the request will still stay in hash table
and get dereferenced when all requests are aborted
causing an attempt to access free'd memory.

Found by Apollon Oikonomopoulos <apoikos@debian.org>

Broken in 1a29ed2f96da1be22fa5a4d96c7583aa81b8b060

7 years agosubmission: Properly handle omission of required authentication for relay connection.
Stephan Bosch [Sat, 27 Jan 2018 23:14:21 +0000 (00:14 +0100)] 
submission: Properly handle omission of required authentication for relay connection.

Particularly, do not forward the 530 error to the client. Instead, log the
problem and close the client connection with an internal error.

7 years agolib-smtp: server: Fix overwriting a previously submitted reply.
Stephan Bosch [Sat, 27 Jan 2018 23:10:11 +0000 (00:10 +0100)] 
lib-smtp: server: Fix overwriting a previously submitted reply.

The submitted flag was not reset, nor was the replies_submitted counter
decreased. This caused assertion failures.

7 years agolib-http: client: Assert that req->client != NULL in http_client_request_send_error().
Stephan Bosch [Sun, 28 Jan 2018 20:39:07 +0000 (21:39 +0100)] 
lib-http: client: Assert that req->client != NULL in http_client_request_send_error().

Applies when blocking payload output API is being used.
Addresses a report by scan-build.

7 years agolib-smtp: client: Fix timeout leak sometimes occurring at unexpected remote disconnect.
Stephan Bosch [Sun, 28 Jan 2018 10:44:26 +0000 (11:44 +0100)] 
lib-smtp: client: Fix timeout leak sometimes occurring at unexpected remote disconnect.

While disconnected, newly submitted commands are queued, yet scheduled for
immediate failure. The timeout used for that was not cleaned up.

7 years agolib-program-client: Make an explicit enum for the exit code.
Stephan Bosch [Fri, 26 Jan 2018 19:37:32 +0000 (20:37 +0100)] 
lib-program-client: Make an explicit enum for the exit code.

Before, the meaning of the code was confusing, since the actual program returns
a different set of values.

7 years agolib-program-client: local: Add test for big data I/O.
Stephan Bosch [Sat, 20 Jan 2018 20:32:07 +0000 (21:32 +0100)] 
lib-program-client: local: Add test for big data I/O.

7 years agolib-program-client: Document the purpose of the use_dotstream setting.
Stephan Bosch [Wed, 24 Jan 2018 00:17:59 +0000 (01:17 +0100)] 
lib-program-client: Document the purpose of the use_dotstream setting.

7 years agolib-program-client: Add comments to program_input/program_output functions.
Stephan Bosch [Tue, 23 Jan 2018 20:14:18 +0000 (21:14 +0100)] 
lib-program-client: Add comments to program_input/program_output functions.

7 years agolib-program-client: Flush/finish the output stream after o_stream_send_istream().
Stephan Bosch [Mon, 22 Jan 2018 22:43:18 +0000 (23:43 +0100)] 
lib-program-client: Flush/finish the output stream after o_stream_send_istream().

There may still be data in the output stream buffer. Failing to flush this
leads to truncated output. For the output towards the program o_stream_finish()
is used, since there may be an ostream_dot in between (or something else for
future features).

7 years agolib-program-client: remote: Don't change exit_code in program_client_remote_disconnec...
Stephan Bosch [Wed, 24 Jan 2018 00:09:16 +0000 (01:09 +0100)] 
lib-program-client: remote: Don't change exit_code in program_client_remote_disconnect() when program_input is already NULL.

When the program_input is NULL, the stream is finished, meaning that the
exit_code is set based on the return code. There can be a program_input for
remote streams, even when the program produces no output.

7 years agolib-program-client: Simplify cleanup of dot input stream in program_client_program_in...
Stephan Bosch [Tue, 23 Jan 2018 20:38:27 +0000 (21:38 +0100)] 
lib-program-client: Simplify cleanup of dot input stream in program_client_program_input().

7 years agolib-program-client: Restructure reading input from program to simplify handling of...
Stephan Bosch [Tue, 23 Jan 2018 20:24:35 +0000 (21:24 +0100)] 
lib-program-client: Restructure reading input from program to simplify handling of dot input stream.

7 years agolib-program-client: Use reliable means of checking for input stream EOF.
Stephan Bosch [Mon, 22 Jan 2018 22:25:34 +0000 (23:25 +0100)] 
lib-program-client: Use reliable means of checking for input stream EOF.