Oswald Buddenhagen
886cd03e37
centralize imap_cmd disposal
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
f8d73ac346
make socket_write() capable of taking ownership of the buffer
...
that way the user code doesn't have to free it any more.
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
8a72d204c9
change socket_write() return code semantics
...
instead of returning a write()-like result, return only a binary status
code - write errors are handled internally anyway, so user code doesn't
have to check the write length.
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
a85013d6ff
make IMAP pipeline depth configurable
...
currently, this affects only "clustered" message listings and
flag stores.
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
a266f28f1c
cancel submitted commands when canceling store
...
we already have some minimal asynchronicity, so there might be commands
in flight when a fatal error comes in.
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
171f7d6cd3
Socket_t + buffer_t => conn_t
...
remove the layering, in favor of a "buffered connection" abstraction.
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
ef41349035
move socket code to a separate file
...
this makes the layering more obvious
2012-09-01 16:03:35 +02:00
Oswald Buddenhagen
d1ee94f02c
move greeting response handling into get_cmd_result()
...
the primary purpose of this is getting rid of the "free-standing"
buffer_gets() call.
2012-09-01 16:03:35 +02:00
Oswald Buddenhagen
584e51ed7d
docs
...
- insert "separator comments" between driver entry points
- document driver API
- document sync_vars_t parts that are stored in the sync state header
2012-09-01 16:03:35 +02:00
Oswald Buddenhagen
2ab689b3df
make imap_exec() result reporting callback-based
...
this makes the IMAP command submission interface asynchronous.
the functions still have synchronous return codes as well - this enables
clean error return paths. only when we invoke callbacks we resort to
refcounting.
as a "side effect", properly sequence commands after CREATE resulting
from [TRYCREATE].
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
7addc3bea8
minor cleanup: use ctx->gen instead of gctx for consistency
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
06ccac1fdd
always use return value from get_cmd_result()
...
once we have callback-based error reporting, this will ensure that we
don't operate on invalidated data structures.
2012-07-22 17:27:42 +02:00
Oswald Buddenhagen
121ce76e46
make response code parse failure of untagged OK/NO/BYE/BAD non-fatal
...
as such, it does not disrupt the data stream
2012-07-22 17:27:42 +02:00
Oswald Buddenhagen
4d4de6e275
remove redundant use_ssl variables
...
just use the presence of an SSL object as an indicator. if something
goes wrong during the ssl handshake or certificate validation, the
socket must be immediately closed anyway.
2012-07-07 18:00:47 +02:00
Oswald Buddenhagen
17dc64b414
after [TRYCREATE], just resend the same command instead of cloning it
2012-07-07 18:00:47 +02:00
Oswald Buddenhagen
83efbe327d
use return values from correct set in get_cmd_result()
...
DRV_OK == RESP_OK, so this worked by accident
2012-07-07 18:00:47 +02:00
Oswald Buddenhagen
99cc328f17
do away with the dreaded rcaps hack
...
don't pretend that the server has no literal+ for the time of the
first relevant command's synchronous execution. instead, enable the
lower layer to do the processing by telling it for which commands
trashnc ("trash's existence not confirmed") is relevant.
2012-07-07 18:00:47 +02:00
Oswald Buddenhagen
1545ed90a0
purge imap_store_t::currentnc vestiges
...
we always actually open the mailbox before appending to it, so we
obviously know that it exists - that's why the code was already
commented out. changing this assumption would significantly complicate
matters for little gain, so let's just assume it won't happen.
consequently, also don't set param.create when appending to regular
mailboxes.
2012-07-07 18:00:47 +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
61d98c5a1d
fix a bunch of warnings
2012-07-07 18:00:47 +02:00
Oswald Buddenhagen
4afd31a457
avoid preprocessor warnings on missing features: #if => #ifdef
2011-03-27 12:06:41 +02:00
Oswald Buddenhagen
cf6a7b4d18
less bizarre code
...
we know that there is only one command in progress, so there
is no need to employ tricks to access the last command.
2011-03-27 11:54:48 +02:00
Oswald Buddenhagen
7e1c16ae02
make cram() sane
...
- don't silently fail in release mode (expression with side effects
inside assert())
- save some redundand strlen()s by not throwing away known lengths
- reorganize the code for legibility
2011-03-27 11:54:48 +02:00
Oswald Buddenhagen
2c729bf9e6
don't leak SSL objects
2011-03-27 11:54:45 +02:00
Oswald Buddenhagen
d637772339
turns out, free(NULL) is just fine ...
2010-11-14 16:44:50 +01:00
Oswald Buddenhagen
e1fa867423
fix UIDNEXT handling
...
UIDNEXT *can* be legally zero, so deal with it.
-REFMAIL: 4CA62BA1.4020104@lemma.co.uk
2010-10-03 14:33:24 +02:00
Oswald Buddenhagen
5ade279839
don't hang after failed start_tls()
...
we'd send a LOGOUT command in plain text while the server was already
expecting an encrypted command, which would typically lead to waiting
for more data and thus an indefinite hang.
so close the socket immediately instead of letting the normal shutdown
path take care of it.
inspired by a patch by Steven Flintham.
-REFMAIL: 4C9AB98E.3000400@lemma.co.uk
2010-10-03 12:37:59 +02:00
Oswald Buddenhagen
70e87eb99e
remove useless message
...
don't complain about missing greeting response - we already complained
about an unexpected EOF anyway.
2010-10-03 12:37:59 +02:00
Oswald Buddenhagen
90a38ea810
assert valid file handles
...
i've seen error logs of the type
SSL_write: Bad file descriptor
and i simply can't nail it, so go for some more drastic measures.
2010-10-03 12:37:59 +02:00
Oswald Buddenhagen
72fd2aafb7
formatting
2010-10-03 12:37:59 +02:00
Oswald Buddenhagen
122e09fe60
beautify error messages
...
don't print the error number - we print the error string anyway, so it
adds no value.
add some whitespace to the messages as well.
2010-10-03 12:37:10 +02:00
Oswald Buddenhagen
db2bbbfef8
fix uninitialized variable read
...
this is basically a security fix for nonsensical configurations:
if the specified CertificateFile did not contain any certificates,
we *might* have accepted an arbitrary server certificate.
2010-04-05 13:06:58 +02:00
Oswald Buddenhagen
da39690aec
fix compile with SSL on Mac OS X
...
patch by Remko Tronçon <remko@el-tramo.be>
BUG: 2126899
2010-02-07 22:31:11 +01:00
Oswald Buddenhagen
e6a356ffc7
add extra verbose mode which dumps the message contents
...
i needed that to debug the line ending issues. maybe it will find other
uses as well ...
2010-02-06 10:49:57 +01:00
Oswald Buddenhagen
ce45692ca5
refactoring. main part is killing struct imap_cmd_cb as such.
...
issue_imap_cmd is split into new_imap_cmd and submit_imap_cmd, so the
command can be parametrized after it was instanciated.
2008-08-31 20:14:59 +00:00
Oswald Buddenhagen
92914b37cc
deal with UIDVALIDITY of 0 properly.
...
-REF: 20080822094543.GA3528@ugly.local
2008-08-23 07:54:00 +00:00
Oswald Buddenhagen
0d8bce1675
give the implicitly created imap account config the name of the store.
2008-04-13 09:56:44 +00:00
Oswald Buddenhagen
262999d092
make ssl certificate handling much more useful:
...
- system-wide ca certs are auto-loaded
- private certs are accepted even if they are self-signed
2008-04-13 09:51:27 +00:00
Oswald Buddenhagen
06521da30d
- accept unset CertificateFile
...
- print the certificate's fingerprint
- make the certificate acceptance prompt much less scary
2008-04-12 08:58:50 +00:00
Oswald Buddenhagen
89519e343c
ignore system flag extensions (\X-...)
2008-04-12 08:13:44 +00:00
Oswald Buddenhagen
2b37288e8d
don't use #ifdef inside htons() arguments - it can be a macro.
...
-REF: <lyy7ezyjah.fsf@gfn.org>
CCMAIL: Scott Gifford <sgifford@suspectclass.com>
2007-09-22 08:45:41 +00:00
Oswald Buddenhagen
625f592fb7
fix crash due to uninited var when parsing IMAPServer. Thanks to
...
CCMAIL: Antoine Reilles <tonio@NetBSD.org>
REF: <20070118182534.GA22288@arcelot.loria.fr>
2007-02-10 15:37:46 +00:00
Oswald Buddenhagen
023d3ee577
fix error paths wrt sync drivers
2006-12-09 10:39:30 +00:00
Oswald Buddenhagen
617d1a6e49
memmove for overlapping mem copies.
2006-08-10 06:33:18 +00:00
Oswald Buddenhagen
4bf58c3e97
don't crash in imap driver when Host is not specified.
2006-05-28 16:03:52 +00:00
Oswald Buddenhagen
dbbab78881
un-document "Host imaps:[...]" syntax and introduce new option UseIMAPS
...
instead.
apply ted's patch to support UseIMAPS in conjunction with Tunnel.
document that SSLv2 is No Good (TM).
2006-05-28 15:43:58 +00:00
Oswald Buddenhagen
67b714ee0e
move assigning default port to the place of use
2006-05-28 13:38:14 +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
b7389cb36f
do not repeatedly get namespace from server.
2006-03-20 20:39:06 +00:00
Oswald Buddenhagen
340bfcc4a8
handle socket() failure and correctly report gethostbyname() failure.
2006-03-20 20:34:32 +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
492ca8d332
whitespace and code verbosity
2006-03-20 17:21:07 +00:00
Oswald Buddenhagen
31fc41a32c
merge imap_t into imap_store_t - there is really no point in having them
...
separated.
2006-03-20 15:01:48 +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
bb7bbcf5b1
make config parsing more robust against bogus input and report errors
...
more clearly.
2006-03-19 10:44:53 +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
a1a5a817bb
merge Quiet, Verbose & Debug into DFlags
2006-01-29 14:46:16 +00:00
Oswald Buddenhagen
a1c402678c
split driver->prepare into ->prepare_opts and ->prepare_paths
2006-01-29 11:22:45 +00:00
Oswald Buddenhagen
4e983506d3
#include limits.h (for INT_MAX)
...
REF: <a8e45e1b0601241753j1e14cc1cm3fc3c65c7acb0c1b@mail.gmail.com>
2006-01-25 06:35:19 +00:00
Oswald Buddenhagen
d414d0aae2
solaris 10 fix: use sys/filio.h for FIONREAD. untested.
...
REF: <20060111215014.GA601@49.180.97-84.rev.gaoland.net>
2006-01-12 06:36:44 +00:00
Oswald Buddenhagen
25db6a3c31
revert 1.8 - what was i smoking?! the CREATE argument is already quoted;
...
we just extracted it from the previous command.
2005-12-17 13:47:51 +00:00
Oswald Buddenhagen
d2753c4188
64-bit cleanness
2005-09-21 16:14:05 +00:00
Oswald Buddenhagen
bf4266eadc
quote CREATE argument
2005-03-28 10:43:31 +00:00
Oswald Buddenhagen
e8c769ea76
ignore user-defined flags (for now).
...
also, split off the backslash from the "core" flag names.
2004-10-17 15:34:53 +00:00
Oswald Buddenhagen
e75ebf75f6
fix segfault due to wrong pointer being passed to parse_response_code.
...
inspired by Raimar Döffinger
2004-10-17 09:00:15 +00:00
Oswald Buddenhagen
6741bc94d9
remove spurious crlf during cram auth. not sure that this instance of
...
socket_write should be (re)moved, but as long as the .cont callback is
used only for this ...
investigation & patch by Mike Delaney.
2004-10-17 08:30:02 +00:00
Oswald Buddenhagen
e0cc45044f
stdarg.h at the right places
2004-09-20 11:28:33 +00:00
Oswald Buddenhagen
af0b75a5dc
stddef.h for offsetof
2004-09-08 16:14:12 +00:00
Oswald Buddenhagen
1b75236135
fix -C for imap mailboxes:
...
- SELECT does not return [TRYCREATE]
- fix bit field truncation
2004-08-13 11:03:12 +00:00
Oswald Buddenhagen
130664b622
The Big Rewrite. too many change to list them all.
...
as opposed to earlier threats, BerkDB was not entirely dropped; i
suppose the isync 0.7 -> 0.8 change had a reason, so i added an
alternative UID storage scheme.
note that BDB 4.0 is not sufficient, as the db->open function changed in
an incompatible way ...
i updated the debian packaging except for a changelog entry.
note that i removed the upgrade blurb, as upstream now has a smooth
upgrade path down to at least isync 0.4.
2004-03-27 16:07:20 +00:00