[apparmor] [patch] fix error handling in aa-decode

Seth Arnold seth.arnold at gmail.com
Sun Sep 16 23:42:21 UTC 2012


This fix looks good, but is anyone else a bit worried about how much handling is done via external programs?

Also I seem to remeber that the last time I used this tool I wanted something like: tail -f audit.log | aa-decode. I don't think that worked -- and this code reinforces my recollection.
-----Original Message-----
From: Christian Boltz <apparmor at cboltz.de>
Sender: apparmor-bounces at lists.ubuntu.com
Date: Mon, 17 Sep 2012 01:00:56 
To: <apparmor at lists.ubuntu.com>
Subject: [apparmor] [patch] fix error handling in aa-decode

Hello,

# aa-decode foobar
String should only contain hex characters (0-9, a-f, A-F)
/usr/sbin/aa-decode: Zeile 53: return: can only `return' from a function or sourced script

The first part of the error message is expected with a non-hex 
parameter, the second part isn't ;-)

The following patch fixes it:

=== modified file 'utils/aa-decode'
--- utils/aa-decode     2010-01-12 13:19:20 +0000
+++ utils/aa-decode     2012-09-16 22:51:58 +0000
@@ -50,7 +50,7 @@
     e=`echo "$1" | tr -s '[:lower:]' '[:upper:]'`
     if ! echo "$e" | egrep -q "^[0-9A-F]+$" ; then
         echo "String should only contain hex characters (0-9, a-f, A-F)"
-        return
+        exit 1
     fi
 
     d=`decode $e`





Regards,

Christian Boltz
-- 
> ich mochte gerne fur eine unbestimte Zeit Linux von meiner 
> Festplatte werfen wie mache ich das genau?  [Glenn Charpantier]
Nimm die Platte aus dem Rechner, und pack sie ganz fest mit der Hand.
Dann machst Du eine heftige Wurfbewegung, als wolltest Du die Platte
ganz weit weg werfen. [...] Wenn die Bewgeung heftig genug war, ist
Linux nun von der Platte gefallen. [Adalbert Michelic in suse-linux]


-- 
AppArmor mailing list
AppArmor at lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor


More information about the AppArmor mailing list