diff --git a/Shorewall2/changelog.txt b/Shorewall2/changelog.txt index 0a2af3bac..45d1ee518 100644 --- a/Shorewall2/changelog.txt +++ b/Shorewall2/changelog.txt @@ -5,6 +5,9 @@ Changes in 2.2.2 2) Enhanced support in the SOURCE column of /etc/shorewall/tcrules. +3) All calls to 'clear' are now conditional on the output device being + a terminal. + Changes in 2.2.1 1) Add examples to the zones and policy files. diff --git a/Shorewall2/releasenotes.txt b/Shorewall2/releasenotes.txt index e9c2868b6..f04afaacb 100755 --- a/Shorewall2/releasenotes.txt +++ b/Shorewall2/releasenotes.txt @@ -9,9 +9,13 @@ Problems corrected in version 2.2.2 ----------------------------------------------------------------------- New Features in version 2.2.2 -1) The SOURCE column in the /etc/shorewall/tcrules now allows $FW to - be optionally followed by ":" and a host/network address or address - range. +1) The SOURCE column in the /etc/shorewall/tcrules file now allows $FW + to be optionally followed by ":" and a host/network address or + address range. + +2) Shorewall now clears the output device only if it is a + terminal. This avoids ugly control sequences being placed in files + when /sbin/shorewall output is redirected. ----------------------------------------------------------------------- Problems corrected in version 2.2.1 diff --git a/Shorewall2/shorewall b/Shorewall2/shorewall index 6da5f1245..7b109fea7 100755 --- a/Shorewall2/shorewall +++ b/Shorewall2/shorewall @@ -220,6 +220,13 @@ get_config() { } +# +# Clear descriptor 1 if it is a terminal +# +clear_term() { + [ -t 1 ] && clear +} + # # Display IPTABLES rules -- we used to store them in a variable but ash # dies when trying to display large sets of rules @@ -238,7 +245,7 @@ display_chains() $IPTABLES -L $IPT_OPTIONS >> $TMPFILE - clear + clear_term echo "$banner $(date)" echo echo "Standard Chains" @@ -250,7 +257,7 @@ display_chains() timed_read - clear + clear_term echo "$banner $(date)" echo firstchain=Yes @@ -268,7 +275,7 @@ display_chains() for zone in $zones; do if [ -n "$(grep "^Chain \.*${zone}" $TMPFILE)" ] ; then - clear + clear_term echo "$banner $(date)" echo firstchain=Yes @@ -287,7 +294,7 @@ display_chains() fi done - clear + clear_term echo "$banner $(date)" echo firstchain=Yes @@ -308,7 +315,7 @@ display_chains() timed_read - clear + clear_term echo "$banner $(date)" echo firstchain=Yes @@ -443,7 +450,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that while true; do display_chains - clear + clear_term echo "$banner $(date)" echo @@ -474,7 +481,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that timed_read fi - clear + clear_term echo "$banner $(date)" echo echo "NAT Status" @@ -482,7 +489,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that $IPTABLES -t nat -L $IPT_OPTIONS timed_read - clear + clear_term echo "$banner $(date)" echo echo @@ -491,7 +498,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that $IPTABLES -t mangle -L $IPT_OPTIONS timed_read - clear + clear_term echo "$banner $(date)" echo echo @@ -500,7 +507,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that cat /proc/net/ip_conntrack timed_read - clear + clear_term echo "$banner $(date)" echo echo @@ -509,7 +516,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that show_tc timed_read - clear + clear_term echo "$banner $(date)" echo echo @@ -541,7 +548,7 @@ logwatch() # $1 = timeout -- if negative, prompt each time that qt which awk && haveawk=Yes || haveawk= while true; do - clear + clear_term echo "$banner $(date)" echo @@ -960,7 +967,7 @@ case "$1" in status) [ -n "$debugging" ] && set -x [ $# -eq 1 ] || usage 1 - clear + clear_term echo "Shorewall-$version Status at $HOSTNAME - $(date)" echo show_reset @@ -1029,7 +1036,7 @@ case "$1" in hits) [ -n "$debugging" ] && set -x [ $# -eq 1 ] || usage 1 - clear + clear_term echo "Shorewall-$version Hits at $HOSTNAME - $(date)" echo