From 07d25b40fa2041439795595115a703e4f00a1a7d Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 13 Apr 2004 22:39:49 +0000 Subject: New Improved SELinux handling * default in constants.py * 'selinux' flag will key it on (if off by default) * turn on for selinux=1, off for selinux=0 * non-existence of selinuxfs will force off --- flags.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'flags.py') diff --git a/flags.py b/flags.py index 1b63454f3..d101a0176 100644 --- a/flags.py +++ b/flags.py @@ -12,6 +12,7 @@ # import os +from constants import * # A lot of effort, but it only allows a limited set of flags to be referenced class Flags: @@ -37,16 +38,26 @@ class Flags: self.__dict__['flags']['autostep'] = 0 self.__dict__['flags']['autoscreenshot'] = 0 self.__dict__['flags']['usevnc'] = 0 - self.__dict__['flags']['selinux'] = 0 + self.__dict__['flags']['selinux'] = SELINUX_DEFAULT # determine if selinux is enabled or not f = open("/proc/cmdline", "r") line = f.readline() f.close() - if os.path.exists("/selinux/load") and line.find(" selinux=0") == -1: - self.__dict__['flags']['selinux'] = 1 - + tokens = line.split() + for tok in tokens: + if tok == "selinux": + self.__dict__['flags']['selinux'] = 1 + elif tok == "selinux=0": + self.__dict__['flags']['selinux'] = 0 + elif tok == "selinux=1": + self.__dict__['flags']['selinux'] = 1 + + if not os.path.exists("/selinux/load"): + self.__dict__['flags']['selinux'] = 0 + + global flags flags = Flags() -- cgit