From d62e837dfb275829a9a7f228c3fce6ca9219e43a Mon Sep 17 00:00:00 2001 From: jdegraeve Date: Fri, 3 Mar 2006 16:30:17 +0000 Subject: [PATCH] Update the doc with 2GB, 4GB wrap mystery and make portal_allow attributes more readable git-svn-id: https://svn.m0n0.ch/wall/trunk@95 e36fee2c-cc09-0410-a7cc-ebac5c6737de --- captiveportal/index.php | 5 ++++- captiveportal/radius_accounting.inc | 7 +++++++ phpconf/inc/radius.inc | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/captiveportal/index.php b/captiveportal/index.php index 2977695..d6dbb72 100755 --- a/captiveportal/index.php +++ b/captiveportal/index.php @@ -290,7 +290,10 @@ function portal_allow($clientip,$clientmac,$clientuser,$password = null, $attrib /* encode password in Base64 just in case it contains commas */ $bpassword = base64_encode($password); - $cpdb[] = array(time(), $ruleno, $clientip, $clientmac, $clientuser, $sessionid, $bpassword, $attributes['session_timeout'], $attributes['idle_timeout'], $attributes['session_terminate_time']); + $cpdb[] = array(time(), $ruleno, $clientip, $clientmac, $clientuser, $sessionid, $bpassword, + $attributes['session_timeout'], + $attributes['idle_timeout'], + $attributes['session_terminate_time']); /* rewrite information to database */ captiveportal_write_db($cpdb); diff --git a/captiveportal/radius_accounting.inc b/captiveportal/radius_accounting.inc index 79adc17..a01cb32 100644 --- a/captiveportal/radius_accounting.inc +++ b/captiveportal/radius_accounting.inc @@ -279,6 +279,13 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius function gigawords($bytes) { + + /* + * RFC2866 Specifies a 32bit unsigned integer, so it should be 4294967295 + * Note that most NAS actually wrap @ 32bit signed which means 2GB. + * The put_int function also is 32bit signed so we are forced to wrap @2GB + */ + // We use BCMath functions since normal integers don't work with so large numbers $gigawords = bcdiv( bcsub( $bytes, remainder($bytes) ) , 2147483647) ; diff --git a/phpconf/inc/radius.inc b/phpconf/inc/radius.inc index c86df3a..c1a6fc3 100644 --- a/phpconf/inc/radius.inc +++ b/phpconf/inc/radius.inc @@ -542,10 +542,10 @@ class Auth_RADIUS extends PEAR { } } - if ($vendor == RADIUS_VENDOR_BAY) { + if ($vendor == 1584) { switch ($attrv) { - case RADIUS_BAY_CES_GROUP: + case 102: $this->attributes['ces_group'] = radius_cvt_string($datav); break; } -- 2.25.1