unlang, variable and SQL (freeradius 3.0.15)

Alan DeKok aland at deployingradius.com
Tue Oct 3 16:55:17 CEST 2017


On Oct 3, 2017, at 10:19 AM, <petr.linke at seznam.cz> <petr.linke at seznam.cz> wrote
> I try to store result from SQL into local variable to eliminate running same
> queries at time.
> 
> I prepare following scenario:
> 
> 1/ define new attribute (will be used for store the result from SQL) in the 
> dictionary, attribute type is string (e.g. ATTRIBUTE       SQLRESULT        
>         3000    string)
> 2/ in inner tunnel post-auth section:
> update control {
>                &SQLRESULT = "%{sql::SELECT count(*) from some_table where ..
> .}"
> }

  Which places it into the control list.

> if ( %{integer:SQLRESULT} == some_value ) {

  Which looks for it in the request list.  Use control:SQLRESULT instead.

  Also, if the attribute is an integer, just define it as an integer in the dictionaries.  Don't define it as a string and then convert it to an integer.

  Alan DeKok.




More information about the Freeradius-Users mailing list