]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
6 years agolib-index: Add mail_cache_compress_forced()
Timo Sirainen [Sun, 29 Apr 2018 10:44:59 +0000 (13:44 +0300)] 
lib-index: Add mail_cache_compress_forced()

6 years agodoveadm-auth-server: Fix cmd_list output to use JSON
Aki Tuomi [Wed, 19 Sep 2018 09:34:57 +0000 (12:34 +0300)] 
doveadm-auth-server: Fix cmd_list output to use JSON

Fixes output for HTTP client

6 years agodoveadm-auth-server: Do not use i_fatal on user listing error
Aki Tuomi [Wed, 19 Sep 2018 09:27:50 +0000 (12:27 +0300)] 
doveadm-auth-server: Do not use i_fatal on user listing error

Breaks error reporting to HTTP client

6 years agodict-client: Avoid excessive CPU usage while waiting commands to finish
Timo Sirainen [Fri, 14 Sep 2018 10:19:16 +0000 (13:19 +0300)] 
dict-client: Avoid excessive CPU usage while waiting commands to finish

client_dict_add_timeout() adds the timeout thinking that the dict no longer
has any work to do, so it can be freed soon. However, if other work is
added before that, the timeout just keeps getting called over and over
again. This is especially bad with the default idle timeout of 0.

6 years agologin-proxy: Fix logging reason when kicking non-logged in connections
Timo Sirainen [Fri, 6 Jul 2018 10:12:51 +0000 (13:12 +0300)] 
login-proxy: Fix logging reason when kicking non-logged in connections

Use the same reason as for logged in connections.

6 years agoimap: Fix command ambiguity checking with special plugins
Timo Sirainen [Mon, 6 Aug 2018 09:39:25 +0000 (12:39 +0300)] 
imap: Fix command ambiguity checking with special plugins

If the tagged line is already sent, that command can't result in ambiguity
anymore.

A cleaner fix would be to add a new _WAIT_SYNC_OUTPUT state, but that
requires all the existing code to understand that new state correctly, so it
has a higher chance of breaking something. So at least for now don't add it.

6 years agolib-http: test-http-client-errors: Address another reliability issue in "peer reuse...
Stephan Bosch [Thu, 13 Sep 2018 07:16:41 +0000 (09:16 +0200)] 
lib-http: test-http-client-errors: Address another reliability issue in "peer reuse failure" test.

6 years agolib-http: response: Add convenience functions for status evaluation.
Stephan Bosch [Thu, 13 Sep 2018 18:44:22 +0000 (20:44 +0200)] 
lib-http: response: Add convenience functions for status evaluation.

6 years agolib-http: test-http-client-errors: Make "peer reuse failure" test reliable.
Stephan Bosch [Mon, 13 Aug 2018 17:23:31 +0000 (19:23 +0200)] 
lib-http: test-http-client-errors: Make "peer reuse failure" test reliable.

It was highly timing-sensitive, since it required a particular error status to
be returned. Sometimes, it would yield a different error based on a
slightly different order of events, making the test fail. Such failures aren't
relevant though, since this regression test is about triggering a segfault that
used to occur.

6 years agoauth: mycrypt - include crypt.h
Aki Tuomi [Wed, 8 Aug 2018 09:33:20 +0000 (12:33 +0300)] 
auth: mycrypt - include crypt.h

Fixes crypt usage on glibc-2.28

Reported by Reuben Farrelly
Patch provided by Thore Bödecker

6 years agolib-master: ipc-client: Don't free command too early
Timo Sirainen [Tue, 2 Oct 2018 07:22:11 +0000 (10:22 +0300)] 
lib-master: ipc-client: Don't free command too early

When multiple replies were received by IPC only the final reply should free
the command. This may have caused e.g. "doveadm proxy list" to crash.
Broken by 435f0545b200767c25a5daee17cd6b4998d03710

6 years agodirector: Allow fully freeing user while waiting for IPC kick to finish
Timo Sirainen [Thu, 5 Jul 2018 11:55:38 +0000 (14:55 +0300)] 
director: Allow fully freeing user while waiting for IPC kick to finish

director_user_move_free() will now just free the IPC command, so this isn't
a problem anymore.

