From f783df56d8c71eec94756164fd8e23cec2e8448a Mon Sep 17 00:00:00 2001 From: u5surf Date: Sat, 22 Feb 2025 15:48:54 +0900 Subject: [PATCH] Mail: Add Client-Port in auth header. in order to send it to authentication script. --- src/mail/ngx_mail_auth_http_module.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c index 27f64b92e..27538dab1 100644 --- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -1244,6 +1244,7 @@ ngx_mail_auth_http_create_request(ngx_mail_session_t *s, ngx_pool_t *pool, + sizeof("Client-IP: ") - 1 + s->connection->addr_text.len + sizeof(CRLF) - 1 + sizeof("Client-Host: ") - 1 + s->host.len + sizeof(CRLF) - 1 + + sizeof("Client-Port: ") - 1 + sizeof("65535") - 1 + sizeof(CRLF) - 1 + ahcf->header.len + sizeof(CRLF) - 1; @@ -1342,6 +1343,9 @@ ngx_mail_auth_http_create_request(ngx_mail_session_t *s, ngx_pool_t *pool, s->connection->addr_text.len); *b->last++ = CR; *b->last++ = LF; + b->last = ngx_sprintf(b->last, "Client-Port: %ui" CRLF, + ngx_inet_get_port(c->sockaddr)); + if (s->host.len) { b->last = ngx_cpymem(b->last, "Client-Host: ", sizeof("Client-Host: ") - 1);