26 lines
764 B
Diff
26 lines
764 B
Diff
commit 79140c7033519cdbcc9d59f08425ddda0a79bff7
|
|
Author: dormando <dormando@rydia.net>
|
|
Date: Mon Mar 23 14:40:34 2020 -0700
|
|
|
|
tls: fix refresh_certs crash when disabled
|
|
|
|
segfaults server if refresh_certs command is run with TLS compiled in
|
|
but not enabled.
|
|
|
|
diff --git a/tls.c b/tls.c
|
|
index c440a7e..ae1cb4d 100644
|
|
--- a/tls.c
|
|
+++ b/tls.c
|
|
@@ -94,6 +94,11 @@ static bool load_server_certificates(char **errmsg) {
|
|
*errmsg = NULL;
|
|
return false;
|
|
}
|
|
+ if (settings.ssl_ctx == NULL) {
|
|
+ snprintf(error_msg, errmax, "Error TLS not enabled\r\n");
|
|
+ *errmsg = error_msg;
|
|
+ return false;
|
|
+ }
|
|
SSL_LOCK();
|
|
if (!SSL_CTX_use_certificate_chain_file(settings.ssl_ctx,
|
|
settings.ssl_chain_cert)) {
|