]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
10 years agofts: Added back fts_expunge_log_uid_count()
Timo Sirainen [Tue, 27 Jan 2015 00:07:10 +0000 (02:07 +0200)] 
fts: Added back fts_expunge_log_uid_count()
This was accidentally removed by commit 5091f03d70e1

10 years agolib-mail: Test program wasn't linked with libiconv, causing linking failures.
Timo Sirainen [Sun, 25 Jan 2015 18:37:35 +0000 (10:37 -0800)] 
lib-mail: Test program wasn't linked with libiconv, causing linking failures.

10 years agolib: array - helper to swap array buffer ownership
Phil Carmody [Sat, 24 Jan 2015 00:15:45 +0000 (02:15 +0200)] 
lib: array - helper to swap array buffer ownership
Currently there's no simple way to create a replacement for an array,
and then atomically switch in that replacement. With this helper,
you can just exchange ownership of the two lists and then free the
new list (which now contains the old buffer).

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agoimapc: Merged gmail-pop3 and gmail-labels-keyword features into a single gmail-migrat...
Timo Sirainen [Fri, 23 Jan 2015 21:19:24 +0000 (23:19 +0200)] 
imapc: Merged gmail-pop3 and gmail-labels-keyword features into a single gmail-migration feature
There's really no other reason to use them except for migration.

10 years agoimapc: With gmail-labels-keyword feature add the $GMailHaveLabels only to \All mailbox
Timo Sirainen [Fri, 23 Jan 2015 21:18:01 +0000 (23:18 +0200)] 
imapc: With gmail-labels-keyword feature add the $GMailHaveLabels only to \All mailbox
This is primarily intended for migration, and with this behavior dsync can
be run just once so it's faster.

10 years agosdbox: Fixed assert-crash when copying mails due to earlier change.
Timo Sirainen [Wed, 21 Jan 2015 00:21:35 +0000 (02:21 +0200)] 
sdbox: Fixed assert-crash when copying mails due to earlier change.

10 years agoplugins/fts: use common guid_128 helpers
Phil Carmody [Tue, 20 Jan 2015 23:53:34 +0000 (01:53 +0200)] 
plugins/fts: use common guid_128 helpers
Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agoplugins/fts: expunge-log - query function to lookup GUID/UID
Phil Carmody [Tue, 20 Jan 2015 23:52:59 +0000 (01:52 +0200)] 
plugins/fts: expunge-log - query function to lookup GUID/UID
Constant time hash lookup for GUID. Log time lookup in seq_range array.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agoplugins/fts: expunge-log - create flattened in-RAM log with no backing storage
Phil Carmody [Tue, 20 Jan 2015 23:51:46 +0000 (01:51 +0200)] 
plugins/fts: expunge-log - create flattened in-RAM log with no backing storage
Combine each record in a source expunge log. This source log does not get
deleted afterwards.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agoplugins/fts: expunge-log - pull mailbox finding/creating into a helper
Phil Carmody [Tue, 20 Jan 2015 23:48:00 +0000 (01:48 +0200)] 
plugins/fts: expunge-log - pull mailbox finding/creating into a helper
There will be more clients than just this one.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agoplugins/fts: expunge-log - permit append helpers to have no log to write to
Phil Carmody [Tue, 20 Jan 2015 23:47:25 +0000 (01:47 +0200)] 
plugins/fts: expunge-log - permit append helpers to have no log to write to
This is for creating an in-RAM, later queriable, structure which you do not
want to be written to backing storage. As when you've finished with one, there's
no concept of a "commit", provide an alternative "abort" way out. These are
identical apart from the call to the write() routine, so refactor the two.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agoplugins/fts: expung-log - add the concept of not unlinking at the end
Phil Carmody [Tue, 20 Jan 2015 23:46:13 +0000 (01:46 +0200)] 
plugins/fts: expung-log - add the concept of not unlinking at the end
No behavioural differences, the default is to unlink.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: seq-range-array - add range changes
Phil Carmody [Tue, 20 Jan 2015 23:44:31 +0000 (01:44 +0200)] 
lib: seq-range-array - add range changes
Pull the _add_range() guts into a private helper function, and add a new
_add_range_count() helper which also returns the number of SEQs added.

