]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
8 years agolib: istream-sized - set stream_errno=EPIPE if stream is too small
Timo Sirainen [Fri, 23 Dec 2016 17:51:41 +0000 (12:51 -0500)] 
lib: istream-sized - set stream_errno=EPIPE if stream is too small

8 years agolib: istream-sized - remove explicit i_error() logging
Timo Sirainen [Fri, 23 Dec 2016 17:26:17 +0000 (12:26 -0500)] 
lib: istream-sized - remove explicit i_error() logging

The stream_errno is set, so it's the caller's responsibility to log the
error. There's no need to log it twice.

8 years agolib-compression: istream-{bzlib|lz4} - set stream_errno=EPIPE on unexpected EOF
Timo Sirainen [Fri, 23 Dec 2016 18:19:50 +0000 (13:19 -0500)] 
lib-compression: istream-{bzlib|lz4} - set stream_errno=EPIPE on unexpected EOF

8 years agolib-mail: istream-qp-decoder: set stream_errno=EPIPE on unexpected EOF
Timo Sirainen [Fri, 23 Dec 2016 18:30:56 +0000 (13:30 -0500)] 
lib-mail: istream-qp-decoder: set stream_errno=EPIPE on unexpected EOF

8 years agolib-fs: istream-metawrap - set stream_errno=EPIPE on unexpected EOF
Timo Sirainen [Fri, 23 Dec 2016 18:23:39 +0000 (13:23 -0500)] 
lib-fs: istream-metawrap - set stream_errno=EPIPE on unexpected EOF

8 years agolib-storage: istream-mail - Use EPIPE if istream is too small
Timo Sirainen [Fri, 23 Dec 2016 18:14:43 +0000 (13:14 -0500)] 
lib-storage: istream-mail - Use EPIPE if istream is too small

8 years agolib-mail: Improve istream-attachment-extractor unit test for EIO errors
Timo Sirainen [Fri, 23 Dec 2016 18:08:59 +0000 (13:08 -0500)] 
lib-mail: Improve istream-attachment-extractor unit test for EIO errors

8 years agolib-mail: istream-attachment-extractor - use EIO for internal errors
Timo Sirainen [Fri, 23 Dec 2016 17:59:13 +0000 (12:59 -0500)] 
lib-mail: istream-attachment-extractor - use EIO for internal errors

These happen only if the attachment writing failed for some reason.
The input stream itself can't have any errors, so EINVAL isn't proper.

8 years agolib-mail: istream-attachment-extractor - remove unnecessary code
Timo Sirainen [Fri, 23 Dec 2016 17:56:24 +0000 (12:56 -0500)] 
lib-mail: istream-attachment-extractor - remove unnecessary code

It's enough to set the stream_errno.

8 years agolib: istream-jsonstr - return EPIPE if end-of-string quote isn't seen
Timo Sirainen [Fri, 23 Dec 2016 16:57:59 +0000 (11:57 -0500)] 
lib: istream-jsonstr - return EPIPE if end-of-string quote isn't seen

8 years agolib: Add istream-jsonstr unit test.
Timo Sirainen [Fri, 23 Dec 2016 16:28:48 +0000 (11:28 -0500)] 
lib: Add istream-jsonstr unit test.

8 years agolib: istream-jsonstr - minor code cleanup
Timo Sirainen [Wed, 21 Dec 2016 16:35:05 +0000 (18:35 +0200)] 
lib: istream-jsonstr - minor code cleanup

If ret==0 here, it means dest wasn't changed, which must mean that i==0.
Make it clear to avoid confusion.

8 years agolib: istream-base64-decoder - use stream_errno=EPIPE for unexpected EOF
Timo Sirainen [Fri, 23 Dec 2016 17:13:16 +0000 (12:13 -0500)] 
lib: istream-base64-decoder - use stream_errno=EPIPE for unexpected EOF

8 years agoglobal: Use const for all test_functions[] arrays
Timo Sirainen [Fri, 23 Dec 2016 16:22:53 +0000 (11:22 -0500)] 
global: Use const for all test_functions[] arrays

