From: Alan T. DeKok Date: Mon, 9 Sep 2024 22:22:30 +0000 (-0400) Subject: when parsing attributes by number, use the real protocol dictionary X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9085ded744af2e042e9984a9d711da46dee7830e;p=thirdparty%2Ffreeradius-server.git when parsing attributes by number, use the real protocol dictionary and not the non-local one. --- diff --git a/src/lib/server/tmpl_tokenize.c b/src/lib/server/tmpl_tokenize.c index a448be81d85..192744e22b0 100644 --- a/src/lib/server/tmpl_tokenize.c +++ b/src/lib/server/tmpl_tokenize.c @@ -1939,6 +1939,8 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t * . */ 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; diff --git a/src/lib/util/dict.h b/src/lib/util/dict.h index 31558b68ea2..0488c783e27 100644 --- a/src/lib/util/dict.h +++ b/src/lib/util/dict.h @@ -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); diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index ee34d25c0ba..38f00e373bc 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -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; +}