6 years agodirector: Fix crash when user kill times out before IPC finishes
Timo Sirainen [Thu, 5 Jul 2018 11:53:02 +0000 (14:53 +0300)] 
director: Fix crash when user kill times out before IPC finishes

Abort the IPC kick command when freeing kill context so the IPC callback
won't be called.

6 years agolib-master: ipc-client: Support aborting commands
Timo Sirainen [Thu, 5 Jul 2018 11:42:30 +0000 (14:42 +0300)] 
lib-master: ipc-client: Support aborting commands

6 years agolib-master: ipc-client: Cleanup - avoid extra return in the function
Timo Sirainen [Thu, 5 Jul 2018 11:41:38 +0000 (14:41 +0300)] 
lib-master: ipc-client: Cleanup - avoid extra return in the function

Simplifies the following commit.

6 years agolib-master: ipc-client: Never call callback directly from ipc_client_cmd()
Timo Sirainen [Thu, 5 Jul 2018 11:38:51 +0000 (14:38 +0300)] 
lib-master: ipc-client: Never call callback directly from ipc_client_cmd()

This may simplify the calling code, especially after the following commit
that returns the command pointer.

6 years agolib-master: ipc-client: Split code to ipc_client_abort_commands()
Timo Sirainen [Thu, 5 Jul 2018 11:35:51 +0000 (14:35 +0300)] 
lib-master: ipc-client: Split code to ipc_client_abort_commands()

6 years agolib-master: ipc-client: Use linked list of commads instead of array
Timo Sirainen [Thu, 5 Jul 2018 11:25:46 +0000 (14:25 +0300)] 
lib-master: ipc-client: Use linked list of commads instead of array

Needed for the following commit that returns the command pointer.

6 years agolib-master: ipc-client: Don't call callback twice if IPC proxy sends invalid input
Timo Sirainen [Thu, 5 Jul 2018 10:40:43 +0000 (13:40 +0300)] 
lib-master: ipc-client: Don't call callback twice if IPC proxy sends invalid input

ipc_client_disconnect() called it once, and the second time was done with
the cmds[0] that was already removed from the array.

6 years agopop3: Do not expunge \Deleted mails without QUIT
Aki Tuomi [Wed, 5 Sep 2018 16:34:20 +0000 (19:34 +0300)] 
pop3: Do not expunge \Deleted mails without QUIT

Prevents loss of email if connection
is unexpectedly terminated.

6 years agocassandra: Add proper log levels to logged messages
Timo Sirainen [Thu, 26 Apr 2018 18:07:31 +0000 (21:07 +0300)] 
cassandra: Add proper log levels to logged messages

If logging to "internal handler", i.e. to log process, write the log prefix
that includes the log level. This way Cassandra's trace/debug/info messages
won't end up in error log.

6 years agolib: Add i_failure_handler_is_internal()
Timo Sirainen [Thu, 26 Apr 2018 18:07:22 +0000 (21:07 +0300)] 
lib: Add i_failure_handler_is_internal()

7 years agolib-storage: fail storage: Allocate event for mailbox.
Stephan Bosch [Wed, 20 Jun 2018 10:40:37 +0000 (12:40 +0200)] 
lib-storage: fail storage: Allocate event for mailbox.

Absence of event causes segfault when event logging is performed for the
mailbox.

7 years agolib-master: Unit test for sending events to stats.
Sergey Kitov [Mon, 1 Oct 2018 08:02:58 +0000 (11:02 +0300)] 
lib-master: Unit test for sending events to stats.

7 years agolib-smtp: client: Make the initialization of the connection after SSL handshake reliable.
Stephan Bosch [Wed, 26 Sep 2018 10:25:59 +0000 (12:25 +0200)] 
lib-smtp: client: Make the initialization of the connection after SSL handshake reliable.

Before, the connection was not guaranteed to be fully initialized after the SSL
handshake. The problem would occur when the handshake finished while writing the
SSL output stream. In a similar HTTP client issue, this caused a segfault.

7 years agolib-http: client: Fix segfault by making the initialization of the connection after...
Stephan Bosch [Tue, 25 Sep 2018 22:26:32 +0000 (00:26 +0200)] 
lib-http: client: Fix segfault by making the initialization of the connection after SSL handshake reliable.

