Commit 6f19276d authored by Franco Fichtner's avatar Franco Fichtner

vpn: kill config dirs consistently

parent fc381754
......@@ -35,7 +35,7 @@ function vpn_configure()
return array(
'vpn_pptpd_configure',
'vpn_pppoes_configure',
'vpn_l2tp_configure'
'vpn_l2tp_configure',
);
}
......@@ -111,6 +111,7 @@ function vpn_pptpd_configure()
$pptpdcfg = $config['pptpd'];
killbypid('/var/run/pptp-vpn.pid', 'TERM', true);
mwexec('rm -rf /var/etc/pptp-vpn');
if (!isset($pptpdcfg['mode']) || $pptpdcfg['mode'] == 'off') {
return 0;
......@@ -125,7 +126,6 @@ function vpn_pptpd_configure()
return;
}
mwexec('rm -rf /var/etc/pptp-vpn');
mkdir('/var/etc/pptp-vpn');
switch ($pptpdcfg['mode']) {
......@@ -331,6 +331,7 @@ function vpn_pppoe_configure(&$pppoecfg)
$syscfg = $config['system'];
killbypid("/var/run/pppoe{$pppoecfg['pppoeid']}-vpn.pid", 'TERM', true);
mwexec("rm -rf /var/etc/pppoe{$pppoecfg['pppoeid']}-vpn");
if (!isset($pppoecfg['mode']) || $pppoecfg['mode'] == 'off') {
return 0;
......@@ -340,12 +341,10 @@ function vpn_pppoe_configure(&$pppoecfg)
echo gettext("Configuring PPPoE VPN service...");
}
switch ($pppoecfg['mode']) {
mkdir("/var/etc/pppoe{$pppoecfg['pppoeid']}-vpn");
switch ($pppoecfg['mode']) {
case 'server':
/* create directory if it does not exist */
@mkdir("/var/etc/pppoe{$pppoecfg['pppoeid']}-vpn");
$pppoe_interface = get_real_interface($pppoecfg['interface']);
if ($pppoecfg['paporchap'] == "chap") {
......@@ -537,6 +536,7 @@ function vpn_l2tp_configure()
global $config;
killbypid('/var/run/l2tp-vpn.pid', 'TERM', true);
mwexec('rm -rf /var/etc/l2tp-vpn');
$syscfg = $config['system'];
if (isset($config['l2tp'])) {
......@@ -553,7 +553,7 @@ function vpn_l2tp_configure()
echo gettext('Configuring L2TP VPN service...');
}
@mkdir('/var/etc/l2tp-vpn');
mkdir('/var/etc/l2tp-vpn');
switch (isset($l2tpcfg['mode'])?$l2tpcfg['mode']:null) {
......
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