8 years agolib-test: test_run*() - use const for test_functions[] array
Timo Sirainen [Fri, 23 Dec 2016 16:22:11 +0000 (11:22 -0500)] 
lib-test: test_run*() - use const for test_functions[] array

8 years agoglobal: Use "static const" for all struct tests[] arrays
Timo Sirainen [Fri, 23 Dec 2016 15:57:16 +0000 (17:57 +0200)] 
global: Use "static const" for all struct tests[] arrays

8 years agolib-test: test_run_named*() - use const for tests[] array
Timo Sirainen [Fri, 23 Dec 2016 15:48:19 +0000 (17:48 +0200)] 
lib-test: test_run_named*() - use const for tests[] array

8 years ago*-login, imapc: Fix new lib-sasl API usage
Timo Sirainen [Fri, 23 Dec 2016 13:38:54 +0000 (15:38 +0200)] 
*-login, imapc: Fix new lib-sasl API usage

Forgot to include these in a669d351502e15802b121e1a0bd83f27d1d95f01

8 years agolib-index: Fix assert-crash if .log creation unexpectedly fails at the end
Timo Sirainen [Mon, 19 Dec 2016 13:31:50 +0000 (15:31 +0200)] 
lib-index: Fix assert-crash if .log creation unexpectedly fails at the end

Pretty much the only reason for this to happen is if the index directory
was deleted while another process still had the index open. Even this
doesn't normally trigger this crash, because there are other checks earlier
that usually catch it. So it crashes only in some race conditions.

Fixes:
Error: rename(.../dovecot.index.log.newlock, .../dovecot.index.log) failed: No such file or directory
Panic: file mail-transaction-log-file.c: line 105 (mail_transaction_log_file_free): assertion failed: (!file->locked)

8 years agostats: use o_stream_nsend in client-export
Martti Rannanjärvi [Tue, 20 Dec 2016 11:40:17 +0000 (13:40 +0200)] 
stats: use o_stream_nsend in client-export

8 years agofs-randomfail: Fix failure handling for fs_read()
Timo Sirainen [Thu, 22 Dec 2016 16:58:29 +0000 (11:58 -0500)] 
fs-randomfail: Fix failure handling for fs_read()

8 years agolib-index: Fix checking if cache file becomes >4GB
Timo Sirainen [Wed, 21 Dec 2016 18:56:58 +0000 (20:56 +0200)] 
lib-index: Fix checking if cache file becomes >4GB

8 years agoimap: use o_stream_nsend when not checking failure
Martti Rannanjärvi [Tue, 20 Dec 2016 11:34:43 +0000 (13:34 +0200)] 
imap: use o_stream_nsend when not checking failure

8 years agoreplication: ignore o_stream_send errors in doveadm-connection
Martti Rannanjärvi [Tue, 20 Dec 2016 08:03:40 +0000 (10:03 +0200)] 
replication: ignore o_stream_send errors in doveadm-connection

8 years agolib-mail: message_binary_part_deserialize(): Return error if body line count is too...
Timo Sirainen [Thu, 22 Dec 2016 16:53:06 +0000 (11:53 -0500)] 
lib-mail: message_binary_part_deserialize(): Return error if body line count is too large

The input was unsigned int, so output must also fit into unsigned int.

8 years agodovecot.service.in: Improve [service] examples
Timo Sirainen [Thu, 22 Dec 2016 15:48:27 +0000 (10:48 -0500)] 
dovecot.service.in: Improve [service] examples

Move them inside [service] section so that simply uncommenting them works.
Also give a better example of how Environment might be used.

8 years agoreplication plugin: Error handling code cleanup
Timo Sirainen [Wed, 21 Dec 2016 19:33:35 +0000 (21:33 +0200)] 
replication plugin: Error handling code cleanup

The old code happened to work in all cases, but it was more of an accident.

8 years agolib-sasl: API change - use size_t type for input/output lengths
Timo Sirainen [Wed, 21 Dec 2016 18:43:38 +0000 (20:43 +0200)] 
lib-sasl: API change - use size_t type for input/output lengths

It's highly unlikely that the length is ever >4GB, but this avoids any
potential problems with integer truncation.

