]> git.kaiwu.me - nginx.git/commitdiff
Mail: added session close on smtp_greeting_delay violation.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 30 Sep 2013 18:09:50 +0000 (22:09 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 30 Sep 2013 18:09:50 +0000 (22:09 +0400)
A server MUST send greeting before other replies, while before this
change in case of smtp_greeting_delay violation the 220 greeting was
sent after several 503 replies to commands received before greeting,
resulting in protocol synchronization loss.  Moreover, further commands
were accepted after the greeting.

While closing a connection isn't strictly RFC compliant (RFC 5321
requires servers to wait for a QUIT before closing a connection), it's
probably good enough for practial uses.

src/mail/ngx_mail_smtp_handler.c

index 21714239fccd0c7f4d732521c4c491e066d47779..c118f547dcffd504a5f5eda04ca021ba2d46ea2d 100644 (file)
@@ -321,6 +321,7 @@ ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev)
         }
 
         ngx_str_set(&s->out, smtp_invalid_pipelining);
+        s->quit = 1;
     }
 
     ngx_mail_send(c->write);