]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
6 years agoauth: oauth2: set scope to passdb_oauth2_settings
Markus Valentin [Mon, 24 Jun 2019 14:06:19 +0000 (16:06 +0200)] 
auth: oauth2: set scope to passdb_oauth2_settings

6 years agolib-oauth2: append scope to the access request payload
Markus Valentin [Mon, 24 Jun 2019 14:03:37 +0000 (16:03 +0200)] 
lib-oauth2: append scope to the access request payload

6 years agolib: Changed chown to chmod for Linux NFS Flush
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.

6 years agolib: Split up logic in nfs_flush_chown_uid
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.

6 years agodoveadm: Fix "service stop" to not print "Interrupted system call" error
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

6 years agomaster: Handle and report system clock glitches in millisecond resolution internally.
Stephan Bosch [Sun, 16 Dec 2018 13:25:58 +0000 (14:25 +0100)] 
master: Handle and report system clock glitches in millisecond resolution internally.

6 years agomaster: Handle throttling of services 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.

6 years agolib-storage: mail-storage-service: Handle and report system clock glitches in millise...
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.

6 years agolib: ioloop: Make the callback for io_loop_set_time_moved_callback() use struct timeval.
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.

6 years agolib: ioloop: Perform calculcations for the detection of system clock glitches in...
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.

6 years agoglobal: Replace usleep() with i_sleep*_usecs and i_sleep*_msecs().
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.

6 years agolib: Implement reliable sleep functions i_sleep*_usecs(), i_sleep*_msecs(), and i_sle...
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.

6 years agolib: time-util: Add timeval_add_usecs() and timeval_sub_usecs().
Stephan Bosch [Thu, 13 Dec 2018 08:53:18 +0000 (09:53 +0100)] 
lib: time-util: Add timeval_add_usecs() and timeval_sub_usecs().

6 years agolib: ioloop: Never decrease wait time counters in ioloop_add_wait_time().
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.

6 years agolib: file-lock: Never decrease the wait time counter in file_lock_wait_end().
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.

6 years agoscript: health-check: add health-check.sh default script
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.

6 years agoscript: add a parameter -p for passthrough scripts
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.

6 years agoscript: extract message parsing to separate function
Markus Valentin [Wed, 19 Jun 2019 07:37:39 +0000 (09:37 +0200)] 
script: extract message parsing to separate function

6 years agolib-auth: checking return values of net_addr2ip in unit-test
Markus Valentin [Thu, 20 Jun 2019 08:52:44 +0000 (10:52 +0200)] 
lib-auth: checking return values of net_addr2ip in unit-test

6 years agolib-auth: add unit test for auth_user_info_export
Markus Valentin [Mon, 17 Jun 2019 09:22:45 +0000 (11:22 +0200)] 
lib-auth: add unit test for auth_user_info_export

The test verifies that fields are ending up in the auth request as
expected given a corresponding auth_user_info struct.

6 years agolib-auth: make auth_user_info_export global
Markus Valentin [Mon, 17 Jun 2019 12:07:10 +0000 (14:07 +0200)] 
lib-auth: make auth_user_info_export global

To allow unit-testing this function it becomes global.

6 years agolmtp-proxy: set real_ variables in auth_user_info struct
Markus Valentin [Thu, 13 Jun 2019 18:54:39 +0000 (20:54 +0200)] 
lmtp-proxy: set real_ variables in auth_user_info struct

Set the real_ variables from connection to the client struct and from
there to the auth_user_info. This allows to pass the real_ variables to
lib-auth and thereby to the auth process.

6 years agolib-auth: add real_[remote|local]_[ip|port] to auth_user_info
Markus Valentin [Thu, 13 Jun 2019 18:45:55 +0000 (20:45 +0200)] 
lib-auth: add real_[remote|local]_[ip|port] to auth_user_info

This allows the auth_user_info_export function to export all the real_
variables, if  available, to the auth request thereby enableing real_
variables for lib-auth.

