[apparmor] [patch] Fix aa-mergeprof crash with files containing multiple profiles

2015-12-26 Thread Christian Boltz
Hello, if a profile file contains multiple profiles, aa-mergeprof crashes on saving in write_profile() because the second profile in the file is not listed in 'changed'. This patch first checks if 'changed' contains the profile before pop()ing it. Reproducer: copy utils/test/cleanprof_test.in

[apparmor] [patch] Better error message on unknown profile lines

2015-12-26 Thread Christian Boltz
Hello, when hitting an unknown line while parsing a profile, it's a good idea to include that line in the error message ;-) I propose this patch for trunk and 2.10 (2.9 would print a literal \n because it doesn't have apparmor.fail, so if we want that patch in 2.9, I'll have to s/\n //') [

[apparmor] [patch] Add more ruletypes to the cleanprof test profiles

2015-12-26 Thread Christian Boltz
Hello, to ensure aa-cleanprof works as expected (and writing the rules works as expected), add some rules for every rule class to the cleanprof.in and cleanprof.out test profiles. [ 48-add-more-ruletypes-to-cleanprof-test.diff ] === modified file ./utils/test/cleanprof_test.in ---

[apparmor] [patch] Dear Santa

2015-12-26 Thread Christian Boltz
Dear Santa, I know I'm late, but - Can you please add the python developer(s) responsible for http://bugs.python.org/issue10076 to your black book? Having to add a workaround for a 5 years old bug, which even has a patch attached to the bugreport, is not nice :-/ [patch] Implement

[apparmor] [patch] Fix wrong usage of write_prof_data in serialize_profile_from_old_profile()

2015-12-26 Thread Christian Boltz
Hello, write_prof_data[hat] is correct (it only contains one profile, see also bug 1528139), write_prof_data[profile][hat] is not and returns an empty (sub)hasher. This affects RE_PROFILE_START and RE_PROFILE_BARE_FILE_ENTRY. I propose this patch for trunk, 2.10 and 2.9. [

[apparmor] [patch] Split off logprof_value_or_all()

2015-12-26 Thread Christian Boltz
Hello, the rule classes have lots of if self.all_foo: foo_txt = _('ALL') else: foo_txt = self.foo in logprof_header_localvars(). To avoid repeating this over and over, split it off to a logprof_value_or_all() function. This function can handle - str

Re: [apparmor] [patch] [1/7] Add a 'details' group to RE_PROFILE_PTRACE

2015-12-26 Thread John Johansen
On 12/08/2015 11:30 AM, Christian Boltz wrote: > Hello, > > as a preparation for the PtraceRule class, add a match group > to RE_PROFILE_PTRACE. > > Also adjust test-regex_matches.py for the added group. > > Note: RE_PROFILE_PTRACE is only used in aa.py, and only matches[0..2] > are used. 0

Re: [apparmor] [patch] [4/7] Add tests for PtraceRule and PtraceRuleset

2015-12-26 Thread John Johansen
On 12/08/2015 11:34 AM, Christian Boltz wrote: > Hello, > > $subject. > As usual, we have 100% test coverage :-) > > Those tests include all tests from test-ptrace_parse.py, therefore > delete this file. > > Acked-by: John Johansen > [ 31-add-ptrace-tests.diff ]

Re: [apparmor] [patch] [6/7] Add support for handling ptrace rules everywhere

2015-12-26 Thread John Johansen
On 12/08/2015 11:38 AM, Christian Boltz wrote: > Hello, > > $subject ;-) > > "Everywhere" means aa-mergeprof and aa-cleanprof. In theory also > aa-logprof, but that needs some code that parses ptrace log events ;-) > > Acked-by: John Johansen > [

Re: [apparmor] [patch] [5/7] Use PtraceRule

2015-12-26 Thread John Johansen
On 12/08/2015 11:37 AM, Christian Boltz wrote: > Hello, > > this patch changes aa.py to use PtraceRule and PtraceRuleset in > profile_storage(), parse_profile_data() and write_ptrace(). This also > means we can drop the now unused parse_ptrace_rule() and > write_ptrace_rules() functions. > >

Re: [apparmor] [patch] [7/7] Add support for ptrace log events to aa-logprof

2015-12-26 Thread John Johansen
On 12/08/2015 11:40 AM, Christian Boltz wrote: > Hello, > > $subject. > > In detail, this means: > - handle ptrace events in logparser.py > - "translate" those events in aa.py - from log (logparser.py readlog()) > to prelog (handle_children()) to log_dict (collapse_log()) to > log_obj

Re: [apparmor] [patch] [7/7] Add support for ptrace log events to aa-logprof

2015-12-26 Thread Christian Boltz
Hello, Am Samstag, 26. Dezember 2015 schrieb John Johansen: > On 12/08/2015 11:40 AM, Christian Boltz wrote: > > $subject. > > > > In detail, this means: > > - handle ptrace events in logparser.py > > - "translate" those events in aa.py - from log (logparser.py > > readlog())> > > to prelog