From: Alan T. DeKok Date: Mon, 4 Aug 2025 12:48:36 +0000 (-0400) Subject: add character set for allowed names of nested attrs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e555ac483c652f1de9052b6af8bf9971f5367c81;p=thirdparty%2Ffreeradius-server.git add character set for allowed names of nested attrs which is the allowed list for attrs, plus '.' --- diff --git a/src/lib/util/dict.h b/src/lib/util/dict.h index 0e62dc206d..5bfa4c18d6 100644 --- a/src/lib/util/dict.h +++ b/src/lib/util/dict.h @@ -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 * */ diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 729826c0a1..199c4aaeda 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -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