Полезная информация


sendmailSearch this book
Previous: 29.4 Rule Set 3Chapter 29
Rule Sets
Next: 29.6 Rule Set 0

29.5 Rule Set 4

Just as all addresses are first rewritten by rule set 3, so are all addresses rewritten last by rule set 4. Its job is to undo any special processing done by rule set 3, such as focusing. In this section we'll examine some typical rule set 4 rules.

29.5.1 Stripping Trailing Dots

Under some versions of sendmail a successful conversion to a fully qualified domain name leaves an extra dot trailing the result. This rule strips that dot:

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

Note that this rule recursively removes as many trailing dots as it finds. Also note that the host part remains focused after rewriting.

29.5.2 Restoring Source Routes

Recall that rule set 3 converted the commas of source route addresses into colons (see Section 29.4.3, "Handling Routing Addresses"). Rule set 4 now needs to restore those commas:

R$* : $+ :$+ <@ $+>       $1 , $2 : $3 <@ $4>            <route-addr> canonical

This rule recursively changes all but one (the rightmost) colon back into a comma.

As a special note, under V8 sendmail, envelope-sender route addresses are always surrounded by angle brackets when passed to the delivery agent. If this behavior is inappropriate for your site, beginning with V8.7 it is possible to prevent this heuristic by specifying the F=d delivery agent flag (see Section 30.8.16).

29.5.3 Removing Focus

Rule set 4 also removes angle brackets inserted by rule set 3 to focus on the host part of the address. This is necessary because mail will fail if they are left in place.

# externalize local domain info
R$* <$+> $*         $1 $2 $3                   defocus

29.5.4 Correcting Tags

After defocusing, rule set 4 may need to convert some addresses back to their original forms. For example, consider UUCP addresses. They entered rule set 3 in the form host!host!user. Rule set 3 rewrote them in the more normal user@host form, and added a .uucp to the end of the host. The following rule in rule set 4 converts such normalized UUCP addresses back to their original form:

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

Previous: 29.4 Rule Set 3sendmailNext: 29.6 Rule Set 0
29.4 Rule Set 3Book Index29.6 Rule Set 0