Mercurial > hg > nginx
comparison src/mail/ngx_mail_proxy_module.c @ 5522:bb3dc21c89ef
Mail: fixed passing of IPv6 client address in XCLIENT.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Fri, 17 Jan 2014 22:06:04 +0400 |
parents | d3e09aa03a7a |
children | bf1655ae9a1c |
comparison
equal
deleted
inserted
replaced
5521:320abeb364e6 | 5522:bb3dc21c89ef |
---|---|
540 | 540 |
541 line.len = sizeof("XCLIENT ADDR= LOGIN= NAME=" | 541 line.len = sizeof("XCLIENT ADDR= LOGIN= NAME=" |
542 CRLF) - 1 | 542 CRLF) - 1 |
543 + s->connection->addr_text.len + s->login.len + s->host.len; | 543 + s->connection->addr_text.len + s->login.len + s->host.len; |
544 | 544 |
545 #if (NGX_HAVE_INET6) | |
546 if (s->connection->sockaddr->sa_family == AF_INET6) { | |
547 line.len += sizeof("IPV6:") - 1; | |
548 } | |
549 #endif | |
550 | |
545 line.data = ngx_pnalloc(c->pool, line.len); | 551 line.data = ngx_pnalloc(c->pool, line.len); |
546 if (line.data == NULL) { | 552 if (line.data == NULL) { |
547 ngx_mail_proxy_internal_server_error(s); | 553 ngx_mail_proxy_internal_server_error(s); |
548 return; | 554 return; |
549 } | 555 } |
550 | 556 |
551 line.len = ngx_sprintf(line.data, | 557 p = ngx_cpymem(line.data, "XCLIENT ADDR=", sizeof("XCLIENT ADDR=") - 1); |
552 "XCLIENT ADDR=%V%s%V NAME=%V" CRLF, | 558 |
553 &s->connection->addr_text, | 559 #if (NGX_HAVE_INET6) |
554 (s->login.len ? " LOGIN=" : ""), &s->login, &s->host) | 560 if (s->connection->sockaddr->sa_family == AF_INET6) { |
555 - line.data; | 561 p = ngx_cpymem(p, "IPV6:", sizeof("IPV6:") - 1); |
562 } | |
563 #endif | |
564 | |
565 p = ngx_copy(p, s->connection->addr_text.data, | |
566 s->connection->addr_text.len); | |
567 | |
568 if (s->login.len) { | |
569 p = ngx_cpymem(p, " LOGIN=", sizeof(" LOGIN=") - 1); | |
570 p = ngx_copy(p, s->login.data, s->login.len); | |
571 } | |
572 | |
573 p = ngx_cpymem(p, " NAME=", sizeof(" NAME=") - 1); | |
574 p = ngx_copy(p, s->host.data, s->host.len); | |
575 | |
576 *p++ = CR; *p++ = LF; | |
577 | |
578 line.len = p - line.data; | |
556 | 579 |
557 if (s->smtp_helo.len) { | 580 if (s->smtp_helo.len) { |
558 s->mail_state = ngx_smtp_xclient_helo; | 581 s->mail_state = ngx_smtp_xclient_helo; |
559 | 582 |
560 } else if (s->auth_method == NGX_MAIL_AUTH_NONE) { | 583 } else if (s->auth_method == NGX_MAIL_AUTH_NONE) { |