>The following patch is taken from IDA, I am not sure why they try null-terminated strings but decided to include that part. This is a context diff from a previously unmodiffied alias.c from berkeley 5.65, as usual your mileage may differ!
The aliases database is a specific case of a general dbm database, provided
that sendmail is compiled with some sort of database support (else it is
implemented in the sybmol table).
Older versions of sendmail provide a redundant '\0' at the end of the key
and datum strings. It is redundant because the length field is sufficient to
determine the end of the string. (using the length field also permits a '\0'
character to be stored in the database) Obviously, database size can be
reduced by not including the redundant '\0' character at the end of each key
and datum.
Checking for the '\0'-terminated string is done for two reasons:
1) if the database was generated with an old sendmail binary, that's
the way it was stored (i.e. it is done for backward compatibility).
2) some implementations of NIS (a.k.a. YP) support programs fail if the
redundant '\0' is not there (i.e. for compatibility with backward
programs 1/2 :-). If you use any of these support programs, either
compile sendmail to pad (all) databases with '\0', or scream at your
supplier to provide fixes for their programs. By the way, it appears
that sendmail version 6.x provides the option of '\0'-terminated
strings on a per-database basis, as well as a hack to force the
'\0'-termination if the database is an NIS aliases database.
Both verbatim and lower-cased versions of the key are used to support both
case-sensitive and case-insensitive lookups (previously everything was
supposed to be case-insensitive[!]). Using all lower-case letters in the
aliases file will result in a case-insensitive match, while any upper-case
letters in the aliases file must be matched by a corresponding upper-case
character. E.g. if the aliases file has the lines
postmaster:root
MAILER-DAEMON:root
then "postmaster" will be matched in a case-insensitive manner[*], but
"MAILER-DAEMON" will only match "MAILER-DAEMON", not "mailer-daemon".
All 4 cases which result from using the verbatim string or the
'\0'-terminated extension, and the given case or lower-cased string are
tested by the UIUC/IDA code.
All database lookups use the length field to determine the extent of the
string (note that there might still be problems when sprintf'ing such
strings using "%s", that is, strings containing an embedded '\0' will be
prematurely truncated (that's a printf() "feature")).
! this was achieved by converting all strings to lower-case before
storage, and by converting all keys to lower-case before an attempted
retrieval. It was therefore impossible to distinguish "Foo" from "foo", and
there were some problems with systems that support user names which can
contain upper-case characters.
* i.e. "Postmaster", "PoStmAster", etc. will all match (as required
for the reserved local-part "postmaster").
P.S. some people may find articles easier to read if long lines are folded.