From: Alan T. DeKok Date: Wed, 6 Jul 2022 15:40:40 +0000 (-0400) Subject: allow for 'ref=PROTOCOL' as a bare word X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e37be961de2afae681116e110ee0133afb718e5;p=thirdparty%2Ffreeradius-server.git allow for 'ref=PROTOCOL' as a bare word --- diff --git a/src/lib/util/dict_fixup.c b/src/lib/util/dict_fixup.c index 2a3e0146b54..72570425b3e 100644 --- a/src/lib/util/dict_fixup.c +++ b/src/lib/util/dict_fixup.c @@ -293,6 +293,14 @@ static fr_dict_attr_t const *dict_find_or_load_reference(fr_dict_t **dict_def, c */ if (slen == 0) goto invalid_reference; + /* + * Just a bare reference to the protocol. Use the root. + */ + if (!ref[slen]) { + *dict_def = dict; + return fr_dict_root(dict); + } + /* * Look up the attribute. */ diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 553d9f2fd61..b43aa1e9cfe 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -1995,7 +1995,7 @@ ssize_t dict_by_protocol_substr(fr_dict_attr_err_t *err, * If what we stopped at wasn't a '.', then there * can't be a protocol name in this string. */ - if (*(our_name.p) != '.') { + if (*(our_name.p) && (*(our_name.p) != '.')) { memcpy(out, &dict_def, sizeof(*out)); return 0; }