W dniu 04.03.2021 16:26, Jorge Pereira napisał(a):
Tomasz,
Guys, thanks for all replies and clarifications! I've also found code fragment which seems to register all xlat function handlers: https://github.com/FreeRADIUS/freeradius-server/blob/90026932c8fe92751b14091... As I see some functions are quite old and they are treated as "legacy" ones - they don't implement full symbol substitution, but only radius attributes?
As Alan said, the current %{lpad:} (also the %{rpad:}) behaviour expects an attribute as you can see in https://github.com/FreeRADIUS/freeradius-server/blob/v3.0.x/raddb/mods-avail...
Therefore, you could try something like:
… if (&Calling-Station-Id && (&Calling-Station-Id =~ /^${policy.mac-addr-regexp}$/i)) { update control { &Tmp-String-1 := “%{1}” &Tmp-String-2 := “%{2}” &Tmp-String-3 := “%{3}” &Tmp-String-4 := “%{4}” &Tmp-String-5 := “%{5}” &Tmp-String-6 := “%{6}” } update request {
&Calling-Station-Id := "%{toupper:%{lpad:&control:Tmp-String-1 2 0}:%{lpad:&control:Tmp-String-2 2 0}:%{lpad:&control:Tmp-String-3 2 0}:%{lpad:&control:Tmp-String-4 2 0}:%{lpad:&control:Tmp-String-5 2 0}:%{lpad:&control:Tmp-String-6 2 0}}" } updated } else { ...
Yeah, you're right. I considers such work-around and it could be effective. Thanks for my thought confirmation! Do "modern" xlat function support nested expressions? -- Bests, Tomasz Chiliński, Chilan opiekun projektu LMS - https://lms.org.pl kierownik projektu LMS Plus / LMS+ - https://lms-plus.org