Mailing List Archive

An intelligent rmail for qmail?
Has anyone seen an intelligent rmail that can at least somewhat fix up
incoming mail headers from UUCP people so that qmail doesn't choke on them?

I'm trying to get my customers to convert over 100% domain based mail,
but particularly the DOS packages still send out the sender as a UUCP
bang-path. It would be great if there was an rmail that could patch it
up, something like:

given client!next-hop!person

if client has dots, rewrite as next-hop!person@client
else lookup client in nodename-to-FQDN table, rewrite as
next-hop!person@client-FQDN

Evan
--
Evan Champion * Director, Network Operations
mailto:evanc@synapse.net * Directeur, Exploitation du reseau
http://www.synapse.net/ * Synapse Internet
Re: An intelligent rmail for qmail? [ In reply to ]
On Thu, 27 Feb 1997, Mark Delany wrote:

> I've got a relatively un-intelligent one that converts ! addressing. It's
> biggest weakness is not extracting the envelope sender address from the
> "From " line. I'm in two minds as to whether to bother about this as half of
> the "From " lines I see have bogus addresses.

It looks like most of the stuff I'm seeing come in has valid Internet
From:/To: but the sender is wrong. I'm strongly considering changing my
rmail to forget about the sender and just put out the From: again.

Evan
--
Evan Champion * Director, Network Operations
mailto:evanc@synapse.net * Directeur, Exploitation du reseau
http://www.synapse.net/ * Synapse Internet
Re: An intelligent rmail for qmail? [ In reply to ]
On Thu, 27 Feb 1997, Mark Delany wrote:

> Agreed. If I didn't say that, that's what I meant to say. The problem with
> putting out the From: again as an envelope sender is the obvious problem of
> mail lists and mail that has been aliased etc. In general it is not
> particularly safe to do excepting when you know that the uucp site only
> originates mail, rather than relays it.

How does this sound:

if sender contains an @, leave it.
else replace with From:

If people want to run mailing lists, they can get a decent mail package
that puts out proper sender lines.

Evan
--
Evan Champion * Director, Network Operations
mailto:evanc@synapse.net * Directeur, Exploitation du reseau
http://www.synapse.net/ * Synapse Internet
Re: An intelligent rmail for qmail? [ In reply to ]
>>>>> "Evan" == Evan Champion <evanc@synapse.net> writes:

Evan> Has anyone seen an intelligent rmail that can at least somewhat
Evan> fix up incoming mail headers from UUCP people so that qmail
Evan> doesn't choke on them?

I just wrote something like that. It's running for about 4 days now on
my site (a 100-200 messages per day UUCP leaf site). I intended the
program mainly for my uplink; I'll install qmail there shortly.

My rmail tries to convert any bangpaths it gets as arguments (ie. the
recipient list) and the bangpath found in the "From "-header if
present and in the first line. If the conversion fails for a recipient
address, it aborts.
Qmail-inject is then invoked with the mail on stdin, the converted
recipient list as argument and QMAILS(HOST|USER) set to what could be
gathered from the From header.

I implemented the bangpath conversion as follows:

Say the bangpath is otherhost!host!user.

The "otherhost!" part is discarded.
If "host" contains dots, "user@host" is used.
If "host" does not contain dots, rmail searches in a file for a FQDN
where "host" matches the first part of FQDN, if found "user@FQDN" is
used.
Otherwise it fails.

If anyone is interested, let me know and I'll send it to you. Note
however that it's my first serious C program and that I used a load of
GNU extensions to the C library.

I also wrote a little program that produces a list of FQDNs when given
the output of named-xfer.

Leo
Re: An intelligent rmail for qmail? [ In reply to ]
On Thu, 27 Feb 1997, Mark Delany wrote:

> From synapse.net!evanc
> would be good whilst:
> From evanc at ttyp1
> would be erg and:
> From synapse!evanc
> would be likewise erg.

Ok, here is a little program which takes an arbitrary bang path and
turns it in to the shortest (optimal) equivalent standard Internet
address. It will add the default domain if the final address doesn't
have a FQDN. This should be replaced by a lookup which would translate
the UUCP nodename in to a FQDN (so for example synapse!evanc could be
translated to evanc@synapse.net). It's currently hardcoded for synapse.net.

A few examples:

evanc can't do anything with this
clarinet!evanc evanc@clarinet.synapse.net
piano!clarinet!evanc evanc%clarinet@piano.synapse.net
piano!clarinet.synapse.net!evanc evanc@clarinet.synapse.net
mira.net.au!markd markd@mira.net.au

I don't know if strsep() is available everywhere. Just replace it with
strtok() if you don't have strsep(); they're almost equivalent. Just run
it with the bangpath you want to translate as the argument.

