Sendmail 8.13.3 Programmer's Guide

Sample Program
Milter Sample Program
Chapter 564
Milter Sample Program
Following is a sample filter program.
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#include "libmilter/mfapi.h"
#ifndef bool
# define boolint
# define TRUE1
# define FALSE0
#endif /* ! bool */
struct mlfiPriv
{
char*mlfi_fname;
char*mlfi_connectfrom;
char*mlfi_helofrom;
FILE*mlfi_fp;
};
#define MLFIPRIV((struct mlfiPriv *) smfi_getpriv(ctx))
extern sfsistatmlfi_cleanup(SMFICTX *, bool);
/* recipients to add and reject (set with -a and -r options) */
char *add = NULL;
char *reject = NULL;
sfsistat
mlfi_connect(ctx, hostname, hostaddr)
SMFICTX *ctx;
char *hostname;
_SOCK_ADDR *hostaddr;
{