SUMMARY: escaping mail aliases

From: Lyndon C. Lim (
Date: Tue Oct 04 1994 - 05:23:45 CDT

i had posted the following problem:

> we have formal name aliases in our NIS database.
> for example, though i prefer my email to be addressed
> to, our aliases database also will
> recognize also, for several of
> our users, commonly misspelled renditions of their names
> are recognized. the problem i am encountering is that
> the From: field in the header of outgoing mail often
> contains those aliases, even the misspelled names.

i had 3 replies, which explained the problem, and of which
2 proposed a solution. i implemented the second one since
it was closer to what was already in our aliases file.

special thanks to:

hal stern
matt hofener

the responses are short enough that i appended them below:
We do the same type of alias inversion. The problem is that since you have
multiple aliases resolving to exactly the same thing on the right (or, at
least the same number of tokens) in your aliases file (and subsequently your
mail.aliases map), the reverse alias map (mail.byaddr) is having trouble
creating a one-to-one map. In other words, it must choose from a set of
aliases all with the same thing to the right of the colon.
To see this, look at your aliases maps:
        % ypcat -k mail.aliases
        (regular aliases are displayed)
        % ypcat -k mail.byaddr
        (reverse aliases are displayed)
The interesting map is the second one. Note that some usernames are resolved
to their formal name alias, whereas others might be resolved to a common
mispelling alias.
To understand why this happens, look at your sendmail configuration file
(/etc/ on the mailhost. Look at the way it does alias inversion.
Mine first translates single tokens ($-, the "username") to $-@mailhost.
Then, if the address looks like $-@$-, it applies alias inversion, looking for
an alias whose right side matches and substitutes the left side. So you end
up with something like formal_alias@mailhost. It goes from there and tacks on
the domain name, etc.
To solve the problem, you need each alias to resolve to something different
on the right. You might consider adopting the following format for your
aliases file:
        # Formal name aliases:
        jane_doe: jadoe@mailhost
        jim_doe: jidoe@mailhost
        john_doe: jodoe@mailhost
        # Common misspellings:
This way the mail.byaddr map has a one-to-one mapping, and when sendmail looks
for an address matching $-@$- for alias inversion, it will only find one
alias - the formal name alias.
Since everyone's is different, take some time to figure out yours.
It may be looking for a slightly different format for alias inversion, in
which case you must modify your /etc/aliases format.
Hope this helps,
Matt Hofener
you're probably doing out-going address rewriting in
if you have an alias of the form:
        lyndon_lim: lyndon

and *you* send mail off-site (as lyndon), it gets rewritten
as to turn this off, either turn off
the address rewriting, or re-arrange your aliases file so
that the *only* name you want exported is on the RHS of
an alias:

        lindon: lyndon_lim
        lyndon_limm: lyndon_lim
        lindonn: lyndon_lim
        lyndon_lim: lyndon@hishost

and mail from "lyndon@hishost" will be translated once,
correctly -- none of the others will match an originating


This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:11 CDT