Multiple fieldnames in SQL query, was: Perl vs. python vs. Lua?

Dom Latter freeradius-users at
Thu Apr 12 17:15:51 CEST 2018

On 12/04/18 14:53, Alan DeKok wrote:

Thanks for the swift repsonse.

> On Apr 12, 2018, at 9:14 AM, Dom Latter <freeradius-users at> wrote:
>> we are trying to pursue this approach.  I am trying to figure out how to
>> get multiple values out of the database.
>    v3 doesn't really support that well.
>> The only thing I have found on this so far is this page on github:
>    Which as the comments say, was done in 3.1.x (now v4).  It's not available in v3.

Ah, I made the rash assumption that anything mentioned then would by
now be current - but I now understand that v4 is a big rewrite.

>> How do I go about this?
>    You might need to just keep using Python.

Well, we are currently using exec to run a PHP script which doesn't seem
to be a great idea.

So the plan was to move to Perl; but if we did that and ran our mysql 
queries inside a perl script would we still have the performance issues?

I am beginning to think that we can construct a (rather complicated)
query that will return the VLAN that needs to be assigned, or 0 to
indicate rejection, or a magic number that will indicate further
processing required, and use unlang to act appropriately (and call
either a PHP script or in due course a perl script).

The vast majority of requests would fall into the first two camps.

So roughly speaking it would look a bit like this (consider this

update control {
   Vlan-Value := "%{sql:SELECT .... as vlan FROM .... WHERE 
username='%{request:User-Name}' }"

if ( &Vlan-Value == 9999 ) {
else if ( &Vlan-Value > 0 ) {
   update reply {
     Tunnel-Private-Group-Id := Vlan-Value
     # some more attributes here
else {

Although rather than a select statement I think it would be a stored

More information about the Freeradius-Users mailing list