Expand the tests to test this new functionality.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: data-stack - fix pointer arithmetic compiler warning
Phil Carmody [Tue, 20 Jan 2015 23:42:01 +0000 (01:42 +0200)] 
lib: data-stack - fix pointer arithmetic compiler warning
Clang's -fsanitize=unsigned-integer-overflow barfs as follows:

data-stack.c:477:29: runtime error: negation of 8 cannot be represented in type 'unsigned long'
data-stack.c:495:15: runtime error: negation of 8 cannot be represented in type 'unsigned long'

Which is of course complete bollocks. There is no 8, there's only an 8ul, and
the negation of 8ul is 0xfffffff8ul (or a wider equivalent). That's the law.

However, the pointer arithmetic which follows the negation, whilst almost
certainly working in practice, is probably bogus, so just make the thing
signed before the negation, and both problems go away.

Reported-by: Teemu Huovila <teemu.huovila@dovecot.fi>
Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agomaster: Fixed a check to see if login directory has any unix listeners.
Timo Sirainen [Tue, 20 Jan 2015 22:19:17 +0000 (00:19 +0200)] 
master: Fixed a check to see if login directory has any unix listeners.

10 years agoimapc: Implemented imapc_features=gmail-pop3 that also migrates pop3_deleted_flag.
Timo Sirainen [Tue, 20 Jan 2015 19:54:58 +0000 (21:54 +0200)] 
imapc: Implemented imapc_features=gmail-pop3 that also migrates pop3_deleted_flag.
This also caused gmail-pop3-uidl feature to be renamed to simply gmail-pop3,
which includes both the features.

10 years agolib-imap-client: Added imapc_command_get_tag()
Timo Sirainen [Tue, 20 Jan 2015 19:49:04 +0000 (21:49 +0200)] 
lib-imap-client: Added imapc_command_get_tag()

10 years agoimapc: Added imapc_features=gmail-pop3-uidl
Timo Sirainen [Tue, 20 Jan 2015 03:41:23 +0000 (05:41 +0200)] 
imapc: Added imapc_features=gmail-pop3-uidl
This allows imapc to generate GMail POP3 compatible UIDL so that
pop3-migration plugin isn't needed.

10 years agodsync: Allow -m parameter to specify \Special-use mailboxes.
Timo Sirainen [Tue, 20 Jan 2015 02:46:51 +0000 (04:46 +0200)] 
dsync: Allow -m parameter to specify \Special-use mailboxes.
Similarly to how -x parameter allows them.

10 years agodsync: Crashfix to -F parameter handling.
Timo Sirainen [Tue, 20 Jan 2015 02:46:26 +0000 (04:46 +0200)] 
dsync: Crashfix to -F parameter handling.

10 years agoimapc: Added imapc_features=gmail-labels-keyword
Timo Sirainen [Tue, 20 Jan 2015 02:30:27 +0000 (04:30 +0200)] 
imapc: Added imapc_features=gmail-labels-keyword
This is a bit kludgy feature mainly intended for migrations from GMail.
Unfortunately I couldn't figure out any nicer way to do this for now.
GMail's "All Mail" folder contains all messages in all folders, but it also
contains some messages that don't exist in other folders. For migrations we
want to copy only those messages that don't exist elsewhere. This can now be
achieved with something like:

doveadm -o imapc_features='gmail-labels-keyword ...' \
  backup -F '-$GmailHaveLabels' mdbox:~/mdbox

Note that dsync can't handle inserting mails into folders, so if doveadm
backup is already run once and one of the existing mails loses all labels,
doveadm backup will delete the whole folder and start again.

10 years agodsync: Added -F parameter to sync only mails with[out] specific flag.
Timo Sirainen [Tue, 20 Jan 2015 02:07:09 +0000 (04:07 +0200)] 
dsync: Added -F parameter to sync only mails with[out] specific flag.

10 years agodsync: If same GUID already exists in storage, try to copy it instead of recreating...
Timo Sirainen [Tue, 20 Jan 2015 01:23:29 +0000 (03:23 +0200)] 
dsync: If same GUID already exists in storage, try to copy it instead of recreating the mail.
This way most mailbox backends can reduce disk space by only doing a
reference count update.