6 years agodoveadm-stats: Print numbers as numbers
Aki Tuomi [Tue, 6 Nov 2018 11:06:49 +0000 (13:06 +0200)] 
doveadm-stats: Print numbers as numbers

Prevents treating numbers as string in JSON printer

6 years agoacl: Use the last line from global ACL file even if it has no LF
Timo Sirainen [Thu, 13 Jun 2019 12:53:40 +0000 (15:53 +0300)] 
acl: Use the last line from global ACL file even if it has no LF

Not all text editors add LF to the last line.

6 years agolib-settings: Note that settings.h is not what it appears to be
Josef 'Jeff' Sipek [Wed, 12 Jun 2019 13:17:56 +0000 (16:17 +0300)] 
lib-settings: Note that settings.h is not what it appears to be

To avoid future confusion.

This also adds a note that the interface should be removed in dovecot 3.0.

6 years agostats: event export - Use transport_timeout in http-post transport
Josef 'Jeff' Sipek [Wed, 12 Jun 2019 08:37:02 +0000 (11:37 +0300)] 
stats: event export - Use transport_timeout in http-post transport

6 years agostats: event export - Introduce a per exporter block transport timeout setting
Josef 'Jeff' Sipek [Wed, 12 Jun 2019 08:36:12 +0000 (11:36 +0300)] 
stats: event export - Introduce a per exporter block transport timeout setting

This commit adds a new per event_exporter { } block setting to specify the
transport timeout.  For example:

event_exporter {
transport = foo
transport_args = ...
transport_timeout = 123msecs

format = bar
format_args = ...
}

Note that this commit only introduces the setting.  The transports will be
changed to make use of it in future commits.

6 years agostats: event export - Increase default http-post timeout to 250ms
Josef 'Jeff' Sipek [Wed, 12 Jun 2019 07:57:02 +0000 (10:57 +0300)] 
stats: event export - Increase default http-post timeout to 250ms

50ms just isn't enough.  A slightly higher latency link combined with a
handful of storage I/Os can easily use up 50ms.

If each event has approximately 4kB memory footprint, then a 250ms timeout
keeps the memory requirement relatively low (50MB on average / 200MB max at
50k events/sec) but still allows a decent amount of time for the HTTP POST
to get sent to and processed by a server in the same datacenter.

6 years agodoveadm-dsync: Clarify why ctx->replicator_notify is checked with noreplicate
Aki Tuomi [Tue, 28 May 2019 07:43:39 +0000 (10:43 +0300)] 
doveadm-dsync: Clarify why ctx->replicator_notify is checked with noreplicate

6 years agodoveadm-dsync: Handle NOREPLICATE error in client
Aki Tuomi [Tue, 28 May 2019 07:41:33 +0000 (10:41 +0300)] 
doveadm-dsync: Handle NOREPLICATE error in client

6 years agodoveadm-dsync: Do not attempt to sync noreplicate user
Aki Tuomi [Tue, 28 May 2019 07:40:15 +0000 (10:40 +0300)] 
doveadm-dsync: Do not attempt to sync noreplicate user

6 years agodoveadm-cmd: Add NOREPLICATE error code
Aki Tuomi [Tue, 28 May 2019 07:39:36 +0000 (10:39 +0300)] 
doveadm-cmd: Add NOREPLICATE error code

6 years agodoveadm-dsync: Set NOREPLICATE error code instead of returning it
Aki Tuomi [Tue, 28 May 2019 07:35:55 +0000 (10:35 +0300)] 
doveadm-dsync: Set NOREPLICATE error code instead of returning it

This is how the error handling is supposed to be done.

Broken in 7f0dcac9942910c2934ceab1230e539043167601

6 years agolib: istream-file - Ensure fd is in valid range
Aki Tuomi [Mon, 27 May 2019 09:56:29 +0000 (12:56 +0300)] 
lib: istream-file - Ensure fd is in valid range

6 years agolib: fd-util - Ensure fd is in valid range
Aki Tuomi [Mon, 27 May 2019 09:55:54 +0000 (12:55 +0300)] 
lib: fd-util - Ensure fd is in valid range

