diff options
Diffstat (limited to 'pop3.c')
-rw-r--r-- | pop3.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -244,9 +244,23 @@ static int pop3_fetch(int sock, struct query *ctl, int number, int *lenp) gen_send(sock, "RETR %d", number); if ((ok = pop3_ok(sock, buf)) != 0) return(ok); - /* look for "nnn octets" -- there may or may not be preceding cruft */ + + /* + * Look for "nnn octets" -- there may or may not be preceding cruft. + * + * Note, it is not guaranteed this will be set; the never-to-be- + * sufficiently-damned RFC1725 doesn't require it. At least one + * actual POP3 daemon (MercuryP/NLM v1.31) actually fails to issue + * a length. + * + * To kluge around this, wedge a huge value into the message + * length if we don't get one back. The only bad effect this will + * have is to make the progress messages look funny. We'll + * document this as a bug instead of forcing every poll to do a + * LIST for sizes. + */ if ((cp = strstr(buf, " octets")) == (char *)NULL) - *lenp = 0; + *lenp = 0xffffffff; else { while (--cp >= buf && isdigit(*cp)) |