]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix to disallow cache lookup/store in external cachedb when a
authorYorgos Thessalonikefs <yorgos@nlnetlabs.nl>
Mon, 23 Feb 2026 13:35:50 +0000 (14:35 +0100)
committerYorgos Thessalonikefs <yorgos@nlnetlabs.nl>
Mon, 23 Feb 2026 13:35:50 +0000 (14:35 +0100)
  forwarder/stub forbids it with the no-cache option.

cachedb/cachedb.c
doc/Changelog
iterator/iter_utils.c

index 226669fcd481d61b1fce75c87ba67f1ef3912a4f..fd9f04e3d6564665d94c747039cebd2f54f1354f 100644 (file)
@@ -805,8 +805,11 @@ cachedb_handle_query(struct module_qstate* qstate,
                return;
        }
 
-       if(qstate->blacklist || qstate->no_cache_lookup) {
-               /* cache is blacklisted or we are instructed from edns to not look */
+       if(qstate->blacklist || qstate->no_cache_lookup
+               || iter_stub_fwd_no_cache(qstate, &qstate->qinfo, NULL, NULL,
+               NULL, 0)) {
+               /* cache is blacklisted or we are instructed from edns to not
+                * look or a forwarder/stub forbids it */
                /* pass request to next module */
                qstate->ext_state[id] = module_wait_module;
                return;
@@ -894,7 +897,9 @@ cachedb_handle_response(struct module_qstate* qstate,
 {
        qstate->is_cachedb_answer = 0;
        /* check if we are not enabled or instructed to not cache, and skip */
-       if(!ie->enabled || qstate->no_cache_store) {
+       if(!ie->enabled || qstate->no_cache_store
+               || iter_stub_fwd_no_cache(qstate, &qstate->qinfo, NULL, NULL,
+               NULL, 0)) {
                /* we are done with the query */
                qstate->ext_state[id] = module_finished;
                return;
index 35171741746c1c9a0f992b71765be824b0646bca..dc7968c0616293c41c9d381809d34bf503707f64 100644 (file)
@@ -2,6 +2,10 @@
        - Fix to have cachedb not return expired bogus data as non-bogus.
        - Fix to make the cachedb_val_expired.crpl succeed.
 
+23 February 2026: Yorgos
+       - Fix to disallow cache lookup/store in external cachedb when a
+         forwarder/stub forbids it with the no-cache option.
+
 17 February 2026: Wouter
        - Fix to remove unused conditional from cookie timestamp at
          worker env.
index feb5b702b243354ba34693af4768ea48250e82ed..cc09fa52461e9fc56efb6f12845375fb6e02c0d9 100644 (file)
@@ -1548,6 +1548,11 @@ iter_stub_fwd_no_cache(struct module_qstate *qstate, struct query_info *qinf,
        struct delegpt *dp;
        int nolock = 1;
 
+       log_assert((retdpname && retdpnamelen
+               && dpname_storage && dpname_storage_len > 0) ||
+               (retdpname == NULL && retdpnamelen == NULL
+                && dpname_storage == NULL && dpname_storage_len == 0));
+
        /* Check for stub. */
        /* Lock both forwards and hints for atomic read. */
        lock_rw_rdlock(&qstate->env->fwds->lock);