Mercurial > hg > nginx
diff src/mail/ngx_mail_imap_handler.c @ 6774:bcb107bb89cd
Mail: support SASL EXTERNAL (RFC 4422).
This is needed to allow TLS client certificate auth to work. With
ssl_verify_client configured, the auth daemon can choose to allow the
connection to proceed based on the certificate data.
This has been tested with Thunderbird for IMAP only. I've not yet found a
client that will do client certificate auth for POP3 or SMTP, and the method is
not really documented anywhere that I can find. That said, its simple enough
that the way I've done is probably right.
author | Rob N ★ <robn@fastmail.com> |
---|---|
date | Sat, 08 Oct 2016 18:05:00 +1100 |
parents | d620f497c50f |
children | b2915d99ee8d |
line wrap: on
line diff
--- a/src/mail/ngx_mail_imap_handler.c Tue Oct 18 19:38:46 2016 +0300 +++ b/src/mail/ngx_mail_imap_handler.c Sat Oct 08 18:05:00 2016 +1100 @@ -222,6 +222,10 @@ case ngx_imap_auth_cram_md5: rc = ngx_mail_auth_cram_md5(s, c); break; + + case ngx_imap_auth_external: + rc = ngx_mail_auth_external(s, c, 0); + break; } } else if (rc == NGX_IMAP_NEXT) { @@ -399,6 +403,13 @@ } return NGX_ERROR; + + case NGX_MAIL_AUTH_EXTERNAL: + + ngx_str_set(&s->out, imap_username); + s->mail_state = ngx_imap_auth_external; + + return NGX_OK; } return rc;