Seems like I only post when I need help!
I've been running my SMTP server for quite a while now (a
month) and I've noticed the following behaviour. Every now
and then a client closes the socket during the DATA phase. I
catch that and discard the message. However, after
re-reading the RFC, I get 2 conflicting ways to handle
this:
one part of the rfc states: 4.1.1.5 RESET (RSET)
... There are circumstances, contrary to the intent of this
specification, in which an SMTP server may receive an
indication that
the underlying TCP connection has been closed or reset. To
preserve
the robustness of the mail system, SMTP servers SHOULD be
prepared
for this condition and SHOULD treat it as if a QUIT had been
received
before the connection disappeared.
ok, that says treat it as though a quit happened, which just
doesn't sound
right to me. If DATA was issued and I'm waiting to see a
CRLF.CRLF, and
the client closes the connection, I would think that it
would be better
to assume the entire message hasn't been sent.
however later I see:
4.1.1.10 QUIT (QUIT)
... If the connection is closed prematurely due to
violations
of the above or system or network failure, the server MUST
cancel any
pending transaction, but not undo any previously completed
transaction, and generally MUST act as if the command or
transaction
in progress had received a temporary error (i.e., a 4yz
response).
which doesn't quite make sense to me because basically it
sounds like this:
DATA -> oops! -> back to MAIL state -> return a 4xx
code
but wait, the socket is closed!
So does anybody have some words of wisdom?
I'm thinking the correct behaviour is to treat it as the
following:
client closed socket
server treats it as a RSET and QUIT.
I'm reachable at jeff @ virtualbuilder dot com