Database maps can be used to look up information in databases, to perform transformations (such as dequoting), to perform computations, and to store values into macros. In their database role, they offer these advantages:
Information can be easily changed without having to restart sendmail because database information is external to the configuration file.
The sendmail program starts up faster because only the location of the information is stored at startup, not the information itself.
Rules are made more versatile because database information can be used in the RHS of rules. Class macros are still of use in the LHS.
To fully appreciate sendmail databases, consider the only alternative, the F configuration command. For example, mail that is sent via UUCP is a typical application that requires lists of information:
Here, the external file /etc/mail/uuhosts contains a list of UUCP hosts connected to the local machine. If the list rarely changes, the F command is appropriate. On the other hand, if the list is volatile and changes often, the F command has drawbacks. The file /etc/mail/uuhosts is read only when the configuration file is processed. Any change to that file is ignored by a running sendmail (such as the daemon). To make the change effective, the daemon needs to be restarted.
In such volatile situations, storing UUCP information in a database is preferred. A change to a database is immediately available to the running daemon, eliminating the need to restart.
V8 sendmail is designed to rewrite addresses on the basis of information looked up in external databases or in its internal symbol table. It can use a wide variety of database forms, ranging from ndbm(3) files (dbm) to Hesiod network database maps (hesiod). The K configuration command (Section 23.2) is used to declare the name, location, and other parameters of databases or to modify use of its symbol table.
In its nondatabase role, database maps can also be used to perform a wide range of services that make the use of rules and rule sets easier and more versatile. For example, database-maps can be used to:
Assign a value to a macro
Log information using the syslog facility
Perform mathematical computations and comparisons
Remove quotation marks from quoted strings
The $( and $) database-map operators (Section 23.4) are used in the RHS of rules to access and utilize the information produced by all the database-map roles.