6 years agolib-http: Add http_client_request_add_missing_header()
Timo Sirainen [Mon, 27 May 2019 15:25:38 +0000 (18:25 +0300)] 
lib-http: Add http_client_request_add_missing_header()

6 years agolib-http: Add http_client_request_lookup_header()
Timo Sirainen [Mon, 27 May 2019 14:55:56 +0000 (17:55 +0300)] 
lib-http: Add http_client_request_lookup_header()

6 years agolib-http: http_client_request_remove_header() - Don't crash if no headers are added
Timo Sirainen [Mon, 27 May 2019 14:53:16 +0000 (17:53 +0300)] 
lib-http: http_client_request_remove_header() - Don't crash if no headers are added

Fixes a crash if http_client_request_add_header() hasn't been called
before http_client_request_remove_header()

6 years agolib-http: http_client_request_add_header() - Replace existing header
Timo Sirainen [Mon, 27 May 2019 14:47:16 +0000 (17:47 +0300)] 
lib-http: http_client_request_add_header() - Replace existing header

If header with the same key already exists, just replace the value.
HTTP supports having multiple headers with the same key only when they
can be rewritten into a single comma-separated header. So practically
there's no reason for lib-http to need to support adding multiple
headers. Replacing an existing value is more useful generally.

6 years agolib-http: http_client_request_remove_header() - split off header finding
Timo Sirainen [Mon, 27 May 2019 14:46:37 +0000 (17:46 +0300)] 
lib-http: http_client_request_remove_header() - split off header finding

6 years agolib-http: Add Unit test for http_client_request_add/remove_header()
Timo Sirainen [Mon, 27 May 2019 13:13:28 +0000 (16:13 +0300)] 
lib-http: Add Unit test for http_client_request_add/remove_header()

6 years agodoveadm service status: Handle VERSION handshake line properly
Timo Sirainen [Fri, 24 May 2019 11:49:59 +0000 (14:49 +0300)] 
doveadm service status: Handle VERSION handshake line properly

It was thought to be part of the command response, which caused somewhat
broken replies. Broken by 5c1267b97367b666bd24e6aadfd85ad3902a5b05

6 years agoquota: Enable program-client debug when mail_debug is enabled
Aki Tuomi [Wed, 8 May 2019 09:46:48 +0000 (12:46 +0300)] 
quota: Enable program-client debug when mail_debug is enabled

Makes it easier to see that program-client actually
executed a warning script.

6 years agoquota: Do not skip noenforcing and auto_update quota roots when intializing
Aki Tuomi [Fri, 7 Dec 2018 07:19:08 +0000 (09:19 +0200)] 
quota: Do not skip noenforcing and auto_update quota roots when intializing

Doing so will break quota warnings.

6 years agoquota: Do not set limits to infinity when not enforcing
Aki Tuomi [Fri, 7 Dec 2018 07:14:25 +0000 (09:14 +0200)] 
quota: Do not set limits to infinity when not enforcing

Fixes quota enforcement to work even if secondary quota
is noenforcing.

6 years agoimap-login: Remove extra '+' from state strings in log output
Timo Sirainen [Tue, 18 Sep 2018 22:28:13 +0000 (01:28 +0300)] 
imap-login: Remove extra '+' from state strings in log output

If multiple outgoing commands were in progress, the state should have
said e.g. "state=capability+login", not "state=capability+++login".

6 years agodoveadm service status: Show total number of processes created
Timo Sirainen [Wed, 30 May 2018 11:55:19 +0000 (14:55 +0300)] 
doveadm service status: Show total number of processes created

6 years agodoveadm service status: Support different number of fields returned by master
Timo Sirainen [Wed, 4 Jul 2018 13:17:57 +0000 (16:17 +0300)] 
doveadm service status: Support different number of fields returned by master

6 years agodoveadm: Add doveadm_print_get_headers_count()
Timo Sirainen [Wed, 4 Jul 2018 13:16:36 +0000 (16:16 +0300)] 
doveadm: Add doveadm_print_get_headers_count()

