Welcome! Log In Create A New Profile

Advanced

[nginx] Mail: fixed passing of IPv6 client address in XCLIENT.

Ruslan Ermilov
January 17, 2014 01:12PM
details: http://hg.nginx.org/nginx/rev/bb3dc21c89ef
branches:
changeset: 5522:bb3dc21c89ef
user: Ruslan Ermilov <ru@nginx.com>
date: Fri Jan 17 22:06:04 2014 +0400
description:
Mail: fixed passing of IPv6 client address in XCLIENT.

diffstat:

src/mail/ngx_mail_proxy_module.c | 33 ++++++++++++++++++++++++++++-----
1 files changed, 28 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r 320abeb364e6 -r bb3dc21c89ef src/mail/ngx_mail_proxy_module.c
--- a/src/mail/ngx_mail_proxy_module.c Fri Jan 17 06:24:53 2014 +0400
+++ b/src/mail/ngx_mail_proxy_module.c Fri Jan 17 22:06:04 2014 +0400
@@ -542,17 +542,40 @@ ngx_mail_proxy_smtp_handler(ngx_event_t
CRLF) - 1
+ s->connection->addr_text.len + s->login.len + s->host.len;

+#if (NGX_HAVE_INET6)
+ if (s->connection->sockaddr->sa_family == AF_INET6) {
+ line.len += sizeof("IPV6:") - 1;
+ }
+#endif
+
line.data = ngx_pnalloc(c->pool, line.len);
if (line.data == NULL) {
ngx_mail_proxy_internal_server_error(s);
return;
}

- line.len = ngx_sprintf(line.data,
- "XCLIENT ADDR=%V%s%V NAME=%V" CRLF,
- &s->connection->addr_text,
- (s->login.len ? " LOGIN=" : ""), &s->login, &s->host)
- - line.data;
+ p = ngx_cpymem(line.data, "XCLIENT ADDR=", sizeof("XCLIENT ADDR=") - 1);
+
+#if (NGX_HAVE_INET6)
+ if (s->connection->sockaddr->sa_family == AF_INET6) {
+ p = ngx_cpymem(p, "IPV6:", sizeof("IPV6:") - 1);
+ }
+#endif
+
+ p = ngx_copy(p, s->connection->addr_text.data,
+ s->connection->addr_text.len);
+
+ if (s->login.len) {
+ p = ngx_cpymem(p, " LOGIN=", sizeof(" LOGIN=") - 1);
+ p = ngx_copy(p, s->login.data, s->login.len);
+ }
+
+ p = ngx_cpymem(p, " NAME=", sizeof(" NAME=") - 1);
+ p = ngx_copy(p, s->host.data, s->host.len);
+
+ *p++ = CR; *p++ = LF;
+
+ line.len = p - line.data;

if (s->smtp_helo.len) {
s->mail_state = ngx_smtp_xclient_helo;

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

[nginx] Mail: fixed passing of IPv6 client address in XCLIENT.

Ruslan Ermilov 801 January 17, 2014 01:12PM



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

Online Users

Guests: 149
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