[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rmail loses



When processing incoming UUCP mail, rmail expects to see old-fashioned
From_ headers -- like this:

>From user  date remote from host
>From user2  date2 remote from host2

rmail turns those headers into a sender address of host!host2!user2.
So far, so good.

Some sites -- notably UUNET -- don't send old-fashioned headers.  Instead,
they send a valid envelope sender address right there in the From_ line,
and omit the remote from:

>From user@site.dom.ain  date

At some point, Rayan made some interesting decisions in the rmail code.
The first decision was that if there's no remote from in the From_ line,
the mail must have come from a brain-dead smart mailer, probably uunet.
So rmail defaults the "remote from" to uunet if none is present.  The other
-- and this is the nasty one -- is that if an @ sign appears in the From_
line address, the path must need to be written as a source-route instead of
a bang path.

WRONG!

I ended up seeing monstrosities from a neighbouring site like this:

from @sonic:user@moon.nbn.com

Which is wrong for two reasons - moon is my neighbour and sonic is downstream
from them, and it's simply illegal to use a source route in this case.
RFC822 stipulates that each component in a source route must be a fully
qualified domain name.  This one obviously is not.

If your UUCP neighbour is running a smart mailer that puts a valid
domain-style sender address in the From_ line, that address should be safe
to use verbatim.  I haven't seen one yet that wasn't.  So all you need to
do is edit compat/rmail/rmail.c and find the following bit of code:

                cp = fl[flmax-1]->address;
                if (cp != NULL && strchr(cp, '@') != NULL) {
-                       for (i = 0; i < flmax; ++i) {
-                               (void) fprintf(mfp, "@%s%s%c",
-                                   PRINTABLE(fl[i]->remotehost, somewhere),
-                                   ((i == 0 && fl[i]->remotehost != NULL
-                                     && strchr(fl[i]->remotehost, '.') == NULL)     ? ".uucp" : ""),
-                                       ((i == flmax-1) ? ':' : ','));
-                       }
                } else {

The loop I marked with hyphens should be ripped out by the roots.
(I took the lazy way out and changed i = 0 to i = flmax, which just
short-circuits it.)  This has been working fine for me for a few days
now.

w.