From 3928f52b397bc5c2d8c10d401bbd1258fc826df3 Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Fri, 5 Sep 2014 08:09:54 +0200 Subject: [PATCH] fw-groups: cleanup checksubnets Now the checksubnets function from general-functions.pl is used. --- html/cgi-bin/fwhosts.cgi | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi index 1f96336a6b..4e8d2347c4 100644 --- a/html/cgi-bin/fwhosts.cgi +++ b/html/cgi-bin/fwhosts.cgi @@ -291,42 +291,14 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' ) $errormessage=$errormessage.$Lang::tr{'fwhost err sub32'}; } if($fwhostsettings{'error'} ne 'on'){ - #check if we use one of ipfire's networks (green,orange,blue) - if (($ownnet{'GREEN_NETADDRESS'} ne '' && $ownnet{'GREEN_NETADDRESS'} ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'GREEN_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'GREEN_NETMASK'})) - { - $errormessage=$errormessage.$Lang::tr{'ccd err green'}."
"; - $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'}; - if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';} - } - if (($ownnet{'ORANGE_NETADDRESS'} ne '' && $ownnet{'ORANGE_NETADDRESS'} ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'ORANGE_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'ORANGE_NETMASK'})) - { - $errormessage=$errormessage.$Lang::tr{'ccd err orange'}."
"; - $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'}; - if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';} - } - if (($ownnet{'BLUE_NETADDRESS'} ne '' && $ownnet{'BLUE_NETADDRESS'} ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'BLUE_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'BLUE_NETMASK'})) - { - $errormessage=$errormessage.$Lang::tr{'ccd err blue'}."
"; - $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'}; + my $fullip="$fwhostsettings{'IP'}/".&General::iporsubtocidr($fwhostsettings{'SUBNET'}); + $errormessage=$errormessage.&General::checksubnets($fwhostsettings{'HOSTNAME'},$fullip,""); if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';} - } - if (($ownnet{'RED_NETADDRESS'} ne '' && $ownnet{'RED_NETADDRESS'} ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'RED_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'RED_NETMASK'})) - { - $errormessage=$errormessage.$Lang::tr{'ccd err red'}."
"; - $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'}; - if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';} - } } #only check plausi when no error till now if (!$errormessage){ &plausicheck("editnet"); } - #check if network ip is part of an already used one - if(&checksubnet(\%customnetwork)) - { - $errormessage=$errormessage.$Lang::tr{'fwhost err partofnet'}; - $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'}; - } if($fwhostsettings{'actualize'} eq 'on' && $fwhostsettings{'newnet'} ne 'on' && $errormessage) { $fwhostsettings{'actualize'} = ''; @@ -417,6 +389,7 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' ) &addnet; &viewtablenet; }else { + $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'}; &addnet; &viewtablenet; } -- 2.39.5