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


Previous Section Next Section

${currHeader}

Current header's value V8.10 and above

The ${currHeader} macro is given a value whenever a header-checking rule set is called. Header rule set checking is declared as part of the H configuration command, as for example:

LOCAL_RULESETS
HSubject: $>ScreenSubject

Here, sendmail will gather the text following the Subject: header in the mail message and supply that text to the ScreenSubject rule set. Usually, that text is treated as an address. All RFC comments are stripped and extra interior spaces are removed, but when you want that text to be supplied intact and as is to a rule set, you can employ this ${currHeader} macro.

To illustrate, consider the need to reject messages that have 10 or more consecutive spaces in the Subject: header. Such Subject: headers often indicate a spam message:

Subject: Rates DROPPED! Lenders COMPETE for mortgage LOANS!                     83419

One way to screen for such headers might look like this:

LOCAL_CONFIG
Ksubjspaces regex -a.FOUND [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]

LOCAL_RULESETS
HSubject: $>+ScreenSubject

SScreenSubject
R $*            $: $1 $(subjspaces $1 $)                        won't work
R $* . FOUND    $#error $@ 5.7.0 $: "553 Subject: header indicates a spam."
R $*            $: OK

The K line sets up a regular expression that will look for 10 consecutive space characters. The first rule in the rule set attempts to find 10 consecutive spaces in the workspace by passing the workspace to the subjspaces regular expression map.

But this won't work. The workspace contains the Subject: header's text after that text has been stripped of RFC comments, and after multiple consecutive spaces have been reduced to one space. Clearly, the reduction of spaces will prevent 10 consecutive spaces from being found. To make this screening work, the first rule needs to be rewritten like this:

R $*            $: $1 $(subjspaces $&{currHeader} $)           use this instead

Here, the subjspaces regular expression database map is instead given the value of the ${currHeader} macro. That value is the Subject: header's text without anything removed. All the original spaces are intact, and the spam message will be successfully rejected.

For another example of a use for this ${currHeader} macro, see Section 25.5.1.

    Previous Section Next Section