]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
9 years agolib-ssl-iostream: The final fix to make the SSL plugin loading not fail..
Timo Sirainen [Mon, 19 Sep 2016 08:08:08 +0000 (11:08 +0300)] 
lib-ssl-iostream: The final fix to make the SSL plugin loading not fail..

9 years agolib-ssl-iostream: Fixed OpenSSL module to be actually initialized.
Timo Sirainen [Sun, 18 Sep 2016 13:33:07 +0000 (16:33 +0300)] 
lib-ssl-iostream: Fixed OpenSSL module to be actually initialized.

9 years agolib-http: Link test-http-client libssl_iostream_openssl.so directly.
Timo Sirainen [Fri, 16 Sep 2016 05:39:24 +0000 (08:39 +0300)] 
lib-http: Link test-http-client libssl_iostream_openssl.so directly.

This way it can be run without having to do make install first.

9 years agolib-ssl-iostream: Use more standard _init() & _deinit() to initialize SSL plugin
Timo Sirainen [Fri, 16 Sep 2016 05:35:55 +0000 (08:35 +0300)] 
lib-ssl-iostream: Use more standard _init() & _deinit() to initialize SSL plugin

This is mainly to make it easier for test programs to link to the plugin
directly.

9 years agodoveadm: Don't allow doveadm_print_header(title==NULL) anymore.
Timo Sirainen [Sat, 10 Sep 2016 08:15:00 +0000 (11:15 +0300)] 
doveadm: Don't allow doveadm_print_header(title==NULL) anymore.

It's not used anywhere, and if it was used it would have crashed with at
least "tab" backend.

9 years agofts-squat: Fixed memory leak on corrupted uidlist handling
Timo Sirainen [Fri, 9 Sep 2016 14:40:58 +0000 (17:40 +0300)] 
fts-squat: Fixed memory leak on corrupted uidlist handling

9 years agodict-file: Don't leak a lock on temp file creation failure.
Timo Sirainen [Fri, 9 Sep 2016 14:39:43 +0000 (17:39 +0300)] 
dict-file: Don't leak a lock on temp file creation failure.

9 years agolib: iostream-temp: Fixed o_stream_send_istream() with >2GB files
Timo Sirainen [Tue, 11 Oct 2016 08:03:06 +0000 (11:03 +0300)] 
lib: iostream-temp: Fixed o_stream_send_istream() with >2GB files

8051312f9 wasn't quite enough.

9 years agolib-program-client: Compiler warning fixes
Timo Sirainen [Mon, 10 Oct 2016 11:42:24 +0000 (14:42 +0300)] 
lib-program-client: Compiler warning fixes

9 years agolib-program-client: Avoid busy-looping while waiting for ostream to have space.
Timo Sirainen [Mon, 10 Oct 2016 11:20:16 +0000 (14:20 +0300)] 
lib-program-client: Avoid busy-looping while waiting for ostream to have space.

9 years agolib-program-client: Add test suite for program client
Aki Tuomi [Fri, 7 Oct 2016 16:49:24 +0000 (19:49 +0300)] 
lib-program-client: Add test suite for program client

9 years agolib-program-client: Expose asynchronous API
Aki Tuomi [Fri, 7 Oct 2016 16:48:59 +0000 (19:48 +0300)] 
lib-program-client: Expose asynchronous API

9 years agolib-program-client: Whitespace fix
Aki Tuomi [Thu, 6 Oct 2016 08:57:27 +0000 (11:57 +0300)] 
lib-program-client: Whitespace fix

9 years agolib-program-client: Add program-client from pigeonhole
Aki Tuomi [Mon, 12 Sep 2016 10:02:23 +0000 (13:02 +0300)] 
lib-program-client: Add program-client from pigeonhole

9 years agodoveadm-import: Update manpage
Aki Tuomi [Thu, 29 Sep 2016 06:51:40 +0000 (09:51 +0300)] 
doveadm-import: Update manpage

9 years agodoveadm-import: Add -U parameter to specify source user
Aki Tuomi [Thu, 29 Sep 2016 07:17:05 +0000 (10:17 +0300)] 
doveadm-import: Add -U parameter to specify source user

