xref: /freebsd/contrib/sendmail/libmilter/docs/smfi_setreply.html (revision 5d747405d755ed5b25cbdd8899484f55dd224665)
1<html>
2<head><title>smfi_setreply</title></head>
3<body>
4<h1>smfi_setreply</h1>
5
6<table border="0" cellspacing=4 cellpadding=4>
7<!---------- Synopsis ----------->
8<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
9<pre>
10#include &lt;libmilter/mfapi.h&gt;
11int smfi_setreply(
12	SMFICTX *ctx,
13	char *rcode,
14	char *xcode,
15	char *message
16);
17</pre>
18Set the default SMTP error reply code.  Only 4XX and 5XX replies are accepted.
19</td></tr>
20
21<!----------- Description ---------->
22<tr><th valign="top" align=left>DESCRIPTION</th><td>
23<table border="1" cellspacing=1 cellpadding=4>
24<tr align="left" valign=top>
25<th width="80">Called When</th>
26<td>smfi_setreply may be called from any of the xxfi_ callbacks
27other than xxfi_connect.</td>
28</tr>
29<tr align="left" valign=top>
30<th width="80">Effects</th>
31<td>Directly set the SMTP error reply code for this connection.  This code
32will be used on subsequent error replies resulting from actions taken by
33this filter.</td>
34</tr>
35</table>
36
37<!----------- Arguments ---------->
38<tr><th valign="top" align=left>ARGUMENTS</th><td>
39    <table border="1" cellspacing=0>
40    <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
41    <tr valign="top"><td>ctx</td>
42	<td>Opaque context structure.
43	</td></tr>
44    <tr valign="top"><td>rcode</td>
45	<td>The three-digit (RFC 821/2821) SMTP reply code, as a
46	null-terminated string.  rcode cannot be NULL, and must be a valid
47	4XX or 5XX reply code.
48        </td></tr>
49    <tr valign="top"><td>xcode</td>
50	<td>The extended (RFC 1893/2034) reply code.  If xcode is NULL, no
51	extended code is used.  Otherwise, xcode must conform to RFC 1893/2034.
52	</td></tr>
53    <tr valign="top"><td>message</td>
54	<td>The text part of the SMTP reply.  If message is NULL, an empty message is used.
55	</td></tr>
56    </table>
57</td></tr>
58
59<!----------- Return values ---------->
60<tr>
61<th valign="top" align=left>RETURN VALUES</th>
62
63<td>smfi_setreply will fail and return MI_FAILURE if:
64<ul>
65    <li>The rcode or xcode argument is invalid.
66    <li>A memory-allocation failure occurs.
67</ul>
68Otherwise, it return MI_SUCCESS.
69</td>
70</tr>
71
72<!----------- Notes ---------->
73<tr align="left" valign=top>
74<th>NOTES</th>
75<td>
76<ul>
77<li>Values passed to smfi_setreply are not checked for standards compliance.
78<li>The message parameter should contain only printable characters,
79other characters may lead to undefined behavior.
80For example, CR or LF will cause the call to fail,
81single '%' characters will cause the text to be ignored
82(if there really should be a '%' in the string,
83use '%%' just like for <tt>printf(3)</tt>).
84<li>For details about reply codes and their meanings, please see RFC's
85<a href="http://www.rfc-editor.org/rfc/rfc821.txt">821</a>/
86<a href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</a>
87and
88<a href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</a>/
89<a href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</a>.
90<li>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used
91for the message, the custom reply is not used.
92<li>Similarly, if the reply code (rcode) given is a '5XX' code but
93SMFI_TEMPFAIL is used for the message, the custom reply is not used.
94</ul>
95</td>
96</tr>
97
98</table>
99
100<hr size="1">
101<font size="-1">
102Copyright (c) 2000, 2002-2003 Sendmail, Inc. and its suppliers.
103All rights reserved.
104<br>
105By using this file, you agree to the terms and conditions set
106forth in the LICENSE.
107</font>
108</body>
109</html>
110