pool name per nas AND per user
Alexandre Chapellon
alexandre.chapellon at mana.pf
Wed Oct 15 06:22:58 CEST 2008
tnt at kalik.net a écrit :
>> So In the authorize section i tried to add an update directive where i
>> define a variable which has the result of the sql query as value.
>> Then i want to concatenate this variable with the value of the Pool-Name
>> attribute as defined in the users file and set it as the new value of
>> Pool-Name. I think this would work for what i want to do.
>>
>> update control {
>> "%{MANA-DSL-Type}" = mysqldb:"SELECT value FROM radcheck
>> WHERE attribute='Subscription-Type' AND username='%{User-Name}'"
>> if ("%{MANA-DSL-Type}") {
>> Pool-Name := "%{Pool-Name}""%{ADSL-Type}"
>> }
>> }
>>
>>
>
> Ugh.
>
>
I knew you was going to said that :)
> 1. Forget custom dictionaries. Use already defined temporary attributes
> from freeradius internal dictionary (ie. Tmp-String-0,...,
> Tmp-Integer-0, ... etc.)
>
>
good
> 2. "%{}" goes around the value not attribute name:
>
> Tmp-String-0 = "%{mysqldb:SELECT value FROM...}"
>
understood
> 3. You can't put if inside the control section. You can put update
> control inside if section.
>
> update control {
> read temporary value from the database
> }
>
> if(whatever) {
> update control { ...
>
ok here is what i have now:
# I want the pool to be the concatenation of pool-name as previously
set by huntgroup in
# users file, the expanded value of tmp-String-0 and the string
"_pool" if possible
update control {
Tmp-String-0 = "%{mysqldb:SELECT forfait FROM test WHERE
username='%{User-Name}'}"
Pool-Name := "%{Pool-Name}""%{Tmp-String-0}"_pool
}
Two problems I can see in the debug output:
- 1 - control returns noop (the update control is placed at the end
ofthe authorize section after pap), and so nothing happens...
- 2 - when expanded "%{Pool-Name}" is empty whereas users as been
proceed before the "update control".
Any idea?
here is the revelant debug:
rlm_sql (mysqldb): - sql_xlat
expand: %{User-Name} -> scott
rlm_sql (mysqldb): sql_set_user escaped user --> 'scott'
expand: SELECT forfait FROM test WHERE username='%{User-Name}' ->
SELECT forfait FROM test WHERE username='scott'
expand: /var/log/freeradius/sqltrace.sql ->
/var/log/freeradius/sqltrace.sql
rlm_sql (mysqldb): Reserving sql socket id: 4
rlm_sql_mysql: query: SELECT forfait FROM test WHERE username='scott'
rlm_sql (mysqldb): - sql_xlat finished
rlm_sql (mysqldb): Released sql socket id: 4
expand: %{mysqldb:SELECT forfait FROM test WHERE
username='%{User-Name}'} -> ADSL512
expand: %{Pool-Name} ->
++[control] returns noop
> Ivan Kalik
> Kalik Informatika ISP
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20081014/0f4e99e6/attachment.html>
More information about the Freeradius-Users
mailing list