summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/libmilter
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2004-08-01 01:04:57 +0000
committergshapiro <gshapiro@FreeBSD.org>2004-08-01 01:04:57 +0000
commit1fc446a819a244515d9461fa50d34ee191414d6f (patch)
treef6477ae85b00ee6d58b086b0d1d597dd9a403391 /contrib/sendmail/libmilter
parent238623a0204c90e8d61dbde7b3b499a5036f2e5d (diff)
downloadFreeBSD-src-1fc446a819a244515d9461fa50d34ee191414d6f.zip
FreeBSD-src-1fc446a819a244515d9461fa50d34ee191414d6f.tar.gz
Import sendmail 8.13.1
Diffstat (limited to 'contrib/sendmail/libmilter')
-rw-r--r--contrib/sendmail/libmilter/Makefile.m42
-rw-r--r--contrib/sendmail/libmilter/README24
-rw-r--r--contrib/sendmail/libmilter/comm.c177
-rw-r--r--contrib/sendmail/libmilter/docs/api.html43
-rw-r--r--contrib/sendmail/libmilter/docs/design.html3
-rw-r--r--contrib/sendmail/libmilter/docs/index.html2
-rw-r--r--contrib/sendmail/libmilter/docs/installation.html3
-rw-r--r--contrib/sendmail/libmilter/docs/other.html3
-rw-r--r--contrib/sendmail/libmilter/docs/overview.html2
-rw-r--r--contrib/sendmail/libmilter/docs/sample.html16
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_addheader.html5
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_addrcpt.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_chgheader.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_delrcpt.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_getpriv.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_getsymval.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_insheader.html123
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_main.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_opensocket.html78
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_progress.html68
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_quarantine.html73
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_register.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_replacebody.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_setbacklog.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_setconn.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_setdbg.html67
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_setmlreply.html147
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_setpriv.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_setreply.html11
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_settimeout.html3
-rw-r--r--contrib/sendmail/libmilter/docs/smfi_stop.html73
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_abort.html3
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_body.html3
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_close.html17
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_connect.html7
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_envfrom.html3
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_envrcpt.html3
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_eoh.html3
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_eom.html3
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_header.html3
-rw-r--r--contrib/sendmail/libmilter/docs/xxfi_helo.html3
-rw-r--r--contrib/sendmail/libmilter/engine.c128
-rw-r--r--contrib/sendmail/libmilter/handler.c2
-rw-r--r--contrib/sendmail/libmilter/libmilter.h8
-rw-r--r--contrib/sendmail/libmilter/listener.c59
-rw-r--r--contrib/sendmail/libmilter/main.c7
-rw-r--r--contrib/sendmail/libmilter/signal.c2
-rw-r--r--contrib/sendmail/libmilter/smfi.c130
48 files changed, 1168 insertions, 172 deletions
diff --git a/contrib/sendmail/libmilter/Makefile.m4 b/contrib/sendmail/libmilter/Makefile.m4
index d824298..5bc1a92 100644
--- a/contrib/sendmail/libmilter/Makefile.m4
+++ b/contrib/sendmail/libmilter/Makefile.m4
@@ -1,4 +1,4 @@
-dnl $Id: Makefile.m4,v 8.30.2.1 2002/06/21 21:58:28 ca Exp $
+dnl $Id: Makefile.m4,v 8.31 2002/06/21 22:01:31 ca Exp $
include(confBUILDTOOLSDIR`/M4/switch.m4')
dnl only required for compilation of EXTRAS
diff --git a/contrib/sendmail/libmilter/README b/contrib/sendmail/libmilter/README
index 96fba66..ec1f84b 100644
--- a/contrib/sendmail/libmilter/README
+++ b/contrib/sendmail/libmilter/README
@@ -9,11 +9,8 @@ through reference to a sample filter which is attached at the end of this
file. It is necessary to first build libmilter.a, which can be done by
issuing the './Build' command in SRCDIR/libmilter .
-NOTE: If you intend to use filters in sendmail, you must compile sendmail
-with -DMILTER defined. You can do this by adding the following to
-your devtools/Site/site.config.m4 file:
-
- APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')
+Starting with 8.13 sendmail is compiled by default with support for
+the milter API.
+----------------+
| SECURITY HINTS |
@@ -23,13 +20,18 @@ Note: we strongly recommend not to run any milter as root. Libmilter
does not need root access to communicate with sendmail. It is a
good security practice to run a program only with root privileges
if really necessary. A milter should probably check first whether
-it runs as root and refuse to start in that case. There is a
-compile time option _FFR_MILTER_ROOT_UNSAFE which keeps libmilter
-from unlinking a socket when running as root. It is recommended
-to turn on this option:
+it runs as root and refuse to start in that case. libmilter will
+not unlink a socket when running as root.
+
++----------------------+
+| CONFIGURATION MACROS |
++----------------------+
- APPENDDEF(`conf_libmilter_ENVDEF', `-D_FFR_MILTER_ROOT_UNSAFE ')
+Libmilter uses a set of C preprocessor macros to specify platform specific
+features of the C compiler and standard C libraries.
+SM_CONF_POLL
+ Set to 1 if poll(2) should be used instead of select(2).
+-------------------+
| BUILDING A FILTER |
@@ -464,4 +466,4 @@ main(argc, argv)
/* eof */
-$Revision: 8.35.2.2 $, Last updated $Date: 2003/05/26 04:10:06 $
+$Revision: 8.40 $, Last updated $Date: 2003/12/11 18:14:34 $
diff --git a/contrib/sendmail/libmilter/comm.c b/contrib/sendmail/libmilter/comm.c
index aa48cf7..552e7e4 100644
--- a/contrib/sendmail/libmilter/comm.c
+++ b/contrib/sendmail/libmilter/comm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2004 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,10 +9,36 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: comm.c,v 8.54.2.6 2003/01/03 22:14:40 ca Exp $")
+SM_RCSID("@(#)$Id: comm.c,v 8.65 2004/07/07 21:41:30 ca Exp $")
#include "libmilter.h"
#include <sm/errstring.h>
+#include <sys/uio.h>
+
+static size_t Maxdatasize = MILTER_MAX_DATA_SIZE;
+
+#if _FFR_MAXDATASIZE
+/*
+** SMFI_SETMAXDATASIZE -- set limit for milter data read/write.
+**
+** Parameters:
+** sz -- new limit.
+**
+** Returns:
+** old limit
+*/
+
+size_t
+smfi_setmaxdatasize(sz)
+ size_t sz;
+{
+ size_t old;
+
+ old = Maxdatasize;
+ Maxdatasize = sz;
+ return old;
+}
+#endif /* _FFR_MAXDATASIZE */
/*
** MI_RD_CMD -- read a command
@@ -107,7 +133,7 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name)
expl = ntohl(expl) - 1;
if (expl <= 0)
return NULL;
- if (expl > MILTER_CHUNK_SIZE)
+ if (expl > Maxdatasize)
{
*cmd = SMFIC_TOOBIG;
return NULL;
@@ -195,12 +221,94 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name)
*cmd = SMFIC_UNKNERR;
return NULL;
}
+
+/*
+** RETRY_WRITEV -- Keep calling the writev() system call
+** until all the data is written out or an error occurs.
+**
+** Parameters:
+** fd -- socket descriptor
+** iov -- io vector
+** iovcnt -- number of elements in io vector
+** must NOT exceed UIO_MAXIOV.
+** timeout -- maximum time to wait
+**
+** Returns:
+** success: number of bytes written
+** otherwise: MI_FAILURE
+*/
+
+static ssize_t
+retry_writev(fd, iov, iovcnt, timeout)
+ socket_t fd;
+ struct iovec *iov;
+ int iovcnt;
+ struct timeval *timeout;
+{
+ int i;
+ ssize_t n, written;
+ FD_WR_VAR(wrs);
+
+ written = 0;
+ for (;;)
+ {
+ while (iovcnt > 0 && iov[0].iov_len == 0)
+ {
+ iov++;
+ iovcnt--;
+ }
+ if (iovcnt <= 0)
+ return written;
+
+ /*
+ ** We don't care much about the timeout here,
+ ** it's very long anyway; correct solution would be
+ ** to take the time before the loop and reduce the
+ ** timeout after each invocation.
+ ** FD_SETSIZE is checked when socket is created.
+ */
+
+ FD_WR_INIT(fd, wrs);
+ i = FD_WR_READY(fd, wrs, timeout);
+ if (i == 0)
+ return MI_FAILURE;
+ if (i < 0)
+ {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+ return MI_FAILURE;
+ }
+ n = writev(fd, iov, iovcnt);
+ if (n == -1)
+ {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+ return MI_FAILURE;
+ }
+
+ written += n;
+ for (i = 0; i < iovcnt; i++)
+ {
+ if (iov[i].iov_len > (unsigned int) n)
+ {
+ iov[i].iov_base = (char *)iov[i].iov_base + n;
+ iov[i].iov_len -= (unsigned int) n;
+ break;
+ }
+ n -= (int) iov[i].iov_len;
+ iov[i].iov_len = 0;
+ }
+ if (i == iovcnt)
+ return written;
+ }
+}
+
/*
** MI_WR_CMD -- write a cmd to sd
**
** Parameters:
** sd -- socket descriptor
-** timeout -- maximum time to wait (currently unused)
+** timeout -- maximum time to wait
** cmd -- single character command to write
** buf -- buffer with further data
** len -- length of buffer (without cmd!)
@@ -209,38 +317,6 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name)
** MI_SUCCESS/MI_FAILURE
*/
-/*
-** we don't care much about the timeout here, it's very long anyway
-** FD_SETSIZE is checked when socket is created.
-** XXX l == 0 ?
-*/
-
-#define MI_WR(data) \
- while (sl > 0) \
- { \
- FD_WR_INIT(sd, wrs); \
- ret = FD_WR_READY(sd, wrs, timeout); \
- if (ret == 0) \
- return MI_FAILURE; \
- if (ret < 0) \
- { \
- if (errno == EINTR) \
- continue; \
- else \
- return MI_FAILURE; \
- } \
- l = MI_SOCK_WRITE(sd, (void *) ((data) + i), sl); \
- if (l < 0) \
- { \
- if (errno == EINTR) \
- continue; \
- else \
- return MI_FAILURE; \
- } \
- i += l; \
- sl -= l; \
- }
-
int
mi_wr_cmd(sd, timeout, cmd, buf, len)
socket_t sd;
@@ -252,27 +328,32 @@ mi_wr_cmd(sd, timeout, cmd, buf, len)
size_t sl, i;
ssize_t l;
mi_int32 nl;
- int ret;
- FD_WR_VAR(wrs);
+ int iovcnt;
+ struct iovec iov[2];
char data[MILTER_LEN_BYTES + 1];
- if (len > MILTER_CHUNK_SIZE)
+ if (len > Maxdatasize || (len > 0 && buf == NULL))
return MI_FAILURE;
+
nl = htonl(len + 1); /* add 1 for the cmd char */
(void) memcpy(data, (void *) &nl, MILTER_LEN_BYTES);
data[MILTER_LEN_BYTES] = (char) cmd;
i = 0;
sl = MILTER_LEN_BYTES + 1;
- /* use writev() instead to send the whole stuff at once? */
-
- MI_WR(data);
- if (len > 0 && buf == NULL)
+ /* set up the vector for the size / command */
+ iov[0].iov_base = (void *) data;
+ iov[0].iov_len = sl;
+ iovcnt = 1;
+ if (len >= 0 && buf != NULL)
+ {
+ iov[1].iov_base = (void *) buf;
+ iov[1].iov_len = len;
+ iovcnt = 2;
+ }
+
+ l = retry_writev(sd, iov, iovcnt, timeout);
+ if (l == MI_FAILURE)
return MI_FAILURE;
- if (len == 0 || buf == NULL)
- return MI_SUCCESS;
- i = 0;
- sl = len;
- MI_WR(buf);
return MI_SUCCESS;
}
diff --git a/contrib/sendmail/libmilter/docs/api.html b/contrib/sendmail/libmilter/docs/api.html
index 936abed..23c4de4 100644
--- a/contrib/sendmail/libmilter/docs/api.html
+++ b/contrib/sendmail/libmilter/docs/api.html
@@ -1,6 +1,9 @@
<html>
<head><title>Milter API</title></head>
<body>
+<!--
+$Id: api.html,v 1.18 2004/04/28 23:26:51 msk Exp $
+-->
<h1>Milter API</h1>
<h2>Contents</h2>
@@ -26,12 +29,20 @@ href="smfi_main.html">smfi_main</a>.
<p>
<table border="1" cellspacing=0 cellpadding=2><tr bgcolor="#dddddd"><th>Function</th><th>Description</th></tr>
+<tr><td><a href="smfi_opensocket.html">smfi_opensocket</a></td><td>Try to create the interface socket.</td></tr>
+
<tr><td><a href="smfi_register.html">smfi_register</a></td><td>Register a filter.</td></tr>
<tr><td><a href="smfi_setconn.html">smfi_setconn</a></td><td>Specify socket to use.</td></tr>
<tr><td><a href="smfi_settimeout.html">smfi_settimeout</a></td><td>Set timeout.</td></tr>
+<tr><td><a href="smfi_setbacklog.html">smfi_setbacklog</a></td><td>Define the incoming <i>listen</i>(2) queue size.</td></tr>
+
+<tr><td><a href="smfi_setdbg.html">smfi_setdbg</a></td><td>Set the milter library debugging (tracing) level.</td></tr>
+
+<tr><td><a href="smfi_stop.html">smfi_stop</a></td><td>Cause an orderly shutdown.</td></tr>
+
<tr><td><a href="smfi_main.html">smfi_main</a></td><td>Hand control to libmilter.</td></tr>
</table>
@@ -54,6 +65,9 @@ pointer.</td></tr>
<tr><td><a href="smfi_setreply.html">smfi_setreply</a></td><td>Set the specific
reply code to be used.</td></tr>
+<tr><td><a href="smfi_setmlreply.html">smfi_setmlreply</a></td><td>Set the
+specific multi-line reply to be used.</td></tr>
+
</table>
<h2>Message Modification Functions</h2>
@@ -85,6 +99,9 @@ the message.</td><td>SMFIF_ADDHDRS</td></tr>
<tr><td><a href="smfi_chgheader.html">smfi_chgheader</a></td><td>Change or delete a header.</td><td>SMFIF_CHGHDRS</td></tr>
+<tr><td><a href="smfi_insheader.html">smfi_insheader</a></td><td>Insert a
+header into the message.</td><td>SMFIF_ADDHDRS</td></tr>
+
<tr><td><a href="smfi_addrcpt.html">smfi_addrcpt</a></td><td>Add a recipient to
the envelope.</td><td>SMFIF_ADDRCPT</td></tr>
@@ -96,7 +113,29 @@ body of the message.</td><td>SMFIF_CHGBODY</td></tr>
</table>
-<h2>Callbacks</h2>
+<h2>Other Message Handling Functions</h2>
+
+The following functions provide special case handling instructions for
+milter or the MTA, without altering the content or status of the message.
+<b>They too may only be called in <a href="xxfi_eom.html">xxfi_eom</a></b>.
+All of these functions may invoke additional communication with the MTA.
+They will return either MI_SUCCESS or MI_FAILURE to indicate the status of
+the operation.
+
+<p>
+Note that the status returned indicates only whether or not the
+filter's message was successfully sent to the MTA, not whether or not
+the MTA performed the requested operation.
+
+<p>
+<table border="1" cellspacing=0 cellpadding=2><tr bgcolor="#dddddd"><th>Function</th><th>Description</th></tr>
+<tr><td><a href="smfi_progress.html">smfi_progress</a></td><td>Report operation in progress.</td></tr>
+
+<tr><td><a href="smfi_quarantine.html">smfi_quarantine</a></td><td>Quarantine a message.</td></tr>
+
+</table>
+
+<h2><a name="callbacks">Callbacks</a></h2>
The filter should implement one or more of the following callbacks,
which are registered via <a href="smfi_register.html">smfi_register</a>:
@@ -131,7 +170,7 @@ having the indicated meanings. Any return other than one of the below
values constitutes an error, and will cause sendmail to terminate its
connection to the offending filter.
-<p><a name="conn-spec"></a>Milter distinguishes between recipient-,
+<p><a name="conn-spec">Milter</a> distinguishes between recipient-,
message-, and connection-oriented routines. Recipient-oriented
callbacks may affect the processing of a single message recipient;
message-oriented callbacks, a single message; connection-oriented
diff --git a/contrib/sendmail/libmilter/docs/design.html b/contrib/sendmail/libmilter/docs/design.html
index 9180486..3cf2898 100644
--- a/contrib/sendmail/libmilter/docs/design.html
+++ b/contrib/sendmail/libmilter/docs/design.html
@@ -3,6 +3,9 @@
<title>Architecture</title>
</head>
<body>
+<!--
+$Id: design.html,v 1.11 2003/03/05 19:57:54 ca Exp $
+-->
<h1>Architecture</h1>
diff --git a/contrib/sendmail/libmilter/docs/index.html b/contrib/sendmail/libmilter/docs/index.html
index 93eb3f8..3c39abf 100644
--- a/contrib/sendmail/libmilter/docs/index.html
+++ b/contrib/sendmail/libmilter/docs/index.html
@@ -4,7 +4,7 @@
</head>
<body>
<!--
-$Id: index.html,v 1.10.4.1 2003/03/05 19:54:19 ca Exp $
+$Id: index.html,v 1.12 2003/03/05 19:57:54 ca Exp $
-->
<h1>Filtering Mail with Sendmail</h1>
diff --git a/contrib/sendmail/libmilter/docs/installation.html b/contrib/sendmail/libmilter/docs/installation.html
index 370f1d3..5353ea7 100644
--- a/contrib/sendmail/libmilter/docs/installation.html
+++ b/contrib/sendmail/libmilter/docs/installation.html
@@ -2,6 +2,9 @@
<head><title>Installation and Configuration</title>
</head>
<body>
+<!--
+$Id: installation.html,v 1.20 2003/03/05 19:57:54 ca Exp $
+-->
<h1>Installation</h1>
<h2>Contents</h2>
<ul>
diff --git a/contrib/sendmail/libmilter/docs/other.html b/contrib/sendmail/libmilter/docs/other.html
index 4647c53..22ef822 100644
--- a/contrib/sendmail/libmilter/docs/other.html
+++ b/contrib/sendmail/libmilter/docs/other.html
@@ -2,6 +2,9 @@
<head><title>Other Resources</title>
</head>
<body>
+<!--
+$Id: other.html,v 1.5 2003/03/05 19:57:54 ca Exp $
+-->
FAQ? Mailing list? More sample filters?
<hr size="1">
<font size="-1">
diff --git a/contrib/sendmail/libmilter/docs/overview.html b/contrib/sendmail/libmilter/docs/overview.html
index 9818564..f06fbdf 100644
--- a/contrib/sendmail/libmilter/docs/overview.html
+++ b/contrib/sendmail/libmilter/docs/overview.html
@@ -4,7 +4,7 @@
</head>
<body>
<!--
-$Id: overview.html,v 1.12.4.1 2003/03/05 19:54:20 ca Exp $
+$Id: overview.html,v 1.14 2003/03/05 19:57:54 ca Exp $
-->
<h1>Technical Overview</h1>
diff --git a/contrib/sendmail/libmilter/docs/sample.html b/contrib/sendmail/libmilter/docs/sample.html
index 2cc1948..29ee67a 100644
--- a/contrib/sendmail/libmilter/docs/sample.html
+++ b/contrib/sendmail/libmilter/docs/sample.html
@@ -1,6 +1,9 @@
<html>
<head><title>A Sample Filter</title></head>
<body>
+<!--
+$Id: sample.html,v 1.18 2004/02/27 00:49:28 msk Exp $
+-->
<h1>A Sample Filter</h1>
The following sample logs each message to a separate temporary file,
@@ -121,9 +124,10 @@ sfsistat
SMFICTX *ctx;
char **argv;
{
+ int fd = -1;
+ int argc = 0;
struct mlfiPriv *priv = MLFIPRIV;
char *mailaddr = <a href="smfi_getsymval.html">smfi_getsymval</a>(ctx, "{mail_addr}");
- int argc = 0;
/* open a file to store this message */
if ((priv-&gt;mlfi_fname = strdup("/tmp/msg.XXXXXX")) == NULL)
@@ -132,14 +136,15 @@ sfsistat
return SMFIS_TEMPFAIL;
}
- if (mkstemp(priv-&gt;mlfi_fname) == -1)
+ if ((fd = mkstemp(priv-&gt;mlfi_fname)) == -1)
{
(void) mlfi_cleanup(ctx, FALSE);
return SMFIS_TEMPFAIL;
}
- if ((priv-&gt;mlfi_fp = fopen(priv-&gt;mlfi_fname, "w+")) == NULL)
+ if ((priv-&gt;mlfi_fp = fdopen(fd, "w+")) == NULL)
{
+ (void) close(fd);
(void) mlfi_cleanup(ctx, FALSE);
return SMFIS_TEMPFAIL;
}
@@ -361,7 +366,8 @@ struct smfiDesc smfilter =
{
"SampleFilter", /* filter name */
SMFI_VERSION, /* version code -- do not change */
- SMFIF_ADDHDRS, /* flags */
+ SMFIF_ADDHDRS|SMFIF_ADDRCPT,
+ /* flags */
<a href="xxfi_connect.html">mlfi_connect</a>, /* connection info filter */
<a href="xxfi_helo.html">mlfi_helo</a>, /* SMTP HELO command filter */
<a href="xxfi_envfrom.html">mlfi_envfrom</a>, /* envelope sender filter */
@@ -488,7 +494,7 @@ main(argc, argv)
</pre>
<hr size="1">
<font size="-1">
-Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers.
+Copyright (c) 2000-2004 Sendmail, Inc. and its suppliers.
All rights reserved.
<br>
By using this file, you agree to the terms and conditions set
diff --git a/contrib/sendmail/libmilter/docs/smfi_addheader.html b/contrib/sendmail/libmilter/docs/smfi_addheader.html
index a49c648..e1fe69d 100644
--- a/contrib/sendmail/libmilter/docs/smfi_addheader.html
+++ b/contrib/sendmail/libmilter/docs/smfi_addheader.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_addheader</title></head>
<body>
+<!--
+$Id: smfi_addheader.html,v 1.15 2004/05/04 17:55:50 ca Exp $
+-->
<h1>smfi_addheader</h1>
<table border="0" cellspacing=4 cellpadding=4>
@@ -69,7 +72,7 @@ Otherwise, it returns MI_SUCCESS.
To change a header's current value, use <a
href="smfi_chgheader.html">smfi_chgheader</a>.
<li>A filter which calls smfi_addheader must have set the SMFIF_ADDHDRS flag in the smfiDesc_str passed to <a href="smfi_register.html">smfi_register</a>.
- <li>For smfi_chgheader, filter order is important. <b>Later filters will see the header changes made by earlier ones.</b>
+ <li>For smfi_addheader, filter order is important. <b>Later filters will see the header changes made by earlier ones.</b>
<li>Neither the name nor the value of the header is checked for
standards compliance. However, each line of the header must be under
2048 characters and should be under 998 characters. If longer headers
diff --git a/contrib/sendmail/libmilter/docs/smfi_addrcpt.html b/contrib/sendmail/libmilter/docs/smfi_addrcpt.html
index 16f86c9..05770bf 100644
--- a/contrib/sendmail/libmilter/docs/smfi_addrcpt.html
+++ b/contrib/sendmail/libmilter/docs/smfi_addrcpt.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_addrcpt</title></head>
<body>
+<!--
+$Id: smfi_addrcpt.html,v 1.9 2003/10/08 17:55:00 gshapiro Exp $
+-->
<h1>smfi_addrcpt</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_chgheader.html b/contrib/sendmail/libmilter/docs/smfi_chgheader.html
index 53ad73c..5c7e507 100644
--- a/contrib/sendmail/libmilter/docs/smfi_chgheader.html
+++ b/contrib/sendmail/libmilter/docs/smfi_chgheader.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_chgheader</title></head>
<body>
+<!--
+$Id: smfi_chgheader.html,v 1.15 2003/04/30 22:10:53 ca Exp $
+-->
<h1>smfi_chgheader</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_delrcpt.html b/contrib/sendmail/libmilter/docs/smfi_delrcpt.html
index 9608e61..7776a43 100644
--- a/contrib/sendmail/libmilter/docs/smfi_delrcpt.html
+++ b/contrib/sendmail/libmilter/docs/smfi_delrcpt.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_delrcpt</title></head>
<body>
+<!--
+$Id: smfi_delrcpt.html,v 1.9 2003/10/27 15:51:12 ca Exp $
+-->
<h1>smfi_delrcpt</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_getpriv.html b/contrib/sendmail/libmilter/docs/smfi_getpriv.html
index 85c994c..3d9f985 100644
--- a/contrib/sendmail/libmilter/docs/smfi_getpriv.html
+++ b/contrib/sendmail/libmilter/docs/smfi_getpriv.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_getpriv</title></head>
<body>
+<!--
+$Id: smfi_getpriv.html,v 1.7 2003/03/05 19:57:54 ca Exp $
+-->
<h1>smfi_getpriv</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_getsymval.html b/contrib/sendmail/libmilter/docs/smfi_getsymval.html
index 7f3db6a..0e9bc58 100644
--- a/contrib/sendmail/libmilter/docs/smfi_getsymval.html
+++ b/contrib/sendmail/libmilter/docs/smfi_getsymval.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_getsymval</title></head>
<body>
+<!--
+$Id: smfi_getsymval.html,v 1.10 2003/03/05 19:57:54 ca Exp $
+-->
<h1>smfi_getsymval</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_insheader.html b/contrib/sendmail/libmilter/docs/smfi_insheader.html
new file mode 100644
index 0000000..837a1fd
--- /dev/null
+++ b/contrib/sendmail/libmilter/docs/smfi_insheader.html
@@ -0,0 +1,123 @@
+<html>
+<head><title>smfi_insheader</title></head>
+<body>
+<!--
+$Id: smfi_insheader.html,v 1.3 2004/05/04 16:20:34 gshapiro Exp $
+-->
+<h1>smfi_insheader</h1>
+
+<table border="0" cellspacing=4 cellpadding=4>
+<!---------- Synopsis ----------->
+<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
+<pre>
+#include &lt;libmilter/mfapi.h&gt;
+int smfi_insheader(
+ SMFICTX *ctx,
+ int hdridx,
+ char *headerf,
+ char *headerv
+);
+</pre>
+Prepend a header to the current message.
+</td></tr>
+
+<!----------- Description ---------->
+<tr><th valign="top" align=left>DESCRIPTION</th><td>
+<table border="1" cellspacing=1 cellpadding=4>
+<tr align="left" valign=top>
+<th width="80">Called When</th>
+<td>Called only from <a href="xxfi_eom.html">xxfi_eom</a>.</td>
+</tr>
+<tr align="left" valign=top>
+<th width="80">Effects</th>
+<td>Prepends a header to the current message.</td>
+</tr>
+</table>
+
+<!----------- Arguments ---------->
+<tr><th valign="top" align=left>ARGUMENTS</th><td>
+ <table border="1" cellspacing=0>
+ <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
+ <tr valign="top"><td>ctx</td>
+ <td>Opaque context structure.
+ </td></tr>
+ <tr valign="top"><td>hdridx</td>
+ <td>The location in the internal header list where this header should
+ be inserted; 0 makes it the topmost header, etc.
+ </td></tr>
+ <tr valign="top"><td>headerf</td>
+ <td>The header name, a non-NULL, null-terminated string.
+ </td></tr>
+ <tr valign="top"><td>headerv</td>
+ <td>The header value to be added, a non-NULL, null-terminated string. This may be the empty string.
+ </td></tr>
+ </table>
+</td></tr>
+
+<!----------- Return values ---------->
+<tr>
+<th valign="top" align=left>RETURN VALUES</th>
+
+<td>smfi_insheader returns MI_FAILURE if:
+<ul><li>headerf or headerv is NULL.
+ <li>Adding headers in the current connection state is invalid.
+ <li>Memory allocation fails.
+ <li>A network error occurs.
+ <li>SMFIF_ADDHDRS was not set when <a href="smfi_register.html">smfi_register</a> was called.
+</ul>
+Otherwise, it returns MI_SUCCESS.
+</td>
+</tr>
+
+<!----------- Notes ---------->
+<tr align="left" valign=top>
+<th>NOTES</th>
+<td>
+<ul><li>smfi_insheader does not change a message's existing headers.
+To change a header's current value, use <a
+href="smfi_chgheader.html">smfi_chgheader</a>.
+ <li>A filter which calls smfi_insheader must have set the SMFIF_ADDHDRS flag in the smfiDesc_str passed to <a href="smfi_register.html">smfi_register</a>.
+ <li>For smfi_insheader, filter order is important. <b>Later filters will see the header changes made by earlier ones.</b>
+ <li>If hdridx is a number larger than the number of headers in the message, the header will simply be appended.
+ <li>Neither the name nor the value of the header is checked for
+ standards compliance. However, each line of the header must be under
+ 2048 characters and should be under 998 characters. If longer headers
+ are needed, make them multi-line. To make a multi-line header, insert
+ a line feed (ASCII 0x0a, or <tt>\n</tt> in C) followed by at least
+ one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09,
+ or <tt>\t</tt> in C). The line feed should NOT be preceded by a
+ carriage return (ASCII 0x0d); the MTA will add this automatically.
+ <b>It is the filter writer's responsibility to ensure that no standards
+ are violated.</b>
+</ul>
+</td>
+</tr>
+
+<!----------- Example code ---------->
+<tr>
+<th valign="top" align=left>EXAMPLE</th>
+
+<td>
+ <pre>
+ int ret;
+ SMFICTX *ctx;
+
+ ...
+
+ ret = smfi_insheader(ctx, 0, "First", "See me?");
+ </pre>
+</td>
+</tr>
+
+</table>
+
+<hr size="1">
+<font size="-1">
+Copyright (c) 2004 Sendmail, Inc. and its suppliers.
+All rights reserved.
+<br>
+By using this file, you agree to the terms and conditions set
+forth in the LICENSE.
+</font>
+</body>
+</html>
diff --git a/contrib/sendmail/libmilter/docs/smfi_main.html b/contrib/sendmail/libmilter/docs/smfi_main.html
index 674ef69..4e772a1 100644
--- a/contrib/sendmail/libmilter/docs/smfi_main.html
+++ b/contrib/sendmail/libmilter/docs/smfi_main.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_main</title></head>
<body>
+<!--
+$Id: smfi_main.html,v 1.7 2003/03/05 19:57:54 ca Exp $
+-->
<h1>smfi_main</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_opensocket.html b/contrib/sendmail/libmilter/docs/smfi_opensocket.html
new file mode 100644
index 0000000..914ae50
--- /dev/null
+++ b/contrib/sendmail/libmilter/docs/smfi_opensocket.html
@@ -0,0 +1,78 @@
+<html>
+<head><title>smfi_opensocket</title></head>
+<body>
+<!--
+$Id: smfi_opensocket.html,v 1.4 2003/10/20 22:28:57 msk Exp $
+-->
+<h1>smfi_opensocket</h1>
+
+<table border="0" cellspacing=4 cellpadding=4>
+<!---------- Synopsis ----------->
+<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
+<pre>
+#include &lt;libmilter/mfapi.h&gt;
+int smfi_opensocket(
+ bool rmsocket
+);
+</pre>
+Attempt to create the interface socket MTAs will use to connect to the
+filter.
+</td></tr>
+
+<!----------- Description ---------->
+<tr><th valign="top" align=left>DESCRIPTION</th><td>
+<table border="1" cellspacing=1 cellpadding=4>
+<tr align="left" valign=top>
+<th width="80">Called When</th>
+<td>Called only from program mainline, before calling
+<tt>smfi_main()</tt>.</td>
+</tr>
+<tr align="left" valign=top>
+<th width="80">Effects</th>
+<td>smfi_opensocket attempts to create the socket specified previously by
+a call to <tt>smfi_setconn()</tt> which will be the interface between MTAs
+and the filter. This allows the calling application to ensure that the
+socket can be created. If this is not called, <tt>smfi_main()</tt> will
+do so implicitly. </td>
+</tr>
+</table>
+
+<!----------- Arguments ---------->
+<tr><th valign="top" align=left>ARGUMENTS</th><td>
+ <table border="1" cellspacing=0>
+ <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
+ <tr valign="top"><td>rmsocket</td>
+ <td>A flag indicating whether or not the library should try to
+ remove any existing UNIX domain socket before trying to create
+ a new one.
+ </td></tr>
+ </table>
+</td></tr>
+
+<!----------- Return values ---------->
+<tr>
+<th valign="top" align=left>RETURN VALUES</th>
+
+<td>smfi_opensocket will fail and return MI_FAILURE if:
+<ul>
+ <li>The interface socket could not be created for any reason.
+ <li><tt>rmsocket</tt> was <tt>true</tt>, and either the socket could
+ not be examined, or exists and could not be removed.
+ <li><tt>smfi_setconn()</tt> has not been called.
+</ul>
+Otherwise, it will return MI_SUCCESS
+</td>
+</tr>
+
+</table>
+
+<hr size="1">
+<font size="-1">
+Copyright (c) 2003 Sendmail, Inc. and its suppliers.
+All rights reserved.
+<br>
+By using this file, you agree to the terms and conditions set
+forth in the LICENSE.
+</font>
+</body>
+</html>
diff --git a/contrib/sendmail/libmilter/docs/smfi_progress.html b/contrib/sendmail/libmilter/docs/smfi_progress.html
new file mode 100644
index 0000000..85f1219
--- /dev/null
+++ b/contrib/sendmail/libmilter/docs/smfi_progress.html
@@ -0,0 +1,68 @@
+<html>
+<head><title>smfi_progress</title></head>
+<body>
+<!--
+$Id: smfi_progress.html,v 1.3 2003/03/05 19:57:54 ca Exp $
+-->
+<h1>smfi_progress</h1>
+
+<table border="0" cellspacing=4 cellpadding=4>
+<!---------- Synopsis ----------->
+<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
+<pre>
+#include &lt;libmilter/mfapi.h&gt;
+int smfi_progress(
+ SMFICTX *ctx;
+);
+</pre>
+Notify the MTA that an operation is still in progress.
+</td></tr>
+
+<!----------- Description ---------->
+<tr><th valign="top" align=left>DESCRIPTION</th><td>
+<table border="1" cellspacing=1 cellpadding=4>
+<tr align="left" valign=top>
+<th width="80">Called When</th>
+<td>Called only from <a href="xxfi_eom.html">xxfi_eom</a>.</td>
+</tr>
+<tr align="left" valign=top>
+<th width="80">Effects</th>
+<td>smfi_progress notifies the MTA that the filter is still working
+on a message, causing the MTA to re-start its timeouts.</td>
+</tr>
+</table>
+
+<!----------- Arguments ---------->
+<tr><th valign="top" align=left>ARGUMENTS</th><td>
+ <table border="1" cellspacing=0>
+ <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
+ <tr valign="top"><td>ctx</td>
+ <td>Opaque context structure.
+ </td></tr>
+ </table>
+</td></tr>
+
+<!----------- Return values ---------->
+<tr>
+<th valign="top" align=left>RETURN VALUES</th>
+
+<td>smfi_progress will fail and return MI_FAILURE if:
+<ul>
+ <li>A network error occurs.
+</ul>
+Otherwise, it will return MI_SUCCESS
+</td>
+</tr>
+
+</table>
+
+<hr size="1">
+<font size="-1">
+Copyright (c) 2003 Sendmail, Inc. and its suppliers.
+All rights reserved.
+<br>
+By using this file, you agree to the terms and conditions set
+forth in the LICENSE.
+</font>
+</body>
+</html>
diff --git a/contrib/sendmail/libmilter/docs/smfi_quarantine.html b/contrib/sendmail/libmilter/docs/smfi_quarantine.html
new file mode 100644
index 0000000..066cce8
--- /dev/null
+++ b/contrib/sendmail/libmilter/docs/smfi_quarantine.html
@@ -0,0 +1,73 @@
+<html>
+<head><title>smfi_quarantine</title></head>
+<body>
+<!--
+$Id: smfi_quarantine.html,v 1.3 2003/03/05 19:57:54 ca Exp $
+-->
+<h1>smfi_quarantine</h1>
+
+<table border="0" cellspacing=4 cellpadding=4>
+<!---------- Synopsis ----------->
+<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
+<pre>
+#include &lt;libmilter/mfapi.h&gt;
+int smfi_quarantine(
+ SMFICTX *ctx;
+ char *reason;
+);
+</pre>
+Quarantine the message using the given reason.
+</td></tr>
+
+<!----------- Description ---------->
+<tr><th valign="top" align=left>DESCRIPTION</th><td>
+<table border="1" cellspacing=1 cellpadding=4>
+<tr align="left" valign=top>
+<th width="80">Called When</th>
+<td>Called only from <a href="xxfi_eom.html">xxfi_eom</a>.</td>
+</tr>
+<tr align="left" valign=top>
+<th width="80">Effects</th>
+<td>smfi_quarantine quarantines the message using the given reason.</td>
+</tr>
+</table>
+
+<!----------- Arguments ---------->
+<tr><th valign="top" align=left>ARGUMENTS</th><td>
+ <table border="1" cellspacing=0>
+ <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
+ <tr valign="top"><td>ctx</td>
+ <td>Opaque context structure.
+ </td></tr>
+ <tr valign="top"><td>reason</td>
+ <td>The quarantine reason, a non-NULL and non-empty null-terminated string.
+ </td></tr>
+ </table>
+</td></tr>
+
+<!----------- Return values ---------->
+<tr>
+<th valign="top" align=left>RETURN VALUES</th>
+
+<td>smfi_quarantine will fail and return MI_FAILURE if:
+<ul>
+ <li>reason is NULL or empty.
+ <li>A network error occurs.
+ <li>SMFIF_QUARANTINE was not set when <a href="smfi_register.html">smfi_register</a> was called.
+</ul>
+Otherwise, it will return MI_SUCCESS
+</td>
+</tr>
+
+</table>
+
+<hr size="1">
+<font size="-1">
+Copyright (c) 2002-2003 Sendmail, Inc. and its suppliers.
+All rights reserved.
+<br>
+By using this file, you agree to the terms and conditions set
+forth in the LICENSE.
+</font>
+</body>
+</html>
diff --git a/contrib/sendmail/libmilter/docs/smfi_register.html b/contrib/sendmail/libmilter/docs/smfi_register.html
index 0aac254..3f6ed83 100644
--- a/contrib/sendmail/libmilter/docs/smfi_register.html
+++ b/contrib/sendmail/libmilter/docs/smfi_register.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_register</title></head>
<body>
+<!--
+$Id: smfi_register.html,v 1.11 2003/05/26 04:10:52 gshapiro Exp $
+-->
<h1>smfi_register</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_replacebody.html b/contrib/sendmail/libmilter/docs/smfi_replacebody.html
index 2ef0f49..91ac882 100644
--- a/contrib/sendmail/libmilter/docs/smfi_replacebody.html
+++ b/contrib/sendmail/libmilter/docs/smfi_replacebody.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_replacebody</title></head>
<body>
+<!--
+$Id: smfi_replacebody.html,v 1.13 2003/03/05 19:57:54 ca Exp $
+-->
<h1>smfi_replacebody</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_setbacklog.html b/contrib/sendmail/libmilter/docs/smfi_setbacklog.html
index d559266..79d8d52 100644
--- a/contrib/sendmail/libmilter/docs/smfi_setbacklog.html
+++ b/contrib/sendmail/libmilter/docs/smfi_setbacklog.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_setbacklog</title></head>
<body>
+<!--
+$Id: smfi_setbacklog.html,v 1.3 2003/03/05 19:57:54 ca Exp $
+-->
<h1>smfi_setbacklog</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_setconn.html b/contrib/sendmail/libmilter/docs/smfi_setconn.html
index 0f810b4..07461ccc 100644
--- a/contrib/sendmail/libmilter/docs/smfi_setconn.html
+++ b/contrib/sendmail/libmilter/docs/smfi_setconn.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_setconn</title></head>
<body>
+<!--
+$Id: smfi_setconn.html,v 1.14 2003/05/26 05:09:16 gshapiro Exp $
+-->
<h1>smfi_setconn</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_setdbg.html b/contrib/sendmail/libmilter/docs/smfi_setdbg.html
new file mode 100644
index 0000000..3203f0f
--- /dev/null
+++ b/contrib/sendmail/libmilter/docs/smfi_setdbg.html
@@ -0,0 +1,67 @@
+<html>
+<head><title>smfi_setdbg</title></head>
+<body>
+<!--
+$Id: smfi_setdbg.html,v 1.1 2003/12/03 17:28:49 ca Exp $
+-->
+<h1>smfi_setdbg</h1>
+
+<table border="0" cellspacing=4 cellpadding=4>
+<!---------- Synopsis ----------->
+<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
+<pre>
+#include &lt;libmilter/mfapi.h&gt;
+int smfi_setdbg(
+ int level;
+);
+</pre>
+Set the debugging (tracing) level for the milter library.
+</td></tr>
+
+<!----------- Description ---------->
+<tr><th valign="top" align=left>DESCRIPTION</th><td>
+<table border="1" cellspacing=1 cellpadding=4>
+<tr align="left" valign=top>
+<th width="80">Called When</th>
+<td>Called from any any routine at any time.</td>
+</tr>
+<tr align="left" valign=top>
+<th width="80">Effects</th>
+<td>smfi_setdbg sets the milter library's internal debugging level
+to a new level so that code details may be traced.
+A level of zero turns off debugging. The greater
+(more positive) the level the more detailed the debugging. Six is
+the current, highest, useful value.</td>
+</tr>
+</table>
+
+<!----------- Arguments ---------->
+<tr><th valign="top" align=left>ARGUMENTS</th><td>
+ <table border="1" cellspacing=0>
+ <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
+ <tr valign="top"><td>level</td>
+ <td>The new debugging level
+ </td></tr>
+ </table>
+</td></tr>
+
+<!----------- Return values ---------->
+<tr>
+<th valign="top" align=left>RETURN VALUES</th>
+
+<td>smfi_setdbg returns MI_SUCCESS by default.
+</td>
+</tr>
+
+</table>
+
+<hr size="1">
+<font size="-1">
+Copyright (c) 2003 Sendmail, Inc. and its suppliers.
+All rights reserved.
+<br>
+By using this file, you agree to the terms and conditions set
+forth in the LICENSE.
+</font>
+</body>
+</html>
diff --git a/contrib/sendmail/libmilter/docs/smfi_setmlreply.html b/contrib/sendmail/libmilter/docs/smfi_setmlreply.html
new file mode 100644
index 0000000..060c81d
--- /dev/null
+++ b/contrib/sendmail/libmilter/docs/smfi_setmlreply.html
@@ -0,0 +1,147 @@
+<html>
+<head><title>smfi_setmlreply</title></head>
+<body>
+<!--
+$Id: smfi_setmlreply.html,v 1.1 2004/01/01 00:32:45 gshapiro Exp $
+-->
+<h1>smfi_setmlreply</h1>
+
+<table border="0" cellspacing=4 cellpadding=4>
+<!---------- Synopsis ----------->
+<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
+<pre>
+#include &lt;libmilter/mfapi.h&gt;
+int smfi_setmlreply(
+ SMFICTX *ctx,
+ char *rcode,
+ char *xcode,
+ ...
+);
+</pre>
+Set the default SMTP error reply code to a multi-line response. Only 4XX
+and 5XX replies are accepted.
+</td></tr>
+
+<!----------- Description ---------->
+<tr><th valign="top" align=left>DESCRIPTION</th><td>
+<table border="1" cellspacing=1 cellpadding=4>
+<tr align="left" valign=top>
+<th width="80">Called When</th>
+<td>smfi_setmlreply may be called from any of the xxfi_ callbacks
+other than xxfi_connect.</td>
+</tr>
+<tr align="left" valign=top>
+<th width="80">Effects</th>
+<td>Directly set the SMTP error reply code for this connection to the given
+lines after the xcode. The list of arguments must be NULL terminated.
+This code will be used on subsequent error replies resulting from actions
+taken by this filter.</td>
+</tr>
+</table>
+
+<!----------- Arguments ---------->
+<tr><th valign="top" align=left>ARGUMENTS</th><td>
+ <table border="1" cellspacing=0>
+ <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
+ <tr valign="top"><td>ctx</td>
+ <td>Opaque context structure.
+ </td></tr>
+ <tr valign="top"><td>rcode</td>
+ <td>The three-digit (RFC 821/2821) SMTP reply code, as a
+ null-terminated string. rcode cannot be NULL, and must be a valid
+ 4XX or 5XX reply code.
+ </td></tr>
+ <tr valign="top"><td>xcode</td>
+ <td>The extended (RFC 1893/2034) reply code. If xcode is NULL, no
+ extended code is used. Otherwise, xcode must conform to RFC 1893/2034.
+ </td></tr>
+ <tr valign="top"><td>...</td>
+ <td>The remainder of the arguments are single lines of text, up to
+ 32 arguments, which will be used as the text part of the SMTP
+ reply. The list must be NULL terminated.
+ </td></tr>
+ </table>
+</td></tr>
+
+<!----------- Example ---------->
+<tr>
+<th valign="top" align=left>RETURN VALUES</th>
+<td>
+For example, the code:<BR>
+<pre>
+ ret = smfi_setmlreply(ctx, "550", "5.7.0",
+ "Spammer access rejected",
+ "Please see our policy at:",
+ "http://www.example.com/spampolicy.html",
+ NULL);
+</pre>
+<BR>would give the SMTP response:<BR>
+<pre>
+550-5.7.0 Spammer access rejected
+550-5.7.0 Please see our policy at:
+550 5.7.0 http://www.example.com/spampolicy.html
+</td>
+</tr>
+
+<!----------- Return values ---------->
+<tr>
+<th valign="top" align=left>RETURN VALUES</th>
+
+<td>smfi_setmlreply will fail and return MI_FAILURE if:
+<ul>
+ <li>The rcode or xcode argument is invalid.
+ <li>A memory-allocation failure occurs.
+ <li>If any text line contains a carraige return or line feed.
+ <li>The length of any text line is more than MAXREPLYLEN (980).
+ <li>More than 32 lines of text replies are given.
+</ul>
+Otherwise, it return MI_SUCCESS.
+</td>
+</tr>
+
+<!----------- Notes ---------->
+<tr align="left" valign=top>
+<th>NOTES</th>
+<td>
+<ul>
+<li>Values passed to smfi_setmlreply are not checked for standards compliance.
+<li>The message parameter should contain only printable characters,
+other characters may lead to undefined behavior.
+For example, CR or LF will cause the call to fail,
+single '%' characters will cause the text to be ignored
+(if there really should be a '%' in the string,
+use '%%' just like for <tt>printf(3)</tt>).
+<li>For details about reply codes and their meanings, please see RFC's
+<a href="http://www.rfc-editor.org/rfc/rfc821.txt">821</a>/
+<a href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</a>
+and
+<a href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</a>/
+<a href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</a>.
+<li>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
+for the message, the custom reply is not used.
+<li>Similarly, if the reply code (rcode) given is a '5XX' code but
+SMFI_TEMPFAIL is used for the message, the custom reply is not used.
+<BR>
+Note: in neither of the last two cases an error is returned to the milter,
+libmilter silently ignores the reply code.
+<li>
+If the milter returns SMFI_TEMPFAIL
+and sets the reply code to '421',
+then the SMTP server will terminate the SMTP session with a 421
+error code.
+</ul>
+</td>
+</tr>
+
+</table>
+
+<hr size="1">
+<font size="-1">
+Copyright (c) 2000, 2002-2003 Sendmail, Inc. and its suppliers.
+All rights reserved.
+<br>
+By using this file, you agree to the terms and conditions set
+forth in the LICENSE.
+</font>
+</body>
+</html>
diff --git a/contrib/sendmail/libmilter/docs/smfi_setpriv.html b/contrib/sendmail/libmilter/docs/smfi_setpriv.html
index 6bd7996..61e30a9 100644
--- a/contrib/sendmail/libmilter/docs/smfi_setpriv.html
+++ b/contrib/sendmail/libmilter/docs/smfi_setpriv.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_setpriv</title></head>
<body>
+<!--
+$Id: smfi_setpriv.html,v 1.9 2003/03/05 19:57:54 ca Exp $
+-->
<h1>smfi_setpriv</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_setreply.html b/contrib/sendmail/libmilter/docs/smfi_setreply.html
index d5b0e24..f62196b 100644
--- a/contrib/sendmail/libmilter/docs/smfi_setreply.html
+++ b/contrib/sendmail/libmilter/docs/smfi_setreply.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_setreply</title></head>
<body>
+<!--
+$Id: smfi_setreply.html,v 1.14 2003/11/16 05:04:01 ca Exp $
+-->
<h1>smfi_setreply</h1>
<table border="0" cellspacing=4 cellpadding=4>
@@ -91,6 +94,14 @@ and
for the message, the custom reply is not used.
<li>Similarly, if the reply code (rcode) given is a '5XX' code but
SMFI_TEMPFAIL is used for the message, the custom reply is not used.
+<BR>
+Note: in neither of the last two cases an error is returned to the milter,
+libmilter silently ignores the reply code.
+<li>
+If the milter returns SMFI_TEMPFAIL
+and sets the reply code to '421',
+then the SMTP server will terminate the SMTP session with a 421
+error code.
</ul>
</td>
</tr>
diff --git a/contrib/sendmail/libmilter/docs/smfi_settimeout.html b/contrib/sendmail/libmilter/docs/smfi_settimeout.html
index c27f817..08f01ed 100644
--- a/contrib/sendmail/libmilter/docs/smfi_settimeout.html
+++ b/contrib/sendmail/libmilter/docs/smfi_settimeout.html
@@ -1,6 +1,9 @@
<html>
<head><title>smfi_settimeout</title></head>
<body>
+<!--
+$Id: smfi_settimeout.html,v 1.11 2003/03/05 19:57:54 ca Exp $
+-->
<h1>smfi_settimeout</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/smfi_stop.html b/contrib/sendmail/libmilter/docs/smfi_stop.html
new file mode 100644
index 0000000..bf93423
--- /dev/null
+++ b/contrib/sendmail/libmilter/docs/smfi_stop.html
@@ -0,0 +1,73 @@
+<html>
+<head><title>smfi_stop</title></head>
+<body>
+<!--
+$Id: smfi_stop.html,v 1.2 2003/11/24 23:38:26 ca Exp $
+-->
+<h1>smfi_stop</h1>
+
+<table border="0" cellspacing=4 cellpadding=4>
+<!---------- Synopsis ----------->
+<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
+<pre>
+#include &lt;libmilter/mfapi.h&gt;
+int smfi_stop(void);
+</pre>
+Start an orderly shutdown of the milter. No connections will be accepted
+after this call.
+</td></tr>
+
+<!----------- Description ---------->
+<tr><th valign="top" align=left>DESCRIPTION</th><td>
+<table border="1" cellspacing=1 cellpadding=4>
+<tr align="left" valign=top>
+<th width="80">Called When</th>
+<td>Called from any of the <a href="api.html#callbacks">Callback</a> routines
+or any error-handling routines at any time.</td>
+</tr>
+<tr align="left" valign=top>
+<th width="80">Effects</th>
+<td>The smfi_stop routine
+causes each thread to finish its current connection, then exit.
+When all threads have exited, the call
+to <a href="smfi_main.html">smfi_main</a> returns to your calling program,
+which may then exit or warm-restart.
+</td>
+</tr>
+</table>
+
+<!----------- Arguments ---------->
+<tr><th valign="top" align=left>ARGUMENTS</th><td>
+ <table border="1" cellspacing=0>
+ <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
+ <tr valign="top"><td>void</td>
+ <td>Takes no arguement.
+ </td></tr>
+ </table>
+</td></tr>
+
+<!----------- Return values ---------->
+<tr>
+<th valign="top" align=left>RETURN VALUES</th>
+
+<td>smfi_stop always returns SMFI_CONTINUE. But note:
+<ul>
+ <li>Another internal routine may already have asked the milter to abort.
+ <li>Another routine may already have asked the milter to stop.
+ <li>There is no way to cancel the stop process once it has begun.
+</ul>
+</td>
+</tr>
+
+</table>
+
+<hr size="1">
+<font size="-1">
+Copyright (c) 2003 Sendmail, Inc. and its suppliers.
+All rights reserved.
+<br>
+By using this file, you agree to the terms and conditions set
+forth in the LICENSE.
+</font>
+</body>
+</html>
diff --git a/contrib/sendmail/libmilter/docs/xxfi_abort.html b/contrib/sendmail/libmilter/docs/xxfi_abort.html
index d47b505..3db1117 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_abort.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_abort.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_abort</title></head>
<body>
+<!--
+$Id: xxfi_abort.html,v 1.9 2003/03/05 19:57:55 ca Exp $
+-->
<h1>xxfi_abort</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/xxfi_body.html b/contrib/sendmail/libmilter/docs/xxfi_body.html
index 6aed207..044e9ce 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_body.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_body.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_body</title></head>
<body>
+<!--
+$Id: xxfi_body.html,v 1.12 2003/03/05 19:57:55 ca Exp $
+-->
<h1>xxfi_body</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/xxfi_close.html b/contrib/sendmail/libmilter/docs/xxfi_close.html
index 30db786..99b36e6 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_close.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_close.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_close</title></head>
<body>
+<!--
+$Id: xxfi_close.html,v 1.10 2004/06/16 22:41:36 ca Exp $
+-->
<h1>xxfi_close</h1>
<table border="0" cellspacing=4 cellpadding=4>
@@ -43,6 +46,18 @@ The current connection is being closed.
<th valign="top" align=left>NOTES</th>
<td>
<ul>
+<li>xxfi_close may be called "out-of-order", i.e. before even the
+xxfi_connect is called.
+After a connection is established by the MTA to the filter,
+if the MTA decides this connection's traffic will be discarded
+(e.g. via an access_db result), no data will be passed to the
+filter from the MTA until the client closes down.
+At that time, xxfi_close is called.
+It can therefore be the only callback ever used for a given connection,
+and developers should anticipate this possibility when crafting their
+xxfi_close code.
+In particular, it is incorrect to assume the private context pointer
+will be something other than NULL in this callback.
<li>xxfi_close is called on close even if the previous mail
transaction was aborted.
<li>xxfi_close is responsible for freeing any resources allocated on a
@@ -56,7 +71,7 @@ currently ignored.
<hr size="1">
<font size="-1">
-Copyright (c) 2000, 2003 Sendmail, Inc. and its suppliers.
+Copyright (c) 2000, 2003, 2004 Sendmail, Inc. and its suppliers.
All rights reserved.
<br>
By using this file, you agree to the terms and conditions set
diff --git a/contrib/sendmail/libmilter/docs/xxfi_connect.html b/contrib/sendmail/libmilter/docs/xxfi_connect.html
index 85d02e4..b39bc94 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_connect.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_connect.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_connect</title></head>
<body>
+<!--
+$Id: xxfi_connect.html,v 1.13 2003/10/29 22:54:16 msk Exp $
+-->
<h1>xxfi_connect</h1>
<table border="0" cellspacing=4 cellpadding=4>
@@ -78,7 +81,9 @@ is passed to smfi_register().
<tr valign="top">
<td>SMFIS_TEMPFAIL</td>
<td>Reject all commands and messages from this client with a
- temporary failure reply code. </td>
+ temporary failure reply code. If also used in conjunction
+ with <tt>smfi_setreply()</tt> to set a reply whose SMTP
+ code is 421, the MTA will drop the connection immediately. </td>
</tr>
<tr valign="top">
<td>SMFIS_REJECT</td>
diff --git a/contrib/sendmail/libmilter/docs/xxfi_envfrom.html b/contrib/sendmail/libmilter/docs/xxfi_envfrom.html
index 5eeaa37..df9e0fc 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_envfrom.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_envfrom.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_envfrom</title></head>
<body>
+<!--
+$Id: xxfi_envfrom.html,v 1.9 2003/03/05 19:57:55 ca Exp $
+-->
<h1>xxfi_envfrom</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/xxfi_envrcpt.html b/contrib/sendmail/libmilter/docs/xxfi_envrcpt.html
index a96ac95..e0c6094 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_envrcpt.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_envrcpt.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_envrcpt</title></head>
<body>
+<!--
+$Id: xxfi_envrcpt.html,v 1.11 2003/12/30 00:19:42 gshapiro Exp $
+-->
<h1>xxfi_envrcpt</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/xxfi_eoh.html b/contrib/sendmail/libmilter/docs/xxfi_eoh.html
index b745959..350ca96 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_eoh.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_eoh.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_eoh</title></head>
<body>
+<!--
+$Id: xxfi_eoh.html,v 1.8 2003/03/05 19:57:55 ca Exp $
+-->
<h1>xxfi_eoh</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/xxfi_eom.html b/contrib/sendmail/libmilter/docs/xxfi_eom.html
index 1c99103..78c6943 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_eom.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_eom.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_eom</title></head>
<body>
+<!--
+$Id: xxfi_eom.html,v 1.9 2003/03/05 19:57:55 ca Exp $
+-->
<h1>xxfi_eom</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/xxfi_header.html b/contrib/sendmail/libmilter/docs/xxfi_header.html
index 1be4958..3ad3e5b 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_header.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_header.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_header</title></head>
<body>
+<!--
+$Id: xxfi_header.html,v 1.10 2003/03/05 19:57:55 ca Exp $
+-->
<h1>xxfi_header</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/docs/xxfi_helo.html b/contrib/sendmail/libmilter/docs/xxfi_helo.html
index 0eb8df6..dc7bbf3 100644
--- a/contrib/sendmail/libmilter/docs/xxfi_helo.html
+++ b/contrib/sendmail/libmilter/docs/xxfi_helo.html
@@ -1,6 +1,9 @@
<html>
<head><title>xxfi_helo</title></head>
<body>
+<!--
+$Id: xxfi_helo.html,v 1.8 2003/03/05 19:57:55 ca Exp $
+-->
<h1>xxfi_helo</h1>
<table border="0" cellspacing=4 cellpadding=4>
diff --git a/contrib/sendmail/libmilter/engine.c b/contrib/sendmail/libmilter/engine.c
index 6bd225c..66ed992 100644
--- a/contrib/sendmail/libmilter/engine.c
+++ b/contrib/sendmail/libmilter/engine.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: engine.c,v 8.109.2.8 2003/12/01 23:57:45 msk Exp $")
+SM_RCSID("@(#)$Id: engine.c,v 8.119 2003/12/02 18:53:57 ca Exp $")
#include "libmilter.h"
@@ -64,16 +64,10 @@ typedef struct cmdfct_t cmdfct;
#define CI_HELO 1
#define CI_MAIL 2
#define CI_RCPT 3
-#if _FFR_MILTER_MACROS_EOM
-# define CI_EOM 4
-# if CI_EOM >= MAX_MACROS_ENTRIES
+#define CI_EOM 4
+#if CI_EOM >= MAX_MACROS_ENTRIES
ERROR: do not compile with CI_EOM >= MAX_MACROS_ENTRIES
-# endif
-#else /* _FFR_MILTER_MACROS_EOM */
-# if CI_RCPT >= MAX_MACROS_ENTRIES
-ERROR: do not compile with CI_RCPT >= MAX_MACROS_ENTRIES
-# endif
-#endif /* _FFR_MILTER_MACROS_EOM */
+#endif
/* function prototypes */
static int st_abortfct __P((genarg *));
@@ -86,6 +80,12 @@ static int st_helo __P((genarg *));
static int st_header __P((genarg *));
static int st_sender __P((genarg *));
static int st_rcpt __P((genarg *));
+#if SMFI_VERSION > 2
+static int st_unknown __P((genarg *));
+#endif /* SMFI_VERSION > 2 */
+#if SMFI_VERSION > 3
+static int st_data __P((genarg *));
+#endif /* SMFI_VERSION > 3 */
static int st_eoh __P((genarg *));
static int st_quit __P((genarg *));
static int sendreply __P((sfsistat, socket_t, struct timeval *, SMFICTX_PTR));
@@ -102,13 +102,15 @@ static int dec_arg2 __P((char *, size_t, char **, char **));
#define ST_HELO 3 /* helo */
#define ST_MAIL 4 /* mail from */
#define ST_RCPT 5 /* rcpt to */
-#define ST_HDRS 6 /* headers */
-#define ST_EOHS 7 /* end of headers */
-#define ST_BODY 8 /* body */
-#define ST_ENDM 9 /* end of message */
-#define ST_QUIT 10 /* quit */
-#define ST_ABRT 11 /* abort */
-#define ST_LAST ST_ABRT
+#define ST_DATA 6 /* data */
+#define ST_HDRS 7 /* headers */
+#define ST_EOHS 8 /* end of headers */
+#define ST_BODY 9 /* body */
+#define ST_ENDM 10 /* end of message */
+#define ST_QUIT 11 /* quit */
+#define ST_ABRT 12 /* abort */
+#define ST_UNKN 13 /* unknown SMTP command */
+#define ST_LAST ST_UNKN /* last valid state */
#define ST_SKIP 15 /* not a state but required for the state table */
/* in a mail transaction? must be before eom according to spec. */
@@ -125,19 +127,25 @@ static int dec_arg2 __P((char *, size_t, char **, char **));
#define MI_MASK(x) (0x0001 << (x)) /* generate a bit "mask" for a state */
#define NX_INIT (MI_MASK(ST_OPTS))
-#define NX_OPTS (MI_MASK(ST_CONN))
-#define NX_CONN (MI_MASK(ST_HELO) | MI_MASK(ST_MAIL))
-#define NX_HELO (MI_MASK(ST_HELO) | MI_MASK(ST_MAIL))
-#define NX_MAIL (MI_MASK(ST_RCPT) | MI_MASK(ST_ABRT))
-#define NX_RCPT (MI_MASK(ST_HDRS) | MI_MASK(ST_EOHS) | \
+#define NX_OPTS (MI_MASK(ST_CONN) | MI_MASK(ST_UNKN))
+#define NX_CONN (MI_MASK(ST_HELO) | MI_MASK(ST_MAIL) | MI_MASK(ST_UNKN))
+#define NX_HELO (MI_MASK(ST_HELO) | MI_MASK(ST_MAIL) | MI_MASK(ST_UNKN))
+#define NX_MAIL (MI_MASK(ST_RCPT) | MI_MASK(ST_ABRT) | MI_MASK(ST_UNKN))
+#define NX_RCPT (MI_MASK(ST_HDRS) | MI_MASK(ST_EOHS) | MI_MASK(ST_DATA) | \
MI_MASK(ST_BODY) | MI_MASK(ST_ENDM) | \
- MI_MASK(ST_RCPT) | MI_MASK(ST_ABRT))
+ MI_MASK(ST_RCPT) | MI_MASK(ST_ABRT) | MI_MASK(ST_UNKN))
+#define NX_DATA (MI_MASK(ST_EOHS) | MI_MASK(ST_HDRS) | MI_MASK(ST_ABRT))
#define NX_HDRS (MI_MASK(ST_EOHS) | MI_MASK(ST_HDRS) | MI_MASK(ST_ABRT))
#define NX_EOHS (MI_MASK(ST_BODY) | MI_MASK(ST_ENDM) | MI_MASK(ST_ABRT))
#define NX_BODY (MI_MASK(ST_ENDM) | MI_MASK(ST_BODY) | MI_MASK(ST_ABRT))
-#define NX_ENDM (MI_MASK(ST_QUIT) | MI_MASK(ST_MAIL))
+#define NX_ENDM (MI_MASK(ST_QUIT) | MI_MASK(ST_MAIL) | MI_MASK(ST_UNKN))
#define NX_QUIT 0
#define NX_ABRT 0
+#define NX_UNKN (MI_MASK(ST_HELO) | MI_MASK(ST_MAIL) | \
+ MI_MASK(ST_RCPT) | MI_MASK(ST_ABRT) | \
+ MI_MASK(ST_DATA) | \
+ MI_MASK(ST_BODY) | MI_MASK(ST_UNKN) | \
+ MI_MASK(ST_ABRT) | MI_MASK(ST_QUIT))
#define NX_SKIP MI_MASK(ST_SKIP)
static int next_states[] =
@@ -148,12 +156,14 @@ static int next_states[] =
NX_HELO,
NX_MAIL,
NX_RCPT,
+ NX_DATA,
NX_HDRS,
NX_EOHS,
NX_BODY,
NX_ENDM,
NX_QUIT,
- NX_ABRT
+ NX_ABRT,
+ NX_UNKN
};
/* commands received by milter */
@@ -163,18 +173,20 @@ static cmdfct cmds[] =
{SMFIC_MACRO, CM_ARGV, ST_NONE, CT_KEEP, CI_NONE, st_macros },
{SMFIC_BODY, CM_ARG1, ST_BODY, CT_CONT, CI_NONE, st_bodychunk },
{SMFIC_CONNECT, CM_ARG2, ST_CONN, CT_CONT, CI_CONN, st_connectinfo },
-#if _FFR_MILTER_MACROS_EOM
{SMFIC_BODYEOB, CM_ARG1, ST_ENDM, CT_CONT, CI_EOM, st_bodyend },
-#else /* _FFR_MILTER_MACROS_EOM */
-{SMFIC_BODYEOB, CM_ARG1, ST_ENDM, CT_CONT, CI_NONE, st_bodyend },
-#endif /* _FFR_MILTER_MACROS_EOM */
{SMFIC_HELO, CM_ARG1, ST_HELO, CT_CONT, CI_HELO, st_helo },
{SMFIC_HEADER, CM_ARG2, ST_HDRS, CT_CONT, CI_NONE, st_header },
{SMFIC_MAIL, CM_ARGV, ST_MAIL, CT_CONT, CI_MAIL, st_sender },
{SMFIC_OPTNEG, CM_ARGO, ST_OPTS, CT_CONT, CI_NONE, st_optionneg },
{SMFIC_EOH, CM_ARG0, ST_EOHS, CT_CONT, CI_NONE, st_eoh },
{SMFIC_QUIT, CM_ARG0, ST_QUIT, CT_END, CI_NONE, st_quit },
+#if SMFI_VERSION > 3
+{SMFIC_DATA, CM_ARG0, ST_DATA, CT_CONT, CI_NONE, st_data },
+#endif /* SMFI_VERSION > 3 */
{SMFIC_RCPT, CM_ARGV, ST_RCPT, CT_IGNO, CI_RCPT, st_rcpt }
+#if SMFI_VERSION > 2
+,{SMFIC_UNKNOWN,CM_ARG1, ST_UNKN, CT_IGNO, CI_NONE, st_unknown }
+#endif /* SMFI_VERSION > 2 */
};
/* additional (internal) reply codes */
@@ -698,6 +710,7 @@ st_connectinfo(g)
return (*fi_connect)(g->a_ctx, g->a_buf,
family != SMFIA_UNKNOWN ? &sockaddr : NULL);
}
+
/*
** ST_EOH -- end of headers
**
@@ -721,6 +734,33 @@ st_eoh(g)
return (*fi_eoh)(g->a_ctx);
return SMFIS_CONTINUE;
}
+
+#if SMFI_VERSION > 3
+/*
+** ST_DATA -- DATA command
+**
+** Parameters:
+** g -- generic argument structure
+**
+** Returns:
+** continue or filter-specified value
+*/
+
+static int
+st_data(g)
+ genarg *g;
+{
+ sfsistat (*fi_data) __P((SMFICTX *));
+
+ if (g == NULL)
+ return _SMFIS_ABORT;
+ if (g->a_ctx->ctx_smfi != NULL &&
+ (fi_data = g->a_ctx->ctx_smfi->xxfi_data) != NULL)
+ return (*fi_data)(g->a_ctx);
+ return SMFIS_CONTINUE;
+}
+#endif /* SMFI_VERSION > 3 */
+
/*
** ST_HELO -- helo/ehlo command
**
@@ -826,6 +866,34 @@ st_rcpt(g)
{
ARGV_FCT(fi_envrcpt, xxfi_envrcpt, CI_RCPT)
}
+
+#if SMFI_VERSION > 2
+/*
+** ST_UNKNOWN -- unrecognized or unimplemented command
+**
+** Parameters:
+** g -- generic argument structure
+**
+** Returns:
+** continue or filter-specified value
+*/
+
+static int
+st_unknown(g)
+ genarg *g;
+{
+ sfsistat (*fi_unknown) __P((SMFICTX *, char *));
+
+ if (g == NULL)
+ return _SMFIS_ABORT;
+ mi_clr_macros(g->a_ctx, g->a_idx + 1);
+ if (g->a_ctx->ctx_smfi != NULL &&
+ (fi_unknown = g->a_ctx->ctx_smfi->xxfi_unknown) != NULL)
+ return (*fi_unknown)(g->a_ctx, g->a_buf);
+ return SMFIS_CONTINUE;
+}
+#endif /* SMFI_VERSION > 2 */
+
/*
** ST_MACROS -- deal with macros received from the MTA
**
@@ -864,11 +932,9 @@ st_macros(g)
case SMFIC_RCPT:
i = CI_RCPT;
break;
-#if _FFR_MILTER_MACROS_EOM
case SMFIC_BODYEOB:
i = CI_EOM;
break;
-#endif /* _FFR_MILTER_MACROS_EOM */
default:
free(argv);
return _SMFIS_FAIL;
diff --git a/contrib/sendmail/libmilter/handler.c b/contrib/sendmail/libmilter/handler.c
index db3cc46..3acfc5f 100644
--- a/contrib/sendmail/libmilter/handler.c
+++ b/contrib/sendmail/libmilter/handler.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: handler.c,v 8.30.2.4 2003/01/23 22:28:36 ca Exp $")
+SM_RCSID("@(#)$Id: handler.c,v 8.36 2003/09/08 21:27:14 yuri Exp $")
#include "libmilter.h"
diff --git a/contrib/sendmail/libmilter/libmilter.h b/contrib/sendmail/libmilter/libmilter.h
index 13bddce..65b0a47 100644
--- a/contrib/sendmail/libmilter/libmilter.h
+++ b/contrib/sendmail/libmilter/libmilter.h
@@ -19,7 +19,7 @@
#ifdef _DEFINE
# define EXTERN
# define INIT(x) = x
-SM_IDSTR(MilterlId, "@(#)$Id: libmilter.h,v 8.33.2.13 2003/10/20 21:51:50 msk Exp $")
+SM_IDSTR(MilterlId, "@(#)$Id: libmilter.h,v 8.50 2003/12/11 18:14:34 ca Exp $")
#else /* _DEFINE */
# define EXTERN extern
# define INIT(x)
@@ -49,7 +49,7 @@ typedef pthread_mutex_t smutex_t;
# define smutex_unlock(mp) (pthread_mutex_unlock(mp) == 0)
# define smutex_trylock(mp) (pthread_mutex_trylock(mp) == 0)
-#if _FFR_USE_POLL
+#if SM_CONF_POLL
# include <poll.h>
# define MI_POLLSELECT "poll"
@@ -86,7 +86,7 @@ typedef pthread_mutex_t smutex_t;
# define FD_RD_READY(sd, rds, excs, timeout) \
poll(&(rds), 1, MI_MS(timeout))
-#else /* _FFR_USE_POLL */
+#else /* SM_CONF_POLL */
# include <sm/fdset.h>
# define MI_POLLSELECT "select"
@@ -113,7 +113,7 @@ typedef pthread_mutex_t smutex_t;
# define FD_RD_READY(sd, rds, excs, timeout) \
select((sd) + 1, &(rds), NULL, &(excs), (timeout))
-#endif /* _FFR_USE_POLL */
+#endif /* SM_CONF_POLL */
#include <sys/time.h>
diff --git a/contrib/sendmail/libmilter/listener.c b/contrib/sendmail/libmilter/listener.c
index bb7a297..ee88f23 100644
--- a/contrib/sendmail/libmilter/listener.c
+++ b/contrib/sendmail/libmilter/listener.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: listener.c,v 8.85.2.17 2003/10/21 17:22:57 ca Exp $")
+SM_RCSID("@(#)$Id: listener.c,v 8.109 2004/02/04 22:55:59 ca Exp $")
/*
** listener.c -- threaded network listener
@@ -41,7 +41,7 @@ static socket_t mi_milteropen __P((char *, int, bool, char *));
** backlog -- listen backlog
** dbg -- debug level
** rmsocket -- if true, try to unlink() the socket first
-** (UNIX domain sockets only)
+** (UNIX domain sockets only)
** smfi -- filter structure to use
**
** Return value:
@@ -79,7 +79,7 @@ mi_opensocket(conn, backlog, dbg, rmsocket, smfi)
(void) smutex_unlock(&L_Mutex);
return MI_FAILURE;
}
-#if !_FFR_USE_POLL
+#if !SM_CONF_POLL
if (!SM_FD_OK_SELECT(listenfd))
{
smi_log(SMI_LOG_ERR, "%s: fd %d is larger than FD_SETSIZE %d",
@@ -87,7 +87,7 @@ mi_opensocket(conn, backlog, dbg, rmsocket, smfi)
(void) smutex_unlock(&L_Mutex);
return MI_FAILURE;
}
-#endif /* !_FFR_USE_POLL */
+#endif /* !SM_CONF_POLL */
return MI_SUCCESS;
}
@@ -585,9 +585,7 @@ mi_closener()
struct stat fileinfo;
removable = sockpath != NULL &&
-#if _FFR_MILTER_ROOT_UNSAFE
geteuid() != 0 &&
-#endif /* _FFR_MILTER_ROOT_UNSAFE */
fstat(listenfd, &sockinfo) == 0 &&
(S_ISFIFO(sockinfo.st_mode)
# ifdef S_ISSOCK
@@ -635,8 +633,6 @@ mi_closener()
** Parameters:
** conn -- connection description
** dbg -- debug level
-** rmsocket -- if true, try to unlink() the socket first
-** (UNIX domain sockets only)
** smfi -- filter structure to use
** timeout -- timeout for reads/writes
** backlog -- listen queue backlog size
@@ -704,6 +700,9 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
int backlog;
{
socket_t connfd = INVALID_SOCKET;
+#if _FFR_DUP_FD
+ socket_t dupfd = INVALID_SOCKET;
+#endif /* _FFR_DUP_FD */
int sockopt = 1;
int r, mistop;
int ret = MI_SUCCESS;
@@ -802,7 +801,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
save_errno = EINVAL;
}
-#if !_FFR_USE_POLL
+#if !SM_CONF_POLL
/* check if acceptable for select() */
if (ValidSocket(connfd) && !SM_FD_OK_SELECT(connfd))
{
@@ -810,11 +809,36 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
connfd = INVALID_SOCKET;
save_errno = ERANGE;
}
-#endif /* !_FFR_USE_POLL */
+#endif /* !SM_CONF_POLL */
if (!ValidSocket(connfd))
{
- if (save_errno == EINTR)
+ if (save_errno == EINTR
+#ifdef EAGAIN
+ || save_errno == EAGAIN
+#endif /* EAGAIN */
+#ifdef ECONNABORTED
+ || save_errno == ECONNABORTED
+#endif /* ECONNABORTED */
+#ifdef EMFILE
+ || save_errno == EMFILE
+#endif /* EMFILE */
+#ifdef ENFILE
+ || save_errno == ENFILE
+#endif /* ENFILE */
+#ifdef ENOBUFS
+ || save_errno == ENOBUFS
+#endif /* ENOBUFS */
+#ifdef ENOMEM
+ || save_errno == ENOMEM
+#endif /* ENOMEM */
+#ifdef ENOSR
+ || save_errno == ENOSR
+#endif /* ENOSR */
+#ifdef EWOULDBLOCK
+ || save_errno == EWOULDBLOCK
+#endif /* EWOULDBLOCK */
+ )
continue;
acnt++;
smi_log(SMI_LOG_ERR,
@@ -830,6 +854,19 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
continue;
}
acnt = 0; /* reset error counter for accept() */
+#if _FFR_DUP_FD
+ dupfd = fcntl(connfd, F_DUPFD, 256);
+ if (ValidSocket(dupfd)
+# if !SM_CONF_POLL
+ && SM_FD_OK_SELECT(dupfd)
+# endif /* !SM_CONF_POLL */
+ )
+ {
+ close(connfd);
+ connfd = dupfd;
+ dupfd = INVALID_SOCKET;
+ }
+#endif /* _FFR_DUP_FD */
if (setsockopt(connfd, SOL_SOCKET, SO_KEEPALIVE,
(void *) &sockopt, sizeof sockopt) < 0)
diff --git a/contrib/sendmail/libmilter/main.c b/contrib/sendmail/libmilter/main.c
index 36b99f0..8692127 100644
--- a/contrib/sendmail/libmilter/main.c
+++ b/contrib/sendmail/libmilter/main.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: main.c,v 8.64.2.13 2003/10/20 22:27:13 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.79 2003/10/20 22:25:09 ca Exp $")
#define _DEFINE 1
#include "libmilter.h"
@@ -95,10 +95,9 @@ static char *conn = NULL;
static int timeout = MI_TIMEOUT;
static int backlog = MI_SOMAXCONN;
-#if _FFR_SMFI_OPENSOCKET
/*
** SMFI_OPENSOCKET -- try the socket setup to make sure we'll be
-** able to start up
+** able to start up
**
** Parameters:
** rmsocket -- if true, instructs libmilter to attempt
@@ -118,7 +117,6 @@ smfi_opensocket(rmsocket)
return mi_opensocket(conn, backlog, dbg, rmsocket, smfi);
}
-#endif /* _FFR_SMFI_OPENSOCKET */
/*
** SMFI_SETDBG -- set debug level.
@@ -239,6 +237,7 @@ smfi_main()
/* Startup the listener */
if (mi_listener(conn, dbg, smfi, timeout, backlog) != MI_SUCCESS)
r = MI_FAILURE;
+
return r;
}
diff --git a/contrib/sendmail/libmilter/signal.c b/contrib/sendmail/libmilter/signal.c
index 94e7f15..eed8b7c 100644
--- a/contrib/sendmail/libmilter/signal.c
+++ b/contrib/sendmail/libmilter/signal.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: signal.c,v 8.37.2.4 2003/11/19 00:22:40 ca Exp $")
+SM_RCSID("@(#)$Id: signal.c,v 8.41 2003/11/19 00:25:20 ca Exp $")
#include "libmilter.h"
diff --git a/contrib/sendmail/libmilter/smfi.c b/contrib/sendmail/libmilter/smfi.c
index 032a6ac..ead2c04 100644
--- a/contrib/sendmail/libmilter/smfi.c
+++ b/contrib/sendmail/libmilter/smfi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2004 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,58 +9,122 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: smfi.c,v 8.64 2002/04/30 22:22:02 msk Exp $")
+SM_RCSID("@(#)$Id: smfi.c,v 8.72 2004/05/05 00:07:21 msk Exp $")
#include <sm/varargs.h>
#include "libmilter.h"
+static int smfi_header __P((SMFICTX *, int, int, char *, char *));
+
/* for smfi_set{ml}reply, let's be generous. 256/16 should be sufficient */
#define MAXREPLYLEN 980 /* max. length of a reply string */
#define MAXREPLIES 32 /* max. number of reply strings */
/*
-** SMFI_ADDHEADER -- send a new header to the MTA
+** SMFI_HEADER -- send a header to the MTA
**
** Parameters:
** ctx -- Opaque context structure
+** cmd -- Header modification command
+** hdridx -- Header index
** headerf -- Header field name
** headerv -- Header field value
**
+**
** Returns:
** MI_SUCCESS/MI_FAILURE
*/
-int
-smfi_addheader(ctx, headerf, headerv)
+static int
+smfi_header(ctx, cmd, hdridx, headerf, headerv)
SMFICTX *ctx;
+ int cmd;
+ int hdridx;
char *headerf;
char *headerv;
{
- /* do we want to copy the stuff or have a special mi_wr_cmd call? */
- size_t len, l1, l2;
+ size_t len, l1, l2, offset;
int r;
+ mi_int32 v;
char *buf;
struct timeval timeout;
if (headerf == NULL || *headerf == '\0' || headerv == NULL)
return MI_FAILURE;
- if (!mi_sendok(ctx, SMFIF_ADDHDRS))
- return MI_FAILURE;
timeout.tv_sec = ctx->ctx_timeout;
timeout.tv_usec = 0;
- l1 = strlen(headerf);
- l2 = strlen(headerv);
- len = l1 + l2 + 2;
+ l1 = strlen(headerf) + 1;
+ l2 = strlen(headerv) + 1;
+ len = l1 + l2;
+ if (hdridx >= 0)
+ len += MILTER_LEN_BYTES;
buf = malloc(len);
if (buf == NULL)
return MI_FAILURE;
- (void) memcpy(buf, headerf, l1 + 1);
- (void) memcpy(buf + l1 + 1, headerv, l2 + 1);
- r = mi_wr_cmd(ctx->ctx_sd, &timeout, SMFIR_ADDHEADER, buf, len);
+ offset = 0;
+ if (hdridx >= 0)
+ {
+ v = htonl(hdridx);
+ (void) memcpy(&(buf[0]), (void *) &v, MILTER_LEN_BYTES);
+ offset += MILTER_LEN_BYTES;
+ }
+ (void) memcpy(buf + offset, headerf, l1);
+ (void) memcpy(buf + offset + l1, headerv, l2);
+ r = mi_wr_cmd(ctx->ctx_sd, &timeout, cmd, buf, len);
free(buf);
return r;
}
/*
+** SMFI_ADDHEADER -- send a new header to the MTA
+**
+** Parameters:
+** ctx -- Opaque context structure
+** headerf -- Header field name
+** headerv -- Header field value
+**
+** Returns:
+** MI_SUCCESS/MI_FAILURE
+*/
+
+int
+smfi_addheader(ctx, headerf, headerv)
+ SMFICTX *ctx;
+ char *headerf;
+ char *headerv;
+{
+ if (!mi_sendok(ctx, SMFIF_ADDHDRS))
+ return MI_FAILURE;
+
+ return smfi_header(ctx, SMFIR_ADDHEADER, -1, headerf, headerv);
+}
+
+/*
+** SMFI_INSHEADER -- send a new header to the MTA (to be inserted)
+**
+** Parameters:
+** ctx -- Opaque context structure
+** hdridx -- index into header list where insertion should occur
+** headerf -- Header field name
+** headerv -- Header field value
+**
+** Returns:
+** MI_SUCCESS/MI_FAILURE
+*/
+
+int
+smfi_insheader(ctx, hdridx, headerf, headerv)
+ SMFICTX *ctx;
+ int hdridx;
+ char *headerf;
+ char *headerv;
+{
+ if (!mi_sendok(ctx, SMFIF_ADDHDRS) || hdridx < 0)
+ return MI_FAILURE;
+
+ return smfi_header(ctx, SMFIR_INSHEADER, hdridx, headerf, headerv);
+}
+
+/*
** SMFI_CHGHEADER -- send a changed header to the MTA
**
** Parameters:
@@ -80,36 +144,12 @@ smfi_chgheader(ctx, headerf, hdridx, headerv)
mi_int32 hdridx;
char *headerv;
{
- /* do we want to copy the stuff or have a special mi_wr_cmd call? */
- size_t len, l1, l2;
- int r;
- mi_int32 v;
- char *buf;
- struct timeval timeout;
-
- if (headerf == NULL || *headerf == '\0')
- return MI_FAILURE;
- if (hdridx < 0)
- return MI_FAILURE;
- if (!mi_sendok(ctx, SMFIF_CHGHDRS))
+ if (!mi_sendok(ctx, SMFIF_CHGHDRS) || hdridx < 0)
return MI_FAILURE;
- timeout.tv_sec = ctx->ctx_timeout;
- timeout.tv_usec = 0;
if (headerv == NULL)
headerv = "";
- l1 = strlen(headerf);
- l2 = strlen(headerv);
- len = l1 + l2 + 2 + MILTER_LEN_BYTES;
- buf = malloc(len);
- if (buf == NULL)
- return MI_FAILURE;
- v = htonl(hdridx);
- (void) memcpy(&(buf[0]), (void *) &v, MILTER_LEN_BYTES);
- (void) memcpy(buf + MILTER_LEN_BYTES, headerf, l1 + 1);
- (void) memcpy(buf + MILTER_LEN_BYTES + l1 + 1, headerv, l2 + 1);
- r = mi_wr_cmd(ctx->ctx_sd, &timeout, SMFIR_CHGHEADER, buf, len);
- free(buf);
- return r;
+
+ return smfi_header(ctx, SMFIR_CHGHEADER, hdridx, headerf, headerv);
}
/*
@@ -214,7 +254,6 @@ smfi_replacebody(ctx, bodyp, bodylen)
return MI_SUCCESS;
}
-#if _FFR_QUARANTINE
/*
** SMFI_QUARANTINE -- quarantine an envelope
**
@@ -251,7 +290,6 @@ smfi_quarantine(ctx, reason)
free(buf);
return r;
}
-#endif /* _FFR_QUARANTINE */
/*
** MYISENHSC -- check whether a string contains an enhanced status code
@@ -365,7 +403,6 @@ smfi_setreply(ctx, rcode, xcode, message)
return MI_SUCCESS;
}
-#if _FFR_MULTILINE
/*
** SMFI_SETMLREPLY -- set multiline reply code for the next reply to the MTA
**
@@ -477,7 +514,6 @@ smfi_setmlreply(ctx, rcode, xcode, va_alist)
SM_VA_END(ap);
return MI_SUCCESS;
}
-#endif /* _FFR_MULTILINE */
/*
** SMFI_SETPRIV -- set private data
@@ -584,7 +620,6 @@ smfi_getsymval(ctx, symname)
return NULL;
}
-#if _FFR_SMFI_PROGRESS
/*
** SMFI_PROGRESS -- send "progress" message to the MTA to prevent premature
** timeouts during long milter-side operations
@@ -610,4 +645,3 @@ smfi_progress(ctx)
return mi_wr_cmd(ctx->ctx_sd, &timeout, SMFIR_PROGRESS, NULL, 0);
}
-#endif /* _FFR_SMFI_PROGRESS */
OpenPOWER on IntegriCloud