rlm_sql: default Acct-On/Off query for all backends is somewhat bogus
Stefan Winter
stefan.winter at restena.lu
Tue Apr 29 09:39:43 CEST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
the query states (in variants):
~ accounting_onoff_query = "\
~ UPDATE ${acct_table1} \
~ SET \
~ acctstoptime = '%S', \
~ acctsessiontime = unix_timestamp('%S') - \
~ unix_timestamp(acctstarttime), \
~ acctterminatecause = '%{Acct-Terminate-Cause}', \
~ acctstopdelay = %{%{Acct-Delay-Time}:-0} \
~ WHERE acctsessiontime = 0 \
~ AND acctstoptime = NULL \
~ AND nasipaddress = '%{NAS-IP-Address}' \
~ AND acctstarttime <= '%S'"
and the acctsessiontime = 0 is bad: acctsessiontime gets updated
whenever an interim record updates the session.
The job of the query should be to close all open sessions, not just all
open sessions that have been opened recently enough to not have received
an update yet. I suggest to change the WHERE to
~ WHERE acctstoptime = NULL \
~ AND nasipaddress = '%{NAS-IP-Address}' \
~ AND acctstarttime <= '%S'"
(leaving out the acctsessiontime = 0 constraint)
Greetings,
Stefan Winter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFIFtC/+jm90f8eFWYRAi7SAJ9jFGjLwKl7yyDhSAvWukgKkd8hNQCeKjrj
s4DcCitbUu0FIEx+slNwB/A=
=qNWG
-----END PGP SIGNATURE-----
More information about the Freeradius-Devel
mailing list