]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move to prefix AUTO
authorAlan T. DeKok <aland@freeradius.org>
Thu, 27 Mar 2025 20:40:30 +0000 (16:40 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 28 Mar 2025 13:47:08 +0000 (09:47 -0400)
src/lib/server/map.c
src/lib/server/tmpl_tokenize.c
src/lib/server/users_file.c
src/lib/unlang/xlat_expr.c
src/lib/unlang/xlat_tokenize.c
src/modules/rlm_exec/rlm_exec.c
src/modules/rlm_sql/sql.c

index c56c1e022394ffa65c2a81b063f0ef068c2444dd..a5d5ab3321e4f1a9ee730683793b1d599448b599 100644 (file)
@@ -1461,7 +1461,7 @@ int map_afrom_vp(TALLOC_CTX *ctx, map_t **out, fr_pair_t *vp, tmpl_rules_t const
        tmpl_attr_set_request_ref(map->lhs, rules->attr.request_def);
        tmpl_attr_set_list(map->lhs, rules->attr.list_def);
 
-       tmpl_print(&buffer_sbuff, map->lhs, TMPL_ATTR_REF_PREFIX_YES, NULL);
+       tmpl_print(&buffer_sbuff, map->lhs, TMPL_ATTR_REF_PREFIX_AUTO, NULL);
        tmpl_set_name(map->lhs, T_BARE_WORD, fr_sbuff_start(&buffer_sbuff), -1);
 
        /*
@@ -2394,7 +2394,7 @@ ssize_t map_print(fr_sbuff_t *out, map_t const *map)
                FR_SBUFF_IN_SPRINTF_RETURN(&our_out, "<%s>",
                                           fr_type_to_str(tmpl_rules_cast(map->lhs)));
        }
-       FR_SBUFF_RETURN(tmpl_print_quoted, &our_out, map->lhs, TMPL_ATTR_REF_PREFIX_YES);
+       FR_SBUFF_RETURN(tmpl_print_quoted, &our_out, map->lhs, TMPL_ATTR_REF_PREFIX_AUTO);
 
        /*
         *      Print separators and operator
@@ -2428,7 +2428,7 @@ ssize_t map_print(fr_sbuff_t *out, map_t const *map)
        /*
         *      Print the RHS.
         */
-       FR_SBUFF_RETURN(tmpl_print_quoted, &our_out, map->rhs, TMPL_ATTR_REF_PREFIX_YES);
+       FR_SBUFF_RETURN(tmpl_print_quoted, &our_out, map->rhs, TMPL_ATTR_REF_PREFIX_AUTO);
 
        FR_SBUFF_SET_RETURN(out, &our_out);
 }
@@ -2483,7 +2483,7 @@ void map_debug_log(request_t *request, map_t const *map, fr_pair_t const *vp)
                 *      the quoting based on the data type.
                 */
                fr_pair_aprint_value_quoted(request, &value, vp, quote);
-               tmpl_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map->rhs, TMPL_ATTR_REF_PREFIX_YES, NULL);
+               tmpl_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map->rhs, TMPL_ATTR_REF_PREFIX_AUTO, NULL);
                rhs = talloc_typed_asprintf(request, "%s -> %s", buffer, value);
        }
                break;
@@ -2495,7 +2495,7 @@ void map_debug_log(request_t *request, map_t const *map, fr_pair_t const *vp)
 
        switch (map->lhs->type) {
        case TMPL_TYPE_ATTR:
-               tmpl_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map->lhs, TMPL_ATTR_REF_PREFIX_YES, NULL);
+               tmpl_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map->lhs, TMPL_ATTR_REF_PREFIX_AUTO, NULL);
                RDEBUG2("%s %s %s", buffer, fr_table_str_by_value(fr_tokens_table, vp ? vp->op : map->op, "<INVALID>"), rhs);
                break;
 
