aboutsummaryrefslogtreecommitdiffstats
path: root/pop3.c
diff options
context:
space:
mode:
Diffstat (limited to 'pop3.c')
-rw-r--r--pop3.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/pop3.c b/pop3.c
index 600d9917..76b66846 100644
--- a/pop3.c
+++ b/pop3.c
@@ -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))