[ Pobierz całość w formacie PDF ]
.mc file, you won't need to worry about S commands at all, asthe macros will build those for you.You will need to manually code your R rules.A sendmail ruleset therefore looks like:SnRlhs rhsRlhs2 rhs2Some Useful Macro Definitionssendmail uses a number of standard macro definitions internally.The most useful of these in writingrulesets are:$jThe fully qualified domain name of this host.$wThe hostname component of the FQDN.$m The domain name component of the FQDN.We can incorporate these macro definitions in our rewrite rules.Our Virtual Brewery configuration usesthe $m macro.The Lefthand SideIn the lefthand side of a rewriting rule, you specify a pattern that will match an address you wish totransform.Most characters are matched literally, but there are a number of characters that have specialmeaning; these are described in the following list.The rewrite rules for the lefthand side are:$@Match exactly zero tokens$*Match zero or more tokens$+Match one or more tokens$-Match exactly one token$=xMatch any phrase in class x$~xMatch any word not in class xA token is a string of characters delimited by spaces.There is no way to include spaces in a token, nor isit necessary, as the expression patterns are flexible enough to work around this need.When a rulematches an address, the text matched by each of the patterns in the expression will be assigned to specialvariables that we'll use in the righthand side.The only exception to this is the $@, which matches notokens and therefore will never generate text to be used on the righthand side.The Righthand SideWhen the lefthand side of a rewrite rule matches an address, the original text is deleted and replaced bythe righthand side of the rule.All tokens in the righthand side are copied literally, unless they begin witha dollar sign.Just as for the lefthand side, a number of metasymbols may be used on the righthand side.These are described in the following list.The rewrite rules for the righthand side are:$nThis metasymbol is replaced with the n'th expression from the lefthand side.$[name$] This metasymbol resolves hostname to canonical name.It is replaced by the canonical form of thehost name supplied.$(map key $@arguments $:default $)This is the more general form of lookup.The output is the result of looking up key in the mapnamed map passing arguments as arguments.The map can be any of the maps that sendmailsupports such as the virtusertable that we describe a little later.If the lookup isunsuccessful, default will be output.If a default is not supplied and lookup fails, the input isunchanged and key is output.$>nThis will cause the rest of this line to be parsed and then given to ruleset n to evaluate.The outputof the called ruleset will be written as output to this rule.This is the mechanism that allows rules tocall other rulesets.$#mailerThis metasymbol causes ruleset evaluation to halt and specifies the mailer that should be used totransport this message in the next step of its delivery.This metasymbol should be called only fromruleset 0 or one of its subroutines.This is the final stage of address parsing and should beaccompanied by the next two metasymbols.$@hostThis metasymbol specifies the host that this message will be forwarded to.If the destination host isthe local host, it may be omitted.The host may be a colon-separated list of destination hosts thatwill be tried in sequence to deliver the message.$:userThis metasymbol specifies the target user for the mail message.A rewrite rule that matches is normally tried repeatedly until it fails to match, then parsing moves on tothe next rule.This behavior can be changed by preceding the righthand side with one of two specialrighthand side metaymbols described in the following list.The rewrite rules for a righthand side loopcontrol metasymbols are:$@This metasymbol causes the ruleset to return with the remainder of the righthand side as the value.No other rules in the ruleset are evaluated.$:This metasymbol causes this rule to terminate immediately, but the rest of the current ruleset isevaluated. A Simple Rule Pattern ExampleTo better see how the macro substitution patterns operate, consider the following rule lefthand side:$*This rule matches Zero or more tokens, followed by the character.If this rule were applied to brewer@vbrew.com or Head Brewer , the rule would not match.The first string would not match because it does not include aThe default configuration file used is the /etc/mail/sendmail.cf file; you can specify analternate configuration file using the C argument.To test our configuration, we need to select a numberof addresses to process that will tell us that each of our mail-handing requirements are met.To illustratethis, we'll work through a test of our more complicated UUCP configuration shown in Example 18-2.First we'll test that sendmail is able to deliver mail to local users on the system [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • szamanka888.keep.pl