Using attribute reference from variable content in unlang

Charles-Antoine Guillat-Guignard xarli at xarli.net
Mon Jan 30 13:26:40 UTC 2023


Even if I doubt it changes anything, my Freeradius version is 3.0.12, sorry I forgot to precise.

Kind regards,

Charles-Antoine Guillat-Guignard


Le 30/01/2023 à 10:19, Charles-Antoine Guillat-Guignard via Freeradius-Users a écrit :
> Hello,
> 
> I am trying to implement some db based attribute handling (names, operator and values from db), and I am struggling with a dynamic handling of 
> attributes references (names).
> 
> Looking at https://freeradius.org/radiusd/man/unlang.txt (ATTRIBUTE REFERENCES section), I see no exemple matching what I want to do (attribute 
> name is always known, and static).
> 
> What I try to achieve would look a bit like that (which doesn't work) : :
> 
> # Exemple for Attributes-Actions values
> # A-AL-AAA,:=,1
> # A-AL-DHCP,:=,0
> 
> foreach &Attributes-Actions {
>      update request {
>          Attributes-Action := "%{Foreach-Variable-2}"
>      }
> 
>      %{explode:Attributes-Action ,}
> 
>      update reply {
>          # for debugging, contains expected value
>          Reply-Message += "index 0 : %{Attributes-Action[0]}"
>          # this fails
>          "%{Attributes-Action[0]}" := "%{Attributes-Action[2]}"
>      }
> }
> 
> Am I missing something? Is there another way to achieve dynamic handling of attributes names, to be able to modify an attribute whose 
> name/reference is not pre-declared in unlang script (unknown in unlang script, but ofc declared in dictionary).
> 
> Thank you in advance.
> 
> Kind regards,
> 
> Charles-Antoine Guillat-Guignard
> 
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20230130/ccdd7c93/attachment.sig>


More information about the Freeradius-Users mailing list