]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
6 years agoReleased v2.3.3. release-2.3.3 2.3.3
Timo Sirainen [Mon, 1 Oct 2018 10:36:56 +0000 (13:36 +0300)] 
Released v2.3.3.

6 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.

6 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

6 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.

6 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.

6 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.

6 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)

6 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

6 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.

6 years agolib/printf-format-fix: fix rejection of "%.0f" as a valid string 2.3.3.rc1
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>
6 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.

6 years agoReleased v2.3.3.rc1.
Timo Sirainen [Thu, 20 Sep 2018 16:34:33 +0000 (19:34 +0300)] 
Released v2.3.3.rc1.

6 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

6 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.

6 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.

6 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.

6 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().

6 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.

6 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.

6 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)

6 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.

6 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)

6 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.

6 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.

6 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.

6 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.

6 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.

6 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

6 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.

6 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()

6 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.

6 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

6 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.

6 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

6 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

6 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

6 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.

6 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

6 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.

6 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

6 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.

6 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.

6 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.

6 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().

6 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.

6 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.

6 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().

6 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().

6 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().

6 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().

6 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.

6 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().

6 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.

6 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.

6 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).

6 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.

6 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.

6 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.

6 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

6 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

6 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

6 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.

6 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.

6 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()

6 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.

6 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

6 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.)

6 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.

6 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.

6 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

6 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.

6 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)
6 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

6 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.

6 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.

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

6 years agoglobal: Replace str_append_n() with str_append_max()
Timo Sirainen [Sat, 21 Apr 2018 13:17:03 +0000 (16:17 +0300)] 
global: Replace str_append_n() with str_append_max()

6 years agolib-fts: fts-tokenizer-address - Cleanup NUL handling in parent_data
Timo Sirainen [Sat, 21 Apr 2018 13:07:21 +0000 (16:07 +0300)] 
lib-fts: fts-tokenizer-address - Cleanup NUL handling in parent_data

The end result is anyway that the token will be truncated at the first NUL.
This change just makes the code a bit more understandable on where the
truncation will happen.

6 years agolib: str_append_[tab]unescaped(): Don't truncate input at NULs
Timo Sirainen [Sat, 21 Apr 2018 12:44:11 +0000 (15:44 +0300)] 
lib: str_append_[tab]unescaped(): Don't truncate input at NULs

For str_append_tabunescaped() the input is supposed to have NULs already
escaped though, so it was truncating only with invalid input.

6 years agoglobal: Replace str_append_n() with str_append_data() wherever possible
Timo Sirainen [Sat, 21 Apr 2018 12:24:28 +0000 (15:24 +0300)] 
global: Replace str_append_n() with str_append_data() wherever possible

It shouldn't be possible for input to have NULs in any of these places.
This makes the extra NUL-check in str_append_n() unnecessary.

6 years agolib: Add str_append_max()
Timo Sirainen [Sat, 21 Apr 2018 13:11:48 +0000 (16:11 +0300)] 
lib: Add str_append_max()

It's otherwise the same as str_append_n(), except it takes const char* as
input instead of const void*. This, as well as its name, should make it
less likely to be used wrong when the input may legitimately have NULs.

The unit test is changed from str_append_n() to str_append_max(), because
str_append_n() will be deprecated.

6 years agolib: Improve str_append_n() comment
Timo Sirainen [Sat, 21 Apr 2018 13:10:03 +0000 (16:10 +0300)] 
lib: Improve str_append_n() comment

6 years agolib-mail: Add MESSAGE_HEADER_REPLACE_NULS_WITH_0x80 flag
Sergey Kitov [Wed, 11 Apr 2018 11:41:45 +0000 (14:41 +0300)] 
lib-mail: Add MESSAGE_HEADER_REPLACE_NULS_WITH_0x80 flag

The flag signals that input stream for message_parse_header() should replace
0x0 symbols with 0x80.

6 years agolib-mail: rfc2231_parse() - Replace NULs with 0x80
Timo Sirainen [Sat, 21 Apr 2018 13:47:16 +0000 (16:47 +0300)] 
lib-mail: rfc2231_parse() - Replace NULs with 0x80

Instead of truncating the strings at NULs.

6 years agolib-mail: message_address_parse*() - Replace NULs with 0x80
Timo Sirainen [Sat, 21 Apr 2018 13:34:05 +0000 (16:34 +0300)] 
lib-mail: message_address_parse*() - Replace NULs with 0x80

Instead of truncating the strings at NULs.

6 years agolib-mail: rfc822-parser: Add nul_replacement_char
Timo Sirainen [Sat, 21 Apr 2018 13:27:21 +0000 (16:27 +0300)] 
lib-mail: rfc822-parser: Add nul_replacement_char

6 years agolib-mail: rfc822-parser: Strip away folding whitespace from comments
Timo Sirainen [Sat, 21 Apr 2018 10:46:21 +0000 (13:46 +0300)] 
lib-mail: rfc822-parser: Strip away folding whitespace from comments

