home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


sendmail

sendmailSearch this book
Previous: 17.3 Rule Set 0 Chapter 17
The Hub's Complex Rules
Next: 17.5 Things to Try
 

17.4 Rule Set 4

Rule set 4 cleans up after all the other rule sets. In general it attempts to undo anything done by rule sets 3 and 96. Recall that rule set 96 looked up the canonical name and appended a dot to any that it found. Any bogus trailing dots need to be stripped away, and that is what rule set 4 does:

# strip trailing dot off possibly canonical name
R$* < @ $+ . > $*       $1 < @ $2 > $3

Recall that UUCP addresses were converted from their host!user form into a .UUCP pseudo domain. Rule set 4 returns them to their original form:

# UUCP must always be presented in old form
R$+ @ $- . UUCP         $2!$1                           u@h.UUCP => h!u

Recall also that rule set 3 focused on the host part of the address. Rule set 4 will defocus:

R$* < $+ > $*           $1 $2 $3                        defocus

Depending on how ambitious the other rules are, rule set 4's job can be easy or hard. In general, processing any address with the sequence 3 then 4 should leave all but extraordinary addresses (such as the null address) unchanged:

% 

/usr/lib/sendmail -bt


ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 

3,4 user@host


rewrite: ruleset  3   input: user @ host
rewrite: ruleset 96   input: user < @ host >
rewrite: ruleset 96 returns: user < @ host >
rewrite: ruleset  3 returns: user < @ host >
rewrite: ruleset  4   input: user < @ host >
rewrite: ruleset  4 returns: user @ host
> 

3,4 user@host.domain


rewrite: ruleset  3   input: user @ host . domain
rewrite: ruleset 96   input: user < @ host . domain >
rewrite: ruleset 96 returns: user < @ host . domain >
rewrite: ruleset  3 returns: user < @ host . domain >
rewrite: ruleset  4   input: user < @ host . domain >
rewrite: ruleset  4 returns: user @ host . domain
> 

3,4 host!user


rewrite: ruleset  3   input: host ! user
rewrite: ruleset 96   input: user < @ host . UUCP >
rewrite: ruleset 96 returns: user < @ host . UUCP . >
rewrite: ruleset  3 returns: user < @ host . UUCP . >
rewrite: ruleset  4   input: user < @ host . UUCP . >
rewrite: ruleset  4 returns: host ! user