ia64/xen-unstable

view tools/python/xen/util/xsm/flask/flask.py @ 18590:1f85f7b216b3

flask: Fix a problem in xend code when starting a guest with XSM/Flask enabled.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Oct 08 10:03:47 2008 +0100 (2008-10-08)
parents 5b133625223a
children
line source
1 import sys
2 from xen.lowlevel import flask
3 from xen.util import xsconstants
4 from xen.xend import sxp
6 #Functions exported through XML-RPC
7 xmlrpc_exports = [ ]
9 def err(msg):
10 """Raise XSM-Flask exception.
11 """
12 sys.stderr.write("XSM-FlaskError: " + msg + "\n")
13 raise XSMError(msg)
15 def on():
16 return xsconstants.XS_POLICY_FLASK
18 def ssidref2label(ssidref):
19 try:
20 return flask.flask_sid_to_context(ssidref)
21 except:
22 return ""
24 def label2ssidref(label, policy, type):
25 try:
26 return flask.flask_context_to_sid(label)
27 except:
28 return ""
30 def parse_security_label(security_label):
31 return security_label
33 def calc_dom_ssidref_from_info(info):
34 ssidref = label2ssidref(info['security_label'], "", "")
35 return ssidref
37 def set_security_label(policy, label):
38 if label:
39 return label
40 else:
41 return ""
43 def ssidref2security_label(ssidref):
44 label = ssidref2label(ssidref)
45 return label
47 def get_security_label(self, xspol=None):
48 label = self.info['security_label']
49 return label