This feature isn't enabled by default. A virtual "All Mails" mailbox needs
to be configured using the virtual plugin. Then you need to give this
mailbox as -a parameter, e.g.:
doveadm sync -a "Virtual/All Mails" ...

Currently this is implemented by reading through all the GUIDs in the
virtual mailbox. This of course isn't very efficient for things like
incremental replication. An upcoming conversation plugin will keep track of
all the mails' GUIDs, so in future replication should be able to have this
functionality efficiently as well.

10 years agovirtual plugin: Read virtual index header when opening virtual mailbox.
Timo Sirainen [Tue, 20 Jan 2015 01:14:37 +0000 (03:14 +0200)] 
virtual plugin: Read virtual index header when opening virtual mailbox.
This allows doing some mailbox accessing without actually syncing the
mailbox. For example MAIL_FETCH_MAILBOX_NAME can be used without crashing.

10 years agodsync: Added more debug logging.
Timo Sirainen [Mon, 19 Jan 2015 22:20:27 +0000 (00:20 +0200)] 
dsync: Added more debug logging.

10 years agodsync: Added -t <timestamp> parameter to save only mails newer than <timestamp>
Timo Sirainen [Mon, 19 Jan 2015 21:43:37 +0000 (23:43 +0200)] 
dsync: Added -t <timestamp> parameter to save only mails newer than <timestamp>
If one side has old mails that don't exist on the other side, they are
ignored (not synced and not deleted).

10 years agolib-storage: Added mail_parse_human_timestamp() to parse human-writable timestamps.
Timo Sirainen [Mon, 19 Jan 2015 21:40:27 +0000 (23:40 +0200)] 
lib-storage: Added mail_parse_human_timestamp() to parse human-writable timestamps.
This isn't really the ideal location for the function, but since it uses
both lib-settings and lib-imap, there's not any good location for it that I
can think of..

10 years agodoveadm: Added missing error handling to various mail commands.
Timo Sirainen [Mon, 19 Jan 2015 20:24:42 +0000 (22:24 +0200)] 
doveadm: Added missing error handling to various mail commands.
This fixes assert-crash that happened when the commands failed, because they
hadn't set any exit_code.

10 years agolib-storage: Comment updates to mailbox_list_iter_*()
Timo Sirainen [Mon, 19 Jan 2015 20:12:58 +0000 (22:12 +0200)] 
lib-storage: Comment updates to mailbox_list_iter_*()

10 years agodoveadm: If mailbox list iteration fails, log the error reason.
Timo Sirainen [Mon, 19 Jan 2015 20:11:29 +0000 (22:11 +0200)] 
doveadm: If mailbox list iteration fails, log the error reason.

10 years agoimap-urlauth: If mailbox list iteration fails, log the error.
Timo Sirainen [Mon, 19 Jan 2015 20:10:17 +0000 (22:10 +0200)] 
imap-urlauth: If mailbox list iteration fails, log the error.

10 years agovirtual plugin: If mailbox list iteration fails, log the error.
Timo Sirainen [Mon, 19 Jan 2015 20:09:14 +0000 (22:09 +0200)] 
virtual plugin: If mailbox list iteration fails, log the error.

10 years agolib-storage: Removed caching body snippet while message is being saved.
Timo Sirainen [Mon, 19 Jan 2015 19:58:19 +0000 (21:58 +0200)] 
lib-storage: Removed caching body snippet while message is being saved.
This broke saving mails with dbox, because it attempts to open the mails
too early. Also the generation was a bit costly operation to do if it wasn't
actually wanted to be cached.

So in future we'd first want to check if body snippet is actually wanted. If
it is, then generate the potential snippets while the message is being
parsed (always generate the snippet for the best found MIME part, replacing
existing snippets when needed). This requires the message_snippet_generate()
API to support sending input as partial message_blocks.

10 years agolib-storage: MAIL_FETCH_BODY_SNIPPET should seek the mail stream back to original...
Timo Sirainen [Mon, 19 Jan 2015 19:53:00 +0000 (21:53 +0200)] 
lib-storage: MAIL_FETCH_BODY_SNIPPET should seek the mail stream back to original position.

