update reply with multiple attributes from mysql table

Alan DeKok aland at deployingradius.com
Fri Apr 21 15:06:28 CEST 2017


On Apr 21, 2017, at 9:00 AM, Little Snooze via Freeradius-Users <freeradius-users at lists.freeradius.org> wrote:
> 
> I'm running freeradius v3.0.4 (and can't run later version).

  You can always run a later version.  The only reason not to is political.

> I would like to update reply with all attributes concerning a specific user, from a mysql table.
> 
> Is there a way to do that?
> 
> I tried this solution, found in previous post, in this mailing list:

  That would be the solution.

> update control {
>                        Tmp-String-0 := "%{sql:SELECT CONCAT(attribute,'#',op,'#',value) from specreply2lns where username = '%{User-Name}'}"
>                }
>                if ("%{explode:&control:Tmp-String-0 #}" > 0) {
>                        foreach &control:Tmp-String-0 {
>                                if ("%{Foreach-Variable-0}" =~ /^([^=]+)=(.*)$/) {
>                                        update reply {
>                                                "%{1}" "%{2}" "%{3}"
>                                        }
>                                }
>                        }
>                }
> 
> pb is "explode" module doesn't available in earlier version of FR  3.0.7 :-(

  Yup.

> Is there a way to do that in unlang and FR V3.0.4?

  Upgrade.

  Or, write a shell script to query SQL and return the columns as individual attributes.

  Alan DeKok.




More information about the Freeradius-Users mailing list