diff options
Diffstat (limited to 'libmilter')
57 files changed, 355 insertions, 276 deletions
diff --git a/libmilter/Makefile b/libmilter/Makefile index 825ddd52d9d6f..181c3b671b91b 100644 --- a/libmilter/Makefile +++ b/libmilter/Makefile @@ -6,10 +6,10 @@ OPTIONS= $(CONFIG) $(FLAGS) all: FRC $(SHELL) $(BUILD) $(OPTIONS) $@ -check: FRC - $(SHELL) $(BUILD) $(OPTIONS) $@ clean: FRC $(SHELL) $(BUILD) $(OPTIONS) $@ +check: FRC + $(SHELL) $(BUILD) $(OPTIONS) $@ install: FRC $(SHELL) $(BUILD) $(OPTIONS) $@ diff --git a/libmilter/README b/libmilter/README index 64e1cca1cf7c1..73953823b6709 100644 --- a/libmilter/README +++ b/libmilter/README @@ -115,7 +115,7 @@ T=C:5m;S:10s;R:10s;E:5m where 's' is seconds and 'm' is minutes. -Which filters are invoked and their sequencing is handled by the +Which filters are invoked and their sequencing is handled by the InputMailFilters option. Note: if InputMailFilters is not defined no filters will be used. @@ -207,28 +207,19 @@ libmilter requires pthread support in the operating system. Moreover, it requires that the library functions it uses are thread safe; which is true for the operating systems libmilter has been developed and tested on. On some operating systems this requires special compile time options (e.g., -not just -pthread). libmilter is currently known to work on (modulo problems -in the pthread support of some specific versions): - -FreeBSD 3.x, 4.x -SunOS 5.x (x >= 5) -AIX 4.3.x -HP UX 11.x -Linux (recent versions/distributions) - -libmilter is currently not supported on: +not just -pthread). +So far, libmilter is not supported on: IRIX 6.x Ultrix Feedback about problems (and possible fixes) is welcome. + +--------------------------+ | SOURCE FOR SAMPLE FILTER | +--------------------------+ Note that the filter example.c may not be thread safe on some operating systems. You should check your system man pages for the functions used -below to verify the functions are thread safe. - -$Revision: 8.42 $, Last updated $Date: 2006-06-29 17:10:16 $ +to verify they are thread safe. diff --git a/libmilter/comm.c b/libmilter/comm.c index a551a5253fd80..05dfdb61457ce 100644 --- a/libmilter/comm.c +++ b/libmilter/comm.c @@ -139,9 +139,9 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name) } #if _FFR_ADD_NULL buf = malloc(expl + 1); -#else /* _FFR_ADD_NULL */ +#else buf = malloc(expl); -#endif /* _FFR_ADD_NULL */ +#endif if (buf == NULL) { *cmd = SMFIC_MALLOC; @@ -194,7 +194,7 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name) #if _FFR_ADD_NULL /* makes life simpler for common string routines */ buf[expl] = '\0'; -#endif /* _FFR_ADD_NULL */ +#endif return buf; } i += len; diff --git a/libmilter/docs/api.html b/libmilter/docs/api.html index b314a0f4e96d4..4a90e9a432e60 100644 --- a/libmilter/docs/api.html +++ b/libmilter/docs/api.html @@ -15,7 +15,7 @@ $Id: api.html,v 1.39 2013-11-22 20:51:39 ca Exp $ <LI><A HREF="#Miscellaneous">Miscellaneous</A> </UL> -<H2><A NAME="LibraryControlFunctions">Library Control Functions</A></H2> +<H2><A NAME="LibraryControlFunctions">Library Control Functions</A></H2> Before handing control to libmilter (by calling <A HREF="smfi_main.html">smfi_main</A>), a filter may call the following @@ -23,11 +23,12 @@ functions to set libmilter parameters. In particular, the filter must call <A HREF="smfi_register.html">smfi_register</A> to register its callbacks. Each function will return either MI_SUCCESS or MI_FAILURE to -indicate the status of the operation. +indicate the status of the operation. <P> -None of these functions communicate with the MTA. All alter the -library's state, some of which is communicated to the MTA inside +None of these functions communicate with the MTA. +All alter the library's state, some of which +is communicated to the MTA inside <A HREF="smfi_main.html">smfi_main</A>. <P> @@ -54,7 +55,7 @@ library's state, some of which is communicated to the MTA inside <H2><A NAME="DataAccessFunctions">Data Access Functions</A></H2> The following functions may be called from within the filter-defined callbacks -to access information about the current connection or message. +to access information about the current connection or message. <P> <TABLE BORDER="1" CELLSPACING=0 CELLPADDING=2><TR bgcolor="#dddddd"><TH>Function</TH><TH>Description</TH></TR> <TR><TD><A HREF="smfi_getsymval.html">smfi_getsymval</A></TD><TD>Return the value @@ -80,33 +81,38 @@ The following functions change a message's contents and attributes. <EM>They may only be called in <A HREF="xxfi_eom.html">xxfi_eom</A></EM>. 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. Message data (senders, recipients, headers, body chunks) +the operation. +Message data (senders, recipients, headers, body chunks) passed to these functions via parameters is copied and does not need to be preserved (i.e., allocated memory can be freed). <P> -A filter must have set the appropriate flag (listed below) in the -description passed to <A HREF="smfi_register.html">smfi_register</A> -to call any message modification function. Failure to do so will -cause the MTA to treat a call to the function as a failure of the -filter, terminating its connection. +A filter which might call a message modification function +must set the appropriate flag +(<A HREF="#SMFIF">listed below</A>), +either +in the description passed to <A HREF="smfi_register.html">smfi_register</A> +or via <A HREF="xxfi_negotiate.html">xxfi_negotiate</A>. +Failure to do so will cause the MTA to treat a call to the function +as a failure of the filter, terminating its connection. <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. For example, +the MTA performed the requested operation. +For example, <A HREF="smfi_addheader.html">smfi_addheader</A>, when called with an illegal header name, will return MI_SUCCESS even though the MTA may later refuse to add the illegal header. <P> -<TABLE BORDER="1" CELLSPACING=0 CELLPADDING=2><TR BGCOLOR="#dddddd"><TH>Function</TH><TH>Description</TH><TH>SMFIF_* flag</TR> +<TABLE BORDER="1" CELLSPACING=0 CELLPADDING=2><TR BGCOLOR="#dddddd"><TH>Function</TH><TH>Description</TH><TH><A NAME="SMFIF">SMFIF_* flag</A></TH></TR> <TR><TD><A HREF="smfi_addheader.html">smfi_addheader</A></TD><TD>Add a header to -the message.</TD><TD>SMFIF_ADDHDRS</TD></TR> +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_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> +header into the message.</TD><TD>SMFIF_ADDHDRS</TD></TR> <TR><TD><A HREF="smfi_chgfrom.html">smfi_chgfrom</A></TD><TD>Change the envelope sender address.</TD><TD>SMFIF_CHGFROM</TD></TR> @@ -180,40 +186,43 @@ which are registered via <A HREF="smfi_register.html">smfi_register</A>: <TR><TD><A HREF="xxfi_close.html">xxfi_close</A></TD><TD>connection cleanup</TD></TR> -<TR><TD><A HREF="xxfi_negotiate.html">xxfi_negotiate</A></TD><TD>option negotiattion</TD></TR> +<TR><TD><A HREF="xxfi_negotiate.html">xxfi_negotiate</A></TD><TD>option negotiation</TD></TR> </TABLE> <P> The above callbacks should all return one of the following return values, -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. +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">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 -callbacks, an entire connection (during which multiple messages may be -delivered to multiple sets of recipients). +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 callbacks, an entire connection +(during which multiple messages may be delivered +to multiple sets of recipients). <A HREF="xxfi_envrcpt.html">xxfi_envrcpt</A> is recipient-oriented. +<A HREF="xxfi_negotiate.html">xxfi_negotiate</A>, <A HREF="xxfi_connect.html">xxfi_connect</A>, <A HREF="xxfi_helo.html">xxfi_helo</A> and -<A HREF="xxfi_close.html">xxfi_close</A> are connection-oriented. All -other callbacks are message-oriented. +<A HREF="xxfi_close.html">xxfi_close</A> are connection-oriented. +All other callbacks are message-oriented. <P> <TABLE BORDER="1" CELLSPACING=0 CELLPADDING=2> <TR BGCOLOR="#dddddd"><TH>Return value</TH><TH>Description</TH></TR> <TR VALIGN="TOP"> - <TD>SMFIS_CONTINUE</TD> + <TD>SMFIS_CONTINUE</TD> <TD>Continue processing the current connection, message, or recipient. </TD> </TR> <TR VALIGN="TOP"> <TD>SMFIS_REJECT</TD> <TD>For a connection-oriented routine, reject this connection; call <A HREF="xxfi_close.html">xxfi_close</A>.<BR> - For a message-oriented routine (except + For a message-oriented routine (except <A HREF="xxfi_abort.html">xxfi_abort</A>), reject this message.<BR> For a recipient-oriented routine, reject the current recipient (but continue processing the current message). </TD> @@ -233,8 +242,8 @@ other callbacks are message-oriented. <TR valign="top"> <TD>SMFIS_TEMPFAIL</TD> <TD>Return a temporary failure, i.e., the corresponding SMTP command will return an appropriate 4xx status code. - For a message-oriented routine (except <A HREF="xxfi_envfrom.html">xxfi_envfrom</A>), fail for this message. <BR> - For a connection-oriented routine, fail for this connection; call <A HREF="xxfi_close.html">xxfi_close</A>. <BR> + For a message-oriented routine (except <A HREF="xxfi_envfrom.html">xxfi_envfrom</A>), fail for this message.<BR> + For a connection-oriented routine, fail for this connection; call <A HREF="xxfi_close.html">xxfi_close</A>.<BR> For a recipient-oriented routine, only fail for the current recipient; continue message processing. </TD> </TR> diff --git a/libmilter/docs/design.html b/libmilter/docs/design.html index 294f9a153d08c..3636fc8158f54 100644 --- a/libmilter/docs/design.html +++ b/libmilter/docs/design.html @@ -31,11 +31,15 @@ administrator to combine multiple independently-developed filters. <P> We expect to see both vendor-supplied, configurable mail filtering applications and a multiplicity of script-like filters designed by and -for MTA administrators. A certain degree of coding sophistication and -domain knowledge on the part of the filter provider is assumed. This -allows filters to exercise fine-grained control at the SMTP level. +for MTA administrators. +A certain degree of coding sophistication and +domain knowledge on the part of the filter provider is assumed. +This allows filters to exercise fine-grained control at the SMTP level. However, as will be seen in the example, many filtering applications -can be written with relatively little protocol knowledge. +can be written with relatively little protocol knowledge, +but a basic understanding (e.g., as documented in RFC 5321: +<EM>The dialog is purposely lock-step, one-at-a-time</EM>) +is necessary. <P> Given these expectations, the API is designed to achieve the following diff --git a/libmilter/docs/index.html b/libmilter/docs/index.html index 57d9ebc6d74d8..90df444f62658 100644 --- a/libmilter/docs/index.html +++ b/libmilter/docs/index.html @@ -10,7 +10,7 @@ $Id: index.html,v 1.14 2013-11-22 20:51:39 ca Exp $ <H1>Filtering Mail with Sendmail</H1> <!-- -<P><B>Disclaimer</B>: +<P><B>Disclaimer</B>: This preliminary API description is provided for review only. This specification may change based on feedback from reviewers, and does not bind Sendmail to offer this functionality in any release. diff --git a/libmilter/docs/installation.html b/libmilter/docs/installation.html index 91fe0d818a3f0..7405afd7f0149 100644 --- a/libmilter/docs/installation.html +++ b/libmilter/docs/installation.html @@ -17,7 +17,7 @@ $Id: installation.html,v 1.24 2013-11-22 20:51:39 ca Exp $ To compile a filter, modify the Makefile provided with the sample program, or: <UL> <LI>Put the include and Sendmail directories in your include path - (e.g. -I/path/to/include -I/path/to/sendmail). + (e.g. -I/path/to/include -I/path/to/sendmail). <LI>Make sure libmilter.a is in your library path, and link your application with it (e.g. "-lmilter"). @@ -71,7 +71,7 @@ connection. The MTA will try to contact the filter again on each new connection. <P> -There are three fields inside of the <CODE>T=</CODE> equate: S, R, and E. +There are four fields inside of the <CODE>T=</CODE> equate: C, S, R, and E. Note the separator between each is a ";" (semicolon), as "," (comma) already separates equates. The value of each field is a decimal number followed by a single letter diff --git a/libmilter/docs/overview.html b/libmilter/docs/overview.html index 78676d377a116..b88e451369650 100644 --- a/libmilter/docs/overview.html +++ b/libmilter/docs/overview.html @@ -60,6 +60,8 @@ returns to <CODE>MESSAGE</CODE>. For each of N connections { For each filter + egotiate MTA/milter capabilities/requirements (<A HREF="xxfi_negotiate.html">xxfi_negotiate</A>) + For each filter process connection (<A HREF="xxfi_connect.html">xxfi_connect</A>) For each filter process helo/ehlo (<A HREF="xxfi_helo.html">xxfi_helo</A>) @@ -203,11 +205,21 @@ communication with the MTA happens. Filters are not terminated asynchronously (except by signals that can't be caught). In the case of <TT>Abort</TT> the -<A HREF="xxfi_abort.html">xxfi_abort</A> callback is invoked. +<A HREF="xxfi_abort.html">xxfi_abort</A> callback is usually invoked +if there is an active transaction. +However, if an invoked callback takes too long to execute +(the maximum time <TT>Abort</TT> waits is currently 5s) +<!-- XREF: MI_CHK_TIME --> +then the filter is simply terminated, i.e., +neither the +<A HREF="xxfi_abort.html">xxfi_abort</A> callback +nor the +<A HREF="xxfi_close.html">xxfi_close</A> callback +is invoked. <HR size="1"> <FONT size="-1"> -Copyright (c) 2000, 2001, 2003, 2006 Proofpoint, Inc. and its suppliers. +Copyright (c) 2000, 2001, 2003, 2006, 2018 Proofpoint, Inc. and its suppliers. All rights reserved. <BR> By using this file, you agree to the terms and conditions set diff --git a/libmilter/docs/sample.html b/libmilter/docs/sample.html index de8d58947a398..b470ae390eee6 100644 --- a/libmilter/docs/sample.html +++ b/libmilter/docs/sample.html @@ -187,7 +187,7 @@ sfsistat ++argc; /* log this recipient */ - if (reject != NULL && rcptaddr != NULL && + if (reject != NULL && rcptaddr != NULL && (strcasecmp(rcptaddr, reject) == 0)) { if (fprintf(priv->mlfi_fp, "RCPT %s -- REJECTED\n", @@ -298,7 +298,7 @@ mlfi_cleanup(ctx, ok) return rstat; /* close the archive file */ - if (priv->mlfi_fp != NULL && fclose(priv->mlfi_fp) == EOF) + if (priv->mlfi_fp != NULL && fclose(priv->mlfi_fp) == EOF) { /* failed; we have to wait until later */ fprintf(stderr, "Couldn't close archive file %s: %s\n", diff --git a/libmilter/docs/smfi_addheader.html b/libmilter/docs/smfi_addheader.html index e58c8d713c60a..fff4dc7fe6fe4 100644 --- a/libmilter/docs/smfi_addheader.html +++ b/libmilter/docs/smfi_addheader.html @@ -32,6 +32,7 @@ Add a header to the current message. <TD>Adds a header to the current message.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -45,21 +46,21 @@ Add a header to the current message. </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. + This may be the empty string. </TD></TR> </TABLE> </TD></TR> <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_addheader 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. + <LI><A HREF="smfi_register.html#SMFIF_ADDHDRS">SMFIF_ADDHDRS</A> is not set. </UL> Otherwise, it returns MI_SUCCESS. </TD> @@ -67,14 +68,13 @@ Otherwise, it returns MI_SUCCESS. <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD> <UL><LI>smfi_addheader 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_addheader must have set the SMFIF_ADDHDRS - flag in the smfiDesc_str passed to - <A href="smfi_register.html">smfi_register</A>. + <LI>A filter which calls smfi_addheader must have set the + <A HREF="smfi_register.html#SMFIF_ADDHDRS">SMFIF_ADDHDRS</A> flag. <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 @@ -101,7 +101,7 @@ To change a header's current value, use <!----------- Example code ----------> <TR> -<TH valign="top" align=left>EXAMPLE</TH> +<TH valign="top" align=left>EXAMPLE</TH> <TD> <PRE> diff --git a/libmilter/docs/smfi_addrcpt.html b/libmilter/docs/smfi_addrcpt.html index 42014bf1d8210..81eecaf0069e5 100644 --- a/libmilter/docs/smfi_addrcpt.html +++ b/libmilter/docs/smfi_addrcpt.html @@ -31,6 +31,7 @@ Add a recipient for the current message. <TD>Add a recipient to the message envelope.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -47,13 +48,13 @@ Add a recipient for the current message. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_addrcpt will fail and return MI_FAILURE if: <UL><LI>rcpt is NULL. <LI>Adding recipients in the current connection state is invalid. <LI>A network error occurs. - <LI>SMFIF_ADDRCPT was not set when <A href="smfi_register.html">smfi_register</A> was called. + <LI><A HREF="smfi_register.html#SMFIF_ADDRCPT">SMFIF_ADDRCPT</A> is not set. </UL> Otherwise, it will return MI_SUCCESS. </TD> @@ -61,11 +62,10 @@ Otherwise, it will return MI_SUCCESS. <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD> -A filter which calls smfi_addrcpt must have set the SMFIF_ADDRCPT flag -in the smfiDesc_str passed to -<A href="smfi_register.html">smfi_register</A>. +A filter which calls smfi_addrcpt must have set the +<A HREF="smfi_register.html#SMFIF_ADDRCPT">SMFIF_ADDRCPT</A> flag. </TD> </TR> diff --git a/libmilter/docs/smfi_addrcpt_par.html b/libmilter/docs/smfi_addrcpt_par.html index 0176e69e0617b..9d72cd6ca82bc 100644 --- a/libmilter/docs/smfi_addrcpt_par.html +++ b/libmilter/docs/smfi_addrcpt_par.html @@ -32,6 +32,7 @@ Add a recipient for the current message including ESMTP arguments. <TD>Add a recipient to the message envelope.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -51,14 +52,13 @@ Add a recipient for the current message including ESMTP arguments. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> -<TD>smfi_addrcpt will fail and return MI_FAILURE if: +<TD>smfi_addrcpt_par will fail and return MI_FAILURE if: <UL><LI>rcpt is NULL. <LI>Adding recipients in the current connection state is invalid. <LI>A network error occurs. - <LI>SMFIF_ADDRCPT_PAR was not set when - <A href="smfi_register.html">smfi_register</A> was called. + <LI><A HREF="smfi_register.html#SMFIF_ADDRCPT_PAR">SMFIF_ADDRCPT_PAR</A> is not set._PAR </UL> Otherwise, it will return MI_SUCCESS. </TD> @@ -66,11 +66,10 @@ Otherwise, it will return MI_SUCCESS. <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD> -A filter which calls smfi_addrcpt must have set the SMFIF_ADDRCPT_PAR flag -in the smfiDesc_str passed to -<A href="smfi_register.html">smfi_register</A>. +A filter which calls smfi_addrcpt_par must have set the +<A HREF="smfi_register.html#SMFIF_ADDRCPT_PAR">SMFIF_ADDRCPT_PAR</A> flag. </TD> </TR> diff --git a/libmilter/docs/smfi_chgfrom.html b/libmilter/docs/smfi_chgfrom.html index a107ee9ebebc0..0cfe7b6fc800d 100644 --- a/libmilter/docs/smfi_chgfrom.html +++ b/libmilter/docs/smfi_chgfrom.html @@ -32,6 +32,7 @@ Change the envelope sender (MAIL From) of the current message. <TD>Change the envelope sender (MAIL From) of the current message.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -51,13 +52,13 @@ Change the envelope sender (MAIL From) of the current message. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_chgfrom will fail and return MI_FAILURE if: <UL><LI>mail is NULL. <LI>Changing the sender in the current connection state is invalid. <LI>A network error occurs. - <LI>SMFIF_CHGFROM was not set when <A href="smfi_register.html">smfi_register</A> was called. + <LI><A HREF="smfi_register.html#SMFIF_CHGFROM">SMFIF_CHGFROM</A> is not set. </UL> Otherwise, it will return MI_SUCCESS. </TD> @@ -65,11 +66,10 @@ Otherwise, it will return MI_SUCCESS. <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD> -A filter which calls smfi_chgfrom must have set the SMFIF_CHGFROM flag -in the smfiDesc_str passed to -<A href="smfi_register.html">smfi_register</A>. +A filter which calls smfi_chgfrom must have set the +<A HREF="smfi_register.html#SMFIF_CHGFROM">SMFIF_CHGFROM</A> flag. <BR> Even though all ESMTP arguments could be set via this call, it does not make sense to do so for many of them, diff --git a/libmilter/docs/smfi_chgheader.html b/libmilter/docs/smfi_chgheader.html index b3004032e4b86..de132f442b5b8 100644 --- a/libmilter/docs/smfi_chgheader.html +++ b/libmilter/docs/smfi_chgheader.html @@ -33,6 +33,7 @@ Change or delete a message header. <TD>Changes a header's value for the current message.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -55,7 +56,7 @@ Change or delete a message header. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD> smfi_chgheader will return MI_FAILURE if @@ -63,17 +64,18 @@ smfi_chgheader will return MI_FAILURE if <LI>Modifying headers in the current connection state is invalid. <LI>Memory allocation fails. <LI>A network error occurs. - <LI>SMFIF_CHGHDRS was not set when <A href="smfi_register.html">smfi_register</A> was called. + <LI><A HREF="smfi_register.html#SMFIF_CHGHDRS">SMFIF_CHGHDRS</A> is not set. </UL> Otherwise, it returns MI_SUCCESS. -</TR> +</TD></TR> <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD> <UL><LI>While smfi_chgheader may be used to add new headers, it is more efficient and far safer to use <A href="smfi_addheader.html">smfi_addheader</A>. - <LI>A filter which calls smfi_chgheader must have set the SMFIF_CHGHDRS flag in the smfiDesc_str passed to <A href="smfi_register.html">smfi_register</A>. + <LI>A filter which calls smfi_chgheader must have set the + <A HREF="smfi_register.html#SMFIF_CHGHDRS">SMFIF_CHGHDRS</A> flag. <LI>For smfi_chgheader, 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 diff --git a/libmilter/docs/smfi_delrcpt.html b/libmilter/docs/smfi_delrcpt.html index ec1412bd37789..bd42a7319e563 100644 --- a/libmilter/docs/smfi_delrcpt.html +++ b/libmilter/docs/smfi_delrcpt.html @@ -31,6 +31,7 @@ Remove a recipient from the current message's envelope. <TD>smfi_delrcpt removes the named recipient from the current message's envelope.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -47,14 +48,14 @@ Remove a recipient from the current message's envelope. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_delrcpt will fail and return MI_FAILURE if: <UL> <LI>rcpt is NULL. <LI>Deleting recipients in the current connection state is invalid. <LI>A network error occurs. - <LI>SMFIF_DELRCPT was not set when <A href="smfi_register.html">smfi_register</A> was called. + <LI><A HREF="smfi_register.html#SMFIF_DELRCPT">SMFIF_DELRCPT</A> is not set. </UL> Otherwise, it will return MI_SUCCESS </TD> @@ -62,9 +63,13 @@ Otherwise, it will return MI_SUCCESS <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD> +<LI> The addresses to be removed must match exactly. For example, an address and its expanded form do not match. +<LI> +A filter which calls smfi_delrcpt must have set the +<A HREF="smfi_register.html#SMFIF_DELRCPT">SMFIF_DELRCPT</A> flag. </TD> </TR> diff --git a/libmilter/docs/smfi_getpriv.html b/libmilter/docs/smfi_getpriv.html index 783d6402ef45c..5ed8a22c2c604 100644 --- a/libmilter/docs/smfi_getpriv.html +++ b/libmilter/docs/smfi_getpriv.html @@ -30,6 +30,7 @@ Get the connection-specific data pointer for this connection. <TD>None.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -43,7 +44,7 @@ Get the connection-specific data pointer for this connection. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_getpriv returns the private data pointer stored by a prior call to <A href="smfi_setpriv.html">smfi_setpriv</A>, or NULL if none has been set.</TD> </TR> diff --git a/libmilter/docs/smfi_getsymval.html b/libmilter/docs/smfi_getsymval.html index dff8dc638c84a..7e3e4d5594345 100644 --- a/libmilter/docs/smfi_getsymval.html +++ b/libmilter/docs/smfi_getsymval.html @@ -31,6 +31,7 @@ Get the value of a sendmail macro. <TD>None.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -51,14 +52,14 @@ Get the value of a sendmail macro. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_getsymval returns the value of the given macro as a null-terminated string, or NULL if the macro is not defined.</TD> </TR> <!----------- Notes ----------> <TR align="left" valign=top> -<TH><A name="notes">NOTES</A></TH> +<TH><A name="notes">NOTES</A></TH> <TD> By default, the following macros are valid in the given contexts: diff --git a/libmilter/docs/smfi_insheader.html b/libmilter/docs/smfi_insheader.html index 3f568864835cd..7759dc90c1a55 100644 --- a/libmilter/docs/smfi_insheader.html +++ b/libmilter/docs/smfi_insheader.html @@ -33,6 +33,7 @@ Prepend a header to the current message. <TD>Prepends a header to the current message.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -49,21 +50,21 @@ Prepend a header to the current message. <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>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> +<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. + <LI><A HREF="smfi_register.html#SMFIF_ADDHDRS">SMFIF_ADDHDRS</A> is not set. </UL> Otherwise, it returns MI_SUCCESS. </TD> @@ -71,15 +72,15 @@ Otherwise, it returns MI_SUCCESS. <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<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>A filter which calls smfi_insheader must have set the + <A HREF="smfi_register.html#SMFIF_ADDHDRS">SMFIF_ADDHDRS</A> + flag. <LI>For smfi_insheader, filter order is important. <B>Later filters will see the header changes made by earlier ones.</B> <LI>A filter will receive <EM>only</EM> headers that have been sent @@ -122,7 +123,7 @@ Otherwise, it returns MI_SUCCESS. <!----------- Example code ----------> <TR> -<TH valign="top" align=left>EXAMPLE</TH> +<TH valign="top" align=left>EXAMPLE</TH> <TD> <PRE> diff --git a/libmilter/docs/smfi_main.html b/libmilter/docs/smfi_main.html index cb63f96bc5d02..87228fc166d0e 100644 --- a/libmilter/docs/smfi_main.html +++ b/libmilter/docs/smfi_main.html @@ -29,10 +29,11 @@ Hand control to libmilter event loop. <TD>smfi_main hands control to the Milter event loop.</TD> </TR> </TABLE> +</TD></TR> <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_main will return MI_FAILURE if it fails to establish a connection. This may occur for any of a variety of reasons (e.g. invalid address passed to <A href="smfi_setconn.html">smfi_setconn</A>). The reason for the failure will be logged. Otherwise, smfi_main will return MI_SUCCESS.</TD> </TR> diff --git a/libmilter/docs/smfi_opensocket.html b/libmilter/docs/smfi_opensocket.html index d4f7e3a705ed0..7b9e49df97afe 100644 --- a/libmilter/docs/smfi_opensocket.html +++ b/libmilter/docs/smfi_opensocket.html @@ -34,13 +34,14 @@ but before calling <TT>smfi_main()</TT>. <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. +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. +<TT>smfi_main()</TT> will create the socket implicitly +(without removing a potentially existing UNIX domain socket). </TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -56,7 +57,7 @@ If this is not called, <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_opensocket will fail and return MI_FAILURE if: <UL> diff --git a/libmilter/docs/smfi_progress.html b/libmilter/docs/smfi_progress.html index 2b87b012422f6..53205ad5dc311 100644 --- a/libmilter/docs/smfi_progress.html +++ b/libmilter/docs/smfi_progress.html @@ -31,6 +31,7 @@ Notify the MTA that an operation is still in progress. on a message, causing the MTA to re-start its timeouts.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -44,7 +45,7 @@ on a message, causing the MTA to re-start its timeouts.</TD> <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_progress will fail and return MI_FAILURE if: <UL> diff --git a/libmilter/docs/smfi_quarantine.html b/libmilter/docs/smfi_quarantine.html index b63da2d6c50f4..6c954c44036ec 100644 --- a/libmilter/docs/smfi_quarantine.html +++ b/libmilter/docs/smfi_quarantine.html @@ -31,6 +31,7 @@ Quarantine the message using the given reason. <TD>smfi_quarantine quarantines the message using the given reason.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -47,13 +48,13 @@ Quarantine the message using the given reason. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<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. + <LI><A HREF="smfi_register.html#SMFIF_QUARANTINE">SMFIF_QUARANTINE</A> is not set. </UL> Otherwise, it will return MI_SUCCESS </TD> diff --git a/libmilter/docs/smfi_register.html b/libmilter/docs/smfi_register.html index 30ab75cae4979..5c61beefc1a50 100644 --- a/libmilter/docs/smfi_register.html +++ b/libmilter/docs/smfi_register.html @@ -37,6 +37,7 @@ is obeyed. </TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -96,12 +97,12 @@ simply returning SMFIS_CONTINUE. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD> smfi_register may return MI_FAILURE for any of the following reasons: <UL> -<LI>memory allocation failed. +<LI>memory allocation failed. <LI>incompatible version or illegal flags value. </UL> @@ -110,7 +111,7 @@ smfi_register may return MI_FAILURE for any of the following reasons: <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH><A NAME=Notes>NOTES</A></TH> <TD> <A NAME="flags">The xxfi_flags</A> @@ -120,7 +121,7 @@ the following values, describing the actions the filter may take: <TR valign="top" bgcolor="#dddddd"><TH align="left">Flag</TH><TH align="center">Description</TH></TR> <TR align="left" valign=top> <TD> - SMFIF_ADDHDRS + <A NAME="SMFIF_ADDHDRS">SMFIF_ADDHDRS</A> </TD> <TD> This filter may <A HREF="smfi_addheader.html">add headers</A>. @@ -128,7 +129,7 @@ the following values, describing the actions the filter may take: </TR> <TR align="left" valign=top> <TD> - SMFIF_CHGHDRS + <A NAME="SMFIF_CHGHDRS">SMFIF_CHGHDRS</A> </TD> <TD> This filter may @@ -137,7 +138,7 @@ the following values, describing the actions the filter may take: </TR> <TR align="left" valign=top> <TD VALIGN="TOP"> - SMFIF_CHGBODY + <A NAME="SMFIF_CHGBODY">SMFIF_CHGBODY</A> </TD> <TD> This filter may @@ -148,7 +149,7 @@ the following values, describing the actions the filter may take: </TR> <TR> <TD VALIGN="TOP"> - SMFIF_ADDRCPT + <A NAME="SMFIF_ADDRCPT">SMFIF_ADDRCPT</A> </TD> <TD> This filter may @@ -158,7 +159,7 @@ the following values, describing the actions the filter may take: </TR> <TR> <TD VALIGN="TOP"> - SMFIF_ADDRCPT_PAR + <A NAME="SMFIF_ADDRCPT_PAR">SMFIF_ADDRCPT_PAR</A> </TD> <TD> This filter may @@ -167,7 +168,7 @@ the following values, describing the actions the filter may take: </TR> <TR> <TD VALIGN="TOP"> - SMFIF_DELRCPT + <A NAME="SMFIF_DELRCPT">SMFIF_DELRCPT</A> </TD> <TD> This filter may @@ -176,7 +177,7 @@ the following values, describing the actions the filter may take: </TR> <TR> <TD VALIGN="TOP"> - SMFIF_QUARANTINE + <A NAME="SMFIF_QUARANTINE">SMFIF_QUARANTINE</A> </TD> <TD> This filter may @@ -186,7 +187,7 @@ the following values, describing the actions the filter may take: <TR> <TD VALIGN="TOP"> - SMFIF_CHGFROM + <A NAME="SMFIF_CHGFROM">SMFIF_CHGFROM</A> </TD> <TD> This filter may @@ -196,7 +197,7 @@ the following values, describing the actions the filter may take: <TR> <TD VALIGN="TOP"> - SMFIF_SETSYMLIST + <A NAME="SMFIF_SETSYMLIST">SMFIF_SETSYMLIST</A> </TD> <TD> This filter can diff --git a/libmilter/docs/smfi_replacebody.html b/libmilter/docs/smfi_replacebody.html index 4a5117964a331..0842298bc62c1 100644 --- a/libmilter/docs/smfi_replacebody.html +++ b/libmilter/docs/smfi_replacebody.html @@ -29,12 +29,13 @@ Replace message-body data. </TR> <TR align="left" valign=top> <TH width="80">Effects</TH> -<TD>smfi_replacebody replaces the body of the current message. If called -more than once, subsequent calls result in data being appended to the new +<TD>smfi_replacebody replaces the body of the current message. If called +more than once, subsequent calls result in data being appended to the new body. </TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -54,14 +55,14 @@ body. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_replacebody fails and returns MI_FAILURE if: <UL> <LI>bodyp == NULL and bodylen > 0. <LI>Changing the body in the current connection state is invalid. <LI>A network error occurs. - <LI>SMFIF_CHGBODY was not set when <A href="smfi_register.html">smfi_register</A> was called. + <LI><A HREF="smfi_register.html#SMFIF_CHGBODY">SMFIF_CHGBODY</A> is not set. </UL> Otherwise, it will return MI_SUCCESS. </TD> @@ -69,12 +70,14 @@ Otherwise, it will return MI_SUCCESS. <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD> <UL> - <LI>Since the message body may be very large, setting SMFIF_CHGBODY may significantly affect filter performance. + <LI>Since the message body may be very large, calling smfi_replacebody may significantly affect filter performance. <LI>If a filter sets SMFIF_CHGBODY but does not call smfi_replacebody, the original body remains unchanged. <LI>For smfi_replacebody, filter order is important. <B>Later filters will see the new body contents created by earlier ones.</B> + <LI>A filter which calls smfi_replacebody must have set the + <A HREF="smfi_register.html#SMFIF_CHGBODY">SMFIF_CHGBODY</A> flag. </UL> </TD> </TR> diff --git a/libmilter/docs/smfi_setbacklog.html b/libmilter/docs/smfi_setbacklog.html index 9612855554424..f025009db7ed5 100644 --- a/libmilter/docs/smfi_setbacklog.html +++ b/libmilter/docs/smfi_setbacklog.html @@ -31,6 +31,7 @@ Set the filter's <CODE>listen(2)</CODE> backlog value. If smfi_setbacklog is not called, the operating system default is used.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -44,7 +45,7 @@ If smfi_setbacklog is not called, the operating system default is used.</TD> <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_setbacklog returns MI_FAILURE if obacklog is less than or equal to zero.</TD> diff --git a/libmilter/docs/smfi_setconn.html b/libmilter/docs/smfi_setconn.html index eba7c5b7e52e3..8897f5aca5a7d 100644 --- a/libmilter/docs/smfi_setconn.html +++ b/libmilter/docs/smfi_setconn.html @@ -30,14 +30,15 @@ Set the socket through which this filter should communicate with sendmail. <TD>Sets the socket through which the filter communicates with sendmail.</TD> </TR> </TABLE> +</TD></TR> <!----------- 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>oconn</TD> - <TD>The address of the desired communication socket. - The address should be a NULL-terminated string in "proto:address" + <TD>The address of the desired communication socket. + The address should be a NULL-terminated string in "proto:address" format: <UL> <LI><CODE>{unix|local}:/path/to/file</CODE> -- A named pipe. @@ -50,7 +51,7 @@ Set the socket through which this filter should communicate with sendmail. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_setconn will not fail on an invalid address. The failure will only be detected in <A href="smfi_main.html">smfi_main</A>. @@ -60,7 +61,7 @@ due to a lack of memory. </TR> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD> <UL> diff --git a/libmilter/docs/smfi_setdbg.html b/libmilter/docs/smfi_setdbg.html index 58d519935e204..e7498391105bc 100644 --- a/libmilter/docs/smfi_setdbg.html +++ b/libmilter/docs/smfi_setdbg.html @@ -34,6 +34,7 @@ A level of zero turns off debugging. The greater the current, highest, useful value.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -47,7 +48,7 @@ the current, highest, useful value.</TD> <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_setdbg returns MI_SUCCESS by default. </TD> diff --git a/libmilter/docs/smfi_setmlreply.html b/libmilter/docs/smfi_setmlreply.html index e9118838fd394..3f36e52964308 100644 --- a/libmilter/docs/smfi_setmlreply.html +++ b/libmilter/docs/smfi_setmlreply.html @@ -38,6 +38,7 @@ This code will be used on subsequent error replies resulting from actions taken by this filter.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -65,7 +66,7 @@ taken by this filter.</TD> <!----------- Example ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD> For example, the code:<BR> <PRE> @@ -86,13 +87,13 @@ For example, the code:<BR> <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<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>If any text line contains a carriage 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> @@ -102,7 +103,7 @@ Otherwise, it return MI_SUCCESS. <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD> <UL> <LI>Values passed to smfi_setmlreply are not checked for standards compliance. @@ -112,7 +113,7 @@ 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 +<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 diff --git a/libmilter/docs/smfi_setpriv.html b/libmilter/docs/smfi_setpriv.html index 5b03456f47aaa..a9cb37e598c90 100644 --- a/libmilter/docs/smfi_setpriv.html +++ b/libmilter/docs/smfi_setpriv.html @@ -31,6 +31,7 @@ Set the private data pointer for this connection. <TD>Sets the private data pointer for the context ctx.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -47,14 +48,14 @@ Set the private data pointer for this connection. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_setpriv returns MI_FAILURE if ctx is an invalid context. Otherwise, it returns MI_SUCCESS.</TD> </TR> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD>There is only one private data pointer per connection; multiple calls to smfi_setpriv with different values will cause previous values diff --git a/libmilter/docs/smfi_setreply.html b/libmilter/docs/smfi_setreply.html index 21ec5a57d0927..615567107a4ab 100644 --- a/libmilter/docs/smfi_setreply.html +++ b/libmilter/docs/smfi_setreply.html @@ -31,11 +31,12 @@ 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. This code -will be used on subsequent error replies resulting from actions taken by +<TD>Directly set the SMTP error reply code for this connection. This code +will be used on subsequent error replies resulting from actions taken by this filter.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -61,12 +62,14 @@ this filter.</TD> <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_setreply will fail and return MI_FAILURE if: <UL> <LI>The rcode or xcode argument is invalid. <LI>A memory-allocation failure occurs. + <LI>The length of any text line is more than MAXREPLYLEN (980). + <LI>The message argument contains a carriage return or line feed. </UL> Otherwise, it return MI_SUCCESS. </TD> @@ -74,7 +77,7 @@ Otherwise, it return MI_SUCCESS. <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD> <UL> <LI>Values passed to smfi_setreply are not checked for standards compliance. @@ -84,7 +87,7 @@ 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 +<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 diff --git a/libmilter/docs/smfi_setsymlist.html b/libmilter/docs/smfi_setsymlist.html index c270d0b5647b9..27bdd8a5f8ede 100644 --- a/libmilter/docs/smfi_setsymlist.html +++ b/libmilter/docs/smfi_setsymlist.html @@ -12,7 +12,7 @@ $Id: smfi_setsymlist.html,v 1.7 2013-11-22 20:51:39 ca Exp $ <PRE> #include <libmilter/mfapi.h> int smfi_setsymlist( - SMFICTX *ctx, + SMFICTX *ctx, int stage, char *macros ); @@ -37,6 +37,7 @@ milter wants to receive from the MTA. </TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -72,7 +73,7 @@ milter wants to receive from the MTA. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>MI_FAILURE is returned if <UL> @@ -88,7 +89,7 @@ Otherwise MI_SUCCESS is returned. <!----------- Notes ----------> <TR align="left" valign=top> -<TH>NOTES</TH> +<TH>NOTES</TH> <TD>There is an internal limit on the number of macros that can be set <!-- XREF: MAXFILTERMACROS --> diff --git a/libmilter/docs/smfi_settimeout.html b/libmilter/docs/smfi_settimeout.html index 35cd51003ae67..aa135618a9d07 100644 --- a/libmilter/docs/smfi_settimeout.html +++ b/libmilter/docs/smfi_settimeout.html @@ -33,6 +33,7 @@ If smfi_settimeout is not called, a default timeout of 7210 seconds is used. </TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -47,24 +48,21 @@ If smfi_settimeout is not called, a default timeout of 7210 seconds is used. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_settimeout always returns MI_SUCCESS.</TD> </TR> <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD> Decreasing the timeout is strongly discouraged and may break the communication with the MTA. Do <EM>not</EM> decrease this value without making sure that the MTA also uses lower timeouts for communication (with the milter and with the SMTP client). -</TR> -</TABLE> - - +</TD></TR> </TABLE> <HR size="1"> diff --git a/libmilter/docs/smfi_stop.html b/libmilter/docs/smfi_stop.html index aa725b9dbc251..c85a20d76ac56 100644 --- a/libmilter/docs/smfi_stop.html +++ b/libmilter/docs/smfi_stop.html @@ -36,6 +36,7 @@ which may then exit or warm-restart. </TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -49,7 +50,7 @@ which may then exit or warm-restart. <!----------- Return values ----------> <TR> -<TH valign="top" align=left>RETURN VALUES</TH> +<TH valign="top" align=left>RETURN VALUES</TH> <TD>smfi_stop always returns SMFI_CONTINUE. But note: <UL> diff --git a/libmilter/docs/smfi_version.html b/libmilter/docs/smfi_version.html index 64c4a4d8f8acb..f9b7bcb86b0ca 100644 --- a/libmilter/docs/smfi_version.html +++ b/libmilter/docs/smfi_version.html @@ -32,6 +32,7 @@ Get the (runtime) version of libmilter. <TD>None.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH VALIGN="TOP" ALIGN=LEFT>ARGUMENTS</TH><TD> diff --git a/libmilter/docs/xxfi_abort.html b/libmilter/docs/xxfi_abort.html index 9ec8f49907377..4e20d0e18d520 100644 --- a/libmilter/docs/xxfi_abort.html +++ b/libmilter/docs/xxfi_abort.html @@ -30,6 +30,7 @@ Handle the current message's being aborted. <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -43,7 +44,7 @@ Handle the current message's being aborted. <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD> <UL> <LI>xxfi_abort must reclaim any resources allocated on a per-message diff --git a/libmilter/docs/xxfi_body.html b/libmilter/docs/xxfi_body.html index 8110350658741..511eeb3aae68c 100644 --- a/libmilter/docs/xxfi_body.html +++ b/libmilter/docs/xxfi_body.html @@ -32,6 +32,7 @@ Handle a piece of a message's body. <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -51,7 +52,7 @@ Handle a piece of a message's body. <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD> <UL> <LI>bodyp points to a sequence of bytes. @@ -65,7 +66,7 @@ to work as expected. significantly impact filter performance. <LI>End-of-lines are represented as received from SMTP (normally CR/LF). <LI>Later filters will see body changes made by earlier ones. -<LI>Message bodies may be sent in multiple chunks, with one call to +<LI>Message bodies may be sent in multiple chunks, with one call to xxfi_body per chunk. <LI>Return <A HREF="api.html#SMFIS_SKIP">SMFIS_SKIP</A> diff --git a/libmilter/docs/xxfi_close.html b/libmilter/docs/xxfi_close.html index b5cf2ff237ad8..1999d0e3896bd 100644 --- a/libmilter/docs/xxfi_close.html +++ b/libmilter/docs/xxfi_close.html @@ -30,6 +30,7 @@ The current connection is being closed. <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -43,7 +44,7 @@ The current connection is being closed. <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD> <UL> <LI>xxfi_close may be called "out-of-order", i.e. before even the @@ -59,7 +60,7 @@ 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. +transaction was aborted. <LI>xxfi_close is responsible for freeing any resources allocated on a per-connection basis. <LI>Since the connection is already closing, the return value is diff --git a/libmilter/docs/xxfi_connect.html b/libmilter/docs/xxfi_connect.html index 29a2c911153e3..c84f9f2817386 100644 --- a/libmilter/docs/xxfi_connect.html +++ b/libmilter/docs/xxfi_connect.html @@ -12,7 +12,7 @@ $Id: xxfi_connect.html,v 1.20 2013-11-22 20:51:39 ca Exp $ <PRE> #include <libmilter/mfapi.h> sfsistat (*xxfi_connect)( - SMFICTX *ctx, + SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr); </PRE> @@ -29,16 +29,18 @@ sfsistat (*xxfi_connect)( <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> + <!-- -This callback function is invoked on each connection to the mail +This callback function is invoked on each connection to the mail filter program. The callback is to be implemented by the Milter application developers. The name of the callback can be any valid function name. The function pointer is to be assigned to the smfiDesc.xxfi_connect and the pointer to the smfiDesc structure is passed to smfi_register(). -</TD></TR> --> +</TD></TR> + <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> <TABLE border="1" cellspacing=0> @@ -103,7 +105,7 @@ is passed to smfi_register(). --> <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD>If an earlier filter rejects the connection in its xxfi_connect() routine, this filter's xxfi_connect() will not be called.</TD> </TR> diff --git a/libmilter/docs/xxfi_data.html b/libmilter/docs/xxfi_data.html index 7dedb4183097b..f8b715b5675e8 100644 --- a/libmilter/docs/xxfi_data.html +++ b/libmilter/docs/xxfi_data.html @@ -23,13 +23,14 @@ Handle the DATA command. <TABLE border="1" cellspacing=1 cellpadding=4> <TR align="left" valign=top> <TH width="80">Called When</TH> -<TD>xxfi_data is called when the client uses the DATA command. +<TD>xxfi_data is called when the client uses the DATA command.</TD> </TR> <TR align="left" valign=top> <TH>Default Behavior</TH> <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -67,11 +68,11 @@ Handle the DATA command. </TD> </TR> </TABLE> -</TR> +</TD></TR> <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD>For more details on ESMTP responses, please see RFC <A href="http://www.rfc-editor.org/rfc/rfc1869.txt">1869</A>.</TD> </TR> diff --git a/libmilter/docs/xxfi_envfrom.html b/libmilter/docs/xxfi_envfrom.html index 24811e14a6c11..b553b4d9fd638 100644 --- a/libmilter/docs/xxfi_envfrom.html +++ b/libmilter/docs/xxfi_envfrom.html @@ -33,6 +33,7 @@ before xxfi_envrcpt.</TD> <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -75,11 +76,11 @@ before xxfi_envrcpt.</TD> </TD> </TR> </TABLE> -</TR> +</TD></TR> <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD>For more details on ESMTP responses, please see RFC <A href="http://www.rfc-editor.org/rfc/rfc1869.txt">1869</A>.</TD> </TR> diff --git a/libmilter/docs/xxfi_envrcpt.html b/libmilter/docs/xxfi_envrcpt.html index 9503ab98c6169..d15b70fdf1879 100644 --- a/libmilter/docs/xxfi_envrcpt.html +++ b/libmilter/docs/xxfi_envrcpt.html @@ -31,6 +31,7 @@ Handle the envelope RCPT command. <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -54,7 +55,7 @@ Handle the envelope RCPT command. <TR bgcolor="#dddddd"><TH>Return value</TH><TH>Description</TH></TR> <TR valign="top"> <TD>SMFIS_TEMPFAIL</TD> - <TD>Temporarily fail for this particular recipient; further recipients + <TD>Temporarily fail for this particular recipient; further recipients may still be sent. <A href="xxfi_abort.html">xxfi_abort</A> is not called. </TD> </TR> @@ -76,11 +77,11 @@ Handle the envelope RCPT command. </TD> </TR> </TABLE> -</TR> +</TD></TR> <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD>For more details on ESMTP responses, please see RFC <A href="http://www.rfc-editor.org/rfc/rfc1869.txt">1869</A>.</TD> </TR> diff --git a/libmilter/docs/xxfi_eoh.html b/libmilter/docs/xxfi_eoh.html index 33f5fc004983d..4be41d758bc36 100644 --- a/libmilter/docs/xxfi_eoh.html +++ b/libmilter/docs/xxfi_eoh.html @@ -31,6 +31,7 @@ Handle the end of message headers. <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> diff --git a/libmilter/docs/xxfi_eom.html b/libmilter/docs/xxfi_eom.html index d473777e4b133..9bf040c02ad49 100644 --- a/libmilter/docs/xxfi_eom.html +++ b/libmilter/docs/xxfi_eom.html @@ -30,6 +30,7 @@ End of a message. <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -43,7 +44,7 @@ End of a message. <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD>A filter is required to make all its modifications to the message headers, body, and envelope in xxfi_eom. Modifications are made via the smfi_* routines. </TD> diff --git a/libmilter/docs/xxfi_header.html b/libmilter/docs/xxfi_header.html index 16e814b47c480..bccada7e524fd 100644 --- a/libmilter/docs/xxfi_header.html +++ b/libmilter/docs/xxfi_header.html @@ -32,6 +32,7 @@ Handle a message header. <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -55,7 +56,7 @@ Handle a message header. <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD> <UL> <LI>Starting with sendmail 8.14, spaces after the colon in a header @@ -90,7 +91,7 @@ it was: <LI>Later filters will see header changes/additions made by earlier ones. -<LI>For much more detail about header format, please see +<LI>For much more detail about header format, please see RFC <A href="http://www.rfc-editor.org/rfc/rfc822.html">822</A> and RFC <A href="http://www.rfc-editor.org/rfc/rfc2822.html">2822</A> diff --git a/libmilter/docs/xxfi_helo.html b/libmilter/docs/xxfi_helo.html index 716eb9290f177..8c4309cd5bf27 100644 --- a/libmilter/docs/xxfi_helo.html +++ b/libmilter/docs/xxfi_helo.html @@ -12,7 +12,7 @@ $Id: xxfi_helo.html,v 1.13 2013-11-22 20:51:39 ca Exp $ <PRE> #include <libmilter/mfapi.h> sfsistat (*xxfi_helo)( - SMFICTX *ctx, + SMFICTX *ctx, char *helohost ); </PRE> @@ -34,6 +34,7 @@ some restrictions can be imposed by the MTA configuration. <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> diff --git a/libmilter/docs/xxfi_negotiate.html b/libmilter/docs/xxfi_negotiate.html index b0502f47a7115..e858a39c0e988 100644 --- a/libmilter/docs/xxfi_negotiate.html +++ b/libmilter/docs/xxfi_negotiate.html @@ -13,7 +13,7 @@ $Id: xxfi_negotiate.html,v 1.24 2013-11-22 20:51:39 ca Exp $ #include <libmilter/mfapi.h> #include <libmilter/mfdef.h> sfsistat (*xxfi_negotiate)( - SMFICTX *ctx, + SMFICTX *ctx, unsigned long f0, unsigned long f1, unsigned long f2, @@ -36,6 +36,8 @@ sfsistat (*xxfi_negotiate)( <TD>Return SMFIS_ALL_OPTS to change nothing.</TD> </TR> </TABLE> +</TD></TR> + <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> <TABLE border="1" cellspacing=0> @@ -48,6 +50,7 @@ sfsistat (*xxfi_negotiate)( </TD></TR> <TR><TD>f1</TD> <TD>the protocol steps offered by the MTA. + </TD></TR> <TR><TD>f2</TD> <TD>for future extensions. </TD></TR> @@ -59,6 +62,7 @@ sfsistat (*xxfi_negotiate)( </TD></TR> <TR><TD>pf1</TD> <TD>the protocol steps requested by the milter. + </TD></TR> <TR><TD>pf2</TD> <TD>for future extensions. </TD></TR> @@ -101,11 +105,11 @@ as they will be ignored. </TD> </TR> </TABLE> -</TR> +</TD></TR> <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD>This function allows a milter to dynamically determine and request operations and actions during startup. In previous versions, the actions (f0) were fixed in the @@ -140,6 +144,11 @@ By setting this bit, a milter can request that the MTA should also send <CODE>RCPT</CODE> commands that have been rejected because the user is unknown (or similar reasons), but not those which have been rejected because of syntax errors etc. +<!-- +In order for this request to have effect, +sendmail must have been built with the compile time option +<TT>_FFR_MILTER_CHECK_REJECTIONS_TOO</TT>. +--> If a milter requests this protocol step, then it should check the macro <CODE>{rcpt_mailer}</CODE>: @@ -204,11 +213,12 @@ space to headers when they are added, inserted, or changed. <LI>The MTA can be instructed not to send information about various SMTP stages, these flags start with: <A NAME="SMFIP_NO"><CODE>SMFIP_NO*</CODE></A>. +Setting any of these flags affects all connections. <UL> <LI><A NAME="SMFIP_NOCONNECT"><CODE>SMFIP_NOCONNECT</CODE></A>: <A HREF="xxfi_connect.html">xxfi_connect()</A> <LI><A NAME="SMFIP_NOHELO"><CODE>SMFIP_NOHELO</CODE></A>: -<A HREF="xxfi_header.html">xxfi_header()</A> +<A HREF="xxfi_helo.html">xxfi_helo()</A> <LI><A NAME="SMFIP_NOMAIL"><CODE>SMFIP_NOMAIL</CODE></A>: <A HREF="xxfi_envfrom.html">xxfi_envfrom()</A> <LI><A NAME="SMFIP_NORCPT"><CODE>SMFIP_NORCPT</CODE></A>: diff --git a/libmilter/docs/xxfi_unknown.html b/libmilter/docs/xxfi_unknown.html index 38c1c3d47166a..94e4f39d9592d 100644 --- a/libmilter/docs/xxfi_unknown.html +++ b/libmilter/docs/xxfi_unknown.html @@ -25,13 +25,14 @@ Handle unknown and unimplemented SMTP commands. <TR align="left" valign=top> <TH width="80">Called When</TH> <TD>xxfi_unknown is called when the client uses an SMTP command -that is either unknown or not implemented by the MTA. +that is either unknown or not implemented by the MTA.</TD> </TR> <TR align="left" valign=top> <TH>Default Behavior</TH> <TD>Do nothing; return SMFIS_CONTINUE.</TD> </TR> </TABLE> +</TD></TR> <!----------- Arguments ----------> <TR><TH valign="top" align=left>ARGUMENTS</TH><TD> @@ -62,13 +63,13 @@ that is either unknown or not implemented by the MTA. </TD> </TR> </TABLE> -</TR> +</TD></TR> <!----------- Notes ----------> <TR> -<TH valign="top" align=left>NOTES</TH> +<TH valign="top" align=left>NOTES</TH> <TD>The SMTP command will always be rejected by the server, -it is only possible to return a different error code. +it is only possible to return a different error code.</TD> </TR> </TABLE> diff --git a/libmilter/engine.c b/libmilter/engine.c index 808ffdbf608a6..2619395a6eb11 100644 --- a/libmilter/engine.c +++ b/libmilter/engine.c @@ -15,7 +15,7 @@ SM_RCSID("@(#)$Id: engine.c,v 8.168 2013-11-22 20:51:36 ca Exp $") #if NETINET || NETINET6 # include <arpa/inet.h> -#endif /* NETINET || NETINET6 */ +#endif /* generic argument for functions in the command table */ struct arg_struct @@ -72,17 +72,17 @@ ERROR: do not compile with CI_LAST < CI_EOM #if CI_LAST < CI_EOH ERROR: do not compile with CI_LAST < CI_EOH #endif -#if CI_LAST < CI_ENVRCPT -ERROR: do not compile with CI_LAST < CI_ENVRCPT +#if CI_LAST < CI_RCPT +ERROR: do not compile with CI_LAST < CI_RCPT #endif -#if CI_LAST < CI_ENVFROM -ERROR: do not compile with CI_LAST < CI_ENVFROM +#if CI_LAST < CI_MAIL +ERROR: do not compile with CI_LAST < CI_MAIL #endif #if CI_LAST < CI_HELO ERROR: do not compile with CI_LAST < CI_HELO #endif -#if CI_LAST < CI_CONNECT -ERROR: do not compile with CI_LAST < CI_CONNECT +#if CI_LAST < CI_CONN +ERROR: do not compile with CI_LAST < CI_CONN #endif #if CI_LAST >= MAX_MACROS_ENTRIES ERROR: do not compile with CI_LAST >= MAX_MACROS_ENTRIES @@ -112,7 +112,7 @@ static void mi_clr_symlist __P((SMFICTX_PTR)); #if _FFR_WORKERS_POOL static bool mi_rd_socket_ready __P((int)); -#endif /* _FFR_WORKERS_POOL */ +#endif /* states */ #define ST_NONE (-1) @@ -458,7 +458,7 @@ mi_engine(ctx) if (ctx->ctx_state != ST_QUIT #if _FFR_WORKERS_POOL && ret != MI_CONTINUE -#endif /* _FFR_WORKERS_POOL */ +#endif ) { if ((fi_close = ctx->ctx_smfi->xxfi_close) != NULL) @@ -468,7 +468,7 @@ mi_engine(ctx) free(buf); #if !_FFR_WORKERS_POOL mi_clr_macros(ctx, 0); -#endif /* _FFR_WORKERS_POOL */ +#endif return ret; } @@ -628,7 +628,7 @@ sendreply(r, sd, timeout_ptr, ctx) { /* milter said it wouldn't reply, but it lied... */ smi_log(SMI_LOG_ERR, - "%s: milter claimed not to reply in state %d but did anyway %d\n", + "%s: milter claimed not to reply in state %d but did anyway %d", ctx->ctx_smfi->xxfi_name, ctx->ctx_state, r); @@ -703,8 +703,12 @@ sendreply(r, sd, timeout_ptr, ctx) (void *) &v, MILTER_LEN_BYTES); len = milter_addsymlist(ctx, buf, &buffer); if (buffer != NULL) + { ret = mi_wr_cmd(sd, timeout_ptr, SMFIC_OPTNEG, buffer, len); + if (buffer != buf) + free(buffer); + } else ret = MI_FAILURE; } @@ -843,7 +847,7 @@ st_optionneg(g) SMFICTX_PTR ctx; #if _FFR_MILTER_CHECK bool testmode = false; -#endif /* _FFR_MILTER_CHECK */ +#endif int (*fi_negotiate) __P((SMFICTX *, unsigned long, unsigned long, unsigned long, unsigned long, @@ -1000,7 +1004,7 @@ st_optionneg(g) testmode = bitset(SMFIP_TEST, m_pflags); if (testmode) m_pflags &= ~SMFIP_TEST; -#endif /* _FFR_MILTER_CHECK */ +#endif /* ** Types of protocol flags (pflags): @@ -1100,7 +1104,7 @@ st_optionneg(g) { /* ** Older MTAs do not support some protocol steps. - ** As this protocol is a bit "wierd" (it asks for steps + ** As this protocol is a bit "weird" (it asks for steps ** NOT to be taken/sent) we have to check whether we ** should turn off those "negative" requests. ** Currently these are only SMFIP_NODATA and SMFIP_NOUNKNOWN. @@ -1186,7 +1190,7 @@ st_connectinfo(g) s = g->a_buf; i = 0; l = g->a_len; - while (s[i] != '\0' && i <= l) + while (i <= l && s[i] != '\0') ++i; if (i + 1 >= l) return _SMFIS_ABORT; @@ -1868,9 +1872,9 @@ mi_rd_socket_ready (sd) int nerr = 0; #if SM_CONF_POLL struct pollfd pfd; -#else /* SM_CONF_POLL */ +#else fd_set rd_set, exc_set; -#endif /* SM_CONF_POLL */ +#endif do { @@ -1912,8 +1916,8 @@ mi_rd_socket_ready (sd) #if SM_CONF_POLL return (pfd.revents != 0); -#else /* SM_CONF_POLL */ +#else return FD_ISSET(sd, &rd_set) || FD_ISSET(sd, &exc_set); -#endif /* SM_CONF_POLL */ +#endif } #endif /* _FFR_WORKERS_POOL */ diff --git a/libmilter/example.c b/libmilter/example.c index f078eb7ba3042..e0fef80b6d4ea 100644 --- a/libmilter/example.c +++ b/libmilter/example.c @@ -28,7 +28,7 @@ #ifndef true # define false 0 # define true 1 -#endif /* ! true */ +#endif struct mlfiPriv { diff --git a/libmilter/handler.c b/libmilter/handler.c index 7622839d65e48..17ee7f8dac0a2 100644 --- a/libmilter/handler.c +++ b/libmilter/handler.c @@ -35,7 +35,7 @@ mi_handle_session(ctx) ctx->ctx_id = (sthread_t) sthread_get_id(); /* - ** Detach so resources are free when the thread returns. + ** Detach so resources are freed when the thread returns. ** If we ever "wait" for threads, this call must be removed. */ diff --git a/libmilter/libmilter.h b/libmilter/libmilter.h index 3c572ec9a9e8c..f9fe38ca4a9f2 100644 --- a/libmilter/libmilter.h +++ b/libmilter/libmilter.h @@ -20,10 +20,10 @@ # define EXTERN # define INIT(x) = x SM_IDSTR(MilterlId, "@(#)$Id: libmilter.h,v 8.78 2013-11-22 20:51:36 ca Exp $") -#else /* _DEFINE */ +#else # define EXTERN extern # define INIT(x) -#endif /* _DEFINE */ +#endif #include "sm/tailq.h" @@ -111,7 +111,7 @@ struct smfi_str #if _FFR_THREAD_MONITOR time_t ctx_start; /* start time of thread */ SM_TAILQ_ENTRY(smfi_str) ctx_mon_link; -#endif /* _FFR_THREAD_MONITOR */ +#endif #if _FFR_WORKERS_POOL long ctx_sid; /* session identifier */ @@ -142,7 +142,7 @@ typedef pthread_mutex_t smutex_t; /* SM_CONF_POLL shall be defined with _FFR_WORKERS_POOL */ # if !SM_CONF_POLL # define SM_CONF_POLL 1 -# endif /* SM_CONF_POLL */ +# endif #endif /* _FFR_WORKERS_POOL */ typedef pthread_cond_t scond_t; @@ -173,7 +173,7 @@ typedef pthread_cond_t scond_t; # define MI_POLL_RD_FLAGS (POLLIN | POLLPRI) # define MI_POLL_WR_FLAGS (POLLOUT) -# define MI_MS(timeout) (((timeout)->tv_sec * 1000) + (timeout)->tv_usec) +# define MI_MS(timeout) (((timeout)->tv_sec * 1000) + (((timeout)->tv_usec) / 1000)) # define FD_RD_VAR(rds, excs) struct pollfd rds # define FD_WR_VAR(wrs) struct pollfd wrs @@ -197,7 +197,7 @@ typedef pthread_cond_t scond_t; # define FD_IS_RD_RDY(sd, rds, excs) \ (((rds).revents & MI_POLL_RD_FLAGS) != 0) -# define FD_WR_READY(sd, excs, timeout) \ +# define FD_WR_READY(sd, wrs, timeout) \ poll(&(wrs), 1, MI_MS(timeout)) # define FD_RD_READY(sd, rds, excs, timeout) \ @@ -241,9 +241,9 @@ typedef pthread_cond_t scond_t; #ifndef MI_SOMAXCONN # if SOMAXCONN > 20 # define MI_SOMAXCONN SOMAXCONN -# else /* SOMAXCONN */ +# else # define MI_SOMAXCONN 20 -# endif /* SOMAXCONN */ +# endif #endif /* ! MI_SOMAXCONN */ /* maximum number of repeated failures in mi_listener() */ diff --git a/libmilter/listener.c b/libmilter/listener.c index 11d92bb09fdfe..0468a6231cced 100644 --- a/libmilter/listener.c +++ b/libmilter/listener.c @@ -24,11 +24,11 @@ SM_RCSID("@(#)$Id: listener.c,v 8.127 2013-11-22 20:51:36 ca Exp $") # if NETINET || NETINET6 # include <arpa/inet.h> -# endif /* NETINET || NETINET6 */ +# endif # if SM_CONF_POLL # undef SM_FD_OK_SELECT # define SM_FD_OK_SELECT(fd) true -# endif /* SM_CONF_POLL */ +# endif static smutex_t L_Mutex; static int L_family; @@ -38,7 +38,7 @@ static socket_t listenfd = INVALID_SOCKET; static socket_t mi_milteropen __P((char *, int, bool, char *)); #if !_FFR_WORKERS_POOL static void *mi_thread_handle_wrapper __P((void *)); -#endif /* !_FFR_WORKERS_POOL */ +#endif /* ** MI_OPENSOCKET -- create the socket where this filter and the MTA will meet @@ -116,7 +116,7 @@ mi_opensocket(conn, backlog, dbg, rmsocket, smfi) #if NETUNIX static char *sockpath = NULL; -#endif /* NETUNIX */ +#endif static socket_t mi_milteropen(conn, backlog, rmsocket, name) @@ -269,13 +269,13 @@ mi_milteropen(conn, backlog, rmsocket, name) if ( # if NETINET addr.sa.sa_family == AF_INET -# endif /* NETINET */ +# endif # if NETINET && NETINET6 || -# endif /* NETINET && NETINET6 */ +# endif # if NETINET6 addr.sa.sa_family == AF_INET6 -# endif /* NETINET6 */ +# endif ) { unsigned short port; @@ -290,13 +290,13 @@ mi_milteropen(conn, backlog, rmsocket, name) case AF_INET: addr.sin.sin_addr.s_addr = INADDR_ANY; break; -# endif /* NETINET */ +# endif # if NETINET6 case AF_INET6: addr.sin6.sin6_addr = in6addr_any; break; -# endif /* NETINET6 */ +# endif } } else @@ -337,10 +337,10 @@ mi_milteropen(conn, backlog, rmsocket, name) bool found = false; # if NETINET unsigned long hid = INADDR_NONE; -# endif /* NETINET */ +# endif # if NETINET6 struct sockaddr_in6 hid6; -# endif /* NETINET6 */ +# endif *end = '\0'; # if NETINET @@ -421,7 +421,7 @@ mi_milteropen(conn, backlog, rmsocket, name) } # if NETINET6 freehostent(hp); -# endif /* NETINET6 */ +# endif } } else @@ -432,12 +432,12 @@ mi_milteropen(conn, backlog, rmsocket, name) case AF_INET: addr.sin.sin_port = port; break; -# endif /* NETINET */ +# endif # if NETINET6 case AF_INET6: addr.sin6.sin6_port = port; break; -# endif /* NETINET6 */ +# endif } } } @@ -465,7 +465,7 @@ mi_milteropen(conn, backlog, rmsocket, name) if ( #if NETUNIX addr.sa.sa_family != AF_UNIX && -#endif /* NETUNIX */ +#endif setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &sockopt, sizeof(sockopt)) == -1) { @@ -607,7 +607,7 @@ mi_closener() (S_ISFIFO(sockinfo.st_mode) # ifdef S_ISSOCK || S_ISSOCK(sockinfo.st_mode) -# endif /* S_ISSOCK */ +# endif ); #endif /* NETUNIX */ @@ -624,13 +624,13 @@ mi_closener() fileinfo.st_ino == sockinfo.st_ino) # ifdef S_ISSOCK || S_ISSOCK(fileinfo.st_mode) -# endif /* S_ISSOCK */ +# endif ) && (S_ISFIFO(fileinfo.st_mode) # ifdef S_ISSOCK || S_ISSOCK(fileinfo.st_mode) -# endif /* S_ISSOCK */ +# endif )) (void) unlink(sockpath); free(sockpath); @@ -719,7 +719,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog) socket_t connfd = INVALID_SOCKET; #if _FFR_DUP_FD socket_t dupfd = INVALID_SOCKET; -#endif /* _FFR_DUP_FD */ +#endif int sockopt = 1; int r, mistop; int ret = MI_SUCCESS; @@ -731,7 +731,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog) int fdflags; #if !_FFR_WORKERS_POOL sthread_t thread_id; -#endif /* !_FFR_WORKERS_POOL */ +#endif _SOCK_ADDR cliaddr; SOCKADDR_LEN_T clilen; SMFICTX_PTR ctx; @@ -744,7 +744,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog) #if _FFR_WORKERS_POOL if (mi_pool_controller_init() == MI_FAILURE) return MI_FAILURE; -#endif /* _FFR_WORKERS_POOL */ +#endif clilen = L_socksize; while ((mistop = mi_stop()) == MILTER_CONT) @@ -817,7 +817,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog) (clilen == 0 || # ifdef BSD4_4_SOCKADDR cliaddr.sa.sa_len == 0 || -# endif /* BSD4_4_SOCKADDR */ +# endif cliaddr.sa.sa_family != L_family)) { (void) closesocket(connfd); @@ -838,28 +838,28 @@ mi_listener(conn, dbg, smfi, timeout, backlog) if (save_errno == EINTR #ifdef EAGAIN || save_errno == EAGAIN -#endif /* EAGAIN */ +#endif #ifdef ECONNABORTED || save_errno == ECONNABORTED -#endif /* ECONNABORTED */ +#endif #ifdef EMFILE || save_errno == EMFILE -#endif /* EMFILE */ +#endif #ifdef ENFILE || save_errno == ENFILE -#endif /* ENFILE */ +#endif #ifdef ENOBUFS || save_errno == ENOBUFS -#endif /* ENOBUFS */ +#endif #ifdef ENOMEM || save_errno == ENOMEM -#endif /* ENOMEM */ +#endif #ifdef ENOSR || save_errno == ENOSR -#endif /* ENOSR */ +#endif #ifdef EWOULDBLOCK || save_errno == EWOULDBLOCK -#endif /* EWOULDBLOCK */ +#endif ) continue; acnt++; @@ -886,7 +886,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog) } #endif /* _FFR_DUP_FD */ - /* + /* ** Need to set close-on-exec for connfd in case a user's ** filter starts other applications. ** Note: errors will not stop processing (for now). @@ -951,12 +951,12 @@ mi_listener(conn, dbg, smfi, timeout, backlog) #if _FFR_WORKERS_POOL # define LOG_CRT_FAIL "%s: mi_start_session() failed: %d, %s" if ((r = mi_start_session(ctx)) != MI_SUCCESS) -#else /* _FFR_WORKERS_POOL */ +#else # define LOG_CRT_FAIL "%s: thread_create() failed: %d, %s" if ((r = thread_create(&thread_id, mi_thread_handle_wrapper, (void *) ctx)) != 0) -#endif /* _FFR_WORKERS_POOL */ +#endif { tcnt++; smi_log(SMI_LOG_ERR, diff --git a/libmilter/main.c b/libmilter/main.c index ef3242feff057..ff7bf99bcc823 100644 --- a/libmilter/main.c +++ b/libmilter/main.c @@ -206,7 +206,7 @@ smfi_setbacklog(obacklog) /* -** SMFI_MAIN -- setup milter connnection and start listener. +** SMFI_MAIN -- setup milter connection and start listener. ** ** Parameters: ** none. diff --git a/libmilter/monitor.c b/libmilter/monitor.c index 9916bb59598d2..ec08e53d0b2ef 100644 --- a/libmilter/monitor.c +++ b/libmilter/monitor.c @@ -39,7 +39,7 @@ static scond_t Mon_cv; ** after a mutex_lock() attempt, the order might not be strict, ** i.e., if the list contains e1 and e2 (in that order) then ** the the start time of e2 can be (slightly) smaller than that of e1. -** However, this slight inaccurracy should not matter for the proper +** However, this slight inaccuracy should not matter for the proper ** working of this algorithm. */ diff --git a/libmilter/sm_gethost.c b/libmilter/sm_gethost.c index 2423c34419c10..262edb6c541c6 100644 --- a/libmilter/sm_gethost.c +++ b/libmilter/sm_gethost.c @@ -14,13 +14,13 @@ SM_RCSID("@(#)$Id: sm_gethost.c,v 8.32 2013-11-22 20:51:36 ca Exp $") #include <sendmail.h> #if NETINET || NETINET6 # include <arpa/inet.h> -#endif /* NETINET || NETINET6 */ +#endif #include "libmilter.h" /* ** MI_GETHOSTBY{NAME,ADDR} -- compatibility routines for gethostbyXXX ** -** Some operating systems have wierd problems with the gethostbyXXX +** Some operating systems have weird problems with the gethostbyXXX ** routines. For example, Solaris versions at least through 2.3 ** don't properly deliver a canonical h_name field. This tries to ** work around these problems. @@ -34,13 +34,13 @@ static struct hostent *sm_getipnodebyname __P((const char *, int, int, int *)); # ifndef AI_ADDRCONFIG # define AI_ADDRCONFIG 0 /* dummy */ -# endif /* ! AI_ADDRCONFIG */ +# endif # ifndef AI_ALL # define AI_ALL 0 /* dummy */ -# endif /* ! AI_ALL */ +# endif # ifndef AI_DEFAULT # define AI_DEFAULT 0 /* dummy */ -# endif /* ! AI_DEFAULT */ +# endif static struct hostent * sm_getipnodebyname(name, family, flags, err) @@ -49,8 +49,17 @@ sm_getipnodebyname(name, family, flags, err) int flags; int *err; { - bool resv6 = true; struct hostent *h; +# if HAS_GETHOSTBYNAME2 + + h = gethostbyname2(name, family); + if (h == NULL) + *err = h_errno; + return h; + +# else /* HAS_GETHOSTBYNAME2 */ +# ifdef RES_USE_INET6 + bool resv6 = true; if (family == AF_INET6) { @@ -58,23 +67,27 @@ sm_getipnodebyname(name, family, flags, err) resv6 = bitset(RES_USE_INET6, _res.options); _res.options |= RES_USE_INET6; } +# endif /* RES_USE_INET6 */ SM_SET_H_ERRNO(0); h = gethostbyname(name); - if (family == AF_INET6 && !resv6) +# ifdef RES_USE_INET6 + if (!resv6) _res.options &= ~RES_USE_INET6; +# endif /* the function is supposed to return only the requested family */ if (h != NULL && h->h_addrtype != family) { -# if NETINET6 +# if NETINET6 freehostent(h); -# endif /* NETINET6 */ +# endif h = NULL; *err = NO_DATA; } else *err = h_errno; return h; +# endif /* HAS_GETHOSTBYNAME2 */ } void @@ -89,7 +102,7 @@ freehostent(h) return; } #else /* NEEDSGETIPNODE && NETINET6 */ -#define sm_getipnodebyname getipnodebyname +#define sm_getipnodebyname getipnodebyname #endif /* NEEDSGETIPNODE && NETINET6 */ struct hostent * @@ -115,7 +128,7 @@ mi_gethostbyname(name, family) # ifndef SM_IPNODEBYNAME_FLAGS /* For IPv4-mapped addresses, use: AI_DEFAULT|AI_ALL */ # define SM_IPNODEBYNAME_FLAGS AI_ADDRCONFIG -# endif /* SM_IPNODEBYNAME_FLAGS */ +# endif int flags = SM_IPNODEBYNAME_FLAGS; int err; @@ -124,7 +137,7 @@ mi_gethostbyname(name, family) # if NETINET6 # if ADDRCONFIG_IS_BROKEN flags &= ~AI_ADDRCONFIG; -# endif /* ADDRCONFIG_IS_BROKEN */ +# endif h = sm_getipnodebyname(name, family, flags, &err); SM_SET_H_ERRNO(err); # else /* NETINET6 */ @@ -138,7 +151,7 @@ mi_gethostbyname(name, family) { # if NETINET6 freehostent(h); -# endif /* NETINET6 */ +# endif h = NULL; SM_SET_H_ERRNO(NO_DATA); } @@ -158,7 +171,7 @@ mi_gethostbyname(name, family) ** ** Returns: ** 1 if the address was valid -** 0 if the address wasn't parseable +** 0 if the address wasn't parsable ** -1 if error */ diff --git a/libmilter/smfi.c b/libmilter/smfi.c index d6c63a2ce8006..a0fcd1184e469 100644 --- a/libmilter/smfi.c +++ b/libmilter/smfi.c @@ -103,7 +103,7 @@ smfi_addheader(ctx, headerf, headerv) ** ** Parameters: ** ctx -- Opaque context structure -** hdridx -- index into header list where insertion should occur +** hdridx -- index into header list where insertion should occur ** headerf -- Header field name ** headerv -- Header field value ** @@ -267,7 +267,6 @@ send2(ctx, cmd, arg0, arg1) if (arg1 != NULL) { - l1 = strlen(arg1) + 1; SM_ASSERT(offset < len); SM_ASSERT(offset + l1 <= len); (void) memcpy(buf + offset, arg1, l1); diff --git a/libmilter/worker.c b/libmilter/worker.c index bf7086a951877..74bf98a394352 100644 --- a/libmilter/worker.c +++ b/libmilter/worker.c @@ -56,7 +56,7 @@ static taskmgr_T Tskmgr = {0}; #ifndef USE_PIPE_WAKE_POLL # define USE_PIPE_WAKE_POLL 1 -#endif /* USE_PIPE_WAKE_POLL */ +#endif /* poll check periodicity (default 10000 - 10 s) */ #define POLL_TIMEOUT 10000 @@ -83,7 +83,7 @@ static int mi_list_del_ctx __P((SMFICTX_PTR)); #ifndef OLD_SESSION_TIMEOUT # define OLD_SESSION_TIMEOUT ctx->ctx_timeout -#endif /* OLD_SESSION_TIMEOUT */ +#endif /* session states - with respect to the pool of workers */ #define WKST_INIT 0 /* initial state */ @@ -143,7 +143,7 @@ static int mi_list_del_ctx __P((SMFICTX_PTR)); # define POOL_LEV_DPRINTF(lev, x) \ do \ { \ - if ((lev) < ctx->ctx_dbg) \ + if (ctx != NULL && (lev) < ctx->ctx_dbg) \ sm_dprintf x; \ } while (0) #else /* POOL_DEBUG */ @@ -381,8 +381,6 @@ mi_pool_controller(arg) int nfd, r, i; time_t now; - POOL_LEV_DPRINTF(4, ("Let's %s again...", WAITFN)); - if (mi_stop() != MILTER_CONT) break; |
