1d0cef73dSGregory Neil Shapiro<HTML> 2d0cef73dSGregory Neil Shapiro<HEAD><TITLE>smfi_setmlreply</TITLE></HEAD> 3d0cef73dSGregory Neil Shapiro<BODY> 4e92d3f3fSGregory Neil Shapiro<!-- 54313cc83SGregory Neil Shapiro$Id: smfi_setmlreply.html,v 1.5 2013-11-22 20:51:39 ca Exp $ 6e92d3f3fSGregory Neil Shapiro--> 7d0cef73dSGregory Neil Shapiro<H1>smfi_setmlreply</H1> 8e92d3f3fSGregory Neil Shapiro 9d0cef73dSGregory Neil Shapiro<TABLE border="0" cellspacing=4 cellpadding=4> 10e92d3f3fSGregory Neil Shapiro<!---------- Synopsis -----------> 11d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD> 12d0cef73dSGregory Neil Shapiro<PRE> 13e92d3f3fSGregory Neil Shapiro#include <libmilter/mfapi.h> 14e92d3f3fSGregory Neil Shapiroint smfi_setmlreply( 15e92d3f3fSGregory Neil Shapiro SMFICTX *ctx, 16e92d3f3fSGregory Neil Shapiro char *rcode, 17e92d3f3fSGregory Neil Shapiro char *xcode, 18e92d3f3fSGregory Neil Shapiro ... 19e92d3f3fSGregory Neil Shapiro); 20d0cef73dSGregory Neil Shapiro</PRE> 21e92d3f3fSGregory Neil ShapiroSet the default SMTP error reply code to a multi-line response. Only 4XX 22e92d3f3fSGregory Neil Shapiroand 5XX replies are accepted. 23d0cef73dSGregory Neil Shapiro</TD></TR> 24e92d3f3fSGregory Neil Shapiro 25e92d3f3fSGregory Neil Shapiro<!----------- Description ----------> 26d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>DESCRIPTION</TH><TD> 27d0cef73dSGregory Neil Shapiro<TABLE border="1" cellspacing=1 cellpadding=4> 28d0cef73dSGregory Neil Shapiro<TR align="left" valign=top> 29d0cef73dSGregory Neil Shapiro<TH width="80">Called When</TH> 30d0cef73dSGregory Neil Shapiro<TD>smfi_setmlreply may be called from any of the xxfi_ callbacks 31d0cef73dSGregory Neil Shapiroother than xxfi_connect.</TD> 32d0cef73dSGregory Neil Shapiro</TR> 33d0cef73dSGregory Neil Shapiro<TR align="left" valign=top> 34d0cef73dSGregory Neil Shapiro<TH width="80">Effects</TH> 35d0cef73dSGregory Neil Shapiro<TD>Directly set the SMTP error reply code for this connection to the given 36*2fb4f839SGregory Neil Shapirolines after the xcode. 37*2fb4f839SGregory Neil ShapiroThe list of arguments must be NULL terminated. 38e92d3f3fSGregory Neil ShapiroThis code will be used on subsequent error replies resulting from actions 39d0cef73dSGregory Neil Shapirotaken by this filter.</TD> 40d0cef73dSGregory Neil Shapiro</TR> 41d0cef73dSGregory Neil Shapiro</TABLE> 425b0945b5SGregory Neil Shapiro</TD></TR> 43e92d3f3fSGregory Neil Shapiro 44e92d3f3fSGregory Neil Shapiro<!----------- Arguments ----------> 45d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>ARGUMENTS</TH><TD> 46d0cef73dSGregory Neil Shapiro <TABLE border="1" cellspacing=0> 47d0cef73dSGregory Neil Shapiro <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR> 48d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>ctx</TD> 49d0cef73dSGregory Neil Shapiro <TD>Opaque context structure. 50d0cef73dSGregory Neil Shapiro </TD></TR> 51d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>rcode</TD> 52*2fb4f839SGregory Neil Shapiro <TD>The three-digit (RFC 821/2821) SMTP reply code, 53*2fb4f839SGregory Neil Shapiro as a null-terminated string. 54*2fb4f839SGregory Neil Shapiro rcode cannot be NULL, and must be a valid 4XX or 5XX reply code. 55d0cef73dSGregory Neil Shapiro </TD></TR> 56d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>xcode</TD> 57*2fb4f839SGregory Neil Shapiro <TD>The extended (RFC 1893/2034) reply code. 58*2fb4f839SGregory Neil Shapiro If xcode is NULL, a generic X.0.0 code is used, 59*2fb4f839SGregory Neil Shapiro where X is the first digit of rcode. 60*2fb4f839SGregory Neil Shapiro Otherwise, xcode must conform to RFC 1893/2034. 61d0cef73dSGregory Neil Shapiro </TD></TR> 62d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>...</TD> 63*2fb4f839SGregory Neil Shapiro <TD>The remainder of the arguments are single lines of text, 64*2fb4f839SGregory Neil Shapiro up to 32 arguments, 65*2fb4f839SGregory Neil Shapiro which will be used as the text part of the SMTP reply. 66*2fb4f839SGregory Neil Shapiro The list must be NULL terminated. 67d0cef73dSGregory Neil Shapiro </TD></TR> 68d0cef73dSGregory Neil Shapiro </TABLE> 69d0cef73dSGregory Neil Shapiro</TD></TR> 70e92d3f3fSGregory Neil Shapiro 71e92d3f3fSGregory Neil Shapiro<!----------- Example ----------> 72d0cef73dSGregory Neil Shapiro<TR> 73*2fb4f839SGregory Neil Shapiro<TH valign="top" align=left>EXAMPLE</TH> 74d0cef73dSGregory Neil Shapiro<TD> 75e92d3f3fSGregory Neil ShapiroFor example, the code:<BR> 76d0cef73dSGregory Neil Shapiro<PRE> 77e92d3f3fSGregory Neil Shapiro ret = smfi_setmlreply(ctx, "550", "5.7.0", 78e92d3f3fSGregory Neil Shapiro "Spammer access rejected", 79e92d3f3fSGregory Neil Shapiro "Please see our policy at:", 80e92d3f3fSGregory Neil Shapiro "http://www.example.com/spampolicy.html", 81e92d3f3fSGregory Neil Shapiro NULL); 82d0cef73dSGregory Neil Shapiro</PRE> 83e92d3f3fSGregory Neil Shapiro<BR>would give the SMTP response:<BR> 84d0cef73dSGregory Neil Shapiro<PRE> 85e92d3f3fSGregory Neil Shapiro550-5.7.0 Spammer access rejected 86e92d3f3fSGregory Neil Shapiro550-5.7.0 Please see our policy at: 87e92d3f3fSGregory Neil Shapiro550 5.7.0 http://www.example.com/spampolicy.html 88d0cef73dSGregory Neil Shapiro</PRE> 89d0cef73dSGregory Neil Shapiro</TD> 90d0cef73dSGregory Neil Shapiro</TR> 91e92d3f3fSGregory Neil Shapiro 92e92d3f3fSGregory Neil Shapiro<!----------- Return values ----------> 93d0cef73dSGregory Neil Shapiro<TR> 94d0cef73dSGregory Neil Shapiro<TH valign="top" align=left>RETURN VALUES</TH> 95e92d3f3fSGregory Neil Shapiro 96d0cef73dSGregory Neil Shapiro<TD>smfi_setmlreply will fail and return MI_FAILURE if: 97d0cef73dSGregory Neil Shapiro<UL> 98d0cef73dSGregory Neil Shapiro <LI>The rcode or xcode argument is invalid. 99d0cef73dSGregory Neil Shapiro <LI>A memory-allocation failure occurs. 1005b0945b5SGregory Neil Shapiro <LI>If any text line contains a carriage return or line feed. 101d0cef73dSGregory Neil Shapiro <LI>The length of any text line is more than MAXREPLYLEN (980). 102d0cef73dSGregory Neil Shapiro <LI>More than 32 lines of text replies are given. 103d0cef73dSGregory Neil Shapiro</UL> 104e92d3f3fSGregory Neil ShapiroOtherwise, it return MI_SUCCESS. 105d0cef73dSGregory Neil Shapiro</TD> 106d0cef73dSGregory Neil Shapiro</TR> 107e92d3f3fSGregory Neil Shapiro 108e92d3f3fSGregory Neil Shapiro<!----------- Notes ----------> 109d0cef73dSGregory Neil Shapiro<TR align="left" valign=top> 110d0cef73dSGregory Neil Shapiro<TH>NOTES</TH> 111d0cef73dSGregory Neil Shapiro<TD> 112d0cef73dSGregory Neil Shapiro<UL> 113d0cef73dSGregory Neil Shapiro<LI>Values passed to smfi_setmlreply are not checked for standards compliance. 114d0cef73dSGregory Neil Shapiro<LI>The message parameter should contain only printable characters, 115e92d3f3fSGregory Neil Shapiroother characters may lead to undefined behavior. 116e92d3f3fSGregory Neil ShapiroFor example, CR or LF will cause the call to fail, 117e92d3f3fSGregory Neil Shapirosingle '%' characters will cause the text to be ignored 118e92d3f3fSGregory Neil Shapiro(if there really should be a '%' in the string, 119d0cef73dSGregory Neil Shapirouse '%%' just like for <TT>printf(3)</TT>). 120d0cef73dSGregory Neil Shapiro<LI>For details about reply codes and their meanings, please see RFC's 121d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc821.txt">821</A>/ 122d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc2821.txt">2821</A> 123e92d3f3fSGregory Neil Shapiroand 124d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc1893.txt">1893</A>/ 125d0cef73dSGregory Neil Shapiro<A href="http://www.rfc-editor.org/rfc/rfc2034.txt">2034</A>. 126d0cef73dSGregory Neil Shapiro<LI>If the reply code (rcode) given is a '4XX' code but SMFI_REJECT is used 127e92d3f3fSGregory Neil Shapirofor the message, the custom reply is not used. 128d0cef73dSGregory Neil Shapiro<LI>Similarly, if the reply code (rcode) given is a '5XX' code but 129e92d3f3fSGregory Neil ShapiroSMFI_TEMPFAIL is used for the message, the custom reply is not used. 130e92d3f3fSGregory Neil Shapiro<BR> 131e92d3f3fSGregory Neil ShapiroNote: in neither of the last two cases an error is returned to the milter, 132e92d3f3fSGregory Neil Shapirolibmilter silently ignores the reply code. 133d0cef73dSGregory Neil Shapiro<LI>If the milter returns SMFI_TEMPFAIL and sets the reply code to '421', 134d0cef73dSGregory Neil Shapirothen the SMTP server will terminate the SMTP session with a 421 error code. 135d0cef73dSGregory Neil Shapiro</UL> 136d0cef73dSGregory Neil Shapiro</TD> 137d0cef73dSGregory Neil Shapiro</TR> 138e92d3f3fSGregory Neil Shapiro 139d0cef73dSGregory Neil Shapiro</TABLE> 140e92d3f3fSGregory Neil Shapiro 141d0cef73dSGregory Neil Shapiro<HR size="1"> 142d0cef73dSGregory Neil Shapiro<FONT size="-1"> 1435dd76dd0SGregory Neil ShapiroCopyright (c) 2000, 2002-2003 Proofpoint, Inc. and its suppliers. 144e92d3f3fSGregory Neil ShapiroAll rights reserved. 145d0cef73dSGregory Neil Shapiro<BR> 146e92d3f3fSGregory Neil ShapiroBy using this file, you agree to the terms and conditions set 147e92d3f3fSGregory Neil Shapiroforth in the LICENSE. 148d0cef73dSGregory Neil Shapiro</FONT> 149d0cef73dSGregory Neil Shapiro</BODY> 150d0cef73dSGregory Neil Shapiro</HTML> 151