This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".
The branch, master has been updated
via 025741919a54ceb2ce96961e74f3afd1ad10706b (commit)
from c5fb845c4eb6fdc4ef7d1e10495566a7689bf451 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 025741919a54ceb2ce96961e74f3afd1ad10706b
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Mon Mar 31 13:16:26 2014 +0200
firewall: Fix perl coding error.
Example:
my @as = (1, 2, 3);
foreach my $a (@as) {
$a += 1;
print "$a\n";
}
$a will be a reference to the number in the array and not
copied. Therefore $a += 1 will change the numbers in the
array as well, so that after the loop the content of @as
would be (2, 3, 4).
To avoid that, the number needs to be copied into a new
variable like: my $b = $a; and we are fine.
This caused that the content of the @sources and @destinations
array has been altered for the second run of the loop and
incorrect (i.e. no) rules were created.
-----------------------------------------------------------------------
Summary of changes:
config/firewall/rules.pl | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
Difference in files:
diff --git a/config/firewall/rules.pl b/config/firewall/rules.pl
index f25983c..a0bc32c 100755
--- a/config/firewall/rules.pl
+++ b/config/firewall/rules.pl
@@ -254,17 +254,22 @@ sub buildrules {
# Check if this protocol knows ports.
my $protocol_has_ports = ($protocol ~~ @PROTOCOLS_WITH_PORTS);
- foreach my $source (@sources) {
- foreach my $destination (@destinations) {
- # Skip invalid rules.
- next if (!$source || !$destination || ($destination eq "none"));
+ foreach my $src (@sources) {
+ # Skip invalid source.
+ next unless ($src);
+
+ # Sanitize source.
+ my $source = $src;
+ if ($source ~~ @ANY_ADDRESSES) {
+ $source = "";
+ }
- # Sanitize source.
- if ($source ~~ @ANY_ADDRESSES) {
- $source = "";
- }
+ foreach my $dst (@destinations) {
+ # Skip invalid rules.
+ next if (!$dst || ($dst eq "none"));
# Sanitize destination.
+ my $destination = $dst;
if ($destination ~~ @ANY_ADDRESSES) {
$destination = "";
}
hooks/post-receive
--
IPFire 2.x development tree