From cc686d98fe3b7c1c34ccb97a9b30a57bfc2ab96e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Tue, 2 Mar 2010 20:19:05 +0000 Subject: Add the neccesary foo for radius.inc to work. --- etc/inc/auth.inc | 2 +- etc/inc/openvpn.auth-user.php | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 8ae6003..6dd1c5c 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -1002,7 +1002,7 @@ function radius_backed($username, $passwd, $authcfg = NULL){ foreach ($radiusservers as $radsrv) $rauth->addServer($radsrv['ipaddr'], $radsrv['port'], $radsrv['sharedsecret']); - if (!$rauth->start()) { + if (PEAR::iserError($rauth->start())) { $retvalue['auth_val'] = 1; $retvalue['error'] = $rauth->getError(); if ($debug) diff --git a/etc/inc/openvpn.auth-user.php b/etc/inc/openvpn.auth-user.php index 2e94519..a611f8c 100755 --- a/etc/inc/openvpn.auth-user.php +++ b/etc/inc/openvpn.auth-user.php @@ -42,8 +42,43 @@ */ require_once("config.inc"); +require_once("radius.inc"); require_once("auth.inc"); +require_once("interfaces.inc"); +/** + * Get the NAS-Identifier + * + * We will use our local hostname to make up the nas_id + */ +if (!function_exists("getNasID")) { +function getNasID() +{ + global $g; + + $nasId = ""; + exec("/bin/hostname", $nasId); + if(!$nasId[0]) + $nasId[0] = "{$g['product_name']}"; + return $nasId[0]; +} +} + +/** + * Get the NAS-IP-Address based on the current wan address + * + * Use functions in interfaces.inc to find this out + * + */ +if (!function_exists("getNasIP")) { +function getNasIP() +{ + $nasIp = get_interface_ip(); + if(!$nasIp) + $nasIp = "0.0.0.0"; + return $nasIp; +} +} /* setup syslog logging */ openlog("openvpn", LOG_ODELAY, LOG_AUTH); -- cgit v1.1