10.2 Rule Set 3In its initial form, rule set 3 looks like this:
S3 # preprocessing for all rule sets R$* < $* > $* $2 basic RFC822 parsing
As with rule set 0, the definition of rule set 3
begins with the The only rule in rule set 3 is composed of three parts, each separated from the others by one or more tab characters:
R$* < $* > $* $2 basic RFC822 parsing LHS tabs RHS tabs comment Note that we will now separate the tokens in the LHS with spaces (not tabs) to make the LHS easier to understand. Spaces always separate tokens, yet are never themselves tokens. 10.2.1 The LHS
The wildcard operator in this LHS, the
$+ @ $+ This LHS easily matches an address like you@here.us.edu in the workspace:
workspace LHS you $+ match one or more @ @ match exactly here $+ match one . or more us . edu This same LHS, however, does not match an address like @here.us.edu :
workspace LHS @ $+ match one here or more . us . edu @ match exactly, fails! $+
Because the
The
workspace LHS $* match zero or more (matches zero) @ @ match exactly here $* match zero . or more us . edu The LHS in rule set 3 matches anything or nothing, provided that there is a pair of angle brackets in the workspace somewhere:
R$* < $* > $* $2 basic RFC822 parsing For example, consider an address that might be given to sendmail by your MUA:
Your Fullname <you@here.us.edu> This address is tokenized and placed into the workspace. That workspace is then compared to the LHS:
workspace LHS Your $* match zero Fullname or more < < match exactly you $* match zero @ or more here . us . edu > > match exactly $* match zero or more
10.2.2 The RHS
Recall that the objective of rule set 3 is to strip everything
but the address part (the text between the angle brackets).
That stripping is accomplished by rewriting the workspace using the
R$* < $* > $* $2 basic RFC822 parsing strip all but the address
Remember, when a $
$* < $* > $* $1 $2 $3
workspace LHS RHS Your $* match zero $1 Fullname or more < < match exactly you $* match zero $2 @ or more here . us . edu > > match exactly $* match zero or more $3
This illustrates that the middle (second) 10.2.3 Test Rule Set 3Take a few moments to experiment. Observe the transformation of a user-specified address into one that sendmail can use. Add the following new rule set 3 to the rule sets in the client.cf file:
Now run
sendmail
again. Up to now, you have been testing rule set 0,
so you have specified a 0 following the
% As expected, the new rule causes everything except the "good" email address, the address between the angle brackets, to be thrown away.
Before we improve rule set 3,
take a few moments to experiment. Experiment by putting
the
As a closing note, recall that
sendmail
does the minimum matching possible when
comparing operators to the workspace. Although
Expecting operators to match more than they do can cause you to misunderstand the effect of rules. |
|