From 7c9ab1a2ebf7e0bbb004a7c17761654b9b24d3fd Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 19 Jul 2006 13:10:57 +0000 Subject: [PATCH] Fix 'hits' output with space delimiters in /etc/services git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4241 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-lite/changelog.txt | 4 +++- Shorewall-lite/releasenotes.txt | 4 ++++ Shorewall-lite/shorewall-lite | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Shorewall-lite/changelog.txt b/Shorewall-lite/changelog.txt index 16c9f81af..4e89ea6ef 100644 --- a/Shorewall-lite/changelog.txt +++ b/Shorewall-lite/changelog.txt @@ -1,3 +1,5 @@ Changes in 3.3.0 -1) Fix output of 'hits' command under busybox 1.2.0. +1) Fix output of 'hits' command under busybox 1.2.0. + +2) Fixed output of 'hits' with spaces as delimiters in /etc/services. diff --git a/Shorewall-lite/releasenotes.txt b/Shorewall-lite/releasenotes.txt index 783484066..0efc6791c 100644 --- a/Shorewall-lite/releasenotes.txt +++ b/Shorewall-lite/releasenotes.txt @@ -5,6 +5,10 @@ Problems Corrected in 3.3.0 1) The output formating of the 'hits' command under BusyBox 1.2.0 has been corrected. +2) The output of the 'hits' command was previously scrambled if + /etc/services contained spaces as column delimiters rather than + tabs. + Other changes in 3.3.0 None. diff --git a/Shorewall-lite/shorewall-lite b/Shorewall-lite/shorewall-lite index f051fd1cb..84682df11 100755 --- a/Shorewall-lite/shorewall-lite +++ b/Shorewall-lite/shorewall-lite @@ -1350,7 +1350,7 @@ case "$COMMAND" in grep "$LOGFORMAT.*DPT" $LOGFILE | sed 's/\(.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2/' | sort | uniq -c | sort -rn | \ while read count port ; do # List all services defined for the given port - srv=$(grep "^[^#].*\\b$port/" /etc/services | cut -f 1 | sort -u) + srv=$(grep "^[^#].*\\b$port/" /etc/services | cut -f 1 | cut -f 1 -d' ' | sort -u) srv=$(echo $srv | sed 's/ /,/g') if [ -n "$srv" ] ; then