But before you can
use this new smfi_insheader() routine, you must add the SMFIF_ADDHDRS flag to the flags
part of the your smfiDesc declaration:
struct smfiDesc smfilter =
{
...
SMFIF_ADDHDRS, /* flags */ ?†? add here
Omitting this flag will cause smfi_insheader() to fail.
The smfi_insheader() routine is used like this.
ret = smfi_insheader(ctx, index, name, value);
The smfi_insheader() routine??™s first argument is a common context pointer, ctx. The next
argument is index, an index into the list of existing headers. If index is zero, the new header
will be added at the beginning of the list, before the first existing header. If index is greater
than the number of existing headers, the new header will be inserted after the last header in
the list. Otherwise, the new header will be inserted into the list of existing headers after the
header indicated by the value of index.
The name is the name of the new header (such as X-MyMilter) and excludes the colon. The
value is the field value of the new header. If either of these two arguments is NULL, smfi_
insheader() will fail. Failures can result from memory allocation or network errors.
Note that neither sendmail nor the Milter library will ensure that your new header is a valid
one. It is up to you to make sure the header you insert does not violate any RFCs. You
should also make sure that it does not cause headers to no longer parse correctly.
Pages:
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146