From 859c41abbf6f39207f3ce5a962b8b8577fdb4b90 Mon Sep 17 00:00:00 2001 From: teastep Date: Sat, 10 Mar 2007 17:07:43 +0000 Subject: [PATCH] Remove CONFIG_PATH scaffolding; fix 'isolate_action' git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5484 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- New/compiler.pl | 23 +++++------------------ New/lib.config | 2 ++ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/New/compiler.pl b/New/compiler.pl index 554f12ca7..218cfa938 100755 --- a/New/compiler.pl +++ b/New/compiler.pl @@ -48,6 +48,7 @@ my %config = ( STARTUP_ENABLED => undef, SUBSYSLOCK => undef, MODULESDIR => undef, #CONFIG_PATH is inherited + CONFIG_PATH => undef, RESTOREFILE => undef, IPSECFILE => undef, # @@ -331,15 +332,6 @@ my %default_actions = ( DROP => 'none' , ACCEPT => 'none' , QUEUE => 'none' ); -sub ensure_config_path() { - $config{CONFIG_PATH} = $env{CONFDIR} . $env{SHAREDIR} unless $config{CONFIG_PATH}; - - if ( $ENV{SHOREWALL_DIR} ) { - ( my ( $firstdir ) = $config{CONFIG_PATH} ) =~ s/:.*//; - $config{CONFIG_PATH} = "$ENV{SHOREWALL_DIR}:" . $config{CONFIG_PATH} if $ENV{SHOREWALL_DIR} ne $firstdir; - } -} - # # Search the CONFIG_PATH for the passed file # @@ -353,7 +345,7 @@ sub find_file($) my $directory; - for $directory ( split ':', $config{CONFIG_PATH} ) { + for $directory ( split ':', $ENV{CONFIG_PATH} ) { my $file = "$directory/$filename"; return $file if -f $file; } @@ -1188,11 +1180,10 @@ sub split_action ( $ ) { } # -# Get Action Type +# Get Macro Name # sub isolate_action( $ ) { - my ( $action , $undef ) = split '/', $_[0]; - $targets{$action} || ''; + ( split '/' , $_[0] )[0]; } # This function substitutes the second argument for the first part of the first argument up to the first colon (":") @@ -4227,7 +4218,7 @@ sub process_action3( $$$$$ ) { my ( $action2 , $level2 ) = split_action $target2; - my $action2type = isolate_action $action2; + my $action2type = $targets{isolate_action $action2}; unless ( $action2type == STANDARD ) { if ( $target eq 'COMMENT' ) { @@ -5076,8 +5067,6 @@ sub create_iptables_restore_file() { # Read the shorewall.conf file and establish global hashes %config and %env. # sub do_initialize() { - ensure_config_path; - my $file = find_file 'shorewall.conf'; if ( -f $file ) { @@ -5110,8 +5099,6 @@ sub do_initialize() { fatal_error "$file does not exist!"; } - ensure_config_path; - $file = find_file 'capabilities'; if ( -f $file ) { diff --git a/New/lib.config b/New/lib.config index fed139477..801d31c81 100644 --- a/New/lib.config +++ b/New/lib.config @@ -2075,6 +2075,7 @@ do_initialize() { fi [ "x${SHOREWALL_DIR}" = "x." ] && SHOREWALL_DIR="$PWD" + [ -n "${RESTOREFILE:=restore}" ] case "${DROP_DEFAULT:=Drop}" in @@ -2179,6 +2180,7 @@ do_initialize() { strip_file_and_lib_load tunnels tunnels report_capabilities1 > $TMP_DIR/capabilities export TMP_DIR + export CONFIG_PATH fi # # Clear $FW