diff --git a/policycoreutils/sepolicy/sepolicy/__init__.py b/policycoreutils/sepolicy/sepolicy/__init__.py index 4d9d6adb..f24750a1 100644 --- a/policycoreutils/sepolicy/sepolicy/__init__.py +++ b/policycoreutils/sepolicy/sepolicy/__init__.py @@ -2,9 +2,11 @@ # Author: Dan Walsh # Author: Ryan Hallisey +# Author: Jason Zaman from . import _policy import selinux +import setools import glob import sepolgen.defaults as defaults import sepolgen.interfaces as interfaces @@ -31,13 +33,13 @@ except: import __builtin__ __builtin__.__dict__['_'] = unicode -TYPE = _policy.TYPE -ROLE = _policy.ROLE -ATTRIBUTE = _policy.ATTRIBUTE -PORT = _policy.PORT -USER = _policy.USER -BOOLEAN = _policy.BOOLEAN -TCLASS = _policy.CLASS +TYPE = 1 +ROLE = 2 +ATTRIBUTE = 3 +PORT = 4 +USER = 5 +BOOLEAN = 6 +TCLASS = 7 ALLOW = 'allow' AUDITALLOW = 'auditallow' @@ -88,6 +90,9 @@ trans_file_type_str["-s"] = "s" trans_file_type_str["-l"] = "l" trans_file_type_str["-p"] = "p" +# the setools policy handle +_pol = None + # cache the lookup results file_equiv_modified = None file_equiv = None @@ -145,6 +150,7 @@ def policy(policy_file): try: _policy.policy(policy_file) + _pol = setools.SELinuxPolicy(policy_file) except: raise ValueError(_("Failed to read %s policy file") % policy_file)