diff src/mail/ngx_mail_handler.c @ 468:2580fe1c5a9a PATCH_NGINX_MAIL_0_6

Mail: support for smtp auth login with username. According to "[MS-XLOGIN]: SMTP Protocol AUTH LOGIN Extension Specification" (http://msdn.microsoft.com/en-us/library/cc433484.aspx) there is special mode called "AUTH LOGIN with User Name". And it seems to be used by some Microsoft software seen in wild.
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 11 Jan 2009 23:19:26 +0300
parents d67e93e97b4a
children abbf48179d76
line wrap: on
line diff
--- a/src/mail/ngx_mail_handler.c
+++ b/src/mail/ngx_mail_handler.c
@@ -356,12 +356,18 @@ ngx_mail_auth_plain(ngx_mail_session_t *
 
 
 ngx_int_t
-ngx_mail_auth_login_username(ngx_mail_session_t *s, ngx_connection_t *c)
+ngx_mail_auth_login_username(ngx_mail_session_t *s, ngx_connection_t *c,
+    ngx_int_t initial)
 {
     ngx_str_t  *arg;
 
     arg = s->args.elts;
 
+    if (initial) {
+        /* username in initial response */
+        arg += (s->protocol == NGX_MAIL_SMTP_PROTOCOL) ? 2 : 1;
+    }
+
     ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
                    "mail auth login username: \"%V\"", &arg[0]);