From: Alan T. DeKok Date: Fri, 19 Jun 2015 02:43:39 +0000 (-0400) Subject: Convert &Packet-Type to "%{Packet-Type}" X-Git-Tag: release_3_0_9~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d1e0871f2b44da1013e4492c6568a2efda6e808;p=thirdparty%2Ffreeradius-server.git Convert &Packet-Type to "%{Packet-Type}" Because the xlat will notice that it's a virtual attribute, and call the expand function. But the "find attribute in list" code won't find the virtual attribute. --- diff --git a/src/main/parser.c b/src/main/parser.c index 7f7ca73bd40..a94a0dd1627 100644 --- a/src/main/parser.c +++ b/src/main/parser.c @@ -1004,6 +1004,26 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st } } else { + vp_tmpl_t *vpt; + + /* + * Convert &Packet-Type to "%{Packet-Type}", because + * these attributes don't really exist. The code to + * find an attribute reference doesn't work, but the + * xlat code does. + */ + vpt = c->data.map->lhs; + if ((vpt->type == TMPL_TYPE_ATTR) && vpt->tmpl_da->flags.virtual) { + vpt->tmpl_xlat = xlat_from_tmpl_attr(vpt, vpt); + vpt->type = TMPL_TYPE_XLAT_STRUCT; + } + + vpt = c->data.map->rhs; + if ((vpt->type == TMPL_TYPE_ATTR) && vpt->tmpl_da->flags.virtual) { + vpt->tmpl_xlat = xlat_from_tmpl_attr(vpt, vpt); + vpt->type = TMPL_TYPE_XLAT_STRUCT; + } + /* * Two attributes? They must be of the same type */ @@ -1162,7 +1182,6 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st int hyphens = 0; bool may_be_attr = true; size_t i; - vp_tmpl_t *vpt; ssize_t attr_slen; /*