From e557ad44a227e12aeac249d1957be296e94c0c7d Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Wed, 5 Nov 2008 21:06:12 +0000 Subject: [PATCH] Handle comments using --comment with spaces and - in them --- firewall/CHANGELOG | 1 + firewall/firewall-lib.pl | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/firewall/CHANGELOG b/firewall/CHANGELOG index f804f2fb9..76fe876f6 100644 --- a/firewall/CHANGELOG +++ b/firewall/CHANGELOG @@ -21,3 +21,4 @@ Added a setup option to configure a firewall for a typical hosting server. Show SNAT and masquerade inputs in custom NAT chains. ---- Changes since 1.440 ---- DNS queries are now allowed when the firewall is setup for web hosting. +Rule coments using --comment containing spaces or - are now properly parsed. diff --git a/firewall/firewall-lib.pl b/firewall/firewall-lib.pl index b71bf948e..fb5458a06 100644 --- a/firewall/firewall-lib.pl +++ b/firewall/firewall-lib.pl @@ -86,7 +86,12 @@ while() { # Parse arguments foreach $a (@known_args) { local @vl; - while($rule->{'args'} =~ s/\s+(!?)\s*($a)\s+(!?)\s*(([^ \-!]\S*(\s+|$))+)/ / || $rule->{'args'} =~ s/\s+(!?)\s*($a)()(\s+|$)/ /) { + while($rule->{'args'} =~ + s/\s+(!?)\s*($a)\s+(!?)\s*("[^"]*")(\s+|$)/ / || + $rule->{'args'} =~ + s/\s+(!?)\s*($a)\s+(!?)\s*(([^ \-!]\S*(\s+|$))+)/ / || + $rule->{'args'} =~ + s/\s+(!?)\s*($a)()(\s+|$)/ /) { push(@vl, [ $1 || $3, &split_quoted_string($4) ]); } local ($aa = $a); $aa =~ s/^-+//;