From c3a8387afdc4d962ede1bad90d4d458774174579 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 6 May 2020 15:20:22 +0100 Subject: [PATCH] ss: support no tls in policy If there's no trust store in use, create a default vhost so everything can continue normally --- lib/secure-streams/policy-common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/secure-streams/policy-common.c b/lib/secure-streams/policy-common.c index 24fe833b8..fc8883a35 100644 --- a/lib/secure-streams/policy-common.c +++ b/lib/secure-streams/policy-common.c @@ -189,6 +189,16 @@ lws_ss_policy_set(struct lws_context *context, const char *name) if (!pol->trust_store) { pol = pol->next; + if (!pol && !context->vhost_list) { + /* corner case... there's no trust store used */ + i.options = context->options; + i.vhost_name = "_ss_default"; + i.port = CONTEXT_PORT_NO_LISTEN; + v = lws_create_vhost(context, &i); + if (!v) + lwsl_err("%s: failed to create vhost %s\n", + __func__, i.vhost_name); + } continue; } v = lws_get_vhost_by_name(context, pol->trust_store->name);