]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Push the process function directly
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 19 Mar 2021 15:16:47 +0000 (15:16 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 Mar 2021 15:04:27 +0000 (16:04 +0100)
src/lib/io/worker.c
src/lib/server/virtual_servers.c
src/lib/server/virtual_servers.h

index 281012cf5e89d8c2637e3f54500f24b3927d2b1b..39e134b728526dfa1cd3d3d81900e0f5ea2e3bac 100644 (file)
@@ -759,8 +759,7 @@ nak:
        /*
         *      Set the entry point for this virtual server.
         */
-       virtual_server_entry_point_set(request);
-       if (!request->async->process) {
+       if (virtual_server_entry_point_set(request) < 0) {
                RERROR("Protocol failed to set 'process' function");
                worker_nak(worker, cd, now);
                return;
index 39420eff1139f1a0f204a8ee9721c92294c1c868..21f70467819f4cc30a041cbc3cc303322a1d540a 100644 (file)
@@ -492,17 +492,11 @@ static int server_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent,
        return 0;
 }
 
-static unlang_action_t null_method(UNUSED rlm_rcode_t *p_result, UNUSED module_ctx_t const *mctx, UNUSED request_t *request)
-{
-       RETURN_MODULE_OK;
-}
-
-
 /** Set the request processing function.
  *
  *     Short-term hack
  */
-void virtual_server_entry_point_set(request_t *request)
+int virtual_server_entry_point_set(request_t *request)
 {
        fr_virtual_server_t *server;
        fr_process_module_t const *process;
@@ -510,20 +504,16 @@ void virtual_server_entry_point_set(request_t *request)
        module_instance_t *mi = talloc_zero(request, module_instance_t);
 
        server = cf_data_value(cf_data_find(request->server_cs, fr_virtual_server_t, "vs"));
-       if (!server) return;
+       if (!server) return -1;
 
        mi->name = server->process_module->name;
 
        if (unlikely(track && track->dynamic && server->dynamic_client_module)) {
                process = (fr_process_module_t const *) server->dynamic_client_module->module->common;
-               request->async->process = process->process;
-               request->async->process_inst = server->dynamic_client_module->data;
                mi->dl_inst = server->dynamic_client_module;
 
        } else {
                process = (fr_process_module_t const *) server->process_module->module->common;
-               request->async->process = process->process;
-               request->async->process_inst = server->process_module->data;
                mi->dl_inst = server->process_module;
        }
 
@@ -538,9 +528,9 @@ void virtual_server_entry_point_set(request_t *request)
         *      src/lib/server/module.c, that reserves 0 for "nothing
         *      is initialized".
         */
-       if (unlang_module_push(&request->rcode, request, mi, null_method, true) < 0) {
-               fr_assert(0);
-       }
+       if (unlang_module_push(&request->rcode, request, mi, process->process, true) < 0) return -1;
+
+       return 0;
 }
 
 /** Allow dynamic clients in this virtual server.
index c68cc67fff664d3f57a84d1b24d8f8a16aa673b5..017bbe68516697f6c983100c97956c13ae7c7cee 100644 (file)
@@ -135,7 +135,7 @@ virtual_server_method_t const *virtual_server_section_methods(char const *name1,
 
 int            virtual_server_get_process_by_name(CONF_SECTION *server, char const *type, module_method_t *method_p, void **ctx);
 
-void           virtual_server_entry_point_set(request_t *request);
+int            virtual_server_entry_point_set(request_t *request);
 
 int            virtual_server_dynamic_clients_allow(CONF_SECTION *server_cs);