try:
- import selinux
+ import portage_selinux as selinux
except OSError, e:
writemsg("!!! SELinux not loaded: %s\n" % str(e), noiselevel=-1)
del e
self._selinux_enabled = 0
if "selinux" in self["USE"].split():
if "selinux" in globals():
- if hasattr(selinux, "enabled"):
- self._selinux_enabled = selinux.enabled
- else:
+ if selinux.is_selinux_enabled() == 1:
self._selinux_enabled = 1
+ else:
+ self._selinux_enabled = 0
else:
writemsg("!!! SELinux module not found. Please verify that it was installed.\n",
noiselevel=-1)
--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+import selinux
+from selinux import is_selinux_enabled
+from selinux_aux import setexec, secure_symlink, secure_rename, \
+ secure_copy, secure_mkdir
+
+def getcontext():
+ return selinux.getcon()[1]
+
+def get_sid(filename):
+ return selinux.getfilecon(filename)[1]
+
+def get_lsid(filename):
+ return selinux.lgetfilecon(filename)[1]