subsctring from attribute

Matthew Newton mcn at freeradius.org
Tue Apr 18 08:45:28 UTC 2023



On 18/04/2023 09:41, Anatoliy wrote:
> HI all , How i can get subsctring from attribute ?
> For example
> &Any-attr = "test:pass" but in DB I only want put "pass" part
> 
> Attribut always in default:XXX

Use unlang and a regex.

E.g.

if (&Tmp-String-1 && (&Tmp-String-1 =~ /^[^:]*:(.*)$/)) {
   update request {
     &Tmp-String-2 := "%{1}"
   }
}


There are plenty of examples in the default config, such as in 
raddb/policy.d/canonicalization

-- 
Matthew


More information about the Freeradius-Users mailing list