]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add allow_wildcard option to tmpl_attr_rules_s
authorNick Porter <nick@portercomputing.co.uk>
Mon, 23 Jan 2023 15:42:37 +0000 (15:42 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 9 Feb 2023 17:00:06 +0000 (11:00 -0600)
src/lib/server/tmpl.h
src/lib/server/tmpl_tokenize.c

index fe9f7f7a888627f6d50855da4167f21a0f2bfc28..d0b14e7a5166c6cf70f24f8558f848ade4b386b6 100644 (file)
@@ -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.
 
index f52e0774c4f76f55fda9e8549a1d36a99e85ac8c..6fd3d29f8e627b5ca170b0fb3582d46bb4e7b1c9 100644 (file)
@@ -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);