When doing import, you can specify which user to use
as source user.

9 years agodoveadm-import: Use target user as source user
Aki Tuomi [Thu, 29 Sep 2016 07:15:24 +0000 (10:15 +0300)] 
doveadm-import: Use target user as source user

This is done to avoid spurious error messages
caused by being ran as root.

9 years agoimap-hibernate: Accept RFC DONE\IDLE
Aki Tuomi [Wed, 28 Sep 2016 10:34:46 +0000 (13:34 +0300)] 
imap-hibernate: Accept RFC DONE\IDLE

Change imap-hibernate to accept
DONE\r\n<tag> IDLE\r\n
as well, which is specified by RFC

9 years agolib-storage: Update mailbox.recent_flags_count correctly.
Timo Sirainen [Tue, 27 Sep 2016 10:28:15 +0000 (13:28 +0300)] 
lib-storage: Update mailbox.recent_flags_count correctly.

The counter was increased even if the UID was already in recent_flags.
This is the only place where I found that recent_flags and
recent_flags_count could become desynced (which they definitely were in
a core dump), so hopefully this fixes assert-crashes like:

Panic: file index-status.c: line 130 (index_storage_get_open_status): assertion failed: (status_r->recent <= status_r->messages)

9 years agodsync: Virtual sizes weren't exported properly with -I parameter.
Timo Sirainen [Tue, 27 Sep 2016 10:50:51 +0000 (13:50 +0300)] 
dsync: Virtual sizes weren't exported properly with -I parameter.

Although they were incorrectly being exported with -T parameter. This makes
-I work without assert-crashing.

9 years agodsync: Renamed "max sync size" parameter from -S to -I.
Timo Sirainen [Tue, 27 Sep 2016 10:50:10 +0000 (13:50 +0300)] 
dsync: Renamed "max sync size" parameter from -S to -I.

-S can't be used because it was already used for the generic socket path,
so it didn't actually work.

9 years agodoveadm: refactor mailbox attribute get/set/unset/list to share more code
Josef 'Jeff' Sipek [Wed, 14 Sep 2016 11:13:50 +0000 (07:13 -0400)] 
doveadm: refactor mailbox attribute get/set/unset/list to share more code

9 years agodoveadm: allow access to server attributes via empty mailbox name
Josef 'Jeff' Sipek [Tue, 13 Sep 2016 11:50:04 +0000 (07:50 -0400)] 
doveadm: allow access to server attributes via empty mailbox name

9 years agolib-storage: remove attribute accessibility checks
Josef 'Jeff' Sipek [Tue, 13 Sep 2016 11:49:41 +0000 (07:49 -0400)] 
lib-storage: remove attribute accessibility checks

index_storage_attribute_{set,get} should assume that the caller performed
due diligence and checked whether or not the user is allowed to store under
the key.

9 years agodoveadm: lowercase attribute names before trying to parse them
Josef 'Jeff' Sipek [Tue, 13 Sep 2016 07:33:06 +0000 (03:33 -0400)] 
doveadm: lowercase attribute names before trying to parse them

This now matches what the imap server does.

9 years agolib-storage: document mailbox and server attribute handling
Josef 'Jeff' Sipek [Tue, 13 Sep 2016 07:32:06 +0000 (03:32 -0400)] 
lib-storage: document mailbox and server attribute handling

9 years agologin proxy: Don't leak connections if reconnect fails with "Host is down"
Timo Sirainen [Fri, 23 Sep 2016 11:59:33 +0000 (14:59 +0300)] 
login proxy: Don't leak connections if reconnect fails with "Host is down"

Double-disconnection was also attempting to close the same fd twice, but I
think that couldn't have happened before this leak was fixed.

9 years agolib: Add test for pending io without timeouts
Aki Tuomi [Thu, 22 Sep 2016 11:14:23 +0000 (14:14 +0300)] 
lib: Add test for pending io without timeouts

9 years agolib: Update ioloop attributes
Aki Tuomi [Thu, 22 Sep 2016 11:13:43 +0000 (14:13 +0300)] 
lib: Update ioloop attributes

With pending IO, the ioloop attributes still need
updating, instead of just returning.

