From: Arran Cudbard-Bell Date: Wed, 25 Aug 2021 16:47:05 +0000 (-0500) Subject: Allow xlat calls without instance data X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20496a9da27a38e45835b3bf5e9506515d81a619;p=thirdparty%2Ffreeradius-server.git Allow xlat calls without instance data --- diff --git a/src/lib/unlang/xlat_eval.c b/src/lib/unlang/xlat_eval.c index dbbf1919282..10eac2e4273 100644 --- a/src/lib/unlang/xlat_eval.c +++ b/src/lib/unlang/xlat_eval.c @@ -1107,7 +1107,8 @@ xlat_action_t xlat_frame_eval_repeat(TALLOC_CTX *ctx, fr_dcursor_t *out, VALUE_BOX_TALLOC_LIST_VERIFY(result); xa = node->call.func->func.async(ctx, out, request, - node->call.inst->data, thread_inst->data, result); + node->call.inst ? node->call.inst->data : NULL, + thread_inst ? thread_inst->data : NULL, result); VALUE_BOX_TALLOC_LIST_VERIFY(result); if (RDEBUG_ENABLED2) xlat_debug_log_expansion(request, *in, &result_copy); diff --git a/src/lib/unlang/xlat_inst.c b/src/lib/unlang/xlat_inst.c index afa3c3d66b3..192bb5f69d7 100644 --- a/src/lib/unlang/xlat_inst.c +++ b/src/lib/unlang/xlat_inst.c @@ -312,21 +312,16 @@ static int _xlat_thread_instantiate(void *data, void *uctx) * @param[in] node to find thread specific data for. * @return * - Thread specific data on success. - * - NULL if the xlat has no thread instance data (should not happen). + * - NULL if the xlat has no thread instance data. */ xlat_thread_inst_t *xlat_thread_instance_find(xlat_exp_t const *node) { - xlat_thread_inst_t *found; - fr_assert(xlat_thread_inst_tree); fr_assert(node->type == XLAT_FUNC); if (node->call.ephemeral) return node->call.thread_inst; - found = fr_rb_find(xlat_thread_inst_tree, &(xlat_thread_inst_t){ .node = node }); - fr_assert(found); - - return found; + return fr_rb_find(xlat_thread_inst_tree, &(xlat_thread_inst_t){ .node = node }); } /** Create thread specific instance tree and create thread instances