Returns the number of headers added to printer.

6 years agomaster: Track total number of processes created per service
Timo Sirainen [Wed, 30 May 2018 11:54:34 +0000 (14:54 +0300)] 
master: Track total number of processes created per service

6 years agolib-master: Set instance_name to the syslog name
SATOH Fumiyasu [Tue, 1 Jul 2014 10:22:56 +0000 (19:22 +0900)] 
lib-master: Set instance_name to the syslog name

6 years agolib: Linux, OSX, etc: Avoid race conditions showing \xAB chars in ps title
Timo Sirainen [Fri, 18 May 2018 14:29:09 +0000 (17:29 +0300)] 
lib: Linux, OSX, etc: Avoid race conditions showing \xAB chars in ps title

With bad luck "ps" reads the process title when it hasn't been fully
written. Since the trailing NULs are written last and the previous code kept
the ps title otherwise filled with \xAB chars, this could have caused ps
to sometimes show the process title filled with \xAB chars (visible as '?')

6 years agodoveadm: fix who/kick out of order response
Bjørnar Ness [Tue, 17 Apr 2018 14:04:02 +0000 (16:04 +0200)] 
doveadm: fix who/kick out of order response

doveadm-who and kick did not properly flush protocol output
after doveadm_print(), this caused out-of-order response to
clients, example:

C: <tab><tab>who<crlf>
S: +<crlf>
S: username<tab>[...]<missing_crlf>

correct response should have been
S: <username><tab>[...]<crlf>
S: +<crlf>

fixed by adding doveadm_print_flush() calls.

6 years agodoveadm: Add NOREPLICATE error when "noreplicate" user flag is used
Aki Tuomi [Wed, 27 Dec 2017 12:08:13 +0000 (14:08 +0200)] 
doveadm: Add NOREPLICATE error when "noreplicate" user flag is used

It will be only understood if -U flag has been used

6 years agoreplicator: Remove user from replication if NOREPLICATE error is returned
Aki Tuomi [Wed, 27 Dec 2017 12:07:30 +0000 (14:07 +0200)] 
replicator: Remove user from replication if NOREPLICATE error is returned

6 years agolib-imap: Make sure str_unescape() won't be writing past allocated memory
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.

6 years agolib-imap: Don't accept strings with NULs
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

6 years agoNEWS: Add release notes for 2.3.7.1
Timo Sirainen [Mon, 22 Jul 2019 10:45:13 +0000 (13:45 +0300)] 
NEWS: Add release notes for 2.3.7.1

6 years agolib-storage: Namespace prefix shouldn't be included in all mailbox name validity...
Timo Sirainen [Mon, 22 Jul 2019 11:57:34 +0000 (14:57 +0300)] 
lib-storage: Namespace prefix shouldn't be included in all mailbox name validity checks

Broken by 90c2995737cc1f3fe042993beb7b0b32e5375795

6 years agolib: ostream-file: Don't log any errors when setting TCP_NODELAY
Timo Sirainen [Mon, 15 Jul 2019 07:14:23 +0000 (10:14 +0300)] 
lib: ostream-file: Don't log any errors when setting TCP_NODELAY

It's likely never useful to log the error, and it seems more and more
unexpected errors just keep popping up.

6 years agolib-smtp: smtp-params - Assume all capabilities are supported when adding parameter...
Stephan Bosch [Mon, 15 Jul 2019 19:50:11 +0000 (21:50 +0200)] 
lib-smtp: smtp-params - Assume all capabilities are supported when adding parameter event fields.

The actual capabilities are not really needed, since any assigned field is
relevent for event processing, whether the remote end will accept it or not.

This also fixes an assert failure occuring for proxied connections. Since the
server and client (proxy) connections can have different capabilities and since
the client connection does not have a proper capability list available in the
beginning of the handshake, the event created for a client transaction would
cause an assert failure when parameters were assigned that did not match the
capabilities (none).