Before, the connection was not guaranteed to be fully initialized after the SSL
handshake. The problem would occur when the handshake finished while writing the
SSL output stream.

7 years agosubmission: Reorder initialization code
Aki Tuomi [Thu, 23 Aug 2018 17:29:58 +0000 (20:29 +0300)] 
submission: Reorder initialization code

login_set socket paths get invalidated when
master_service_init_finish is called, so we need
to run the code that uses them before this.

7 years agolib-smtp: Increase memory pool initial sizes
Aki Tuomi [Thu, 23 Aug 2018 16:15:50 +0000 (19:15 +0300)] 
lib-smtp: Increase memory pool initial sizes

This reduces malloc traffic

7 years agolib-smtp: server: Fix memory leak occurring when an error occurs early for BDAT/BURL.
Stephan Bosch [Tue, 19 Jun 2018 22:22:47 +0000 (00:22 +0200)] 
lib-smtp: server: Fix memory leak occurring when an error occurs early for BDAT/BURL.

7 years agolib-smtp: server: connection: Rely on i_stream_destroy(NULL) being a no-op.
Stephan Bosch [Wed, 20 Jun 2018 13:54:21 +0000 (15:54 +0200)] 
lib-smtp: server: connection: Rely on i_stream_destroy(NULL) being a no-op.

7 years agolib-smtp: server: Restructure reference counting of BDAT/BURL chain stream.
Stephan Bosch [Tue, 19 Jun 2018 22:31:43 +0000 (00:31 +0200)] 
lib-smtp: server: Restructure reference counting of BDAT/BURL chain stream.

It is now dereferenced directly, rather than via a local variable; thereby
making sure it is reset to NULL.

7 years agodirector: Fix assert-crash when doveadm disconnects immediately after sending command
Timo Sirainen [Fri, 29 Jun 2018 11:37:36 +0000 (14:37 +0300)] 
director: Fix assert-crash when doveadm disconnects immediately after sending command

Any command that requires a ring sync should cause the doveadm connection to
wait until the ring is synced. However, if the disconnection happened early
enough the connection is deinitialized before the ring sync is finished.

Fixes:
Panic: file doveadm-connection.c: line 1097 (doveadm_connection_deinit): assertion failed: (conn->to_ring_sync_abort == NULL)

7 years agodirector: Add assert to make sure doveadm connection's IO isn't added multiple times
Timo Sirainen [Wed, 19 Sep 2018 08:32:08 +0000 (11:32 +0300)] 
director: Add assert to make sure doveadm connection's IO isn't added multiple times

7 years agodoveadm: Make sure to stop running commands requiring synced ring when ring is no...
Timo Sirainen [Fri, 7 Sep 2018 17:04:48 +0000 (20:04 +0300)] 
doveadm: Make sure to stop running commands requiring synced ring when ring is no longer synced

A command could desync the ring, and no more commands should be run
afterwards.

This also fixes a bug where a command that desyncs the ring is supposed to
wait for the ring being synced before returning OK, but returns it
immediately instead.

7 years agolib/printf-format-fix: fix rejection of "%.0f" as a valid string
Phil Carmody [Wed, 3 Jan 2018 13:54:15 +0000 (15:54 +0200)] 
lib/printf-format-fix: fix rejection of "%.0f" as a valid string

Sometimes you want to calculate in floats, but don't want the decimals
printed.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
7 years agolib-smtp: reply-parser: Fix closing the text_lines array with NULL sentinel.
Stephan Bosch [Wed, 19 Sep 2018 20:26:08 +0000 (22:26 +0200)] 
lib-smtp: reply-parser: Fix closing the text_lines array with NULL sentinel.

For (EHLO) replies with more than 7 lines, the text_lines array of the reply did
not end in NULL, causing a segfault.

7 years agolib: i_zero*() - Give compiler error if it's wrongly used on an array
Timo Sirainen [Thu, 13 Sep 2018 12:30:22 +0000 (15:30 +0300)] 
lib: i_zero*() - Give compiler error if it's wrongly used on an array

7 years agolib-master, auth: Fix clearing memory
Timo Sirainen [Thu, 13 Sep 2018 12:29:45 +0000 (15:29 +0300)] 
lib-master, auth: Fix clearing memory

