Hi all,
I’ve a strange problem
with sql counter on freeradius both 1.1.7 and 2.1.5 versions.
Actually executing
SELECT SUM(AcctSessionTime)
FROM radacct WHERE UserName='mauro'
from SQL Server Management
Studio gives me 294841 (Yes, that's a lot of seconds, is a test user)
while the output of radiusd -X
(ver 2.1.5) is:
------------------------------------
rlm_sqlcounter: Entering module
authorize code
sqlcounter_expand:
'SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='%{
User-Name}''
[sessioncounter]
expand: SELECT SUM(AcctSessionTime) FROM radacct WHERE U
serName='%{User-Name}' ->
SELECT SUM(AcctSessionTime) FROM radacct WHERE UserNam
e='mauro'
sqlcounter_expand:
'%{sql:SELECT SUM(AcctSessionTime) FROM radacct WHERE UserNa
me='mauro'}'
[sessioncounter] sql_xlat
[sessioncounter]
expand: %{User-Name} -> mauro
[sessioncounter] sql_set_user
escaped user --> 'mauro'
[sessioncounter]
expand: SELECT SUM(AcctSessionTime) FROM radacct WHERE U
serName='mauro' -> SELECT
SUM(AcctSessionTime) FROM radacct WHERE UserName='maur
o'
[sessioncounter]
expand: /usr/var/log/radius/sqltrace.sql -> /usr/var/log
/radius/sqltrace.sql
rlm_sql (sql): Reserving sql
socket id: 3
query: SELECT
SUM(AcctSessionTime) FROM radacct WHERE UserName='mauro'
[sessioncounter] sql_xlat
finished
rlm_sql (sql): Released sql
socket id: 3
[sessioncounter]
expand: %{sql:SELECT SUM(AcctSessionTime) FROM radacct W
HERE UserName='mauro'} ->
2948
rlm_sqlcounter: Check item is
greater than query result
rlm_sqlcounter: Authorized user
mauro, check_item=3600, counter=2948
rlm_sqlcounter: Sent Reply-Item
for user mauro, Type=Session-Timeout, value=652
++[sessioncounter] returns ok
------------------------------------
That’s' totally wrong
since 294841 is much bigger than 3600 and not smaller... And this happens with
users from different groups and with different SUM(AcctSessionTime). *Every*
time SUM(AcctSessionTime) is bigger than 9999 it looses the fifth digit of the
response, better it looses every digits after the fourth!!!
What’s wrong??? I’d
appreciate any help or ideas.
This happens on two different
Slackware 12.1 and 12.2 machines both with freeradius 1.1.7 and a Slackware
12.2 with freeradius 2.1.5
Mauro Iorio.