index f1e5a8add54516a2a38661c0893f2f61856ddd92..01253269d5b203d71cc6e078e8e16432780d8fc8 100644 (file)
@@ -1277,7 +1277,7 @@ int tmpl_attr_afrom_list(TALLOC_CTX *ctx, tmpl_t **out, tmpl_t const *list, fr_d
         *      We need to rebuild the attribute name, to be the
         *      one we copied from the source list.
         */
-       slen = tmpl_print(&FR_SBUFF_OUT(attr, sizeof(attr)), vpt, TMPL_ATTR_REF_PREFIX_YES,
+       slen = tmpl_print(&FR_SBUFF_OUT(attr, sizeof(attr)), vpt, TMPL_ATTR_REF_PREFIX_AUTO,
                          fr_value_escape_by_quote[list->quote]);
        if (slen < 0) {
                fr_strerror_printf("Serialized attribute too long.  Must be < "
@@ -1784,8 +1784,6 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t
        fr_dict_attr_err_t      dict_err;
        fr_dict_attr_t const    *our_parent = parent;
 
-       fr_assert(at_rules->prefix != TMPL_ATTR_REF_PREFIX_YES);
-
        fr_sbuff_marker(&m_s, name);
 
        if (depth > FR_DICT_MAX_TLV_STACK) {
@@ -2243,8 +2241,6 @@ ssize_t tmpl_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t *err,
 
        at_rules = &t_rules->attr;
 
-       fr_assert(at_rules->prefix != TMPL_ATTR_REF_PREFIX_YES);
-
        if (err) *err = TMPL_ATTR_ERROR_NONE;
 
        if (!fr_sbuff_extend(&our_name)) {
@@ -2447,9 +2443,6 @@ ssize_t tmpl_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t *err,
                fr_assert(ar != NULL);
 
                if (tmpl_attr_is_list_attr(ar)) vpt->rules.attr.list_def = ar->ar_da;
-
-               fr_assert(vpt->rules.attr.prefix != TMPL_ATTR_REF_PREFIX_YES);
-
        }
 
        if (!tmpl_substr_terminal_check(&our_name, p_rules)) {
@@ -3354,8 +3347,6 @@ fr_slen_t tmpl_afrom_substr(TALLOC_CTX *ctx, tmpl_t **out,
                if (slen > 0) goto done_bareword;
                fr_assert(!*out);
 
-               fr_assert(t_rules->attr.prefix != TMPL_ATTR_REF_PREFIX_YES);
-
                /*
                 *      See if it's an attribute reference
                 *      without the prefix.
@@ -5054,8 +5045,6 @@ void tmpl_attr_verify(char const *file, int line, tmpl_t const *vpt)
 
        fr_assert(tmpl_is_attr_unresolved(vpt) || tmpl_is_attr(vpt));
 
-       fr_assert(vpt->rules.attr.prefix != TMPL_ATTR_REF_PREFIX_YES);
-
        /*
         *      Loop detection
         */
@@ -5839,8 +5828,6 @@ void tmpl_rules_child_init(TALLOC_CTX *ctx, tmpl_rules_t *out, tmpl_rules_t cons
 
        if (!tmpl_is_attr(vpt)) return;
 
-       fr_assert(vpt->rules.attr.prefix != TMPL_ATTR_REF_PREFIX_YES);
-
        da = tmpl_attr_tail_da(vpt);
 
        /*
index 9f6345918a66b9242386c16045243c277dfcacc7..f1ee696b206d36fe8e4c5d47ae7654ab06234846 100644 (file)
@@ -280,7 +280,7 @@ static int pairlist_read_internal(TALLOC_CTX *ctx, fr_dict_t const *dict, char c
        rhs_rules = (tmpl_rules_t) {
                .attr = {
                        .dict_def = dict,
-                       .prefix = TMPL_ATTR_REF_PREFIX_YES,
+                       .prefix = TMPL_ATTR_REF_PREFIX_AUTO,
                        .list_def = request_attr_request,
                        .list_presence = TMPL_ATTR_LIST_ALLOW,
                        .bare_word_enum = v3_compat,
index a90ac5131fe86927327f482c121e8d205311bbca..d0b5f8a4ac1a01627405011723541af484ebcadc 100644 (file)
@@ -2808,8 +2808,6 @@ static fr_slen_t tokenize_field(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuf
 #ifndef NDEBUG
                if (vpt->name[0] == '%') {
                        fr_assert(vpt->rules.attr.prefix == TMPL_ATTR_REF_PREFIX_NO);
-               } else {
-                       fr_assert(vpt->rules.attr.prefix != TMPL_ATTR_REF_PREFIX_YES);
                }
 #endif
 
index 0a50ef09aa280fcc3164e21a4c944139c5497a5d..81272ac7c18e297bba21db1df5822906ae959607 100644 (file)
@@ -1130,12 +1130,6 @@ ssize_t xlat_print_node(fr_sbuff_t *out, xlat_exp_head_t const *head, xlat_exp_t
                fr_assert(talloc_parent(node->vpt) == node);
                fr_assert(!node->flags.pure);
 
-               /*
-                *      Can't have prefix YES if we're using the new flag.  The parser / tmpl alloc routines
-                *      MUST have set this to prefix AUTO.
-                */
-               fr_assert(node->vpt->rules.attr.prefix != TMPL_ATTR_REF_PREFIX_YES);
-
                /*
                 *      No '&', print the name, BUT without any attribute prefix.
                 */
index 8dc72ae97bd4fa41042f0cd48eb31bcec27ccbea..0edab6ca8df75589a874eb700b432a993bee6aef 100644 (file)
@@ -317,7 +317,7 @@ static unlang_action_t mod_exec_oneshot_wait_resume(rlm_rcode_t *p_result, modul
                        };
                        tmpl_rules_t    rhs_rules = lhs_rules;
 
-                       rhs_rules.attr.prefix = TMPL_ATTR_REF_PREFIX_YES;
+                       rhs_rules.attr.prefix = TMPL_ATTR_REF_PREFIX_AUTO;
                        rhs_rules.attr.list_def = request_attr_request;
                        rhs_rules.at_runtime = true;
                        rhs_rules.xlat.runtime_el = unlang_interpret_event_list(request);
index cbb61ba856e2a8ea3b8bacb3cf59f1a548b19957..fea9621ee9cc4bff58e6bd44bae19f2392525506 100644 (file)
@@ -309,7 +309,7 @@ static unlang_action_t sql_get_map_list_resume(rlm_rcode_t *p_result, UNUSED int
        map_t           *parent = NULL;
        rlm_sql_t const *inst = map_ctx->inst;
 
-       rhs_rules.attr.prefix = TMPL_ATTR_REF_PREFIX_YES;
+       rhs_rules.attr.prefix = TMPL_ATTR_REF_PREFIX_AUTO;
        rhs_rules.attr.list_def = request_attr_request;
 
        if (query_ctx->rcode != RLM_SQL_OK) RETURN_MODULE_FAIL;