xref: /freebsd/contrib/sendmail/libmilter/docs/smfi_setreply.html (revision e2c0e292e8a7ca00ba99bcfccc9e637f45c3e8b1)
1d0cef73dSGregory Neil Shapiro<HTML>
2d0cef73dSGregory Neil Shapiro<HEAD><TITLE>smfi_setreply</TITLE></HEAD>
3d0cef73dSGregory Neil Shapiro<BODY>
4e92d3f3fSGregory Neil Shapiro<!--
54313cc83SGregory 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>
39*5b0945b5SGregory Neil Shapiro</TD></TR>
4040266059SGregory Neil Shapiro
4140266059SGregory Neil Shapiro<!----------- Arguments ---------->
42d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
43d0cef73dSGregory Neil Shapiro    <TABLE border="1" cellspacing=0>
44d0cef73dSGregory Neil Shapiro    <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
45d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>ctx</TD>
46d0cef73dSGregory Neil Shapiro	<TD>Opaque context structure.
47d0cef73dSGregory Neil Shapiro	</TD></TR>
48d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>rcode</TD>
49d0cef73dSGregory Neil Shapiro	<TD>The three-digit (RFC 821/2821) SMTP reply code, as a
50a7ec597cSGregory Neil Shapiro	null-terminated string.  rcode cannot be NULL, and must be a valid
51a7ec597cSGregory Neil Shapiro	4XX or 5XX reply code.
52d0cef73dSGregory Neil Shapiro        </TD></TR>
53d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>xcode</TD>
54d0cef73dSGregory Neil Shapiro	<TD>The extended (RFC 1893/2034) reply code.  If xcode is NULL, no
55a7ec597cSGregory Neil Shapiro	extended code is used.  Otherwise, xcode must conform to RFC 1893/2034.
56d0cef73dSGregory Neil Shapiro	</TD></TR>
57d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>message</TD>
58d0cef73dSGregory Neil Shapiro	<TD>The text part of the SMTP reply.  If message is NULL, an empty message is used.
59d0cef73dSGregory Neil Shapiro	</TD></TR>
60d0cef73dSGregory Neil Shapiro    </TABLE>
61d0cef73dSGregory Neil Shapiro</TD></TR>
6240266059SGregory Neil Shapiro
6340266059SGregory Neil Shapiro<!----------- Return values ---------->
64d0cef73dSGregory Neil Shapiro<TR>
65d0cef73dSGregory Neil Shapiro<TH valign="top" align=left>RETURN VALUES</TH>
6640266059SGregory Neil Shapiro
67d0cef73dSGregory Neil Shapiro<TD>smfi_setreply will fail and return MI_FAILURE if:
68d0cef73dSGregory Neil Shapiro<UL>
69d0cef73dSGregory Neil Shapiro    <LI>The rcode or xcode argument is invalid.
70d0cef73dSGregory Neil Shapiro    <LI>A memory-allocation failure occurs.
71*5b0945b5SGregory Neil Shapiro    <LI>The length of any text line is more than MAXREPLYLEN (980).
72*5b0945b5SGregory Neil Shapiro    <LI>The message argument contains a carriage return or line feed.
73d0cef73dSGregory Neil Shapiro</UL>
7440266059SGregory Neil ShapiroOtherwise, it return MI_SUCCESS.
75d0cef73dSGregory Neil Shapiro</TD>
76d0cef73dSGregory Neil Shapiro</TR>
7740266059SGregory Neil Shapiro
7840266059SGregory Neil Shapiro<!----------- Notes ---------->
79d0cef73dSGregory Neil Shapiro<TR align="left" valign=top>
80d0cef73dSGregory Neil Shapiro<TH>NOTES</TH>
81d0cef73dSGregory Neil Shapiro<TD>
82d0cef73dSGregory Neil Shapiro<UL>
83d0cef73dSGregory Neil Shapiro<LI>Values passed to smfi_setreply are not checked for standards compliance.
84d0cef73dSGregory Neil Shapiro<LI>The message parameter should contain only printable characters,
85323f6dcbSGregory Neil Shapiroother characters may lead to undefined behavior.
86323f6dcbSGregory Neil ShapiroFor example, CR or LF will cause the call to fail,
87323f6dcbSGregory Neil Shapirosingle '%' characters will cause the text to be ignored
88323f6dcbSGregory Neil Shapiro(if there really should be a '%' in the string,
89d0cef73dSGregory Neil Shapirouse '%%' just like for <TT>printf(3)</TT>).
90d0cef73dSGregory Neil Shapiro<LI>For details about reply codes and their meanings, please see RFC's
91d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc821.txt">821</A>/
92d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</A>
93a7ec597cSGregory Neil Shapiroand
94d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</A>/
95d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</A>.
96d0cef73dSGregory Neil Shapiro<LI>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
97605302a5SGregory Neil Shapirofor the message, the custom reply is not used.
98d0cef73dSGregory Neil Shapiro<LI>Similarly, if the reply code (rcode) given is a '5XX' code but
99605302a5SGregory Neil ShapiroSMFI_TEMPFAIL is used for the message, the custom reply is not used.
100e92d3f3fSGregory Neil Shapiro<BR>
101e92d3f3fSGregory Neil ShapiroNote: in neither of the last two cases an error is returned to the milter,
102e92d3f3fSGregory Neil Shapirolibmilter silently ignores the reply code.
103d0cef73dSGregory Neil Shapiro<LI>If the milter returns SMFI_TEMPFAIL and sets the reply code to '421',
104d0cef73dSGregory Neil Shapirothen the SMTP server will terminate the SMTP session with a 421 error code.
105d0cef73dSGregory Neil Shapiro</UL>
106d0cef73dSGregory Neil Shapiro</TD>
107d0cef73dSGregory Neil Shapiro</TR>
10840266059SGregory Neil Shapiro
109d0cef73dSGregory Neil Shapiro</TABLE>
11040266059SGregory Neil Shapiro
111d0cef73dSGregory Neil Shapiro<HR size="1">
112d0cef73dSGregory Neil Shapiro<FONT size="-1">
1135dd76dd0SGregory Neil ShapiroCopyright (c) 2000, 2002-2003 Proofpoint, Inc. and its suppliers.
11440266059SGregory Neil ShapiroAll rights reserved.
115d0cef73dSGregory Neil Shapiro<BR>
11640266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set
1175ef517c0SGregory Neil Shapiroforth in the LICENSE.
118d0cef73dSGregory Neil Shapiro</FONT>
119d0cef73dSGregory Neil Shapiro</BODY>
120d0cef73dSGregory Neil Shapiro</HTML>
121