Index is not an integer (segfault)
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Thu Dec 17 15:53:14 CET 2015
> On 17 Dec 2015, at 09:50, Arran Cudbard-Bell <a.cudbardb at freeradius.org> wrote:
>
>>
>> On 17 Dec 2015, at 09:47, Alan DeKok <aland at deployingradius.com> wrote:
>>
>> On Dec 17, 2015, at 4:50 AM, Franks Andy (IT Technical Architecture Manager) <Andy.Franks at sath.nhs.uk> wrote:
>>> Ideally, I'd like to expand in an if statement and compare, i.e. if ( "%{xlat:control:Tmp-Integer-1[%{control:Tmp-Integer-0}]}" > 1 ),
>>
>> Hmm... you shouldn't be able to dynamically expand non-string attributes. The idea behind %{xlat:} is that you could do something like:
>>
>> Tmp-String-0 := "sql: SELECT ..."
>>
>> and then do:
>>
>> Blah = "%{xlat:Tmp-String-0}"
>>
>> i.e. the contents of the %{xlat} expansion are another string to be expanded.
>>
>> You're not using it that way. You're trying to dynamically expand an array reference, and then use that to get an integer. And you're *not* dynamically expanding the integer.
>>
>> So the %{xlat} expansion is not what you want. You want something else. Something which isn't yet implemented.
>>
>> I'll see if I can think of something.
>
> He wants:
>
> &Attribute[&index]
>
> Which is pretty easy to implement.
>
> Just the tmpl parser and the tmpl cursor code needs to change. I believe everything uses that now for resolving array offsets in attributes.
Could also just print non string types to a string and write that to the buffer in the xlat xlat, which is a little nicer than just erroring out.
-Arran
Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS development team
FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 872 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20151217/aa51cf18/attachment.sig>
More information about the Freeradius-Users
mailing list