]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Allow xlat calls without instance data
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 25 Aug 2021 16:47:05 +0000 (11:47 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 25 Aug 2021 17:19:01 +0000 (12:19 -0500)
src/lib/unlang/xlat_eval.c
src/lib/unlang/xlat_inst.c

index dbbf1919282974012c66b47eae2e791af9efbcec..10eac2e42739c2573fbf96d841c19aaf4a4d997a 100644 (file)
@@ -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);
index afa3c3d66b30c750a638474a9ad4f0b3fa55139a..192bb5f69d7d31391e09ecfb7cf4a61452244f4f 100644 (file)
@@ -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