[apparmor] [patch] [02/38] check_and_split_list: optionally allow empty list
Christian Boltz
apparmor at cboltz.de
Fri Aug 12 20:44:14 UTC 2016
Hello,
$subject.
File permissions can be an empty list (if only exec permissions are
specified). This patch adds the optional allow_empty_list parameter so
that the function can handle this case.
[ 02-check_and_split_list-optionally-allow-empty-list.diff ]
--- utils/apparmor/rule/__init__.py 2016-01-07 20:41:32.718787664 +0100
+++ utils/apparmor/rule/__init__.py 2016-01-15 23:00:18.765000352 +0100
@@ -431,14 +431,14 @@
raise NotImplementedError("get_glob_ext is not available for this rule type!")
-def check_and_split_list(lst, allowed_keywords, all_obj, classname, keyword_name):
+def check_and_split_list(lst, allowed_keywords, all_obj, classname, keyword_name, allow_empty_list=False):
'''check if lst is all_obj or contains only items listed in allowed_keywords'''
if lst == all_obj:
return None, True, None
elif type_is_str(lst):
result_list = {lst}
- elif (type(lst) == list or type(lst) == tuple) and len(lst) > 0:
+ elif (type(lst) == list or type(lst) == tuple) and (len(lst) > 0 or allow_empty_list):
result_list = set(lst)
else:
raise AppArmorBug('Passed unknown %(type)s object to %(classname)s: %(unknown_object)s' %
Regards,
Christian Boltz
--
Eine Sig ist genauso überflüssig wie beim Einkaufen die Hose. In
irgendeinem abstrakten Sinne käme man natürlich ohne aus, wenn man
sein Portemonnaie in die Jeansjacke steckt. Aber es wäre mächtig
kühl, und man hätte das unangenehme Gefühl, daß untenrum irgendwas
Wichtiges fehlt. [Peter `g' Bouillon in dafu]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20160812/29d31068/attachment.pgp>
More information about the AppArmor
mailing list