9 years agolib-mail: message_header_hash_more() now allows input in any slices.
Timo Sirainen [Thu, 22 Sep 2016 11:23:00 +0000 (14:23 +0300)] 
lib-mail: message_header_hash_more() now allows input in any slices.

There wasn't necessarily any guarantees that the input would be sliced in
such a way that the repeating '?' would be dropped the same way every time.

9 years agolib-mail: Removed obsolete comment about message_header_hash_more()
Timo Sirainen [Thu, 22 Sep 2016 11:16:12 +0000 (14:16 +0300)] 
lib-mail: Removed obsolete comment about message_header_hash_more()

pop3-migration plugin uses this function now, so it doesn't need to be kept
in sync.

9 years agopop3-migration: "first POP3 msg" warning didn't actually show the first one.
Timo Sirainen [Thu, 22 Sep 2016 10:47:42 +0000 (13:47 +0300)] 
pop3-migration: "first POP3 msg" warning didn't actually show the first one.

It was showing the first index in an array, which had nothing to do with
being the first POP3 message number.

9 years agodbox: mailbox_update() shouldn't reset pop3-uidl header.
Timo Sirainen [Thu, 22 Sep 2016 10:38:33 +0000 (13:38 +0300)] 
dbox: mailbox_update() shouldn't reset pop3-uidl header.

This broke reading migrated POP3 UIDLs.

9 years agologin-proxy: Fixed "Host is down" never reseting itself.
Timo Sirainen [Wed, 21 Sep 2016 17:50:24 +0000 (20:50 +0300)] 
login-proxy: Fixed "Host is down" never reseting itself.

Broken by c8eb8314a, which moved adding num_waiting_connections earlier.
After that it was never 0 at the check time.

9 years agolib: test-istream-chain fixes
Timo Sirainen [Wed, 21 Sep 2016 13:17:26 +0000 (16:17 +0300)] 
lib: test-istream-chain fixes

9 years agolib-dcrypt: Don't finalize encryption on o_stream_flush()
Timo Sirainen [Tue, 20 Sep 2016 15:08:10 +0000 (18:08 +0300)] 
lib-dcrypt: Don't finalize encryption on o_stream_flush()

For example the default o_stream_uncork() implementation enforces flushing
and it's probably better not to change that. In general there's really no
reason to perform the finalization at flush when the stream can't be written
to anymore (whereas lib-compression ostreams allow writes after flushes).

9 years agolib: Fixed istream-chain when it has multiple "previous streams".
Timo Sirainen [Wed, 21 Sep 2016 10:26:30 +0000 (13:26 +0300)] 
lib: Fixed istream-chain when it has multiple "previous streams".

Fixes assert:
Panic: file istream-chain.c: line 223 (i_stream_chain_read): assertion failed: (cur_data_pos == data_size)

Unit test for it by Stephan Bosch.

9 years agodoveadm fs get: Fixed logging error messages.
Timo Sirainen [Wed, 21 Sep 2016 09:19:18 +0000 (12:19 +0300)] 
doveadm fs get: Fixed logging error messages.

The error is in istream, not in fs.

9 years agoimap-login: Add missing brace
Aki Tuomi [Tue, 20 Sep 2016 18:06:22 +0000 (21:06 +0300)] 
imap-login: Add missing brace

9 years agoimap-proxy: Fix typo in comment
Aki Tuomi [Tue, 20 Sep 2016 15:51:18 +0000 (18:51 +0300)] 
imap-proxy: Fix typo in comment

9 years agoimap-login: Honor nopipelining during preauth
Aki Tuomi [Tue, 20 Sep 2016 12:02:42 +0000 (15:02 +0300)] 
imap-login: Honor nopipelining during preauth

9 years agolib-dcrypt: Set NOPLUGIN_LDFLAGS to empty
Aki Tuomi [Tue, 20 Sep 2016 09:47:32 +0000 (12:47 +0300)] 
lib-dcrypt: Set NOPLUGIN_LDFLAGS to empty

Avoids -Wl,--as-needed here

9 years agolib-dcrypt: Makefile.am fix
Aki Tuomi [Tue, 20 Sep 2016 07:52:08 +0000 (10:52 +0300)] 
lib-dcrypt: Makefile.am fix

