From: Stefan Berger Subject: [PATCH] [ACM/XEND] Fix case where resource label file does not exist Date: Thu, 30 Aug 2007 10:37:55 -0400 Message-ID: <1188484675.10813.3.camel@gsal-3.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-eWoihZzKFIyuw36l8BlQ" 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 Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --=-eWoihZzKFIyuw36l8BlQ Content-Type: text/plain Content-Transfer-Encoding: 7bit Fix the case where the resource label file does not exist but its contents would be needed for access control evaluations. Signed-off-by: Stefan Berger --=-eWoihZzKFIyuw36l8BlQ Content-Disposition: attachment; filename=security_no_labels_file_fix.diff Content-Type: text/x-patch; name=security_no_labels_file_fix.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/tools/python/xen/util/security.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/util/security.py +++ root/xen-unstable.hg/tools/python/xen/util/security.py @@ -934,7 +934,8 @@ def resources_compatible_with_vmlabel(xs access_control = dictio.dict_read("resources", res_label_filename) except: - return False + # No labeled resources -> must be compatible + return True return __resources_compatible_with_vmlabel(xspol, dominfo, vmlabel, access_control) finally: @@ -950,6 +951,7 @@ def __resources_compatible_with_vmlabel( given VM label. The access_control parameter provides a dictionary of the resource name to resource label mappings under which the evaluation should be done. + Call this only for a paused or running domain. """ def collect_labels(reslabels, s_label, polname): if len(s_label) != 3 or polname != s_label[1]: @@ -1204,7 +1206,7 @@ def change_acm_policy(bin_pol, del_array access_control = {} try: access_control = dictio.dict_read("resources", res_label_filename) - finally: + except: pass for key, labeldata in access_control.items(): if len(labeldata) == 2: --=-eWoihZzKFIyuw36l8BlQ 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 --=-eWoihZzKFIyuw36l8BlQ--