Commit 2e39a060 authored by Sam Varshavchik's avatar Sam Varshavchik

courier: generate SMTPUTF8 DSNs.

Prepend UTF8 to RFC3848 transmission types, by adding another character
to submit's format string.

Generate message/global, message/global-headers, and
message/global-delivery-status.
parent 3f65e7c3
......@@ -23,6 +23,7 @@
<arg choice="opt" rep="norepeat">-vhost=<replaceable>address</replaceable></arg>
<arg choice="opt" rep="norepeat">-bcc</arg>
<arg choice="opt" rep="norepeat">-delay=<replaceable>n</replaceable></arg>
<arg choice="opt" rep="norepeat">-rfc3848=<replaceable>type</replaceable></arg>
<arg choice="req" rep="norepeat">module</arg>
<arg choice="req" rep="norepeat">"<replaceable>type</replaceable>; <replaceable>hostid</replaceable>"</arg>
</cmdsynopsis>
......@@ -132,6 +133,17 @@ time (default: 0 seconds -- immediate delivery).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-rfc3848=<replaceable>text</replaceable></term>
<listitem>
<para>
Specify the RFC 3848 transmission type label to be included
in the message's <quote>Received:</quote> header
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-vhost=<replaceable>address</replaceable></term>
<listitem>
......@@ -191,13 +203,22 @@ empty string, optionally followed by tab, then "format", another tab, then
"envid".</para>
<para>
<replaceable>format</replaceable> is one or more chatacters that specify delivery status
notification processing, and other message options. The 'F' character
specifies that delivery status notifications should include the entire
message, 'H' specifies just the headers of the message should be included.
Absence of either 'F' or 'H' specifies no preference. "S{keyword}" specifies
the optional SECURITY extension keyword for this message. The 'V' character in
<replaceable>format</replaceable> sets the VERP extension flag for this message.</para>
<replaceable>format</replaceable> is one or more chatacters that
specify delivery status
notification processing, and other message options. The 'F' character
specifies that delivery status notifications should include the entire
message, 'H' specifies just the headers of the message should be included.
Absence of either 'F' or 'H' specifies no preference. "S{keyword}"
specifies
the optional SECURITY extension keyword for this message.
The 'V' character in
<replaceable>format</replaceable> sets the VERP extension flag for
this message.
The '8' character is a flag indicating that the message was received
via SMTP with a <literal>SMTPUTF8</literal> keyword, this prepends
<quote>UTF8</quote> to the transmission type passed in via
<option>-rfc3848</option>.
</para>
<para>
<replaceable>envid</replaceable> is the original message envelope ID, that will be shown on any
......
......@@ -947,9 +947,12 @@ static int dodsn(struct ctlfile *ctf, FILE *fp, const char *sender,
}
}
fprintf(fp, "%s\n\n--%s\nContent-Type: message/delivery-status\nContent-Transfer-Encoding: %s\n\nReporting-MTA: dns; %s\nArrival-Date: %s\n",
fprintf(fp, "%s\n\n--%s\nContent-Type: %s\nContent-Transfer-Encoding: %s\n\nReporting-MTA: dns; %s\nArrival-Date: %s\n",
dsnfooter,
boundary,
dsn8flag
? "message/global-delivery-status"
: "message/delivery-status",
dsn8flag ? "8bit":"7bit",
config_me(), from_time);
......@@ -1062,7 +1065,10 @@ static int dodsn(struct ctlfile *ctf, FILE *fp, const char *sender,
fprintf(fp, "\n--%s\n", boundary);
fprintf(fp, "Content-Type: %s\nContent-Transfer-Encoding: %s\n\n",
returnmsg ? "message/rfc822":"text/rfc822-headers; charset=\"utf-8\"",
returnmsg ?
(msg8flag ? "message/global":"message/rfc822"):
(msg8flag ? "message/global-headers; charset=\"utf-8\""
:"text/rfc822-headers; charset=\"utf-8\""),
msg8flag ? "8bit":"7bit");
if (print_message(datfile, fp, returnmsg))
......
......@@ -540,12 +540,13 @@ const char *q=skipaddress(&p);
static int domailfrom(const char *p, const char *q)
{
const char *r, *s;
char retformat=0;
const char *envid=0;
size_t envidlen=0;
char *buf;
int rc;
const char *r, *s;
char retformat=0;
const char *envid=0;
size_t envidlen=0;
char *buf;
int rc;
int smtputf8=0;
hasexdata=0;
hasverp=0;
......@@ -638,6 +639,19 @@ int rc;
l=n;
}
}
else if (s - r >= 8 &&
#if HAVE_STRNCASECMP
strncasecmp(r, "SMTPUTF8", 8)
#else
strnicmp(r, "SMTPUTF8", 8)
#endif
== 0)
{
if (s-r == 8 || r[8] == '=')
{
smtputf8=1;
}
}
r= s-1;
}
......@@ -660,6 +674,10 @@ int rc;
{
strcat(buf, "S{STARTTLS}");
}
if (smtputf8)
{
strcat(buf, "8");
}
if (envidlen)
{
......
......@@ -1874,7 +1874,7 @@ static char *esmtp_mailfrom_cmd_idna(struct esmtp_info *info,
if (*p & 0x80)
{
if (errmsg)
*errmsg="553-The addressee's mail"
*errmsg="550-The addressee's mail"
"server "
"does not support the sender's "
"international E-mail address.";
......
......@@ -528,6 +528,7 @@ struct mailfrominfo {
AliasSearch *asptr;
std::string *envid;
char dsnformat;
int smtputf8;
struct rw_transport *module;
int flag;
std::string helohost;
......@@ -593,6 +594,9 @@ static void setmsgopts(struct mailfrominfo &mfi, std::string optstring)
if (opts.size() && security.size() == 0)
security=opts;
break;
case '8':
mfi.smtputf8=1;
break;
}
}
}
......@@ -896,6 +900,7 @@ static int getsender(Input &input, struct rw_transport *module)
frominfo.flag=1;
frominfo.module=module;
frominfo.dsnformat=0;
frominfo.smtputf8=0;
frominfo.envid=NULL;
frominfo.receivedspfhelo=NULL;
frominfo.receivedspfmailfrom=NULL;
......@@ -932,7 +937,7 @@ static int getsender(Input &input, struct rw_transport *module)
buf=utf8ize_address(buf);
if ((q=getenv("DSNRET")) != 0)
setmsgopts(frominfo, utf8ize_address(q));
setmsgopts(frominfo, q);
const char *tcpremoteip=getenv("TCPREMOTEIP");
int bofhcheckhelo=(q=getenv("BOFHCHECKHELO")) == NULL ? 0:atoi(q);
......@@ -1762,7 +1767,11 @@ char *sender=rfc822_gettok(addresst);
line += " with ";
if (rfc3848_receivedwith && *rfc3848_receivedwith)
{
if (mf->smtputf8)
line += "UTF8";
line += rfc3848_receivedwith;
}
else
line += mf->module->name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment