diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2018-04-24 15:29:01 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2018-04-24 15:29:01 +0300 |
commit | 76be1ea9de13c5e8bb0d9523c6a2ad4009a5d7cf (patch) | |
tree | efc4b871b998e7e04d5ab4a11a7df9e89a3e1dde /src/mail/ngx_mail_handler.c | |
parent | 5d3a854ebd4f59854ade798b94070ff1ee3eddcf (diff) | |
download | nginx-76be1ea9de13c5e8bb0d9523c6a2ad4009a5d7cf.tar.gz nginx-76be1ea9de13c5e8bb0d9523c6a2ad4009a5d7cf.zip |
SSL: detect "listen ... ssl" without certificates (ticket #178).
In mail and stream modules, no certificate provided is a fatal condition,
much like with the "ssl" and "starttls" directives.
In http, "listen ... ssl" can be used in a non-default server without
certificates as long as there is a certificate in the default one, so
missing certificate is only fatal for default servers.
Diffstat (limited to 'src/mail/ngx_mail_handler.c')
-rw-r--r-- | src/mail/ngx_mail_handler.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/mail/ngx_mail_handler.c b/src/mail/ngx_mail_handler.c index bc3e6b9e2..803a247d2 100644 --- a/src/mail/ngx_mail_handler.c +++ b/src/mail/ngx_mail_handler.c @@ -165,29 +165,13 @@ ngx_mail_init_connection(ngx_connection_t *c) sslcf = ngx_mail_get_module_srv_conf(s, ngx_mail_ssl_module); - if (sslcf->enable) { + if (sslcf->enable || addr_conf->ssl) { c->log->action = "SSL handshaking"; ngx_mail_ssl_init_connection(&sslcf->ssl, c); return; } - if (addr_conf->ssl) { - - c->log->action = "SSL handshaking"; - - if (sslcf->ssl.ctx == NULL) { - ngx_log_error(NGX_LOG_ERR, c->log, 0, - "no \"ssl_certificate\" is defined " - "in server listening on SSL port"); - ngx_mail_close_connection(c); - return; - } - - ngx_mail_ssl_init_connection(&sslcf->ssl, c); - return; - } - } #endif |