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).
** 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.
}
/* 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);
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);
}
else
SockWrite(buf, 1, 1, sinkfp);
- if (ctl->mda)
+ if (ctl->stripcr)
{
char *sp, *tp;
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);
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:";
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);
int fetchall;
int flush;
int no_rewrite;
+ int stripcr;
int limit;
int fetchlimit;
int batchlimit;
.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
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)
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; }
%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
*/
| 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;
| 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;}