aboutsummaryrefslogtreecommitdiffstats
path: root/pop3.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2004-01-13 03:21:41 +0000
committerEric S. Raymond <esr@thyrsus.com>2004-01-13 03:21:41 +0000
commit6798c96d68aa98bfd7187805aaa7b3a72eb76415 (patch)
treed780c4465deb565688d0644a7aa4cb3ebbcd1a01 /pop3.c
parent96c464a8399b5ba2df510e7f0726b216eeefe722 (diff)
downloadfetchmail-6798c96d68aa98bfd7187805aaa7b3a72eb76415.tar.gz
fetchmail-6798c96d68aa98bfd7187805aaa7b3a72eb76415.tar.bz2
fetchmail-6798c96d68aa98bfd7187805aaa7b3a72eb76415.zip
Fix patch for Sunil Shetye's POP3 tweaks.
svn path=/trunk/; revision=3871
Diffstat (limited to 'pop3.c')
-rw-r--r--pop3.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/pop3.c b/pop3.c
index 2deb9699..8e356f18 100644
--- a/pop3.c
+++ b/pop3.c
@@ -911,25 +911,24 @@ static int pop3_getrange(int sock,
static int pop3_getpartialsizes(int sock, int first, int last, int *sizes)
/* capture the size of message #first */
{
- int ok;
+ int ok, i;
char buf [POPBUFSIZE+1];
unsigned int num, size;
- /* for POP3, we can get the size of one mail only! */
- if (first != last)
- {
- report(stderr, "cannot get a range of message sizes (%d-%d).\n", first, last);
- return(PS_PROTOCOL);
- }
- gen_send(sock, "LIST %d", first);
- if ((ok = pop3_ok(sock, buf)) != 0)
- return(ok);
- if (sscanf(buf, "%u %u", &num, &size) == 2) {
- if (num == first)
- sizes[0] = size;
- else
- /* warn about possible attempt to induce buffer overrun */
- report(stderr, "Warning: ignoring bogus data for message sizes returned by server.\n");
+ for (i = first; i <= last; i++) {
+ gen_send(sock, "LIST %d", i);
+ if ((ok = pop3_ok(sock, buf)) != 0)
+ return(ok);
+ if (sscanf(buf, "%u %u", &num, &size) == 2) {
+ if (num == i)
+ sizes[i - first] = size;
+ else
+ /* warn about possible attempt to induce buffer overrun
+ *
+ * we expect server reply message number and requested
+ * message number to match */
+ report(stderr, "Warning: ignoring bogus data for message sizes returned by server.\n");
+ }
}
return(ok);
}