diff options
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | driver.c | 32 | ||||
-rw-r--r-- | fetchmail.man | 9 |
3 files changed, 33 insertions, 14 deletions
@@ -1,5 +1,11 @@ Release Notes: +fetchmail-4.6.2 (): +* Time out server open requests like we do reads. This protects against + buggy TCP/IP configurations that hang forever on a bad open. + +There are 255 people on fetchmail-friends and 293 on fetchmail-announce. + fetchmail-4.6.1 (Wed Oct 14 18:46:58 EDT 1998): * Fixed a minor memory leak in the IP-address-comparison code. * Mark Staveley's patch to suppress progress dots from non-detached daemon @@ -109,9 +109,10 @@ static int mimemsg; /* bitmask indicating MIME body-type */ /* use these to track what was happening when the nonresponse timer fired */ #define GENERAL_WAIT 0 /* unknown wait type */ -#define SERVER_WAIT 1 /* waiting for mailserver response */ -#define LISTENER_WAIT 2 /* waiting for listener initialization */ -#define FORWARDING_WAIT 3 /* waiting for listener response */ +#define OPEN_WAIT 1 /* waiting from mailserver open */ +#define SERVER_WAIT 2 /* waiting for mailserver response */ +#define LISTENER_WAIT 3 /* waiting for listener initialization */ +#define FORWARDING_WAIT 4 /* waiting for listener response */ static phase; static void set_timeout(int timeleft) @@ -377,7 +378,7 @@ static int smtp_open(struct query *ctl) oldphase = phase; phase = LISTENER_WAIT; - set_timeout(ctl->server.timeout); + set_timeout(mytimeout); for (idp = ctl->smtphunt; idp; idp = idp->next) { char *cp, *parsed_host = alloca(strlen(idp->id) + 1); @@ -581,7 +582,7 @@ int num; /* index of message */ linelen = 0; line[0] = '\0'; do { - set_timeout(ctl->server.timeout); + set_timeout(mytimeout); if ((n = SockRead(sock, buf, sizeof(buf)-1)) == -1) { set_timeout(0); free(line); @@ -1534,7 +1535,7 @@ flag forward; /* TRUE to forward */ /* pass through the text lines */ while (protocol->delimited || len > 0) { - set_timeout(ctl->server.timeout); + set_timeout(mytimeout); if ((linelen = SockRead(sock, inbufp, sizeof(buf)-4-(inbufp-buf)))==-1) { set_timeout(0); @@ -1786,7 +1787,11 @@ const struct method *proto; /* protocol method table */ if ((js = setjmp(restart)) == 1) { - if (phase == SERVER_WAIT) + if (phase == OPEN_WAIT) + error(0, 0, + "timeout after %d seconds waiting to connect to server %s.", + ctl->server.timeout, ctl->server.pollname); + else if (phase == SERVER_WAIT) error(0, 0, "timeout after %d seconds waiting for server %s.", ctl->server.timeout, ctl->server.pollname); @@ -1816,7 +1821,7 @@ const struct method *proto; /* protocol method table */ #if INET6 int fetches, dispatches; #else /* INET6 */ - int port, fetches, dispatches; + int port, fetches, dispatches, oldphase; #endif /* INET6 */ struct idlist *idp; @@ -1830,6 +1835,9 @@ const struct method *proto; /* protocol method table */ } /* open a socket to the mail server */ + oldphase = phase; + phase = OPEN_WAIT; + set_timeout(mytimeout); #if !INET6 port = ctl->server.port ? ctl->server.port : protocol->port; #endif /* !INET6 */ @@ -1867,13 +1875,17 @@ const struct method *proto; /* protocol method table */ } #endif /* INET6 */ ok = PS_SOCKET; + set_timeout(0); + phase = oldphase; goto closeUp; } + set_timeout(0); + phase = oldphase; #ifdef KERBEROS_V4 if (ctl->server.preauthenticate == A_KERBEROS_V4) { - set_timeout(ctl->server.timeout); + set_timeout(mytimeout); ok = kerberos_auth(sock, ctl->server.truename); set_timeout(0); if (ok != 0) @@ -1884,7 +1896,7 @@ const struct method *proto; /* protocol method table */ #ifdef KERBEROS_V5 if (ctl->server.preauthenticate == A_KERBEROS_V5) { - set_timeout(ctl->server.timeout); + set_timeout(mytimeout); ok = kerberos5_auth(sock, ctl->server.truename); set_timeout(0); if (ok != 0) diff --git a/fetchmail.man b/fetchmail.man index 64d22c71..2731343a 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -1648,10 +1648,11 @@ temporarily discards any suid privileges it may have while running the MDA. For maximum safety, however, don't use an mda command containing %F or %T when fetchmail is run from the root account itself. .PP -Send comments, bug reports, gripes, and the like to Eric S. Raymond -<esr@thyrsus.com>. An HTML FAQ is available at the fetchmail home -page; surf to http://www.tuxedo.org/~esr/fetchmail or do a WWW search -for pages with `fetchmail' in their titles. +Send comments, bug reports, gripes, and the like to the +fetchmail-friends list <fetchmail-friends@ccil.org>. An HTML FAQ is +available at the fetchmail home page; surf to +http://www.tuxedo.org/~esr/fetchmail or do a WWW search for pages with +`fetchmail' in their titles. .SH SEE ALSO elm(1), mail(1), sendmail(8), popd(8), imapd(8) |