From: Arran Cudbard-Bell Date: Wed, 23 Oct 2024 06:08:00 +0000 (-0600) Subject: Add fields to store attribute location X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fba6df40858c1b8d41bbf61cf95dff31f13fba52;p=thirdparty%2Ffreeradius-server.git Add fields to store attribute location --- diff --git a/src/lib/util/dict.h b/src/lib/util/dict.h index 245deecd628..211daeb057d 100644 --- a/src/lib/util/dict.h +++ b/src/lib/util/dict.h @@ -188,6 +188,11 @@ struct dict_attr_s { fr_dict_attr_flags_t flags; //!< Flags. + char const *filename; //!< Where the attribute was defined. + ///< this buffer's lifetime is bound to the + ///< fr_dict_t. + int line; //!< Line number where the attribute was defined. + uint8_t ext[FR_DICT_ATTR_EXT_MAX]; //!< Extensions to the dictionary attribute. } CC_HINT(aligned(FR_EXT_ALIGNMENT)); diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 91ce6776248..5dbdae87626 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -642,6 +642,14 @@ int dict_attr_init(fr_dict_attr_t **da_p, * This attribute is just a reference to another. */ if (args->ref) if (dict_attr_ref_init(da_p, args->ref) < 0) return -1; +/** Set where the dictionary attribute was defined + * + */ +void dict_attr_location_init(fr_dict_attr_t *da, char const *filename, int line) +{ + da->filename = filename; + da->line = line; +} /* * Name is a separate talloc chunk. We allocate