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
This commit is contained in:
teastep 2006-07-19 13:10:57 +00:00
parent c741ab9e43
commit 7c9ab1a2eb
3 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,5 @@
Changes in 3.3.0
1) Fix output of 'hits' command under busybox 1.2.0.
2) Fixed output of 'hits' with spaces as delimiters in /etc/services.

View File

@ -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.

View File

@ -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