It doesn't look like these being wrong were causing any bugs.

7 years agodoveadm stats dump: Fix potentially not writing all stats output
Timo Sirainen [Tue, 11 Sep 2018 12:54:39 +0000 (15:54 +0300)] 
doveadm stats dump: Fix potentially not writing all stats output

It depended on whether uninitialized stack memory was 0 or not.

7 years agolib: Mark signal waiting IO as "never wait alone"
Timo Sirainen [Fri, 17 Aug 2018 08:34:02 +0000 (11:34 +0300)] 
lib: Mark signal waiting IO as "never wait alone"

This signal is being automatically moved to nested ioloops. It can't be the
only IO being waited, since there's no code that simply wants to wait for a
signal.

7 years agolib: ioloop-epoll/kqueue: Remove now unnecessary infinite wait check.
Timo Sirainen [Fri, 17 Aug 2018 08:33:17 +0000 (11:33 +0300)] 
lib: ioloop-epoll/kqueue: Remove now unnecessary infinite wait check.

The previous change adds this globally to io_loop_run_get_wait_time().

7 years agolib: Add io_set_never_wait_alone()
Timo Sirainen [Fri, 17 Aug 2018 08:32:10 +0000 (11:32 +0300)] 
lib: Add io_set_never_wait_alone()

If ioloop is run without any timeouts and without IOs that don't have this
flag, assert-crash rather than going to infinite wait.

7 years agolib: Add and use io_loop_run_get_wait_time()
Timo Sirainen [Fri, 17 Aug 2018 08:29:30 +0000 (11:29 +0300)] 
lib: Add and use io_loop_run_get_wait_time()

This is going to be called just before running an ioloop iteration.
The next commit improves its behavior.

7 years agolib-storage: Don't try to deserialize bodystructure if we already have it
Josef 'Jeff' Sipek [Fri, 7 Sep 2018 14:43:43 +0000 (10:43 -0400)] 
lib-storage: Don't try to deserialize bodystructure if we already have it

Fixes:
Panic: file message-part-data.c: line 37 (message_part_data_is_plain_7bit): assertion failed: (data != NULL)

7 years agolib-storage: Simplify an assertion condition
Josef 'Jeff' Sipek [Thu, 6 Sep 2018 15:07:22 +0000 (11:07 -0400)] 
lib-storage: Simplify an assertion condition

Since the i_assert() is guarded by a check for save_bodystructure_header
being true, the whole condition can be simplified.

7 years agolib-storage: Don't try to process header if we haven't parsed the body structure
Josef 'Jeff' Sipek [Thu, 6 Sep 2018 15:06:17 +0000 (11:06 -0400)] 
lib-storage: Don't try to process header if we haven't parsed the body structure

Fixes:
Panic: file index-mail-headers.c: line 294 (index_mail_parse_header): assertion failed: (part != NULL)

7 years agolib: Move log type to be written before appended log prefix
Timo Sirainen [Fri, 31 Aug 2018 12:06:09 +0000 (15:06 +0300)] 
lib: Move log type to be written before appended log prefix

This changes the logging format back to how it used to be before the event
logging changes.

7 years agolib: Add failure_context.log_prefix_type_pos
Timo Sirainen [Fri, 31 Aug 2018 12:03:37 +0000 (15:03 +0300)] 
lib: Add failure_context.log_prefix_type_pos

If non-zero, this specifies where the log type (e.g. "Info: ") is written
within the log prefix. By default it's appended.

7 years agolib, log: Add log prefix length to internal logging protocol
Timo Sirainen [Fri, 31 Aug 2018 12:01:38 +0000 (15:01 +0300)] 
lib, log: Add log prefix length to internal logging protocol

This way log process knows which part of the text is the log prefix, and
which part is the logged text.

7 years agolog: Move data stack frame allocation to parent function
Timo Sirainen [Fri, 31 Aug 2018 11:57:13 +0000 (14:57 +0300)] 
log: Move data stack frame allocation to parent function

This simplifies the next commit, which requires data stack nearly always
when logging. The data stack frames are cheap enough that we don't really
need to optimize for avoiding the cases when they're not needed.

7 years agolog: Avoid unnecessary global log prefix changes
Timo Sirainen [Fri, 31 Aug 2018 11:54:18 +0000 (14:54 +0300)] 
log: Avoid unnecessary global log prefix changes

