comparison 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
comparison
equal deleted inserted replaced
6868:ee3645078759 6869:b2915d99ee8d
354 if (ngx_mail_starttls_only(s, c)) { 354 if (ngx_mail_starttls_only(s, c)) {
355 return NGX_MAIL_PARSE_INVALID_COMMAND; 355 return NGX_MAIL_PARSE_INVALID_COMMAND;
356 } 356 }
357 #endif 357 #endif
358 358
359 iscf = ngx_mail_get_module_srv_conf(s, ngx_mail_imap_module);
360
359 rc = ngx_mail_auth_parse(s, c); 361 rc = ngx_mail_auth_parse(s, c);
360 362
361 switch (rc) { 363 switch (rc) {
362 364
363 case NGX_MAIL_AUTH_LOGIN: 365 case NGX_MAIL_AUTH_LOGIN:
380 s->mail_state = ngx_imap_auth_plain; 382 s->mail_state = ngx_imap_auth_plain;
381 383
382 return NGX_OK; 384 return NGX_OK;
383 385
384 case NGX_MAIL_AUTH_CRAM_MD5: 386 case NGX_MAIL_AUTH_CRAM_MD5:
385
386 iscf = ngx_mail_get_module_srv_conf(s, ngx_mail_imap_module);
387 387
388 if (!(iscf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED)) { 388 if (!(iscf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED)) {
389 return NGX_MAIL_PARSE_INVALID_COMMAND; 389 return NGX_MAIL_PARSE_INVALID_COMMAND;
390 } 390 }
391 391
403 } 403 }
404 404
405 return NGX_ERROR; 405 return NGX_ERROR;
406 406
407 case NGX_MAIL_AUTH_EXTERNAL: 407 case NGX_MAIL_AUTH_EXTERNAL:
408
409 if (!(iscf->auth_methods & NGX_MAIL_AUTH_EXTERNAL_ENABLED)) {
410 return NGX_MAIL_PARSE_INVALID_COMMAND;
411 }
408 412
409 ngx_str_set(&s->out, imap_username); 413 ngx_str_set(&s->out, imap_username);
410 s->mail_state = ngx_imap_auth_external; 414 s->mail_state = ngx_imap_auth_external;
411 415
412 return NGX_OK; 416 return NGX_OK;