debuggers.hg

view tools/python/xen/util/xsm/flask/flask.py @ 16559:5255eac35270

Implement legacy XML-RPC interface for ACM commands.

This patch implements a (non Xen-API) legacy XML-RPC interface for the
ACM commands and funnels the calls into code introduced by the Xen-API
support for ACM security management. Since some of the functionality
has changed, also the xm applications have changed. In particular the
following old commands have been removed along with some tools the
have become obsolete now:

- loadpolicy (included in: setpolicy)
- makepolicy (included in: setpolicy)
- cfgbootpolicy (included in: setpolicy)

and the following commands been introduced:

- setpolicy
- getpolicy
- resetpolicy

All tools have been adapted to work in Xen-API and legacy XML-RPC
mode. Both modes support the same functionality.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 05 09:44:20 2007 +0000 (2007-12-05)
parents 40d88481cd3f
children 94c6501c4ffe
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 1
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