From 081cf30447908206dfcdc5187f057b6b72f5e640 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 27 Oct 2015 17:45:22 -0700 Subject: [PATCH] Don't export variables with parentheses in their names Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Config.pm | 56 +++++++++++++++++------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index f0acfd644..59f82e0bf 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -5188,19 +5188,23 @@ sub get_params( $ ) { $shell = BASH; for ( @params ) { - if ( /^declare -x (.*?)="(.*[^\\])"$/ ) { - $params{$1} = $2 unless $1 eq '_'; - } elsif ( /^declare -x (.*?)="(.*)$/ ) { - $params{$variable=$1} = $2 eq '"' ? '' : "${2}\n"; - } elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""$/ ) { - $params{$1} = ''; - } else { - chomp; - if ($variable) { - s/"$//; - $params{$variable} .= $_; + my $var = $1; + + unless ( $var =~ /\(/ ) { + if ( /^declare -x (.*?)="(.*[^\\])"$/ ) { + $params{$var} = $2 unless $1 eq '_'; + } elsif ( /^declare -x (.*?)="(.*)$/ ) { + $params{$variable=$var} = $2 eq '"' ? '' : "${2}\n"; + } elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""$/ ) { + $params{$var} = ''; } else { - warning_message "Param line ($_) ignored" unless $bug++; + chomp; + if ($variable) { + s/"$//; + $params{$variable} .= $_; + } else { + warning_message "Param line ($_) ignored" unless $bug++; + } } } } @@ -5216,19 +5220,23 @@ sub get_params( $ ) { $shell = OLDBASH; for ( @params ) { - if ( /^export (.*?)="(.*[^\\])"$/ ) { - $params{$1} = $2 unless $1 eq '_'; - } elsif ( /^export (.*?)="(.*)$/ ) { - $params{$variable=$1} = $2 eq '"' ? '' : "${2}\n"; - } elsif ( /^export ([^\s=]+)\s*$/ || /^export (.*)=""$/ ) { - $params{$1} = ''; - } else { - chomp; - if ($variable) { - s/"$//; - $params{$variable} .= $_; + my $var = $1; + + unless ( $var =~ /\(/ ) { + if ( /^export (.*?)="(.*[^\\])"$/ ) { + $params{$var} = $2 unless $1 eq '_'; + } elsif ( /^export (.*?)="(.*)$/ ) { + $params{$variable=$var} = $2 eq '"' ? '' : "${2}\n"; + } elsif ( /^export ([^\s=]+)\s*$/ || /^export (.*)=""$/ ) { + $params{$var} = ''; } else { - warning_message "Param line ($_) ignored" unless $bug++; + chomp; + if ($variable) { + s/"$//; + $params{$variable} .= $_; + } else { + warning_message "Param line ($_) ignored" unless $bug++; + } } } }