Milter xxfi_body()

Review a chunk of message body All Milter versions

The message body follows the headers. Thus, xxfi_eoh() (Milter xxfi_eoh() on page 1214), if used, will be called before the first call to xxfi_body(). Because the message body may be huge, xxfi_body() might reasonably be called multiple times for a given body and is passed a chunk of the body each time. After all the body chunks have been passed, xxfi_eom() (Milter xxfi_eom() on page 1215), if used, will be called to signal the end of body chunks.

The xxfi_body() function is called like this:

sfsistat
xxfi_body(SMFICTX *ctx,  unsigned char *bodyp,  size_t len)

Here, ctx is the context pointer passed to all xxfi_ functions to maintain state in a multithreaded environment. The bodyp is a pointer to a buffer that contains len bytes of body. Although bodyp is of type char *, it is not a string and must not be treated as a string (that is, you must not depend on it being zero-terminated).[454]

List xxfi_body() in smfiDesc only if you need to process the body. Message bodies can be large, and needlessly asking for body chunks can adversely impact a Milter’s performance.

The values your xxfi_body() function can return and their meanings are:

SMFIS_CONTINUE

Allow the current body chunk and expect more chunks if any. This is the default return value if you don’t declare a body chunk handler in smfiDesc (Milter smfi_register() on page 1194).

SMFIS_ACCEPT

Accept the current body chunk and thereafter the current envelope. Your Milter ...

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.