2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

rename vague 'dir' variables (thanks to cboltz)

This commit is contained in:
Jamie Strandboge
2017-12-21 14:36:35 -06:00
parent 9bbef8e307
commit a7e79ffa3d

View File

@@ -2304,10 +2304,10 @@ def parse_profile_data(data, file, do_include):
filelist[file]['include'][include_name] = True filelist[file]['include'][include_name] = True
# If include is a directory # If include is a directory
if include_name.startswith('/'): if include_name.startswith('/'):
dir = include_name include_name_abs = include_name
else: else:
dir = profile_dir + '/' + include_name include_name_abs = profile_dir + '/' + include_name
if os.path.isdir(dir): if os.path.isdir(include_name_abs):
for file_name in include_dir_filelist(profile_dir, include_name): for file_name in include_dir_filelist(profile_dir, include_name):
if not include.get(file_name, False): if not include.get(file_name, False):
load_include(file_name) load_include(file_name)
@@ -3350,10 +3350,10 @@ def is_known_rule(profile, rule_type, rule_obj):
checked.append(incname) checked.append(incname)
if incname.startswith('/'): if incname.startswith('/'):
dir = incname incname_abs = incname
else: else:
dir = profile_dir + '/' + incname incname_abs = profile_dir + '/' + incname
if os.path.isdir(dir): if os.path.isdir(incname_abs):
includelist += include_dir_filelist(profile_dir, incname) includelist += include_dir_filelist(profile_dir, incname)
else: else:
if include[incname][incname].get(rule_type, False): if include[incname][incname].get(rule_type, False):
@@ -3382,10 +3382,10 @@ def get_file_perms(profile, path, audit, deny):
checked.append(incname) checked.append(incname)
if incname.startswith('/'): if incname.startswith('/'):
dir = incname incname_abs = incname
else: else:
dir = profile_dir + '/' + incname incname_abs = profile_dir + '/' + incname
if os.path.isdir(dir): if os.path.isdir(incname_abs):
includelist += include_dir_filelist(profile_dir, incname) includelist += include_dir_filelist(profile_dir, incname)
else: else:
incperms = include[incname][incname]['file'].get_perms_for_path(path, audit, deny) incperms = include[incname][incname]['file'].get_perms_for_path(path, audit, deny)
@@ -3482,14 +3482,14 @@ def include_dir_filelist(profile_dir, include_name):
''' '''
files = [] files = []
if include_name.startswith('/'): if include_name.startswith('/'):
dir = include_name include_name_abs = include_name
else: else:
dir = profile_dir + '/' + include_name include_name_abs = profile_dir + '/' + include_name
for path in os.listdir(dir): for path in os.listdir(include_name_abs):
path = path.strip() path = path.strip()
if is_skippable_file(path): if is_skippable_file(path):
continue continue
if os.path.isfile(dir + '/' + path): if os.path.isfile(include_name_abs + '/' + path):
file_name = include_name + '/' + path file_name = include_name + '/' + path
# strip off profile_dir for non-absolute paths # strip off profile_dir for non-absolute paths
if not include_name.startswith('/'): if not include_name.startswith('/'):