def translate(raw, prepend=1): if prepend == 1: context="a:b:c:%s" % raw else: context=raw (rc, trans)=selinux.selinux_raw_to_trans_context(context) if rc != 0: return raw if prepend: trans = trans.strip("a:b:c") if trans == "": return raw else: return trans
def translate(raw, prepend=1): if prepend == 1: context = "a:b:c:%s" % raw else: context = raw (rc, trans) = selinux.selinux_raw_to_trans_context(context) if rc != 0: return raw if prepend: trans = trans.strip("a:b:c") if trans == "": return raw else: return trans
def translate(raw, prepend = 1): filler="a:b:c:" if prepend == 1: context = "%s%s" % (filler,raw) else: context = raw (rc, trans) = selinux.selinux_raw_to_trans_context(context) if rc != 0: return raw if prepend: trans = trans[len(filler):] if trans == "": return raw else: return trans
def format(self): # FIXME, what does selinux_raw_to_trans_context() do and why do we need it? (rc, trans) = selinux.selinux_raw_to_trans_context(str(self)) return trans
def get_trans_range(): range = get_range() (rc, tcon) = selinux.selinux_raw_to_trans_context("a:b:c:" + range) context_array = tcon.split(":") range = context_array[3] return range