ssl: fix segfault when using SSL_CTX that is not created

vhost->ssl_ctx is created in 'lws_tls_server_vhost_backend_init', but it
is used before in 'lws_tls_server_client_cert_verify_config' when
calling SSL_CTX_set_session_id_context...

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>
This commit is contained in:
Petar Paradzik 2017-10-25 15:27:06 +02:00 committed by Andy Green
parent 5a90bb36d1
commit 413631632b

View file

@ -73,8 +73,6 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
* as a server, if we are requiring clients to identify themselves
* then set the backend up for it
*/
lws_tls_server_client_cert_verify_config(info, vhost);
if (lws_check_opt(info->options,
LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT))
/* Normally SSL listener rejects non-ssl, optionally allow */
@ -88,6 +86,8 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
if (lws_tls_server_vhost_backend_init(info, vhost, &wsi))
return -1;
lws_tls_server_client_cert_verify_config(info, vhost);
vhost->protocols[0].callback(&wsi,
LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS,
vhost->ssl_ctx, NULL, 0);