mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Break lines before binary operators.
This commit is contained in:
parent
ef2e6c62e7
commit
ea3fb60007
@ -75,8 +75,8 @@ class AAPythonBindingsTests(unittest.TestCase):
|
|||||||
|
|
||||||
expected = self.parse_output_file(outfile)
|
expected = self.parse_output_file(outfile)
|
||||||
self.assertEqual(expected, record,
|
self.assertEqual(expected, record,
|
||||||
"expected records did not match\n" +
|
"expected records did not match\n"
|
||||||
"expected = %s\nactual = %s" % (expected, record))
|
"expected = %s\nactual = %s" % (expected, record))
|
||||||
|
|
||||||
def parse_output_file(self, outfile):
|
def parse_output_file(self, outfile):
|
||||||
"""parse testcase .out file and return dict"""
|
"""parse testcase .out file and return dict"""
|
||||||
|
@ -10,10 +10,10 @@ from pathlib import Path
|
|||||||
def is_excluded(f):
|
def is_excluded(f):
|
||||||
return (re.match(
|
return (re.match(
|
||||||
# skip test scripts and the rc.apparmor.slackware initscript
|
# skip test scripts and the rc.apparmor.slackware initscript
|
||||||
r"^([.]git/|parser/tst/|tests/|utils/test/|parser/rc[.]apparmor[.]slackware)" +
|
r"^([.]git/|parser/tst/|tests/|utils/test/|parser/rc[.]apparmor[.]slackware)"
|
||||||
"|" +
|
+ "|"
|
||||||
# skip several files generated during libapparmor build
|
# skip several files generated during libapparmor build
|
||||||
r"^libraries/libapparmor/(compile|config[.]guess|config[.]status|config[.]sub|configure|depcomp|install-sh|libtool|ltmain[.]sh|missing|test-driver|ylwrap|testsuite/test_multi[.]multi)",
|
+ r"^libraries/libapparmor/(compile|config[.]guess|config[.]status|config[.]sub|configure|depcomp|install-sh|libtool|ltmain[.]sh|missing|test-driver|ylwrap|testsuite/test_multi[.]multi)",
|
||||||
f,
|
f,
|
||||||
) or Path(f).is_dir())
|
) or Path(f).is_dir())
|
||||||
|
|
||||||
|
@ -1922,8 +1922,8 @@ def parse_profile_data(data, file, do_include, in_preamble):
|
|||||||
|
|
||||||
if profile_data.get(profname, False):
|
if profile_data.get(profname, False):
|
||||||
raise AppArmorException(
|
raise AppArmorException(
|
||||||
'Profile %(profile)s defined twice in %(file)s, last found in line %(line)s' %
|
'Profile %(profile)s defined twice in %(file)s, last found in line %(line)s'
|
||||||
{'file': file, 'line': lineno + 1, 'profile': combine_name(profile, hat)})
|
% {'file': file, 'line': lineno + 1, 'profile': combine_name(profile, hat)})
|
||||||
|
|
||||||
profile_data[profname] = prof_storage
|
profile_data[profname] = prof_storage
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ def convert_regexp(regexp):
|
|||||||
|
|
||||||
def user_perm(prof_dir):
|
def user_perm(prof_dir):
|
||||||
if not os.access(prof_dir, os.W_OK):
|
if not os.access(prof_dir, os.W_OK):
|
||||||
sys.stdout.write("Cannot write to profile directory.\n" +
|
sys.stdout.write("Cannot write to profile directory.\n"
|
||||||
"Please run as a user with appropriate permissions.\n")
|
"Please run as a user with appropriate permissions.\n")
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
@ -285,8 +285,8 @@ class ReadLog:
|
|||||||
self.parse_event_for_tree(event)
|
self.parse_event_for_tree(event)
|
||||||
|
|
||||||
except AppArmorException as e:
|
except AppArmorException as e:
|
||||||
ex_msg = ('%(msg)s\n\nThis error was caused by the log line:\n%(logline)s' %
|
ex_msg = ('%(msg)s\n\nThis error was caused by the log line:\n%(logline)s'
|
||||||
{'msg': e.value, 'logline': line})
|
% {'msg': e.value, 'logline': line})
|
||||||
raise AppArmorBug(ex_msg) from None
|
raise AppArmorBug(ex_msg) from None
|
||||||
|
|
||||||
self.logmark = ''
|
self.logmark = ''
|
||||||
|
@ -56,33 +56,33 @@ RE_PROFILE_UNIX = re.compile(RE_AUDIT_DENY + '(unix\s*,|unix\s+[^#]*\s*,)' + RE_
|
|||||||
__re_no_or_quoted_hash = '([^#"]|"[^"]*")*'
|
__re_no_or_quoted_hash = '([^#"]|"[^"]*")*'
|
||||||
|
|
||||||
RE_RULE_HAS_COMMA = re.compile(
|
RE_RULE_HAS_COMMA = re.compile(
|
||||||
'^' + __re_no_or_quoted_hash +
|
'^' + __re_no_or_quoted_hash
|
||||||
',\s*(#.*)?$') # match comma plus any trailing comment
|
+ ',\s*(#.*)?$') # match comma plus any trailing comment
|
||||||
RE_HAS_COMMENT_SPLIT = re.compile(
|
RE_HAS_COMMENT_SPLIT = re.compile(
|
||||||
'^(?P<not_comment>' + __re_no_or_quoted_hash + ')' + # store in 'not_comment' group
|
'^(?P<not_comment>' + __re_no_or_quoted_hash + ')' # store in 'not_comment' group
|
||||||
'(?P<comment>#.*)$') # match trailing comment and store in 'comment' group
|
+ '(?P<comment>#.*)$') # match trailing comment and store in 'comment' group
|
||||||
|
|
||||||
|
|
||||||
RE_PROFILE_START = re.compile(
|
RE_PROFILE_START = re.compile(
|
||||||
'^(?P<leadingspace>\s*)' +
|
'^(?P<leadingspace>\s*)'
|
||||||
'(' +
|
+ '('
|
||||||
RE_PROFILE_PATH_OR_VAR % 'plainprofile' + # just a path
|
+ RE_PROFILE_PATH_OR_VAR % 'plainprofile' # just a path
|
||||||
'|' + # or
|
+ '|' # or
|
||||||
'(' + 'profile' + '\s+' + RE_PROFILE_NAME % 'namedprofile' + '(\s+' + RE_PROFILE_PATH_OR_VAR % 'attachment' + ')?' + ')' + # 'profile', profile name, optionally attachment
|
+ '(' + 'profile' + '\s+' + RE_PROFILE_NAME % 'namedprofile' + '(\s+' + RE_PROFILE_PATH_OR_VAR % 'attachment' + ')?' + ')' # 'profile', profile name, optionally attachment
|
||||||
')' +
|
+ ')'
|
||||||
RE_XATTRS +
|
+ RE_XATTRS
|
||||||
RE_FLAGS +
|
+ RE_FLAGS
|
||||||
'\s*\{' +
|
+ '\s*\{'
|
||||||
RE_EOL)
|
+ RE_EOL)
|
||||||
|
|
||||||
|
|
||||||
RE_PROFILE_CHANGE_PROFILE = re.compile(
|
RE_PROFILE_CHANGE_PROFILE = re.compile(
|
||||||
RE_AUDIT_DENY +
|
RE_AUDIT_DENY
|
||||||
'change_profile' +
|
+ 'change_profile'
|
||||||
'(\s+' + RE_SAFE_OR_UNSAFE + ')?' + # optionally exec mode
|
+ '(\s+' + RE_SAFE_OR_UNSAFE + ')?' # optionally exec mode
|
||||||
'(\s+' + RE_PROFILE_PATH_OR_VAR % 'execcond' + ')?' + # optionally exec condition
|
+ '(\s+' + RE_PROFILE_PATH_OR_VAR % 'execcond' + ')?' # optionally exec condition
|
||||||
'(\s+->\s*' + RE_PROFILE_NAME % 'targetprofile' + ')?' + # optionally '->' target profile
|
+ '(\s+->\s*' + RE_PROFILE_NAME % 'targetprofile' + ')?' # optionally '->' target profile
|
||||||
RE_COMMA_EOL)
|
+ RE_COMMA_EOL)
|
||||||
|
|
||||||
|
|
||||||
# RE_PATH_PERMS is as restrictive as possible, but might still cause mismatches when adding different rule types.
|
# RE_PATH_PERMS is as restrictive as possible, but might still cause mismatches when adding different rule types.
|
||||||
@ -90,26 +90,26 @@ RE_PROFILE_CHANGE_PROFILE = re.compile(
|
|||||||
RE_PATH_PERMS = '(?P<%s>[mrwalkPUCpucix]+)'
|
RE_PATH_PERMS = '(?P<%s>[mrwalkPUCpucix]+)'
|
||||||
|
|
||||||
RE_PROFILE_FILE_ENTRY = re.compile(
|
RE_PROFILE_FILE_ENTRY = re.compile(
|
||||||
RE_AUDIT_DENY +
|
RE_AUDIT_DENY
|
||||||
'(?P<owner>owner\s+)?' + # optionally: <owner>
|
+ '(?P<owner>owner\s+)?' # optionally: <owner>
|
||||||
'(' +
|
+ '('
|
||||||
'(?P<bare_file>file)' + # bare 'file,'
|
+ '(?P<bare_file>file)' # bare 'file,'
|
||||||
'|' + # or
|
+ '|' # or
|
||||||
'(?P<file_keyword>file\s+)?' + # optional 'file' keyword
|
+ '(?P<file_keyword>file\s+)?' # optional 'file' keyword
|
||||||
'(' +
|
+ '('
|
||||||
RE_PROFILE_PATH_OR_VAR % 'path' + '\s+' + RE_PATH_PERMS % 'perms' + # path and perms
|
+ RE_PROFILE_PATH_OR_VAR % 'path' + '\s+' + RE_PATH_PERMS % 'perms' # path and perms
|
||||||
'|' + # or
|
+ '|' # or
|
||||||
RE_PATH_PERMS % 'perms2' + '\s+' + RE_PROFILE_PATH_OR_VAR % 'path2' + # perms and path
|
+ RE_PATH_PERMS % 'perms2' + '\s+' + RE_PROFILE_PATH_OR_VAR % 'path2' # perms and path
|
||||||
')' +
|
+ ')'
|
||||||
'(\s+->\s*' + RE_PROFILE_NAME % 'target' + ')?' +
|
+ '(\s+->\s*' + RE_PROFILE_NAME % 'target' + ')?'
|
||||||
'|' + # or
|
+ '|' # or
|
||||||
'(?P<link_keyword>link\s+)' + # 'link' keyword
|
+ '(?P<link_keyword>link\s+)' # 'link' keyword
|
||||||
'(?P<subset_keyword>subset\s+)?' + # optional 'subset' keyword
|
+ '(?P<subset_keyword>subset\s+)?' # optional 'subset' keyword
|
||||||
RE_PROFILE_PATH_OR_VAR % 'link_path' + # path
|
+ RE_PROFILE_PATH_OR_VAR % 'link_path' # path
|
||||||
'\s+' + '->' + '\s+' + # ' -> '
|
+ '\s+' + '->' + '\s+' # ' -> '
|
||||||
RE_PROFILE_PATH_OR_VAR % 'link_target' + # path
|
+ RE_PROFILE_PATH_OR_VAR % 'link_target' # path
|
||||||
')' +
|
+ ')'
|
||||||
RE_COMMA_EOL)
|
+ RE_COMMA_EOL)
|
||||||
|
|
||||||
|
|
||||||
def parse_profile_start_line(line, filename):
|
def parse_profile_start_line(line, filename):
|
||||||
|
@ -508,15 +508,15 @@ def check_and_split_list(lst, allowed_keywords, all_obj, classname, keyword_name
|
|||||||
result_list = set(lst)
|
result_list = set(lst)
|
||||||
else:
|
else:
|
||||||
raise AppArmorBug(
|
raise AppArmorBug(
|
||||||
'Passed unknown %(type)s object to %(classname)s: %(unknown_object)s' %
|
'Passed unknown %(type)s object to %(classname)s: %(unknown_object)s'
|
||||||
{'type': type(lst), 'classname': classname, 'unknown_object': str(lst)})
|
% {'type': type(lst), 'classname': classname, 'unknown_object': str(lst)})
|
||||||
|
|
||||||
unknown_items = set()
|
unknown_items = set()
|
||||||
for item in result_list:
|
for item in result_list:
|
||||||
if not item.strip():
|
if not item.strip():
|
||||||
raise AppArmorBug(
|
raise AppArmorBug(
|
||||||
'Passed empty %(keyword_name)s to %(classname)s' %
|
'Passed empty %(keyword_name)s to %(classname)s'
|
||||||
{'keyword_name': keyword_name, 'classname': classname})
|
% {'keyword_name': keyword_name, 'classname': classname})
|
||||||
if item not in allowed_keywords:
|
if item not in allowed_keywords:
|
||||||
unknown_items.add(item)
|
unknown_items.add(item)
|
||||||
|
|
||||||
|
@ -41,27 +41,27 @@ RE_FLAG = '(?P<%s>(\S+|"[^"]+"|\(\s*\S+\s*\)|\(\s*"[^"]+"\)\s*))' # string with
|
|||||||
# XXX this regex will allow repeated parameters, last one wins
|
# XXX this regex will allow repeated parameters, last one wins
|
||||||
# XXX (the parser will reject such rules)
|
# XXX (the parser will reject such rules)
|
||||||
RE_DBUS_DETAILS = re.compile(
|
RE_DBUS_DETAILS = re.compile(
|
||||||
'^' +
|
'^'
|
||||||
'(\s+(?P<access>' + RE_ACCESS_KEYWORDS + '))?' + # optional access keyword(s)
|
+ '(\s+(?P<access>' + RE_ACCESS_KEYWORDS + '))?' # optional access keyword(s)
|
||||||
'((\s+(bus\s*=\s*' + RE_FLAG % 'bus' + '))?|' + # optional bus= system | session | AARE, (...) optional
|
+ '((\s+(bus\s*=\s*' + RE_FLAG % 'bus' + '))?|' # optional bus= system | session | AARE, (...) optional
|
||||||
'(\s+(path\s*=\s*' + RE_FLAG % 'path' + '))?|' + # optional path=AARE, (...) optional
|
+ '(\s+(path\s*=\s*' + RE_FLAG % 'path' + '))?|' # optional path=AARE, (...) optional
|
||||||
'(\s+(name\s*=\s*' + RE_FLAG % 'name' + '))?|' + # optional name=AARE, (...) optional
|
+ '(\s+(name\s*=\s*' + RE_FLAG % 'name' + '))?|' # optional name=AARE, (...) optional
|
||||||
'(\s+(interface\s*=\s*' + RE_FLAG % 'interface' + '))?|' + # optional interface=AARE, (...) optional
|
+ '(\s+(interface\s*=\s*' + RE_FLAG % 'interface' + '))?|' # optional interface=AARE, (...) optional
|
||||||
'(\s+(member\s*=\s*' + RE_FLAG % 'member' + '))?|' + # optional member=AARE, (...) optional
|
+ '(\s+(member\s*=\s*' + RE_FLAG % 'member' + '))?|' # optional member=AARE, (...) optional
|
||||||
'(\s+(peer\s*=\s*\((,|\s)*' + # optional peer=(name=AARE and/or label=AARE), (...) required
|
+ '(\s+(peer\s*=\s*\((,|\s)*' # optional peer=(name=AARE and/or label=AARE), (...) required
|
||||||
'(' +
|
+ '('
|
||||||
'(' + '(,|\s)*' + ')' + # empty peer=()
|
+ '(' + '(,|\s)*' + ')' # empty peer=()
|
||||||
'|' # or
|
+ '|' # or
|
||||||
'(' + 'name\s*=\s*' + RE_PROFILE_NAME % 'peername1' + ')' + # only peer name (match group peername1)
|
+ '(' + 'name\s*=\s*' + RE_PROFILE_NAME % 'peername1' + ')' # only peer name (match group peername1)
|
||||||
'|' # or
|
+ '|' # or
|
||||||
'(' + 'label\s*=\s*' + RE_PROFILE_NAME % 'peerlabel1' + ')' + # only peer label (match group peerlabel1)
|
+ '(' 'label\s*=\s*' + RE_PROFILE_NAME % 'peerlabel1' + ')' # only peer label (match group peerlabel1)
|
||||||
'|' # or
|
+ '|' # or
|
||||||
'(' + 'name\s*=\s*' + RE_PROFILE_NAME % 'peername2' + '(,|\s)+' + 'label\s*=\s*' + RE_PROFILE_NAME % 'peerlabel2' + ')' + # peer name + label (match name peername2/peerlabel2)
|
+ '(' + 'name\s*=\s*' + RE_PROFILE_NAME % 'peername2' + '(,|\s)+' + 'label\s*=\s*' + RE_PROFILE_NAME % 'peerlabel2' + ')' # peer name + label (match name peername2/peerlabel2)
|
||||||
'|' # or
|
+ '|' # or
|
||||||
'(' + 'label\s*=\s*' + RE_PROFILE_NAME % 'peerlabel3' + '(,|\s)+' + 'name\s*=\s*' + RE_PROFILE_NAME % 'peername3' + ')' + # peer label + name (match name peername3/peerlabel3)
|
+ '(' + 'label\s*=\s*' + RE_PROFILE_NAME % 'peerlabel3' + '(,|\s)+' + 'name\s*=\s*' + RE_PROFILE_NAME % 'peername3' + ')' # peer label + name (match name peername3/peerlabel3)
|
||||||
')'
|
+ ')'
|
||||||
'(,|\s)*\)))?){0,6}'
|
+ '(,|\s)*\)))?){0,6}'
|
||||||
'\s*$')
|
+ '\s*$')
|
||||||
|
|
||||||
|
|
||||||
class DbusRule(BaseRule):
|
class DbusRule(BaseRule):
|
||||||
|
@ -39,10 +39,10 @@ RE_NETWORK_TYPE = '(' + '|'.join(network_type_keywords) + ')'
|
|||||||
RE_NETWORK_PROTOCOL = '(' + '|'.join(network_protocol_keywords) + ')'
|
RE_NETWORK_PROTOCOL = '(' + '|'.join(network_protocol_keywords) + ')'
|
||||||
|
|
||||||
RE_NETWORK_DETAILS = re.compile(
|
RE_NETWORK_DETAILS = re.compile(
|
||||||
'^\s*' +
|
'^\s*'
|
||||||
'(?P<domain>' + RE_NETWORK_DOMAIN + ')?' + # optional domain
|
+ '(?P<domain>' + RE_NETWORK_DOMAIN + ')?' # optional domain
|
||||||
'(\s+(?P<type_or_protocol>' + RE_NETWORK_TYPE + '|' + RE_NETWORK_PROTOCOL + '))?' + # optional type or protocol
|
+ '(\s+(?P<type_or_protocol>' + RE_NETWORK_TYPE + '|' + RE_NETWORK_PROTOCOL + '))?' # optional type or protocol
|
||||||
'\s*$')
|
+ '\s*$')
|
||||||
|
|
||||||
|
|
||||||
class NetworkRule(BaseRule):
|
class NetworkRule(BaseRule):
|
||||||
|
@ -27,17 +27,16 @@ access_keywords = ['r', 'w', 'rw', 'wr', 'read', 'write', 'readby', 'trace', 'tr
|
|||||||
|
|
||||||
# XXX joint_access_keyword and RE_ACCESS_KEYWORDS exactly as in PtraceRule - move to function!
|
# XXX joint_access_keyword and RE_ACCESS_KEYWORDS exactly as in PtraceRule - move to function!
|
||||||
joint_access_keyword = '\s*(' + '|'.join(access_keywords) + ')\s*'
|
joint_access_keyword = '\s*(' + '|'.join(access_keywords) + ')\s*'
|
||||||
RE_ACCESS_KEYWORDS = (joint_access_keyword + # one of the access_keyword or
|
RE_ACCESS_KEYWORDS = (joint_access_keyword # one of the access_keyword or
|
||||||
'|' + # or
|
+ '|' # or
|
||||||
'\(' + joint_access_keyword + '(' + '(\s|,)+' + joint_access_keyword + ')*' + '\)' # one or more access_keyword in (...)
|
+ '\(' + joint_access_keyword + '(' + '(\s|,)+' + joint_access_keyword + ')*' + '\)') # one or more access_keyword in (...)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
RE_PTRACE_DETAILS = re.compile(
|
RE_PTRACE_DETAILS = re.compile(
|
||||||
'^' +
|
'^'
|
||||||
'(\s+(?P<access>' + RE_ACCESS_KEYWORDS + '))?' + # optional access keyword(s)
|
+ '(\s+(?P<access>' + RE_ACCESS_KEYWORDS + '))?' # optional access keyword(s)
|
||||||
'(\s+(peer=' + RE_PROFILE_NAME % 'peer' + '))?' + # optional peer
|
+ '(\s+(peer=' + RE_PROFILE_NAME % 'peer' + '))?' # optional peer
|
||||||
'\s*$')
|
+ '\s*$')
|
||||||
|
|
||||||
|
|
||||||
class PtraceRule(BaseRule):
|
class PtraceRule(BaseRule):
|
||||||
|
@ -39,25 +39,25 @@ RE_SIGNAL_REALTIME = re.compile('^rtmin\+0*([0-9]|[12][0-9]|3[0-2])$') # rtmin+
|
|||||||
|
|
||||||
joint_access_keyword = '\s*(' + '|'.join(access_keywords) + ')\s*'
|
joint_access_keyword = '\s*(' + '|'.join(access_keywords) + ')\s*'
|
||||||
RE_ACCESS_KEYWORDS = (
|
RE_ACCESS_KEYWORDS = (
|
||||||
joint_access_keyword + # one of the access_keyword or
|
joint_access_keyword # one of the access_keyword or
|
||||||
'|' + # or
|
+ '|' # or
|
||||||
'\(' + joint_access_keyword + '(' + '(\s|,)+' + joint_access_keyword + ')*' + '\)' # one or more access_keyword in (...)
|
+ '\(' + joint_access_keyword + '(' + '(\s|,)+' + joint_access_keyword + ')*' + '\)' # one or more access_keyword in (...)
|
||||||
)
|
)
|
||||||
|
|
||||||
signal_keyword = '\s*([a-z0-9+]+|"[a-z0-9+]+")\s*' # don't check against the signal keyword list in the regex to allow a more helpful error message
|
signal_keyword = '\s*([a-z0-9+]+|"[a-z0-9+]+")\s*' # don't check against the signal keyword list in the regex to allow a more helpful error message
|
||||||
RE_SIGNAL_KEYWORDS = (
|
RE_SIGNAL_KEYWORDS = (
|
||||||
'set\s*=\s*' + signal_keyword + # one of the signal_keyword or
|
'set\s*=\s*' + signal_keyword # one of the signal_keyword or
|
||||||
'|' + # or
|
+ '|' # or
|
||||||
'set\s*=\s*\(' + signal_keyword + '(' + '(\s|,)+' + signal_keyword + ')*' + '\)' # one or more signal_keyword in (...)
|
+ 'set\s*=\s*\(' + signal_keyword + '(' + '(\s|,)+' + signal_keyword + ')*' + '\)' # one or more signal_keyword in (...)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
RE_SIGNAL_DETAILS = re.compile(
|
RE_SIGNAL_DETAILS = re.compile(
|
||||||
'^' +
|
'^'
|
||||||
'(\s+(?P<access>' + RE_ACCESS_KEYWORDS + '))?' + # optional access keyword(s)
|
+ '(\s+(?P<access>' + RE_ACCESS_KEYWORDS + '))?' # optional access keyword(s)
|
||||||
'(?P<signal>' + '(\s+(' + RE_SIGNAL_KEYWORDS + '))+' + ')?' + # optional signal set(s)
|
+ '(?P<signal>' + '(\s+(' + RE_SIGNAL_KEYWORDS + '))+' + ')?' # optional signal set(s)
|
||||||
'(\s+(peer=' + RE_PROFILE_NAME % 'peer' + '))?' + # optional peer
|
+ '(\s+(peer=' + RE_PROFILE_NAME % 'peer' + '))?' # optional peer
|
||||||
'\s*$')
|
+ '\s*$')
|
||||||
|
|
||||||
|
|
||||||
RE_FILTER_SET_1 = re.compile('set\s*=\s*\(([^)]*)\)')
|
RE_FILTER_SET_1 = re.compile('set\s*=\s*\(([^)]*)\)')
|
||||||
|
@ -607,8 +607,8 @@ EndSection
|
|||||||
started = False
|
started = False
|
||||||
|
|
||||||
# We need to wait for the xpra socket to exist before attaching
|
# We need to wait for the xpra socket to exist before attaching
|
||||||
fn = os.path.join(os.environ['HOME'], '.xpra', '%s-%s' %
|
fn = os.path.join(os.environ['HOME'], '.xpra', '%s-%s'
|
||||||
(socket.gethostname(), self.display.split(':')[1]))
|
% (socket.gethostname(), self.display.split(':')[1]))
|
||||||
for i in range(self.timeout * 2): # up to self.timeout seconds to start
|
for i in range(self.timeout * 2): # up to self.timeout seconds to start
|
||||||
if os.path.exists(fn):
|
if os.path.exists(fn):
|
||||||
debug("Found '%s'! Proceeding to attach" % fn)
|
debug("Found '%s'! Proceeding to attach" % fn)
|
||||||
|
@ -561,8 +561,8 @@ POLICYGROUPS_DIR="%s/templates"
|
|||||||
|
|
||||||
args = self.full_args
|
args = self.full_args
|
||||||
args.append('--list-templates')
|
args.append('--list-templates')
|
||||||
args.append('--include-templates-dir=%s' %
|
args.append('--include-templates-dir=%s'
|
||||||
os.path.join(self.test_include_dir, 'templates'))
|
% os.path.join(self.test_include_dir, 'templates'))
|
||||||
(self.options, self.args) = easyprof.parse_args(args)
|
(self.options, self.args) = easyprof.parse_args(args)
|
||||||
|
|
||||||
easyp = easyprof.AppArmorEasyProfile(None, self.options)
|
easyp = easyprof.AppArmorEasyProfile(None, self.options)
|
||||||
@ -580,8 +580,8 @@ POLICYGROUPS_DIR="%s/templates"
|
|||||||
args = self.full_args
|
args = self.full_args
|
||||||
args += ['--show-template',
|
args += ['--show-template',
|
||||||
'--template', f,
|
'--template', f,
|
||||||
'--include-templates-dir=%s' %
|
'--include-templates-dir=%s'
|
||||||
os.path.join(self.test_include_dir, 'templates')]
|
% os.path.join(self.test_include_dir, 'templates')]
|
||||||
(self.options, self.args) = easyprof.parse_args(args)
|
(self.options, self.args) = easyprof.parse_args(args)
|
||||||
easyp = easyprof.AppArmorEasyProfile(None, self.options)
|
easyp = easyprof.AppArmorEasyProfile(None, self.options)
|
||||||
|
|
||||||
@ -634,8 +634,8 @@ POLICYGROUPS_DIR="%s/templates"
|
|||||||
|
|
||||||
args = self.full_args
|
args = self.full_args
|
||||||
args.append('--list-policy-groups')
|
args.append('--list-policy-groups')
|
||||||
args.append('--include-policy-groups-dir=%s' %
|
args.append('--include-policy-groups-dir=%s'
|
||||||
os.path.join(self.test_include_dir, 'policygroups'))
|
% os.path.join(self.test_include_dir, 'policygroups'))
|
||||||
(self.options, self.args) = easyprof.parse_args(args)
|
(self.options, self.args) = easyprof.parse_args(args)
|
||||||
|
|
||||||
easyp = easyprof.AppArmorEasyProfile(None, self.options)
|
easyp = easyprof.AppArmorEasyProfile(None, self.options)
|
||||||
@ -653,8 +653,8 @@ POLICYGROUPS_DIR="%s/templates"
|
|||||||
args = self.full_args
|
args = self.full_args
|
||||||
args += ['--show-policy-group',
|
args += ['--show-policy-group',
|
||||||
'--policy-groups', os.path.basename(f),
|
'--policy-groups', os.path.basename(f),
|
||||||
'--include-policy-groups-dir=%s' %
|
'--include-policy-groups-dir=%s'
|
||||||
os.path.join(self.test_include_dir, 'policygroups')]
|
% os.path.join(self.test_include_dir, 'policygroups')]
|
||||||
(self.options, self.args) = easyprof.parse_args(args)
|
(self.options, self.args) = easyprof.parse_args(args)
|
||||||
easyp = easyprof.AppArmorEasyProfile(None, self.options)
|
easyp = easyprof.AppArmorEasyProfile(None, self.options)
|
||||||
|
|
||||||
|
@ -116,10 +116,10 @@ Feb 4 13:40:38 XPS-13-9370 kernel: [128552.880347] audit: type=1400 audit({epoc
|
|||||||
with NamedTemporaryFile("w+", prefix='test-aa-notify-', delete=False) as temp_file:
|
with NamedTemporaryFile("w+", prefix='test-aa-notify-', delete=False) as temp_file:
|
||||||
self.test_logfile = temp_file.name
|
self.test_logfile = temp_file.name
|
||||||
temp_file.write(
|
temp_file.write(
|
||||||
test_logfile_contents_999_days_old +
|
test_logfile_contents_999_days_old
|
||||||
test_logfile_contents_30_days_old +
|
+ test_logfile_contents_30_days_old
|
||||||
test_logfile_contents_unrelevant_entries +
|
+ test_logfile_contents_unrelevant_entries
|
||||||
test_logfile_contents_0_seconds_old
|
+ test_logfile_contents_0_seconds_old
|
||||||
)
|
)
|
||||||
|
|
||||||
def AATeardown(self):
|
def AATeardown(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user