If the context specifies a log prefix, the global prefix isn't going to be
used.

7 years agolib: failures - Use common log_prefix_add() for default and syslog formatters
Timo Sirainen [Fri, 31 Aug 2018 11:50:52 +0000 (14:50 +0300)] 
lib: failures - Use common log_prefix_add() for default and syslog formatters

7 years agolib: Add unit test for event log prefix handling
Timo Sirainen [Tue, 28 Aug 2018 09:45:23 +0000 (12:45 +0300)] 
lib: Add unit test for event log prefix handling

Some of the tests are commented out until they're fixed in a following
commit.

7 years agolib: failures - Move adding LF from default_format() to default_write()
Timo Sirainen [Fri, 31 Aug 2018 11:30:21 +0000 (14:30 +0300)] 
lib: failures - Move adding LF from default_format() to default_write()

This makes it similar to internal_format/write()

7 years agolib: Move failure handler structs and typedefs to failures-private.h
Timo Sirainen [Fri, 31 Aug 2018 11:21:06 +0000 (14:21 +0300)] 
lib: Move failure handler structs and typedefs to failures-private.h

Also change the function typedefs to be non-pointers, like they usually are
in Dovecot code.

7 years agolib: Make failure handler variables static
Timo Sirainen [Fri, 31 Aug 2018 11:19:32 +0000 (14:19 +0300)] 
lib: Make failure handler variables static

7 years agolib: Rename handler_config variable to failure_handler
Timo Sirainen [Fri, 31 Aug 2018 11:18:34 +0000 (14:18 +0300)] 
lib: Rename handler_config variable to failure_handler

It's a global variable, so it needs to have a proper prefix.

7 years agolib: Implement vfuncs for logging to stderr
Sergey Kitov [Thu, 14 Jun 2018 12:54:03 +0000 (15:54 +0300)] 
lib: Implement vfuncs for logging to stderr

7 years agolib: Implement vfuncs for logging to syslog
Sergey Kitov [Thu, 14 Jun 2018 12:49:41 +0000 (15:49 +0300)] 
lib: Implement vfuncs for logging to syslog

7 years agolib: Implement vfuncs for logging to default location and common failure logging...
Sergey Kitov [Sun, 5 Aug 2018 01:00:17 +0000 (04:00 +0300)] 
lib: Implement vfuncs for logging to default location and common failure logging handling

7 years agolib: Introduce abstraction for failure logging implementations.
Sergey Kitov [Tue, 12 Jun 2018 12:56:46 +0000 (15:56 +0300)] 
lib: Introduce abstraction for failure logging implementations.

7 years agolib-master: Fix crash when stats events are merged all the way to the root
Timo Sirainen [Mon, 3 Sep 2018 11:15:07 +0000 (14:15 +0300)] 
lib-master: Fix crash when stats events are merged all the way to the root

7 years agolib-master: stats_event_get_merged() - Remove unnecessary variable assignment
Timo Sirainen [Mon, 3 Sep 2018 10:14:39 +0000 (13:14 +0300)] 
lib-master: stats_event_get_merged() - Remove unnecessary variable assignment

Fixes scan-build complaint.

7 years agolib-master: stats_event_write use BEGIN only when event and parent_event create times...
Sergey Kitov [Tue, 16 Jan 2018 10:51:53 +0000 (12:51 +0200)] 
lib-master: stats_event_write use BEGIN only when event and parent_event create timestamps differ

7 years agolib: Add some event handling functions.
Sergey Kitov [Mon, 26 Feb 2018 14:33:19 +0000 (16:33 +0200)] 
lib: Add some event handling functions.

event_has_all_categories() - checks if given event contains all the
categories of an another event.
event_has_all_fields() - checks if given event contains all the fields
of an another event.
event_dup() - duplicates an event.
event_copy_categories_fields() - copies all categories and fields from
source to dest.

7 years agolib-http: client: peer: Log the number of pending connections consistently in relevan...
Stephan Bosch [Thu, 6 Sep 2018 01:40:55 +0000 (03:40 +0200)] 
lib-http: client: peer: Log the number of pending connections consistently in relevant debug messages.