10 years agodbox: Added asserts to make sure the mail body isn't tried to be read too early while...
Timo Sirainen [Mon, 19 Jan 2015 19:52:21 +0000 (21:52 +0200)] 
dbox: Added asserts to make sure the mail body isn't tried to be read too early while saving.
If the mail headers are still being written, the opening will just fail
thinking the mail is corrupted.

10 years agofts: Fixed assert-crash in HTML parsing, broken by the earlier changes.
Timo Sirainen [Mon, 19 Jan 2015 19:11:29 +0000 (21:11 +0200)] 
fts: Fixed assert-crash in HTML parsing, broken by the earlier changes.

10 years agolib: iostream-rawlog now writes to ostreams instead of directly to fds.
Timo Sirainen [Sat, 17 Jan 2015 02:14:58 +0000 (04:14 +0200)] 
lib: iostream-rawlog now writes to ostreams instead of directly to fds.

10 years agolib: Added o_stream_create_passthrough() for creating simple wrapper ostreams
Timo Sirainen [Sat, 17 Jan 2015 02:14:09 +0000 (04:14 +0200)] 
lib: Added o_stream_create_passthrough() for creating simple wrapper ostreams

10 years agolib: Added o_stream_add_destroy_callback()
Timo Sirainen [Sat, 17 Jan 2015 02:13:13 +0000 (04:13 +0200)] 
lib: Added o_stream_add_destroy_callback()

10 years agoauth: Changed passdb { continue-ok } handling for credentials lookups.
Timo Sirainen [Sat, 17 Jan 2015 00:40:11 +0000 (02:40 +0200)] 
auth: Changed passdb { continue-ok } handling for credentials lookups.
If the last passdb after it doesn't return credentials, use the first
passdb's credentials. This allows implementing plugins that modify the
passdb result without actually changing the credentials.

10 years agolib-storage: Added mail_user_init_fs_settings()
Timo Sirainen [Sat, 17 Jan 2015 00:31:24 +0000 (02:31 +0200)] 
lib-storage: Added mail_user_init_fs_settings()
Also changed mailbox_list_init_fs() to use it internally.

10 years agodoveadm user: If username is changed by userdb lookup, return it.
Timo Sirainen [Fri, 16 Jan 2015 23:19:42 +0000 (01:19 +0200)] 
doveadm user: If username is changed by userdb lookup, return it.

10 years agodoveadm fetch: Added body.snippet field.
Timo Sirainen [Fri, 16 Jan 2015 22:32:10 +0000 (00:32 +0200)] 
doveadm fetch: Added body.snippet field.

10 years agolib-storage: Added MAIL_FETCH_BODY_SNIPPET.
Timo Sirainen [Fri, 16 Jan 2015 22:31:35 +0000 (00:31 +0200)] 
lib-storage: Added MAIL_FETCH_BODY_SNIPPET.

10 years agofts: Parse HTML MIME parts using lib-mail's mail-html2text.
Timo Sirainen [Fri, 16 Jan 2015 22:24:36 +0000 (00:24 +0200)] 
fts: Parse HTML MIME parts using lib-mail's mail-html2text.

10 years agolib-mail: Added message_snippet_generate() to produce a short text snippet of a mail.
Timo Sirainen [Fri, 16 Jan 2015 22:23:36 +0000 (00:23 +0200)] 
lib-mail: Added message_snippet_generate() to produce a short text snippet of a mail.

10 years agolib-mail: Added mail-html2text API
Timo Sirainen [Fri, 16 Jan 2015 22:15:44 +0000 (00:15 +0200)] 
lib-mail: Added mail-html2text API
What makes it mail-specific is that it allows skipping over data inside
<blockquote>. This code probably doesn't parse HTML perfectly, but hopefully
good enough for HTML emails.

10 years agolib-mail: Forgot to commit .h file for message_decoder_current_content_type() change.
Timo Sirainen [Wed, 14 Jan 2015 23:26:02 +0000 (01:26 +0200)] 
lib-mail: Forgot to commit .h file for message_decoder_current_content_type() change.

10 years agolib-mail: Added message_decoder_current_content_type()
Timo Sirainen [Wed, 14 Jan 2015 23:22:04 +0000 (01:22 +0200)] 
lib-mail: Added message_decoder_current_content_type()

