Commit 87626c27 authored by Matthias Andree's avatar Matthias Andree

Properly report size of mailboxes of 2 GibiB or above.

To fix Debian Bug#873668, reported by Andreas Schmidt.
This requires C99's new long long type.
parent 6b350878
...@@ -80,6 +80,13 @@ fetchmail-6.5.0 (not yet released): ...@@ -80,6 +80,13 @@ fetchmail-6.5.0 (not yet released):
The libesmtp/getaddrinfo.? library has been removed from the distribution. The libesmtp/getaddrinfo.? library has been removed from the distribution.
The KAME/getnameinfo.c file has been removed from the distribution. The KAME/getnameinfo.c file has been removed from the distribution.
## BUG FIXES
* fetchmail can now report mailbox sizes of 2^31 octets and beyond.
This requires C99 support (for the long long type).
Fixes Debian Bug#873668, reported by Andreas Schmidt.
--------------------------------------------------------------------------------
fetchmail-6.4.0 (not yet released): fetchmail-6.4.0 (not yet released):
# NOTE THAT FETCHMAIL IS NO LONGER PUBLISHED THROUGH IBIBLIO. # NOTE THAT FETCHMAIL IS NO LONGER PUBLISHED THROUGH IBIBLIO.
......
...@@ -932,7 +932,7 @@ static int do_session( ...@@ -932,7 +932,7 @@ static int do_session(
{ {
/* sigsetjmp returned zero -> normal operation */ /* sigsetjmp returned zero -> normal operation */
char buf[MSGBUFSIZE+1], *realhost; char buf[MSGBUFSIZE+1], *realhost;
int count, newm, bytes; int count, newm;
int fetches, dispatches, transient_errors, oldphase; int fetches, dispatches, transient_errors, oldphase;
struct idlist *idp; struct idlist *idp;
...@@ -1306,6 +1306,7 @@ is restored.")); ...@@ -1306,6 +1306,7 @@ is restored."));
/* compute # of messages and number of new messages waiting */ /* compute # of messages and number of new messages waiting */
stage = STAGE_GETRANGE; stage = STAGE_GETRANGE;
unsigned long long bytes;
err = (ctl->server.base_protocol->getrange)(mailserver_socket, ctl, idp->id, &count, &newm, &bytes); err = (ctl->server.base_protocol->getrange)(mailserver_socket, ctl, idp->id, &count, &newm, &bytes);
if (err != 0) if (err != 0)
goto cleanUp; goto cleanUp;
...@@ -1335,10 +1336,10 @@ is restored.")); ...@@ -1335,10 +1336,10 @@ is restored."));
"%d messages for %s", "%d messages for %s",
count), count),
count, buf); count, buf);
if (bytes == -1) if (bytes == (unsigned long long)-1) // mailbox size unsupported
report_complete(stdout, ".\n"); report_complete(stdout, ".\n");
else else
report_complete(stdout, GT_(" (%d octets).\n"), bytes); report_complete(stdout, GT_(" (%llu octets).\n"), bytes);
} }
else else
{ {
......
...@@ -31,7 +31,7 @@ static int etrn_ok (int sock, char *argbuf) ...@@ -31,7 +31,7 @@ static int etrn_ok (int sock, char *argbuf)
} }
static int etrn_getrange(int sock, struct query *ctl, const char *id, static int etrn_getrange(int sock, struct query *ctl, const char *id,
int *countp, int *newp, int *bytes) int *countp, int *newp, unsigned long long *bytes)
/* send ETRN and interpret the response */ /* send ETRN and interpret the response */
{ {
int ok, opts; int ok, opts;
......
...@@ -210,7 +210,7 @@ struct method /* describe methods for protocol state machine */ ...@@ -210,7 +210,7 @@ struct method /* describe methods for protocol state machine */
/* response_parsing function */ /* response_parsing function */
int (*getauth)(int, struct query *, char *); int (*getauth)(int, struct query *, char *);
/* authorization fetcher */ /* authorization fetcher */
int (*getrange)(int, struct query *, const char *, int *, int *, int *); int (*getrange)(int, struct query *, const char *, int *, int *, unsigned long long *);
/* get message range to fetch */ /* get message range to fetch */
int (*getsizes)(int, int, int *); int (*getsizes)(int, int, int *);
/* get sizes of messages */ /* get sizes of messages */
......
...@@ -883,7 +883,7 @@ static int imap_search(int sock, struct query *ctl, int count) ...@@ -883,7 +883,7 @@ static int imap_search(int sock, struct query *ctl, int count)
static int imap_getrange(int sock, static int imap_getrange(int sock,
struct query *ctl, struct query *ctl,
const char *folder, const char *folder,
int *countp, int *newp, int *bytes) int *countp, int *newp, unsigned long long *bytes)
/* get range of messages to be fetched */ /* get range of messages to be fetched */
{ {
int ok; int ok;
......
...@@ -36,7 +36,7 @@ static int odmr_ok (int sock, char *argbuf) ...@@ -36,7 +36,7 @@ static int odmr_ok (int sock, char *argbuf)
} }
static int odmr_getrange(int sock, struct query *ctl, const char *id, static int odmr_getrange(int sock, struct query *ctl, const char *id,
int *countp, int *newp, int *bytes) int *countp, int *newp, unsigned long long *bytes)
/* send ODMR and then run a reverse SMTP session */ /* send ODMR and then run a reverse SMTP session */
{ {
int ok, opts, smtp_sock; int ok, opts, smtp_sock;
......
...@@ -80,7 +80,7 @@ static int pop2_getauth(int sock, struct query *ctl, char *buf) ...@@ -80,7 +80,7 @@ static int pop2_getauth(int sock, struct query *ctl, char *buf)
} }
static int pop2_getrange(int sock, struct query *ctl, const char *folder, static int pop2_getrange(int sock, struct query *ctl, const char *folder,
int *countp, int *newp, int *bytes) int *countp, int *newp, unsigned long long *bytes)
/* get range of messages to be fetched */ /* get range of messages to be fetched */
{ {
(void)ctl; (void)ctl;
......
...@@ -969,7 +969,7 @@ static int pop3_slowuidl( int sock, struct query *ctl, int *countp, int *newp) ...@@ -969,7 +969,7 @@ static int pop3_slowuidl( int sock, struct query *ctl, int *countp, int *newp)
static int pop3_getrange(int sock, static int pop3_getrange(int sock,
struct query *ctl, struct query *ctl,
const char *folder, const char *folder,
int *countp, int *newp, int *bytes) int *countp, int *newp, unsigned long long *bytes)
/* get range of messages to be fetched */ /* get range of messages to be fetched */
{ {
int ok; int ok;
...@@ -992,7 +992,7 @@ static int pop3_getrange(int sock, ...@@ -992,7 +992,7 @@ static int pop3_getrange(int sock,
if (ok == 0) { if (ok == 0) {
int asgn; int asgn;
asgn = sscanf(buf,"%d %d", countp, bytes); asgn = sscanf(buf,"%d %llu", countp, bytes);
if (asgn != 2) if (asgn != 2)
return PS_PROTOCOL; return PS_PROTOCOL;
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment