vpnmain.cgi - Replace spaces with tab characters and fix indentation

Replaced spaces with tab characters. Fixed indentation.

This is based on http://patchwork.ipfire.org/patch/88/ so that patch must be applied before.

Signed-off-by: Lars Schuhmacher <larsen007@web.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Lars Schuhmacher
2015-09-25 23:01:17 +02:00
committed by Michael Tremer
parent ed1d0fbdbe
commit 624615ee07

View File

@@ -40,8 +40,7 @@ undef (@dummy);
###
### Initialize variables
###
my $sleepDelay = 4; # after a call to ipsecctrl S or R, wait this delay (seconds) before reading status
# (let the ipsec do its job)
my $sleepDelay = 4; # after a call to ipsecctrl S or R, wait this delay (seconds) before reading status (let the ipsec do its job)
my %netsettings=();
our %cgiparams=();
our %vpnsettings=();
@@ -138,8 +137,7 @@ sub vpnenabled {
### old version: maintain serial number to one, without explication.
### this: let the counter go, so that each cert is numbered.
###
sub cleanssldatabase
{
sub cleanssldatabase {
if (open(FILE, ">${General::swroot}/certs/serial")) {
print FILE "01";
close FILE;
@@ -152,8 +150,7 @@ sub cleanssldatabase
unlink ("${General::swroot}/certs/serial.old");
unlink ("${General::swroot}/certs/01.pem");
}
sub newcleanssldatabase
{
sub newcleanssldatabase {
if (! -s "${General::swroot}/certs/serial" ) {
open(FILE, ">${General::swroot}/certs/serial");
print FILE "01";
@@ -288,8 +285,8 @@ sub writeipsecfiles {
print CONF "\tleftsubnet=$cidr_net\n";
print CONF "\tleftfirewall=yes\n";
print CONF "\tlefthostaccess=yes\n";
print CONF "\tright=$lconfighash{$key}[10]\n";
if ($lconfighash{$key}[3] eq 'net') {
my $cidr_net=&General::ipcidr($lconfighash{$key}[11]);
print CONF "\trightsubnet=$cidr_net\n";
@@ -349,6 +346,7 @@ sub writeipsecfiles {
if (! $lconfighash{$key}[29]) {
$lconfighash{$key}[29] = "ikev1";
}
print CONF "\tkeyexchange=$lconfighash{$key}[29]\n";
# Lifetimes
@@ -442,6 +440,7 @@ if ($ENV{"REMOTE_ADDR"} eq "") {
###
if ($cgiparams{'ACTION'} eq $Lang::tr{'save'} && $cgiparams{'TYPE'} eq '' && $cgiparams{'KEY'} eq '') {
&General::readhash("${General::swroot}/vpn/settings", \%vpnsettings);
unless (&General::validfqdn($cgiparams{'VPN_IP'}) || &General::validip($cgiparams{'VPN_IP'})
|| $cgiparams{'VPN_IP'} eq '%defaultroute' ) {
$errormessage = $Lang::tr{'invalid input for hostname'};
@@ -509,8 +508,8 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'save'} && $cgiparams{'TYPE'} eq '' && $cg
<tr>
<td align='center'>
<input type='hidden' name='AREUSURE' value='yes' />
<b><font color='${Header::colourred}'>$Lang::tr{'capswarning'}</font></b>:
$Lang::tr{'resetting the vpn configuration will remove the root ca, the host certificate and all certificate based connections'}</td>
<b><font color='${Header::colourred}'>$Lang::tr{'capswarning'}</font></b>:&nbsp;$Lang::tr{'resetting the vpn configuration will remove the root ca, the host certificate and all certificate based connections'}
</td>
</tr><tr>
<td align='center'>
<input type='submit' name='ACTION' value='$Lang::tr{'remove x509'}' />
@@ -684,8 +683,7 @@ END
<input type='hidden' name='AREUSURE' value='yes' /></td>
</tr><tr>
<td align='center'>
<b><font color='${Header::colourred}'>$Lang::tr{'capswarning'}</font></b>
$Lang::tr{'connections are associated with this ca. deleting the ca will delete these connections as well.'}</td>
<b><font color='${Header::colourred}'>$Lang::tr{'capswarning'}</font></b>&nbsp;$Lang::tr{'connections are associated with this ca. deleting the ca will delete these connections as well.'}</td>
</tr><tr>
<td align='center'>
<input type='submit' name='ACTION' value='$Lang::tr{'remove ca certificate'}' />
@@ -1797,7 +1795,7 @@ END
$confighash{$key}[27] = $cgiparams{'DPD_ACTION'};
$confighash{$key}[29] = $cgiparams{'IKE_VERSION'};
#dont forget advanced value
# don't forget advanced value
$confighash{$key}[18] = $cgiparams{'IKE_ENCRYPTION'};
$confighash{$key}[19] = $cgiparams{'IKE_INTEGRITY'};
$confighash{$key}[20] = $cgiparams{'IKE_GROUPTYPE'};
@@ -2206,12 +2204,10 @@ if(($cgiparams{'ACTION'} eq $Lang::tr{'advanced'}) ||
goto ADVANCED_ERROR;
}
if (
($cgiparams{'COMPRESSION'} !~ /^(|on|off)$/) ||
if (($cgiparams{'COMPRESSION'} !~ /^(|on|off)$/) ||
($cgiparams{'FORCE_MOBIKE'} !~ /^(|on|off)$/) ||
($cgiparams{'ONLY_PROPOSED'} !~ /^(|on|off)$/) ||
($cgiparams{'PFS'} !~ /^(|on|off)$/)
){
($cgiparams{'PFS'} !~ /^(|on|off)$/)) {
$errormessage = $Lang::tr{'invalid input'};
goto ADVANCED_ERROR;
}
@@ -2278,7 +2274,6 @@ if(($cgiparams{'ACTION'} eq $Lang::tr{'advanced'}) ||
if (!$cgiparams{'DPD_TIMEOUT'}) {
$cgiparams{'DPD_TIMEOUT'} = 120;
}
}
ADVANCED_ERROR:
@@ -2765,8 +2760,7 @@ END
my $active = "<b><font color='#FFFFFF'>$Lang::tr{'capsclosed'}</font></b>";
foreach my $line (@status) {
if (($line =~ /\"$confighash{$key}[1]\".*IPsec SA established/) ||
($line =~ /$confighash{$key}[1]\{.*INSTALLED/))
{
($line =~ /$confighash{$key}[1]\{.*INSTALLED/)) {
$col1="bgcolor='${Header::colourgreen}'";
$active = "<b><font color='#FFFFFF'>$Lang::tr{'capsopen'}</font></b>";
}
@@ -2797,7 +2791,8 @@ END
</form>
</td>
END
; } else {
;
} else {
print "<td width='2%' $col>&nbsp;</td>";
}
if ($confighash{$key}[4] eq 'cert' && -f "${General::swroot}/certs/$confighash{$key}[1].p12") {
@@ -2810,7 +2805,8 @@ END
</form>
</td>
END
; } elsif (($confighash{$key}[4] eq 'cert') && ($confighash{$key}[2] ne '%auth-dn')) {
;
} elsif (($confighash{$key}[4] eq 'cert') && ($confighash{$key}[2] ne '%auth-dn')) {
print <<END
<td align='center' $col>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
@@ -2820,7 +2816,8 @@ END
</form>
</td>
END
; } else {
;
} else {
print "<td width='2%' $col>&nbsp;</td>";
}
print <<END