From 7763011f16ffabe9fb0cab4ecbc7da09502e0b77 Mon Sep 17 00:00:00 2001 From: teastep Date: Sat, 10 Apr 2004 16:46:20 +0000 Subject: [PATCH] Restore logic to make find_file() check for SHOREWALL_DIR git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1259 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall2/changelog.txt | 2 ++ Shorewall2/firewall | 3 --- Shorewall2/functions | 28 ++++++++++++++++------------ Shorewall2/shorewall | 6 +----- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Shorewall2/changelog.txt b/Shorewall2/changelog.txt index 7b124ca79..63e06a93a 100644 --- a/Shorewall2/changelog.txt +++ b/Shorewall2/changelog.txt @@ -9,3 +9,5 @@ Changes since 2.0.1 4) Implement CONFIG_PATH. 5) Apply Stijn Jonker's fix for CONFIG_PATH. + +6) Restore logic to make 'find_file' check for SHOREWALL_DIR separately. diff --git a/Shorewall2/firewall b/Shorewall2/firewall index 62f2dae91..f21ed0f90 100755 --- a/Shorewall2/firewall +++ b/Shorewall2/firewall @@ -5740,8 +5740,6 @@ do_initialize() { run_user_exit params - [ -n "$SHOREWALL_DIR" ] && CONFIG_PATH=$SHOREWALL_DIR:$CONFIG_PATH - config=$(find_file shorewall.conf) if [ -f $config ]; then @@ -5755,7 +5753,6 @@ do_initialize() { # Restore CONFIG_PATH if the shorewall.conf file cleared it # [ -n "$CONFIG_PATH" ] || CONFIG_PATH=/etc/shorewall:/usr/share/shorewall - [ -n "$SHOREWALL_DIR" ] && CONFIG_PATH=$SHOREWALL_DIR:$CONFIG_PATH # # Determine the capabilities of the installed iptables/netfilter # diff --git a/Shorewall2/functions b/Shorewall2/functions index d05cc6623..b96bd6704 100755 --- a/Shorewall2/functions +++ b/Shorewall2/functions @@ -94,19 +94,23 @@ find_file() echo $1 ;; *) - saveifs=$IFS - IFS=: - for directory in $CONFIG_PATH; do - if [ -f $directory/$1 ]; then - echo $directory/$1 - IFS=$saveifs - return - fi - done + if [ -n "$SHOREWALL_DIR" -a -f $SHOREWALL_DIR/$1 ]; then + echo $SHOREWALL_DIR/$1 + else + saveifs=$IFS + IFS=: + for directory in $CONFIG_PATH; do + if [ -f $directory/$1 ]; then + echo $directory/$1 + IFS=$saveifs + return + fi + done - IFS=$saveifs - - echo /etc/shorewall/$1 + IFS=$saveifs + + echo /etc/shorewall/$1 + fi ;; esac } diff --git a/Shorewall2/shorewall b/Shorewall2/shorewall index 2f3fbdf28..d08f721a4 100755 --- a/Shorewall2/shorewall +++ b/Shorewall2/shorewall @@ -632,7 +632,6 @@ FUNCTIONS=$SHARED_DIR/functions VERSION_FILE=$SHARED_DIR/version HELP=$SHARED_DIR/help CONFIG_PATH=/etc/shorewall:/usr/share/shorewall -[ -n "$SHOREWALL_DIR" ] && CONFIG_PATH=$SHOREWALL_DIR:$CONFIG_PATH if [ -f $FUNCTIONS ]; then . $FUNCTIONS @@ -650,10 +649,7 @@ else exit 2 fi -if [ -z "$CONFIG_PATH" ]; then - CONFIG_PATH=/etc/shorewall:/usr/share/shorewall - [ -n "$SHOREWALL_DIR" ] && CONFIG_PATH=$SHOREWALL_DIR:$CONFIG_PATH -fi +[ -z "$CONFIG_PATH" ] && CONFIG_PATH=/etc/shorewall:/usr/share/shorewall [ -z "${STATEDIR}" ] && STATEDIR=/var/state/shorewall