]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
just use function instead of "roll your own" code
authorAlan T. DeKok <aland@freeradius.org>
Mon, 2 Sep 2024 11:15:20 +0000 (07:15 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 2 Sep 2024 11:15:20 +0000 (07:15 -0400)
which incidentally also handles unknown attributes, too

src/lib/server/tmpl_tokenize.c

index 39032f05ec5bf238c4f1eb82b6e5ac5419088de0..624004ef26dc2f306d7e5ea1c90c467dce58c174 100644 (file)
@@ -1237,7 +1237,6 @@ void tmpl_attr_set_list(tmpl_t *vpt, fr_dict_attr_t const *list)
 int tmpl_attr_afrom_list(TALLOC_CTX *ctx, tmpl_t **out, tmpl_t const *list, fr_dict_attr_t const *da)
 {
        tmpl_t *vpt;
-       tmpl_attr_t *ar;
 
        char attr[256];
        ssize_t slen;
@@ -1248,11 +1247,8 @@ int tmpl_attr_afrom_list(TALLOC_CTX *ctx, tmpl_t **out, tmpl_t const *list, fr_d
         *      Copies request refs and the list ref
         */
        tmpl_attr_copy(vpt, list);
-       tmpl_attr_set_list(vpt, tmpl_list(list));       /* Remove when lists are attributes */
-       ar = tmpl_attr_add(vpt, TMPL_ATTR_TYPE_NORMAL);
-       ar->ar_da = da;
-       ar->ar_parent = fr_dict_root(fr_dict_by_da(da));
-       tmpl_attr_set_leaf_num(vpt, tmpl_attr_tail_num(list));
+       tmpl_attr_set_list(vpt, tmpl_list(list));
+       tmpl_attr_set_leaf_da(vpt, da);
 
        /*
         *      We need to rebuild the attribute name, to be the