diff options
-rw-r--r-- | etc/inc/auth.inc | 2 | ||||
-rwxr-xr-x | etc/inc/openvpn.auth-user.php | 35 |
2 files changed, 36 insertions, 1 deletions
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); |