nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 0ed82f58cd3869b3d0196b692c65685b8d1faf8b
parent 17dc89aeebb0dc3bdcab9a34da6d44c40fd337dc
Author: Leah Neukirchen <leah@vuxu.org>
Date:   Wed,  8 Apr 2020 23:30:59 +0200

qmail-remote: remove flagcname, deprecated feature

qmail-remote used to rewrite the RCPT TO: domain when it was a CNAME,
as it was common before 2001.

RFC 5321 (from 2008), Section 5.1 clearly specifies what MTA should do
today:

  The lookup first attempts to locate an MX record associated with the
  name. If a CNAME record is found, the resulting name is processed as
  if it were the initial name.

djb wrote in https://cr.yp.to/im/cname.html:

  Most implementors agree that this feature is not worth the
  implementation costs. I recommend that, before January 2001, sites stop
  relying on client-side CNAME translation, so that implementors can
  safely remove the feature at that time.

Fixes #120.

Diffstat:
MCHANGES.md | 1+
Mqmail-remote.c | 16++++------------
2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md @@ -1,3 +1,4 @@ +- 20200614 stop rewriting RCPT TO: domains when they are a CNAME (RFC 5321 5.1) - 20200523 doc: give text files .md extensions. - 20200523 cleanup: remove qsmhook, replaced by preline. - 20200520 remove wrappers for obsolete mail clients without maildir support diff --git a/qmail-remote.c b/qmail-remote.c @@ -275,15 +275,14 @@ void smtp() stralloc canonhost = {0}; stralloc canonbox = {0}; -void addrmangle(saout,s,flagalias,flagcname) +void addrmangle(saout,s,flagalias) stralloc *saout; /* host has to be canonical, box has to be quoted */ char *s; int *flagalias; -int flagcname; { int j; - *flagalias = flagcname; + *flagalias = 0; j = str_rchr(s,'@'); if (!s[j]) { @@ -296,13 +295,6 @@ int flagcname; if (!stralloc_cats(saout,"@")) temp_nomem(); if (!stralloc_copys(&canonhost,s + j + 1)) temp_nomem(); - if (flagcname) - switch(dns_cname(&canonhost)) { - case 0: *flagalias = 0; break; - case DNS_MEM: temp_nomem(); - case DNS_SOFT: temp_dnscanon(); - case DNS_HARD: ; /* alias loop, not our problem */ - } if (!stralloc_cat(saout,&canonhost)) temp_nomem(); } @@ -361,7 +353,7 @@ int main(int argc, char **argv) } - addrmangle(&sender,argv[2],&flagalias,0); + addrmangle(&sender,argv[2],&flagalias); if (!saa_readyplus(&reciplist,0)) temp_nomem(); if (ipme_init() != 1) temp_oserr(); @@ -371,7 +363,7 @@ int main(int argc, char **argv) while (*recips) { if (!saa_readyplus(&reciplist,1)) temp_nomem(); reciplist.sa[reciplist.len] = sauninit; - addrmangle(reciplist.sa + reciplist.len,*recips,&flagalias,!relayhost); + addrmangle(reciplist.sa + reciplist.len,*recips,&flagalias); if (!flagalias) flagallaliases = 0; ++reciplist.len; ++recips;