aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--README2
-rw-r--r--driver.c73
-rw-r--r--fetchmail-features.html13
-rw-r--r--fetchmail.man26
5 files changed, 82 insertions, 37 deletions
diff --git a/NEWS b/NEWS
index 0a8f41d3..4c5090ae 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,6 @@
* Allow an explicit "append" option to specify what rewrite appends? (For
when user's pop3 host isn't the same as his SMTP host.)
* Allow -c -F to work to flush messages without retrieval.
-* Read from /etc/fetchmailrc before ~/.fetchmailrc?
* Do is_host_alias checks by comparing IP addresses rather than names?
* Handle multi-homed hosts correctly.
* Add an "ident" per-user option for debugging that produces an
@@ -18,8 +17,10 @@
------------------------------------------------------------------------------
fetchmail-4.4.1 ():
* We now properly shroud IMAP passwords containing ", \, and SP.
+* Checked for Y2K safety. No 2-digit dates anywhere, so we're safe.
+* Added mimedecode option by Henrik Storner.
-There are 273 people on fetchmail-friends and 160 on fetchmail-announce.
+There are 274 people on fetchmail-friends and 164 on fetchmail-announce.
------------------------------------------------------------------------------
fetchmail-4.4.0 (Mon Mar 16 14:57:38 EST 1998):
diff --git a/README b/README
index 473aa4f6..89b69a69 100644
--- a/README
+++ b/README
@@ -25,6 +25,8 @@ under AmigaOS.
A beta OS/2 port of fetchmail is available from Jason F. McBrayer at
http://studentweb.tulane.edu/%7Ejmcbray/os2.
+Fetchmail is Y2K safe.
+
See the distribution files FEATURES for a full list of features, NEWS
for detailed information on recent changes and NOTES for design notes.
diff --git a/driver.c b/driver.c
index aa908ecd..a3e8a633 100644
--- a/driver.c
+++ b/driver.c
@@ -108,6 +108,7 @@ static int tagnum;
static char shroud[PASSWORDLEN]; /* string to shroud in debug output */
static int mytimeout; /* value of nonreponse timeout */
static int msglen; /* actual message length */
+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 */
@@ -639,7 +640,7 @@ int num; /* index of message */
char return_path[HOSTLEN + USERNAMELEN + 4];
int from_offs, reply_to_offs, resent_from_offs;
int app_from_offs, sender_offs, resent_sender_offs;
- int ctt_offs, env_offs;
+ int env_offs;
char *headers, *received_for, *destaddr, *rcv, *cp;
int n, linelen, oldlen, ch, remaining, skipcount;
struct idlist *idp, *xmit_names;
@@ -656,10 +657,11 @@ int num; /* index of message */
/* read message headers */
headers = received_for = NULL;
from_offs = reply_to_offs = resent_from_offs = app_from_offs =
- sender_offs = resent_sender_offs = ctt_offs = env_offs = -1;
+ sender_offs = resent_sender_offs = env_offs = -1;
oldlen = 0;
msglen = 0;
skipcount = 0;
+ mimemsg = 0;
for (remaining = fetchlen; remaining > 0 || protocol->delimited; remaining -= linelen)
{
@@ -880,8 +882,6 @@ int num; /* index of message */
else if (!strncasecmp("Resent_Sender:", line, 14))
resent_sender_offs = (line - headers);
- else if (!strncasecmp("Content-Transfer-Encoding:", line, 26))
- ctt_offs = (line - headers);
else if (!strncasecmp("Message-Id:", buf, 11))
{
if (ctl->server.uidl)
@@ -982,6 +982,16 @@ int num; /* index of message */
* In fact we have to, as this will tell us where to forward to.
*/
+ /* Decode MIME encoded headers. We MUST do this before
+ * looking at the Content-Type / Content-Transfer-Encoding
+ * headers (RFC 2046).
+ */
+ if (ctl->mimedecode) {
+ UnMimeHeader(headers);
+ }
+ /* Check for MIME headers indicating possible 8-bit data */
+ mimemsg = MimeBodyType(headers);
+
/*
* If there is a Return-Path address on the message, this was
* almost certainly the MAIL FROM address given the originating
@@ -1197,7 +1207,7 @@ int num; /* index of message */
}
else
{
- char *ap, *ctt, options[MSGBUFSIZE], addr[128];
+ char *ap, options[MSGBUFSIZE], addr[128];
/* build a connection to the SMTP listener */
if ((smtp_open(ctl) == -1))
@@ -1210,22 +1220,16 @@ int num; /* index of message */
}
/*
- * Compute ESMTP options. It's a kluge to use nxtaddr()
- * here because the contents of the Content-Transfer-Encoding
- * headers isn't semantically an address. But it has the
- * desired tokenizing effect.
+ * Compute ESMTP options.
*/
options[0] = '\0';
- if (ctl->server.esmtp_options & ESMTP_8BITMIME)
- if (ctl->pass8bits)
+ if (ctl->server.esmtp_options & ESMTP_8BITMIME) {
+ if (ctl->pass8bits || (mimemsg & MSG_IS_8BIT))
strcpy(options, " BODY=8BITMIME");
- else if ((ctt_offs >= 0) && (ctt = nxtaddr(headers + ctt_offs)))
- {
- if (!strcasecmp(ctt,"7BIT"))
- strcpy(options, " BODY=7BIT");
- else if (!strcasecmp(ctt,"8BIT"))
- strcpy(options, " BODY=8BITMIME");
- }
+ else if (mimemsg & MSG_IS_7BIT)
+ strcpy(options, " BODY=7BIT");
+ }
+
if ((ctl->server.esmtp_options & ESMTP_SIZE) && reallen > 0)
sprintf(options + strlen(options), " SIZE=%ld", reallen);
@@ -1258,12 +1262,13 @@ int num; /* index of message */
* coming from this address, probably due to an
* anti-spam domain exclusion. Respect this. Don't
* try to ship the message, and don't prevent it from
- * being deleted. Typical values.
+ * being deleted. Typical values:
*
* 571 = sendmail's "unsolicited email refused"
* 501 = exim's old antispam response
* 550 = exim's new antispam response (temporary)
*/
+ SMTP_rset(ctl->smtp_socket); /* required by RFC1870 */
free(headers);
free_str_list(&xmit_names);
return(PS_REFUSED);
@@ -1292,6 +1297,7 @@ int num; /* index of message */
return(PS_TRANSIENT);
case 552: /* message exceeds fixed maximum message size */
+ case 553: /* invalid sending domain */
/*
* Permanent no-go condition on the
* ESMTP server. Don't try to ship the message,
@@ -1543,13 +1549,15 @@ int len; /* length of message */
flag forward; /* TRUE to forward */
{
int linelen;
- char buf[MSGBUFSIZE+1];
+ unsigned char buf[MSGBUFSIZE+1];
+ unsigned char *inbufp = buf;
+ flag issoftline = FALSE;
/* pass through the text lines */
while (protocol->delimited || len > 0)
{
set_timeout(ctl->server.timeout);
- if ((linelen = SockRead(sock, buf, sizeof(buf)-1)) == -1)
+ if ((linelen = SockRead(sock, inbufp, sizeof(buf)-1-(inbufp-buf)))==-1)
{
set_timeout(0);
if (ctl->mda)
@@ -1576,20 +1584,35 @@ flag forward; /* TRUE to forward */
len -= linelen;
/* check for end of message */
- if (protocol->delimited && *buf == '.')
- if (buf[1] == '\r' && buf[2] == '\n' && buf[3] == '\0')
+ if (protocol->delimited && *inbufp == '.')
+ if (inbufp[1] == '\r' && inbufp[2] == '\n' && inbufp[3] == '\0')
break;
- else if (buf[1] == '\n' && buf[2] == '\0')
+ else if (inbufp[1] == '\n' && inbufp[2] == '\0')
break;
else
msglen--; /* subtract the size of the dot escape */
msglen += linelen;
+ if (ctl->mimedecode && (mimemsg & MSG_NEEDS_DECODE)) {
+ issoftline = UnMimeBodyline(&inbufp, (protocol->delimited && issoftline));
+ if (issoftline && (sizeof(buf)-1-(inbufp-buf) < 200)) {
+ /* Soft linebreak, but less than 200 bytes left in
+ * input buffer. Rather than doing a buffer overrun,
+ * ignore the soft linebreak, NL-terminate data and
+ * deliver what we have now.
+ * (Who writes lines longer than 2K anyway?)
+ */
+ *inbufp = '\n'; *(inbufp+1) = '\0';
+ issoftline = 0;
+ }
+ }
+
/* ship out the text line */
- if (forward)
+ if (forward && (!issoftline))
{
int n = stuffline(ctl, buf);
+ inbufp = buf;
if (n < 0)
{
diff --git a/fetchmail-features.html b/fetchmail-features.html
index 42cbcf87..2e6a7ccf 100644
--- a/fetchmail-features.html
+++ b/fetchmail-features.html
@@ -10,17 +10,18 @@
<table width="100%" cellpadding=0><tr>
<td width="30%">Back to <a href="index.html">Fetchmail Home Page</a>
<td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a>
-<td width="30%" align=right>$Date: 1998/03/03 21:22:31 $
+<td width="30%" align=right>$Date: 1998/03/20 16:37:36 $
</table>
<HR>
<H1 ALIGN=CENTER>Fetchmail Feature List</H1>
-Here are fetchmail's main features. Those unique to fetchmail
-are listed first. <P>
-
<H2>Since 4.0:</H2>
<UL>
+<LI> Automatically decodes armored 7-bit MIME into 8 bits.
+
+<LI> You can specify which SMTP error is recognized as a spam block.
+
<LI> Support for Kerberos V authentication.
<LI> Support for IMAP-OTP authentication using Craig Metz's patches
@@ -114,6 +115,8 @@ are listed first. <P>
<LI> Strict conformance to relevant RFCs and good debugging options.
You could use fetchmail to test and debug server implementatations.
+
+<LI> For anybody who cares, fetchmail is Y2K safe.
</UL>
<H2>Features in common with other remote-mail retrieval programs:</H2>
@@ -141,7 +144,7 @@ get-mail, gwpop, pimp-1.0, pop-perl5-1.2, popc, popmail-1.6 and upop.<P>
<table width="100%" cellpadding=0><tr>
<td width="30%">Back to <a href="index.html">Fetchmail Home Page</a>
<td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a>
-<td width="30%" align=right>$Date: 1998/03/03 21:22:31 $
+<td width="30%" align=right>$Date: 1998/03/20 16:37:36 $
</table>
<P><ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com">&lt;esr@snark.thyrsus.com&gt;</A></ADDRESS>
diff --git a/fetchmail.man b/fetchmail.man
index 50c947fd..e5b74ff2 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -418,7 +418,7 @@ Every mode except ETRN requires authentication of the client.
Normal user authentication in
.I fetchmail
is very much like the authentication mechanism of
-.I ftp(1).
+.IR ftp (1).
The correct user-id and password depend upon the underlying security
system at the mailserver.
.PP
@@ -912,6 +912,9 @@ T}
dropstatus \& T{
Strip Status and X-Mozilla-Status lines out of incoming mail
T}
+mimedecode \& T{
+Convert quoted-printable to 8-bit in MIME messages (default)
+T}
no keep -K T{
Delete seen messages from server (default)
T}
@@ -936,6 +939,9 @@ T}
no dropstatus \& T{
Don't drop Status headers (default)
T}
+no mimedecode \& T{
+Don't convert quoted-printable to 8-bit in MIME messages
+T}
limit -l T{
Set message size limit
T}
@@ -971,7 +977,8 @@ All options correspond to the obvious command-line arguments, except
the following: `via', `interval', `aka', `is', `to', `dns'/`no dns',
\&`password', \&`preconnect', \&`postconnect', `localdomains',
\&`stripcr'/`no stripcr', \&`forcecr'/`no forcecr', `pass8bits'/`no
-pass8bits' `dropstatus/no dropstatus', and `no envelope'.
+pass8bits' `dropstatus/no dropstatus', `mimedecode/no mimedecode',
+and `no envelope'.
.PP
The `via' option is for use with ssh, or if you want to have more
than one configuration pointing at the same site. If it is present,
@@ -1095,6 +1102,15 @@ confuse some new-mail notifiers, which assume that anything with a
Status line in it has been seen. (Note: the empty Status lines
inserted by some buggy POP servers are unconditionally discarded.)
.PP
+The `mimedecode' option controls whether MIME messages using the
+quoted-printable encoding are automatically converted into pure
+8-bit data. If you are delivering mail to an ESMTP-capable,
+8-bit-clean listener (that includes all of the major programs
+like sendmail), then this will automatically convert quoted-printable
+message headers and data into 8-bit data, making it easier to
+understand when reading mail. If your e-mail programs know how to
+deal with MIME messages, then this option is not needed.
+.PP
.SS Miscellaneous Run Control Options
The words `here' and `there' have useful English-like
significance. Normally `user eric is esr' would mean that
@@ -1524,9 +1540,9 @@ in foreground while a background fetchmail is running will do
whichever of these is appropriate to wake it up.
.SH BUGS AND KNOWN PROBLEMS
-The RFC822 parser used in multidrop mode chokes on some @-addresses that
-are technically legal but bizarre. Strange uses of quoting and
-embedded comments are likely to confuse it.
+The RFC822 address parser used in multidrop mode chokes on some
+@-addresses that are technically legal but bizarre. Strange uses of
+quoting and embedded comments are likely to confuse it.
.PP
Use of any of the supported protocols other than POP3 with OTP or RPA, APOP,
KPOP, IMAP-K4, IMAP-GSS, or ETRN requires that the program send unencrypted