Welcome! Log In Create A New Profile

Advanced

[nginx] Mail: handle smtp multiline replies.

Maxim Dounin
September 30, 2013 02:12PM
details: http://hg.nginx.org/nginx/rev/d3e09aa03a7a
branches:
changeset: 5399:d3e09aa03a7a
user: Maxim Dounin <mdounin@mdounin.ru>
date: Mon Sep 30 22:10:03 2013 +0400
description:
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

diffstat:

src/mail/ngx_mail_proxy_module.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)

diffs (38 lines):

diff --git a/src/mail/ngx_mail_proxy_module.c b/src/mail/ngx_mail_proxy_module.c
--- a/src/mail/ngx_mail_proxy_module.c
+++ b/src/mail/ngx_mail_proxy_module.c
@@ -707,7 +707,7 @@ ngx_mail_proxy_dummy_handler(ngx_event_t
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_se
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:

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Mail: handle smtp multiline replies.

Maxim Dounin 605 September 30, 2013 02:12PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 161
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready