]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
fwhosts.cgi: Show in which firewall rule objects are being used
authorPeer Dietzmann <dietzmann@brecht-schule.hamburg>
Mon, 23 Jun 2025 17:16:54 +0000 (17:16 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Jun 2025 16:02:36 +0000 (16:02 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
12 files changed:
doc/language_issues.en
doc/language_issues.es
doc/language_issues.fr
doc/language_issues.it
doc/language_issues.nl
doc/language_issues.pl
doc/language_issues.ru
doc/language_issues.tr
doc/language_missings
html/cgi-bin/fwhosts.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl

index 9965724563cedc6bda83b058efe92b2944e55bca..7d72fa99bdec4892635c12cc4299eedd59d62acc 100644 (file)
@@ -78,6 +78,7 @@ WARNING: untranslated string: TOS rule = TOS rule
 WARNING: untranslated string: The class number does not match the specified interface. = The class number does not match the specified interface.
 WARNING: untranslated string: The destination IP address is invalid. = The destination IP address is invalid.
 WARNING: untranslated string: The source IP address is invalid. = The source IP address is invalid.
+WARNING: untranslated string: Unused = Unused
 WARNING: untranslated string: WakeOnLan = Wake On Lan
 WARNING: untranslated string: a ca certificate with this name already exists = A CA certificate with this name already exists.
 WARNING: untranslated string: a connection with this common name already exists = A connection with this common name already exists.
index 68836302a05ad09849811af607d1d2277f788750..e90acf9d97cfc8831f7b0d4042dcee5d31dc4610 100644 (file)
@@ -980,6 +980,7 @@ WARNING: translation string unused: zoneconf val vlan tag range error
 WARNING: translation string unused: zoneconf val zoneslave amount error
 WARNING: untranslated string: Captive ACTIVATE = unknown string
 WARNING: untranslated string: Captive clients = unknown string
+WARNING: untranslated string: Unused = Unused
 WARNING: untranslated string: ca name must only contain characters and spaces = unknown string
 WARNING: untranslated string: dns servers = DNS Servers
 WARNING: untranslated string: enable disable client = unknown string
index 80341a1c37ea6ceffd6812500784149ebbed1b06..db91be7fee16bbe655c3f715785a4c13ee2d06d0 100644 (file)
@@ -959,6 +959,7 @@ WARNING: translation string unused: zoneconf val vlan amount assignment error
 WARNING: translation string unused: zoneconf val vlan tag assignment error
 WARNING: translation string unused: zoneconf val vlan tag range error
 WARNING: translation string unused: zoneconf val zoneslave amount error
+WARNING: untranslated string: Unused = Unused
 WARNING: untranslated string: allowed subnets = Allowed Subnets
 WARNING: untranslated string: bypassed = Bypassed
 WARNING: untranslated string: ca name must only contain characters and spaces = unknown string
index 4ec3545ba6b38f40ed33053f8c09fbcb84e058d6..facb0c2563ab26885a9d14e989eb030d6ba8e7a7 100644 (file)
@@ -932,6 +932,7 @@ WARNING: untranslated string: Captive vouchervalid = Allowed time for this coupo
 WARNING: untranslated string: Captive wrong type = Uploaded file has wrong filetype
 WARNING: untranslated string: MTU settings = MTU settings:
 WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
+WARNING: untranslated string: Unused = Unused
 WARNING: untranslated string: access point name = Access Point Name
 WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
 WARNING: untranslated string: access point name is required = Access Point Name is required
index 56c6dadf6152be2ced3e0b94d6b291b64d1224e9..40710c698fea5ce73f3eccfeadfa185533ca2b2f 100644 (file)
@@ -932,6 +932,7 @@ WARNING: untranslated string: Captive vouchervalid = Allowed time for this coupo
 WARNING: untranslated string: Captive wrong type = Uploaded file has wrong filetype
 WARNING: untranslated string: MTU settings = MTU settings:
 WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
+WARNING: untranslated string: Unused = Unused
 WARNING: untranslated string: access point name = Access Point Name
 WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
 WARNING: untranslated string: access point name is required = Access Point Name is required
index 6ccb0a4974d8ae71af4c37a53a387515f2631dcf..ef464100c25117ae1837d8e67e5b412266b77825 100644 (file)
@@ -848,6 +848,7 @@ WARNING: untranslated string: MB read = MB read
 WARNING: untranslated string: MB written = MB written
 WARNING: untranslated string: MTU settings = MTU settings:
 WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
+WARNING: untranslated string: Unused = Unused
 WARNING: untranslated string: access point name = Access Point Name
 WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
 WARNING: untranslated string: access point name is required = Access Point Name is required
index 8a689daa79ae5ee1b7721e635b28024b21557b93..d4f669b1b8442fe1896c0caec94453dd0009e354 100644 (file)
@@ -843,6 +843,7 @@ WARNING: untranslated string: MB read = MB read
 WARNING: untranslated string: MB written = MB written
 WARNING: untranslated string: MTU settings = MTU settings:
 WARNING: untranslated string: Number of Countries for the pie chart = Number of Countries for the pie chart
+WARNING: untranslated string: Unused = Unused
 WARNING: untranslated string: access point name = Access Point Name
 WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
 WARNING: untranslated string: access point name is required = Access Point Name is required
index e79fe13883c76e3833cce3902c48020434ed1aa4..f557f9a04b5665af67065df6d4cb5697cb87ffde 100644 (file)
@@ -925,6 +925,7 @@ WARNING: translation string unused: year-graph
 WARNING: translation string unused: yearly firewallhits
 WARNING: untranslated string: Captive clients = unknown string
 WARNING: untranslated string: Captive delete logo = Delete Logo
+WARNING: untranslated string: Unused = Unused
 WARNING: untranslated string: access point name = Access Point Name
 WARNING: untranslated string: access point name is invalid = Access Point Name is invalid
 WARNING: untranslated string: access point name is required = Access Point Name is required
index cd005f45ac2c4c9121b1a01d2307b4f0d7beb945..8487c8a26642fad42b1f1bdc82b4a52649faa78c 100644 (file)
 < dns servers
 < ids provider eol
 < online
+< Unused
 ############################################################################
 # Checking cgi-bin translations for language: fr                           #
 ############################################################################
 < system time
 < timeformat
 < total
+< Unused
 < upload fcdsl.o
 < warning
 < wg
 < unblock all
 < uncheck all
 < unlimited
+< Unused
 < update ruleset
 < updxlrtr passive mode
 < uplink bit rate
 < unblock all
 < uncheck all
 < unlimited
+< Unused
 < update ruleset
 < updxlrtr passive mode
 < uplink bit rate
 < unblock all
 < uncheck all
 < unlimited
+< Unused
 < update ruleset
 < updxlrtr passive mode
 < updxlrtr sources
 < unblock all
 < uncheck all
 < unlimited
+< Unused
 < update ruleset
 < updxlrtr passive mode
 < updxlrtr sources
 < traffic stat title
 < transfers
 < transport mode does not support vti
+< Unused
 < update ruleset
 < updxlrtr passive mode
 < user management
index e92ef6853248ab9f827fcd0e9fca5371fcc0253f..6b4e22159a292de337d79b22677f33ebd4e64752 100644 (file)
@@ -1932,7 +1932,7 @@ sub viewtablenet
                }else{
                        print<<END;
                        <table width='100%' cellspacing='0' class='tbl'>
-                       <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
+                       <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost netaddress'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
 END
                }
                my $count=0;
@@ -1952,7 +1952,14 @@ END
                        }
                        my $colnet="$customnetwork{$key}[1]/".&General::subtocidr($customnetwork{$key}[2]);
                        my $netcount=&getnetcount($customnetwork{$key}[0]);
-                       print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td>";
+                       my $netusedin=&getusedin($customnetwork{$key}[0]);
+                       my $htmlparttouse="";
+                       if ($netusedin) {
+                               $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$netusedin' title='$netusedin'>";
+                       } else { 
+                               $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
+                       }
+                       print"<td width='20%' $col><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center' $col>".&getcolor($colnet)."</td><td width='40%' $col>$customnetwork{$key}[3]</td><td align='center' $col>$netcount x</td><td>$htmlparttouse</td>";
                        print<<END;
                        <td width='1%' $col><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
                        <input type='hidden' name='ACTION' value='editnet'>
@@ -2086,7 +2093,7 @@ sub viewtablehost
                }else{
                print<<END;
                <table width='100%' cellspacing='0' class='tbl'>
-               <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th width='3%'></th></tr>
+               <tr><th align='center'><b>$Lang::tr{'name'}</b></th><th align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></th><th align='center'><b>$Lang::tr{'remark'}</b></th><th align='center'><b>$Lang::tr{'used'}</b></th><th></th><th></th><th width='3%'></th></tr>
 END
        }
                my $count=0;
@@ -2106,7 +2113,14 @@ END
                        $customhost{$key}[4]=~s/\s+//g;
                        my $hostcount=0;
                        $hostcount=&gethostcount($customhost{$key}[0]);
-                       print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td>";
+                       my $hostusedin=&getusedin($customhost{$key}[0]);
+                       my $htmlparttouse="";
+                       if ($hostusedin) {
+                               $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='$hostusedin' title='$hostusedin'>";
+                       } else { 
+                               $htmlparttouse = "<input type='image' align='top' src='/images/info.gif' alt='Unused' title='Unused'>";
+                       }
+                       print"<td width='20%' $col>$customhost{$key}[0]</td><td width='20%' align='center' $col >".&getcolor($ip)."</td><td width='50%' align='left' $col>$customhost{$key}[3]</td><td align='center' $col>$hostcount x</td><td>$htmlparttouse</td>";
                        print<<END;
                        <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
                        <input type='hidden' name='ACTION' value='edithost' />
@@ -2182,7 +2196,13 @@ sub viewtablegrp
                                print "<br><b><u>$grpname</u></b>&nbsp; &nbsp;";
                                print " <b>$Lang::tr{'remark'}:</b>&nbsp $remark &nbsp " if ($remark ne '');
                                my $netgrpcount=&getnetcount($grpname);
-                               print "<b>$Lang::tr{'used'}:</b> $netgrpcount x";
+                               print "<b>$Lang::tr{'used'}:</b> $netgrpcount x ";
+                               my $groupusedin=&getusedin($grpname);
+                               if ($groupusedin) {
+                                       print "<input type='image' align='top' src='/images/info.gif' alt='$groupusedin' title='$groupusedin'>";                                
+                               } else { 
+                                       print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
+                               }
                                if($netgrpcount == '0')
                                {
                                        print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='ACTION' value='delgrp'></form>";
@@ -2320,8 +2340,13 @@ sub viewtablelocationgrp
 
                        # Get group count.
                        my $locationgrpcount=&getlocationcount($grpname);
-                       print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x";
-
+                       my $locationusedin=&getlocusedin($grpname);
+                       print "<b>$Lang::tr{'used'}:</b> $locationgrpcount x ";
+                       if ($locationusedin) {
+                               print "<input type='image' align='top' src='/images/info.gif' alt='$locationusedin' title='$locationusedin'>";                          
+                       } else { 
+                               print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
+                       }
                        # Only display delete icon, if the group is not used by a firewall rule.
                        if($locationgrpcount == '0') {
                                print"<form method='post' style='display:inline'>\n";
@@ -2442,7 +2467,7 @@ sub viewtableservice
                &General::readhasharray("$fwconfigout", \%fwout);
                print<<END;
                        <table width='100%' cellspacing='0' class='tbl'>
-                       <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th width='3%'></th></tr>
+                       <tr><th align='center'><b>$Lang::tr{'fwhost srv_name'}</b></th><th align='center'><b>$Lang::tr{'fwhost prot'}</b></th><th align='center'><b>$Lang::tr{'fwhost port'}</b></th><th align='center'><b>ICMP</b></th><th align='center'><b>$Lang::tr{'fwhost used'}</b></th><th></th><th></th><th width='3%'></th></tr>
 END
                my $col='';
                foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0])} keys %customservice)
@@ -2463,10 +2488,17 @@ END
 END
                        #Neuer count
                        $srvcount=&getsrvcount($customservice{$key}[0]);
+                       my $serviceusedin=&getsrvusedin($customservice{$key}[0]);
+                       my $htmlparttouse="";
+                       if ($serviceusedin) {
+                               $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$serviceusedin' title='$serviceusedin'>";
+                       } else { 
+                               $htmlparttouse="<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
+                       }
                        if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
                        elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
                        print<<END;
-                       </td><td align='center' $col>$srvcount x</td>
+                       </td><td align='center' $col>$srvcount x</td><td>$htmlparttouse</td>
                        <td width='1%' $col><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' /><input type='hidden' name='ACTION' value='editservice' />
                        <input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
                        <input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
@@ -2538,7 +2570,13 @@ sub viewtableservicegrp
                                if($count >0){print"</table>";$count=1;}
                                print "<br><b><u>$grpname</u></b>&nbsp; &nbsp; ";
                                print "<b>$Lang::tr{'remark'}:</b>&nbsp; $remark " if ($remark ne '');
-                               print "&nbsp; <b>$Lang::tr{'used'}:</b> $grpcount x";
+                               print "&nbsp; <b>$Lang::tr{'used'}:</b> $grpcount x ";
+                               my $srvgrpusedin=&getsrvusedin($customservicegrp{$key}[0]);
+                               if ($srvgrpusedin) {
+                                       print "<input type='image' align='top' src='/images/info.gif' alt='$srvgrpusedin' title='$srvgrpusedin'>";                              
+                               } else { 
+                                       print "<input type='image' align='top' src='/images/info.gif' alt='$Lang::tr{'Unused'}' title='$Lang::tr{'Unused'}'>";
+                               }
                                if($grpcount == '0')
                                {
                                        print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='ACTION' value='delservicegrp'></form>";
@@ -2811,6 +2849,106 @@ sub getlocationcount
        }
        return $counter;
 }
+sub getlocusedin
+{
+       my $groupname=shift;
+       my $titletext="";
+
+       # Location groups are stored as "group:groupname" in the
+       # firewall settings files.
+       my $searchstring = join(':', "group",$groupname);
+
+       #Count services used in firewall - config
+       my $fwfwtext="";
+       # first set title if found
+       foreach my $key1 (keys %fwfwd) {
+               if($fwfwd{$key1}[4] eq $searchstring){
+                       $fwfwtext = "$Lang::tr{'firewall rules'}:";
+               }
+               if($fwfwd{$key1}[6] eq $searchstring){
+                       $fwfwtext = "$Lang::tr{'firewall rules'}:";
+               }
+       }
+       # then add rule numbers
+       my @fwfwrules = ();
+       foreach my $key1 (keys %fwfwd) {
+               if($fwfwd{$key1}[4] eq $searchstring){
+                       push(@fwfwrules, $key1);
+               }
+               if($fwfwd{$key1}[6] eq $searchstring){
+                       push(@fwfwrules, $key1);
+               }
+       }
+       my @fwfwarraysorted = sort { $a <=> $b } @fwfwrules;
+       foreach my $rule (@fwfwarraysorted)
+       {
+       $fwfwtext .= "&#010- $rule";
+       }
+       #Count services used in firewall - input
+       my $fwintext="";
+       foreach my $key2 (keys %fwinp) {
+               if($fwinp{$key2}[4] eq $searchstring){
+                       $fwintext = "$Lang::tr{'incoming firewall access'}:";
+               }
+               if($fwinp{$key2}[6] eq $searchstring){
+                       $fwintext = "$Lang::tr{'incoming firewall access'}:";
+               }
+       }
+       my @fwinrules = ();
+       foreach my $key2 (keys %fwinp) {
+               if($fwinp{$key2}[4] eq $searchstring){
+                       push(@fwinrules, $key2);
+               }
+               if($fwinp{$key2}[6] eq $searchstring){
+                       push(@fwinrules, $key2);
+               }
+       }
+       my @fwinarraysorted = sort { $a <=> $b } @fwinrules;
+       foreach my $rule (@fwinarraysorted)
+       {
+       $fwintext .= "&#010- $rule";
+       }
+       #Count services used in firewall - outgoing
+       my $fwouttext="";
+       foreach my $key3 (keys %fwout) {
+               if($fwout{$key3}[4] eq $searchstring){
+                       $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+               }
+               if($fwout{$key3}[6] eq $searchstring){
+                       $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+               }
+       }
+       my @fwoutrules = ();
+       foreach my $key3 (keys %fwout) {
+               if($fwout{$key3}[4] eq $searchstring){
+                       push(@fwoutrules, $key3);
+               }
+               if($fwout{$key3}[6] eq $searchstring){
+                       push(@fwoutrules, $key3);
+               }
+       }
+       my @fwoutarraysorted = sort { $a <=> $b } @fwoutrules;
+       foreach my $rule (@fwoutarraysorted)
+       {
+       $fwouttext .= "&#010- $rule";
+       }
+       if ($fwfwtext) {
+               $titletext .= "$fwfwtext"
+       }
+       if ($fwintext) {
+               if ($titletext) {
+                       $titletext .= "&#010 "
+               }
+               $titletext .= "$fwintext"
+       }
+       if ($fwouttext) {
+               if ($titletext) {
+                       $titletext .= "&#010 "
+               }
+               $titletext .= "$fwouttext"
+       }
+       return $titletext;
+}
 sub getnetcount
 {
        my $searchstring=shift;
@@ -2850,6 +2988,122 @@ sub getnetcount
        }
        return $srvcounter;
 }