Use the same style everywhere and log it where it makes sense.

7 years agolib-http: client: peer: Maintain a list of connections pending on behalf of a peer.
Stephan Bosch [Thu, 6 Sep 2018 01:33:59 +0000 (03:33 +0200)] 
lib-http: client: peer: Maintain a list of connections pending on behalf of a peer.

Before, pending connections were only listed in the peer pool.

7 years agolib-http: client: connection: Unlist the connection as pending immediately in http_cl...
Stephan Bosch [Thu, 6 Sep 2018 01:23:26 +0000 (03:23 +0200)] 
lib-http: client: connection: Unlist the connection as pending immediately in http_client_connection_failure().

7 years agolib-http: client: connection: Remove the connection from the peer pool pending list...
Stephan Bosch [Wed, 5 Sep 2018 23:57:43 +0000 (01:57 +0200)] 
lib-http: client: connection: Remove the connection from the peer pool pending list in a separate function.

7 years agolib-http: client: peer: Notify all peers in a peer pool about a successful connection.
Stephan Bosch [Thu, 6 Sep 2018 13:22:30 +0000 (15:22 +0200)] 
lib-http: client: peer: Notify all peers in a peer pool about a successful connection.

This allows peers for which the last connection attempt failed (which was not
the last pending attempt in the pool) to try again. This solves a problem that
could potentially cause a hang with multiple parallel clients creating serveral
new connections at once.

7 years agolib-http: client: peer: Add debug message for http_client_peer_connection_failure().
Stephan Bosch [Thu, 6 Sep 2018 14:03:58 +0000 (16:03 +0200)] 
lib-http: client: peer: Add debug message for http_client_peer_connection_failure().

7 years agolib-http: client: peer: Clarify debug message in http_client_peer_connection_failed_p...
Stephan Bosch [Thu, 6 Sep 2018 13:56:44 +0000 (15:56 +0200)] 
lib-http: client: peer: Clarify debug message in http_client_peer_connection_failed_pool().

7 years agolib-http: client: peer: Log debug message before calling peer pool in http_client_pee...
Stephan Bosch [Thu, 6 Sep 2018 13:54:02 +0000 (15:54 +0200)] 
lib-http: client: peer: Log debug message before calling peer pool in http_client_peer_connection_success().

7 years agolib-http: client: peer: Rename http_client_peer_connection_failed_any() to http_clien...
Stephan Bosch [Thu, 6 Sep 2018 13:50:36 +0000 (15:50 +0200)] 
lib-http: client: peer: Rename http_client_peer_connection_failed_any() to http_client_peer_connection_failed_pool().

7 years agolib-http: client: peer: Always run http_client_queue_connection_failure() upon defini...
Stephan Bosch [Thu, 6 Sep 2018 01:11:18 +0000 (03:11 +0200)] 
lib-http: client: peer: Always run http_client_queue_connection_failure() upon definitive connection failure.

The recorded peer->connecting flag was highly unreliable in a scenario involving
starting parallel connections. This way, the linked queues can update their
state accordingly. Also, this will not cause empty queues to initiate new
connection, because empty queues will do nothing after updating the connection
state.

This problem caused a client ioloop hang in high-load conditions.

7 years agolib-http: client: peer: Move http_client_peer_connection_failure().
Stephan Bosch [Thu, 6 Sep 2018 12:57:28 +0000 (14:57 +0200)] 
lib-http: client: peer: Move http_client_peer_connection_failure().

7 years agolib-http: client: queue: Do not fail claimed requests unless the queue is being destr...
Stephan Bosch [Thu, 6 Sep 2018 01:02:16 +0000 (03:02 +0200)] 
lib-http: client: queue: Do not fail claimed requests unless the queue is being destroyed.

Before, connection failure would also abort requests already being sent on
another connection, which is premature at best.

7 years agolib-http: client: queue: Fix the number of pending requests listed in http_client_que...
Stephan Bosch [Thu, 6 Sep 2018 00:57:24 +0000 (02:57 +0200)] 
lib-http: client: queue: Fix the number of pending requests listed in http_client_queue_connection_failure() debug message.