6 years agoNEWS: Add release notes for 2.3.7
Aki Tuomi [Wed, 10 Jul 2019 08:01:57 +0000 (11:01 +0300)] 
NEWS: Add release notes for 2.3.7

6 years agoNEWS: Add missing 2.3.6 news
Aki Tuomi [Wed, 10 Jul 2019 07:44:45 +0000 (10:44 +0300)] 
NEWS: Add missing 2.3.6 news

6 years agoconfig: Cache converted ssl-parameters.dat result
Timo Sirainen [Fri, 12 Jul 2019 07:22:01 +0000 (10:22 +0300)] 
config: Cache converted ssl-parameters.dat result

This way the ssl-parameters.dat is read only once by the config process
instead of for every config request.

6 years agoconfig: Fix memory leaks when failing to convert ssl-parameters.dat
Timo Sirainen [Fri, 12 Jul 2019 07:16:26 +0000 (10:16 +0300)] 
config: Fix memory leaks when failing to convert ssl-parameters.dat

If ssl_dh setting isn't set and ssl-parameters.dat isn't found or there's
some error reading it, memory is leaked for every config request. This
eventually results in config process dying due to reaching vsz_limit.

6 years agolib-storage: Fix setting \Noinferiors flag for detached INBOX
Timo Sirainen [Thu, 11 Jul 2019 12:08:10 +0000 (15:08 +0300)] 
lib-storage: Fix setting \Noinferiors flag for detached INBOX

The "" namespace is nowadays automatically created, so we can't just check
if mail_namespace_find_prefix() returns NULL.

I left the NULL check there for now at least, just in case there's some
reason I couldn't think of when it could be NULL.

6 years agodict: Exit early to work around various errors and crashes at shutdown
Timo Sirainen [Thu, 11 Jul 2019 11:43:13 +0000 (14:43 +0300)] 
dict: Exit early to work around various errors and crashes at shutdown

This is just a kludge until the dict process cleanup can be done cleanly.

6 years agolib: connection - Make sure the connection name is always available.
Stephan Bosch [Thu, 28 Mar 2019 20:41:53 +0000 (21:41 +0100)] 
lib: connection - Make sure the connection name is always available.

6 years agolib-dns: Log "Disconnect" event before calling DNS callbacks and freeing lookups
Timo Sirainen [Tue, 9 Jul 2019 23:09:12 +0000 (02:09 +0300)] 
lib-dns: Log "Disconnect" event before calling DNS callbacks and freeing lookups

dns_lookup_free() could be freeing the dns_client, which causes a segfault
in the e_debug() log call.

Broken by fc8c54c48fec6a89d9cda755756c233191c62af1

6 years agolib-http: guard against hshared use-after-free
Stephan Bosch [Mon, 1 Jul 2019 23:04:03 +0000 (19:04 -0400)] 
lib-http: guard against hshared use-after-free

This fixes a race condition where the http_client_host_shared_idle_timeout()
function would get called with an already freed hshared argument.

Specifically, the situation arises from the hshared idle timeout calling
http_client_host_shared_free(), which removes the timeout and then proceeds to
free the client queue.  The client queue freeing code indirectly calls
http_client_host_shared_check_idle(), which notices that there is no idle
timeout and allocates one.