+sub getusedin
+{
+       my $searchstring=shift;
+       my $titletext="";
+       my $groups=();
+       my $rules=();
+
+       #Count services used in Network/Host group
+       my $servicegrouptext="";
+       foreach my $key (keys %customgrp) {
+               if($customgrp{$key}[2] eq $searchstring){
+                       $servicegrouptext = "$Lang::tr{'fwhost cust grp'}:";
+               }
+       }
+       foreach my $key (keys %customgrp) {
+               if($customgrp{$key}[2] eq $searchstring){
+                       $servicegrouptext .= "&#010- $customgrp{$key}[0]";
+               }
+       }
+       #Count services used in firewall - config
+       my $fwfwtext="";
+       # first set title if found
+       foreach my $key1 (keys %fwfwd) {
+               if($fwfwd{$key1}[4] eq $searchstring){
+                       $fwfwtext = "$Lang::tr{'firewall rules'}:";
+               }
+               if($fwfwd{$key1}[6] eq $searchstring){
+                       $fwfwtext = "$Lang::tr{'firewall rules'}:";
+               }
+       }
+       # then add rule numbers
+       my @fwfwrules = ();
+       foreach my $key1 (keys %fwfwd) {
+               if($fwfwd{$key1}[4] eq $searchstring){
+                       push(@fwfwrules, $key1);
+               }
+               if($fwfwd{$key1}[6] eq $searchstring){
+                       push(@fwfwrules, $key1);
+               }
+       }
+       my @fwfwarraysorted = sort { $a <=> $b } @fwfwrules;
+       foreach my $rule (@fwfwarraysorted)
+       {
+       $fwfwtext .= "&#010- $rule";
+       }
+       #Count services used in firewall - input
+       my $fwintext="";
+       foreach my $key2 (keys %fwinp) {
+               if($fwinp{$key2}[4] eq $searchstring){
+                       $fwintext = "$Lang::tr{'incoming firewall access'}:";
+               }
+               if($fwinp{$key2}[6] eq $searchstring){
+                       $fwintext = "$Lang::tr{'incoming firewall access'}:";
+               }
+       }
+       my @fwinrules = ();
+       foreach my $key2 (keys %fwinp) {
+               if($fwinp{$key2}[4] eq $searchstring){
+                       push(@fwinrules, $key2);
+               }
+               if($fwinp{$key2}[6] eq $searchstring){
+                       push(@fwinrules, $key2);
+               }
+       }
+       my @fwinarraysorted = sort { $a <=> $b } @fwinrules;
+       foreach my $rule (@fwinarraysorted)
+       {
+       $fwintext .= "&#010- $rule";
+       }
+       #Count services used in firewall - outgoing
+       my $fwouttext="";
+       foreach my $key3 (keys %fwout) {
+               if($fwout{$key3}[4] eq $searchstring){
+                       $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+               }
+               if($fwout{$key3}[6] eq $searchstring){
+                       $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+               }
+       }
+       my @fwoutrules = ();
+       foreach my $key3 (keys %fwout) {
+               if($fwout{$key3}[4] eq $searchstring){
+                       push(@fwoutrules, $key3);
+               }
+               if($fwout{$key3}[6] eq $searchstring){
+                       push(@fwoutrules, $key3);
+               }
+       }
+       my @fwoutarraysorted = sort { $a <=> $b } @fwoutrules;
+       foreach my $rule (@fwoutarraysorted)
+       {
+       $fwouttext .= "&#010- $rule";
+       }
+       if ($servicegrouptext) {
+               $titletext .= "$servicegrouptext"
+       }
+       if ($fwfwtext) {
+               if ($titletext) {
+                       $titletext .= "&#010 "
+               }
+               $titletext .= "$fwfwtext"
+       }
+       if ($fwintext) {
+               if ($titletext) {
+                       $titletext .= "&#010 "
+               }
+               $titletext .= "$fwintext"
+       }
+       if ($fwouttext) {
+               if ($titletext) {
+                       $titletext .= "&#010 "
+               }
+               $titletext .= "$fwouttext"
+       }
+       return $titletext
+}
 sub getsrvcount
 {
        my $searchstring=shift;
@@ -2880,6 +3134,100 @@ sub getsrvcount
        }
        return $srvcounter;
 }
