]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Have unlang_call_push return an unlang_action_t
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 7 Jun 2021 00:39:22 +0000 (19:39 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 10 Jun 2021 22:58:23 +0000 (17:58 -0500)
src/lib/unlang/call.c
src/lib/unlang/call.h

index 4a59ed4ee9f333ea5dd9bec3cc3e9b50aee46717..f480ffab07f7c934df42eddd164b44e6a8a7c649 100644 (file)
@@ -88,7 +88,7 @@ static unlang_action_t unlang_call_frame_init(rlm_rcode_t *p_result, request_t *
  *
  * This should be used instead of virtual_server_push in the majority of the code
  */
-int unlang_call_push(request_t *request, CONF_SECTION *server_cs, bool top_frame)
+unlang_action_t unlang_call_push(request_t *request, CONF_SECTION *server_cs, bool top_frame)
 {
        unlang_stack_t                  *stack = request->stack;
        unlang_call_t                   *c;
@@ -101,14 +101,14 @@ int unlang_call_push(request_t *request, CONF_SECTION *server_cs, bool top_frame
         */
        dict = virtual_server_dict(server_cs);
        if (!dict) {
-               REDEBUG("No dictionary associated with virtual server");
-               return -1;
+               REDEBUG("Virtual server \"%s\" not compiled", cf_section_name2(server_cs));
+               return UNLANG_ACTION_FAIL;
        }
 
        attr_packet_type = fr_dict_attr_by_name(NULL, fr_dict_root(dict), "Packet-Type");
        if (!attr_packet_type) {
                REDEBUG("No Packet-Type attribute available");
-               return -1;
+               return UNLANG_ACTION_FAIL;
        }
 
        /*
@@ -147,10 +147,10 @@ int unlang_call_push(request_t *request, CONF_SECTION *server_cs, bool top_frame
        if (unlang_interpret_push(request, unlang_call_to_generic(c),
                                  RLM_MODULE_NOT_SET, UNLANG_NEXT_STOP, top_frame) < 0) {
                talloc_free(c);
-               return -1;
+               return UNLANG_ACTION_FAIL;
        }
 
-       return 0;
+       return UNLANG_ACTION_PUSHED_CHILD;
 }
 
 /** Return the last virtual server that was called
index f83b6542fe82cbaffed3c7d122c20b8775b211c8..2dd697b8d2d85fb8f2c2af4d4233a6b5bf08282b 100644 (file)
@@ -29,7 +29,7 @@ extern "C" {
 #include <freeradius-devel/server/request.h>
 #include <freeradius-devel/server/cf_util.h>
 
-int unlang_call_push(request_t *request, CONF_SECTION *server_cs, bool top_frame);
+unlang_action_t unlang_call_push(request_t *request, CONF_SECTION *server_cs, bool top_frame) CC_HINT(nonnull);
 
 CONF_SECTION *unlang_call_current(request_t *request);