Acct-Type and MySQL

2006-04-11 Thread Luca Corti

Hello,

I'm using MySQL as an authentication and accounting backend. I'd like to
move the accounting for users in a particular group to a different table
in the database.


sql.conf:
-
sql sql_generic {
...
}

sql sql_dialup {
...
}


radiusd.conf:
-

accounting {

...

Acct-Type DIALUP {
sql_dialup
}

sql_generic

}


Now I'd like to specify "Acct-Type := DIALUP" in MySQL for a particular
group of users so that accounting for that group uses sql_dialup.

Is this doable? Do I need to specify Acct-Type as a reply or check item?

thanks


-- 
Luca Corti
PGP Key ID 1F38C091
BOFH excuse of the moment:
The kernel license has expired

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Acct-Type and MySQL

2006-04-11 Thread Nicolas Baradakis
Luca Corti wrote:

> Now I'd like to specify "Acct-Type := DIALUP" in MySQL for a particular
> group of users so that accounting for that group uses sql_dialup.
> 
> Is this doable? Do I need to specify Acct-Type as a reply or check item?

You need to specify Acct-Type during "preacct". It's doable if you
can write an acct_users file to set the Acct-Type.

If you need to do it with MySQL, I've seen a patch on the bugzilla.
http://bugs.freeradius.org/show_bug.cgi?id=264

-- 
Nicolas Baradakis

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Acct-Type and MySQL

2006-04-12 Thread Luca Corti
On Tue, 2006-04-11 at 18:46 +0200, Nicolas Baradakis wrote:
> You need to specify Acct-Type during "preacct". It's doable if you
> can write an acct_users file to set the Acct-Type.
> 
> If you need to do it with MySQL, I've seen a patch on the bugzilla.
> http://bugs.freeradius.org/show_bug.cgi?id=264


Thanks a lot for the pointer. I've patched and installed FR 1.1.1.

Now I have set preaccounting query in my sql.conf file to

sql sql_generic {

...

preaccounting_query = "SELECT Value FROM ${groupcheck_table} WHERE
Attribute = 'Acct-Type' LIMIT 1"
}


and also set in radiusd.conf

preacct {

...

sql_generic

...

}

accounting {

Acct-Type DIALUP {
sql_dialup
}

sql_generic

}


Now my group in MySQL has

++---+---+++
| id | GroupName | Attribute | op | Value  |
++---+---+++
| 25 | MYGROUP   | Acct-Type | := | DIALUP |
++---+---+++


is this supposed to be correct? Unfortunately I get a segfault.


modcall[preacct]: module "acct_unique" returns ok for request 0
rlm_realm: No '@' in User-Name = "gi-na-napoli-a", looking up realm
NULL
rlm_realm: No such realm "NULL"
  modcall[preacct]: module "suffix" returns noop for request 0
radius_xlat:  'SELECT Value FROM radgroupcheck WHERE Attribute =
'Acct-Type' LIMIT 1'
rlm_sql (sql_generic): Reserving sql socket id: 3
Segmentation fault


thanks


-- 
Luca Corti
PGP Key ID 1F38C091
BOFH excuse of the moment:
..disk or the processor is on fire.

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Acct-Type and MySQL

2006-04-14 Thread Nicolas Baradakis
Luca Corti wrote:

> On Tue, 2006-04-11 at 18:46 +0200, Nicolas Baradakis wrote:
> > You need to specify Acct-Type during "preacct". It's doable if you
> > can write an acct_users file to set the Acct-Type.

Did you try to write an acct_users file? Try to distinguish your
group with the value of one or several attributes present in the
Accounting-Request.

Here is an example:
DEFAULT Some-Attribute == "some value", Acct-Type := DIALUP

Here is the documentation:
http://freeradius.org/radiusd/doc/Acct-Type

> > If you need to do it with MySQL, I've seen a patch on the bugzilla.
> > http://bugs.freeradius.org/show_bug.cgi?id=264
> 
> Thanks a lot for the pointer. I've patched and installed FR 1.1.1.

Please try the first method. The second one is a last ressort
solution, since this patch is not part of FreeRADIUS.

> Now I have set preaccounting query in my sql.conf file to
> 
> sql sql_generic {
> ...
> 
> preaccounting_query = "SELECT Value FROM ${groupcheck_table} WHERE
> Attribute = 'Acct-Type' LIMIT 1"
> }

I think the select statement should return 5 columns like the
authorize queries.

> is this supposed to be correct? Unfortunately I get a segfault.
> 
> modcall[preacct]: module "acct_unique" returns ok for request 0
> rlm_realm: No '@' in User-Name = "gi-na-napoli-a", looking up realm
> NULL
> rlm_realm: No such realm "NULL"
>   modcall[preacct]: module "suffix" returns noop for request 0
> radius_xlat:  'SELECT Value FROM radgroupcheck WHERE Attribute =
> 'Acct-Type' LIMIT 1'
> rlm_sql (sql_generic): Reserving sql socket id: 3
> Segmentation fault

I'd suggest to post your problems at the end of bug #224. You're using a
patch which isn't part of FreeRADIUS, so I can't help much.

-- 
Nicolas Baradakis

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html