10 years agolib-mail: message-decoder now always sets output->size=0 when headers are returned.
Timo Sirainen [Wed, 14 Jan 2015 23:11:34 +0000 (01:11 +0200)] 
lib-mail: message-decoder now always sets output->size=0 when headers are returned.

10 years agolib-mail: Fixed crash in message-decoder with unknown charsets.
Timo Sirainen [Wed, 14 Jan 2015 23:10:11 +0000 (01:10 +0200)] 
lib-mail: Fixed crash in message-decoder with unknown charsets.
Caused by earlier changes.

10 years agolib-mail: Replaced MAX_TRANSLATION_BUF_SIZE with the new CHARSET_MAX_PENDING_BUF_SIZE
Timo Sirainen [Wed, 14 Jan 2015 23:08:00 +0000 (01:08 +0200)] 
lib-mail: Replaced MAX_TRANSLATION_BUF_SIZE with the new CHARSET_MAX_PENDING_BUF_SIZE

10 years agolib-charset: Added CHARSET_MAX_PENDING_BUF_SIZE macro and asserts for it.
Timo Sirainen [Wed, 14 Jan 2015 23:05:36 +0000 (01:05 +0200)] 
lib-charset: Added CHARSET_MAX_PENDING_BUF_SIZE macro and asserts for it.

10 years agolib-charset: Added charset_utf8_to_utf8_begin() wrapper function.
Timo Sirainen [Wed, 14 Jan 2015 23:05:13 +0000 (01:05 +0200)] 
lib-charset: Added charset_utf8_to_utf8_begin() wrapper function.
It's never supposed to fail, so it makes it nicer for the callers who need
to use it.

10 years agolib: Fixed NUL-handling in uni_utf8_*strlen*()
Timo Sirainen [Wed, 14 Jan 2015 23:03:58 +0000 (01:03 +0200)] 
lib: Fixed NUL-handling in uni_utf8_*strlen*()
uni_utf8_strlen() could have skipped over the ending NUL byte and caused
read buffer overflows with invalid input.

uni_utf8_strlen_n() and uni_utf8_partial_strlen_n() now allow NUL bytes in
the input and they're treated as regular control characters. Previously the
size was actually treated as max_size with early NUL byte termination.
Technically this is an API change, but I'm not aware of anything using these
functions in an incompatible way.

10 years agolib-storage: Added "oldestonly" search arg to stop searching after the first non...
Timo Sirainen [Wed, 14 Jan 2015 22:10:56 +0000 (00:10 +0200)] 
lib-storage: Added "oldestonly" search arg to stop searching after the first non-match.
This parameter works only for doveadm search queries. It's not fully exact
currently, because if mailbox.search_next_update_seq() skips over
non-matching messages we don't stop if the next message matches. So this
parameter is mainly useful for optimization of commands like:

doveadm expunge -u user@domain mailbox inbox savedsince 30d oldestonly

Where the timestamps should be ascending all the time anyway and there's no
point in continuing to search for more mails after the first timestamp is
too high.

10 years agolib-mail: message-decoder no longer skips lib-charset for UTF8 -> UTF8 translations.
Timo Sirainen [Sat, 10 Jan 2015 02:32:42 +0000 (04:32 +0200)] 
lib-mail: message-decoder no longer skips lib-charset for UTF8 -> UTF8 translations.
With the previous lib-charset fix this makes message-decoder handle partial
UTF-8 text in input blocks correctly.

10 years agolib: Added uni_utf8_partial_strlen_n()
Timo Sirainen [Sat, 10 Jan 2015 02:30:40 +0000 (04:30 +0200)] 
lib: Added uni_utf8_partial_strlen_n()

10 years agolib-charset: UTF-8 -> UTF-8 translation was never returning CHARSET_RET_INCOMPLETE_INPUT
Timo Sirainen [Sat, 10 Jan 2015 02:25:21 +0000 (04:25 +0200)] 
lib-charset: UTF-8 -> UTF-8 translation was never returning CHARSET_RET_INCOMPLETE_INPUT
Instead the incomplete input was just being modified into broken output.

10 years agolib-imap-client: Compiler warning fixes
Timo Sirainen [Thu, 8 Jan 2015 21:07:54 +0000 (23:07 +0200)] 
lib-imap-client: Compiler warning fixes