8 years agolib-fts: Change fts_icu_*() to use ARRAY_TYPE(icu_utf16) for UTF16 input.
Timo Sirainen [Wed, 21 Dec 2016 18:39:37 +0000 (20:39 +0200)] 
lib-fts: Change fts_icu_*() to use ARRAY_TYPE(icu_utf16) for UTF16 input.

This makes it clearer how the API is intended to be used.

8 years agoFix compiling when compiler doesn't support typeof()
Timo Sirainen [Wed, 21 Dec 2016 17:50:10 +0000 (19:50 +0200)] 
Fix compiling when compiler doesn't support typeof()

8 years agolib-index: Make sure buffer is not null before freeing
Aki Tuomi [Mon, 19 Dec 2016 10:16:20 +0000 (12:16 +0200)] 
lib-index: Make sure buffer is not null before freeing

Fixes signal 11 crash under stress.

8 years agoconfigure: Define __STDC_LIMIT_MACROS for CXXFLAGS
Timo Sirainen [Sun, 18 Dec 2016 20:54:11 +0000 (22:54 +0200)] 
configure: Define __STDC_LIMIT_MACROS for CXXFLAGS

Fixes SIZE_MAX being undefined when building fts-lucene.

8 years agomaster: Update assert to make sure optind != 0
Timo Sirainen [Sun, 18 Dec 2016 11:20:39 +0000 (13:20 +0200)] 
master: Update assert to make sure optind != 0

Hopefully prevents Coverity warning about "doubleops[optind]" access being
uninitialized.

8 years agolib: Remove dead code from unit test
Timo Sirainen [Sun, 18 Dec 2016 10:54:34 +0000 (12:54 +0200)] 
lib: Remove dead code from unit test

8 years agolib: Allow only known %chars in printf_format_fix_noalloc()
Timo Sirainen [Tue, 29 Nov 2016 21:37:43 +0000 (23:37 +0200)] 
lib: Allow only known %chars in printf_format_fix_noalloc()

Otherwise if some libc adds a new unsupported character, our %n check might
break.

8 years agolib: Fix %n detection in printf_format_fix_noalloc()
Timo Sirainen [Tue, 29 Nov 2016 21:29:04 +0000 (23:29 +0200)] 
lib: Fix %n detection in printf_format_fix_noalloc()

It's undefined how flags, precision or length modifiers are handled with %n,
so make sure we catch all of them to detect an unwanted %n.

8 years agolib: Optimize printf_format_fix_noalloc()
Timo Sirainen [Tue, 29 Nov 2016 21:21:17 +0000 (23:21 +0200)] 
lib: Optimize printf_format_fix_noalloc()

Using strchr() is faster than looping through the characters manually.
Since this function is being called a lot, it's worth optimizing.

8 years agolib-imap-client: Fixed boolean vs integer mixup in debug message format argument.
Stephan Bosch [Sat, 17 Dec 2016 19:03:46 +0000 (20:03 +0100)] 
lib-imap-client: Fixed boolean vs integer mixup in debug message format argument.

Found with Clang -Wstrict-bool.

8 years agolib-http: client: Added test for premature connection loss to test-http-client-errors.
Stephan Bosch [Fri, 16 Dec 2016 22:38:58 +0000 (23:38 +0100)] 
lib-http: client: Added test for premature connection loss to test-http-client-errors.

8 years agolib-http: client: Added test for normal connection backoff behavior to test-http...
Stephan Bosch [Fri, 16 Dec 2016 22:58:43 +0000 (23:58 +0100)] 
lib-http: client: Added test for normal connection backoff behavior to test-http-client-errors.

8 years agolib-http: client: Treat connections that get disconnected prematurely as connection...
Stephan Bosch [Fri, 16 Dec 2016 22:36:19 +0000 (23:36 +0100)] 
lib-http: client: Treat connections that get disconnected prematurely as connection failures.

This means that the backoff time is increased when this happens.
A premature disconnection happens when the connection is disconnected before any data is received from the server.

