From 8a47c19021dde35a19f3fe83938d3edcfd6c76d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Wed, 10 Mar 2010 10:40:52 +0000 Subject: Ticket #413. Hanlde cases when no authentication is specified. --- etc/inc/openvpn.inc | 26 ++++++++++++++------------ usr/local/www/vpn_openvpn_server.php | 6 ++++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index c9b4313..766dce3 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -382,19 +382,21 @@ function openvpn_reconfigure($mode,& $settings) { $conf .= "client-cert-not-required\n"; case 'server_tls_user': $conf .= "username-as-common-name\n"; - $authcfgs = explode(",", $settings['authmode']); - $sed = "\$authmodes=array("; - $firstsed = 0; - foreach ($authcfgs as $authcfg) { - if ($firstsed > 0) - $sed .= ","; - $firstsed = 1; - $sed .= "\"{$authcfg}\""; + if (!empty($settings['authmode'])) { + $authcfgs = explode(",", $settings['authmode']); + $sed = "\$authmodes=array("; + $firstsed = 0; + foreach ($authcfgs as $authcfg) { + if ($firstsed > 0) + $sed .= ","; + $firstsed = 1; + $sed .= "\"{$authcfg}\""; + } + $sed .= ");"; + mwexec("/bin/cat /etc/inc/openvpn.auth-user.php | /usr/bin/sed 's/\/\/