Commit 891f7abf authored by Franco Fichtner's avatar Franco Fichtner

openvpn: improve scoping for vars; closes #664

In languages where scoping matters this would be really iffy...
parent 1699d318
......@@ -145,12 +145,12 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
$conf = "";
$validconfig = openvpn_client_export_validate_config($srvid, $usrid, $crtid);
if ($validconfig) {
list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig;
} else {
if (!$validconfig) {
return false;
}
list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig;
// determine basic variables
$remotes = openvpn_client_export_build_remote_lines($settings, $useaddr, $interface, $expformat, $nl);
$server_port = $settings['local_port'];
......@@ -463,12 +463,12 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
$workdir = "{$ovpndir}/client-export";
$validconfig = openvpn_client_export_validate_config($srvid, $usrid, $crtid);
if ($validconfig) {
list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig;
} else {
if (!$validconfig) {
return false;
}
list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig;
// create template directory
$tempdir = "/tmp//openvpn-export-".uniqid();
mkdir($tempdir, 0700, true);
......@@ -570,12 +570,12 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead
$zipfile = "/tmp/{$uniq}-Viscosity.visc.zip";
$validconfig = openvpn_client_export_validate_config($srvid, $usrid, $crtid);
if ($validconfig) {
list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig;
} else {
if (!$validconfig) {
return false;
}
list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig;
// create template directory
mkdir($tempdir, 0700, true);
mkdir($tempdir . "/Viscosity.visc", 0700, true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment