Sendmail 8.13.3 Programmer's Guide
Table Of Contents

Sample Program
Milter Sample Program
Chapter 5 69
SMFICTX *ctx;
unsigned char *bodyp;
size_t bodylen;
{
struct mlfiPriv *priv = MLFIPRIV;
/* output body block to log file */
if (fwrite(bodyp, bodylen, 1, priv->mlfi_fp) != 1)
{
/* write failed */
fprintf(stderr, "Couldn’t write file %s: %s\n",
priv->mlfi_fname, strerror(errno));
(void) mlfi_cleanup(ctx, FALSE);
return SMFIS_TEMPFAIL;
}
/* continue processing */
return SMFIS_CONTINUE;
}
sfsistat
mlfi_eom(ctx)
SMFICTX *ctx;
{
bool ok = TRUE;
/* change recipients, if requested */
if (add != NULL)
ok = (smfi_addrcpt(ctx, add) == MI_SUCCESS);
return mlfi_cleanup(ctx, ok);
}
sfsistat
mlfi_abort(ctx)
SMFICTX *ctx;
{
return mlfi_cleanup(ctx, FALSE);
}
sfsistat
mlfi_cleanup(ctx, ok)
SMFICTX *ctx;
bool ok;
{
sfsistat rstat = SMFIS_CONTINUE;
struct mlfiPriv *priv = MLFIPRIV;