Seeing all of the various discussion over the last couple of weeks about
what an appropriate response to the initial connection is, I decided to
reread the RFC's and see what they say. I'm not trying to jump in on
anything other than the immediate response from a mail server on connect,
and qmail-remote's immediate response thereto.
We'll start with the background:
1) RFC821 is the current STANDARD for SMTP conversations. While there are
many updates to the protocol (including RFC2821, see item 2), this is
still the official standard adopted by IETF. It specifies that the
success code on connection is 220, and the failure code is 421. Please
note that it also explicitly states that 421 may be given as a response to
any command if the SMTP server knows it needs to close the connection.
2) RFC2821 is the current PROPOSED STANDARD for SMTP conversations. All
modern MTAs that I know of strive to meet this RFC, although in qmail's
case it is through various patches that update it sonce qmail predates the
RFC in question. The response codes specified in RFC2821 are again 220
for success, but no 554 for error (which replaces failure as a term).
However, it also again specifies that 421 may be issued at any time that
the SMTP service is shutting down the connection.
3) Additionally, RFC2821 states that "SMTP clients SHOULD, when possible,
interpret only the first digit of the reply and MUST be prepared to deal
with unrecognized reply codes by interpreting the first digit only."
4) Stock qmail-1.03 and netqmail-1.05 treat an initial code of 220 as
success, and anything else as a temporary failure (qmail-remote.c, line
225, in function smtp).
Modifications to stock qmail:
5) There is a patch on qmail.org by Adrian Ho that is listed as increasing
qmail's compliance with RFC2821 by accepting 5xx codes as initial
responses and treats them as permanent failures
(http://qmail.mirrors.pair.com/accept-5xx.patch).
6) There is a patch out there written by Matthias Andree that I found
linked from John M. Simpson's qmail page (http://qmail.jms1.net) that
further modifies qmail-remote to treat 4xx codes as "move on to the next
MX record"
(http://www-dt.e-technik.uni-dortmund.de/~ma/qmail/patch-qmail-1.03-rfc2821.diff).
Conclusions:
7) qmail-remote treats any code other than 220 as a failure of some
variety, handing the message back to qmail-send for disposition. This is
in line with both RFCs, as qmail-remote is stricly for remote delivery.
8) While stock qmail does indeed follow RFC821, it is lacking explicit
support for treating the 554 response on connect as a permanent failure as
allowed by RFC2821.
9) Adrian Ho's patch (#5) provides support for that code, and allows
other, non-RFC-approved 5xx codes as well.
10) Matthias Andree's patch (#6) may provide a useful way of getting mail
out to destination servers more quickly by trying additional MX records
(often usefull for large providers such as yahoo and hotmail who are often
overloaded), but strictly speaking is not required - qmail-remote is not a
queueing program, it's strictly a remote delivery program.
11) Any mail server that wishes to immediately bounce a message upon
connection is supposed to use one of two response codes: 421 for a
temporary problem, and 554 for a permanent one. Any other code, while it
may be accepted by various mail programs, it technically in violation of
RFCs 821 and/or 2821 and should be strongly discouraged.
12) <rant> Anyone who issues a response code on connection that is not one
of 220, 421 or 554, and then complains about the behavior of the
connecting MTA afterwards, has no leg to stand on and should go away.
Even if you think that qmail is somehow violating an RFC in its behavior
(which it may or may not be), fix your mail system first, and then we can
talk. People who live in glass houses and all that whatnot.</rant>
Constructive criticism and discussion are not only welcome by encouraged.
If you think I'm wrong and can back it up with a good rebuttal, I'll stand
corrected. Of course, I also know I'm inviting a flame war by some
people, but I think the above a reasonably calm discussion (excepting item
#12, which I did enclose in <rant> tags), so I'm willing to take that
risk.
Josh
--
Joshua Megerman
SJGames MIB #5273 - OGRE AI Testing Division
You can't win; You can't break even; You can't even quit the game.
- Layman's translation of the Laws of Thermodynamics
qmail@honorablemenschen.com
|