Commit Graph

586 Commits

Author SHA1 Message Date
Oswald Buddenhagen
ec8f440383 don't call cancel() repeatedly on a store
erroring command replies will trickle in even after canceling
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
6d86e5347e don't access free'd memory in cancel_sync()
as it happens, the 1st round *may* trash svars - if we get the
cancelation request after the slave store has already died.
2012-07-29 12:26:38 +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
57444e9df9 don't decode aux pointer on DRV_CANCELED
the aux data was already free()d by the error callback by the time we
get this status code.
2012-07-22 20:19:20 +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
d2e13f147c de-duplicate code a bit 2012-07-22 17:27:40 +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
fd229040d8 DRV_SERVER_BAD is and will probably stay unused => trash 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
7bab2d6d94 de-duplicate error paths
makes the code more compact. yay for gotos.
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
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
058d01f179 don't compare find_old_done with find_new_total
this didn't have any effect as no async drivers currently exist.
2011-03-27 11:54:48 +02:00
Oswald Buddenhagen
9e10e871fd don't hang if store cannot be opened asynchronously 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
296ac0364c add CR after TUID during LF => CRLF conversion 2011-03-27 11:54:02 +02:00
Oswald Buddenhagen
8df1ebaf40 fix (another) out-of-bounds access in CRLF conversion
if the header contained no CRs but the body (or the post-TUID part of
the header) did, the TUID insertion would add an excess CR, thus
overflowing the buffer by one byte.
2011-03-27 11:54:02 +02:00
Oswald Buddenhagen
39006d7f24 document some breakage 2010-11-14 17:23:59 +01: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
516c3bfa99 remove mail addresses from man pages
apparently, some people don't see the "maintained by" bits, so make them
look harder for explicit contact information (to be found in AUTHORS).
2010-02-28 22:23:20 +01: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
a8b4de463e add -P option to isync wrapper
not really a backwards compat option, but whatever ...

based on a patch submitted long ago by "nobody".
BUG: 1433532
2010-02-07 22:31:11 +01:00
Oswald Buddenhagen
5bc3bf5fbd fix rpm spec file
-REFMAIL: 20090122213325.GA11572@crow.ths.tcoek12.org
2010-02-07 22:31:11 +01:00
Oswald Buddenhagen
7728278b9c (new?) automake already sets docdir correctly for us 2010-02-07 22:31:11 +01:00
Oswald Buddenhagen
4729b1ee23 cvsignore => gitignore 2010-02-07 22:31:10 +01:00
Oswald Buddenhagen
474ce08b3a adjust ChangeLog generation to git
now that log generation is cheap, don't store it in the SCM any more.
2010-02-07 22:31:07 +01:00
Oswald Buddenhagen
2a5ff54683 fix "make distcheck"
this makes the deb-clean target shadow build safe
2010-02-07 12:25:21 +01:00
Oswald Buddenhagen
022d137b8c more to do 2010-02-06 11:58:36 +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
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
09dfddb36b some more error reporting relating malformed messages 2010-02-06 10:49:06 +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