From 71a681ae50175a569bf832d2615fd11994c41d73 Mon Sep 17 00:00:00 2001 From: Iwan Timmer Date: Mon, 17 Jun 2019 22:33:50 +0200 Subject: resolved: add missing error code check when initializing DNS-over-TLS --- src/resolve/resolved-dnstls-gnutls.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/resolve/resolved-dnstls-gnutls.c') diff --git a/src/resolve/resolved-dnstls-gnutls.c b/src/resolve/resolved-dnstls-gnutls.c index 7defd119a4..d824d6ca5a 100644 --- a/src/resolve/resolved-dnstls-gnutls.c +++ b/src/resolve/resolved-dnstls-gnutls.c @@ -194,14 +194,15 @@ void dnstls_server_free(DnsServer *server) { gnutls_free(server->dnstls_data.session_data.data); } -void dnstls_manager_init(Manager *manager) { +int dnstls_manager_init(Manager *manager) { int r; assert(manager); - gnutls_certificate_allocate_credentials(&manager->dnstls_data.cert_cred); - r = gnutls_certificate_set_x509_trust_file(manager->dnstls_data.cert_cred, manager->trusted_certificate_file, GNUTLS_X509_FMT_PEM); + r = gnutls_certificate_allocate_credentials(&manager->dnstls_data.cert_cred); if (r < 0) - log_error("Failed to load trusted certificate file %s: %s", manager->trusted_certificate_file, gnutls_strerror(r)); + return -ENOMEM; + + return 0; } void dnstls_manager_free(Manager *manager) { -- cgit v1.2.3