[master] questions about recent changes in xlat

Alan DeKok aland at deployingradius.com
Sat Oct 24 15:30:23 CEST 2020


On Oct 24, 2020, at 8:44 AM, Chaigneau, Nicolas via Freeradius-Devel <freeradius-devel at lists.freeradius.org> wrote:
> A couple of recent changes I've noticed in FreeRADIUS xlat framework:
> 
> 1)
> "%%" is no longer transformed to "%" (it remains %%).
> Function xlat_eval_one_letter has a case for '%' but it seems it's not called anymore.
> In function xlat_sync_eval which should call xlat_eval_one_letter, I see that node->type is 1 (XLAT_LITERAL) instead of 2 (XLAT_ONE_LETTER).
> 
> Is this change intended ?

  Yes.  We've updated the parser to be smarter.  It no longer need %%.  Which was always ugly.

> According to the documentation it should work:
> https://github.com/FreeRADIUS/freeradius-server/blob/master/doc/antora/modules/unlang/pages/xlat/character.adoc

  We'll update the documentation, and also the upgrade guide.

> 2)
> Using a form of xlat functions with no parameter is no longer working.
> For example: %{myxlat}
> 
> This used to work (not too long ago).
> This is useful to me, although I can still get the same result with: %{myxlat:}
> But this is a bit ugly though...
> 
> Do you think we could get this to work again without the colon ?

  Possibly.  We're trying to regularize all of the parsing, expansions, etc.  Which means that some changes creep in.

  The main issue with not using the ":" is that the syntax becomes ambiguous.  Is %{foo} an attribute reference, or an xlat function?  You can't tell.

  Alan DeKok.




More information about the Freeradius-Devel mailing list