]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
respect casts for results of exec, too
authorAlan T. DeKok <aland@freeradius.org>
Wed, 29 Jun 2022 14:02:50 +0000 (10:02 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 30 Jun 2022 11:24:32 +0000 (07:24 -0400)
src/lib/unlang/tmpl.c
src/lib/unlang/xlat_eval.c

index 223efa86aaebf7867ba1b0ab45100a26f854eefb..cb40e196875f48ae67ae16355bdbd13a61e374a9 100644 (file)
@@ -77,6 +77,13 @@ static void unlang_tmpl_signal(request_t *request, unlang_stack_frame_t *frame,
 static unlang_action_t unlang_tmpl_resume(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
 {
        unlang_frame_state_tmpl_t       *state = talloc_get_type_abort(frame->state, unlang_frame_state_tmpl_t);
+       unlang_tmpl_t                   *ut = unlang_generic_to_tmpl(frame->instruction);
+
+       if (tmpl_eval_cast(request, &state->list, ut->tmpl) < 0) {
+               RPEDEBUG("Failed casting expansion");
+               *p_result = RLM_MODULE_FAIL;
+               return UNLANG_ACTION_CALCULATE_RESULT;
+       }
 
        if (state->out) fr_dlist_move(state->out, &state->list);
 
index 41a3ef77bfba4862323ad1f259c4ed92a61badc6..83bf6d2bdf0eaff3f6c89d6a714d58732c37f275 100644 (file)
@@ -920,6 +920,11 @@ xlat_action_t xlat_frame_eval_repeat(TALLOC_CTX *ctx, fr_dcursor_t *out,
        case XLAT_TMPL:
                fr_assert(tmpl_is_exec(node->vpt));
 
+               if (tmpl_eval_cast(ctx, result, node->vpt) < 0) {
+                       fr_dlist_talloc_free(result);
+                       return XLAT_ACTION_FAIL;
+               }
+
                /*
                 *      First entry is the command to run.  Subsequent entries are the options to pass to the
                 *      command.