diff src/mail/ngx_mail_imap_handler.c @ 6869:b2915d99ee8d

Mail: make it possible to disable SASL EXTERNAL.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 12 Jan 2017 19:22:03 +0300
parents bcb107bb89cd
children ab6257dac2a8
line wrap: on
line diff
--- a/src/mail/ngx_mail_imap_handler.c
+++ b/src/mail/ngx_mail_imap_handler.c
@@ -356,6 +356,8 @@ ngx_mail_imap_authenticate(ngx_mail_sess
     }
 #endif
 
+    iscf = ngx_mail_get_module_srv_conf(s, ngx_mail_imap_module);
+
     rc = ngx_mail_auth_parse(s, c);
 
     switch (rc) {
@@ -383,8 +385,6 @@ ngx_mail_imap_authenticate(ngx_mail_sess
 
     case NGX_MAIL_AUTH_CRAM_MD5:
 
-        iscf = ngx_mail_get_module_srv_conf(s, ngx_mail_imap_module);
-
         if (!(iscf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED)) {
             return NGX_MAIL_PARSE_INVALID_COMMAND;
         }
@@ -406,6 +406,10 @@ ngx_mail_imap_authenticate(ngx_mail_sess
 
     case NGX_MAIL_AUTH_EXTERNAL:
 
+        if (!(iscf->auth_methods & NGX_MAIL_AUTH_EXTERNAL_ENABLED)) {
+            return NGX_MAIL_PARSE_INVALID_COMMAND;
+        }
+
         ngx_str_set(&s->out, imap_username);
         s->mail_state = ngx_imap_auth_external;