Oswald Buddenhagen
16e5aade3f
store config error status in conffile_t object
...
this makes passing it around more straight-forward
2012-09-15 11:46:42 +02:00
Oswald Buddenhagen
2e07e68630
call fdatasync() after updating .uidvalidity files
...
they must be flushed before the file system meta data, as otherwise we
may end up with duplicate UIDs after a system crash.
2012-09-09 12:18:14 +02:00
Oswald Buddenhagen
f11504aa07
update copyrights
...
make the wrapper's help string also mention copyrights pertaining only
to the actual syncer, as this is the only string many people will ever
see.
2012-09-01 21:15:53 +02:00
Oswald Buddenhagen
d4c786823d
replace FSF address with something more ... contemporary
2012-09-01 21:15:53 +02:00
Oswald Buddenhagen
2585dd3324
add support for hierarchical mailboxes
2012-09-01 21:15:18 +02:00
Oswald Buddenhagen
4f94197e41
calculate trash box path already in maildir_open_store()
...
this gives us some cleaner code paths later on, as we can treat the
trash box like a regular mailbox.
2012-09-01 21:15:08 +02:00
Oswald Buddenhagen
8121224744
ensure that mailbox creation in maildir_store() is limited to trashing
...
other mailboxes would have been maildir_select()ed already.
2012-09-01 21:15:08 +02:00
Oswald Buddenhagen
1bc9c6d9cf
reject qualified mailboxes with the magic name INBOX
...
otherwise we couldn't tell them apart from the real INBOX after
stripping away the Path.
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
40f2812a41
suppress bdb complaints about unknown file format
...
pass DB_TRUNCATE when creating databases. otherwise bdb will complain
about the empty file we pass it (we have to create it upfront to
implement our locking).
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
233f563569
deal with concurrent maildir modifications during listing
...
files may be renamed (due to new -> cur transition or flag changes),
which may lead to two effects if ignored:
- we see both the old and the new name, so we report a spurious
duplicate UID
- we see neither name, so we report a spurious deletion
as countermeasure, record and compare directory modification times. upon
mismatch, we just start over - as usual.
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
3386285205
make maildir uidvalidity change fatal
...
it's best to give the user a chance to fix it rather than completely
messing up the syncstate by re-enumerating the UIDs.
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
a3bd10c04d
cleanup maildir error paths
...
don't try to unlock and close databases and files - this will happen a
moment later anyway, through cancelation or re-selection.
ironically, this plugs a memory leak, because an open main database is
used as a signal to close a temporary db in maildir_scan().
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
04ca97920d
fix potential double free
...
the store may be discarded before we reach maildir_select() again, which
will leave us with a dangling pointer.
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
e71ad53b7f
plug memory leak in maildir_store_msg() upon failure to acquire UID
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
9c86ec3442
employ alternative scheme to finding messages by TUID
...
instead of SEARCHing every single message (which is slow and happens to
be unreliabe with M$ Exchange 2010), just FETCH the new messages from
the mailbox - the ones we just appended will be amongst them.
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
d2bed4990d
unify error reporting
...
- introduce sys_error() and use it instead of perror() and
error(strerror()) in all expected error conditions
- perror() is used only for "something's really wrong with the system"
kind of errors
- file names, etc. are quoted if they are not validated yet, so e.g. an
empty string becomes immediately obvious
- improve and unify language
- add missing newlines
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
dee9f51096
don't complain about disappearing temp files
...
some other process might be cleaning up concurrently ...
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
3169c59e10
validate maildirs more strictly
...
now that "SyncState *" won't create fake mailboxes any more, we can make
a full validity check again.
2012-09-01 16:03:35 +02:00
Oswald Buddenhagen
05fd0b9970
split out drv->load() from drv->select()
2012-09-01 16:02:50 +02:00
Oswald Buddenhagen
c741d5ffb5
make creation of trash folder independent from -C option
...
the trash is not a box which is synced, but a "byproduct" of
manipulating synced boxes, so it makes no sense to bind it to the same
option.
2012-07-30 01:21:32 +02:00
Oswald Buddenhagen
ea951a697f
fix error paths wrt sync drivers, take 2
...
synchronous error codes which are passed through callbacks aren't a
particularly good idea, after all: latest when the callback does stuff
which does not concern the caller, the return code becomes ambiguous.
instead, protect the sync_vars object with a refcount when invoking
driver functions from loops, as the callbacks they call could invalidate
the object and we would have no way of knowing that the loop should be
aborted prematurely. the upcoming async imap driver will also need a
refcount to protect the cancelation marker of the imap socket dispatcher
loop.
2012-07-30 01:21:32 +02:00
Oswald Buddenhagen
b0bbd23512
replace DRV_STORE_BAD with a separate bad_callback()
...
that way we don't have to piggy-back (possibly asynchronous) fatal
errors to particular commands.
internally, the drivers still use synchronous return values as well,
so they don't try to access the invalidated store after calling back.
2012-07-30 01:21:31 +02:00
Oswald Buddenhagen
9554026443
make drv->cancel()'s callback have no status code
...
this function is not going to actually execute any commands, so it
makes no sense for the callback to have a status code.
2012-07-29 12:25:24 +02:00
Oswald Buddenhagen
c66afdc0a8
move setting of ctx->listed outside the drivers
...
it's essentially an external state flag
2012-07-07 18:00:47 +02:00
Oswald Buddenhagen
f6a25b331f
check return value from close() after write()
...
otherwise we may lose data when quota is exceeded
or nfs is in a bad mood.
2012-07-07 18:00:47 +02:00
Oswald Buddenhagen
61d98c5a1d
fix a bunch of warnings
2012-07-07 18:00:47 +02:00
Oswald Buddenhagen
d637772339
turns out, free(NULL) is just fine ...
2010-11-14 16:44:50 +01:00
Oswald Buddenhagen
d94dadbaeb
fix line ending conversion logic
...
imap may very well store messages with LF line endings. only RFC2822
requires CRLF.
consequently, preserve the line endings as much as possible unless the
mailbox format does not support it (this would be the case for unix mbox
- i actually have no idea about maildir).
2010-02-06 10:49:57 +01:00
Oswald Buddenhagen
a365e20660
put pointers to bdb open() into parentheses, so they won't be
...
macro-expanded as libc open.
patch by fedora
-REF: <1197916586.13945.120.camel@localhost.localdomain>
2008-02-23 09:01:51 +00:00
Oswald Buddenhagen
023d3ee577
fix error paths wrt sync drivers
2006-12-09 10:39:30 +00:00
Oswald Buddenhagen
e0d72cd5e3
reverse-map <Inbox> to INBOX when encountered during listing.
...
usually this will be a no-op (when putting INBOX in Path, people
generally call it INBOX), but better safe than sorry.
2006-11-18 13:17:13 +00:00
Oswald Buddenhagen
2a9b0bd763
don't crash on truncating database. seems to affect only some bdb
...
versions (e.g., 4.2).
2006-10-24 17:37:57 +00:00
Oswald Buddenhagen
1b9f8b4c69
glibc seems to be *really* fucked up.
2006-07-31 05:30:46 +00:00
Oswald Buddenhagen
d2463a4cd8
work around glibc bug: printf("%.*s", INT_MAX, s) tries to allocate 2G.
2006-07-29 11:52:54 +00:00
Oswald Buddenhagen
f6f2d2461c
add comment
2006-05-27 12:44:13 +00:00
Oswald Buddenhagen
168e5f3282
make the driver model, sync_chans() and sync_boxes() fully async.
...
async drivers to follow ...
2006-03-21 20:03:21 +00:00
Oswald Buddenhagen
3e3cf3ac9a
update copyrights
2006-03-20 20:16:22 +00:00
Oswald Buddenhagen
7f9ece8e7e
move whole responsibility for recycling open stores/server connections
...
to the drivers.
2006-03-20 19:38:20 +00:00
Oswald Buddenhagen
47e592b603
keep the result of driver->list() and a flag whether it is valid in the store.
2006-03-20 19:27:38 +00:00
Oswald Buddenhagen
d7126dca5e
"fprintf( stderr," => "error(". new functions debugn() and infon()
...
for messages with missing newline; warn() and error() act upon this.
2006-03-19 11:29:12 +00:00
Oswald Buddenhagen
7726ce3e0f
don't barf at directories with none of {tmp,new,cur}/ and turn them
...
into maildirs instead. see next commit.
2006-02-11 20:14:31 +00:00
Oswald Buddenhagen
1453e61840
update fsf's postal address. i think it's sort of useless nowadays
...
anyway, but heck ...
2006-02-09 17:44:22 +00:00
Oswald Buddenhagen
850addecd5
wrap message storing into transactions. nice side effect: drivers don't
...
need to deal with line end conversion any move.
2006-02-03 21:33:43 +00:00
Oswald Buddenhagen
a1c402678c
split driver->prepare into ->prepare_opts and ->prepare_paths
2006-01-29 11:22:45 +00:00
Oswald Buddenhagen
8db5ec1e5e
less confusing error message on invalid mailbox.
2005-12-21 13:04:43 +00:00
Oswald Buddenhagen
7710b3dcb5
make flag changes unset "new" status - unless a ghost is acting in the
...
background, a flag change indicates that the message was at least
noticed.
2005-09-29 21:07:20 +00:00
Oswald Buddenhagen
02babb0651
fix inverted condition leading to endless loop when message is changed
...
while isync is running.
2005-03-28 10:26:39 +00:00
Oswald Buddenhagen
3f8e820acb
use legacy flock() only on linux. at least on OS X flock aliases to
...
fcntl.
2004-09-20 11:31:55 +00:00
Oswald Buddenhagen
16de402c9e
when storing \seen messages, don't set the \recent flag on them. could
...
well be that this is incorrect, but some mailers need it that way.
when trashing messages, preserve their \recent status as well.
2004-09-15 09:06:36 +00:00
Oswald Buddenhagen
86d9a3140d
first check _both_ bounds, then compare ...
2004-09-08 14:52:22 +00:00