Mercurial > hg > nginx
comparison src/mail/ngx_mail_pop3_handler.c @ 9287:32d4582c484d
Mail: fixed EXTERNAL to be accepted only if enabled.
As originally implemented in 6774:bcb107bb89cd, it wasn't possible to
disable the EXTERNAL authentication method: it was always accepted
(but not advertised unless enabled). It is, however, believed that
it is better to reject attempts to use the disabled method, hence in
6869:b2915d99ee8d an attempt was made to address this. This attempt
was insufficient though: it was still possible to use the method as long
as initial SASL response was used.
With this patch both challenge-response and initial response forms are
disabled. Additionally, initial response handling for the PLAIN
authentication is removed from ngx_mail_auth_parse(), for consistency
and to don't provoke such bugs.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 03 Jun 2024 18:03:05 +0300 |
parents | d7fd0acdea64 |
children | 4538c1ffb0f8 |
comparison
equal
deleted
inserted
replaced
9286:d9fe808c1841 | 9287:32d4582c484d |
---|---|
515 | 515 |
516 return ngx_mail_auth_login_username(s, c, 1); | 516 return ngx_mail_auth_login_username(s, c, 1); |
517 | 517 |
518 case NGX_MAIL_AUTH_PLAIN: | 518 case NGX_MAIL_AUTH_PLAIN: |
519 | 519 |
520 if (s->args.nelts == 2) { | |
521 return ngx_mail_auth_plain(s, c, 1); | |
522 } | |
523 | |
520 ngx_str_set(&s->out, pop3_next); | 524 ngx_str_set(&s->out, pop3_next); |
521 s->mail_state = ngx_pop3_auth_plain; | 525 s->mail_state = ngx_pop3_auth_plain; |
522 | 526 |
523 return NGX_OK; | 527 return NGX_OK; |
524 | 528 |
539 | 543 |
540 if (!(pscf->auth_methods & NGX_MAIL_AUTH_EXTERNAL_ENABLED)) { | 544 if (!(pscf->auth_methods & NGX_MAIL_AUTH_EXTERNAL_ENABLED)) { |
541 return NGX_MAIL_PARSE_INVALID_COMMAND; | 545 return NGX_MAIL_PARSE_INVALID_COMMAND; |
542 } | 546 } |
543 | 547 |
548 if (s->args.nelts == 2) { | |
549 return ngx_mail_auth_external(s, c, 1); | |
550 } | |
551 | |
544 ngx_str_set(&s->out, pop3_username); | 552 ngx_str_set(&s->out, pop3_username); |
545 s->mail_state = ngx_pop3_auth_external; | 553 s->mail_state = ngx_pop3_auth_external; |
546 | 554 |
547 return NGX_OK; | 555 return NGX_OK; |
548 } | 556 } |