8 years agolib-http: client: Consolidated connection loss handling into a single function.
Stephan Bosch [Fri, 16 Dec 2016 21:30:42 +0000 (22:30 +0100)] 
lib-http: client: Consolidated connection loss handling into a single function.

8 years agolib-http: client: Moved connection backoff timer management to separate functions.
Stephan Bosch [Fri, 16 Dec 2016 21:00:47 +0000 (22:00 +0100)] 
lib-http: client: Moved connection backoff timer management to separate functions.

8 years agolib-http: client: Prevent infinite event loop involving the request handler.
Stephan Bosch [Fri, 16 Dec 2016 20:41:29 +0000 (21:41 +0100)] 
lib-http: client: Prevent infinite event loop involving the request handler.

Could happen when a backoff time is active.

8 years agomaster: PROCESS-STATUS output was duplicated many times
Timo Sirainen [Sat, 17 Dec 2016 09:31:42 +0000 (11:31 +0200)] 
master: PROCESS-STATUS output was duplicated many times

8 years agoimapc: Log server disconnection error only once.
Timo Sirainen [Thu, 15 Dec 2016 15:43:11 +0000 (17:43 +0200)] 
imapc: Log server disconnection error only once.

8 years agoimapc: Minor debug logging improvement
Timo Sirainen [Thu, 15 Dec 2016 15:45:06 +0000 (17:45 +0200)] 
imapc: Minor debug logging improvement

8 years agoimapc: Don't retry a failed reconnection before 10 secs have passed
Timo Sirainen [Thu, 15 Dec 2016 15:36:39 +0000 (17:36 +0200)] 
imapc: Don't retry a failed reconnection before 10 secs have passed

This mainly avoids a lot of unnecessary connect attempts within a short
time period, for example if the caller attempts to perform some work for
all the mailboxes.

8 years agoimapc: Fix infinite reconnect loop to remote server that is down
Timo Sirainen [Thu, 15 Dec 2016 15:31:18 +0000 (17:31 +0200)] 
imapc: Fix infinite reconnect loop to remote server that is down

This happened only in some situations. Usually there would have bene some
command in the queue, which would cause the reconnect-check to fail.

8 years agolib: Compiler warning fix for 32bit systems
Timo Sirainen [Sat, 17 Dec 2016 08:55:01 +0000 (10:55 +0200)] 
lib: Compiler warning fix for 32bit systems

8 years agoglobal: Make sure *_malloc() calculations won't cause integer overflows.
Timo Sirainen [Mon, 12 Dec 2016 05:28:00 +0000 (07:28 +0200)] 
global: Make sure *_malloc() calculations won't cause integer overflows.

8 years agoglobal: Change string position/length from unsigned int to size_t
Timo Sirainen [Mon, 12 Dec 2016 05:19:55 +0000 (07:19 +0200)] 
global: Change string position/length from unsigned int to size_t

Mainly to avoid truncating >4GB strings, which might potentially cause
some security holes. Normally there are other limits, which prevent such
excessive strings from being created in the first place.

I'm sure this didn't find everything. Maybe everything could be found with
compiler warnings. -Wconversion kind of does it, but it gives way too many
unnecessary warnings.

These were mainly found with:

grep " = strlen"
egrep "unsigned int.*(size|len)"

8 years agolib: Optimization - p_strconcat() doesn't need to allocate from data stack
Timo Sirainen [Mon, 12 Dec 2016 03:16:28 +0000 (05:16 +0200)] 
lib: Optimization - p_strconcat() doesn't need to allocate from data stack

Various other parts of the code already rely on p_malloc() not overwriting
t_buffer_get()'ed data. p_strconcat() can do that as well.

8 years agolib: *_new(): Use the new MALLOC_MULTIPLY() macro to avoid overflows
Timo Sirainen [Mon, 12 Dec 2016 02:55:47 +0000 (04:55 +0200)] 
lib: *_new(): Use the new MALLOC_MULTIPLY() macro to avoid overflows

Cast the sizeof() result to unsigned int, because it's definitely always
enough and in many cases this allows optimizing away the wrap-check.

8 years agolib: Add MALLOC_MULTIPLY() and MALLOC_ADD()
Timo Sirainen [Mon, 12 Dec 2016 02:53:02 +0000 (04:53 +0200)] 
lib: Add MALLOC_MULTIPLY() and MALLOC_ADD()

