Commit 92d7bce2 authored by Ad Schellevis's avatar Ad Schellevis

(openvpn export) make sure we remove the top level temp dir for Viscosity exports

parent 41b9d3fe
...@@ -464,9 +464,6 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead ...@@ -464,9 +464,6 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead
{ {
global $config; global $config;
$uniq = uniqid();
$tempdir = "/tmp/openvpn-export-{$uniq}";
$validconfig = openvpn_client_export_validate_config($srvid, $usrid, $crtid); $validconfig = openvpn_client_export_validate_config($srvid, $usrid, $crtid);
if (!$validconfig) { if (!$validconfig) {
return false; return false;
...@@ -475,11 +472,9 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead ...@@ -475,11 +472,9 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead
list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig; list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig;
// create template directory // create template directory
$baseTempDir = "/tmp/openvpn-export-" . uniqid();
$tempdir = $baseTempDir . "/Viscosity.visc";
mkdir($tempdir, 0700, true); mkdir($tempdir, 0700, true);
mkdir($tempdir . "/Viscosity.visc", 0700, true);
// Append new Viscosity.visc directory on top
$tempdir = $tempdir . "/Viscosity.visc/";
// write cofiguration file // write cofiguration file
$prefix = openvpn_client_export_prefix($srvid, $usrid, $crtid); $prefix = openvpn_client_export_prefix($srvid, $usrid, $crtid);
...@@ -570,7 +565,7 @@ EOF; ...@@ -570,7 +565,7 @@ EOF;
} }
// Remove temporary directory // Remove temporary directory
exec("rm -rf {$tempdir}"); exec("rm -rf {$baseTempDir}");
return $outputfile; return $outputfile;
} }
......
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