diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-01-30 17:29:36 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-01-30 17:29:36 +0000 |
commit | 65179f921d37756ed89e1ef7965e13bd5f319650 (patch) | |
tree | fdabc324b67d060eab0509040cbc1a7b998658a5 | |
parent | 6a529e4eac97ac7255229fbadcac721b5ba6925b (diff) | |
download | fetchmail-65179f921d37756ed89e1ef7965e13bd5f319650.tar.gz fetchmail-65179f921d37756ed89e1ef7965e13bd5f319650.tar.bz2 fetchmail-65179f921d37756ed89e1ef7965e13bd5f319650.zip |
Add stripcr option.
svn path=/trunk/; revision=842
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | driver.c | 44 | ||||
-rw-r--r-- | fetchmail.c | 7 | ||||
-rw-r--r-- | fetchmail.h | 1 | ||||
-rw-r--r-- | fetchmail.man | 8 | ||||
-rw-r--r-- | rcfile_l.l | 8 | ||||
-rw-r--r-- | rcfile_y.y | 8 |
8 files changed, 54 insertions, 28 deletions
@@ -5,6 +5,9 @@ fetchmail-3.3 () features -- +* Whether or not carriage returns will be stripped on output is explicitly + controllable with stripcr. + bugs -- * Correction to length-extraction code for servers that return (nnn octets). @@ -21,6 +21,9 @@ Since 3.0: ** Support for ESMTP 8BITMIME and SIZE options. + ** The stripcr option to explicitly control carriage-return + stripping before mail forwarding. + Since 2.0: ** Support for secure use with ssh. @@ -765,19 +765,22 @@ char *realname; /* real name of host */ } /* write all the headers */ - if (sinkfp) + if (ctl->stripcr) { - if (ctl->mda) - { - char *sp, *tp; + char *sp, *tp; - for (sp = tp = headers; *sp; sp++) - if (*sp != '\r') - *tp++ = *sp; - *tp = '\0'; + for (sp = tp = headers; *sp; sp++) + if (*sp != '\r') + *tp++ = *sp; + *tp = '\0'; + } + + /* write all the headers */ + if (sinkfp) + { + if (ctl->mda) n = fwrite(headers, 1, strlen(headers), sinkfp); - } else n = SockWrite(headers, 1, strlen(headers), sinkfp); @@ -842,18 +845,20 @@ char *realname; /* real name of host */ strcat(errmsg, "\n"); /* ship out the error line */ + if (ctl->stripcr) + { + char *sp, *tp; + + for (sp = tp = errmsg; *sp; sp++) + if (*sp != '\r') + *tp++ = *sp; + *tp = '\0'; + } + if (sinkfp) { if (ctl->mda) - { - char *sp, *tp; - - for (sp = tp = errmsg; *sp; sp++) - if (*sp != '\r') - *tp++ = *sp; - *tp = '\0'; fwrite(errmsg, 1, strlen(errmsg), sinkfp); - } else SockWrite(errmsg, 1, strlen(errmsg), sinkfp); } @@ -909,7 +914,7 @@ char *realname; /* real name of host */ else SockWrite(buf, 1, 1, sinkfp); - if (ctl->mda) + if (ctl->stripcr) { char *sp, *tp; @@ -917,9 +922,10 @@ char *realname; /* real name of host */ if (*sp != '\r') *tp++ = *sp; *tp = '\0'; + } + if (ctl->mda) n = fwrite(buf, 1, strlen(buf), sinkfp); - } else if (sinkfp) n = SockWrite(buf, 1, strlen(buf), sinkfp); diff --git a/fetchmail.c b/fetchmail.c index 75d9e542..47fcfe72 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -630,6 +630,10 @@ static int load_params(int argc, char **argv, int optind) ctl->server.lead_server = &(ctl->server); no_new_server:; + /* if stripcr hasn't been set, default it asccording to MDA */ + if (ctl->stripcr == -1) + ctl->stripcr = !ctl->mda; + /* plug in the semi-standard way of indicating a mail address */ if (ctl->server.envelope == (char *)NULL) ctl->server.envelope = "X-Envelope-To:"; @@ -826,6 +830,9 @@ void dump_params (struct query *ctl) printf(" Rewrite of server-local addresses is %sabled (--norewrite %s).\n", ctl->no_rewrite ? "dis" : "en", ctl->no_rewrite ? "on" : "off"); + printf(" Carriage-return stripping is %sabled (--stripcr %s).\n", + ctl->stripcr ? "en" : "dis", + ctl->stripcr ? "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 18bfbe1f..4f974b45 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -106,6 +106,7 @@ struct query int fetchall; int flush; int no_rewrite; + int stripcr; int limit; int fetchlimit; int batchlimit; diff --git a/fetchmail.man b/fetchmail.man index 11081032..24495d98 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -594,7 +594,7 @@ 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', and `localdomains'. +`preconnect', `localdomains', and `stripcr'. .PP The `is' or `to' keywords associate the following local (client) name(s) (or server-name to client-name mappings separated by =) with @@ -651,6 +651,12 @@ 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 `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. +.PP Legal protocol identifiers are auto (or AUTO) @@ -59,18 +59,14 @@ keep { yylval.flag = FLAG_TRUE; return KEEP; } flush { yylval.flag = FLAG_TRUE; return FLUSH; } fetchall { yylval.flag = FLAG_TRUE; return FETCHALL; } rewrite { yylval.flag = FLAG_TRUE; return REWRITE; } +stripcr { yylval.flag = FLAG_TRUE; return STRIPCR; } dns { yylval.flag = FLAG_TRUE; return DNS; } -nokeep { yylval.flag = FLAG_FALSE; return KEEP; } -noflush { yylval.flag = FLAG_FALSE; return FLUSH; } -nofetchall { yylval.flag = FLAG_FALSE; return FETCHALL; } -norewrite { yylval.flag = FLAG_FALSE; return REWRITE; } -nodns { yylval.flag = FLAG_FALSE; return DNS; } - no{WS}keep { yylval.flag = FLAG_FALSE; return KEEP; } no{WS}flush { yylval.flag = FLAG_FALSE; return FLUSH; } no{WS}fetchall { yylval.flag = FLAG_FALSE; return FETCHALL; } no{WS}rewrite { yylval.flag = FLAG_FALSE; return REWRITE; } +no{WS}stripcr { yylval.flag = FLAG_FALSE; return REWRITE; } no{WS}dns { yylval.flag = FLAG_FALSE; return DNS; } limit { return LIMIT; } @@ -49,7 +49,7 @@ static void prc_reset(); %token <proto> PROTO %token <sval> STRING %token <number> NUMBER -%token <flag> KEEP FLUSH FETCHALL REWRITE DNS PORT +%token <flag> KEEP FLUSH FETCHALL REWRITE STRIPCR DNS PORT /* these are actually used by the lexer */ %token FLAG_TRUE 2 @@ -76,7 +76,10 @@ statement : SET LOGFILE MAP STRING {logfile = xstrdup($4);} */ | define_server serverspecs {prc_register(); prc_reset();} | define_server serverspecs userspecs - {memset(¤t,'\0',sizeof(current));} + { + memset(¤t,'\0',sizeof(current)); + current.stripcr = -1; + } ; define_server : POLL STRING {current.server.names = (struct idlist *)NULL; @@ -192,6 +195,7 @@ user_option : TO localnames HERE | FLUSH {current.flush = ($1==FLAG_TRUE);} | FETCHALL {current.fetchall = ($1==FLAG_TRUE);} | REWRITE {current.no_rewrite =($1==FLAG_FALSE);} + | STRIPCR {current.stripcr = ($1==FLAG_TRUE);} | LIMIT NUMBER {current.limit = $2;} | FETCHLIMIT NUMBER {current.fetchlimit = $2;} | BATCHLIMIT NUMBER {current.batchlimit = $2;} |