7 years agolib-http: client: peer: Determine number of pending peers in http_client_peer_shared_...
Stephan Bosch [Thu, 6 Sep 2018 00:51:09 +0000 (02:51 +0200)] 
lib-http: client: peer: Determine number of pending peers in http_client_peer_shared_connection_failure() itself.

Before, the number of pending peers was a parameter, but that was only for a
single peer pool. This is wrong, since the one peer can have many different
pools (depending on how many clients with incompatible configs share this
peer).

7 years agolib-http: client: peer: Notify definitive connection failure only within a peer pool.
Stephan Bosch [Thu, 6 Sep 2018 12:49:59 +0000 (14:49 +0200)] 
lib-http: client: peer: Notify definitive connection failure only within a peer pool.

Other peer pools have different configuration, which may actually succeed and
will arrive at this point when their own connections fail anyway.

7 years agoquota: Mark noenforcing quotas with unlimited quota
Aki Tuomi [Tue, 24 Jul 2018 11:47:47 +0000 (14:47 +0300)] 
quota: Mark noenforcing quotas with unlimited quota

This allows quota to be properly updated for unenforced quotas
so they can be used for tracking only.

This fixes issue where using noenforcing would not update quota
during mail save, but requires a manual quota update.

7 years agoquota: Cleanup - Move enforce checking out of quota_root_visible()
Aki Tuomi [Tue, 24 Jul 2018 11:38:18 +0000 (14:38 +0300)] 
quota: Cleanup - Move enforce checking out of quota_root_visible()

Non-enforcing quota roots need to be visible even when enforcing quotas,
otherwise we cannot update them.

7 years agofts: Optimize replacing NULs in header
Timo Sirainen [Mon, 27 Aug 2018 12:06:44 +0000 (15:06 +0300)] 
fts: Optimize replacing NULs in header

7 years agofts: Fix indexing mails with NULs in headers
Timo Sirainen [Thu, 23 Aug 2018 11:33:59 +0000 (14:33 +0300)] 
fts: Fix indexing mails with NULs in headers

After the first NUL all the rest of the string was converted to spaces.
This was broken already in the initial commit that attempted to fix this:
4d27f95c76bd008bb38f9c442567046da2b6ce14

7 years agolib-index: mail_cache_lookup_headers() - Allow using datastack pool
Timo Sirainen [Mon, 20 Aug 2018 09:51:28 +0000 (12:51 +0300)] 
lib-index: mail_cache_lookup_headers() - Allow using datastack pool

This fixes assert caused by 53712af0e7f357e7279d9ff03831428aae85aa45:
Panic: pool_data_stack_realloc(): stack frame changed

7 years agolib-storage: Fix NUL handling in mail_get_first_header*(), mail_get_headers*()
Timo Sirainen [Fri, 17 Aug 2018 11:39:41 +0000 (14:39 +0300)] 
lib-storage: Fix NUL handling in mail_get_first_header*(), mail_get_headers*()

These functions return NUL-terminated values, so they got truncated whenever
a header value contained a NUL. Fix this by converting NULs to unicode
replacement characters in the output.

7 years agolib-mail: Make message_header_strdup() public
Timo Sirainen [Fri, 17 Aug 2018 11:33:50 +0000 (14:33 +0300)] 
lib-mail: Make message_header_strdup() public

Also move it to a better file.

7 years agolib-mail: Cleanup - Rename internal hdr_strdup() to message_header_strdup()
Timo Sirainen [Fri, 17 Aug 2018 17:16:29 +0000 (20:16 +0300)] 
lib-mail: Cleanup - Rename internal hdr_strdup() to message_header_strdup()

7 years agolib-mail: rfc822-parser - Handle \<NUL> in quoted-string and domain-literal
Timo Sirainen [Fri, 17 Aug 2018 11:12:25 +0000 (14:12 +0300)] 
lib-mail: rfc822-parser - Handle \<NUL> in quoted-string and domain-literal

It was already handled in comments. Previously this caused the strings and
domain-literals to be truncated at that position.

7 years agolib-mail: test-message-address - Test NULs in display-name
Timo Sirainen [Fri, 17 Aug 2018 10:42:35 +0000 (13:42 +0300)] 
lib-mail: test-message-address - Test NULs in display-name

