]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/resolve: kr_context: add trust whitelist certificate credentials]
authorFrantisek Tobias <frantisek.tobias@nic.cz>
Fri, 21 Mar 2025 09:39:32 +0000 (10:39 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 7 Jul 2025 14:22:05 +0000 (16:22 +0200)
lib/resolve.c
lib/resolve.h

index feee74a6f3eddadb9f9b81abfd6094dfff637d86..c21f8c1a040c42e2cb6995f814022a88a0c14c96 100644 (file)
@@ -595,21 +595,6 @@ cleanup:
        return rv;
 }
 
-int kr_init_whitelist(const char *whitelistpath)
-{
-       the_resolver->issuers = calloc(sizeof(struct issuer_whitelist), 1);
-       if (!the_resolver->issuers)
-               return ENOMEM;
-
-       int ret = get_auth_name_array(the_resolver->issuers, whitelistpath);
-       if (ret != kr_ok()) {
-               whitelist_free(the_resolver->issuers);
-               the_resolver->issuers = NULL;
-       }
-
-       return ret;
-}
-
 int kr_resolver_init(module_array_t *modules, knot_mm_t *pool)
 {
        the_resolver = &the_resolver_value;
@@ -637,6 +622,7 @@ int kr_resolver_init(module_array_t *modules, knot_mm_t *pool)
        /* Empty init; filled via ./lua/postconfig.lua */
        kr_zonecut_init(&the_resolver->root_hints, (const uint8_t *)"", pool);
        lru_create(&the_resolver->cache_cookie, LRU_COOKIES_SIZE, NULL, NULL);
+       the_resolver->trust_whitelist = NULL;
 
        return kr_ok();
 }
@@ -653,7 +639,7 @@ void kr_resolver_deinit(void)
        trie_free(the_resolver->trust_anchors);
        kr_ta_clear(the_resolver->negative_anchors);
        trie_free(the_resolver->negative_anchors);
-       whitelist_free(the_resolver->issuers);
+       gnutls_certificate_free_credentials(the_resolver->trust_whitelist);
 
        the_resolver = NULL;
 }
index a5123bc563ddab8ca567141e62e13339874a63c8..ff65184ddeab974193633acbba8af7549030f9e1 100644 (file)
@@ -182,7 +182,7 @@ struct kr_context
        kr_cookie_lru_t *cache_cookie;
        int32_t tls_padding; /**< See net.tls_padding in ../daemon/README.rst -- -1 is "true" (default policy), 0 is "false" (no padding) */
        knot_mm_t *pool;
-       struct issuer_whitelist *issuers;
+       gnutls_certificate_credentials_t trust_whitelist;
 };
 
 /** Pointer to the singleton resolver context. NULL if not initialized */