Rewrite Rule Control Sequences

Special control sequences can also appear in rewrite rule templates. These sequences impose additional conditions to the applicability of a given rewrite rule: not only must the pattern portion of the rewrite rule match the host/domain specification being examined, but other aspects of the address being rewritten must meet conditions set by the control sequence or sequences. For instance, the $E control sequence requires that the address being rewritten be an envelope address, while the $F control sequence requires that it be a forward-pointing address. Thus, the rewrite rule:

acme.com $U@mail.acme.com$E$F

only applies to (rewrite) envelope To: addresses of the form user@acme.com. If a domain/host specification matches the pattern portion of a rewrite rule but doesn't meet all of the criteria imposed by control sequences in the rule's template, then the rewrite rule fails and the rewriter continues to look for other applicable rules. This makes possible sets of rewrite rules such as:

acme.com $U@mail.acme.com$Nverify
acme.com $U%acme.com@verify-daemon

which results in messages to user@acme.com being passed to the directory channel. However, should the verify channel rewrite a message with the address user@acme.com, that message does not again pass through the verify channel. This then allows all mail to user@acme.com to pass through the verify channel and for the verify channel to send mail to that address without causing a mail loop.

A summary of control sequences is contained in TABLE 3-5.

TABLE  3-5   Summary of Template Control Sequences
Control Sequence
Effect on Rewrite Rule

$E  

Apply only to envelope addresses  

$B  

Apply only to header and body addresses  

$F  

Apply only to forward-directed (for example, To:) addresses  

$R  

Apply only to backward-directed (for example, From:) addresses  

$M channel  

Apply only if channel is rewriting the address  

$N channel  

Fail if channel channel is rewriting the address  

$Q channel  

Apply if sending to channel channel  

$C channel  

Fail if sending to channel channel  

$S  

Apply if host is from a source route  

$A  

Apply if host is to the right of the at sign  

$P  

Apply if host is to the right of a percent sign  

$X  

Apply if host is to the left of an exclamation point  

$? errmsg  

If rewriting fails return errmsg instead of the default error message  




Copyright © 1999 Sun Microsystems, Inc. All Rights Reserved.