# HG changeset patch # User Maxim Dounin # Date 1234130014 -10800 # Node ID abbf48179d763bcb93c9cd7c913da9ac36318577 # Parent a28a95b7a86d3dcd5c44e2dde8b4ab4231066faf Mail: minor changes to auth login with username support. diff --git a/src/mail/ngx_mail.h b/src/mail/ngx_mail.h --- 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, diff --git a/src/mail/ngx_mail_handler.c b/src/mail/ngx_mail_handler.c --- 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]); diff --git a/src/mail/ngx_mail_smtp_handler.c b/src/mail/ngx_mail_smtp_handler.c --- 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: