From: Stefan Berger Subject: [PATCH] [XEND] [ACM] Some small fixes Date: Wed, 24 Oct 2007 19:40:53 -0400 Message-ID: <1193269253.7670.9.camel@941e-2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-yCOfd+S3uvwCvWbJPctr" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --=-yCOfd+S3uvwCvWbJPctr Content-Type: text/plain Content-Transfer-Encoding: 7bit Check that the policy is of type ACM and return an error if it is not. Reworked the way the label of a domain is read. Signed-off-by; Stefan Berger --=-yCOfd+S3uvwCvWbJPctr Content-Disposition: attachment; filename=xend_acm_small_fixes.diff Content-Type: text/x-vhdl; name=xend_acm_small_fixes.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit --- xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) Index: root/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py +++ root/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py @@ -656,6 +656,10 @@ def get_res_security_details(resource): log.info("Resource label for "+resource+" not in file, using DEFAULT.") return default_security_details() + if policytype != xsconstants.ACM_POLICY_ID: + raise VmError("Unknown policy type '%s in label for resource '%s'" % + (policytype, resource)) + # is this resource label for the running policy? if policy == active_policy: ssidref = label2ssidref(label, policy, 'res') @@ -1373,11 +1377,9 @@ def get_security_label(self, xspol=None) from xen.xend.XendXSPolicyAdmin import XSPolicyAdminInstance xspol = XSPolicyAdminInstance().get_loaded_policy() - if domid == 0: + label = "" if xspol: label = xspol.policy_get_domain_label_formatted(domid) - else: - label = "" - else: - label = self.info.get('security_label', '') + if domid != 0: + label = self.info.get('security_label', label) return label --=-yCOfd+S3uvwCvWbJPctr Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-yCOfd+S3uvwCvWbJPctr--