Fix issue #676: Unencrypted query is sent when forward-tls-upstream: yes is

used without tls-cert-bundle

Model the behavior of unbound in unbound-host: always create a SSL context
This commit is contained in:
Philip Homburg 2023-03-24 14:51:37 +01:00
parent eb7eff4fc7
commit 7e6a7f310d

View File

@ -168,14 +168,12 @@ libworker_setup(struct ub_ctx* ctx, int is_bg, struct ub_event_base* eb)
hints_delete(w->env->hints); hints_delete(w->env->hints);
w->env->hints = NULL; w->env->hints = NULL;
} }
if(cfg->ssl_upstream || (cfg->tls_cert_bundle && cfg->tls_cert_bundle[0]) || cfg->tls_win_cert) { w->sslctx = connect_sslctx_create(NULL, NULL,
w->sslctx = connect_sslctx_create(NULL, NULL, cfg->tls_cert_bundle, cfg->tls_win_cert);
cfg->tls_cert_bundle, cfg->tls_win_cert); if(!w->sslctx) {
if(!w->sslctx) { /* to make the setup fail after unlock */
/* to make the setup fail after unlock */ hints_delete(w->env->hints);
hints_delete(w->env->hints); w->env->hints = NULL;
w->env->hints = NULL;
}
} }
if(!w->is_bg || w->is_bg_thread) { if(!w->is_bg || w->is_bg_thread) {
lock_basic_unlock(&ctx->cfglock); lock_basic_unlock(&ctx->cfglock);