Remove dcrypt.c from openssl library and add missing slash

9 years agolib: Ensure handler_context is not NULL
Aki Tuomi [Fri, 16 Sep 2016 12:50:22 +0000 (15:50 +0300)] 
lib: Ensure handler_context is not NULL

handler context must not be NULL here.

9 years agolib: Prevent crash in ioloop
Aki Tuomi [Fri, 16 Sep 2016 12:49:36 +0000 (15:49 +0300)] 
lib: Prevent crash in ioloop

If only non-fd sources and no timeouts are
in ioloop, prevent crash and unnecessary
waiting when there are pending IOs.

9 years agolib: Assert if i_stream_create_seekable_path(temp_path_prefix==NULL)
Timo Sirainen [Mon, 19 Sep 2016 13:20:14 +0000 (16:20 +0300)] 
lib: Assert if i_stream_create_seekable_path(temp_path_prefix==NULL)

If the stream becomes large enough it would crash then in a callback
function, which makes debugging more difficult.

9 years agofts-plugin: Remove NULL assert
Aki Tuomi [Mon, 19 Sep 2016 09:27:16 +0000 (12:27 +0300)] 
fts-plugin: Remove NULL assert

fts_backend_update_deinit will set box to NULL and call
update_set_mailbox then. NULL check needs to be done
in backends.

9 years agofts-backend-solr: Check that box is not NULL
Aki Tuomi [Mon, 19 Sep 2016 09:26:46 +0000 (12:26 +0300)] 
fts-backend-solr: Check that box is not NULL

fts_backend_update_deinit will set box to NULL and call
update_set_mailbox then.

9 years agofts-backend-lucene: Check that box is not NULL
Aki Tuomi [Mon, 19 Sep 2016 09:26:08 +0000 (12:26 +0300)] 
fts-backend-lucene: Check that box is not NULL

fts_backend_update_deinit will set box to NULL and call
update_set_mailbox then.

9 years agoauth-policy: Ref/unref auth request
Aki Tuomi [Sat, 17 Sep 2016 09:57:00 +0000 (12:57 +0300)] 
auth-policy: Ref/unref auth request

If auth_request is not referenced it can go away
before HTTP response is handled.

9 years agofs-randomfail: Operation is unfinished on EAGAIN, not ENOENT.
Timo Sirainen [Fri, 16 Sep 2016 14:13:24 +0000 (17:13 +0300)] 
fs-randomfail: Operation is unfinished on EAGAIN, not ENOENT.

This caused crashes and other problems when using randomfail with
asynchronous fs drivers.

9 years agolib: safe_mkstemp*() didn't always truncate prefix back to original on failure.
Timo Sirainen [Thu, 15 Sep 2016 08:30:15 +0000 (11:30 +0300)] 
lib: safe_mkstemp*() didn't always truncate prefix back to original on failure.

This caused repeated safe_mkstemp*() calls with the same prefix to keep
increasing its size. It probably didn't really break anything (unless it was
called enough many times to reach 255 filename length), but the filenames
were still confusingly ugly.

9 years agopop3-migration: Fixed crash when not specifying pop3_migration_mailbox setting.
Timo Sirainen [Thu, 15 Sep 2016 07:23:41 +0000 (10:23 +0300)] 
pop3-migration: Fixed crash when not specifying pop3_migration_mailbox setting.

9 years agoiostream-temp: If write() to temp file fails at any time, move it back to memory.
Timo Sirainen [Wed, 14 Sep 2016 11:19:39 +0000 (14:19 +0300)] 
iostream-temp: If write() to temp file fails at any time, move it back to memory.

Similarly to if the write() to temp fails during the initial move attempt.
This way even if write() fails due to out of disk space, it's not visible
to caller. An error message is logged in any case.

9 years agopop3-migration: Avoid unnecessarily using stream's hdr_size.
Timo Sirainen [Wed, 14 Sep 2016 16:06:29 +0000 (19:06 +0300)] 
pop3-migration: Avoid unnecessarily using stream's hdr_size.

Shouldn't change any behavior, except reduce CPU usage a little bit.

