mirror of
https://github.com/nginx/nginx.git
synced 2024-12-03 04:39:00 +08:00
Mail: handle smtp multiline replies.
See here for details: http://nginx.org/pipermail/nginx/2010-August/021713.html http://nginx.org/pipermail/nginx/2010-August/021784.html http://nginx.org/pipermail/nginx/2010-August/021785.html
This commit is contained in:
parent
4f6f653f48
commit
f2b5192c30
@ -707,7 +707,7 @@ ngx_mail_proxy_dummy_handler(ngx_event_t *wev)
|
||||
static ngx_int_t
|
||||
ngx_mail_proxy_read_response(ngx_mail_session_t *s, ngx_uint_t state)
|
||||
{
|
||||
u_char *p;
|
||||
u_char *p, *m;
|
||||
ssize_t n;
|
||||
ngx_buf_t *b;
|
||||
ngx_mail_proxy_conf_t *pcf;
|
||||
@ -784,6 +784,25 @@ ngx_mail_proxy_read_response(ngx_mail_session_t *s, ngx_uint_t state)
|
||||
break;
|
||||
|
||||
default: /* NGX_MAIL_SMTP_PROTOCOL */
|
||||
|
||||
if (p[3] == '-') {
|
||||
/* multiline reply, check if we got last line */
|
||||
|
||||
m = b->last - (sizeof(CRLF "200" CRLF) - 1);
|
||||
|
||||
while (m > p) {
|
||||
if (m[0] == CR && m[1] == LF) {
|
||||
break;
|
||||
}
|
||||
|
||||
m--;
|
||||
}
|
||||
|
||||
if (m <= p || m[5] == '-') {
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
|
||||
case ngx_smtp_start:
|
||||
|
Loading…
Reference in New Issue
Block a user