mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
OpenVPN: Fix for N2N plausibility checks
Fixes #12335 If no N2N name has been set, no directory and config has been created so it can not be deleted. 'goto VPNCONF_ERROR;' has been missing for N2N checks. Fixed also code formatting. Signed-off-by: Erik Kapfer <ummeegge@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
committed by
Arne Fitzenreiter
parent
4bdddf8d11
commit
73735ad99c
@@ -3770,41 +3770,42 @@ if ($cgiparams{'TYPE'} eq 'host') {
|
||||
#CCD End
|
||||
|
||||
|
||||
if ($cgiparams{'TYPE'} !~ /^(host|net)$/) {
|
||||
$errormessage = $Lang::tr{'connection type is invalid'};
|
||||
if ($cgiparams{'TYPE'} eq 'net') {
|
||||
unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
|
||||
rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
|
||||
}
|
||||
goto VPNCONF_ERROR;
|
||||
if ($cgiparams{'TYPE'} !~ /^(host|net)$/) {
|
||||
$errormessage = $Lang::tr{'connection type is invalid'};
|
||||
if ($cgiparams{'TYPE'} eq 'net') {
|
||||
unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
|
||||
rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
|
||||
goto VPNCONF_ERROR;
|
||||
}
|
||||
goto VPNCONF_ERROR;
|
||||
}
|
||||
|
||||
|
||||
if ($cgiparams{'NAME'} !~ /^[a-zA-Z0-9]+$/) {
|
||||
$errormessage = $Lang::tr{'name must only contain characters'};
|
||||
if ($cgiparams{'TYPE'} eq 'net') {
|
||||
unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
|
||||
rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
|
||||
}
|
||||
goto VPNCONF_ERROR;
|
||||
}
|
||||
$errormessage = $Lang::tr{'name must only contain characters'};
|
||||
if ($cgiparams{'TYPE'} eq 'net') {
|
||||
goto VPNCONF_ERROR;
|
||||
}
|
||||
goto VPNCONF_ERROR;
|
||||
}
|
||||
|
||||
if ($cgiparams{'NAME'} =~ /^(host|01|block|private|clear|packetdefault)$/) {
|
||||
$errormessage = $Lang::tr{'name is invalid'};
|
||||
if ($cgiparams{'TYPE'} eq 'net') {
|
||||
unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
|
||||
rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
|
||||
}
|
||||
goto VPNCONF_ERROR;
|
||||
$errormessage = $Lang::tr{'name is invalid'};
|
||||
if ($cgiparams{'TYPE'} eq 'net') {
|
||||
unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
|
||||
rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
|
||||
goto VPNCONF_ERROR;
|
||||
}
|
||||
goto VPNCONF_ERROR;
|
||||
}
|
||||
|
||||
if (length($cgiparams{'NAME'}) >60) {
|
||||
$errormessage = $Lang::tr{'name too long'};
|
||||
if ($cgiparams{'TYPE'} eq 'net') {
|
||||
unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
|
||||
rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
|
||||
}
|
||||
goto VPNCONF_ERROR;
|
||||
$errormessage = $Lang::tr{'name too long'};
|
||||
if ($cgiparams{'TYPE'} eq 'net') {
|
||||
unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
|
||||
rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
|
||||
goto VPNCONF_ERROR;
|
||||
}
|
||||
goto VPNCONF_ERROR;
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
Reference in New Issue
Block a user