diff options
author | Sunil Shetye <sunilshetye@rocketmail.com> | 2012-05-09 13:40:12 +0530 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2012-05-10 17:25:41 +0200 |
commit | e08e5a23758e36466a64345bd56d515a4ada9552 (patch) | |
tree | 8641ab430a801e893e05cdfb9a6821867d0b13ef /driver.c | |
parent | 5698169f15c7d3a020f583f88fcc2c793d7a45c4 (diff) | |
download | fetchmail-e08e5a23758e36466a64345bd56d515a4ada9552.tar.gz fetchmail-e08e5a23758e36466a64345bd56d515a4ada9552.tar.bz2 fetchmail-e08e5a23758e36466a64345bd56d515a4ada9552.zip |
fetchmail workaround for a bug in Microsoft Exchange
treat missing header in response to a FETCH command as a transient error
(Reported by John Connett)
if there are too many transient errors, log it.
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -438,7 +438,8 @@ static int eat_trailer(int sock, struct query *ctl) static int fetch_messages(int mailserver_socket, struct query *ctl, int count, int **msgsizes, int maxfetch, - int *fetches, int *dispatches, int *deletions) + int *fetches, int *dispatches, int *deletions, + int *transient_errors) /* fetch messages in lockstep mode */ { flag force_retrieval; @@ -612,6 +613,7 @@ static int fetch_messages(int mailserver_socket, struct query *ctl, GT_("couldn't fetch headers, message %s@%s:%d (%d octets)\n"), ctl->remotename, ctl->server.truename, num, msgsize); + (*transient_errors)++; continue; } else if (err != 0) @@ -653,7 +655,10 @@ static int fetch_messages(int mailserver_socket, struct query *ctl, if (err == PS_RETAINED) suppress_forward = suppress_delete = retained = TRUE; else if (err == PS_TRANSIENT) + { suppress_delete = suppress_forward = TRUE; + (*transient_errors)++; + } else if (err == PS_REFUSED) suppress_forward = TRUE; else if (err) @@ -714,7 +719,10 @@ static int fetch_messages(int mailserver_socket, struct query *ctl, len); if (err == PS_TRANSIENT) + { suppress_delete = suppress_forward = TRUE; + (*transient_errors)++; + } else if (err) return(err); @@ -940,7 +948,7 @@ static int do_session( /* sigsetjmp returned zero -> normal operation */ char buf[MSGBUFSIZE+1], *realhost; int count, newm, bytes; - int fetches, dispatches, oldphase; + int fetches, dispatches, transient_errors, oldphase; struct idlist *idp; /* execute pre-initialization command, if any */ @@ -1297,6 +1305,7 @@ is restored.")); pass = 0; do { dispatches = 0; + transient_errors = 0; ++pass; /* reset timeout, in case we did an IDLE */ @@ -1426,10 +1435,20 @@ is restored.")); err = fetch_messages(mailserver_socket, ctl, count, &msgsizes, maxfetch, - &fetches, &dispatches, &deletions); + &fetches, &dispatches, &deletions, + &transient_errors); if (err != PS_SUCCESS && err != PS_MAXFETCH) goto cleanUp; + if (transient_errors > MAX_TRANSIENT_ERRORS) + { + if (outlevel > O_SILENT) + { + report(stderr, GT_("Too many mails skipped (%d > %d) due to transient errors for %s\n"), + transient_errors, MAX_TRANSIENT_ERRORS, buf); + } + } + if (!check_only && ctl->skipped && run.poll_interval > 0 && !nodetach) { |