7 years agolib-mail: Change MESSAGE_ADDRESS_PARSE_FLAG_NON_STRICT_DOTS to _FLAG_STRICT_DOTS
Timo Sirainen [Fri, 4 May 2018 16:53:27 +0000 (19:53 +0300)] 
lib-mail: Change MESSAGE_ADDRESS_PARSE_FLAG_NON_STRICT_DOTS to _FLAG_STRICT_DOTS

Generally we want it to be enabled everywhere, so it's easier to just enable
it by default.

(This is kept as a separate commit from the previous one so it'll be easy to
revert this in case we actually don't want this to be the default.)

7 years agolib-mail: Add MESSAGE_ADDRESS_PARSE_FLAG_NON_STRICT_DOTS
Timo Sirainen [Fri, 4 May 2018 16:49:57 +0000 (19:49 +0300)] 
lib-mail: Add MESSAGE_ADDRESS_PARSE_FLAG_NON_STRICT_DOTS

This code is somewhat copy&pasted from parse_local_part() in Pigeonhole.

7 years agolib-mail: message_address_parse() - Change fill_missing parameter to flags
Timo Sirainen [Fri, 4 May 2018 16:31:26 +0000 (19:31 +0300)] 
lib-mail: message_address_parse() - Change fill_missing parameter to flags

This change allows adding more flags. The API is also backwards compatible
in a way that the old FALSE/TRUE values still map to compatible 0/1 flags.

7 years agolib-mail: Fix rfc822_parse_dot_atom() to reject if dot isn't followed by atom
Timo Sirainen [Fri, 4 May 2018 16:21:52 +0000 (19:21 +0300)] 
lib-mail: Fix rfc822_parse_dot_atom() to reject if dot isn't followed by atom

7 years agolib-mail: Remove MESSAGE_HEADER_REPLACE_NULS_WITH_0x80 flag
Timo Sirainen [Wed, 25 Apr 2018 11:19:27 +0000 (14:19 +0300)] 
lib-mail: Remove MESSAGE_HEADER_REPLACE_NULS_WITH_0x80 flag

As mentioned in previous commit, 0x80 isn't valid UTF-8 and we shouldn't
encourage using it. This implementation also can't be easily changed to
use unicode replacement character without larger changes to istream-nonuls.

Reverts 95fba2c295bb84639dc64ca5c9f2ccb9edc00ba7.

7 years agolib-mail: Change NUL -> 0x80 replacement to use unicode replacement char instead
Timo Sirainen [Wed, 25 Apr 2018 11:17:34 +0000 (14:17 +0300)] 
lib-mail: Change NUL -> 0x80 replacement to use unicode replacement char instead

Using 0x80 produces invalid UTF-8 output, which we should avoid. Some places
in Dovecot code already requires that input is valid UTF-8, so it's also
safer and easier to use the unicode replacement character.

Fixes: Panic: file fts-tokenizer-generic.c: line 210 (fts_tokenizer_generic_simple_next): assertion failed: (char_size > 0)
7 years agolib-mail: Change rfc822_parser_context.nul_replacement_char to string
Timo Sirainen [Wed, 25 Apr 2018 11:11:43 +0000 (14:11 +0300)] 
lib-mail: Change rfc822_parser_context.nul_replacement_char to string

7 years agolib-mail: message_part_*_parse_from_header() - Replace NULs with 0x80
Timo Sirainen [Tue, 24 Apr 2018 15:01:03 +0000 (18:01 +0300)] 
lib-mail: message_part_*_parse_from_header() - Replace NULs with 0x80

This avoids truncation of Content-*, Subject, Message-ID, In-Reply-To and
Date headers in IMAP ENVELOPE, BODY and BODYSTRUCTURE replies. Of course,
NULs in headers are violating RFCs already, so the previous behavior wasn't
really wrong either.

7 years agolib: Mark str_append_n() deprecated
Timo Sirainen [Sat, 21 Apr 2018 13:21:33 +0000 (16:21 +0300)] 
lib: Mark str_append_n() deprecated

It was almost always used wrongly. Most of the time str_append_data()
should have been used instead. str_append_max() has the old functionality.

7 years agolib: Add ATTR_DEPRECATED macro
Timo Sirainen [Sat, 21 Apr 2018 13:19:43 +0000 (16:19 +0300)] 
lib: Add ATTR_DEPRECATED macro