From a90b20cfb6fa5332dd8a4335b16a171feaf5a3a1 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 15 Feb 2002 03:52:22 +0000 Subject: [PATCH] Minor fixes for 5.9.8. svn path=/trunk/; revision=3578 --- NEWS | 8 ++++++++ configure.in | 2 +- driver.c | 15 ++++++++++++++- env.c | 3 +-- fetchmail.man | 5 ++++- fetchmailconf | 10 +++++++++- imap.c | 10 ++++++++-- indexgen.sh | 4 ++++ interface.c | 2 +- rcfile_y.y | 2 +- sink.c | 6 +++--- socket.c | 20 +++++++++++++++----- transact.c | 4 ++-- 13 files changed, 71 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index 2530104b..c39be980 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,14 @@ (The `lines' figures total .c, .h, .l, and .y files under version control.) +* Added de translation catalog; updated da and tr catalogs. +* vsprintf underflow fixes by Sunil Shetye. +* Added warning about UIMS POP3 server. +* Fix yacc syntax bug when building with SSL. +* Sunil Shetye's patch for idle timeout during poll. +* Applied HMH's fix for the 'message delimiter found in headers' code path + (Debian bug #128672). + fetchmail-5.9.7 (Sat Feb 2 00:33:40 EST 2002), 21330 lines: * Minor fixes by HMH. diff --git a/configure.in b/configure.in index d819d1e8..ced05eef 100644 --- a/configure.in +++ b/configure.in @@ -68,7 +68,7 @@ then fi dnl i18n -ALL_LINGUAS="cs es fr pl pt_BR gl da tr" +ALL_LINGUAS="cs da de es fr gl pl pt_BR tr" AM_GNU_GETTEXT dnl end i18n diff --git a/driver.c b/driver.c index eb34010a..56c37a73 100644 --- a/driver.c +++ b/driver.c @@ -495,10 +495,23 @@ static int fetch_messages(int mailserver_socket, struct query *ctl, suppress_delete = suppress_forward = TRUE; else if (err == PS_REFUSED) suppress_forward = TRUE; +#if 0 + /* + * readheaders does not read the body when it + * hits a non-header. It has been recently + * fixed to return PS_TRUNCATED (properly) when + * that happens, but apparently fixing that bug + * opened this one here (which looks like an + * inproper fix from some ancient thinko) + */ else if (err == PS_TRUNCATED) suppress_readbody = TRUE; else if (err) return(err); +#else + else if (err && err != PS_TRUNCATED) + return(err); +#endif /* * If we're using IMAP4 or something else that @@ -635,7 +648,7 @@ static int fetch_messages(int mailserver_socket, struct query *ctl, /* * Tell the UID code we've seen this. * Matthias Andree: only register the UID if we could actually - * forward this mail. If we omit this !suppress_forward check, + * forward this mail. If we omit this !suppress_delete check, * fetchmail will never retry mail that the local listener * refused temporarily. */ diff --git a/env.c b/env.c index e69fea0f..86531b96 100644 --- a/env.c +++ b/env.c @@ -70,8 +70,7 @@ void envquery(int argc, char **argv) { fprintf(stderr, GT_("%s: The NULLMAILER_FLAGS environment variable is set.\n" - "This is dangerous as it can make nullmailer-inject -or nullmailer's\n" + "This is dangerous as it can make nullmailer-inject or nullmailer's\n" "sendmail wrapper tamper with your From:, Message-ID: or Return-Path: headers.\n" "Try \"env NULLMAILER_FLAGS= %s YOUR ARGUMENTS HERE\"\n" "%s: Abort.\n"), diff --git a/fetchmail.man b/fetchmail.man index e93fc4c7..ab62cca8 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -492,7 +492,10 @@ connection to the server is flaky and expensive, as it avoids resending duplicate mail after a line hit. However, on large mailboxes the overhead of re-indexing after every message can slam the server pretty hard, so if your connection is reliable it is good to do -expunges less frequently. If you specify this option to an integer N, +expunges less frequently. Also note that some servers enforce a delay +of a few seconds after each quit, so fetchmail may not be able to get +back in immediately after an expunge -- you may see "lock busy" errors +if this happens. If you specify this option to an integer N, it tells .I fetchmail to only issue expunges on every Nth delete. An argument of zero diff --git a/fetchmailconf b/fetchmailconf index 427b3e5b..fc9bef69 100755 --- a/fetchmailconf +++ b/fetchmailconf @@ -4,7 +4,7 @@ # by Eric S. Raymond, . # Requires Python with Tkinter, and the following OS-dependent services: # posix, posixpath, socket -version = "1.40" +version = "1.41" from Tkinter import * from Dialog import * @@ -1364,6 +1364,14 @@ Your mailserver is running Novonyx POP3. This server, at least as of version 2.17, seems to have problems handling and reporting seen bits. You may have to use the fetchall option. +""" + if string.find(greetline, " IMS POP3") > 0: + warnings = warnings + """ +Some servers issuing the greeting line 'IMS POP3' have been known to +do byte-stuffing correctly. This means that if a message you receive +has a . (period) at start of line, fetchmail will become confused and +probably wedge itself. (This bug was recorded on IMS POP3 0.86.) + """ ### IMAP servers start here diff --git a/imap.c b/imap.c index c07ceec7..fd850d78 100644 --- a/imap.c +++ b/imap.c @@ -535,8 +535,14 @@ static int imap_getrange(int sock, report(stdout, GT_("%d messages waiting after first poll\n"), count); /* no messages? then we may need to idle until we get some */ - if (count == 0 && do_idle) - imap_idle(sock); + while (count == 0 && do_idle) { + ok = imap_idle(sock); + if (ok) + { + report(stderr, GT_("re-poll failed\n")); + return(ok); + } + } /* * We should have an expunge here to diff --git a/indexgen.sh b/indexgen.sh index 2e0c50bf..8880dbf9 100755 --- a/indexgen.sh +++ b/indexgen.sh @@ -68,6 +68,10 @@ cat >index.html <The fetchmail Home Page

+

Note: if you are a stranded fetchmail.com user, we're sorry but +we have nothing to do with that site and cannot help you. It's just an +unfortunate coincidence of names. +

What fetchmail does:

Fetchmail is a full-featured, robust, well-documented diff --git a/interface.c b/interface.c index 723d5e3a..29d4c107 100644 --- a/interface.c +++ b/interface.c @@ -269,7 +269,7 @@ get_ifinfo(const char *ifname, ifinfo_t *ifinfo) kvm_read(kvmfd, ifnet_addr, &ifnet, sizeof(ifnet)); kvm_read(kvmfd, (unsigned long) ifnet.if_name, tname, sizeof tname); #ifdef HAVE_SNPRINTF - snprintf(tname, sizeof tname - 1, + snprintf(tname, sizeof tname, #else sprintf(tname, #endif diff --git a/rcfile_y.y b/rcfile_y.y index 15415986..a7246cf5 100644 --- a/rcfile_y.y +++ b/rcfile_y.y @@ -342,7 +342,7 @@ user_option : TO localnames HERE #ifdef SSL_ENABLE current.use_ssl = FLAG_TRUE; #else - yyerror(GT_("SSL is not enabled")) + yyerror(GT_("SSL is not enabled")); #endif } | SSLKEY STRING {current.sslkey = xstrdup($2);} diff --git a/sink.c b/sink.c index ffd7a1f9..5ffe142f 100644 --- a/sink.c +++ b/sink.c @@ -706,14 +706,14 @@ static int open_smtp_sink(struct query *ctl, struct msgblk *msg, else { if (ctl->smtpname) { #ifdef HAVE_SNPRINTF - snprintf(addr, sizeof(addr)-1, "%s", ctl->smtpname); + snprintf(addr, sizeof(addr), "%s", ctl->smtpname); #else sprintf(addr, "%s", ctl->smtpname); #endif /* HAVE_SNPRINTF */ } else { #ifdef HAVE_SNPRINTF - snprintf(addr, sizeof(addr)-1, "%s@%s", idp->id, ctl->destaddr); + snprintf(addr, sizeof(addr), "%s@%s", idp->id, ctl->destaddr); #else sprintf(addr, "%s@%s", idp->id, ctl->destaddr); #endif /* HAVE_SNPRINTF */ @@ -785,7 +785,7 @@ static int open_smtp_sink(struct query *ctl, struct msgblk *msg, else { #ifdef HAVE_SNPRINTF - snprintf(addr, sizeof(addr)-1, "%s@%s", run.postmaster, ctl->destaddr); + snprintf(addr, sizeof(addr), "%s@%s", run.postmaster, ctl->destaddr); #else sprintf(addr, "%s@%s", run.postmaster, ctl->destaddr); #endif /* HAVE_SNPRINTF */ diff --git a/socket.c b/socket.c index 2631e1fb..ceadc960 100644 --- a/socket.c +++ b/socket.c @@ -563,13 +563,14 @@ int SockRead(int sock, char *buf, int len) later change the behavior of SSL_peek to "fix" this problem... :-( */ if ((n = SSL_peek(ssl, bp, len)) < 0) { + (void)SSL_get_error(ssl, n); return(-1); } if( 0 == n ) { /* SSL_peek says no data... Does he mean no data or did the connection blow up? If we got an error then bail! */ - if( 0 != ( n = ERR_get_error() ) ) { + if( 0 != ( n = SSL_get_error(ssl, n) ) ) { return -1; } /* We didn't get an error so read at least one @@ -581,8 +582,13 @@ int SockRead(int sock, char *buf, int len) newline = NULL; } else if ((newline = memchr(bp, '\n', n)) != NULL) n = newline - bp + 1; - if ((n = SSL_read(ssl, bp, n)) == -1) { - return(-1); + /* Matthias Andree: SSL_read can return 0, in that case + * we must cal SSL_get_error to figure if there was + * an error or just a "no data" condition */ + if ((n = SSL_read(ssl, bp, n)) <= 0) { + if ((n = SSL_get_error(ssl, n))) { + return(-1); + } } /* Check for case where our single character turned out to * be a newline... (It wasn't going to get caught by @@ -635,16 +641,20 @@ int SockPeek(int sock) #ifdef SSL_ENABLE if( NULL != ( ssl = SSLGetContext( sock ) ) ) { n = SSL_peek(ssl, &ch, 1); + if (n < 0) { + (void)SSL_get_error(ssl, n); + return -1; + } if( 0 == n ) { /* This code really needs to implement a "hold back" * to simulate a functioning SSL_peek()... sigh... * Has to be coordinated with the read code above. * Next on the list todo... */ - /* SSL_peek says no data... Does he mean no data + /* SSL_peek says 0... Does that mean no data or did the connection blow up? If we got an error then bail! */ - if( 0 != ( n = ERR_get_error() ) ) { + if( 0 != ( n = SSL_get_error(ssl, n) ) ) { return -1; } diff --git a/transact.c b/transact.c index c6387e3c..c3898b0f 100644 --- a/transact.c +++ b/transact.c @@ -1355,7 +1355,7 @@ va_dcl va_start(ap); #endif #ifdef HAVE_VSNPRINTF - vsnprintf(buf + strlen(buf), sizeof(buf), fmt, ap); + vsnprintf(buf + strlen(buf), sizeof(buf)-strlen(buf), fmt, ap); #else vsprintf(buf + strlen(buf), fmt, ap); #endif @@ -1445,7 +1445,7 @@ va_dcl va_start(ap); #endif #ifdef HAVE_VSNPRINTF - vsnprintf(buf + strlen(buf), sizeof(buf), fmt, ap); + vsnprintf(buf + strlen(buf), sizeof(buf)-strlen(buf), fmt, ap); #else vsprintf(buf + strlen(buf), fmt, ap); #endif -- 2.43.2