The backtrace at the point of this new timeout allocation:

    frame #3: 0x00007f0c775897f0 libdovecot.so.0`timeout_add_to(...) ioloop.c:280
    frame #4: 0x00007f0c7751a45f libdovecot.so.0`http_client_host_shared_check_idle(hshared=<unavailable>) at http-client-host.c:69
    frame #5: 0x00007f0c7750de89 libdovecot.so.0`http_client_request_error(_req=<unavailable>, status=9000, error="") at http-client-request.c:1525
    frame #6: 0x00007f0c77517f38 libdovecot.so.0`http_client_queue_fail_full(queue=0x000055e13cff0e10, status=9000, error="", all=<unavailable>) at http-client-queue.c:183
    frame #7: 0x00007f0c77518baa libdovecot.so.0`http_client_queue_free(queue=0x000055e13cff0e10) at http-client-queue.c:141
    frame #8: 0x00007f0c7751a8bc libdovecot.so.0`http_client_host_free_shared(_host=<unavailable>) at http-client-host.c:391
    frame #9: 0x00007f0c7751ab4c libdovecot.so.0`http_client_host_shared_free(_hshared=0x00007ffdac109e48) at http-client-host.c:294
    frame #10: 0x00007f0c7751ace8 libdovecot.so.0`http_client_host_shared_idle_timeout(hshared=<unavailable>) at http-client-host.c:40
    frame #11: 0x00007f0c7758a1a4 libdovecot.so.0`io_loop_handle_timeouts at ioloop.c:682
    frame #12: 0x00007f0c7758a089 libdovecot.so.0`io_loop_handle_timeouts(ioloop=0x000055e13cfc8d80) at ioloop.c:696
    frame #13: 0x00007f0c7758befc libdovecot.so.0`io_loop_handler_run_internal(ioloop=0x000055e13cfc8d80) at ioloop-select.c:126
    frame #14: 0x00007f0c7758a56d libdovecot.so.0`io_loop_handler_run(ioloop=<unavailable>) at ioloop.c:767
    frame #15: 0x00007f0c7758a798 libdovecot.so.0`io_loop_run(ioloop=0x000055e13cfc8d80) at ioloop.c:740
    frame #16: 0x00007f0c774f61eb libdovecot.so.0`master_service_run(service=0x000055e13cfc8c10, callback=<unavailable>) at master-service.c:782
    frame #17: 0x000055e13b48e3a5 stats`main(argc=<unavailable>, argv=<unavailable>) at main.c:99
    frame #18: 0x00007f0c771092e1 libc.so.6`__libc_start_main + 241
    frame #19: 0x000055e13b48e41a stats`_start + 42

6 years agolib-storage: test-mail-storage - Use array_push_back() and array_front()
Timo Sirainen [Tue, 9 Jul 2019 07:19:24 +0000 (10:19 +0300)] 
lib-storage: test-mail-storage - Use array_push_back() and array_front()

These were dropped due to changes being merged in different order than in
master.

6 years agolib-storage: test-mail-storage - Add missing MASTER_SERVICE_FLAG_DONT_SEND_STATS
Timo Sirainen [Tue, 9 Jul 2019 07:18:30 +0000 (10:18 +0300)] 
lib-storage: test-mail-storage - Add missing MASTER_SERVICE_FLAG_DONT_SEND_STATS

This was dropped due to changes being merged in different order than in
master.

6 years agolib-storage: test-mail-storage - add check for mailbox_create() return value
Timo Sirainen [Thu, 1 Mar 2018 18:12:35 +0000 (20:12 +0200)] 
lib-storage: test-mail-storage - add check for mailbox_create() return value

6 years agolib-smtp: smtp-server-cmd-helo - Fix segfault occurring when domain argument is inval...
Stephan Bosch [Tue, 2 Jul 2019 22:40:05 +0000 (00:40 +0200)] 
lib-smtp: smtp-server-cmd-helo - Fix segfault occurring when domain argument is invalid in a second EHLO command.

6 years agolib-index: After recreating cache, make sure offsets are immediately updated to map
Timo Sirainen [Mon, 8 Jul 2019 15:56:12 +0000 (18:56 +0300)] 
lib-index: After recreating cache, make sure offsets are immediately updated to map

They were most likely refreshed anyway before the next cache usage, but this
caused an assert-crash if the dovecot.index was also recreated in the same
sync.

Broken by e31b0637d8788885a71db2def5743ebf14c698f3

Fixes:
Panic: file mail-index-write.c: line 138 (mail_index_write): assertion failed: (file->hdr.prev_file_offset == hdr->log_file_head_offset)

6 years agolib-index: Fix using old map when checking for unexpected changes during log rotate
Timo Sirainen [Mon, 8 Jul 2019 15:59:21 +0000 (18:59 +0300)] 
lib-index: Fix using old map when checking for unexpected changes during log rotate

