[apparmor] [patch] severity.py: use re_match_include()
Christian Boltz
apparmor at cboltz.de
Sun Jun 14 19:15:19 UTC 2015
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
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]
More information about the AppArmor
mailing list