From: Alan T. DeKok Date: Mon, 13 Jul 2026 22:24:08 +0000 (-0400) Subject: loop over virtual modules, compiling them X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f96cc5fcff1176d2cbcf1f2c850d9a7256dc1cd3;p=thirdparty%2Ffreeradius-server.git loop over virtual modules, compiling them --- diff --git a/src/lib/server/module_rlm.c b/src/lib/server/module_rlm.c index 6ef71da90f1..c61c940cae4 100644 --- a/src/lib/server/module_rlm.c +++ b/src/lib/server/module_rlm.c @@ -751,6 +751,8 @@ fr_slen_t module_rlm_by_name_and_method(TALLOC_CTX *ctx, module_method_call_t *m } by_section: + if (!vs) goto section_error; + /* * First look for the section name in the module's * bindings. If that fails, look for the alt @@ -774,6 +776,7 @@ by_section: if (mmc_out) section_name_dup(ctx, &mmc->asked, section); } if (!mmb) { + section_error: fr_strerror_printf("Module \"%s\" has no method for section %s %s { ... }, i.e. %s%s%s", mmc->mi->name, section->name1, diff --git a/src/lib/server/virtual_servers.c b/src/lib/server/virtual_servers.c index 5d393fd2bae..d14888714e3 100644 --- a/src/lib/server/virtual_servers.c +++ b/src/lib/server/virtual_servers.c @@ -1945,6 +1945,8 @@ int virtual_servers_thread_instantiate(TALLOC_CTX *ctx, fr_event_list_t *el) int virtual_servers_instantiate(void) { size_t i, server_cnt; + CONF_SECTION *cs; + fr_rb_iter_inorder_t iter; /* * User didn't specify any "server" sections @@ -2021,6 +2023,20 @@ int virtual_servers_instantiate(void) (void) virtual_server_warn_unused(server_cs, process->compile_list); } + /* + * Iterate over virtual modules to see if we can compile them. + */ + for (cs = module_rlm_virtual_iter_init(&iter); + cs != NULL; + cs = module_rlm_virtual_iter_next(&iter)) { + fr_dict_t const *dict; + + dict = virtual_server_dict_by_cs(cs); /* cheating! */ + if (!dict) continue; + + if (unlang_compile_virtual_module(cs, dict) < 0) return -1; + } + if (modules_instantiate(process_modules) < 0) { PERROR("Failed instantiating process modules"); return -1;