Timo Sirainen [Thu, 18 Oct 2012 03:58:01 +0000 (06:58 +0300)]
lib-imap-urlauth: Minor fix to avoiding timing attacks against mailbox existence.
random_fill() is slightly slower than random_fill_weak(). Probably even
better way to handle timing attacks would be to always add a short random
pause before returning verification failure.
Timo Sirainen [Thu, 18 Oct 2012 03:55:04 +0000 (06:55 +0300)]
Moved random_init() from lib-imap-urlauth to imap/imap-urlauth main().
This way if the processes are chrooted they are still able to open
/dev/urandom.
Timo Sirainen [Thu, 18 Oct 2012 03:00:18 +0000 (06:00 +0300)]
lib-index: Fixed handling of finding a duplicate dovecot.index.log file_seq
Previously we assumed that the already opened file was always the wrong one,
but more common was that the newly opened file was .log.2 which should have
been deleted.
Timo Sirainen [Sat, 13 Oct 2012 01:27:14 +0000 (04:27 +0300)]
lib-storage: Added support to get/set/iterate mailbox attributes.
The attributes are stored in a dict specified by mail_attribute_dict
setting. The idea is to use this as storage for extensions that require
per-mailbox key=value pairs, such as METADATA.
Timo Sirainen [Fri, 12 Oct 2012 21:40:41 +0000 (00:40 +0300)]
Moved doveadm zlib commands from zlib plugin to doveadm directly.
Previously it was a plugin, because the istream-zlib existed only in zlib
plugin. Now there's a lib-compression that implements it.
Timo Sirainen [Fri, 12 Oct 2012 21:24:47 +0000 (00:24 +0300)]
lib-ssl-iostream: Make the input buffering behave the same as in file-istream
Previously i_stream_read(ssl_input) could have still left some data buffered
into the underlying file-istream, which meant that I/O loop didn't detect
any new input from the fd and the connection got stuck.
Timo Sirainen [Fri, 12 Oct 2012 02:45:42 +0000 (05:45 +0300)]
lib-storage: Added support for "broken_char" setting for escaping invalid mailbox names.
This is currently enabled only for imapc backend, where '~' character is
used for it.
Most importantly this allows migrating mailboxes from other IMAP servers
that contain mailbox names that Dovecot's imapc backend couldn't otherwise
access.
Timo Sirainen [Fri, 12 Oct 2012 00:47:41 +0000 (03:47 +0300)]
lib-storage: Added optional mailbox_list.init(), which can check for failure.
"index" backend now gives a nice error message instead of crashing when
mailbox_list_index=no
Timo Sirainen [Fri, 12 Oct 2012 00:17:56 +0000 (03:17 +0300)]
Build imapc and pop3c always as plugins.
This avoids having to link openssl library to all binaries that use
lib-storage. It appears that simply by linking with openssl causes each
such process to use 100-200 kB of more memory. With 10k imap processes this
is 1-2 GB of wasted memory.
The imapc and pop3c are still registered as stubs, and their plugins are
automatically loaded when needed.
Timo Sirainen [Fri, 12 Oct 2012 00:12:19 +0000 (03:12 +0300)]
lib-storage: Added mail_user_get_storage_class(), which auto-loads storage plugins.
The auto-loading is done only if there's already a stub storage registered.
Timo Sirainen [Fri, 12 Oct 2012 00:08:13 +0000 (03:08 +0300)]
--without-shared-libs: Link Dovecot libraries with --whole-archive flag for binaries.
This removes the need for the ugly unused_objects lists for binaries, which
were needed to avoid plugins from failing because they were missing some
functions.
Apparently there's no easy way to use --whole-archive properly with libtool,
so there's now a rather ugly cc-wrapper.sh that does it. Also this is done
only when GNU ld is deted. Most people are going to use --with-shared-libs
though, so I don't think any of this is going to be a real problem.
Timo Sirainen [Thu, 11 Oct 2012 21:51:41 +0000 (00:51 +0300)]
Plugin ABI version checking improvements.
Previously the plugin version was checked against the version string
returned by the currently running Dovecot master process, not necessarily
the same as the binary. Also version_ignore=yes setting skipped the version
check entirely.
Now there's a new DOVECOT_ABI_VERSION macro that can (at least in theory) be
updated only when the ABI actually changes. The version is in format
"2.2.ABIv1(2.2.15)", where the (2.2.15) would be the actual Dovecot version
number that gets ignored when comparing the strings.
Also now the plugin version is compared to the actually running binary's
ABI, not the master's version, and it can't be ignored with a setting.
Timo Sirainen [Thu, 4 Oct 2012 21:15:01 +0000 (00:15 +0300)]
lib-storage: Don't crash when searching multiple keywords.
Fixed by simply removing the keyword merging code.
mail_search_args_simplify() is called before mail_search_args_init(), so the
keywords are still NULL and merging can't be done. Alternative fix would
have been to add string array to mail_search_arg.value containing the
keywords, but all of this is a pretty unnecessary optimization.
Timo Sirainen [Wed, 3 Oct 2012 23:34:53 +0000 (02:34 +0300)]
lib-index: Simplified writing to dovecot.index.cache file.
The old method was basically:
- write max. 32 kB to internal buffer
- flush it by writing to reserved areas (with no locks)
The reserved areas were acquired by doing (whenever needed):
- lock dovecot.index.cache
- reserve data from dovecot.index.cache for writing, potentially increasing
the file size by writing 0 bytes. the reserved area size varies.
- unlock dovecot.index.cache
This worked, but if multiple processes were writing to the cache file it
could have left incomplete reserved areas as holes. The holes were attempted
to be filled if they were large enough.
The new method is:
- write max. 256 kB to internal buffer
- lock dovecot.index.cache
- append the buffer to dovecot.index.cache
- unlock dovecot.index.cache
No reserved areas, holes or anything else weird going on.
Ideally no data would be overwritten in the dovecot.index.cache file, only
appended. Unfortunately currently some data is still overwritten:
- mail_cache_header.{deleted_space,continued_record_count}
- mail_cache_header_fields.next_offset when writing a new one
- mail_cache_header_fields.{last_used,decision}
- mail_cache_record.prev_offset
The changing headers could eventually be moved to dovecot.index. This
however is a backwards-incompatible change. The record's prev_offset could
maybe simply just not be written in those (somewhat rare) problematic
situations.
Timo Sirainen [Wed, 3 Oct 2012 15:17:26 +0000 (18:17 +0300)]
Renamed network.[ch] to net.[ch].
The function prefixes already started with net_ instead of network_.
And icecap wants to use network.h for other purpose. :)
Timo Sirainen [Wed, 3 Oct 2012 02:41:46 +0000 (05:41 +0300)]
lib-index: Fix for handling view syncing for already deleted transaction logs.
The sync changes' hidden-flag was set randomly, which could have caused
flag changes to get lost.
Timo Sirainen [Tue, 2 Oct 2012 22:20:22 +0000 (01:20 +0300)]
lib-storage: mailbox_save_cancel() now makes sure that dest_mail is reset.
This fixes e.g. doveadm import, which continues import even though some
messages couldn't be saved.
Timo Sirainen [Tue, 2 Oct 2012 20:24:10 +0000 (23:24 +0300)]
lib-storage: When index mkdir() fails with EPERM, create the dir anyway with 0700 mode.
This avoids failing entirely when /var/mail/user has 0660 permissions and we
don't have access to the group. The error message is still logged.
Timo Sirainen [Mon, 24 Sep 2012 13:49:29 +0000 (16:49 +0300)]
ldap auth: Update %variables after each field update.
The previous behavior was a bit confusing. "uid=user" at the beginning
updated the %u variable, but if it was after templates it didn't update it.
Also "=user=%{uid}" that was supposed to be equivalent wasn't. Now the
behavior is consistent across all ways to set the fields.
Timo Sirainen [Mon, 24 Sep 2012 11:42:38 +0000 (14:42 +0300)]
lib-storage: Added ALTNOCHECK option to mail_location.
By default Dovecot verifies that $rootdir/dbox-alt-root symlink matches the
ALT directory location, and logs an error if not. This is mainly to avoid
accidents during initial configuration when for example alt dir was set in
global mail_location but was forgotten to be set in userdb reply's
mail_location. The ALTNOCHECK setting simply doesn't check or create this
symlink, giving a (very) small performance improvement.
Timo Sirainen [Mon, 24 Sep 2012 11:24:58 +0000 (14:24 +0300)]
imapc: And another compile fix..
Using the macro would have required config/all-settings.c to include
imapc-client.h, which is a bit too much trouble just for this.
Timo Sirainen [Fri, 21 Sep 2012 07:26:10 +0000 (09:26 +0200)]
lmtp: After successful proxying RCPT TO, the second one to nonexistent user gave tempfail error.
Instead of "unknown user" it gave "Can't handle mixed proxy/non-proxy
destinations".