2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-03 07:45:50 +00:00

fix whitespace and indentation in several files

This commit is contained in:
Christian Boltz
2019-08-12 23:27:41 +02:00
parent 2e304f82fc
commit e246568819
7 changed files with 14 additions and 14 deletions

View File

@@ -398,7 +398,7 @@ def main():
# If a TTY then assume running in test mode and fix output width # If a TTY then assume running in test mode and fix output width
if not sys.stdout.isatty(): if not sys.stdout.isatty():
parser.formatter_class=lambda prog: argparse.HelpFormatter(prog, width=80) parser.formatter_class = lambda prog: argparse.HelpFormatter(prog, width=80)
args = parser.parse_args() args = parser.parse_args()

View File

@@ -64,7 +64,7 @@ def cmd_verbose():
filtered_profiles = filter_profiles(profiles, status) filtered_profiles = filter_profiles(profiles, status)
stdmsg("%d profiles are in %s mode." % (len(filtered_profiles), status)) stdmsg("%d profiles are in %s mode." % (len(filtered_profiles), status))
for item in filtered_profiles: for item in filtered_profiles:
stdmsg(" %s" % item) stdmsg(" %s" % item)
stdmsg("%d processes have profiles defined." % len(processes)) stdmsg("%d processes have profiles defined." % len(processes))
for status in ('enforce', 'complain', 'unconfined'): for status in ('enforce', 'complain', 'unconfined'):
@@ -197,7 +197,7 @@ def filter_processes(processes, status):
def find_apparmorfs(): def find_apparmorfs():
'''Finds AppArmor mount point''' '''Finds AppArmor mount point'''
for p in open("/proc/mounts","rb").readlines(): for p in open("/proc/mounts", "rb").readlines():
if p.split()[2].decode() == "securityfs" and \ if p.split()[2].decode() == "securityfs" and \
os.path.exists(os.path.join(p.split()[1].decode(), "apparmor")): os.path.exists(os.path.join(p.split()[1].decode(), "apparmor")):
return os.path.join(p.split()[1].decode(), "apparmor") return os.path.join(p.split()[1].decode(), "apparmor")

View File

@@ -822,8 +822,8 @@ def check_for_manifest_arg(option, opt_str, value, parser):
def check_for_manifest_arg_append(option, opt_str, value, parser): def check_for_manifest_arg_append(option, opt_str, value, parser):
'''Check for -m/--manifest with conflicting args (with append)''' '''Check for -m/--manifest with conflicting args (with append)'''
if parser.values.manifest: if parser.values.manifest:
raise optparse.OptionValueError("can't use --%s with --manifest " \ raise optparse.OptionValueError("can't use --%s with --manifest " \
"argument" % opt_str.lstrip('-')) "argument" % opt_str.lstrip('-'))
parser.values.ensure_value(option.dest, []).append(value) parser.values.ensure_value(option.dest, []).append(value)
def add_parser_policy_args(parser): def add_parser_policy_args(parser):
@@ -1216,7 +1216,7 @@ def verify_manifest(params, args=None):
tv_val = tv.split('=')[1] tv_val = tv.split('=')[1]
debug("Examining %s" % tv_val) debug("Examining %s" % tv_val)
if '..' in tv_val or pat.search(tv_val): if '..' in tv_val or pat.search(tv_val):
err_str += "\n%s" % tv err_str += "\n%s" % tv
if err_str: if err_str:
warn("Manifest definition is potentially unsafe%s" % err_str) warn("Manifest definition is potentially unsafe%s" % err_str)

View File

@@ -140,7 +140,7 @@ class BaseRule(object):
'''check if other_rule is covered by this rule object''' '''check if other_rule is covered by this rule object'''
if not type(other_rule) == type(self): if not type(other_rule) == type(self):
raise AppArmorBug('Passes %s instead of %s' % (str(other_rule),self.__class__.__name__)) raise AppArmorBug('Passes %s instead of %s' % (str(other_rule), self.__class__.__name__))
if check_allow_deny and self.deny != other_rule.deny: if check_allow_deny and self.deny != other_rule.deny:
return False return False
@@ -197,7 +197,7 @@ class BaseRule(object):
Note: this function checks against other_value.regex, which is not really correct, but avoids overly strict results when matching one regex against another Note: this function checks against other_value.regex, which is not really correct, but avoids overly strict results when matching one regex against another
''' '''
if type(other_value) == AARE: if type(other_value) == AARE:
other_value = other_value.regex other_value = other_value.regex
return self._is_covered_aare(self_value, self_all, other_value, other_all, cond_name) return self._is_covered_aare(self_value, self_all, other_value, other_all, cond_name)

View File

@@ -98,9 +98,9 @@ class DbusRule(BaseRule):
# not all combinations are allowed # not all combinations are allowed
if self.access and 'bind' in self.access and (self.path or self.interface or self.member or self.peername or self.peerlabel): if self.access and 'bind' in self.access and (self.path or self.interface or self.member or self.peername or self.peerlabel):
raise AppArmorException(_('dbus bind rules must not contain a path, interface, member or peer conditional')) raise AppArmorException(_('dbus bind rules must not contain a path, interface, member or peer conditional'))
elif self.access and 'eavesdrop' in self.access and (self.name or self.path or self.interface or self.member or self.peername or self.peerlabel): elif self.access and 'eavesdrop' in self.access and (self.name or self.path or self.interface or self.member or self.peername or self.peerlabel):
raise AppArmorException(_('dbus eavesdrop rules must not contain a name, path, interface, member or peer conditional')) raise AppArmorException(_('dbus eavesdrop rules must not contain a name, path, interface, member or peer conditional'))
elif self.access and self.name: elif self.access and self.name:
for msg in message_keywords: for msg in message_keywords:
if msg in self.access: if msg in self.access:

View File

@@ -401,7 +401,7 @@ class FileRule(BaseRule):
def glob(self): def glob(self):
'''Change path to next possible glob''' '''Change path to next possible glob'''
if self.all_paths: if self.all_paths:
return return
self.path = self.path.glob_path() self.path = self.path.glob_path()
self.raw_rule = None self.raw_rule = None
@@ -409,7 +409,7 @@ class FileRule(BaseRule):
def glob_ext(self): def glob_ext(self):
'''Change path to next possible glob with extension''' '''Change path to next possible glob with extension'''
if self.all_paths: if self.all_paths:
return return
self.path = self.path.glob_path_withext() self.path = self.path.glob_path_withext()
self.raw_rule = None self.raw_rule = None

View File

@@ -81,8 +81,8 @@ def parse_args(args=None, parser=None):
valid_xservers = ['xpra', 'xpra3d', 'xephyr'] valid_xservers = ['xpra', 'xpra3d', 'xephyr']
if my_opt.withx and my_opt.xserver.lower() not in valid_xservers: if my_opt.withx and my_opt.xserver.lower() not in valid_xservers:
error("Invalid server '%s'. Use one of: %s" % (my_opt.xserver, \ error("Invalid server '%s'. Use one of: %s" % (my_opt.xserver, \
", ".join(valid_xservers))) ", ".join(valid_xservers)))
if my_opt.withx: if my_opt.withx:
if my_opt.xephyr_geometry and my_opt.xserver.lower() != "xephyr": if my_opt.xephyr_geometry and my_opt.xserver.lower() != "xephyr":