These can be used for calculating memory allocation sizes. If there's an
overflow, the macro panics.

8 years agolib: Remove t_buffer_*_type()
Timo Sirainen [Mon, 12 Dec 2016 01:55:54 +0000 (03:55 +0200)] 
lib: Remove t_buffer_*_type()

The t_buffer_*() shouldn't normally be used anyway except in some low-level
string/buffer manipulation code, so there's not much point in trying to make
easier to use versions of them.

8 years agomaster: Removed unused process_exec(extra_args) parameter
Timo Sirainen [Mon, 12 Dec 2016 01:48:49 +0000 (03:48 +0200)] 
master: Removed unused process_exec(extra_args) parameter

Removes unnecessarily complicated code marked with @UNSAFE.

8 years agolib-storage: Make dovecot.list.index's filename configurable.
Timo Sirainen [Thu, 15 Dec 2016 16:15:21 +0000 (18:15 +0200)] 
lib-storage: Make dovecot.list.index's filename configurable.

This is useful when there are multiple namespaces pointing to the same mail
root directory. For example mdbox with lazy-expunge:

namespace {
  prefix = Expunged/
  location = mdbox:~/mdbox:MAILBOXDIR=expunged:LISTINDEX=expunged.list.index
  ..
}

8 years agolib-storage: Deduplicate code into mailbox_list_settings_init_defaults()
Timo Sirainen [Thu, 15 Dec 2016 16:13:34 +0000 (18:13 +0200)] 
lib-storage: Deduplicate code into mailbox_list_settings_init_defaults()

8 years agodirector: Fix crash when using director_flush_socket
Timo Sirainen [Fri, 16 Dec 2016 16:52:23 +0000 (18:52 +0200)] 
director: Fix crash when using director_flush_socket

Broken accidentally when merging b44033e45e9f48f8a6e1ac5905234fec5de6d6cc

8 years agodirector: Fix USER-KICK and USER-KICK-ALT forwarding
Timo Sirainen [Thu, 15 Dec 2016 17:03:39 +0000 (19:03 +0200)] 
director: Fix USER-KICK and USER-KICK-ALT forwarding

The internal IPC command was prefixed, which caused the remote director
to reject the commands and disconnect:

director(...): Command proxy: Unknown command proxy
director(...): Remote sent invalid protocol data recently, waiting 57 secs before allowing further communication

8 years agodirector: doveadm command handling was missing USER-KICK-ALT
Timo Sirainen [Thu, 15 Dec 2016 17:02:56 +0000 (19:02 +0200)] 
director: doveadm command handling was missing USER-KICK-ALT

8 years agoimap: Fix STORE UNCHANGEDSINCE to work with >32bit modseqs.
Timo Sirainen [Thu, 15 Dec 2016 13:00:54 +0000 (15:00 +0200)] 
imap: Fix STORE UNCHANGEDSINCE to work with >32bit modseqs.

8 years agolib-storage: Fix "*" in SEARCH seqset/uidset
Timo Sirainen [Thu, 15 Dec 2016 13:20:02 +0000 (15:20 +0200)] 
lib-storage: Fix "*" in SEARCH seqset/uidset

4294967295 is used for "*", which matches the last existing message.
Which we don't know what it is at the time of search args simplification,
so avoid making any assumptions about it.

It's a bit ugly that 4294967295 can't be used as a valid UID, but this
restriction has already existed since the beginning of Dovecot. A future
alternative might be to add MAIL_SEARCH_ARG_FLAG_SEQSET_WITH_STAR, but
that's a bit complicated change.

8 years agoimapc: Don't allow "*" in SEARCH replies
Timo Sirainen [Thu, 15 Dec 2016 13:01:47 +0000 (15:01 +0200)] 
imapc: Don't allow "*" in SEARCH replies

Doesn't fix anything, but makes the parsing a bit more correct.

8 years agofts-squat: Use file_cache_new_path() for squat indexes
Timo Sirainen [Wed, 14 Dec 2016 17:36:43 +0000 (19:36 +0200)] 
fts-squat: Use file_cache_new_path() for squat indexes

