diff src/mail/ngx_mail_imap_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 dac47e9ef0d5
children 5938746e70c2 8246d8a2c2be
line wrap: on
line diff
--- a/src/mail/ngx_mail_imap_handler.c
+++ b/src/mail/ngx_mail_imap_handler.c
@@ -205,7 +205,7 @@ ngx_mail_imap_auth_state(ngx_event_t *re
             break;
 
         case ngx_imap_auth_login_username:
-            rc = ngx_mail_auth_login_username(s, c);
+            rc = ngx_mail_auth_login_username(s, c, 0);
 
             tag = 0;
             s->out.len = sizeof(imap_password) - 1;
@@ -370,6 +370,14 @@ ngx_mail_imap_authenticate(ngx_mail_sess
 
         return NGX_OK;
 
+    case NGX_MAIL_AUTH_LOGIN_USERNAME:
+
+        s->out.len = sizeof(imap_password) - 1;
+        s->out.data = imap_password;
+        s->mail_state = ngx_imap_auth_login_password;
+
+        return ngx_mail_auth_login_username(s, c, 1);
+
     case NGX_MAIL_AUTH_PLAIN:
 
         s->out.len = sizeof(imap_plain_next) - 1;