eksoverzero / whmcs-freeradius

FreeRADIUS server module for WHMCS
111 stars 79 forks source link

cron refers to non-existent "Expiration" attribute #5

Closed eugenefvdm closed 10 years ago

eugenefvdm commented 11 years ago

The CRON uses this Mysql query to see if an account is over limits:

if($usagetotal >= $usagelimit) {        
    $result = mysql_query( "SELECT value FROM radcheck where username = '$user' and attribute = 'Expiration'" );

Expiration is however only set in two place:

  1. function freeradius_SuspendAccount($params){
  2. function freeradius_UnsuspendAccount($params){

It seems essential logic is missing or this attribute must not be checked.

eksoverzero commented 11 years ago

The condition at line 107 is incorrect however:

When the Expiration attribute is set the account will not be able to authenticate if the value is on or past the current date. If the expiration module for FreeRADIUS is enabled.

The Expiration lookup before the insert statement insures that, for example the cron runs every 5 minutes, the Expiration attribute value pair is not inserted every time and the message outputted. Same with the delete statement.