]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use correct names
authorAlan T. DeKok <aland@freeradius.org>
Tue, 3 Sep 2024 15:23:11 +0000 (11:23 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 3 Sep 2024 19:05:24 +0000 (15:05 -0400)
if we use "bool" for TMPL_ATTR_REF_PREFIX things, then code searches
won't find the right values.

So we explicitly initialize vpt->rules.attr.prefix = YES

src/lib/server/tmpl_tokenize.c

index f4f79c444a33eb934c2ff1ec72f61137d6bcfb58..a448be81d852ea40973e760dd57ab706f20cc66f 100644 (file)
@@ -2214,7 +2214,6 @@ ssize_t tmpl_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t *err,
        int                             ret;
        tmpl_t                          *vpt;
        fr_sbuff_t                      our_name = FR_SBUFF(name);      /* Take a local copy in case we need to back track */
-       bool                            ref_prefix = false;
        bool                            is_raw = false;
        tmpl_attr_rules_t const         *at_rules;
        fr_sbuff_marker_t               m_l;
@@ -2263,8 +2262,12 @@ ssize_t tmpl_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t *err,
                break;
        }
 
+       /*
+        *      We parsed the tmpl as &User-Name, or just User-Name, but NOT %{User-Name}.
+        *      Mark it up as having a prefix.
+        */
        MEM(vpt = tmpl_alloc(ctx, TMPL_TYPE_ATTR, T_BARE_WORD, NULL, 0));
-       vpt->data.attribute.ref_prefix = ref_prefix;
+       vpt->data.attribute.ref_prefix = TMPL_ATTR_REF_PREFIX_YES;
 
        /*
         *      The "raw." prefix marks up the leaf attribute