Skip to contentSkip to conversation

Some fixes

PATCH New Stefan Berger 1 participant 1 message Jul 12, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Some fixes

This patch adds some fixes to the submitted patches:

- Allow multiple ChineseWallTypes in a VM labels
- check for surfacing exceptions in the python code
- check for array sizes in the XML DOM in python
- properly display the labels when doing 'xm list --label' in xm's non-Xen-API mode
- rely on the security checking hooks in xend to check access to the block interface rather than doing this in xm.

---
 xen-unstable.hg/tools/python/xen/util/acmpolicy.py          |   81 ++++++------
 xen-unstable.hg/tools/python/xen/util/security.py           |   69 ----------
 xen-unstable.hg/tools/python/xen/xend/XendConfig.py         |    2 
 xen-unstable.hg/tools/python/xen/xm/main.py                 |   30 +---
 xen-unstable.hg/tools/security/policies/security_policy.xsd |    7 -
 5 files changed, 57 insertions(+), 132 deletions(-)
xen-unstable.hg/tools/security/policies/security_policy.xsd +1 -6
Index: root/xen-unstable.hg/tools/security/policies/security_policy.xsd
===================================================================
@@ -99,7 +99,7 @@
 			<xsd:sequence>
 				<xsd:element name="Name" type="NameWithFrom"></xsd:element>
 				<xsd:element ref="SimpleTypeEnforcementTypes" minOccurs="0" maxOccurs="unbounded" />
-				<xsd:element name="ChineseWallTypes" type="SingleChineseWallType" />
+				<xsd:element ref="ChineseWallTypes" minOccurs="0" maxOccurs="unbounded" />
 			</xsd:sequence>
 		</xsd:complexType>
 	</xsd:element>
@@ -143,9 +143,4 @@
 			<xsd:element maxOccurs="1" minOccurs="1" ref="Type" />
 		</xsd:sequence>
 	</xsd:complexType>
-	<xsd:complexType name="SingleChineseWallType">
-		<xsd:sequence>
-			<xsd:element maxOccurs="1" minOccurs="1" ref="Type" />
-		</xsd:sequence>
-	</xsd:complexType>
 </xsd:schema>
xen-unstable.hg/tools/python/xen/util/acmpolicy.py +47 -34

135 lines not on this page · raw message

xen-unstable.hg/tools/python/xen/xend/XendConfig.py +2 -0
Index: root/xen-unstable.hg/tools/python/xen/xend/XendConfig.py
===================================================================
@@ -636,6 +636,8 @@ class XendConfig(dict):
                 except ValueError, e:
                     raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e))
 
+        if not 'security' in cfg and sxp.child_value(sxp_cfg, 'security'):
+            cfg['security'] = sxp.child_value(sxp_cfg, 'security')
         if 'security' in cfg and not cfg.get('security_label'):
             secinfo = cfg['security']
             if isinstance(secinfo, list):
xen-unstable.hg/tools/python/xen/xm/main.py +7 -23
Index: root/xen-unstable.hg/tools/python/xen/xm/main.py
===================================================================
@@ -870,17 +870,13 @@ def parse_doms_info(info):
         'up_time'  : up_time
         }
 
-    if serverType != SERVER_XEN_API:
-        from xen.util import security
-        parsed_info['seclabel'] = security.get_security_printlabel(info)
-    else:
-        label = get_info('security_label', unicode, '')
-        tmp = label.split(":")
-        if len(tmp) != 3:
-            label = ""
-        else:
-            label = tmp[2]
-        parsed_info['seclabel'] = label
+    security_label = get_info('security_label', str, '')
+    tmp = security_label.split(":")
+    if len(tmp) != 3:
+        seclabel = ""
+    else:
+        seclabel = tmp[2]
+    parsed_info['seclabel'] = seclabel
 
     if serverType == SERVER_XEN_API:
         parsed_info['mem'] = get_info('memory_actual', int, 0) / 1024
@@ -2051,18 +2047,6 @@ def parse_block_configuration(args):
     if len(args) == 5:
         vbd.append(['backend', args[4]])
 
-    if serverType != SERVER_XEN_API:
-        # verify that policy permits attaching this resource
-        from xen.util import security
-    
-        if security.on():
-            dominfo = server.xend.domain(dom)
-            label = security.get_security_printlabel(dominfo)
-        else:
-            label = None
-
-        security.res_security_check(args[1], label)
-
     return (dom, vbd)
 
 
xen-unstable.hg/tools/python/xen/util/security.py +0 -69

75 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel