From: Alan T. DeKok Date: Wed, 23 Sep 2015 18:23:04 +0000 (-0400) Subject: More fixes for virtual attributes X-Git-Tag: release_3_0_10~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e9d732d3f85465ecfcb9f0c96d9e6e13680d7ea;p=thirdparty%2Ffreeradius-server.git More fixes for virtual attributes --- diff --git a/src/main/modcall.c b/src/main/modcall.c index 28061f7be7d..d02b0031c86 100644 --- a/src/main/modcall.c +++ b/src/main/modcall.c @@ -3437,6 +3437,15 @@ static bool pass2_callback(void *ctx, fr_cond_t *c) vpt->type = TMPL_TYPE_XLAT_STRUCT; } + /* + * Convert RHS to expansions, too. + */ + 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; + } + /* * @todo v3.1: do the same thing for the RHS... */ @@ -3789,6 +3798,14 @@ bool modcall_pass2(modcallable *mc) } } + /* + * Virtual attribute fixes for "case" statements, too. + */ + if ((g->vpt->type == TMPL_TYPE_ATTR) && g->vpt->tmpl_da->flags.virtual) { + g->vpt->tmpl_xlat = xlat_from_tmpl_attr(g->vpt, g->vpt); + g->vpt->type = TMPL_TYPE_XLAT_STRUCT; + } + if (!modcall_pass2(g->children)) return false; g->done_pass2 = true; break; diff --git a/src/tests/keywords/virtual-rhs b/src/tests/keywords/virtual-rhs new file mode 100644 index 00000000000..0d21e7f3fd9 --- /dev/null +++ b/src/tests/keywords/virtual-rhs @@ -0,0 +1,16 @@ +# +# PRE: update if +# +update control { + Cleartext-Password := 'hello' +} + +update request { + Tmp-String-0 := "" +} + +if (&Tmp-String-0 == &Client-Shortname) { + update reply { + Filter-Id := "filter" + } +}