switch

Build sequences based on service switch V8.7 and later

The switch database-map type is used internally by sendmail to create sequence types of database maps based on external service-switch files. The lines inside a service-switch file look like this:

service     methodA methodB

as, for example:

aliases   files nis

This line tells sendmail to search for its aliases in files first, and then using NIS.

To illustrate the switch type, consider the need to look up aliases inside rule sets in the same way that sendmail looks up its own aliases. To do this, you would declare a switch database map. For example:

Kali switch aliases

This causes sendmail to search for the service named aliases in the service-switch file. In this example it finds such a line, so for each how that follows the aliases in that line, sendmail creates a new database map with the name ali followed by a dot and the how:[354]

aliases   files    becomes →    ali.files
aliases   nis      becomes →    ali.nis

These named database maps are then sequenced for you. Recall that sequence database maps are declared like this:

Kname sequence  map1  map2,...

The name given to the sequence is ali. In our example, the following sequence is automatically created for you from your original switch declaration:

Kali sequence ali.files ali.nis

In rule sets, when you look up aliases with the ali database map:

R...        $( ali $1 $)
                ↑
          the sequence named ali

you will use the sequence named ali that was automatically built for you from a combination of your original switch definition ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.