diff options
author | jim-p <jimp@pfsense.org> | 2013-08-14 08:48:46 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-08-14 08:52:13 -0400 |
commit | de85521ad54e27c2d0c8212c8ef907a3ac6be76d (patch) | |
tree | bf1be8c913cf4fa56ea69254cb7b965d6285c36e | |
parent | f229148479a2c105f6d6b12587ccb08ecdd1a6da (diff) | |
download | pfsense-de85521ad54e27c2d0c8212c8ef907a3ac6be76d.zip pfsense-de85521ad54e27c2d0c8212c8ef907a3ac6be76d.tar.gz |
Remove prior CSC entry when cleaning up. Fixes #3143
-rw-r--r-- | etc/inc/openvpn.inc | 10 | ||||
-rw-r--r-- | usr/local/www/vpn_openvpn_csc.php | 7 |
2 files changed, 15 insertions, 2 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 2014d1c..6dbf27a 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -838,6 +838,16 @@ function openvpn_delete($mode, & $settings) { mwexec("/bin/rm {$g['varetc_path']}/openvpn/{$mode_id}.*"); } +function openvpn_cleanup_csc($common_name) { + global $g, $config; + if (empty($common_name)) + return; + $fpath = "{$g['varetc_path']}/openvpn-csc/" . basename($common_name); + if (is_file($fpath)) + unlink_if_exists($fpath); + return; +} + function openvpn_resync_csc(& $settings) { global $g, $config; diff --git a/usr/local/www/vpn_openvpn_csc.php b/usr/local/www/vpn_openvpn_csc.php index 80726f4..a3893c9 100644 --- a/usr/local/www/vpn_openvpn_csc.php +++ b/usr/local/www/vpn_openvpn_csc.php @@ -210,11 +210,14 @@ if ($_POST) { $csc['nbdd_server1'] = $pconfig['nbdd_server1']; } - if (isset($id) && $a_csc[$id]) + if (isset($id) && $a_csc[$id]) { + $old_csc_cn = $a_csc[$id]['common_name']; $a_csc[$id] = $csc; - else + } else $a_csc[] = $csc; + if (!empty($old_csc_cn)) + openvpn_cleanup_csc($old_csc_cn); openvpn_resync_csc($csc); write_config(); |