[comp.mail.sendmail] Ruleset 4

msir@uhura.cc.rochester.edu (Mark Sirota) (01/07/89)

This was posted April 1, 1988:
In message <Apr.1.18.00.05.1988.14969@athos.rutgers.edu> hedrick@athos.rutgers.edu (Charles Hedrick) writes:
> To see how sendmail is going to deliver mail to a given address, a
> reasonable thing to type is
> 	sendmail -bt
> 	0,4 address
> ...
> Finally, here is the exact sequence in which these rules are used.
> For example, the first line means that the destination specified in
> the envelope is processed first by rule 3, then rule 0, then rule 4.
> 
> envelope recipient:    3,0,4  [actually rule 4 is applied only to the
> 				user name portion of what rule 0 returns]
> envelope sender:       3,1,4
> header recipient:      3,2,xx,4  [xx is the rule number specified in R=]
> header sender:         3,1,xx,4  [xx is the rule number specified in S=]
>
> I have the impression that the sender from the envelope (the
> return-path) may actually get processed twice, once by 3,1,4 and the
> second time by 3,1,xx,4.  However I'm not sure about that.

Would anyone care to comment on any of that?

If I try this in ruleset 4:

# Insure entire address is in UUCP (!) format
R$+%$+.UUCP$*           $1@$2.UUCP$3            Change all %'s to @'s
R$+@$+.UUCP$*           $2!$1$3                 Change to UUCP format

This should work fine for sender and recipient addresses, but not for
envelope addresses.  Using /usr/lib/sendmail -bt, I get the following:
> 0,4 c%b.uucp@a.uucp
[From ruleset 0 down:]
rewrite: ruleset  0   input: "c" "%" "b" "." "uucp" "<" "@" "a" "." "uucp" ">"
rewrite: ruleset  0 returns: "^V" "uucp" "^W" "a" "^X" "c" "%" "b" "." "uucp"
rewrite: ruleset  4   input: "^V" "uucp" "^W" "a" "^X" "c" "%" "b" "." "uucp"
rewrite: ruleset  4 returns: "b" "!" "^V" "uucp" "^W" "a" "^X" "c"

I am finding that ruleset 4 is putting the "b!" before the entire
specification, not just at the beginning of the user portion.  ($1 includes
*everything* before the @, not just what's in the "user" portion.)

Looking through lots of other sendmail.cf's, which do similar things
to what I've described above, I'm beginning to doubt that ruleset 4 is
indeed called after ruleset 0.  What is the truth on this matter?
(Perhaps Mr. Hedrick was April Fools'-ing?)
-- 
Mark Sirota - University of Rochester, Rochester, NY
 Internet: msir@cc.rochester.edu
 Bitnet:   msir_ss@uordbv.bitnet
 UUCP:     ...!rochester!ur-cc!msir

piet@ruuinf (Piet van Oostrum) (01/14/89)

In article <619@ur-cc.UUCP>, msir@uhura (Mark Sirota) writes:
`This was posted April 1, 1988:
`In message <Apr.1.18.00.05.1988.14969@athos.rutgers.edu> hedrick@athos.rutgers.edu (Charles Hedrick) writes:
`> To see how sendmail is going to deliver mail to a given address, a
`> reasonable thing to type is
`> 	sendmail -bt
`> 	0,4 address
`> ...
`> Finally, here is the exact sequence in which these rules are used.
`> For example, the first line means that the destination specified in
`> the envelope is processed first by rule 3, then rule 0, then rule 4.
`> 
`> envelope recipient:    3,0,4  [actually rule 4 is applied only to the
`> 				user name portion of what rule 0 returns]
`> envelope sender:       3,1,4
`> header recipient:      3,2,xx,4  [xx is the rule number specified in R=]
`> header sender:         3,1,xx,4  [xx is the rule number specified in S=]
`>
`> I have the impression that the sender from the envelope (the
`> return-path) may actually get processed twice, once by 3,1,4 and the
`> second time by 3,1,xx,4.  However I'm not sure about that.
`

In article <KARL.89Jan10111212@triceratops.cis.ohio-state.edu>, karl@triceratops (Karl Kleinpaste) writes:
`
`Ultimately, an address gets near the end of S3 with the potential for
`not having been taken care of by the above sorts of rules.  So my S3
`ends like this (after some intervening stuff taking care of a lot of
`deeply weird special cases):
`
`# Final cleanup: Make sure it's bracketed and @ified.
`R$+<$*>$*		$@$1<$2>$3		already <>'d; leave be
`R$+@$*			$@$1<@$[$2$]>		already @ified; add <>
`R$+			$@$1<@$D>		u => u@domain
`
`The final line is what makes sure that outbound mail always has the
`Right Thing.  $D in my case is cis.ohio-state.edu, so it's guaranteed
`to leave a reasonable FQDN in the right places.  If I weren't hiding
`hostnames, I would probably use $w or $w.$D or somesuch.
`

We have a problem that's related to this one.

What we wanted is adding our domain to local names in To: and Cc: fields.
The rule is:
R$-	$-	$@$1.$D.$U
First we did that in ruleset 4. It appeared that local mail didn't work
anymore. Apparently the user name that is passed to /bin/mail got munged
through ruleset 4. We checked that with de debug option :-).

So we put the rule in the R rules in the uucp mailer. The next problem was
that mail to our uucp connections no longer worked. Mail to uucphost!user
got the rmail command as rmail user@cs.ruu.nl (so their user name with our
domain name). This even happened for mail passing us. The reason apparently
being the same: The $u value is passed through rules 2, R, 4.

So we tried to put the rule in S3. No way, it got into a loop (Essentially,
it is recognized as local, at the end of rule 0 the local domain is
stripped off, and then it goes back to rule 0 and 0). This may be a problem
of our (vendor-supplied) sendmail,cf that calls S15 at the end of S0
processing, S15 calls S3 and S0.

Every time we try to make a minor change, we get stuck somewhere. Could
anybody give us a copy of a simple, but complete configuration file for a
site similar to the following:

We have a few uucp connections, and a local ethernet (with hosts known from
the file etherhosts)

Our domain is cs.ruu.nl, hostname is ruuinf.
All xxx.cs.ruu.nl goes to the ethernet
All yy.ruu.nl goes by uucp to accumv!
All unkown stuff goes by uucp to hp4nl!
-- 
Piet van Oostrum, Dept of Computer Science, University of Utrecht
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
Telephone: +31-30-531806. piet@cs.ruu.nl (mcvax!hp4nl!ruuinf!piet)