From: Alan T. DeKok Date: Fri, 20 Jan 2017 17:48:01 +0000 (-0500) Subject: Look up unknown attributes by name, not by number. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39f1ea734f3abf28509cf7ec3faba4d20465fe60;p=thirdparty%2Ffreeradius-server.git Look up unknown attributes by name, not by number. And update the ipaddr.raw test to match. next, update the tests for attribute existence... --- diff --git a/src/main/tmpl.c b/src/main/tmpl.c index ec1417d09b2..0bf5b62d7d1 100644 --- a/src/main/tmpl.c +++ b/src/main/tmpl.c @@ -749,8 +749,7 @@ ssize_t tmpl_from_attr_substr(vp_tmpl_t *vpt, char const *name, * If it has, parsing is the same as if the attribute * name had been used instead of its OID. */ - attr.da = fr_dict_attr_child_by_num(((fr_dict_attr_t *)&attr.unknown.da)->parent, - ((fr_dict_attr_t *)&attr.unknown.da)->attr); + attr.da = fr_dict_attr_by_name(NULL, a); if (attr.da) { vpt->auto_converted = true; goto do_num; diff --git a/src/tests/keywords/ipaddr.raw b/src/tests/keywords/ipaddr.raw index aa990eb059d..87372769d90 100644 --- a/src/tests/keywords/ipaddr.raw +++ b/src/tests/keywords/ipaddr.raw @@ -12,3 +12,22 @@ update control { update request { Attr-4 = 0x010203 } + +#if (!&Attr-4) { +if (0) { + update reply { + Filter-Id := "Cannot find newly added raw attribute" + } +} +else { + if (&Attr-4 != 0x010203) { + update reply { + Filter-Id := "Attr-4 is not 0x0120203" + } + } + else { + update reply { + Filter-Id := "filter" + } + } +} \ No newline at end of file