From aa991fcf458029a417c3802b0bd2f46adc9ccb7b Mon Sep 17 00:00:00 2001 From: teastep Date: Tue, 3 Jul 2007 21:22:08 +0000 Subject: [PATCH] Correct handling of nested shell variable expansion; update extension script doc git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6773 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Config.pm | 5 ++--- docs/shorewall_extension_scripts.xml | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Shorewall-perl/Shorewall/Config.pm b/Shorewall-perl/Shorewall/Config.pm index 02586203f..0aa7cc62b 100644 --- a/Shorewall-perl/Shorewall/Config.pm +++ b/Shorewall-perl/Shorewall/Config.pm @@ -551,10 +551,9 @@ sub read_a_line { # $line = '', next if $line =~ /^\s*$/; # - # Expand Shell Variables using %ENV + # Expand Shell Variables using %ENV # - $line = join( '', $1 , ( $ENV{$2} || '' ) , $3 ) while $line =~ /^(.*?)\${([a-zA-Z]\w*)}(.*)$/; - $line = join( '', $1 , ( $ENV{$2} || '' ) , $3 ) while $line =~ /^(.*?)\$([a-zA-Z]\w*)(.*)$/; + $line = join( '', $1 , ( $ENV{$2} || '' ) , $3 ) while $line =~ /^(.*?)\$([a-zA-Z]\w*)(.*)$/ || $line =~ /^(.*?)\${([a-zA-Z]\w*)}(.*)$/; if ( $line =~ /^\s*INCLUDE\s/ ) { diff --git a/docs/shorewall_extension_scripts.xml b/docs/shorewall_extension_scripts.xml index ab5a2c09f..3b86b390f 100644 --- a/docs/shorewall_extension_scripts.xml +++ b/docs/shorewall_extension_scripts.xml @@ -432,7 +432,7 @@ will abort the compilation. All scripts will need to begin with the following - line:use Shorewall::Chains; For more + line:use Shorewall::Chains;For more complex scripts, you may need to 'use' other Shorewall Perl modules -- browse /usr/share/shorewall-perl/Shorewall/ to see @@ -479,12 +479,20 @@ maclog Note that in the 'initdone' script, there is no default - chain ($chainref). You can objtain a reference to a standard chain - by:my $chainref = $chain_table{<table>}{<chain name>};Example:my $chainref = $chain_table{filter}{INPUT};The - continue script has been eliminated because it no longer make any sense - under Shorewall-perl. This script was designed to allow you to add - special temporary rules during [re]start. Shorewall-perl doesn't need - such rules. + chain ($chainref). You can obtain a reference to a standard chain + by:my $chainref = $chain_table{<table>}{<chain name>};Example:my $chainref = $chain_table{filter}{INPUT}; + + You can also use the hash references $filter_table, $mangle_table + and $nat_table to access chain references. + + Example: + + my $chainref = $filter_table->{INPUT}; #Same as above with a few less keystrokes; runs faster too + + The continue script has been eliminated because it no longer make + any sense under Shorewall-perl. This script was designed to allow you to + add special temporary rules during [re]start. Shorewall-perl doesn't + need such rules. \ No newline at end of file