This shouldn't normally be possible. The log is locked, so other processes
shouldn't be able to write anything to it. This was mainly found by the
earlier bug.

6 years agolib-index: Compress cache immediately after enough mails have been expunged
Timo Sirainen [Mon, 10 Jun 2019 20:07:56 +0000 (23:07 +0300)] 
lib-index: Compress cache immediately after enough mails have been expunged

This fixes a bug where cache may never become compressed in certain mailbox
access patterns. Especially for autoexpunging in lazy_expunge mailboxes.
The cache compression happened only when:

a) After the mailbox_sync() that finishes expunging there was another
mailbox_sync(). If mailbox was immediately closed after expunging, this
didn't happen.

b) Fields are fetched from cache

If neither of these happened, the cache just kept growing. This happened
especially with lazy_expunge mailboxes.

sdbox format was always doing b) during expunging, because it looked up
GUIDs from cache. However, this helped only with regular expunges, not
with autoexpunges, because autoexpunging didn't finish with any
mailbox_sync() (which is a bug on its own).

mdbox also did GUID lookups from cache, but it wasn't doing cache
compressions due the bug fixed by the previous commit.

6 years agolib-index: Fix calling expunge handlers with mdbox
Timo Sirainen [Mon, 10 Jun 2019 20:01:16 +0000 (23:01 +0300)] 
lib-index: Fix calling expunge handlers with mdbox

This fixes updating deleted_record_count in dovecot.index.cache files.
Because they were wrong, the cache wasn't always compressed as early as
it should have been.

mdbox uses a separate transaction to commit expunges while mailbox is being
synced. When syncing was finished, tail_offset was updated too early so
mail_index_map(MAIL_INDEX_SYNC_HANDLER_FILE) was always a no-op and expunge
handlers were never called.

There doesn't seem to be any downside to not updating tail_offset early.
sdbox saving also uses such a transaction, but there is no difference in
the resulting dovecot.index.log file. The main worry I had was that
tail_offset wouldn't be updated to point to the end of the log file.
However, this doesn't happen with the old code either. This is because the
extra transaction is external, and tail_offset updating skips over all
external transactions anyway.

6 years agomdbox: Always sync dovecot.map.index with MAIL_INDEX_SYNC_FLAG_UPDATE_TAIL_OFFSET
Timo Sirainen [Mon, 17 Jun 2019 10:59:10 +0000 (13:59 +0300)] 
mdbox: Always sync dovecot.map.index with MAIL_INDEX_SYNC_FLAG_UPDATE_TAIL_OFFSET

This avoids errors after the next commit.

6 years agolib-index: mail_index_sync_update_mailbox_offset() - Remove unnecessary code
Timo Sirainen [Mon, 10 Jun 2019 19:58:44 +0000 (22:58 +0300)] 
lib-index: mail_index_sync_update_mailbox_offset() - Remove unnecessary code

The function call has no side effects, and the return values aren't used.

6 years agolib-storage: Sync mailbox after autoexpunging
Timo Sirainen [Wed, 12 Jun 2019 07:58:37 +0000 (10:58 +0300)] 
lib-storage: Sync mailbox after autoexpunging

This actually finishes expunging the mails. Previously the mails were
just marked to be expunged in the transaction log, and the next session
that opened the mailbox finished the expunging.

6 years agolmtp: Replace i_info() with e_info().
Stephan Bosch [Wed, 13 Feb 2019 23:21:16 +0000 (00:21 +0100)] 
lmtp: Replace i_info() with e_info().

6 years agolmtp: Replace i_error() with e_error().
Stephan Bosch [Wed, 13 Feb 2019 23:17:20 +0000 (00:17 +0100)] 
lmtp: Replace i_error() with e_error().

6 years agolmtp: proxy: Use client.event for SMTP client connection.
Stephan Bosch [Thu, 27 Dec 2018 21:39:20 +0000 (22:39 +0100)] 
lmtp: proxy: Use client.event for SMTP client connection.

