Commit Graph

955 Commits

Author SHA1 Message Date
Oswald Buddenhagen
ae49a37a3e don't crash on malformed response code
this would happen in the absurd corner case that the response code is
properly terminated with a closing bracket, but the atom itself is an
unterminated double-quoted string.

NOT found by coverity.
2014-04-12 15:02:40 +02:00
Oswald Buddenhagen
fd872a7ff7 don't crash on truncated LIST response
found by coverity.
2014-04-12 14:58:18 +02:00
Oswald Buddenhagen
0dfbf6f6fb remove pointless pointer assignment 2014-04-12 13:08:10 +02:00
Oswald Buddenhagen
d34baeb886 fix hypothetical buffer overflows
if something managed to make the maildir .uidvalidity files big enough
(possible only by appending garbage or scrambling them alltogether), we
would overflow the read buffer by one when appending the terminating
null.
this is not expected to have any real-world impact.

found by coverity.
2014-04-12 13:03:46 +02:00
Oswald Buddenhagen
df29c592d1 close a bunch of fd leaks in error paths
found by coverity.
2014-04-12 12:46:36 +02:00
Oswald Buddenhagen
dec5f73f57 actually use prime numbers for all hash bucket sizes
for some reason lost in history, the prime_deltas were actually wrong,
leading to using composite numbers.
the right sequence is available at http://oeis.org/A092131.
2014-03-19 10:27:06 +01:00
Oswald Buddenhagen
bee7ceb0fb fix zero MaxSize override in Channels
REFMAIL: CA+Tk8fzb9i9LrC_k4G978c5XR5urNz_s0fpOn_-6EsdrBnEzSQ@mail.gmail.com
2014-03-19 10:09:20 +01:00
Oswald Buddenhagen
19d86d2aa9 rework maildir store mapping
the trivial approach of having "home" and "root" stores produced ugly
results, and totally failed with the introduction of nested folder
handling.
instead, create a store per local directory, just as one would manually.

CCMAIL: 737708@bugs.debian.org
2014-03-10 12:20:29 +01:00
Oswald Buddenhagen
0edb606e0f don't needlessly quote strings 2014-03-10 12:20:29 +01:00
Oswald Buddenhagen
183f256557 don't needlessly spell out INBOX 2014-03-10 12:20:29 +01:00
Oswald Buddenhagen
bf9d7c7695 write Sync and Expunge to global section if applicable
makes for leaner Channel sections.

note: the global delete and expunge variables exist so the command line
can override the config file despite the otherwise backwards behavior.
2014-03-10 12:20:18 +01:00
Oswald Buddenhagen
f55f42bdfc don't bother checking impossible condition
the config readear already verified that at least host or tunnel are
set.
2014-03-09 15:56:52 +01:00
Oswald Buddenhagen
3161540ab9 fix crash on store without prior fetch with non-UIDPLUS servers
we'd never initialize the message list append pointer, so
imap_find_new_msgs()'s FETCH would go awry.

REFMAIL: <20140207101719.GB17125@mac.home>
2014-02-08 13:29:35 +01:00
Oswald Buddenhagen
12be7dd1f3 remove pointless use of AI_V4MAPPED flag
this flag is ineffective if ai_family is not explicitly AF_INET6.
on top of that, attempting to use it breaks on FreeBSD.
2014-02-02 12:24:34 +01:00
Oswald Buddenhagen
1c758be695 fix typos 2014-01-25 13:19:02 +01:00
Oswald Buddenhagen
f4a192f375 don't error out if we don't get an X-TUID header
the BODY[] item in the FETCH response corresponds to what we requested,
and its presence doesn't imply that it actually contains anything useful
- new messages may appear in the mailbox in addition to those we stored
ourselves, and these will obviously have no TUID.
2014-01-25 11:34:03 +01:00
Oswald Buddenhagen
aee0fa3b68 make date parsing portable, take 2
the global timezone variable is glibc-specific.
so use timegm() instead of mktime() for the conversion.
as that is specific to the BSDs and glibc, provide a fallback.
amends 62a6099.
2014-01-02 21:09:09 +01:00
Oswald Buddenhagen
6d2fd370a6 fix _POSIX_SYNCHRONIZED_IO usage
it can be -1 for unsupported, or 0 for runtime detection (which we don't
do).
2014-01-02 21:09:09 +01:00
Oswald Buddenhagen
813b4942db bump version 2014-01-02 21:08:57 +01:00
Oswald Buddenhagen
f9386d0b83 remove apparently obsolete item about Mutt's confusion
seems to work just fine ...
2013-12-15 14:06:14 +01:00
Oswald Buddenhagen
760bfa2cc6 pre-release doc updates 2013-12-15 13:46:25 +01:00
Oswald Buddenhagen
8b2bc912b4 elaborate on expunging and trashing 2013-12-15 13:46:25 +01:00
Oswald Buddenhagen
4481702da3 clarify wording in MapInbox doc 2013-12-15 13:46:25 +01:00
Oswald Buddenhagen
4fa5779193 avoid array underflow in IMAP LIST .lock workaround
suggested by Mark Wielaard <mark@klomp.org>.

