Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
 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