[comp.unix.wizards] routed return addresses and sendmail

ramey@ti-csl.UUCP (08/18/87)

I am having trouble with routed addresses in sendmail.  We are running
Ultrix 2.0, but our sendmail is version 5.51 from 4.3bsd, plus the IDA
Enhancements, though our config file doesn't come from the IDA kit; it
has been hacked together from a number of different sources.

The problem is that CSNET has been giving us routed addresses lately
in the envelope, that is, it invokes sendmail with an argv something
like this:
	/usr/lib/sendmail -f @relay1,@relay2:user@host recipient

This works fine in most cases.  However, if there is an error, e.g.,
recipient is an unknown user, the return mail bounces.  Sendmail
breaks the address up around the comma (in sendtolist) and sends to
each one individually.

Another case which causes problems is with DECnet mail.  The DECnet
mailer gets the From: field from the envelope rather than the header,
so a VMS user gets something like
From: ULTRIX::"@relay1,@relay2:user@host"
When the user replies to this, the same thing happens as above, i.e.
the message is sent to both @relay1 and @relay2:user@host.

I tried fixing this a couple of ways.  First I modified the CSNET
pmdf-deliver program so that it added angle brackets around the
address after the -f switch (to sendmail).  That caused other
problems, so I tried adding a rule in ruleset 4 to add angle brackets
around routed addresses.  This also caused more problems than it
fixed.  Finally I started looking at the sendmail sources.  In
sendtolist(), sendmail tries to decide if it should consider comma or
space as the address delimiter.  Basically, if there is a comma,
semicolon, open angle bracket, or open parenthesis in the address it
uses commas to delimit addresses.  I changed this to be 
	( ',' && ':' ) || ';' || '<' || '('
assuming that addresses with a comma and a colon would be routed
addresses, and hence would be separated by spaces.  (Now that I think
about it, perhaps the first clause should be ( ',' && ':' && ! '<' )
so if there was a routed address with < > around it sendmail would
consider comma to be the delimiter.

I am not really sure that my fix was right, but so far it seems to
be correcting both my problems.  Perhaps someone with more knowledge
of sendmail could suggest another fix, or explain what is right/wrong
about my approach.

Joe Ramey
TI Computer Science Center
ti-csl!ramey
ramey@csc.ti.com (or ramey%csc.ti.com@relay.cs.net)