From 3c037075d0f6c296225500651d89b03b3c65d9e2 Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Fri, 20 Dec 2013 12:53:46 +0100 Subject: [PATCH] Firewall: when DNAT external port is given and dest port is empty, theres now an errormessage displayed --- doc/language_issues.es | 1 + doc/language_issues.fr | 1 + doc/language_issues.nl | 1 + doc/language_issues.pl | 1 + doc/language_issues.ru | 1 + doc/language_issues.tr | 1 + doc/language_missings | 4 ++++ html/cgi-bin/firewall.cgi | 5 ++++- langs/de/cgi-bin/de.pl | 1 + langs/en/cgi-bin/en.pl | 1 + 10 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/language_issues.es b/doc/language_issues.es index f735730a8..356dc0ec5 100644 --- a/doc/language_issues.es +++ b/doc/language_issues.es @@ -643,6 +643,7 @@ WARNING: untranslated string: fwdfw delete WARNING: untranslated string: fwdfw dnat WARNING: untranslated string: fwdfw dnat error WARNING: untranslated string: fwdfw dnat porterr +WARNING: untranslated string: fwdfw dnat porterr2 WARNING: untranslated string: fwdfw edit WARNING: untranslated string: fwdfw err nosrc WARNING: untranslated string: fwdfw err nosrcip diff --git a/doc/language_issues.fr b/doc/language_issues.fr index e33e653dc..6e1c15bc2 100644 --- a/doc/language_issues.fr +++ b/doc/language_issues.fr @@ -646,6 +646,7 @@ WARNING: untranslated string: fwdfw delete WARNING: untranslated string: fwdfw dnat WARNING: untranslated string: fwdfw dnat error WARNING: untranslated string: fwdfw dnat porterr +WARNING: untranslated string: fwdfw dnat porterr2 WARNING: untranslated string: fwdfw edit WARNING: untranslated string: fwdfw err nosrc WARNING: untranslated string: fwdfw err nosrcip diff --git a/doc/language_issues.nl b/doc/language_issues.nl index 92ef57e38..902b6e5c1 100644 --- a/doc/language_issues.nl +++ b/doc/language_issues.nl @@ -592,6 +592,7 @@ WARNING: untranslated string: fwdfw delete WARNING: untranslated string: fwdfw dnat WARNING: untranslated string: fwdfw dnat error WARNING: untranslated string: fwdfw dnat porterr +WARNING: untranslated string: fwdfw dnat porterr2 WARNING: untranslated string: fwdfw edit WARNING: untranslated string: fwdfw err nosrc WARNING: untranslated string: fwdfw err nosrcip diff --git a/doc/language_issues.pl b/doc/language_issues.pl index f735730a8..356dc0ec5 100644 --- a/doc/language_issues.pl +++ b/doc/language_issues.pl @@ -643,6 +643,7 @@ WARNING: untranslated string: fwdfw delete WARNING: untranslated string: fwdfw dnat WARNING: untranslated string: fwdfw dnat error WARNING: untranslated string: fwdfw dnat porterr +WARNING: untranslated string: fwdfw dnat porterr2 WARNING: untranslated string: fwdfw edit WARNING: untranslated string: fwdfw err nosrc WARNING: untranslated string: fwdfw err nosrcip diff --git a/doc/language_issues.ru b/doc/language_issues.ru index 7e1a86dc3..a5e663845 100644 --- a/doc/language_issues.ru +++ b/doc/language_issues.ru @@ -629,6 +629,7 @@ WARNING: untranslated string: fwdfw delete WARNING: untranslated string: fwdfw dnat WARNING: untranslated string: fwdfw dnat error WARNING: untranslated string: fwdfw dnat porterr +WARNING: untranslated string: fwdfw dnat porterr2 WARNING: untranslated string: fwdfw edit WARNING: untranslated string: fwdfw err nosrc WARNING: untranslated string: fwdfw err nosrcip diff --git a/doc/language_issues.tr b/doc/language_issues.tr index fe1aed6b0..810b3d659 100644 --- a/doc/language_issues.tr +++ b/doc/language_issues.tr @@ -588,6 +588,7 @@ WARNING: untranslated string: fwdfw delete WARNING: untranslated string: fwdfw dnat WARNING: untranslated string: fwdfw dnat error WARNING: untranslated string: fwdfw dnat porterr +WARNING: untranslated string: fwdfw dnat porterr2 WARNING: untranslated string: fwdfw edit WARNING: untranslated string: fwdfw err nosrc WARNING: untranslated string: fwdfw err nosrcip diff --git a/doc/language_missings b/doc/language_missings index 8a751f05c..0b6e3f093 100644 --- a/doc/language_missings +++ b/doc/language_missings @@ -106,6 +106,7 @@ < fwdfw dnat < fwdfw dnat error < fwdfw dnat porterr +< fwdfw dnat porterr2 < fwdfw DROP < fwdfw edit < fwdfw err nosrc @@ -518,6 +519,7 @@ < fwdfw dnat < fwdfw dnat error < fwdfw dnat porterr +< fwdfw dnat porterr2 < fwdfw DROP < fwdfw edit < fwdfw err nosrc @@ -914,6 +916,7 @@ < fwdfw dnat < fwdfw dnat error < fwdfw dnat porterr +< fwdfw dnat porterr2 < fwdfw DROP < fwdfw edit < fwdfw err nosrc @@ -1299,6 +1302,7 @@ < fwdfw dnat < fwdfw dnat error < fwdfw dnat porterr +< fwdfw dnat porterr2 < fwdfw DROP < fwdfw edit < fwdfw err nosrc diff --git a/html/cgi-bin/firewall.cgi b/html/cgi-bin/firewall.cgi index 741fada01..71ca75257 100755 --- a/html/cgi-bin/firewall.cgi +++ b/html/cgi-bin/firewall.cgi @@ -729,8 +729,11 @@ sub checkrule { #check valid port for NAT if($fwdfwsettings{'USE_NAT'} eq 'ON'){ - #if no port is given in nat area, take target host port + #if no dest port is given in nat area, take target host port if($fwdfwsettings{'nat'} eq 'dnat' && $fwdfwsettings{'grp3'} eq 'TGT_PORT' && $fwdfwsettings{'dnatport'} eq ''){$fwdfwsettings{'dnatport'}=$fwdfwsettings{'TGT_PORT'};} + if($fwdfwsettings{'TGT_PORT'} eq ''){ + $errormessage=$Lang::tr{'fwdfw dnat porterr2'}; + } #check if port given in nat area is a single valid port or portrange if($fwdfwsettings{'nat'} eq 'dnat' && $fwdfwsettings{'TGT_PORT'} ne '' && !&check_natport($fwdfwsettings{'dnatport'})){ $errormessage=$Lang::tr{'fwdfw target'}.": ".$Lang::tr{'fwdfw dnat porterr'}."
"; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index b0b072407..e8fb99599 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -930,6 +930,7 @@ 'fwdfw dnat' => 'Destination-NAT (Port-Weiterleitung)', 'fwdfw dnat error' => 'Für Destination-NAT muss ein einzelner Host als Ziel ausgewählt werden. Gruppen oder Netzwerke sind nicht erlaubt', 'fwdfw dnat porterr' => 'Für NAT-Regeln muss ein einzelner Port oder Portbereich angegeben werden', +'fwdfw dnat porterr2' => 'Externer Port (NAT) darf nur angegeben werden, wenn ein Ziel-Port definiert ist.', 'fwdfw edit' => 'Bearbeiten', 'fwdfw err nosrc' => 'Keine Quelle ausgewählt', 'fwdfw err nosrcip' => 'Bitte Quell-IP-Adresse angeben', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 0909226da..8bbfff39f 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -955,6 +955,7 @@ 'fwdfw dnat' => 'Destination NAT (Port forwarding)', 'fwdfw dnat error' => 'You have to select a single host for DNAT. Groups or networks are not allowed.', 'fwdfw dnat porterr' => 'You have to select a single port or portrange (tcp/udp) for NAT', +'fwdfw dnat porterr2' => 'Cannot use external port (NAT) when no destination port is defined.', 'fwdfw edit' => 'Edit', 'fwdfw err nosrc' => 'No source selected.', 'fwdfw err nosrcip' => 'Please provide a source IP address.', -- 2.39.2