On Feb 14, 2022, at 3:49 PM, xaled@web.de wrote:
I want to split the Acct-Session-Id attribute from account stop request at the "/" sign and write the two resulting parts in to two separate columns in a MySQL DB.
The best way to do this is via a regular expression: if (Acct-Session-Id =~ /^(...)/(...)/) { update request { Split-Session-ID += "%{1}" Split-Session-ID += "%{2}" } You'll have to use a real regular expression, of course But it should work.
My limited understanding of the way to approach it is have something like a local variable defined that would take the results of the explode operations and then use this new variable to write the splited content in two columns in a MySQL DB.
The "explode" operation won't create two attributes, though. It will assign the results only to one attribute.
From your comment I seem to get that there is no concept of something like local variables in FreeRADIUS that can be freely defined and operated upon. I would need to have attributes defined within the dictionary that would act as the variables that I need.
Yes.
Given the explanation would it be the right way to proceed? * Defining a new attribute in raddb/dictionary that would hold the results of the splitting.
Yes.
* Add update request section to preacct:
No. Just use a regular expression.
* in MySQL driver-specific configuration use:
'%{Split-Session-ID[1]}', \ '%{Split-Session-ID[2]}', \
That should work. Alan DeKok.