[apparmor] [patch] severity.py: use re_match_include()
Kshitij Gupta
kgupta8592 at gmail.com
Mon Jun 15 18:06:20 UTC 2015
Hello,
On Mon, Jun 15, 2015 at 12:45 AM, Christian Boltz <apparmor at cboltz.de>
wrote:
> Hello,
>
> load_variables() used a nearly-correct regex. Drop it and use
> re_match_include() instead.
>
>
>
> [ 50-severity-use-re_match_include.diff ]
>
> === modified file utils/apparmor/severity.py
> --- utils/apparmor/severity.py 2015-06-06 14:53:16.868029000 +0200
> +++ utils/apparmor/severity.py 2015-06-14 21:09:57.462206062 +0200
> @@ -15,6 +15,7 @@
> import os
> import re
> from apparmor.common import AppArmorException, open_file_read, warn,
> convert_regexp # , msg, error, debug
> +from apparmor.regex import re_match_include
>
> class Severity(object):
> def __init__(self, dbname=None, default_rank=10):
> @@ -179,16 +180,14 @@
>
> def load_variables(self, prof_path):
> """Loads the variables for the given profile"""
> - regex_include = re.compile('^#?include\s*<(\S*)>')
> if os.path.isfile(prof_path):
> with open_file_read(prof_path) as f_in:
> for line in f_in:
> line = line.strip()
> # If any includes, load variables from them first
> - match = regex_include.search(line)
> + match = re_match_include(line)
> if match:
> - new_path = match.groups()[0]
> - new_path = self.PROF_DIR + '/' + new_path
> + new_path = self.PROF_DIR + '/' + match
> self.load_variables(new_path)
> else:
> # Remove any comments
>
>
> Thanks for the patch.
Acked-by: Kshitij Gupta <kgupta8592 at gmail.com>.
Regards,
Kshitij Gupta
> Regards,
>
> Christian Boltz
> --
> Jetzt bringt das KDE schon ein eigenes shutdown mit? Ist ja ein kHammer!
> (und morgen müssen wir kkernel (von klinux) und kinit installieren, was
> dann mit kbash und kperl das knetzwerk, kindernet, papache, kquid und
> kostfix knochfährt und dann das kX.org köffnet und kkde kanzeigt, kurz:
> Kunix! SKNR.) [Steffen Dettmer in suse-linux]
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/apparmor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150615/006859d3/attachment.html>
More information about the AppArmor
mailing list