$_

RFC1413 validation and IP source route V8.1 and later

RFC1413, Identification Protocol, describes a method for identifying the user and host that initiate network connections.[313] It relies on the originating host, which must be running the identd(8) daemon.

When the V8 sendmail daemon receives a network connection request (and if the Timeout.ident option, Timeout.ident (V8.6 and later) on page 1104, is nonzero) it attempts to connect to the originating host’s identd service. If the originating host properly supports identification, sendmail reads the login name of the user who initiated the connection (although sendmail will read whatever the other side sends, including garbage). The sendmail program then appends an @ and the originating hostname to what it interprets as the username. If the originating hostname is an IP address in square brackets, sendmail attempts to convert the number to a hostname. The final result, in the form user@host, is assigned to $_.

When sendmail is run on the local machine, it sets $_ to be the name of the user that corresponds to the user-id of the process that ran sendmail. It gets that name by calling getpwuid(3). If the call fails, the name is set to the string:

Unknown UID: num

Here, num is the user-id for which a login name could not be found.

Next, an @ and the name of the local machine are appended to the name, and the result is assigned to $_.

Beginning with V8.7 sendmail, attempts at IP source routing can also be stored in this macro. If sendmail ...

Get sendmail, 4th 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.