fwiw, the workaround really is still necessary with panda imap ...
2013-12-15 13:46:06 +01:00
Oswald Buddenhagen
359091625d MaxMessages: ignore entries with no master while calculating bulk fetch 2013-12-13 15:38:50 +01:00
Oswald Buddenhagen
2bbd07ec87 adjust comments to new reality 2013-12-11 16:29:34 +01:00
Oswald Buddenhagen
5a21042e98 ensure sequencing of message propagation and store closing
by putting the message propagation last, d3f634702 uncovered a
long-standing problem: we might have closed the source store before all
messages were propagated from it.
2013-12-11 16:29:33 +01:00
Oswald Buddenhagen
c47ee1c8c4 fix error paths wrt sync drivers, take 3
msgs_copied() was not checked at all, and msgs_flags_set() was doing it
wrong (sync_close() was not checked).

instead of trying to fix/extend the msgs_flags_set() model (ref-counting
and cancelation checking in lower-level functions, and return values to
propagate the status), place the refs/derefs around higher-level scopes
and do the checking only there. this is effectively simpler, and does
away with some obscure macros.
2013-12-11 16:29:33 +01:00
Oswald Buddenhagen
2f0fbcd306 don't use UID EXPUNGE unless trashing
a simple CLOSE is way more efficient, so use it if no adverse effects
can come from it.
2013-12-11 16:29:33 +01:00
Oswald Buddenhagen
03b3b566f1 reshuffle sources a bit
split header and move some code to more logical places.
2013-12-08 23:19:12 +01:00
Oswald Buddenhagen
92b892d247 tag verbose output when channel links two verbose stores
otherwise it's pure guesswork to assign the output to particular stores.
2013-12-08 23:14:34 +01:00
Oswald Buddenhagen
27fa63a577 move verbose socket logging out of socket driver
the way it's used, it's more of a high-level function.
2013-12-08 23:14:34 +01:00
Oswald Buddenhagen
0b32734693 remove own_store() function from driver model
the drivers which support it can abstract it inside open_store() just
fine.
2013-12-08 23:14:34 +01:00
Oswald Buddenhagen
2cb483fb2e make use of IMAP MOVE extension
the Maildir driver is always exposing behavior equivalent to this - it's
more efficient.
2013-12-08 23:14:34 +01:00
Oswald Buddenhagen
0ad8ef80b2 don't check for INBOX more than necessary 2013-12-08 11:12:18 +01:00
Oswald Buddenhagen
c293acaf24 fix listing of nested maildir mailboxes 2013-12-08 11:12:18 +01:00
Oswald Buddenhagen
cf0f32f800 allow prefixes to Patterns
this makes it possible to "rename" a "namespace" while syncing.
2013-12-08 11:12:18 +01:00
Oswald Buddenhagen
6c6ad9710c less spaghetti 2013-12-08 11:12:18 +01:00
Oswald Buddenhagen
decc33c2cf factor out sync_listed_boxes() 2013-12-08 11:12:18 +01:00
Oswald Buddenhagen
f485d69332 refuse box list overrides if Channel has no Patterns
as the named boxes are the same on both sides, they logically make
sense only when the channel is in that mode anyway, which is the case
when using patterns.
2013-12-08 11:12:17 +01:00
Oswald Buddenhagen
c6f08b8f17 treat manually specified box list the same as one coming from Patterns 2013-12-08 11:12:17 +01:00
Oswald Buddenhagen
540adbb8fd make host resolution error messages more useful in non-ipv6 builds 2013-12-08 11:12:10 +01:00
Oswald Buddenhagen
b6949c64d2 avoid useless delay after creating maildir box
we would see the recent timestamp of the creation and conclude that
something is going on, so we'd wait. this is obviously nonsense.
as we know that a freshly created mailbox is empty, simply skip the
message scan alltogether.
2013-12-08 11:12:10 +01:00
Oswald Buddenhagen
71524cb6b0 reduce FSync option to a boolean
there is no use for Thorough mode any more, so simplify the
configuration.
2013-12-08 11:12:09 +01:00
Oswald Buddenhagen
29a56e2dc4 don't fsync after logging every TUID
as we now don't actually start propagating new messages until all TUIDs
have been generated, it's sufficient to sync just once. this makes it
a cheap operation, so we can do it at SYNC_NORMAL level already.
2013-12-08 11:12:09 +01:00
Oswald Buddenhagen
8d5bd62537 add ExpireUnread option 2013-12-08 11:12:09 +01:00
Oswald Buddenhagen
f586c0bee5 make it possible to specify CopyArrivalDate and MaxMessages globally
sneaky change on the side: the wording of the man page is changed from
"outside any section" to "before any section" to get global options.
this is not entirely true ... the previously existing options behave as
before, while the two newcomers actually affect subsequent channels.
2013-12-08 11:12:09 +01:00
Oswald Buddenhagen
c0ba0c7ecf replace global_* with a channel_conf_t instance
this makes the (growing) list of getopt_helper()'s parameters
manageable. the few wasted bytes are worth it.
2013-12-08 11:12:09 +01:00
Oswald Buddenhagen
1e427f5cd5 do not unnecessarily use bitfields
they don't save much (if any) space in our usage, while they make the
machine code more bloated and slow.
2013-12-08 11:12:09 +01:00
Oswald Buddenhagen
49a32910a7 move handling of new messages after that of old ones
i.e., move it back. whatever the original reason was, it's now gone.

this order is way more natural, which allows us to remove the osrecadd
and S_DONE hacks.
2013-12-01 13:36:28 +01:00