]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove old foreach, along with XLAT_VIRTUAL
authorAlan T. DeKok <aland@freeradius.org>
Thu, 20 Mar 2025 10:06:33 +0000 (17:06 +0700)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 20 Mar 2025 10:07:04 +0000 (17:07 +0700)
src/lib/unlang/xlat_alloc.c
src/lib/unlang/xlat_eval.c
src/lib/unlang/xlat_priv.h
src/lib/unlang/xlat_purify.c
src/lib/unlang/xlat_tokenize.c

index e19074186aa17d189cc37daba053970f242babb7..7f34225cf1e1c8fdcdab788195e57df220868751 100644 (file)
@@ -274,12 +274,6 @@ static int CC_HINT(nonnull) _xlat_copy_internal(NDEBUG_LOCATION_ARGS TALLOC_CTX
                case XLAT_FUNC_UNRESOLVED:
                        break;
 
-               case XLAT_VIRTUAL:
-                       node->call.func = p->call.func;
-                       node->call.dict = p->call.dict;
-                       node->call.ephemeral = p->call.ephemeral;
-                       break;
-
                case XLAT_FUNC:
                        /*
                         *      Only copy the function pointer, and whether this
index 1bc2b98fbfba68cd4bfd93cbeecd559834393686..1427de2dae43213a82a7c1837a5007bf8f121b56 100644 (file)
@@ -169,9 +169,6 @@ static fr_slen_t xlat_fmt_print(fr_sbuff_t *out, xlat_exp_t const *node)
                        return fr_sbuff_in_sprintf(out, "%%{%pV}", fr_box_strvalue_buffer(node->fmt));
                }
 
-       case XLAT_VIRTUAL:
-               return fr_sbuff_in_sprintf(out, "%%{%s}", node->call.func->name);
-
 #ifdef HAVE_REGEX
        case XLAT_REGEX:
                return fr_sbuff_in_sprintf(out, "%%{%u}", node->regex_index);
@@ -1245,21 +1242,6 @@ xlat_action_t xlat_frame_eval(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_exp_head_
                        fr_value_box_list_move((fr_value_box_list_t *)out->dlist, &result);
                        continue;
 
-               case XLAT_VIRTUAL:
-               {
-                       XLAT_DEBUG("** [%i] %s(virtual) - %%{%s}", unlang_interpret_stack_depth(request), __FUNCTION__,
-                                  node->fmt);
-
-                       xlat_debug_log_expansion(request, node, NULL, __LINE__);
-                       xa = node->call.func->func(ctx, out,
-                                                  XLAT_CTX(node->call.func->uctx, NULL, NULL, NULL, NULL),
-                                                  request, NULL);
-                       fr_dcursor_next(out);
-
-                       xlat_debug_log_result(request, node, fr_dcursor_current(out));
-               }
-                       continue;
-
                case XLAT_FUNC:
                        XLAT_DEBUG("** [%i] %s(func) - %%%s(...)", unlang_interpret_stack_depth(request), __FUNCTION__,
                                   node->fmt);
index dfa980d64c1a3028328e97fba30b1e82c66b6fdf..197821d1ed48c5d007246c1fee546429e592e74b 100644 (file)
@@ -108,10 +108,9 @@ typedef enum {
        XLAT_ONE_LETTER         = 0x0002,               //!< Special "one-letter" expansion
        XLAT_FUNC               = 0x0004,               //!< xlat module
        XLAT_FUNC_UNRESOLVED    = 0x0008,               //!< func needs resolution during pass2.
-       XLAT_VIRTUAL            = 0x0010,               //!< virtual attribute
-       XLAT_TMPL               = 0x0020,               //!< xlat attribute
+       XLAT_TMPL               = 0x0010,               //!< xlat attribute
 #ifdef HAVE_REGEX
-       XLAT_REGEX              = 0x0040,               //!< regex reference %{1}, etc.
+       XLAT_REGEX              = 0x0020,               //!< regex reference %{1}, etc.
 #endif
        XLAT_GROUP              = 0x0100                //!< encapsulated string of xlats
 } xlat_type_t;
index a704315ab64d2a5406692d982bab8b74a44bbea8..d8be73fd9d2e56a55c1595ffe77fb8fc86243829 100644 (file)
@@ -162,7 +162,6 @@ static int xlat_purify_list_internal(xlat_exp_head_t *head, request_t *request,
 
                case XLAT_INVALID:
                case XLAT_FUNC_UNRESOLVED:
-               case XLAT_VIRTUAL:
                        fr_assert(0);
                        return -1;
 
index 11769147ae2de08c25ec5d9c78b848fdc0570934..1a9e277564232953f52ddeed3dea37d12002e683 100644 (file)
@@ -467,28 +467,6 @@ error:
        return 0;
 }
 
-static int xlat_resolve_virtual_attribute(xlat_exp_t *node, tmpl_t *vpt)
-{
-       xlat_t  *func;
-
-       if (tmpl_is_attr(vpt)) {
-               func = xlat_func_find(tmpl_attr_tail_da(vpt)->name, -1);
-       } else {
-               func = xlat_func_find(tmpl_attr_tail_unresolved(vpt), -1);
-       }
-       if (!func) return -1;
-
-       xlat_exp_set_type(node, XLAT_VIRTUAL);
-       xlat_exp_set_name_shallow(node, vpt->name);
-
-       XLAT_DEBUG("VIRTUAL <-- %pV",
-                  fr_box_strvalue_len(vpt->name, vpt->len));
-       node->call.func = func;
-       node->flags = func->flags;
-
-       return 0;
-}
-
 /** Parse an attribute ref or a virtual attribute
  *
  */
@@ -553,11 +531,6 @@ static CC_HINT(nonnull(1,2,4)) ssize_t xlat_tokenize_attribute(xlat_exp_head_t *
         *      Deal with unresolved attributes.
         */
        if (tmpl_is_attr_unresolved(vpt)) {
-               /*
-                *      Could it be a virtual attribute?
-                */
-               if ((tmpl_attr_num_elements(vpt) == 2) && (xlat_resolve_virtual_attribute(node, vpt) == 0)) goto done;
-
                if (!t_rules->attr.allow_unresolved) {
                        talloc_free(vpt);
 
@@ -569,21 +542,16 @@ static CC_HINT(nonnull(1,2,4)) ssize_t xlat_tokenize_attribute(xlat_exp_head_t *
                /*
                 *      Try to resolve it later
                 */
-               xlat_exp_set_type(node, XLAT_TMPL);
-               xlat_exp_set_name_shallow(node, vpt->name);
-               node->vpt = vpt;
                node->flags.needs_resolving = true;
-
-       } else {
-               /*
-                *      Deal with normal attribute (or list)
-                */
-               xlat_exp_set_type(node, XLAT_TMPL);
-               xlat_exp_set_name_shallow(node, vpt->name);
-               node->vpt = vpt;
        }
 
-done:
+       /*
+        *      Deal with normal attribute (or list)
+        */
+       xlat_exp_set_type(node, XLAT_TMPL);
+       xlat_exp_set_name_shallow(node, vpt->name);
+       node->vpt = vpt;
+
        /*
         *      Remember that it was %{User-Name}
         *
@@ -1029,11 +997,6 @@ static void _xlat_debug_node(xlat_exp_t const *node, int depth)
        }
                break;
 
-       case XLAT_VIRTUAL:
-               fr_assert(node->fmt != NULL);
-               INFO_INDENT("virtual (%s)", node->fmt);
-               break;
-
        case XLAT_FUNC:
                fr_assert(node->call.func != NULL);
                INFO_INDENT("func (%s)", node->call.func->name);
@@ -1270,14 +1233,12 @@ ssize_t xlat_print_node(fr_sbuff_t *out, xlat_exp_head_t const *head, xlat_exp_t
                slen = tmpl_attr_print(out, node->vpt, TMPL_ATTR_REF_PREFIX_NO);
                if (slen < 0) return slen;
                break;
+
 #ifdef HAVE_REGEX
        case XLAT_REGEX:
                FR_SBUFF_IN_SPRINTF_RETURN(out, "%i", node->regex_index);
                break;
 #endif
-       case XLAT_VIRTUAL:
-               FR_SBUFF_IN_BSTRCPY_BUFFER_RETURN(out, node->call.func->name);
-               break;
 
        case XLAT_FUNC:
                FR_SBUFF_IN_BSTRCPY_BUFFER_RETURN(out, node->call.func->name);