Fixed segfault on ssl servers without cert with SNI (ticket #54).

Non-default servers may not have ssl context created if there are no
certificate defined.  Make sure to check if ssl context present before
using it.
This commit is contained in:
Maxim Dounin 2011-11-22 16:27:45 +00:00
parent 7cd93c6926
commit 0560ae55bc

View File

@ -671,6 +671,7 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
if (sscf->ssl.ctx) {
SSL_set_SSL_CTX(ssl_conn, sscf->ssl.ctx); SSL_set_SSL_CTX(ssl_conn, sscf->ssl.ctx);
/* /*
@ -690,6 +691,7 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
#endif #endif
SSL_set_options(ssl_conn, SSL_CTX_get_options(sscf->ssl.ctx)); SSL_set_options(ssl_conn, SSL_CTX_get_options(sscf->ssl.ctx));
}
return SSL_TLSEXT_ERR_OK; return SSL_TLSEXT_ERR_OK;
} }