aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-04-17 07:57:06 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-04-17 07:57:06 +0000
commit68b96cb4f8258c5120b8daec819cb8ae2456f399 (patch)
tree403b0993b7b42e3dc84a9cdbd502f824e02a7081
parentddb99a133d2301974d24b41b19210f3c03bc708c (diff)
downloadfetchmail-68b96cb4f8258c5120b8daec819cb8ae2456f399.tar.gz
fetchmail-68b96cb4f8258c5120b8daec819cb8ae2456f399.tar.bz2
fetchmail-68b96cb4f8258c5120b8daec819cb8ae2456f399.zip
Added forcecr option.
svn path=/trunk/; revision=963
-rw-r--r--Makefile.in2
-rw-r--r--NEWS5
-rw-r--r--README4
-rw-r--r--driver.c25
-rw-r--r--fetchmail-FAQ.html9
-rw-r--r--fetchmail.c4
-rw-r--r--fetchmail.h1
-rw-r--r--fetchmail.man15
-rw-r--r--rcfile_l.l1
-rw-r--r--rcfile_y.y6
-rw-r--r--sample.rcfile2
11 files changed, 62 insertions, 12 deletions
diff --git a/Makefile.in b/Makefile.in
index a85ccb2f..de7b3016 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -209,7 +209,7 @@ config = $(srcdir)/Makefile.in $(srcdir)/configure.in $(srcdir)/configure \
$(srcdir)/acconfig.h
scripts = $(srcdir)/install.sh $(srcdir)/mkinstalldirs $(srcdir)/specgen.sh
all = $(docs) $(config) $(srcs) $(parser) $(headers) $(extra) $(scripts) \
- $(srcdir)/MANIFEST contrib
+ $(srcdir)/contrib/* $(srcdir)/MANIFEST
MANIFEST: $(srcdir)
@echo $(all) | tr "[ \t]" '\n' | sort | sed "s/\\./fetchmail-$(VERS)/" >MANIFEST
diff --git a/NEWS b/NEWS
index 01ce5226..e4a04c8c 100644
--- a/NEWS
+++ b/NEWS
@@ -19,9 +19,10 @@ pl 3.9.1 (Sat Apr 5 14:22:16 EST 1997):
* --check now turns off --daemon.
* --syslog is now independent of --daemon.
* Multiple-error X- headers are improved.
+* Added `forcecr' to fix qmail problems by forcing CRLF termination.
-There are 246 people on the fetchmail-friends list.
-(24 bad addresses were dropped)
+There are 225 people on the fetchmail-friends list.
+(many bad addresses were dropped after the switchover to SmartList)
------------------------------------------------------------------------------
fetchmail-3.9 (Wed Apr 2 13:36:22 EST 1997)
diff --git a/README b/README
index a0bda331..02626f47 100644
--- a/README
+++ b/README
@@ -25,8 +25,8 @@ Since 3.0:
** Support for ESMTP ETRN command.
- ** The stripcr option to explicitly control carriage-return
- stripping before mail forwarding.
+ ** The stripcr and forcecr option to explicitly control carriage-return
+ stripping and LF->CRLF mapping before mail forwarding.
Since 2.0:
diff --git a/driver.c b/driver.c
index 753b90ec..701224f0 100644
--- a/driver.c
+++ b/driver.c
@@ -466,6 +466,19 @@ char *realname; /* real name of host */
do {
if (!SockGets(buf, sizeof(buf)-1, sockfp))
return(PS_SOCKET);
+
+ /* lines may not be properly CRLF terminated; fix this for qmail */
+ if (ctl->forcecr)
+ {
+ cp = buf + strlen(buf) - 1;
+ if (cp > buf && *cp == '\n' && cp[-1] != '\r')
+ {
+ *cp++ = '\r';
+ *cp++ = '\n';
+ *cp++ = '\0';
+ }
+ }
+
set_timeout(ctl->server.timeout);
/* leave extra room for reply_hack to play with */
line = realloc(line, strlen(line) + strlen(buf) + HOSTLEN + 1);
@@ -1008,6 +1021,18 @@ char *realname; /* real name of host */
}
remaining -= n;
+ /* fix messages that have only \n line-termination (for qmail) */
+ if (ctl->forcecr)
+ {
+ cp = buf + strlen(buf) - 1;
+ if (cp > buf && *cp == '\n' && cp[-1] != '\r')
+ {
+ *cp++ = '\r';
+ *cp++ = '\n';
+ *cp++ = '\0';
+ }
+ }
+
/* check for end of message */
if (delimited && *buf == '.')
if (buf[1] == '\r' && buf[2] == '\n')
diff --git a/fetchmail-FAQ.html b/fetchmail-FAQ.html
index 79ce34f3..7de91de1 100644
--- a/fetchmail-FAQ.html
+++ b/fetchmail-FAQ.html
@@ -9,7 +9,7 @@
<BODY>
<H1>Frequently Asked Questions About Fetchmail</H1>
-$Id: fetchmail-FAQ.html,v 1.3 1997/04/16 20:29:43 esr Exp $<p>
+$Id: fetchmail-FAQ.html,v 1.4 1997/04/17 07:56:59 esr Exp $<p>
(Added <a href="http:#C6">C6</a> on working with qmail and
<a href="http:#C7">C7</a> on managing fetchmail in the presence of
@@ -54,7 +54,7 @@ and is a SmartList reflector; sign up in the usual way. <p>
<a href="#C3">C3. How do I know what interface and address to use with --interface?</a><br>
<a href="#C4">C4. How can I get fetchmail to work with ssh?</a><br>
<a href="#C5">C5. How can I set up support for sendmail's anti-spam 571 response?</a><br>
-<a href="#C6">C6. How can I use fetchmail multidrop mode with qmail?</a><br>
+<a href="#C6">C6. How can I use fetchmail with qmail?</a><br>
<a href="#C7">C7. How can I do automatic startup/shutdown of fetchmail
when I may have multiple login sessions going?</a><br>
@@ -548,7 +548,10 @@ to allow sendmail to process the message further and generate an error
message to the sender. <p>
<hr>
-<h2><a name="C6">C6. How can I use fetchmail multidrop mode with qmail?</a></h2>
+<h2><a name="C6">C6. How can I use fetchmail with qmail?</a></h2>
+
+Turn on the <tt>forcecr</tt> option; qmail's listener mode doesn't like
+header or message lines terminated with bare linefeeds.<p>
(This information is thanks to Robert de Bath
&lt;robert@mayday.cix.co.uk&gt;.)<p>
diff --git a/fetchmail.c b/fetchmail.c
index 700b9bab..172eb17e 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -631,6 +631,7 @@ static int load_params(int argc, char **argv, int optind)
DEFAULT(ctl->fetchall, FALSE);
DEFAULT(ctl->rewrite, TRUE);
DEFAULT(ctl->stripcr, (ctl->mda != (char *)NULL));
+ DEFAULT(ctl->forcecr, FALSE);
DEFAULT(ctl->server.dns, TRUE);
DEFAULT(ctl->server.uidl, FALSE);
#undef DEFAULT
@@ -853,6 +854,9 @@ void dump_params (struct query *ctl)
printf(" Carriage-return stripping is %sabled (--stripcr %s).\n",
ctl->stripcr ? "en" : "dis",
ctl->stripcr ? "on" : "off");
+ printf(" Carriage-return forcing is %sabled (--forcecr %s).\n",
+ ctl->forcecr ? "en" : "dis",
+ ctl->forcecr ? "on" : "off");
if (ctl->limit)
printf(" Message size limit is %d bytes (--limit %d).\n",
ctl->limit, ctl->limit);
diff --git a/fetchmail.h b/fetchmail.h
index 526d7370..4680bfe3 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -114,6 +114,7 @@ struct query
int flush;
int rewrite;
int stripcr;
+ int forcecr;
int limit;
int fetchlimit;
int batchlimit;
diff --git a/fetchmail.man b/fetchmail.man
index 72b9bb04..4abc7ad9 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -618,12 +618,14 @@ Legal user options are
fetchall
rewrite
stripcr
+ forcecr
dns
no keep
no flush
no fetchall
no rewrite
no stripcr
+ no forcecr
no dns
no envelope
limit
@@ -633,8 +635,8 @@ Legal user options are
.PP
All options correspond to the obvious command-line arguments except
the following: `aka', `is', `to', `dns'/`no dns', `password',
-\&`preconnect', `localdomains', `stripcr'/`no stripcr' and
-\&`no received'.
+\&`preconnect', `localdomains', `stripcr'/`no stripcr' ,
+\&`forcecr'/`no forcecr' and `no received'.
.PP
The `is' or `to' keywords associate the following local (client)
name(s) (or server-name to client-name mappings separated by =) with
@@ -698,11 +700,18 @@ establishes a mailserver connection. This may be useful if you are
attempting to set up secure POP connections with the aid of
.IR ssh (1).
.PP
+The `forcecr' option controls whether lines terminated by LF only are
+given CRLF termination before forwarding. Strictly speaking RFC821
+requires this, but few MTAs enforce the requirement it so this option
+is normally off (only one such MTA, qmail, is in significant use at
+time of writing).
+.PP
The `stripcr' option controls whether carriage returns are stripped
out of retrieved mail before it is forwarded. It is normally not
necessary to set this, because it defaults to `on' (CR stripping
enabled) when there is an MDA declared but `off' (CR stripping
-disabled) when forwarding is via SMTP.
+disabled) when forwarding is via SMTP. If `stripcr' and `forcecr' are
+both on, `stripcr' will override.
.PP
Legal protocol identifiers are
diff --git a/rcfile_l.l b/rcfile_l.l
index 8d9ec034..9d36b41e 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -60,6 +60,7 @@ keep { return KEEP; }
flush { return FLUSH; }
fetchall { return FETCHALL; }
rewrite { return REWRITE; }
+forcecr { return FORCECR; }
stripcr { return STRIPCR; }
dns { return DNS; }
uidl { return UIDL; }
diff --git a/rcfile_y.y b/rcfile_y.y
index d9bf0ebc..f2e703a9 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -48,7 +48,7 @@ static void user_reset();
%token <proto> PROTO
%token <sval> STRING
%token <number> NUMBER
-%token NO KEEP FLUSH FETCHALL REWRITE STRIPCR DNS PORT UIDL
+%token NO KEEP FLUSH FETCHALL REWRITE FORCECR STRIPCR DNS PORT UIDL
%%
@@ -199,12 +199,14 @@ user_option : TO localnames HERE
| FLUSH {current.flush = FLAG_TRUE;}
| FETCHALL {current.fetchall = FLAG_TRUE;}
| REWRITE {current.rewrite = FLAG_TRUE;}
+ | FORCECR {current.forcecr = FLAG_TRUE;}
| STRIPCR {current.stripcr = FLAG_TRUE;}
| NO KEEP {current.keep = FLAG_FALSE;}
| NO FLUSH {current.flush = FLAG_FALSE;}
| NO FETCHALL {current.fetchall = FLAG_FALSE;}
| NO REWRITE {current.rewrite = FLAG_FALSE;}
+ | NO FORCECR {current.forcecr = FLAG_FALSE;}
| NO STRIPCR {current.stripcr = FLAG_FALSE;}
| LIMIT NUMBER {current.limit = $2;}
@@ -366,6 +368,7 @@ static void record_current(void)
FLAG_FORCE(flush);
FLAG_FORCE(fetchall);
FLAG_FORCE(rewrite);
+ FLAG_FORCE(forcecr);
FLAG_FORCE(stripcr);
FLAG_FORCE(limit);
FLAG_FORCE(fetchlimit);
@@ -408,6 +411,7 @@ void optmerge(struct query *h2, struct query *h1)
FLAG_MERGE(flush);
FLAG_MERGE(fetchall);
FLAG_MERGE(rewrite);
+ FLAG_MERGE(forcecr);
FLAG_MERGE(stripcr);
FLAG_MERGE(limit);
FLAG_MERGE(fetchlimit);
diff --git a/sample.rcfile b/sample.rcfile
index 75bc72cd..ade59267 100644
--- a/sample.rcfile
+++ b/sample.rcfile
@@ -44,12 +44,14 @@
# flush
# fetchall
# rewrite
+# forcecr
# stripcr
# dns
# no keep
# no flush
# no fetchall
# no rewrite
+# no forcecr
# no stripcr
# no dns
# no envelope