]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't allow unresolved functions at runtime
authorAlan T. DeKok <aland@freeradius.org>
Sun, 8 Oct 2023 00:47:59 +0000 (20:47 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 8 Oct 2023 00:47:59 +0000 (20:47 -0400)
because otherwise xlat_resolve() will call xlat_bootstrap_func(),
which modifies the xlat_inst_tree at runtime, from a child thread

src/lib/unlang/xlat_tokenize.c

index 8963bcefc940b27773e261a293dad3494821e54f..2376e2f2aea2d810526b0a35f95c09595b7516ef 100644 (file)
@@ -287,7 +287,7 @@ static inline int xlat_tokenize_function_mono(xlat_exp_head_t *head,
         */
        node = xlat_exp_alloc(head, XLAT_FUNC, fr_sbuff_current(&m_s), fr_sbuff_behind(&m_s));
        if (!func) {
-               if (!t_rules || !t_rules->attr.allow_unresolved) {
+               if (!t_rules || !t_rules->attr.allow_unresolved || t_rules->at_runtime) {
                        fr_strerror_const("Unresolved expansion functions are not allowed here");
                        goto bad_function;
                }
@@ -545,7 +545,7 @@ int xlat_tokenize_function_args(xlat_exp_head_t *head, fr_sbuff_t *in,
         */
        node = xlat_exp_alloc(head, XLAT_FUNC, fr_sbuff_current(&m_s), fr_sbuff_behind(&m_s));
        if (!func) {
-               if (!t_rules || !t_rules->attr.allow_unresolved) {
+               if (!t_rules || !t_rules->attr.allow_unresolved || t_rules->at_runtime) {
                        fr_strerror_const("Unresolved expansion functions are not allowed here");
                        goto bad_function;
                }
@@ -705,7 +705,7 @@ static int xlat_tokenize_function_new(xlat_exp_head_t *head, fr_sbuff_t *in, tmp
         */
        node = xlat_exp_alloc(head, XLAT_FUNC, fr_sbuff_current(&m_s), fr_sbuff_behind(&m_s));
        if (!func) {
-               if (!t_rules || !t_rules->attr.allow_unresolved) {
+               if (!t_rules || !t_rules->attr.allow_unresolved|| t_rules->at_runtime) {
                        fr_strerror_const("Unresolved expansion functions are not allowed here");
                        fr_sbuff_set(in, &m_s);         /* backtrack */
                        fr_sbuff_marker_release(&m_s);