Reverse string concatenation for multiple attributes

Franks Andy (IT Technical Architecture Manager) Andy.Franks at sath.nhs.uk
Thu Dec 10 20:19:14 CET 2015


Hi Arran,
  Nice one. Looking for sql map stuff i found this thread
https://github.com/FreeRADIUS/freeradius-server/issues/984
  .. It seems to indicate predefinition in a module, which is ok but your example looks more inline. I am guessing the sql bit matches the module instance name here and the query is loaded in a variable? 
Would an xlat type section be therefore

Map sql_instname &var {
                Control:Tmp-string-0 += myfieldname
}

Or am i way out and it needs module definition?
Thanks!
________________________________________
From: Freeradius-Users [freeradius-users-bounces+andy.franks=sath.nhs.uk at lists.freeradius.org] on behalf of Arran Cudbard-Bell [a.cudbardb at freeradius.org]
Sent: 10 December 2015 18:06
To: FreeRadius users mailing list
Subject: Re: Reverse string concatenation for multiple attributes

> On 10 Dec 2015, at 12:57, Arran Cudbard-Bell <a.cudbardb at freeradius.org> wrote:
>
>
>> On 10 Dec 2015, at 12:42, Franks Andy (IT Technical Architecture Manager) <Andy.Franks at sath.nhs.uk> wrote:
>>
>> Hi all,
>> I'm trying to do something a bit fiddly. I'm sure I've asked this before but google doesn't help.
>> Can we pass back multiple attributes from a sql xlat yet on 3.1.0?
>> If not, is there a reverse of %{Attribute-Name[*]} that could translate my value1\nvalue2 from an SQL stored procedure into attribute[1]=value1, attribute[2]=value2 etc?
>> If not, has anyone come up with a clean way to iterate through and do the equivalent via += a number of times?
>> It seems I can use explode to get the number of delimiters (maybe I'm using it wrongly).
>>
>> Maybe I'm missing something REALLY simple. Wouldn't be the first time. :-~
>
> You can do it with maps IIRC:
>
> map sql <query> {
>       <radius attr> += <sql column>
> }

And then use the pairs xlat.

-Arran

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS development team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2




More information about the Freeradius-Users mailing list