10 years agoimapc: Added imapc_sasl_mechanisms setting
Timo Sirainen [Thu, 8 Jan 2015 20:52:11 +0000 (22:52 +0200)] 
imapc: Added imapc_sasl_mechanisms setting
The first supported SASL mechanism is used, otherwise the login fails
entirely.

10 years agolib-imap-client: Use lib-sasl to perform the AUTHENTICATE command handling.
Timo Sirainen [Thu, 8 Jan 2015 20:32:20 +0000 (22:32 +0200)] 
lib-imap-client: Use lib-sasl to perform the AUTHENTICATE command handling.

10 years agolib: Defined array type for guid_128_t
Timo Sirainen [Tue, 6 Jan 2015 22:37:50 +0000 (00:37 +0200)] 
lib: Defined array type for guid_128_t

10 years agolib: Remove OpenBSD workaround in i_getpw*()
Timo Sirainen [Tue, 6 Jan 2015 01:15:11 +0000 (03:15 +0200)] 
lib: Remove OpenBSD workaround in i_getpw*()
Originally added in 801714cba91b. It was requested to be removed now that 1)
it's fixed in OpenBSD v5.6+ and 2) The workaround caused nonexistent users
to not work correctly (process running out of memory I guess?)

10 years agofts: Correct returned value to match type signature.
Teemu Huovila [Mon, 5 Jan 2015 13:48:55 +0000 (15:48 +0200)] 
fts: Correct returned value to match type signature.

10 years agoglobal: freshen copyright
Phil Carmody [Mon, 5 Jan 2015 20:20:10 +0000 (22:20 +0200)] 
global: freshen copyright
Robomatically:
  git ls-files | xargs perl -p -i -e 's/(\d+)-201[0-4]/$1-2015/g;s/ (201[0-4]) Dovecot/ $1-2015 Dovecot/'

Happy 2015 everyone!

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: guid - centralise a 'reset to the empty value' helper function
Phil Carmody [Mon, 5 Jan 2015 20:16:59 +0000 (22:16 +0200)] 
lib: guid - centralise a 'reset to the empty value' helper function
This helper just ensures that the caller never has to get the sizeof()
right. (Were a guid passed as a function parameter, mistakes could happen.)

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: guid - declare some functions as pure
Phil Carmody [Mon, 5 Jan 2015 20:15:31 +0000 (22:15 +0200)] 
lib: guid - declare some functions as pure
As the functions aren't inline, the compiler can't know if they
can be optimised away, so give it a helping hand.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: array - explain implications of ARRAY_TYPE() in comment
Phil Carmody [Mon, 5 Jan 2015 20:15:07 +0000 (22:15 +0200)] 
lib: array - explain implications of ARRAY_TYPE() in comment
If you use ARRAY_TYPE() to pass an array around, then you must also
use ARRAY_TYPE() to define the array itself, ARRAY() will no longer do.

Reported-by: Arnt Gulbrandsen <arnt@gulbrandsen.priv.no>
Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: test-array - test new lsearch helper
Phil Carmody [Mon, 5 Jan 2015 20:13:59 +0000 (22:13 +0200)] 
lib: test-array - test new lsearch helper
Just piggy-back on to the current reverse test, as that's got an array
nicely set up for us already.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: array - new linear search helper
Phil Carmody [Mon, 5 Jan 2015 20:12:48 +0000 (22:12 +0200)] 
lib: array - new linear search helper
There are large numbers of array_foreach loops which do nothing but search
for the first element which matches some key. This can be abstracted out
into a helper.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agoconfigure: Don't break when using --without-shared-libs and CC with '/' chars.
Timo Sirainen [Fri, 26 Dec 2014 15:28:30 +0000 (17:28 +0200)] 
configure: Don't break when using --without-shared-libs and CC with '/' chars.

10 years agoauth: Don't crash if master user login is attempted without master=yes passdbs
Timo Sirainen [Wed, 17 Dec 2014 13:43:30 +0000 (14:43 +0100)] 
auth: Don't crash if master user login is attempted without master=yes passdbs

