Query help
Jonathan Bastin
jonathan.bastin at peerpointinternet.co.uk
Tue Oct 9 14:48:43 CEST 2012
I am trying to write a query to look at peoples quota and change their speed biased on these details. So far I have:
if ("%{sql: SELECT radgroupcheck.value FROM radusergroup Inner Join radgroupcheck ON radusergroup.groupname = radgroupcheck.groupname WHERE radusergroup.username = '%{User-Name}' AND radgroupcheck.attribute = 'CS-Total-Octets-Monthly';}"<= "%{sql: SELECT SUM( AcctInputOctets + AcctOutputOctets) FROM radacct WHERE UserName='%{User-Name}' AND AcctStartTime > (DATE_SUB(CURDATE(),INTERVAL DAYOFMONTH(CURDATE())DAY));}"){
update reply {
Reply-Message := "You have reached your transfer limit. Limited bandwitch"
Cisco-AVPair := "lcp:interface-config#1=rate-limit output 524288 98304 196608 conform-action transmit exceed-action drop"
Cisco-AVPair := "lcp:interface-config#2=rate-limit input 524288 98304 196608 conform-action transmit exceed-action drop"
}
}
Issue I get is that I always get
Tue Oct 9 13:43:17 2012 : Info: ++- if ("%{sql: SELECT radgroupcheck.value FROM radusergroup Inner Join radgroupcheck ON radusergroup.groupname = radgroupcheck.groupname WHERE radusergroup.username = '%{User-Name}' AND radgroupcheck.attribute = 'CS-Total-Octets-Monthly';}"<= "%{sql: SELECT SUM( AcctInputOctets + AcctOutputOctets) FROM radacct WHERE UserName='%{User-Name}' AND AcctStartTime > (DATE_SUB(CURDATE(),INTERVAL DAYOFMONTH(CURDATE())DAY));}") returns ok
It doesn't actualy update the reply biased on what the outcome is of the SQL query. Any help would be very much appreciated.
-------------------------------------------------------------------------------------------------------------------------- This email (including any attachments) is intended only for the recipient(s) named above. It may contain confidential or privileged information and should not be read, copied or otherwise used by any other person. If you are not the named recipient please contact the sender and delete the email from your system. The author's incumbent expressions, views and thoughts are their own and not necessarily representative of those of the Peer Point Internet Ltd or associated companies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20121009/f481e673/attachment.html>
More information about the Freeradius-Users
mailing list