From 138638cb1aa26170b7d6e4efac3c9b66bfe03541 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Wed, 13 Feb 2013 07:45:24 -0800 Subject: [PATCH] Effectively use the specified directory as the CONFIG_PATH til .conf is read Signed-off-by: Tom Eastep --- Shorewall-core/lib.common | 6 +++++- Shorewall/Perl/Shorewall/Chains.pm | 8 ++++---- Shorewall/lib.cli-std | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Shorewall-core/lib.common b/Shorewall-core/lib.common index fdc384b65..e04d6bb86 100644 --- a/Shorewall-core/lib.common +++ b/Shorewall-core/lib.common @@ -676,7 +676,11 @@ find_file() fi done - echo ${g_confdir}/$1 + if [ -n "$g_shorewalldir" ]; then + echo ${g_shorewalldir}/$1 + else + echo ${g_confdir}/$1 + fi ;; esac } diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index d2153cb3d..e39237386 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -6375,7 +6375,7 @@ sub isolate_source_interface( $ ) { } else { $source =~ tr/<>/[]/; - if ( $source =~ /^(.+?):(\[(?:.+)\],\[(?:.+)\])$/ ) { + if ( $source =~ /^(.+?):(\[(?:.+),\[(?:.+)\])$/ ) { $iiface = $1; $inets = $2; } elsif ( $source =~ /^(.+?):\[(.+)\]\s*$/ || @@ -6386,7 +6386,7 @@ sub isolate_source_interface( $ ) { $iiface = $1; $inets = $2; } elsif ( $source =~ /:/ ) { - if ( $source =~ /^\[(?:.+)\],\[(?:.+)\]$/ ){ + if ( $source =~ /^\[(?:.+),\[(?:.+)\]$/ ){ $inets = $source; } elsif ( $source =~ /^\[(.+)\]$/ ) { $inets = $1; @@ -6493,7 +6493,7 @@ sub isolate_dest_interface( $$$$ ) { } else { $dest =~ tr/<>/[]/; - if ( $dest =~ /^(.+?):(\[(?:.+)\],\[(?:.+)\])$/ ) { + if ( $dest =~ /^(.+?):(\[(?:.+),\[(?:.+)\])$/ ) { $diface = $1; $dnets = $2; } elsif ( $dest =~ /^(.+?):\[(.+)\]\s*$/ || @@ -6504,7 +6504,7 @@ sub isolate_dest_interface( $$$$ ) { $diface = $1; $dnets = $2; } elsif ( $dest =~ /:/ ) { - if ( $dest =~ /^\[(?:.+)\],\[(?:.+)\]$/ ){ + if ( $dest =~ /^\[(?:.+),\[(?:.+)\]$/ ){ $dnets = $dest; } elsif ( $dest =~ /^\[(.+)\]$/ ) { $dnets = $1; diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std index 0ebd5bf26..4f0c9a2a5 100644 --- a/Shorewall/lib.cli-std +++ b/Shorewall/lib.cli-std @@ -46,7 +46,11 @@ get_config() { fi fi - config=$(find_file $g_program.conf) + if [ "$(id -u)" -eq 0 ]; then + config=$(find_file $g_program.conf) + else + config="$g_shorewalldir/$g_program.conf" + fi if [ -f $config ]; then if [ -r $config ]; then