10 years agolib: Small optimization / unnecessary code removal from array_*() functions.
Timo Sirainen [Wed, 17 Dec 2014 12:39:57 +0000 (13:39 +0100)] 
lib: Small optimization / unnecessary code removal from array_*() functions.

10 years agolib-storage: Mail prefetching was still not working right.
Timo Sirainen [Fri, 5 Dec 2014 03:50:19 +0000 (05:50 +0200)] 
lib-storage: Mail prefetching was still not working right.
I wonder if it ever actually worked (except for SEARCH TEXT).

10 years agodoveadm: Avoid calling init() in doveadm binary if the command is sent to doveadm...
Timo Sirainen [Fri, 5 Dec 2014 02:39:11 +0000 (04:39 +0200)] 
doveadm: Avoid calling init() in doveadm binary if the command is sent to doveadm-server.
The init() is still always called when -A or -u *wildcards* are used though.
I'm not sure if that can be delayed. At least all commands should be
verified that they don't rely on the current init() location.

10 years agodoveadm: Support changing proxy destination username with "user" and "destuser" passd...
Timo Sirainen [Fri, 5 Dec 2014 01:53:02 +0000 (03:53 +0200)] 
doveadm: Support changing proxy destination username with "user" and "destuser" passdb field.

10 years agoauth: Don't allow changing username to an empty string.
Timo Sirainen [Fri, 5 Dec 2014 01:38:08 +0000 (03:38 +0200)] 
auth: Don't allow changing username to an empty string.
This is most likely always accidental and Dovecot in general hasn't been
designed to support empty usernames.

10 years agofts: Install some of the header files that other external plugins might want to use.
Timo Sirainen [Fri, 5 Dec 2014 01:11:14 +0000 (03:11 +0200)] 
fts: Install some of the header files that other external plugins might want to use.

10 years agofts: Compiler warning fix when using fts-indexer.h directly
Timo Sirainen [Fri, 5 Dec 2014 01:10:32 +0000 (03:10 +0200)] 
fts: Compiler warning fix when using fts-indexer.h directly

10 years agodict-redis: Use timeout_msecs parameter also for transaction commit waits.
Timo Sirainen [Tue, 2 Dec 2014 08:29:13 +0000 (00:29 -0800)] 
dict-redis: Use timeout_msecs parameter also for transaction commit waits.

10 years agodict-redis: Use EXPIRE also after INCRBY commands.
Timo Sirainen [Tue, 2 Dec 2014 08:26:24 +0000 (00:26 -0800)] 
dict-redis: Use EXPIRE also after INCRBY commands.

10 years agolib: test-array - really really really stop gcc optimising away fatal tests
Phil Carmody [Mon, 1 Dec 2014 20:43:33 +0000 (22:43 +0200)] 
lib: test-array - really really really stop gcc optimising away fatal tests
Gcc 4.6 also was determined to optimise away the calls that should crash.
We therefore have to do *something*, no matter how stupid, with the return
values. This should do it. (please, oh please, oh please, ...)

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agoquota: Added "hidden" option to hide the quota root from IMAP GETQUOTAROOT command.
Timo Sirainen [Mon, 1 Dec 2014 20:11:54 +0000 (12:11 -0800)] 
quota: Added "hidden" option to hide the quota root from IMAP GETQUOTAROOT command.

10 years agolib: array - array_foreach_idx is just a generic ptr_to_idx helper
Phil Carmody [Fri, 28 Nov 2014 08:57:43 +0000 (10:57 +0200)] 
lib: array - array_foreach_idx is just a generic ptr_to_idx helper
Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: test-array - remove possibility to optimise out tests
Phil Carmody [Fri, 28 Nov 2014 08:57:43 +0000 (10:57 +0200)] 
lib: test-array - remove possibility to optimise out tests
(void) on a call to a "pure" function was causing some compilers (gcc 4.8)
to not reach the assert within the pure function. Technically it's not a
pure function, as (in the assert fail case) it has effects other than its
return value. However, simply removing the void cast (and then actually
using the return value) also prevents this optimisation.