8 years agolib-index: Use file_cache_new_path() for dovecot.index.cache
Timo Sirainen [Wed, 14 Dec 2016 17:35:29 +0000 (19:35 +0200)] 
lib-index: Use file_cache_new_path() for dovecot.index.cache

8 years agolib: Add file_cache_new_path() to include path in error messages.
Timo Sirainen [Wed, 14 Dec 2016 17:35:05 +0000 (19:35 +0200)] 
lib: Add file_cache_new_path() to include path in error messages.

8 years agodriver-mysql: Do not hex-encode again
Aki Tuomi [Wed, 14 Dec 2016 21:20:12 +0000 (23:20 +0200)] 
driver-mysql: Do not hex-encode again

Use correct syntax to provide data to
mysql in hex format, without recoding
it in hex format again.

8 years agolib-storage: Fix crash in obox's dsync-merge
Timo Sirainen [Tue, 13 Dec 2016 14:04:53 +0000 (16:04 +0200)] 
lib-storage: Fix crash in obox's dsync-merge

8 years agoauth: Don't log errors when cache_key expansion finds unknown %variables
Timo Sirainen [Wed, 14 Dec 2016 17:03:02 +0000 (19:03 +0200)] 
auth: Don't log errors when cache_key expansion finds unknown %variables

8 years agomail-crypt: Treat empty values correctly
Aki Tuomi [Fri, 9 Dec 2016 14:01:20 +0000 (16:01 +0200)] 
mail-crypt: Treat empty values correctly

If mail_crypt_curve or mail_crypt_save_version
is left empty, disable the plugin. Don't error
out.

8 years agomail-crypt: Skip tests if dcrypt cannot be initialized
Aki Tuomi [Wed, 14 Dec 2016 15:39:04 +0000 (17:39 +0200)] 
mail-crypt: Skip tests if dcrypt cannot be initialized

Avoids breaking tests on system without working
ECC keys.

8 years agoauth-policy: Allow unsupported attributes in response
Aki Tuomi [Wed, 14 Dec 2016 09:42:56 +0000 (11:42 +0200)] 
auth-policy: Allow unsupported attributes in response

Do not choke if we receive unsupported attributes in
response. This allows better interoperability with
different systems that are getting signals from
auth policy server that are not (yet) supported by
dovecot.

8 years agosha3: Fix typo in ifdef
Aki Tuomi [Wed, 14 Dec 2016 08:32:44 +0000 (10:32 +0200)] 
sha3: Fix typo in ifdef

The code was supposed to be used with big endian
machines.

Reported by than@redhat.com

8 years agolib-test: Change test_fatal_func_t to take unsigned int stage as parameter.
Timo Sirainen [Mon, 12 Dec 2016 13:21:13 +0000 (15:21 +0200)] 
lib-test: Change test_fatal_func_t to take unsigned int stage as parameter.

It could never be -1, so this makes it clearer. It also removes annoying
casts when comparing stage to e.g. N_ELEMENTS().

8 years agolib-test: test_run_with_fatals() now takes a const array
Timo Sirainen [Mon, 12 Dec 2016 13:17:23 +0000 (15:17 +0200)] 
lib-test: test_run_with_fatals() now takes a const array

8 years agolib-test: Introduce test_fatal_func_t as typedef and comment how it works.
Timo Sirainen [Mon, 12 Dec 2016 13:16:34 +0000 (15:16 +0200)] 
lib-test: Introduce test_fatal_func_t as typedef and comment how it works.

8 years agoauth: silence var_expand_with_funcs in db-ldap
Martti Rannanjärvi [Tue, 13 Dec 2016 18:03:41 +0000 (20:03 +0200)] 
auth: silence var_expand_with_funcs in db-ldap

This needs to be silenced since it's logging errors of variable
expansions that are not meant to be successful. The function is used
here just for filling the attr_names array in ldap_field_find_context
and the resulting string is not used.

