[comp.bugs.4bsd] sendmail bug or feature

lindberg@chalmers.UUCP (08/17/87)

A contest for all Sendmail Gurus: Is this a bug or feature?

    Host:	VAX 11/780
    System:	UNIX, MtXinu 4.3BSD with NFS
    Program:	/usr/lib/sendmail, distributed version 5.51

MtXinu 4.3BSD sendmail applies the mailer's Recipient-rule (R=,
used for To:, Cc: etc) on the "user" part of the Rule Zero address.
Unfortunately this behaviour breakes all attempts to handle uucp
mail with correct "Cc:" addresses. If we look at the result of
sendmail parsing an address we get (to ease reading I've dropped
the real syntax):

    In 4.2 - Rule S0:
	foohost!foo -> uucp:  uux - -r foohost!rmail (foo)

    In 4.3 - Rule S0:
	foohost!foo -> uucp:  uux - -r foohost!rmail (R-rewrite(foo))

As far as I know, the Recipient rule is mostly used to handle "Cc:"
addresses (in principle it also deals with "To:" but those addresses
are already correct, or the mail wouldn't have reached the uucp mailer
anyway). If we send a mail with

    To: foohost!foo
    Cc: bar

we of course want "foohost!foo" to receive a mail containing

    To: foohost!foo
    Cc: ourhost!bar

so that his "reply" works correctly. To do so, we have to use the
mailer's Recipient-rule (R=), catch all names that do not contain
a "!" or "@" and tack on our hostname (creating "ourhost!bar").

Then, however, rule S0 gives:

	foohost!foo -> uucp:  uux - -r foohost!rmail (ourhost!foo)

which, mildly said, isn't what we wanted!


The fix is quite simple: Around line 921 in parseaddr.c we find:

	/* rewrite according recipient mailer rewriting rules */
	rewrite(++tv, 2);
   ->	if (m->m_r_rwset > 0)
   ->		rewrite(tv, m->m_r_rwset);
	rewrite(tv, 4);

Simply remove the two lines marked with "->". This is the same as
having an empty R= rule so it should be quite safe (it does work
OK here).


Finally, a few questions:

    +	Is my interpretation of how to use the R= rule wrong, or
	is this really a bug? It wasn't there in 4.2BSD...
    
    +	If we don't handle "Cc" in the R= rule, where should it be
	taken care of? How do you do it?
    
    +	Is this even a feature? If so, could someone please explain
	its usage to me?


    Gunnar Lindberg
    Department of Computer Science
    Chalmers University of Technology
    S-412 96 Gothenburg, SWEDEN
    lindberg@cs.chalmers.se, lindberg@chalmers.{UUCP,CSNET,SUNET}