#include <string.h>
#include <stdio.h>

char *buf[30];
char address[256];

int main(int argc, char **argv) {
int i,nb,hasdot;

for (nb = 0; (buf[nb] = strsep(&argv[1], "!")) != NULL; ++ nb);
if (nb == 1) {
printf("I can't do anything with this.\n");
return 1;
}

strcpy(address, buf[nb - 1]);

for (i = nb - 2, hasdot = 0; i > 0; -- i) {
if (strchr(buf[i], '.') != NULL) {
hasdot = 1;
break;
}

strcat(address, "%");
strcat(address, buf[i]);
}

strcat(address, "@");
strcat(address, buf[i]);

if (! hasdot) {
strcat(address, ".synapse.net");
}

printf("%s\n", address);

return 0;
}

It does a lot more work than it probably should, but that's why we buy
these big CPU's :-)

> Going beyond that is very much "diminishing returns" country methinks. Have
> a look at what the sendmail distribution of rmail does for the pain that one
> can inflict on oneself. Or the "From " detection macro in qpopper for that
> matter...

I don't even know why it bothers to do all that work when it passes a
bang-pathed address anyway. It seems sort of silly to me.

Evan
--
Evan Champion * Director, Network Operations
mailto:evanc@synapse.net * Directeur, Exploitation du reseau
http://www.synapse.net/ * Synapse Internet
Re: An intelligent rmail for qmail? [ In reply to ]
I've got a relatively un-intelligent one that converts ! addressing. It's
biggest weakness is not extracting the envelope sender address from the
"From " line. I'm in two minds as to whether to bother about this as half of
the "From " lines I see have bogus addresses.

Perhaps the biggest source of email to postmaster is undeliverable mails
that have undeterminable sender addresses.


At 11:58 AM 2/26/97 -0500, Evan Champion wrote:
>Has anyone seen an intelligent rmail that can at least somewhat fix up
>incoming mail headers from UUCP people so that qmail doesn't choke on them?
>
>I'm trying to get my customers to convert over 100% domain based mail,
>but particularly the DOS packages still send out the sender as a UUCP
>bang-path. It would be great if there was an rmail that could patch it
>up, something like:
>
> given client!next-hop!person
>
> if client has dots, rewrite as next-hop!person@client
> else lookup client in nodename-to-FQDN table, rewrite as
> next-hop!person@client-FQDN
>
>Evan
>--
>Evan Champion * Director, Network Operations
>mailto:evanc@synapse.net * Directeur, Exploitation du reseau
>http://www.synapse.net/ * Synapse Internet
>
>
>
>
Re: An intelligent rmail for qmail? [ In reply to ]
Agreed. If I didn't say that, that's what I meant to say. The problem with
putting out the From: again as an envelope sender is the obvious problem of
mail lists and mail that has been aliased etc. In general it is not
particularly safe to do excepting when you know that the uucp site only
originates mail, rather than relays it.


At 04:01 PM 2/26/97 -0500, Evan Champion wrote:
>On Thu, 27 Feb 1997, Mark Delany wrote:
>
>> I've got a relatively un-intelligent one that converts ! addressing. It's
>> biggest weakness is not extracting the envelope sender address from the
>> "From " line. I'm in two minds as to whether to bother about this as
half of
>> the "From " lines I see have bogus addresses.
>
>It looks like most of the stuff I'm seeing come in has valid Internet
>From:/To: but the sender is wrong. I'm strongly considering changing my
>rmail to forget about the sender and just put out the From: again.
>
>Evan
>--
>Evan Champion * Director, Network Operations
>mailto:evanc@synapse.net * Directeur, Exploitation du reseau
>http://www.synapse.net/ * Synapse Internet
>
>
>
Re: An intelligent rmail for qmail? [ In reply to ]
At 04:25 PM 2/26/97 -0500, Evan Champion wrote:

>How does this sound:
>
>if sender contains an @, leave it.
>else replace with From:

I'd be a bit more specific. If sender address (deduced from the "From " line)
can be made to contain a reasonably feasable FQN then use it, else use a
default for that site. Thus:

From synapse.net!evanc
would be good whilst:
From evanc at ttyp1
would be erg and:
From synapse!evanc
would be likewise erg.

I wouldn't get carried away with "reasonably feasable". My rule would be
something like:

if ((at = strchr(deduced_from, '@') && (strchr(at, '.')) accept();

(If there's an @ and at least one dot following, accept it)

Going beyond that is very much "diminishing returns" country methinks. Have
a look at what the sendmail distribution of rmail does for the pain that one
can inflict on oneself. Or the "From " detection macro in qpopper for that
matter...



Regards.