Using attribute reference from variable content in unlang
Charles-Antoine Guillat-Guignard
xarli at xarli.net
Mon Jan 30 09:19:15 UTC 2023
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
-------------- 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/5dd57b52/attachment.sig>
More information about the Freeradius-Users
mailing list