8 years agodoveadm-mail: Set exit code to EX_TEMPFAIL on timeout
Aki Tuomi [Mon, 12 Dec 2016 07:41:02 +0000 (09:41 +0200)] 
doveadm-mail: Set exit code to EX_TEMPFAIL on timeout

When running `doveadm save` command on proxy/director
and the remote command execution times out, exit code
must be set to EX_TEMPFAIL.

Fixes Panic: file doveadm-mail.c: line 405 (doveadm_mail_next_user):
assertion failed: (ctx->exit_code != 0)

8 years agodoveadm-save: Set exit code to EX_TEMPFAIL on open error
Aki Tuomi [Mon, 12 Dec 2016 07:39:34 +0000 (09:39 +0200)] 
doveadm-save: Set exit code to EX_TEMPFAIL on open error

Prevents potential crash on doveadm_mail_next_user

8 years agolib-imap: imap-bodystructure: Prevent writing erroneous whitespace between items...
Stephan Bosch [Wed, 14 Dec 2016 01:51:54 +0000 (02:51 +0100)] 
lib-imap: imap-bodystructure: Prevent writing erroneous whitespace between items in an envelope address list.

Both imap_bodystructure_write() and imap_body_parse_from_bodystructure() produced such invalid output.
This caused an RFC 3501 violation in IMAP FETCH BODY and BODYSTRUCTURE responses.

Test suite is amended to test this situation.

8 years agolib-index: Add mail_index_revert_changes()
Timo Sirainen [Tue, 13 Dec 2016 16:31:41 +0000 (18:31 +0200)] 
lib-index: Add mail_index_revert_changes()

This can be used to revert changes done in a transaction to the specified
existing mail.

8 years agomail-crypt: Ensure array is created before accessing it
Aki Tuomi [Wed, 14 Dec 2016 08:23:17 +0000 (10:23 +0200)] 
mail-crypt: Ensure array is created before accessing it

Fixes segmentation fault on fs-crypt when keys are not
configured.

8 years agodoveadm-director: Show tag field from response
Aki Tuomi [Wed, 14 Dec 2016 10:46:50 +0000 (12:46 +0200)] 
doveadm-director: Show tag field from response

Fix off-by-one in doveadm director dump

8 years agoacl: Don't set acl_defaults_from_inbox=yes as default after all.
Timo Sirainen [Tue, 13 Dec 2016 12:51:20 +0000 (14:51 +0200)] 
acl: Don't set acl_defaults_from_inbox=yes as default after all.

Reverts b56d462fff46511b7efa0ccf254ba93d72322920 and removes the FIXME.
Some people might actually want to give someone else access to their INBOX
but not to all the other mailboxes. We should make it possible to use the
"" mailbox name as the default ACL instead.

8 years agoimap: Fix assert when waiting for input on SEARCH/SORT
Aki Tuomi [Mon, 12 Dec 2016 13:14:52 +0000 (15:14 +0200)] 
imap: Fix assert when waiting for input on SEARCH/SORT

Set cmd->state to CLIENT_COMMAND_STATE_WAIT_EXTERNAL
because we are not expecting input or output.

Fixes Panic: file imap-client.c: line 854 (client_check_command_hangs): assertion failed: (client->io != NULL || (client->output_cmd_lock != NULL && client->output_cmd_lock != client->input_lock))

8 years agodsync: Fix .dovecot-sync.lock timeout checking
Timo Sirainen [Mon, 12 Dec 2016 10:37:34 +0000 (12:37 +0200)] 
dsync: Fix .dovecot-sync.lock timeout checking

Whenever the lock file was recreated, the lock timeout was reset. Switched
to using file_create_locked(), which already solves this problem and has
compatible locking.

8 years agodsync: Improve process title during initialization
Timo Sirainen [Mon, 12 Dec 2016 10:53:36 +0000 (12:53 +0200)] 
dsync: Improve process title during initialization

If something is hanging, this should make it clear what exactly it is.

8 years agodoveadm-server: Show UNIX socket connections as <local> in process title
Timo Sirainen [Mon, 12 Dec 2016 10:42:53 +0000 (12:42 +0200)] 
doveadm-server: Show UNIX socket connections as <local> in process title

