Browse Source

*** workaround exchange being unhapply about messages with binary content

*** this is is an *untested* rebase; originally submitted against 1.3

Those where bogus messages with the raw attachment in binary but with
base 64 headers correctly set.
Near 100% (if not 100%) of those where in the sent folder and are
probably the result of gmail + buggy email client (but you can still
open the attachment with gmail !)

this is a possible fix for https://sourceforge.net/p/isync/bugs/22/ and
a lot of related reports.

patch by Florian Lombard <f.lombard@montmirail.com>:

============

the treatment should be the same as for messages with excesively long
lines - MIME-encoding (presumably as quoted-printable).
wip/exchange-workarounds-1.5
Oswald Buddenhagen 8 years ago
parent
commit
52870a0a5c
  1. 2
      src/config.c
  2. 9
      src/drv_imap.c
  3. 1
      src/sync.h
  4. 12
      src/sync_msg_cvt.c

2
src/config.c

@ -263,6 +263,8 @@ getopt_helper( conffile_t *cfile, int *cops, channel_conf_t *conf )
conf->max_line_len = parse_int( cfile );
} else if (!strcasecmp( "CutLongLines", cfile->cmd )) {
conf->cut_lines = parse_bool( cfile );
} else if (!strcasecmp( "SkipBinaryContent", cfile->cmd )) {
conf->skip_binary_content = parse_bool( cfile );
} else if (!strcasecmp( "MaxMessages", cfile->cmd )) {
conf->max_messages = parse_int( cfile );
} else if (!strcasecmp( "ExpireSide", cfile->cmd )) {

9
src/drv_imap.c

@ -1926,7 +1926,14 @@ imap_socket_read( void *aux )
resp = RESP_NO;
// Fall through - we still complain
} else {
resp = RESP_CANCEL;
//resp = RESP_CANCEL;
// Ignore BAD Error 10 (or 11) when SkipBinaryContent is not used.
// this doesn't seem like a terribly good idea to me - this server response
// indicates that the client (allegedly) did something wrong. that may mean
// that the subsequent command stream will be interpreted as garbage, which
// may have unpredictable effects. it just isn't safe to continue at this
// point.
resp = RESP_NO;
}
}
error( "IMAP command '%s' returned an error: %s\n",

1
src/sync.h

@ -62,6 +62,7 @@ typedef struct channel_conf {
char use_internal_date;
uint max_line_len;
char cut_lines;
char skip_binary_content; /* for master only */
} channel_conf_t;
typedef struct group_conf {

12
src/sync_msg_cvt.c

@ -106,6 +106,18 @@ copy_msg_convert( int in_cr, int out_cr, copy_vars_t *vars )
leftLen -= curLineLen;
}
}
if (global_conf.skip_binary_content) {
while (idx < in_len) {
uchar c = in_buf[idx++];
if (c < 0x20 && c != '\r' && c != '\n' && c != '\t') {
/* binary content, skip */
debug( "Incorrect byte %u at offset %u/%u\n", c, idx, in_len );
free( in_buf );
return "contains raw binary";
}
}
idx = 0;
}
for (;;) {
uint start = idx;
uint line_cr = 0;

Loading…
Cancel
Save