9 years agoimapc: mail_get_stream() shouldn't return cached hdr_size
Timo Sirainen [Wed, 14 Sep 2016 15:57:43 +0000 (18:57 +0300)] 
imapc: mail_get_stream() shouldn't return cached hdr_size

9 years agolib-http: client: Fixed hang occurring when nested ioloops are used in response callb...
Stephan Bosch [Tue, 13 Sep 2016 20:54:02 +0000 (22:54 +0200)] 
lib-http: client: Fixed hang occurring when nested ioloops are used in response callbacks.

To prevent missing disconnect events, i_stream_read() is called once a change in ioloop is detected.
However, if something was actually read into the stream, the input handler was never called.
So, a response could linger in the stream buffer, without being handled, thereby causing the connection to hang indefinitely.
An additional input event could end the hang, but sometimes this doesn't happen before the request times out.

This problem was seen in test-http-payload once in about 10 invocations.
Obox uses nested ioloops, to this applies there.

9 years agodoveadm-auth: Handle unexpected auth "continue" request without crashing.
Timo Sirainen [Sat, 10 Sep 2016 08:32:28 +0000 (11:32 +0300)] 
doveadm-auth: Handle unexpected auth "continue" request without crashing.

9 years agolib-lda: Cleanup error handling in LMTP client code.
Timo Sirainen [Sat, 10 Sep 2016 08:28:38 +0000 (11:28 +0300)] 
lib-lda: Cleanup error handling in LMTP client code.

If there are no successful recipients, we'll need to deinit the client.
But at that point we've already called all the callbacks, so the line
parameter to lmtp_client_fail_full() isn't actually used anywhere.
This was confusing static analyzer because global_fail_string was used
as parameter, which could have been NULL and wouldn't have been valid
for the callbacks.

9 years agolib-master: Fixed memory leak when IPC server is handling commands.
Timo Sirainen [Sat, 10 Sep 2016 08:16:05 +0000 (11:16 +0300)] 
lib-master: Fixed memory leak when IPC server is handling commands.

This mainly meant that when login processes responded to doveadm proxy
list/kick commands memory was leaked.

9 years agodict-client: Don't crash if dict-server returns broken reply.
Timo Sirainen [Sat, 10 Sep 2016 08:13:58 +0000 (11:13 +0300)] 
dict-client: Don't crash if dict-server returns broken reply.

Just treat missing <tab>value as empty value.

9 years agoauth: Make sure auth_request_log_info() doesn't crash when there are no passdbs
Timo Sirainen [Fri, 9 Sep 2016 15:18:32 +0000 (18:18 +0300)] 
auth: Make sure auth_request_log_info() doesn't crash when there are no passdbs

auth_request_is_disabled_master_user() could have caused such crash.

9 years agoauth: Explicitly ignore return value to make static analyzer happier.
Timo Sirainen [Fri, 9 Sep 2016 15:12:41 +0000 (18:12 +0300)] 
auth: Explicitly ignore return value to make static analyzer happier.

9 years agoAdded asserts to make static analyzer happier.
Timo Sirainen [Fri, 9 Sep 2016 15:10:29 +0000 (18:10 +0300)] 
Added asserts to make static analyzer happier.

9 years agoRemoved dead code to make static analyzer happier.
Timo Sirainen [Fri, 9 Sep 2016 15:07:15 +0000 (18:07 +0300)] 
Removed dead code to make static analyzer happier.

9 years agolib-storage: Fix potential crash when userdb-returns "key+=value" for a nonexistent...
Timo Sirainen [Fri, 9 Sep 2016 14:55:20 +0000 (17:55 +0300)] 
lib-storage: Fix potential crash when userdb-returns "key+=value" for a nonexistent setting.

type would have also happened to be initialized to SET_STR for the crash to
happen.

9 years agolib-imap-urlauth: Don't access freed memory on errors.
Timo Sirainen [Fri, 9 Sep 2016 14:36:39 +0000 (17:36 +0300)] 
lib-imap-urlauth: Don't access freed memory on errors.

9 years agoimap, pop3: Added rawlog_dir setting to store IMAP/POP3 traffic logs.
Timo Sirainen [Tue, 13 Sep 2016 04:22:03 +0000 (07:22 +0300)] 
imap, pop3: Added rawlog_dir setting to store IMAP/POP3 traffic logs.