Earlier they were shown as empty string.

8 years agodoveadm: Add global doveadm_verbose_proctitle setting.
Timo Sirainen [Mon, 12 Dec 2016 10:43:47 +0000 (12:43 +0200)] 
doveadm: Add global doveadm_verbose_proctitle setting.

This previously existed only for doveadm-server, but adding it to doveadm
CLI makes it easier to do process title updates for it as well.

8 years agodoveadm: When connecting to doveadm-server via TCP, use 30s timeout
Timo Sirainen [Mon, 12 Dec 2016 10:51:42 +0000 (12:51 +0200)] 
doveadm: When connecting to doveadm-server via TCP, use 30s timeout

Should be enough, and better than the kernel's default, which might be a lot
more.

8 years agolib-storage: Do not try to recover missing list index
Aki Tuomi [Mon, 12 Dec 2016 08:40:20 +0000 (10:40 +0200)] 
lib-storage: Do not try to recover missing list index

Fixes Panic: file mailbox-list-index.c: line 342 (mailbox_list_index_parse_records): assertion failed: (node != NULL)

8 years agoconfigure: Fix some implicit function declarations
Paul Howarth [Mon, 5 Dec 2016 15:17:30 +0000 (15:17 +0000)] 
configure: Fix some implicit function declarations

Some configure tests fail unexpectedly if the compiler flag
-Werror=implicit-function-declarations is enabled, which can result
in the wrong implementations being used.

This compiler flag is now enabled by default in Fedora Rawhide:
https://fedoraproject.org/wiki/Changes/Fedora26CFlags

<stdlib.h> is needed for exit()
<string.h> is needed for strcpy()

8 years agoopenssl: Clear error queue after an incomplete SSL_shutdown
manuel [Wed, 7 Dec 2016 13:23:12 +0000 (14:23 +0100)] 
openssl: Clear error queue after an incomplete SSL_shutdown

If the SSL_shutdown-call fails (e.g. because the underlaying socket has
already been closed) OpenSSL puts the corresponding error into the
queue. We don't care about details so we need to clear the queue.

Otherwise the error will be pulled while error checking the next OpenSSL
call of an unrelated connection.

8 years agoimapc: Don't send NOOP immediately after SELECT
Timo Sirainen [Fri, 9 Dec 2016 13:06:05 +0000 (15:06 +0200)] 
imapc: Don't send NOOP immediately after SELECT

NOOP is normally used by mailbox syncing to check if there are any changes
done by other concurrent IMAP sessions. But doing it immediately after
SELECT is unnecessary, because nothing could have changed.

8 years agoconfig: Avoid excessive data stack usage when matching local_name
Timo Sirainen [Fri, 9 Dec 2016 11:11:11 +0000 (11:11 +0000)] 
config: Avoid excessive data stack usage when matching local_name

Moved config_filter_match_local_name() to its own function to make
adding the data stack frame easier.

Based on patch by J. Nick Koston

8 years agodoveadm-server: http: Fixed temp_path_prefix for iostream-temp.
Stephan Bosch [Fri, 9 Dec 2016 08:57:57 +0000 (09:57 +0100)] 
doveadm-server: http: Fixed temp_path_prefix for iostream-temp.

The temp_path_prefix was "/tmp", which is extended to "/tmp<hostname>.<pid>.<random>" by safe_mkstemp.

Obviously, mortal users cannot create a file like that, causing this error:
doveadm: Error: safe_mkstemp(/tmp) failed: Permission denied

The temp_path_prefix should have been "/tmp/doveadm.", as it is elsewhere as well.

8 years agolib: add t_strfgmtime and t_strftime
Martti Rannanjärvi [Thu, 8 Dec 2016 11:01:48 +0000 (13:01 +0200)] 
lib: add t_strfgmtime and t_strftime

8 years agolib: Improve seq_range_array_invert() unit tests
Timo Sirainen [Thu, 8 Dec 2016 17:37:30 +0000 (19:37 +0200)] 
lib: Improve seq_range_array_invert() unit tests

Try all possible combinations for seq=0..7 and seq=4294967288..4294967295
and make sure they're inverted correctly.