xref: /freebsd/contrib/sendmail/libmilter/docs/smfi_setreply.html (revision 323f6dcb88194c5561fc9e314d5b98539ab3fe5a)
140266059SGregory Neil Shapiro<html>
240266059SGregory Neil Shapiro<head><title>smfi_setreply</title></head>
340266059SGregory Neil Shapiro<body>
440266059SGregory Neil Shapiro<h1>smfi_setreply</h1>
540266059SGregory Neil Shapiro
640266059SGregory Neil Shapiro<table border="0" cellspacing=4 cellpadding=4>
740266059SGregory Neil Shapiro<!---------- Synopsis ----------->
840266059SGregory Neil Shapiro<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
940266059SGregory Neil Shapiro<pre>
1040266059SGregory Neil Shapiro#include &lt;libmilter/mfapi.h&gt;
1140266059SGregory Neil Shapiroint smfi_setreply(
1240266059SGregory Neil Shapiro	SMFICTX *ctx,
1340266059SGregory Neil Shapiro	char *rcode,
1440266059SGregory Neil Shapiro	char *xcode,
1540266059SGregory Neil Shapiro	char *message
1640266059SGregory Neil Shapiro);
1740266059SGregory Neil Shapiro</pre>
18a7ec597cSGregory Neil ShapiroSet the default SMTP error reply code.  Only 4XX and 5XX replies are accepted.
1940266059SGregory Neil Shapiro</td></tr>
2040266059SGregory Neil Shapiro
2140266059SGregory Neil Shapiro<!----------- Description ---------->
2240266059SGregory Neil Shapiro<tr><th valign="top" align=left>DESCRIPTION</th><td>
2340266059SGregory Neil Shapiro<table border="1" cellspacing=1 cellpadding=4>
2440266059SGregory Neil Shapiro<tr align="left" valign=top>
2540266059SGregory Neil Shapiro<th width="80">Called When</th>
26d9986b26SGregory Neil Shapiro<td>smfi_setreply may be called from any of the xxfi_ callbacks
27d9986b26SGregory Neil Shapiroother than xxfi_connect.</td>
2840266059SGregory Neil Shapiro</tr>
2940266059SGregory Neil Shapiro<tr align="left" valign=top>
3040266059SGregory Neil Shapiro<th width="80">Effects</th>
3140266059SGregory Neil Shapiro<td>Directly set the SMTP error reply code for this connection.  This code
3240266059SGregory Neil Shapirowill be used on subsequent error replies resulting from actions taken by
3340266059SGregory Neil Shapirothis filter.</td>
3440266059SGregory Neil Shapiro</tr>
3540266059SGregory Neil Shapiro</table>
3640266059SGregory Neil Shapiro
3740266059SGregory Neil Shapiro<!----------- Arguments ---------->
3840266059SGregory Neil Shapiro<tr><th valign="top" align=left>ARGUMENTS</th><td>
3940266059SGregory Neil Shapiro    <table border="1" cellspacing=0>
4040266059SGregory Neil Shapiro    <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
4140266059SGregory Neil Shapiro    <tr valign="top"><td>ctx</td>
4240266059SGregory Neil Shapiro	<td>Opaque context structure.
4340266059SGregory Neil Shapiro	</td></tr>
4440266059SGregory Neil Shapiro    <tr valign="top"><td>rcode</td>
45a7ec597cSGregory Neil Shapiro	<td>The three-digit (RFC 821/2821) SMTP reply code, as a
46a7ec597cSGregory Neil Shapiro	null-terminated string.  rcode cannot be NULL, and must be a valid
47a7ec597cSGregory Neil Shapiro	4XX or 5XX reply code.
4840266059SGregory Neil Shapiro        </td></tr>
4940266059SGregory Neil Shapiro    <tr valign="top"><td>xcode</td>
50a7ec597cSGregory Neil Shapiro	<td>The extended (RFC 1893/2034) reply code.  If xcode is NULL, no
51a7ec597cSGregory Neil Shapiro	extended code is used.  Otherwise, xcode must conform to RFC 1893/2034.
5240266059SGregory Neil Shapiro	</td></tr>
5340266059SGregory Neil Shapiro    <tr valign="top"><td>message</td>
5440266059SGregory Neil Shapiro	<td>The text part of the SMTP reply.  If message is NULL, an empty message is used.
5540266059SGregory Neil Shapiro	</td></tr>
5640266059SGregory Neil Shapiro    </table>
5740266059SGregory Neil Shapiro</td></tr>
5840266059SGregory Neil Shapiro
5940266059SGregory Neil Shapiro<!----------- Return values ---------->
6040266059SGregory Neil Shapiro<tr>
6140266059SGregory Neil Shapiro<th valign="top" align=left>RETURN VALUES</th>
6240266059SGregory Neil Shapiro
6340266059SGregory Neil Shapiro<td>smfi_setreply will fail and return MI_FAILURE if:
6440266059SGregory Neil Shapiro<ul>
6540266059SGregory Neil Shapiro    <li>The rcode or xcode argument is invalid.
6640266059SGregory Neil Shapiro    <li>A memory-allocation failure occurs.
6740266059SGregory Neil Shapiro</ul>
6840266059SGregory Neil ShapiroOtherwise, it return MI_SUCCESS.
6940266059SGregory Neil Shapiro</td>
7040266059SGregory Neil Shapiro</tr>
7140266059SGregory Neil Shapiro
7240266059SGregory Neil Shapiro<!----------- Notes ---------->
7340266059SGregory Neil Shapiro<tr align="left" valign=top>
7440266059SGregory Neil Shapiro<th>NOTES</th>
7540266059SGregory Neil Shapiro<td>
7640266059SGregory Neil Shapiro<ul>
7740266059SGregory Neil Shapiro<li>Values passed to smfi_setreply are not checked for standards compliance.
78323f6dcbSGregory Neil Shapiro<li>The message parameter should contain only printable characters,
79323f6dcbSGregory Neil Shapiroother characters may lead to undefined behavior.
80323f6dcbSGregory Neil ShapiroFor example, CR or LF will cause the call to fail,
81323f6dcbSGregory Neil Shapirosingle '%' characters will cause the text to be ignored
82323f6dcbSGregory Neil Shapiro(if there really should be a '%' in the string,
83323f6dcbSGregory Neil Shapirouse '%%' just like for <tt>printf(3)</tt>).
8440266059SGregory Neil Shapiro<li>For details about reply codes and their meanings, please see RFC's
85a7ec597cSGregory Neil Shapiro<a href="http://www.rfc-editor.org/rfc/rfc821.txt">821</a>/
86a7ec597cSGregory Neil Shapiro<a href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</a>
87a7ec597cSGregory Neil Shapiroand
88a7ec597cSGregory Neil Shapiro<a href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</a>/
89a7ec597cSGregory Neil Shapiro<a href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</a>.
90605302a5SGregory Neil Shapiro<li>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
91605302a5SGregory Neil Shapirofor the message, the custom reply is not used.
92605302a5SGregory Neil Shapiro<li>Similarly, if the reply code (rcode) given is a '5XX' code but
93605302a5SGregory Neil ShapiroSMFI_TEMPFAIL is used for the message, the custom reply is not used.
9440266059SGregory Neil Shapiro</ul>
9540266059SGregory Neil Shapiro</td>
9640266059SGregory Neil Shapiro</tr>
9740266059SGregory Neil Shapiro
9840266059SGregory Neil Shapiro</table>
9940266059SGregory Neil Shapiro
10040266059SGregory Neil Shapiro<hr size="1">
10140266059SGregory Neil Shapiro<font size="-1">
1025ef517c0SGregory Neil ShapiroCopyright (c) 2000, 2002-2003 Sendmail, Inc. and its suppliers.
10340266059SGregory Neil ShapiroAll rights reserved.
10440266059SGregory Neil Shapiro<br>
10540266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set
1065ef517c0SGregory Neil Shapiroforth in the LICENSE.
10740266059SGregory Neil Shapiro</font>
10840266059SGregory Neil Shapiro</body>
10940266059SGregory Neil Shapiro</html>
110