Milter xxfi_close()

Close a connection All Milter versions

A connecting client, when finished sending zero or more envelopes, will close down the connection to sendmail by sending the SMTP QUIT command. A connection can also be closed down if sendmail drops the connection itself. No matter how the connection shuts down, this xxfi_close() function, if used, will be called.

The xxfi_close() function is called like this:

sfsistat
xxfi_close(SMFICTX *ctx)

Here, ctx is the context pointer passed to all xxfi_ functions to maintain state in a multithreaded environment. Nothing else is passed. If you have earlier declared a private data pointer with smfi_setpriv() (Milter smfi_setpriv() on page 1199), this may be a good place to deallocate that data. But be aware that xxfi_close() can be the only xxfi_ function called for a connection. Consider the case of a connection rejected through the access database (The access Database on page 277). In that event, xxfi_connect() will not be called, but xxfi_close() will be, so always anticipate that your private data pointer might be NULL.

Note that xxfi_close() is called even if a prior Milter rejected the connection.

Also note that any value returned by xxfi_close() is ignored, so you may return any value with no change in effect. If you don’t declare a close handler in smfiDesc (Milter smfi_register() on page 1194), the default return value is SMFIS_CONTINUE.

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.