From: Nick Porter Date: Mon, 23 Jan 2023 15:42:37 +0000 (+0000) Subject: Add allow_wildcard option to tmpl_attr_rules_s X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91bdfe8d8155b71398ff8ec9592c27dce8d06ae5;p=thirdparty%2Ffreeradius-server.git Add allow_wildcard option to tmpl_attr_rules_s --- diff --git a/src/lib/server/tmpl.h b/src/lib/server/tmpl.h index fe9f7f7a888..d0b14e7a516 100644 --- a/src/lib/server/tmpl.h +++ b/src/lib/server/tmpl.h @@ -315,7 +315,10 @@ struct tmpl_attr_rules_s { ///< This should be used as part of a multi-pass ///< approach to parsing. - uint8_t allow_foreign:1; //!< Allow arguments not found in dict_def. + uint8_t allow_wildcard:1; //!< Allow the special case of .[*] representing + ///< all children of a structural attribute. + + uint8_t allow_foreign:1; //!< Allow arguments not found in dict_def. uint8_t disallow_internal:1; //!< Allow/fallback to internal attributes. diff --git a/src/lib/server/tmpl_tokenize.c b/src/lib/server/tmpl_tokenize.c index f52e0774c4f..6fd3d29f8e6 100644 --- a/src/lib/server/tmpl_tokenize.c +++ b/src/lib/server/tmpl_tokenize.c @@ -1807,7 +1807,7 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t * Don't alter the fr_strerror buffer, may contain useful * errors from the dictionary code. */ - if (!at_rules->allow_unresolved) { + if (!at_rules->allow_unresolved && !(at_rules->allow_wildcard && fr_sbuff_is_char(name, '['))) { fr_strerror_const_push("Unresolved attributes are not allowed here"); if (err) *err = TMPL_ATTR_ERROR_UNRESOLVED_NOT_ALLOWED; fr_sbuff_set(name, &m_s);