Milter xxfi_connect()

Begin a connection All Milter versions

Before any messages (envelopes) can be processed, the sending client must connect to the listening sendmail server. After the connection is made, but before sendmail provides its normal 220 greeting, this xxfi_connect() function, if used, is called.

The xxfi_connect() function is called like this:

sfsistat
xxfi_connect(SMFICTX *ctx,  unsigned char *hostname,  SOCK_ADDR *hostaddr)

Here, ctx is the context pointer passed to all xxfi_ functions to maintain state in a multithreaded environment. The hostname is a pointer to a buffer that contains the hostname of the connecting client. The hostname is derived by a reverse-look-up of the connecting client’s IP address. After finding the hostname, sendmail looks it up to find its IP address. As a special case, if the found IP address does not match the original, the hostname will contain the found IP address in square braces.

"foo.example.com"            ← success
"[123.45.67.89]"             ← failure

Note that a host can have multiple IP addresses and, if so, each is compared to the original connecting IP address and at least one must match.

The hostname is guaranteed by the Milter library to never be NULL, but it can contain an empty string. If the connection is over the standard input, the hostname will contain a copy of the expression "localhost" as a string. The hostname may or may not be a canonical hostname, depending on the connecting client’s behavior.

The hostaddr is the result of a call to getpeername(2) ...

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.