From: jdegraeve Date: Fri, 10 Feb 2006 02:32:44 +0000 (+0000) Subject: Changes in the way we handle the nasId and nasIp X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b3863448f60830c117a1be0486e9467b8335e7b;p=m0n0chwall.git Changes in the way we handle the nasId and nasIp git-svn-id: https://svn.m0n0.ch/wall/trunk@70 e36fee2c-cc09-0410-a7cc-ebac5c6737de --- diff --git a/phpconf/inc/captiveportal.inc b/phpconf/inc/captiveportal.inc index 376a362..47920d4 100644 --- a/phpconf/inc/captiveportal.inc +++ b/phpconf/inc/captiveportal.inc @@ -928,5 +928,33 @@ function getVolume($ruleno) { return $volume; } +/** + * Get the NAS-Identifier + * + * We will use our local hostname to make up the nas_id + */ + +function getNasID() +{ + exec("/bin/hostname", $_nasId); + if(!$nasId[0]) + $nasId[0] = "m0n0wall"; + return $nasId[0]; +} + +/** + * Get the NAS-IP-Address based on the current wan address + * + * Use functions in interfaces.inc to find this out + * + */ + +function getNasIP() +{ + $nasIp = get_current_wan_address(); + if(!$nasIp) + $nasIp = "0.0.0.0"; + return $nasIp; +} ?> diff --git a/phpconf/inc/radius.inc b/phpconf/inc/radius.inc index 4a82e99..8847f6c 100644 --- a/phpconf/inc/radius.inc +++ b/phpconf/inc/radius.inc @@ -103,18 +103,6 @@ class Auth_RADIUS extends PEAR { */ var $password = null; - /** - * NAS-IP-Address - * @var string - */ - var $nasIp = null; - - /** - * NAS-Identifier - * @var array (note: RFC specifies string and PECL specifies integer) - */ - var $nasId = array(); - /** * List of known attributes. * @var array @@ -168,33 +156,6 @@ class Auth_RADIUS extends PEAR { $this->_servers[] = array($servername, $port, $sharedSecret, $timeout, $maxtries); } - /** - * Get the NAS-Identifier - * - * We will use our local hostname to make up the nas_id - */ - function getNasID() - { - exec("/bin/hostname", $_nasId); - if(!$_nasId[0]) - $_nasId[0] = "m0n0wall"; - return $_nasId[0]; - } - - /** - * Get the NAS-IP-Address based on the current wan address - * - * Use functions in interfaces.inc to find this out - * - */ - function getNasIP() - { - $_nasIp = get_current_wan_address(); - if(!$_nasIp) - $_nasIp = "0.0.0.0"; - return $_nasIp; - } - /** * Returns an error message, if an error occurred. * @@ -205,7 +166,7 @@ class Auth_RADIUS extends PEAR { { return radius_strerror($this->res); } - + /** * Sets the configuration-file. * @@ -332,10 +293,10 @@ class Auth_RADIUS extends PEAR { $this->putAttribute(RADIUS_SERVICE_TYPE, RADIUS_LOGIN); // Add support for sending NAS-IP-Address, set this explicitly as an ip_addr - $this->putAttribute(RADIUS_NAS_IP_ADDRESS, $this->getNasIP(), addr); + $this->putAttribute(RADIUS_NAS_IP_ADDRESS, getNasIP(), addr); // Add support for sending NAS-Identifier - $this->putAttribute(RADIUS_NAS_IDENTIFIER, $this->getNasID()); + $this->putAttribute(RADIUS_NAS_IDENTIFIER, getNasID()); }