diff -Naur fetchmail-5.9.14.orig/driver.c fetchmail-5.9.14/driver.c --- fetchmail-5.9.14.orig/driver.c Sat Jun 29 01:00:29 2002 +++ fetchmail-5.9.14/driver.c Fri Sep 6 18:48:43 2002 @@ -442,9 +442,7 @@ report_build(stdout, GT_(" (length -1)")); break; case MSGLEN_TOOLARGE: - report_build(stdout, - GT_(" (oversized, %d octets)"), - msgsizes[num-1]); + report_build(stdout, GT_(" (oversized)")); break; } } @@ -457,8 +455,8 @@ err = (ctl->server.base_protocol->fetch_headers)(mailserver_socket,ctl,num, &len); if (err == PS_TRANSIENT) /* server is probably Exchange */ { - report_build(stdout, - GT_("couldn't fetch headers, message %s(_at_)%s:%d (%d octets)"), + report(stdout, + GT_("couldn't fetch headers, message %s(_at_)%s:%d (%d octets)\n"), ctl->remotename, ctl->server.truename, num, msgsizes[num-1]); continue; @@ -1344,8 +1342,10 @@ /* OK, we're going to gather size info next */ xalloca(msgsizes, int *, sizeof(int) * count); xalloca(msgcodes, int *, sizeof(int) * count); - for (i = 0; i < count; i++) + for (i = 0; i < count; i++) { + msgsizes[i] = 0; msgcodes[i] = MSGLEN_UNKNOWN; + } /* * We need the size of each message before it's diff -Naur fetchmail-5.9.14.orig/imap.c fetchmail-5.9.14/imap.c --- fetchmail-5.9.14.orig/imap.c Tue Jun 4 19:25:05 2002 +++ fetchmail-5.9.14/imap.c Fri Sep 6 18:48:43 2002 @@ -691,6 +691,9 @@ if ((ok = gen_recv(sock, buf, sizeof(buf)))) return(ok); + /* an untagged NO means that a message was not readable */ + else if (strstr(buf, "* NO")) + ; else if (strstr(buf, "OK") || strstr(buf, "NO")) break; else if (sscanf(buf, "* %u FETCH (RFC822.SIZE %u)", &num, &size) == 2) { @@ -763,9 +766,19 @@ break; /* try to recover from chronically fucked-up M$ Exchange servers */ else if (!strncmp(ptr, "NO", 2)) + { + /* wait for a tagged response */ + if (strstr (buf, "* NO")) + imap_ok (sock, 0); return(PS_TRANSIENT); + } else if (!strncmp(ptr, "BAD", 3)) + { + /* wait for a tagged response */ + if (strstr (buf, "* BAD")) + imap_ok (sock, 0); return(PS_TRANSIENT); + } } if (num != number)