[nginx] Mail: logging upstream to the error log with "smtp_auth none; ".

noreply at nginx.com noreply at nginx.com
Fri Aug 22 17:02:19 UTC 2025


details:   https://github.com/nginx/nginx/commit/239e10793adb1e32847095ba6c1d14249bf19a5c
branches:  master
commit:    239e10793adb1e32847095ba6c1d14249bf19a5c
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Mon, 21 Jul 2025 17:44:28 +0400
description:
Mail: logging upstream to the error log with "smtp_auth none;".

Previously, it was never logged because of missing login.

---
 src/mail/ngx_mail_handler.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mail/ngx_mail_handler.c b/src/mail/ngx_mail_handler.c
index d3be7f3b3..a88e6c287 100644
--- a/src/mail/ngx_mail_handler.c
+++ b/src/mail/ngx_mail_handler.c
@@ -1006,14 +1006,12 @@ ngx_mail_log_error(ngx_log_t *log, u_char *buf, size_t len)
     len -= p - buf;
     buf = p;
 
-    if (s->login.len == 0) {
-        return p;
+    if (s->login.len) {
+        p = ngx_snprintf(buf, len, ", login: \"%V\"", &s->login);
+        len -= p - buf;
+        buf = p;
     }
 
-    p = ngx_snprintf(buf, len, ", login: \"%V\"", &s->login);
-    len -= p - buf;
-    buf = p;
-
     if (s->proxy == NULL) {
         return p;
     }


More information about the nginx-devel mailing list