6 years agolib-mail: rfc822-parser: Improve domain-literal parsing
Timo Sirainen [Sat, 21 Apr 2018 10:28:34 +0000 (13:28 +0300)] 
lib-mail: rfc822-parser: Improve domain-literal parsing

Strip away folding whitespace. Treat any extra '[' as an error.

6 years agolib-mail: rfc822-parser: Don't allow preserving escaped [CR]LF
Timo Sirainen [Sat, 21 Apr 2018 10:05:49 +0000 (13:05 +0300)] 
lib-mail: rfc822-parser: Don't allow preserving escaped [CR]LF

It's not valid to have "\<CR>" or "\<LF>", so the old behavior isn't really
wrong either. However, rfc822_parse_quoted_string() callers are more likely
to expect that the output won't contain any [CR]LF so this new behavior is
a bit better.

6 years agolib-mail: Change rfc822_parse_content_param() API to allow NULs in value
Timo Sirainen [Sat, 21 Apr 2018 09:47:22 +0000 (12:47 +0300)] 
lib-mail: Change rfc822_parse_content_param() API to allow NULs in value

This was the only function in rfc822-parser.h that wasn't NUL-safe.
This won't fix anything, but it makes the rfc822-parser.h API fully
consistent with the NUL handling.

Normally rfc2231_parse() should be called instead of calling
rfc822_parse_content_param() directly, so this shouldn't break any plugins.

6 years agofts-squat: Fix truncating headers at NULs while indexing
Timo Sirainen [Sat, 21 Apr 2018 13:05:16 +0000 (16:05 +0300)] 
fts-squat: Fix truncating headers at NULs while indexing

6 years agologin-common: Consistently truncate client SASL input at first NUL
Timo Sirainen [Sat, 21 Apr 2018 13:03:42 +0000 (16:03 +0300)] 
login-common: Consistently truncate client SASL input at first NUL

The input is supposed to be base64-encoded, so there's no need to support
actual NUL characters. The previous code truncated at NULs, but could have
kept appending more data to the value. This could have produced somewhat
random results.

6 years agolib-master, util: Consistently truncate tabescaped input at the first NUL
Timo Sirainen [Sat, 21 Apr 2018 12:58:15 +0000 (15:58 +0300)] 
lib-master, util: Consistently truncate tabescaped input at the first NUL

The NULs are supposed to come tab-escaped, so there's no need to support
actual NUL characters. The previous code truncated at NULs, but could
have kept appending more data to the value. This could have produced
somewhat random results.

6 years agoconfig: Consistently truncate value at the first NUL in value input file
Timo Sirainen [Sat, 21 Apr 2018 12:53:42 +0000 (15:53 +0300)] 
config: Consistently truncate value at the first NUL in value input file

When value contained "<file", the file was added as a value. The setting
values don't currently support NULs, so the value gets truncated at the
first NUL. However, the previous code could have appended more data to
the value. This could have produced somewhat confusing results.

6 years agodict-fs/memcached-ascii/redis: Consistently truncate value at NULs
Timo Sirainen [Sat, 21 Apr 2018 12:50:08 +0000 (15:50 +0300)] 
dict-fs/memcached-ascii/redis: Consistently truncate value at NULs

The dict API currently doesn't support NULs in values, so they have to be
truncated. However, previously they were truncated at NULs, but more data
may have still been appended to the value. This could have produced
somewhat random results.

6 years agoauth: checkpassword - Fail if input from script contains NULs
Timo Sirainen [Sat, 21 Apr 2018 12:47:23 +0000 (15:47 +0300)] 
auth: checkpassword - Fail if input from script contains NULs

Previously the input was just silently truncated at NULs.

6 years agodoveadm: Fix table printer to not truncate output at NULs
Timo Sirainen [Sat, 21 Apr 2018 12:42:53 +0000 (15:42 +0300)] 
doveadm: Fix table printer to not truncate output at NULs

6 years agodoveadm dump: Don't truncate dovecot.index.cache values at NULs
Timo Sirainen [Sat, 21 Apr 2018 12:41:44 +0000 (15:41 +0300)] 
doveadm dump: Don't truncate dovecot.index.cache values at NULs

6 years agolib-mail: rfc822-parser: Don't truncate comment/quoted-string/domain-literal at NUL
Timo Sirainen [Sat, 21 Apr 2018 11:56:43 +0000 (14:56 +0300)] 
lib-mail: rfc822-parser: Don't truncate comment/quoted-string/domain-literal at NUL

The other tokens couldn't have contained NULs in the first place.

6 years agolib-mail: message_snippet_generate() - Ignore NULs without shrinking snippet size
Timo Sirainen [Sat, 21 Apr 2018 11:53:25 +0000 (14:53 +0300)] 
lib-mail: message_snippet_generate() - Ignore NULs without shrinking snippet size

Previously the NULs also weren't in the snippet content, but they were
included in the snippet size.