[net.mail] a common sendmail.cf bug

essick@uiucdcsb.Uiuc.ARPA (09/06/85)

Here's a bug that is probably in most people's sendmail.cf.  It
involves turning user%host into user@host.

The stock berkeley ruleset 3 has the line:

R$+%$+			$@$>6$1<@$2>			user%host

Which works fine for "user%host" but doesn't work so well when
the address is something like "user%host%host2". It hands
back "user@host%host2" instead of "user%host@host2".  I prefer
to use the following 3 rules to handle the multiple-% case.

R$+%$+			$:$1<@$2>			user%host
R$+<@$+%$+>		$1%$2<@$3>			fix user%host%host2
R$+<@$+>		$@$>6$1<@$2>			get outta here

A quick way to find out if your configuration does this correctly
is to try:

	% /usr/lib/sendmail -bt
	> 0 user%this%that%other

and see what that gives you when ruleset 3 returns.

-- Ray Essick, University of Illinois
-- essick@uiuc.arpa,  {ihnp4, convex, philabs}!uiucdcs!essick

fair@ucbvax.ARPA (Erik E. Fair) (09/08/85)

This is not a bug; you should be using route address to begin with
(messy as they are). The percent syntax is a non-standard hack, to get
around the fact that RFC822 specifically prohibits multiple `@' in an
address with the exception of a route address. If you are trying to use
more than one percent sign, you're going to get bounces, because it
isn't in the standard.

I think it's long past the time that unofficial gateways to non-internet
networks start using route addresses. Examples:

user%host.BITNET@WISCVM.ARPA 	=>	@WISCVM.ARPA:user@host.BITNET
user%host.CSNET@CSNET-RELAY.ARPA =>	@CSNET-RELAY.ARPA:user@host.CSNET
user%host.DEC@DECWRL.ARPA	=>	@DECWRL.ARPA:user@host.DEC

This is carefully defined in RFC822, a standard that is going to have
its third birthday in five days. If a host on the internet does the
wrong thing with any of the above route address examples, you have a
legitimate right to complain to the postmaster of that site, and the
person who implemented the mailer that they use (so rarely one in the
same person). Comments from the gateway maintainers?

	Erik E. Fair	ucbvax!fair	fair@ucbarpa.BERKELEY.EDU

root@topaz.RUTGERS.EDU (Charles Root) (09/09/85)

Alas, @DECWRL.ARPA:user@host.DEC is not legal according to The
Official Interpretation of RFC822.  In a route address, all of the
things after @ must be legal host names.  In order to a legal host
name, it must be registered with the NIC, or possibly these days part
of a domain that is sanctioned by NIC and has the necessary redundant
domain servers.  This syntax is not like the UUCP !.  With
foo!bar!baz, as long as you know what foo is, you don't need to know
anything about bar and baz.  It suffices for each host to know the
next one.  Under RFC822, all addresses are absolute.  The original
sender must know (or at least be able to find out using domain
servers) the Internet addresses for all of the hosts in the path.
Clearly this makes the syntax somewhat less useful that it first
appeared to be.  That is why % was invented in the first place.
Believe me, it was not because people were too lazy to implement the
RFC822 route address syntax.  I had a complete implementation of it
for TOPS-20, and was told I couldn't use it, at least not in any way
that accomplished anything useful.  The people behind TCP specifically
did not want to supply any equivalent of the UUCP !.

jim@hwcs.UUCP (Jim Crammond) (09/12/85)

In article <10306@ucbvax.ARPA> fair@ucbvax.ARPA (Erik E. Fair) writes:
>This is not a bug; you should be using route address to begin with
>(messy as they are). The percent syntax is a non-standard hack, 

Sendmail has severe problems translating addresses into rfc822 style
because of commas and angle brackets.

Firstly, note that percent syntax is not a non-standard hack. It is
defined in the UK's Greybook protocol and I think is used in CSNET too.
Thus gateways from these networks to real 822 sites should convert address
styles.  Unfortunately sendmail gets into a bit of a mess over this when
converting headers because a proper translation should look like:

user%domain1%domain2@domain3  =>  user <@domain3,@domain2:user@domain1>

Sendmail only passes what's inside the angle brackets to the rulesets.
It rewrites this bit then restores the rest of header (including angle
brackets, if any).

So, if you add angle brackets within the rulesets then the final address
in the headers could have 2 layers of angle brackets - this causes the next
mailer down the line to barf since you can't nest angle brackets!

If you don't add angle brackets then you could break the address into two:
"@domain3,@domain2:user@domain1"  becomes two comma separated addresses
"@domain3" and "@domain2:user@domain1". This usually means the next mailer
down the line sends the mail to domain2 okay (not necessarily via domain3)
and also returns the message with "@domain3... User Unknown".


Fortunately, most real gateways between percent and 822 sites use MMDF....
-- 
-------------
-Jim Crammond		JANET:	jim@UK.AC.hw.cs
			UUCP:	jim@hwcs.uucp  or  ..!ukc!hwcs!jim
			ARPA:	jim@cs.hw.ac.uk