Timo Sirainen [Tue, 27 Nov 2012 23:43:24 +0000 (01:43 +0200)]
i_stream_default_stat(): If we can't know the size, return -1 instead of assert crash.
This fixes a crash saving to mdbox when input stream's size wasn't known.
Timo Sirainen [Tue, 27 Nov 2012 08:39:26 +0000 (10:39 +0200)]
mdbox: When rebuilding storage, fsck the map index first to make sure it's valid.
This fixes assert-crash when the map index contained records with UIDs in
wrong order.
Timo Sirainen [Tue, 27 Nov 2012 07:13:57 +0000 (09:13 +0200)]
login: Reverted previous fix attempt for SSL_accept() busy-looping.
Apparently didn't work. Probably this patch doesn't help anything then, so
just remove the extra complexity.
Timo Sirainen [Tue, 27 Nov 2012 05:50:06 +0000 (07:50 +0200)]
Reversed recent "short utf8" changes.
Solr code needs to parse the UTF8 input explicitly anyway to encode the XML
characters. And all the character checks were already done in it.
Timo Sirainen [Fri, 23 Nov 2012 06:32:13 +0000 (08:32 +0200)]
auth: Added a way to set default values for nonexistent LDAP attributes.
%{ldap:attrName:default_value} expands to default_value if attrName doesn't
exist.
Timo Sirainen [Wed, 7 Nov 2012 15:37:16 +0000 (17:37 +0200)]
var_expand*(): Don't use a data stack frame when expanding long %{variables}
This avoids potential crashes if the destination string is also allocated
from data stack and requires growing.
Timo Sirainen [Wed, 7 Nov 2012 15:05:47 +0000 (17:05 +0200)]
mdbox: Don't leave extra records to dovecot.map.index if mailbox index locking fails.
Fixes errors such as:
Corrupted dbox file /mdbox/storage/m.1 (around offset=2652): EOF reading msg header (got 0/30 bytes)
Timo Sirainen [Tue, 6 Nov 2012 21:49:24 +0000 (23:49 +0200)]
module_dir_deinit(): If no modules were actually initialized, avoid doing memory allocation.
This allows calling module_dir_unload() with atexit(), as long as the module
doesn't need to call deinit().
Timo Sirainen [Mon, 5 Nov 2012 23:11:03 +0000 (01:11 +0200)]
Reverted 269104a0821b (Build imapc and pop3c always as plugins.)
This is no longer needed now that lib-ssl-iostream can be linked without
linking openssl.
Timo Sirainen [Mon, 5 Nov 2012 23:04:24 +0000 (01:04 +0200)]
lib-ssl-iostream now dynamically loads openssl library instead of linking to it.
This allowed removing the separate libdovecot-ssl library. In future if
GnuTLS/NSS support is added it would also allow switching between them
dynamically.
Timo Sirainen [Sat, 3 Nov 2012 18:25:17 +0000 (20:25 +0200)]
lib-index: Replaced cache's deleted_space with deleted_record_count.
This way when expunging messages we don't need to actually read through the
cache file and calculate how many bytes will be freed, we can simply
increase the deleted_record_count by 1. We'll still compress the cache file
approximately after 20% of the space (records) has been deleted.
This also converts the old "hole offset" header field to tracking the number
of records in the cache file. Otherwise we'd have to assume that all of the
messages in mailbox have a cache record, but that isn't true for users who
have only temporary cache fields. This "hole offset" cannot be trusted
completely, because nothing prevents old Dovecot version from simply writing
a hole offset there and messing up the record counts. Because of this there
are a couple of extra sanity checks for it. (Unfortunately there wasn't any
easy way to simply add a new field to header without breaking backwards
compatibility.)
Timo Sirainen [Sat, 3 Nov 2012 17:35:54 +0000 (19:35 +0200)]
lib-index: If a cache record is larger than 64 kB, don't add it to cache file.
This shouldn't affect anything except mails that probably shouldn't exist in
the first place.
Timo Sirainen [Sat, 3 Nov 2012 17:25:35 +0000 (19:25 +0200)]
lib-index: Cache record linking is now while writing new records, not later with pwrite().
This should make performance somewhat better. It also means that now the
only overwrites to cache file are to the file header and the fields header.
This means that we no longer have to invalidate file_cache (with
mmap_disable=yes) except when reading the headers, which is always done
anyway.
It would be nice to move the overwritten fields in the headers to a cache
header in dovecot.index file, but this is a bit tricky currently. When
writing these headers the cache file needs to be locked to avoid race
conditions. To avoid deadlocks the transaction log would have to be locked
before the cache. The code to do all this would still be a bit complex, and
to keep backwards compatibility with old Dovecot versions it would still
have to do the overwriting until the backwards compatibility code is
disabled.
Timo Sirainen [Sat, 3 Nov 2012 11:47:55 +0000 (13:47 +0200)]
lib-index: Write to transaction log using O_APPEND flag.
Most OSes should do the writes atomically so that reads won't see partially
written data. We don't currently rely on this, but it would be possible in
future to remove locking entirely from writing to transaction log.
Timo Sirainen [Wed, 31 Oct 2012 11:34:52 +0000 (13:34 +0200)]
lib-storage: Don't require mailbox to be synced for MAILBOX_METADATA_GUID lookup
None of the mailbox formats currently require it, and lib-lda code
assert-crashes with it since syncing is done with a transaction already
open.
Timo Sirainen [Mon, 29 Oct 2012 20:03:25 +0000 (22:03 +0200)]
If prefix="" namespace isn't defined, autocreate it as an unusable namespace.
This avoids having to handle mail_namespace_find() errors all over the
place. Instead now the mailbox accesses will simply fail.