mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-11 16:44:59 +00:00
sepolicy: initialize setools4
Signed-off-by: Jason Zaman <jason@perfinion.com>
This commit is contained in:
parent
c3176aeee8
commit
cf6bd6ae04
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
# Author: Dan Walsh <dwalsh@redhat.com>
|
# Author: Dan Walsh <dwalsh@redhat.com>
|
||||||
# Author: Ryan Hallisey <rhallise@redhat.com>
|
# Author: Ryan Hallisey <rhallise@redhat.com>
|
||||||
|
# Author: Jason Zaman <perfinion@gentoo.org>
|
||||||
|
|
||||||
from . import _policy
|
from . import _policy
|
||||||
import selinux
|
import selinux
|
||||||
|
import setools
|
||||||
import glob
|
import glob
|
||||||
import sepolgen.defaults as defaults
|
import sepolgen.defaults as defaults
|
||||||
import sepolgen.interfaces as interfaces
|
import sepolgen.interfaces as interfaces
|
||||||
@ -31,13 +33,13 @@ except:
|
|||||||
import __builtin__
|
import __builtin__
|
||||||
__builtin__.__dict__['_'] = unicode
|
__builtin__.__dict__['_'] = unicode
|
||||||
|
|
||||||
TYPE = _policy.TYPE
|
TYPE = 1
|
||||||
ROLE = _policy.ROLE
|
ROLE = 2
|
||||||
ATTRIBUTE = _policy.ATTRIBUTE
|
ATTRIBUTE = 3
|
||||||
PORT = _policy.PORT
|
PORT = 4
|
||||||
USER = _policy.USER
|
USER = 5
|
||||||
BOOLEAN = _policy.BOOLEAN
|
BOOLEAN = 6
|
||||||
TCLASS = _policy.CLASS
|
TCLASS = 7
|
||||||
|
|
||||||
ALLOW = 'allow'
|
ALLOW = 'allow'
|
||||||
AUDITALLOW = 'auditallow'
|
AUDITALLOW = 'auditallow'
|
||||||
@ -88,6 +90,9 @@ trans_file_type_str["-s"] = "s"
|
|||||||
trans_file_type_str["-l"] = "l"
|
trans_file_type_str["-l"] = "l"
|
||||||
trans_file_type_str["-p"] = "p"
|
trans_file_type_str["-p"] = "p"
|
||||||
|
|
||||||
|
# the setools policy handle
|
||||||
|
_pol = None
|
||||||
|
|
||||||
# cache the lookup results
|
# cache the lookup results
|
||||||
file_equiv_modified = None
|
file_equiv_modified = None
|
||||||
file_equiv = None
|
file_equiv = None
|
||||||
@ -145,6 +150,7 @@ def policy(policy_file):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
_policy.policy(policy_file)
|
_policy.policy(policy_file)
|
||||||
|
_pol = setools.SELinuxPolicy(policy_file)
|
||||||
except:
|
except:
|
||||||
raise ValueError(_("Failed to read %s policy file") % policy_file)
|
raise ValueError(_("Failed to read %s policy file") % policy_file)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user