2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 01:57:43 +00:00

load_include(): use include_dir_filelist()

load_include() used a custom os.listdir call instead of
include_dir_filelist() for directory includes, which means it also read
skippable files like *.rpmnew or README. (It seems nobody created a
README inside an included directory, otherwise we'd have seen a
bugreport ;-)

This patch changes load_include() to use include_dir_filelist(). This
function is used in some more places already and removes skippable files
from the file list.


Acked-by <timeout>
This commit is contained in:
Christian Boltz 2015-10-11 20:34:02 +02:00
parent 643ab7dde9
commit 75e3a212f1

View File

@ -4158,7 +4158,7 @@ def load_include(incname):
attach_profile_data(include, incdata) attach_profile_data(include, incdata)
#If the include is a directory means include all subfiles #If the include is a directory means include all subfiles
elif os.path.isdir(profile_dir + '/' + incfile): elif os.path.isdir(profile_dir + '/' + incfile):
load_includeslist += list(map(lambda x: incfile + '/' + x, os.listdir(profile_dir + '/' + incfile))) load_includeslist += include_dir_filelist(profile_dir, incfile)
else: else:
raise AppArmorException("Include file %s not found" % (profile_dir + '/' + incfile) ) raise AppArmorException("Include file %s not found" % (profile_dir + '/' + incfile) )