|
|
The alias database exists in two forms.
One is a text form,
maintained in the file
/usr/lib/mail/aliases.
The aliases are of the form:
name:
name1, name2, ...
Only local names can be aliased.
For example:
eric@prep.ai.MIT.EDU: eric@CS.Berkeley.EDU
This does not have the desired effect. Aliases can be continued by starting any continuation line with a space or a tab, or by putting a backslash directly before the newline. Blank lines and lines beginning with a number sign (``#'') are comments.
The second form is processed by the ndbm(NS) or the Berkeley db library. This form is in the files /usr/lib/mail/aliases.db (if using Berkeley db) or /usr/lib/mail/aliases.dir and /usr/lib/mail/aliases.pag (if using ndbm). This is the form that sendmail actually uses to resolve aliases. This technique improves performance.
The control of search order is actually set by the service switch. Essentially, the entry
O AliasFile=switch:aliasesis always added as the first alias entry; also, the first alias file name without a class (for example, without ``nis:'' on the front) will be used as the name of the file for a ``files'' entry in the aliases switch. For example, if the configuration file contains
O AliasFile=/usr/lib/mail/aliasesand the service switch contains
aliases nis files nisplusthen aliases will first be searched in the NIS database, then in /usr/lib/mail/aliases, then in the NIS+ database.
You can also use NIS-based alias files. For example, the following specification will first search the /usr/lib/mail/aliases file and then the map named mail.aliases in my.nis.domain.
O AliasFile=/usr/lib/mail/aliases O AliasFile=nis:mail.aliases@my.nis.domain
Additional flags can be added after the colon exactly like a K line. For example:
OAnis:-N mail.aliases@my.nis.domainThis will search the appropriate NIS map and always include null bytes in the key.
The hash or dbm version of the database
can be rebuilt explicitly by executing the command:
/usr/bin/newaliases
This is equivalent to giving sendmail the -bi flag:
/usr/lib/sendmail -bi
If the RebuildAliases (old D) option is specified in the configuration, sendmail rebuilds the alias database automatically, if possible, when it is out of date. Auto-rebuild can be dangerous on heavily loaded machines with large alias files; if it might take more than the rebuild timeout (option AliasWait (old a) which is normally five minutes) to rebuild the database, there is a chance that several processes start the rebuild process simultaneously.
If you have multiple aliases databases specified, the -bi flag rebuilds all the database types it understands (for example, it can rebuild db databases but not NIS databases).
There are a number of problems that can occur with the alias database. They all result when a sendmail process accesses the DBM version while it is only partially built. This can happen under two circumstances: either one process accesses the database while another process is rebuilding it, or the process rebuilding the database dies (due to being killed or a system crash) before completing the rebuild.
The sendmail program includes three techniques to try to relieve these problems. First, it ignores interrupts while rebuilding the database; this avoids the problem of someone aborting the process and leaving a partially rebuilt database. Second, it locks the database source file during the rebuild, but this may not work over NFS or if the file is unwritable. Third, at the end of the rebuild it adds an alias of the form:
@: @(Note that this is not normally legal.) Before sendmail accesses the database, it checks to ensure that this entry exists. (The AliasWait option is required in the configuration for this action to occur. This should normally be specified.)
If an error occurs on sending to a certain address, say ``x,'' sendmail looks for an alias of the form ``owner-x'' to receive the errors. This is typically useful for a mailing list where the submitter of the list has no control over the maintenance of the list itself; in this case the list maintainer would be the owner of the list. For example:
mail-wizards: eric@ucbarpa, wnj@monet, nosuchuser, sam@matisse owner-mail-wizards: eric@ucbarpaThis would cause eric@ucbarpa to get the error that occurs when someone sends to mail-wizards, due to the inclusion of nosuchuser on the list.
List owners also cause the envelope sender address to be modified. The contents of the owner alias are used if they point to a single user, otherwise the name of the alias itself is used. For this reason, and to obey Internet conventions, a typical scheme would be:
list: some, set, of, addresses list-request: list-admin-1, list-admin-2, ... owner-list: list-request
To stop and restart sendmail: