]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add character set for allowed names of nested attrs
authorAlan T. DeKok <aland@freeradius.org>
Mon, 4 Aug 2025 12:48:36 +0000 (08:48 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 4 Aug 2025 12:48:36 +0000 (08:48 -0400)
which is the allowed list for attrs, plus '.'

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

index 0e62dc206de6069e51f9c58c83f7468741787f45..5bfa4c18d60b98d9508570ae5fdd31d3204d74f3 100644 (file)
@@ -499,11 +499,16 @@ typedef struct fr_dict_gctx_s fr_dict_gctx_t;
  */
 #define FR_DICT_MAX_TLV_STACK          (FR_DICT_TLV_NEST_MAX + 5)
 
-/** Characters that are allowed in dictionary attribute names
+/** Characters allowed in a single dictionary attribute name
  *
  */
 extern bool const      fr_dict_attr_allowed_chars[UINT8_MAX + 1];
 
+/** Characters allowed in a nested dictionary attribute name
+ *
+ */
+extern bool const fr_dict_attr_nested_allowed_chars[UINT8_MAX + 1];
+
 /** Characters that are allowed in dictionary enumeration value names
  *
  */
index 729826c0a1defaf885a7853f0486b15457d7e6dd..199c4aaeda920286252f98f247130c4793aaa5a9 100644 (file)
@@ -41,25 +41,36 @@ RCSID("$Id$")
 
 fr_dict_gctx_t *dict_gctx = NULL;      //!< Top level structure containing global dictionary state.
 
-/** Characters allowed in dictionary names
+#define DICT_ATTR_ALLOWED_CHARS \
+       ['-'] = true, ['/'] = true, ['_'] = true, \
+       ['0'] = true, ['1'] = true, ['2'] = true, ['3'] = true, ['4'] = true, \
+       ['5'] = true, ['6'] = true, ['7'] = true, ['8'] = true, ['9'] = true, \
+       ['A'] = true, ['B'] = true, ['C'] = true, ['D'] = true, ['E'] = true, \
+       ['F'] = true, ['G'] = true, ['H'] = true, ['I'] = true, ['J'] = true, \
+       ['K'] = true, ['L'] = true, ['M'] = true, ['N'] = true, ['O'] = true, \
+       ['P'] = true, ['Q'] = true, ['R'] = true, ['S'] = true, ['T'] = true, \
+       ['U'] = true, ['V'] = true, ['W'] = true, ['X'] = true, ['Y'] = true, \
+       ['Z'] = true, \
+       ['a'] = true, ['b'] = true, ['c'] = true, ['d'] = true, ['e'] = true, \
+       ['f'] = true, ['g'] = true, ['h'] = true, ['i'] = true, ['j'] = true, \
+       ['k'] = true, ['l'] = true, ['m'] = true, ['n'] = true, ['o'] = true, \
+       ['p'] = true, ['q'] = true, ['r'] = true, ['s'] = true, ['t'] = true, \
+       ['u'] = true, ['v'] = true, ['w'] = true, ['x'] = true, ['y'] = true, \
+       ['z'] = true
+
+/** Characters allowed in a single dictionary attribute name
  *
  */
 bool const fr_dict_attr_allowed_chars[UINT8_MAX + 1] = {
-       ['-'] = true, ['/'] = true, ['_'] = true,
-       ['0'] = true, ['1'] = true, ['2'] = true, ['3'] = true, ['4'] = true,
-       ['5'] = true, ['6'] = true, ['7'] = true, ['8'] = true, ['9'] = true,
-       ['A'] = true, ['B'] = true, ['C'] = true, ['D'] = true, ['E'] = true,
-       ['F'] = true, ['G'] = true, ['H'] = true, ['I'] = true, ['J'] = true,
-       ['K'] = true, ['L'] = true, ['M'] = true, ['N'] = true, ['O'] = true,
-       ['P'] = true, ['Q'] = true, ['R'] = true, ['S'] = true, ['T'] = true,
-       ['U'] = true, ['V'] = true, ['W'] = true, ['X'] = true, ['Y'] = true,
-       ['Z'] = true,
-       ['a'] = true, ['b'] = true, ['c'] = true, ['d'] = true, ['e'] = true,
-       ['f'] = true, ['g'] = true, ['h'] = true, ['i'] = true, ['j'] = true,
-       ['k'] = true, ['l'] = true, ['m'] = true, ['n'] = true, ['o'] = true,
-       ['p'] = true, ['q'] = true, ['r'] = true, ['s'] = true, ['t'] = true,
-       ['u'] = true, ['v'] = true, ['w'] = true, ['x'] = true, ['y'] = true,
-       ['z'] = true
+       DICT_ATTR_ALLOWED_CHARS
+};
+
+/** Characters allowed in a nested dictionary attribute name
+ *
+ */
+bool const fr_dict_attr_nested_allowed_chars[UINT8_MAX + 1] = {
+       DICT_ATTR_ALLOWED_CHARS,
+       [ '.' ] = true
 };
 
 /** Characters allowed in enumeration value names