]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
when parsing attributes by number, use the real protocol dictionary
authorAlan T. DeKok <aland@freeradius.org>
Mon, 9 Sep 2024 22:22:30 +0000 (18:22 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 10 Sep 2024 12:14:30 +0000 (08:14 -0400)
and not the non-local one.

src/lib/server/tmpl_tokenize.c
src/lib/util/dict.h
src/lib/util/dict_util.c

index a448be81d852ea40973e760dd57ab706f20cc66f..192744e22b0ac5068ab44b7166ee586f91f7db00 100644 (file)
@@ -1939,6 +1939,8 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t
         *      .<oid>
         */
        if (fr_sbuff_out(NULL, &oid, name) > 0) {
+               namespace = fr_dict_unlocal(namespace);
+
                fr_strerror_clear();    /* Clear out any existing errors */
 
                if (fr_dict_by_da(namespace) == fr_dict_internal()) goto disallow_unknown;
index 31558b68ea29bbfca5f56004594d61c07abb4809..0488c783e2762fe069bc7bd8e1abb40f3641cc96 100644 (file)
@@ -564,6 +564,8 @@ fr_dict_t const             *fr_dict_by_protocol_num(unsigned int num);
 
 fr_dict_protocol_t const *fr_dict_protocol(fr_dict_t const *dict);
 
+fr_dict_attr_t const   *fr_dict_unlocal(fr_dict_attr_t const *da) CC_HINT(nonnull);
+
 fr_dict_t const                *fr_dict_by_da(fr_dict_attr_t const *da) CC_HINT(nonnull);
 
 fr_dict_t const                *fr_dict_by_attr_name(fr_dict_attr_t const **found, char const *name);
index ee34d25c0ba55e34c157f6b7a90fbd397cd46aff..38f00e373bcf1871a9f7ada4d6f08007835da915 100644 (file)
@@ -4587,3 +4587,19 @@ fr_dict_protocol_t const *fr_dict_protocol(fr_dict_t const *dict)
 {
        return dict->proto;
 }
+
+/*
+ *     Get the real protocol dictionary behind the local one.
+ */
+fr_dict_attr_t const *fr_dict_unlocal(fr_dict_attr_t const *da)
+{
+       if (!da->flags.local) return da;
+
+       fr_assert(da->dict->root == da);
+
+       while (da->dict->next) {
+               da = da->dict->next->root;
+       }
+
+       return da;
+}