On 3 Mar 2015, at 15:52, Alan DeKok <aland@deployingradius.com> wrote:
On Mar 3, 2015, at 3:41 PM, James Wood <james.wood@purplewifi.com> wrote:
How can I split this in the FreeRadius conf in to the three separate variables using # as the delimiter?
Regular expressions. Put the data into a temporary attribute:
update control { Tmp-String-0 := “”" }
if (Tmp-String-0 =~ /^([^#]+)#([^#]+)([^#]+)/) { update reply { Session-Timeout := “%{1}” Idle-Timeout := “%{2}” Filter-Id := “%{3}" } }
That should work…
or update control { Tmp-String-0 := "%{sql:SELECT CONCAT(`Session-Timeout`, '#', `Idle-Timeout`, '#', `Filter-Id`) FROM settings…}" } if ("%{explode:&control:Tmp-String-0 #}" > 0) { update reply { Session-Timeout := &control:Tmp-String-0[0] Idle-Timeout := &control:Tmp-String-0[1] Filter-Id := &control:Tmp-String-0[2] } } or update control { Tmp-String-0 := "%{sql:SELECT CONCAT('Session-Timeout=',`Session-Timeout`, '#Idle-Timeout=', `Idle-Timeout`, '#Filter-Id=', `Filter-Id`) FROM settings…}" } if ("%{explode:&control:Tmp-String-0 #}" > 0) { foreach &control:Tmp-String-0 { if ("%{Foreach-Variable-0}" =~ /^([^=]+)=(.*)$/) { update reply { "%{1}" := "%{2}" } } } } above examples are 3.0.7 only. We really need to sort those mapping sections out. Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS development team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2