From dacac43e55b37595edbfadcd46f0237897ba472b Mon Sep 17 00:00:00 2001 From: Paul Gear Date: Wed, 8 Aug 2007 08:50:58 +0000 Subject: [PATCH] BUG: Corrected mis-handling of nested zones introduced in 1.350. Removed debugging cruft added in 1.350. Added support for end-of-line comments in zones, params, and shorewall.conf. Added support for display of long zone names under the new zones format. Added module option to disable display of long zone names in the rules file. --- shorewall/CHANGELOG | 10 ++- shorewall/config.info | 1 + shorewall/lang/en | 12 ++- shorewall/shorewall-lib.pl | 153 ++++++++++++++++++++++++------------- 4 files changed, 120 insertions(+), 56 deletions(-) diff --git a/shorewall/CHANGELOG b/shorewall/CHANGELOG index f93f071c4..dfa08e24d 100644 --- a/shorewall/CHANGELOG +++ b/shorewall/CHANGELOG @@ -1,4 +1,12 @@ ----- Changes since 1.351 ---- +---- Changes since 1.360 ---- +(Updates by Paul Gear .) +BUG: Corrected mis-handling of nested zones introduced in 1.350. +Removed debugging cruft added in 1.350. +Added support for end-of-line comments in zones, params, and shorewall.conf. +Added support for display of long zone names under the new zones format. +Added module option to disable display of long zone names in the rules file. +---- Changes since 1.350 ---- +(Updates by Paul Gear .) Corrected name to "Shoreline Firewall". Correctly determine Shorewall version for beta releases. Corrected zones file support on version 3 or greater when IPSECFILE=ipsec. diff --git a/shorewall/config.info b/shorewall/config.info index d75aaa66a..e223b27e1 100644 --- a/shorewall/config.info +++ b/shorewall/config.info @@ -4,3 +4,4 @@ actions=Standard actions files,9,40,5,\t macros=Macro files directory,0 before_apply_cmd=Command to run before applying configuration,3,None after_apply_cmd=Command to run after applying configuration,3,None +display_zone_descriptions=Display zone descriptions in rules file,1,0-No,1-Yes diff --git a/shorewall/lang/en b/shorewall/lang/en index e050169c1..0524bb92a 100644 --- a/shorewall/lang/en +++ b/shorewall/lang/en @@ -48,10 +48,12 @@ zones_none=No network zones have been defined yet. zones_0=Zone ID zones_1=Displayed name zones_2=Description -zones_1new=Zone type -zones_2new=Zone options -zones_3new=Incoming options -zones_4new=Outgoing options +zones_1new=Parent zone +zones_2new=Zone type +zones_3new=Zone options +zones_4new=Incoming options +zones_5new=Outgoing options +zones_6new=Comment zones_return=zones list zones_edit=Edit Network Zone zones_create=Create Network Zone @@ -424,6 +426,7 @@ shorewall_conf_add=Add a new configuration variable. shorewall_conf_none=No shorewall configuration found. shorewall_conf_0=Variable shorewall_conf_1=Value +shorewall_conf_2=Comment shorewall_conf_return=configuration variables list shorewall_conf_edit=Edit configuration variable shorewall_conf_create=Create configuration variable @@ -437,6 +440,7 @@ params_add=Add a new custom parameter. params_none=No custom parameters found. params_0=Parameter params_1=Value +params_2=Comment params_return=custom parameters list params_edit=Edit custom parameter params_create=Create custom parameter diff --git a/shorewall/shorewall-lib.pl b/shorewall/shorewall-lib.pl index a3d1d73de..d7449835c 100644 --- a/shorewall/shorewall-lib.pl +++ b/shorewall/shorewall-lib.pl @@ -318,8 +318,11 @@ return @sp ? \@sp : undef; sub config_parser { local $l = $_[0]; - $l =~ s/#.*$//; + $l =~ s/#\s*(.*?)\s*$//; # save the comment we strip local @sp = split(/=/, $l, 2); + if ($#sp > -1 && defined $1) { + push @sp, $1; # add back the saved comment, if present + } return @sp ? \@sp : undef; } @@ -328,7 +331,6 @@ sub get_parser_func { local $hashref = $_[0]; &get_clean_table_name($hashref); - &debug_message("table = $hashref->{'table'}, pfunc = $pfunc"); local $pfunc = $hashref->{'tableclean'}."_parser"; if (!defined(&$pfunc)) { if ($hashref->{'tableclean'} =~ /^(params|shorewall_conf)$/) { @@ -338,7 +340,6 @@ sub get_parser_func $pfunc = "standard_parser"; } } - &debug_message("table = $hashref->{'table'}, pfunc = $pfunc"); return $pfunc; } @@ -356,7 +357,6 @@ sub get_clean_table_name local $hashref = $_[0]; if (!exists hashref->{'tableclean'}) { $hashref->{'tableclean'} = &clean_name($in{'table'}); - &debug_message("table = " . $hashref->{'table'} . ", tableclean = " . $hashref->{'tableclean'}); } } @@ -383,15 +383,8 @@ elsif ($_[3] == 0) { $found = !$_[1] || $_[1] eq 'all' || &is_fw($_[1]); } foreach $z (@ztable) { - if (&new_zones_format()) { - printf "