changeset 481:abbf48179d76

Mail: minor changes to auth login with username support.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 09 Feb 2009 00:53:34 +0300
parents a28a95b7a86d
children c78a94ba4ae1
files src/mail/ngx_mail.h src/mail/ngx_mail_handler.c src/mail/ngx_mail_smtp_handler.c
diffstat 3 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/mail/ngx_mail.h
+++ b/src/mail/ngx_mail.h
@@ -347,7 +347,7 @@ ngx_int_t ngx_mail_salt(ngx_mail_session
 ngx_int_t ngx_mail_auth_plain(ngx_mail_session_t *s, ngx_connection_t *c,
     ngx_uint_t n);
 ngx_int_t ngx_mail_auth_login_username(ngx_mail_session_t *s,
-    ngx_connection_t *c, ngx_int_t initial);
+    ngx_connection_t *c, ngx_uint_t n);
 ngx_int_t ngx_mail_auth_login_password(ngx_mail_session_t *s,
     ngx_connection_t *c);
 ngx_int_t ngx_mail_auth_cram_md5_salt(ngx_mail_session_t *s,
--- a/src/mail/ngx_mail_handler.c
+++ b/src/mail/ngx_mail_handler.c
@@ -357,16 +357,12 @@ 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_int_t initial)
+    ngx_uint_t n)
 {
     ngx_str_t  *arg;
 
     arg = s->args.elts;
-
-    if (initial) {
-        /* username in initial response */
-        arg += (s->protocol == NGX_MAIL_SMTP_PROTOCOL) ? 2 : 1;
-    }
+    arg += n;
 
     ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
                    "mail auth login username: \"%V\"", &arg[0]);
--- a/src/mail/ngx_mail_smtp_handler.c
+++ b/src/mail/ngx_mail_smtp_handler.c
@@ -625,7 +625,7 @@ ngx_mail_smtp_auth(ngx_mail_session_t *s
         s->out.data = smtp_password;
         s->mail_state = ngx_smtp_auth_login_password;
 
-        return ngx_mail_auth_login_username(s, c, 1);
+        return ngx_mail_auth_login_username(s, c, 2);
 
     case NGX_MAIL_AUTH_PLAIN: