xref: /freebsd/contrib/sendmail/libmilter/docs/smfi_setreply.html (revision 5dd76dd0cc19450133aa379ce0ce4a68ae07fb39)
1d0cef73dSGregory Neil Shapiro<HTML>
2d0cef73dSGregory Neil Shapiro<HEAD><TITLE>smfi_setreply</TITLE></HEAD>
3d0cef73dSGregory Neil Shapiro<BODY>
4e92d3f3fSGregory Neil Shapiro<!--
5*5dd76dd0SGregory Neil Shapiro$Id: smfi_setreply.html,v 1.18 2013/11/22 20:51:39 ca Exp $
6e92d3f3fSGregory Neil Shapiro-->
7d0cef73dSGregory Neil Shapiro<H1>smfi_setreply</H1>
840266059SGregory Neil Shapiro
9d0cef73dSGregory Neil Shapiro<TABLE border="0" cellspacing=4 cellpadding=4>
1040266059SGregory Neil Shapiro<!---------- Synopsis ----------->
11d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD>
12d0cef73dSGregory Neil Shapiro<PRE>
1340266059SGregory Neil Shapiro#include &lt;libmilter/mfapi.h&gt;
1440266059SGregory Neil Shapiroint smfi_setreply(
1540266059SGregory Neil Shapiro	SMFICTX *ctx,
1640266059SGregory Neil Shapiro	char *rcode,
1740266059SGregory Neil Shapiro	char *xcode,
1840266059SGregory Neil Shapiro	char *message
1940266059SGregory Neil Shapiro);
20d0cef73dSGregory Neil Shapiro</PRE>
21a7ec597cSGregory Neil ShapiroSet the default SMTP error reply code.  Only 4XX and 5XX replies are accepted.
22d0cef73dSGregory Neil Shapiro</TD></TR>
2340266059SGregory Neil Shapiro
2440266059SGregory Neil Shapiro<!----------- Description ---------->
25d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>DESCRIPTION</TH><TD>
26d0cef73dSGregory Neil Shapiro<TABLE border="1" cellspacing=1 cellpadding=4>
27d0cef73dSGregory Neil Shapiro<TR align="left" valign=top>
28d0cef73dSGregory Neil Shapiro<TH width="80">Called When</TH>
29d0cef73dSGregory Neil Shapiro<TD>smfi_setreply may be called from any of the xxfi_ callbacks
30d0cef73dSGregory Neil Shapiroother than xxfi_connect.</TD>
31d0cef73dSGregory Neil Shapiro</TR>
32d0cef73dSGregory Neil Shapiro<TR align="left" valign=top>
33d0cef73dSGregory Neil Shapiro<TH width="80">Effects</TH>
34d0cef73dSGregory Neil Shapiro<TD>Directly set the SMTP error reply code for this connection.  This code
3540266059SGregory Neil Shapirowill be used on subsequent error replies resulting from actions taken by
36d0cef73dSGregory Neil Shapirothis filter.</TD>
37d0cef73dSGregory Neil Shapiro</TR>
38d0cef73dSGregory Neil Shapiro</TABLE>
3940266059SGregory Neil Shapiro
4040266059SGregory Neil Shapiro<!----------- Arguments ---------->
41d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
42d0cef73dSGregory Neil Shapiro    <TABLE border="1" cellspacing=0>
43d0cef73dSGregory Neil Shapiro    <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
44d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>ctx</TD>
45d0cef73dSGregory Neil Shapiro	<TD>Opaque context structure.
46d0cef73dSGregory Neil Shapiro	</TD></TR>
47d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>rcode</TD>
48d0cef73dSGregory Neil Shapiro	<TD>The three-digit (RFC 821/2821) SMTP reply code, as a
49a7ec597cSGregory Neil Shapiro	null-terminated string.  rcode cannot be NULL, and must be a valid
50a7ec597cSGregory Neil Shapiro	4XX or 5XX reply code.
51d0cef73dSGregory Neil Shapiro        </TD></TR>
52d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>xcode</TD>
53d0cef73dSGregory Neil Shapiro	<TD>The extended (RFC 1893/2034) reply code.  If xcode is NULL, no
54a7ec597cSGregory Neil Shapiro	extended code is used.  Otherwise, xcode must conform to RFC 1893/2034.
55d0cef73dSGregory Neil Shapiro	</TD></TR>
56d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>message</TD>
57d0cef73dSGregory Neil Shapiro	<TD>The text part of the SMTP reply.  If message is NULL, an empty message is used.
58d0cef73dSGregory Neil Shapiro	</TD></TR>
59d0cef73dSGregory Neil Shapiro    </TABLE>
60d0cef73dSGregory Neil Shapiro</TD></TR>
6140266059SGregory Neil Shapiro
6240266059SGregory Neil Shapiro<!----------- Return values ---------->
63d0cef73dSGregory Neil Shapiro<TR>
64d0cef73dSGregory Neil Shapiro<TH valign="top" align=left>RETURN VALUES</TH>
6540266059SGregory Neil Shapiro
66d0cef73dSGregory Neil Shapiro<TD>smfi_setreply will fail and return MI_FAILURE if:
67d0cef73dSGregory Neil Shapiro<UL>
68d0cef73dSGregory Neil Shapiro    <LI>The rcode or xcode argument is invalid.
69d0cef73dSGregory Neil Shapiro    <LI>A memory-allocation failure occurs.
70d0cef73dSGregory Neil Shapiro</UL>
7140266059SGregory Neil ShapiroOtherwise, it return MI_SUCCESS.
72d0cef73dSGregory Neil Shapiro</TD>
73d0cef73dSGregory Neil Shapiro</TR>
7440266059SGregory Neil Shapiro
7540266059SGregory Neil Shapiro<!----------- Notes ---------->
76d0cef73dSGregory Neil Shapiro<TR align="left" valign=top>
77d0cef73dSGregory Neil Shapiro<TH>NOTES</TH>
78d0cef73dSGregory Neil Shapiro<TD>
79d0cef73dSGregory Neil Shapiro<UL>
80d0cef73dSGregory Neil Shapiro<LI>Values passed to smfi_setreply are not checked for standards compliance.
81d0cef73dSGregory Neil Shapiro<LI>The message parameter should contain only printable characters,
82323f6dcbSGregory Neil Shapiroother characters may lead to undefined behavior.
83323f6dcbSGregory Neil ShapiroFor example, CR or LF will cause the call to fail,
84323f6dcbSGregory Neil Shapirosingle '%' characters will cause the text to be ignored
85323f6dcbSGregory Neil Shapiro(if there really should be a '%' in the string,
86d0cef73dSGregory Neil Shapirouse '%%' just like for <TT>printf(3)</TT>).
87d0cef73dSGregory Neil Shapiro<LI>For details about reply codes and their meanings, please see RFC's
88d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc821.txt">821</A>/
89d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</A>
90a7ec597cSGregory Neil Shapiroand
91d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</A>/
92d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</A>.
93d0cef73dSGregory Neil Shapiro<LI>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
94605302a5SGregory Neil Shapirofor the message, the custom reply is not used.
95d0cef73dSGregory Neil Shapiro<LI>Similarly, if the reply code (rcode) given is a '5XX' code but
96605302a5SGregory Neil ShapiroSMFI_TEMPFAIL is used for the message, the custom reply is not used.
97e92d3f3fSGregory Neil Shapiro<BR>
98e92d3f3fSGregory Neil ShapiroNote: in neither of the last two cases an error is returned to the milter,
99e92d3f3fSGregory Neil Shapirolibmilter silently ignores the reply code.
100d0cef73dSGregory Neil Shapiro<LI>If the milter returns SMFI_TEMPFAIL and sets the reply code to '421',
101d0cef73dSGregory Neil Shapirothen the SMTP server will terminate the SMTP session with a 421 error code.
102d0cef73dSGregory Neil Shapiro</UL>
103d0cef73dSGregory Neil Shapiro</TD>
104d0cef73dSGregory Neil Shapiro</TR>
10540266059SGregory Neil Shapiro
106d0cef73dSGregory Neil Shapiro</TABLE>
10740266059SGregory Neil Shapiro
108d0cef73dSGregory Neil Shapiro<HR size="1">
109d0cef73dSGregory Neil Shapiro<FONT size="-1">
110*5dd76dd0SGregory Neil ShapiroCopyright (c) 2000, 2002-2003 Proofpoint, Inc. and its suppliers.
11140266059SGregory Neil ShapiroAll rights reserved.
112d0cef73dSGregory Neil Shapiro<BR>
11340266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set
1145ef517c0SGregory Neil Shapiroforth in the LICENSE.
115d0cef73dSGregory Neil Shapiro</FONT>
116d0cef73dSGregory Neil Shapiro</BODY>
117d0cef73dSGregory Neil Shapiro</HTML>
118