diff --git a/Shorewall/compiler b/Shorewall/compiler index abfa24694..b14139346 100755 --- a/Shorewall/compiler +++ b/Shorewall/compiler @@ -107,9 +107,24 @@ indent() { } # -# Echo the contents of the passed file indented by $INDENT and perform INCLUDE processing. +# Echo the contents of the passed file indented by $INDENT while handling line continuation # indent1() { + if [ -n "$INDENT" ]; then + if [ -n "$HAVEAWK" ]; then + eval awk \''BEGIN { indent=1; }; /^[[:space:]]*$/ { print ""; indent=1; next; }; { if (indent == 1) print "'"$INDENT"'" $0; else print; }; { indent=1; }; /\\$/ { indent=0; };'\' $1 + else + eval sed \'s\/^/"$INDENT"\/\' $1 + fi + else + cat $1 + fi +} + +# +# Echo the contents of the passed file indented by $INDENT and perform INCLUDE processing. +# +indent2() { if [ -n "$INDENT" ]; then read_file $1 0 | eval sed \'s\/^/"$INDENT"\/\' else @@ -140,6 +155,20 @@ append_file() # $1 = File Name esac } +# +# Append a file to the compiler's output with indentation and INCLUDE expansion. +# +append_file1() # $1 = File Name +{ + local user_exit=$(find_file $1) + + if [ -f $user_exit ]; then + save_progress_message "Processing $user_exit ..." + indent2 $user_exit >&3 + save_command + fi +} + # # Generate a command to run iptables # @@ -5086,7 +5115,7 @@ __EOF__ __EOF__ fi - append_file params + append_file1 params cat >&3 << __EOF__ diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index 991f4c4a2..933ab04a9 100644 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -73,8 +73,13 @@ Problems Corrected in 3.4.0 RC1 This problem has been corrected in RC1. 4) Previously, if "INCLUDE " appeared in - /etc/shorewall/params or in an extension script then run-time - errors occurred. + /etc/shorewall/params then run-time errors occurred. + + As part of the fix for this problem, the mechanism by which + /etc/shorewall/params is copied into the compiler output was + changed. As a result, extra white space is removed from the text + during the copy operation so code in /etc/shorewall/params should + not depend on precise white-space, even in quoted strings. Other Changes in 3.4.0 RC 1