%{rand} in recent versions

Stefan Winter stefan.winter at restena.lu
Mon Jul 15 14:38:30 CEST 2013


> So after investigating this a bit more, it seems the correct way to pass arguments to xlat functions in 2.x.x is with a space after the colon.
> This is because xlat functions which take numerical arguments, may get mistaken for attributes with tag selectors by the xlat parser code (in 2.x.x at least).
> The behaviour change which caused your issue was introduced by https://github.com/FreeRADIUS/freeradius-server/commit/33e9e1f7fbf5e63baa0fbd734e570474bee10878, but it's not a bug. The man pages for xlat, show a space after the ':' for module calls.
> The parser is 3.0.0 is smarter, and uses the table of registered xlat functions to determine whether it's an xlat module or an attribute. We don't do this in 2.x.x because of the potential performance hit. Though as compilation and evaluation is still done at runtime... um never mind, that'll be fixed in 3.1 :) The difficult work was splitting it into two stages, which is now complete.
> Anyway %{rand: 1000000} should work fine.
> +- entering group authorize {...}
> 	expand:  500 ->  500
> 	expand: %{rand: 500} -> 309
> 	expand: ccccccccccccc -> ccccccccccccc
> 	expand: %{randstr:ccccccccccccc} -> aodcqryxbsgpg

Rrrright. You know, I would almost buy your "RTFM", except that you
admitted that this is way too unexpected and confusing for a normal
users to "get it" - by writing "it's broken" yourself ;-)

Anyway, this works indeed, I changed my config and see actual randomness.


Stefan Winter

Ingenieur de Recherche
Fondation RESTENA - Réseau Téléinformatique de l'Education Nationale et
de la Recherche
6, rue Richard Coudenhove-Kalergi
L-1359 Luxembourg

Tel: +352 424409 1
Fax: +352 422473

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20130715/5ff94151/attachment.pgp>

More information about the Freeradius-Devel mailing list