diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | imap.c | 29 |
2 files changed, 27 insertions, 5 deletions
@@ -52,6 +52,9 @@ fetchmail 6.3.1 (not yet released): same SMTP/LMTP connection. Reported by Joachim Feise, Berlios Bug #5849. (MA) * Manual page: Add "-md5" to "openssl x509" example in --sslfingerprint documentation. Suggested by Jason White. (MA) +* Cope with servers that return UID information in response to non-UID + RFC822.{SIZE|HEADER} requests. Reported by Jason White. + Patch suggestion by by Sunil Shetye, simplified by MA. fetchmail 6.3.0 (released 2005-11-30): @@ -875,12 +875,21 @@ static int imap_getpartialsizes(int sock, int first, int last, int *sizes) ; else if (strstr(buf, "OK") || strstr(buf, "NO")) break; - else if (sscanf(buf, "* %u FETCH (RFC822.SIZE %u)", &num, &size) == 2) + else if (sscanf(buf, "* %u FETCH (RFC822.SIZE %u)", &num, &size) == 2 + /* some servers (like mail.internode.on.net bld-mail04) return UID information here + * + * IMAP> A0005 FETCH 1 RFC822.SIZE + * IMAP< * 1 FETCH (UID 16 RFC822.SIZE 1447) + * IMAP< A0005 OK FETCH completed + * + */ + || sscanf(buf, "* %u FETCH (UID %*s RFC822.SIZE %u)", &num, &size) == 2) { if (num >= first && num <= last) - sizes[num - first] = size; + sizes[num - first] = size; else - report(stderr, "Warning: ignoring bogus data for message sizes returned by the server.\n"); + report(stderr, + GT_("Warning: ignoring bogus data for message sizes returned by the server.\n")); } } @@ -948,8 +957,18 @@ static int imap_fetch_headers(int sock, struct query *ctl,int number,int *lenp) if ((ok = gen_recv(sock, buf, sizeof(buf)))) return(ok); ptr = skip_token(buf); /* either "* " or "AXXXX " */ - if (sscanf(ptr, "%d FETCH (%*s {%d}", &num, lenp) == 2) - break; + if (sscanf(ptr, "%d FETCH (RFC822.HEADER {%d}", &num, lenp) == 2 + /* some servers (like mail.internode.on.net bld-mail04) return UID information here + * + * IMAP> A0006 FETCH 1 RFC822.HEADER + * IMAP< * 1 FETCH (UID 16 RFC822.HEADER {1360} + * ... + * IMAP< ) + * IMAP< A0006 OK FETCH completed + * + */ + || sscanf(ptr, "%d FETCH (UID %*s RFC822.HEADER {%d}", &num, lenp) == 2) + break; /* try to recover from chronically fucked-up M$ Exchange servers */ else if (!strncmp(ptr, "NO", 2)) { |