This at least partially replaces the "rawlog" post-login binary. For now
the "rawlog" binary supports some parameters, which aren't configurable
for rawlog_dir.

9 years agopop3-migration-plugin: Add to index after successful retry
Aki Tuomi [Fri, 9 Sep 2016 12:51:43 +0000 (15:51 +0300)] 
pop3-migration-plugin: Add to index after successful retry

Also change return value to indicate that the hash
has been assigned to header.

9 years agodoveconf: Hide any _api_key
Aki Tuomi [Mon, 12 Sep 2016 06:47:26 +0000 (09:47 +0300)] 
doveconf: Hide any _api_key

9 years agodoveconf: hide ssl_key without -P
Aki Tuomi [Tue, 16 Aug 2016 09:28:27 +0000 (12:28 +0300)] 
doveconf: hide ssl_key without -P

9 years agoplugins: fts - replace i_assert under _expunge_log_subtract with warning (API change)
Phil Carmody [Mon, 5 Sep 2016 13:26:56 +0000 (16:26 +0300)] 
plugins: fts - replace i_assert under _expunge_log_subtract with warning (API change)

The helper whose interface is changing currently has no other known
clients (there's little need for it to be exposed at all).

This should never happen, but if it does, just tally the number of times
it happened, and squirt out a warning message after the whole subtract.
If it happens at all, there's no reason not to expect a lot, so only
warn once per file.

In particular - do not assert crash when this is seen - it has been seen
on live test systems where file corruption seems to have occured. As
this can only be associated with corrupt fts indexes, seeing this error
implies that the whole FTS index should be rebuilt for that user.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
9 years agolib-storage: Limit folder full name only
Aki Tuomi [Wed, 10 Aug 2016 10:07:01 +0000 (13:07 +0300)] 
lib-storage: Limit folder full name only

Before we had limit of 16 levels and 255 bytes per name
which is same as 4096 bytes. Now we limit only the total
length of the name to MAILBOX_LIST_NAME_MAX_LENGTH. For
compability reasons, we are restricting individual component
names to 255 characters.

9 years agofs-metawrap: Added assert to make sure we don't create empty files.
Timo Sirainen [Mon, 22 Aug 2016 13:13:32 +0000 (16:13 +0300)] 
fs-metawrap: Added assert to make sure we don't create empty files.

It seems like this could be happening in some situation.

9 years agofs-randomfail: Fixed assert-crash in fs_write_stream_abort_error()
Timo Sirainen [Thu, 8 Sep 2016 23:48:45 +0000 (02:48 +0300)] 
fs-randomfail: Fixed assert-crash in fs_write_stream_abort_error()

9 years agoimap-hibernate: Increased imap-master communication timeout from 5s to 30s
Timo Sirainen [Thu, 8 Sep 2016 22:42:50 +0000 (01:42 +0300)] 
imap-hibernate: Increased imap-master communication timeout from 5s to 30s

Looks like 5s isn't enough in loaded environments. It's also not really a
problem if the timeout is large, it's just going to take a while longer to
restore the connection. When timeout is reached the client would just get
disconnected anyway.

9 years agolib-storage: Fixed accessing user as root when user has no uid.
Timo Sirainen [Fri, 9 Sep 2016 11:07:11 +0000 (14:07 +0300)] 
lib-storage: Fixed accessing user as root when user has no uid.

This shouldn't normally be done, but might as well fix it. Fixes:

Fatal: mail-storage-service: seteuid(4294967295) failed: Invalid argument

9 years agolib-index: Fixed mail_index_modseq_get_next_log_offset() when accessing .log.2
Timo Sirainen [Thu, 8 Sep 2016 21:59:53 +0000 (00:59 +0300)] 
lib-index: Fixed mail_index_modseq_get_next_log_offset() when accessing .log.2

file->sync_offset was set only after header, so sync_highest_modseq was also
same as initial_modseq. The previous code then just returned offset pointing
to sync_offset, which was too early.

9 years agolib-index: Make sure new dovecot.index.log files start tracking modseqs.
Timo Sirainen [Thu, 8 Sep 2016 20:54:22 +0000 (23:54 +0300)] 
lib-index: Make sure new dovecot.index.log files start tracking modseqs.

This will make mail_index_modseq_get_next_log_offset() work correctly even
if modseqs haven't been explicitly enabled.

9 years agolib-storage: Code cleanup for mailbox_get_expunge*()
Timo Sirainen [Tue, 23 Aug 2016 19:36:08 +0000 (22:36 +0300)] 
lib-storage: Code cleanup for mailbox_get_expunge*()

The previous code did actually work as well, but it wasn't very obvious that
it did.

9 years agoimap: When hibernating, wait for old imap process to cleanup before creating new...
Timo Sirainen [Thu, 8 Sep 2016 22:31:46 +0000 (01:31 +0300)] 
imap: When hibernating, wait for old imap process to cleanup before creating new ones.

This fixes stats errors:

stats: Error: FIFO input error: CONNECT: Duplicate session ID Y7Q6E4U7xO1/AAAB for user testuser service imap
stats: Warning: Couldn't find session ID: Y7Q6E4U7xO1/AAAB

9 years agolib-fs: Moved fs_write_stream_abort_parent() to fs-api-private.h
Timo Sirainen [Thu, 8 Sep 2016 23:50:27 +0000 (02:50 +0300)] 
lib-fs: Moved fs_write_stream_abort_parent() to fs-api-private.h

Only fs wrapper drivers are supposed to call it.

9 years agolib-index: limit mail_index error prints to one per ioloop_time
Martti Rannanjärvi [Thu, 8 Sep 2016 16:01:54 +0000 (19:01 +0300)] 
lib-index: limit mail_index error prints to one per ioloop_time

This is to prevent log flooding.

9 years agolib-test: Added missing va_end() call.
Timo Sirainen [Fri, 9 Sep 2016 07:38:10 +0000 (10:38 +0300)] 
lib-test: Added missing va_end() call.

9 years agolib-test: test_expect_errors() now works for the entire log string, not just format...
Timo Sirainen [Fri, 9 Sep 2016 00:05:39 +0000 (03:05 +0300)] 
lib-test: test_expect_errors() now works for the entire log string, not just format parameter

9 years agolib-test: test-exit helper to stop valgrind complaining about fork()s
Phil Carmody [Tue, 9 Aug 2016 15:29:19 +0000 (18:29 +0300)] 
lib-test: test-exit helper to stop valgrind complaining about fork()s

fork()s that want to _exit() will cause valgrind's full memory leak
checker to complain a lot - this performs a quick cleanup first.

Before:
  phil@phil:~/repos/dovecot-core$ valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all src/lib/test-lib --match unix
  ==19576==   total heap usage: 4 allocs, 0 frees, 17,858 bytes allocated
  istream unix ......................................................... : ok
  0 / 1 tests failed
  ==19575==   total heap usage: 7 allocs, 7 frees, 19,327 bytes allocated

After:
  phil@phil:~/repos/dovecot-core$ valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all src/lib/test-lib --match unix
  istream unix ......................................................... : ok
  ==4993==   total heap usage: 4 allocs, 4 frees, 17,858 bytes allocated
  0 / 1 tests failed
  ==4992==   total heap usage: 7 allocs, 7 frees, 19,327 bytes allocated

Signed-off-by: Phil Carmody <phil@dovecot.fi>
9 years agolib-test: enable naming of tests, such that only a subset is run
Phil Carmody [Tue, 12 Jul 2016 10:28:54 +0000 (13:28 +0300)] 
lib-test: enable naming of tests, such that only a subset is run

How to use these will become clear in a subsequent patch. Even if you
don't want to name tests, the macros can reduce redundancy in the code,
as the list of test function prototypes and the list of test functions
to call become the same lists, expanded through 2 different macros.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
9 years agolib-test: improve expected error handling
Phil Carmody [Wed, 1 Jun 2016 10:57:34 +0000 (13:57 +0300)] 
lib-test: improve expected error handling

If we expect a specific error string, then when we see it, suppress it.

We do not suppress errors expected by count, because if we get unexpected
errors, then we do not want them suppressed, and we have no way of
distinguishing between the expected and unexpected errors.

This of course favours the use of the expected string version of the helper,
but alas that's not always usable, as you can only expect one at a time.

Additionally, if we failed to see an expected message, then when we no longer
expect to see it, reset the expected message state to not cascade further
test assertion failures.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
Conflicts:
src/lib-test/test-common.c

9 years agostats: Include PIDs in "Duplicate session ID" errors.
Timo Sirainen [Thu, 8 Sep 2016 22:08:59 +0000 (01:08 +0300)] 
stats: Include PIDs in "Duplicate session ID" errors.

9 years agolib-index: mail_index_modseq_get_next_log_offset() shouldn't return offset beyond...
Timo Sirainen [Thu, 8 Sep 2016 19:08:11 +0000 (22:08 +0300)] 
lib-index: mail_index_modseq_get_next_log_offset() shouldn't return offset beyond view's head

This also allows removing the same workaround from dsync code.

9 years agoimap: Avoid wrongly assert-crashing in client_check_command_hangs()
Timo Sirainen [Wed, 7 Sep 2016 08:52:00 +0000 (11:52 +0300)] 
imap: Avoid wrongly assert-crashing in client_check_command_hangs()

Fixes assert:

Panic: file imap-client.c: line 837 (client_check_command_hangs): assertion failed: (client->io != NULL)

9 years agostats plugin: Don't send any stats before CONNECT was successfully sent.
Timo Sirainen [Thu, 8 Sep 2016 17:23:35 +0000 (20:23 +0300)] 
stats plugin: Don't send any stats before CONNECT was successfully sent.

After stats write failures this fixes warnings like:
Warning: stats: Couldn't find session ID: smqAXQE8pIp/AAAB

9 years agolib-stats: stats_connection_send() now returns whether it succeeded or not
Timo Sirainen [Thu, 8 Sep 2016 17:18:46 +0000 (20:18 +0300)] 
lib-stats: stats_connection_send() now returns whether it succeeded or not

9 years agodoveadm flags: Sync mailbox after committing transaction.
Timo Sirainen [Thu, 8 Sep 2016 13:50:02 +0000 (16:50 +0300)] 
doveadm flags: Sync mailbox after committing transaction.

9 years agolmtp: Always read settings before dropping privs
Aki Tuomi [Wed, 7 Sep 2016 19:06:55 +0000 (22:06 +0300)] 
lmtp: Always read settings before dropping privs

If lmtp is ran explicitly as root, settings were not read.

9 years agoimap: Fixed assert-crash if un-hibernation failed to initialize user.
Timo Sirainen [Wed, 7 Sep 2016 19:00:14 +0000 (22:00 +0300)] 
imap: Fixed assert-crash if un-hibernation failed to initialize user.

master_service_client_connection_destroyed() was also being called in
imap_master_client_destroy() so it was done twice.

Fixes:
Panic: file master-service.c: line 775 (master_service_client_connection_destroyed): assertion failed: (service->total_available_count > 0)

9 years agofs-api: Retrieve errno before dest->copy_output is NULL'ed
Aki Tuomi [Mon, 5 Sep 2016 09:42:08 +0000 (12:42 +0300)] 
fs-api: Retrieve errno before dest->copy_output is NULL'ed

CID 10144: When aborting output, errno retrieval
is attempted after dest->copy_output has already
been unreffed. Found by coverity.

9 years agolib-storage: Check that UID is set before caching
Aki Tuomi [Tue, 6 Sep 2016 06:24:06 +0000 (09:24 +0300)] 
lib-storage: Check that UID is set before caching

9 years agolib-imap-storage: Check that UID is assigned before caching
Aki Tuomi [Tue, 6 Sep 2016 06:23:54 +0000 (09:23 +0300)] 
lib-imap-storage: Check that UID is assigned before caching

9 years agozlib-plugin: Check that UID is assigned
Aki Tuomi [Mon, 5 Sep 2016 12:56:05 +0000 (15:56 +0300)] 
zlib-plugin: Check that UID is assigned

When caching, code has to check whether UID is
assigned to avoid reusing cache for different
email since they all have UID = 0 before they
are actually committed.