diff options
author | Matthew Grooms <mgrooms@pfsense.org> | 2008-10-02 22:54:57 +0000 |
---|---|---|
committer | Matthew Grooms <mgrooms@pfsense.org> | 2008-10-02 22:54:57 +0000 |
commit | 164553152641fea88b78ee0865070be2542800c0 (patch) | |
tree | ee75570b4aa799c6cd132d82dff0f29cad034204 /packages/openvpn-client-export | |
parent | 33dd9990a9f6fbaa4ff512bc57b1aec89223ee0b (diff) | |
download | pfsense-packages-164553152641fea88b78ee0865070be2542800c0.tar.gz pfsense-packages-164553152641fea88b78ee0865070be2542800c0.tar.bz2 pfsense-packages-164553152641fea88b78ee0865070be2542800c0.zip |
Correct a bug in the OpenVPN client export package. The config directory
path must exist. If it is not included in the template archive, create it.
I didn't notice this bug before as the template archive contained the
config import directory so it was copied along with other template data.
Without this fix, errors would be thrown but the output would be included
in the download which appended them to the beginning of the executable.
This of course corrupted the file contents. Reported by Chris Buechler.
Diffstat (limited to 'packages/openvpn-client-export')
-rwxr-xr-x | packages/openvpn-client-export/openvpn-client-export.inc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/openvpn-client-export/openvpn-client-export.inc b/packages/openvpn-client-export/openvpn-client-export.inc index 0a386e31..b2286ef2 100755 --- a/packages/openvpn-client-export/openvpn-client-export.inc +++ b/packages/openvpn-client-export/openvpn-client-export.inc @@ -188,16 +188,21 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $uset if (!$cert) return false; - // create temp config directory + // create template directory $tempdir = $g['tmp_path']."/openvpn-export-".uniqid(); mkdir($tempdir, 0700, true); + // create config directory + $confdir = "{$tempdir}/config"; + if (!is_dir($conf_dir)) + mkdir($confdir, 0700, true); + // copy the template directory exec("cp -r {$workdir}/template/* {$tempdir}"); // write cofiguration file $prefix = openvpn_client_export_prefix($srvid); - $cfgfile = "{$tempdir}/config/{$prefix}-config.ovpn"; + $cfgfile = "{$confdir}/{$prefix}-config.ovpn"; $conf = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken); if (!$conf) return false; |