Hi,
I use the following sql counter and run radiusd in full debug mode:
sqlcounter m5 {
counter-name = m5
check-name = Max-M5-Session
sqlmod-inst = sql
key = User-Name
query = "SELECT SUM(IF(HOUR(AcctStartTime)>='02:00:00' AND
HOUR(AcctStopTime)<='06:00:00',5 * AcctSessionTime,0)
+IF(HOUR(AcctStartTime)>='07:00:00' AND HOUR(AcctStopTime)<='13:00:00',2 *
AcctSessionTime,0) +IF(HOUR(AcctStartTime)>='14:00:00' AND
HOUR(AcctStopTime)<='23:00:00',3*AcctSessionTime,0)) FROM radacct WHERE
UserName='%{%k}'"
and get the following error :
rlm_sql: Reserving sql socket id: 2
query: SELECT SUM(IF(HOUR(AcctStartTime)>='02:00:00' AND
HOUR(AcctStopTime)<='06:00:00',5 * AcctSessionTime,0)
+IF(HOUR(AcctStartTime)>='07:00:00' AND HOUR(AcctStopTime)<='13:00:00',2 *
AcctSessionTime,0) +IF(HOUR(AcctStartTime)>='14:00:00' AND HOUR(Acct
MYSQL check_error: 1064 received
rlm_sql: database query error
rlm_sql: Released sql socket id: 2
radius_xlat: ''
rlm_sqlcounter: (Check item - counter) is greater than zero
rlm_sqlcounter: Authorized user saber, check_item=20000000, counter=0
rlm_sqlcounter: Sent Reply-Item for user saber, Type=Session-Timeout, value=20000000
modcall[authorize]: module "m5" returns ok
modcall: group authorize returns ok
also m5 module added in authorize section as well as defining the Max-M5-Session in
the radcheckgroup for a special group and all definitions are OK.
but
when I edit the m5 sql counter and reduse it's conditions, no error message appear:
sqlcounter m5 {
counter-name = m5
check-name = Max-M5-Session
sqlmod-inst = sql
key = User-Name
query = "SELECT SUM(IF(HOUR(AcctStartTime)>='02:00:00' AND
HOUR(AcctStopTime)<='06:00:00',5 * AcctSessionTime,0)
+IF(HOUR(AcctStartTime)>='07:00:00' AND HOUR(AcctStopTime)<='13:00:00',2 *
AcctSessionTime,0) ) FROM radacct WHERE UserName='%{%k}'"
(the above works with error !)
please let me know what's my mistake in the first sqlcounter definition .
does freeradius truncate the tail of huge queries ?
p.s.I want to implement Credit based accounting by using some queries such as the
following in some sqlcounter:
SELECT SUM(IF(HOUR(AcctStartTime)>='02:00:00' AND
HOUR(AcctStopTime)<='06:00:00',50*AcctSessionTime,0)+IF(HOUR(AcctStartTime)>='07:00:00'
AND
HOUR(AcctStopTime)<='13:00:00',100*AcctSessionTime,0)+IF(HOUR(AcctStartTime)>='14:00:00'
AND
HOUR(AcctStopTime)<='23:00:00',150*AcctSessionTime,0)+IF(HOUR(AcctStartTime)>='00:00:00'
AND HOUR(AcctStopTime)<='01:00:00',120*AcctSessionTime,0) ) from radacct WHERE
username='herasat'
the above query run with no problem in the mysql invironment but doesn't work in
sqlcounter on freeradius with some changes like substituting username='herasat' to
UserName='%{%k}'
any Idea about such a queries ?
Best Regards,
M. Roomi
_____________________________________________________________
Promote your group and strengthen ties to your members with [EMAIL PROTECTED] by
Everyone.net http://www.everyone.net/?btn=tag
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html