6 years agolmtp: local: Use rcpt.event as mail_*user's parent event.
Stephan Bosch [Thu, 27 Dec 2018 21:37:40 +0000 (22:37 +0100)] 
lmtp: local: Use rcpt.event as mail_*user's parent event.

6 years agolmtp: Add username to recipient event.
Stephan Bosch [Wed, 13 Feb 2019 23:36:41 +0000 (00:36 +0100)] 
lmtp: Add username to recipient event.

6 years agolmtp: Add client.event.
Stephan Bosch [Thu, 27 Dec 2018 21:32:01 +0000 (22:32 +0100)] 
lmtp: Add client.event.

6 years agolib-smtp: smtp-submit - Rename event setting to event_parent.
Stephan Bosch [Sat, 9 Mar 2019 22:33:24 +0000 (23:33 +0100)] 
lib-smtp: smtp-submit - Rename event setting to event_parent.

6 years agolib-smtp: smtp-server - Rename event setting to event_parent.
Stephan Bosch [Fri, 8 Mar 2019 21:21:22 +0000 (22:21 +0100)] 
lib-smtp: smtp-server - Rename event setting to event_parent.

6 years agolib-smtp: smtp-client - Rename event setting to event_parent.
Stephan Bosch [Fri, 8 Mar 2019 20:47:00 +0000 (21:47 +0100)] 
lib-smtp: smtp-client - Rename event setting to event_parent.

6 years agolib-http: http-client - Rename event setting to event_parent.
Stephan Bosch [Fri, 8 Mar 2019 21:20:58 +0000 (22:20 +0100)] 
lib-http: http-client - Rename event setting to event_parent.

6 years agolib: connection - Turn connection_init_client_ip*() name parameter into an explicit...
Stephan Bosch [Thu, 7 Mar 2019 20:51:48 +0000 (21:51 +0100)] 
lib: connection - Turn connection_init_client_ip*() name parameter into an explicit hostname.

This way, the default connection name will be hostname:ip when hostname is not
NULL. This will be helpful once the connection API has TLS support.

6 years agolib-smtp: smtp-client-command - Emit smtp_client_command_finished event for replied...
Stephan Bosch [Sat, 2 Mar 2019 12:05:08 +0000 (13:05 +0100)] 
lib-smtp: smtp-client-command - Emit smtp_client_command_finished event for replied commands.

This was an omission.

6 years agolib-smtp: smtp-client-command - Make sure command event is finished just once.
Stephan Bosch [Sat, 2 Mar 2019 12:08:34 +0000 (13:08 +0100)] 
lib-smtp: smtp-client-command - Make sure command event is finished just once.

6 years agolib-smtp: smtp-submit - Emit named events.
Stephan Bosch [Sat, 2 Mar 2019 16:18:02 +0000 (17:18 +0100)] 
lib-smtp: smtp-submit - Emit named events.

These have some overlap with the smtp-client events, but for the sendmail binary
submission method those are not produced.

6 years agolib-smtp: smtp-submit - Add support for event API.
Stephan Bosch [Thu, 27 Dec 2018 23:41:43 +0000 (00:41 +0100)] 
lib-smtp: smtp-submit - Add support for event API.

6 years agolib-smtp: smtp-submit - Collect optional inputs to smtp_submit_session_init() into...
Stephan Bosch [Thu, 27 Dec 2018 23:36:32 +0000 (00:36 +0100)] 
lib-smtp: smtp-submit - Collect optional inputs to smtp_submit_session_init() into a struct.

6 years agolib-smtp: smtp-server-transaction - Record the size of the message data in the event...
Stephan Bosch [Tue, 12 Feb 2019 00:48:01 +0000 (01:48 +0100)] 
lib-smtp: smtp-server-transaction - Record the size of the message data in the event at the end of the transaction.

6 years agolib-smtp: smtp-server-recipient - Emit named events.
Stephan Bosch [Tue, 12 Feb 2019 00:47:43 +0000 (01:47 +0100)] 
lib-smtp: smtp-server-recipient - Emit named events.