Name

MatchGECOS

Synopsis

The GECOS field is the portion of a passwd(5) file line that contains a user’s full name. Typical passwd file lines are illustrated here with the GECOS field of each highlighted in bold type:

george:Vnn9x34sEVbCN:101:29:George Washington:/usr/george:/bin/csh
bcx:/a88.97eGSx1l:102:5:Bill Xavier,,,:/usr/bcx:/bin/csh
tim:Fss9UdQl55cde:103:45:& Plenty (Jr):/usr/tim:/bin/csh

When sendmail attempts to deliver through a delivery agent that has the F=w flag set (F=w) it looks up the recipient’s name in the passwd file so that it can locate the user’s home directory. That lookup tries to match the login name, the leftmost field in the passwd file. If that lookup fails, and sendmail has been compiled with MATCHGECOS defined (MATCHGECOS) and this MatchGECOS option is true, sendmail also tries to match the recipient name to the GECOS field.

First, sendmail converts any underscore characters in the address into spaces and, if the BlankSub option is set (BlankSub), any characters that match that space substitution character into spaces. This makes the recipient name look like a normal full name.

Second, sendmail normalizes each GECOS entry by throwing away everything following and including the first comma, semicolon, and percent characters. It also converts the & to the login name wherever one is found.

After each GECOS name is normalized, it’s compared in a case-insensitive manner to the recipient. If they match, the passwd entry for that user is used.

This feature allows ...

Get Sendmail, 3rd 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.