From 69677d62c5a80e66a6497ed02d0133a84ced0433 Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 12 Mar 2010 13:03:13 +0000 Subject: Do not require the caller to define getNasIP explicitly, intead try to gracefully handle the case. --- etc/inc/radius.inc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'etc') diff --git a/etc/inc/radius.inc b/etc/inc/radius.inc index bcf7342..77535de 100644 --- a/etc/inc/radius.inc +++ b/etc/inc/radius.inc @@ -296,13 +296,21 @@ class Auth_RADIUS extends PEAR { */ function putStandardAttributes() { + global $g; + if (!function_exists("getNasIp")) + $ipaddr = "0.0.0.0"; + else + $ipaddr = getNasIP(); // Add support for sending NAS-IP-Address, set this explicitly as an ip_addr - $this->putAttribute(RADIUS_NAS_IP_ADDRESS, getNasIP(), "addr"); + $this->putAttribute(RADIUS_NAS_IP_ADDRESS, $ipaddr, "addr"); // Add support for sending NAS-Identifier - $this->putAttribute(RADIUS_NAS_IDENTIFIER, getNasID()); - + $nasId = ""; + exec("/bin/hostname", $nasId); + if(!$nasId[0]) + $nasId[0] = "{$g['product_name']}"; + $this->putAttribute(RADIUS_NAS_IDENTIFIER, $nasId[0]); } /** -- cgit v1.1