+sub getsrvusedin
+{
+       my $searchstring=shift;
+       my $titletext="";
+       #Count services used in servicegroups
+       my $servicegrouptext="";
+       foreach my $key (keys %customservicegrp) {
+               if($customservicegrp{$key}[2] eq $searchstring){
+                       $servicegrouptext = "$Lang::tr{'outgoing firewall access'}:";
+               }
+       }
+       foreach my $key (keys %customservicegrp) {
+               if($customservicegrp{$key}[2] eq $searchstring){
+                       $servicegrouptext .= "&#010- $customservicegrp{$key}[0]";
+               }
+       }
+       my $fwfwtext="";
+       # first set title if found
+       foreach my $key1 (keys %fwfwd) {
+               if($fwfwd{$key1}[15] eq $searchstring){
+                       $fwfwtext = "$Lang::tr{'firewall rules'}:";
+               }
+       }
+       # then add rule numbers
+       my @fwfwrules = ();
+       foreach my $key1 (keys %fwfwd) {
+               if($fwfwd{$key1}[15] eq $searchstring){
+                       push(@fwfwrules, $key1);
+               }
+       }
+       my @fwfwarraysorted = sort { $a <=> $b } @fwfwrules;
+       foreach my $rule (@fwfwarraysorted)
+       {
+       $fwfwtext .= "&#010- $rule";
+       }
+       #Count services used in firewall - input
+       my $fwintext="";
+       foreach my $key2 (keys %fwinp) {
+               if($fwinp{$key2}[15] eq $searchstring){
+                       $fwintext = "$Lang::tr{'incoming firewall access'}:";
+               }
+       }
+       my @fwinrules = ();
+       foreach my $key2 (keys %fwinp) {
+               if($fwinp{$key2}[15] eq $searchstring){
+                       push(@fwinrules, $key2);
+               }
+       }
+       my @fwinarraysorted = sort { $a <=> $b } @fwinrules;
+       foreach my $rule (@fwinarraysorted)
+       {
+       $fwintext .= "&#010- $rule";
+       }
+       #Count services used in firewall - outgoing
+       my $fwouttext="";
+       foreach my $key3 (keys %fwout) {
+               if($fwout{$key3}[15] eq $searchstring){
+                       $fwouttext = "$Lang::tr{'outgoing firewall access'}:";
+               }
+       }
+       my @fwoutrules = ();
+       foreach my $key3 (keys %fwout) {
+               if($fwout{$key3}[15] eq $searchstring){
+                       push(@fwoutrules, $key3);
+               }
+       }
+       my @fwoutarraysorted = sort { $a <=> $b } @fwoutrules;
+       foreach my $rule (@fwoutarraysorted)
+       {
+       $fwouttext .= "&#010- $rule";
+       }
+       if ($servicegrouptext ne '') {
+               $titletext .= "$servicegrouptext";
+       }
+       if ($fwfwtext ne '') {
+               if ($titletext) {
+                       $titletext .= "&#010 ";
+               }
+               $titletext .= "$fwfwtext";
+       }
+       if ($fwintext ne '') {
+               if ($titletext) {
+                       $titletext .= "&#010 ";
+               }
+               $titletext .= "$fwintext";
+       }
+       if ($fwouttext) {
+               if ($titletext ne '') {
+                       $titletext .= "&#010 ";
+               }
+               $titletext .= "$fwouttext";
+       }
+       return $titletext
+}
 sub deletefromgrp
 {
        my $target=shift;
index 53d6903aeb969c1bc496ea72996e0628e0b3bb08..13022791060473246375f13321019cb6c8c30424 100644 (file)
 'The class number does not match the specified interface.' => 'Die Klassennummer passt nicht zum angegebenen Interface.',
 'The destination IP address is invalid.' => 'Die Ziel-IP-Adresse ist ungültig.',
 'The source IP address is invalid.' => 'Die Quell-IP-Adresse ist ungültig.',
+'Unused' => 'Unbenutzt',
 'Utilization on' => 'Auslastung auf',
 'Verbose' => 'Verbose',
 'WakeOnLan' => 'Wake On LAN',
index ef7d75ce75cb43d31c57280d2c2179a2a333136e..e76ca878c50625d1ee93865659a6a173cce940eb 100644 (file)
 'The class number does not match the specified interface.' => 'The class number does not match the specified interface.',
 'The destination IP address is invalid.' => 'The destination IP address is invalid.',
 'The source IP address is invalid.' => 'The source IP address is invalid.',
+'Unused' => 'Unused',
 'Utilization on' => 'Utilization on',
 'Verbose' => 'Verbose:',
 'WakeOnLan' => 'Wake On Lan',