From bc0781c4440f976e68b2032b8bf2e09488abacd2 Mon Sep 17 00:00:00 2001 From: jim-p Date: Tue, 2 Oct 2012 14:32:32 -0400 Subject: Add export option for OpenVPN 2.3 beta client as well as the existing one. --- .../openvpn-client-export.inc | 17 +++++++++-- .../openvpn-client-export/vpn_openvpn_export.php | 33 ++++++++++++++++------ 2 files changed, 39 insertions(+), 11 deletions(-) (limited to 'config/openvpn-client-export') diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index 1c556d10..a96c6638 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -411,15 +411,28 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese } } -function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $quoteservercn, $usetoken, $outpass, $proxy, $advancedoptions) { +function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $quoteservercn, $usetoken, $outpass, $proxy, $advancedoptions, $openvpn_version = "2.1") { global $config, $g, $input_errors; $uname_p = trim(exec("uname -p")); + switch ($openvpn_version) { + case "2.3-x86": + $client_install_exe = "openvpn-install-2.3-i686.exe"; + break; + case "2.3-x64": + $client_install_exe = "openvpn-install-2.3-x86_64.exe"; + break; + default: + $client_install_exe = "openvpn-install-2.2.exe"; + } + $ovpndir = "/usr/local/share/openvpn"; $workdir = "{$ovpndir}/client-export"; - if (!file_exists($workdir . "/template/openvpn-install.exe")) + if (!file_exists($workdir . "/template/{$client_install_exe}")) openvpn_client_export_install(); + exec("/bin/cp {$workdir}/template/{$client_install_exe} {$workdir}/template/openvpn-install.exe"); + $validconfig = openvpn_client_export_validate_config($srvid, $usrid, $crtid); if ($validconfig) { list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig; diff --git a/config/openvpn-client-export/vpn_openvpn_export.php b/config/openvpn-client-export/vpn_openvpn_export.php index 811fb62f..414ad7d0 100755 --- a/config/openvpn-client-export/vpn_openvpn_export.php +++ b/config/openvpn-client-export/vpn_openvpn_export.php @@ -211,9 +211,9 @@ if (!empty($act)) { $exp_path = viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $useaddr, $quoteservercn, $usetoken, $password, $proxy, $advancedoptions); } - if($act == "inst") { + if(substr($act, 0, 4) == "inst") { $exp_name = urlencode($exp_name."-install.exe"); - $exp_path = openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $quoteservercn, $usetoken, $password, $proxy, $advancedoptions); + $exp_path = openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $quoteservercn, $usetoken, $password, $proxy, $advancedoptions, substr($act, 5)); } if (!$exp_path) { @@ -306,7 +306,7 @@ function download_begin(act, i, j) { var pass = document.getElementById("pass").value; var conf = document.getElementById("conf").value; - if (usepass && (act == "inst")) { + if (usepass && (act.substring(0,4) == "inst")) { if (!pass || !conf) { alert("The password or confirm field is empty"); return; @@ -408,8 +408,13 @@ function server_changed() { cell2.innerHTML += "Inline Configuration"; cell2.innerHTML += "
"; cell2.innerHTML += "Configuration archive"; - cell2.innerHTML += "
"; - cell2.innerHTML += "Windows Installer"; + cell2.innerHTML += "
Windows Installers:
"; + cell2.innerHTML += "   "; + cell2.innerHTML += "2.2"; + cell2.innerHTML += "   "; + cell2.innerHTML += "2.3-x86 (Beta)"; +// cell2.innerHTML += "   "; +// cell2.innerHTML += "2.3-x64 (Beta)"; cell2.innerHTML += "
"; cell2.innerHTML += "Viscosity Bundle"; } @@ -432,8 +437,13 @@ function server_changed() { cell2.innerHTML += "Inline Configuration"; cell2.innerHTML += "
"; cell2.innerHTML += "Configuration archive"; - cell2.innerHTML += "
"; - cell2.innerHTML += "Windows Installer"; + cell2.innerHTML += "
Windows Installers:
"; + cell2.innerHTML += "   "; + cell2.innerHTML += "2.2"; + cell2.innerHTML += "   "; + cell2.innerHTML += "2.3-x86 (Beta)"; +// cell2.innerHTML += "   "; +// cell2.innerHTML += "2.3-x64 (Beta)"; cell2.innerHTML += "
"; cell2.innerHTML += "Viscosity Bundle"; if (servers[index][2] == "server_tls") { @@ -463,8 +473,13 @@ function server_changed() { cell2.innerHTML += "Inline Configuration"; cell2.innerHTML += "
"; cell2.innerHTML += "Configuration archive"; - cell2.innerHTML += "
"; - cell2.innerHTML += "Windows Installer"; + cell2.innerHTML += "
Windows Installers:
"; + cell2.innerHTML += "   "; + cell2.innerHTML += "2.2"; + cell2.innerHTML += "   "; + cell2.innerHTML += "2.3-x86 (Beta)"; +// cell2.innerHTML += "   "; +// cell2.innerHTML += "2.3-x64 (Beta)"; cell2.innerHTML += "
"; cell2.innerHTML += "Viscosity Bundle"; } -- cgit v1.2.3