Merge lp:~chipaca/ubuntu-core-security/usaaage into lp:~ubuntu-security/ubuntu-core-security/trunk

Proposed by John Lenton on 2015-06-16
Status: Merged
Merged at revision: 77
Proposed branch: lp:~chipaca/ubuntu-core-security/usaaage
Merge into: lp:~ubuntu-security/ubuntu-core-security/trunk
Diff against target: 24 lines (+6/-1)
1 file modified
bin/sc-logresolve (+6/-1)
To merge this branch: bzr merge lp:~chipaca/ubuntu-core-security/usaaage
Reviewer Review Type Date Requested Status
Jamie Strandboge 2015-06-16 Approve on 2015-06-16
Review via email: mp+262115@code.launchpad.net

Commit Message

In sc-logresolve: show usage if -h or --help is given; drop spurious cat; use -- to avoid grep treating logfile as an option.

Description of the Change

I came to add a call to usage() in sc-logresolve, that had usage but was never called.

I then saw a spurious cat, so I removed it.

Then I noticed we weren't protecting $logfile from being treated as an option, so I added that.

This last item makes sc-logresolve no longer work with BSD grep.

To post a comment you must log in.
Jamie Strandboge (jdstrand) wrote :

LGTM. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/sc-logresolve'
2--- bin/sc-logresolve 2015-03-31 21:20:15 +0000
3+++ bin/sc-logresolve 2015-06-16 17:20:35 +0000
4@@ -19,6 +19,11 @@
5 }
6
7 if [ -n "$1" ]; then
8+ if [ "$1" = "-h" -o "$1" = "--help" ]; then
9+ usage
10+ exit 0
11+ fi
12+
13 logfile="$1"
14 shift
15 fi
16@@ -27,7 +32,7 @@
17 logfile="/dev/stdin"
18 fi
19
20-cat "$logfile" | grep 'audit: type=1326' | while read line ; do
21+grep 'audit: type=1326' -- "$logfile" | while read line ; do
22 call=`echo "$line" | sed 's/.* \(syscall=[0-9]\+\) .*/\1/g' | cut -d '=' -f 2`
23 name=`scmp_sys_resolver $call`
24 echo "$line" | sed "s/ syscall=$call / syscall=$call($name) /"

Subscribers

People subscribed via source and target branches