ia64/xen-unstable

view tools/python/xen/util/xsm/flask/flask.py @ 17578:94c6501c4ffe

xend: Refactor security.on() call

I am refactoring the security.on() call to return the actual type of
the security module that is found to be enabled rather than just
returning True or False.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 06 10:05:52 2008 +0100 (2008-05-06)
parents 5255eac35270
children 5b133625223a
line source
1 import sys
2 from xen.lowlevel import flask
3 from xen.xend import sxp
5 #Functions exported through XML-RPC
6 xmlrpc_exports = [ ]
8 def err(msg):
9 """Raise XSM-Flask exception.
10 """
11 sys.stderr.write("XSM-FlaskError: " + msg + "\n")
12 raise XSMError(msg)
14 def on():
15 return 0 #xsconstants.XS_POLICY_FLASK
17 def ssidref2label(ssidref):
18 try:
19 return flask.flask_sid_to_context(ssidref)
20 except:
21 return ""
23 def label2ssidref(label, policy, type):
24 try:
25 return flask.flask_context_to_sid(label)
26 except:
27 return ""
29 def parse_security_label(security_label):
30 return security_label
32 def calc_dom_ssidref_from_info(info):
33 ssidref = label2ssidref(info['security_label'], "", "")
34 return ssidref
36 def set_security_label(policy, label):
37 return label
39 def ssidref2security_label(ssidref):
40 return ssidref2label(ssidref)
42 def get_security_label(self, xspol=None):
43 label = self.info.get('security_label', '')
44 return label