From: Alan T. DeKok Date: Fri, 10 Sep 2021 14:54:29 +0000 (-0400) Subject: don't smash fields when parsing them X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=163c8c03d511ef162eaffd2b36e739ff3b7706ab;p=thirdparty%2Ffreeradius-server.git don't smash fields when parsing them --- diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index a750cfc554b..2f8b9362e6b 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -288,6 +288,14 @@ static int dict_process_flag_field(dict_tokenize_ctx_t *ctx, char *name, fr_type if (ref) *ref = NULL; + /* + * Set these as default, so that we can set one (or both) separately as flags. + */ + if ((type == FR_TYPE_DATE) || (type == FR_TYPE_TIME_DELTA)) { + flags->length = 4; + flags->flag_time_res = FR_TIME_RES_SEC; + } + for (p = name; p && *p != '\0' ; p = next) { char *key, *value; @@ -383,9 +391,6 @@ static int dict_process_flag_field(dict_tokenize_ctx_t *ctx, char *name, fr_type flags->subtype = FLAG_LENGTH_UINT16; } else if ((type == FR_TYPE_DATE) || (type == FR_TYPE_TIME_DELTA)) { - flags->length = 4; - flags->flag_time_res = FR_TIME_RES_SEC; - /* * Allow the dictionary to specify the encoding format. */