[apparmor] [patch] fix aa-decode stdin handling

Steve Beattie steve at nxnw.org
Mon Oct 15 21:53:12 UTC 2012


On Wed, Oct 10, 2012 at 02:24:48AM +0200, Christian Boltz wrote:
> Changes compared to my first patch:
> - replace tr calls by perl's uc() (also for non-stdin mode)

Ah cool.

> - also handle encoded profile names (introduced by Steve)
> - don't fail if a file or profile name contains a '

My sed-a-rific you-now-have-two-problems version didn't seem to fail
with an encoded ', but definitely did with \^ (yes, I've added specific
testcases for those to my new testscript).

> BTW: I intentionally added the "name=" part in the replacement
>     line="${line/name=$ne/name=\"$nd\"}"
> It might look superfluous, but it ensures that the correct part is 
> replaced.

Yeah, I got that it was to ensure the correct replacement occurred.

In any event, Acked-By: Steve Beattie <sbeattie at ubuntu.com>

> I didn't test the testscript yet, but having one is a good idea ;-)

It's fairly simply to drive; from the utils/ directory, do:

  python test/test-aa-decode.py

(add -v to see the individual testcase descriptions listed.) You
will of course need a python installed; either/both python 2.x and
3.x should work (though 2.x may need to be 2.6 or newer). It also
gets triggered by a 'make check' in the utils/ directory.

Attached is an updated version of the test script; changes include

 - add testcases that include encoded "'" and "\^" strings
 - add a helper test run function that makes adding new testcases
   easier, basically define the log input content and a list of
   strings you expect to see in the output, pass them to the
   helper function and it does the rest.

Thanks!

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aa-decode-tests.patch
Type: text/x-diff
Size: 9050 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20121015/6c444544/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20121015/6c444544/attachment.pgp>


More information about the AppArmor mailing list