]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Handle un-used rlm_cache instances using htrie driver
authorNick Porter <nick@portercomputing.co.uk>
Tue, 25 Mar 2025 09:22:29 +0000 (09:22 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 25 Mar 2025 11:08:53 +0000 (11:08 +0000)
When a module instance using the htrie driver is not used in policy, and
has it's type set to `auto`, it will still have htype FR_HTRIE_AUTO when
the module is instantiated.

In this case, exit driver instantiation early.

src/modules/rlm_cache/drivers/rlm_cache_htrie/rlm_cache_htrie.c

index ace9d9b8cd29e840a2dd14a62064f2a306378e34..ef69d050f4db6debf793b1c685da410e68dfee88 100644 (file)
@@ -432,6 +432,12 @@ static int mod_instantiate(module_inst_ctx_t const *mctx)
        rlm_cache_htrie_mutable_t       *mutable;
        int ret;
 
+       /*
+        *      An instance with htype of FR_HTRIE_AUTO has not been used
+        *      in any policy - so instantiation can be short circuited.
+        */
+       if (driver->htype == FR_HTRIE_AUTO) return 0;
+
        MEM(mutable = talloc_zero(NULL, rlm_cache_htrie_mutable_t));
 
        /*