An additional fatal test was added - there's a difference between an access
outside the allocated range and outside the initialised range.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib-test: more delicate *assert() behaviour when doing fatal tests
Phil Carmody [Fri, 28 Nov 2014 08:57:43 +0000 (10:57 +0200)] 
lib-test: more delicate *assert() behaviour when doing fatal tests
We shouldn't be i_asserting ourselves when we're in the state of wanting a
test to fail. Therefore instead test_assert to get the assert message, and
ensure that the success flag is cleared to get the FAILED at the end.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: array - additional compile-time checks to array_append
Phil Carmody [Tue, 25 Nov 2014 01:48:42 +0000 (03:48 +0200)] 
lib: array - additional compile-time checks to array_append
The new two-array helper macro works in this context too.

Note: array_copy doesn't have any protection currently, it isn't
obvious how to wrap that with some safety without breaking interfaces.
It only seems to have one internal user, lib/aqueue.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: test-array - fix off-by-one in test_reverse
Phil Carmody [Tue, 25 Nov 2014 01:45:35 +0000 (03:45 +0200)] 
lib: test-array - fix off-by-one in test_reverse
i is not used as an index, but as a count. Therefore, it can attain the
array size in the loop without causing any buffer overflows.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: test-array - fatal tests
Phil Carmody [Tue, 25 Nov 2014 01:44:55 +0000 (03:44 +0200)] 
lib: test-array - fatal tests
Tests both of the i_asserts which aren't already protected by TYPEOF compile-time
checks.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: test-array - new equality testers
Phil Carmody [Tue, 25 Nov 2014 01:44:31 +0000 (03:44 +0200)] 
lib: test-array - new equality testers
One using strings that get dereferenced, the other using the context pointer
to pass in external data.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: array - element-wise comparison via callback
Phil Carmody [Tue, 25 Nov 2014 01:43:02 +0000 (03:43 +0200)] 
lib: array - element-wise comparison via callback
2 are provided - with and without a context pointer.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: test-array - test array_cmp()
Phil Carmody [Tue, 25 Nov 2014 01:43:02 +0000 (03:43 +0200)] 
lib: test-array - test array_cmp()
Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agolib: guid - turn uint8_t * parameters into guid_128_t
Phil Carmody [Tue, 25 Nov 2014 01:31:34 +0000 (03:31 +0200)] 
lib: guid - turn uint8_t * parameters into guid_128_t
As we expose the type's internals, there's no concrete difference between
the two, but it might help static code checkers to detect misuse of the
library, or sloppy typing.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
10 years agodict-redis: Small error handling fix to previous change.
Timo Sirainen [Tue, 25 Nov 2014 01:12:25 +0000 (03:12 +0200)] 
dict-redis: Small error handling fix to previous change.

10 years agodict-redis: Added support for expire_secs=n parameter.
Timo Sirainen [Tue, 25 Nov 2014 01:10:41 +0000 (03:10 +0200)] 
dict-redis: Added support for expire_secs=n parameter.
It performs EXPIRE command for the added keys immediately after the SET.

10 years agolib-storage: Don't fetch wanted_fields for messages that don't match the search query.
Timo Sirainen [Tue, 25 Nov 2014 00:56:37 +0000 (02:56 +0200)] 
lib-storage: Don't fetch wanted_fields for messages that don't match the search query.
For example "doveadm fetch text subject foo" was opening all the mails, even
though only a few matched the subject (that was hopefully already in cache
file).

The behavior still isn't perfect though. The wanted_fields should probably
be split into search_wanted_fields and fetch_wanted_fields, but the current
behavior is likely good enough for now.

10 years agolmtp: Added TLS security information to Received: header when STARTTLS was used.
Timo Sirainen [Fri, 21 Nov 2014 09:17:00 +0000 (18:17 +0900)] 
lmtp: Added TLS security information to Received: header when STARTTLS was used.

10 years agostats: Removed extra TAB from global stats exporting.
Timo Sirainen [Thu, 20 Nov 2014 13:03:25 +0000 (22:03 +0900)] 
stats: Removed extra TAB from global stats exporting.

10 years agolib-index: If transaction log is unexpectedly recreated while it was locked, log...
Timo Sirainen [Thu, 20 Nov 2014 06:15:20 +0000 (15:15 +0900)] 
lib-index: If transaction log is unexpectedly recreated while it was locked, log a nice error.
Instead of just assert-crashing.