Welcome! Log In Create A New Profile

Advanced

Re: SMTP AUTH with XCLIENT - impossible or just difficult?

Maxim Dounin
August 05, 2010 10:04PM
Hello!

On Fri, Aug 06, 2010 at 05:56:36AM +0400, Maxim Dounin wrote:

[...]

> Here actual problem happens. nginx doesn't really understand
> multiline smtp replies, but usually handles them nicely once they
> happen to be in single tcp packet.
>
> Most likely your tcp daemon sends ehlo reply in multiple packets.
> This isn't good from performance point of view but anyway should
> be supported. Try the attached patch.

Oops, sorry, forgot to attach the patch. Next try... :)

Maxim Dounin
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1281055684 -14400
# Node ID 6ff8b5f13ef2d572ca09d6deb86a8fb189c3df0e
# Parent ad310549c5d4a121f64a2f4167d445c86caf031e
Mail: handle smtp multiline replies.

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
@@ -701,7 +701,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;
@@ -778,6 +778,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 mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

SMTP AUTH with XCLIENT - impossible or just difficult?

Karl Kraft August 04, 2010 09:08AM

Re: SMTP AUTH with XCLIENT - impossible or just difficult?

Maxim Dounin August 05, 2010 10:04PM

Re: SMTP AUTH with XCLIENT - impossible or just difficult?

Maxim Dounin August 05, 2010 10:06PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 208
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready